spyne 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/spyne.esm.js +3 -3
- package/lib/spyne.esm.js.LICENSE.txt +2 -2
- package/lib/spyne.esm.js.map +1 -1
- package/lib/spyne.umd.js +2 -2
- package/lib/spyne.umd.js.LICENSE.txt +2 -2
- package/package.json +1 -1
- package/src/spyne/channels/channel-payload-class.js +112 -17
- package/src/spyne/channels/channel.js +13 -0
- package/src/spyne/channels/spyne-channel-window.js +95 -3
- package/src/spyne/spyne-app.js +5 -2
- package/src/spyne/spyne-plugins.js +17 -0
- package/src/spyne/spyne.js +11 -3
- package/src/spyne/utils/channel-fetch-util.js +3 -2
- package/src/spyne/utils/channel-payload-filter.js +26 -22
- package/src/spyne/utils/safe-clone.js +128 -2
- package/src/spyne/utils/sanitize-data.js +244 -23
- package/src/spyne/utils/sanitize-html.js +17 -40
- package/src/spyne/utils/spyne-app-properties.js +30 -0
- package/src/spyne/utils/spyne-warn.js +26 -0
- package/src/spyne/views/dom-element-template.js +93 -0
- package/src/spyne/views/dom-element.js +4 -3
- package/src/spyne/views/view-stream-selector.js +52 -47
- package/src/tests/channels/channel-payload-filter.test.js +26 -0
- package/src/tests/channels/channel-window-custom-events.test.js +130 -0
- package/src/tests/index.test.js +5 -0
- package/src/tests/utils/safe-clone.test.js +193 -0
- package/src/tests/utils/security.test.js +153 -1
- package/src/tests/views/dom-el-selectors.test.js +7 -7
- package/src/tests/views/view-stream-selector.test.js +178 -0
package/lib/spyne.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{fromEventPattern as e,Observable as t,Subject as r,bindCallback as n,fromEvent as o,of as s,ReplaySubject as i,forkJoin as a,EMPTY as c,merge as l,from as d}from"rxjs";import{compose as u,complement as h,isEmpty as E,head as p,values as N,isNil as _,allPass as f,reject as m,equals as T,keys as A,find as C,is as y,assoc as g,prop as b,when as v,__ as I,join as S,replace as L,flatten as O,map as D,toPairs as R,ifElse as H,always as w,concat as V,either as P,propEq as U,test as M,findLastIndex as W,last as x,filter as F,invert as $,defaultTo as k,reduce as G,zipObj as j,split as z,fromPairs as B,has as Y,path as K,uniq as q,chain as Q,includes as X,mergeRight as J,pickAll as Z,pick as ee,mergeDeepRight as te,clone as re,not as ne,mergeAll as oe,lte as se,match as ie,without as ae,mapObjIndexed as ce,pipe as le,forEachObjIndexed as de,flip as ue,propSatisfies as he,forEach as Ee,props as pe,omit as Ne,any as _e,curry as fe,where as me,F as Te,all as Ae,slice as Ce,toLower as ye,findIndex as ge,apply as be,identity as ve,objOf as Ie,view as Se,lensIndex as Le,lensProp as Oe,over as De,reverse as Re,curryN as He,toUpper as we,partialRight as Ve,pluck as Pe,pathEq as Ue,pathSatisfies as Me}from"ramda";import We from"dompurify";class xe{constructor(){this.checkIfObjIsNotEmptyOrNil=xe.checkIfObjIsNotEmptyOrNil.bind(this)}static checkIfObjIsNotEmptyOrNil(e){const t=u(h(E),p,N),r=u(h(_),p,N);return f([t,r])(e)}static checkIfParamValueMatchesRegex(e,t){const r=m(T("routeName")),n=u(r,A),o=u(C(t=>M(new RegExp(t),e)),n)(t);return y(String,o)&&(t=g(e,b(o,t),t)),t}static formatStrAsWindowLocation(e){return{hash:e,search:e,pathname:e}}static getLocationStrByType(e,t=!1,r=window.location){return b({slash:"pathname",query:"search",hash:"hash"}[!0===t?"hash":e],r).replace(/^(\/)?(#)?(\/)?(.*)$/,"$4")}static createRouteArrayFromParams(e,t,r="slash",n){const o=[],s=t=>{const r={},i=t.routeName;let a=void 0!==e[i]?e[i]:b(i,n);const c=typeof t[a];"string"===c?a=t[a]:"undefined"===c&&(t=this.checkIfParamValueMatchesRegex(a,t)),r[i]=a,this.checkIfObjIsNotEmptyOrNil(r)&&o.push(r);const l=y(Object,t),d=Y(a,t),u=Y("routePath",t);if(!0===(d&&l)){const e=t[a];Y("routePath",e)&&s(e.routePath)}else!0===u&&void 0!==a&&s(t.routePath)};return s(t),o}static createSlashString(e){const t=m(_),r=v(h(_,I),S("/")),n=L(/^(\^*)(.*|^\$)(\$)$/,"$2");return u(n,r,t,O,D(N))(e)}static createQueryString(e){const t=m(_),r=this.checkIfObjIsNotEmptyOrNil,n=u(S("="),O,R),o=H(r,n,w(void 0)),s=D(o),i=v(h(E),V("?"));return u(i,S("&"),t,s)(e)}static checkPayloadForRegexOverrides(e,t,r="Value"){const n=u(e=>b(`${e}${r}`,t),p,A);return D(e=>{const t=n(e);return void 0!==t?g(u(p,A)(e),t,e):e},e)}static checkForRouteValWithMultipleVals(e){const t=e=>{const t=(t,r)=>(t[r]=(e=>{const t=e.match(/^[^|]*/);return t?"^$"===t[0]?"":t[0]:e})(e[r]),t);return"object"==typeof e&&(e=Object.keys(e).reduce(t,{})),e};return!0===Array.isArray(e)?e.map(t):e}static checkForRouteValsPartMatch(e,t={}){const r=(e,t)=>t.split("|").some(t=>((e,t)=>{const r=e.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,"[\\w\\d_-]*");return new RegExp(`^${r}$`).test(t)})(t,e))?e:t;return e.map(e=>{const n={...e};return Object.keys(n).forEach(e=>{Object.prototype.hasOwnProperty.call(n,e)&&t[e]&&(n[e]=r(t[e],n[e]))}),n})}static convertParamsToRoute(e,t=it.config.channels.ROUTE,r,n){const o=void 0!==r?r:t.type,s=t.isHash,i=t.routes.routePath,a=void 0!==n?n:this.getLocationStrByType(o,s),c=this.convertRouteToParams(a,t,o).routeData;let l=this.createRouteArrayFromParams(e,i,o,c);return l=xe.checkPayloadForRegexOverrides(l,e),l=xe.checkForRouteValWithMultipleVals(l),"query"===o?this.createQueryString(l):this.createSlashString(l)}static findIndexOfMatchedStringOrRegex(e,t){const r=t.includes(".+"),n=L(/^$/,"^$"),o=P(U(e,"str"),u(M(I,e),b("re")));return u(W(T(!0)),D(o),D(e=>{return{str:e,re:(t=e,r&&(t.startsWith("^")||(t="^"+t),t.endsWith("$")||(t+="$")),new RegExp(t))};var t}),D(n))(t)}static checkIfValueShouldMapToParam(e,t,r){const n=u(D(x),D(F(y(String))),R)(e),o=xe.findIndexOfMatchedStringOrRegex(t,n);let s=t;if(o>=0){const t=n[o],r=$(e),i=u(p,k([]),b(t))(r);!0===/^([-$\w]*)$/.test(i)&&!0===y(String,i)&&(s=i)}return s}static createArrFromSlashStr(e){return e.replace(/^([/])?(.*)$/,"$2").split("/")}static convertSlashRouteStrToParamsObj(e,t,r){const n=t,o=this.createArrFromSlashStr(t),s=[],i=[];let a=e;G((e,t)=>{const n=this.checkIfValueShouldMapToParam(a,t,r);a=this.checkIfParamValueMatchesRegex(t,a);const o=P(E,_);void 0!==a&&(e=>e!==x(s))(a.routeName)&&!1===o(n)&&(s.push(a.routeName),i.push(n));const c=K([t,"routePath"],a),l=K(["routePath"],a);void 0!==c?a=c:void 0!==l&&(a=l)},0,o);const c=j(s,i),l=this.getLastArrVal(s);return{paths:s,pathInnermost:l,routeData:c,routeValue:n}}static getLastArrVal(e){return void 0!==x(t=e)?x(t):"";var t}static createDefaultParamFromEmptyStr(e,t){const r={};return r[e.routeName]=this.checkIfValueShouldMapToParam(e,t),r}static convertQueryStrToParams(e,t,r){const n=t,o=t.replace(/^([?])?(.*)$/,"$2"),s=u(D(z("=")),z("&"))(o);let i=B(s),a=D(p,s);!0===E(t)&&(i=this.createDefaultParamFromEmptyStr(e,t,r),a=A(i));return{paths:a,pathInnermost:this.getLastArrVal(a),routeData:i,routeValue:n}}static convertRouteToParams(e,t,r){if(void 0===t)return{};const n=void 0!==r?r:t.type,o=k({},b("regexTokens",t)),s=t.routes.routePath;return"query"===n?this.convertQueryStrToParams(s,e):(e=e.replace(/\/$|$/,"/"),this.convertSlashRouteStrToParamsObj(s,e,o))}}class Fe{constructor(){this.createPopStateStream=Fe.createPopStateStream.bind(this)}static createPopStateStream(t){e(function(e){window.onpopstate=e},function(){window.onpopstate=function(){}}).subscribe(t)}static getLastArrVal(e){return void 0!==x(t=e)?x(t):"";var t}static compareRouteKeywords(e={},t){const r=(e,t)=>void 0!==t?ee(t,e):e;let n=r(e,t);return{pickValues:r,compare:(e={},t)=>{const o=r(e,t),s=e=>u(A,F(U(!0,e))),i=u(D(e=>{const t=b(e,n),r=b(e,o),s=T(t,r),i=void 0!==t,a=void 0!==r,c=!s,l=!1===i&&!0===a,d=!0===i&&!1===a,u={};return u[e]={same:s,changed:c,added:l,removed:d,previousExists:i,nextExists:a},u}),q,Q(A))([n,o]),a=Q(s("changed"),i),c=Q(s("added"),i),l=Q(s("removed"),i);return n=o,{pathsAdded:c,pathsRemoved:l,pathsChanged:a}},getComparer:()=>n}}static getRouteArrData(e,t){const r=F(X(I,e),t);return{paths:r,pathInnermost:Fe.getLastArrVal(r)}}static flattenConfigObject(e){const t=e=>Q(([e,r])=>"object"!=typeof r||null===r||Array.isArray(r)?[[e,r]]:D(([t,r])=>[`${e}.${t}`,r],t(r)),R(e));return N(B(t(e)))}static addRouteDatasets(e){const{type:t,isHash:r}=e,n=n=>{const o="query"===t?"":!0===r?"#":"/",s=xe.convertParamsToRoute(n,e);return o+s.replace(/^(.*\/)([\w-]*\/?)(.*)$/gm,"$1$2")},o=/^([A-Za-z0-9_-])+$/m,s=(e=[],t,r={})=>{let{routeName:i}=t;return R(t).reduce((t,a)=>{const[c,l]=a,d=y(Object,l),u=e=>M(o,e)?(e=>String(e).replace(/([-_])/g," ").toUpperCase())(e):c;if("routeName"===c||"404"===c)return t;i=i||b("routeName",l);let h=re(r);if(h[i]=String(c).replace(/([^A-Za-z0-9-_])/g,""),!0===d){if(1===A(h).length){const e=K(["routePath","routeName"],l);if(e){const o=re(h);o[e]="",o.navLevel=A(r).length,o.title=u(c),o.href=n(o),t.push(o)}}h=s(e,l,h)}else h.title=u(c),h.href=n(h);return h.navLevel=A(r).length,t.push(h),t},[])},i=s([],e.routes);let a=O(i);a=function e(t){return t.map(t=>{for(const r in t)void 0===r||"undefined"===r||void 0===t[r]?delete t[r]:t[r]&&"object"==typeof t[r]&&!Array.isArray(t[r])&&(t[r]=e([t[r]])[0]);return t})}(a);return{routeDatasetsArr:a,routeNamesArr:(e=>{const t=m(X(I,["title","href","navLevel","undefined"]));return u(q,t,O,D(A))(e)})(a)}}static conformRouteObject(e={},t=!1){const r=K(["channels","ROUTE"],e);let{add404s:n}=void 0!==r?r:e;n=n||t;const o=e=>{const t=e[1],r=y(Array,t);return""===t?e[1]="^$":r&&(e[1]=t.join("|")),e},s=u(B,D(e=>{const[t,r]=e,i=n?{404:".+"}:{},a=y(Object,r),c=y(Array,r),l="routePath"===t;return!0===a&&!1===c&&(e[1]=s(e[1]),l&&(e[1]=u(te(i),B,D(o),R)(e[1]))),e}),R);if(void 0!==r){e.channels.ROUTE=s(e.channels.ROUTE);const t=Fe.addRouteDatasets(e.channels.ROUTE);return e.channels.ROUTE=J(e.channels.ROUTE,t),e}return s(e)}static getLocationData(){return Z(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}}const $e=Object.create({}),ke=u(ne,y(Array)),Ge=u(f([ke,y(Object)]));function je(e){return e&&"object"==typeof e&&"[object RegExp]"!==Object.prototype.toString.call(e)&&"[object Date]"!==Object.prototype.toString.call(e)}function ze(e,t){return t&&!0===t.clone&&je(e)?Ye((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function Be(e,t,r){const n=e.slice();return t.forEach(function(t,o){void 0===n[o]?n[o]=ze(t,r):je(t)?n[o]=Ye(e[o],t,r):-1===e.indexOf(t)&&n.push(ze(t,r))}),n}function Ye(e,t,r){const n=Array.isArray(t),o=(r||{arrayMerge:Be}).arrayMerge||Be;return n?Array.isArray(e)?o(e,t,r):ze(t,r):function(e,t,r){const n={};return je(e)&&Object.keys(e).forEach(function(t){n[t]=ze(e[t],r)}),Object.keys(t).forEach(function(o){je(t[o])&&e[o]?n[o]=Ye(e[o],t[o],r):n[o]=ze(t[o],r)}),n}(e,t,r)}let Ke,qe,Qe,Xe;Ye.all=function(e,t){if(!Array.isArray(e)||e.length<2)throw new Error("first argument should be an array with at least two elements");return e.reduce(function(e,r){return Ye(e,r,t)})};let Je=!0,Ze=!1;const et=[];let tt,rt;const nt=[],ot=new Map;const st=new class{constructor(){$e.foo=()=>console.log("used for testing purposes.")}addMethod(e,t,r=!1){if(!0===Object.prototype.hasOwnProperty.call($e,e)){const t=`Spyne Warning: the method name, ${e}, already exists.`;if(r)return t;console.warn(t)}else $e[e]=t}addMethods(e={},t=!1){let r;if(!1===Ge(e))return r=`Spyne Warning: the pluginMethods property, ${JSON.stringify(e)} needs to be an object.`,t?r:void console.warn(r);return A(e).map(n=>{const o=b(n,e);if("function"==typeof o)this.addMethod(n,o,t);else{if(r=`the value for ${n} is not a valid function.`,t)return r;console.warn(r)}}).join(",")}checkIfMethodExists(e){}get pluginMethodsObj(){return $e}};const it=new class{constructor(){Xe=!1}get channelsMap(){return Qe}get initialized(){return Xe}get config(){return Ke}get debug(){return Je}get mode(){return void 0!==Ke?.mode?Ke.mode:"app"}static listChannels(){return Array.from(qe.map.keys())}initialize(e={},t={},r,n){return qe=r,Ke=Ye(e,t),Ke.channels&&Ke.channels.ROUTE&&(Ke=n.conformRouteObject(Ke)),rt=Ke?.IMG_PATH,Je=void 0!==Ke.debug?Ke.debug:Je,this.getChannelActions=qe.getChannelActions.bind(qe),this.listRegisteredChannels=qe.listRegisteredChannels.bind(qe),Xe=!0,this._initialized=Xe,this.setChannelsMap(),t?.baseHref&&this.setHeadBaseHref(t.baseHref),Ke}setHeadBaseHref(e){const t=document.createElement("base");t.href=e,document.head.appendChild(t)}conformRouteConfig(e=!1){Ke=Fe.conformRouteObject(Ke,e)}setChannelsMap(){const e=qe.getStream.bind(qe),t=qe.testStream.bind(qe),r=qe.getProxySubject.bind(qe);Qe={getStream:e,testStream:t,getProxySubject:r}}setProp(e,t,r=!1){return r?Ke.ephemeralProps[e]=t:Ke.tmpProps[e]=t,t}getProp(e){if(Ke?.tmpProps&&Object.prototype.hasOwnProperty.call(Ke.tmpProps,e))return Ke.tmpProps[e];if(Ke?.ephemeralProps&&Object.prototype.hasOwnProperty.call(Ke.ephemeralProps,e)){const t=Ke.ephemeralProps[e];return delete Ke.ephemeralProps[e],t}}createTempProp(e){const t=Math.random().toString(36).slice(2,8);return this.setProp(t,e,!0),t}setChannelConfig(e,t){return Ke.channels[e]=t,Ke.channels[e]}getChannelConfig(e,t=Ke){if("CHANNEL_ROUTE"===e?e="ROUTE":"CHANNEL_WINDOW"===e&&(e="WINDOW"),void 0===t||void 0===Ke.channels)return void console.warn("Spyne warning: Spyne config object is empty!");const r=Ke.channels[e];if(void 0!==r)return r;console.warn(`Spyne warning: Spyne configuration for channel, ${e} is empty!`)}registerChannel(){}addPluginConfig(e,t={}){void 0===Ke.plugins&&(Ke.plugins={}),this.addPluginMethods(t.pluginMethods),Ke.plugins[e]=t}getPluginsMethodObj(e){return e&&this.addPluginMethods(e),st.pluginMethodsObj}addPluginMethods(e){e&&st.addMethods(e)}doNotTrackChannel(e){nt.push(e)}getUntrackedChannelsList(){return nt}registerProxyReviver(e,t){ot.set(e,t)}registerPlugin(e){this._initialized||console.warn("SpyneApp is not initialized yet. Plugin will not be fully registered."),e.register(this)}getProxyReviver(e){return ot.get(e)}getPluginConfigByPluginName(e){return Ke.plugins[e]}get IMG_PATH(){return rt}get excludeChannelsFromConsole(){return et}set excludeChannelsFromConsole(e){"string"==typeof e?et.includes(e)||et.push(e):Array.isArray(e)?e.forEach(e=>{"string"!=typeof e||et.includes(e)||et.push(e)}):console.warn("Invalid value provided to excludeChannelsFromConsole. Only strings or arrays are allowed.")}get linksData(){return console.warn("get links data in SpyneAppProperties is deprecated, use navLinks"),tt}set linksData(e){console.warn("set links data in SpyneAppProperties is deprecated, use navLinks")}get navLinks(){return tt}set navLinks(e){tt=e}get enableCMSProxies(){return Ze}getHrefFromData(e={}){return xe.convertParamsToRoute(e)}set enableCMSProxies(e=!0){Ze=Boolean(e)}setCMSProxyMethod(e){this.enableCMSProxies=!0,this.formatTemplateForProxyData=e}tempGetChannelsInstance(){}tempGetConfig(){}},at=()=>({includes:()=>!0===it.initialized?it.listRegisteredChannels():["CHANNEL_ROUTE","CHANNEL_UI","CHANNEL_WINDOW","DISPATCHER"]});void 0!==u&&void 0!==t&&(u(y(String),K(["data","srcElement","vsid"])),u(y(String),K(["data","srcElement","id"])));const ct=(e,t)=>{const{__proxy__proxyName:r}=e;void 0===r&&console.error("object is not proxy object ",e);const n=(r,n)=>{const o=K(n,e),{__proxy__isProxy:s,__proxy__props:i}=o;return s?t(r,i):r},o=n(re(e),[]),s=(e,t)=>{const r=t||[];Object.entries(e).forEach(([t,o])=>{const i=(e=>{let t=typeof e;return["number","boolean","string"].includes(t)?t="primitive":"object"===t&&(Array.isArray(e)?t="array":null===e&&(t="undefined")),t})(o),a=[...r];a.push(t),"object"!==i&&"array"!==i||(e[t]=n(o,a),s(o,a))})};return s(o),o},lt=function(e){const{__proxy__proxyName:t}=e;if(void 0!==t){const r=it.getProxyReviver(t);if("function"==typeof r)return ct(e,r)}const r=y(Array),n=y(Object);var o;return!1===r(o=e)&&!0===n(o)?u(B,R,re)(e):re(e)};class dt{constructor(e,t,r,n,o,s){const i=e;s&&console.time(s);const a={channelName:e,action:t,srcElement:n,event:o},c=dt.deepFreeze(r);if(a.payload=c,!0===it.debug){if(Object.prototype.hasOwnProperty.call(r,"payload")){const e=JSON.stringify(r);console.warn(`Spyne Warning: the following payload contains a nested payload property which may create conflicts: Action: ${t}, ${e}`)}const e=it.getChannelActions(i);dt.validateAction(t,i,e)}a.clone=()=>oe([{payload:lt(a.payload)},a.payload,{channel:re(i)},{event:re(o)},{srcElement:n},re(a.srcElement),{action:re(a.action)}]);const l={$dir:{get:()=>a._dir,set:e=>(a._dir=e,e)}};return"CHANNEL_ROUTE"===i&&(l.location={get:()=>dt.getLocationData()}),a._dir=void 0,Object.defineProperties(a,l),s&&console.timeEnd(s),a}static validateAction(e,t,r){const n=X(e,r);return!1===n&&!0===it.initialized&&console.warn(`warning: Action: '${e}' is not registered within the ${t} channel!`),n}static getLocationData(){return Z(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}static getStreamItem(){}static deepClone(e){const t=y(Array),r=y(Object);var n;return!1===t(n=e)&&!0===r(n)?u(B,R,re)(e):re(e)}static deepFreeze(e){const t=u(se(0),k(-1),b("nodeType"));try{Object.freeze(e),Object.getOwnPropertyNames(e).forEach(function(r){!Object.prototype.hasOwnProperty.call(e,r)||!1!==t(e[r])||null===e[r]||"object"!=typeof e[r]&&"function"!=typeof e[r]||Object.isFrozen(e[r])||dt.deepFreeze(e[r])})}catch(t){return e}return e}static getMouseEventKeys(){return["altKey","bubbles","cancelBubble","cancelable","clientX","clientY","composed","ctrlKey","currentTarget","defaultPrevented","detail","eventPhase","fromElement","isTrusted","layerX","layerY","metaKey","movementX","movementY","offsetX","offsetY","pageX","pageY","path","relatedTarget","returnValue","screenX","screenY","shiftKey","sourceCapabilities","srcElement","target","timeStamp","toElement","type","view","which","x","y"]}}function ut(){return{createpropsMap:function(){const e=new WeakMap,t={vsid:this.props.vsid};return e.set(t,this.props),{key:t,weakMap:e}},gc:function(){for(const e in this)delete this[e]},createId:function(){return Math.random().toString(36).replace(/\d/gm,"").substring(1,8)},setTraceFunc:function(e){return!0===e?console.log:()=>{}}}}const ht=async(e,t)=>{window.setTimeout(async()=>{var t;await(t=1,new Promise(e=>setTimeout(e,t))),window.requestAnimationFrame(e)},t)},Et=e=>{if(void 0!==e.constructor.name)return e.constructor.name;const t=e.toString();return k(String(t).substr(0,12),ie(/^(function\s)(\w+)(\(.*)$/,t)[2])},pt=e=>{const t=u(h(E),p,N),r=u(h(_),p,N);return f([t,r])(e)};let Nt,_t=!1;const ft=e=>{if(!_t)throw new Error("sanitizeHTML is not configured. Call sanitizeHTMLConfigure() with appropriate config.");return Nt(e)};class mt{constructor(e,t={},r={}){if(this.template=this.formatTemplate(e),this.isProxyData=!0===t.__cms__isProxy,this.testMode=r?.testMode,this.template=mt.normalizeTripleBrackets(this.template),!0===this.isProxyData){const e=!0===it.enableCMSProxies?it.formatTemplateForProxyData:mt.formatTemplateForProxyData;"function"==typeof e&&(this.template=e(this.template))}(()=>{!0===y(Array,t)&&(t={spyneData:t},this.template=this.template.replace("{{/}}","{{/spyneData}}"),this.template=this.template.replace("{{#}}","{{#spyneData}}"))})(),this.templateData=t,this.currentOuterLoopData=null;const n=mt.getStringArray(this.template);let o=this.template.match(mt.findTmplLoopsRE());o=null===o?[]:o;const s=mt.parseTmplLoopsRE(),i=this.parseTheTmplLoop.bind(this),a=X(I,o),c=H(a,e=>e.replace(s,i),this.addParams.bind(this));this.finalArr=n.map(c)}static isPrimitiveTag(e){return/({{\.\*?}})/.test(e)}static normalizeTripleBrackets(e){return"string"!=typeof e||-1===e.indexOf("{{{")?e:e.replace(/\{\{\{([^{}]+?)\}\}\}/g,"{{$1}}")}static getNestedDataReducer(e={},t=""){return/(\.)/gm.test(String(t))?String(t).split(".").reduce((e,t)=>e[t]?e[t]:"string"==typeof e?e:"",e):e[t]??""}static getStringArray(e){const t=e.split(mt.findTmplLoopsRE()),r=/^([\\n\s\W]+)$/,n=t.filter((e,t)=>!(t>=2&&(t-2)%3==0));return m(e=>e.match(r),n)}static findTmplLoopsRE(){return/({{#([\w.]+)}}[\w\n\s\W]+?{{\/\2}})/gm}static parseTmplLoopsRE(){return/({{#([\w.]+)}})([\w\n\s\W]+?)({{\/\2}})/gm}static innerLoopRE(){return/({{#([\w.]+)}})([\w\n\s\W]+?)({{\/\2}})/gm}static swapParamsForTagsRE(){return/({{)(.*?)(}})/gm}static hasLoop(e){return mt.innerLoopRE().test(e)}removeThis(){void 0!==this&&(this.finalArr=void 0,this.templateData=void 0,this.template=void 0)}renderDocFrag(){let e=mt.replaceImgPath(this.finalArr.join(""));!0!==this.testMode&&(e=ft(e));const t=/^([^>]*?)(<){1}(\b)(thead|col|colgroup|tbody|td|tfoot|tr|th)(\b)([^\0]*)$/.test(e)?e:document.createRange().createContextualFragment(e);return window.setTimeout(this.removeThis,2),t}renderToString(){let e=this.finalArr.join("");return e=mt.replaceImgPath(e),!0!==this.testMode&&(e=String(ft(e))),window.setTimeout(this.removeThis,2),e}getTemplateString(){return this.finalArr.join("")}formatTemplate(e){return!0===["SCRIPT","TEMPLATE"].includes(b("nodeName",e))?e.innerHTML:e}getDataValFromPathStr(e,t){const r=String(e).split(".");return K(r,t)||""}addParams(e){return e.replace(mt.swapParamsForTagsRE(),(e,t,r,n)=>mt.getNestedDataReducer(this.templateData,r))}static replaceImgPath(e){const{IMG_PATH:t}=it;return void 0!==t?(e=e.replaceAll(/src\s*=\s*(['"])imgs\//g,`src=$1${t}`)).replaceAll(/url\(\s*(['"]?)imgs\//g,`url($1${t}`):e}processInnerLoop(e,t){const r=mt.innerLoopRE();return e.replace(r,(e,r,n,o)=>{!0===mt.hasLoop(o)&&(!0===it.debug&&!0!==this.testMode&&console.warn(`Spyne Warning: DomElementTemplate supports one level of nested array loops. A deeper nested loop was detected inside "{{#${n}}}". Consider restructuring via nested ViewStreams instead.`),o=o.replace(/{{[#/][\w.]+}}/g,""));const s=mt.getNestedDataReducer(t,n);if(!0===_(s)||E(s))return"";const i=Array.isArray(s)?s:[s],a=this.currentOuterLoopData;this.currentOuterLoopData=s;const c=i.map((e,t)=>this.substituteForItem(o,e,t)).join("");return this.currentOuterLoopData=a,c})}substituteForItem(e,t,r){if("string"==typeof t){if(mt.isPrimitiveTag(e)){const r=t.replace(/\$/g,"$$$$");return e.replace(mt.swapParamsForTagsRE(),r)}const n=this.buildStringItemContext(t,r);return this.substituteObject(e,n)}const n=this.buildItemContext(t,r);return this.substituteObject(e,n)}buildStringItemContext(e,t){const r={spyneLoopKey:e,loopIndex:t,loopNum:t+1};if(!0===this.isProxyData){const t=this.currentOuterLoopData;if(t&&"object"==typeof t){r.__cms__dataId=t.__cms__dataId||"";const n=`__cms__keyFor_${e}`;r.origKey=void 0!==t[n]?t[n]:""}else r.__cms__dataId="",r.origKey=""}return r}buildItemContext(e,t){const r=Object.assign({},e,{loopIndex:t,loopNum:t+1});return!0===this.isProxyData&&(r.__cms__dataId=e.__cms__dataId,r.spyneLoopKey=e,r.loopIndex=t,r.loopNum=t+1),r}substituteObject(e,t){const r=/(\.)/gm,n={loopIndex:t.loopIndex,loopNum:t.loopNum};return e.replace(mt.swapParamsForTagsRE(),(e,o,s)=>void 0!==n[s]?n[s]:!1===r.test(s)&&void 0!==t[s]?t[s]:this.getDataValFromPathStr(s,t))}parseTheTmplLoop(e,t,r,n){const o=n,s=mt.getNestedDataReducer(this.templateData,r);if(!0===_(s)||E(s))return"";const i=this.currentOuterLoopData;this.currentOuterLoopData=s;const a=Array.isArray(s)?s:[s],c=mt.hasLoop(o),l=a.map((e,t)=>{const r=c?this.processInnerLoop(o,e):o;return this.substituteForItem(r,e,t)}).join("");return this.currentOuterLoopData=i,l}}let Tt,At=!1,Ct=!1;const yt=/^(?:(?:https?|mailto|tel):|data:image\/|(?![a-z][a-z0-9+.-]*:)[\s\S]*$)/i,gt=e=>String(e).replace(/[\u0000-\u0020]/g,""),bt={ALLOWED_TAGS:["a","b","i","em","strong","u","p","br","ul","dl","dt","dd","ol","li","hr","blockquote","pre","code","span","div","section","article","aside","header","footer","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th","img","figure","figcaption","video","source","iframe","input","button","label","link"],ADD_TAGS:["iframe","input","button","link"],ALLOWED_ATTR:["href","src","alt","class","title","width","height","style","target","rel","controls","poster","type","rows","cols","sandbox"],ALLOW_DATA_ATTR:!0,FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","onchange"],FORBID_TAGS:["script","object","embed","meta"],ALLOWED_URI_REGEXP:yt},vt={FORBID_TAGS:["script","iframe","object","embed","form","input","button","link","meta"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","onchange"],ALLOW_DATA_ATTR:!1,ALLOWED_URI_REGEXP:yt};let It={allow:void 0,allowedOrigins:[],sandbox:"allow-scripts allow-same-origin allow-popups"},St=It;const Lt=e=>e?{allow:void 0!==e.allow?e.allow:It.allow,allowedOrigins:void 0!==e.allowedOrigins?e.allowedOrigins:It.allowedOrigins,sandbox:void 0!==e.sandbox?e.sandbox:It.sandbox}:It,Ot=(e,t=St)=>{const r=gt(e);let n;try{n=new URL(r,window.location.href)}catch(e){return!1}if(n.origin===window.location.origin&&"null"!==n.origin)return!0;var o;if(!0!==("https:"===n.protocol||"http:"===n.protocol&&("localhost"===(o=n.hostname)||"127.0.0.1"===o||"[::1]"===o||o.endsWith(".localhost"))))return!1;const s=t.allowedOrigins;return!Array.isArray(s)||0===s.length||s.some(e=>{try{return new URL(e).origin===n.origin}catch(e){return!1}})};let Dt=!1;const Rt=["richtext","authoring","development"],Ht=()=>{const e=it?.mode;if(Rt.includes(e))return"richtext";if("app"===e)return"app";try{if("undefined"!=typeof process&&"development"===process?.env?.NODE_ENV)return"richtext"}catch(e){}return"app"},wt=e=>{const t="richtext"===e?bt:vt,r=((e,t=St)=>void 0===t.allow?"richtext"===e:!0===t.allow)(e);return"richtext"===e&&!0!==r?{...t,ALLOWED_TAGS:t.ALLOWED_TAGS.filter(e=>"iframe"!==e),ADD_TAGS:t.ADD_TAGS.filter(e=>"iframe"!==e),FORBID_TAGS:[...t.FORBID_TAGS,"iframe"]}:"app"===e&&!0===r?{...t,FORBID_TAGS:t.FORBID_TAGS.filter(e=>"iframe"!==e),ADD_TAGS:["iframe"],ADD_ATTR:["sandbox"]}:t};function Vt(e="app"){const t=wt(e);return e=>We.sanitize(e,t)}const Pt=(e={})=>{if(At)return void console.warn("sanitizeData is already configured. Reconfiguration is not allowed.");const{strict:t=!1,disableSanitize:r=!1,iframes:n}=e;Ct=!0===r,n&&"object"==typeof n&&(It=Lt(n),St=It),Ct?console.warn("SPYNE SECURITY WARNING: All data sanitization is DISABLED via config.disableSanitize. Do not use this setting in production."):Dt||(Dt=!0,We.addHook("afterSanitizeAttributes",e=>{if(!e||"IFRAME"!==e.tagName)return;const t=e.getAttribute("src")||"";""!==t&&!0!==Ot(t)&&(console.warn(`SPYNE WARNING: iframe src "${t}" was removed by the iframe policy (same-origin, https, or an allowed origin is required).`),e.removeAttribute("src"));const{sandbox:r}=St;!1!==r&&!0!==e.hasAttribute("sandbox")&&e.setAttribute("sandbox",r)}));const o=e=>{const t=Vt(e),r=e=>{if(Array.isArray(e))return e.map(r);if(e&&"object"==typeof e){const n={};for(const[o,s]of Object.entries(e))n[o]="string"==typeof s?t(s):r(s);return n}return"string"==typeof e?t(e):e};return r};Tt=(e,r={})=>{const{disableSanitize:n=!1,mode:s,iframes:i}=r;if(Ct||n)return e;const a=s||(t?"app":Ht());St=Lt(i);try{return o(a)(e)}finally{St=It}},Pt.sanitizeDataForce=(e,t)=>{if(Ct)return e;const r=t||Ht();return o(r)(e)},At=!0},Ut=(e,t={})=>{if(!At)throw new Error("sanitizeData is not configured. Call sanitizeDataConfigure() first.");return Tt(e,t)},Mt=["href","src","action","formaction","ping","poster","cite","codebase","manifest","icon","background"],Wt=(e,t,r)=>{if(Ct)return{allowed:!0,value:t};const n=String(e).toLowerCase(),o=String(r||"").toUpperCase();if(n.startsWith("on"))return{allowed:!1,value:t};if("srcdoc"===n){const e=wt(Ht());return{allowed:!0,value:We.sanitize(String(t),e)}}return"IFRAME"===o&&"src"===n?{allowed:Ot(t,It),value:t}:Mt.includes(n)&&!0!==(s=t,yt.test(gt(s)))?{allowed:!1,value:t}:{allowed:!0,value:t};var s},xt=(e,t)=>{if(!e||Ct)return;const r=Vt(t||Ht()),n=/<(?:script|object|embed|form|input|button|link|meta)[^>]*>|on\w+=|javascript:/i;if("string"==typeof e.value&&n.test(e.value)){const t=r(e.value);t!==e.value&&(e.value=t)}if(e.isContentEditable&&"string"==typeof e.innerHTML&&n.test(e.innerHTML)){const t=r(e.innerHTML);t!==e.innerHTML&&(e.innerHTML=t)}};class Ft{constructor(e={},t=!1){var r,n;e.tagName=(r="div",n=e.tagName,k(r)(n)),e.attributes=void 0!==e.attributes?e.attributes:this.getDomAttributes(e),e.attrs=this.updateAttrs(e.attributes),e.fragment=document.createDocumentFragment(),this.testMode=t,this.props=e,this.addMixins()}setProp(e,t){this.props[e]=t}getProp(e){return this.props[e]}get el(){return this.props.el}setElAttrs(e,t){const r=!0===this.testMode;return this.getProp("attrs").forEach((t,n)=>{const o=(t,r)=>{e.dataset[r]=t};if("dataset"!==n){if(!0!==r){const{allowed:r,value:o}=Wt(n,t,e.tagName);if(!0!==r)return void console.warn(`SPYNE WARNING: The attribute "${n}" was removed during sanitization.`,e);t=o}e.setAttribute(n,t)}else de(o,t)}),!0!==r&&(e=>{if(Ct||!e||"IFRAME"!==e.tagName)return e;const{sandbox:t}=It;!1!==t&&!0!==e.hasAttribute("sandbox")&&e.setAttribute("sandbox",t)})(e),e}updateAttrs(e,t){const r=void 0!==t?t:new Map;return ce((e,t)=>r.set(t,e),e),r}addTemplate(e){const t=this.getProp("template");return void 0!==t?(t=>{let r=this.getProp("data");r=y(Object,r)?r:{};const n=new mt(t,r,{testMode:this?.testMode}).renderDocFrag();return y(String,n)?e.innerHTML=n:e.appendChild(n),e})(t):e}createElement(e="div"){return document.createElement(e)}addContent(e){const t=this.getProp("data");if(!0===y(String,t)){const r=document.createTextNode(t);e.appendChild(r)}return e}execute(){const e=le(this.createElement.bind(this),this.setElAttrs.bind(this),this.addTemplate.bind(this),this.addContent.bind(this))(this.getProp("tagName"));this.props.el=e}render(){return this.execute(),this.props.template=void 0,this.props.data=void 0,this.props.attributes=void 0,this.getProp("el")}renderToHTMLString(){return this.execute(),this.props.template=void 0,this.props.data=void 0,this.props.attributes=void 0,this.getProp("el").outerHTML}returnIfDefined(e,t){if(void 0!==t){const r=void 0===t;e[t]=!1===r?t:Ye(e[t],t)}}updateprops(e){return this.returnIfDefined(this.props,e),this}updatepropsAndRun(e){return this.updateprops(e),this.execute(),this.getProp("fragment")}unmount(){void 0!==this.props&&(this.getProp("el").remove(),this.props=void 0,this.gc())}updateTag(e="div"){this.updateprops(e)}updateAttributes(e={}){this.updateprops(e)}updateTemplate(e){this.updateprops(e)}updateData(e={}){this.updateprops(e)}addTagAndRender(e="div"){this.updatepropsAndRun(e)}addAttrsibutesAndRender(e={}){this.updatepropsAndRun(e)}addTemplateAndRender(e){this.updatepropsAndRun(e)}addDataAndRender(e={}){this.updatepropsAndRun(e)}addMixins(){const e=ut();this.gc=e.gc.bind(this)}getDomAttributes(e){return ee(this.attributesArray,e)}get attributesArray(){return["accept","accept-charset","accesskey","action","align","allow","alt","async","autocapitalize","autocomplete","autofocus","autoplay","bgcolor","border","buffered","challenge","charset","checked","cite","class","code","codebase","color","cols","colspan","content","contenteditable","contextmenu","controls","coords","crossorigin","csp","dataset","datetime","decoding","default","defer","dir","dirname","disabled","download","draggable","dropzone","enctype","for","form","formaction","headers","height","hidden","high","href","hreflang","http-equiv","icon","id","importance","integrity","ismap","itemprop","keytype","kind","label","lang","language","lazyload","list","loop","low","manifest","max","maxlength","minlength","media","method","min","multiple","muted","name","novalidate","open","optimum","pattern","ping","placeholder","poster","preload","radiogroup","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","sandbox","scope","scoped","selected","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","summary","tabindex","target","title","translate","type","usemap","value","width","wrap"]}}const $t=(e=!1,t=1,r="ease",n=!1)=>`${!0===n?"opacity:0;":""}transition: opacity ${t}s ${r}; opacity: ${!0===e?1:0};`;function kt(e){return"function"==typeof e}function Gt(e){return function(t){if(function(e){return kt(null==e?void 0:e.lift)}(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw new TypeError("Unable to lift unknown Observable type")}}var jt=function(e,t){return jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},jt(e,t)};function zt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}jt(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function Bt(e,t,r,n){return new(r||(r=Promise))(function(o,s){function i(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,a)}c((n=n.apply(e,t||[])).next())})}function Yt(e,t){var r,n,o,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function Kt(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function qt(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function Qt(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function Xt(e){return this instanceof Xt?(this.v=e,this):new Xt(e)}function Jt(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),s=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),i("next"),i("throw"),i("return",function(e){return function(t){return Promise.resolve(t).then(e,l)}}),n[Symbol.asyncIterator]=function(){return this},n;function i(e,t){o[e]&&(n[e]=function(t){return new Promise(function(r,n){s.push([e,t,r,n])>1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{(r=o[e](t)).value instanceof Xt?Promise.resolve(r.value.v).then(c,l):d(s[0][2],r)}catch(e){d(s[0][3],e)}var r}function c(e){a("next",e)}function l(e){a("throw",e)}function d(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Zt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=Kt(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,o){(function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)})(n,o,(t=e[r](t)).done,t.value)})}}}"function"==typeof SuppressedError&&SuppressedError;var er=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function tr(e){return kt(null==e?void 0:e.then)}function rr(e){var t=e(function(e){Error.call(e),e.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var nr=rr(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function or(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var sr=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=Kt(s),a=i.next();!a.done;a=i.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else s.remove(this);var c=this.initialTeardown;if(kt(c))try{c()}catch(e){o=e instanceof nr?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var d=Kt(l),u=d.next();!u.done;u=d.next()){var h=u.value;try{cr(h)}catch(e){o=null!=o?o:[],e instanceof nr?o=Qt(Qt([],qt(o)),qt(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}}if(o)throw new nr(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)cr(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&or(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&or(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),ir=sr.EMPTY;function ar(e){return e instanceof sr||e&&"closed"in e&&kt(e.remove)&&kt(e.add)&&kt(e.unsubscribe)}function cr(e){kt(e)?e():e.unsubscribe()}var lr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},dr={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=dr.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,Qt([e,t],qt(r))):setTimeout.apply(void 0,Qt([e,t],qt(r)))},clearTimeout:function(e){var t=dr.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function ur(e){dr.setTimeout(function(){throw e})}function hr(){}var Er=pr("C",void 0,void 0);function pr(e,t,r){return{kind:e,value:t,error:r}}function Nr(e){e()}var _r=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,ar(t)&&t.add(r)):r.destination=gr,r}return zt(t,e),t.create=function(e,t,r){return new Ar(e,t,r)},t.prototype.next=function(e){this.isStopped?yr(function(e){return pr("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?yr(pr("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?yr(Er,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(sr),fr=Function.prototype.bind;function mr(e,t){return fr.call(e,t)}var Tr=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){Cr(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Cr(e)}else Cr(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Cr(e)}},e}(),Ar=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;kt(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&lr.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&mr(t.next,s),error:t.error&&mr(t.error,s),complete:t.complete&&mr(t.complete,s)}):o=t;return i.destination=new Tr(o),i}return zt(t,e),t}(_r);function Cr(e){ur(e)}function yr(e,t){var r=lr.onStoppedNotification;r&&dr.setTimeout(function(){return r(e,t)})}var gr={closed:!0,next:hr,error:function(e){throw e},complete:hr},br="function"==typeof Symbol&&Symbol.observable||"@@observable";function vr(e){return e}function Ir(e){return 0===e.length?vr:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var Sr=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,s=(n=e)&&n instanceof _r||function(e){return e&&kt(e.next)&&kt(e.error)&&kt(e.complete)}(n)&&ar(n)?e:new Ar(e,t,r);return Nr(function(){var e=o,t=e.operator,r=e.source;s.add(t?t.call(s,r):r?o._subscribe(s):o._trySubscribe(s))}),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=Lr(t))(function(t,n){var o=new Ar({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[br]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ir(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Lr(e))(function(e,r){var n;t.subscribe(function(e){return n=e},function(e){return r(e)},function(){return e(n)})})},e.create=function(t){return new e(t)},e}();function Lr(e){var t;return null!==(t=null!=e?e:lr.Promise)&&void 0!==t?t:Promise}function Or(e){return kt(e[br])}function Dr(e){return Symbol.asyncIterator&&kt(null==e?void 0:e[Symbol.asyncIterator])}function Rr(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Hr="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function wr(e){return kt(null==e?void 0:e[Hr])}function Vr(e){return Jt(this,arguments,function(){var t,r,n;return Yt(this,function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,Xt(t.read())];case 3:return r=o.sent(),n=r.value,r.done?[4,Xt(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,Xt(n)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function Pr(e){return kt(null==e?void 0:e.getReader)}function Ur(e){if(e instanceof Sr)return e;if(null!=e){if(Or(e))return o=e,new Sr(function(e){var t=o[br]();if(kt(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(er(e))return n=e,new Sr(function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()});if(tr(e))return r=e,new Sr(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,ur)});if(Dr(e))return Mr(e);if(wr(e))return t=e,new Sr(function(e){var r,n;try{for(var o=Kt(t),s=o.next();!s.done;s=o.next()){var i=s.value;if(e.next(i),e.closed)return}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}e.complete()});if(Pr(e))return Mr(Vr(e))}var t,r,n,o;throw Rr(e)}function Mr(e){return new Sr(function(t){(function(e,t){var r,n,o,s;return Bt(this,void 0,void 0,function(){var i,a;return Yt(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Zt(e),c.label=1;case 1:return[4,r.next()];case 2:if((n=c.sent()).done)return[3,4];if(i=n.value,t.next(i),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function Wr(e,t,r,n,o){return new xr(e,t,r,n,o)}var xr=function(e){function t(t,r,n,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return zt(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(_r),Fr=function(e){function t(t,r){return e.call(this)||this}return zt(t,e),t.prototype.schedule=function(e,t){return this},t}(sr),$r={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=$r.delegate;return(null==o?void 0:o.setInterval)?o.setInterval.apply(o,Qt([e,t],qt(r))):setInterval.apply(void 0,Qt([e,t],qt(r)))},clearInterval:function(e){var t=$r.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},kr=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return zt(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,o=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(o,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),$r.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&$r.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,or(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Fr),Gr={now:function(){return(Gr.delegate||Date).now()},delegate:void 0},jr=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=Gr.now,e}(),zr=new(function(e){function t(t,r){void 0===r&&(r=jr.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return zt(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(jr))(kr);function Br(e,t,r,n,o){void 0===n&&(n=0),void 0===o&&(o=!1);var s=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(s),!o)return s}function Yr(e){return Gt(function(t,r){var n,o=null,s=!1;o=t.subscribe(Wr(r,void 0,void 0,function(i){n=Ur(e(i,Yr(e)(t))),o?(o.unsubscribe(),o=null,n.subscribe(r)):s=!0})),s&&(o.unsubscribe(),o=null,n.subscribe(r))})}function Kr(e,t){return void 0===t&&(t=0),Gt(function(r,n){r.subscribe(Wr(n,function(r){return Br(n,e,function(){return n.next(r)},t)},function(){return Br(n,e,function(){return n.complete()},t)},function(r){return Br(n,e,function(){return n.error(r)},t)}))})}function qr(e,t){return void 0===t&&(t=0),Gt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function Qr(e,t){if(!e)throw new Error("Iterable cannot be null");return new Sr(function(r){Br(r,t,function(){var n=e[Symbol.asyncIterator]();Br(r,t,function(){n.next().then(function(e){e.done?r.complete():r.next(e.value)})},0,!0)})})}function Xr(e,t){if(null!=e){if(Or(e))return function(e,t){return Ur(e).pipe(qr(t),Kr(t))}(e,t);if(er(e))return function(e,t){return new Sr(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}(e,t);if(tr(e))return function(e,t){return Ur(e).pipe(qr(t),Kr(t))}(e,t);if(Dr(e))return Qr(e,t);if(wr(e))return function(e,t){return new Sr(function(r){var n;return Br(r,t,function(){n=e[Hr](),Br(r,t,function(){var e,t,o;try{t=(e=n.next()).value,o=e.done}catch(e){return void r.error(e)}o?r.complete():r.next(t)},0,!0)}),function(){return kt(null==n?void 0:n.return)&&n.return()}})}(e,t);if(Pr(e))return function(e,t){return Qr(Vr(e),t)}(e,t)}throw Rr(e)}function Jr(e,t){return Gt(function(r,n){var o=0;r.subscribe(Wr(n,function(r){n.next(e.call(t,r,o++))}))})}var Zr=Array.isArray;function en(e){return Jr(function(t){return function(e,t){return Zr(t)?e.apply(void 0,Qt([],qt(t))):e(t)}(e,t)})}function tn(e,t,r){return void 0===r&&(r=vr),function(n){rn(t,function(){for(var o=e.length,s=new Array(o),i=o,a=o,c=function(o){rn(t,function(){var c=function(e,t){return t?Xr(e,t):Ur(e)}(e[o],t),l=!1;c.subscribe(Wr(n,function(e){s[o]=e,l||(l=!0,a--),a||n.next(r(s.slice()))},function(){--i||n.complete()}))},n)},l=0;l<o;l++)c(l)},n)}}function rn(e,t,r){e?Br(r,e,t):t()}function nn(e,t,r){return void 0===r&&(r=1/0),kt(t)?nn(function(r,n){return Jr(function(e,o){return t(r,e,n,o)})(Ur(e(r,n)))},r):("number"==typeof t&&(r=t),Gt(function(t,n){return function(e,t,r,n,o,s,i,a){var c=[],l=0,d=0,u=!1,h=function(){!u||c.length||l||t.complete()},E=function(e){return l<n?p(e):c.push(e)},p=function(e){s&&t.next(e),l++;var a=!1;Ur(r(e,d++)).subscribe(Wr(t,function(e){null==o||o(e),s?E(e):t.next(e)},function(){a=!0},void 0,function(){if(a)try{l--;for(var e=function(){var e=c.shift();i?Br(t,i,function(){return p(e)}):p(e)};c.length&&l<n;)e();h()}catch(e){t.error(e)}}))};return e.subscribe(Wr(t,E,function(){u=!0,h()})),function(){null==a||a()}}(t,n,e,r)}))}var on=Array.isArray;function sn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=function(e){return kt((t=e)[t.length-1])?e.pop():void 0;var t}(e);return r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ir(e)}(sn.apply(void 0,Qt([],qt(e))),en(r)):Gt(function(t,r){tn(Qt([t],qt(function(e){return 1===e.length&&on(e[0])?e[0]:e}(e))))(r)})}var an=rr(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),cn=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return zt(t,e),t.prototype.lift=function(e){var t=new ln(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new an},t.prototype.next=function(e){var t=this;Nr(function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=Kt(t.currentObservers),s=o.next();!s.done;s=o.next()){s.value.next(e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var t=this;Nr(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;Nr(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,o=r.isStopped,s=r.observers;return n||o?ir:(this.currentObservers=null,s.push(e),new sr(function(){t.currentObservers=null,or(s,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,o=t.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new Sr;return e.source=this,e},t.create=function(e,t){return new ln(e,t)},t}(Sr),ln=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return zt(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:ir},t}(cn);function dn(e,t){return void 0===t&&(t=zr),Gt(function(r,n){var o=null,s=null,i=null,a=function(){if(o){o.unsubscribe(),o=null;var e=s;s=null,n.next(e)}};function c(){var r=i+e,s=t.now();if(s<r)return o=this.schedule(void 0,r-s),void n.add(o);a()}r.subscribe(Wr(n,function(r){s=r,i=t.now(),o||(o=t.schedule(c,e),n.add(o))},function(){a(),n.complete()},void 0,function(){s=o=null}))})}var un=new Sr(function(e){return e.complete()});function hn(e){return e<=0?function(){return un}:Gt(function(t,r){var n=0;t.subscribe(Wr(r,function(t){++n<=e&&(r.next(t),e<=n&&r.complete())}))})}function En(e,t){return Gt(function(r,n){var o=0;r.subscribe(Wr(n,function(r){return e.call(t,r,o++)&&n.next(r)}))})}function pn(e){return Gt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}function Nn(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!0!==t){if(!1!==t){var o=new Ar({next:function(){o.unsubscribe(),e()}});return Ur(t.apply(void 0,Qt([],qt(r)))).subscribe(o)}}else e()}function _n(e,t){return void 0===t&&(t=!1),Gt(function(r,n){var o=0;r.subscribe(Wr(n,function(r){var s=e(r,o++);(s||t)&&n.next(r),!s&&n.complete()}))})}function fn(e,t,r){var n=kt(e)||t||r?{next:e,error:t,complete:r}:e;return n?Gt(function(e,t){var r;null===(r=n.subscribe)||void 0===r||r.call(n);var o=!0;e.subscribe(Wr(t,function(e){var r;null===(r=n.next)||void 0===r||r.call(n,e),t.next(e)},function(){var e;o=!1,null===(e=n.complete)||void 0===e||e.call(n),t.complete()},function(e){var r;o=!1,null===(r=n.error)||void 0===r||r.call(n,e),t.error(e)},function(){var e,t;o&&(null===(e=n.unsubscribe)||void 0===e||e.call(n)),null===(t=n.finalize)||void 0===t||t.call(n)}))}):vr}class mn{constructor(e){this.props.observableStreams=mn.createDirectionalObservables()}static createDirectionalFiltersObject(){const e="internal",t="parent",r="child";return{P:[t],C:[r],PCI:[t,e,r],CI:[r,e],PI:[t,e],PC:[t,r]}}static addDefaultDir(e){return ue(J)({$dir:["internal"]},re(e))}static addDownInternalDir(e,t=["internal","down"]){return ue(J)(re(e),{$dir:t})}static addChildAndInternalDir(e,t=["child","down"]){return ue(J)(re(e),{$dir:t})}static mapToDefaultDir(e){return this.addDefaultDir(e)}static createDirectionalObservables(e=new r,t,n){void 0!==t&&void 0!==n&&(e.viewName=t,e.vsid=n);const o=e=>he(t=>t.includes(e),"$dir"),s=o("parent"),i=o("child"),a=o("internal"),c=e=>J({from$:e}),l=c("child"),d=c("internal"),u=c("parent"),h=e.pipe(En(e=>void 0!==e&&void 0!==e.action)),E=e.pipe(En(a),Jr(d)),p=e.pipe(En(s),Jr(l)),N=e.pipe(En(i),Jr(u)),_={parent:p,internal:E,child:N};return{raw$:h,toInternal$:E,toParent$:p,toChild$:N,completeAll:()=>{Ee(e=>{e.complete(),e.isStopped=!0},[h,E,p,N])},completeStream:(e=[])=>{const t=e=>{if(void 0!==_[e]){(t=_[e]).complete(),t.isStopped=!0}var t};void 0!==e&&e.length>=1&&e.forEach(t)}}}}class Tn{constructor(e,t={},n="",o="theName"){this.addMixins(),this._state="INIT",this.vsid=n,this.el=t.el,this.vsName=o,this.defaults={debug:!1,extendedHashMethods:{}},this.options=Ye(this.defaults,t);this.addActionListeners().forEach(e=>{const[t,r]=e;this.options.extendedHashMethods[t]=e=>this[r](e)}),this.options.hashMethods=this.setHashMethods(this.options.extendedHashMethods),this.sink$=e,this.sink$.subscribe(this.onObsSinkSubscribe.bind(this)),this.$dirs=mn.createDirectionalFiltersObject(),this.addDefaultDir=mn.addDefaultDir,this.sourceStreams=mn.createDirectionalObservables(new r,this.vsName,this.vsid),this._source$=this.sourceStreams.toInternal$}addActionListeners(){return[]}setHashMethods(e={}){return Ye({VS_DETRITUS_COLLECT:e=>this.onGarbageCollect(e),READY_FOR_VS_DETRITUS_COLLECT:e=>this.onReadyForGC(e),EXTIRPATE:e=>this.onDispose(e),VS_SPAWN:e=>this.onRender(e),VS_SPAWN_AND_ATTACH_TO_PARENT:e=>this.onRenderAndAttachToParent(e),VS_SPAWN_AND_ATTACH_TO_DOM:e=>this.onRenderAndAttachToDom(e),ATTACH_CHILD_TO_SELF:e=>this.onAttachChildToSelf(e)},e)}createDomItem(){this.props=void 0!==this.props?this.props:{};const e=F(e=>void 0!==e,ee(["id","className"],this.props)),{tagName:t,data:r,template:n}=this.props;return new Ft(t,e,r,n)}onDisposeCompleted(e){}animateInTween(e,t){!function(e,t){const r=1*window.getComputedStyle(e).opacity,n=$t(!0,t,"ease",1===r);e.style.cssText+=n}(e,t)}animateOutTween(e,t,r){!function(e,t,r){const n=$t(!1,t,"ease");e.style.cssText+=n,e.addEventListener("transitionend",r,!1)}(e,t,r)}setAnimateIn(e){if(!0===e.animateIn){const t=void 0!==e.el?e.el:this.domItem.el;this.animateInTween(t,e.animateInTime)}}disposeMethod(e){const t=void 0!==e.el.el?e.el.el:e.el,r={action:"READY_FOR_VS_DETRITUS_COLLECT",$dir:this.$dirs.PI,el:t},o=n((e,r)=>{this.animateOutTween(t,e.animateOutTime,r)}),s=e=>{this._source$.next(r)},i=!0===e.animateOut?e=>(o(e).subscribe(s),{action:"EXTIRPATING",$dir:this.$dirs.CI}):()=>({action:"EXTIRPATE_AND_READY_FOR_VS_DETRITUS_COLLECT",$dir:this.$dirs.CI});return i(e)}onDispose(e){return this.disposeMethod(e)}removeStream(){void 0!==this.sourceStreams&&this.sourceStreams.completeStream(["internal","child"])}onReadyForGC(e){this.removeStream()}onGarbageCollect(e){void 0!==this.domItem&&this.domItem.unmount(),void 0!==this.sourceStreams&&this.sourceStreams.completeStream(["parent"])}getSourceStream(){return this._source$}combineDomItems(e){if(void 0!==this.el)return;const t=_(e.query)?e.node:e.query,r=(e,t)=>e.insertBefore(t,e.firstChild);({appendChild:(e,t)=>e.appendChild(t),after:(e,t)=>e.after(t)}[e.attachType]||r)(t,this.domItem.render()),this.setAnimateIn(e)}onAttachChildToSelf(e){const t=e.childRenderData;return this.combineDomItems(t),{action:"CHILD_ATTACHED",$dir:this.$dirs.PI}}onRenderAndAttachToParent(e){return this.onRender(e),this.combineDomItems(e),{action:"VS_SPAWNED_AND_ATTACHED_TO_PARENT",el:this.el||this.domItem.el,$dir:this.$dirs.PI}}renderDomItem(e){const[t,r,n,o]=e;return this.domItem=new Ft({tagName:t,attributes:r,data:n,template:o}),this.domItem}onRender(e){return{action:"VS_SPAWNED",el:this.el||(e=>this.renderDomItem(e))(pe(["tagName","domAttributes","data","template"],e)),$dir:this.$dirs.I}}extendedMethods(e){}onRenderAndAttachToDom(e){return e.attachData.el=(e=>this.renderDomItem(e))(pe(["tagName","domAttributes","data","template"],e)),this.combineDomItems(e.attachData),{action:"VS_SPAWNED_AND_ATTACHED_TO_DOM",el:this.el||e.attachData.el.el,$dir:this.$dirs.CI}}onObsSinkSubscribe(e){const t=e.action,r=k(e=>this.extendedMethods(e)),n=r(this.options.hashMethods[t])(e);void 0!==n&&(e=>{this._source$.next(e)})(Object.freeze(n))}addMixins(){}}function An(){setTimeout(()=>{Ee(e=>{},this)},1)}class Cn{constructor(e,t,r,n="subscribe",o=!1){const s={name:e,observable:t,data:r,action:n};this.sendToDirectorStream(s)}sendToDirectorStream(e){const t=it.channelsMap.getStream("DISPATCHER"),r=lt(e);t.next(r),e=void 0}static deepClone(e){const t=y(Array),r=y(Object);var n;return!1===t(n=e)&&!0===r(n)?u(B,R,re)(e):re(e)}static getMouseEventKeys(){return["altKey","bubbles","cancelBubble","cancelable","clientX","clientY","composed","ctrlKey","currentTarget","defaultPrevented","detail","eventPhase","fromElement","isTrusted","layerX","layerY","metaKey","movementX","movementY","offsetX","offsetY","pageX","pageY","path","relatedTarget","returnValue","screenX","screenY","shiftKey","sourceCapabilities","srcElement","target","timeStamp","toElement","type","view","which","x","y"]}addMixins(){this.gc=An}}const yn=!0===it.debug;class gn{constructor(e,t){this.addMixins(),this.props=e,this.broadcastFn=t,this.broadcaster(this.broadcastFn)}addDblClickEvt(e){return o(e,"dblclick").pipe(Jr(e=>{const t=re(e);return t.typeOverRide="dblclick",t}))}broadcast(e){if(e.length<=0&&!0===yn)return void console.warn(`Spyne Warning: The nested array in ${this.props.name}.broadcastEvents appears to be empty --\x3e vsid:${this.props.vsid}!`);const t={UI:this.sendUIPayload,ROUTE:this.sendRoutePayload},[r,n,s]=e;let i,a=this.props.el.querySelectorAll(r);if(a.length<=0){const e=this.props.el,t=t=>{t===e&&(a=[t])};(()=>{const n=(null!==e.parentElement?e.parentElement:document).querySelectorAll(r);n.forEach=Array.prototype.forEach,n.forEach(t)})()}const c=void 0!==s,l=e=>{const r="dblClick"!==n?o(e,n,{preventDefault:()=>!0}):this.addDblClickEvt(e);i=e.dataset.channel;const s={};s.payload=(e=>{const t={};for(const r in e)t[r]=e[r];return t})(e.dataset),s.payload=Ne(["channel"],s.payload),"ROUTE"===s.channel&&(s.payload.endPreventDefault=!0),s.channel=i,s.srcElement={},s.srcElement.id=this.props.id,s.srcElement.vsid=this.props.vsid,s.srcElement.isLocalEvent=c,s.srcElement.srcEvent=n,s.srcElement.el=e;var a;(0,t[a=i,"ROUTE"===a||"CHANNEL_ROUTE"===a?"ROUTE":("UI"!==a&&"CHANNEL_UI"!==a&&void 0!==a&&console.warn(`SpyneJS warning: The channel, ${a}, is not allowed here, only "UI" or "ROUTE" are valid channels, defaulting to CHANNEL_UI`),"UI")])(r,s)};!0===(void 0===a||a.length<=0)&&!0===yn?console.warn(`Spyne Warning: The item ${r}, does not appear to exist in ${this.props.name} --\x3e vsid:${this.props.vsid}!`):(a.forEach=Array.prototype.forEach,a.forEach(l))}broadcaster(e){e().forEach(e=>this.broadcast(e))}addMixins(){const e={testFunc:function(e){console.log("stream mixin is ",e)},sendRoutePayload:function(e,t){return new Cn("CHANNEL_ROUTE",e,t,"subscribe")},sendUIPayload:function(e,t){return new Cn("CHANNEL_UI",e,t,"subscribe")}};this.sendUIPayload=e.sendUIPayload,this.sendRoutePayload=e.sendRoutePayload}}const bn=u(ne,y(Array)),vn=u(ne,E),In=f([y(String),vn]),Sn=f([y(Array),vn]),Ln=u(f([bn,y(Object)])),On=u(f([vn,bn,y(Object)]));class Dn{constructor(e,t={},r,n){Ln(e)&&(e=b("selector",t=e),n=n||b("testMode",t));const o=[r,b("debugLabel",t)];r=u(C(y(String)))(o);let s=Ne(["debugLabel","label","selector","props","testMode","propFilters"],t);void 0!==t.props?s=oe([t.props,s]):void 0!==t.propFilters&&(s=oe([t.propFilters,s])),t.propFilters=s;const{propFilters:i}=t,a=In(e)?Dn.filterSelector([e],r):void 0,c=Sn(e)?Dn.filterSelector(e,r):void 0,l=On(i)?Dn.filterData(i,r):void 0;let d=m(_,[a,c,l]);const h=E(d);return h&&(d=[w(!1)],!0===it.debug&&!0!==n&&console.warn(`Spyne Warning: The Channel Filter, with selector: ${e}, and propFilters:${i} appears to be empty!`)),!0===n?{selector:e,propFilters:i,debugLabel:r,filters:t,testMode:n,filtersAreEmpty:h}:f(d)}static filterData(e,t){const r=t;return(()=>{if(E(e))return w(!1);e=D((e,t,r)=>{let n=Te;if((e=>y(String,e))(e)||(e=>y(Boolean,e))(e)||(e=>y(Number,e))(e))o=e,n=e=>e===o;else{if("function"==typeof e)return e;if((e=>y(Array,e))(e)||Ln(e))return console.warn(`ChannelPayloadFilter: Property "${e}" is an array/object, which is not allowed. This property will always return false.`),n}var o;return n},e);const t=me(e);return u(t,t=>{if(void 0===r)return t;const n={};return de((e,r)=>{n[r]=e(b(r,t))},e),console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${r}"] - values: `,"color:orange;",{propsBooleans:n,comparedObj:t}),t},k({}),e=>{const{payload:t,srcElement:r,event:n}=e||{};return Object.assign({},e,r,n,t)})})()}static checkPayloadSelector(e,t,r){const{payload:n,srcElement:o,event:s}=r||{},i=[o,n,b("srcElement",s),r].reduce((e,t)=>{const r=b("el",t);return Dn.elIsDomElement(r)&&void 0===e&&(e=r),e},void 0),a=e=>e.isEqualNode(i),c=e=>{const t=Array.from(document.querySelectorAll(e));return D(a,t)};if(void 0!==t){const r=u(O,D(c))(e),n=e;console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${t}"] - selectors: `,"color:orange;",{el:i,selectorsArr:n,nodeArrResultsDebugger:r})}if("object"!=typeof i)return!1;const l=u(O,D(c))(e);return!0!==E(l)&&_e(T(!0),l)}static elIsDomElement(e){return y(String,e)&&(e=document.querySelector(e)),u(se(0),k(-1),b("nodeType"))(e)}static filterSelector(e,t){const r=m(E,e);return fe(Dn.checkPayloadSelector)(r,t)}}function Rn(){return!0===it.debug}function Hn(e){return u(se(0),k(-1),b("nodeType"))(e)}function wn(e,t,r=!1){const n=Pn(e,t,r);return 1===n.length?p(n):n}function Vn(e,t,r){const n=document.querySelector(e),o=u(se(0),k(-1),b("nodeType"));if(null===n||!1!==o(n)){if(void 0!==t&&String(t).trim().length>0){function s(e){try{return document.querySelectorAll(e).length>0}catch(e){return!1}}const i=s(t);!0===r&&!0===Rn()&&!1===i&&console.warn(`Spyne Warning: the selector, ${t} does not exist in this el, ${e}`)}}else console.warn(`Spyne Warning: the el object is not a valid single element, ${n}`)}function Pn(e,t,r=!1){let n=!1;const o=(r=>{let o=[];try{o=document.querySelectorAll(r)}catch(e){o=[]}try{n=document.querySelector(t)===document.querySelector(e),!0===n&&(o=[document.querySelector(t)])}catch(e){}return o})(void 0!==t?`${e} ${t}`:e);if(!0===r){Vn(!0===n?"body":e,t,r)}return o}function Un(e,t,r){return Pn(t,r).forEach(t=>{t.style.cssText=e}),this}function Mn(e,t){function r(t){return Mn(e,t)}return Vn(e="string"==typeof e?e:function(e){let t=`${Math.random().toString(36).replace(/\d/gm,"").substring(1,8)}`;return void 0===e.dataset.vsid?e.dataset.vsid=t:t=e.dataset.vsid,`[data-vsid='${t}']`}(e),t,!1),r.map=r=>Array.from(Pn(e,t)).map(r),r.forEach=r=>Array.from(Pn(e,t)).map(r),r.getNodeListArray=()=>Pn(e,t),r.addClass=r=>(Pn(e,t).forEach(e=>e.classList.add(r)),this),r.removeClass=r=>(Pn(e,t).forEach(e=>{e.classList.remove(r)}),this),r.setClass=r=>(Pn(e,t).forEach(e=>{const t=u(m(E),z(" "))(e.className),n=r.split(" ");t.forEach(t=>e.classList.remove(t)),n.forEach(t=>e.classList.add(t))}),this),r.unmount=()=>{},r.toggleClass=(r,n)=>(Pn(e,t).forEach(e=>{(n=void 0!==n?n:!e.classList.contains(r))?e.classList.add(r):e.classList.remove(r)}),this),r.toggle=(e,t)=>(r.toggleClass(e,t),this),r.appendChild=e=>(0!==r.el.length?r.el.appendChild(e):console.warn(`Spyne Warning: The selector, ${t} does not appear to be valid!`),r.el),r.addAnimClass=r=>{requestAnimationFrame(()=>{Pn(e,t).forEach(e=>{try{e.classList.add(r)}catch(e){}})})},r.setActiveItem2=(r,n)=>{const o=Pn(e,t),s="string"==typeof n?wn(e,n):n,i=e=>e.isEqualNode(s)?e.classList.add(r):e.classList.remove(r);return!0===Hn(s)?o.forEach(i):!0===Rn()&&console.warn(`Spyne Warning: The selector, ${n}, does not appear to be a valid item in setActiveItem: ${r}`),this},r.setActiveItem=(r,n)=>{const o=Pn(e,t),s="string"==typeof n?wn(e,n):n;if(o.forEach(e=>e.classList.remove(r)),!0===Hn(s)){const e=Array.from(o).find(e=>e===s);e?e.classList.add(r):!0===Rn()&&console.warn(`Spyne Warning: The selector, ${n}, is valid but does not match any item in setActiveItem: ${r}`)}else!0===Rn()&&console.warn(`Spyne Warning: The selector, ${n}, does not appear to be a valid item in setActiveItem: ${r}`);return this},Object.defineProperty(r,"el",{get:()=>wn(e,t,!0)}),Object.defineProperty(r,"els",{get:()=>Pn(e,t)}),Object.defineProperty(r,"len",{get:()=>Pn(e,t,!1).length}),Object.defineProperty(r,"exists",{get:()=>Pn(e,t,!1).length>=1}),Object.defineProperty(r,"exist",{get:()=>Pn(e,t,!1).length>=1}),Object.defineProperty(r,"nodeList",{get:()=>Pn(e,t)}),Object.defineProperty(r,"arr",{get:()=>{const r=wn(e,t,!0);return void 0===r?[]:void 0===r.length?[r]:Array.from(r)}}),Object.defineProperty(r,"inline",{set:r=>Un(r,e,t),get:()=>r}),Object.defineProperty(r,"inlineCss",{set:r=>Un(r,e,t),get:()=>r}),r}class Wn{constructor(e={}){this.vsnum=Math.random(),this.addMixins(),this._postRenderCalled=!1,this.defaults=()=>{const t=this.createId(),r=e.id?e.id:t;return{vsid:t,id:r,tagName:"div",el:void 0,data:void 0,animateIn:!1,animateInTime:.5,animateOut:!1,animateOutTime:.5,sendLifecyleEvents:!1,hashId:`#${r}`,id$:`#${r}`,viewClass:Tn,extendedSourcesHashMethods:{},debug:!1,template:void 0,node:document.createDocumentFragment(),name:Et(this)}},this._state={},this.$dirs=mn.createDirectionalFiltersObject(),this.addDefaultDirection=mn.addDefaultDir,this.addDownInternalDir=mn.addDownInternalDir,this.props=Ye(this.defaults(),e),this.sendLifecycleMethod=!0===this.props.sendLifecyleEvents?this.sendLifecycleMethodActive.bind(this):this.sendLifecycleMethodInactive.bind(this);const t=this.attributesArray;this.props.domAttributes=ee(t,this.props),void 0!==this.props.traits&&this.addTraits(this.props.traits),this.loadAllMethods(),this.props.action="LOADED",this.sink$=new r,this.props.elIsAlreadyRenderedBool=this.elAlreadyExistsFn(this.props);const n=this.props.viewClass;this.view=new n(this.sink$,{el:this.props.el},this.props.vsid,this.props.id),this.sourceStreams=this.view.sourceStreams,this._rawSource$=this.view.getSourceStream(),this._rawSource$.viewName=this.props.name,this.sendEventsDownStream=this.sendEventsDownStreamFn,this.initViewStream(),this.isDevMode=Wn.isDevMode(),this.props.addedChannels=[],this.checkIfElementAlreadyExists()}get source$(){return this._source$}get attributesArray(){return["accesskey","class","contenteditable","dir","draggable","hidden","id","lang","spellcheck","style","tabindex","title","translate","aria-autocomplete","aria-checked","aria-disabled","aria-expanded","aria-haspopup","aria-hidden","aria-invalid","aria-label","aria-level","aria-multiline","aria-multiselectable","aria-orientation","aria-pressed","aria-readonly","aria-required","aria-selected","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","aria-atomic","aria-busy","aria-live","aria-relevant","aria-dropeffect","aria-grabbed","aria-activedescendant","aria-controls","aria-describedby","aria-flowto","aria-labelledby","aria-owns","aria-posinset","aria-setsize","accept","autocomplete","autofocus","checked","dirname","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","list","max","maxlength","min","minlength","multiple","name","pattern","placeholder","readonly","required","size","step","value","alt","srcset","sizes","usemap","ismap","href","target","download","ping","rel","hreflang","as","media","accept-charset","action","enctype","novalidate","content","charset","http-equiv","async","defer","integrity","nomodule","nonce","referrerpolicy","autocapitalize","autoplay","buffered","challenge","cite","code","codebase","color","cols","colspan","contextmenu","controls","coords","crossorigin","csp","dataset","datetime","decoding","default","for","headers","high","icon","importance","itemprop","keytype","kind","label","language","lazyload","loop","low","manifest","method","muted","open","optimum","poster","preload","radiogroup","reversed","role","rows","rowspan","sandbox","scope","scoped","selected","shape","slot","span","srcdoc","src","type","srclang","start","summary","wrap","width","height"]}static isDevMode(){return it.debug}static checkIfActionsAreRegistered(e=[],t){if(t.length>0){const r=t=>{const r=new RegExp(t);if(ge(M(r),n)<0){const r=1===e.length?"from added channel":"from added channels";console.warn(`Spyne Warning: The action, ${t}, in ${this.props.name}, does not match any of the registered actions ${r}, ${e.join(", ")}`)}},n=(e=>{const t=e.map(e=>it.getChannelActions(e));return O(t)})(e);t.forEach(r)}}static isValidNestedArr(e){const t=T(!0),r=Ae(t),n=y(String),o=u(r,D(n),Ce(0,2),k([]));return u(r,D(o),k([]))(e)}static elIsDomElement(e){return y(String,e)&&(e=document.querySelector(e)),u(se(0),k(-1),b("nodeType"))(e)}updatePropsToMatchEl(){const e=u(ye,P(b("tagName"),w("")));this.props.tagName=e(this.props.el)}elAlreadyExistsFn(e){const t=u(se(0),k(-1),b("nodeType"));return he(f([e=>document.body.contains(e),t]),"el")(e)}checkIfElementAlreadyExists(){!0===this.props.elIsAlreadyRenderedBool?(this.updatePropsToMatchEl(),this.postRender()):null===this.props.el&&console.error(`Spyne Error: The defined element for this ViewStream instance, ${this.constructor.name}, appears to not exist.`)}loadAllMethods(){const e=fe(this.onChannelMethodCall.bind(this));this.addActionListeners().forEach(t=>{let[r,n,o]=t;y(String,o)&&(o=new Dn({selector:o})),this.props.extendedSourcesHashMethods[r]=e(n,o)}),this.props.hashSourceMethods=this.setSourceHashMethods(this.props.extendedSourcesHashMethods)}addActionListeners(){return[]}onChannelMethodCall(e,t,r){const n=t=>{void 0===this[e]?console.warn(`Spyne Warning: The method, ${e} does not appear to exist in ${this.constructor.name}!`):this[e](t)};if(void 0!==r.$dir&&r.$dir.includes("child")&&!0!==this.deleted){const e=Ye({},r);e.$dir=this.$dirs.C,this.sourceStreams.raw$.next(e)}!0===k(w(!0),t)(r)&&n(r=Ne(["$dir"],r))}setSourceHashMethods(e={}){const t={EXTIRPATING:e=>this.checkParentDispose(e),EXTIRPATE:e=>this.disposeViewStream(e),VS_SPAWNED:e=>this.onVSRendered(e),VS_SPAWNED_AND_ATTACHED_TO_DOM:e=>this.onVSRendered(e),VS_SPAWNED_AND_ATTACHED_TO_PARENT:e=>this.onVSRendered(e),READY_FOR_VS_DETRITUS_COLLECT:e=>this.onReadyToGC(e),VS_NULLITY:()=>({})};return Ye.all([{},t,e])}initViewStream(){this._source$=this._rawSource$.pipe(Jr(e=>this.onMapViewSource(e)),_n(this.notGCSTATE)),this.initAutoMergeSourceStreams(),this.updateSourceSubscription(this._source$,!0)}notGCSTATE(e){return!e.action.includes("READY_FOR_VS_DETRITUS_COLLECT")}eqGCSTATE(e){return!e.action.includes("READY_FOR_VS_DETRITUS_COLLECT")}notCOMPLETED(e){return!e.action.includes("COMPLETED")}notGCCOMPLETE(e){return!e.action.includes("GC_COMPLETE")}testVal(e){console.log("TESTING VALL IS ",e)}addParentStream(e,t){this.parent$=e.pipe(En(e=>void 0!==e&&void 0!==e.action),Jr(e=>{const t=Ye({},e);return"EXTIRPATE_AND_READY_FOR_VS_DETRITUS_COLLECT"===t.action&&(this.disposeViewStream(t),t.action="READY_FOR_VS_DETRITUS_COLLECT"),t})),this.updateSourceSubscription(this.parent$,!1,"PARENT"),this.renderAndAttachToParent(t)}addChildStream(e){const t=e.pipe(En(e=>void 0!==e&&void 0!==e.action),fn(e=>this.tracer("addChildStraem do ",e)),Jr(e=>e),pn(e=>this.onChildCompleted(t.source)));this.updateSourceSubscription(t,!0,"CHILD")}onChildDisposed(e){}onChildCompleted(e){const t=(e=>{const t=e=>{for(;void 0!==e.destination;)e=t(e.destination);return e};return ee(["id","vsid"],t(e))})(e);return this.tracer("onChildCompleted ",this.vsnum,e),this.onChildDisposed(t,e),t}initAutoMergeSourceStreams(){const e={next:this.onSubscribeToSourcesNext.bind(this),error:this.onSubscribeToSourcesError.bind(this),complete:this.onSubscribeToSourcesComplete.bind(this)},t=()=>{this.props.el$=void 0,this.uberSource$.complete(),this.autoSubscriber$.complete(),this.sink$.complete(),this.props=void 0,this.deleted=!0,this.tracer("completeAll",this.deleted,this.props)},n=()=>{o-=1,0===o&&t()};let o=0;this.uberSource$=new r;this.autoMergeSubject$=this.uberSource$.pipe(nn(e=>{const t=e.observable.pipe(En(e=>void 0!==e&&void 0!==e.action),Jr(e=>{const t=Ye({},e);return t.action=e.action,this.tracer("autoMergeSubject$",t),t}));return!1===e.autoClosesBool?t:(o+=1,t.pipe(pn(n)))})),this.autoSubscriber$=this.autoMergeSubject$.pipe(En(e=>void 0!==e&&void 0!==e.action)).subscribe(e)}updateSourceSubscription(e,t=!1,r){const n={observable:e,autoClosesBool:t,rel:r};this.tracer("updateSourceSubscription ",this.vsnum,n),this.uberSource$.next(n)}onSubscribeToSourcesNext(e={}){const t=k(e=>this.sendExtendedStreams(e)),r=(n=this.props.hashSourceMethods,o=e.action,void 0!==n[o]?o:u(p,F(u(M(I,o),e=>new RegExp(e))))(A(n)));var n,o;t(this.props.hashSourceMethods[r])(e),this.tracer("onSubscribeToSourcesNext",{payload:e})}onSubscribeToSourcesError(e=""){console.log("ALL ERROR ",this.constructor.name,e)}onSubscribeToSourcesComplete(){this.tracer("onSubscribeToSourcesComplete","VS_DETRITUS_COLLECT"),this.openSpigot("VS_DETRITUS_COLLECT")}sendExtendedStreams(e){this.tracer("sendExtendedStreams",e),this.openSpigot(e.action,e)}renderAndAttachToParent(e){this.openSpigot("VS_SPAWN_AND_ATTACH_TO_PARENT",e)}renderView(){this.openSpigot("VS_SPAWN")}renderViewAndAttachToDom(e,t,r){const n={node:e,type:t,attachType:r};this.openSpigot("VS_SPAWN_AND_ATTACH_TO_DOM",{attachData:n})}checkParentDispose(e){"parent"===e.from$&&this.disposeViewStream(e)}onBeforeDispose(){}setTimeout(e,t=0,r=!1){window.setTimeout((...t)=>{if(void 0!==this&&void 0!==this.props){const n=!0===r?e.bind(this):e;be(n,t)}},t)}disposeViewStream(e){this.onBeforeDispose(),this.openSpigot("EXTIRPATE")}onChildDispose(e){}onParentDisposing(e){this.openSpigot("EXTIRPATE")}onReadyToGC(e){const t=void 0!==e.from$&&"internal"===e.from$;this.tracer("onReadyToGC",t,e)}openSpigot(e,t={}){if(void 0!==this.props){this.props.action=e;const r=J(this.props,t);this.sink$.next(Object.freeze(r))}}setAttachData(e,t){return{node:this.props.el,type:"ViewStreamObservable",attachType:e,query:(()=>{const e=this.props.el.querySelector(t);return!0===Wn.isDevMode()&&y(String,t)&&_(e)&&console.warn(`Spyne Warning: The appendView query in ${this.props.name}, '${t}', appears to not exist!`),e})()}}getParentEls(e,t){const r=e=>e.parentElement;let n=0,o=e;for(;n<t;)o=r(o),n++;return o}setAttachParentData(e,t,r){t=""!==t?t:void 0;const n=this.getParentEls(this.props.el,r);return{node:n,type:"ViewStreamObservable",attachType:e,query:n.querySelector(t)}}onMapViewSource(e={}){return this.props=J(this.props,e),e}exchangeViewsWithChild(e,t){this.addChildStream(e.sourceStreams.toParent$),e.addParentStream(this.sourceStreams.toChild$,t)}appendToDom(e){void 0!==this.props.el&&console.warn(`Spyne Warning: The ViewStream, ${this.props.name}, has an element, ${this.props.el}, that is already rendered and does not need to be appendedToDom. This may create unsusual side effects!`),this.renderViewAndAttachToDom(e,"dom","appendChild")}appendToDomAfter(e){void 0!==this.props.el&&console.warn(`Spyne Warning: The ViewStream, ${this.props.name}, has an element, ${this.props.el}, that is already rendered and does not need to be appendedToDomAfter. This may create unsusual side effects!`),this.renderViewAndAttachToDom(e,"dom","after")}prependToDom(e){void 0!==this.props.el&&console.warn(`Spyne Warning: The ViewStream, ${this.props.name}, has an element, ${this.props.el}, that is already rendered and does not need to be prependedToDom. This may create unsusual side effects!`),this.renderViewAndAttachToDom(e,"dom","prependChild")}appendView(e,t){this.exchangeViewsWithChild(e,this.setAttachData("appendChild",t))}appendViewAfter(e,t){this.exchangeViewsWithChild(e,this.setAttachData("after",t))}appendViewToParentEl(e,t,r=1){this.exchangeViewsWithChild(e,this.setAttachParentData("appendChild",t,r))}prependViewToParentEl(e,t,r=1){this.exchangeViewsWithChild(e,this.setAttachParentData("prependChild",t,r))}prependView(e,t){this.exchangeViewsWithChild(e,this.setAttachData("prependChild",t))}appendToNull(){const e=document.getElementById("spyne-null-views");this.renderViewAndAttachToDom(e,"dom","appendChild")}onVSRendered(e){"internal"===e.from$&&this.postRender()}postRender(){if(!0===this._postRenderedCalled)return;this.beforeAfterRender(),this.afterRender(),this.onRendered();if(requestAnimationFrame(()=>this.onAnimFrameAfterRendered()),!0===this.isDevMode){const e=this.broadcastEvents();!1===Wn.isValidNestedArr(e)&&console.warn(`Spyne Warning: The array returned from broadcastEvents in ${this.props.name}, '${JSON.stringify(e)}', does not appear to be properly formatted!`)}this.initializeChannels(),this.viewsStreamBroadcaster=new gn(this.props,this.broadcastEvents.bind(this)),this.afterBroadcastEvents(),this._postRenderedCalled=!0}addTraits(e){"Array"!==e.constructor.name&&(e=[e]);e.forEach(e=>{new e(this)})}afterBroadcastEvents(){if(!0===this.isDevMode){const e=e=>e[0],t=this.addActionListeners(),r=t.map(e);if(!1===Wn.isValidNestedArr(t))console.warn(`Spyne Warning: The array returned from addActionsListeners in ${this.props.name}, '${JSON.stringify(t)}', does not appear to be properly formatted!`);else{u(Ee(e=>{const t=k("",e[1]);!1===y(Function,this[t])&&console.warn(`Spyne Warning: The method in addActionListeners nested Array, '${JSON.stringify(e)}', in ${this.props.name}, does not appear to exist!`)}),k([]))(t)}const n=()=>{void 0!==K(["props","addedChannels"],this)&&Wn.checkIfActionsAreRegistered.bind(this)(this.props.addedChannels,r)};this.setTimeout(n,500)}}setDataVSID(){this.props.el.dataset.vsid=this.props.vsid}beforeAfterRender(){this.setDataVSID(),this.props.el$=Mn(this.props.el)}downStream(){}onRendered(){}onAnimFrameAfterRendered(){}afterRender(){}broadcastEvents(){return[]}getChannel(e){return H(e=>at().includes(e),e=>it.channelsMap.getStream(e).observer.pipe(_n(e=>!0!==this.deleted)),e=>console.warn(`channel name ${e} is not within ${at}`))(e)}initializeChannels(){const e=e=>{const[t,r=!1]=Array.isArray(e)?e:[e];this?.addChannel(t,r)};Array.isArray(this?.props?.channels)?this?.props?.channels?.forEach(e):Array.isArray(this?.props?.channel)&&console.warn("props.channel is not a ViewStream property. Do you mean props.channels?")}addChannel(e,t=!1,r=!1,n=!1){const o=!0===r?this.$dirs.CI:this.$dirs.I;if(!0===this?.props?.addedChannels?.includes(e))return;const s=K(["srcElement","isLocalEvent"]),i=K(["srcElement","vsid"]),a=[Jr(e=>{const t=e;return t.$dir=o,t}),En(e=>{const t=i(e);return!0!==s(e)||t===this.props.vsid})];var c;!0===t&&a.unshift((c=1,En(function(e,t){return c<=t})));const l=this.getChannel(e).pipe(...a);this.updateSourceSubscription(l,!1),this.props.addedChannels.push(e)}checkIfChannelExists(e){const t=it.channelsMap.testStream(e);return!0!==t&&console.warn(`SPYNE WARNING: The ChannelPayload from ${this.props.name}, has been sent to a channel, ${e}, that has not been registered!`),t}sendInfoToChannel(e,t={},r){const n=t,o=k("VIEWSTREAM_EVENT"),i=u(o,b(e)),a={payload:n,action:r=r||i({CHANNEL_ROUTE:"CHANNEL_ROUTE_CHANGE_EVENT"})};try{if(a.srcElement=u(ee(["id","vsid","class","tagName"]),b("props"))(this),!0===this.checkIfChannelExists(e)){!1===/CHANNEL_LIFECYCLE/.test(r)&&Object.defineProperties(a,{payload:{get:()=>lt(t)}});const n=s(a);return new Cn(e,n,a)}}catch(e){console.warn("SPYNE WARNING ",e)}}tracer(...e){this.sendLifecycleMethod(...e)}sendLifecycleMethodInactive(){}sendLifecycleMethodActive(e,t){const r="VS_DETRITUS_COLLECT"===t;!0===me({from$:T("internal"),action:T("VS_SPAWNED_AND_ATTACHED_TO_PARENT")},t)?this.sendInfoToChannel("CHANNEL_LIFECYCLE",{action:"CHANNEL_LIFECYCLE_RENDERED_EVENT"},"CHANNEL_LIFECYCLE_RENDERED_EVENT"):!0===r&&this.sendInfoToChannel("CHANNEL_LIFECYCLE",{action:"CHANNEL_LIFECYCLE_DISPOSED_EVENT"},"CHANNEL_LIFECYCLE_DISPOSED_EVENT")}createActionFilter(e,t){return new Dn(e,t)}isLocalEvent(e){const t=K(["srcElement","el"],e),r=K(["props","el"],this);return Wn.elIsDomElement(r)&&Wn.elIsDomElement(t)&&r.contains(t)}addMixins(){const e=ut();this.createId=e.createId}}class xn{constructor(e){const t=String(e.props.name),r=`${t}_ROUTE_UPDATER`;return fe(xn.createTemporaryViewStreamObj)({id:r,name:t})}static createTemporaryViewStreamObj(e,t){const{name:r,id:n}=e,o=t,s=new Wn({id:n,name:r,data:t});s.onRendered=()=>{s.sendInfoToChannel("CHANNEL_ROUTE",o)},s.afterBroadcastEvents=()=>{s.disposeViewStream()},s.appendToNull()}}class Fn{constructor(e,t={}){this.addRegisteredActions.bind(this),this.createChannelActionsObj(e,t.extendedActionsArr),t.name=e,t.defaultActions=void 0!==t.data?[`${t.name}_EVENT`]:[],this.props=t,this.props.isRegistered=!1,this.props.isProxy=void 0!==this.props.isProxy&&this.props.isProxy;const r=void 0!==this.props.data;void 0!==this.props.replay?this.props.sendCachedPayload=this.props.replay:this.props.sendCachedPayload=void 0===this.props.sendCachedPayload?r:this.props.sendCachedPayload,this.sendPayloadToRouteChannel=new xn(this),this.createChannelActionMethods(),this.streamsController=it.channelsMap;const n=this.getMainObserver();this.checkForPersistentDataMode=Fn.checkForPersistentDataMode.bind(this),this.observer$=this.props.observer=n;const o=this.streamsController.getStream("DISPATCHER"),s=U(t.name,"name");o.pipe(En(s)).subscribe(e=>this.onReceivedObservable(e))}getMainObserver(){void 0===this.streamsController&&console.warn(`Spyne Warning: The following channel, ${this.props.name}, appears to be registered before Spyne has been initialized.`);return!0===this.streamsController.testStream(this.props.name)?this.streamsController.getProxySubject(this.props.name,this.props.sendCachedPayload):!0===this.props.sendCachedPayload?new i(1):new r}onChannelInitialized(){}onRegistered(e=this.props){if(void 0!==e.data){const t=Object.keys(this.channelActions)[0];this.sendChannelPayload(t,e.data)}}get isProxy(){return this.props.isProxy}get channelName(){return this.props.name}get observer(){return this.observer$}checkForTraits(){const e=e=>{"Array"!==e.constructor.name&&(e=[e]);e.forEach(e=>new e(this))};void 0!==this.props.traits&&e(this.props.traits)}initializeStream(){this.checkForTraits(),this.onChannelInitialized(),this.checkForPersistentDataMode(),this.onRegistered(),this.props.isRegistered=!0}static checkForPersistentDataMode(e=this.props,t=this.channelActions){const r=E(t),n=void 0!==b("data",e);return!0===r&&!0===n&&(e.sendCachedPayload=!0,t=(()=>{const{name:t}=e,r=`${t}_EVENT`;return{[r]:r}})(),void 0!==this.channelActions&&(this.channelActions=t)),{props:e,actionsObj:t}}setTrace(e){}createChannelActionsObj(e,t=[]){const r=H(y(String),ve,p),n=t.concat(this.addRegisteredActions(e)),o=D(r,n),s=oe(Q(e=>Ie(e,e),o));this.channelActions=s}createChannelActionMethods(){const e=H(y(String),ve,p),t=(e,t)=>{window.setTimeout(()=>{"function"!=typeof this[e]&&console.warn(`"${this.props.name}", REQUIRES THE FOLLOWING METHOD ${e} FOR ACTION, ${t[0]}`)},100)},r=H(y(String),w("onViewStreamInfo"),e=>{const r=Se(Le(1),e);return t(r,e),r});this.channelActionMethods=B(D(t=>[e(t),r(t)],this.addRegisteredActions()))}addRegisteredActions(){let e=[];return K(["props","data"],this)&&(e=[`${this.props.name}_EVENT`]),e}onReceivedObservable(e){this.onIncomingObservable(e)}getActionMethodForObservable(e){e.unpacked=!0;const t=this.onViewStreamInfo.bind(this),r=K(["data","action"],e),n=b(r,this.channelActionMethods);let o=t;if(void 0!==n&&"onViewStreamInfo"!==n){!0===("function"==typeof this[n])&&(o=this[n].bind(this))}return o}onIncomingObservable(e){const t=T(e.name,this.props.name),{action:r,payload:n,srcElement:o}=e.data,s=t=>({clone:()=>{return t=e.data,oe([t,{action:b("action",t)},b("payload",t),b("srcElement",t)]);var t},action:r,payload:n,srcElement:o,event:t});return!0===t?(e=>e.observable.pipe(Jr(s)).subscribe(this.getActionMethodForObservable(e)))(e):void 0}onViewStreamInfo(e){}sendChannelPayload(e,t,r={},n={},o=this.observer$){const s=new dt(this.props.name,e,t,r,n);o.next(s)}getChannel(e,t){return H(e=>at().includes(e),r=>{const n=this.streamsController.getStream(r).observer;return n.source?n.source.channelName=e:n.channelName=e,void 0!==t?n.pipe(En(t)):n},e=>console.warn(`channel name ${e} is not within ${at}`))(e)}mergeChannels(e,t=!0){const r=e.map(e=>{if("string"==typeof e){const r=this.getChannel(e);return t?r.pipe(hn(1)):r}return t?e.pipe(hn(1)):e});let n;if(t)n=a(r);else if(0===r.length)n=c;else if(1===r.length)n=r[0];else{const[e,...t]=r;n=e.pipe(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return sn.apply(void 0,Qt([],qt(e)))}(...t))}return n.pipe(Jr(t=>{const r={};return e.forEach((e,n)=>{const o="string"==typeof e?e:`channel_${n}`;r[e?.source?.channelName||e?.source?.source?.channelName||o]=t[n]}),r}))}static checkForNotTrackFlag(e={}){!0===e.doNotTrack&&it.doNotTrackChannel(e.channelName)}}class $n extends Fn{constructor(e="CHANNEL_ROUTE",t={}){t.sendCachedPayload=!0,super("CHANNEL_ROUTE",t),this.createChannelActionsObj(),this.routeConfigJson=this.getRouteConfig(),this.bindStaticMethods(),this.navToStream$=new i(1),this.observer$=this.navToStream$.pipe(Jr(e=>this.onMapNext(e))),this.compareRouteKeywords=Fe.compareRouteKeywords()}checkConfigForHash(){!0===("hash"===it.config.channels.ROUTE.type)&&(it.config.channels.ROUTE.type="slash",it.config.channels.ROUTE.isHash=!0)}onRegistered(){this.checkConfigForHash(),this.initStream()}createChannelActionsObj(){const e=this.addRegisteredActions(),t=oe(Q(e=>Ie(e,e),e));this.channelActions=t}addRegisteredActions(){return["CHANNEL_ROUTE_DEEPLINK_EVENT","CHANNEL_ROUTE_CHANGE_EVENT","CHANNEL_ROUTE_CONFIG_UPDATED_EVENT",["CHANNEL_ROUTE_UPDATE_CONFIG_EVENT","updateRouteConfig"]]}updateRouteConfig(e){const t=ee(["isHash","isHidden","routes","type"],e.payload);it.config.channels.ROUTE=J(it.config.channels.ROUTE,t),it.conformRouteConfig();const r=this.getRouteConfig();r.navLinks=[...r?.routeDatasetsArr],this.routeConfigJson=r,this.bindStaticMethodsWithConfigData(),this.sendChannelPayload("CHANNEL_ROUTE_CONFIG_UPDATED_EVENT",r,{},{},this.navToStream$)}getRouteConfig(){const e=it.config,t=K(["channels","ROUTE"],e);"query"===t.type&&(t.isHash=!1);const r=Fe.flattenConfigObject(t.routes);return t.paramsArr=r,t}initStream(){this.firstLoadStream$=new i(1),this.onIncomingDomEvent(void 0,this.routeConfigJson,"CHANNEL_ROUTE_DEEPLINK_EVENT"),Fe.createPopStateStream(this.onIncomingDomEvent.bind(this)),this.observer$=l(this.firstLoadStream$,this.navToStream$)}onMapNext(e,t=!1){return e.action="CHANNEL_ROUTE_CHANGE_EVENT",e}static removeSSID(e){const t=Oe(["routeData"]);return De(t,Ne(["vsid"]))(e)}static onIncomingDomEvent(e,t=this.routeConfigJson,r){const n=void 0!==r?r:this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT,o=K(["state","routeCount"],e),s=!0===y(Number,o);let i=this.getDataFromString(t,s);!0===s&&(i.routeCount=o),"CHANNEL_ROUTE_DEEPLINK_EVENT"===r&&(i.navLinks=b("routeDatasetsArr",t),Object.defineProperty(i,"linksData",{get(){return this.navLinks},set(e){console.warn("set links data is deprecated in ROUTE DEEPLINK DATA, use navLinks")},enumerable:!0}));const a=this.compareRouteKeywords.compare(i.routeData,i.paths);i=J(i,a),this.sendChannelPayload(n,i,void 0,e,this.navToStream$)}static checkForRouteParamsOverrides(e){return e}static checkForEventMethods(e){const t=u(F(M(/^(event)([A-Z].*)([A-Z].*)$/gm)),A,b("payload"))(e);if(t.length>=1){const r=b("event",e);if(void 0!==r){const e=L(/^(event)([A-Z])(.*)([A-Z].*)$/gm,(e,t,r,n,o)=>String(r).toLowerCase()+n+o),n=t=>{const n=e(t);void 0!==r[n]&&r[n]()};t.forEach(n)}}return e}static checkForEndRoute(e,t=this.routeConfigJson,r){if(!0!==u(T("true"),K(["payload","endRoute"]))(e))return e;const n=void 0!==r?r:!0===it.debug,{payload:o}=e;let s=0;const i=(e=[],t)=>{const r=t[1],{routePath:a}=r,c=b("routeName",a),l=(e=>{const t=b("routeName",e);if(t){const r=u(A,Ne(["routeName"]))(e),n=o[t];return C(e=>new RegExp(`^${e}$`).test(n),r)}})(a),d=y(Object,r),h=y(Array,r);if(s+=1,!0===d&&!1===h){const t=a[l];t?u(Re,G(i,e),R)({nextRoutePath:t}):1===s?n&&console.warn(`Spyne Warning: use of end route method should add start route value of "${c}".`):e.push(c)}return e},{routes:a}=t,c=u(Re,G(i,[]),R)({routes:a});if(1===c.length){const t=c[0];e.payload[t]=""}return e}onViewStreamInfo(e){const t=e.action??this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT;e?.srcElement?.el?.dataset&&(e.payload=function(e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e?.srcElement?.el?.dataset)??e.payload),$n.checkForEventMethods(e),e=this.checkForEndRoute(e);let r=this.getDataFromParams(e);const n=b("srcElement",e),o=b("event",e),s=!r.isHidden,i=this.compareRouteKeywords.compare(r.routeData,r.paths);r=J(r,i),this.sendRouteStream(r,s),r=$n.removeSSID(r),this.sendChannelPayload(t,r,n,o,this.navToStream$)}static checkAndConvertStrWithRegexTokens(e,t){return A(t)}sendRouteStream(e,t=!0){!0===t&&this.setWindowLocation(e)}static getRouteState(){return"CHANNEL_ROUTE_CHANGE_EVENT"}static getIsDeepLinkBool(e){return!1===e&&0===this._routeCount}static getRouteCount(e=!1){return void 0===this._routeCount?(this._routeCount=0,this._routeCount):(!1===e&&(this._routeCount+=1),this._routeCount)}static getExtraPayloadParams(e=this.routeConfigJson,t=!1){return{routeCount:this.getRouteCount(t),isDeepLink:this.getIsDeepLinkBool(t),isHash:e.isHash,isHistory:t,isHidden:e.isHidden,routeType:e.type}}static getDataFromParams(e,t=this.routeConfigJson){let r=b("payload",e);const n=this.getRouteStrFromParams(r,t),o=(e,r)=>k(r,b(e,t)),s=o("type","slash"),i=o("isHash",!1),a=xe.formatStrAsWindowLocation(n),c=this.getDataFromLocationStr(s,i,a),{pathInnermost:l,paths:d}=c;r=J(c.routeData,r);const{routeCount:u,isDeepLink:h,isHash:E,isHistory:p,isHidden:N,routeType:_}=this.getExtraPayloadParams(t);return{isDeepLink:h,routeCount:u,pathInnermost:l,paths:d,routeData:r,routeValue:n,isHash:E,isHidden:N,isHistory:p,routeType:_}}static getDataFromString(e=this.routeConfigJson,t=!1){const r=e.type,n=!0===e.isHash,o=xe.getLocationStrByType(r,n),{paths:s,pathInnermost:i,routeData:a,routeValue:c}=$n.getParamsFromRouteStr(o,e,r),{routeCount:l,isDeepLink:d,isHash:u,routeType:h,isHidden:E}=this.getExtraPayloadParams(e,t);return{isDeepLink:d,routeCount:l,pathInnermost:i,paths:s,routeData:a,routeValue:c,isHash:u,isHidden:E,isHistory:t,routeType:h}}static getDataFromLocationStr(e="slash",t=this.routeConfigJson.isHash,r=window.location){const n=void 0!==this.routeConfigJson?this.routeConfigJson.type:e,o=xe.getLocationStrByType(n,t,r),{paths:s,pathInnermost:i,routeData:a,routeValue:c}=this.getParamsFromRouteStr(o,this.routeConfigJson,n);return{paths:s,pathInnermost:i,routeData:a,routeValue:c,action:this.getRouteState()}}static getLocationData(){return Z(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}static getRouteStrFromParams(e,t,r){const n=void 0!==r?r:t.type;return xe.convertParamsToRoute(e,t,n)}static getParamsFromRouteStr(e,t,r){const n=void 0!==r?r:t.type;return xe.convertRouteToParams(e,t,n)}checkEmptyRouteStr(e,t=!1){const r=E(e);return!0===(!0===r&&!1===t)||!0===(!0===r&&!0===t)?"/":!0===(!1===r&&!0===t)?V("#",e):e}static removeLastSlash(e){return e.replace(/^(.*)(\/)$/,"$1")}setWindowLocation(e){let{isHash:t,routeValue:r,routeType:n}=e;r=this.checkEmptyRouteStr(r,t);const{routeCount:o}=e;if(!0===t||"query"===n){r=$n.removeLastSlash(window.location.pathname)+r,window.history.pushState({routeCount:o},"",r)}else{const e=v(u(h(T("/")),p),V("/",I));window.history.pushState({routeCount:o},"",e(r))}}getWindowLocation(){return window.location.pathname}bindStaticMethods(){this.checkForEndRoute=$n.checkForEndRoute.bind(this),this.getIsDeepLinkBool=$n.getIsDeepLinkBool.bind(this),this.getDataFromLocationStr=$n.getDataFromLocationStr.bind(this),this.onIncomingDomEvent=$n.onIncomingDomEvent.bind(this),this.getDataFromString=$n.getDataFromString.bind(this),this.getParamsFromRouteStr=$n.getParamsFromRouteStr.bind(this),this.getLocationData=$n.getLocationData.bind(this),this.getRouteState=$n.getRouteState.bind(this),this.getDataFromParams=$n.getDataFromParams.bind(this),this.getRouteCount=$n.getRouteCount.bind(this),this.getExtraPayloadParams=$n.getExtraPayloadParams.bind(this),this.bindStaticMethodsWithConfigData()}bindStaticMethodsWithConfigData(){const e=He(3,$n.getRouteStrFromParams);this.getRouteStrFromParams=e(I,this.routeConfigJson,this.routeConfigJson.type)}}class kn extends Fn{constructor(e="CHANNEL_UI",t={}){t.sendCachedPayload=!1,super(e,t),this.keyEventsLoaded=!1,this.keyCodeArr=[]}addRegisteredActions(){return["CHANNEL_UI_DOMCONTENTLOADED_EVENT","CHANNEL_UI_ABORT_EVENT","CHANNEL_UI_ACTIVATE_EVENT","CHANNEL_UI_ADDTRACK_EVENT","CHANNEL_UI_AFTERPRINT_EVENT","CHANNEL_UI_AFTERSCRIPTEXECUTE_EVENT","CHANNEL_UI_ANIMATIONCANCEL_EVENT","CHANNEL_UI_ANIMATIONEND_EVENT","CHANNEL_UI_ANIMATIONITERATION_EVENT","CHANNEL_UI_ANIMATIONSTART_EVENT","CHANNEL_UI_APPINSTALLED_EVENT","CHANNEL_UI_AUDIOEND_EVENT","CHANNEL_UI_AUDIOSTART_EVENT","CHANNEL_UI_AUXCLICK_EVENT","CHANNEL_UI_BEFOREINPUT_EVENT","CHANNEL_UI_BEFOREPRINT_EVENT","CHANNEL_UI_BEFOREUNLOAD_EVENT","CHANNEL_UI_BEGINEVENT_EVENT","CHANNEL_UI_BLOCKED_EVENT","CHANNEL_UI_BLUR_EVENT","CHANNEL_UI_BOUNDARY_EVENT","CHANNEL_UI_BUFFEREDAMOUNTLOW_EVENT","CHANNEL_UI_CANCEL_EVENT","CHANNEL_UI_CANPLAY_EVENT","CHANNEL_UI_CANPLAYTHROUGH_EVENT","CHANNEL_UI_CHANGE_EVENT","CHANNEL_UI_CLICK_EVENT","CHANNEL_UI_CLOSE_EVENT","CHANNEL_UI_CLOSING_EVENT","CHANNEL_UI_COMPLETE_EVENT","CHANNEL_UI_COMPOSITIONEND_EVENT","CHANNEL_UI_COMPOSITIONSTART_EVENT","CHANNEL_UI_COMPOSITIONUPDATE_EVENT","CHANNEL_UI_CONNECT_EVENT","CHANNEL_UI_CONNECTIONSTATECHANGE_EVENT","CHANNEL_UI_CONTENTDELETE_EVENT","CHANNEL_UI_CONTEXTMENU_EVENT","CHANNEL_UI_COPY_EVENT","CHANNEL_UI_CUECHANGE_EVENT","CHANNEL_UI_CUT_EVENT","CHANNEL_UI_DATACHANNEL_EVENT","CHANNEL_UI_DBLCLICK_EVENT","CHANNEL_UI_DEVICECHANGE_EVENT","CHANNEL_UI_DEVICEMOTION_EVENT","CHANNEL_UI_DEVICEORIENTATION_EVENT","CHANNEL_UI_DRAG_EVENT","CHANNEL_UI_DRAGEND_EVENT","CHANNEL_UI_DRAGENTER_EVENT","CHANNEL_UI_DRAGLEAVE_EVENT","CHANNEL_UI_DRAGOVER_EVENT","CHANNEL_UI_DRAGSTART_EVENT","CHANNEL_UI_DROP_EVENT","CHANNEL_UI_DURATIONCHANGE_EVENT","CHANNEL_UI_EMPTIED_EVENT","CHANNEL_UI_END_EVENT","CHANNEL_UI_ENDEVENT_EVENT","CHANNEL_UI_ENDED_EVENT","CHANNEL_UI_ENTERPICTUREINPICTURE_EVENT","CHANNEL_UI_ERROR_EVENT","CHANNEL_UI_FOCUS_EVENT","CHANNEL_UI_FOCUSIN_EVENT","CHANNEL_UI_FOCUSOUT_EVENT","CHANNEL_UI_FORMDATA_EVENT","CHANNEL_UI_FULLSCREENCHANGE_EVENT","CHANNEL_UI_FULLSCREENERROR_EVENT","CHANNEL_UI_GAMEPADCONNECTED_EVENT","CHANNEL_UI_GAMEPADDISCONNECTED_EVENT","CHANNEL_UI_GATHERINGSTATECHANGE_EVENT","CHANNEL_UI_GESTURECHANGE_EVENT","CHANNEL_UI_GESTUREEND_EVENT","CHANNEL_UI_GESTURESTART_EVENT","CHANNEL_UI_GOTPOINTERCAPTURE_EVENT","CHANNEL_UI_HASHCHANGE_EVENT","CHANNEL_UI_ICECANDIDATE_EVENT","CHANNEL_UI_ICECANDIDATEERROR_EVENT","CHANNEL_UI_ICECONNECTIONSTATECHANGE_EVENT","CHANNEL_UI_ICEGATHERINGSTATECHANGE_EVENT","CHANNEL_UI_INPUT_EVENT","CHANNEL_UI_INPUTSOURCESCHANGE_EVENT","CHANNEL_UI_INSTALL_EVENT","CHANNEL_UI_INVALID_EVENT","CHANNEL_UI_KEYDOWN_EVENT","CHANNEL_UI_KEYUP_EVENT","CHANNEL_UI_LANGUAGECHANGE_EVENT","CHANNEL_UI_LEAVEPICTUREINPICTURE_EVENT","CHANNEL_UI_LOAD_EVENT","CHANNEL_UI_LOADEDDATA_EVENT","CHANNEL_UI_LOADEDMETADATA_EVENT","CHANNEL_UI_LOADEND_EVENT","CHANNEL_UI_LOADSTART_EVENT","CHANNEL_UI_LOSTPOINTERCAPTURE_EVENT","CHANNEL_UI_MARK_EVENT","CHANNEL_UI_MERCHANTVALIDATION_EVENT","CHANNEL_UI_MESSAGE_EVENT","CHANNEL_UI_MESSAGEERROR_EVENT","CHANNEL_UI_MOUSEDOWN_EVENT","CHANNEL_UI_MOUSEENTER_EVENT","CHANNEL_UI_MOUSELEAVE_EVENT","CHANNEL_UI_MOUSEMOVE_EVENT","CHANNEL_UI_MOUSEOUT_EVENT","CHANNEL_UI_MOUSEOVER_EVENT","CHANNEL_UI_MOUSEUP_EVENT","CHANNEL_UI_MUTE_EVENT","CHANNEL_UI_NEGOTIATIONNEEDED_EVENT","CHANNEL_UI_NOMATCH_EVENT","CHANNEL_UI_NOTIFICATIONCLICK_EVENT","CHANNEL_UI_OFFLINE_EVENT","CHANNEL_UI_ONLINE_EVENT","CHANNEL_UI_OPEN_EVENT","CHANNEL_UI_ORIENTATIONCHANGE_EVENT","CHANNEL_UI_PAGEHIDE_EVENT","CHANNEL_UI_PAGESHOW_EVENT","CHANNEL_UI_PASTE_EVENT","CHANNEL_UI_PAUSE_EVENT","CHANNEL_UI_PAYERDETAILCHANGE_EVENT","CHANNEL_UI_PAYMENTMETHODCHANGE_EVENT","CHANNEL_UI_PLAY_EVENT","CHANNEL_UI_PLAYING_EVENT","CHANNEL_UI_POINTERCANCEL_EVENT","CHANNEL_UI_POINTERDOWN_EVENT","CHANNEL_UI_POINTERENTER_EVENT","CHANNEL_UI_POINTERLEAVE_EVENT","CHANNEL_UI_POINTERLOCKCHANGE_EVENT","CHANNEL_UI_POINTERLOCKERROR_EVENT","CHANNEL_UI_POINTERMOVE_EVENT","CHANNEL_UI_POINTEROUT_EVENT","CHANNEL_UI_POINTEROVER_EVENT","CHANNEL_UI_POINTERUP_EVENT","CHANNEL_UI_POPSTATE_EVENT","CHANNEL_UI_PROGRESS_EVENT","CHANNEL_UI_PUSH_EVENT","CHANNEL_UI_PUSHSUBSCRIPTIONCHANGE_EVENT","CHANNEL_UI_RATECHANGE_EVENT","CHANNEL_UI_READYSTATECHANGE_EVENT","CHANNEL_UI_REJECTIONHANDLED_EVENT","CHANNEL_UI_REMOVETRACK_EVENT","CHANNEL_UI_REMOVESTREAM_EVENT","CHANNEL_UI_REPEATEVENT_EVENT","CHANNEL_UI_RESET_EVENT","CHANNEL_UI_RESIZE_EVENT","CHANNEL_UI_RESOURCETIMINGBUFFERFULL_EVENT","CHANNEL_UI_RESULT_EVENT","CHANNEL_UI_RESUME_EVENT","CHANNEL_UI_SCROLL_EVENT","CHANNEL_UI_SEARCH_EVENT","CHANNEL_UI_SEEKED_EVENT","CHANNEL_UI_SEEKING_EVENT","CHANNEL_UI_SELECT_EVENT","CHANNEL_UI_SELECTEDCANDIDATEPAIRCHANGE_EVENT","CHANNEL_UI_SELECTEND_EVENT","CHANNEL_UI_SELECTIONCHANGE_EVENT","CHANNEL_UI_SELECTSTART_EVENT","CHANNEL_UI_SHIPPINGADDRESSCHANGE_EVENT","CHANNEL_UI_SHIPPINGOPTIONCHANGE_EVENT","CHANNEL_UI_SIGNALINGSTATECHANGE_EVENT","CHANNEL_UI_SLOTCHANGE_EVENT","CHANNEL_UI_SOUNDEND_EVENT","CHANNEL_UI_SOUNDSTART_EVENT","CHANNEL_UI_SPEECHEND_EVENT","CHANNEL_UI_SPEECHSTART_EVENT","CHANNEL_UI_SQUEEZE_EVENT","CHANNEL_UI_SQUEEZEEND_EVENT","CHANNEL_UI_SQUEEZESTART_EVENT","CHANNEL_UI_STALLED_EVENT","CHANNEL_UI_START_EVENT","CHANNEL_UI_STATECHANGE_EVENT","CHANNEL_UI_STORAGE_EVENT","CHANNEL_UI_SUBMIT_EVENT","CHANNEL_UI_SUCCESS_EVENT","CHANNEL_UI_SUSPEND_EVENT","CHANNEL_UI_TIMEOUT_EVENT","CHANNEL_UI_TIMEUPDATE_EVENT","CHANNEL_UI_TOGGLE_EVENT","CHANNEL_UI_TONECHANGE_EVENT","CHANNEL_UI_TOUCHCANCEL_EVENT","CHANNEL_UI_TOUCHEND_EVENT","CHANNEL_UI_TOUCHMOVE_EVENT","CHANNEL_UI_TOUCHSTART_EVENT","CHANNEL_UI_TRACK_EVENT","CHANNEL_UI_TRANSITIONCANCEL_EVENT","CHANNEL_UI_TRANSITIONEND_EVENT","CHANNEL_UI_TRANSITIONRUN_EVENT","CHANNEL_UI_TRANSITIONSTART_EVENT","CHANNEL_UI_UNHANDLEDREJECTION_EVENT","CHANNEL_UI_UNLOAD_EVENT","CHANNEL_UI_UNMUTE_EVENT","CHANNEL_UI_UPGRADENEEDED_EVENT","CHANNEL_UI_VERSIONCHANGE_EVENT","CHANNEL_UI_VISIBILITYCHANGE_EVENT","CHANNEL_UI_VOICESCHANGED_EVENT","CHANNEL_UI_VOLUMECHANGE_EVENT","CHANNEL_UI_VRDISPLAYACTIVATE_EVENT","CHANNEL_UI_VRDISPLAYBLUR_EVENT","CHANNEL_UI_VRDISPLAYCONNECT_EVENT","CHANNEL_UI_VRDISPLAYDEACTIVATE_EVENT","CHANNEL_UI_VRDISPLAYDISCONNECT_EVENT","CHANNEL_UI_VRDISPLAYFOCUS_EVENT","CHANNEL_UI_VRDISPLAYPOINTERRESTRICTED_EVENT","CHANNEL_UI_VRDISPLAYPOINTERUNRESTRICTED_EVENT","CHANNEL_UI_VRDISPLAYPRESENTCHANGE_EVENT","CHANNEL_UI_WAITING_EVENT","CHANNEL_UI_WEBGLCONTEXTCREATIONERROR_EVENT","CHANNEL_UI_WEBGLCONTEXTLOST_EVENT","CHANNEL_UI_WEBGLCONTEXTRESTORED_EVENT","CHANNEL_UI_WEBKITMOUSEFORCECHANGED_EVENT","CHANNEL_UI_WEBKITMOUSEFORCEDOWN_EVENT","CHANNEL_UI_WEBKITMOUSEFORCEUP_EVENT","CHANNEL_UI_WEBKITMOUSEFORCEWILLBEGIN_EVENT","CHANNEL_UI_WHEEL_EVENT"]}loadKeyStream(){const e=t.fromEvent(document,"keyup");this.keyPresses$=e.groupBy(e=>e.keyCode).mergeAll().filter(e=>this.keyCodeArr.indexOf(e.keyCode)>=0).repeat().subscribe(this.onKeyPressed.bind(this))}addKeyEvent(e){!1===this.keyEventsLoaded&&this.loadKeyStream(),this.keyEventsLoaded=!0,this.registerKey(e)}registerKey(e){this.keyCodeArr.push(e)}onKeyPressed(e){}static removeSSID(e){const t=Oe(["payload"]);return De(t,Ne(["vsid"]))(e)}onIncomingObservable(e){const t=T(e.name,this.props.name);e.data=kn.removeSSID(e.data);const{payload:r,srcElement:n}=e.data,o=e=>({payload:r,srcElement:n,event:e});return!0===t?(e=>e.observable.pipe(Jr(o)).subscribe(this.onUIEvent.bind(this)))(e):void 0}getActionState(e){const t=K(["event","type"]),r=K(["event","typeOverRide"]),n=u(we,P(r,t))(e),o="CHANNEL_UI";return void 0!==n?`${o}_${n}_EVENT`:o}static checkForEventMethods(e){const t=u(F(M(/^(event)([A-Z].*)([A-Z].*)$/gm)),A,b("payload"))(e);if(t.length>=1){const r=b("event",e);if(void 0!==r){const e=L(/^(event)([A-Z])(.*)([A-Z].*)$/gm,(e,t,r,n,o)=>String(r).toLowerCase()+n+o),n=t=>{const n=e(t);void 0!==r[n]&&"function"==typeof r[n]&&r[n]()};t.forEach(n)}}return e}onUIEvent(e){e.payload=function(e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e?.srcElement?.el?.dataset)??e.payload,kn.checkForEventMethods(e),e.action=this.getActionState(e);const t=e.action,{payload:r,srcElement:n}=e,o=e.event;xt(o?.target),this.sendChannelPayload(t,r,n,o)}}class Gn{constructor(){this.createDomObservableFromEvent=Gn.createDomObservableFromEvent.bind(this)}static createDomObservableFromEvent(t,r,n=!0,o=window){return r=void 0===r?e=>e:r,e(e=>o.addEventListener(t,e,{passive:n}),()=>{o[t]=e=>e}).pipe(Jr(r))}static createMediaQuery(e){const t=window.matchMedia(e);return this.checkIfValidMediaQuery(t,e),!1!==t&&t}static checkIfValidMediaQuery(e,t){const r=e=>e.replace(/\s+/gm,""),n=void 0!==e.matches&&r(e.media).indexOf(r(t))>=0;return!1===n&&(t=>{console.warn(`Spyne Info: the following query string, "${t}", has been optimized to "${e.media}" by the browser and may not be a valid Media Query item!`)})(t),n}static createMediaQueryHandler(t,r){const n=(e=>t=>(t.mediaQueryName=e,t))(r),o=(s=t,{addHandler:e=>{s.addListener(e)},removeHandler:e=>{s.onchange=()=>{}}});var s;return new e(o.addHandler,o.removeHandler).pipe(Jr(n))}static createMergedObsFromObj(e){const t=e.mediaQueries||e.mediaQueries,r=[];return ce((e,t,n)=>{const o=Gn.createMediaQuery(e);return!1!==o&&r.push(Gn.createMediaQueryHandler(o,t)),r},t),r}}class jn extends Fn{constructor(e="CHANNEL_WINDOW"){super(e),this.bindStaticMethods(),this.currentScrollY=0}initializeStream(){this.domChannelConfig=it.config.channels.WINDOW;const e=this.getActiveObservables(),t=l(...e);this.dom$=t,t.subscribe(e=>{const{action:t,payload:r,srcElement:n,event:o}=e;this.sendChannelPayload(t,r,n,o)})}static getMouseWheelMapFn(e){const t=this.channelActions.CHANNEL_WINDOW_WHEEL_EVENT,r=e.deltaY<=0?"up":"down",{deltaX:n,deltaY:o,deltaZ:s}=e;return{action:t,payload:{scrollDir:r,deltaX:n,deltaY:o,deltaZ:s},srcElement:e.srcElement,event:e}}static createCurriedGenericEvent(e){const t=`CHANNEL_WINDOW_${e.toUpperCase()}_EVENT`;return fe(jn.mapGenericEvent)(t)}static mapGenericEvent(e,t){return{action:e,payload:t,srcElement:t.srcElement,event:t}}static getResizeMapFn(e){return{action:this.channelActions.CHANNEL_WINDOW_RESIZE_EVENT,payload:ee(["innerWidth","innerHeight","outerWidth","outerHeight"],window),srcElement:e.srcElement,event:e}}static getOrientationMapFn(e){const t=this.channelActions.CHANNEL_WINDOW_ORIENTATION_EVENT,r=window.matchMedia("(orientation: portrait)").matches,n=ee(["innerWidth","innerHeight","outerWidth","outerHeight"],window);n.orientation=!0===r?"portrait":"landscape";return{action:t,payload:n,srcElement:e.srcElement,event:e}}getMediaQueryMapFn(e){return{action:this.channelActions.CHANNEL_WINDOW_MEDIA_QUERY_EVENT,payload:ee(["matches","media","mediaQueryName"],e),srcElement:e.srcElement,event:e}}createMouseWheelObservable(e){const t=e.debounceMSTimeForScroll;return Gn.createDomObservableFromEvent("wheel",jn.getMouseWheelMapFn.bind(this)).pipe(dn(t))}static getScrollData(){let e=0;return t=>{const r=e-t;return e=t,{scrollY:t,scrollDistance:r,scrollDir:r>=0?"up":"down"}}}static getScrollY(e){return void 0!==e.pageYOffset?e.pageYOffset:e.scrollTop}static getScrollMapFn(e,t,r,n,o){const s=n(jn.getScrollY(o)),{scrollDistance:i}=s;return{action:r,payload:s,srcElement:e.srcElement,scrollDistance:i,event:e}}createScrollObservable(e,t=window,r=!0){const n=e.debounceMSTimeForScroll,o=t,s=t===window,i=void 0!==e.scrollElForVals?e.scrollElForVals:t,a=s?"CHANNEL_WINDOW_SCROLL_EVENT":"CHANNEL_WINDOW_ELEMENT_SCROLL_EVENT",c=jn.getScrollData(),l=Ve(jn.getScrollMapFn,[a,c,i,r,o]).bind(this);return Gn.createDomObservableFromEvent("scroll",l,r,o).pipe(dn(n),(d=e=>0===e.scrollDistance,Gt(function(e,t){var r=!1,n=0;e.subscribe(Wr(t,function(e){return(r||(r=!d(e,n++)))&&t.next(e)}))})),Jr(e=>{const t=jn.getScrollY(o);return e.payload.scrollDistanceAbs=Math.abs(this.currentScrollY-t),this.currentScrollY=t,e}));var d}createOrientationObservable(e){return Gn.createDomObservableFromEvent("orientationchange",jn.getOrientationMapFn.bind(this))}createResizeObservable(e){const t=e.debounceMSTimeForResize;return Gn.createDomObservableFromEvent("resize",jn.getResizeMapFn.bind(this)).pipe(dn(t))}getEventsFromConfig(e=this.domChannelConfig){const t=e.events;return D(e=>{const t=jn.createCurriedGenericEvent(e);return Gn.createDomObservableFromEvent(e,t)},t)}getActiveObservables(e=this.domChannelConfig){let t=[];e.listenForMediaQueries=pt(e.mediaQueries)||pt(e.mediaQueries);const r={listenForResize:this.createResizeObservable.bind(this),listenForOrientation:this.createOrientationObservable.bind(this),listenForScroll:this.createScrollObservable.bind(this),listenForWheel:this.createMouseWheelObservable.bind(this)};ce((r,n,o)=>{e[n]&&t.push(r(e))},r),this.checkForMediaQueries(e.listenForMediaQueries);const n=this.getEventsFromConfig(e);return t=t.concat(n),t}checkForMediaQueries(e){const t=e=>{const{action:t,payload:r,srcElement:n,event:o}=e;this.sendChannelPayload(t,r,n,o,this.observer$)};!0===e&&this.getMediaQueryObservable(this.domChannelConfig).subscribe(t)}getMediaQueryObservable(e){const t=this.createMergedObsFromObj(e);return be(l,t).pipe(Jr(this.getMediaQueryMapFn.bind(this)))}addRegisteredActions(){return["CHANNEL_WINDOW_ABORT_EVENT","CHANNEL_WINDOW_AFTERPRINT_EVENT","CHANNEL_WINDOW_ANIMATIONEND_EVENT","CHANNEL_WINDOW_ANIMATIONITERATION_EVENT","CHANNEL_WINDOW_ANIMATIONSTART_EVENT","CHANNEL_WINDOW_APPINSTALLED_EVENT","CHANNEL_WINDOW_BEFOREPRINT_EVENT","CHANNEL_WINDOW_BEFOREUNLOAD_EVENT","CHANNEL_WINDOW_BEGINEVENT_EVENT","CHANNEL_WINDOW_BLUR_EVENT","CHANNEL_WINDOW_CACHED_EVENT","CHANNEL_WINDOW_CHANGE_EVENT","CHANNEL_WINDOW_CLICK_EVENT","CHANNEL_WINDOW_CLOSE_EVENT","CHANNEL_WINDOW_COMPOSITIONEND_EVENT","CHANNEL_WINDOW_COMPOSITIONSTART_EVENT","CHANNEL_WINDOW_COMPOSITIONUPDATE_EVENT","CHANNEL_WINDOW_COPY_EVENT","CHANNEL_WINDOW_CUT_EVENT","CHANNEL_WINDOW_DBLCLICK_EVENT","CHANNEL_WINDOW_DEVICECHANGE_EVENT","CHANNEL_WINDOW_DEVICELIGHT_EVENT","CHANNEL_WINDOW_DEVICEMOTION_EVENT","CHANNEL_WINDOW_DEVICEORIENTATION_EVENT","CHANNEL_WINDOW_DEVICEPROXIMITY_EVENT","CHANNEL_WINDOW_DOMATTRIBUTENAMECHANGED_EVENT","CHANNEL_WINDOW_DOMATTRMODIFIED_EVENT","CHANNEL_WINDOW_DOMCHARACTERDATAMODIFIED_EVENT","CHANNEL_WINDOW_DOMCONTENTLOADED_EVENT","CHANNEL_WINDOW_DOMCONTENTLOADED_EVENT","CHANNEL_WINDOW_DOMELEMENTNAMECHANGED_EVENT","CHANNEL_WINDOW_DRAGEND_EVENT","CHANNEL_WINDOW_DRAGENTER_EVENT","CHANNEL_WINDOW_DRAGLEAVE_EVENT","CHANNEL_WINDOW_DRAGOVER_EVENT","CHANNEL_WINDOW_DRAGSTART_EVENT","CHANNEL_WINDOW_DRAG_EVENT","CHANNEL_WINDOW_DROP_EVENT","CHANNEL_WINDOW_ELEMENT_SCROLL_EVENT","CHANNEL_WINDOW_ERROR_EVENT","CHANNEL_WINDOW_FOCUSIN_EVENT","CHANNEL_WINDOW_FOCUS_EVENT","CHANNEL_WINDOW_FULLSCREENCHANGE_EVENT","CHANNEL_WINDOW_FULLSCREENERROR_EVENT","CHANNEL_WINDOW_HASHCHANGE_EVENT","CHANNEL_WINDOW_INPUT_EVENT","CHANNEL_WINDOW_INVALID_EVENT","CHANNEL_WINDOW_KEYDOWN_EVENT","CHANNEL_WINDOW_KEYPRESS_EVENT","CHANNEL_WINDOW_KEYUP_EVENT","CHANNEL_WINDOW_LOAD_EVENT","CHANNEL_WINDOW_MEDIA_QUERY_EVENT","CHANNEL_WINDOW_MESSAGE_EVENT","CHANNEL_WINDOW_MOUSEDOWN_EVENT","CHANNEL_WINDOW_MOUSEENTER_EVENT","CHANNEL_WINDOW_MOUSELEAVE_EVENT","CHANNEL_WINDOW_MOUSEMOVE_EVENT","CHANNEL_WINDOW_MOUSEOUT_EVENT","CHANNEL_WINDOW_MOUSEOVER_EVENT","CHANNEL_WINDOW_MOUSEUP_EVENT","CHANNEL_WINDOW_MOUSEWHEEL_EVENT","CHANNEL_WINDOW_OFFLINE_EVENT","CHANNEL_WINDOW_ONLINE_EVENT","CHANNEL_WINDOW_OPEN_EVENT","CHANNEL_WINDOW_ORIENTATION_EVENT","CHANNEL_WINDOW_PAGEHIDE_EVENT","CHANNEL_WINDOW_PAGESHOW_EVENT","CHANNEL_WINDOW_PASTE_EVENT","CHANNEL_WINDOW_POPSTATE_EVENT","CHANNEL_WINDOW_POPSTATE_EVENT","CHANNEL_WINDOW_PROGRESSEVENTS_EVENT","CHANNEL_WINDOW_RESET_EVENT","CHANNEL_WINDOW_RESIZE_EVENT","CHANNEL_WINDOW_SCROLL_ELEMENT_ADDED_EVENT","CHANNEL_WINDOW_SCROLL_EVENT","CHANNEL_WINDOW_SCROLL_LOCK_EVENT",["CHANNEL_WINDOW_SCROLL_LOCK_EVENT","onScrollLockEvent"],["CHANNEL_WINDOW_SET_ELEMENT_TO_SCROLL_EVENT","onSetElementToScroll"],"CHANNEL_WINDOW_STORAGE_EVENT","CHANNEL_WINDOW_SUBMIT_EVENT","CHANNEL_WINDOW_TRANSITIONCANCEL_EVENT","CHANNEL_WINDOW_TRANSITIONEND_EVENT","CHANNEL_WINDOW_TRANSITIONRUN_EVENT","CHANNEL_WINDOW_TRANSITIONSTART_EVENT","CHANNEL_WINDOW_UNLOAD_EVENT","CHANNEL_WINDOW_WHEEL_EVENT"]}onScrollLockEvent(e){}onSetElementToScroll(e){let{config:t,el:r,scrollElement:n}=e.payload;t=t||{},t=Ye(this.domChannelConfig,t),n=n||r;this.sendChannelPayload("CHANNEL_WINDOW_SCROLL_ELEMENT_ADDED_EVENT",{el:r},r),this.createScrollObservable(t,n).subscribe(e=>{const{action:t,payload:r,srcElement:n,event:o}=e;this.sendChannelPayload(t,r,n,o)})}bindStaticMethods(){this.createMediaQueryHandler=Gn.createMediaQueryHandler.bind(this),this.createMergedObsFromObj=Gn.createMergedObsFromObj.bind(this)}}class zn extends Fn{constructor(e={}){super("CHANNEL_LIFECYCLE",e)}addRegisteredActions(){return["CHANNEL_LIFECYCLE_RENDERED_EVENT","CHANNEL_LIFECYCLE_DISPOSED_EVENT"]}onViewStreamInfo(e){const{action:t,srcElement:r}=e,n=r;n.action=t,this.onSendEvent(t,n)}onSendEvent(e,t={}){const r=this.channelActions[e],n={};window.setTimeout(()=>this.sendChannelPayload(r,t,n,void 0),0)}}class Bn extends Fn{constructor(e={}){super("CHANNEL_AI",e)}addRegisteredActions(){return["CHANNEL_AI_RENDERED_EVENT","CHANNEL_AI_DISPOSED_EVENT"]}onViewStreamInfo(e){const{action:t,srcElement:r}=e,n=r;n.action=t,this.onSendEvent(t,n)}onSendEvent(e,t={}){const r=this.channelActions[e],n={};window.setTimeout(()=>this.sendChannelPayload(r,t,n,void 0),0)}}class Yn extends Fn{constructor(e,t={}){t.isProxy=!0,super(e,t),this.props=t,this.subject$=new r,this.replaySub$=new i(1),this.observer$=l(this.subject$,this.replaySub$);!0===it.debug&&this.checkIfChannelIsStillProxy(e)}getMergedSubject(e=!1){return!0===e?this.replaySub$:this.subject$}checkIfChannelIsStillProxy(e){const t=e;ht(()=>{!0!==X(t,it.listRegisteredChannels())&&console.warn(`Spyne Warning: The channel, ${t} does not appear to be registered!`)},1e3)}get replaySubject(){return this.replaySub$}get subject(){return this.subject$}}const Kn=new Map;class qn{constructor(){this.addMixins(),Kn.set("DISPATCHER",new r),this.listRegisteredChannels=qn.listRegisteredChannels.bind(this),this.getChannelsList=qn.getChannelsList.bind(this)}get map(){return Kn}static getChannelsList(){return Array.from(Kn,(e,t)=>({key:e[0],val:e[1].constructor.name}))}static listRegisteredChannels(e=!1){const t=this.getChannelsList(),r=m(U("ChannelProxy","val")),n=F(U("ChannelProxy","val")),o=(!0===e?n:r)(t);return Pe(["key"],o)}listProxyChannels(){return this.listRegisteredChannels(!0)}checkForMissingChannels(){const e=this.getChannelsList(),t=F(U("ChannelProxy","val"))(e);if(t.length>=1){const e=`Spyne Warning: The following ${1===t.length?"Channel has":"Channels have"} not been initialized: ${u(S(", "),D(b("key")))(t)}`;console.warn(e)}}init(){this.createMainStreams()}createMainStreams(){this.routeStream=new $n,Kn.set("CHANNEL_ROUTE",this.routeStream),this.uiStream=new kn,Kn.set("CHANNEL_UI",this.uiStream),this.domStream=new jn,Kn.set("CHANNEL_WINDOW",this.domStream),this.viewStreamLifecycle=new zn,Kn.set("CHANNEL_LIFECYCLE",this.viewStreamLifecycle),this.aiStream=new Bn,Kn.set("CHANNEL_AI",this.aiStream),this.routeStream.initializeStream(),this.domStream.initializeStream()}addKeyEvent(e){Kn.get("UI").addKeyEvent(e)}registerStream(e){const t=e.channelName;if(Kn.has(t)){if(u(Ue(["props","isRegistered"],!0))(Kn.get(t)))return void console.warn(`Spyne Warning: The Channel, ${t}, has already been registered!`)}Kn.set(t,e),e.initializeStream()}getChannelActions(e){return Kn.get(e).addRegisteredActions()}getProxySubject(e,t=!1){const r=!0===t?"replaySubject":"subject";return Kn.get(e)[r]}testStream(e){return void 0!==Kn.get(e)}getStream(e){return!1===this.testStream(e)&&Kn.set(e,new Yn(e)),Kn.get(e)}addMixins(){}}class Qn{constructor(e,t="",r=!0){return this.parentContext=e,this.omittedMethods=["autoBinder","initAutoBinder","getEnhancerMethods","checkForMalformedMethods","caller","arguments","bindParentViewStream"],this.prefix=t,!0===r&&this.autoBinder(),this.allMethodsList}initAutoBinder(){this.autoBinder()}getEnhancerMethods(){return function(e,t=[]){const r=V(["length","name","prototype","constructor"],t),n=u(ae(r),q),o=n(Object.getOwnPropertyNames(e.constructor.prototype)),s=n(Object.getOwnPropertyNames(e.constructor));return{methods:o,staticMethods:s,allMethods:V(o,s)}}(this,this.omittedMethods)}checkForMalformedMethods(e){const t=it?.debug||!1;if(""===this.prefix&&t)return void console.warn(`SPYNE WARNING: The following SpyneTrait ${this.constructor.name} needs a prefix`);const r=m(e=>0===e.indexOf(this.prefix),e);if(r.length>=1&&t){const e=`Spyne Warning: The following method(s) in ${this.constructor.name} require the prefix, "${this.prefix}": [${r.join(", ")}];`;console.warn(e)}}bindParentViewStream(e,t){this.checkForMalformedMethods(e.allMethods);const r={},n=(e,n=!1)=>{const o=!0===n?this.constructor:this;"function"===typeof o[e]&&(r[e]=t[e]=o[e].bind(t))},o=He(2,n)(I,!0);return D(o,e.staticMethods),D(n,e.methods),r}autoBinder(){const e=this.getEnhancerMethods();return this.allMethodsList=this.bindParentViewStream(e,this.parentContext),this.allMethodsList}}class Xn{constructor(e={},t,r,n){this._mapFn=Xn.setMapFn(e),this._url=Xn.setUrl(e),this._responseType=Xn.setResponseType(e),this._serverOptions=Xn.setServerOptions(e),this._subscriber=void 0!==t?t:e=>console.log("FETCH RETURNED ",e),this.debug=!0===e?.debug,this.disableSanitize=!0===e?.disableSanitize,this.channelName=n;const o={mapFn:this.mapFn,url:this.url,serverOptions:this.serverOptions,responseType:this.responseType,disableSanitize:this.disableSanitize,debug:this.debug};!0!==r&&Xn.startWindowFetch(o,this._subscriber,this.channelName)}static startWindowFetch(e,t,r){const{mapFn:n,url:o,serverOptions:i,responseType:a,debug:c}=e,l={channelName:r,url:o,responseType:a,serverOptions:i},u=fn(!0===c?e=>{console.log("DEBUG FETCH :",e,l)}:()=>{}),h=d(window.fetch(o,i)).pipe(nn(e=>d(Xn.parseResponse(e,l))),u,Jr((E=n,t=>{const r=!0===e?.disableSanitize?t:Ut(t,{mode:"app"});return E(r,l)})),Yr(e=>s(Xn.createFetchErrorPayload(e,l))),function(e){void 0===e&&(e={});var t=e.connector,r=void 0===t?function(){return new cn}:t,n=e.resetOnError,o=void 0===n||n,s=e.resetOnComplete,i=void 0===s||s,a=e.resetOnRefCountZero,c=void 0===a||a;return function(e){var t,n,s,a=0,l=!1,d=!1,u=function(){null==n||n.unsubscribe(),n=void 0},h=function(){u(),t=s=void 0,l=d=!1},E=function(){var e=t;h(),null==e||e.unsubscribe()};return Gt(function(e,p){a++,d||l||u();var N=s=null!=s?s:r();p.add(function(){0!==--a||d||l||(n=Nn(E,c))}),N.subscribe(p),!t&&a>0&&(t=new Ar({next:function(e){return N.next(e)},error:function(e){d=!0,u(),n=Nn(h,o,e),N.error(e)},complete:function(){l=!0,u(),n=Nn(h,i),N.complete()}}),Ur(e).subscribe(t))})(e)}}());var E;h.subscribe(t)}static async parseResponse(e,t){const{responseType:r}=t,n=e.status,o=e.statusText,s=e.headers?.get?.("content-type")||"",i={...t,status:n,statusText:o,contentType:s,ok:e.ok};if(!0!==e.ok){const t=await Xn.safeReadText(e);throw Xn.createFetchError({errorType:"FETCH_HTTP_ERROR",message:`Fetch request failed with status ${n} ${o}`,metadata:i,rawBody:t})}if("json"===r)return Xn.parseJsonResponse(e,i);if("text"===r)return e.text();if("blob"===r)return e.blob();if("arrayBuffer"===r)return e.arrayBuffer();if("formData"===r)return e.formData();throw Xn.createFetchError({errorType:"FETCH_UNSUPPORTED_RESPONSE_TYPE",message:`Unsupported fetch responseType "${r}"`,metadata:i})}static async parseJsonResponse(e,t){const r=await e.text(),n=r.trim();if(""===n)return null;try{return JSON.parse(n)}catch(e){throw Xn.createFetchError({errorType:"FETCH_RESPONSE_PARSE_ERROR",message:"Expected JSON but could not parse response body.",metadata:t,rawBody:r,originalError:e})}}static createFetchError({errorType:e,message:t,metadata:r,rawBody:n="",originalError:o}){const s=new Error(t);return s.isChannelFetchError=!0,s.errorType=e,s.metadata=r,s.rawBody=n,s.originalError=o,s}static createFetchErrorPayload(e,t){const r=e?.metadata||t||{};return{isChannelFetchError:!0,isError:!0,error:!0,errorType:e?.errorType||"FETCH_UNKNOWN_ERROR",message:e?.message||"Unknown ChannelFetchUtil error",channelName:r.channelName,url:r.url,responseType:r.responseType,status:r.status,statusText:r.statusText,contentType:r.contentType,ok:r.ok,rawBodyPreview:Xn.truncateBody(e?.rawBody),originalErrorMessage:e?.originalError?.message}}static truncateBody(e="",t=500){return"string"!=typeof e?"":e.length>t?`${e.slice(0,t)}...`:e}static async safeReadText(e){try{return await e.text()}catch(e){return""}}static setMapFn(e){return u(k(e=>e),b("mapFn"))(e)}static setUrl(e){const t=b("url",e);return void 0===t&&console.warn("SPYNE WARNING: URL is undefined for data channel"),t}static setResponseType(e){return k("json",b("responseType",e))}get mapFn(){return this._mapFn}get url(){return this._url}get serverOptions(){return this._serverOptions}get responseType(){return this._responseType}static stringifyBodyIfItExists(e){const t=e?.body;if(!0!==(null!==t&&"object"==typeof t&&t.constructor===Object))return e;const r=new Headers(e.headers||{});return!0!==r.has("Content-Type")&&r.set("Content-Type","application/json"),{...e,headers:r,body:JSON.stringify(t)}}static updateMethodWhenBodyExists(e){return void 0!==e?.body&&"GET"===(e?.method||"GET").toUpperCase()?(console.warn("SPYNE WARNING: Fetch body was provided with method GET. Changing method to POST.",e),{...e,method:"POST"}):e}static setServerOptions(e){const t=ee(["method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive"],e);let r=te(Xn.baseOptions(),t);return r=Xn.updateMethodWhenBodyExists(r),r=Xn.stringifyBodyIfItExists(r),r}static baseOptions(){return{method:"GET",headers:new Headers({Accept:"application/json, text/plain, */*"}),mode:"cors",credentials:"same-origin",cache:"default",redirect:"follow",referrerPolicy:"no-referrer-when-downgrade",integrity:"",keepalive:!1}}}class Jn extends Fn{constructor(e,t={disableSanitize:!1}){Jn.validateMapMethod(t,e),void 0!==t.map&&(t.mapFn=t.map),t.extendedActionsArr=[`${e}_RESPONSE_EVENT`,`${e}_ERROR_EVENT`,[`${e}_REQUEST_EVENT`,"onFetchUpdate"]],t.sendCachedPayload=!0,super(e,t)}static validateMapMethod(e,t,r=!1){const n=P(_,e=>"function"!=typeof e),o=Ae(n),s=f([o,e=>e.length>=1]);return!u(s,N,ee(["map","mapFn"]))(e)||(!1===r&&console.warn(`Spyne Warning: The map method for ChannelFetch, ${t}, appears to be invalid`),!1)}onRegistered(e=this.props){!0!==e?.pause&&this.startFetch()}addRegisteredActions(e){const t=u(k([]),K(["props","extendedActionsArr"]));return["CHANNEL_RESPONSE_EVENT","CHANNEL_ERROR_EVENT",["CHANNEL_UPDATE_RESPONSE_EVENT","onFetchUpdate"],["CHANNEL_FETCH_REQUEST_EVENT","onFetchUpdate"]].concat(t(this))}startFetch(e={},t=this.onFetchReturned.bind(this)){const r=this.consolidateAllFetchProps(e);return new Xn(r,t,!1,this.props.name)}onFetchUpdate(e){const t=this.getPropsForFetch(e);this.startFetch(t)}onFetchReturned(e){const t=!0===e?.isChannelFetchError?`${this.props.name}_ERROR_EVENT`:`${this.props.name}_RESPONSE_EVENT`;return this.createChannelPayloadItem(e,t)}createChannelPayloadItem(e,t=`${this.props.name}_RESPONSE_EVENT`){const{name:r,sendCachedPayload:n,url:o}=this.props,s={name:r,sendCachedPayload:n,url:o};this.sendChannelPayload(t,e,s)}getPropsForFetch(e){return ee(["mapFn","url","header","body","mode","method","responseType","debug"],e?.payload??e?.viewStreamInfo?.payload??{})}consolidateAllFetchProps(e,t=this.props){const r=ee(["mapFn","url","header","body","mode","disableSanitize","method","responseType","debug"],t),n=m(_);return u(n,(e,t)=>te(e,t))(r,e)}get observer(){return this.observer$}}let Zn=it;class eo{constructor(e={}){let{name:t,config:r,parentEl:n}=e;this.props=e,void 0===r&&(r=re(e)),this.name=t||"empty",this.props.name=t,r=eo.mergeDefaultConfig(r,this.defaultConfig()),this.props.parentEl=n||eo.createParentEl(),this.props.config=r,void 0!==this.props.traits&&this.addTraits(this.props.traits)}register(e){Zn=e,this.props.pluginName=this.props.name,!1!==Zn.initialized?(this.onBeforeRegistered(),this.props.config=re(this.props.config),Zn.addPluginConfig(this.name,this.props.config),this.onRegistered(),this.onRender()):console.warn(`Spyne Warning: SpyneApp has not been initialized yet! Cannot register plugin "${this.name}".`)}get SpyneAppProperties(){return Zn}static mergeDefaultConfig(e={},t=this.defaultConfig()){return Object.assign(t,e)}static getSpyneApp(e,t){!1===Zn.initialized?console.warn(`Spyne Warning: Unable to install plugin, ${e}! SpyneApp has not been initialized!`):Zn.addPluginConfig(e,t)}static updateSpyneConfig(e,t,r){return!0===Me(y(Object),["config","plugins",t])(e)?(!0===e.config.debug&&console.warn(`Spyne Warning: The plugin, ${t}, already exists`),!1):(e.config.plugins[t]=r,e.config.plugins[t])}static createParentEl(e){return e||document.getElementById("spyne-plugins")||(()=>{const e=new Ft({id:"spyne-plugins"});document.body.appendChild(e.render());const t=document.getElementById("spyne-plugins");return t.style.cssText="position:absolute; top:0;left:0;width:100%;height:100%;min-height:100vh;z-index:1000000; pointer-events:none",t})()}addTraits(e){"Array"!==e.constructor.name&&(e=[e]);e.forEach(e=>new e(this))}onBeforeRegistered(){this.checkForRequiredWindowEvent()}checkForRequiredWindowEvent(){const e=this.props.requiredEvents??[],t=it.getChannelConfig("WINDOW"),r=e.filter(e=>!t.events.includes(e));r.length>0&&console.warn(`plugin "${this.props.name}" requires the following config.WINDOW.events, --\x3e ${r.join(", ")} <--`)}defaultConfig(){return{}}onRegistered(){}onRender(){}}const to=new qn,ro="0.24.0";let no=new class{constructor(){this.version=ro}get channels(){return to}init(e={},t=!1){
|
|
1
|
+
import{fromEventPattern as e,Observable as t,Subject as r,bindCallback as n,fromEvent as o,of as s,ReplaySubject as i,forkJoin as a,EMPTY as c,merge as l,from as u}from"rxjs";import{compose as d,complement as h,isEmpty as E,head as p,values as N,isNil as _,allPass as f,reject as m,equals as T,keys as A,find as y,is as C,assoc as g,prop as v,when as b,__ as I,join as S,replace as L,flatten as O,map as D,toPairs as R,ifElse as w,always as H,concat as P,either as V,propEq as U,test as x,findLastIndex as M,last as W,filter as F,invert as $,defaultTo as k,reduce as j,zipObj as G,split as z,fromPairs as B,has as Y,path as K,uniq as q,chain as Q,includes as X,mergeRight as J,pickAll as Z,pick as ee,mergeDeepRight as te,clone as re,not as ne,mergeAll as oe,lte as se,match as ie,without as ae,mapObjIndexed as ce,pipe as le,forEachObjIndexed as ue,flip as de,propSatisfies as he,forEach as Ee,props as pe,omit as Ne,any as _e,curry as fe,where as me,F as Te,all as Ae,slice as ye,toLower as Ce,findIndex as ge,apply as ve,identity as be,objOf as Ie,view as Se,lensIndex as Le,lensProp as Oe,over as De,reverse as Re,curryN as we,toUpper as He,partialRight as Pe,pluck as Ve,pathEq as Ue,pathSatisfies as xe}from"ramda";import Me from"dompurify";class We{constructor(){this.checkIfObjIsNotEmptyOrNil=We.checkIfObjIsNotEmptyOrNil.bind(this)}static checkIfObjIsNotEmptyOrNil(e){const t=d(h(E),p,N),r=d(h(_),p,N);return f([t,r])(e)}static checkIfParamValueMatchesRegex(e,t){const r=m(T("routeName")),n=d(r,A),o=d(y(t=>x(new RegExp(t),e)),n)(t);return C(String,o)&&(t=g(e,v(o,t),t)),t}static formatStrAsWindowLocation(e){return{hash:e,search:e,pathname:e}}static getLocationStrByType(e,t=!1,r=window.location){return v({slash:"pathname",query:"search",hash:"hash"}[!0===t?"hash":e],r).replace(/^(\/)?(#)?(\/)?(.*)$/,"$4")}static createRouteArrayFromParams(e,t,r="slash",n){const o=[],s=t=>{const r={},i=t.routeName;let a=void 0!==e[i]?e[i]:v(i,n);const c=typeof t[a];"string"===c?a=t[a]:"undefined"===c&&(t=this.checkIfParamValueMatchesRegex(a,t)),r[i]=a,this.checkIfObjIsNotEmptyOrNil(r)&&o.push(r);const l=C(Object,t),u=Y(a,t),d=Y("routePath",t);if(!0===(u&&l)){const e=t[a];Y("routePath",e)&&s(e.routePath)}else!0===d&&void 0!==a&&s(t.routePath)};return s(t),o}static createSlashString(e){const t=m(_),r=b(h(_,I),S("/")),n=L(/^(\^*)(.*|^\$)(\$)$/,"$2");return d(n,r,t,O,D(N))(e)}static createQueryString(e){const t=m(_),r=this.checkIfObjIsNotEmptyOrNil,n=d(S("="),O,R),o=w(r,n,H(void 0)),s=D(o),i=b(h(E),P("?"));return d(i,S("&"),t,s)(e)}static checkPayloadForRegexOverrides(e,t,r="Value"){const n=d(e=>v(`${e}${r}`,t),p,A);return D(e=>{const t=n(e);return void 0!==t?g(d(p,A)(e),t,e):e},e)}static checkForRouteValWithMultipleVals(e){const t=e=>{const t=(t,r)=>(t[r]=(e=>{const t=e.match(/^[^|]*/);return t?"^$"===t[0]?"":t[0]:e})(e[r]),t);return"object"==typeof e&&(e=Object.keys(e).reduce(t,{})),e};return!0===Array.isArray(e)?e.map(t):e}static checkForRouteValsPartMatch(e,t={}){const r=(e,t)=>t.split("|").some(t=>((e,t)=>{const r=e.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,"[\\w\\d_-]*");return new RegExp(`^${r}$`).test(t)})(t,e))?e:t;return e.map(e=>{const n={...e};return Object.keys(n).forEach(e=>{Object.prototype.hasOwnProperty.call(n,e)&&t[e]&&(n[e]=r(t[e],n[e]))}),n})}static convertParamsToRoute(e,t=ct.config.channels.ROUTE,r,n){const o=void 0!==r?r:t.type,s=t.isHash,i=t.routes.routePath,a=void 0!==n?n:this.getLocationStrByType(o,s),c=this.convertRouteToParams(a,t,o).routeData;let l=this.createRouteArrayFromParams(e,i,o,c);return l=We.checkPayloadForRegexOverrides(l,e),l=We.checkForRouteValWithMultipleVals(l),"query"===o?this.createQueryString(l):this.createSlashString(l)}static findIndexOfMatchedStringOrRegex(e,t){const r=t.includes(".+"),n=L(/^$/,"^$"),o=V(U(e,"str"),d(x(I,e),v("re")));return d(M(T(!0)),D(o),D(e=>{return{str:e,re:(t=e,r&&(t.startsWith("^")||(t="^"+t),t.endsWith("$")||(t+="$")),new RegExp(t))};var t}),D(n))(t)}static checkIfValueShouldMapToParam(e,t,r){const n=d(D(W),D(F(C(String))),R)(e),o=We.findIndexOfMatchedStringOrRegex(t,n);let s=t;if(o>=0){const t=n[o],r=$(e),i=d(p,k([]),v(t))(r);!0===/^([-$\w]*)$/.test(i)&&!0===C(String,i)&&(s=i)}return s}static createArrFromSlashStr(e){return e.replace(/^([/])?(.*)$/,"$2").split("/")}static convertSlashRouteStrToParamsObj(e,t,r){const n=t,o=this.createArrFromSlashStr(t),s=[],i=[];let a=e;j((e,t)=>{const n=this.checkIfValueShouldMapToParam(a,t,r);a=this.checkIfParamValueMatchesRegex(t,a);const o=V(E,_);void 0!==a&&(e=>e!==W(s))(a.routeName)&&!1===o(n)&&(s.push(a.routeName),i.push(n));const c=K([t,"routePath"],a),l=K(["routePath"],a);void 0!==c?a=c:void 0!==l&&(a=l)},0,o);const c=G(s,i),l=this.getLastArrVal(s);return{paths:s,pathInnermost:l,routeData:c,routeValue:n}}static getLastArrVal(e){return void 0!==W(t=e)?W(t):"";var t}static createDefaultParamFromEmptyStr(e,t){const r={};return r[e.routeName]=this.checkIfValueShouldMapToParam(e,t),r}static convertQueryStrToParams(e,t,r){const n=t,o=t.replace(/^([?])?(.*)$/,"$2"),s=d(D(z("=")),z("&"))(o);let i=B(s),a=D(p,s);!0===E(t)&&(i=this.createDefaultParamFromEmptyStr(e,t,r),a=A(i));return{paths:a,pathInnermost:this.getLastArrVal(a),routeData:i,routeValue:n}}static convertRouteToParams(e,t,r){if(void 0===t)return{};const n=void 0!==r?r:t.type,o=k({},v("regexTokens",t)),s=t.routes.routePath;return"query"===n?this.convertQueryStrToParams(s,e):(e=e.replace(/\/$|$/,"/"),this.convertSlashRouteStrToParamsObj(s,e,o))}}class Fe{constructor(){this.createPopStateStream=Fe.createPopStateStream.bind(this)}static createPopStateStream(t){e(function(e){window.onpopstate=e},function(){window.onpopstate=function(){}}).subscribe(t)}static getLastArrVal(e){return void 0!==W(t=e)?W(t):"";var t}static compareRouteKeywords(e={},t){const r=(e,t)=>void 0!==t?ee(t,e):e;let n=r(e,t);return{pickValues:r,compare:(e={},t)=>{const o=r(e,t),s=e=>d(A,F(U(!0,e))),i=d(D(e=>{const t=v(e,n),r=v(e,o),s=T(t,r),i=void 0!==t,a=void 0!==r,c=!s,l=!1===i&&!0===a,u=!0===i&&!1===a,d={};return d[e]={same:s,changed:c,added:l,removed:u,previousExists:i,nextExists:a},d}),q,Q(A))([n,o]),a=Q(s("changed"),i),c=Q(s("added"),i),l=Q(s("removed"),i);return n=o,{pathsAdded:c,pathsRemoved:l,pathsChanged:a}},getComparer:()=>n}}static getRouteArrData(e,t){const r=F(X(I,e),t);return{paths:r,pathInnermost:Fe.getLastArrVal(r)}}static flattenConfigObject(e){const t=e=>Q(([e,r])=>"object"!=typeof r||null===r||Array.isArray(r)?[[e,r]]:D(([t,r])=>[`${e}.${t}`,r],t(r)),R(e));return N(B(t(e)))}static addRouteDatasets(e){const{type:t,isHash:r}=e,n=n=>{const o="query"===t?"":!0===r?"#":"/",s=We.convertParamsToRoute(n,e);return o+s.replace(/^(.*\/)([\w-]*\/?)(.*)$/gm,"$1$2")},o=/^([A-Za-z0-9_-])+$/m,s=(e=[],t,r={})=>{let{routeName:i}=t;return R(t).reduce((t,a)=>{const[c,l]=a,u=C(Object,l),d=e=>x(o,e)?(e=>String(e).replace(/([-_])/g," ").toUpperCase())(e):c;if("routeName"===c||"404"===c)return t;i=i||v("routeName",l);let h=re(r);if(h[i]=String(c).replace(/([^A-Za-z0-9-_])/g,""),!0===u){if(1===A(h).length){const e=K(["routePath","routeName"],l);if(e){const o=re(h);o[e]="",o.navLevel=A(r).length,o.title=d(c),o.href=n(o),t.push(o)}}h=s(e,l,h)}else h.title=d(c),h.href=n(h);return h.navLevel=A(r).length,t.push(h),t},[])},i=s([],e.routes);let a=O(i);a=function e(t){return t.map(t=>{for(const r in t)void 0===r||"undefined"===r||void 0===t[r]?delete t[r]:t[r]&&"object"==typeof t[r]&&!Array.isArray(t[r])&&(t[r]=e([t[r]])[0]);return t})}(a);return{routeDatasetsArr:a,routeNamesArr:(e=>{const t=m(X(I,["title","href","navLevel","undefined"]));return d(q,t,O,D(A))(e)})(a)}}static conformRouteObject(e={},t=!1){const r=K(["channels","ROUTE"],e);let{add404s:n}=void 0!==r?r:e;n=n||t;const o=e=>{const t=e[1],r=C(Array,t);return""===t?e[1]="^$":r&&(e[1]=t.join("|")),e},s=d(B,D(e=>{const[t,r]=e,i=n?{404:".+"}:{},a=C(Object,r),c=C(Array,r),l="routePath"===t;return!0===a&&!1===c&&(e[1]=s(e[1]),l&&(e[1]=d(te(i),B,D(o),R)(e[1]))),e}),R);if(void 0!==r){e.channels.ROUTE=s(e.channels.ROUTE);const t=Fe.addRouteDatasets(e.channels.ROUTE);return e.channels.ROUTE=J(e.channels.ROUTE,t),e}return s(e)}static getLocationData(){return Z(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}}const $e=Object.create({}),ke=d(ne,C(Array)),je=d(f([ke,C(Object)]));function Ge(e){return e&&"object"==typeof e&&"[object RegExp]"!==Object.prototype.toString.call(e)&&"[object Date]"!==Object.prototype.toString.call(e)}function ze(e,t){return t&&!0===t.clone&&Ge(e)?Ye((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function Be(e,t,r){const n=e.slice();return t.forEach(function(t,o){void 0===n[o]?n[o]=ze(t,r):Ge(t)?n[o]=Ye(e[o],t,r):-1===e.indexOf(t)&&n.push(ze(t,r))}),n}function Ye(e,t,r){const n=Array.isArray(t),o=(r||{arrayMerge:Be}).arrayMerge||Be;return n?Array.isArray(e)?o(e,t,r):ze(t,r):function(e,t,r){const n={};return Ge(e)&&Object.keys(e).forEach(function(t){n[t]=ze(e[t],r)}),Object.keys(t).forEach(function(o){Ge(t[o])&&e[o]?n[o]=Ye(e[o],t[o],r):n[o]=ze(t[o],r)}),n}(e,t,r)}let Ke,qe,Qe,Xe;Ye.all=function(e,t){if(!Array.isArray(e)||e.length<2)throw new Error("first argument should be an array with at least two elements");return e.reduce(function(e,r){return Ye(e,r,t)})};let Je,Ze,et=!0,tt=!1;const rt=[];let nt,ot;const st=[],it=new Map;const at=new class{constructor(){$e.foo=()=>console.log("used for testing purposes.")}addMethod(e,t,r=!1){if(!0===Object.prototype.hasOwnProperty.call($e,e)){const t=`Spyne Warning: the method name, ${e}, already exists.`;if(r)return t;console.warn(t)}else $e[e]=t}addMethods(e={},t=!1){let r;if(!1===je(e))return r=`Spyne Warning: the pluginMethods property, ${JSON.stringify(e)} needs to be an object.`,t?r:void console.warn(r);return A(e).map(n=>{const o=v(n,e);if("function"==typeof o)this.addMethod(n,o,t);else{if(r=`the value for ${n} is not a valid function.`,t)return r;console.warn(r)}}).join(",")}checkIfMethodExists(e){}get pluginMethodsObj(){return $e}};const ct=new class{constructor(){Xe=!1}get channelsMap(){return Qe}get initialized(){return Xe}get config(){return Ke}get debug(){return et}get mode(){return void 0!==Ke?.mode?Ke.mode:"app"}static listChannels(){return Array.from(qe.map.keys())}initialize(e={},t={},r,n){return qe=r,Ke=Ye(e,t),Ke.channels&&Ke.channels.ROUTE&&(Ke=n.conformRouteObject(Ke)),ot=Ke?.IMG_PATH,et=void 0!==Ke.debug?Ke.debug:et,this.getChannelActions=qe.getChannelActions.bind(qe),this.listRegisteredChannels=qe.listRegisteredChannels.bind(qe),Xe=!0,this._initialized=Xe,this.setChannelsMap(),t?.baseHref&&this.setHeadBaseHref(t.baseHref),Ke}setHeadBaseHref(e){const t=document.createElement("base");t.href=e,document.head.appendChild(t)}conformRouteConfig(e=!1){Ke=Fe.conformRouteObject(Ke,e)}setChannelsMap(){const e=qe.getStream.bind(qe),t=qe.testStream.bind(qe),r=qe.getProxySubject.bind(qe);Qe={getStream:e,testStream:t,getProxySubject:r}}setProp(e,t,r=!1){return r?Ke.ephemeralProps[e]=t:Ke.tmpProps[e]=t,t}getProp(e){if(Ke?.tmpProps&&Object.prototype.hasOwnProperty.call(Ke.tmpProps,e))return Ke.tmpProps[e];if(Ke?.ephemeralProps&&Object.prototype.hasOwnProperty.call(Ke.ephemeralProps,e)){const t=Ke.ephemeralProps[e];return delete Ke.ephemeralProps[e],t}}createTempProp(e){const t=Math.random().toString(36).slice(2,8);return this.setProp(t,e,!0),t}setChannelConfig(e,t){return Ke.channels[e]=t,Ke.channels[e]}getChannelConfig(e,t=Ke){if("CHANNEL_ROUTE"===e?e="ROUTE":"CHANNEL_WINDOW"===e&&(e="WINDOW"),void 0===t||void 0===Ke.channels)return void console.warn("Spyne warning: Spyne config object is empty!");const r=Ke.channels[e];if(void 0!==r)return r;console.warn(`Spyne warning: Spyne configuration for channel, ${e} is empty!`)}registerChannel(){}addPluginConfig(e,t={}){void 0===Ke.plugins&&(Ke.plugins={}),this.addPluginMethods(t.pluginMethods),Ke.plugins[e]=t}getPluginsMethodObj(e){return e&&this.addPluginMethods(e),at.pluginMethodsObj}addPluginMethods(e){e&&at.addMethods(e)}doNotTrackChannel(e){st.push(e)}getUntrackedChannelsList(){return st}registerProxyReviver(e,t){it.set(e,t)}registerPlugin(e){this._initialized||console.warn("SpyneApp is not initialized yet. Plugin will not be fully registered."),e.register(this)}getProxyReviver(e){return it.get(e)}registerCmsRehydrator(e){Je=e}get rehydrateCmsData(){return Je}registerCmsLineageWarner(e){Ze=e}get warnUnproxiedCmsData(){return Ze}getPluginConfigByPluginName(e){return Ke.plugins[e]}get IMG_PATH(){return ot}get excludeChannelsFromConsole(){return rt}set excludeChannelsFromConsole(e){"string"==typeof e?rt.includes(e)||rt.push(e):Array.isArray(e)?e.forEach(e=>{"string"!=typeof e||rt.includes(e)||rt.push(e)}):console.warn("Invalid value provided to excludeChannelsFromConsole. Only strings or arrays are allowed.")}get linksData(){return console.warn("get links data in SpyneAppProperties is deprecated, use navLinks"),nt}set linksData(e){console.warn("set links data in SpyneAppProperties is deprecated, use navLinks")}get navLinks(){return nt}set navLinks(e){nt=e}get enableCMSProxies(){return tt}getHrefFromData(e={}){return We.convertParamsToRoute(e)}set enableCMSProxies(e=!0){tt=Boolean(e)}setCMSProxyMethod(e){this.enableCMSProxies=!0,this.formatTemplateForProxyData=e}tempGetChannelsInstance(){}tempGetConfig(){}},lt=()=>({includes:()=>!0===ct.initialized?ct.listRegisteredChannels():["CHANNEL_ROUTE","CHANNEL_UI","CHANNEL_WINDOW","DISPATCHER"]});void 0!==d&&void 0!==t&&(d(C(String),K(["data","srcElement","vsid"])),d(C(String),K(["data","srcElement","id"])));const ut=(e={},t)=>{const{__proxy__proxyName:r}=e;void 0===r&&console.error("object is not proxy object ",e);const n=(r,n)=>{const o=K(n,e),{__proxy__isProxy:s,__proxy__props:i}=o;return s?t(r,i):r},o=n(re(e),[]),s=(e,t)=>{const r=t||[];Object.entries(e).forEach(([t,o])=>{const i=(e=>{let t=typeof e;return["number","boolean","string"].includes(t)?t="primitive":"object"===t&&(Array.isArray(e)?t="array":null===e&&(t="undefined")),t})(o),a=[...r];a.push(t),"object"!==i&&"array"!==i||(e[t]=n(o,a),s(o,a))})};return s(o),o},dt=(e={})=>{const{__proxy__proxyName:t}=e;if(void 0!==t){const r=ct.getProxyReviver(t);if("function"==typeof r)return ut(e,r)}},ht=function(e,t=new WeakSet){if(null===e||"object"!=typeof e)return e;const r=dt(e);if(void 0!==r)return r;if(t.has(e))return e;if(t.add(e),Array.isArray(e))return e.map(e=>ht(e,t));const n={};return Object.entries(e).forEach(([e,r])=>{n[e]=ht(r,t)}),n},Et=(e,t)=>{const r=e?.__proxy__proxyName;if(void 0===r)return t;const n=ct.getProxyReviver(r);return"function"!=typeof n?t:n(t,e.__proxy__props)},pt=function(e,t){return Et(e,e.filter(t))},Nt=function(e,t){return Et(e,e.filter((e,r)=>!1===t(e,r)))},_t=function(e,t){const r=e.map((e,r)=>{const n=null!==e&&"object"==typeof e&&void 0!==e.__proxy__proxyName;return t(n?ht(e):e,r)});return Et(e,r)},ft=function(e,t={}){const r=ht(e);return Object.entries(t).forEach(([e,t])=>{r[e]=t}),r},mt=function(e,t=!1){const r=dt(e);if(void 0!==r)return r;if(!0===t)return ht(e);const n=C(Array),o=C(Object);var s;return!1===n(s=e)&&!0===o(s)?d(B,R,re)(e):re(e)},Tt=new WeakMap;class At{constructor(e,t,r,n,o,s){const i=e;s&&console.time(s);const a={channelName:e,action:t,srcElement:n,event:o};if(a.payload=At.deepFreeze(r),!0===ct.debug){if(Object.prototype.hasOwnProperty.call(r,"payload")){const e=JSON.stringify(r);console.warn(`Spyne Warning: the following payload contains a nested payload property which may create conflicts: Action: ${t}, ${e}`)}const e=ct.getChannelActions(i);At.validateAction(t,i,e)}a.clone=()=>oe([{payload:mt(a.payload)},a.payload,{channel:re(i)},{event:re(o)},{srcElement:n},re(a.srcElement),{action:re(a.action)}]),a.safeClone=()=>{const e=ht(a.payload);return oe([{payload:e},e,{channel:i},{event:o},{srcElement:n},a.srcElement,{action:a.action}])};const c={$dir:{get:()=>a._dir,set:e=>(a._dir=e,e)}};return"CHANNEL_ROUTE"===i&&(c.location={get:()=>At.getLocationData()}),a._dir=void 0,Object.defineProperties(a,c),s&&console.timeEnd(s),a}static validateAction(e,t,r){const n=X(e,r);return!1===n&&!0===ct.initialized&&console.warn(`warning: Action: '${e}' is not registered within the ${t} channel!`),n}static getLocationData(){return Z(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}static getStreamItem(){}static deepClone(e){const t=C(Array),r=C(Object);var n;return!1===t(n=e)&&!0===r(n)?d(B,R,re)(e):re(e)}static createReadOnlyProxyFacade(e){if(Tt.has(e))return Tt.get(e);const t=e=>(!0===ct.debug&&console.warn(`Spyne Warning: blocked write of '${String(e)}' on read-only channel payload data; use e.safeClone() for a writable copy`),!0),r=new Proxy(e,{get(e,t){const r=e[t];return null!==r&&"object"==typeof r&&!0===r.__proxy__isProxy?At.createReadOnlyProxyFacade(r):r},set:(e,r)=>t(r),defineProperty:(e,r)=>t(r),deleteProperty:(e,r)=>t(r)});return Tt.set(e,r),r}static deepFreeze(e){const t=d(se(0),k(-1),v("nodeType"));if(null!==e&&"object"==typeof e&&!0===e.__proxy__isProxy)return At.createReadOnlyProxyFacade(e);try{Object.getOwnPropertyNames(e).forEach(function(r){const n=e[r];if(Object.prototype.hasOwnProperty.call(e,r)&&!1===t(n)&&null!==n&&("object"==typeof n||"function"==typeof n)&&!Object.isFrozen(n)){const t=At.deepFreeze(n);t!==n&&(e[r]=t)}}),Object.freeze(e)}catch(t){return e}return e}static getMouseEventKeys(){return["altKey","bubbles","cancelBubble","cancelable","clientX","clientY","composed","ctrlKey","currentTarget","defaultPrevented","detail","eventPhase","fromElement","isTrusted","layerX","layerY","metaKey","movementX","movementY","offsetX","offsetY","pageX","pageY","path","relatedTarget","returnValue","screenX","screenY","shiftKey","sourceCapabilities","srcElement","target","timeStamp","toElement","type","view","which","x","y"]}}function yt(){return{createpropsMap:function(){const e=new WeakMap,t={vsid:this.props.vsid};return e.set(t,this.props),{key:t,weakMap:e}},gc:function(){for(const e in this)delete this[e]},createId:function(){return Math.random().toString(36).replace(/\d/gm,"").substring(1,8)},setTraceFunc:function(e){return!0===e?console.log:()=>{}}}}const Ct=async(e,t)=>{window.setTimeout(async()=>{var t;await(t=1,new Promise(e=>setTimeout(e,t))),window.requestAnimationFrame(e)},t)},gt=e=>{if(void 0!==e.constructor.name)return e.constructor.name;const t=e.toString();return k(String(t).substr(0,12),ie(/^(function\s)(\w+)(\(.*)$/,t)[2])},vt=e=>{const t=d(h(E),p,N),r=d(h(_),p,N);return f([t,r])(e)};const bt=(...e)=>{!0!==("undefined"!=typeof window&&!0===window.SPYNE_SUPPRESS_WARNINGS)&&console.warn(...e)},It=(e=!0)=>{"undefined"!=typeof window&&(window.SPYNE_SUPPRESS_WARNINGS=!0===e)};let St,Lt=!1,Ot=!1;const Dt=/^(?:(?:https?|mailto|tel):|data:image\/|(?![a-z][a-z0-9+.-]*:)[\s\S]*$)/i,Rt=e=>String(e).replace(/[\u0000-\u0020]/g,""),wt=e=>Dt.test(Rt(e)),Ht=/^spyne-[a-z][a-z0-9-]*$/i,Pt=[],Vt=(e=[])=>{(Array.isArray(e)?e:[e]).forEach(e=>{if(e instanceof RegExp)return void Pt.push(e);const t=String(e).toLowerCase();!0===/^[a-z][a-z0-9]*-[a-z0-9-]+$/.test(t)?Pt.push(t):bt(`SPYNE WARNING: "${e}" is not a valid custom element name (a hyphen is required) and was not added to the sanitizer allowlist.`)})},Ut={tagNameCheck:e=>!!Ht.test(e)||Pt.some(t=>t instanceof RegExp?t.test(e):t===e),attributeNameCheck:/^data-[a-z0-9-]+$/i,allowCustomizedBuiltInElements:!1},xt={ALLOWED_TAGS:["a","b","i","em","strong","u","p","br","ul","dl","dt","dd","ol","li","hr","blockquote","pre","code","span","div","section","article","aside","header","footer","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th","img","figure","figcaption","video","source","iframe","input","button","label","link"],ADD_TAGS:["iframe","input","button","link"],ALLOWED_ATTR:["href","src","alt","class","title","width","height","style","target","rel","controls","poster","type","rows","cols","sandbox"],ALLOW_DATA_ATTR:!0,FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","onchange"],FORBID_TAGS:["script","object","embed","meta"],ALLOWED_URI_REGEXP:Dt,CUSTOM_ELEMENT_HANDLING:Ut},Mt={FORBID_TAGS:["script","iframe","object","embed","form","input","button","link","meta"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","onchange"],ALLOW_DATA_ATTR:!1,ALLOWED_URI_REGEXP:Dt,CUSTOM_ELEMENT_HANDLING:Ut};let Wt={allow:void 0,allowedOrigins:[],sandbox:"allow-scripts allow-same-origin allow-popups"},Ft=Wt;const $t=e=>e?{allow:void 0!==e.allow?e.allow:Wt.allow,allowedOrigins:void 0!==e.allowedOrigins?e.allowedOrigins:Wt.allowedOrigins,sandbox:void 0!==e.sandbox?e.sandbox:Wt.sandbox}:Wt,kt=(e,t=Ft)=>{const r=Rt(e);let n;try{n=new URL(r,window.location.href)}catch(e){return!1}if(n.origin===window.location.origin&&"null"!==n.origin)return!0;var o;if(!0!==("https:"===n.protocol||"http:"===n.protocol&&("localhost"===(o=n.hostname)||"127.0.0.1"===o||"[::1]"===o||o.endsWith(".localhost"))))return!1;const s=t.allowedOrigins;return!Array.isArray(s)||0===s.length||s.some(e=>{try{return new URL(e).origin===n.origin}catch(e){return!1}})};let jt=!1;const Gt=["_self","_parent","_top"];let zt={allowTarget:!0,addNoopener:!0,allowedDomains:[]},Bt=zt;const Yt=e=>e?{allowTarget:void 0!==e.allowTarget?!0===e.allowTarget:zt.allowTarget,addNoopener:void 0!==e.addNoopener?!0===e.addNoopener:zt.addNoopener,allowedDomains:void 0!==e.allowedDomains?e.allowedDomains:zt.allowedDomains}:zt,Kt=(e,t=Bt)=>{const r=Rt(e);if(/^(mailto|tel):/i.test(r))return!0;let n;try{n=new URL(r,window.location.href)}catch(e){return!1}if(n.origin===window.location.origin&&"null"!==n.origin)return!0;if(!0!==/^https?:$/.test(n.protocol))return!1;const o=t.allowedDomains;return!Array.isArray(o)||0===o.length||o.some(e=>{try{return new URL(e).origin===n.origin}catch(e){return!1}})},qt=e=>{const t=e.getAttribute("rel")||"",r=new Set(t.split(/\s+/).filter(Boolean));r.add("noopener"),r.add("noreferrer"),e.setAttribute("rel",Array.from(r).join(" "))};let Qt=!1;const Xt=["richtext","authoring","development"],Jt=()=>{const e=ct?.mode;if(Xt.includes(e))return"richtext";if("app"===e)return"app";try{if("undefined"!=typeof process&&"development"===process?.env?.NODE_ENV)return"richtext"}catch(e){}return"app"},Zt=e=>{const t="richtext"===e?xt:Mt,r=((e,t=Ft)=>void 0===t.allow?"richtext"===e:!0===t.allow)(e);if("richtext"===e&&!0!==r)return{...t,ALLOWED_TAGS:t.ALLOWED_TAGS.filter(e=>"iframe"!==e),ADD_TAGS:t.ADD_TAGS.filter(e=>"iframe"!==e),FORBID_TAGS:[...t.FORBID_TAGS,"iframe"]};if("app"===e){const e={...t},n=[];return!0===r&&(e.FORBID_TAGS=t.FORBID_TAGS.filter(e=>"iframe"!==e),e.ADD_TAGS=["iframe"],n.push("sandbox")),!0===Bt.allowTarget&&n.push("target","rel"),n.length>0&&(e.ADD_ATTR=n),e}return t};function er(e="app"){const t=Zt(e);return e=>Me.sanitize(e,t)}const tr=(e={})=>{if(Lt)return void bt("sanitizeData is already configured. Reconfiguration is not allowed.");const{strict:t=!1,disableSanitize:r=!1,iframes:n,customElements:o,anchors:s,allowTargetAttr:i,addNoopener:a}=e;Ot=!0===r,void 0!==o&&Vt(o),n&&"object"==typeof n&&(Wt=$t(n),Ft=Wt),zt=Yt({allowTarget:void 0!==s?.allowTarget?s.allowTarget:i,addNoopener:void 0!==s?.addNoopener?s.addNoopener:a,allowedDomains:s?.allowedDomains}),Bt=zt,Ot?console.warn("SPYNE SECURITY WARNING: All data sanitization is DISABLED via config.disableSanitize. Do not use this setting in production."):(jt||(jt=!0,Me.addHook("afterSanitizeAttributes",e=>{if(!e||"IFRAME"!==e.tagName)return;const t=e.getAttribute("src")||"";""!==t&&!0!==kt(t)&&(bt(`SPYNE WARNING: iframe src "${t}" was removed by the iframe policy (same-origin, https, or an allowed origin is required).`),e.removeAttribute("src"));const{sandbox:r}=Ft;!1!==r&&!0!==e.hasAttribute("sandbox")&&e.setAttribute("sandbox",r)})),Qt||(Qt=!0,Me.addHook("afterSanitizeAttributes",e=>{if(!e||"function"!=typeof e.getAttribute)return;if("A"!==e.tagName)return;const t=Bt,r=e.getAttribute("href");r&&t.allowedDomains.length>0&&!0!==Kt(r,t)&&(bt(`SPYNE WARNING: anchor href "${r}" was removed by the anchor policy (same-origin or an allowed domain is required).`),e.removeAttribute("href"));const n=e.getAttribute("target");n&&(!0===t.allowTarget&&e.getAttribute("href")?!0!==Gt.includes(n)&&!0===t.addNoopener&&qt(e):e.removeAttribute("target"))})));const c=e=>{const t=er(e),r=e=>{if(Array.isArray(e))return e.map(r);if(e&&"object"==typeof e){const n={};for(const[o,s]of Object.entries(e))n[o]="string"==typeof s?t(s):r(s);return n}return"string"==typeof e?t(e):e};return r};St=(e,r={})=>{const{disableSanitize:n=!1,mode:o,iframes:s,anchors:i}=r;if(Ot||n)return e;const a=o||(t?"app":Jt());Ft=$t(s),Bt=Yt(i);try{return c(a)(e)}finally{Ft=Wt,Bt=zt}},tr.sanitizeDataForce=(e,t)=>{if(Ot)return e;const r=t||Jt();return c(r)(e)},Lt=!0},rr=(e,t={})=>{if(!Lt)throw new Error("sanitizeData is not configured. Call sanitizeDataConfigure() first.");return St(e,t)},nr=["href","src","action","formaction","ping","poster","cite","codebase","manifest","icon","background"],or=(e,t)=>{if(!e||Ot)return;const r=er(t||Jt()),n=/<(?:script|object|embed|form|input|button|link|meta)[^>]*>|on\w+=|javascript:/i;if("string"==typeof e.value&&n.test(e.value)){const t=r(e.value);t!==e.value&&(e.value=t)}if(e.isContentEditable&&"string"==typeof e.innerHTML&&n.test(e.innerHTML)){const t=r(e.innerHTML);t!==e.innerHTML&&(e.innerHTML=t)}};let sr,ir=!1;const ar=e=>{if(!ir)throw new Error("sanitizeHTML is not configured. Call sanitizeHTMLConfigure() with appropriate config.");return sr(e)};class cr{constructor(e,t={},r={}){if(this.template=this.formatTemplate(e),this.isProxyData=!0===t.__cms__isProxy,this.testMode=r?.testMode,!1===this.isProxyData&&!0===ct.enableCMSProxies){const e=ct.rehydrateCmsData?.(t);void 0!==e?(t=e,this.isProxyData=!0):!0===cr.templateBindsProxiedChild(t,this.template)?this.isProxyData=!0:!0===ct.debug&&ct.warnUnproxiedCmsData?.(t,this.template)}if(this.template=cr.normalizeTripleBrackets(this.template),!0===this.isProxyData){const e=!0===ct.enableCMSProxies?ct.formatTemplateForProxyData:cr.formatTemplateForProxyData;"function"==typeof e&&(this.template=e(this.template))}(()=>{!0===C(Array,t)&&(t={spyneData:t},this.template=this.template.replace("{{/}}","{{/spyneData}}"),this.template=this.template.replace("{{#}}","{{#spyneData}}"))})(),this.templateData=t,this.currentOuterLoopData=null;const n=cr.getStringArray(this.template);let o=this.template.match(cr.findTmplLoopsRE());o=null===o?[]:o;const s=cr.parseTmplLoopsRE(),i=this.parseTheTmplLoop.bind(this),a=X(I,o),c=w(a,e=>e.replace(s,i),this.addParams.bind(this));this.finalArr=n.map(c)}static isPrimitiveTag(e){return/({{\.\*?}})/.test(e)}static templateBindsProxiedChild(e,t){if(null===e||"object"!=typeof e||"string"!=typeof t)return!1;if(-1===t.indexOf("{{"))return!1;const r=Object.keys(e);for(let n=0;n<r.length;n++){const o=r[n],s=e[o];if(null!==s&&"object"==typeof s&&!0===s.__cms__isProxy&&(-1!==t.indexOf(`{{${o}.`)||-1!==t.indexOf(`{{#${o}}}`)||-1!==t.indexOf(`{{#${o}.`)))return!0}return!1}static hasProxiedChild(e){if(null===e||"object"!=typeof e)return!1;const t=Object.values(e);for(let e=0;e<t.length;e++){const r=t[e];if(null!==r&&"object"==typeof r&&!0===r.__cms__isProxy)return!0}return!1}static normalizeTripleBrackets(e){return"string"!=typeof e||-1===e.indexOf("{{{")?e:e.replace(/\{\{\{([^{}]+?)\}\}\}/g,"{{$1}}")}static getNestedDataReducer(e={},t=""){return/(\.)/gm.test(String(t))?String(t).split(".").reduce((e,t)=>e[t]?e[t]:"string"==typeof e?e:"",e):e[t]??""}static getStringArray(e){const t=e.split(cr.findTmplLoopsRE()),r=/^([\\n\s\W]+)$/,n=t.filter((e,t)=>!(t>=2&&(t-2)%3==0));return m(e=>e.match(r),n)}static findTmplLoopsRE(){return/({{#([\w.]+)}}[\w\n\s\W]+?{{\/\2}})/gm}static parseTmplLoopsRE(){return/({{#([\w.]+)}})([\w\n\s\W]+?)({{\/\2}})/gm}static innerLoopRE(){return/({{#([\w.]+)}})([\w\n\s\W]+?)({{\/\2}})/gm}static swapParamsForTagsRE(){return/({{)(.*?)(}})/gm}static hasLoop(e){return cr.innerLoopRE().test(e)}removeThis(){void 0!==this&&(this.finalArr=void 0,this.templateData=void 0,this.template=void 0)}static stripInertCmsItems(e){if(-1===e.indexOf('data-cms-id=""'))return e;return e.replace(/<spyne-cms-item data-cms-id=""[^>]*>[\s\S]*?<spyne-cms-item-text>([\s\S]*?)<\/spyne-cms-item-text>\s*<\/spyne-cms-item>/g,"$1")}renderDocFrag(){let e=cr.replaceImgPath(this.finalArr.join(""));!0===this.isProxyData&&(e=cr.stripInertCmsItems(e)),!0!==this.testMode&&(e=ar(e));const t=/^([^>]*?)(<){1}(\b)(thead|col|colgroup|tbody|td|tfoot|tr|th)(\b)([^\0]*)$/.test(e)?e:document.createRange().createContextualFragment(e);return window.setTimeout(this.removeThis,2),t}renderToString(){let e=this.finalArr.join("");return e=cr.replaceImgPath(e),!0===this.isProxyData&&(e=cr.stripInertCmsItems(e)),!0!==this.testMode&&(e=String(ar(e))),window.setTimeout(this.removeThis,2),e}getTemplateString(){return this.finalArr.join("")}formatTemplate(e){return!0===["SCRIPT","TEMPLATE"].includes(v("nodeName",e))?e.innerHTML:e}getDataValFromPathStr(e,t){const r=String(e).split(".");return K(r,t)||""}addParams(e){return e.replace(cr.swapParamsForTagsRE(),(e,t,r,n)=>cr.getNestedDataReducer(this.templateData,r))}static replaceImgPath(e){const{IMG_PATH:t}=ct;return void 0!==t?(e=e.replaceAll(/src\s*=\s*(['"])imgs\//g,`src=$1${t}`)).replaceAll(/url\(\s*(['"]?)imgs\//g,`url($1${t}`):e}processInnerLoop(e,t){const r=cr.innerLoopRE();return e.replace(r,(e,r,n,o)=>{!0===cr.hasLoop(o)&&(!0===ct.debug&&!0!==this.testMode&&console.warn(`Spyne Warning: DomElementTemplate supports one level of nested array loops. A deeper nested loop was detected inside "{{#${n}}}". Consider restructuring via nested ViewStreams instead.`),o=o.replace(/{{[#/][\w.]+}}/g,""));const s=cr.getNestedDataReducer(t,n);if(!0===_(s)||E(s))return"";const i=Array.isArray(s)?s:[s],a=this.currentOuterLoopData;this.currentOuterLoopData=s;const c=i.map((e,t)=>this.substituteForItem(o,e,t)).join("");return this.currentOuterLoopData=a,c})}substituteForItem(e,t,r){if("string"==typeof t){if(cr.isPrimitiveTag(e)){const r=t.replace(/\$/g,"$$$$");return e.replace(cr.swapParamsForTagsRE(),r)}const n=this.buildStringItemContext(t,r);return this.substituteObject(e,n)}const n=this.buildItemContext(t,r);return this.substituteObject(e,n)}buildStringItemContext(e,t){const r={spyneLoopKey:e,loopIndex:t,loopNum:t+1};if(!0===this.isProxyData){const t=this.currentOuterLoopData;if(t&&"object"==typeof t){r.__cms__dataId=t.__cms__dataId||"";const n=`__cms__keyFor_${e}`;r.origKey=void 0!==t[n]?t[n]:""}else r.__cms__dataId="",r.origKey=""}return r}buildItemContext(e,t){const r=Object.assign({},e,{loopIndex:t,loopNum:t+1});return!0===this.isProxyData&&(r.__cms__dataId=e.__cms__dataId,r.spyneLoopKey=e,r.loopIndex=t,r.loopNum=t+1),r}substituteObject(e,t){const r=/(\.)/gm,n={loopIndex:t.loopIndex,loopNum:t.loopNum};return e.replace(cr.swapParamsForTagsRE(),(e,o,s)=>void 0!==n[s]?n[s]:!1===r.test(s)&&void 0!==t[s]?t[s]:this.getDataValFromPathStr(s,t))}parseTheTmplLoop(e,t,r,n){const o=n,s=cr.getNestedDataReducer(this.templateData,r);if(!0===_(s)||E(s))return"";const i=this.currentOuterLoopData;this.currentOuterLoopData=s;const a=Array.isArray(s)?s:[s],c=cr.hasLoop(o),l=a.map((e,t)=>{const r=c?this.processInnerLoop(o,e):o;return this.substituteForItem(r,e,t)}).join("");return this.currentOuterLoopData=i,l}}class lr{constructor(e={},t=!1){var r,n;e.tagName=(r="div",n=e.tagName,k(r)(n)),e.attributes=void 0!==e.attributes?e.attributes:this.getDomAttributes(e),e.attrs=this.updateAttrs(e.attributes),e.fragment=document.createDocumentFragment(),this.testMode=t,this.props=e,this.addMixins()}setProp(e,t){this.props[e]=t}getProp(e){return this.props[e]}get el(){return this.props.el}setElAttrs(e,t){const r=!0===this.testMode;return this.getProp("attrs").forEach((t,n)=>{const o=(t,r)=>{e.dataset[r]=t};if("dataset"!==n){if(!0!==r){const{allowed:r,value:o}=((e,t,r)=>{if(Ot)return{allowed:!0,value:t};const n=String(e).toLowerCase(),o=String(r||"").toUpperCase();if(n.startsWith("on"))return{allowed:!1,value:t};if("srcdoc"===n){const e=Zt(Jt());return{allowed:!0,value:Me.sanitize(String(t),e)}}return"IFRAME"===o&&"src"===n?{allowed:kt(t,Wt),value:t}:"A"===o&&"href"===n?!0!==wt(t)||zt.allowedDomains.length>0&&!0!==Kt(t,zt)?{allowed:!1,value:t}:{allowed:!0,value:t}:nr.includes(n)&&!0!==wt(t)?{allowed:!1,value:t}:{allowed:!0,value:t}})(n,t,e.tagName);if(!0!==r)return void bt(`SPYNE WARNING: The attribute "${n}" was removed during sanitization.`,e);t=o}e.setAttribute(n,t)}else ue(o,t)}),!0!==r&&(e=>{if(Ot||!e)return e;if("IFRAME"===e.tagName){const{sandbox:t}=Wt;!1!==t&&!0!==e.hasAttribute("sandbox")&&e.setAttribute("sandbox",t)}if("A"===e.tagName){const t=zt,r=e.getAttribute("target");r&&(!0===t.allowTarget&&e.getAttribute("href")?!0!==Gt.includes(r)&&!0===t.addNoopener&&qt(e):e.removeAttribute("target"))}})(e),e}updateAttrs(e,t){const r=void 0!==t?t:new Map;return ce((e,t)=>r.set(t,e),e),r}addTemplate(e){const t=this.getProp("template");return void 0!==t?(t=>{let r=this.getProp("data");r=C(Object,r)?r:{};const n=new cr(t,r,{testMode:this?.testMode}).renderDocFrag();return C(String,n)?e.innerHTML=n:e.appendChild(n),e})(t):e}createElement(e="div"){return document.createElement(e)}addContent(e){const t=this.getProp("data");if(!0===C(String,t)){const r=document.createTextNode(t);e.appendChild(r)}return e}execute(){const e=le(this.createElement.bind(this),this.setElAttrs.bind(this),this.addTemplate.bind(this),this.addContent.bind(this))(this.getProp("tagName"));this.props.el=e}render(){return this.execute(),this.props.template=void 0,this.props.data=void 0,this.props.attributes=void 0,this.getProp("el")}renderToHTMLString(){return this.execute(),this.props.template=void 0,this.props.data=void 0,this.props.attributes=void 0,this.getProp("el").outerHTML}returnIfDefined(e,t){if(void 0!==t){const r=void 0===t;e[t]=!1===r?t:Ye(e[t],t)}}updateprops(e){return this.returnIfDefined(this.props,e),this}updatepropsAndRun(e){return this.updateprops(e),this.execute(),this.getProp("fragment")}unmount(){void 0!==this.props&&(this.getProp("el").remove(),this.props=void 0,this.gc())}updateTag(e="div"){this.updateprops(e)}updateAttributes(e={}){this.updateprops(e)}updateTemplate(e){this.updateprops(e)}updateData(e={}){this.updateprops(e)}addTagAndRender(e="div"){this.updatepropsAndRun(e)}addAttrsibutesAndRender(e={}){this.updatepropsAndRun(e)}addTemplateAndRender(e){this.updatepropsAndRun(e)}addDataAndRender(e={}){this.updatepropsAndRun(e)}addMixins(){const e=yt();this.gc=e.gc.bind(this)}getDomAttributes(e){return ee(this.attributesArray,e)}get attributesArray(){return["accept","accept-charset","accesskey","action","align","allow","alt","async","autocapitalize","autocomplete","autofocus","autoplay","bgcolor","border","buffered","challenge","charset","checked","cite","class","code","codebase","color","cols","colspan","content","contenteditable","contextmenu","controls","coords","crossorigin","csp","dataset","datetime","decoding","default","defer","dir","dirname","disabled","download","draggable","dropzone","enctype","for","form","formaction","headers","height","hidden","high","href","hreflang","http-equiv","icon","id","importance","integrity","ismap","itemprop","keytype","kind","label","lang","language","lazyload","list","loop","low","manifest","max","maxlength","minlength","media","method","min","multiple","muted","name","novalidate","open","optimum","pattern","ping","placeholder","poster","preload","radiogroup","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","sandbox","scope","scoped","selected","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","summary","tabindex","target","title","translate","type","usemap","value","width","wrap"]}}const ur=(e=!1,t=1,r="ease",n=!1)=>`${!0===n?"opacity:0;":""}transition: opacity ${t}s ${r}; opacity: ${!0===e?1:0};`;function dr(e){return"function"==typeof e}function hr(e){return function(t){if(function(e){return dr(null==e?void 0:e.lift)}(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw new TypeError("Unable to lift unknown Observable type")}}var Er=function(e,t){return Er=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Er(e,t)};function pr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Er(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function Nr(e,t,r,n){return new(r||(r=Promise))(function(o,s){function i(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,a)}c((n=n.apply(e,t||[])).next())})}function _r(e,t){var r,n,o,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function fr(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function mr(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function Tr(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function Ar(e){return this instanceof Ar?(this.v=e,this):new Ar(e)}function yr(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),s=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),i("next"),i("throw"),i("return",function(e){return function(t){return Promise.resolve(t).then(e,l)}}),n[Symbol.asyncIterator]=function(){return this},n;function i(e,t){o[e]&&(n[e]=function(t){return new Promise(function(r,n){s.push([e,t,r,n])>1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{(r=o[e](t)).value instanceof Ar?Promise.resolve(r.value.v).then(c,l):u(s[0][2],r)}catch(e){u(s[0][3],e)}var r}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Cr(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=fr(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,o){(function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)})(n,o,(t=e[r](t)).done,t.value)})}}}"function"==typeof SuppressedError&&SuppressedError;var gr=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function vr(e){return dr(null==e?void 0:e.then)}function br(e){var t=e(function(e){Error.call(e),e.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Ir=br(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function Sr(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Lr=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=fr(s),a=i.next();!a.done;a=i.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else s.remove(this);var c=this.initialTeardown;if(dr(c))try{c()}catch(e){o=e instanceof Ir?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var u=fr(l),d=u.next();!d.done;d=u.next()){var h=d.value;try{Rr(h)}catch(e){o=null!=o?o:[],e instanceof Ir?o=Tr(Tr([],mr(o)),mr(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}}if(o)throw new Ir(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Rr(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Sr(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&Sr(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),Or=Lr.EMPTY;function Dr(e){return e instanceof Lr||e&&"closed"in e&&dr(e.remove)&&dr(e.add)&&dr(e.unsubscribe)}function Rr(e){dr(e)?e():e.unsubscribe()}var wr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Hr={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Hr.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,Tr([e,t],mr(r))):setTimeout.apply(void 0,Tr([e,t],mr(r)))},clearTimeout:function(e){var t=Hr.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Pr(e){Hr.setTimeout(function(){throw e})}function Vr(){}var Ur=xr("C",void 0,void 0);function xr(e,t,r){return{kind:e,value:t,error:r}}function Mr(e){e()}var Wr=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,Dr(t)&&t.add(r)):r.destination=Br,r}return pr(t,e),t.create=function(e,t,r){return new jr(e,t,r)},t.prototype.next=function(e){this.isStopped?zr(function(e){return xr("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?zr(xr("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?zr(Ur,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Lr),Fr=Function.prototype.bind;function $r(e,t){return Fr.call(e,t)}var kr=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){Gr(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Gr(e)}else Gr(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Gr(e)}},e}(),jr=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;dr(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&wr.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&$r(t.next,s),error:t.error&&$r(t.error,s),complete:t.complete&&$r(t.complete,s)}):o=t;return i.destination=new kr(o),i}return pr(t,e),t}(Wr);function Gr(e){Pr(e)}function zr(e,t){var r=wr.onStoppedNotification;r&&Hr.setTimeout(function(){return r(e,t)})}var Br={closed:!0,next:Vr,error:function(e){throw e},complete:Vr},Yr="function"==typeof Symbol&&Symbol.observable||"@@observable";function Kr(e){return e}function qr(e){return 0===e.length?Kr:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var Qr=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,s=(n=e)&&n instanceof Wr||function(e){return e&&dr(e.next)&&dr(e.error)&&dr(e.complete)}(n)&&Dr(n)?e:new jr(e,t,r);return Mr(function(){var e=o,t=e.operator,r=e.source;s.add(t?t.call(s,r):r?o._subscribe(s):o._trySubscribe(s))}),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=Xr(t))(function(t,n){var o=new jr({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[Yr]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return qr(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Xr(e))(function(e,r){var n;t.subscribe(function(e){return n=e},function(e){return r(e)},function(){return e(n)})})},e.create=function(t){return new e(t)},e}();function Xr(e){var t;return null!==(t=null!=e?e:wr.Promise)&&void 0!==t?t:Promise}function Jr(e){return dr(e[Yr])}function Zr(e){return Symbol.asyncIterator&&dr(null==e?void 0:e[Symbol.asyncIterator])}function en(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var tn="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function rn(e){return dr(null==e?void 0:e[tn])}function nn(e){return yr(this,arguments,function(){var t,r,n;return _r(this,function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,Ar(t.read())];case 3:return r=o.sent(),n=r.value,r.done?[4,Ar(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,Ar(n)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function on(e){return dr(null==e?void 0:e.getReader)}function sn(e){if(e instanceof Qr)return e;if(null!=e){if(Jr(e))return o=e,new Qr(function(e){var t=o[Yr]();if(dr(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(gr(e))return n=e,new Qr(function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()});if(vr(e))return r=e,new Qr(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,Pr)});if(Zr(e))return an(e);if(rn(e))return t=e,new Qr(function(e){var r,n;try{for(var o=fr(t),s=o.next();!s.done;s=o.next()){var i=s.value;if(e.next(i),e.closed)return}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}e.complete()});if(on(e))return an(nn(e))}var t,r,n,o;throw en(e)}function an(e){return new Qr(function(t){(function(e,t){var r,n,o,s;return Nr(this,void 0,void 0,function(){var i,a;return _r(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Cr(e),c.label=1;case 1:return[4,r.next()];case 2:if((n=c.sent()).done)return[3,4];if(i=n.value,t.next(i),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function cn(e,t,r,n,o){return new ln(e,t,r,n,o)}var ln=function(e){function t(t,r,n,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return pr(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(Wr),un=function(e){function t(t,r){return e.call(this)||this}return pr(t,e),t.prototype.schedule=function(e,t){return this},t}(Lr),dn={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=dn.delegate;return(null==o?void 0:o.setInterval)?o.setInterval.apply(o,Tr([e,t],mr(r))):setInterval.apply(void 0,Tr([e,t],mr(r)))},clearInterval:function(e){var t=dn.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},hn=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return pr(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,o=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(o,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),dn.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&dn.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Sr(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(un),En={now:function(){return(En.delegate||Date).now()},delegate:void 0},pn=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=En.now,e}(),Nn=new(function(e){function t(t,r){void 0===r&&(r=pn.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return pr(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(pn))(hn),_n=Nn;function fn(e,t,r){void 0===e&&(e=0),void 0===r&&(r=_n);var n,o=-1;return null!=t&&((n=t)&&dr(n.schedule)?r=t:o=t),new Qr(function(t){var n=function(e){return e instanceof Date&&!isNaN(e)}(e)?+e-r.now():e;n<0&&(n=0);var s=0;return r.schedule(function(){t.closed||(t.next(s++),0<=o?this.schedule(void 0,o):t.complete())},n)})}function mn(e,t,r,n,o){void 0===n&&(n=0),void 0===o&&(o=!1);var s=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(s),!o)return s}function Tn(e){return hr(function(t,r){var n,o=null,s=!1;o=t.subscribe(cn(r,void 0,void 0,function(i){n=sn(e(i,Tn(e)(t))),o?(o.unsubscribe(),o=null,n.subscribe(r)):s=!0})),s&&(o.unsubscribe(),o=null,n.subscribe(r))})}function An(e,t){return void 0===t&&(t=0),hr(function(r,n){r.subscribe(cn(n,function(r){return mn(n,e,function(){return n.next(r)},t)},function(){return mn(n,e,function(){return n.complete()},t)},function(r){return mn(n,e,function(){return n.error(r)},t)}))})}function yn(e,t){return void 0===t&&(t=0),hr(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function Cn(e,t){if(!e)throw new Error("Iterable cannot be null");return new Qr(function(r){mn(r,t,function(){var n=e[Symbol.asyncIterator]();mn(r,t,function(){n.next().then(function(e){e.done?r.complete():r.next(e.value)})},0,!0)})})}function gn(e,t){if(null!=e){if(Jr(e))return function(e,t){return sn(e).pipe(yn(t),An(t))}(e,t);if(gr(e))return function(e,t){return new Qr(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}(e,t);if(vr(e))return function(e,t){return sn(e).pipe(yn(t),An(t))}(e,t);if(Zr(e))return Cn(e,t);if(rn(e))return function(e,t){return new Qr(function(r){var n;return mn(r,t,function(){n=e[tn](),mn(r,t,function(){var e,t,o;try{t=(e=n.next()).value,o=e.done}catch(e){return void r.error(e)}o?r.complete():r.next(t)},0,!0)}),function(){return dr(null==n?void 0:n.return)&&n.return()}})}(e,t);if(on(e))return function(e,t){return Cn(nn(e),t)}(e,t)}throw en(e)}function vn(e,t){return hr(function(r,n){var o=0;r.subscribe(cn(n,function(r){n.next(e.call(t,r,o++))}))})}var bn=Array.isArray;function In(e){return vn(function(t){return function(e,t){return bn(t)?e.apply(void 0,Tr([],mr(t))):e(t)}(e,t)})}function Sn(e,t,r){return void 0===r&&(r=Kr),function(n){Ln(t,function(){for(var o=e.length,s=new Array(o),i=o,a=o,c=function(o){Ln(t,function(){var c=function(e,t){return t?gn(e,t):sn(e)}(e[o],t),l=!1;c.subscribe(cn(n,function(e){s[o]=e,l||(l=!0,a--),a||n.next(r(s.slice()))},function(){--i||n.complete()}))},n)},l=0;l<o;l++)c(l)},n)}}function Ln(e,t,r){e?mn(r,e,t):t()}function On(e,t,r){return void 0===r&&(r=1/0),dr(t)?On(function(r,n){return vn(function(e,o){return t(r,e,n,o)})(sn(e(r,n)))},r):("number"==typeof t&&(r=t),hr(function(t,n){return function(e,t,r,n,o,s,i,a){var c=[],l=0,u=0,d=!1,h=function(){!d||c.length||l||t.complete()},E=function(e){return l<n?p(e):c.push(e)},p=function(e){s&&t.next(e),l++;var a=!1;sn(r(e,u++)).subscribe(cn(t,function(e){null==o||o(e),s?E(e):t.next(e)},function(){a=!0},void 0,function(){if(a)try{l--;for(var e=function(){var e=c.shift();i?mn(t,i,function(){return p(e)}):p(e)};c.length&&l<n;)e();h()}catch(e){t.error(e)}}))};return e.subscribe(cn(t,E,function(){d=!0,h()})),function(){null==a||a()}}(t,n,e,r)}))}var Dn=Array.isArray;function Rn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=function(e){return dr((t=e)[t.length-1])?e.pop():void 0;var t}(e);return r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return qr(e)}(Rn.apply(void 0,Tr([],mr(e))),In(r)):hr(function(t,r){Sn(Tr([t],mr(function(e){return 1===e.length&&Dn(e[0])?e[0]:e}(e))))(r)})}var wn=br(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Hn=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return pr(t,e),t.prototype.lift=function(e){var t=new Pn(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new wn},t.prototype.next=function(e){var t=this;Mr(function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=fr(t.currentObservers),s=o.next();!s.done;s=o.next()){s.value.next(e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var t=this;Mr(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;Mr(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,o=r.isStopped,s=r.observers;return n||o?Or:(this.currentObservers=null,s.push(e),new Lr(function(){t.currentObservers=null,Sr(s,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,o=t.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new Qr;return e.source=this,e},t.create=function(e,t){return new Pn(e,t)},t}(Qr),Pn=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return pr(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:Or},t}(Hn);function Vn(e,t){return void 0===t&&(t=Nn),hr(function(r,n){var o=null,s=null,i=null,a=function(){if(o){o.unsubscribe(),o=null;var e=s;s=null,n.next(e)}};function c(){var r=i+e,s=t.now();if(s<r)return o=this.schedule(void 0,r-s),void n.add(o);a()}r.subscribe(cn(n,function(r){s=r,i=t.now(),o||(o=t.schedule(c,e),n.add(o))},function(){a(),n.complete()},void 0,function(){s=o=null}))})}var Un=new Qr(function(e){return e.complete()});function xn(e){return e<=0?function(){return Un}:hr(function(t,r){var n=0;t.subscribe(cn(r,function(t){++n<=e&&(r.next(t),e<=n&&r.complete())}))})}function Mn(e,t){return hr(function(r,n){var o=0;r.subscribe(cn(n,function(r){return e.call(t,r,o++)&&n.next(r)}))})}function Wn(e){return hr(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}function Fn(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!0!==t){if(!1!==t){var o=new jr({next:function(){o.unsubscribe(),e()}});return sn(t.apply(void 0,Tr([],mr(r)))).subscribe(o)}}else e()}function $n(e,t){return void 0===t&&(t=!1),hr(function(r,n){var o=0;r.subscribe(cn(n,function(r){var s=e(r,o++);(s||t)&&n.next(r),!s&&n.complete()}))})}function kn(e,t,r){var n=dr(e)||t||r?{next:e,error:t,complete:r}:e;return n?hr(function(e,t){var r;null===(r=n.subscribe)||void 0===r||r.call(n);var o=!0;e.subscribe(cn(t,function(e){var r;null===(r=n.next)||void 0===r||r.call(n,e),t.next(e)},function(){var e;o=!1,null===(e=n.complete)||void 0===e||e.call(n),t.complete()},function(e){var r;o=!1,null===(r=n.error)||void 0===r||r.call(n,e),t.error(e)},function(){var e,t;o&&(null===(e=n.unsubscribe)||void 0===e||e.call(n)),null===(t=n.finalize)||void 0===t||t.call(n)}))}):Kr}function jn(e,t,r){void 0===t&&(t=Nn);var n=fn(e,t);return function(e,t){return hr(function(r,n){var o=null!=t?t:{},s=o.leading,i=void 0===s||s,a=o.trailing,c=void 0!==a&&a,l=!1,u=null,d=null,h=!1,E=function(){null==d||d.unsubscribe(),d=null,c&&(_(),h&&n.complete())},p=function(){d=null,h&&n.complete()},N=function(t){return d=sn(e(t)).subscribe(cn(n,E,p))},_=function(){if(l){l=!1;var e=u;u=null,n.next(e),!h&&N(e)}};r.subscribe(cn(n,function(e){l=!0,u=e,(!d||d.closed)&&(i?_():N(e))},function(){h=!0,(!(c&&l&&d)||d.closed)&&n.complete()}))})}(function(){return n},r)}class Gn{constructor(e){this.props.observableStreams=Gn.createDirectionalObservables()}static createDirectionalFiltersObject(){const e="internal",t="parent",r="child";return{P:[t],C:[r],PCI:[t,e,r],CI:[r,e],PI:[t,e],PC:[t,r]}}static addDefaultDir(e){return de(J)({$dir:["internal"]},re(e))}static addDownInternalDir(e,t=["internal","down"]){return de(J)(re(e),{$dir:t})}static addChildAndInternalDir(e,t=["child","down"]){return de(J)(re(e),{$dir:t})}static mapToDefaultDir(e){return this.addDefaultDir(e)}static createDirectionalObservables(e=new r,t,n){void 0!==t&&void 0!==n&&(e.viewName=t,e.vsid=n);const o=e=>he(t=>t.includes(e),"$dir"),s=o("parent"),i=o("child"),a=o("internal"),c=e=>J({from$:e}),l=c("child"),u=c("internal"),d=c("parent"),h=e.pipe(Mn(e=>void 0!==e&&void 0!==e.action)),E=e.pipe(Mn(a),vn(u)),p=e.pipe(Mn(s),vn(l)),N=e.pipe(Mn(i),vn(d)),_={parent:p,internal:E,child:N};return{raw$:h,toInternal$:E,toParent$:p,toChild$:N,completeAll:()=>{Ee(e=>{e.complete(),e.isStopped=!0},[h,E,p,N])},completeStream:(e=[])=>{const t=e=>{if(void 0!==_[e]){(t=_[e]).complete(),t.isStopped=!0}var t};void 0!==e&&e.length>=1&&e.forEach(t)}}}}class zn{constructor(e,t={},n="",o="theName"){this.addMixins(),this._state="INIT",this.vsid=n,this.el=t.el,this.vsName=o,this.defaults={debug:!1,extendedHashMethods:{}},this.options=Ye(this.defaults,t);this.addActionListeners().forEach(e=>{const[t,r]=e;this.options.extendedHashMethods[t]=e=>this[r](e)}),this.options.hashMethods=this.setHashMethods(this.options.extendedHashMethods),this.sink$=e,this.sink$.subscribe(this.onObsSinkSubscribe.bind(this)),this.$dirs=Gn.createDirectionalFiltersObject(),this.addDefaultDir=Gn.addDefaultDir,this.sourceStreams=Gn.createDirectionalObservables(new r,this.vsName,this.vsid),this._source$=this.sourceStreams.toInternal$}addActionListeners(){return[]}setHashMethods(e={}){return Ye({VS_DETRITUS_COLLECT:e=>this.onGarbageCollect(e),READY_FOR_VS_DETRITUS_COLLECT:e=>this.onReadyForGC(e),EXTIRPATE:e=>this.onDispose(e),VS_SPAWN:e=>this.onRender(e),VS_SPAWN_AND_ATTACH_TO_PARENT:e=>this.onRenderAndAttachToParent(e),VS_SPAWN_AND_ATTACH_TO_DOM:e=>this.onRenderAndAttachToDom(e),ATTACH_CHILD_TO_SELF:e=>this.onAttachChildToSelf(e)},e)}createDomItem(){this.props=void 0!==this.props?this.props:{};const e=F(e=>void 0!==e,ee(["id","className"],this.props)),{tagName:t,data:r,template:n}=this.props;return new lr(t,e,r,n)}onDisposeCompleted(e){}animateInTween(e,t){!function(e,t){const r=1*window.getComputedStyle(e).opacity,n=ur(!0,t,"ease",1===r);e.style.cssText+=n}(e,t)}animateOutTween(e,t,r){!function(e,t,r){const n=ur(!1,t,"ease");e.style.cssText+=n,e.addEventListener("transitionend",r,!1)}(e,t,r)}setAnimateIn(e){if(!0===e.animateIn){const t=void 0!==e.el?e.el:this.domItem.el;this.animateInTween(t,e.animateInTime)}}disposeMethod(e){const t=void 0!==e.el.el?e.el.el:e.el,r={action:"READY_FOR_VS_DETRITUS_COLLECT",$dir:this.$dirs.PI,el:t},o=n((e,r)=>{this.animateOutTween(t,e.animateOutTime,r)}),s=e=>{this._source$.next(r)},i=!0===e.animateOut?e=>(o(e).subscribe(s),{action:"EXTIRPATING",$dir:this.$dirs.CI}):()=>({action:"EXTIRPATE_AND_READY_FOR_VS_DETRITUS_COLLECT",$dir:this.$dirs.CI});return i(e)}onDispose(e){return this.disposeMethod(e)}removeStream(){void 0!==this.sourceStreams&&this.sourceStreams.completeStream(["internal","child"])}onReadyForGC(e){this.removeStream()}onGarbageCollect(e){void 0!==this.domItem&&this.domItem.unmount(),void 0!==this.sourceStreams&&this.sourceStreams.completeStream(["parent"])}getSourceStream(){return this._source$}combineDomItems(e){if(void 0!==this.el)return;const t=_(e.query)?e.node:e.query,r=(e,t)=>e.insertBefore(t,e.firstChild);({appendChild:(e,t)=>e.appendChild(t),after:(e,t)=>e.after(t)}[e.attachType]||r)(t,this.domItem.render()),this.setAnimateIn(e)}onAttachChildToSelf(e){const t=e.childRenderData;return this.combineDomItems(t),{action:"CHILD_ATTACHED",$dir:this.$dirs.PI}}onRenderAndAttachToParent(e){return this.onRender(e),this.combineDomItems(e),{action:"VS_SPAWNED_AND_ATTACHED_TO_PARENT",el:this.el||this.domItem.el,$dir:this.$dirs.PI}}renderDomItem(e){const[t,r,n,o]=e;return this.domItem=new lr({tagName:t,attributes:r,data:n,template:o}),this.domItem}onRender(e){return{action:"VS_SPAWNED",el:this.el||(e=>this.renderDomItem(e))(pe(["tagName","domAttributes","data","template"],e)),$dir:this.$dirs.I}}extendedMethods(e){}onRenderAndAttachToDom(e){return e.attachData.el=(e=>this.renderDomItem(e))(pe(["tagName","domAttributes","data","template"],e)),this.combineDomItems(e.attachData),{action:"VS_SPAWNED_AND_ATTACHED_TO_DOM",el:this.el||e.attachData.el.el,$dir:this.$dirs.CI}}onObsSinkSubscribe(e){const t=e.action,r=k(e=>this.extendedMethods(e)),n=r(this.options.hashMethods[t])(e);void 0!==n&&(e=>{this._source$.next(e)})(Object.freeze(n))}addMixins(){}}function Bn(){setTimeout(()=>{Ee(e=>{},this)},1)}class Yn{constructor(e,t,r,n="subscribe",o=!1){const s={name:e,observable:t,data:r,action:n};this.sendToDirectorStream(s)}sendToDirectorStream(e){const t=ct.channelsMap.getStream("DISPATCHER"),r=mt(e);t.next(r),e=void 0}static deepClone(e){const t=C(Array),r=C(Object);var n;return!1===t(n=e)&&!0===r(n)?d(B,R,re)(e):re(e)}static getMouseEventKeys(){return["altKey","bubbles","cancelBubble","cancelable","clientX","clientY","composed","ctrlKey","currentTarget","defaultPrevented","detail","eventPhase","fromElement","isTrusted","layerX","layerY","metaKey","movementX","movementY","offsetX","offsetY","pageX","pageY","path","relatedTarget","returnValue","screenX","screenY","shiftKey","sourceCapabilities","srcElement","target","timeStamp","toElement","type","view","which","x","y"]}addMixins(){this.gc=Bn}}const Kn=!0===ct.debug;class qn{constructor(e,t){this.addMixins(),this.props=e,this.broadcastFn=t,this.broadcaster(this.broadcastFn)}addDblClickEvt(e){return o(e,"dblclick").pipe(vn(e=>{const t=re(e);return t.typeOverRide="dblclick",t}))}broadcast(e){if(e.length<=0&&!0===Kn)return void console.warn(`Spyne Warning: The nested array in ${this.props.name}.broadcastEvents appears to be empty --\x3e vsid:${this.props.vsid}!`);const t={UI:this.sendUIPayload,ROUTE:this.sendRoutePayload},[r,n,s]=e;let i,a=this.props.el.querySelectorAll(r);if(a.length<=0){const e=this.props.el,t=t=>{t===e&&(a=[t])};(()=>{const n=(null!==e.parentElement?e.parentElement:document).querySelectorAll(r);n.forEach=Array.prototype.forEach,n.forEach(t)})()}const c=void 0!==s,l=e=>{const r="dblClick"!==n?o(e,n,{preventDefault:()=>!0}):this.addDblClickEvt(e);i=e.dataset.channel;const s={};s.payload=(e=>{const t={};for(const r in e)t[r]=e[r];return t})(e.dataset),s.payload=Ne(["channel"],s.payload),"ROUTE"===s.channel&&(s.payload.endPreventDefault=!0),s.channel=i,s.srcElement={},s.srcElement.id=this.props.id,s.srcElement.vsid=this.props.vsid,s.srcElement.isLocalEvent=c,s.srcElement.srcEvent=n,s.srcElement.el=e;var a;(0,t[a=i,"ROUTE"===a||"CHANNEL_ROUTE"===a?"ROUTE":("UI"!==a&&"CHANNEL_UI"!==a&&void 0!==a&&console.warn(`SpyneJS warning: The channel, ${a}, is not allowed here, only "UI" or "ROUTE" are valid channels, defaulting to CHANNEL_UI`),"UI")])(r,s)};!0===(void 0===a||a.length<=0)&&!0===Kn?console.warn(`Spyne Warning: The item ${r}, does not appear to exist in ${this.props.name} --\x3e vsid:${this.props.vsid}!`):(a.forEach=Array.prototype.forEach,a.forEach(l))}broadcaster(e){e().forEach(e=>this.broadcast(e))}addMixins(){const e={testFunc:function(e){console.log("stream mixin is ",e)},sendRoutePayload:function(e,t){return new Yn("CHANNEL_ROUTE",e,t,"subscribe")},sendUIPayload:function(e,t){return new Yn("CHANNEL_UI",e,t,"subscribe")}};this.sendUIPayload=e.sendUIPayload,this.sendRoutePayload=e.sendRoutePayload}}const Qn=d(ne,C(Array)),Xn=d(ne,E),Jn=f([C(String),Xn]),Zn=f([C(Array),Xn]),eo=d(f([Qn,C(Object)])),to=d(f([Xn,Qn,C(Object)]));class ro{constructor(e,t={},r,n){eo(e)&&(e=v("selector",t=e),n=n||v("testMode",t));const o=[r,v("debugLabel",t)];r=d(y(C(String)))(o);let s=Ne(["debugLabel","label","selector","props","testMode","propFilters"],t);void 0!==t.props?s=oe([t.props,s]):void 0!==t.propFilters&&(s=oe([t.propFilters,s])),t.propFilters=s;const{propFilters:i}=t,a=Jn(e)?ro.filterSelector([e],r):void 0,c=Zn(e)?ro.filterSelector(e,r):void 0,l=to(i)?ro.filterData(i,r):void 0;let u=m(_,[a,c,l]);const h=E(u);return h&&(u=[H(!1)],!0===ct.debug&&!0!==n&&console.warn(`Spyne Warning: The Channel Filter, with selector: ${e}, and propFilters:${i} appears to be empty!`)),!0===n?{selector:e,propFilters:i,debugLabel:r,filters:t,testMode:n,filtersAreEmpty:h}:f(u)}static filterData(e,t){const r=t;return(()=>{if(E(e))return H(!1);e=D((e,t,r)=>{let n=Te;if((e=>C(String,e))(e)||(e=>C(Boolean,e))(e)||(e=>C(Number,e))(e))o=e,n=e=>e===o;else{if("function"==typeof e)return e;if((e=>C(Array,e))(e)||eo(e))return console.warn(`ChannelPayloadFilter: Property "${e}" is an array/object, which is not allowed. This property will always return false.`),n}var o;return n},e);const t=me(e);return d(t,t=>{if(void 0===r)return t;const n={};return ue((e,r)=>{n[r]=e(v(r,t))},e),console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${r}"] - values: `,"color:orange;",{propsBooleans:n,comparedObj:t}),t},k({}),e=>{const{payload:t,srcElement:r,event:n}=e||{};return Object.assign({},e,r,n,t)})})()}static checkPayloadSelector(e,t,r){const{payload:n,srcElement:o,event:s}=r||{},i=[o,n,v("srcElement",s),r].reduce((e,t)=>{if(void 0!==e)return e;const r=v("el",t);return ro.elIsDomElement(r)&&(e=r),e},void 0),a=null!==i&&"object"==typeof i&&"function"==typeof i.matches,c=a?D(e=>{try{return i.matches(e)}catch(t){return!0===ct.debug&&console.warn(`Spyne Warning: The ChannelPayloadFilter selector, ${e}, is not a valid css selector!`),!1}},e):[];if(void 0!==t){const r=e;console.log(`%c CHANNEL PAYLOAD FILTER DEBUGGER ["${t}"] - selectors: `,"color:orange;",{el:i,selectorsArr:r,nodeArrResultsDebugger:c})}return!1!==a&&!0!==E(c)&&_e(T(!0),c)}static elIsDomElement(e){return C(String,e)&&(e=document.querySelector(e)),d(se(0),k(-1),v("nodeType"))(e)}static filterSelector(e,t){const r=m(E,e);return fe(ro.checkPayloadSelector)(r,t)}}function no(){return!0===ct.debug}function oo(e,t,r=!1){const n=io(e,t,r);return 1===n.length?p(n):n}function so(e,t,r){const n=document.querySelector(e),o=d(se(0),k(-1),v("nodeType"));if(null===n||!1!==o(n)){if(void 0!==t&&String(t).trim().length>0){function s(e){try{return document.querySelectorAll(e).length>0}catch(e){return!1}}const i=s(t);!0===r&&!0===no()&&!1===i&&bt(`Spyne Warning: the selector, ${t} does not exist in this el, ${e}`)}}else bt(`Spyne Warning: the el object is not a valid single element, ${n}`)}function io(e,t,r=!1){let n=!1;const o=(r=>{let o=[];try{o=document.querySelectorAll(r)}catch(e){o=[]}try{n=document.querySelector(t)===document.querySelector(e),!0===n&&(o=[document.querySelector(t)])}catch(e){}return o})(void 0!==t?`${e} ${t}`:e);if(!0===r){so(!0===n?"body":e,t,r)}return o}function ao(e,t,r){return io(t,r).forEach(t=>{t.style.cssText=e}),this}function co(e,t){function r(t){return co(e,t)}so(e="string"==typeof e?e:function(e){let t=`${Math.random().toString(36).replace(/\d/gm,"").substring(1,8)}`;return void 0===e.dataset.vsid?e.dataset.vsid=t:t=e.dataset.vsid,`[data-vsid='${t}']`}(e),t,!1),r.map=r=>Array.from(io(e,t)).map(r),r.forEach=r=>Array.from(io(e,t)).map(r),r.addClass=n=>(io(e,t).forEach(e=>e.classList.add(n)),r),r.removeClass=n=>(io(e,t).forEach(e=>{e.classList.remove(n)}),r),r.setClass=n=>(io(e,t).forEach(e=>{const t=d(m(E),z(" "))(e.className),r=n.split(" ");t.forEach(t=>e.classList.remove(t)),r.forEach(t=>e.classList.add(t))}),r),r.unmount=()=>{},r.toggleClass=(n,o)=>(io(e,t).forEach(e=>{(o=void 0!==o?o:!e.classList.contains(n))?e.classList.add(n):e.classList.remove(n)}),r),r.toggle=(e,t)=>(r.toggleClass(e,t),r),r.appendChild=e=>{const n=r.el;return null!==n?n.appendChild(e):bt(`Spyne Warning: The selector, ${t} does not appear to be valid!`),r.el},r.addAnimClass=n=>(requestAnimationFrame(()=>{io(e,t).forEach(e=>{try{e.classList.add(n)}catch(e){}})}),r),r.setActiveItem=(n,o)=>{const s=io(e,t),i="string"==typeof o?oo(e,o):o;if(s.forEach(e=>e.classList.remove(n)),!0===(a=i,d(se(0),k(-1),v("nodeType"))(a))){const e=Array.from(s).find(e=>e===i);e?e.classList.add(n):!0===no()&&bt(`Spyne Warning: The selector, ${o}, is valid but does not match any item in setActiveItem: ${n}`)}else!0===no()&&bt(`Spyne Warning: The selector, ${o}, does not appear to be a valid item in setActiveItem: ${n}`);var a;return r};const n=(r=!0)=>Array.from(io(e,t,r));return Object.defineProperty(r,"el",{get:()=>{const r=n();return r.length>1&&!0===no()&&bt(`Spyne Warning: el$("${void 0!==t?t:e}").el matched ${r.length} elements; returning the first. Use .els for the full list.`),r.length>=1?r[0]:null}}),Object.defineProperty(r,"els",{get:()=>n()}),Object.defineProperty(r,"arr",{get:()=>n()}),Object.defineProperty(r,"elLegacy",{get:()=>oo(e,t,!0)}),Object.defineProperty(r,"len",{get:()=>io(e,t,!1).length}),Object.defineProperty(r,"length",{get:()=>io(e,t,!1).length}),Object.defineProperty(r,"exists",{get:()=>io(e,t,!1).length>=1}),Object.defineProperty(r,"inline",{set:r=>ao(r,e,t),get:()=>r}),Object.defineProperty(r,"inlineCss",{set:r=>ao(r,e,t),get:()=>r}),r}class lo{constructor(e={}){this.vsnum=Math.random(),this.addMixins(),this._postRenderCalled=!1,this.defaults=()=>{const t=this.createId(),r=e.id?e.id:t;return{vsid:t,id:r,tagName:"div",el:void 0,data:void 0,animateIn:!1,animateInTime:.5,animateOut:!1,animateOutTime:.5,sendLifecyleEvents:!1,hashId:`#${r}`,id$:`#${r}`,viewClass:zn,extendedSourcesHashMethods:{},debug:!1,template:void 0,node:document.createDocumentFragment(),name:gt(this)}},this._state={},this.$dirs=Gn.createDirectionalFiltersObject(),this.addDefaultDirection=Gn.addDefaultDir,this.addDownInternalDir=Gn.addDownInternalDir,this.props=Ye(this.defaults(),e),this.sendLifecycleMethod=!0===this.props.sendLifecyleEvents?this.sendLifecycleMethodActive.bind(this):this.sendLifecycleMethodInactive.bind(this);const t=this.attributesArray;this.props.domAttributes=ee(t,this.props),void 0!==this.props.traits&&this.addTraits(this.props.traits),this.loadAllMethods(),this.props.action="LOADED",this.sink$=new r,this.props.elIsAlreadyRenderedBool=this.elAlreadyExistsFn(this.props);const n=this.props.viewClass;this.view=new n(this.sink$,{el:this.props.el},this.props.vsid,this.props.id),this.sourceStreams=this.view.sourceStreams,this._rawSource$=this.view.getSourceStream(),this._rawSource$.viewName=this.props.name,this.sendEventsDownStream=this.sendEventsDownStreamFn,this.initViewStream(),this.isDevMode=lo.isDevMode(),this.props.addedChannels=[],this.checkIfElementAlreadyExists()}get source$(){return this._source$}get attributesArray(){return["accesskey","class","contenteditable","dir","draggable","hidden","id","lang","spellcheck","style","tabindex","title","translate","aria-autocomplete","aria-checked","aria-disabled","aria-expanded","aria-haspopup","aria-hidden","aria-invalid","aria-label","aria-level","aria-multiline","aria-multiselectable","aria-orientation","aria-pressed","aria-readonly","aria-required","aria-selected","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","aria-atomic","aria-busy","aria-live","aria-relevant","aria-dropeffect","aria-grabbed","aria-activedescendant","aria-controls","aria-describedby","aria-flowto","aria-labelledby","aria-owns","aria-posinset","aria-setsize","accept","autocomplete","autofocus","checked","dirname","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","list","max","maxlength","min","minlength","multiple","name","pattern","placeholder","readonly","required","size","step","value","alt","srcset","sizes","usemap","ismap","href","target","download","ping","rel","hreflang","as","media","accept-charset","action","enctype","novalidate","content","charset","http-equiv","async","defer","integrity","nomodule","nonce","referrerpolicy","autocapitalize","autoplay","buffered","challenge","cite","code","codebase","color","cols","colspan","contextmenu","controls","coords","crossorigin","csp","dataset","datetime","decoding","default","for","headers","high","icon","importance","itemprop","keytype","kind","label","language","lazyload","loop","low","manifest","method","muted","open","optimum","poster","preload","radiogroup","reversed","role","rows","rowspan","sandbox","scope","scoped","selected","shape","slot","span","srcdoc","src","type","srclang","start","summary","wrap","width","height"]}static isDevMode(){return ct.debug}static checkIfActionsAreRegistered(e=[],t){if(t.length>0){const r=t=>{const r=new RegExp(t);if(ge(x(r),n)<0){const r=1===e.length?"from added channel":"from added channels";console.warn(`Spyne Warning: The action, ${t}, in ${this.props.name}, does not match any of the registered actions ${r}, ${e.join(", ")}`)}},n=(e=>{const t=e.map(e=>ct.getChannelActions(e));return O(t)})(e);t.forEach(r)}}static isValidNestedArr(e){const t=T(!0),r=Ae(t),n=C(String),o=d(r,D(n),ye(0,2),k([]));return d(r,D(o),k([]))(e)}static elIsDomElement(e){return C(String,e)&&(e=document.querySelector(e)),d(se(0),k(-1),v("nodeType"))(e)}updatePropsToMatchEl(){const e=d(Ce,V(v("tagName"),H("")));this.props.tagName=e(this.props.el)}elAlreadyExistsFn(e){const t=d(se(0),k(-1),v("nodeType"));return he(f([e=>document.body.contains(e),t]),"el")(e)}checkIfElementAlreadyExists(){!0===this.props.elIsAlreadyRenderedBool?(this.updatePropsToMatchEl(),this.postRender()):null===this.props.el&&console.error(`Spyne Error: The defined element for this ViewStream instance, ${this.constructor.name}, appears to not exist.`)}loadAllMethods(){const e=fe(this.onChannelMethodCall.bind(this));this.addActionListeners().forEach(t=>{let[r,n,o]=t;C(String,o)&&(o=new ro({selector:o})),this.props.extendedSourcesHashMethods[r]=e(n,o)}),this.props.hashSourceMethods=this.setSourceHashMethods(this.props.extendedSourcesHashMethods)}addActionListeners(){return[]}onChannelMethodCall(e,t,r){const n=t=>{void 0===this[e]?console.warn(`Spyne Warning: The method, ${e} does not appear to exist in ${this.constructor.name}!`):this[e](t)};if(void 0!==r.$dir&&r.$dir.includes("child")&&!0!==this.deleted){const e=Ye({},r);e.$dir=this.$dirs.C,this.sourceStreams.raw$.next(e)}!0===k(H(!0),t)(r)&&n(r=Ne(["$dir"],r))}setSourceHashMethods(e={}){const t={EXTIRPATING:e=>this.checkParentDispose(e),EXTIRPATE:e=>this.disposeViewStream(e),VS_SPAWNED:e=>this.onVSRendered(e),VS_SPAWNED_AND_ATTACHED_TO_DOM:e=>this.onVSRendered(e),VS_SPAWNED_AND_ATTACHED_TO_PARENT:e=>this.onVSRendered(e),READY_FOR_VS_DETRITUS_COLLECT:e=>this.onReadyToGC(e),VS_NULLITY:()=>({})};return Ye.all([{},t,e])}initViewStream(){this._source$=this._rawSource$.pipe(vn(e=>this.onMapViewSource(e)),$n(this.notGCSTATE)),this.initAutoMergeSourceStreams(),this.updateSourceSubscription(this._source$,!0)}notGCSTATE(e){return!e.action.includes("READY_FOR_VS_DETRITUS_COLLECT")}eqGCSTATE(e){return!e.action.includes("READY_FOR_VS_DETRITUS_COLLECT")}notCOMPLETED(e){return!e.action.includes("COMPLETED")}notGCCOMPLETE(e){return!e.action.includes("GC_COMPLETE")}testVal(e){console.log("TESTING VALL IS ",e)}addParentStream(e,t){this.parent$=e.pipe(Mn(e=>void 0!==e&&void 0!==e.action),vn(e=>{const t=Ye({},e);return"EXTIRPATE_AND_READY_FOR_VS_DETRITUS_COLLECT"===t.action&&(this.disposeViewStream(t),t.action="READY_FOR_VS_DETRITUS_COLLECT"),t})),this.updateSourceSubscription(this.parent$,!1,"PARENT"),this.renderAndAttachToParent(t)}addChildStream(e){const t=e.pipe(Mn(e=>void 0!==e&&void 0!==e.action),kn(e=>this.tracer("addChildStraem do ",e)),vn(e=>e),Wn(e=>this.onChildCompleted(t.source)));this.updateSourceSubscription(t,!0,"CHILD")}onChildDisposed(e){}onChildCompleted(e){const t=(e=>{const t=e=>{for(;void 0!==e.destination;)e=t(e.destination);return e};return ee(["id","vsid"],t(e))})(e);return this.tracer("onChildCompleted ",this.vsnum,e),this.onChildDisposed(t,e),t}initAutoMergeSourceStreams(){const e={next:this.onSubscribeToSourcesNext.bind(this),error:this.onSubscribeToSourcesError.bind(this),complete:this.onSubscribeToSourcesComplete.bind(this)},t=()=>{this.props.el$=void 0,this.uberSource$.complete(),this.autoSubscriber$.complete(),this.sink$.complete(),this.props=void 0,this.deleted=!0,this.tracer("completeAll",this.deleted,this.props)},n=()=>{o-=1,0===o&&t()};let o=0;this.uberSource$=new r;this.autoMergeSubject$=this.uberSource$.pipe(On(e=>{const t=e.observable.pipe(Mn(e=>void 0!==e&&void 0!==e.action),vn(e=>{const t=Ye({},e);return t.action=e.action,this.tracer("autoMergeSubject$",t),t}));return!1===e.autoClosesBool?t:(o+=1,t.pipe(Wn(n)))})),this.autoSubscriber$=this.autoMergeSubject$.pipe(Mn(e=>void 0!==e&&void 0!==e.action)).subscribe(e)}updateSourceSubscription(e,t=!1,r){const n={observable:e,autoClosesBool:t,rel:r};this.tracer("updateSourceSubscription ",this.vsnum,n),this.uberSource$.next(n)}onSubscribeToSourcesNext(e={}){const t=k(e=>this.sendExtendedStreams(e)),r=(n=this.props.hashSourceMethods,o=e.action,void 0!==n[o]?o:d(p,F(d(x(I,o),e=>new RegExp(e))))(A(n)));var n,o;t(this.props.hashSourceMethods[r])(e),this.tracer("onSubscribeToSourcesNext",{payload:e})}onSubscribeToSourcesError(e=""){console.log("ALL ERROR ",this.constructor.name,e)}onSubscribeToSourcesComplete(){this.tracer("onSubscribeToSourcesComplete","VS_DETRITUS_COLLECT"),this.openSpigot("VS_DETRITUS_COLLECT")}sendExtendedStreams(e){this.tracer("sendExtendedStreams",e),this.openSpigot(e.action,e)}renderAndAttachToParent(e){this.openSpigot("VS_SPAWN_AND_ATTACH_TO_PARENT",e)}renderView(){this.openSpigot("VS_SPAWN")}renderViewAndAttachToDom(e,t,r){const n={node:e,type:t,attachType:r};this.openSpigot("VS_SPAWN_AND_ATTACH_TO_DOM",{attachData:n})}checkParentDispose(e){"parent"===e.from$&&this.disposeViewStream(e)}onBeforeDispose(){}setTimeout(e,t=0,r=!1){window.setTimeout((...t)=>{if(void 0!==this&&void 0!==this.props){const n=!0===r?e.bind(this):e;ve(n,t)}},t)}disposeViewStream(e){this.onBeforeDispose(),this.openSpigot("EXTIRPATE")}onChildDispose(e){}onParentDisposing(e){this.openSpigot("EXTIRPATE")}onReadyToGC(e){const t=void 0!==e.from$&&"internal"===e.from$;this.tracer("onReadyToGC",t,e)}openSpigot(e,t={}){if(void 0!==this.props){this.props.action=e;const r=J(this.props,t);this.sink$.next(Object.freeze(r))}}setAttachData(e,t){return{node:this.props.el,type:"ViewStreamObservable",attachType:e,query:(()=>{const e=this.props.el.querySelector(t);return!0===lo.isDevMode()&&C(String,t)&&_(e)&&console.warn(`Spyne Warning: The appendView query in ${this.props.name}, '${t}', appears to not exist!`),e})()}}getParentEls(e,t){const r=e=>e.parentElement;let n=0,o=e;for(;n<t;)o=r(o),n++;return o}setAttachParentData(e,t,r){t=""!==t?t:void 0;const n=this.getParentEls(this.props.el,r);return{node:n,type:"ViewStreamObservable",attachType:e,query:n.querySelector(t)}}onMapViewSource(e={}){return this.props=J(this.props,e),e}exchangeViewsWithChild(e,t){this.addChildStream(e.sourceStreams.toParent$),e.addParentStream(this.sourceStreams.toChild$,t)}appendToDom(e){void 0!==this.props.el&&console.warn(`Spyne Warning: The ViewStream, ${this.props.name}, has an element, ${this.props.el}, that is already rendered and does not need to be appendedToDom. This may create unsusual side effects!`),this.renderViewAndAttachToDom(e,"dom","appendChild")}appendToDomAfter(e){void 0!==this.props.el&&console.warn(`Spyne Warning: The ViewStream, ${this.props.name}, has an element, ${this.props.el}, that is already rendered and does not need to be appendedToDomAfter. This may create unsusual side effects!`),this.renderViewAndAttachToDom(e,"dom","after")}prependToDom(e){void 0!==this.props.el&&console.warn(`Spyne Warning: The ViewStream, ${this.props.name}, has an element, ${this.props.el}, that is already rendered and does not need to be prependedToDom. This may create unsusual side effects!`),this.renderViewAndAttachToDom(e,"dom","prependChild")}appendView(e,t){this.exchangeViewsWithChild(e,this.setAttachData("appendChild",t))}appendViewAfter(e,t){this.exchangeViewsWithChild(e,this.setAttachData("after",t))}appendViewToParentEl(e,t,r=1){this.exchangeViewsWithChild(e,this.setAttachParentData("appendChild",t,r))}prependViewToParentEl(e,t,r=1){this.exchangeViewsWithChild(e,this.setAttachParentData("prependChild",t,r))}prependView(e,t){this.exchangeViewsWithChild(e,this.setAttachData("prependChild",t))}appendToNull(){const e=document.getElementById("spyne-null-views");this.renderViewAndAttachToDom(e,"dom","appendChild")}onVSRendered(e){"internal"===e.from$&&this.postRender()}postRender(){if(!0===this._postRenderedCalled)return;this.beforeAfterRender(),this.afterRender(),this.onRendered();if(requestAnimationFrame(()=>this.onAnimFrameAfterRendered()),!0===this.isDevMode){const e=this.broadcastEvents();!1===lo.isValidNestedArr(e)&&console.warn(`Spyne Warning: The array returned from broadcastEvents in ${this.props.name}, '${JSON.stringify(e)}', does not appear to be properly formatted!`)}this.initializeChannels(),this.viewsStreamBroadcaster=new qn(this.props,this.broadcastEvents.bind(this)),this.afterBroadcastEvents(),this._postRenderedCalled=!0}addTraits(e){"Array"!==e.constructor.name&&(e=[e]);e.forEach(e=>{new e(this)})}afterBroadcastEvents(){if(!0===this.isDevMode){const e=e=>e[0],t=this.addActionListeners(),r=t.map(e);if(!1===lo.isValidNestedArr(t))console.warn(`Spyne Warning: The array returned from addActionsListeners in ${this.props.name}, '${JSON.stringify(t)}', does not appear to be properly formatted!`);else{d(Ee(e=>{const t=k("",e[1]);!1===C(Function,this[t])&&console.warn(`Spyne Warning: The method in addActionListeners nested Array, '${JSON.stringify(e)}', in ${this.props.name}, does not appear to exist!`)}),k([]))(t)}const n=()=>{void 0!==K(["props","addedChannels"],this)&&lo.checkIfActionsAreRegistered.bind(this)(this.props.addedChannels,r)};this.setTimeout(n,500)}}setDataVSID(){this.props.el.dataset.vsid=this.props.vsid}beforeAfterRender(){this.setDataVSID(),this.props.el$=co(this.props.el)}downStream(){}onRendered(){}onAnimFrameAfterRendered(){}afterRender(){}broadcastEvents(){return[]}getChannel(e){return w(e=>lt().includes(e),e=>ct.channelsMap.getStream(e).observer.pipe($n(e=>!0!==this.deleted)),e=>console.warn(`channel name ${e} is not within ${lt}`))(e)}initializeChannels(){const e=e=>{const[t,r=!1]=Array.isArray(e)?e:[e];this?.addChannel(t,r)};Array.isArray(this?.props?.channels)?this?.props?.channels?.forEach(e):Array.isArray(this?.props?.channel)&&console.warn("props.channel is not a ViewStream property. Do you mean props.channels?")}addChannel(e,t=!1,r=!1,n=!1){const o=!0===r?this.$dirs.CI:this.$dirs.I;if(!0===this?.props?.addedChannels?.includes(e))return;const s=K(["srcElement","isLocalEvent"]),i=K(["srcElement","vsid"]),a=[vn(e=>{const t=e;return t.$dir=o,t}),Mn(e=>{const t=i(e);return!0!==s(e)||t===this.props.vsid})];var c;!0===t&&a.unshift((c=1,Mn(function(e,t){return c<=t})));const l=this.getChannel(e).pipe(...a);this.updateSourceSubscription(l,!1),this.props.addedChannels.push(e)}checkIfChannelExists(e){const t=ct.channelsMap.testStream(e);return!0!==t&&console.warn(`SPYNE WARNING: The ChannelPayload from ${this.props.name}, has been sent to a channel, ${e}, that has not been registered!`),t}sendInfoToChannel(e,t={},r){const n=t,o=k("VIEWSTREAM_EVENT"),i=d(o,v(e)),a={payload:n,action:r=r||i({CHANNEL_ROUTE:"CHANNEL_ROUTE_CHANGE_EVENT"})};try{if(a.srcElement=d(ee(["id","vsid","class","tagName"]),v("props"))(this),!0===this.checkIfChannelExists(e)){!1===/CHANNEL_LIFECYCLE/.test(r)&&Object.defineProperties(a,{payload:{get:()=>mt(t)}});const n=s(a);return new Yn(e,n,a)}}catch(e){console.warn("SPYNE WARNING ",e)}}tracer(...e){this.sendLifecycleMethod(...e)}sendLifecycleMethodInactive(){}sendLifecycleMethodActive(e,t){const r="VS_DETRITUS_COLLECT"===t;!0===me({from$:T("internal"),action:T("VS_SPAWNED_AND_ATTACHED_TO_PARENT")},t)?this.sendInfoToChannel("CHANNEL_LIFECYCLE",{action:"CHANNEL_LIFECYCLE_RENDERED_EVENT"},"CHANNEL_LIFECYCLE_RENDERED_EVENT"):!0===r&&this.sendInfoToChannel("CHANNEL_LIFECYCLE",{action:"CHANNEL_LIFECYCLE_DISPOSED_EVENT"},"CHANNEL_LIFECYCLE_DISPOSED_EVENT")}createActionFilter(e,t){return new ro(e,t)}isLocalEvent(e){const t=K(["srcElement","el"],e),r=K(["props","el"],this);return lo.elIsDomElement(r)&&lo.elIsDomElement(t)&&r.contains(t)}addMixins(){const e=yt();this.createId=e.createId}}class uo{constructor(e){const t=String(e.props.name),r=`${t}_ROUTE_UPDATER`;return fe(uo.createTemporaryViewStreamObj)({id:r,name:t})}static createTemporaryViewStreamObj(e,t){const{name:r,id:n}=e,o=t,s=new lo({id:n,name:r,data:t});s.onRendered=()=>{s.sendInfoToChannel("CHANNEL_ROUTE",o)},s.afterBroadcastEvents=()=>{s.disposeViewStream()},s.appendToNull()}}class ho{constructor(e,t={}){this.addRegisteredActions.bind(this),this.createChannelActionsObj(e,t.extendedActionsArr),t.name=e,t.defaultActions=void 0!==t.data?[`${t.name}_EVENT`]:[],this.props=t,this.props.isRegistered=!1,this.props.isProxy=void 0!==this.props.isProxy&&this.props.isProxy;const r=void 0!==this.props.data;void 0!==this.props.replay?this.props.sendCachedPayload=this.props.replay:this.props.sendCachedPayload=void 0===this.props.sendCachedPayload?r:this.props.sendCachedPayload,this.sendPayloadToRouteChannel=new uo(this),this.createChannelActionMethods(),this.streamsController=ct.channelsMap;const n=this.getMainObserver();this.checkForPersistentDataMode=ho.checkForPersistentDataMode.bind(this),this.observer$=this.props.observer=n;const o=this.streamsController.getStream("DISPATCHER"),s=U(t.name,"name");o.pipe(Mn(s)).subscribe(e=>this.onReceivedObservable(e))}getMainObserver(){void 0===this.streamsController&&console.warn(`Spyne Warning: The following channel, ${this.props.name}, appears to be registered before Spyne has been initialized.`);return!0===this.streamsController.testStream(this.props.name)?this.streamsController.getProxySubject(this.props.name,this.props.sendCachedPayload):!0===this.props.sendCachedPayload?new i(1):new r}onChannelInitialized(){}onRegistered(e=this.props){if(void 0!==e.data){const t=Object.keys(this.channelActions)[0];this.sendChannelPayload(t,e.data)}}get isProxy(){return this.props.isProxy}get channelName(){return this.props.name}get observer(){return this.observer$}checkForTraits(){const e=e=>{"Array"!==e.constructor.name&&(e=[e]);e.forEach(e=>new e(this))};void 0!==this.props.traits&&e(this.props.traits)}initializeStream(){this.checkForTraits(),this.onChannelInitialized(),this.checkForPersistentDataMode(),this.onRegistered(),this.props.isRegistered=!0}static checkForPersistentDataMode(e=this.props,t=this.channelActions){const r=E(t),n=void 0!==v("data",e);return!0===r&&!0===n&&(e.sendCachedPayload=!0,t=(()=>{const{name:t}=e,r=`${t}_EVENT`;return{[r]:r}})(),void 0!==this.channelActions&&(this.channelActions=t)),{props:e,actionsObj:t}}setTrace(e){}createChannelActionsObj(e,t=[]){const r=w(C(String),be,p),n=t.concat(this.addRegisteredActions(e)),o=D(r,n),s=oe(Q(e=>Ie(e,e),o));this.channelActions=s}createChannelActionMethods(){const e=w(C(String),be,p),t=(e,t)=>{window.setTimeout(()=>{"function"!=typeof this[e]&&console.warn(`"${this.props.name}", REQUIRES THE FOLLOWING METHOD ${e} FOR ACTION, ${t[0]}`)},100)},r=w(C(String),H("onViewStreamInfo"),e=>{const r=Se(Le(1),e);return t(r,e),r});this.channelActionMethods=B(D(t=>[e(t),r(t)],this.addRegisteredActions()))}addRegisteredActions(){let e=[];return K(["props","data"],this)&&(e=[`${this.props.name}_EVENT`]),e}onReceivedObservable(e){this.onIncomingObservable(e)}getActionMethodForObservable(e){e.unpacked=!0;const t=this.onViewStreamInfo.bind(this),r=K(["data","action"],e),n=v(r,this.channelActionMethods);let o=t;if(void 0!==n&&"onViewStreamInfo"!==n){!0===("function"==typeof this[n])&&(o=this[n].bind(this))}return o}onIncomingObservable(e){const t=T(e.name,this.props.name),{action:r,payload:n,srcElement:o}=e.data,s=t=>({clone:()=>{return t=e.data,oe([t,{action:v("action",t)},v("payload",t),v("srcElement",t)]);var t},safeClone:()=>{const e=ht(n);return oe([{payload:e},e,{action:r},{srcElement:o},{event:t}])},action:r,payload:n,srcElement:o,event:t});return!0===t?(e=>e.observable.pipe(vn(s)).subscribe(this.getActionMethodForObservable(e)))(e):void 0}onViewStreamInfo(e){}sendChannelPayload(e,t,r={},n={},o=this.observer$){const s=new At(this.props.name,e,t,r,n);o.next(s)}getChannel(e,t){return w(e=>lt().includes(e),r=>{const n=this.streamsController.getStream(r).observer;return n.source?n.source.channelName=e:n.channelName=e,void 0!==t?n.pipe(Mn(t)):n},e=>console.warn(`channel name ${e} is not within ${lt}`))(e)}mergeChannels(e,t=!0){const r=e.map(e=>{if("string"==typeof e){const r=this.getChannel(e);return t?r.pipe(xn(1)):r}return t?e.pipe(xn(1)):e});let n;if(t)n=a(r);else if(0===r.length)n=c;else if(1===r.length)n=r[0];else{const[e,...t]=r;n=e.pipe(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Rn.apply(void 0,Tr([],mr(e)))}(...t))}return n.pipe(vn(t=>{const r={};return e.forEach((e,n)=>{const o="string"==typeof e?e:`channel_${n}`;r[e?.source?.channelName||e?.source?.source?.channelName||o]=t[n]}),r}))}static checkForNotTrackFlag(e={}){!0===e.doNotTrack&&ct.doNotTrackChannel(e.channelName)}}class Eo extends ho{constructor(e="CHANNEL_ROUTE",t={}){t.sendCachedPayload=!0,super("CHANNEL_ROUTE",t),this.createChannelActionsObj(),this.routeConfigJson=this.getRouteConfig(),this.bindStaticMethods(),this.navToStream$=new i(1),this.observer$=this.navToStream$.pipe(vn(e=>this.onMapNext(e))),this.compareRouteKeywords=Fe.compareRouteKeywords()}checkConfigForHash(){!0===("hash"===ct.config.channels.ROUTE.type)&&(ct.config.channels.ROUTE.type="slash",ct.config.channels.ROUTE.isHash=!0)}onRegistered(){this.checkConfigForHash(),this.initStream()}createChannelActionsObj(){const e=this.addRegisteredActions(),t=oe(Q(e=>Ie(e,e),e));this.channelActions=t}addRegisteredActions(){return["CHANNEL_ROUTE_DEEPLINK_EVENT","CHANNEL_ROUTE_CHANGE_EVENT","CHANNEL_ROUTE_CONFIG_UPDATED_EVENT",["CHANNEL_ROUTE_UPDATE_CONFIG_EVENT","updateRouteConfig"]]}updateRouteConfig(e){const t=ee(["isHash","isHidden","routes","type"],e.payload);ct.config.channels.ROUTE=J(ct.config.channels.ROUTE,t),ct.conformRouteConfig();const r=this.getRouteConfig();r.navLinks=[...r?.routeDatasetsArr],this.routeConfigJson=r,this.bindStaticMethodsWithConfigData(),this.sendChannelPayload("CHANNEL_ROUTE_CONFIG_UPDATED_EVENT",r,{},{},this.navToStream$)}getRouteConfig(){const e=ct.config,t=K(["channels","ROUTE"],e);"query"===t.type&&(t.isHash=!1);const r=Fe.flattenConfigObject(t.routes);return t.paramsArr=r,t}initStream(){this.firstLoadStream$=new i(1),this.onIncomingDomEvent(void 0,this.routeConfigJson,"CHANNEL_ROUTE_DEEPLINK_EVENT"),Fe.createPopStateStream(this.onIncomingDomEvent.bind(this)),this.observer$=l(this.firstLoadStream$,this.navToStream$)}onMapNext(e,t=!1){return e.action="CHANNEL_ROUTE_CHANGE_EVENT",e}static removeSSID(e){const t=Oe(["routeData"]);return De(t,Ne(["vsid"]))(e)}static onIncomingDomEvent(e,t=this.routeConfigJson,r){const n=void 0!==r?r:this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT,o=K(["state","routeCount"],e),s=!0===C(Number,o);let i=this.getDataFromString(t,s);!0===s&&(i.routeCount=o),"CHANNEL_ROUTE_DEEPLINK_EVENT"===r&&(i.navLinks=v("routeDatasetsArr",t),Object.defineProperty(i,"linksData",{get(){return this.navLinks},set(e){console.warn("set links data is deprecated in ROUTE DEEPLINK DATA, use navLinks")},enumerable:!0}));const a=this.compareRouteKeywords.compare(i.routeData,i.paths);i=J(i,a),this.sendChannelPayload(n,i,void 0,e,this.navToStream$)}static checkForRouteParamsOverrides(e){return e}static checkForEventMethods(e){const t=d(F(x(/^(event)([A-Z].*)([A-Z].*)$/gm)),A,v("payload"))(e);if(t.length>=1){const r=v("event",e);if(void 0!==r){const e=L(/^(event)([A-Z])(.*)([A-Z].*)$/gm,(e,t,r,n,o)=>String(r).toLowerCase()+n+o),n=t=>{const n=e(t);void 0!==r[n]&&r[n]()};t.forEach(n)}}return e}static checkForEndRoute(e,t=this.routeConfigJson,r){if(!0!==d(T("true"),K(["payload","endRoute"]))(e))return e;const n=void 0!==r?r:!0===ct.debug,{payload:o}=e;let s=0;const i=(e=[],t)=>{const r=t[1],{routePath:a}=r,c=v("routeName",a),l=(e=>{const t=v("routeName",e);if(t){const r=d(A,Ne(["routeName"]))(e),n=o[t];return y(e=>new RegExp(`^${e}$`).test(n),r)}})(a),u=C(Object,r),h=C(Array,r);if(s+=1,!0===u&&!1===h){const t=a[l];t?d(Re,j(i,e),R)({nextRoutePath:t}):1===s?n&&console.warn(`Spyne Warning: use of end route method should add start route value of "${c}".`):e.push(c)}return e},{routes:a}=t,c=d(Re,j(i,[]),R)({routes:a});if(1===c.length){const t=c[0];e.payload[t]=""}return e}onViewStreamInfo(e){const t=e.action??this.channelActions.CHANNEL_ROUTE_CHANGE_EVENT;e?.srcElement?.el?.dataset&&(e.payload=function(e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e?.srcElement?.el?.dataset)??e.payload),Eo.checkForEventMethods(e),e=this.checkForEndRoute(e);let r=this.getDataFromParams(e);const n=v("srcElement",e),o=v("event",e),s=!r.isHidden,i=this.compareRouteKeywords.compare(r.routeData,r.paths);r=J(r,i),this.sendRouteStream(r,s),r=Eo.removeSSID(r),this.sendChannelPayload(t,r,n,o,this.navToStream$)}static checkAndConvertStrWithRegexTokens(e,t){return A(t)}sendRouteStream(e,t=!0){!0===t&&this.setWindowLocation(e)}static getRouteState(){return"CHANNEL_ROUTE_CHANGE_EVENT"}static getIsDeepLinkBool(e){return!1===e&&0===this._routeCount}static getRouteCount(e=!1){return void 0===this._routeCount?(this._routeCount=0,this._routeCount):(!1===e&&(this._routeCount+=1),this._routeCount)}static getExtraPayloadParams(e=this.routeConfigJson,t=!1){return{routeCount:this.getRouteCount(t),isDeepLink:this.getIsDeepLinkBool(t),isHash:e.isHash,isHistory:t,isHidden:e.isHidden,routeType:e.type}}static getDataFromParams(e,t=this.routeConfigJson){let r=v("payload",e);const n=this.getRouteStrFromParams(r,t),o=(e,r)=>k(r,v(e,t)),s=o("type","slash"),i=o("isHash",!1),a=We.formatStrAsWindowLocation(n),c=this.getDataFromLocationStr(s,i,a),{pathInnermost:l,paths:u}=c;r=J(c.routeData,r);const{routeCount:d,isDeepLink:h,isHash:E,isHistory:p,isHidden:N,routeType:_}=this.getExtraPayloadParams(t);return{isDeepLink:h,routeCount:d,pathInnermost:l,paths:u,routeData:r,routeValue:n,isHash:E,isHidden:N,isHistory:p,routeType:_}}static getDataFromString(e=this.routeConfigJson,t=!1){const r=e.type,n=!0===e.isHash,o=We.getLocationStrByType(r,n),{paths:s,pathInnermost:i,routeData:a,routeValue:c}=Eo.getParamsFromRouteStr(o,e,r),{routeCount:l,isDeepLink:u,isHash:d,routeType:h,isHidden:E}=this.getExtraPayloadParams(e,t);return{isDeepLink:u,routeCount:l,pathInnermost:i,paths:s,routeData:a,routeValue:c,isHash:d,isHidden:E,isHistory:t,routeType:h}}static getDataFromLocationStr(e="slash",t=this.routeConfigJson.isHash,r=window.location){const n=void 0!==this.routeConfigJson?this.routeConfigJson.type:e,o=We.getLocationStrByType(n,t,r),{paths:s,pathInnermost:i,routeData:a,routeValue:c}=this.getParamsFromRouteStr(o,this.routeConfigJson,n);return{paths:s,pathInnermost:i,routeData:a,routeValue:c,action:this.getRouteState()}}static getLocationData(){return Z(["href","origin","protocol","host","hostname","port","pathname","search","hash"],window.location)}static getRouteStrFromParams(e,t,r){const n=void 0!==r?r:t.type;return We.convertParamsToRoute(e,t,n)}static getParamsFromRouteStr(e,t,r){const n=void 0!==r?r:t.type;return We.convertRouteToParams(e,t,n)}checkEmptyRouteStr(e,t=!1){const r=E(e);return!0===(!0===r&&!1===t)||!0===(!0===r&&!0===t)?"/":!0===(!1===r&&!0===t)?P("#",e):e}static removeLastSlash(e){return e.replace(/^(.*)(\/)$/,"$1")}setWindowLocation(e){let{isHash:t,routeValue:r,routeType:n}=e;r=this.checkEmptyRouteStr(r,t);const{routeCount:o}=e;if(!0===t||"query"===n){r=Eo.removeLastSlash(window.location.pathname)+r,window.history.pushState({routeCount:o},"",r)}else{const e=b(d(h(T("/")),p),P("/",I));window.history.pushState({routeCount:o},"",e(r))}}getWindowLocation(){return window.location.pathname}bindStaticMethods(){this.checkForEndRoute=Eo.checkForEndRoute.bind(this),this.getIsDeepLinkBool=Eo.getIsDeepLinkBool.bind(this),this.getDataFromLocationStr=Eo.getDataFromLocationStr.bind(this),this.onIncomingDomEvent=Eo.onIncomingDomEvent.bind(this),this.getDataFromString=Eo.getDataFromString.bind(this),this.getParamsFromRouteStr=Eo.getParamsFromRouteStr.bind(this),this.getLocationData=Eo.getLocationData.bind(this),this.getRouteState=Eo.getRouteState.bind(this),this.getDataFromParams=Eo.getDataFromParams.bind(this),this.getRouteCount=Eo.getRouteCount.bind(this),this.getExtraPayloadParams=Eo.getExtraPayloadParams.bind(this),this.bindStaticMethodsWithConfigData()}bindStaticMethodsWithConfigData(){const e=we(3,Eo.getRouteStrFromParams);this.getRouteStrFromParams=e(I,this.routeConfigJson,this.routeConfigJson.type)}}class po extends ho{constructor(e="CHANNEL_UI",t={}){t.sendCachedPayload=!1,super(e,t),this.keyEventsLoaded=!1,this.keyCodeArr=[]}addRegisteredActions(){return["CHANNEL_UI_DOMCONTENTLOADED_EVENT","CHANNEL_UI_ABORT_EVENT","CHANNEL_UI_ACTIVATE_EVENT","CHANNEL_UI_ADDTRACK_EVENT","CHANNEL_UI_AFTERPRINT_EVENT","CHANNEL_UI_AFTERSCRIPTEXECUTE_EVENT","CHANNEL_UI_ANIMATIONCANCEL_EVENT","CHANNEL_UI_ANIMATIONEND_EVENT","CHANNEL_UI_ANIMATIONITERATION_EVENT","CHANNEL_UI_ANIMATIONSTART_EVENT","CHANNEL_UI_APPINSTALLED_EVENT","CHANNEL_UI_AUDIOEND_EVENT","CHANNEL_UI_AUDIOSTART_EVENT","CHANNEL_UI_AUXCLICK_EVENT","CHANNEL_UI_BEFOREINPUT_EVENT","CHANNEL_UI_BEFOREPRINT_EVENT","CHANNEL_UI_BEFOREUNLOAD_EVENT","CHANNEL_UI_BEGINEVENT_EVENT","CHANNEL_UI_BLOCKED_EVENT","CHANNEL_UI_BLUR_EVENT","CHANNEL_UI_BOUNDARY_EVENT","CHANNEL_UI_BUFFEREDAMOUNTLOW_EVENT","CHANNEL_UI_CANCEL_EVENT","CHANNEL_UI_CANPLAY_EVENT","CHANNEL_UI_CANPLAYTHROUGH_EVENT","CHANNEL_UI_CHANGE_EVENT","CHANNEL_UI_CLICK_EVENT","CHANNEL_UI_CLOSE_EVENT","CHANNEL_UI_CLOSING_EVENT","CHANNEL_UI_COMPLETE_EVENT","CHANNEL_UI_COMPOSITIONEND_EVENT","CHANNEL_UI_COMPOSITIONSTART_EVENT","CHANNEL_UI_COMPOSITIONUPDATE_EVENT","CHANNEL_UI_CONNECT_EVENT","CHANNEL_UI_CONNECTIONSTATECHANGE_EVENT","CHANNEL_UI_CONTENTDELETE_EVENT","CHANNEL_UI_CONTEXTMENU_EVENT","CHANNEL_UI_COPY_EVENT","CHANNEL_UI_CUECHANGE_EVENT","CHANNEL_UI_CUT_EVENT","CHANNEL_UI_DATACHANNEL_EVENT","CHANNEL_UI_DBLCLICK_EVENT","CHANNEL_UI_DEVICECHANGE_EVENT","CHANNEL_UI_DEVICEMOTION_EVENT","CHANNEL_UI_DEVICEORIENTATION_EVENT","CHANNEL_UI_DRAG_EVENT","CHANNEL_UI_DRAGEND_EVENT","CHANNEL_UI_DRAGENTER_EVENT","CHANNEL_UI_DRAGLEAVE_EVENT","CHANNEL_UI_DRAGOVER_EVENT","CHANNEL_UI_DRAGSTART_EVENT","CHANNEL_UI_DROP_EVENT","CHANNEL_UI_DURATIONCHANGE_EVENT","CHANNEL_UI_EMPTIED_EVENT","CHANNEL_UI_END_EVENT","CHANNEL_UI_ENDEVENT_EVENT","CHANNEL_UI_ENDED_EVENT","CHANNEL_UI_ENTERPICTUREINPICTURE_EVENT","CHANNEL_UI_ERROR_EVENT","CHANNEL_UI_FOCUS_EVENT","CHANNEL_UI_FOCUSIN_EVENT","CHANNEL_UI_FOCUSOUT_EVENT","CHANNEL_UI_FORMDATA_EVENT","CHANNEL_UI_FULLSCREENCHANGE_EVENT","CHANNEL_UI_FULLSCREENERROR_EVENT","CHANNEL_UI_GAMEPADCONNECTED_EVENT","CHANNEL_UI_GAMEPADDISCONNECTED_EVENT","CHANNEL_UI_GATHERINGSTATECHANGE_EVENT","CHANNEL_UI_GESTURECHANGE_EVENT","CHANNEL_UI_GESTUREEND_EVENT","CHANNEL_UI_GESTURESTART_EVENT","CHANNEL_UI_GOTPOINTERCAPTURE_EVENT","CHANNEL_UI_HASHCHANGE_EVENT","CHANNEL_UI_ICECANDIDATE_EVENT","CHANNEL_UI_ICECANDIDATEERROR_EVENT","CHANNEL_UI_ICECONNECTIONSTATECHANGE_EVENT","CHANNEL_UI_ICEGATHERINGSTATECHANGE_EVENT","CHANNEL_UI_INPUT_EVENT","CHANNEL_UI_INPUTSOURCESCHANGE_EVENT","CHANNEL_UI_INSTALL_EVENT","CHANNEL_UI_INVALID_EVENT","CHANNEL_UI_KEYDOWN_EVENT","CHANNEL_UI_KEYUP_EVENT","CHANNEL_UI_LANGUAGECHANGE_EVENT","CHANNEL_UI_LEAVEPICTUREINPICTURE_EVENT","CHANNEL_UI_LOAD_EVENT","CHANNEL_UI_LOADEDDATA_EVENT","CHANNEL_UI_LOADEDMETADATA_EVENT","CHANNEL_UI_LOADEND_EVENT","CHANNEL_UI_LOADSTART_EVENT","CHANNEL_UI_LOSTPOINTERCAPTURE_EVENT","CHANNEL_UI_MARK_EVENT","CHANNEL_UI_MERCHANTVALIDATION_EVENT","CHANNEL_UI_MESSAGE_EVENT","CHANNEL_UI_MESSAGEERROR_EVENT","CHANNEL_UI_MOUSEDOWN_EVENT","CHANNEL_UI_MOUSEENTER_EVENT","CHANNEL_UI_MOUSELEAVE_EVENT","CHANNEL_UI_MOUSEMOVE_EVENT","CHANNEL_UI_MOUSEOUT_EVENT","CHANNEL_UI_MOUSEOVER_EVENT","CHANNEL_UI_MOUSEUP_EVENT","CHANNEL_UI_MUTE_EVENT","CHANNEL_UI_NEGOTIATIONNEEDED_EVENT","CHANNEL_UI_NOMATCH_EVENT","CHANNEL_UI_NOTIFICATIONCLICK_EVENT","CHANNEL_UI_OFFLINE_EVENT","CHANNEL_UI_ONLINE_EVENT","CHANNEL_UI_OPEN_EVENT","CHANNEL_UI_ORIENTATIONCHANGE_EVENT","CHANNEL_UI_PAGEHIDE_EVENT","CHANNEL_UI_PAGESHOW_EVENT","CHANNEL_UI_PASTE_EVENT","CHANNEL_UI_PAUSE_EVENT","CHANNEL_UI_PAYERDETAILCHANGE_EVENT","CHANNEL_UI_PAYMENTMETHODCHANGE_EVENT","CHANNEL_UI_PLAY_EVENT","CHANNEL_UI_PLAYING_EVENT","CHANNEL_UI_POINTERCANCEL_EVENT","CHANNEL_UI_POINTERDOWN_EVENT","CHANNEL_UI_POINTERENTER_EVENT","CHANNEL_UI_POINTERLEAVE_EVENT","CHANNEL_UI_POINTERLOCKCHANGE_EVENT","CHANNEL_UI_POINTERLOCKERROR_EVENT","CHANNEL_UI_POINTERMOVE_EVENT","CHANNEL_UI_POINTEROUT_EVENT","CHANNEL_UI_POINTEROVER_EVENT","CHANNEL_UI_POINTERUP_EVENT","CHANNEL_UI_POPSTATE_EVENT","CHANNEL_UI_PROGRESS_EVENT","CHANNEL_UI_PUSH_EVENT","CHANNEL_UI_PUSHSUBSCRIPTIONCHANGE_EVENT","CHANNEL_UI_RATECHANGE_EVENT","CHANNEL_UI_READYSTATECHANGE_EVENT","CHANNEL_UI_REJECTIONHANDLED_EVENT","CHANNEL_UI_REMOVETRACK_EVENT","CHANNEL_UI_REMOVESTREAM_EVENT","CHANNEL_UI_REPEATEVENT_EVENT","CHANNEL_UI_RESET_EVENT","CHANNEL_UI_RESIZE_EVENT","CHANNEL_UI_RESOURCETIMINGBUFFERFULL_EVENT","CHANNEL_UI_RESULT_EVENT","CHANNEL_UI_RESUME_EVENT","CHANNEL_UI_SCROLL_EVENT","CHANNEL_UI_SEARCH_EVENT","CHANNEL_UI_SEEKED_EVENT","CHANNEL_UI_SEEKING_EVENT","CHANNEL_UI_SELECT_EVENT","CHANNEL_UI_SELECTEDCANDIDATEPAIRCHANGE_EVENT","CHANNEL_UI_SELECTEND_EVENT","CHANNEL_UI_SELECTIONCHANGE_EVENT","CHANNEL_UI_SELECTSTART_EVENT","CHANNEL_UI_SHIPPINGADDRESSCHANGE_EVENT","CHANNEL_UI_SHIPPINGOPTIONCHANGE_EVENT","CHANNEL_UI_SIGNALINGSTATECHANGE_EVENT","CHANNEL_UI_SLOTCHANGE_EVENT","CHANNEL_UI_SOUNDEND_EVENT","CHANNEL_UI_SOUNDSTART_EVENT","CHANNEL_UI_SPEECHEND_EVENT","CHANNEL_UI_SPEECHSTART_EVENT","CHANNEL_UI_SQUEEZE_EVENT","CHANNEL_UI_SQUEEZEEND_EVENT","CHANNEL_UI_SQUEEZESTART_EVENT","CHANNEL_UI_STALLED_EVENT","CHANNEL_UI_START_EVENT","CHANNEL_UI_STATECHANGE_EVENT","CHANNEL_UI_STORAGE_EVENT","CHANNEL_UI_SUBMIT_EVENT","CHANNEL_UI_SUCCESS_EVENT","CHANNEL_UI_SUSPEND_EVENT","CHANNEL_UI_TIMEOUT_EVENT","CHANNEL_UI_TIMEUPDATE_EVENT","CHANNEL_UI_TOGGLE_EVENT","CHANNEL_UI_TONECHANGE_EVENT","CHANNEL_UI_TOUCHCANCEL_EVENT","CHANNEL_UI_TOUCHEND_EVENT","CHANNEL_UI_TOUCHMOVE_EVENT","CHANNEL_UI_TOUCHSTART_EVENT","CHANNEL_UI_TRACK_EVENT","CHANNEL_UI_TRANSITIONCANCEL_EVENT","CHANNEL_UI_TRANSITIONEND_EVENT","CHANNEL_UI_TRANSITIONRUN_EVENT","CHANNEL_UI_TRANSITIONSTART_EVENT","CHANNEL_UI_UNHANDLEDREJECTION_EVENT","CHANNEL_UI_UNLOAD_EVENT","CHANNEL_UI_UNMUTE_EVENT","CHANNEL_UI_UPGRADENEEDED_EVENT","CHANNEL_UI_VERSIONCHANGE_EVENT","CHANNEL_UI_VISIBILITYCHANGE_EVENT","CHANNEL_UI_VOICESCHANGED_EVENT","CHANNEL_UI_VOLUMECHANGE_EVENT","CHANNEL_UI_VRDISPLAYACTIVATE_EVENT","CHANNEL_UI_VRDISPLAYBLUR_EVENT","CHANNEL_UI_VRDISPLAYCONNECT_EVENT","CHANNEL_UI_VRDISPLAYDEACTIVATE_EVENT","CHANNEL_UI_VRDISPLAYDISCONNECT_EVENT","CHANNEL_UI_VRDISPLAYFOCUS_EVENT","CHANNEL_UI_VRDISPLAYPOINTERRESTRICTED_EVENT","CHANNEL_UI_VRDISPLAYPOINTERUNRESTRICTED_EVENT","CHANNEL_UI_VRDISPLAYPRESENTCHANGE_EVENT","CHANNEL_UI_WAITING_EVENT","CHANNEL_UI_WEBGLCONTEXTCREATIONERROR_EVENT","CHANNEL_UI_WEBGLCONTEXTLOST_EVENT","CHANNEL_UI_WEBGLCONTEXTRESTORED_EVENT","CHANNEL_UI_WEBKITMOUSEFORCECHANGED_EVENT","CHANNEL_UI_WEBKITMOUSEFORCEDOWN_EVENT","CHANNEL_UI_WEBKITMOUSEFORCEUP_EVENT","CHANNEL_UI_WEBKITMOUSEFORCEWILLBEGIN_EVENT","CHANNEL_UI_WHEEL_EVENT"]}loadKeyStream(){const e=t.fromEvent(document,"keyup");this.keyPresses$=e.groupBy(e=>e.keyCode).mergeAll().filter(e=>this.keyCodeArr.indexOf(e.keyCode)>=0).repeat().subscribe(this.onKeyPressed.bind(this))}addKeyEvent(e){!1===this.keyEventsLoaded&&this.loadKeyStream(),this.keyEventsLoaded=!0,this.registerKey(e)}registerKey(e){this.keyCodeArr.push(e)}onKeyPressed(e){}static removeSSID(e){const t=Oe(["payload"]);return De(t,Ne(["vsid"]))(e)}onIncomingObservable(e){const t=T(e.name,this.props.name);e.data=po.removeSSID(e.data);const{payload:r,srcElement:n}=e.data,o=e=>({payload:r,srcElement:n,event:e});return!0===t?(e=>e.observable.pipe(vn(o)).subscribe(this.onUIEvent.bind(this)))(e):void 0}getActionState(e){const t=K(["event","type"]),r=K(["event","typeOverRide"]),n=d(He,V(r,t))(e),o="CHANNEL_UI";return void 0!==n?`${o}_${n}_EVENT`:o}static checkForEventMethods(e){const t=d(F(x(/^(event)([A-Z].*)([A-Z].*)$/gm)),A,v("payload"))(e);if(t.length>=1){const r=v("event",e);if(void 0!==r){const e=L(/^(event)([A-Z])(.*)([A-Z].*)$/gm,(e,t,r,n,o)=>String(r).toLowerCase()+n+o),n=t=>{const n=e(t);void 0!==r[n]&&"function"==typeof r[n]&&r[n]()};t.forEach(n)}}return e}onUIEvent(e){e.payload=function(e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}(e?.srcElement?.el?.dataset)??e.payload,po.checkForEventMethods(e),e.action=this.getActionState(e);const t=e.action,{payload:r,srcElement:n}=e,o=e.event;or(o?.target),this.sendChannelPayload(t,r,n,o)}}class No{constructor(){this.createDomObservableFromEvent=No.createDomObservableFromEvent.bind(this)}static createDomObservableFromEvent(t,r,n=!0,o=window){return r=void 0===r?e=>e:r,e(e=>o.addEventListener(t,e,{passive:n}),()=>{o[t]=e=>e}).pipe(vn(r))}static createMediaQuery(e){const t=window.matchMedia(e);return this.checkIfValidMediaQuery(t,e),!1!==t&&t}static checkIfValidMediaQuery(e,t){const r=e=>e.replace(/\s+/gm,""),n=void 0!==e.matches&&r(e.media).indexOf(r(t))>=0;return!1===n&&(t=>{console.warn(`Spyne Info: the following query string, "${t}", has been optimized to "${e.media}" by the browser and may not be a valid Media Query item!`)})(t),n}static createMediaQueryHandler(t,r){const n=(e=>t=>(t.mediaQueryName=e,t))(r),o=(s=t,{addHandler:e=>{s.addListener(e)},removeHandler:e=>{s.onchange=()=>{}}});var s;return new e(o.addHandler,o.removeHandler).pipe(vn(n))}static createMergedObsFromObj(e){const t=e.mediaQueries||e.mediaQueries,r=[];return ce((e,t,n)=>{const o=No.createMediaQuery(e);return!1!==o&&r.push(No.createMediaQueryHandler(o,t)),r},t),r}}const _o=[];class fo extends ho{constructor(e="CHANNEL_WINDOW"){super(e),this.bindStaticMethods(),this.currentScrollY=0}initializeStream(){this.domChannelConfig=ct.config.channels.WINDOW;const e=this.getActiveObservables(),t=l(...e);this.dom$=t,t.subscribe(e=>{const{action:t,payload:r,srcElement:n,event:o}=e;this.sendChannelPayload(t,r,n,o)})}static getMouseWheelMapFn(e){const t=this.channelActions.CHANNEL_WINDOW_WHEEL_EVENT,r=e.deltaY<=0?"up":"down",{deltaX:n,deltaY:o,deltaZ:s}=e;return{action:t,payload:{scrollDir:r,deltaX:n,deltaY:o,deltaZ:s},srcElement:e.srcElement,event:e}}static createCurriedGenericEvent(e){const t=`CHANNEL_WINDOW_${e.toUpperCase()}_EVENT`;return fe(fo.mapGenericEvent)(t)}static mapGenericEvent(e,t){return{action:e,payload:t,srcElement:t.srcElement,event:t}}static getResizeMapFn(e){return{action:this.channelActions.CHANNEL_WINDOW_RESIZE_EVENT,payload:ee(["innerWidth","innerHeight","outerWidth","outerHeight"],window),srcElement:e.srcElement,event:e}}static getOrientationMapFn(e){const t=this.channelActions.CHANNEL_WINDOW_ORIENTATION_EVENT,r=window.matchMedia("(orientation: portrait)").matches,n=ee(["innerWidth","innerHeight","outerWidth","outerHeight"],window);n.orientation=!0===r?"portrait":"landscape";return{action:t,payload:n,srcElement:e.srcElement,event:e}}getMediaQueryMapFn(e){return{action:this.channelActions.CHANNEL_WINDOW_MEDIA_QUERY_EVENT,payload:ee(["matches","media","mediaQueryName"],e),srcElement:e.srcElement,event:e}}createMouseWheelObservable(e){const t=e.debounceMSTimeForScroll;return No.createDomObservableFromEvent("wheel",fo.getMouseWheelMapFn.bind(this)).pipe(Vn(t))}static getScrollData(){let e=0;return t=>{const r=e-t;return e=t,{scrollY:t,scrollDistance:r,scrollDir:r>=0?"up":"down"}}}static getScrollY(e){return void 0!==e.pageYOffset?e.pageYOffset:e.scrollTop}static getScrollMapFn(e,t,r,n,o){const s=n(fo.getScrollY(o)),{scrollDistance:i}=s;return{action:r,payload:s,srcElement:e.srcElement,scrollDistance:i,event:e}}createScrollObservable(e,t=window,r=!0){const n=e.debounceMSTimeForScroll,o=t,s=t===window,i=void 0!==e.scrollElForVals?e.scrollElForVals:t,a=s?"CHANNEL_WINDOW_SCROLL_EVENT":"CHANNEL_WINDOW_ELEMENT_SCROLL_EVENT",c=fo.getScrollData(),l=Pe(fo.getScrollMapFn,[a,c,i,r,o]).bind(this);return No.createDomObservableFromEvent("scroll",l,r,o).pipe(Vn(n),(u=e=>0===e.scrollDistance,hr(function(e,t){var r=!1,n=0;e.subscribe(cn(t,function(e){return(r||(r=!u(e,n++)))&&t.next(e)}))})),vn(e=>{const t=fo.getScrollY(o);return e.payload.scrollDistanceAbs=Math.abs(this.currentScrollY-t),this.currentScrollY=t,e}));var u}createOrientationObservable(e){return No.createDomObservableFromEvent("orientationchange",fo.getOrientationMapFn.bind(this))}createResizeObservable(e){const t=e.debounceMSTimeForResize;return No.createDomObservableFromEvent("resize",fo.getResizeMapFn.bind(this)).pipe(Vn(t))}getEventsFromConfig(e=this.domChannelConfig){const t=e.events,r=Array.isArray(e.customEvents)?e.customEvents.map(fo.conformCustomEventConfig).filter(e=>null!==e):[];r.forEach(e=>this.updateChannelActions(e.name));const n=e=>{const t=fo.createCurriedGenericEvent(e);return No.createDomObservableFromEvent(e,t)};return D(n,t).concat(D(({name:e,operator:t,value:r})=>{const o=n(e);return void 0===t?o:fo.customizeCustomEventObservable(o,t,r)},r))}static conformCustomEventConfig(e){if("string"==typeof e)return{name:e,operator:void 0,value:void 0};if(null!==e&&"object"==typeof e&&"string"==typeof e.name){const t=["buffer","count","debounce","throttle"].filter(t=>void 0!==e[t]),r=t[0];return t.length>1&&!0===ct.debug&&console.warn(`Spyne Warning: the customEvent, ${e.name}, sets multiple operators (${t.join(", ")}); using ${r}.`),{name:e.name,operator:r,value:void 0!==r?e[r]:void 0}}return console.warn(`Spyne Warning: the following config.customEvents entry is not a string or a {name} object and was skipped: ${JSON.stringify(e)}`),null}static customizeCustomEventObservable(e,t,r){switch(t){case"buffer":return e.pipe((s=e.pipe(Vn(r)),hr(function(e,t){var r=[];return e.subscribe(cn(t,function(e){return r.push(e)},function(){t.next(r),t.complete()})),sn(s).subscribe(cn(t,function(){var e=r;r=[],t.next(e)},Vr)),function(){r=null}})),Mn(e=>e.length>0),vn(fo.mapBatchedEvents));case"count":return e.pipe((n=r,void 0===o&&(o=null),o=null!=o?o:n,hr(function(e,t){var r=[],s=0;e.subscribe(cn(t,function(e){var i,a,c,l,u=null;s++%o===0&&r.push([]);try{for(var d=fr(r),h=d.next();!h.done;h=d.next())(N=h.value).push(e),n<=N.length&&(u=null!=u?u:[]).push(N)}catch(e){i={error:e}}finally{try{h&&!h.done&&(a=d.return)&&a.call(d)}finally{if(i)throw i.error}}if(u)try{for(var E=fr(u),p=E.next();!p.done;p=E.next()){var N=p.value;Sr(r,N),t.next(N)}}catch(e){c={error:e}}finally{try{p&&!p.done&&(l=E.return)&&l.call(E)}finally{if(c)throw c.error}}},function(){var e,n;try{for(var o=fr(r),s=o.next();!s.done;s=o.next()){var i=s.value;t.next(i)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}t.complete()},void 0,function(){r=null}))})),vn(fo.mapBatchedEvents));case"debounce":return e.pipe(Vn(r));case"throttle":return e.pipe(jn(r));default:return e}var n,o,s}static mapBatchedEvents(e){const t=e[e.length-1],{action:r,srcElement:n,event:o}=t;return{action:r,payload:{detail:e.map(e=>void 0!==e.event&&null!==e.event?e.event.detail:void 0),isBatch:!0,batchCount:e.length},srcElement:n,event:o}}getActiveObservables(e=this.domChannelConfig){let t=[];e.listenForMediaQueries=vt(e.mediaQueries)||vt(e.mediaQueries);const r={listenForResize:this.createResizeObservable.bind(this),listenForOrientation:this.createOrientationObservable.bind(this),listenForScroll:this.createScrollObservable.bind(this),listenForWheel:this.createMouseWheelObservable.bind(this)};ce((r,n,o)=>{e[n]&&t.push(r(e))},r),this.checkForMediaQueries(e.listenForMediaQueries);const n=this.getEventsFromConfig(e);return t=t.concat(n),t}checkForMediaQueries(e){const t=e=>{const{action:t,payload:r,srcElement:n,event:o}=e;this.sendChannelPayload(t,r,n,o,this.observer$)};!0===e&&this.getMediaQueryObservable(this.domChannelConfig).subscribe(t)}getMediaQueryObservable(e){const t=this.createMergedObsFromObj(e);return ve(l,t).pipe(vn(this.getMediaQueryMapFn.bind(this)))}updateChannelActions(e){if("string"!=typeof e)return;const t=`CHANNEL_WINDOW_${e.toUpperCase()}_EVENT`;_o.push(t)}addRegisteredActions(){return["CHANNEL_WINDOW_ABORT_EVENT","CHANNEL_WINDOW_AFTERPRINT_EVENT","CHANNEL_WINDOW_ANIMATIONEND_EVENT","CHANNEL_WINDOW_ANIMATIONITERATION_EVENT","CHANNEL_WINDOW_ANIMATIONSTART_EVENT","CHANNEL_WINDOW_APPINSTALLED_EVENT","CHANNEL_WINDOW_BEFOREPRINT_EVENT","CHANNEL_WINDOW_BEFOREUNLOAD_EVENT","CHANNEL_WINDOW_BEGINEVENT_EVENT","CHANNEL_WINDOW_BLUR_EVENT","CHANNEL_WINDOW_CACHED_EVENT","CHANNEL_WINDOW_CHANGE_EVENT","CHANNEL_WINDOW_CLICK_EVENT","CHANNEL_WINDOW_CLOSE_EVENT","CHANNEL_WINDOW_COMPOSITIONEND_EVENT","CHANNEL_WINDOW_COMPOSITIONSTART_EVENT","CHANNEL_WINDOW_COMPOSITIONUPDATE_EVENT","CHANNEL_WINDOW_COPY_EVENT","CHANNEL_WINDOW_CUT_EVENT","CHANNEL_WINDOW_DBLCLICK_EVENT","CHANNEL_WINDOW_DEVICECHANGE_EVENT","CHANNEL_WINDOW_DEVICELIGHT_EVENT","CHANNEL_WINDOW_DEVICEMOTION_EVENT","CHANNEL_WINDOW_DEVICEORIENTATION_EVENT","CHANNEL_WINDOW_DEVICEPROXIMITY_EVENT","CHANNEL_WINDOW_DOMATTRIBUTENAMECHANGED_EVENT","CHANNEL_WINDOW_DOMATTRMODIFIED_EVENT","CHANNEL_WINDOW_DOMCHARACTERDATAMODIFIED_EVENT","CHANNEL_WINDOW_DOMCONTENTLOADED_EVENT","CHANNEL_WINDOW_DOMCONTENTLOADED_EVENT","CHANNEL_WINDOW_DOMELEMENTNAMECHANGED_EVENT","CHANNEL_WINDOW_DRAGEND_EVENT","CHANNEL_WINDOW_DRAGENTER_EVENT","CHANNEL_WINDOW_DRAGLEAVE_EVENT","CHANNEL_WINDOW_DRAGOVER_EVENT","CHANNEL_WINDOW_DRAGSTART_EVENT","CHANNEL_WINDOW_DRAG_EVENT","CHANNEL_WINDOW_DROP_EVENT","CHANNEL_WINDOW_ELEMENT_SCROLL_EVENT","CHANNEL_WINDOW_ERROR_EVENT","CHANNEL_WINDOW_FOCUSIN_EVENT","CHANNEL_WINDOW_FOCUS_EVENT","CHANNEL_WINDOW_FULLSCREENCHANGE_EVENT","CHANNEL_WINDOW_FULLSCREENERROR_EVENT","CHANNEL_WINDOW_HASHCHANGE_EVENT","CHANNEL_WINDOW_INPUT_EVENT","CHANNEL_WINDOW_INVALID_EVENT","CHANNEL_WINDOW_KEYDOWN_EVENT","CHANNEL_WINDOW_KEYPRESS_EVENT","CHANNEL_WINDOW_KEYUP_EVENT","CHANNEL_WINDOW_LOAD_EVENT","CHANNEL_WINDOW_MEDIA_QUERY_EVENT","CHANNEL_WINDOW_MESSAGE_EVENT","CHANNEL_WINDOW_MOUSEDOWN_EVENT","CHANNEL_WINDOW_MOUSEENTER_EVENT","CHANNEL_WINDOW_MOUSELEAVE_EVENT","CHANNEL_WINDOW_MOUSEMOVE_EVENT","CHANNEL_WINDOW_MOUSEOUT_EVENT","CHANNEL_WINDOW_MOUSEOVER_EVENT","CHANNEL_WINDOW_MOUSEUP_EVENT","CHANNEL_WINDOW_MOUSEWHEEL_EVENT","CHANNEL_WINDOW_OFFLINE_EVENT","CHANNEL_WINDOW_ONLINE_EVENT","CHANNEL_WINDOW_OPEN_EVENT","CHANNEL_WINDOW_ORIENTATION_EVENT","CHANNEL_WINDOW_PAGEHIDE_EVENT","CHANNEL_WINDOW_PAGESHOW_EVENT","CHANNEL_WINDOW_PASTE_EVENT","CHANNEL_WINDOW_POPSTATE_EVENT","CHANNEL_WINDOW_POPSTATE_EVENT","CHANNEL_WINDOW_PROGRESSEVENTS_EVENT","CHANNEL_WINDOW_RESET_EVENT","CHANNEL_WINDOW_RESIZE_EVENT","CHANNEL_WINDOW_SCROLL_ELEMENT_ADDED_EVENT","CHANNEL_WINDOW_SCROLL_EVENT","CHANNEL_WINDOW_SCROLL_LOCK_EVENT",["CHANNEL_WINDOW_SCROLL_LOCK_EVENT","onScrollLockEvent"],["CHANNEL_WINDOW_SET_ELEMENT_TO_SCROLL_EVENT","onSetElementToScroll"],"CHANNEL_WINDOW_STORAGE_EVENT","CHANNEL_WINDOW_SUBMIT_EVENT","CHANNEL_WINDOW_TRANSITIONCANCEL_EVENT","CHANNEL_WINDOW_TRANSITIONEND_EVENT","CHANNEL_WINDOW_TRANSITIONRUN_EVENT","CHANNEL_WINDOW_TRANSITIONSTART_EVENT","CHANNEL_WINDOW_UNLOAD_EVENT","CHANNEL_WINDOW_WHEEL_EVENT"].concat(_o)}onScrollLockEvent(e){}onSetElementToScroll(e){let{config:t,el:r,scrollElement:n}=e.payload;t=t||{},t=Ye(this.domChannelConfig,t),n=n||r;this.sendChannelPayload("CHANNEL_WINDOW_SCROLL_ELEMENT_ADDED_EVENT",{el:r},r),this.createScrollObservable(t,n).subscribe(e=>{const{action:t,payload:r,srcElement:n,event:o}=e;this.sendChannelPayload(t,r,n,o)})}bindStaticMethods(){this.createMediaQueryHandler=No.createMediaQueryHandler.bind(this),this.createMergedObsFromObj=No.createMergedObsFromObj.bind(this)}}class mo extends ho{constructor(e={}){super("CHANNEL_LIFECYCLE",e)}addRegisteredActions(){return["CHANNEL_LIFECYCLE_RENDERED_EVENT","CHANNEL_LIFECYCLE_DISPOSED_EVENT"]}onViewStreamInfo(e){const{action:t,srcElement:r}=e,n=r;n.action=t,this.onSendEvent(t,n)}onSendEvent(e,t={}){const r=this.channelActions[e],n={};window.setTimeout(()=>this.sendChannelPayload(r,t,n,void 0),0)}}class To extends ho{constructor(e={}){super("CHANNEL_AI",e)}addRegisteredActions(){return["CHANNEL_AI_RENDERED_EVENT","CHANNEL_AI_DISPOSED_EVENT"]}onViewStreamInfo(e){const{action:t,srcElement:r}=e,n=r;n.action=t,this.onSendEvent(t,n)}onSendEvent(e,t={}){const r=this.channelActions[e],n={};window.setTimeout(()=>this.sendChannelPayload(r,t,n,void 0),0)}}class Ao extends ho{constructor(e,t={}){t.isProxy=!0,super(e,t),this.props=t,this.subject$=new r,this.replaySub$=new i(1),this.observer$=l(this.subject$,this.replaySub$);!0===ct.debug&&this.checkIfChannelIsStillProxy(e)}getMergedSubject(e=!1){return!0===e?this.replaySub$:this.subject$}checkIfChannelIsStillProxy(e){const t=e;Ct(()=>{!0!==X(t,ct.listRegisteredChannels())&&console.warn(`Spyne Warning: The channel, ${t} does not appear to be registered!`)},1e3)}get replaySubject(){return this.replaySub$}get subject(){return this.subject$}}const yo=new Map;class Co{constructor(){this.addMixins(),yo.set("DISPATCHER",new r),this.listRegisteredChannels=Co.listRegisteredChannels.bind(this),this.getChannelsList=Co.getChannelsList.bind(this)}get map(){return yo}static getChannelsList(){return Array.from(yo,(e,t)=>({key:e[0],val:e[1].constructor.name}))}static listRegisteredChannels(e=!1){const t=this.getChannelsList(),r=m(U("ChannelProxy","val")),n=F(U("ChannelProxy","val")),o=(!0===e?n:r)(t);return Ve(["key"],o)}listProxyChannels(){return this.listRegisteredChannels(!0)}checkForMissingChannels(){const e=this.getChannelsList(),t=F(U("ChannelProxy","val"))(e);if(t.length>=1){const e=`Spyne Warning: The following ${1===t.length?"Channel has":"Channels have"} not been initialized: ${d(S(", "),D(v("key")))(t)}`;console.warn(e)}}init(){this.createMainStreams()}createMainStreams(){this.routeStream=new Eo,yo.set("CHANNEL_ROUTE",this.routeStream),this.uiStream=new po,yo.set("CHANNEL_UI",this.uiStream),this.domStream=new fo,yo.set("CHANNEL_WINDOW",this.domStream),this.viewStreamLifecycle=new mo,yo.set("CHANNEL_LIFECYCLE",this.viewStreamLifecycle),this.aiStream=new To,yo.set("CHANNEL_AI",this.aiStream),this.routeStream.initializeStream(),this.domStream.initializeStream()}addKeyEvent(e){yo.get("UI").addKeyEvent(e)}registerStream(e){const t=e.channelName;if(yo.has(t)){if(d(Ue(["props","isRegistered"],!0))(yo.get(t)))return void console.warn(`Spyne Warning: The Channel, ${t}, has already been registered!`)}yo.set(t,e),e.initializeStream()}getChannelActions(e){return yo.get(e).addRegisteredActions()}getProxySubject(e,t=!1){const r=!0===t?"replaySubject":"subject";return yo.get(e)[r]}testStream(e){return void 0!==yo.get(e)}getStream(e){return!1===this.testStream(e)&&yo.set(e,new Ao(e)),yo.get(e)}addMixins(){}}class go{constructor(e,t="",r=!0){return this.parentContext=e,this.omittedMethods=["autoBinder","initAutoBinder","getEnhancerMethods","checkForMalformedMethods","caller","arguments","bindParentViewStream"],this.prefix=t,!0===r&&this.autoBinder(),this.allMethodsList}initAutoBinder(){this.autoBinder()}getEnhancerMethods(){return function(e,t=[]){const r=P(["length","name","prototype","constructor"],t),n=d(ae(r),q),o=n(Object.getOwnPropertyNames(e.constructor.prototype)),s=n(Object.getOwnPropertyNames(e.constructor));return{methods:o,staticMethods:s,allMethods:P(o,s)}}(this,this.omittedMethods)}checkForMalformedMethods(e){const t=ct?.debug||!1;if(""===this.prefix&&t)return void console.warn(`SPYNE WARNING: The following SpyneTrait ${this.constructor.name} needs a prefix`);const r=m(e=>0===e.indexOf(this.prefix),e);if(r.length>=1&&t){const e=`Spyne Warning: The following method(s) in ${this.constructor.name} require the prefix, "${this.prefix}": [${r.join(", ")}];`;console.warn(e)}}bindParentViewStream(e,t){this.checkForMalformedMethods(e.allMethods);const r={},n=(e,n=!1)=>{const o=!0===n?this.constructor:this;"function"===typeof o[e]&&(r[e]=t[e]=o[e].bind(t))},o=we(2,n)(I,!0);return D(o,e.staticMethods),D(n,e.methods),r}autoBinder(){const e=this.getEnhancerMethods();return this.allMethodsList=this.bindParentViewStream(e,this.parentContext),this.allMethodsList}}class vo{constructor(e={},t,r,n){this._mapFn=vo.setMapFn(e),this._url=vo.setUrl(e),this._responseType=vo.setResponseType(e),this._serverOptions=vo.setServerOptions(e),this._subscriber=void 0!==t?t:e=>console.log("FETCH RETURNED ",e),this.debug=!0===e?.debug,this.disableSanitize=!0===e?.disableSanitize,this.channelName=n;const o={mapFn:this.mapFn,url:this.url,serverOptions:this.serverOptions,responseType:this.responseType,disableSanitize:this.disableSanitize,debug:this.debug};!0!==r&&vo.startWindowFetch(o,this._subscriber,this.channelName)}static startWindowFetch(e,t,r){const{mapFn:n,url:o,serverOptions:i,responseType:a,debug:c}=e,l={channelName:r,url:o,responseType:a,serverOptions:i},d=kn(!0===c?e=>{console.log("DEBUG FETCH :",e,l)}:()=>{}),h=u(window.fetch(o,i)).pipe(On(e=>u(vo.parseResponse(e,l))),d,vn((E=n,t=>{const r=!0===e?.disableSanitize?t:rr(t,{mode:"app"});return E(r,l)})),Tn(e=>s(vo.createFetchErrorPayload(e,l))),function(e){void 0===e&&(e={});var t=e.connector,r=void 0===t?function(){return new Hn}:t,n=e.resetOnError,o=void 0===n||n,s=e.resetOnComplete,i=void 0===s||s,a=e.resetOnRefCountZero,c=void 0===a||a;return function(e){var t,n,s,a=0,l=!1,u=!1,d=function(){null==n||n.unsubscribe(),n=void 0},h=function(){d(),t=s=void 0,l=u=!1},E=function(){var e=t;h(),null==e||e.unsubscribe()};return hr(function(e,p){a++,u||l||d();var N=s=null!=s?s:r();p.add(function(){0!==--a||u||l||(n=Fn(E,c))}),N.subscribe(p),!t&&a>0&&(t=new jr({next:function(e){return N.next(e)},error:function(e){u=!0,d(),n=Fn(h,o,e),N.error(e)},complete:function(){l=!0,d(),n=Fn(h,i),N.complete()}}),sn(e).subscribe(t))})(e)}}());var E;h.subscribe(t)}static async parseResponse(e,t){const{responseType:r}=t,n=e.status,o=e.statusText,s=e.headers?.get?.("content-type")||"",i={...t,status:n,statusText:o,contentType:s,ok:e.ok};if(!0!==e.ok){const t=await vo.safeReadText(e);throw vo.createFetchError({errorType:"FETCH_HTTP_ERROR",message:`Fetch request failed with status ${n} ${o}`,metadata:i,rawBody:t})}if("json"===r)return vo.parseJsonResponse(e,i);if("text"===r)return e.text();if("blob"===r)return e.blob();if("arrayBuffer"===r)return e.arrayBuffer();if("formData"===r)return e.formData();throw vo.createFetchError({errorType:"FETCH_UNSUPPORTED_RESPONSE_TYPE",message:`Unsupported fetch responseType "${r}"`,metadata:i})}static async parseJsonResponse(e,t){const r=await e.text(),n=r.trim();if(""===n)return null;try{return JSON.parse(n)}catch(e){throw vo.createFetchError({errorType:"FETCH_RESPONSE_PARSE_ERROR",message:"Expected JSON but could not parse response body.",metadata:t,rawBody:r,originalError:e})}}static createFetchError({errorType:e,message:t,metadata:r,rawBody:n="",originalError:o}){const s=new Error(t);return s.isChannelFetchError=!0,s.errorType=e,s.metadata=r,s.rawBody=n,s.originalError=o,s}static createFetchErrorPayload(e,t){const r=e?.metadata||t||{};return{isChannelFetchError:!0,isError:!0,error:!0,errorType:e?.errorType||"FETCH_UNKNOWN_ERROR",message:e?.message||"Unknown ChannelFetchUtil error",channelName:r.channelName,url:r.url,responseType:r.responseType,status:r.status,statusText:r.statusText,contentType:r.contentType,ok:r.ok,rawBodyPreview:vo.truncateBody(e?.rawBody),originalErrorMessage:e?.originalError?.message}}static truncateBody(e="",t=500){return"string"!=typeof e?"":e.length>t?`${e.slice(0,t)}...`:e}static async safeReadText(e){try{return await e.text()}catch(e){return""}}static setMapFn(e){return d(k(e=>e),v("mapFn"))(e)}static setUrl(e){const t=v("url",e);return void 0===t&&bt("SPYNE WARNING: URL is undefined for data channel"),t}static setResponseType(e){return k("json",v("responseType",e))}get mapFn(){return this._mapFn}get url(){return this._url}get serverOptions(){return this._serverOptions}get responseType(){return this._responseType}static stringifyBodyIfItExists(e){const t=e?.body;if(!0!==(null!==t&&"object"==typeof t&&t.constructor===Object))return e;const r=new Headers(e.headers||{});return!0!==r.has("Content-Type")&&r.set("Content-Type","application/json"),{...e,headers:r,body:JSON.stringify(t)}}static updateMethodWhenBodyExists(e){return void 0!==e?.body&&"GET"===(e?.method||"GET").toUpperCase()?(bt("SPYNE WARNING: Fetch body was provided with method GET. Changing method to POST.",e),{...e,method:"POST"}):e}static setServerOptions(e){const t=ee(["method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive"],e);let r=te(vo.baseOptions(),t);return r=vo.updateMethodWhenBodyExists(r),r=vo.stringifyBodyIfItExists(r),r}static baseOptions(){return{method:"GET",headers:new Headers({Accept:"application/json, text/plain, */*"}),mode:"cors",credentials:"same-origin",cache:"default",redirect:"follow",referrerPolicy:"no-referrer-when-downgrade",integrity:"",keepalive:!1}}}class bo extends ho{constructor(e,t={disableSanitize:!1}){bo.validateMapMethod(t,e),void 0!==t.map&&(t.mapFn=t.map),t.extendedActionsArr=[`${e}_RESPONSE_EVENT`,`${e}_ERROR_EVENT`,[`${e}_REQUEST_EVENT`,"onFetchUpdate"]],t.sendCachedPayload=!0,super(e,t)}static validateMapMethod(e,t,r=!1){const n=V(_,e=>"function"!=typeof e),o=Ae(n),s=f([o,e=>e.length>=1]);return!d(s,N,ee(["map","mapFn"]))(e)||(!1===r&&console.warn(`Spyne Warning: The map method for ChannelFetch, ${t}, appears to be invalid`),!1)}onRegistered(e=this.props){!0!==e?.pause&&this.startFetch()}addRegisteredActions(e){const t=d(k([]),K(["props","extendedActionsArr"]));return["CHANNEL_RESPONSE_EVENT","CHANNEL_ERROR_EVENT",["CHANNEL_UPDATE_RESPONSE_EVENT","onFetchUpdate"],["CHANNEL_FETCH_REQUEST_EVENT","onFetchUpdate"]].concat(t(this))}startFetch(e={},t=this.onFetchReturned.bind(this)){const r=this.consolidateAllFetchProps(e);return new vo(r,t,!1,this.props.name)}onFetchUpdate(e){const t=this.getPropsForFetch(e);this.startFetch(t)}onFetchReturned(e){const t=!0===e?.isChannelFetchError?`${this.props.name}_ERROR_EVENT`:`${this.props.name}_RESPONSE_EVENT`;return this.createChannelPayloadItem(e,t)}createChannelPayloadItem(e,t=`${this.props.name}_RESPONSE_EVENT`){const{name:r,sendCachedPayload:n,url:o}=this.props,s={name:r,sendCachedPayload:n,url:o};this.sendChannelPayload(t,e,s)}getPropsForFetch(e){return ee(["mapFn","url","header","body","mode","method","responseType","debug"],e?.payload??e?.viewStreamInfo?.payload??{})}consolidateAllFetchProps(e,t=this.props){const r=ee(["mapFn","url","header","body","mode","disableSanitize","method","responseType","debug"],t),n=m(_);return d(n,(e,t)=>te(e,t))(r,e)}get observer(){return this.observer$}}let Io=ct;class So{constructor(e={}){let{name:t,config:r,parentEl:n}=e;this.props=e,void 0===r&&(r=re(e)),this.name=t||"empty",this.props.name=t,r=So.mergeDefaultConfig(r,this.defaultConfig()),this.props.parentEl=n||So.createParentEl(),this.props.config=r,void 0!==this.props.traits&&this.addTraits(this.props.traits)}register(e){Io=e,this.props.pluginName=this.props.name,!1!==Io.initialized?(this.onBeforeRegistered(),this.props.config=re(this.props.config),Io.addPluginConfig(this.name,this.props.config),this.onRegistered(),this.onRender()):console.warn(`Spyne Warning: SpyneApp has not been initialized yet! Cannot register plugin "${this.name}".`)}get SpyneAppProperties(){return Io}static mergeDefaultConfig(e={},t=this.defaultConfig()){return Object.assign(t,e)}static getSpyneApp(e,t){!1===Io.initialized?console.warn(`Spyne Warning: Unable to install plugin, ${e}! SpyneApp has not been initialized!`):Io.addPluginConfig(e,t)}static updateSpyneConfig(e,t,r){return!0===xe(C(Object),["config","plugins",t])(e)?(!0===e.config.debug&&console.warn(`Spyne Warning: The plugin, ${t}, already exists`),!1):(e.config.plugins[t]=r,e.config.plugins[t])}static createParentEl(e){return e||document.getElementById("spyne-plugins")||(()=>{const e=new lr({id:"spyne-plugins"});document.body.appendChild(e.render());const t=document.getElementById("spyne-plugins");return t.style.cssText="position:absolute; top:0;left:0;width:100%;height:100%;min-height:100vh;z-index:1000000; pointer-events:none",t})()}addTraits(e){"Array"!==e.constructor.name&&(e=[e]);e.forEach(e=>new e(this))}onBeforeRegistered(){this.checkForRequiredWindowEvent()}checkForRequiredWindowEvent(){const e=this.props.requiredEvents??[],t=this.props.requiredCustomEvents??[],r=ct.getChannelConfig("WINDOW"),n=e.filter(e=>!r.events.includes(e)),o=e=>"string"==typeof e?e:e?.name,s=r.customEvents.map(o),i=t.filter(e=>!s.includes(o(e)));if(n.length>0&&console.warn(`plugin "${this.props.name}" requires the following config.WINDOW.events, --\x3e ${n.join(", ")} <--`),i.length>0){const e=e=>"string"==typeof e?`'${e}'`:JSON.stringify(e);console.warn(`plugin "${this.props.name}" requires the following config.WINDOW.customEvents, --\x3e ${i.map(e).join(", ")} <--`)}}defaultConfig(){return{}}onRegistered(){}onRender(){}}const Lo=new Co,Oo="0.26.0";let Do=new class{constructor(){this.version=Oo}get channels(){return Lo}init(e={},t=!1){
|
|
2
2
|
/*!
|
|
3
|
-
* Spyne 0.
|
|
3
|
+
* Spyne 0.26.0
|
|
4
4
|
* https://spynejs.org
|
|
5
5
|
*
|
|
6
6
|
* @license
|
|
@@ -14,5 +14,5 @@ import{fromEventPattern as e,Observable as t,Subject as r,bindCallback as n,from
|
|
|
14
14
|
*
|
|
15
15
|
* This notice may not be removed or altered from any distribution.
|
|
16
16
|
*/
|
|
17
|
-
if(!0===
|
|
17
|
+
if(!0===ct.initialized)return t?"The Spyne Application has already been initialized!":void console.warn("The Spyne Application has already been initialized!");let r={scrollLock:!1,scrollLockX:31,scrollLockY:0,debug:!1,strict:!1,mode:"app",disableSanitize:!1,iframes:{},anchors:{},customElements:[],baseHref:void 0,IMG_PATH:"undefined"!=typeof IMG_PATH?IMG_PATH:void 0,pluginMethods:{},plugins:{},tmp:{},ephemeralProps:{},tmpProps:{},channels:{WINDOW:{mediaQueries:{},events:[],customEvents:[],listenForResize:!0,listenForOrientation:!0,listenForScroll:!1,listenForMouseWheel:!1,listenForWheel:!1,debounceMSTimeForResize:200,debounceMSTimeForScroll:150},ROUTE:{type:"slash",isHash:!1,isHidden:!1,add404s:!1,routes:{routePath:{routeName:"change"}}}}};if(void 0!==e){const t=Fe;e=ct.initialize(r,e,Lo,t)}this.pluginsFn=ct.getPluginsMethodObj(e.pluginMethods),this.getChannelActions=e=>Lo.getChannelActions(e),this.registerChannel=e=>Lo.registerStream(e),this.registerPlugin=e=>ct.registerPlugin(e),this.registerDataChannel=e=>Lo.registerStream(e),this.listChannels=()=>Array.from(Lo.map.keys());let n=new lo({id:"spyne-null-views"});n.appendToDom(document.body),n.props.el.style.cssText="display:none; opacity:0; pointer-events:none;",Lo.init(),!0===ct.config.debug&&(window.Spyne={version:Oo}),((e={})=>{if(ir)return void bt("sanitizeHTML is already configured. Reconfiguration is not allowed.");const{strict:t=!1,mode:r="app",disableSanitize:n=!1,allowTargetAttr:o=!0,debug:s=!1,iframes:i={},anchors:a={}}=e;if(!0===n)return console.warn("SPYNE SECURITY WARNING: All HTML sanitization is DISABLED via config.disableSanitize. Do not use this setting in production."),sr=e=>e,void(ir=!0);const c=["richtext","authoring","development"].includes(r),l=void 0!==i.allow?!0===i.allow:c,u={RETURN_TRUSTED_TYPE:!1,ADD_TAGS:[...l?["iframe"]:[],...c?["link"]:[]],ADD_ATTR:[...(void 0!==a.allowTarget?!0===a.allowTarget:!0===o)?["target","rel"]:[],...l?["sandbox"]:[]],CUSTOM_ELEMENT_HANDLING:Ut,...!0!==l&&c?{FORBID_TAGS:["iframe"]}:{}},d=e=>Me.sanitize(e,u);if(sr=d,!0===t&&window.trustedTypes)try{const e=window.trustedTypes.createPolicy("default",{createHTML:e=>d(e)});sr=t=>e.createHTML(t),!0===s&&console.log("SPYNE: Trusted Types default policy registered. Note that browser enforcement additionally requires the CSP header: require-trusted-types-for 'script'.")}catch(e){bt('SPYNE WARNING: A Trusted Types "default" policy already exists on this page. Falling back to direct sanitization.',e)}ir=!0})(ct.config),tr(ct.config)}static listChannels(){return Array.from(Lo.map.keys())}static getChannelActions(e){return Lo.getChannelActions(e)}static registerChannel(e){if(!1!==ct.initialized)return Lo.registerStream(e);console.warn("Spyne has not been initialized")}};export{ho as Channel,bo as ChannelFetch,vo as ChannelFetchUtil,At as ChannelPayload,ro as ChannelPayloadFilter,Co as ChannelsMap,lr as DomElement,cr as DomElementTemplate,Do as SpyneApp,ct as SpyneAppProperties,So as SpynePlugin,go as SpyneTrait,lo as ViewStream,qn as ViewStreamBroadcaster,zn as ViewStreamElement,Yn as ViewStreamPayload,co as ViewStreamSelector,Vt as allowCustomElements,Ye as deepMerge,ft as safeAugment,mt as safeClone,ht as safeCloneDeep,pt as safeFilter,_t as safeMap,Nt as safeReject,rr as sanitizeData,or as sanitizeEventTarget,It as setSpyneWarningsDisabled};
|
|
18
18
|
//# sourceMappingURL=spyne.esm.js.map
|