@supersoniks/concorde 2.0.3 → 2.0.5
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/cli.js +0 -0
- package/concorde-core.bundle.js +3 -3
- package/concorde-core.es.js +11 -12
- package/core/components/functional/queue/queue.js +5 -0
- package/core/components/functional/router/router.js +2 -2
- package/core/core.d.ts +1 -0
- package/core/core.js +1 -0
- package/core/decorators/Subscriber.d.ts +1 -1
- package/core/decorators/Subscriber.js +2 -2
- package/core/utils/PublisherProxy.js +13 -11
- package/core/utils/url-pattern.d.ts +2 -0
- package/core/utils/url-pattern.js +2 -0
- package/package.json +6 -2
package/cli.js
CHANGED
|
File without changes
|
package/concorde-core.bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){var t,e;let s=class t{static getLanguage(){const t=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||t}static getCookies(){return document.cookie.split(";").reduce(((t,e)=>{const s=e.indexOf("=");return t[e.substring(0,s).trim()]=e.substring(s+1),t}),{})}static everyAncestors(t,e){for(;t;){if(!e(t))return;t=t.parentNode||t.host}}static getAncestorAttributeValue(t,e){if(!t)return null;for(;!("hasAttribute"in t)||!t.hasAttribute(e);){if(!(t.parentNode||t.host))break;t=t.parentNode||t.host}return"hasAttribute"in t?t.getAttribute(e):null}static getApiConfiguration(e){const s=t.getAncestorAttributeValue(e,"token"),i=null!=t.getAncestorAttributeValue(e,"addHTTPResponse"),r=t.getAncestorAttributeValue(e,"serviceURL");let o=null,n=null;const a=t.getAncestorAttributeValue(e,"tokenProvider"),l=t.getAncestorAttributeValue(e,"eventsApiToken");s||(o=t.getAncestorAttributeValue(e,"userName"),n=t.getAncestorAttributeValue(e,"password"));return{serviceURL:r,token:s,userName:o,password:n,authToken:l,tokenProvider:a,addHTTPResponse:i,credentials:t.getAncestorAttributeValue(e,"credentials")||void 0,cache:e.getAttribute("cache"),blockUntilDone:e.hasAttribute("blockUntilDone")}}static getClosestElement(t,e){for(;!t.nodeName||t.nodeName.toLowerCase()!==e;){if(!(t.parentNode||t.host))break;t=t.parentNode||t.host}return t.nodeName?t:null}static getClosestForm(e){return t.getClosestElement(e,"form")}static async loadJS(t){return new Promise((async e=>{const s=document.createElement("script");s.src=t,s.onload=()=>e(!0),s.onerror=()=>e(!0),document.head.appendChild(s)}))}static async loadCSS(t){return new Promise((async e=>{const s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=t,s.onload=()=>e(!0),s.onerror=()=>e(!0),document.head.appendChild(s)}))}},i=class{static ucFirst(t){return"string"!=typeof t?t:t.charAt(0).toUpperCase()+t.substring(1)}static minutesDuration(t,e="",i="long"){e||(e=s.getLanguage());function r(t,e,s){return Intl.NumberFormat(t,{style:"unit",unit:e,unitDisplay:s}).format}const[o,n]=(a=t,l=60,[Math.floor(a/l),a%l]);var a,l;const c=[];return o&&c.push(r(e,"hour",i)(o)),n&&c.push(r(e,"minute",i)(n)),new Intl.ListFormat(e,{style:"long",type:"conjunction"}).format(c)}static js(t){try{return Function("return "+t)()}catch(e){return""}}};function r(t){return"object"==typeof t&&null!=t}const o=class t{constructor(t,e){for(this._proxies_=new Map,this._is_savable_=!1,this._invalidateListeners_=new Set,this._assignListeners_=new Set,this._mutationListeners_=new Set,this._fillListeners_=new Set,this._templateFillListeners_=new Set,this._lockInternalMutationPublishing_=!1,this._instanceCounter_=0,this._assignmentId_=0,this._value_=t,this.parent=e||null,this.root=this,this._instanceCounter_=0;this.root.parent;)this.root=this.root.parent}delete(){for(const t of this._proxies_.values())t.delete();this._invalidateListeners_.clear(),this._assignListeners_.clear(),this._mutationListeners_.clear(),this._fillListeners_.clear(),this._templateFillListeners_.clear(),this._proxies_.clear(),t.instances.delete(this._instanceCounter_)}hasListener(){return this._templateFillListeners_.size>0||this._assignListeners_.size>0||this._invalidateListeners_.size>0||this._mutationListeners_.size>0||this._fillListeners_.size>0}_publishInternalMutation_(t=!1){if(this._mutationListeners_.forEach((t=>t())),this._is_savable_&&!l.changed){l.changed=!0,l.saveId++;const t=l.saveId;setTimeout((()=>l.getInstance().saveToLocalStorage(t)),1e3)}t||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(t=!1){this._assignmentId_++;const e=this._assignmentId_;if(await(async()=>new Promise((t=>{window.queueMicrotask((()=>t(null)))})))(),e!==this._assignmentId_)return;const s=this.get();this._assignListeners_.forEach((t=>t(s))),this._publishInternalMutation_(t)}_publishInvalidation_(){this._invalidateListeners_.forEach((t=>t()))}_publishDynamicFilling_(t,e){this._fillListeners_.forEach((s=>{s[t]!==e&&(s[t]=e)})),this._publishTemplateFilling_(t,e)}_publishTemplateFilling_(t,e){this._templateFillListeners_.forEach((s=>{const i=Object.getOwnPropertyDescriptor(s,t);(!i||i.set||i.writable)&&(s.propertyMap&&s.propertyMap[t]&&(t=s.propertyMap[t]),void 0!==s[t]&&s[t]!==e&&(s[t]=e))}))}onAssign(t,e=!0){"function"==typeof t&&(this._assignListeners_.has(t)||(this._assignListeners_.add(t),e&&t(this.get())))}offAssign(t){this._assignListeners_.delete(t)}onInvalidate(t){"function"==typeof t&&this._invalidateListeners_.add(t)}offInvalidate(t){"function"==typeof t&&this._invalidateListeners_.delete(t)}invalidate(){this._publishInvalidation_()}onInternalMutation(t){"function"==typeof t&&(this._mutationListeners_.add(t),t())}offInternalMutation(t){"function"==typeof t&&this._mutationListeners_.delete(t)}startTemplateFilling(t){if(this._templateFillListeners_.add(t),"object"==typeof this._value_)for(const e in this._value_){let s=e;const i=this._value_[e];t.propertyMap&&t.propertyMap[e]&&(s=t.propertyMap[e]),void 0!==t[e]&&t[e]!==i&&(t[s]=i)}}stopTemplateFilling(t){this._templateFillListeners_.delete(t)}startDynamicFilling(t){this._fillListeners_.add(t);for(const e in this._value_){const s=this._value_[e];t[e]!==s&&(t[e]=s)}}stopDynamicFilling(t){this._fillListeners_.delete(t)}async set(t,e=!1){var s;if(this._value_===t)return!0;if(this._value_&&Object.prototype.hasOwnProperty.call(this._value_,"__value")&&Object.prototype.hasOwnProperty.call(t,"__value")&&this._value_.__value===t.__value)return!0;const i=this._value_;this._value_=r(t)?t:{__value:t},this._cachedGet_=void 0;if(Object.prototype.hasOwnProperty.call(this._value_,"__value"))return await this._publishAssignement_(e),!0;for(const r in this._value_)void 0===this._value_[r]&&delete this._value_[r];if(this._proxies_.forEach(((t,e)=>{void 0===this._value_[e]&&((null==t?void 0:t.hasListener())?"_parent_"!=e&&i[e]&&(this._value_[e]=null):this._proxies_.delete(e))})),await this._publishAssignement_(),r(this._value_))for(const o in this._value_){const e=t[o],i=r(e)?e:{__value:e};this._proxies_.has(o)?(await(null==(s=this._proxies_.get(o))?void 0:s.set(i,!0)),this._publishDynamicFilling_(o,e)):this._publishDynamicFilling_(o,e)}return!0}get(){if(void 0!==this._cachedGet_)return this._cachedGet_;if(l.modifiedCollectore.length>0&&l.modifiedCollectore[0].add(this),Object.prototype.hasOwnProperty.call(this._value_,"__value")){const t=this._value_.__value;return this._cachedGet_=null!=t?t:null}return this._cachedGet_=this._value_}get $tag(){this._instanceCounter_||(t.instancesCounter++,this._instanceCounter_=t.instancesCounter),t.instances.set(this._instanceCounter_,this);return'<reactive-publisher-proxy publisher="'+this._instanceCounter_+'"></reactive-publisher-proxy>'}};o.instances=new Map,o.instancesCounter=0;let n=o;const a=class t{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],null!=t.instance)throw"Singleton / use getInstance";t.instance=this,this.isLocalStrorageReady=this.cleanStorageData()}async cleanStorageData(){return new Promise((t=>{(async()=>{try{let s=localStorage.getItem("publisher-proxies-data"),i=null;if(s&&(i=await this.decompress(s,"gzip")),i)try{this.localStorageData=JSON.parse(i)}catch(e){this.localStorageData={}}else s=await this.compress("{}","gzip"),localStorage.setItem("publisher-proxies-data",s),this.localStorageData={};const r=(new Date).getTime()-432e5;for(const t in this.localStorageData){this.localStorageData[t].lastModifiationMS<r&&delete this.localStorageData[t]}t(!0)}catch(e){window.requestAnimationFrame((()=>{t(!1)})),console.log("no publisher cache in this browser")}})()}))}static getInstance(){return null==t.instance?new t:t.instance}static get(e,s){return t.getInstance().get(e,s)}static collectModifiedPublisher(){t.modifiedCollectore.unshift(new Set)}static getModifiedPublishers(){return t.modifiedCollectore.shift()}static delete(e){return!!e&&t.getInstance().delete(e)}async setLocalData(t,e){var i;await this.isLocalStrorageReady,t.set((null==(i=this.localStorageData[e+"¤lang_"+s.getLanguage()])?void 0:i.data)||t.get())}get(t,e){const s="enabled"===(null==e?void 0:e.localStorageMode);if(!this.publishers.has(t)){const e=new h({});this.set(t,e)}const i=this.publishers.get(t);return s&&-1===this.initialisedData.indexOf(t)&&(i._is_savable_=!0,this.initialisedData.push(t),this.setLocalData(i,t)),this.publishers.get(t)}set(t,e){this.publishers.set(t,e)}delete(t){return!!this.publishers.has(t)&&(this.publishers.delete(t),!0)}async saveToLocalStorage(e=0){if(e===t.saveId||e%10==0)try{if(!t.changed||t.saving)return;t.saving=!0,t.changed=!1;const e=Array.from(this.publishers.keys());let i=!1;for(const t of e){const e=this.publishers.get(t);if(!(null==e?void 0:e._is_savable_))continue;const r=null==e?void 0:e.get();r&&(this.localStorageData[t+"¤lang_"+s.getLanguage()]={lastModifiationMS:(new Date).getTime(),data:r},i=!0)}if(i){const t=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem("publisher-proxies-data",t)}if(t.saving=!1,t.changed){t.saveId++;const e=t.saveId;setTimeout((()=>this.saveToLocalStorage(e)),1e3)}}catch(i){t.saving=!1}}async compress(t,e){const s=(new TextEncoder).encode(t),i=new window.CompressionStream(e),r=i.writable.getWriter();r.write(s),r.close();const o=await new Response(i.readable).arrayBuffer(),n=new Uint8Array(o);let a="";for(let l=0;l<n.length;l++)a+=String.fromCharCode(n[l]);return btoa(a)}async decompress(t,e){const s=atob(t),i=Uint8Array.from(s,(t=>t.charCodeAt(0))).buffer,r=new window.DecompressionStream(e),o=r.writable.getWriter();o.write(i),o.close();const n=await new Response(r.readable).arrayBuffer();return(new TextDecoder).decode(n)}};a.buildDate="Wed Apr 03 2024 13:58:47 GMT+0200 (Central European Summer Time)",a.changed=!1,a.saving=!1,a.saveId=0,a.instance=null,a.modifiedCollectore=[];let l=a;const c=new Set(["invalidate","onInvalidate","offInvalidate","onAssign","offAssign","startDynamicFilling","stopDynamicFilling","startTemplateFilling","stopTemplateFilling","onInternalMutation","offInternalMutation","set","get","$tag","_cachedGet_","_templateFillListeners_","_fillListeners_","_assignListeners_","_invalidateListeners_","_publishInternalMutation_","hasListener","delete","_mutationListeners_","_publishDynamicFilling_","_publishInvalidation_","_publishTemplateFilling_","_publishAssignement_","_proxies_","parent","_value_","_is_savable_","_lockInternalMutationPublishing_","_instanceCounter_","_assignmentId_"]);class h extends n{constructor(t,e=null){super(t,e);const s=new Proxy(this,{get:function(t,e){if(e==Symbol.toPrimitive)return()=>s.get();if(c.has(e))return t[e];if(!t._proxies_.has(e)){const i=t._value_[e],o=new h(r(i)?i:{__value:i},t);o._proxies_.set("_parent_",s),t._proxies_.set(e,o)}return t._proxies_.get(e)},set:function(t,e,i){var o;if("_value_"==e)return t._value_=i,!0;if("_cachedGet_"==e)return t._cachedGet_=i,!0;if("_assignmentId_"==e)return t._assignmentId_=i,!0;if("_is_savable_"==e)return t._is_savable_=i,!0;if("_instanceCounter_"==e)return t._instanceCounter_=i,!0;if(!t._proxies_.has(e)){const i=new h({},t);i._proxies_.set("_parent_",s),t._proxies_.set(e,i)}return t._value_[e]!==i&&(t._value_[e]=i,t._publishDynamicFilling_(e,i),null==(o=t._proxies_.get(e))||o.set(r(i)?i:{__value:i})),!0},deleteProperty:function(t,e){return t._publishDynamicFilling_(e,null),t._proxies_.delete(e),delete t._value_[e]},has:function(t,e){return e in t._value_&&"_lockInternalMutationPublishing_"!=e},defineProperty:function(t,e,s){return s&&"value"in s&&(t._value_[e]=s.value),!0},getOwnPropertyDescriptor:function(t,e){return{enumerable:!0,configurable:!0}},ownKeys:function(t){return t._value_.__value?Object.keys(t._value_.__value):Object.keys(t._value_)}});return s}toString(){return"hey"}valueOf(){return 2}getProperty(t,e){return t[e]}}"undefined"!=typeof module&&(module.exports={Publisher:h,PublisherManager:l});class d extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=t=>{this.innerHTML=t.toString()}}connectedCallback(){var t;this.publisherId=this.getAttribute("publisher")||"",this.publisher=n.instances.get(parseInt(this.publisherId)),null==(t=this.publisher)||t.onAssign(this.onAssign)}disconnectedCallback(){var t;null==(t=this.publisher)||t.offAssign(this.onAssign)}}customElements.define("reactive-publisher-proxy",d);const p=class t{static disable(){this.enabled&&(this.enabled=!1,Array.from(t.observedElements.keys()).forEach((e=>t.unObserve(e))))}static observe(e){if(!e)return;if(!t.enabled)return;if(t.observedElements.has(e))return;const s=new MutationObserver(t.onMutation),i={childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-bind"]};s.observe(e,i),e.querySelectorAll("[data-bind]").forEach((e=>t.addPublisherListeners(e))),t.observedElements.set(e,s)}static unObserve(e){if(!e)return;const s=this.observedElements.get(e);s&&(s.disconnect(),e.querySelectorAll("[data-bind]").forEach((e=>t.removePublisherListeners(e))))}static onAdded(e){e.hasAttribute&&e.hasAttribute("data-bind")&&t.addPublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach((e=>t.addPublisherListeners(e))):e.childNodes.forEach((e=>t.onAdded(e)))}static onRemoved(e){e.hasAttribute&&e.hasAttribute("data-bind")&&t.removePublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach((e=>t.removePublisherListeners(e))):e.childNodes.forEach((e=>t.onRemoved(e)))}static onMutation(e){for(const s of e)switch(s.type){case"attributes":t.addPublisherListeners(s.target);break;case"childList":s.addedNodes.forEach((e=>{t.onAdded(e)})),s.removedNodes.forEach((e=>{t.onRemoved(e)}))}}static removePublisherListeners(e){const s=t.publisherListeners.get(e);s&&(t.publisherListeners.delete(e),s.forEach((t=>{var e;null==(e=t.publisher)||e.offAssign(t.onAssign)})))}static getVariablesDescriptor(t){let e=t.match(/(\$(?:\w+\\?\.?)+)/g);return e=e?e.map((t=>t.replace("$",""))):[t],e=e.filter((t=>t.length>0)),{expression:t.replace("\\",""),variables:e.map((t=>t.split(/\b\.\b/).map((t=>t.replace("\\","")))))}}static getDataBindItems(e){return"attributes"in e?Array.from(e.attributes).filter((t=>0==t.name.indexOf("::"))).map((e=>({propertyToUpdate:e.name.substring(2).replace(/-((html)|\w)/g,(t=>t.substring(1).toUpperCase())),bindedVariablesDescriptor:t.getVariablesDescriptor(e.value)}))):[]}static getSubPublisher(t,e){if(!e)return t;for(const s of e)if("_self_"!=s){if(!t)return null;t=t[s]}return t}static addPublisherListeners(e){t.removePublisherListeners(e);const r=s.getAncestorAttributeValue(e.parentNode||e.host||e,"dataProvider");if(!r)return;const o=l.getInstance().get(r),n=t.getDataBindItems(e),a=[];n.forEach((s=>{const r=s.bindedVariablesDescriptor,n=s.propertyToUpdate;for(const l of r.variables){const s=l;let c=o;c=t.getSubPublisher(o,s);const h=e,d={publisher:c,onAssign:()=>{const e=r.variables.map((e=>{var s;return null==(s=t.getSubPublisher(o,e))?void 0:s.get()}));let s=r.expression,a=!1;if(1==e.length&&r.variables[0].join(".")==s.substring(1)){let t=e[0];return null===t&&(t=""),void(h[n]=t)}for(let t=0;t<e.length;t++){let i=e[t];const o=r.variables[t];null===i&&(a=!0,i=void 0),s=s.replace("$"+o.join("."),i)}if(-1!=s.indexOf("|")){const t=s.indexOf("|");if(0==t)s=i.js(s.substring(1));else{const e=s.substring(0,t),r=s.substring(t+1),o=i[e];s=a?"":o?o(r):s}}else s=a?"":s;h[n]=s}};null==c||c.onAssign(d.onAssign),a.push(d)}})),t.publisherListeners.set(e,a)}};p.observedElements=new Map,p.enabled=!0,p.publisherListeners=new Map;let u=p;u.observe(document.documentElement),window.SonicDataBindObserver||(window.SonicDataBindObserver=u);let g=class t{static shallowEqual(t,e,s=!0){const i=Object.keys(t),r=Object.keys(e);if(i.length!==r.length&&s)return!1;for(const o of i){const i=t[o],r=e[o];if(s?i!==r:i!=r)return!1}return!0}static deepEqual(e,s,i=!0){const r=Object.keys(e),o=Object.keys(s);if(r.length!==o.length&&i)return!1;for(const n of r){const r=e[n],o=s[n],a=t.isObject(r)&&t.isObject(o),l=i?r!==o:r!=o;if(a&&!t.deepEqual(r,o)||!a&&l)return!1}return!0}static isObject(t){return null!=t&&"object"==typeof t}static isUndefindOrNull(t){return null==t}static isEmpty(e){return!!t.isUndefindOrNull(e)||0===Object.keys(e).length}static traverse(e,s,i=!1){for(const r of s){const s=e[r];if(void 0===s)return;e=i&&t.isObject(s)?Object.assign(Array.isArray(s)?[]:{},e,s):e[r]}return e}static getURLSearchArray(e,s=""){let i=[];for(let r in e){const o=e[r];s&&(r=s+"["+r+"]"),t.isObject(o)?i=[...i,...this.getURLSearchArray(o,r)]:i.push(`${r}=${o}`)}return i}static getURLSearchString(e){return t.getURLSearchArray(e,"").join("&")}};
|
|
1
|
+
!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){var t,e;let s=class t{static getLanguage(){const t=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||t}static getCookies(){return document.cookie.split(";").reduce(((t,e)=>{const s=e.indexOf("=");return t[e.substring(0,s).trim()]=e.substring(s+1),t}),{})}static everyAncestors(t,e){for(;t;){if(!e(t))return;t=t.parentNode||t.host}}static getAncestorAttributeValue(t,e){if(!t)return null;for(;!("hasAttribute"in t)||!t.hasAttribute(e);){if(!(t.parentNode||t.host))break;t=t.parentNode||t.host}return"hasAttribute"in t?t.getAttribute(e):null}static getApiConfiguration(e){const s=t.getAncestorAttributeValue(e,"token"),i=null!=t.getAncestorAttributeValue(e,"addHTTPResponse"),r=t.getAncestorAttributeValue(e,"serviceURL");let o=null,n=null;const a=t.getAncestorAttributeValue(e,"tokenProvider"),l=t.getAncestorAttributeValue(e,"eventsApiToken");s||(o=t.getAncestorAttributeValue(e,"userName"),n=t.getAncestorAttributeValue(e,"password"));return{serviceURL:r,token:s,userName:o,password:n,authToken:l,tokenProvider:a,addHTTPResponse:i,credentials:t.getAncestorAttributeValue(e,"credentials")||void 0,cache:e.getAttribute("cache"),blockUntilDone:e.hasAttribute("blockUntilDone")}}static getClosestElement(t,e){for(;!t.nodeName||t.nodeName.toLowerCase()!==e;){if(!(t.parentNode||t.host))break;t=t.parentNode||t.host}return t.nodeName?t:null}static getClosestForm(e){return t.getClosestElement(e,"form")}static async loadJS(t){return new Promise((async e=>{const s=document.createElement("script");s.src=t,s.onload=()=>e(!0),s.onerror=()=>e(!0),document.head.appendChild(s)}))}static async loadCSS(t){return new Promise((async e=>{const s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=t,s.onload=()=>e(!0),s.onerror=()=>e(!0),document.head.appendChild(s)}))}},i=class{static ucFirst(t){return"string"!=typeof t?t:t.charAt(0).toUpperCase()+t.substring(1)}static minutesDuration(t,e="",i="long"){e||(e=s.getLanguage());function r(t,e,s){return Intl.NumberFormat(t,{style:"unit",unit:e,unitDisplay:s}).format}const[o,n]=(a=t,l=60,[Math.floor(a/l),a%l]);var a,l;const c=[];return o&&c.push(r(e,"hour",i)(o)),n&&c.push(r(e,"minute",i)(n)),new Intl.ListFormat(e,{style:"long",type:"conjunction"}).format(c)}static js(t){try{return Function("return "+t)()}catch(e){return""}}};function r(t){return"object"==typeof t&&null!=t}const o=class t{constructor(t,e){for(this._proxies_=new Map,this._is_savable_=!1,this._invalidateListeners_=new Set,this._assignListeners_=new Set,this._mutationListeners_=new Set,this._fillListeners_=new Set,this._templateFillListeners_=new Set,this._lockInternalMutationPublishing_=!1,this._instanceCounter_=0,this._assignmentId_=0,this._value_=t,this.parent=e||null,this.root=this,this._instanceCounter_=0;this.root.parent;)this.root=this.root.parent}delete(){for(const t of this._proxies_.values())t.delete();this._invalidateListeners_.clear(),this._assignListeners_.clear(),this._mutationListeners_.clear(),this._fillListeners_.clear(),this._templateFillListeners_.clear(),this._proxies_.clear(),t.instances.delete(this._instanceCounter_)}hasListener(){return this._templateFillListeners_.size>0||this._assignListeners_.size>0||this._invalidateListeners_.size>0||this._mutationListeners_.size>0||this._fillListeners_.size>0}_publishInternalMutation_(t=!1){if(this._mutationListeners_.forEach((t=>t())),this._is_savable_&&!l.changed){l.changed=!0,l.saveId++;const t=l.saveId;setTimeout((()=>l.getInstance().saveToLocalStorage(t)),1e3)}t||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(t=!1){this._assignmentId_++;const e=this._assignmentId_;if(await(async()=>new Promise((t=>{window.queueMicrotask((()=>t(null)))})))(),e!==this._assignmentId_)return;const s=this.get();this._assignListeners_.forEach((t=>t(s))),this._publishInternalMutation_(t)}_publishInvalidation_(){this._invalidateListeners_.forEach((t=>t()))}_publishDynamicFilling_(t,e){this._fillListeners_.forEach((s=>{s[t]!==e&&(s[t]=e)})),this._publishTemplateFilling_(t,e)}_publishTemplateFilling_(t,e){this._templateFillListeners_.forEach((s=>{const i=Object.getOwnPropertyDescriptor(s,t);(!i||i.set||i.writable)&&(s.propertyMap&&s.propertyMap[t]&&(t=s.propertyMap[t]),void 0!==s[t]&&s[t]!==e&&(s[t]=e))}))}onAssign(t,e=!0){"function"==typeof t&&(this._assignListeners_.has(t)||(this._assignListeners_.add(t),e&&t(this.get())))}offAssign(t){this._assignListeners_.delete(t)}onInvalidate(t){"function"==typeof t&&this._invalidateListeners_.add(t)}offInvalidate(t){"function"==typeof t&&this._invalidateListeners_.delete(t)}invalidate(){this._publishInvalidation_()}onInternalMutation(t){"function"==typeof t&&(this._mutationListeners_.add(t),t())}offInternalMutation(t){"function"==typeof t&&this._mutationListeners_.delete(t)}startTemplateFilling(t){if(this._templateFillListeners_.add(t),"object"==typeof this._value_)for(const e in this._value_){let s=e;const i=this._value_[e];t.propertyMap&&t.propertyMap[e]&&(s=t.propertyMap[e]),void 0!==t[e]&&t[e]!==i&&(t[s]=i)}}stopTemplateFilling(t){this._templateFillListeners_.delete(t)}startDynamicFilling(t){this._fillListeners_.add(t);for(const e in this._value_){const s=this._value_[e];t[e]!==s&&(t[e]=s)}}stopDynamicFilling(t){this._fillListeners_.delete(t)}async set(t,e=!1){var s;if(this._value_===t)return!0;if(this._value_&&Object.prototype.hasOwnProperty.call(this._value_,"__value")&&Object.prototype.hasOwnProperty.call(t,"__value")&&this._value_.__value===t.__value)return!0;const i=this._value_;this._value_=r(t)?t:{__value:t},this._cachedGet_=void 0;if(Object.prototype.hasOwnProperty.call(this._value_,"__value"))return await this._publishAssignement_(e),!0;for(const r in this._value_)void 0===this._value_[r]&&delete this._value_[r];if(this._proxies_.forEach(((t,e)=>{void 0===this._value_[e]&&"_parent_"!=e&&i[e]&&(this._value_[e]=null)})),await this._publishAssignement_(),r(this._value_))for(const o in this._value_){const e=t[o],i=r(e)?e:{__value:e};this._proxies_.has(o)?(await(null==(s=this._proxies_.get(o))?void 0:s.set(i,!0)),this._publishDynamicFilling_(o,e)):this._publishDynamicFilling_(o,e)}return!0}get(){if(void 0!==this._cachedGet_)return this._cachedGet_;if(l.modifiedCollectore.length>0&&l.modifiedCollectore[0].add(this),Object.prototype.hasOwnProperty.call(this._value_,"__value")){const t=this._value_.__value;return this._cachedGet_=null!=t?t:null}return this._cachedGet_=this._value_}get $tag(){this._instanceCounter_||(t.instancesCounter++,this._instanceCounter_=t.instancesCounter),t.instances.set(this._instanceCounter_,this);return'<reactive-publisher-proxy publisher="'+this._instanceCounter_+'"></reactive-publisher-proxy>'}};o.instances=new Map,o.instancesCounter=0;let n=o;const a=class t{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],null!=t.instance)throw"Singleton / use getInstance";t.instance=this,this.isLocalStrorageReady=this.cleanStorageData()}async cleanStorageData(){return new Promise((t=>{(async()=>{try{let s=localStorage.getItem("publisher-proxies-data"),i=null;if(s&&(i=await this.decompress(s,"gzip")),i)try{this.localStorageData=JSON.parse(i)}catch(e){this.localStorageData={}}else s=await this.compress("{}","gzip"),localStorage.setItem("publisher-proxies-data",s),this.localStorageData={};const r=(new Date).getTime()-432e5;for(const t in this.localStorageData){this.localStorageData[t].lastModifiationMS<r&&delete this.localStorageData[t]}t(!0)}catch(e){window.requestAnimationFrame((()=>{t(!1)})),console.log("no publisher cache in this browser")}})()}))}static getInstance(){return null==t.instance?new t:t.instance}static get(e,s){return t.getInstance().get(e,s)}static collectModifiedPublisher(){t.modifiedCollectore.unshift(new Set)}static getModifiedPublishers(){return t.modifiedCollectore.shift()}static delete(e){return!!e&&t.getInstance().delete(e)}async setLocalData(t,e){var i;await this.isLocalStrorageReady,t.set((null==(i=this.localStorageData[e+"¤lang_"+s.getLanguage()])?void 0:i.data)||t.get())}get(t,e){const s="enabled"===(null==e?void 0:e.localStorageMode);if(!this.publishers.has(t)){const e=new h({});this.set(t,e)}const i=this.publishers.get(t);return s&&-1===this.initialisedData.indexOf(t)&&(i._is_savable_=!0,this.initialisedData.push(t),this.setLocalData(i,t)),this.publishers.get(t)}set(t,e){this.publishers.set(t,e)}delete(t){return!!this.publishers.has(t)&&(this.publishers.delete(t),!0)}async saveToLocalStorage(e=0){if(e===t.saveId||e%10==0)try{if(!t.changed||t.saving)return;t.saving=!0,t.changed=!1;const e=Array.from(this.publishers.keys());let i=!1;for(const t of e){const e=this.publishers.get(t);if(!(null==e?void 0:e._is_savable_))continue;const r=null==e?void 0:e.get();r&&(this.localStorageData[t+"¤lang_"+s.getLanguage()]={lastModifiationMS:(new Date).getTime(),data:r},i=!0)}if(i){const t=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem("publisher-proxies-data",t)}if(t.saving=!1,t.changed){t.saveId++;const e=t.saveId;setTimeout((()=>this.saveToLocalStorage(e)),1e3)}}catch(i){t.saving=!1}}async compress(t,e){const s=(new TextEncoder).encode(t),i=new window.CompressionStream(e),r=i.writable.getWriter();r.write(s),r.close();const o=await new Response(i.readable).arrayBuffer(),n=new Uint8Array(o);let a="";for(let l=0;l<n.length;l++)a+=String.fromCharCode(n[l]);return btoa(a)}async decompress(t,e){const s=atob(t),i=Uint8Array.from(s,(t=>t.charCodeAt(0))).buffer,r=new window.DecompressionStream(e),o=r.writable.getWriter();o.write(i),o.close();const n=await new Response(r.readable).arrayBuffer();return(new TextDecoder).decode(n)}};a.buildDate="Thu Apr 04 2024 11:34:32 GMT+0200 (Central European Summer Time)",a.changed=!1,a.saving=!1,a.saveId=0,a.instance=null,a.modifiedCollectore=[];let l=a;const c=new Set(["invalidate","onInvalidate","offInvalidate","onAssign","offAssign","startDynamicFilling","stopDynamicFilling","startTemplateFilling","stopTemplateFilling","onInternalMutation","offInternalMutation","set","get","$tag","_cachedGet_","_templateFillListeners_","_fillListeners_","_assignListeners_","_invalidateListeners_","_publishInternalMutation_","hasListener","delete","_mutationListeners_","_publishDynamicFilling_","_publishInvalidation_","_publishTemplateFilling_","_publishAssignement_","_proxies_","parent","_value_","_is_savable_","_lockInternalMutationPublishing_","_instanceCounter_","_assignmentId_"]);class h extends n{constructor(t,e=null){super(t,e);const s=new Proxy(this,{get:function(t,e){if(e==Symbol.toPrimitive)return()=>s.get();if(c.has(e))return t[e];if(!t._proxies_.has(e)){const i=t._value_[e],o=new h(r(i)?i:{__value:i},t);o._proxies_.set("_parent_",s),t._proxies_.set(e,o)}return t._proxies_.get(e)},set:function(t,e,i){var o;if("_value_"==e)return t._value_=i,!0;if("_cachedGet_"==e)return t._cachedGet_=i,!0;if("_assignmentId_"==e)return t._assignmentId_=i,!0;if("_is_savable_"==e)return t._is_savable_=i,!0;if("_instanceCounter_"==e)return t._instanceCounter_=i,!0;if(!t._proxies_.has(e)){const i=new h({},t);i._proxies_.set("_parent_",s),t._proxies_.set(e,i)}return t._value_[e]!==i&&(t._value_[e]=i,t._publishDynamicFilling_(e,i),null==(o=t._proxies_.get(e))||o.set(r(i)?i:{__value:i})),!0},deleteProperty:function(t,e){var s;return t._publishDynamicFilling_(e,null),null==(s=t._proxies_.get(e))||s.set(null),delete t._value_[e]},has:function(t,e){return e in t._value_&&"_lockInternalMutationPublishing_"!=e},defineProperty:function(t,e,s){return s&&"value"in s&&(t._value_[e]=s.value),!0},getOwnPropertyDescriptor:function(t,e){return{enumerable:!0,configurable:!0}},ownKeys:function(t){return t._value_.__value?Object.keys(t._value_.__value):Object.keys(t._value_)}});return s}toString(){return"hey"}valueOf(){return 2}getProperty(t,e){return t[e]}}"undefined"!=typeof module&&(module.exports={Publisher:h,PublisherManager:l});class d extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=t=>{this.innerHTML=t.toString()}}connectedCallback(){var t;this.publisherId=this.getAttribute("publisher")||"",this.publisher=n.instances.get(parseInt(this.publisherId)),null==(t=this.publisher)||t.onAssign(this.onAssign)}disconnectedCallback(){var t;null==(t=this.publisher)||t.offAssign(this.onAssign)}}customElements.define("reactive-publisher-proxy",d);const p=class t{static disable(){this.enabled&&(this.enabled=!1,Array.from(t.observedElements.keys()).forEach((e=>t.unObserve(e))))}static observe(e){if(!e)return;if(!t.enabled)return;if(t.observedElements.has(e))return;const s=new MutationObserver(t.onMutation),i={childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-bind"]};s.observe(e,i),e.querySelectorAll("[data-bind]").forEach((e=>t.addPublisherListeners(e))),t.observedElements.set(e,s)}static unObserve(e){if(!e)return;const s=this.observedElements.get(e);s&&(s.disconnect(),e.querySelectorAll("[data-bind]").forEach((e=>t.removePublisherListeners(e))))}static onAdded(e){e.hasAttribute&&e.hasAttribute("data-bind")&&t.addPublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach((e=>t.addPublisherListeners(e))):e.childNodes.forEach((e=>t.onAdded(e)))}static onRemoved(e){e.hasAttribute&&e.hasAttribute("data-bind")&&t.removePublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach((e=>t.removePublisherListeners(e))):e.childNodes.forEach((e=>t.onRemoved(e)))}static onMutation(e){for(const s of e)switch(s.type){case"attributes":t.addPublisherListeners(s.target);break;case"childList":s.addedNodes.forEach((e=>{t.onAdded(e)})),s.removedNodes.forEach((e=>{t.onRemoved(e)}))}}static removePublisherListeners(e){const s=t.publisherListeners.get(e);s&&(t.publisherListeners.delete(e),s.forEach((t=>{var e;null==(e=t.publisher)||e.offAssign(t.onAssign)})))}static getVariablesDescriptor(t){let e=t.match(/(\$(?:\w+\\?\.?)+)/g);return e=e?e.map((t=>t.replace("$",""))):[t],e=e.filter((t=>t.length>0)),{expression:t.replace("\\",""),variables:e.map((t=>t.split(/\b\.\b/).map((t=>t.replace("\\","")))))}}static getDataBindItems(e){return"attributes"in e?Array.from(e.attributes).filter((t=>0==t.name.indexOf("::"))).map((e=>({propertyToUpdate:e.name.substring(2).replace(/-((html)|\w)/g,(t=>t.substring(1).toUpperCase())),bindedVariablesDescriptor:t.getVariablesDescriptor(e.value)}))):[]}static getSubPublisher(t,e){if(!e)return t;for(const s of e)if("_self_"!=s){if(!t)return null;t=t[s]}return t}static addPublisherListeners(e){t.removePublisherListeners(e);const r=s.getAncestorAttributeValue(e.parentNode||e.host||e,"dataProvider");if(!r)return;const o=l.getInstance().get(r),n=t.getDataBindItems(e),a=[];n.forEach((s=>{const r=s.bindedVariablesDescriptor,n=s.propertyToUpdate;for(const l of r.variables){const s=l;let c=o;c=t.getSubPublisher(o,s);const h=e,d={publisher:c,onAssign:()=>{const e=r.variables.map((e=>{var s;return null==(s=t.getSubPublisher(o,e))?void 0:s.get()}));let s=r.expression,a=!1;if(1==e.length&&r.variables[0].join(".")==s.substring(1)){let t=e[0];return null===t&&(t=""),void(h[n]=t)}for(let t=0;t<e.length;t++){let i=e[t];const o=r.variables[t];null===i&&(a=!0,i=void 0),s=s.replace("$"+o.join("."),i)}if(-1!=s.indexOf("|")){const t=s.indexOf("|");if(0==t)s=i.js(s.substring(1));else{const e=s.substring(0,t),r=s.substring(t+1),o=i[e];s=a?"":o?o(r):s}}else s=a?"":s;h[n]=s}};null==c||c.onAssign(d.onAssign),a.push(d)}})),t.publisherListeners.set(e,a)}};p.observedElements=new Map,p.enabled=!0,p.publisherListeners=new Map;let u=p;u.observe(document.documentElement),window.SonicDataBindObserver||(window.SonicDataBindObserver=u);let g=class t{static shallowEqual(t,e,s=!0){const i=Object.keys(t),r=Object.keys(e);if(i.length!==r.length&&s)return!1;for(const o of i){const i=t[o],r=e[o];if(s?i!==r:i!=r)return!1}return!0}static deepEqual(e,s,i=!0){const r=Object.keys(e),o=Object.keys(s);if(r.length!==o.length&&i)return!1;for(const n of r){const r=e[n],o=s[n],a=t.isObject(r)&&t.isObject(o),l=i?r!==o:r!=o;if(a&&!t.deepEqual(r,o)||!a&&l)return!1}return!0}static isObject(t){return null!=t&&"object"==typeof t}static isUndefindOrNull(t){return null==t}static isEmpty(e){return!!t.isUndefindOrNull(e)||0===Object.keys(e).length}static traverse(e,s,i=!1){for(const r of s){const s=e[r];if(void 0===s)return;e=i&&t.isObject(s)?Object.assign(Array.isArray(s)?[]:{},e,s):e[r]}return e}static getURLSearchArray(e,s=""){let i=[];for(let r in e){const o=e[r];s&&(r=s+"["+r+"]"),t.isObject(o)?i=[...i,...this.getURLSearchArray(o,r)]:i.push(`${r}=${o}`)}return i}static getURLSearchString(e){return t.getURLSearchArray(e,"").join("&")}};
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google LLC
|
|
@@ -1086,7 +1086,7 @@ const ei=Rt(class extends Ft{constructor(t){if(super(t),t.type!==zt)throw Error(
|
|
|
1086
1086
|
</sonic-subscriber>
|
|
1087
1087
|
${r&&!c?ei(r):gt}
|
|
1088
1088
|
`}))}
|
|
1089
|
-
`}};xi([F({type:Object})],_i.prototype,"itemPropertyMap",2),xi([F({type:String})],_i.prototype,"templateKey",2),xi([F({type:String})],_i.prototype,"idKey",2),xi([F()],_i.prototype,"loader",2),xi([F()],_i.prototype,"limit",2),xi([F()],_i.prototype,"offset",2),_i=xi([b("sonic-list")],_i);var ki=Object.defineProperty,Ai=Object.getOwnPropertyDescriptor,Pi=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?Ai(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&ki(e,s,o),o};let Ci=class extends(he(Zt)){constructor(){super(...arguments),this.templates=null,this.lastRequestTime=0,this.key="",this.itemPropertyMap=null,this.cache="default",this.targetRequestDuration=500,this.limit=5,this.lazyBoundsRatio=1,this.offset=0,this.resultCount=0,this.noLazyload=!1,this.filteredFields="",this.instanceId=0,this.localStorage="disabled",this.filterPublisher=null,this.filterTimeoutMs=400,this.searchHash="",this.requestId=0,this.isFirstRequest=!0,this.updateFilteredContent=()=>{var t;const e=this.dataProviderExpression.split("?");e.shift();const s=new URLSearchParams(e.join("?")),i=null==(t=this.filterPublisher)?void 0:t.get(),r=this.filteredFields.split(" ");for(const n in i){let t=i[n];Array.isArray(t)&&(t=t.filter((t=>null!==t))),this.filteredFields&&!r.includes(n)||null==t||""===t.toString()||s.set(n,i[n].toString())}const o=s.toString();if(o!=this.searchHash||this.isFirstRequest){this.searchHash=o;for(const t of this.listDataProviders)l.delete(t);this.listDataProviders=[],clearTimeout(this.filterTimeoutId),this.filterTimeoutId=setTimeout((async()=>{const t=this.resultCount;this.props=null,this.requestId++,this.resultCount=t,await l.getInstance().isLocalStrorageReady,window.requestAnimationFrame((()=>this.next()))}),this.isFirstRequest?0:this.filterTimeoutMs),this.isFirstRequest=!1}},this.dataProviderExpression="",this.idKey="id",this.listDataProviders=[],this.nextHadEvent=!1}disconnectedCallback(){var t;for(const e of this.listDataProviders)l.delete(e),this.listDataProviders=[];null==(t=this.filterPublisher)||t.offInternalMutation(this.updateFilteredContent),this.props=null,this.limit=5,this.offset=0,this.resultCount=0,this.searchHash="",this.requestId=0,this.isFirstRequest=!0,this.nextHadEvent=!1,this.publisher.set({}),super.disconnectedCallback()}async connectedCallback(){this.instanceId=Ci.instanceCounter++,this.localStorage=this.getAttribute("localStorage")||this.localStorage,this.filterTimeoutMs=parseInt(this.getAttribute("filterTimeoutMs")||"400"),this.removeAttribute("localStorage"),this.noShadowDom="",this.defferedDebug=this.hasAttribute("debug")||null,this.dataProvider||(this.dataProvider=this.dataProviderExpression||"sonic-queue-"+this.instanceId+"-"+Math.random().toString(36).substring(7)),this.dataProviderExpression||(this.dataProviderExpression=Ee.getAncestorAttributeValue(this.parentElement,"dataProvider")||""),super.connectedCallback(),this.publisher.set({}),this.key=this.getAttribute("key"),await l.getInstance().isLocalStrorageReady,this.templates||(this.templates=Array.from(this.querySelectorAll("template"))),this.lastRequestTime=(new Date).getTime(),this.configFilter()}configFilter(){var t;const e=this.getAncestorAttributeValue("dataFilterProvider");e?(this.filterPublisher=l.getInstance().get(e),null==(t=this.filterPublisher)||t.onInternalMutation(this.updateFilteredContent)):this.next()}resetDuration(){this.lastRequestTime=(new Date).getTime()}next(t){var e;let s=this.offset;const i=(new Date).getTime()-this.lastRequestTime;if(!this.nextHadEvent&&t&&(this.publisher.resultCount=0,this.resultCount=0),this.nextHadEvent=!!t,t){if(this.publisher.lastFetchedData=t.detail.fetchedData,t.detail.requestId<this.requestId)return;if(this.resultCount+=t.detail.props.length,!t.detail.isFirstLoad||!t.detail.props.length||-1==this.dataProviderExpression.indexOf("$offset"))return void(this.publisher.resultCount=this.resultCount)}if(Array.isArray(this.props)){const t=this.props,e=t[t.length-1];s=parseInt(e.offset.toString())+parseInt(e.limit.toString())}else{const
|
|
1089
|
+
`}};xi([F({type:Object})],_i.prototype,"itemPropertyMap",2),xi([F({type:String})],_i.prototype,"templateKey",2),xi([F({type:String})],_i.prototype,"idKey",2),xi([F()],_i.prototype,"loader",2),xi([F()],_i.prototype,"limit",2),xi([F()],_i.prototype,"offset",2),_i=xi([b("sonic-list")],_i);var ki=Object.defineProperty,Ai=Object.getOwnPropertyDescriptor,Pi=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?Ai(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&ki(e,s,o),o};let Ci=class extends(he(Zt)){constructor(){super(...arguments),this.templates=null,this.lastRequestTime=0,this.key="",this.itemPropertyMap=null,this.cache="default",this.targetRequestDuration=500,this.limit=5,this.lazyBoundsRatio=1,this.offset=0,this.resultCount=0,this.noLazyload=!1,this.filteredFields="",this.instanceId=0,this.localStorage="disabled",this.filterPublisher=null,this.filterTimeoutMs=400,this.searchHash="",this.requestId=0,this.isFirstRequest=!0,this.updateFilteredContent=()=>{var t;const e=this.dataProviderExpression.split("?");e.shift();const s=new URLSearchParams(e.join("?")),i=null==(t=this.filterPublisher)?void 0:t.get(),r=this.filteredFields.split(" ");for(const n in i){let t=i[n];Array.isArray(t)&&(t=t.filter((t=>null!==t))),this.filteredFields&&!r.includes(n)||null==t||""===t.toString()||s.set(n,i[n].toString())}const o=s.toString();if(o!=this.searchHash||this.isFirstRequest){this.searchHash=o;for(const t of this.listDataProviders)l.delete(t);this.listDataProviders=[],clearTimeout(this.filterTimeoutId),this.filterTimeoutId=setTimeout((async()=>{const t=this.resultCount;this.props=null,this.requestId++,this.resultCount=t,await l.getInstance().isLocalStrorageReady,window.requestAnimationFrame((()=>this.next()))}),this.isFirstRequest?0:this.filterTimeoutMs),this.isFirstRequest=!1}},this.dataProviderExpression="",this.idKey="id",this.listDataProviders=[],this.nextHadEvent=!1}disconnectedCallback(){var t;for(const e of this.listDataProviders)l.delete(e),this.listDataProviders=[];null==(t=this.filterPublisher)||t.offInternalMutation(this.updateFilteredContent),this.props=null,this.limit=5,this.offset=0,this.resultCount=0,this.searchHash="",this.requestId=0,this.isFirstRequest=!0,this.nextHadEvent=!1,this.publisher.set({}),super.disconnectedCallback()}async connectedCallback(){this.instanceId=Ci.instanceCounter++,this.localStorage=this.getAttribute("localStorage")||this.localStorage,this.filterTimeoutMs=parseInt(this.getAttribute("filterTimeoutMs")||"400"),this.removeAttribute("localStorage"),this.noShadowDom="",this.defferedDebug=this.hasAttribute("debug")||null,this.dataProvider||(this.dataProvider=this.dataProviderExpression||"sonic-queue-"+this.instanceId+"-"+Math.random().toString(36).substring(7)),this.dataProviderExpression||(this.dataProviderExpression=Ee.getAncestorAttributeValue(this.parentElement,"dataProvider")||""),super.connectedCallback(),this.publisher.set({}),this.key=this.getAttribute("key"),await l.getInstance().isLocalStrorageReady,this.templates||(this.templates=Array.from(this.querySelectorAll("template"))),this.lastRequestTime=(new Date).getTime(),this.configFilter()}configFilter(){var t;const e=this.getAncestorAttributeValue("dataFilterProvider");e?(this.filterPublisher=l.getInstance().get(e),null==(t=this.filterPublisher)||t.onInternalMutation(this.updateFilteredContent)):this.next()}resetDuration(){this.lastRequestTime=(new Date).getTime()}next(t){var e;let s=this.offset;const i=(new Date).getTime()-this.lastRequestTime;if(!this.nextHadEvent&&t&&(this.publisher.resultCount=0,this.resultCount=0),this.nextHadEvent=!!t,t){if(this.publisher.lastFetchedData=t.detail.fetchedData,t.detail.requestId<this.requestId)return;if(this.resultCount+=t.detail.props.length,!t.detail.isFirstLoad||!t.detail.props.length||-1==this.dataProviderExpression.indexOf("$offset"))return void(this.publisher.resultCount=this.resultCount)}if(Array.isArray(this.props)){const t=this.props,e=t[t.length-1];s=parseInt(e.offset.toString())+parseInt(e.limit.toString())}else{const e=[];e.resultCount=this.resultCount,e.lastFetchedData=(null==t?void 0:t.detail.fetchedData)||{},this.props=e}i>0&&t&&!this.localStorage&&(this.limit=Math.round(this.limit/i*this.targetRequestDuration)),this.limit<1&&(this.limit=1),this.limit>15&&(this.limit=15);let r=this.dataProviderExpression.replace("$offset",s+"").replace("$limit",this.limit+"");const o=r.split("?");let n=o.shift();const a=new URLSearchParams(o.join("?")),l=null==(e=this.filterPublisher)?void 0:e.get(),c=this.filteredFields.split(" ");for(const d in l)this.filteredFields&&c.includes(d)||null==l[d]||""==l[d]||a.set(d,l[d]);this.searchHash||(this.searchHash=a.toString()),n=n+"?"+a.toString(),r=r+"_item_from_queue_"+this.instanceId,this.listDataProviders.push(r);const h=[...this.props,{id:a.toString()+"/"+this.props.length,dataProvider:r,endPoint:n,offset:s,limit:this.limit}];h.resultCount=this.resultCount,h.lastFetchedData=(null==t?void 0:t.detail.fetchedData)||{},this.props=h,this.lastRequestTime=(new Date).getTime()}render(){if(!Array.isArray(this.props))return gt;let t=!this.noLazyload;return 1==this.props.length&&(t=!1),pt`
|
|
1090
1090
|
${
|
|
1091
1091
|
/**
|
|
1092
1092
|
* @license
|
|
@@ -1121,7 +1121,7 @@ function*(t,e){if(void 0!==t){let s=0;for(const i of t)yield e(i,s++)}}(this.pro
|
|
|
1121
1121
|
pointer-events: none;
|
|
1122
1122
|
user-select: none;
|
|
1123
1123
|
}
|
|
1124
|
-
`,Oi([F({type:String})],Di.prototype,"submitResultKey",2),Oi([F({type:Boolean})],Di.prototype,"disabled",2),Oi([F({type:String})],Di.prototype,"endPoint",2),Oi([F()],Di.prototype,"name",2),Oi([F()],Di.prototype,"value",2),Di=Oi([b("sonic-submit")],Di);var Li="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ei(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ji,Mi,Ii,Ti,Ni={exports:{}};ji=Ni,Ti=[].slice,Mi=Li,Ii=function(){var t,e,s,i,r,o,n,a,l,c,h,d,p,u,g;return l=function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},n=function(t,e){var s,i,r;for(r=[],s=-1,i=t.length;++s<i;)r=r.concat(e(t[s]));return r},u=function(t,e){var s,i,r;for(r="",s=-1,i=t.length;++s<i;)r+=e(t[s]);return r},p=function(t){return new RegExp(t.toString()+"|").exec("").length-1},h=function(t,e){var s,i,r,o,n;for(o={},s=-1,r=t.length;++s<r;)i=t[s],null!=(n=e[s])&&(null!=o[i]?(Array.isArray(o[i])||(o[i]=[o[i]]),o[i].push(n)):o[i]=n);return o},(t={}).Result=function(t,e){this.value=t,this.rest=e},t.Tagged=function(t,e){this.tag=t,this.value=e},t.tag=function(e,s){return function(i){var r,o;if(null!=(r=s(i)))return o=new t.Tagged(e,r.value),new t.Result(o,r.rest)}},t.regex=function(e){return function(s){var i,r;if(null!=(i=e.exec(s)))return r=i[0],new t.Result(r,s.slice(r.length))}},t.sequence=function(){var e;return e=1<=arguments.length?Ti.call(arguments,0):[],function(s){var i,r,o,n,a;for(i=-1,r=e.length,a=[],o=s;++i<r;){if(null==(n=(0,e[i])(o)))return;a.push(n.value),o=n.rest}return new t.Result(a,o)}},t.pick=function(){var e,s;return e=arguments[0],s=2<=arguments.length?Ti.call(arguments,1):[],function(i){var r,o;if(null!=(o=t.sequence.apply(t,s)(i)))return r=o.value,o.value=r[e],o}},t.string=function(e){var s;return s=e.length,function(i){if(i.slice(0,s)===e)return new t.Result(e,i.slice(s))}},t.lazy=function(t){var e;return e=null,function(s){return null==e&&(e=t()),e(s)}},t.baseMany=function(e,s,i,r,o){var n,a,l;for(a=o,l=i?"":[];(null==s||null==s(a))&&null!=(n=e(a));)i?l+=n.value:l.push(n.value),a=n.rest;if(!r||0!==l.length)return new t.Result(l,a)},t.many1=function(e){return function(s){return t.baseMany(e,null,!1,!0,s)}},t.concatMany1Till=function(e,s){return function(i){return t.baseMany(e,s,!0,!0,i)}},t.firstChoice=function(){var t;return t=1<=arguments.length?Ti.call(arguments,0):[],function(e){var s,i,r;for(s=-1,i=t.length;++s<i;)if(null!=(r=(0,t[s])(e)))return r}},d=function(e){var s;return(s={}).wildcard=t.tag("wildcard",t.string(e.wildcardChar)),s.optional=t.tag("optional",t.pick(1,t.string(e.optionalSegmentStartChar),t.lazy((function(){return s.pattern})),t.string(e.optionalSegmentEndChar))),s.name=t.regex(new RegExp("^["+e.segmentNameCharset+"]+")),s.named=t.tag("named",t.pick(1,t.string(e.segmentNameStartChar),t.lazy((function(){return s.name})))),s.escapedChar=t.pick(1,t.string(e.escapeChar),t.regex(/^./)),s.static=t.tag("static",t.concatMany1Till(t.firstChoice(t.lazy((function(){return s.escapedChar})),t.regex(/^./)),t.firstChoice(t.string(e.segmentNameStartChar),t.string(e.optionalSegmentStartChar),t.string(e.optionalSegmentEndChar),s.wildcard))),s.token=t.lazy((function(){return t.firstChoice(s.wildcard,s.optional,s.named,s.static)})),s.pattern=t.many1(t.lazy((function(){return s.token}))),s},a={escapeChar:"\\",segmentNameStartChar:":",segmentValueCharset:"a-zA-Z0-9-_~ %",segmentNameCharset:"a-zA-Z0-9",optionalSegmentStartChar:"(",optionalSegmentEndChar:")",wildcardChar:"*"},o=function(t,e){if(Array.isArray(t))return u(t,(function(t){return o(t,e)}));switch(t.tag){case"wildcard":return"(.*?)";case"named":return"(["+e+"]+)";case"static":return l(t.value);case"optional":return"(?:"+o(t.value,e)+")?"}},r=function(t,e){return null==e&&(e=a.segmentValueCharset),"^"+o(t,e)+"$"},i=function(t){if(Array.isArray(t))return n(t,i);switch(t.tag){case"wildcard":return["_"];case"named":return[t.value];case"static":return[];case"optional":return i(t.value)}},c=function(t,e,s,i){var r,o,n;if(null==i&&(i=!1),null!=(n=t[e])){if(!((r=s[e]||0)>(Array.isArray(n)?n.length-1:0)))return o=Array.isArray(n)?n[r]:n,i&&(s[e]=r+1),o;if(i)throw new Error("too few values provided for key `"+e+"`")}else if(i)throw new Error("no values provided for key `"+e+"`")},s=function(t,e,i){var r,o;if(Array.isArray(t)){for(r=-1,o=t.length;++r<o;)if(s(t[r],e,i))return!0;return!1}switch(t.tag){case"wildcard":return null!=c(e,"_",i,!1);case"named":return null!=c(e,t.value,i,!1);case"static":return!1;case"optional":return s(t.value,e,i)}},g=function(t,e,i){if(Array.isArray(t))return u(t,(function(t){return g(t,e,i)}));switch(t.tag){case"wildcard":return c(e,"_",i,!0);case"named":return c(e,t.value,i,!0);case"static":return t.value;case"optional":return s(t.value,e,i)?g(t.value,e,i):""}},(e=function(t,s){var o,n,l;if(t instanceof e)return this.isRegex=t.isRegex,this.regex=t.regex,this.ast=t.ast,void(this.names=t.names);if(this.isRegex=t instanceof RegExp,"string"!=typeof t&&!this.isRegex)throw new TypeError("argument must be a regex or a string");if(this.isRegex){if(this.regex=t,null!=s){if(!Array.isArray(s))throw new Error("if first argument is a regex the second argument may be an array of group names but you provided something else");if(o=p(this.regex),s.length!==o)throw new Error("regex contains "+o+" groups but array of group names contains "+s.length);this.names=s}}else{if(""===t)throw new Error("argument must not be the empty string");if(t.replace(/\s+/g,"")!==t)throw new Error("argument must not contain whitespace");if(n={escapeChar:(null!=s?s.escapeChar:void 0)||a.escapeChar,segmentNameStartChar:(null!=s?s.segmentNameStartChar:void 0)||a.segmentNameStartChar,segmentNameCharset:(null!=s?s.segmentNameCharset:void 0)||a.segmentNameCharset,segmentValueCharset:(null!=s?s.segmentValueCharset:void 0)||a.segmentValueCharset,optionalSegmentStartChar:(null!=s?s.optionalSegmentStartChar:void 0)||a.optionalSegmentStartChar,optionalSegmentEndChar:(null!=s?s.optionalSegmentEndChar:void 0)||a.optionalSegmentEndChar,wildcardChar:(null!=s?s.wildcardChar:void 0)||a.wildcardChar},null==(l=d(n).pattern(t)))throw new Error("couldn't parse pattern");if(""!==l.rest)throw new Error("could only partially parse pattern");this.ast=l.value,this.regex=new RegExp(r(this.ast,n.segmentValueCharset)),this.names=i(this.ast)}}).prototype.match=function(t){var e,s;return null==(s=this.regex.exec(t))?null:(e=s.slice(1),this.names?h(this.names,e):e)},e.prototype.stringify=function(t){if(null==t&&(t={}),this.isRegex)throw new Error("can't stringify patterns generated from a regex");if(t!==Object(t))throw new Error("argument must be an object or undefined");return g(this.ast,t,{})},e.escapeForRegex=l,e.concatMap=n,e.stringConcatMap=u,e.regexGroupCount=p,e.keysAndValuesToObject=h,e.P=t,e.newParser=d,e.defaultOptions=a,e.astNodeToRegexString=r,e.astNodeToNames=i,e.getParam=c,e.astNodeContainsSegmentsForProvidedParams=s,e.stringify=g,e},null!==Ni.exports?ji.exports=Ii():Mi.UrlPattern=Ii();const zi=Ei(Ni.exports);var Ri=Object.defineProperty,Fi=Object.getOwnPropertyDescriptor,Ui=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?Fi(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&Ri(e,s,o),o};let Vi=class extends(he(ue(Zt))){constructor(){super(...arguments),this.templateValueAttribute="data-route",this._location=document.location.href.replace(document.location.origin,"")}connectedCallback(){this.noShadowDom="",ye.onChange(this),super.connectedCallback()}disconnectedCallback(){ye.offChange(this),super.disconnectedCallback()}set location(t){this._location=t,this.requestUpdate()}get location(){return this._location}render(){const t=[];for(const s of this.templatePartsList){const i=s.getAttribute(this.templateValueAttribute)||"";if(new RegExp(i).test(this.location))t.push(s);else try{new zi(i).match(this.location)&&(s.setAttribute("mode","patternMatching"),t.push(s))}catch(e){-1!=this.location.indexOf(i.replace(document.location.origin,""))&&t.push(s)}}if(0==t.length){this.fallBackRoute&&this.isConnected&&(document.location.href=this.fallBackRoute);const e=this.templatePartsList.find((t=>t.hasAttribute("data-fallback")));e&&t.push(e)}return pt`${Ye(t,((t,e)=>e+(new Date).getTime()),(t=>{var e;if(t.title&&(document.title=t.title),t.hasAttribute("dataProviderExpression")){let s="";const i=t.getAttribute("dataProviderExpression")||"";if("patternMatching"==t.getAttribute("mode")){const e=new zi(t.getAttribute(this.templateValueAttribute)||"");s=new zi(i).stringify(e.match(this.location))}else{const r=new RegExp(t.getAttribute(this.templateValueAttribute)||""),o=(this.location+"").match(r);o&&(s=(null==(e=o.shift())?void 0:e.replace(r,i))||"")}return pt`<div style="display:contents" dataProvider="${s}">${ei(t)}</div>`}return ei(t)}))}`}};Ui([F({type:String})],Vi.prototype,"fallBackRoute",2),Ui([F()],Vi.prototype,"location",1),Vi=Ui([b("sonic-router")],Vi);var Bi=Object.defineProperty,Hi=Object.getOwnPropertyDescriptor;let qi=class extends(he(Zt)){connectedCallback(){this.noShadowDom="",this.style.display="none",super.connectedCallback(),this.udpateCallBack=()=>this.update(),this.publisher&&this.publisher.onInternalMutation(this.udpateCallBack)}disconnectedCallback(){this.publisher&&this.publisher.offInternalMutation(this.udpateCallBack),super.disconnectedCallback()}update(){if(this.hasAttribute("onAdded"))return void ye.changeFromComponent(this);if(!this.props)return;const t=this.getAttribute("onData").split("."),e=g.traverse(this.props,t);!e||g.isObject(e)&&e||ye.changeFromComponent(this)}};qi=((t,e,s,i)=>{for(var r,o=i>1?void 0:i?Hi(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&Bi(e,s,o),o})([b("sonic-redirect")],qi);var Wi=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,Zi=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?Ki(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&Wi(e,s,o),o};let Yi=class extends(he(ue(Zt))){constructor(){super(...arguments),this.state="",this.inverted=!1,this.statePath="",this.onAssign=t=>{this.state=t,this.requestUpdate()}}connectedCallback(){if(this.noShadowDom="",super.connectedCallback(),this.hasAttribute("data-path")&&(this.statePath=this.getAttribute("data-path")),this.statePath){this.statePublisher=this.publisher;const t=this.statePath.split(".");for(const e of t)this.statePublisher=this.statePublisher[e];this.statePublisher.onAssign(this.onAssign)}}disconnectedCallback(){var t;this.statePath&&(null==(t=this.statePublisher)||t.offAssign(this.onAssign)),super.disconnectedCallback()}render(){const t=[];let e=this.state;(!Array.isArray(e)&&g.isObject(e)||void 0===e)&&(e="");for(const s of this.templatePartsList){let i=s.getAttribute(this.templateValueAttribute),r=e;this.inverted&&(r=i,i=e),""==i&&(i=this.inverted?".*?":"^$");if(new RegExp(i).test(r))t.push(s),s.removeAttribute("mode");else{const e=new zi(i);e.names.length>0&&e.match(r)&&(s.setAttribute("mode","patternMatching"),t.push(s))}}return pt`${Ye(t,((t,e)=>e+(new Date).getTime()),(t=>{var s;if(t.title&&(document.title=t.title),t.hasAttribute("dataProviderExpression")){const i=t.getAttribute("dataProviderExpression");let r="",o=e,n=t.getAttribute(this.templateValueAttribute);if(this.inverted&&(o=n,n=e),""==n&&(n=this.inverted?"*":"^$"),"patternMatching"==t.getAttribute("mode")){const t=new zi(n);r=new zi(i).stringify(t.match(o))}else{const t=new RegExp(n),e=(o+"").match(t);e&&(r=null==(s=e.shift())?void 0:s.replace(t,i))}return pt`<div style="display:contents" dataProvider="${r}">${ei(t)}</div>`}return ei(t)}))}`}};Zi([F()],Yi.prototype,"state",2),Zi([F({type:Boolean,reflect:!0})],Yi.prototype,"inverted",2),Yi=Zi([b("sonic-states")],Yi);var Gi=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor;let Ji=class extends Zt{createRenderRoot(){return this}render(){return pt`<slot></slot>`}};Ji=((t,e,s,i)=>{for(var r,o=i>1?void 0:i?Qi(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&Gi(e,s,o),o})([b("sonic-scope")],Ji);var Xi=Object.defineProperty,tr=Object.getOwnPropertyDescriptor,er=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?tr(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&Xi(e,s,o),o};let sr=class extends(he(Zt)){constructor(){super(...arguments),this.text="Example"}render(){return pt`<div>${this.text}</div>`}};er([F()],sr.prototype,"text",2),sr=er([b("sonic-example")],sr);const ir={checkbox:{tagName:"sonic-checkbox"},date:{tagName:"sonic-input",attributes:{type:"date"}},fieldset:{tagName:"sonic-fieldset",nodes:[{libraryKey:"formLayout"}],contentElementSelector:"sonic-form-layout"},managed_file:{tagName:"sonic-input",attributes:{variant:"ghost",type:"file"}},password:{tagName:"sonic-input",attributes:{type:"password"}},radio:{tagName:"sonic-radio"},select:{tagName:"sonic-select"},textarea:{tagName:"sonic-textarea"},textfield:{tagName:"sonic-input",attributes:{type:"text"}},hidden:{tagName:"sonic-input",attributes:{type:"hidden"}},button:{tagName:"sonic-button"},form:{tagName:"sonic-submit",attributes:{onEnterKey:!0}},submit:{tagName:"sonic-submit",attributes:{onClick:!0},contentElementSelector:"sonic-button",nodes:[{libraryKey:"button",attributes:{type:"success"},nodes:[{tagName:"sonic-icon",attributes:{name:"check",slot:"prefix"}}]}]},email:{tagName:"sonic-input",attributes:{type:"email"}},formItemContainer:{tagName:"div",attributes:{class:"form-item-container"}},formLayout:{tagName:"sonic-form-layout"},formActions:{tagName:"sonic-form-actions"},passwordHelper:{tagName:"sonic-password-helper"},sameValueHelper:{tagName:"sonic-same-value-helper"},divider:{tagName:"sonic-divider"}};class rr{async transform(t,e){if(this.sduiDescriptor=t,this.sduiDescriptor.library)for(const s in e.library)this.sduiDescriptor.library[s]=e.library[s];for(const s of e.transforms)this.transformAction(s)}transformAction(t){const e=this.getNodesMatchingPatterns(t.patterns,this.sduiDescriptor);this[t.action](t,e)}getNodesMatchingPatterns(t,e){if(!t)return[];if(!e)return[];const s=e.nodes;if(!s)return[];let i=[],r=0;for(const o of t)for(const t of s)this.nodeMatchesPattern(o,t)&&i.push({parent:e,child:t,index:r}),i=i.concat(this.getNodesMatchingPatterns([o],t)),r++;return i}stringMatchesExpression(t,e){return!e||t&&t.match(e)}nodeMatchesPattern(t,e){const s=t,i=e,r=["libraryKey","innerHTML","prefix","suffix","markup"];for(const a of r)if(!this.stringMatchesExpression(i[a],s[a]))return!1;const o=t.attributes,n=e.attributes;if(o&&!n)return!1;if(o)for(const a in o)if(!n||!this.stringMatchesExpression(n[a],o[a]))return!1;return!0}unwrap(t,e){var s,i;for(const r of e)null==(s=r.parent.nodes)||s.splice(r.parent.nodes.indexOf(r.child),1),r.child.nodes&&(null==(i=r.parent.nodes)||i.splice(r.parent.nodes.indexOf(r.child),0,...r.child.nodes))}wrap(t,e){var s,i,r,o,n,a;const l={...t.ui};l.nodes||(l.nodes=[]);let c=0;for(const d of e)null==(s=l.nodes)||s.push(d.child),c>0&&(null==(i=d.parent.nodes)||i.splice(d.parent.nodes.indexOf(d.child),1)),c++;const h=null==(o=null==(r=e[0])?void 0:r.parent.nodes)?void 0:o.indexOf(e[0].child);h&&(null==(n=e[0].parent.nodes)||n.splice(h,1),null==(a=e[0].parent.nodes)||a.splice(h,0,l))}move(t,e){var s,i;for(const r of e){null==(s=r.parent.nodes)||s.splice(r.parent.nodes.indexOf(r.child),1);let e=[];t.after&&(e=this.getNodesMatchingPatterns([t.after],this.sduiDescriptor)),t.before&&(e=this.getNodesMatchingPatterns([t.before],this.sduiDescriptor));const o=e[0];o&&(null==(i=o.parent.nodes)||i.splice(o.parent.nodes.indexOf(o.child)+(t.after?1:0),0,r.child))}}remap(t,e){var s,i,r;for(const o of e){const e={...t.ui};e.attributes||(e.attributes={});const n=o.child.attributes;if(n)for(const t in n)Object.prototype.hasOwnProperty.call(e.attributes,"key")||(e.attributes[t]=n[t]);const a=["libraryKey","innerHTML","prefix","suffix","markup"],l=o.child,c=e;for(const t of a)!Object.prototype.hasOwnProperty.call(e,t)&&l[t]&&(c[t]=l[t]);e.nodes||(e.nodes=[]);const h=o.child.nodes;if(h)for(const t of h)e.nodes.push(t);const d=(null==(s=o.parent.nodes)?void 0:s.indexOf(o.child))||-1;-1!=d&&(null==(i=o.parent.nodes)||i.splice(d,1),null==(r=o.parent.nodes)||r.splice(d,0,e))}}delete(t,e){var s;for(const i of e)null==(s=i.parent.nodes)||s.splice(i.parent.nodes.indexOf(i.child),1)}insert(t,e){var s;const i=t.after?"after":t.before?"before":"in";e=[],t.after?e=this.getNodesMatchingPatterns([t.after],this.sduiDescriptor):t.before?e=this.getNodesMatchingPatterns([t.before],this.sduiDescriptor):t.in&&(e=this.getNodesMatchingPatterns([t.in],this.sduiDescriptor));const r=e[0];r&&("in"==i?(r.child.nodes||(r.child.nodes=[]),r.child.nodes.push({...t.ui})):null==(s=r.parent.nodes)||s.splice(r.parent.nodes.indexOf(r.child)+("after"==i?1:0),0,{...t.ui}))}}var or=Object.defineProperty,nr=Object.getOwnPropertyDescriptor,ar=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?nr(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&or(e,s,o),o};let lr=class extends(Ys(Xs(Zt))){constructor(){super(...arguments),this.sduiDescriptor={}}connectedCallback(){this.noShadowDom="",this.displayContents=!0,this.isFetchEnabled=this.hasAttribute("fetch"),super.connectedCallback()}willUpdate(t){null==this.props&&(this.sduiDescriptor={});{const t=this.sduiKey?this.props[this.sduiKey]:this.props;if(this.sduiDescriptor==t)return;this.sduiDescriptor=t,this.updateContents()}super.willUpdate(t)}async updateContents(){if(!this.sduiDescriptor)return;const t={};Object.assign(t,ir,this.sduiDescriptor.library),this.sduiDescriptor.library=t,this.loadAssets(),await this.loadLibrary(),await this.transformSDUIDescriptor(),this.parseRootNodes()}removeChildren(){for(;[...this.children].filter((t=>"SLOT"!=t.nodeName)).length>0;)this.removeChild(this.children[0])}loadAssets(){if(this.sduiDescriptor){if(this.sduiDescriptor.js)for(const t of this.sduiDescriptor.js)Ee.loadJS(t);if(this.sduiDescriptor.css)for(const t of this.sduiDescriptor.css)Ee.loadCSS(t)}}async transformSDUIDescriptor(){if(!this.hasAttribute("transformation"))return;const t=await fetch(this.getAttribute("transformation")),e=await t.json(),s=new rr;await s.transform(this.sduiDescriptor,e)}async loadLibrary(){if(!this.hasAttribute("library"))return;const t=await fetch(this.getAttribute("library")),e=await t.json();this.sduiDescriptor.library=e}parseRootNodes(){if(this.removeChildren(),!this.sduiDescriptor)return;let t=this.sduiDescriptor.nodes;t||(t=[]);const e={tagName:"sonic-toast-message-subscriber",attributes:{}};this.messagesKey&&(e.attributes={subDataProvider:this.messagesKey}),t.push(e),t.forEach((t=>this.appendChild(this.parseChild(t))))}parseChild(t){const e=t.tagName||"div";let{element:s,contentElement:i}=this.handleLibrary(t,e);if(this.handleAttributes(t,s),s=this.handleMarkup(t,s),i||(i=s),this.handleChildNodes(t,i,s),this.handleInnerHTML(t,i),t.prefix||t.suffix){return this.handlePrefixSuffix(t,s)}return s}handlePrefixSuffix(t,e){const s=document.createElement("div");return s.innerHTML=(t.prefix||"")+e.outerHTML+(t.suffix||""),s.style.display="contents",s}handleChildNodes(t,e,s){if(t.nodes){const i=t.nodes;for(const t of i){const i=this.parseChild(t);let r=e;if(t.parentElementSelector&&(r=s.querySelector(t.parentElementSelector)||e),r.shadowRoot)r.shadowRoot.appendChild(i);else if("template"==r.tagName.toLocaleLowerCase()){r.content.appendChild(i)}else r.appendChild(i)}}}handleLibrary(t,e){let s,i;if(t.libraryKey&&this.sduiDescriptor.library){s=this.parseChild(this.sduiDescriptor.library[t.libraryKey]||{tagName:"div"});const e=(this.sduiDescriptor.library[t.libraryKey]||{}).contentElementSelector;e&&(i=s.querySelector(e))}else s=document.createElement(e);return{element:s,contentElement:i}}handleAttributes(t,e){const s=t.attributes;for(const i in s){const t=s[i],r=Me.isObject(t)?JSON.stringify(t):t;e.setAttribute(i,r)}}handleMarkup(t,e){return t.markup&&((e=document.createElement("div")).style.display="contents",e.innerHTML=t.markup),e}handleInnerHTML(t,e){var s;if(t.innerHTML)if(-1!=t.innerHTML.indexOf("wording_")){const i=this.getAncestorAttributeValue("wordingProvider");null==(s=this.api)||s.post(i,{labels:[t.innerHTML.substring(8)]}).then((t=>{e&&(e.innerHTML+=t)}))}else e&&(e.innerHTML+=t.innerHTML)}};ar([F()],lr.prototype,"sduiKey",2),ar([F()],lr.prototype,"messagesKey",2),lr=ar([b("sonic-sdui")],lr);var cr=Object.defineProperty,hr=Object.getOwnPropertyDescriptor,dr=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?hr(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&cr(e,s,o),o};let pr=class extends(Xs(Zt)){constructor(){super(...arguments),this._composition={},this.listeners=[]}get composition(){return this._composition}set composition(t){this._composition=t,this.updateComposition()}connectedCallback(){super.connectedCallback(),this.updateComposition()}disconnectedCallback(){this.removePublisherListeners(),super.disconnectedCallback()}updateComposition(){this.removePublisherListeners(),this.publisher&&(this.publisher.set({}),this.parseComposition(this.composition,this.publisher))}removePublisherListeners(){const t=this.listeners;this.listeners=[],t.forEach((t=>{this.publisher.offAssign(t.subscriber)}))}parseComposition(t,e){if(t)for(const s in t){const i=t[s];if("string"==typeof i){const t=i.split("."),r=t.shift();if(!r)continue;let o=Te.get(r);o=Me.traverse(o,t);const n={publisher:o,subscriber:t=>{e[s]=t}};this.listeners.push(n),o.onAssign(n.subscriber),e._proxies_.set(s,o)}else{this.publisher[s]={};const t=new n({},e);e._proxies_.set(s,t);const r={publisher:t,subscriber:t=>{e[s]=t}};this.listeners.push(r),t.onAssign(r.subscriber),this.parseComposition(i,t)}}}render(){return pt`<slot></slot>`}};pr.styles=[x`
|
|
1124
|
+
`,Oi([F({type:String})],Di.prototype,"submitResultKey",2),Oi([F({type:Boolean})],Di.prototype,"disabled",2),Oi([F({type:String})],Di.prototype,"endPoint",2),Oi([F()],Di.prototype,"name",2),Oi([F()],Di.prototype,"value",2),Di=Oi([b("sonic-submit")],Di);var Li="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ei(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ji,Mi,Ii,Ti,Ni={exports:{}};ji=Ni,Ti=[].slice,Mi=Li,Ii=function(){var t,e,s,i,r,o,n,a,l,c,h,d,p,u,g;return l=function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},n=function(t,e){var s,i,r;for(r=[],s=-1,i=t.length;++s<i;)r=r.concat(e(t[s]));return r},u=function(t,e){var s,i,r;for(r="",s=-1,i=t.length;++s<i;)r+=e(t[s]);return r},p=function(t){return new RegExp(t.toString()+"|").exec("").length-1},h=function(t,e){var s,i,r,o,n;for(o={},s=-1,r=t.length;++s<r;)i=t[s],null!=(n=e[s])&&(null!=o[i]?(Array.isArray(o[i])||(o[i]=[o[i]]),o[i].push(n)):o[i]=n);return o},(t={}).Result=function(t,e){this.value=t,this.rest=e},t.Tagged=function(t,e){this.tag=t,this.value=e},t.tag=function(e,s){return function(i){var r,o;if(null!=(r=s(i)))return o=new t.Tagged(e,r.value),new t.Result(o,r.rest)}},t.regex=function(e){return function(s){var i,r;if(null!=(i=e.exec(s)))return r=i[0],new t.Result(r,s.slice(r.length))}},t.sequence=function(){var e;return e=1<=arguments.length?Ti.call(arguments,0):[],function(s){var i,r,o,n,a;for(i=-1,r=e.length,a=[],o=s;++i<r;){if(null==(n=(0,e[i])(o)))return;a.push(n.value),o=n.rest}return new t.Result(a,o)}},t.pick=function(){var e,s;return e=arguments[0],s=2<=arguments.length?Ti.call(arguments,1):[],function(i){var r,o;if(null!=(o=t.sequence.apply(t,s)(i)))return r=o.value,o.value=r[e],o}},t.string=function(e){var s;return s=e.length,function(i){if(i.slice(0,s)===e)return new t.Result(e,i.slice(s))}},t.lazy=function(t){var e;return e=null,function(s){return null==e&&(e=t()),e(s)}},t.baseMany=function(e,s,i,r,o){var n,a,l;for(a=o,l=i?"":[];(null==s||null==s(a))&&null!=(n=e(a));)i?l+=n.value:l.push(n.value),a=n.rest;if(!r||0!==l.length)return new t.Result(l,a)},t.many1=function(e){return function(s){return t.baseMany(e,null,!1,!0,s)}},t.concatMany1Till=function(e,s){return function(i){return t.baseMany(e,s,!0,!0,i)}},t.firstChoice=function(){var t;return t=1<=arguments.length?Ti.call(arguments,0):[],function(e){var s,i,r;for(s=-1,i=t.length;++s<i;)if(null!=(r=(0,t[s])(e)))return r}},d=function(e){var s;return(s={}).wildcard=t.tag("wildcard",t.string(e.wildcardChar)),s.optional=t.tag("optional",t.pick(1,t.string(e.optionalSegmentStartChar),t.lazy((function(){return s.pattern})),t.string(e.optionalSegmentEndChar))),s.name=t.regex(new RegExp("^["+e.segmentNameCharset+"]+")),s.named=t.tag("named",t.pick(1,t.string(e.segmentNameStartChar),t.lazy((function(){return s.name})))),s.escapedChar=t.pick(1,t.string(e.escapeChar),t.regex(/^./)),s.static=t.tag("static",t.concatMany1Till(t.firstChoice(t.lazy((function(){return s.escapedChar})),t.regex(/^./)),t.firstChoice(t.string(e.segmentNameStartChar),t.string(e.optionalSegmentStartChar),t.string(e.optionalSegmentEndChar),s.wildcard))),s.token=t.lazy((function(){return t.firstChoice(s.wildcard,s.optional,s.named,s.static)})),s.pattern=t.many1(t.lazy((function(){return s.token}))),s},a={escapeChar:"\\",segmentNameStartChar:":",segmentValueCharset:"a-zA-Z0-9-_~ %",segmentNameCharset:"a-zA-Z0-9",optionalSegmentStartChar:"(",optionalSegmentEndChar:")",wildcardChar:"*"},o=function(t,e){if(Array.isArray(t))return u(t,(function(t){return o(t,e)}));switch(t.tag){case"wildcard":return"(.*?)";case"named":return"(["+e+"]+)";case"static":return l(t.value);case"optional":return"(?:"+o(t.value,e)+")?"}},r=function(t,e){return null==e&&(e=a.segmentValueCharset),"^"+o(t,e)+"$"},i=function(t){if(Array.isArray(t))return n(t,i);switch(t.tag){case"wildcard":return["_"];case"named":return[t.value];case"static":return[];case"optional":return i(t.value)}},c=function(t,e,s,i){var r,o,n;if(null==i&&(i=!1),null!=(n=t[e])){if(!((r=s[e]||0)>(Array.isArray(n)?n.length-1:0)))return o=Array.isArray(n)?n[r]:n,i&&(s[e]=r+1),o;if(i)throw new Error("too few values provided for key `"+e+"`")}else if(i)throw new Error("no values provided for key `"+e+"`")},s=function(t,e,i){var r,o;if(Array.isArray(t)){for(r=-1,o=t.length;++r<o;)if(s(t[r],e,i))return!0;return!1}switch(t.tag){case"wildcard":return null!=c(e,"_",i,!1);case"named":return null!=c(e,t.value,i,!1);case"static":return!1;case"optional":return s(t.value,e,i)}},g=function(t,e,i){if(Array.isArray(t))return u(t,(function(t){return g(t,e,i)}));switch(t.tag){case"wildcard":return c(e,"_",i,!0);case"named":return c(e,t.value,i,!0);case"static":return t.value;case"optional":return s(t.value,e,i)?g(t.value,e,i):""}},(e=function(t,s){var o,n,l;if(t instanceof e)return this.isRegex=t.isRegex,this.regex=t.regex,this.ast=t.ast,void(this.names=t.names);if(this.isRegex=t instanceof RegExp,"string"!=typeof t&&!this.isRegex)throw new TypeError("argument must be a regex or a string");if(this.isRegex){if(this.regex=t,null!=s){if(!Array.isArray(s))throw new Error("if first argument is a regex the second argument may be an array of group names but you provided something else");if(o=p(this.regex),s.length!==o)throw new Error("regex contains "+o+" groups but array of group names contains "+s.length);this.names=s}}else{if(""===t)throw new Error("argument must not be the empty string");if(t.replace(/\s+/g,"")!==t)throw new Error("argument must not contain whitespace");if(n={escapeChar:(null!=s?s.escapeChar:void 0)||a.escapeChar,segmentNameStartChar:(null!=s?s.segmentNameStartChar:void 0)||a.segmentNameStartChar,segmentNameCharset:(null!=s?s.segmentNameCharset:void 0)||a.segmentNameCharset,segmentValueCharset:(null!=s?s.segmentValueCharset:void 0)||a.segmentValueCharset,optionalSegmentStartChar:(null!=s?s.optionalSegmentStartChar:void 0)||a.optionalSegmentStartChar,optionalSegmentEndChar:(null!=s?s.optionalSegmentEndChar:void 0)||a.optionalSegmentEndChar,wildcardChar:(null!=s?s.wildcardChar:void 0)||a.wildcardChar},null==(l=d(n).pattern(t)))throw new Error("couldn't parse pattern");if(""!==l.rest)throw new Error("could only partially parse pattern");this.ast=l.value,this.regex=new RegExp(r(this.ast,n.segmentValueCharset)),this.names=i(this.ast)}}).prototype.match=function(t){var e,s;return null==(s=this.regex.exec(t))?null:(e=s.slice(1),this.names?h(this.names,e):e)},e.prototype.stringify=function(t){if(null==t&&(t={}),this.isRegex)throw new Error("can't stringify patterns generated from a regex");if(t!==Object(t))throw new Error("argument must be an object or undefined");return g(this.ast,t,{})},e.escapeForRegex=l,e.concatMap=n,e.stringConcatMap=u,e.regexGroupCount=p,e.keysAndValuesToObject=h,e.P=t,e.newParser=d,e.defaultOptions=a,e.astNodeToRegexString=r,e.astNodeToNames=i,e.getParam=c,e.astNodeContainsSegmentsForProvidedParams=s,e.stringify=g,e},null!==Ni.exports?ji.exports=Ii():Mi.UrlPattern=Ii();const zi=Ei(Ni.exports);var Ri=Object.defineProperty,Fi=Object.getOwnPropertyDescriptor,Ui=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?Fi(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&Ri(e,s,o),o};let Vi=class extends(he(ue(Zt))){constructor(){super(...arguments),this.templateValueAttribute="data-route",this._location=document.location.href.replace(document.location.origin,"")}connectedCallback(){this.noShadowDom="",ye.onChange(this),super.connectedCallback()}disconnectedCallback(){ye.offChange(this),super.disconnectedCallback()}set location(t){this._location=t,this.requestUpdate()}get location(){return this._location}render(){const t=[];for(const s of this.templatePartsList){const i=s.getAttribute(this.templateValueAttribute)||"";if(new RegExp(i).test(this.location))t.push(s);else try{new zi("(/)*"+i+"*").match(this.location)&&(s.setAttribute("mode","patternMatching"),t.push(s))}catch(e){-1!=this.location.indexOf(i.replace(document.location.origin,""))&&t.push(s)}}if(0==t.length){this.fallBackRoute&&this.isConnected&&(document.location.href=this.fallBackRoute);const e=this.templatePartsList.find((t=>t.hasAttribute("data-fallback")));e&&t.push(e)}return pt`${Ye(t,((t,e)=>e+(new Date).getTime()),(t=>{var e;if(t.title&&(document.title=t.title),t.hasAttribute("dataProviderExpression")){let s="";const i=t.getAttribute("dataProviderExpression")||"";if("patternMatching"==t.getAttribute("mode")){const e=new zi("(/)*"+(t.getAttribute(this.templateValueAttribute)||"")+"*");s=new zi(i).stringify(e.match(this.location))}else{const r=new RegExp(t.getAttribute(this.templateValueAttribute)||""),o=(this.location+"").match(r);o&&(s=(null==(e=o.shift())?void 0:e.replace(r,i))||"")}return pt`<div style="display:contents" dataProvider="${s}">${ei(t)}</div>`}return ei(t)}))}`}};Ui([F({type:String})],Vi.prototype,"fallBackRoute",2),Ui([F()],Vi.prototype,"location",1),Vi=Ui([b("sonic-router")],Vi);var Bi=Object.defineProperty,Hi=Object.getOwnPropertyDescriptor;let qi=class extends(he(Zt)){connectedCallback(){this.noShadowDom="",this.style.display="none",super.connectedCallback(),this.udpateCallBack=()=>this.update(),this.publisher&&this.publisher.onInternalMutation(this.udpateCallBack)}disconnectedCallback(){this.publisher&&this.publisher.offInternalMutation(this.udpateCallBack),super.disconnectedCallback()}update(){if(this.hasAttribute("onAdded"))return void ye.changeFromComponent(this);if(!this.props)return;const t=this.getAttribute("onData").split("."),e=g.traverse(this.props,t);!e||g.isObject(e)&&e||ye.changeFromComponent(this)}};qi=((t,e,s,i)=>{for(var r,o=i>1?void 0:i?Hi(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&Bi(e,s,o),o})([b("sonic-redirect")],qi);var Wi=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,Zi=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?Ki(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&Wi(e,s,o),o};let Yi=class extends(he(ue(Zt))){constructor(){super(...arguments),this.state="",this.inverted=!1,this.statePath="",this.onAssign=t=>{this.state=t,this.requestUpdate()}}connectedCallback(){if(this.noShadowDom="",super.connectedCallback(),this.hasAttribute("data-path")&&(this.statePath=this.getAttribute("data-path")),this.statePath){this.statePublisher=this.publisher;const t=this.statePath.split(".");for(const e of t)this.statePublisher=this.statePublisher[e];this.statePublisher.onAssign(this.onAssign)}}disconnectedCallback(){var t;this.statePath&&(null==(t=this.statePublisher)||t.offAssign(this.onAssign)),super.disconnectedCallback()}render(){const t=[];let e=this.state;(!Array.isArray(e)&&g.isObject(e)||void 0===e)&&(e="");for(const s of this.templatePartsList){let i=s.getAttribute(this.templateValueAttribute),r=e;this.inverted&&(r=i,i=e),""==i&&(i=this.inverted?".*?":"^$");if(new RegExp(i).test(r))t.push(s),s.removeAttribute("mode");else{const e=new zi(i);e.names.length>0&&e.match(r)&&(s.setAttribute("mode","patternMatching"),t.push(s))}}return pt`${Ye(t,((t,e)=>e+(new Date).getTime()),(t=>{var s;if(t.title&&(document.title=t.title),t.hasAttribute("dataProviderExpression")){const i=t.getAttribute("dataProviderExpression");let r="",o=e,n=t.getAttribute(this.templateValueAttribute);if(this.inverted&&(o=n,n=e),""==n&&(n=this.inverted?"*":"^$"),"patternMatching"==t.getAttribute("mode")){const t=new zi(n);r=new zi(i).stringify(t.match(o))}else{const t=new RegExp(n),e=(o+"").match(t);e&&(r=null==(s=e.shift())?void 0:s.replace(t,i))}return pt`<div style="display:contents" dataProvider="${r}">${ei(t)}</div>`}return ei(t)}))}`}};Zi([F()],Yi.prototype,"state",2),Zi([F({type:Boolean,reflect:!0})],Yi.prototype,"inverted",2),Yi=Zi([b("sonic-states")],Yi);var Gi=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor;let Ji=class extends Zt{createRenderRoot(){return this}render(){return pt`<slot></slot>`}};Ji=((t,e,s,i)=>{for(var r,o=i>1?void 0:i?Qi(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&Gi(e,s,o),o})([b("sonic-scope")],Ji);var Xi=Object.defineProperty,tr=Object.getOwnPropertyDescriptor,er=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?tr(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&Xi(e,s,o),o};let sr=class extends(he(Zt)){constructor(){super(...arguments),this.text="Example"}render(){return pt`<div>${this.text}</div>`}};er([F()],sr.prototype,"text",2),sr=er([b("sonic-example")],sr);const ir={checkbox:{tagName:"sonic-checkbox"},date:{tagName:"sonic-input",attributes:{type:"date"}},fieldset:{tagName:"sonic-fieldset",nodes:[{libraryKey:"formLayout"}],contentElementSelector:"sonic-form-layout"},managed_file:{tagName:"sonic-input",attributes:{variant:"ghost",type:"file"}},password:{tagName:"sonic-input",attributes:{type:"password"}},radio:{tagName:"sonic-radio"},select:{tagName:"sonic-select"},textarea:{tagName:"sonic-textarea"},textfield:{tagName:"sonic-input",attributes:{type:"text"}},hidden:{tagName:"sonic-input",attributes:{type:"hidden"}},button:{tagName:"sonic-button"},form:{tagName:"sonic-submit",attributes:{onEnterKey:!0}},submit:{tagName:"sonic-submit",attributes:{onClick:!0},contentElementSelector:"sonic-button",nodes:[{libraryKey:"button",attributes:{type:"success"},nodes:[{tagName:"sonic-icon",attributes:{name:"check",slot:"prefix"}}]}]},email:{tagName:"sonic-input",attributes:{type:"email"}},formItemContainer:{tagName:"div",attributes:{class:"form-item-container"}},formLayout:{tagName:"sonic-form-layout"},formActions:{tagName:"sonic-form-actions"},passwordHelper:{tagName:"sonic-password-helper"},sameValueHelper:{tagName:"sonic-same-value-helper"},divider:{tagName:"sonic-divider"}};class rr{async transform(t,e){if(this.sduiDescriptor=t,this.sduiDescriptor.library)for(const s in e.library)this.sduiDescriptor.library[s]=e.library[s];for(const s of e.transforms)this.transformAction(s)}transformAction(t){const e=this.getNodesMatchingPatterns(t.patterns,this.sduiDescriptor);this[t.action](t,e)}getNodesMatchingPatterns(t,e){if(!t)return[];if(!e)return[];const s=e.nodes;if(!s)return[];let i=[],r=0;for(const o of t)for(const t of s)this.nodeMatchesPattern(o,t)&&i.push({parent:e,child:t,index:r}),i=i.concat(this.getNodesMatchingPatterns([o],t)),r++;return i}stringMatchesExpression(t,e){return!e||t&&t.match(e)}nodeMatchesPattern(t,e){const s=t,i=e,r=["libraryKey","innerHTML","prefix","suffix","markup"];for(const a of r)if(!this.stringMatchesExpression(i[a],s[a]))return!1;const o=t.attributes,n=e.attributes;if(o&&!n)return!1;if(o)for(const a in o)if(!n||!this.stringMatchesExpression(n[a],o[a]))return!1;return!0}unwrap(t,e){var s,i;for(const r of e)null==(s=r.parent.nodes)||s.splice(r.parent.nodes.indexOf(r.child),1),r.child.nodes&&(null==(i=r.parent.nodes)||i.splice(r.parent.nodes.indexOf(r.child),0,...r.child.nodes))}wrap(t,e){var s,i,r,o,n,a;const l={...t.ui};l.nodes||(l.nodes=[]);let c=0;for(const d of e)null==(s=l.nodes)||s.push(d.child),c>0&&(null==(i=d.parent.nodes)||i.splice(d.parent.nodes.indexOf(d.child),1)),c++;const h=null==(o=null==(r=e[0])?void 0:r.parent.nodes)?void 0:o.indexOf(e[0].child);h&&(null==(n=e[0].parent.nodes)||n.splice(h,1),null==(a=e[0].parent.nodes)||a.splice(h,0,l))}move(t,e){var s,i;for(const r of e){null==(s=r.parent.nodes)||s.splice(r.parent.nodes.indexOf(r.child),1);let e=[];t.after&&(e=this.getNodesMatchingPatterns([t.after],this.sduiDescriptor)),t.before&&(e=this.getNodesMatchingPatterns([t.before],this.sduiDescriptor));const o=e[0];o&&(null==(i=o.parent.nodes)||i.splice(o.parent.nodes.indexOf(o.child)+(t.after?1:0),0,r.child))}}remap(t,e){var s,i,r;for(const o of e){const e={...t.ui};e.attributes||(e.attributes={});const n=o.child.attributes;if(n)for(const t in n)Object.prototype.hasOwnProperty.call(e.attributes,"key")||(e.attributes[t]=n[t]);const a=["libraryKey","innerHTML","prefix","suffix","markup"],l=o.child,c=e;for(const t of a)!Object.prototype.hasOwnProperty.call(e,t)&&l[t]&&(c[t]=l[t]);e.nodes||(e.nodes=[]);const h=o.child.nodes;if(h)for(const t of h)e.nodes.push(t);const d=(null==(s=o.parent.nodes)?void 0:s.indexOf(o.child))||-1;-1!=d&&(null==(i=o.parent.nodes)||i.splice(d,1),null==(r=o.parent.nodes)||r.splice(d,0,e))}}delete(t,e){var s;for(const i of e)null==(s=i.parent.nodes)||s.splice(i.parent.nodes.indexOf(i.child),1)}insert(t,e){var s;const i=t.after?"after":t.before?"before":"in";e=[],t.after?e=this.getNodesMatchingPatterns([t.after],this.sduiDescriptor):t.before?e=this.getNodesMatchingPatterns([t.before],this.sduiDescriptor):t.in&&(e=this.getNodesMatchingPatterns([t.in],this.sduiDescriptor));const r=e[0];r&&("in"==i?(r.child.nodes||(r.child.nodes=[]),r.child.nodes.push({...t.ui})):null==(s=r.parent.nodes)||s.splice(r.parent.nodes.indexOf(r.child)+("after"==i?1:0),0,{...t.ui}))}}var or=Object.defineProperty,nr=Object.getOwnPropertyDescriptor,ar=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?nr(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&or(e,s,o),o};let lr=class extends(Ys(Xs(Zt))){constructor(){super(...arguments),this.sduiDescriptor={}}connectedCallback(){this.noShadowDom="",this.displayContents=!0,this.isFetchEnabled=this.hasAttribute("fetch"),super.connectedCallback()}willUpdate(t){null==this.props&&(this.sduiDescriptor={});{const t=this.sduiKey?this.props[this.sduiKey]:this.props;if(this.sduiDescriptor==t)return;this.sduiDescriptor=t,this.updateContents()}super.willUpdate(t)}async updateContents(){if(!this.sduiDescriptor)return;const t={};Object.assign(t,ir,this.sduiDescriptor.library),this.sduiDescriptor.library=t,this.loadAssets(),await this.loadLibrary(),await this.transformSDUIDescriptor(),this.parseRootNodes()}removeChildren(){for(;[...this.children].filter((t=>"SLOT"!=t.nodeName)).length>0;)this.removeChild(this.children[0])}loadAssets(){if(this.sduiDescriptor){if(this.sduiDescriptor.js)for(const t of this.sduiDescriptor.js)Ee.loadJS(t);if(this.sduiDescriptor.css)for(const t of this.sduiDescriptor.css)Ee.loadCSS(t)}}async transformSDUIDescriptor(){if(!this.hasAttribute("transformation"))return;const t=await fetch(this.getAttribute("transformation")),e=await t.json(),s=new rr;await s.transform(this.sduiDescriptor,e)}async loadLibrary(){if(!this.hasAttribute("library"))return;const t=await fetch(this.getAttribute("library")),e=await t.json();this.sduiDescriptor.library=e}parseRootNodes(){if(this.removeChildren(),!this.sduiDescriptor)return;let t=this.sduiDescriptor.nodes;t||(t=[]);const e={tagName:"sonic-toast-message-subscriber",attributes:{}};this.messagesKey&&(e.attributes={subDataProvider:this.messagesKey}),t.push(e),t.forEach((t=>this.appendChild(this.parseChild(t))))}parseChild(t){const e=t.tagName||"div";let{element:s,contentElement:i}=this.handleLibrary(t,e);if(this.handleAttributes(t,s),s=this.handleMarkup(t,s),i||(i=s),this.handleChildNodes(t,i,s),this.handleInnerHTML(t,i),t.prefix||t.suffix){return this.handlePrefixSuffix(t,s)}return s}handlePrefixSuffix(t,e){const s=document.createElement("div");return s.innerHTML=(t.prefix||"")+e.outerHTML+(t.suffix||""),s.style.display="contents",s}handleChildNodes(t,e,s){if(t.nodes){const i=t.nodes;for(const t of i){const i=this.parseChild(t);let r=e;if(t.parentElementSelector&&(r=s.querySelector(t.parentElementSelector)||e),r.shadowRoot)r.shadowRoot.appendChild(i);else if("template"==r.tagName.toLocaleLowerCase()){r.content.appendChild(i)}else r.appendChild(i)}}}handleLibrary(t,e){let s,i;if(t.libraryKey&&this.sduiDescriptor.library){s=this.parseChild(this.sduiDescriptor.library[t.libraryKey]||{tagName:"div"});const e=(this.sduiDescriptor.library[t.libraryKey]||{}).contentElementSelector;e&&(i=s.querySelector(e))}else s=document.createElement(e);return{element:s,contentElement:i}}handleAttributes(t,e){const s=t.attributes;for(const i in s){const t=s[i],r=Me.isObject(t)?JSON.stringify(t):t;e.setAttribute(i,r)}}handleMarkup(t,e){return t.markup&&((e=document.createElement("div")).style.display="contents",e.innerHTML=t.markup),e}handleInnerHTML(t,e){var s;if(t.innerHTML)if(-1!=t.innerHTML.indexOf("wording_")){const i=this.getAncestorAttributeValue("wordingProvider");null==(s=this.api)||s.post(i,{labels:[t.innerHTML.substring(8)]}).then((t=>{e&&(e.innerHTML+=t)}))}else e&&(e.innerHTML+=t.innerHTML)}};ar([F()],lr.prototype,"sduiKey",2),ar([F()],lr.prototype,"messagesKey",2),lr=ar([b("sonic-sdui")],lr);var cr=Object.defineProperty,hr=Object.getOwnPropertyDescriptor,dr=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?hr(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&cr(e,s,o),o};let pr=class extends(Xs(Zt)){constructor(){super(...arguments),this._composition={},this.listeners=[]}get composition(){return this._composition}set composition(t){this._composition=t,this.updateComposition()}connectedCallback(){super.connectedCallback(),this.updateComposition()}disconnectedCallback(){this.removePublisherListeners(),super.disconnectedCallback()}updateComposition(){this.removePublisherListeners(),this.publisher&&(this.publisher.set({}),this.parseComposition(this.composition,this.publisher))}removePublisherListeners(){const t=this.listeners;this.listeners=[],t.forEach((t=>{this.publisher.offAssign(t.subscriber)}))}parseComposition(t,e){if(t)for(const s in t){const i=t[s];if("string"==typeof i){const t=i.split("."),r=t.shift();if(!r)continue;let o=Te.get(r);o=Me.traverse(o,t);const n={publisher:o,subscriber:t=>{e[s]=t}};this.listeners.push(n),o.onAssign(n.subscriber),e._proxies_.set(s,o)}else{this.publisher[s]={};const t=new n({},e);e._proxies_.set(s,t);const r={publisher:t,subscriber:t=>{e[s]=t}};this.listeners.push(r),t.onAssign(r.subscriber),this.parseComposition(i,t)}}}render(){return pt`<slot></slot>`}};pr.styles=[x`
|
|
1125
1125
|
:host {
|
|
1126
1126
|
display: contents;
|
|
1127
1127
|
}
|
package/concorde-core.es.js
CHANGED
|
@@ -379,15 +379,11 @@ var require_concorde_core_es = __commonJS({
|
|
|
379
379
|
if (this._value_[key] === void 0)
|
|
380
380
|
delete this._value_[key];
|
|
381
381
|
}
|
|
382
|
-
this._proxies_.forEach((
|
|
382
|
+
this._proxies_.forEach((_subProxy, key) => {
|
|
383
383
|
if (this._value_[key] === void 0) {
|
|
384
|
-
if (
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
if (key != "_parent_") {
|
|
388
|
-
if (prevValue[key])
|
|
389
|
-
this._value_[key] = null;
|
|
390
|
-
}
|
|
384
|
+
if (key != "_parent_") {
|
|
385
|
+
if (prevValue[key])
|
|
386
|
+
this._value_[key] = null;
|
|
391
387
|
}
|
|
392
388
|
}
|
|
393
389
|
});
|
|
@@ -625,7 +621,7 @@ var require_concorde_core_es = __commonJS({
|
|
|
625
621
|
return new TextDecoder().decode(result);
|
|
626
622
|
}
|
|
627
623
|
};
|
|
628
|
-
_PublisherManager.buildDate = "
|
|
624
|
+
_PublisherManager.buildDate = "Thu Apr 04 2024 11:34:32 GMT+0200 (Central European Summer Time)";
|
|
629
625
|
_PublisherManager.changed = false;
|
|
630
626
|
_PublisherManager.saving = false;
|
|
631
627
|
_PublisherManager.saveId = 0;
|
|
@@ -734,8 +730,9 @@ var require_concorde_core_es = __commonJS({
|
|
|
734
730
|
* Autres propriétés classiques d'un objet implémentées par le proxy
|
|
735
731
|
*/
|
|
736
732
|
deleteProperty: function(publisherInstance, sKey) {
|
|
733
|
+
var _a2;
|
|
737
734
|
publisherInstance._publishDynamicFilling_(sKey, null);
|
|
738
|
-
publisherInstance._proxies_.
|
|
735
|
+
(_a2 = publisherInstance._proxies_.get(sKey)) == null ? void 0 : _a2.set(null);
|
|
739
736
|
return delete publisherInstance._value_[sKey];
|
|
740
737
|
},
|
|
741
738
|
// enumerate: function (publisherInstance, sKey): CoreJSType {
|
|
@@ -6845,6 +6842,7 @@ var require_concorde_core_es = __commonJS({
|
|
|
6845
6842
|
if (!Array.isArray(this.props)) {
|
|
6846
6843
|
const newProps2 = [];
|
|
6847
6844
|
newProps2.resultCount = this.resultCount;
|
|
6845
|
+
newProps2.lastFetchedData = (e2 == null ? void 0 : e2.detail.fetchedData) || {};
|
|
6848
6846
|
this.props = newProps2;
|
|
6849
6847
|
} else {
|
|
6850
6848
|
const props = this.props;
|
|
@@ -6885,6 +6883,7 @@ var require_concorde_core_es = __commonJS({
|
|
|
6885
6883
|
}
|
|
6886
6884
|
];
|
|
6887
6885
|
newProps.resultCount = this.resultCount;
|
|
6886
|
+
newProps.lastFetchedData = (e2 == null ? void 0 : e2.detail.fetchedData) || {};
|
|
6888
6887
|
this.props = newProps;
|
|
6889
6888
|
this.lastRequestTime = (/* @__PURE__ */ new Date()).getTime();
|
|
6890
6889
|
}
|
|
@@ -7654,7 +7653,7 @@ var require_concorde_core_es = __commonJS({
|
|
|
7654
7653
|
templates.push(t2);
|
|
7655
7654
|
} else {
|
|
7656
7655
|
try {
|
|
7657
|
-
if (new UrlPattern(path).match(this.location)) {
|
|
7656
|
+
if (new UrlPattern("(/)*" + path + "*").match(this.location)) {
|
|
7658
7657
|
t2.setAttribute("mode", "patternMatching");
|
|
7659
7658
|
templates.push(t2);
|
|
7660
7659
|
}
|
|
@@ -7687,7 +7686,7 @@ var require_concorde_core_es = __commonJS({
|
|
|
7687
7686
|
let dataProvider = "";
|
|
7688
7687
|
const dataProviderExpression = template.getAttribute("dataProviderExpression") || "";
|
|
7689
7688
|
if (template.getAttribute("mode") == "patternMatching") {
|
|
7690
|
-
const matcher = new UrlPattern(template.getAttribute(this.templateValueAttribute) || "");
|
|
7689
|
+
const matcher = new UrlPattern("(/)*" + (template.getAttribute(this.templateValueAttribute) || "") + "*");
|
|
7691
7690
|
const filler = new UrlPattern(dataProviderExpression);
|
|
7692
7691
|
dataProvider = filler.stringify(matcher.match(this.location));
|
|
7693
7692
|
} else {
|
|
@@ -77,6 +77,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
|
|
|
77
77
|
*/
|
|
78
78
|
for (const dataProvider of this.listDataProviders) {
|
|
79
79
|
PublisherManager.delete(dataProvider);
|
|
80
|
+
// this.publisher.lastFetchedData = {};
|
|
80
81
|
}
|
|
81
82
|
this.listDataProviders = [];
|
|
82
83
|
clearTimeout(this.filterTimeoutId);
|
|
@@ -166,6 +167,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
|
|
|
166
167
|
* */
|
|
167
168
|
if (!this.nextHadEvent && e) {
|
|
168
169
|
this.publisher.resultCount = 0;
|
|
170
|
+
// this.publisher.lastFetchedData = {};
|
|
169
171
|
this.resultCount = 0;
|
|
170
172
|
}
|
|
171
173
|
this.nextHadEvent = !!e;
|
|
@@ -176,12 +178,14 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
|
|
|
176
178
|
this.resultCount += e.detail.props.length;
|
|
177
179
|
if (!e.detail.isFirstLoad || !e.detail.props.length || this.dataProviderExpression.indexOf("$offset") == -1) {
|
|
178
180
|
this.publisher.resultCount = this.resultCount;
|
|
181
|
+
// this.publisher.lastFetchedData = {};
|
|
179
182
|
return;
|
|
180
183
|
}
|
|
181
184
|
}
|
|
182
185
|
if (!Array.isArray(this.props)) {
|
|
183
186
|
const newProps = [];
|
|
184
187
|
newProps.resultCount = this.resultCount;
|
|
188
|
+
newProps.lastFetchedData = e?.detail.fetchedData || {};
|
|
185
189
|
this.props = newProps;
|
|
186
190
|
}
|
|
187
191
|
else {
|
|
@@ -223,6 +227,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
|
|
|
223
227
|
},
|
|
224
228
|
];
|
|
225
229
|
newProps.resultCount = this.resultCount;
|
|
230
|
+
newProps.lastFetchedData = e?.detail.fetchedData || {};
|
|
226
231
|
this.props = newProps;
|
|
227
232
|
this.lastRequestTime = new Date().getTime();
|
|
228
233
|
}
|
|
@@ -59,7 +59,7 @@ let SonicRouter = class SonicRouter extends Subscriber(TemplatesContainer(LitEle
|
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
61
|
try {
|
|
62
|
-
if (new UrlPattern(path).match(this.location)) {
|
|
62
|
+
if (new UrlPattern("(/)*" + path + "*").match(this.location)) {
|
|
63
63
|
t.setAttribute("mode", "patternMatching");
|
|
64
64
|
templates.push(t);
|
|
65
65
|
}
|
|
@@ -90,7 +90,7 @@ let SonicRouter = class SonicRouter extends Subscriber(TemplatesContainer(LitEle
|
|
|
90
90
|
let dataProvider = "";
|
|
91
91
|
const dataProviderExpression = template.getAttribute("dataProviderExpression") || "";
|
|
92
92
|
if (template.getAttribute("mode") == "patternMatching") {
|
|
93
|
-
const matcher = new UrlPattern(template.getAttribute(this.templateValueAttribute) || "");
|
|
93
|
+
const matcher = new UrlPattern("(/)*" + (template.getAttribute(this.templateValueAttribute) || "") + "*");
|
|
94
94
|
const filler = new UrlPattern(dataProviderExpression);
|
|
95
95
|
dataProvider = filler.stringify(matcher.match(this.location));
|
|
96
96
|
}
|
package/core/core.d.ts
CHANGED
package/core/core.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./components/functional/functional";
|
|
2
2
|
import "./components/ui/ui";
|
|
3
3
|
import "./mixins/mixins";
|
|
4
|
+
import "./utils/url-pattern";
|
|
4
5
|
import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy";
|
|
5
6
|
import DataBindObserver from "./utils/DataBindObserver";
|
|
6
7
|
if (!window.SonicPublisherManager)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function bind(
|
|
1
|
+
export declare function bind(path: string): (target: unknown, propertyKey: string) => void;
|
|
2
2
|
export declare function onAssign(...values: Array<string>): (target: unknown, _propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
3
3
|
export declare function autoSubscribe(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
4
4
|
export declare function autoFill(values: string[]): (target: unknown) => void;
|
|
@@ -33,8 +33,8 @@ function setSubscribable(target) {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
export function bind(
|
|
37
|
-
const split =
|
|
36
|
+
export function bind(path) {
|
|
37
|
+
const split = path.split(".");
|
|
38
38
|
if (split.length == 0) {
|
|
39
39
|
return function () {
|
|
40
40
|
//Empty def function
|
|
@@ -245,20 +245,19 @@ export class PublisherProxy {
|
|
|
245
245
|
if (this._value_[key] === undefined)
|
|
246
246
|
delete this._value_[key];
|
|
247
247
|
}
|
|
248
|
-
this._proxies_.forEach((
|
|
248
|
+
this._proxies_.forEach((_subProxy, key) => {
|
|
249
249
|
/**
|
|
250
250
|
* On supprime les proxys qui ne sont plus dans la nouvelle valeur si ils n'on pas d'écouteurs
|
|
251
251
|
**/
|
|
252
252
|
if (this._value_[key] === undefined) {
|
|
253
|
-
if (!
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (key
|
|
258
|
-
|
|
259
|
-
this._value_[key] = null;
|
|
260
|
-
}
|
|
253
|
+
// if (!_subProxy?.hasListener()) {
|
|
254
|
+
// // this._proxies_.delete(key);
|
|
255
|
+
// } else {
|
|
256
|
+
if (key != "_parent_") {
|
|
257
|
+
if (prevValue[key])
|
|
258
|
+
this._value_[key] = null;
|
|
261
259
|
}
|
|
260
|
+
// }
|
|
262
261
|
}
|
|
263
262
|
});
|
|
264
263
|
/**
|
|
@@ -635,9 +634,12 @@ export default class Publisher extends PublisherProxy {
|
|
|
635
634
|
*/
|
|
636
635
|
deleteProperty: function (publisherInstance, sKey) {
|
|
637
636
|
publisherInstance;
|
|
638
|
-
// publisherInstance._proxies_.get(sKey).set(null);
|
|
639
637
|
publisherInstance._publishDynamicFilling_(sKey, null);
|
|
640
|
-
publisherInstance._proxies_.
|
|
638
|
+
// if (!publisherInstance._proxies_.get(sKey)?.hasListener()) {
|
|
639
|
+
// publisherInstance._proxies_.delete(sKey);
|
|
640
|
+
// } else {
|
|
641
|
+
publisherInstance._proxies_.get(sKey)?.set(null);
|
|
642
|
+
// }
|
|
641
643
|
return delete publisherInstance._value_[sKey];
|
|
642
644
|
},
|
|
643
645
|
// enumerate: function (publisherInstance, sKey): CoreJSType {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supersoniks/concorde",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"customElements": "custom-elements.json",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -265,6 +265,8 @@
|
|
|
265
265
|
"./utils/Utils": "./core/utils/Utils.js",
|
|
266
266
|
"./core/utils/api": "./core/utils/api.js",
|
|
267
267
|
"./utils/api": "./core/utils/api.js",
|
|
268
|
+
"./core/utils/url-pattern": "./core/utils/url-pattern.js",
|
|
269
|
+
"./utils/url-pattern": "./core/utils/url-pattern.js",
|
|
268
270
|
"./docs/code": "./docs/code.js",
|
|
269
271
|
"./docs/docs": "./docs/docs.js",
|
|
270
272
|
"./docs": "./docs.js",
|
|
@@ -286,5 +288,7 @@
|
|
|
286
288
|
".": "./core/core"
|
|
287
289
|
},
|
|
288
290
|
"type": "module",
|
|
289
|
-
"bin":
|
|
291
|
+
"bin": {
|
|
292
|
+
"concorde": "./cli.js"
|
|
293
|
+
}
|
|
290
294
|
}
|