Socket
Socket
Sign inDemoInstall

@pelagiccreatures/sargasso

Package Overview
Dependencies
7
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.5 to 2.4.0

example/observable-client.html

2

dist/sargasso.iife.min.js

@@ -1,2 +0,2 @@

var SargassoModule=function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r="object"==typeof t&&t&&t.Object===Object&&t,s=r,n="object"==typeof self&&self&&self.Object===Object&&self,i=s||n||Function("return this")(),o=i.Symbol;var a=function arrayMap$1(e,t){for(var r=-1,s=null==e?0:e.length,n=Array(s);++r<s;)n[r]=t(e[r],r,e);return n},c=Array.isArray,l=o,h=Object.prototype,u=h.hasOwnProperty,d=h.toString,p=l?l.toStringTag:void 0;var f=function getRawTag$1(e){var t=u.call(e,p),r=e[p];try{e[p]=void 0;var s=!0}catch(e){}var n=d.call(e);return s&&(t?e[p]=r:delete e[p]),n},b=Object.prototype.toString;var g=f,v=function objectToString$1(e){return b.call(e)},m=o?o.toStringTag:void 0;var w=function baseGetTag$5(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":m&&m in Object(e)?g(e):v(e)};var y=function isObjectLike$5(e){return null!=e&&"object"==typeof e},_=w,O=y;var x=function isSymbol$2(e){return"symbol"==typeof e||O(e)&&"[object Symbol]"==_(e)},j=a,S=c,E=x,k=o?o.prototype:void 0,A=k?k.toString:void 0;var C=function baseToString$1(e){if("string"==typeof e)return e;if(S(e))return j(e,baseToString$1)+"";if(E(e))return A?A.call(e):"";var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t},D=C;var $=function toString$4(e){return null==e?"":D(e)};var M=function baseSlice$1(e,t,r){var s=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(r=r>n?n:r)<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(n);++s<n;)i[s]=e[s+t];return i};var P=function castSlice$1(e,t,r){var s=e.length;return r=void 0===r?s:r,!t&&r>=s?e:M(e,t,r)},T=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var F=function hasUnicode$2(e){return T.test(e)};var L=function asciiToArray$1(e){return e.split("")},R="\\ud800-\\udfff",z="["+R+"]",W="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",H="\\ud83c[\\udffb-\\udfff]",V="[^"+R+"]",I="(?:\\ud83c[\\udde6-\\uddff]){2}",N="[\\ud800-\\udbff][\\udc00-\\udfff]",q="(?:"+W+"|"+H+")"+"?",U="[\\ufe0e\\ufe0f]?",B=U+q+("(?:\\u200d(?:"+[V,I,N].join("|")+")"+U+q+")*"),Q="(?:"+[V+W+"?",W,I,N,z].join("|")+")",G=RegExp(H+"(?="+H+")|"+Q+B,"g");var Z=L,J=F,Y=function unicodeToArray$1(e){return e.match(G)||[]};var K=P,X=F,ee=function stringToArray$1(e){return J(e)?Y(e):Z(e)},te=$;var re=function createCaseFirst$1(e){return function(t){t=te(t);var r=X(t)?ee(t):void 0,s=r?r[0]:t.charAt(0),n=r?K(r,1).join(""):t.slice(1);return s[e]()+n}}("toUpperCase"),se=$,ne=re;var ie=function capitalize$1(e){return ne(se(e).toLowerCase())};var oe=function arrayReduce$1(e,t,r,s){var n=-1,i=null==e?0:e.length;for(s&&i&&(r=e[++n]);++n<i;)r=t(r,e[n],n,e);return r};var ae=function basePropertyOf$1(e){return function(t){return null==e?void 0:e[t]}}({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ce=$,le=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,he=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var ue=function deburr$1(e){return(e=ce(e))&&e.replace(le,ae).replace(he,"")},de=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var pe=function asciiWords$1(e){return e.match(de)||[]},fe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var be=function hasUnicodeWord$1(e){return fe.test(e)},ge="\\ud800-\\udfff",ve="\\u2700-\\u27bf",me="a-z\\xdf-\\xf6\\xf8-\\xff",we="A-Z\\xc0-\\xd6\\xd8-\\xde",ye="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",_e="["+ye+"]",Oe="\\d+",xe="["+ve+"]",je="["+me+"]",Se="[^"+ge+ye+Oe+ve+me+we+"]",Ee="(?:\\ud83c[\\udde6-\\uddff]){2}",ke="[\\ud800-\\udbff][\\udc00-\\udfff]",Ae="["+we+"]",Ce="(?:"+je+"|"+Se+")",De="(?:"+Ae+"|"+Se+")",$e="(?:['’](?:d|ll|m|re|s|t|ve))?",Me="(?:['’](?:D|LL|M|RE|S|T|VE))?",Pe="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",Te="[\\ufe0e\\ufe0f]?",Fe=Te+Pe+("(?:\\u200d(?:"+["[^"+ge+"]",Ee,ke].join("|")+")"+Te+Pe+")*"),Le="(?:"+[xe,Ee,ke].join("|")+")"+Fe,Re=RegExp([Ae+"?"+je+"+"+$e+"(?="+[_e,Ae,"$"].join("|")+")",De+"+"+Me+"(?="+[_e,Ae+Ce,"$"].join("|")+")",Ae+"?"+Ce+"+"+$e,Ae+"+"+Me,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Oe,Le].join("|"),"g");var ze=pe,We=be,He=$,Ve=function unicodeWords$1(e){return e.match(Re)||[]};var Ie=oe,Ne=ue,qe=function words$1(e,t,r){return e=He(e),void 0===(t=r?void 0:t)?We(e)?Ve(e):ze(e):e.match(t)||[]},Ue=RegExp("['’]","g");var Be=function createCompounder$2(e){return function(t){return Ie(qe(Ne(t).replace(Ue,"")),e,"")}},Qe=ie,Ge=Be((function(e,t,r){return t=t.toLowerCase(),e+(r?Qe(t):t)}));const Ze={},setValidator=(e,t)=>{Ze[e]=t};setValidator("isDefined",(e=>void 0!==e)),setValidator("isUnDefined",(e=>void 0===e)),setValidator("isNull",(e=>null===e)),setValidator("isElement",(e=>e&&(e instanceof Element||e instanceof Window))),setValidator("isEventTarget",(e=>e&&e instanceof EventTarget)),setValidator("isString",(e=>e&&("string"==typeof e||e instanceof String))),setValidator("isArray",(e=>e&&e instanceof Array)),setValidator("notEmpty",(e=>e instanceof Array?0!==e.length:""!==e)),setValidator("isEmpty",(e=>void 0===e||!e||(e instanceof Array?0===e.length:""===e))),setValidator("isObject",(e=>e&&e instanceof Object)),setValidator("isFunction",(e=>e&&"function"==typeof e));const validate=(e,t,r)=>{const s=r.map((e=>{if(e instanceof Array){return-1!==e.map((e=>Ze[e]&&Ze[e](t))).indexOf(!0)}return Ze[e]&&Ze[e](t)}));if(-1!==s.indexOf(!1))throw new Error("call to "+e+" invalid value: "+t+" "+r,0+s)},Je=new WeakMap,hasClass=(e,t)=>(validate("hasClass element",e,["isDefined","isElement"]),validate("hasClass cssClass",t,["isDefined","notEmpty","isString"]),e.classList.contains(t)),isVisible=e=>(validate("isVisible element",e,["isDefined","isElement"]),!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)),setMetaData=(e,t,r)=>{validate("setMetaData element",e,["isDefined","isElement"]),validate("setMetaData k",t,["isDefined","isString"]),validate("setMetaData v",r,[["isUnDefined","isNull","isString","isObject"]]);const s=Je.get(e)||{};r?s[t]=r:delete s[t],Je.set(e,s)},getMetaData=(e,t)=>{validate("getMetaData element",e,["isDefined","isElement"]),validate("getMetaData k",t,["isDefined","isString"]);const r=Je.get(e)||{};return t?r[t]:r},on=function(e,t,r,s,n,i,o){"function"==typeof s&&(o=i,i=n,n=s,s=void 0),validate("on uid",e,["isDefined","notEmpty"]),validate("on container",t,["isDefined","isEventTarget"]),validate("on events",r,["isDefined","isString"]),validate("on fn",n,["isDefined","isFunction"]),validate("on selector",s,[["isEmpty","isString"]]);const a="on:"+e+"-"+r+"-"+s;if(getMetaData(t,a))return void console.error("Error: Sargasso utils.on: duplicate event handler specification. %o %s",t,a);const c={uid:e,events:r,selector:s||void 0,fn:i=>{o&&off(e,t,r,s),s?Array.from(t.querySelectorAll(s)).forEach((e=>{(i.target===e||e.contains(i.target))&&n(i,e)})):n(i)},options:i||!1};setMetaData(t,a,c),r.split(/[\s,]+/).forEach((e=>{t.addEventListener(e.trim(),c.fn,c.options)}))},off=function(e,t,r,s){validate("off uid",e,["isDefined","notEmpty"]),validate("off container",t,["isDefined","isEventTarget"]),validate("off events",r,["isDefined","isString"]),validate("off selector",s,[["isEmpty","isString"]]);const n="on:"+e+"-"+r+"-"+s,i=getMetaData(t,n);i&&(r.split(/[\s,]+/).forEach((e=>{t.removeEventListener(e.trim(),i.fn,i.options)})),setMetaData(t,n))},Ye={hasClass:hasClass,addClass:(e,t)=>{validate("addClass element",e,["isDefined","isElement"]),validate("addClass addClasses",t,["isDefined","notEmpty",["isString","isArray"]]),Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach((t=>{t=t.trim(),hasClass(e,t)||e.classList.add(t)}))},removeClass:(e,t)=>{validate("removeClass element",e,["isDefined","isElement"]),validate("removeClass removeClasses",t,["isDefined","notEmpty",["isString","isArray"]]),Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach((t=>{t=t.trim(),hasClass(e,t)&&e.classList.remove(t)}))},isVisible:isVisible,inViewPort:(e,t=window)=>{validate("inViewPort element",e,["isDefined","isElement"]);const r=e.getBoundingClientRect(),s=isVisible(e),n=r.bottom<0;let i;return i=t.self===window?r.top>(window.innerHeight||document.documentElement.clientHeight):r.top>t.clientHeight,s&&!i&&!n},setCSS:(e,t)=>{validate("css element",e,["isDefined","isElement"]),validate("css css",t,["isDefined",["isObject"]]);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const s=Ge(r);e.style[s]=null!==t[r]?t[r]:null}},setMetaData:setMetaData,getMetaData:getMetaData,on:on,off:off,once:function(e,t,r,s,n,i){"function"==typeof s&&(i=n,n=s,s=void 0),on(e,t,r,s,n,i,!0)},offAll:function(e){validate("offAll container",e,["isDefined","isEventTarget"]);const t=Je.get(e)||{},r=[];for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&e.match(/^on:/)&&r.push(e);r.forEach((r=>{off(t[r].uid,e,t[r].events,t[r].selector)}))}};var Ke=function isObject$4(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Xe=i,et=/\s/;var tt=function trimmedEndIndex$1(e){for(var t=e.length;t--&&et.test(e.charAt(t)););return t},rt=/^\s+/;var st=function baseTrim$1(e){return e?e.slice(0,tt(e)+1).replace(rt,""):e},nt=Ke,it=x,ot=/^[-+]0x[0-9a-f]+$/i,at=/^0b[01]+$/i,ct=/^0o[0-7]+$/i,lt=parseInt;var ht=Ke,now=function(){return Xe.Date.now()},ut=function toNumber$1(e){if("number"==typeof e)return e;if(it(e))return NaN;if(nt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=nt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=st(e);var r=at.test(e);return r||ct.test(e)?lt(e.slice(2),r?2:8):ot.test(e)?NaN:+e},dt=Math.max,pt=Math.min;var ft=function debounce(e,t,r){var s,n,i,o,a,c,l=0,h=!1,u=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function invokeFunc(t){var r=s,i=n;return s=n=void 0,l=t,o=e.apply(i,r)}function leadingEdge(e){return l=e,a=setTimeout(timerExpired,t),h?invokeFunc(e):o}function shouldInvoke(e){var r=e-c;return void 0===c||r>=t||r<0||u&&e-l>=i}function timerExpired(){var e=now();if(shouldInvoke(e))return trailingEdge(e);a=setTimeout(timerExpired,function remainingWait(e){var r=t-(e-c);return u?pt(r,i-(e-l)):r}(e))}function trailingEdge(e){return a=void 0,d&&s?invokeFunc(e):(s=n=void 0,o)}function debounced(){var e=now(),r=shouldInvoke(e);if(s=arguments,n=this,c=e,r){if(void 0===a)return leadingEdge(c);if(u)return clearTimeout(a),a=setTimeout(timerExpired,t),invokeFunc(c)}return void 0===a&&(a=setTimeout(timerExpired,t)),o}return t=ut(t)||0,ht(r)&&(h=!!r.leading,i=(u="maxWait"in r)?dt(ut(r.maxWait)||0,t):i,d="trailing"in r?!!r.trailing:d),debounced.cancel=function cancel(){void 0!==a&&clearTimeout(a),l=0,s=c=n=a=void 0},debounced.flush=function flush(){return void 0===a?o:trailingEdge(now())},debounced};var bt=function listCacheClear$1(){this.__data__=[],this.size=0};var gt=function eq$2(e,t){return e===t||e!=e&&t!=t},vt=gt;var mt=function assocIndexOf$4(e,t){for(var r=e.length;r--;)if(vt(e[r][0],t))return r;return-1},wt=mt,yt=Array.prototype.splice;var _t=mt;var Ot=mt;var xt=mt;var jt=bt,St=function listCacheDelete$1(e){var t=this.__data__,r=wt(t,e);return!(r<0)&&(r==t.length-1?t.pop():yt.call(t,r,1),--this.size,!0)},Et=function listCacheGet$1(e){var t=this.__data__,r=_t(t,e);return r<0?void 0:t[r][1]},kt=function listCacheHas$1(e){return Ot(this.__data__,e)>-1},At=function listCacheSet$1(e,t){var r=this.__data__,s=xt(r,e);return s<0?(++this.size,r.push([e,t])):r[s][1]=t,this};function ListCache$4(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}ListCache$4.prototype.clear=jt,ListCache$4.prototype.delete=St,ListCache$4.prototype.get=Et,ListCache$4.prototype.has=kt,ListCache$4.prototype.set=At;var Ct=ListCache$4,Dt=Ct;var $t=function stackClear$1(){this.__data__=new Dt,this.size=0};var Mt=function stackDelete$1(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var Pt=function stackGet$1(e){return this.__data__.get(e)};var Tt=function stackHas$1(e){return this.__data__.has(e)},Ft=w,Lt=Ke;var Rt,zt=function isFunction$2(e){if(!Lt(e))return!1;var t=Ft(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Wt=i["__core-js_shared__"],Ht=(Rt=/[^.]+$/.exec(Wt&&Wt.keys&&Wt.keys.IE_PROTO||""))?"Symbol(src)_1."+Rt:"";var Vt=function isMasked$1(e){return!!Ht&&Ht in e},It=Function.prototype.toString;var Nt=function toSource$2(e){if(null!=e){try{return It.call(e)}catch(e){}try{return e+""}catch(e){}}return""},qt=zt,Ut=Vt,Bt=Ke,Qt=Nt,Gt=/^\[object .+?Constructor\]$/,Zt=Function.prototype,Jt=Object.prototype,Yt=Zt.toString,Kt=Jt.hasOwnProperty,Xt=RegExp("^"+Yt.call(Kt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var er=function baseIsNative$1(e){return!(!Bt(e)||Ut(e))&&(qt(e)?Xt:Gt).test(Qt(e))},tr=function getValue$1(e,t){return null==e?void 0:e[t]};var rr=function getNative$6(e,t){var r=tr(e,t);return er(r)?r:void 0},sr=rr(i,"Map"),nr=rr(Object,"create"),ir=nr;var or=function hashClear$1(){this.__data__=ir?ir(null):{},this.size=0};var ar=function hashDelete$1(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},cr=nr,lr=Object.prototype.hasOwnProperty;var hr=function hashGet$1(e){var t=this.__data__;if(cr){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return lr.call(t,e)?t[e]:void 0},ur=nr,dr=Object.prototype.hasOwnProperty;var pr=nr;var fr=or,br=ar,gr=hr,vr=function hashHas$1(e){var t=this.__data__;return ur?void 0!==t[e]:dr.call(t,e)},mr=function hashSet$1(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=pr&&void 0===t?"__lodash_hash_undefined__":t,this};function Hash$1(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}Hash$1.prototype.clear=fr,Hash$1.prototype.delete=br,Hash$1.prototype.get=gr,Hash$1.prototype.has=vr,Hash$1.prototype.set=mr;var wr=Hash$1,yr=Ct,_r=sr;var Or=function isKeyable$1(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var xr=function getMapData$4(e,t){var r=e.__data__;return Or(t)?r["string"==typeof t?"string":"hash"]:r.map},jr=xr;var Sr=xr;var Er=xr;var kr=xr;var Ar=function mapCacheClear$1(){this.size=0,this.__data__={hash:new wr,map:new(_r||yr),string:new wr}},Cr=function mapCacheDelete$1(e){var t=jr(this,e).delete(e);return this.size-=t?1:0,t},Dr=function mapCacheGet$1(e){return Sr(this,e).get(e)},$r=function mapCacheHas$1(e){return Er(this,e).has(e)},Mr=function mapCacheSet$1(e,t){var r=kr(this,e),s=r.size;return r.set(e,t),this.size+=r.size==s?0:1,this};function MapCache$2(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}MapCache$2.prototype.clear=Ar,MapCache$2.prototype.delete=Cr,MapCache$2.prototype.get=Dr,MapCache$2.prototype.has=$r,MapCache$2.prototype.set=Mr;var Pr=MapCache$2,Tr=Ct,Fr=sr,Lr=Pr;var Rr=Ct,zr=$t,Wr=Mt,Hr=Pt,Vr=Tt,Ir=function stackSet$1(e,t){var r=this.__data__;if(r instanceof Tr){var s=r.__data__;if(!Fr||s.length<199)return s.push([e,t]),this.size=++r.size,this;r=this.__data__=new Lr(s)}return r.set(e,t),this.size=r.size,this};function Stack$1(e){var t=this.__data__=new Rr(e);this.size=t.size}Stack$1.prototype.clear=zr,Stack$1.prototype.delete=Wr,Stack$1.prototype.get=Hr,Stack$1.prototype.has=Vr,Stack$1.prototype.set=Ir;var Nr=Pr,qr=function setCacheAdd$1(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Ur=function setCacheHas$1(e){return this.__data__.has(e)};function SetCache$1(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Nr;++t<r;)this.add(e[t])}SetCache$1.prototype.add=SetCache$1.prototype.push=qr,SetCache$1.prototype.has=Ur;i.Uint8Array;var Br=o?o.prototype:void 0;Br&&Br.valueOf;Object.prototype.propertyIsEnumerable,Object.getOwnPropertySymbols;var Qr=w,Gr=y;var Zr=function baseIsArguments$1(e){return Gr(e)&&"[object Arguments]"==Qr(e)},Jr=y,Yr=Object.prototype,Kr=Yr.hasOwnProperty,Xr=Yr.propertyIsEnumerable,es=(Zr(function(){return arguments}()),{});var ts=function stubFalse(){return!1};!function(e,t){var r=i,s=ts,n=t&&!t.nodeType&&t,o=n&&e&&!e.nodeType&&e,a=o&&o.exports===n?r.Buffer:void 0,c=(a?a.isBuffer:void 0)||s;e.exports=c}({get exports(){return es},set exports(e){es=e}},es);var rs=function isLength$2(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},ss=w,ns=rs,is=y,os={};os["[object Float32Array]"]=os["[object Float64Array]"]=os["[object Int8Array]"]=os["[object Int16Array]"]=os["[object Int32Array]"]=os["[object Uint8Array]"]=os["[object Uint8ClampedArray]"]=os["[object Uint16Array]"]=os["[object Uint32Array]"]=!0,os["[object Arguments]"]=os["[object Array]"]=os["[object ArrayBuffer]"]=os["[object Boolean]"]=os["[object DataView]"]=os["[object Date]"]=os["[object Error]"]=os["[object Function]"]=os["[object Map]"]=os["[object Number]"]=os["[object Object]"]=os["[object RegExp]"]=os["[object Set]"]=os["[object String]"]=os["[object WeakMap]"]=!1;var as=function baseIsTypedArray$1(e){return is(e)&&ns(e.length)&&!!os[ss(e)]};var cs=function baseUnary$1(e){return function(t){return e(t)}},ls={};!function(e,t){var s=r,n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n&&s.process,a=function(){try{var e=i&&i.require&&i.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a}({get exports(){return ls},set exports(e){ls=e}},ls);var hs=as,us=cs,ds=ls&&ls.isTypedArray;ds&&us(ds),Object.prototype.hasOwnProperty;Object.prototype;(function overArg$1(e,t){return function(r){return e(t(r))}})(Object.keys,Object),Object.prototype.hasOwnProperty;Object.prototype.hasOwnProperty;var ps=rr(i,"DataView"),fs=sr,bs=rr(i,"Promise"),gs=rr(i,"Set"),vs=rr(i,"WeakMap"),ms=w,ws=Nt,ys="[object Map]",_s="[object Promise]",Os="[object Set]",xs="[object WeakMap]",js="[object DataView]",Ss=ws(ps),Es=ws(fs),ks=ws(bs),As=ws(gs),Cs=ws(vs),Ds=ms;(ps&&Ds(new ps(new ArrayBuffer(1)))!=js||fs&&Ds(new fs)!=ys||bs&&Ds(bs.resolve())!=_s||gs&&Ds(new gs)!=Os||vs&&Ds(new vs)!=xs)&&(Ds=function(e){var t=ms(e),r="[object Object]"==t?e.constructor:void 0,s=r?ws(r):"";if(s)switch(s){case Ss:return js;case Es:return ys;case ks:return _s;case As:return Os;case Cs:return xs}return t});Object.prototype.hasOwnProperty;var $s,Ms,Ps,Ts,Fs,Ls,Rs={},zs={get exports(){return Rs},set exports(e){Rs=e}},Ws=($s=[],Ms=[],Ps=[],Ts=[],Fs=null,Ls=function(e,t,r,s){var n=r||null,i=s||[{target:e,property:""}];$s.push(i),e instanceof Array&&(e.hasOwnProperty("__length")?e.__length=e.length:Object.defineProperty(e,"__length",{enumerable:!1,value:e.length,writable:!0}));var o=[],_getPath=function(e,t,r){for(var s="",n=null,o=0;o<i.length;o++)n instanceof Array&&!isNaN(i[o].property)&&(i[o].property=n.indexOf(i[o].target)),s=s+"."+i[o].property,n=i[o].target;return s=(s=s+"."+t).substring(2),!0===r&&(s="/"+s.replace(/\./g,"/")),s},_notifyObservers=function(e){if(!0!==n.paused){var r="number"==typeof t;if(r||!0===t)setTimeout((function(){if(e===o.length){var t=o.slice(0);o=[];for(var r=0;r<n.observers.length;r++)n.observers[r](t)}}),r&&t>0?t:10);else{var s=o.slice(0);o=[];for(var i=0;i<n.observers.length;i++)n.observers[i](s)}}},a={get:function(e,r){if("__getTarget"===r)return e;if("__isProxy"===r)return!0;if("__getParent"===r)return function(e){void 0===e&&(e=1);var t=_getPath(0,"__getParent").split(".");return t.splice(-(e+1),e+1),function(e,t){return t.split(".").reduce((function(e,t){return e?e[t]:void 0}),e||self)}(n.parentProxy,t.join("."))};if("__getPath"===r)return _getPath(0,"__getParent").slice(0,-12);var s=e[r];if(e instanceof Date&&s instanceof Function&&null!==s)return s.bind(e);if(s instanceof Object&&null!==s&&e.hasOwnProperty(r)){if(!0===s.__isProxy&&(s=s.__getTarget),s.__targetPosition>-1&&null!==Ps[s.__targetPosition])for(var o=Ts[s.__targetPosition],a=0,c=o.length;a<c;a++)if(n===o[a].observable)return o[a].proxy;var l=i.slice(0);return l.push({target:s,property:r}),Ls(s,t,n,l)}return s},deleteProperty:function(e,t){var r=!0;Fs===l&&(r=!1,Fs=null);var s=Object.assign({},e);if(o.push({type:"delete",target:e,property:t,newValue:null,previousValue:s[t],currentPath:_getPath(0,t),jsonPointer:_getPath(0,t,!0),proxy:l}),!0===r){n.changesPaused||delete e[t];for(var i=0,a=Ps.length;i<a&&e!==Ps[i];i++);for(var c=Ts[i]||[],h=c.length;h--;)c[h].proxy!==l&&(Fs=c[h].proxy,delete c[h].proxy[t])}return _notifyObservers(o.length),!0},set:function(e,t,r,s){r&&r.__isProxy&&(r=r.__getTarget);var i=!0;Fs===l&&(i=!1,Fs=null);var a=e[t];if(a!==r||!1===i||"length"===t&&e instanceof Array&&e.__length!==r){var c=!0,h=typeof a,u="update";if("undefined"===h&&(u="add"),o.push({type:u,target:e,property:t,newValue:r,previousValue:s[t],currentPath:_getPath(0,t),jsonPointer:_getPath(0,t,!0),proxy:l}),"length"===t&&e instanceof Array&&e.__length!==r&&(o[o.length-1].previousValue=e.__length,e.__length=r),!0===i){n.changesPaused||(e[t]=r),c=!1;for(var d=e.__targetPosition,p=Ts[d].length;p--;)if(n===Ts[d][p].observable&&null!==Ps[Ts[d][p].observable.parentTarget.__targetPosition]){c=!0;break}if(c){for(var f=Ts[d],b=0,g=f.length;b<g;b++)f[b].proxy!==l&&(Fs=f[b].proxy,f[b].proxy[t]=r);setTimeout((function(){if("object"===h&&null!==a){for(var t=Object.keys(e),r=0,s=t.length;r<s;r++)if(e[t[r]]===a)return;var i=!1;if(function iterate(e){for(var t=Object.keys(e),r=0,s=t.length;r<s;r++){var n=e[t[r]];if(n instanceof Object&&null!==n&&iterate(n),n===a)return void(i=!0)}}(e),!0===i)return;!function iterate(e){for(var t=Object.keys(e),r=0,s=t.length;r<s;r++){var i=e[t[r]];i instanceof Object&&null!==i&&iterate(i)}var o=-1;for(r=0,s=Ps.length;r<s;r++)if(e===Ps[r]){o=r;break}if(o>-1){for(var a=Ts[o],c=a.length;c--;)if(n===a[c].observable){a.splice(c,1);break}0==a.length&&(Ps[o]=null)}}(a)}}),1e4)}}c&&_notifyObservers(o.length)}return!0}},c=e.__targetPosition;c>-1||Object.defineProperty(e,"__targetPosition",{value:Ps.length,writable:!1,enumerable:!1,configurable:!1});var l=new Proxy(e,a);null===n&&(n={parentTarget:e,domDelay:t,parentProxy:l,observers:[],paused:!1,path:i,changesPaused:!1},Ms.push(n));var h={target:e,proxy:l,observable:n};return c>-1?(null===Ps[c]&&(Ps[c]=e),Ts[c].push(h)):(Ps.push(e),Ts.push([h])),l},{create:function(e,t,r){!0===e.__isProxy&&(e=e.__getTarget);var s=Ls(e,t);return"function"==typeof r&&this.observe(s,r),function iterate(e){for(var t=e.__getTarget,r=Object.keys(t),s=0,n=r.length;s<n;s++){var i=r[s];t[i]instanceof Object&&null!==t[i]&&iterate(e[i])}}(s),s},observe:function(e,t){for(var r=Ms.length;r--;)if(Ms[r].parentProxy===e){Ms[r].observers.push(t);break}},pause:function(e){for(var t=Ms.length,r=!1;t--;)if(Ms[t].parentProxy===e){Ms[t].paused=!0,r=!0;break}if(0==r)throw new Error("ObseravableSlim could not pause observable -- matching proxy not found.")},resume:function(e){for(var t=Ms.length,r=!1;t--;)if(Ms[t].parentProxy===e){Ms[t].paused=!1,r=!0;break}if(0==r)throw new Error("ObseravableSlim could not resume observable -- matching proxy not found.")},pauseChanges:function(e){for(var t=Ms.length,r=!1;t--;)if(Ms[t].parentProxy===e){Ms[t].changesPaused=!0,r=!0;break}if(0==r)throw new Error("ObseravableSlim could not pause changes on observable -- matching proxy not found.")},resumeChanges:function(e){for(var t=Ms.length,r=!1;t--;)if(Ms[t].parentProxy===e){Ms[t].changesPaused=!1,r=!0;break}if(0==r)throw new Error("ObseravableSlim could not resume changes on observable -- matching proxy not found.")},remove:function(e){for(var t=null,r=!1,s=Ms.length;s--;)if(Ms[s].parentProxy===e){t=Ms[s],r=!0;break}for(var n=Ts.length;n--;)for(var i=Ts[n].length;i--;)Ts[n][i].observable===t&&(Ts[n].splice(i,1),0===Ts[n].length&&(Ps[n]=null));!0===r&&Ms.splice(s,1)}});try{zs.exports=Ws}catch(e){}const Hs={};class ObservableObject{constructor(e,t={},r={}){if(this.id=e,Hs[this.id])throw new Error("ObservableObject "+e+" already exists.");this.bound={},this.data=Rs.create(t,!1,(e=>{this.sync(e)})),this.options=r,Hs[this.id]=this}destroy(){Rs.pause(this.data),delete Hs[this.id],delete this.data,Object.keys(this.bound).forEach((e=>{Object.keys(this.bound[e]).forEach((t=>{this.unbind(t,e)}))})),Rs.remove(this.data)}getObservableData(){return this.data}bind(e,t,r="*"){if("__proto__"===r)throw new Error("Invalid property name");this.bound[r]||(this.bound[r]={}),this.bound[r][e]=t,t(this.id,"connect")}unbind(e,t="*"){this.bound[t][e](this.id,"disconnect"),this.bound[t]&&this.bound[t][e]&&delete this.bound[t][e]}sync(e){for(const t of e){const e=t.type,r=t.currentPath,s=t.newValue,n=t.previousValue,i=[];for(const e in this.bound)if("*"===e)i.push(e);else{const t=new RegExp("^"+e.replace(".","\\."));r.match(t)&&i.push(e)}for(const t of i)for(const i in this.bound[t])this.bound[t][i](this.id,e,r,s,n)}}}let Vs,Is,Ns,qs,Us,Bs;class ObserverSubscriptionManager{constructor(e){this.options=e,this.observers=[],this.pendingAnimationFrame=void 0,this.frameQueue=[],this.sleeping=!0}subscribe(e){!this.observers.length&&this.sleeping&&this.wakeup(),this.observers.push(e)}unSubscribe(e){-1!==this.observers.indexOf(e)&&this.observers.splice(this.observers.indexOf(e),1),this.observers.length||this.sleep()}sleep(){this.sleeping=!0}wakeup(){this.sleeping=!1}notifyObservers(e,t){for(let r=0;r<this.observers.length;r++)this.observers[r][e]&&this.observers[r][e].apply(this.observers[r],t||[])}flushQueue(){this.pendingAnimationFrame&&(cancelAnimationFrame(this.pendingAnimationFrame),this.pendingAnimationFrame=void 0),this.frameQueue=[]}queueFrame(e){this.frameQueue.push(e.bind(this)),this.pendingAnimationFrame||(this.pendingAnimationFrame=requestAnimationFrame((()=>{this.processQueue()})))}processQueue(){this.pendingAnimationFrame=void 0;const e=this.frameQueue.slice(0);this.frameQueue=[];for(let t=0;t<e.length;t++)e[t]()}}class DOMWatcher extends ObserverSubscriptionManager{constructor(e={}){super(e),this.mutationHandler=ft(((e,t)=>{this.observeDOM(this.options.shadowDOM||document.body)}),25,{maxWait:100}),this.mutationObserver=new MutationObserver(this.mutationHandler,!1)}subscribe(e){super.subscribe(e),e.watchDOM(this.options.shadowDOM||document.body)}wakeup(){super.wakeup(),this.mutationObserver.observe(this.options.shadowDOM||document.body,{childList:!0,subtree:!0})}sleep(){super.sleep(),this.mutationObserver.disconnect()}observeDOM(e){this.notifyObservers("watchDOM",[e||this.options.shadowDOM||document.body])}}Vs=new DOMWatcher,Is=new class ScrollWatcher extends ObserverSubscriptionManager{constructor(e={}){super(e),this.scrollElement=this.options.scrollElement||window,this.lastscroll=0,this.scrolling=!1}trigger(){this.scrolling||this.scrollLoop()}scrollLoop(){if(this.lastscroll!==this.scrollTop()){this.scrolling=!0,this.lastscroll=this.scrollTop(),this.watchScroll();const frame=()=>{this.scrollLoop()};this.queueFrame(frame)}else this.scrolling=!1}setOptions(e={}){this.sleep(),this.scrollElement=e.scrollElement||window,this.wakeup()}subscribe(e){super.subscribe(e),e.watchScroll()}wakeup(){super.wakeup(),Ye.on("theScrollWatcher",this.scrollElement,"scroll",(()=>{this.trigger()}))}sleep(){super.sleep(),Ye.off("theScrollWatcher",this.scrollElement,"scroll")}inViewPort(e){return Ye.inViewPort(e,this.scrollElement)}watchScroll(){this.notifyObservers("watchScroll")}scrollTop(e){if(this.scrollElement===window){if(void 0===e)return window.pageYOffset;window.scrollTo(0,e)}else{if(void 0===e)return this.scrollElement.scrollTop;this.scrollElement.scrollTop=e}}},Ns=new class ResizeWatcher extends ObserverSubscriptionManager{constructor(e){super(e),this.debounce=ft((()=>{this.watchResize()}),250)}subscribe(e){super.subscribe(e),e.watchResize()}wakeup(){super.wakeup(),window.addEventListener("resize",this.debounce,!1)}sleep(){super.sleep(),window.removeEventListener("resize",this.debounce)}watchResize(){this.notifyObservers("watchResize")}},qs=new class OrientationWatcher extends ObserverSubscriptionManager{constructor(e){super(e),"onorientationchange"in window?Ye.addClass(document.body,"have-orientation"):Ye.addClass(document.body,"no-orientation"),this.debounce=ft((()=>{this.watchOrientation()}),250)}subscribe(e){super.subscribe(e),e.watchOrientation()}wakeup(){super.wakeup(),"onorientationchange"in window&&window.addEventListener("orientationchange",this.debounce,!1)}sleep(){super.sleep(),"onorientationchange"in window&&window.removeEventListener("orientationchange",this.debounce)}watchOrientation(){this.notifyObservers("watchOrientation")}},Us=new class WorkerWatcher extends ObserverSubscriptionManager{constructor(e){super(e),this.workers={}}registerWorker(e,t){if(!this.workers[e]){let r=t,s=!1;if(!t.match(/^(http|\/)/i)){const e=new Blob([t],{type:"text/javascript"});r=URL.createObjectURL(e),s=!0}this.workers[e]={worker:new Worker(r),observers:[]},s&&URL.revokeObjectURL(r),this.workers[e].worker.onmessage=t=>{this.workerMessage(e,t)}}return this.workers[e].worker}subscribe(e,t){if(!this.workers[t])throw new Error("worker "+t+" does not exist");this.workers[t].observers.push(e),super.subscribe(e)}unSubscribe(e,t){if(!this.workers[t])throw new Error("worker "+t+" does not exist");const r=this.workers[t].observers;-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1),r.length||(this.workers[t].worker.terminate(),delete this.workers[t]),super.unSubscribe(e)}workerMessage(e,t){this.workers[e].observers.forEach((r=>{r.workerMessage&&r.workerMessage(e,t)}))}wakeup(){super.wakeup()}sleep(){super.sleep()}},Bs=new class ObservableObjectWatcher extends ObserverSubscriptionManager{constructor(e){super(e),this.registeredObservableObjects={}}getObservable(e){return this.registeredObservableObjects[e]?this.registeredObservableObjects[e].observable:void 0}observableStart(e,t){const r=(e=>Hs[e])(e);if(r&&void 0!==t)throw new Error("ObservableObject "+e+" already exists, can't build.");return this.registeredObservableObjects[e]||(this.registeredObservableObjects[e]=r?{id:e,observable:r,observers:[],managed:!1}:{id:e,observable:new ObservableObject(e,t),observers:[],managed:!0},this.registeredObservableObjects[e].observable.bind(this.constructor.name,this.notify.bind(this))),this.registeredObservableObjects[e].observable}observableDestroy(e){if(!this.registeredObservableObjects[e])throw new Error("ObservableObject observableDestroy "+e+" does not exist");this.registeredObservableObjects[e].observable.unbind(this.constructor.name),this.registeredObservableObjects[e].observable.destroy(),delete this.registeredObservableObjects[e]}subscribe(e,t,r){this.registeredObservableObjects[t]||this.observableStart(t,r),this.registeredObservableObjects[t].observers.push(e),super.subscribe(e)}unSubscribe(e,t){if(!this.registeredObservableObjects[t])throw new Error("ObservableObject unSubscribe "+t+" does not exist");const r=this.registeredObservableObjects[t].observers;-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1),!r.length&&this.registeredObservableObjects[t].managed&&this.observableDestroy(t),super.unSubscribe(e)}notify(e,t,r,s,n){if(!this.registeredObservableObjects[e])throw new Error("ObservableObject notify "+e+" does not exist");this.registeredObservableObjects[e].observers.forEach((i=>{i.observableChanged&&i.observableChanged(e,t,r,s,n)}))}};var Qs=Be((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}));let Gs=0;const Zs=[],Js="customElements"in window,Ys={},registerSargassoClass=(e,t)=>{if(Ys[e])throw new Error("Sargasso class "+e+" is already registered.");if(Ys[e]=t,Js){const t=new Function("registeredClasses",`\n\t\t\treturn class ${e}Element extends HTMLElement {\n\t\t\t\tconstructor(element, options = {}) {\n\t\t\t\t\tsuper()\n\t\t\t\t\tthis.helperClass= '${e}'\n\t\t\t\t\tthis.helpers = []\n\t\t\t\t}\n\n\t\t\t\tconnectedCallback () {\n\t\t\t\t\tthis.helpers.push(new registeredClasses[this.helperClass](this,{isCustomElement:true}))\n\t\t\t\t\tif (this.hasAttributes()) {\n\t\t\t\t\t\tfor(let i = 0; i < this.attributes.length; i++) {\n\t\t\t\t\t\t\tif(this.attributes[i].name.match(/^sargasso-/)) {\n\t\t\t\t\t\t\t\tlet classname = this.attributes[i].name.replace(/^sargasso-/,'').split('-').map(word=> word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join('')\n\t\t\t\t\t\t\t\tif(!registeredClasses[classname]) {\n\t\t\t\t\t\t\t\t\tconsole.log('instantiate by attribute ' + this.attributes[i].name + ' > ' + classname + ' is not a sargasso class')\n\t\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tthis.helpers.push(new registeredClasses[classname](this,{isCustomElement:true}))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.helpers.forEach((helper) => {\n\t\t\t\t\t\thelper.start()\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tdisconnectedCallback () {\n\t\t\t\t\tthis.helpers.forEach((helper) => {\n\t\t\t\t\t\thelper.sleep()\n\t\t\t\t\t\thelper.destroy()\n\t\t\t\t \t})\n\t\t\t\t\tthis.helpers = [] // nuke the reference for trash collection\n\t\t\t\t}\n\t\t\t}`)(Ys),r=window.sargassoOptions||{},s=void 0!==r.customElementPrefix?r.customElementPrefix:"sargasso-";customElements.define(s+Qs(e),t)}},Ks=["DOMChanged","didScroll","didResize","didBreakpoint","enterViewport","exitViewport","enterFullscreen","exitFullscreen","newPage","elementEvent","workerOnMessage","observableChanged"];class Sargasso{constructor(e,t={}){validate("Sargasso constructor element",e,["isDefined","isElement"]),validate("Sargasso constructor options",t,["isDefined",["isObject"]]),this.uid=++Gs,this.element=e,t.shadowDOM&&(this._shadowDOM=e.attachShadow({mode:"open"}),this._shadowRoot=document.createElement("div"),this._shadowDOM.append(this._shadowRoot),this._hostElement=this.element,this.element=this._shadowRoot),this.options=t,this._pendingAnimationFrame=void 0,this._frameQueue=[],this._isInViewport=!1,this._workers={},this._observables={},this._template=void 0,this._templateArgs={},this._started=!1,this.render=ft((()=>{this._render()}),100,{maxWait:250})}start(){const e=this.getMetaData("registeredResponsiveControllers")||[];e.push(this),this.setMetaData("registeredResponsiveControllers",e),this.setMetaData(this.constructor.name,this),Zs.push(this),this._shadowDOM&&(this._shadowDOMWatcher||(this._shadowDOMWatcher=new DOMWatcher({shadowDOM:this._shadowRoot})),this._shadowDOMWatcher.subscribe(this)),this.options.watchDOM&&Vs.subscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Is.subscribe(this),(this.options.watchResize||this.options.watchViewport)&&Ns.subscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&qs.subscribe(this),this.options.watchAttributes&&this.watchAttributes(),this.elementListener=e=>{e.detail&&e.detail.sargassoEvent&&-1!==Ks.indexOf(e.detail.sargassoEvent)?this[e.detail.sargassoEvent].apply(this,e.detail.sargassoEventOptions||[]):this.elementEvent(e)},this.element.addEventListener("sargasso",this.elementListener),this._started=!0}sleep(){this._shadowDOM&&this._shadowDOMWatcher.unSubscribe(this),this.options.watchDOM&&Vs.unSubscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Is.unSubscribe(this),(this.options.watchResize||this.options.watchViewport)&&Ns.unSubscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&qs.unSubscribe(this),this.attributeObserver&&this.attributeObserver.disconnect(),this.element.removeEventListener("sargasso",this.elementListener),Ye.offAll(this.element),this._started=!1}watchAttributes(){this.attributeObserver=new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&this.attributeChanged(e.attributeName)}))})),this.attributeObserver.observe(this._hostElement||this.element,{attributes:!0})}DOMChanged(e){}didScroll(){}didResize(){}didBreakpoint(){}enterViewport(){}exitViewport(){}enterFullscreen(){}exitFullscreen(){}newPage(e,t){}elementEvent(e){}workerOnMessage(e,t){}observableChanged(e,t,r,s,n){this.render()}attributeChanged(e){}setMetaData(e,t){Ye.setMetaData(this.element,e,t)}getMetaData(e){return Ye.getMetaData(this.element,e)}on(e,t,r,s){Ye.on(this.constructor.name+"-"+this.uid,this.element,e,t,r,s)}off(e,t){Ye.off(this.constructor.name+"-"+this.uid,this.element,e,t)}once(e,t,r,s){Ye.once(this.constructor.name+"-"+this.uid,this.element,e,t,r,s)}notifyAll(e,t){if(-1===Ks.indexOf(e))throw new Error("invalid event name "+e);for(let r=0;r<Zs.length;r++){const s=Zs[r];s!==this&&s[e]&&s[e].apply(s,t)}}notifyElement(e,t,r){if(-1===Ks.indexOf(t))throw new Error("invalid event name "+t);const s=this.getMetaData("registeredResponsiveControllers");if(s)for(let e=0;e<s.length;e++){const n=s[e];n!==this&&n[t]&&n[t].apply(n,r)}}queueFrame(e){this._frameQueue.push(e.bind(this)),this._pendingAnimationFrame||(this._pendingAnimationFrame=requestAnimationFrame((()=>{this._processQueue()})))}wantFullscreen(e){e?this.enterFullscreen():this.exitFullscreen()}hasClass(e){return Ye.hasClass(this.element,e)}addClass(e){Ye.addClass(this.element,e)}removeClass(e){Ye.removeClass(this.element,e)}setCSS(e){Ye.setCSS(this.element,e)}isVisible(){return Ye.isVisible(this.element)}workerStart(e,t){return this._workers[e]=Us.registerWorker(e,t),Us.subscribe(this,e),this._workers[e]}workerPostMessage(e,t){t.uid||(t.uid=this.uid),this._workers[e]&&this._workers[e].postMessage(t)}getObservable(e){return this._observables[e]}getObservableData(e){return this._observables[e].data}observableStart(e,t){return Bs.subscribe(this,e,t),this._observables[e]=Bs.getObservable(e),this._observables[e]}observableStop(e){this._observables[e]&&(Bs.unSubscribe(this,e),delete this._observables[e])}observableStopAll(){for(const e in this._observables)this.observableStop(e)}setTemplate(e){this._template=e}setRenderer(e){this.renderer=e}setTemplateArgs(e={}){this._templateArgs=e,this.render()}getTemplateArgs(){const e=this._templateArgs||[];return JSON.parse(JSON.stringify(e))}_render(){this._template&&this.renderer&&this.renderer(this._template.apply(this,this.getTemplateArgs()),this.element)}_flushQueue(){this._pendingAnimationFrame&&(cancelAnimationFrame(this._pendingAnimationFrame),this._pendingAnimationFrame=void 0),this._frameQueue=[]}_processQueue(){this._pendingAnimationFrame=void 0;const e=this._frameQueue.slice(0);this._frameQueue=[];for(let t=0;t<e.length;t++)e[t]()}_stopWorker(e){this._workers[e]&&(Us.unSubscribe(this,e),delete this._workers[e])}_stopAllWorkers(){for(const e in this._workers)this._stopWorker(e)}destroy(){this._stopAllWorkers(),this.observableStopAll(),this._flushQueue(),this._started&&this.sleep();const e=this.getMetaData("registeredResponsiveControllers");e&&-1!==e.indexOf(this)&&(e.splice(e.indexOf(this),1),this.setMetaData("registeredResponsiveControllers",e)),this.setMetaData(this.constructor.name,null),this.element=null,-1!==Zs.indexOf(this)&&Zs.splice(Zs.indexOf(this),1)}watchDOM(e){e===this._shadowRoot?Vs.observeDOM(this._shadowRoot):this.DOMChanged(e)}watchScroll(){this.options.watchViewport&&this.inViewport(),this.didScroll()}watchResize(){this.options.watchViewport&&this.inViewport(),this.didResize()}watchOrientation(){!window.orientation||90!==window.orientation&&-90!==window.orientation?this.wantFullscreen(!1):this.wantFullscreen(!0)}inViewport(){Is.inViewPort(this.element)?this._isInViewport||(this.enterViewport(),this._isInViewport=!0):this._isInViewport&&(this.exitViewport(),this._isInViewport=!1)}workerMessage(e,t){t.data.uid===this.uid&&this.workerOnMessage(e,t.data)}nativeRequestFullScreen(){if(document.fullscreenElement){if(document.fullscreenElement===this.element)return;document.exitFullscreen()}this.element.requestFullscreen()}nativeExitFullScreen(){document.fullscreenElement&&document.fullscreenElement===this.element&&document.exitFullscreen()}}registerSargassoClass("Sargasso",Sargasso);class LazyInstantiate extends Sargasso{constructor(e,t={}){t.watchScroll=!0,t.watchResize=!0,t.watchDOM=!0,t.immortal=!0,super(e,t)}didResize(){super.didResize(),this.lazyHandler()}didScroll(){super.didScroll(),this.lazyHandler()}DOMChanged(e){super.DOMChanged(e),this.lazyHandler(e)}lazyHandler(e=document){const t=e.querySelectorAll("[data-lazy-sargasso-class]");for(let e=0;e<t.length;e++){const r=t[e];if(Is.inViewPort(r)){const s=r.getAttribute("data-lazy-sargasso-class").split(/\s*,\s*/);for(let r=0;r<s.length;r++){new Ys[s[r]](t[e]).start()}r.removeAttribute("data-lazy-sargasso-class")}}}}registerSargassoClass("LazyInstantiate",LazyInstantiate);class SargassoSupervisor extends Sargasso{constructor(e,t={}){super(e,{watchDOM:!0,mortal:!1}),this.lazy=new LazyInstantiate(e,t)}start(){this.lazy.start(),super.start()}instantiate(e){const t=e.getAttribute("data-sargasso-class").split(/\s*,\s*/);for(let r=0;r<t.length;r++)try{new Ys[t[r]](e).start()}catch(e){console.log("error instantiating "+t[r],e,Ys)}e.removeAttribute("data-sargasso-class")}newPage(){this.doIt()}DOMChanged(e){this.doIt(e)}doIt(e=document.body){e.getAttribute("data-sargasso-class")&&this.instantiate(e);const t=e.querySelectorAll("[data-sargasso-class]");for(const e of t)this.instantiate(e);const r=[];for(let e=0;e<Zs.length;e++)Zs[e].options.immortal||Zs[e].options.isCustomElement||document.body.contains(Zs[e].element)||r.push(Zs[e]);for(let e=0;e<r.length;e++)r[e].destroy()}}registerSargassoClass("SargassoSupervisor",SargassoSupervisor);const Xs=window.breakpoints||{widths:[{className:"breakpoint-phone",maxWidth:599},{className:"breakpoint-tablet",maxWidth:904},{className:"breakpoint-desktop",maxWidth:void 0}]};class Breakpoints extends Sargasso{constructor(e,t={}){t.watchResize=!0,super(e,t),this.options.widths=t.widths||Xs,this.scale=void 0,this.widths=[],this.classes=[],this.debouncedDetectGeometry=ft((()=>{this.detectGeometry()}),100,{maxWait:150})}start(){super.start(),this.debouncedDetectGeometry()}didResize(){this.debouncedDetectGeometry()}detectGeometry(){const e=window.doBreakpoints(this.options.widths);if(e!==this.scale){const frame=()=>{this.notifyAll("didBreakpoint",[e])};this.queueFrame(frame)}this.scale=e}}registerSargassoClass("Breakpoints",Breakpoints);class HijaxLoader extends Sargasso{constructor(e,t={}){t.watchDOM=!0,t.immortal=!0,super(e,t),this.excludeRegex=new RegExp("^(//|http|javascript|mailto|#)","i"),this.currentPage=location.pathname+location.search,this.cachedMarkup={}}start(){const e=document.querySelectorAll("[data-hijax-skip-unchanged]");for(let t=0;t<e.length;t++){const r=e[t],s=r.getAttribute("id");this.cachedMarkup[s]=r.innerHTML}super.start(),window.addEventListener("popstate",(e=>{this.watchPopState(e)}),!1)}DOMChanged(e){super.DOMChanged(e),this.hijaxLinks(e)}watchPopState(e){location.pathname+location.search!==this.currentPage&&this.preFlight(location.pathname+location.search)}hijaxLinks(e){const t=e?e.getElementsByTagName("a"):this.element.getElementsByTagName("a");for(let e=0;e<t.length;e++){const r=t[e],s=r.getAttribute("href");!s||r.getAttribute("data-hijaxed")||r.getAttribute("target")||r.hasAttribute("data-no-hijax")||this.excludeRegex.exec(s)||(r.setAttribute("data-hijaxed",!0),r.addEventListener("click",(e=>{e.preventDefault(),this.setPage(s)}),!1))}}setPage(e,t){e===this.currentPage||t?this.preFlight(e):(history.pushState(null,null,e),this.watchPopState())}preFlight(e){if(!this.options.preFlight)return this.loadPage(e);this.options.preFlight(e,((t,r,s)=>{t&&(this.options.onError?this.options.onError("danger",t):alert("Error loading page: "+t)),r?this.currentPage=location.pathname+location.search:this.loadPage(s||e)}))}loadPage(e){this.queueFrame((()=>{Ye.addClass(document.body,"hijax-loading")})),this.options.onExitPage&&this.options.onExitPage();const t=new XMLHttpRequest;t.open("GET",e),t.setRequestHeader("Sargasso-Hijax",1),t.setRequestHeader("x-digitopia-hijax",1),this.options.onLoading&&(this.options.onLoading(),t.onreadystatechange=this.options.onLoading),t.onload=()=>{if(301===t.status||302===t.status||t.getResponseHeader("Sargasso-Location")){const e=t.getResponseHeader("Location")?t.getResponseHeader("Location"):t.getResponseHeader("Sargasso-Location");this.setPage(e)}else if(200===t.status){Is.scrollTop(0),this.mergePage(t.responseText);const e=this.currentPage,frame=()=>{this.notifyAll("newPage",[e,location.pathname+location.search]),Ye.removeClass(document.body,"hijax-loading")};this.queueFrame(frame),this.currentPage=location.pathname+location.search}else{const e=t.getResponseHeader("Sargasso-Flash-Level")||"danger";let r=t.getResponseHeader("Sargasso-Flash-Message")||t.statusText;r||(r="Could not connect to server."),this.options.onError?this.options.onError(e,r):alert("Error loading page: "+r)}},t.send()}processScripts(e){Array.from(e).forEach((e=>{e.remove();const t=e.getAttribute("id");document.getElementById(t)||document.getElementsByTagName("head")[0].appendChild(e)}))}mergePage(e){const t=document.querySelectorAll("[data-ephemeral]");Array.from(t).forEach((e=>{e.remove()}));const r=e.split(/(<body[^>]*>|<\/body>)/gi),s=makeFragment(r[2]),n=document.querySelectorAll("[data-hijax]");for(let e=0;e<n.length;e++){const t=n[e],r=t.getAttribute("id"),i=s.getElementById(r);if(t.hasAttribute("data-hijax-skip-unchanged")){if(this.cachedMarkup[r]===i.innerHTML)continue;this.cachedMarkup[r]=i.innerHTML}const o=t.getAttribute("data-hijax-cache-key-selector");if(o&&i.querySelector(o)&&t.querySelector(o)&&t.querySelector(o).getAttribute("data-hijax-cache-key")===i.querySelector(o).getAttribute("data-hijax-cache-key"))continue;this.processScripts(i.querySelectorAll("script"));const frame=()=>{t.parentNode.replaceChild(i,t),this.options.onEnterPage&&this.options.onEnterPage(),this.hijaxLinks(i)};this.queueFrame(frame)}}}registerSargassoClass("HijaxLoader",HijaxLoader);const makeFragment=e=>{if(document.createRange&&document.createRange().createContextualFragment)return document.createRange().createContextualFragment(e);const t=document.createDocumentFragment(),r=document.createElement("div");return r.insertAdjacentHTML("afterBegin",e),t.appendChild(r),t};e.loadPageHandler=void 0;const en={registerSargassoClass:registerSargassoClass,bootSargasso:(t={})=>{if(t.scrollElement&&Is.setOptions(t),t.breakpoints){new Breakpoints(document.body,t.breakpoints).start()}if(t.hijax){const r=new HijaxLoader(document.body,t.hijax);r.start(),e.loadPageHandler=r.setPage.bind(r)}else e.loadPageHandler=e=>{document.location.href=e};const r=new SargassoSupervisor(document.body,t);return r.start(t),r},elementTools:Ye,validate:validate,setValidator:setValidator},tn={theDOMWatcher:Vs,theScrollWatcher:Is,theResizeWatcher:Ns,theOrientationWatcher:qs,theWorkerWatcher:Us,theObservableObjectWatcher:Bs},rn={liveElements:Zs,registeredClasses:Ys,elementMetaData:Je};return e.ObservableObject=ObservableObject,e.Sargasso=Sargasso,e.services=tn,e.system=rn,e.utils=en,e}({});
var SargassoModule=function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r="object"==typeof t&&t&&t.Object===Object&&t,s="object"==typeof self&&self&&self.Object===Object&&self,n=r||s||Function("return this")(),i=n.Symbol;var o=function arrayMap$1(e,t){for(var r=-1,s=null==e?0:e.length,n=Array(s);++r<s;)n[r]=t(e[r],r,e);return n},a=Array.isArray,c=i,l=Object.prototype,u=l.hasOwnProperty,h=l.toString,d=c?c.toStringTag:void 0;var p=function getRawTag$1(e){var t=u.call(e,d),r=e[d];try{e[d]=void 0;var s=!0}catch(e){}var n=h.call(e);return s&&(t?e[d]=r:delete e[d]),n},f=Object.prototype.toString;var b=p,g=function objectToString$1(e){return f.call(e)},v=i?i.toStringTag:void 0;var m=function baseGetTag$1(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":v&&v in Object(e)?b(e):g(e)},w=function isObjectLike$1(e){return null!=e&&"object"==typeof e};var y=function isSymbol$2(e){return"symbol"==typeof e||w(e)&&"[object Symbol]"==m(e)},O=o,E=a,x=y,_=i?i.prototype:void 0,S=_?_.toString:void 0;var k=function baseToString$1(e){if("string"==typeof e)return e;if(E(e))return O(e,baseToString$1)+"";if(x(e))return S?S.call(e):"";var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t},A=k;var j=function toString$5(e){return null==e?"":A(e)};var L=function baseSlice$1(e,t,r){var s=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(r=r>n?n:r)<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(n);++s<n;)i[s]=e[s+t];return i};var C=function castSlice$1(e,t,r){var s=e.length;return r=void 0===r?s:r,!t&&r>=s?e:L(e,t,r)},M=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var D=function hasUnicode$2(e){return M.test(e)};var P=function asciiToArray$1(e){return e.split("")},R="\\ud800-\\udfff",T="["+R+"]",F="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",W="\\ud83c[\\udffb-\\udfff]",z="[^"+R+"]",V="(?:\\ud83c[\\udde6-\\uddff]){2}",I="[\\ud800-\\udbff][\\udc00-\\udfff]",N="(?:"+F+"|"+W+")"+"?",H="[\\ufe0e\\ufe0f]?",$=H+N+("(?:\\u200d(?:"+[z,V,I].join("|")+")"+H+N+")*"),q="(?:"+[z+F+"?",F,V,I,T].join("|")+")",U=RegExp(W+"(?="+W+")|"+q+$,"g");var Q=P,B=D,G=function unicodeToArray$1(e){return e.match(U)||[]};var Z=C,J=D,K=function stringToArray$1(e){return B(e)?G(e):Q(e)},Y=j;var X=function createCaseFirst$1(e){return function(t){t=Y(t);var r=J(t)?K(t):void 0,s=r?r[0]:t.charAt(0),n=r?Z(r,1).join(""):t.slice(1);return s[e]()+n}}("toUpperCase"),ee=j,te=X;var re=function capitalize$1(e){return te(ee(e).toLowerCase())};var se=function arrayReduce$1(e,t,r,s){var n=-1,i=null==e?0:e.length;for(s&&i&&(r=e[++n]);++n<i;)r=t(r,e[n],n,e);return r};var ne=function basePropertyOf$1(e){return function(t){return null==e?void 0:e[t]}}({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ie=j,oe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ae=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var ce=function deburr$1(e){return(e=ie(e))&&e.replace(oe,ne).replace(ae,"")},le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var ue=function asciiWords$1(e){return e.match(le)||[]},he=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var de=function hasUnicodeWord$1(e){return he.test(e)},pe="\\ud800-\\udfff",fe="\\u2700-\\u27bf",be="a-z\\xdf-\\xf6\\xf8-\\xff",ge="A-Z\\xc0-\\xd6\\xd8-\\xde",ve="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",me="["+ve+"]",we="\\d+",ye="["+fe+"]",Oe="["+be+"]",Ee="[^"+pe+ve+we+fe+be+ge+"]",xe="(?:\\ud83c[\\udde6-\\uddff]){2}",_e="[\\ud800-\\udbff][\\udc00-\\udfff]",Se="["+ge+"]",ke="(?:"+Oe+"|"+Ee+")",Ae="(?:"+Se+"|"+Ee+")",je="(?:['’](?:d|ll|m|re|s|t|ve))?",Le="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ce="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",Me="[\\ufe0e\\ufe0f]?",De=Me+Ce+("(?:\\u200d(?:"+["[^"+pe+"]",xe,_e].join("|")+")"+Me+Ce+")*"),Pe="(?:"+[ye,xe,_e].join("|")+")"+De,Re=RegExp([Se+"?"+Oe+"+"+je+"(?="+[me,Se,"$"].join("|")+")",Ae+"+"+Le+"(?="+[me,Se+ke,"$"].join("|")+")",Se+"?"+ke+"+"+je,Se+"+"+Le,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",we,Pe].join("|"),"g");var Te=ue,Fe=de,We=j,ze=function unicodeWords$1(e){return e.match(Re)||[]};var Ve=se,Ie=ce,Ne=function words$1(e,t,r){return e=We(e),void 0===(t=r?void 0:t)?Fe(e)?ze(e):Te(e):e.match(t)||[]},He=RegExp("['’]","g");var $e=function createCompounder$2(e){return function(t){return Ve(Ne(Ie(t).replace(He,"")),e,"")}},qe=re,Ue=$e((function(e,t,r){return t=t.toLowerCase(),e+(r?qe(t):t)}));const Qe={},setValidator=(e,t)=>{Qe[e]=t};setValidator("isDefined",(e=>void 0!==e)),setValidator("isUnDefined",(e=>void 0===e)),setValidator("isNull",(e=>null===e)),setValidator("isElement",(e=>e&&(e instanceof Element||e instanceof Window))),setValidator("isEventTarget",(e=>e&&e instanceof EventTarget)),setValidator("isString",(e=>e&&("string"==typeof e||e instanceof String))),setValidator("isArray",(e=>e&&e instanceof Array)),setValidator("notEmpty",(e=>e instanceof Array?0!==e.length:""!==e)),setValidator("isEmpty",(e=>void 0===e||!e||(e instanceof Array?0===e.length:""===e))),setValidator("isObject",(e=>e&&e instanceof Object)),setValidator("isFunction",(e=>e&&"function"==typeof e));const validate=(e,t,r)=>{const s=r.map((e=>{if(e instanceof Array){return-1!==e.map((e=>Qe[e]&&Qe[e](t))).indexOf(!0)}return Qe[e]&&Qe[e](t)}));if(-1!==s.indexOf(!1))throw new Error("call to "+e+" invalid value: "+t+" "+r,0+s)},Be=new WeakMap,hasClass=(e,t)=>(validate("hasClass element",e,["isDefined","isElement"]),validate("hasClass cssClass",t,["isDefined","notEmpty","isString"]),e.classList.contains(t)),isVisible=e=>(validate("isVisible element",e,["isDefined","isElement"]),!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)),setMetaData=(e,t,r)=>{validate("setMetaData element",e,["isDefined","isElement"]),validate("setMetaData k",t,["isDefined","isString"]),validate("setMetaData v",r,[["isUnDefined","isNull","isString","isObject"]]);const s=Be.get(e)||{};r?s[t]=r:delete s[t],Be.set(e,s)},getMetaData=(e,t)=>{validate("getMetaData element",e,["isDefined","isElement"]),validate("getMetaData k",t,["isDefined","isString"]);const r=Be.get(e)||{};return t?r[t]:r},on=function(e,t,r,s,n,i,o){"function"==typeof s&&(o=i,i=n,n=s,s=void 0),validate("on uid",e,["isDefined","notEmpty"]),validate("on container",t,["isDefined","isEventTarget"]),validate("on events",r,["isDefined","isString"]),validate("on fn",n,["isDefined","isFunction"]),validate("on selector",s,[["isEmpty","isString"]]);const a="on:"+e+"-"+r+"-"+s;if(getMetaData(t,a))return void console.error("Error: Sargasso utils.on: duplicate event handler specification. %o %s",t,a);const c={uid:e,events:r,selector:s||void 0,fn:i=>{o&&off(e,t,r,s),s?Array.from(t.querySelectorAll(s)).forEach((e=>{(i.target===e||e.contains(i.target))&&n(i,e)})):n(i)},options:i||!1};setMetaData(t,a,c),r.split(/[\s,]+/).forEach((e=>{t.addEventListener(e.trim(),c.fn,c.options)}))},off=function(e,t,r,s){validate("off uid",e,["isDefined","notEmpty"]),validate("off container",t,["isDefined","isEventTarget"]),validate("off events",r,["isDefined","isString"]),validate("off selector",s,[["isEmpty","isString"]]);const n="on:"+e+"-"+r+"-"+s,i=getMetaData(t,n);i&&(r.split(/[\s,]+/).forEach((e=>{t.removeEventListener(e.trim(),i.fn,i.options)})),setMetaData(t,n))},Ge={hasClass:hasClass,addClass:(e,t)=>{validate("addClass element",e,["isDefined","isElement"]),validate("addClass addClasses",t,["isDefined","notEmpty",["isString","isArray"]]),Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach((t=>{t=t.trim(),hasClass(e,t)||e.classList.add(t)}))},removeClass:(e,t)=>{validate("removeClass element",e,["isDefined","isElement"]),validate("removeClass removeClasses",t,["isDefined","notEmpty",["isString","isArray"]]),Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach((t=>{t=t.trim(),hasClass(e,t)&&e.classList.remove(t)}))},isVisible:isVisible,inViewPort:(e,t=window)=>{validate("inViewPort element",e,["isDefined","isElement"]);const r=e.getBoundingClientRect(),s=isVisible(e),n=r.bottom<0;let i;return i=t.self===window?r.top>(window.innerHeight||document.documentElement.clientHeight):r.top>t.clientHeight,s&&!i&&!n},setCSS:(e,t)=>{validate("css element",e,["isDefined","isElement"]),validate("css css",t,["isDefined",["isObject"]]);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const s=Ue(r);e.style[s]=null!==t[r]?t[r]:null}},setMetaData:setMetaData,getMetaData:getMetaData,on:on,off:off,once:function(e,t,r,s,n,i){"function"==typeof s&&(i=n,n=s,s=void 0),on(e,t,r,s,n,i,!0)},offAll:function(e){validate("offAll container",e,["isDefined","isEventTarget"]);const t=Be.get(e)||{},r=[];for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&e.match(/^on:/)&&r.push(e);r.forEach((r=>{off(t[r].uid,e,t[r].events,t[r].selector)}))}};var Ze=function isObject$2(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Je=n,Ke=/\s/;var Ye=function trimmedEndIndex$1(e){for(var t=e.length;t--&&Ke.test(e.charAt(t)););return t},Xe=/^\s+/;var et=function baseTrim$1(e){return e?e.slice(0,Ye(e)+1).replace(Xe,""):e},tt=Ze,rt=y,st=/^[-+]0x[0-9a-f]+$/i,nt=/^0b[01]+$/i,it=/^0o[0-7]+$/i,ot=parseInt;var at=Ze,now=function(){return Je.Date.now()},ct=function toNumber$1(e){if("number"==typeof e)return e;if(rt(e))return NaN;if(tt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=tt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=et(e);var r=nt.test(e);return r||it.test(e)?ot(e.slice(2),r?2:8):st.test(e)?NaN:+e},lt=Math.max,ut=Math.min;var ht,dt=function debounce(e,t,r){var s,n,i,o,a,c,l=0,u=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function invokeFunc(t){var r=s,i=n;return s=n=void 0,l=t,o=e.apply(i,r)}function leadingEdge(e){return l=e,a=setTimeout(timerExpired,t),u?invokeFunc(e):o}function shouldInvoke(e){var r=e-c;return void 0===c||r>=t||r<0||h&&e-l>=i}function timerExpired(){var e=now();if(shouldInvoke(e))return trailingEdge(e);a=setTimeout(timerExpired,function remainingWait(e){var r=t-(e-c);return h?ut(r,i-(e-l)):r}(e))}function trailingEdge(e){return a=void 0,d&&s?invokeFunc(e):(s=n=void 0,o)}function debounced(){var e=now(),r=shouldInvoke(e);if(s=arguments,n=this,c=e,r){if(void 0===a)return leadingEdge(c);if(h)return clearTimeout(a),a=setTimeout(timerExpired,t),invokeFunc(c)}return void 0===a&&(a=setTimeout(timerExpired,t)),o}return t=ct(t)||0,at(r)&&(u=!!r.leading,i=(h="maxWait"in r)?lt(ct(r.maxWait)||0,t):i,d="trailing"in r?!!r.trailing:d),debounced.cancel=function cancel(){void 0!==a&&clearTimeout(a),l=0,s=c=n=a=void 0},debounced.flush=function flush(){return void 0===a?o:trailingEdge(now())},debounced},pt={},ft={get exports(){return pt},set exports(e){pt=e}},bt="object"==typeof Reflect?Reflect:null,gt=bt&&"function"==typeof bt.apply?bt.apply:function ReflectApply(e,t,r){return Function.prototype.apply.call(e,t,r)};ht=bt&&"function"==typeof bt.ownKeys?bt.ownKeys:Object.getOwnPropertySymbols?function ReflectOwnKeys(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function ReflectOwnKeys(e){return Object.getOwnPropertyNames(e)};var vt=Number.isNaN||function NumberIsNaN(e){return e!=e};function EventEmitter(){EventEmitter.init.call(this)}ft.exports=EventEmitter;pt.once=function once(e,t){return new Promise((function(r,s){function errorListener(r){e.removeListener(t,resolver),s(r)}function resolver(){"function"==typeof e.removeListener&&e.removeListener("error",errorListener),r([].slice.call(arguments))}eventTargetAgnosticAddListener(e,t,resolver,{once:!0}),"error"!==t&&function addErrorHandlerIfEventEmitter(e,t,r){"function"==typeof e.on&&eventTargetAgnosticAddListener(e,"error",t,r)}(e,errorListener,{once:!0})}))};EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var mt=10;function checkListener(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function _getMaxListeners(e){return void 0===e._maxListeners?EventEmitter.defaultMaxListeners:e._maxListeners}function _addListener(e,t,r,s){var n,i,o;if(checkListener(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),o=i[t]),void 0===o)o=i[t]=r,++e._eventsCount;else if("function"==typeof o?o=i[t]=s?[r,o]:[o,r]:s?o.unshift(r):o.push(r),(n=_getMaxListeners(e))>0&&o.length>n&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,function ProcessEmitWarning(e){console&&console.warn&&console.warn(e)}(a)}return e}function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(e,t,r){var s={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=onceWrapper.bind(s);return n.listener=r,s.wrapFn=n,n}function _listeners(e,t,r){var s=e._events;if(void 0===s)return[];var n=s[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function unwrapListeners(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):arrayClone(n,n.length)}function listenerCount(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function arrayClone(e,t){for(var r=new Array(t),s=0;s<t;++s)r[s]=e[s];return r}function eventTargetAgnosticAddListener(e,t,r,s){if("function"==typeof e.on)s.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function wrapListener(n){s.once&&e.removeEventListener(t,wrapListener),r(n)}))}}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return mt},set:function(e){if("number"!=typeof e||e<0||vt(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");mt=e}}),EventEmitter.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function setMaxListeners(e){if("number"!=typeof e||e<0||vt(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},EventEmitter.prototype.getMaxListeners=function getMaxListeners(){return _getMaxListeners(this)},EventEmitter.prototype.emit=function emit(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var s="error"===e,n=this._events;if(void 0!==n)s=s&&void 0===n.error;else if(!s)return!1;if(s){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var o=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw o.context=i,o}var a=n[e];if(void 0===a)return!1;if("function"==typeof a)gt(a,this,t);else{var c=a.length,l=arrayClone(a,c);for(r=0;r<c;++r)gt(l[r],this,t)}return!0},EventEmitter.prototype.addListener=function addListener(e,t){return _addListener(this,e,t,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.prependListener=function prependListener(e,t){return _addListener(this,e,t,!0)},EventEmitter.prototype.once=function once(e,t){return checkListener(t),this.on(e,_onceWrap(this,e,t)),this},EventEmitter.prototype.prependOnceListener=function prependOnceListener(e,t){return checkListener(t),this.prependListener(e,_onceWrap(this,e,t)),this},EventEmitter.prototype.removeListener=function removeListener(e,t){var r,s,n,i,o;if(checkListener(t),void 0===(s=this._events))return this;if(void 0===(r=s[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){o=r[i].listener,n=i;break}if(n<0)return this;0===n?r.shift():function spliceOne(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(s[e]=r[0]),void 0!==s.removeListener&&this.emit("removeListener",e,o||t)}return this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.removeAllListeners=function removeAllListeners(e){var t,r,s;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,i=Object.keys(r);for(s=0;s<i.length;++s)"removeListener"!==(n=i[s])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(s=t.length-1;s>=0;s--)this.removeListener(e,t[s]);return this},EventEmitter.prototype.listeners=function listeners(e){return _listeners(this,e,!0)},EventEmitter.prototype.rawListeners=function rawListeners(e){return _listeners(this,e,!1)},EventEmitter.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):listenerCount.call(e,t)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function eventNames(){return this._eventsCount>0?ht(this._events):[]};var wt,yt,Ot,Et,xt,_t,St={},kt={get exports(){return St},set exports(e){St=e}},At=(wt=[],yt=[],Ot=[],Et=[],xt=null,_t=function(e,t,r,s){var n=r||null,i=s||[{target:e,property:""}];wt.push(i),e instanceof Array&&(e.hasOwnProperty("__length")?e.__length=e.length:Object.defineProperty(e,"__length",{enumerable:!1,value:e.length,writable:!0}));var o=[],_getPath=function(e,t,r){for(var s="",n=null,o=0;o<i.length;o++)n instanceof Array&&!isNaN(i[o].property)&&(i[o].property=n.indexOf(i[o].target)),s=s+"."+i[o].property,n=i[o].target;return s=(s=s+"."+t).substring(2),!0===r&&(s="/"+s.replace(/\./g,"/")),s},_notifyObservers=function(e){if(!0!==n.paused){var r="number"==typeof t;if(r||!0===t)setTimeout((function(){if(e===o.length){var t=o.slice(0);o=[];for(var r=0;r<n.observers.length;r++)n.observers[r](t)}}),r&&t>0?t:10);else{var s=o.slice(0);o=[];for(var i=0;i<n.observers.length;i++)n.observers[i](s)}}},a={get:function(e,r){if("__getTarget"===r)return e;if("__isProxy"===r)return!0;if("__getParent"===r)return function(e){void 0===e&&(e=1);var t=_getPath(0,"__getParent").split(".");return t.splice(-(e+1),e+1),function(e,t){return t.split(".").reduce((function(e,t){return e?e[t]:void 0}),e||self)}(n.parentProxy,t.join("."))};if("__getPath"===r)return _getPath(0,"__getParent").slice(0,-12);var s=e[r];if(e instanceof Date&&s instanceof Function&&null!==s)return s.bind(e);if(s instanceof Object&&null!==s&&e.hasOwnProperty(r)){if(!0===s.__isProxy&&(s=s.__getTarget),s.__targetPosition>-1&&null!==Ot[s.__targetPosition])for(var o=Et[s.__targetPosition],a=0,c=o.length;a<c;a++)if(n===o[a].observable)return o[a].proxy;var l=i.slice(0);return l.push({target:s,property:r}),_t(s,t,n,l)}return s},deleteProperty:function(e,t){var r=!0;xt===l&&(r=!1,xt=null);var s=Object.assign({},e);if(o.push({type:"delete",target:e,property:t,newValue:null,previousValue:s[t],currentPath:_getPath(0,t),jsonPointer:_getPath(0,t,!0),proxy:l}),!0===r){n.changesPaused||delete e[t];for(var i=0,a=Ot.length;i<a&&e!==Ot[i];i++);for(var c=Et[i]||[],u=c.length;u--;)c[u].proxy!==l&&(xt=c[u].proxy,delete c[u].proxy[t])}return _notifyObservers(o.length),!0},set:function(e,t,r,s){r&&r.__isProxy&&(r=r.__getTarget);var i=!0;xt===l&&(i=!1,xt=null);var a=e[t];if(a!==r||!1===i||"length"===t&&e instanceof Array&&e.__length!==r){var c=!0,u=typeof a,h="update";if("undefined"===u&&(h="add"),o.push({type:h,target:e,property:t,newValue:r,previousValue:s[t],currentPath:_getPath(0,t),jsonPointer:_getPath(0,t,!0),proxy:l}),"length"===t&&e instanceof Array&&e.__length!==r&&(o[o.length-1].previousValue=e.__length,e.__length=r),!0===i){n.changesPaused||(e[t]=r),c=!1;for(var d=e.__targetPosition,p=Et[d].length;p--;)if(n===Et[d][p].observable&&null!==Ot[Et[d][p].observable.parentTarget.__targetPosition]){c=!0;break}if(c){for(var f=Et[d],b=0,g=f.length;b<g;b++)f[b].proxy!==l&&(xt=f[b].proxy,f[b].proxy[t]=r);setTimeout((function(){if("object"===u&&null!==a){for(var t=Object.keys(e),r=0,s=t.length;r<s;r++)if(e[t[r]]===a)return;var i=!1;if(function iterate(e){for(var t=Object.keys(e),r=0,s=t.length;r<s;r++){var n=e[t[r]];if(n instanceof Object&&null!==n&&iterate(n),n===a)return void(i=!0)}}(e),!0===i)return;!function iterate(e){for(var t=Object.keys(e),r=0,s=t.length;r<s;r++){var i=e[t[r]];i instanceof Object&&null!==i&&iterate(i)}var o=-1;for(r=0,s=Ot.length;r<s;r++)if(e===Ot[r]){o=r;break}if(o>-1){for(var a=Et[o],c=a.length;c--;)if(n===a[c].observable){a.splice(c,1);break}0==a.length&&(Ot[o]=null)}}(a)}}),1e4)}}c&&_notifyObservers(o.length)}return!0}},c=e.__targetPosition;c>-1||Object.defineProperty(e,"__targetPosition",{value:Ot.length,writable:!1,enumerable:!1,configurable:!1});var l=new Proxy(e,a);null===n&&(n={parentTarget:e,domDelay:t,parentProxy:l,observers:[],paused:!1,path:i,changesPaused:!1},yt.push(n));var u={target:e,proxy:l,observable:n};return c>-1?(null===Ot[c]&&(Ot[c]=e),Et[c].push(u)):(Ot.push(e),Et.push([u])),l},{create:function(e,t,r){!0===e.__isProxy&&(e=e.__getTarget);var s=_t(e,t);return"function"==typeof r&&this.observe(s,r),function iterate(e){for(var t=e.__getTarget,r=Object.keys(t),s=0,n=r.length;s<n;s++){var i=r[s];t[i]instanceof Object&&null!==t[i]&&iterate(e[i])}}(s),s},observe:function(e,t){for(var r=yt.length;r--;)if(yt[r].parentProxy===e){yt[r].observers.push(t);break}},pause:function(e){for(var t=yt.length,r=!1;t--;)if(yt[t].parentProxy===e){yt[t].paused=!0,r=!0;break}if(0==r)throw new Error("ObseravableSlim could not pause observable -- matching proxy not found.")},resume:function(e){for(var t=yt.length,r=!1;t--;)if(yt[t].parentProxy===e){yt[t].paused=!1,r=!0;break}if(0==r)throw new Error("ObseravableSlim could not resume observable -- matching proxy not found.")},pauseChanges:function(e){for(var t=yt.length,r=!1;t--;)if(yt[t].parentProxy===e){yt[t].changesPaused=!0,r=!0;break}if(0==r)throw new Error("ObseravableSlim could not pause changes on observable -- matching proxy not found.")},resumeChanges:function(e){for(var t=yt.length,r=!1;t--;)if(yt[t].parentProxy===e){yt[t].changesPaused=!1,r=!0;break}if(0==r)throw new Error("ObseravableSlim could not resume changes on observable -- matching proxy not found.")},remove:function(e){for(var t=null,r=!1,s=yt.length;s--;)if(yt[s].parentProxy===e){t=yt[s],r=!0;break}for(var n=Et.length;n--;)for(var i=Et[n].length;i--;)Et[n][i].observable===t&&(Et[n].splice(i,1),0===Et[n].length&&(Ot[n]=null));!0===r&&yt.splice(s,1)}});try{kt.exports=At}catch(e){}const jt={},getObservable=e=>jt[e];class ObservableObject extends pt{constructor(e,t={},r={}){if(super(),this.id=e,jt[this.id])throw new Error("ObservableObject "+e+" already exists.");this.bound={},this.unproxied=t,this.data=St.create(t,!1,(e=>{this.sync(e,this.getSource())})),this.options=r,jt[this.id]=this}getSource(){return this.id}destroy(){St.pause(this.data),delete jt[this.id],delete this.data,Object.keys(this.bound).forEach((e=>{Object.keys(this.bound[e]).forEach((t=>{this.unbind(t,e)}))})),St.remove(this.data)}getObservableData(){return this.data}bind(e,t,r="*"){if("__proto__"===r)throw new Error("Invalid property name");this.bound[r]||(this.bound[r]={}),this.bound[r][e]=t,t(this.id,"connect")}unbind(e,t="*"){this.bound[t][e](this.id,"disconnect"),this.bound[t]&&this.bound[t][e]&&delete this.bound[t][e]}sync(e){for(const t of e){const e=t.type,r=t.currentPath,s=t.newValue,n=t.previousValue,i=[];for(const e in this.bound)if("*"===e)i.push(e);else{const t=new RegExp("^"+e.replace(".","\\."));r.match(t)&&i.push(e)}for(const t of i)for(const i in this.bound[t])this.bound[t][i](this.id,e,r,s,n)}}}let Lt,Ct,Mt,Dt,Pt,Rt;class ObserverSubscriptionManager{constructor(e){this.options=e,this.observers=[],this.pendingAnimationFrame=void 0,this.frameQueue=[],this.sleeping=!0}subscribe(e){!this.observers.length&&this.sleeping&&this.wakeup(),this.observers.push(e)}unSubscribe(e){-1!==this.observers.indexOf(e)&&this.observers.splice(this.observers.indexOf(e),1),this.observers.length||this.sleep()}sleep(){this.sleeping=!0}wakeup(){this.sleeping=!1}notifyObservers(e,t){for(let r=0;r<this.observers.length;r++)this.observers[r][e]&&this.observers[r][e].apply(this.observers[r],t||[])}flushQueue(){this.pendingAnimationFrame&&(cancelAnimationFrame(this.pendingAnimationFrame),this.pendingAnimationFrame=void 0),this.frameQueue=[]}queueFrame(e){this.frameQueue.push(e.bind(this)),this.pendingAnimationFrame||(this.pendingAnimationFrame=requestAnimationFrame((()=>{this.processQueue()})))}processQueue(){this.pendingAnimationFrame=void 0;const e=this.frameQueue.slice(0);this.frameQueue=[];for(let t=0;t<e.length;t++)e[t]()}}class DOMWatcher extends ObserverSubscriptionManager{constructor(e={}){super(e),this.mutationHandler=dt(((e,t)=>{this.observeDOM(this.options.shadowDOM||document.body)}),25,{maxWait:100}),this.mutationObserver=new MutationObserver(this.mutationHandler,!1)}subscribe(e){super.subscribe(e),e.watchDOM(this.options.shadowDOM||document.body)}wakeup(){super.wakeup(),this.mutationObserver.observe(this.options.shadowDOM||document.body,{childList:!0,subtree:!0})}sleep(){super.sleep(),this.mutationObserver.disconnect()}observeDOM(e){this.notifyObservers("watchDOM",[e||this.options.shadowDOM||document.body])}}Lt=new DOMWatcher,Ct=new class ScrollWatcher extends ObserverSubscriptionManager{constructor(e={}){super(e),this.scrollElement=this.options.scrollElement||window,this.lastscroll=0,this.scrolling=!1}trigger(){this.scrolling||this.scrollLoop()}scrollLoop(){if(this.lastscroll!==this.scrollTop()){this.scrolling=!0,this.lastscroll=this.scrollTop(),this.watchScroll();const frame=()=>{this.scrollLoop()};this.queueFrame(frame)}else this.scrolling=!1}setOptions(e={}){this.sleep(),this.scrollElement=e.scrollElement||window,this.wakeup()}subscribe(e){super.subscribe(e),e.watchScroll()}wakeup(){super.wakeup(),Ge.on("theScrollWatcher",this.scrollElement,"scroll",(()=>{this.trigger()}))}sleep(){super.sleep(),Ge.off("theScrollWatcher",this.scrollElement,"scroll")}inViewPort(e){return Ge.inViewPort(e,this.scrollElement)}watchScroll(){this.notifyObservers("watchScroll")}scrollTop(e){if(this.scrollElement===window){if(void 0===e)return window.pageYOffset;window.scrollTo(0,e)}else{if(void 0===e)return this.scrollElement.scrollTop;this.scrollElement.scrollTop=e}}},Mt=new class ResizeWatcher extends ObserverSubscriptionManager{constructor(e){super(e),this.debounce=dt((()=>{this.watchResize()}),250)}subscribe(e){super.subscribe(e),e.watchResize()}wakeup(){super.wakeup(),window.addEventListener("resize",this.debounce,!1)}sleep(){super.sleep(),window.removeEventListener("resize",this.debounce)}watchResize(){this.notifyObservers("watchResize")}},Dt=new class OrientationWatcher extends ObserverSubscriptionManager{constructor(e){super(e),"onorientationchange"in window?Ge.addClass(document.body,"have-orientation"):Ge.addClass(document.body,"no-orientation"),this.debounce=dt((()=>{this.watchOrientation()}),250)}subscribe(e){super.subscribe(e),e.watchOrientation()}wakeup(){super.wakeup(),"onorientationchange"in window&&window.addEventListener("orientationchange",this.debounce,!1)}sleep(){super.sleep(),"onorientationchange"in window&&window.removeEventListener("orientationchange",this.debounce)}watchOrientation(){this.notifyObservers("watchOrientation")}},Pt=new class WorkerWatcher extends ObserverSubscriptionManager{constructor(e){super(e),this.workers={}}registerWorker(e,t){if(!this.workers[e]){let r=t,s=!1;if(!t.match(/^(http|\/)/i)){const e=new Blob([t],{type:"text/javascript"});r=URL.createObjectURL(e),s=!0}this.workers[e]={worker:new Worker(r),observers:[]},s&&URL.revokeObjectURL(r),this.workers[e].worker.onmessage=t=>{this.workerMessage(e,t)}}return this.workers[e].worker}subscribe(e,t){if(!this.workers[t])throw new Error("worker "+t+" does not exist");this.workers[t].observers.push(e),super.subscribe(e)}unSubscribe(e,t){if(!this.workers[t])throw new Error("worker "+t+" does not exist");const r=this.workers[t].observers;-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1),r.length||(this.workers[t].worker.terminate(),delete this.workers[t]),super.unSubscribe(e)}workerMessage(e,t){this.workers[e].observers.forEach((r=>{r.workerMessage&&r.workerMessage(e,t)}))}wakeup(){super.wakeup()}sleep(){super.sleep()}},Rt=new class ObservableObjectWatcher extends ObserverSubscriptionManager{constructor(e){super(e),this.registeredObservableObjects={}}getObservable(e){return this.registeredObservableObjects[e]?this.registeredObservableObjects[e].observable:void 0}observableStart(e,t){const r=getObservable(e);if(r&&void 0!==t)throw new Error("ObservableObject "+e+" already exists, can't build.");return this.registeredObservableObjects[e]||(this.registeredObservableObjects[e]=r?{id:e,observable:r,observers:[],managed:!1}:{id:e,observable:new ObservableObject(e,t),observers:[],managed:!0},this.registeredObservableObjects[e].observable.bind(this.constructor.name,this.notify.bind(this))),this.registeredObservableObjects[e].observable}observableDestroy(e){if(!this.registeredObservableObjects[e])throw new Error("ObservableObject observableDestroy "+e+" does not exist");this.registeredObservableObjects[e].observable.unbind(this.constructor.name),this.registeredObservableObjects[e].observable.destroy(),delete this.registeredObservableObjects[e]}subscribe(e,t,r){this.registeredObservableObjects[t]||this.observableStart(t,r),this.registeredObservableObjects[t].observers.push(e),super.subscribe(e)}unSubscribe(e,t){if(!this.registeredObservableObjects[t])throw new Error("ObservableObject unSubscribe "+t+" does not exist");const r=this.registeredObservableObjects[t].observers;-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1),!r.length&&this.registeredObservableObjects[t].managed&&this.observableDestroy(t),super.unSubscribe(e)}notify(e,t,r,s,n){if(!this.registeredObservableObjects[e])throw new Error("ObservableObject notify "+e+" does not exist");this.registeredObservableObjects[e].observers.forEach((i=>{i.observableChanged&&i.observableChanged(e,t,r,s,n)}))}};var Tt=$e((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}));let Ft=0;const Wt=[],zt="customElements"in window,Vt={},registerSargassoClass=(e,t)=>{if(Vt[e])throw new Error("Sargasso class "+e+" is already registered.");if(Vt[e]=t,zt){const t=new Function("registeredClasses",`\n\t\t\treturn class ${e}Element extends HTMLElement {\n\t\t\t\tconstructor(element, options = {}) {\n\t\t\t\t\tsuper()\n\t\t\t\t\tthis.helperClass= '${e}'\n\t\t\t\t\tthis.helpers = []\n\t\t\t\t}\n\n\t\t\t\tconnectedCallback () {\n\t\t\t\t\tthis.helpers.push(new registeredClasses[this.helperClass](this,{isCustomElement:true}))\n\t\t\t\t\tif (this.hasAttributes()) {\n\t\t\t\t\t\tfor(let i = 0; i < this.attributes.length; i++) {\n\t\t\t\t\t\t\tif(this.attributes[i].name.match(/^sargasso-/)) {\n\t\t\t\t\t\t\t\tlet classname = this.attributes[i].name.replace(/^sargasso-/,'').split('-').map(word=> word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join('')\n\t\t\t\t\t\t\t\tif(!registeredClasses[classname]) {\n\t\t\t\t\t\t\t\t\tconsole.log('instantiate by attribute ' + this.attributes[i].name + ' > ' + classname + ' is not a sargasso class')\n\t\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tthis.helpers.push(new registeredClasses[classname](this,{isCustomElement:true}))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.helpers.forEach((helper) => {\n\t\t\t\t\t\thelper.start()\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tdisconnectedCallback () {\n\t\t\t\t\tthis.helpers.forEach((helper) => {\n\t\t\t\t\t\thelper.sleep()\n\t\t\t\t\t\thelper.destroy()\n\t\t\t\t \t})\n\t\t\t\t\tthis.helpers = [] // nuke the reference for trash collection\n\t\t\t\t}\n\t\t\t}`)(Vt),r=window.sargassoOptions||{},s=void 0!==r.customElementPrefix?r.customElementPrefix:"sargasso-";customElements.define(s+Tt(e),t)}},It=["DOMChanged","didScroll","didResize","didBreakpoint","enterViewport","exitViewport","enterFullscreen","exitFullscreen","newPage","elementEvent","workerOnMessage","observableChanged"];class Sargasso{constructor(e,t={}){validate("Sargasso constructor element",e,["isDefined","isElement"]),validate("Sargasso constructor options",t,["isDefined",["isObject"]]),this.uid=++Ft,this.element=e,t.shadowDOM&&(this._shadowDOM=e.attachShadow({mode:"open"}),this._shadowRoot=document.createElement("div"),this._shadowDOM.append(this._shadowRoot),this._hostElement=this.element,this.element=this._shadowRoot),this.options=t,this._pendingAnimationFrame=void 0,this._frameQueue=[],this._isInViewport=!1,this._workers={},this._observables={},this._template=void 0,this._templateArgs={},this._started=!1,this.render=dt((()=>{this._render()}),100,{maxWait:250})}start(){const e=this.getMetaData("registeredResponsiveControllers")||[];e.push(this),this.setMetaData("registeredResponsiveControllers",e),this.setMetaData(this.constructor.name,this),Wt.push(this),this._shadowDOM&&(this._shadowDOMWatcher||(this._shadowDOMWatcher=new DOMWatcher({shadowDOM:this._shadowRoot})),this._shadowDOMWatcher.subscribe(this)),this.options.watchDOM&&Lt.subscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Ct.subscribe(this),(this.options.watchResize||this.options.watchViewport)&&Mt.subscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&Dt.subscribe(this),this.options.watchAttributes&&this.watchAttributes(),this.elementListener=e=>{e.detail&&e.detail.sargassoEvent&&-1!==It.indexOf(e.detail.sargassoEvent)?this[e.detail.sargassoEvent].apply(this,e.detail.sargassoEventOptions||[]):this.elementEvent(e)},this.element.addEventListener("sargasso",this.elementListener),this._started=!0}sleep(){this._shadowDOM&&this._shadowDOMWatcher.unSubscribe(this),this.options.watchDOM&&Lt.unSubscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Ct.unSubscribe(this),(this.options.watchResize||this.options.watchViewport)&&Mt.unSubscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&Dt.unSubscribe(this),this.attributeObserver&&this.attributeObserver.disconnect(),this.element.removeEventListener("sargasso",this.elementListener),Ge.offAll(this.element),this._started=!1}watchAttributes(){this.attributeObserver=new MutationObserver((e=>{e.forEach((e=>{"attributes"===e.type&&this.attributeChanged(e.attributeName)}))})),this.attributeObserver.observe(this._hostElement||this.element,{attributes:!0})}DOMChanged(e){}didScroll(){}didResize(){}didBreakpoint(){}enterViewport(){}exitViewport(){}enterFullscreen(){}exitFullscreen(){}newPage(e,t){}elementEvent(e){}workerOnMessage(e,t){}observableChanged(e,t,r,s,n){this.render()}attributeChanged(e){}setMetaData(e,t){Ge.setMetaData(this.element,e,t)}getMetaData(e){return Ge.getMetaData(this.element,e)}on(e,t,r,s){Ge.on(this.constructor.name+"-"+this.uid,this.element,e,t,r,s)}off(e,t){Ge.off(this.constructor.name+"-"+this.uid,this.element,e,t)}once(e,t,r,s){Ge.once(this.constructor.name+"-"+this.uid,this.element,e,t,r,s)}notifyAll(e,t){if(-1===It.indexOf(e))throw new Error("invalid event name "+e);for(let r=0;r<Wt.length;r++){const s=Wt[r];s!==this&&s[e]&&s[e].apply(s,t)}}notifyElement(e,t,r){if(-1===It.indexOf(t))throw new Error("invalid event name "+t);const s=this.getMetaData("registeredResponsiveControllers");if(s)for(let e=0;e<s.length;e++){const n=s[e];n!==this&&n[t]&&n[t].apply(n,r)}}queueFrame(e){this._frameQueue.push(e.bind(this)),this._pendingAnimationFrame||(this._pendingAnimationFrame=requestAnimationFrame((()=>{this._processQueue()})))}wantFullscreen(e){e?this.enterFullscreen():this.exitFullscreen()}hasClass(e){return Ge.hasClass(this.element,e)}addClass(e){Ge.addClass(this.element,e)}removeClass(e){Ge.removeClass(this.element,e)}setCSS(e){Ge.setCSS(this.element,e)}isVisible(){return Ge.isVisible(this.element)}workerStart(e,t){return this._workers[e]=Pt.registerWorker(e,t),Pt.subscribe(this,e),this._workers[e]}workerPostMessage(e,t){t.uid||(t.uid=this.uid),this._workers[e]&&this._workers[e].postMessage(t)}getObservable(e){return this._observables[e]}getObservableData(e){return this._observables[e].data}observableStart(e,t){return Rt.subscribe(this,e,t),this._observables[e]=Rt.getObservable(e),this._observables[e]}observableStop(e){this._observables[e]&&(Rt.unSubscribe(this,e),delete this._observables[e])}observableStopAll(){for(const e in this._observables)this.observableStop(e)}setTemplate(e){this._template=e}setRenderer(e){this.renderer=e}setTemplateArgs(e={}){this._templateArgs=e,this.render()}getTemplateArgs(){const e=this._templateArgs||[];return JSON.parse(JSON.stringify(e))}_render(){this._template&&this.renderer&&this.renderer(this._template.apply(this,this.getTemplateArgs()),this.element)}_flushQueue(){this._pendingAnimationFrame&&(cancelAnimationFrame(this._pendingAnimationFrame),this._pendingAnimationFrame=void 0),this._frameQueue=[]}_processQueue(){this._pendingAnimationFrame=void 0;const e=this._frameQueue.slice(0);this._frameQueue=[];for(let t=0;t<e.length;t++)e[t]()}_stopWorker(e){this._workers[e]&&(Pt.unSubscribe(this,e),delete this._workers[e])}_stopAllWorkers(){for(const e in this._workers)this._stopWorker(e)}destroy(){this._stopAllWorkers(),this.observableStopAll(),this._flushQueue(),this._started&&this.sleep();const e=this.getMetaData("registeredResponsiveControllers");e&&-1!==e.indexOf(this)&&(e.splice(e.indexOf(this),1),this.setMetaData("registeredResponsiveControllers",e)),this.setMetaData(this.constructor.name,null),this.element=null,-1!==Wt.indexOf(this)&&Wt.splice(Wt.indexOf(this),1)}watchDOM(e){e===this._shadowRoot?Lt.observeDOM(this._shadowRoot):this.DOMChanged(e)}watchScroll(){this.options.watchViewport&&this.inViewport(),this.didScroll()}watchResize(){this.options.watchViewport&&this.inViewport(),this.didResize()}watchOrientation(){!window.orientation||90!==window.orientation&&-90!==window.orientation?this.wantFullscreen(!1):this.wantFullscreen(!0)}inViewport(){Ct.inViewPort(this.element)?this._isInViewport||(this.enterViewport(),this._isInViewport=!0):this._isInViewport&&(this.exitViewport(),this._isInViewport=!1)}workerMessage(e,t){t.data.uid===this.uid&&this.workerOnMessage(e,t.data)}nativeRequestFullScreen(){if(document.fullscreenElement){if(document.fullscreenElement===this.element)return;document.exitFullscreen()}this.element.requestFullscreen()}nativeExitFullScreen(){document.fullscreenElement&&document.fullscreenElement===this.element&&document.exitFullscreen()}}registerSargassoClass("Sargasso",Sargasso);class LazyInstantiate extends Sargasso{constructor(e,t={}){t.watchScroll=!0,t.watchResize=!0,t.watchDOM=!0,t.immortal=!0,super(e,t)}didResize(){super.didResize(),this.lazyHandler()}didScroll(){super.didScroll(),this.lazyHandler()}DOMChanged(e){super.DOMChanged(e),this.lazyHandler(e)}lazyHandler(e=document){const t=e.querySelectorAll("[data-lazy-sargasso-class]");for(let e=0;e<t.length;e++){const r=t[e];if(Ct.inViewPort(r)){const s=r.getAttribute("data-lazy-sargasso-class").split(/\s*,\s*/);for(let r=0;r<s.length;r++){new Vt[s[r]](t[e]).start()}r.removeAttribute("data-lazy-sargasso-class")}}}}registerSargassoClass("LazyInstantiate",LazyInstantiate);class SargassoSupervisor extends Sargasso{constructor(e,t={}){super(e,{watchDOM:!0,mortal:!1}),this.lazy=new LazyInstantiate(e,t)}start(){this.lazy.start(),super.start()}instantiate(e){const t=e.getAttribute("data-sargasso-class").split(/\s*,\s*/);for(let r=0;r<t.length;r++)try{new Vt[t[r]](e).start()}catch(e){console.log("error instantiating "+t[r],e,Vt)}e.removeAttribute("data-sargasso-class")}newPage(){this.doIt()}DOMChanged(e){this.doIt(e)}doIt(e=document.body){e.getAttribute("data-sargasso-class")&&this.instantiate(e);const t=e.querySelectorAll("[data-sargasso-class]");for(const e of t)this.instantiate(e);const r=[];for(let e=0;e<Wt.length;e++)Wt[e].options.immortal||Wt[e].options.isCustomElement||document.body.contains(Wt[e].element)||r.push(Wt[e]);for(let e=0;e<r.length;e++)r[e].destroy()}}registerSargassoClass("SargassoSupervisor",SargassoSupervisor);const Nt=window.breakpoints||{widths:[{className:"breakpoint-phone",maxWidth:599},{className:"breakpoint-tablet",maxWidth:904},{className:"breakpoint-desktop",maxWidth:void 0}]};class Breakpoints extends Sargasso{constructor(e,t={}){t.watchResize=!0,super(e,t),this.options.widths=t.widths||Nt,this.scale=void 0,this.widths=[],this.classes=[],this.debouncedDetectGeometry=dt((()=>{this.detectGeometry()}),100,{maxWait:150})}start(){super.start(),this.debouncedDetectGeometry()}didResize(){this.debouncedDetectGeometry()}detectGeometry(){const e=window.doBreakpoints(this.options.widths);if(e!==this.scale){const frame=()=>{this.notifyAll("didBreakpoint",[e])};this.queueFrame(frame)}this.scale=e}}registerSargassoClass("Breakpoints",Breakpoints);class HijaxLoader extends Sargasso{constructor(e,t={}){t.watchDOM=!0,t.immortal=!0,super(e,t),this.excludeRegex=new RegExp("^(//|http|javascript|mailto|#)","i"),this.currentPage=location.pathname+location.search,this.cachedMarkup={}}start(){const e=document.querySelectorAll("[data-hijax-skip-unchanged]");for(let t=0;t<e.length;t++){const r=e[t],s=r.getAttribute("id");this.cachedMarkup[s]=r.innerHTML}super.start(),window.addEventListener("popstate",(e=>{this.watchPopState(e)}),!1)}DOMChanged(e){super.DOMChanged(e),this.hijaxLinks(e)}watchPopState(e){location.pathname+location.search!==this.currentPage&&this.preFlight(location.pathname+location.search)}hijaxLinks(e){const t=e?e.getElementsByTagName("a"):this.element.getElementsByTagName("a");for(let e=0;e<t.length;e++){const r=t[e],s=r.getAttribute("href");!s||r.getAttribute("data-hijaxed")||r.getAttribute("target")||r.hasAttribute("data-no-hijax")||this.excludeRegex.exec(s)||(r.setAttribute("data-hijaxed",!0),r.addEventListener("click",(e=>{e.preventDefault(),this.setPage(s)}),!1))}}setPage(e,t){e===this.currentPage||t?this.preFlight(e):(history.pushState(null,null,e),this.watchPopState())}preFlight(e){if(!this.options.preFlight)return this.loadPage(e);this.options.preFlight(e,((t,r,s)=>{t&&(this.options.onError?this.options.onError("danger",t):alert("Error loading page: "+t)),r?this.currentPage=location.pathname+location.search:this.loadPage(s||e)}))}loadPage(e){this.queueFrame((()=>{Ge.addClass(document.body,"hijax-loading")})),this.options.onExitPage&&this.options.onExitPage();const t=new XMLHttpRequest;t.open("GET",e),t.setRequestHeader("Sargasso-Hijax",1),t.setRequestHeader("x-digitopia-hijax",1),this.options.onLoading&&(this.options.onLoading(),t.onreadystatechange=this.options.onLoading),t.onload=()=>{if(301===t.status||302===t.status||t.getResponseHeader("Sargasso-Location")){const e=t.getResponseHeader("Location")?t.getResponseHeader("Location"):t.getResponseHeader("Sargasso-Location");this.setPage(e)}else if(200===t.status){Ct.scrollTop(0),this.mergePage(t.responseText);const e=this.currentPage,frame=()=>{this.notifyAll("newPage",[e,location.pathname+location.search]),Ge.removeClass(document.body,"hijax-loading")};this.queueFrame(frame),this.currentPage=location.pathname+location.search}else{const e=t.getResponseHeader("Sargasso-Flash-Level")||"danger";let r=t.getResponseHeader("Sargasso-Flash-Message")||t.statusText;r||(r="Could not connect to server."),this.options.onError?this.options.onError(e,r):alert("Error loading page: "+r)}},t.send()}processScripts(e){Array.from(e).forEach((e=>{e.remove();const t=e.getAttribute("id");document.getElementById(t)||document.getElementsByTagName("head")[0].appendChild(e)}))}mergePage(e){const t=document.querySelectorAll("[data-ephemeral]");Array.from(t).forEach((e=>{e.remove()}));const r=e.split(/(<body[^>]*>|<\/body>)/gi),s=makeFragment(r[2]),n=document.querySelectorAll("[data-hijax]");for(let e=0;e<n.length;e++){const t=n[e],r=t.getAttribute("id"),i=s.getElementById(r);if(t.hasAttribute("data-hijax-skip-unchanged")){if(this.cachedMarkup[r]===i.innerHTML)continue;this.cachedMarkup[r]=i.innerHTML}const o=t.getAttribute("data-hijax-cache-key-selector");if(o&&i.querySelector(o)&&t.querySelector(o)&&t.querySelector(o).getAttribute("data-hijax-cache-key")===i.querySelector(o).getAttribute("data-hijax-cache-key"))continue;this.processScripts(i.querySelectorAll("script"));const frame=()=>{t.parentNode.replaceChild(i,t),this.options.onEnterPage&&this.options.onEnterPage(),this.hijaxLinks(i)};this.queueFrame(frame)}}}registerSargassoClass("HijaxLoader",HijaxLoader);const makeFragment=e=>{if(document.createRange&&document.createRange().createContextualFragment)return document.createRange().createContextualFragment(e);const t=document.createDocumentFragment(),r=document.createElement("div");return r.insertAdjacentHTML("afterBegin",e),t.appendChild(r),t};e.loadPageHandler=void 0;var Ht=Object.prototype.hasOwnProperty,$t=Object.prototype.toString,qt=function forEach(e,t,r){if("[object Function]"!==$t.call(t))throw new TypeError("iterator must be a function");var s=e.length;if(s===+s)for(var n=0;n<s;n++)t.call(r,e[n],n,e);else for(var i in e)Ht.call(e,i)&&t.call(r,e[i],i,e)},Ut=api;function api(e,t,r){if(3===arguments.length)return api.set(e,t,r);if(2===arguments.length)return api.get(e,t);var s=api.bind(api,e);for(var n in api)api.hasOwnProperty(n)&&(s[n]=api[n].bind(s,e));return s}api.get=function get(e,t){for(var r=Array.isArray(t)?t:api.parse(t),s=0;s<r.length;++s){var n=r[s];if("object"!=typeof e||!(n in e))throw new Error("Invalid reference token: "+n);e=e[n]}return e},api.set=function set(e,t,r){var s=Array.isArray(t)?t:api.parse(t),n=s[0];if(0===s.length)throw Error("Can not set the root object");for(var i=0;i<s.length-1;++i){var o=s[i];"string"!=typeof o&&"number"!=typeof o&&(o=String(o)),"__proto__"!==o&&"constructor"!==o&&"prototype"!==o&&("-"===o&&Array.isArray(e)&&(o=e.length),n=s[i+1],o in e||(n.match(/^(\d+|-)$/)?e[o]=[]:e[o]={}),e=e[o])}return"-"===n&&Array.isArray(e)&&(n=e.length),e[n]=r,this},api.remove=function(e,t){var r=Array.isArray(t)?t:api.parse(t),s=r[r.length-1];if(void 0===s)throw new Error('Invalid JSON pointer for remove: "'+t+'"');var n=api.get(e,r.slice(0,-1));if(Array.isArray(n)){var i=+s;if(""===s&&isNaN(i))throw new Error('Invalid array index: "'+s+'"');Array.prototype.splice.call(n,i,1)}else delete n[s]},api.dict=function dict(e,t){var r={};return api.walk(e,(function(e,t){r[t]=e}),t),r},api.walk=function walk(e,t,r){var s=[];r=r||function(e){var t=Object.prototype.toString.call(e);return"[object Object]"===t||"[object Array]"===t},function next(e){qt(e,(function(e,n){s.push(String(n)),r(e)?next(e):t(e,api.compile(s)),s.pop()}))}(e)},api.has=function has(e,t){try{api.get(e,t)}catch(e){return!1}return!0},api.escape=function escape(e){return e.toString().replace(/~/g,"~0").replace(/\//g,"~1")},api.unescape=function unescape(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")},api.parse=function parse(e){if(""===e)return[];if("/"!==e.charAt(0))throw new Error("Invalid JSON pointer: "+e);return e.substring(1).split(/\//).map(api.unescape)},api.compile=function compile(e){return 0===e.length?"":"/"+e.map(api.escape).join("/")};const cloneObj=(e,t)=>{Object.keys(e).forEach((r=>{Array.isArray(e[r])?(t[r]=[],cloneObj(e[r],t[r])):"object"==typeof e[r]?(t[r]={},cloneObj(e[r],t[r])):t[r]=e[r]}))};const Qt={registerSargassoClass:registerSargassoClass,bootSargasso:(t={})=>{if(t.scrollElement&&Ct.setOptions(t),t.breakpoints){new Breakpoints(document.body,t.breakpoints).start()}if(t.hijax){const r=new HijaxLoader(document.body,t.hijax);r.start(),e.loadPageHandler=r.setPage.bind(r)}else e.loadPageHandler=e=>{document.location.href=e};const r=new SargassoSupervisor(document.body,t);return r.start(t),r},elementTools:Ge,validate:validate,setValidator:setValidator,getObservable:getObservable},Bt={theDOMWatcher:Lt,theScrollWatcher:Ct,theResizeWatcher:Mt,theOrientationWatcher:Dt,theWorkerWatcher:Pt,theObservableObjectWatcher:Rt},Gt={liveElements:Wt,registeredClasses:Vt,elementMetaData:Be};return e.ObservableClient=class ObservableClient extends ObservableObject{constructor(e,t={},r={}){validate("ObservableClient constructor endpoint",r.endpoint,["isDefined","isString"]),super(e,t,r),this.socket=null,this.connected=!1,this.socket=(r.io||io)(this.options.endpoint),this.socket.on("error",(e=>{this.emit("error",{message:"socket error",error:e})})),this.socket.on("connect_error",(e=>{this.emit("error",{message:"connect_error",error:e}),this.connected=!1})),this.socket.on("disconnect",(e=>{this.emit("error",{message:"disconnect",reason:e}),this.connected=!1})),this.socket.on("connect",(()=>{this.socket.emit("authenticate",this.id,this.getSource(),this.authenticateHandler.bind(this))})),this.socket.on("change",(e=>{for(const t of e.changes){const e=t.type,r=t.currentPath,s=t.newValue,n=(t.previousValue,"/"+r.replace(/\./g,"/"));"update"!==e&&"add"!==e||Ut.has(this.unproxied,n)&&Ut.get(this.unproxied,n)===s||Ut.set(this.unproxied,n,s),"delete"===e&&Ut.has(this.unproxied,n)&&Ut.remove(this.unproxied,n)}this.sync(e.changes,e.source),this.emit("sync_from_server")})),this.options.authoritative||this.socket.on("init",(e=>{cloneObj(e.init,this.unproxied),this.sync(e.changes,e.source),this.emit("initialized")}))}authenticateHandler(e){"ok"===e.status?(this.options.authoritative&&this.socket.emit("init",{source:this.getSource(),init:this.unproxied,changes:[{type:"init"}]}),this.connected=!0,this.emit("status","connected")):this.emit("error",{message:"ObservableClient authentication failed",error:e})}getSource(){return super.getSource()+":client:"+this.socket.id}destroy(){this.socket&&this.socket.disconnect(!0),super.destroy()}sync(e,t){super.sync(e),t===this.getSource()&&this.socket&&this.connected&&this.socket.emit("change",{sourceId:this.getSource(),changes:e},(e=>{"ok"!==e.status?this.emit("error",{message:"sync error",response:e}):this.emit("status","sync ok")}))}},e.ObservableObject=ObservableObject,e.Sargasso=Sargasso,e.services=Bt,e.system=Gt,e.utils=Qt,e}({});
//# sourceMappingURL=sargasso.iife.min.js.map
{
"name": "@pelagiccreatures/sargasso",
"version": "2.3.5",
"version": "2.4.0",
"description": "Simple, Fast, Reactive, Supervised Javascript controllers for custom html elements.",

@@ -10,3 +10,4 @@ "type": "module",

"includeNodeModules": {
"lit-html": false
"lit-html": false,
"events": true
}

@@ -22,11 +23,11 @@ }

"lazy load",
"web components",
"pwa",
"web app",
"hijax",
"animation-frame",
"custom-elements",
"progressive-enhancement"
"animation frame",
"custom elements",
"progressive enhancement"
],
"scripts": {
"test": "npx mocha-chrome http://localhost:8000/tests/index.html --ignore-exceptions",
"build": "npx rollup --no-treeshake -c rollup.config.js",

@@ -44,9 +45,8 @@ "build-module": "sh build-module.sh"

"core-js": "^3.29.1",
"eslint": "^8.36.0",
"eslint": "^8.37.0",
"mocha": "^10.2.0",
"mocha-chrome": "^2.2.0",
"parcel": "^2.8.3",
"rollup": "^3.20.2",
"setimmediate": "^1.0.5",
"sinon": "^15.0.2"
"sinon": "^15.0.3"
},

@@ -57,2 +57,4 @@ "peerDependencies": {

"dependencies": {
"events": "^3.3.0",
"json-pointer": "^0.6.2",
"lodash": "^4.17.21",

@@ -59,0 +61,0 @@ "observable-slim": "^0.1.6"

@@ -1,2 +0,2 @@

### Simple, Fast, Supervised ES6 Custom Element and Web Component Framework for Web Sites and Progressive Web Apps.
### Simple, Fast, Supervised ES6 Custom Element and Web Component Framework for simplifying development of Web Sites and Progressive Web Apps.

@@ -10,6 +10,8 @@ [@pelagiccreatures/sargasso](https://www.npmjs.com/package/@pelagiccreatures/sargasso)

@license MIT
Made in Barbados 🇧🇧 Copyright © 2020-2022 Michael Rhodes
Made in Barbados 🇧🇧 Copyright © 2020-2023 Michael Rhodes
```
### Sargasso Is a Framework for:
* Custom Elements
* Web Components
* Web pages

@@ -19,3 +21,3 @@ * PWA (Progressive Web Apps)

### Key features
### Key features / Technology
* Supervises creation and clean destruction of custom elements as content changes

@@ -25,3 +27,3 @@ * Fast, Debounced UI Events ('resize', 'scroll', etc.)

* Web worker management and event subscriptions
* Observable Data (proxy/reflect)
* Observable Data (proxy/reflect/socket.io for client/server data sharing)
* Simplified CSS class & CSS style manipulation

@@ -28,0 +30,0 @@ * Weak Map metadata

@@ -28,5 +28,5 @@ import commonjs from '@rollup/plugin-commonjs'

json(),
nodeResolve(),
nodeResolve({ preferBuiltins: false, mainFields: ['browser'] }),
commonjs()
]
}

@@ -23,3 +23,2 @@

const testElement = document.createElement('div')

@@ -475,2 +474,43 @@ testElement.setAttribute('id', 'test-element')

it('ObservedClient', (done) => {
fetch('http://localhost:8000/observable/todo?reset=true')
.then((response) => {
return response.json()
})
.then((jsonData) => {
expect(jsonData.lastId).to.equal(0)
done()
})
})
it('ObservableClient', (done) => {
const observed1 = new SargassoModule.ObservableClient('todo', undefined, { endpoint: 'http://localhost:8000', io: io })
// wait for init
observed1.on('initialized', () => {
expect(observed1.data.lastId).to.equal(0)
// call test harness on server side which adds a todo item and updates lastId
fetch('http://localhost:8000/observable/todo?push=true')
.then((response) => {
return response.json()
})
.then((jsonData) => {
expect(jsonData.lastId).to.equal(1)
expect(observed1.data.lastId).to.equal(1)
observed1.data.lastId = 2
fetch('http://localhost:8000/observable/todo')
.then((response) => {
return response.json()
})
.then((jsonData) => {
expect(jsonData.lastId).to.equal(2)
done()
})
})
})
})
/*

@@ -477,0 +517,0 @@ excercises

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc