@pelagiccreatures/sargasso
Advanced tools
Comparing version 2.4.1 to 2.4.2
@@ -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="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}({}); | ||
var SargassoModule=function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}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,u=Object.prototype,h=u.hasOwnProperty,d=u.toString,p=l?l.toStringTag:void 0;var f=function getRawTag$1(e){var t=h.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=function objectToString$1(e){return b.call(e)},v=f,m=g,w=o?o.toStringTag:void 0;var y=function baseGetTag$1(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":w&&w in Object(e)?v(e):m(e)};var O=function isObjectLike$1(e){return null!=e&&"object"==typeof e},E=y,x=O;var _=function isSymbol$2(e){return"symbol"==typeof e||x(e)&&"[object Symbol]"==E(e)},S=a,k=c,j=_,A=o?o.prototype:void 0,L=A?A.toString:void 0;var C=function baseToString$1(e){if("string"==typeof e)return e;if(k(e))return S(e,baseToString$1)+"";if(j(e))return L?L.call(e):"";var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t},D=C;var M=function toString$5(e){return null==e?"":D(e)};var P=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},R=P;var T=function castSlice$1(e,t,r){var s=e.length;return r=void 0===r?s:r,!t&&r>=s?e:R(e,t,r)},F=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var W=function hasUnicode$2(e){return F.test(e)};var z=function asciiToArray$1(e){return e.split("")},V="\\ud800-\\udfff",I="["+V+"]",N="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",H="\\ud83c[\\udffb-\\udfff]",$="[^"+V+"]",q="(?:\\ud83c[\\udde6-\\uddff]){2}",U="[\\ud800-\\udbff][\\udc00-\\udfff]",Q="(?:"+N+"|"+H+")"+"?",B="[\\ufe0e\\ufe0f]?",G=B+Q+("(?:\\u200d(?:"+[$,q,U].join("|")+")"+B+Q+")*"),Z="(?:"+[$+N+"?",N,q,U,I].join("|")+")",J=RegExp(H+"(?="+H+")|"+Z+G,"g");var K=function unicodeToArray$1(e){return e.match(J)||[]},Y=z,X=W,ee=K;var te=function stringToArray$1(e){return X(e)?ee(e):Y(e)},re=T,se=W,ne=te,ie=M;var oe=function createCaseFirst$1(e){return function(t){t=ie(t);var r=se(t)?ne(t):void 0,s=r?r[0]:t.charAt(0),n=r?re(r,1).join(""):t.slice(1);return s[e]()+n}},ae=oe("toUpperCase"),ce=M,le=ae;var ue=function capitalize$1(e){return le(ce(e).toLowerCase())};var he=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 de=function basePropertyOf$1(e){return function(t){return null==e?void 0:e[t]}},pe=de({"À":"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"}),fe=pe,be=M,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var me=function deburr$1(e){return(e=be(e))&&e.replace(ge,fe).replace(ve,"")},we=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var ye=function asciiWords$1(e){return e.match(we)||[]},Oe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var Ee=function hasUnicodeWord$1(e){return Oe.test(e)},xe="\\ud800-\\udfff",_e="\\u2700-\\u27bf",Se="a-z\\xdf-\\xf6\\xf8-\\xff",ke="A-Z\\xc0-\\xd6\\xd8-\\xde",je="\\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",Ae="["+je+"]",Le="\\d+",Ce="["+_e+"]",De="["+Se+"]",Me="[^"+xe+je+Le+_e+Se+ke+"]",Pe="(?:\\ud83c[\\udde6-\\uddff]){2}",Re="[\\ud800-\\udbff][\\udc00-\\udfff]",Te="["+ke+"]",Fe="(?:"+De+"|"+Me+")",We="(?:"+Te+"|"+Me+")",ze="(?:['’](?:d|ll|m|re|s|t|ve))?",Ve="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ie="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",Ne="[\\ufe0e\\ufe0f]?",He=Ne+Ie+("(?:\\u200d(?:"+["[^"+xe+"]",Pe,Re].join("|")+")"+Ne+Ie+")*"),$e="(?:"+[Ce,Pe,Re].join("|")+")"+He,qe=RegExp([Te+"?"+De+"+"+ze+"(?="+[Ae,Te,"$"].join("|")+")",We+"+"+Ve+"(?="+[Ae,Te+Fe,"$"].join("|")+")",Te+"?"+Fe+"+"+ze,Te+"+"+Ve,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Le,$e].join("|"),"g");var Ue=function unicodeWords$1(e){return e.match(qe)||[]},Qe=ye,Be=Ee,Ge=M,Ze=Ue;var Je=function words$1(e,t,r){return e=Ge(e),void 0===(t=r?void 0:t)?Be(e)?Ze(e):Qe(e):e.match(t)||[]},Ke=he,Ye=me,Xe=Je,et=RegExp("['’]","g");var tt=function createCompounder$2(e){return function(t){return Ke(Xe(Ye(t).replace(et,"")),e,"")}},rt=ue,st=tt((function(e,t,r){return t=t.toLowerCase(),e+(r?rt(t):t)})),nt=getDefaultExportFromCjs(st);const it={},setValidator=(e,t)=>{it[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=>it[e]&&it[e](t))).indexOf(!0)}return it[e]&&it[e](t)}));if(-1!==s.indexOf(!1))throw new Error("call to "+e+" invalid value: "+t+" "+r,0+s)},ot=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=ot.get(e)||{};r?s[t]=r:delete s[t],ot.set(e,s)},getMetaData=(e,t)=>{validate("getMetaData element",e,["isDefined","isElement"]),validate("getMetaData k",t,["isDefined","isString"]);const r=ot.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))},at={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=nt(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=ot.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 ct=function isObject$2(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},lt=i,now_1=function(){return lt.Date.now()},ut=/\s/;var ht=function trimmedEndIndex$1(e){for(var t=e.length;t--&&ut.test(e.charAt(t)););return t},dt=ht,pt=/^\s+/;var ft=function baseTrim$1(e){return e?e.slice(0,dt(e)+1).replace(pt,""):e},bt=ft,gt=ct,vt=_,mt=/^[-+]0x[0-9a-f]+$/i,wt=/^0b[01]+$/i,yt=/^0o[0-7]+$/i,Ot=parseInt;var Et=function toNumber$1(e){if("number"==typeof e)return e;if(vt(e))return NaN;if(gt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=gt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=bt(e);var r=wt.test(e);return r||yt.test(e)?Ot(e.slice(2),r?2:8):mt.test(e)?NaN:+e},xt=ct,_t=now_1,St=Et,kt=Math.max,jt=Math.min;var At,Lt=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=_t();if(shouldInvoke(e))return trailingEdge(e);a=setTimeout(timerExpired,function remainingWait(e){var r=t-(e-c);return h?jt(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=_t(),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=St(t)||0,xt(r)&&(u=!!r.leading,i=(h="maxWait"in r)?kt(St(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(_t())},debounced},Ct=getDefaultExportFromCjs(Lt),Dt={exports:{}},Mt=(Dt.exports,"object"==typeof Reflect?Reflect:null),Pt=Mt&&"function"==typeof Mt.apply?Mt.apply:function ReflectApply(e,t,r){return Function.prototype.apply.call(e,t,r)};At=Mt&&"function"==typeof Mt.ownKeys?Mt.ownKeys:Object.getOwnPropertySymbols?function ReflectOwnKeys(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function ReflectOwnKeys(e){return Object.getOwnPropertyNames(e)};var Rt=Number.isNaN||function NumberIsNaN(e){return e!=e};function EventEmitter(){EventEmitter.init.call(this)}Dt.exports=EventEmitter;Dt.exports.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 Tt=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 Tt},set:function(e){if("number"!=typeof e||e<0||Rt(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Tt=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||Rt(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)Pt(a,this,t);else{var c=a.length,l=arrayClone(a,c);for(r=0;r<c;++r)Pt(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?At(this._events):[]};var Ft,Wt,zt,Vt,It,Nt,Ht=getDefaultExportFromCjs(Dt.exports),$t={exports:{}},qt=($t.exports,Ft=[],Wt=[],zt=[],Vt=[],It=null,Nt=function(e,t,r,s){var n=r||null,i=s||[{target:e,property:""}];Ft.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!==zt[s.__targetPosition])for(var o=Vt[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}),Nt(s,t,n,l)}return s},deleteProperty:function(e,t){var r=!0;It===l&&(r=!1,It=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=zt.length;i<a&&e!==zt[i];i++);for(var c=Vt[i]||[],u=c.length;u--;)c[u].proxy!==l&&(It=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;It===l&&(i=!1,It=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=Vt[d].length;p--;)if(n===Vt[d][p].observable&&null!==zt[Vt[d][p].observable.parentTarget.__targetPosition]){c=!0;break}if(c){for(var f=Vt[d],b=0,g=f.length;b<g;b++)f[b].proxy!==l&&(It=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=zt.length;r<s;r++)if(e===zt[r]){o=r;break}if(o>-1){for(var a=Vt[o],c=a.length;c--;)if(n===a[c].observable){a.splice(c,1);break}0==a.length&&(zt[o]=null)}}(a)}}),1e4)}}c&&_notifyObservers(o.length)}return!0}},c=e.__targetPosition;c>-1||Object.defineProperty(e,"__targetPosition",{value:zt.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},Wt.push(n));var u={target:e,proxy:l,observable:n};return c>-1?(null===zt[c]&&(zt[c]=e),Vt[c].push(u)):(zt.push(e),Vt.push([u])),l},{create:function(e,t,r){!0===e.__isProxy&&(e=e.__getTarget);var s=Nt(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=Wt.length;r--;)if(Wt[r].parentProxy===e){Wt[r].observers.push(t);break}},pause:function(e){for(var t=Wt.length,r=!1;t--;)if(Wt[t].parentProxy===e){Wt[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=Wt.length,r=!1;t--;)if(Wt[t].parentProxy===e){Wt[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=Wt.length,r=!1;t--;)if(Wt[t].parentProxy===e){Wt[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=Wt.length,r=!1;t--;)if(Wt[t].parentProxy===e){Wt[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=Wt.length;s--;)if(Wt[s].parentProxy===e){t=Wt[s],r=!0;break}for(var n=Vt.length;n--;)for(var i=Vt[n].length;i--;)Vt[n][i].observable===t&&(Vt[n].splice(i,1),0===Vt[n].length&&(zt[n]=null));!0===r&&Wt.splice(s,1)}});try{$t.exports=qt}catch(e){}var Ut=getDefaultExportFromCjs($t.exports);const Qt={},getObservable=e=>Qt[e];class ObservableObject extends Ht{constructor(e,t={},r={}){if(super(),this.id=e,Qt[this.id])throw new Error("ObservableObject "+e+" already exists.");this.bound={},this.unproxied=t,this.data=Ut.create(t,!1,(e=>{this.sync(e,this.getSource())})),this.options=r,Qt[this.id]=this}getSource(){return this.id}destroy(){Ut.pause(this.data),delete Qt[this.id],delete this.data,Object.keys(this.bound).forEach((e=>{Object.keys(this.bound[e]).forEach((t=>{this.unbind(t,e)}))})),Ut.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 Bt,Gt,Zt,Jt,Kt,Yt;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=Ct(((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])}}Bt=new DOMWatcher,Gt=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(),at.on("theScrollWatcher",this.scrollElement,"scroll",(()=>{this.trigger()}))}sleep(){super.sleep(),at.off("theScrollWatcher",this.scrollElement,"scroll")}inViewPort(e){return at.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}}},Zt=new class ResizeWatcher extends ObserverSubscriptionManager{constructor(e){super(e),this.debounce=Ct((()=>{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")}},Jt=new class OrientationWatcher extends ObserverSubscriptionManager{constructor(e){super(e),"onorientationchange"in window?at.addClass(document.body,"have-orientation"):at.addClass(document.body,"no-orientation"),this.debounce=Ct((()=>{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")}},Kt=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()}},Yt=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 Xt=tt((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),er=getDefaultExportFromCjs(Xt);let tr=0;const rr=[],sr="customElements"in window,nr={},registerSargassoClass=(e,t)=>{if(nr[e])throw new Error("Sargasso class "+e+" is already registered.");if(nr[e]=t,sr){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}`)(nr),r=window.sargassoOptions||{},s=void 0!==r.customElementPrefix?r.customElementPrefix:"sargasso-";customElements.define(s+er(e),t)}},ir=["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=++tr,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=Ct((()=>{this._render()}),100,{maxWait:250})}start(){const e=this.getMetaData("registeredResponsiveControllers")||[];e.push(this),this.setMetaData("registeredResponsiveControllers",e),this.setMetaData(this.constructor.name,this),rr.push(this),this._shadowDOM&&(this._shadowDOMWatcher||(this._shadowDOMWatcher=new DOMWatcher({shadowDOM:this._shadowRoot})),this._shadowDOMWatcher.subscribe(this)),this.options.watchDOM&&Bt.subscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Gt.subscribe(this),(this.options.watchResize||this.options.watchViewport)&&Zt.subscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&Jt.subscribe(this),this.options.watchAttributes&&this.watchAttributes(),this.elementListener=e=>{e.detail&&e.detail.sargassoEvent&&-1!==ir.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&&Bt.unSubscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Gt.unSubscribe(this),(this.options.watchResize||this.options.watchViewport)&&Zt.unSubscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&Jt.unSubscribe(this),this.attributeObserver&&this.attributeObserver.disconnect(),this.element.removeEventListener("sargasso",this.elementListener),at.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){at.setMetaData(this.element,e,t)}getMetaData(e){return at.getMetaData(this.element,e)}on(e,t,r,s){at.on(this.constructor.name+"-"+this.uid,this.element,e,t,r,s)}off(e,t){at.off(this.constructor.name+"-"+this.uid,this.element,e,t)}once(e,t,r,s){at.once(this.constructor.name+"-"+this.uid,this.element,e,t,r,s)}notifyAll(e,t){if(-1===ir.indexOf(e))throw new Error("invalid event name "+e);for(let r=0;r<rr.length;r++){const s=rr[r];s!==this&&s[e]&&s[e].apply(s,t)}}notifyElement(e,t,r){if(-1===ir.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 at.hasClass(this.element,e)}addClass(e){at.addClass(this.element,e)}removeClass(e){at.removeClass(this.element,e)}setCSS(e){at.setCSS(this.element,e)}isVisible(){return at.isVisible(this.element)}workerStart(e,t){return this._workers[e]=Kt.registerWorker(e,t),Kt.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 Yt.subscribe(this,e,t),this._observables[e]=Yt.getObservable(e),this._observables[e]}observableStop(e){this._observables[e]&&(Yt.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]&&(Kt.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!==rr.indexOf(this)&&rr.splice(rr.indexOf(this),1)}watchDOM(e){e===this._shadowRoot?Bt.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(){Gt.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(Gt.inViewPort(r)){const s=r.getAttribute("data-lazy-sargasso-class").split(/\s*,\s*/);for(let r=0;r<s.length;r++){new nr[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 nr[t[r]](e).start()}catch(e){console.log("error instantiating "+t[r],e,nr)}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<rr.length;e++)rr[e].options.immortal||rr[e].options.isCustomElement||document.body.contains(rr[e].element)||r.push(rr[e]);for(let e=0;e<r.length;e++)r[e].destroy()}}registerSargassoClass("SargassoSupervisor",SargassoSupervisor);const or=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||or,this.scale=void 0,this.widths=[],this.classes=[],this.debouncedDetectGeometry=Ct((()=>{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((()=>{at.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){Gt.scrollTop(0),this.mergePage(t.responseText);const e=this.currentPage,frame=()=>{this.notifyAll("newPage",[e,location.pathname+location.search]),at.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 ar=Object.prototype.hasOwnProperty,cr=Object.prototype.toString,lr=function forEach(e,t,r){if("[object Function]"!==cr.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)ar.call(e,i)&&t.call(r,e[i],i,e)},ur=lr,hr=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){ur(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("/")};var dr=getDefaultExportFromCjs(hr);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 pr={registerSargassoClass:registerSargassoClass,bootSargasso:(t={})=>{if(t.scrollElement&&Gt.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:at,validate:validate,setValidator:setValidator,getObservable:getObservable},fr={theDOMWatcher:Bt,theScrollWatcher:Gt,theResizeWatcher:Zt,theOrientationWatcher:Jt,theWorkerWatcher:Kt,theObservableObjectWatcher:Yt},br={liveElements:rr,registeredClasses:nr,elementMetaData:ot};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||dr.has(this.unproxied,n)&&dr.get(this.unproxied,n)===s||dr.set(this.unproxied,n,s),"delete"===e&&dr.has(this.unproxied,n)&&dr.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=fr,e.system=br,e.utils=pr,e}({}); | ||
//# sourceMappingURL=sargasso.iife.min.js.map |
{ | ||
"name": "@pelagiccreatures/sargasso", | ||
"version": "2.4.1", | ||
"version": "2.4.2", | ||
"description": "Simple, Fast, Reactive, Supervised Javascript controllers for custom html elements.", | ||
@@ -37,17 +37,17 @@ "type": "module", | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^24.0.1", | ||
"@rollup/plugin-commonjs": "^24.1.0", | ||
"@rollup/plugin-json": "^6.0.0", | ||
"@rollup/plugin-node-resolve": "^15.0.1", | ||
"@rollup/plugin-terser": "^0.4.0", | ||
"@rollup/plugin-node-resolve": "^15.0.2", | ||
"@rollup/plugin-terser": "^0.4.1", | ||
"chai": "^4.3.7", | ||
"core-js": "^3.29.1", | ||
"eslint": "^8.37.0", | ||
"core-js": "^3.30.1", | ||
"eslint": "^8.39.0", | ||
"mocha": "^10.2.0", | ||
"parcel": "^2.8.3", | ||
"rollup": "^3.20.2", | ||
"rollup": "^3.21.2", | ||
"setimmediate": "^1.0.5", | ||
"sinon": "^15.0.3" | ||
"sinon": "^15.0.4" | ||
}, | ||
"peerDependencies": { | ||
"lit-html": "^2.7.0" | ||
"lit-html": "^2.7.3" | ||
}, | ||
@@ -54,0 +54,0 @@ "dependencies": { |
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 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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1728833
22943