@supersoniks/concorde 4.9.98-visual-stack.3 → 4.9.98-visual-stack.4
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/build-infos.json +1 -1
- package/concorde-3d.bundle.js +1 -1
- package/concorde-3d.es.js +1 -1
- package/concorde-core.bundle.js +2 -2
- package/concorde-core.es.js +7 -2
- package/concorde-hugging-face-infer.bundle.js +1 -1
- package/concorde-hugging-face-infer.es.js +1 -1
- package/concorde-interactive.bundle.js +38 -43
- package/concorde-interactive.es.js +157 -146
- package/concorde-shader.bundle.js +1 -1
- package/concorde-shader.es.js +1 -1
- package/concorde-webgpu.bundle.js +1 -1
- package/concorde-webgpu.es.js +1 -1
- package/dist/concorde-3d.bundle.js +1 -1
- package/dist/concorde-3d.es.js +1 -1
- package/dist/concorde-core.bundle.js +2 -2
- package/dist/concorde-core.es.js +7 -2
- package/dist/concorde-hugging-face-infer.bundle.js +1 -1
- package/dist/concorde-hugging-face-infer.es.js +1 -1
- package/dist/concorde-interactive.bundle.js +38 -43
- package/dist/concorde-interactive.es.js +157 -146
- package/dist/concorde-shader.bundle.js +1 -1
- package/dist/concorde-shader.es.js +1 -1
- package/dist/concorde-webgpu.bundle.js +1 -1
- package/dist/concorde-webgpu.es.js +1 -1
- package/dist/js/core/components/functional/interactive/gesture.js +19 -6
- package/dist/js/core/components/functional/interactive/gesture.js.map +1 -1
- package/dist/js/core/components/functional/interactive/store.js +11 -3
- package/dist/js/core/components/functional/interactive/store.js.map +1 -1
- package/dist/js/core/mixins/Subscriber.js +6 -1
- package/dist/js/core/mixins/Subscriber.js.map +1 -1
- package/dist/types/core/components/functional/interactive/gesture.d.ts +2 -0
- package/dist/types/core/components/functional/interactive/gesture.d.ts.map +1 -1
- package/dist/types/core/components/functional/interactive/store.d.ts +2 -0
- package/dist/types/core/components/functional/interactive/store.d.ts.map +1 -1
- package/dist/types/core/mixins/Subscriber.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/core/components/functional/interactive/gesture.ts +20 -6
package/concorde-3d.es.js
CHANGED
|
@@ -27854,7 +27854,7 @@ const yt = class yt {
|
|
|
27854
27854
|
return new TextDecoder().decode(c);
|
|
27855
27855
|
}
|
|
27856
27856
|
};
|
|
27857
|
-
yt.buildDate = "
|
|
27857
|
+
yt.buildDate = "Sat Oct 03 2026 09:31:28 GMT+0200 (Central European Summer Time)", yt.changed = !1, yt.saving = !1, yt.saveId = 0, yt.instance = null, yt.instances = /* @__PURE__ */ new Map(), yt.pageShowHandlerInitialized = !1;
|
|
27858
27858
|
let Xt = yt;
|
|
27859
27859
|
if (typeof window < "u") {
|
|
27860
27860
|
const i = window, e = Qx + "PublisherManager", t = i[e] || Xt;
|
package/concorde-core.bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(dn){typeof define=="function"&&define.amd?define(dn):dn()})((function(){"use strict";var Te,st;function Wl(t){const e=t.trim();if(!e)return!1;try{const s=new URL(e,"https://example.invalid/");return s.protocol==="http:"||s.protocol==="https:"||s.protocol==="blob:"}catch{return!1}}let Ge=class Ct{static getLanguage(){const e=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||e}static getCookies(){return document.cookie.split(";").reduce((e,s)=>{const r=s.indexOf("=");return e[s.substring(0,r).trim()]=s.substring(r+1),e},{})}static nextComposedAncestor(e){return e instanceof Element&&e.assignedSlot?e.assignedSlot:e.parentNode||e.host||null}static everyAncestors(e,s){let r=e;for(;r;){if(!s(r))return;r=r.parentNode||r.host}}static overflowMatches(e,s){return s.includes(e.overflowY)||s.includes(e.overflowX)}static findAncestorByOverflow(e,s){let r=e;for(;r;){if(r instanceof Element&&r.nodeType===1){const i=window.getComputedStyle(r);if(Ct.overflowMatches(i,s))return r}r=Ct.nextComposedAncestor(r)}return null}static getScrollableAncestor(e){return Ct.findAncestorByOverflow(e,["auto","scroll","hidden","overlay"])}static getScrollingAncestor(e){return Ct.findAncestorByOverflow(e,["auto","scroll","overlay"])}static scopeAttributeNames(e){const s=e.toLowerCase();return s===e?[e]:[e,s]}static readScopeAttributeOnElement(e,s){for(const r of Ct.scopeAttributeNames(s))if(e.hasAttribute(r))return e.getAttribute(r)??"";return null}static getAncestorAttributeValue(e,s){if(!e)return null;let r=e;for(;r;){if(r instanceof HTMLElement){const n=Ct.readScopeAttributeOnElement(r,s);if(n!=null)return n}const i=r.parentNode||r.host;if(!i)break;r=i}return null}static getApiConfiguration(e){const s=Ct.getAncestorAttributeValue(e,"token"),r=Ct.getAncestorAttributeValue(e,"addHTTPResponse")!=null,i=Ct.getAncestorAttributeValue(e,"serviceURL");let n=null,o=null;const c=Ct.getAncestorAttributeValue(e,"tokenProvider"),h=Ct.getAncestorAttributeValue(e,"eventsApiToken");s||(n=Ct.getAncestorAttributeValue(e,"userName"),o=Ct.getAncestorAttributeValue(e,"password"));const g=Ct.getAncestorAttributeValue(e,"credentials")||void 0,A=e.getAttribute("cache"),m=e.hasAttribute("blockUntilDone"),f=e.hasAttribute("keepAlive");return{serviceURL:i,token:s,userName:n,password:o,authToken:h,tokenProvider:c,addHTTPResponse:r,credentials:g,cache:A,blockUntilDone:m,keepAlive:f}}static getClosestElement(e,s){let r=e;for(;r&&!(r.nodeName&&r.nodeName.toLowerCase()===s);){const i=r.parentNode||r.host;if(!i){r=null;break}r=i}return r?.nodeName?r:null}static getClosestForm(e){return Ct.getClosestElement(e,"form")}static getAncestorsByTagNames(e,s){const r=new Set(s.map(o=>o.toLowerCase())),i=[];let n=e.parentNode||e.host;for(;n;)n instanceof Element&&r.has(n.tagName.toLowerCase())&&i.push(n),n=n.parentNode||n.host;return i}static getAncestorsBySelectors(e,s){const r=[];let i=e.parentNode||e.host;for(;i;){if(i instanceof Element)for(const n of s)try{if(i.matches(n)){r.push(i);break}}catch{}i=i.parentNode||i.host}return r}static async loadJS(e){if(!Wl(e))return!1;const s=typeof document<"u"?new URL(e,document.baseURI).href:e,r=Array.from(document.scripts).find(n=>n.src===s);if(r)return r.dataset.concordeLoaded==="1"?!0:new Promise(n=>{let o=!1;const c=g=>{o||(o=!0,g&&(r.dataset.concordeLoaded="1"),n(g))};r.addEventListener("load",()=>c(!0),{once:!0}),r.addEventListener("error",()=>c(!1),{once:!0});const h=r.readyState;if(h==="complete"||h==="loaded"){c(!0);return}Promise.resolve().then(()=>{Promise.resolve().then(()=>{o||c(!0)})})});const i=/\.es\.js(\?|#|$)/.test(e)||/[?&]module(?:&|=|$)/.test(e);return new Promise(n=>{const o=document.createElement("script");o.src=e,i&&(o.type="module"),o.onload=()=>{o.dataset.concordeLoaded="1",n(!0)},o.onerror=()=>n(!1),document.head.appendChild(o)})}static async loadCSS(e){return new Promise(s=>{const r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,r.onload=()=>s(!0),r.onerror=()=>s(!0),document.head.appendChild(r)})}};const pn=t=>{const e=document.documentElement;new MutationObserver(r=>{for(const i of r)i.type==="attributes"&&i.attributeName==="lang"&&t()}).observe(e,{attributes:!0,attributeFilter:["lang"]})};let Ir=class{static ucFirst(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.substring(1)}static minutesDuration(e,s="",r="long"){s||(s=Ge.getLanguage());const i=(g,A)=>[Math.floor(g/A),g%A];function n(g,A,m){return new Intl.NumberFormat(g,{style:"unit",unit:A,unitDisplay:m}).format}const[o,c]=i(e,60),h=[];return o&&h.push(n(s,"hour",r)(o)),c&&h.push(n(s,"minute",r)(c)),new Intl.ListFormat(s,{style:"long",type:"conjunction"}).format(h)}static js(e){try{return Function("return "+e)()}catch{return""}}};class To{constructor(e){this.path=e}toString(){return this.path}}function Lo(t){return new Proxy(t,{get(e,s){if(s==="path")return e.path;if(s==="toString")return e.toString.bind(e);if(s===Symbol.toStringTag)return"DataProviderKey";if(typeof s=="symbol")return e[s];const r=e.path?`${e.path}.${String(s)}`:String(s);return Lo(new To(r))}})}const Kl=/\$\{|\{\$/;function Gl(t){return Kl.test(t)}function mi(t){const e=typeof t=="string"?t:t.path;if(Gl(e))throw new Error("Static publisher path required for get/set/dp. Use @subscribe, @publish, or @handle for dynamic DataProviderKey paths.");return e}const $s=function(t){return this instanceof $s?Lo(new To(t)):new $s(t)};let lt=class ks{static shallowEqual(e,s,r=!0){const i=Object.keys(e),n=Object.keys(s);if(i.length!==n.length&&r)return!1;for(const o of i){const c=e[o],h=s[o];if(r?c!==h:c!=h)return!1}return!0}static deepEqual(e,s,r=!0){const i=Object.keys(e),n=Object.keys(s);if(i.length!==n.length&&r)return!1;for(const o of i){const c=e[o],h=s[o],g=ks.isObject(c)&&ks.isObject(h),A=r?c!==h:c!=h;if(g&&!ks.deepEqual(c,h)||!g&&A)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}static isUndefindOrNull(e){return e==null}static isEmpty(e){return ks.isUndefindOrNull(e)?!0:Object.keys(e).length===0}static traverse(e,s,r=!1){for(const i of s){const n=e[i];if(n===void 0)return;r&&ks.isObject(n)?e=Object.assign(Array.isArray(n)?[]:{},e,n):e=e[i]}return e}static traverseDotNotation(e,s,r=!1){return ks.traverse(e,s.split("."),r)}static getURLSearchArray(e,s=""){let r=[];for(let i in e){const n=e[i];s&&(i=s+"["+i+"]"),ks.isObject(n)?r=[...r,...this.getURLSearchArray(n,i)]:r.push(`${i}=${n}`)}return r}static getURLSearchString(e){return ks.getURLSearchArray(e,"").join("&")}};const qt=lt.traverseDotNotation;let Yl=class{static async queueTaskPromise(){return new Promise(e=>{window.queueMicrotask(()=>e(null))})}static async delayPromise(e){return new Promise(s=>{setTimeout(s,e)})}},Mo="sonic";typeof __SONIC_PREFIX__<"u"&&(Mo=__SONIC_PREFIX__);let Fo=Mo.replace(/-([a-z])/g,t=>t[1].toUpperCase());const fn=Fo.charAt(0).toUpperCase()+Fo.slice(1),Zl=new Set(["localStorageMode","expirationDelayMs","invalidateOnPageShow"]);function Io(t){return t==null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).some(e=>Zl.has(e))}function gi(t){return Object.prototype.hasOwnProperty.call(t,"__value")}function Ds(t){return typeof t=="object"&&t!==null}let pr="sonic";typeof __SONIC_PREFIX__>"u"&&(pr="sonic");const mn=pr=="sonic"?"publisher-proxies-data":pr+"-publisher-proxies-data",Vs=class Vs{constructor(e,s,r){for(this._proxies_=new Map,this._is_savable_=!1,this._expiration_delay_=1e3*60*60*12,this._invalidate_on_page_show_=!1,this._invalidateListeners_=new Set,this._formInvalidateListeners_=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_=e,this.parent=s||null,this._parentKey_=r,this.root=this,this._instanceCounter_=0;this.root.parent;)this.root=this.root.parent}delete(){for(const e in this._proxies_.keys())e!="_parent_"&&this._proxies_.get(e)?.delete();this._invalidateListeners_.clear(),this._formInvalidateListeners_.clear(),this._assignListeners_.clear(),this._mutationListeners_.clear(),this._fillListeners_.clear(),this._templateFillListeners_.clear(),this._proxies_.clear(),Vs.instances.delete(this._instanceCounter_)}hasListener(){return this._templateFillListeners_.size>0||this._assignListeners_.size>0||this._invalidateListeners_.size>0||this._formInvalidateListeners_.size>0||this._mutationListeners_.size>0||this._fillListeners_.size>0}_publishInternalMutation_(e=!1){if(this._mutationListeners_.forEach(s=>s()),this._is_savable_&&!me.changed){me.changed=!0,me.saveId++;const s=me.saveId;setTimeout(()=>me.getInstance().saveToLocalStorage(s),1e3)}e||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(e=!1){if(this._assignmentId_++,this._assignmentId_!==this._assignmentId_)return;const r=this.get();this._assignListeners_.forEach(i=>{i(r)}),this._publishInternalMutation_(e)}_publishInvalidation_(){this._invalidateListeners_.forEach(e=>e())}_publishFormInvalidation_(){this._formInvalidateListeners_.forEach(e=>e())}_publishDynamicFilling_(e,s){this._fillListeners_.forEach(r=>{r[e]!==s&&(r[e]=s)}),this._publishTemplateFilling_(e,s)}_publishTemplateFilling_(e,s){this._templateFillListeners_.forEach(r=>{const i=Object.getOwnPropertyDescriptor(r,e);i&&!i.set&&!i.writable||(r.propertyMap&&r.propertyMap[e]&&(e=r.propertyMap[e]),typeof r[e]<"u"&&r[e]!==s&&(r[e]=s))})}onAssign(e,s=!0){typeof e=="function"&&(this._assignListeners_.has(e)||(this._assignListeners_.add(e),s&&e(this.get())))}offAssign(e){this._assignListeners_.delete(e)}onInvalidate(e){typeof e=="function"&&this._invalidateListeners_.add(e)}offInvalidate(e){typeof e=="function"&&this._invalidateListeners_.delete(e)}invalidate(){this._publishInvalidation_()}onFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.add(e)}offFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.delete(e)}invalidateForm(){this._publishFormInvalidation_()}onInternalMutation(e){typeof e=="function"&&(this._mutationListeners_.add(e),e())}offInternalMutation(e){typeof e=="function"&&this._mutationListeners_.delete(e)}startTemplateFilling(e){if(this._templateFillListeners_.add(e),typeof this._value_=="object")for(const s in this._value_){let r=s;const i=this._value_[s];e.propertyMap&&e.propertyMap[s]&&(r=e.propertyMap[s]),typeof e[s]<"u"&&e[s]!==i&&(e[r]=i)}}stopTemplateFilling(e){this._templateFillListeners_.delete(e)}startDynamicFilling(e){this._fillListeners_.add(e);for(const s in this._value_){const r=this._value_[s];e[s]!==r&&(e[s]=r)}}stopDynamicFilling(e){this._fillListeners_.delete(e)}set(e,s=!1){if(this._value_===e||Ds(this._value_)&&Ds(e)&&e&&gi(this._value_)&&gi(e)&&this._value_.__value===e.__value||!Ds(e)&&e===this._value_.__value)return!0;this._value_=Ds(e)?e:{__value:e},this._cachedGet_=void 0;const r=gi(this._value_);if(this._parentKey_&&this.parent){const i=gi(this._value_)?this._value_.__value:this._value_;if(this.parent?.get()==null&&this.parent?.get()==null)if(isNaN(Number(this._parentKey_)))this.parent.set({[this._parentKey_]:i});else{const n=[];n[Number(this._parentKey_)]=i,this.parent.set(n)}else this.parent._value_[this._parentKey_]=i}if(r)return this._proxies_.forEach((i,n)=>{n!="_parent_"&&(i.set(null),this._publishDynamicFilling_(n,null))}),this._publishAssignement_(s),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_.__value),!0;for(const i in this._value_)this._value_[i]===void 0&&delete this._value_[i];if(this._proxies_.forEach((i,n)=>{const o=this._value_[n];n!="_parent_"&&o===void 0&&o!==null&&isNaN(Number(n))&&(i.set(null),this._publishDynamicFilling_(n,null))}),this._publishAssignement_(),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_),Ds(this._value_))for(const i in this._value_){const n=e[i],c=Ds(n)?n:{__value:n};if(!this._proxies_.has(i)){this._publishDynamicFilling_(i,n);continue}this._proxies_.get(i)?.set(c,!0),this._publishDynamicFilling_(i,n)}return!0}get(){if(Jl(this),this._cachedGet_!==void 0)return this._cachedGet_;if(Object.prototype.hasOwnProperty.call(this._value_,"__value")){const e=this._value_.__value;return this._cachedGet_=e??null}return this._cachedGet_=this._value_!=null?this._value_:null}get $tag(){return this._instanceCounter_||(Vs.instancesCounter++,this._instanceCounter_=Vs.instancesCounter),Vs.instances.set(this._instanceCounter_,this),"<"+pr+'-publisher-proxy publisher="'+this._instanceCounter_+'"></'+pr+"-publisher-proxy>"}};Vs.instances=new Map,Vs.instancesCounter=0;let Nr=Vs;const bi=[];function Jl(t){bi.length>0&&bi[0].add(t)}function No(){bi.unshift(new Set)}function Ro(){return bi.shift()}const Me=class Me{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],Me.instance!=null)throw"Singleton / use getInstance";Me.instance=this,this.isLocalStrorageReady=this.cleanStorageData(),Me.initPageShowHandler()}static initPageShowHandler(){Me.pageShowHandlerInitialized||(Me.pageShowHandlerInitialized=!0,window.addEventListener("pageshow",e=>{e.persisted&&Me.getInstance().invalidateAll()}))}invalidateAll(){this.publishers.forEach(e=>{e._invalidate_on_page_show_&&e.invalidate()})}async cleanStorageData(){return new Promise(e=>{(async()=>{try{let r=localStorage.getItem(mn),i=null;if(r&&(i=await this.decompress(r,"gzip")),i)try{this.localStorageData=JSON.parse(i)}catch{this.localStorageData={}}else r=await this.compress("{}","gzip"),localStorage.setItem(mn,r),this.localStorageData={};const n=1e3*60*60*12;for(const o in this.localStorageData){const c=this.localStorageData[o],h=new Date().getTime()-(c.expirationDelayMs||n);c.lastModifiationMS<h&&delete this.localStorageData[o]}e(!0)}catch{window.requestAnimationFrame(()=>{e(!1)}),console.warn("no publisher cache in this browser")}})()})}static getInstance(e){if(e){const s=Me.instances.get(e);return s||(console.warn("No PublisherManager instance registered with id:",e,"creating new one"),new Me)}return Me.instance==null?new Me:Me.instance}static get(e,s){return Me.getInstance().get(e,s)}async setLocalData(e,s){await this.isLocalStrorageReady,e.set(this.localStorageData[s+"¤lang_"+Ge.getLanguage()]?.data||e.get())}get(e,s){const r=s?.localStorageMode==="enabled",i=s?.invalidateOnPageShow===!0;if(!this.publishers.has(e)){const c=gn({});this.set(e,c)}const n=this.publishers.get(e);return r&&this.initialisedData.indexOf(e)===-1&&(s?.expirationDelayMs&&(n._expiration_delay_=s.expirationDelayMs),n._is_savable_=!0,this.initialisedData.push(e),this.setLocalData(n,e)),i&&(n._invalidate_on_page_show_=i),this.publishers.get(e)}set(e,s){this.publishers.set(e,s)}delete(e){return this.publishers.has(e)?(this.publishers.delete(e),!0):!1}async saveToLocalStorage(e=0){if(!(e!==Me.saveId&&e%10!=0))try{if(!Me.changed||Me.saving)return;Me.saving=!0,Me.changed=!1;const s=Array.from(this.publishers.keys());let r=!1;for(const i of s){const n=this.publishers.get(i);if(!n?._is_savable_)continue;const o=n?.get();o&&(this.localStorageData[i+"¤lang_"+Ge.getLanguage()]={lastModifiationMS:new Date().getTime(),expirationDelayMs:n._expiration_delay_,data:o},r=!0)}if(r){const i=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem(mn,i)}if(Me.saving=!1,Me.changed){Me.saveId++;const i=Me.saveId;setTimeout(()=>this.saveToLocalStorage(i),1e3)}}catch{Me.saving=!1}}async compress(e,s){const r=new TextEncoder().encode(e),i=window,n=new i.CompressionStream(s),o=n.writable.getWriter();o.write(r),o.close();const c=await new Response(n.readable).arrayBuffer(),h=new Uint8Array(c);let g="";for(let A=0;A<h.length;A++)g+=String.fromCharCode(h[A]);return btoa(g)}async decompress(e,s){const r=atob(e),n=Uint8Array.from(r,A=>A.charCodeAt(0)).buffer,o=window,c=new o.DecompressionStream(s),h=c.writable.getWriter();h.write(n),h.close();const g=await new Response(c.readable).arrayBuffer();return new TextDecoder().decode(g)}};Me.buildDate="Thu Oct 01 2026 19:01:47 GMT+0200 (Central European Summer Time)",Me.changed=!1,Me.saving=!1,Me.saveId=0,Me.instance=null,Me.instances=new Map,Me.pageShowHandlerInitialized=!1;let me=Me;if(typeof window<"u"){const t=window,e=fn+"PublisherManager",s=t[e]||me;if(t[e]||(t[e]=me),s!==me){const r=["instance","instances","changed","saving","saveId","pageShowHandlerInitialized"];for(const i of r)Object.defineProperty(me,i,{configurable:!0,get(){return s[i]},set(n){s[i]=n}})}}const Ql=new Set(["invalidate","onInvalidate","offInvalidate","invalidateForm","onFormInvalidate","offFormInvalidate","onAssign","offAssign","startDynamicFilling","stopDynamicFilling","startTemplateFilling","stopTemplateFilling","onInternalMutation","offInternalMutation","set","get","$tag","_cachedGet_","_templateFillListeners_","_fillListeners_","_assignListeners_","_invalidateListeners_","_formInvalidateListeners_","_publishInternalMutation_","hasListener","delete","_mutationListeners_","_publishDynamicFilling_","_publishInvalidation_","_publishFormInvalidation_","_publishTemplateFilling_","_publishAssignement_","_proxies_","parent","_parentKey_","_value_","_is_savable_","_expiration_delay_","_lockInternalMutationPublishing_","_instanceCounter_","_assignmentId_","_invalidate_on_page_show_"]);function Xl(t,e){return{get:function(s,r){if(typeof r=="string"&&Ql.has(r))return t[r];if(r==Symbol.toPrimitive)return()=>e().get();if(!t._proxies_.has(r)){const i=t._value_[r],n=gn(Ds(i)?i:{__value:i},t,r);n._proxies_.set("_parent_",e()),t._proxies_.set(r,n)}return t._proxies_.get(r)},set:function(s,r,i){if(r=="_value_")return t._value_=i,!0;if(r=="_cachedGet_")return t._cachedGet_=i,!0;if(r=="_assignmentId_")return t._assignmentId_=i,!0;if(r=="_is_savable_")return t._is_savable_=i,!0;if(r=="_expiration_delay_")return t._expiration_delay_=i,!0;if(r=="_invalidate_on_page_show_")return t._invalidate_on_page_show_=i,!0;if(r=="_instanceCounter_")return t._instanceCounter_=i,!0;if(!t._proxies_.has(r)){const o=gn({},t,r);o._proxies_.set("_parent_",e()),t._proxies_.set(r,o)}return t._value_[r]!==i&&(t._value_[r]=i,t._publishDynamicFilling_(r,i),t._proxies_.get(r)?.set(Ds(i)?i:{__value:i})),!0},deleteProperty:function(s,r){return t._publishDynamicFilling_(r,null),t._proxies_.get(r)?.set(null),delete t._value_[r]},has:function(s,r){return r in t._value_&&r!="_lockInternalMutationPublishing_"},defineProperty:function(s,r,i){return i&&"value"in i&&(t._value_[r]=i.value),!0},getOwnPropertyDescriptor:function(s,r){return{enumerable:!0,configurable:!0}},ownKeys:function(s){return t._value_.__value?Object.keys(t._value_.__value):Object.keys(t._value_)}}}function gn(t,e=null,s){const r=new Nr(t,e,s);let i=null;const n=Xl(r,()=>i);return i=new Proxy(r,n),i}class ec extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=e=>{this.innerHTML=e.toString()}}connectedCallback(){this.publisherId=this.getAttribute("publisher")||"",this.publisher=Nr.instances.get(parseInt(this.publisherId)),this.publisher?.onAssign(this.onAssign)}disconnectedCallback(){this.publisher?.offAssign(this.onAssign)}}try{customElements.define(pr+"-publisher-proxy",ec)}catch{}const vi=(t,e)=>{if(typeof t=="function"){const s=t;return No(),s(),Ro()}if(typeof t=="string"){const s=t.split("."),r=s.shift()||"";let i=me.get(r,e);i=lt.traverse(i,s);const n=new Set;return n.add(i),n}return new Set([t])};function tc(t){const e=mi(t);return vi(e).values().next().value?.get()}function yi(t,e,s){const r=mi(t);return vi(r,s).values().next().value}function sc(t,e){return Io(e)?yi(t,void 0,e):yi(t)}function wi(t,e){return Io(e)?yi(t,void 0,e):yi(t)}function rc(t,e){const s=mi(t);vi(s).values().next().value?.set(e)}let _i=(Te=class{static disable(){this.enabled&&(this.enabled=!1,Array.from(Te.observedElements.keys()).forEach(e=>Te.unObserve(e)))}static observe(e){if(!e||!Te.enabled||Te.observedElements.has(e))return;const s=new MutationObserver(Te.onMutation),r={};r.childList=!0,r.subtree=!0,r.attributes=!0,r.attributeFilter=["data-bind"],s.observe(e,r),e.querySelectorAll("[data-bind]").forEach(i=>Te.addPublisherListeners(i)),Te.observedElements.set(e,s)}static unObserve(e){if(!e)return;const s=this.observedElements.get(e);s&&(s.disconnect(),e.querySelectorAll("[data-bind]").forEach(r=>Te.removePublisherListeners(r)))}static onAdded(e){e.hasAttribute&&e.hasAttribute("data-bind")&&Te.addPublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(s=>Te.addPublisherListeners(s)):e.childNodes.forEach(s=>Te.onAdded(s))}static onRemoved(e){e.hasAttribute&&e.hasAttribute("data-bind")&&Te.removePublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(s=>Te.removePublisherListeners(s)):e.childNodes.forEach(s=>Te.onRemoved(s))}static onMutation(e){for(const s of e)switch(s.type){case"attributes":Te.addPublisherListeners(s.target);break;case"childList":s.addedNodes.forEach(r=>{Te.onAdded(r)}),s.removedNodes.forEach(r=>{Te.onRemoved(r)});break}}static removePublisherListeners(e){const s=Te.publisherListeners.get(e);s&&(Te.publisherListeners.delete(e),s.forEach(r=>{r.publisher?.offAssign(r.onAssign)}))}static getVariablesDescriptor(e){let s=e.match(/(\$(?:\w+\\?\.?)+)/g);return s?s=s.map(r=>r.replace("$","")):s=[e],s=s.filter(r=>r.length>0),{expression:e.replace("\\",""),variables:s.map(r=>r.split(/\b\.\b/).map(i=>i.replace("\\","")))}}static getDataBindItems(e){return"attributes"in e?Array.from(e.attributes).filter(s=>s.name.indexOf("::")==0).map(s=>({propertyToUpdate:s.name.substring(2).replace(/-((html)|\w)/g,i=>i.substring(1).toUpperCase()),bindedVariablesDescriptor:Te.getVariablesDescriptor(s.value)})):[]}static getSubPublisher(e,s){if(!s)return e;for(const r of s)if(r!="_self_"){if(!e)return null;e=e[r]}return e}static addPublisherListeners(e){Te.removePublisherListeners(e);const s=Ge.getAncestorAttributeValue(e.parentNode||e.host||e,"dataProvider");if(!s)return;const r=me.getInstance().get(s),i=Te.getDataBindItems(e),n=[];i.forEach(o=>{const c=o.bindedVariablesDescriptor,h=o.propertyToUpdate;for(const g of c.variables){const A=g;let m=r;m=Te.getSubPublisher(r,A);const f=e,k={publisher:m,onAssign:()=>{const E=c.variables.map(B=>Te.getSubPublisher(r,B)?.get());let O=c.expression,z=!1;if(E.length==1&&c.variables[0].join(".")==O.substring(1)){let B=E[0];B===null&&(B=""),f[h]=B;return}for(let B=0;B<E.length;B++){let S=E[B];const y=c.variables[B];S===null&&(z=!0,S=void 0),O=O.replace("$"+y.join("."),S)}if(O.indexOf("|")!=-1){const B=O.indexOf("|");if(B==0)O=Ir.js(O.substring(1));else{const S=O.substring(0,B),y=O.substring(B+1),F=Ir[S];O=z?"":F?F(y):O}}else O=z?"":O;f[h]=O}};m?.onAssign(k.onAssign),n.push(k)}}),Te.publisherListeners.set(e,n)}},Te.observedElements=new Map,Te.enabled=!0,Te.publisherListeners=new Map,Te);_i.observe(document.documentElement),window.SonicDataBindObserver||(window.SonicDataBindObserver=_i);/**
|
|
1
|
+
(function(dn){typeof define=="function"&&define.amd?define(dn):dn()})((function(){"use strict";var Te,st;function Wl(t){const e=t.trim();if(!e)return!1;try{const s=new URL(e,"https://example.invalid/");return s.protocol==="http:"||s.protocol==="https:"||s.protocol==="blob:"}catch{return!1}}let Ge=class Ct{static getLanguage(){const e=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||e}static getCookies(){return document.cookie.split(";").reduce((e,s)=>{const r=s.indexOf("=");return e[s.substring(0,r).trim()]=s.substring(r+1),e},{})}static nextComposedAncestor(e){return e instanceof Element&&e.assignedSlot?e.assignedSlot:e.parentNode||e.host||null}static everyAncestors(e,s){let r=e;for(;r;){if(!s(r))return;r=r.parentNode||r.host}}static overflowMatches(e,s){return s.includes(e.overflowY)||s.includes(e.overflowX)}static findAncestorByOverflow(e,s){let r=e;for(;r;){if(r instanceof Element&&r.nodeType===1){const i=window.getComputedStyle(r);if(Ct.overflowMatches(i,s))return r}r=Ct.nextComposedAncestor(r)}return null}static getScrollableAncestor(e){return Ct.findAncestorByOverflow(e,["auto","scroll","hidden","overlay"])}static getScrollingAncestor(e){return Ct.findAncestorByOverflow(e,["auto","scroll","overlay"])}static scopeAttributeNames(e){const s=e.toLowerCase();return s===e?[e]:[e,s]}static readScopeAttributeOnElement(e,s){for(const r of Ct.scopeAttributeNames(s))if(e.hasAttribute(r))return e.getAttribute(r)??"";return null}static getAncestorAttributeValue(e,s){if(!e)return null;let r=e;for(;r;){if(r instanceof HTMLElement){const n=Ct.readScopeAttributeOnElement(r,s);if(n!=null)return n}const i=r.parentNode||r.host;if(!i)break;r=i}return null}static getApiConfiguration(e){const s=Ct.getAncestorAttributeValue(e,"token"),r=Ct.getAncestorAttributeValue(e,"addHTTPResponse")!=null,i=Ct.getAncestorAttributeValue(e,"serviceURL");let n=null,o=null;const c=Ct.getAncestorAttributeValue(e,"tokenProvider"),h=Ct.getAncestorAttributeValue(e,"eventsApiToken");s||(n=Ct.getAncestorAttributeValue(e,"userName"),o=Ct.getAncestorAttributeValue(e,"password"));const g=Ct.getAncestorAttributeValue(e,"credentials")||void 0,A=e.getAttribute("cache"),m=e.hasAttribute("blockUntilDone"),f=e.hasAttribute("keepAlive");return{serviceURL:i,token:s,userName:n,password:o,authToken:h,tokenProvider:c,addHTTPResponse:r,credentials:g,cache:A,blockUntilDone:m,keepAlive:f}}static getClosestElement(e,s){let r=e;for(;r&&!(r.nodeName&&r.nodeName.toLowerCase()===s);){const i=r.parentNode||r.host;if(!i){r=null;break}r=i}return r?.nodeName?r:null}static getClosestForm(e){return Ct.getClosestElement(e,"form")}static getAncestorsByTagNames(e,s){const r=new Set(s.map(o=>o.toLowerCase())),i=[];let n=e.parentNode||e.host;for(;n;)n instanceof Element&&r.has(n.tagName.toLowerCase())&&i.push(n),n=n.parentNode||n.host;return i}static getAncestorsBySelectors(e,s){const r=[];let i=e.parentNode||e.host;for(;i;){if(i instanceof Element)for(const n of s)try{if(i.matches(n)){r.push(i);break}}catch{}i=i.parentNode||i.host}return r}static async loadJS(e){if(!Wl(e))return!1;const s=typeof document<"u"?new URL(e,document.baseURI).href:e,r=Array.from(document.scripts).find(n=>n.src===s);if(r)return r.dataset.concordeLoaded==="1"?!0:new Promise(n=>{let o=!1;const c=g=>{o||(o=!0,g&&(r.dataset.concordeLoaded="1"),n(g))};r.addEventListener("load",()=>c(!0),{once:!0}),r.addEventListener("error",()=>c(!1),{once:!0});const h=r.readyState;if(h==="complete"||h==="loaded"){c(!0);return}Promise.resolve().then(()=>{Promise.resolve().then(()=>{o||c(!0)})})});const i=/\.es\.js(\?|#|$)/.test(e)||/[?&]module(?:&|=|$)/.test(e);return new Promise(n=>{const o=document.createElement("script");o.src=e,i&&(o.type="module"),o.onload=()=>{o.dataset.concordeLoaded="1",n(!0)},o.onerror=()=>n(!1),document.head.appendChild(o)})}static async loadCSS(e){return new Promise(s=>{const r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,r.onload=()=>s(!0),r.onerror=()=>s(!0),document.head.appendChild(r)})}};const pn=t=>{const e=document.documentElement;new MutationObserver(r=>{for(const i of r)i.type==="attributes"&&i.attributeName==="lang"&&t()}).observe(e,{attributes:!0,attributeFilter:["lang"]})};let Ir=class{static ucFirst(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.substring(1)}static minutesDuration(e,s="",r="long"){s||(s=Ge.getLanguage());const i=(g,A)=>[Math.floor(g/A),g%A];function n(g,A,m){return new Intl.NumberFormat(g,{style:"unit",unit:A,unitDisplay:m}).format}const[o,c]=i(e,60),h=[];return o&&h.push(n(s,"hour",r)(o)),c&&h.push(n(s,"minute",r)(c)),new Intl.ListFormat(s,{style:"long",type:"conjunction"}).format(h)}static js(e){try{return Function("return "+e)()}catch{return""}}};class To{constructor(e){this.path=e}toString(){return this.path}}function Lo(t){return new Proxy(t,{get(e,s){if(s==="path")return e.path;if(s==="toString")return e.toString.bind(e);if(s===Symbol.toStringTag)return"DataProviderKey";if(typeof s=="symbol")return e[s];const r=e.path?`${e.path}.${String(s)}`:String(s);return Lo(new To(r))}})}const Kl=/\$\{|\{\$/;function Gl(t){return Kl.test(t)}function mi(t){const e=typeof t=="string"?t:t.path;if(Gl(e))throw new Error("Static publisher path required for get/set/dp. Use @subscribe, @publish, or @handle for dynamic DataProviderKey paths.");return e}const $s=function(t){return this instanceof $s?Lo(new To(t)):new $s(t)};let lt=class ks{static shallowEqual(e,s,r=!0){const i=Object.keys(e),n=Object.keys(s);if(i.length!==n.length&&r)return!1;for(const o of i){const c=e[o],h=s[o];if(r?c!==h:c!=h)return!1}return!0}static deepEqual(e,s,r=!0){const i=Object.keys(e),n=Object.keys(s);if(i.length!==n.length&&r)return!1;for(const o of i){const c=e[o],h=s[o],g=ks.isObject(c)&&ks.isObject(h),A=r?c!==h:c!=h;if(g&&!ks.deepEqual(c,h)||!g&&A)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}static isUndefindOrNull(e){return e==null}static isEmpty(e){return ks.isUndefindOrNull(e)?!0:Object.keys(e).length===0}static traverse(e,s,r=!1){for(const i of s){const n=e[i];if(n===void 0)return;r&&ks.isObject(n)?e=Object.assign(Array.isArray(n)?[]:{},e,n):e=e[i]}return e}static traverseDotNotation(e,s,r=!1){return ks.traverse(e,s.split("."),r)}static getURLSearchArray(e,s=""){let r=[];for(let i in e){const n=e[i];s&&(i=s+"["+i+"]"),ks.isObject(n)?r=[...r,...this.getURLSearchArray(n,i)]:r.push(`${i}=${n}`)}return r}static getURLSearchString(e){return ks.getURLSearchArray(e,"").join("&")}};const qt=lt.traverseDotNotation;let Yl=class{static async queueTaskPromise(){return new Promise(e=>{window.queueMicrotask(()=>e(null))})}static async delayPromise(e){return new Promise(s=>{setTimeout(s,e)})}},Mo="sonic";typeof __SONIC_PREFIX__<"u"&&(Mo=__SONIC_PREFIX__);let Fo=Mo.replace(/-([a-z])/g,t=>t[1].toUpperCase());const fn=Fo.charAt(0).toUpperCase()+Fo.slice(1),Zl=new Set(["localStorageMode","expirationDelayMs","invalidateOnPageShow"]);function Io(t){return t==null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).some(e=>Zl.has(e))}function gi(t){return Object.prototype.hasOwnProperty.call(t,"__value")}function Ds(t){return typeof t=="object"&&t!==null}let pr="sonic";typeof __SONIC_PREFIX__>"u"&&(pr="sonic");const mn=pr=="sonic"?"publisher-proxies-data":pr+"-publisher-proxies-data",Vs=class Vs{constructor(e,s,r){for(this._proxies_=new Map,this._is_savable_=!1,this._expiration_delay_=1e3*60*60*12,this._invalidate_on_page_show_=!1,this._invalidateListeners_=new Set,this._formInvalidateListeners_=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_=e,this.parent=s||null,this._parentKey_=r,this.root=this,this._instanceCounter_=0;this.root.parent;)this.root=this.root.parent}delete(){for(const e in this._proxies_.keys())e!="_parent_"&&this._proxies_.get(e)?.delete();this._invalidateListeners_.clear(),this._formInvalidateListeners_.clear(),this._assignListeners_.clear(),this._mutationListeners_.clear(),this._fillListeners_.clear(),this._templateFillListeners_.clear(),this._proxies_.clear(),Vs.instances.delete(this._instanceCounter_)}hasListener(){return this._templateFillListeners_.size>0||this._assignListeners_.size>0||this._invalidateListeners_.size>0||this._formInvalidateListeners_.size>0||this._mutationListeners_.size>0||this._fillListeners_.size>0}_publishInternalMutation_(e=!1){if(this._mutationListeners_.forEach(s=>s()),this._is_savable_&&!me.changed){me.changed=!0,me.saveId++;const s=me.saveId;setTimeout(()=>me.getInstance().saveToLocalStorage(s),1e3)}e||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(e=!1){if(this._assignmentId_++,this._assignmentId_!==this._assignmentId_)return;const r=this.get();this._assignListeners_.forEach(i=>{i(r)}),this._publishInternalMutation_(e)}_publishInvalidation_(){this._invalidateListeners_.forEach(e=>e())}_publishFormInvalidation_(){this._formInvalidateListeners_.forEach(e=>e())}_publishDynamicFilling_(e,s){this._fillListeners_.forEach(r=>{r[e]!==s&&(r[e]=s)}),this._publishTemplateFilling_(e,s)}_publishTemplateFilling_(e,s){this._templateFillListeners_.forEach(r=>{const i=Object.getOwnPropertyDescriptor(r,e);i&&!i.set&&!i.writable||(r.propertyMap&&r.propertyMap[e]&&(e=r.propertyMap[e]),typeof r[e]<"u"&&r[e]!==s&&(r[e]=s))})}onAssign(e,s=!0){typeof e=="function"&&(this._assignListeners_.has(e)||(this._assignListeners_.add(e),s&&e(this.get())))}offAssign(e){this._assignListeners_.delete(e)}onInvalidate(e){typeof e=="function"&&this._invalidateListeners_.add(e)}offInvalidate(e){typeof e=="function"&&this._invalidateListeners_.delete(e)}invalidate(){this._publishInvalidation_()}onFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.add(e)}offFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.delete(e)}invalidateForm(){this._publishFormInvalidation_()}onInternalMutation(e){typeof e=="function"&&(this._mutationListeners_.add(e),e())}offInternalMutation(e){typeof e=="function"&&this._mutationListeners_.delete(e)}startTemplateFilling(e){if(this._templateFillListeners_.add(e),typeof this._value_=="object")for(const s in this._value_){let r=s;const i=this._value_[s];e.propertyMap&&e.propertyMap[s]&&(r=e.propertyMap[s]),typeof e[s]<"u"&&e[s]!==i&&(e[r]=i)}}stopTemplateFilling(e){this._templateFillListeners_.delete(e)}startDynamicFilling(e){this._fillListeners_.add(e);for(const s in this._value_){const r=this._value_[s];e[s]!==r&&(e[s]=r)}}stopDynamicFilling(e){this._fillListeners_.delete(e)}set(e,s=!1){if(this._value_===e||Ds(this._value_)&&Ds(e)&&e&&gi(this._value_)&&gi(e)&&this._value_.__value===e.__value||!Ds(e)&&e===this._value_.__value)return!0;this._value_=Ds(e)?e:{__value:e},this._cachedGet_=void 0;const r=gi(this._value_);if(this._parentKey_&&this.parent){const i=gi(this._value_)?this._value_.__value:this._value_;if(this.parent?.get()==null&&this.parent?.get()==null)if(isNaN(Number(this._parentKey_)))this.parent.set({[this._parentKey_]:i});else{const n=[];n[Number(this._parentKey_)]=i,this.parent.set(n)}else this.parent._value_[this._parentKey_]=i}if(r)return this._proxies_.forEach((i,n)=>{n!="_parent_"&&(i.set(null),this._publishDynamicFilling_(n,null))}),this._publishAssignement_(s),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_.__value),!0;for(const i in this._value_)this._value_[i]===void 0&&delete this._value_[i];if(this._proxies_.forEach((i,n)=>{const o=this._value_[n];n!="_parent_"&&o===void 0&&o!==null&&isNaN(Number(n))&&(i.set(null),this._publishDynamicFilling_(n,null))}),this._publishAssignement_(),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_),Ds(this._value_))for(const i in this._value_){const n=e[i],c=Ds(n)?n:{__value:n};if(!this._proxies_.has(i)){this._publishDynamicFilling_(i,n);continue}this._proxies_.get(i)?.set(c,!0),this._publishDynamicFilling_(i,n)}return!0}get(){if(Jl(this),this._cachedGet_!==void 0)return this._cachedGet_;if(Object.prototype.hasOwnProperty.call(this._value_,"__value")){const e=this._value_.__value;return this._cachedGet_=e??null}return this._cachedGet_=this._value_!=null?this._value_:null}get $tag(){return this._instanceCounter_||(Vs.instancesCounter++,this._instanceCounter_=Vs.instancesCounter),Vs.instances.set(this._instanceCounter_,this),"<"+pr+'-publisher-proxy publisher="'+this._instanceCounter_+'"></'+pr+"-publisher-proxy>"}};Vs.instances=new Map,Vs.instancesCounter=0;let Nr=Vs;const bi=[];function Jl(t){bi.length>0&&bi[0].add(t)}function No(){bi.unshift(new Set)}function Ro(){return bi.shift()}const Me=class Me{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],Me.instance!=null)throw"Singleton / use getInstance";Me.instance=this,this.isLocalStrorageReady=this.cleanStorageData(),Me.initPageShowHandler()}static initPageShowHandler(){Me.pageShowHandlerInitialized||(Me.pageShowHandlerInitialized=!0,window.addEventListener("pageshow",e=>{e.persisted&&Me.getInstance().invalidateAll()}))}invalidateAll(){this.publishers.forEach(e=>{e._invalidate_on_page_show_&&e.invalidate()})}async cleanStorageData(){return new Promise(e=>{(async()=>{try{let r=localStorage.getItem(mn),i=null;if(r&&(i=await this.decompress(r,"gzip")),i)try{this.localStorageData=JSON.parse(i)}catch{this.localStorageData={}}else r=await this.compress("{}","gzip"),localStorage.setItem(mn,r),this.localStorageData={};const n=1e3*60*60*12;for(const o in this.localStorageData){const c=this.localStorageData[o],h=new Date().getTime()-(c.expirationDelayMs||n);c.lastModifiationMS<h&&delete this.localStorageData[o]}e(!0)}catch{window.requestAnimationFrame(()=>{e(!1)}),console.warn("no publisher cache in this browser")}})()})}static getInstance(e){if(e){const s=Me.instances.get(e);return s||(console.warn("No PublisherManager instance registered with id:",e,"creating new one"),new Me)}return Me.instance==null?new Me:Me.instance}static get(e,s){return Me.getInstance().get(e,s)}async setLocalData(e,s){await this.isLocalStrorageReady,e.set(this.localStorageData[s+"¤lang_"+Ge.getLanguage()]?.data||e.get())}get(e,s){const r=s?.localStorageMode==="enabled",i=s?.invalidateOnPageShow===!0;if(!this.publishers.has(e)){const c=gn({});this.set(e,c)}const n=this.publishers.get(e);return r&&this.initialisedData.indexOf(e)===-1&&(s?.expirationDelayMs&&(n._expiration_delay_=s.expirationDelayMs),n._is_savable_=!0,this.initialisedData.push(e),this.setLocalData(n,e)),i&&(n._invalidate_on_page_show_=i),this.publishers.get(e)}set(e,s){this.publishers.set(e,s)}delete(e){return this.publishers.has(e)?(this.publishers.delete(e),!0):!1}async saveToLocalStorage(e=0){if(!(e!==Me.saveId&&e%10!=0))try{if(!Me.changed||Me.saving)return;Me.saving=!0,Me.changed=!1;const s=Array.from(this.publishers.keys());let r=!1;for(const i of s){const n=this.publishers.get(i);if(!n?._is_savable_)continue;const o=n?.get();o&&(this.localStorageData[i+"¤lang_"+Ge.getLanguage()]={lastModifiationMS:new Date().getTime(),expirationDelayMs:n._expiration_delay_,data:o},r=!0)}if(r){const i=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem(mn,i)}if(Me.saving=!1,Me.changed){Me.saveId++;const i=Me.saveId;setTimeout(()=>this.saveToLocalStorage(i),1e3)}}catch{Me.saving=!1}}async compress(e,s){const r=new TextEncoder().encode(e),i=window,n=new i.CompressionStream(s),o=n.writable.getWriter();o.write(r),o.close();const c=await new Response(n.readable).arrayBuffer(),h=new Uint8Array(c);let g="";for(let A=0;A<h.length;A++)g+=String.fromCharCode(h[A]);return btoa(g)}async decompress(e,s){const r=atob(e),n=Uint8Array.from(r,A=>A.charCodeAt(0)).buffer,o=window,c=new o.DecompressionStream(s),h=c.writable.getWriter();h.write(n),h.close();const g=await new Response(c.readable).arrayBuffer();return new TextDecoder().decode(g)}};Me.buildDate="Sat Oct 03 2026 09:31:26 GMT+0200 (Central European Summer Time)",Me.changed=!1,Me.saving=!1,Me.saveId=0,Me.instance=null,Me.instances=new Map,Me.pageShowHandlerInitialized=!1;let me=Me;if(typeof window<"u"){const t=window,e=fn+"PublisherManager",s=t[e]||me;if(t[e]||(t[e]=me),s!==me){const r=["instance","instances","changed","saving","saveId","pageShowHandlerInitialized"];for(const i of r)Object.defineProperty(me,i,{configurable:!0,get(){return s[i]},set(n){s[i]=n}})}}const Ql=new Set(["invalidate","onInvalidate","offInvalidate","invalidateForm","onFormInvalidate","offFormInvalidate","onAssign","offAssign","startDynamicFilling","stopDynamicFilling","startTemplateFilling","stopTemplateFilling","onInternalMutation","offInternalMutation","set","get","$tag","_cachedGet_","_templateFillListeners_","_fillListeners_","_assignListeners_","_invalidateListeners_","_formInvalidateListeners_","_publishInternalMutation_","hasListener","delete","_mutationListeners_","_publishDynamicFilling_","_publishInvalidation_","_publishFormInvalidation_","_publishTemplateFilling_","_publishAssignement_","_proxies_","parent","_parentKey_","_value_","_is_savable_","_expiration_delay_","_lockInternalMutationPublishing_","_instanceCounter_","_assignmentId_","_invalidate_on_page_show_"]);function Xl(t,e){return{get:function(s,r){if(typeof r=="string"&&Ql.has(r))return t[r];if(r==Symbol.toPrimitive)return()=>e().get();if(!t._proxies_.has(r)){const i=t._value_[r],n=gn(Ds(i)?i:{__value:i},t,r);n._proxies_.set("_parent_",e()),t._proxies_.set(r,n)}return t._proxies_.get(r)},set:function(s,r,i){if(r=="_value_")return t._value_=i,!0;if(r=="_cachedGet_")return t._cachedGet_=i,!0;if(r=="_assignmentId_")return t._assignmentId_=i,!0;if(r=="_is_savable_")return t._is_savable_=i,!0;if(r=="_expiration_delay_")return t._expiration_delay_=i,!0;if(r=="_invalidate_on_page_show_")return t._invalidate_on_page_show_=i,!0;if(r=="_instanceCounter_")return t._instanceCounter_=i,!0;if(!t._proxies_.has(r)){const o=gn({},t,r);o._proxies_.set("_parent_",e()),t._proxies_.set(r,o)}return t._value_[r]!==i&&(t._value_[r]=i,t._publishDynamicFilling_(r,i),t._proxies_.get(r)?.set(Ds(i)?i:{__value:i})),!0},deleteProperty:function(s,r){return t._publishDynamicFilling_(r,null),t._proxies_.get(r)?.set(null),delete t._value_[r]},has:function(s,r){return r in t._value_&&r!="_lockInternalMutationPublishing_"},defineProperty:function(s,r,i){return i&&"value"in i&&(t._value_[r]=i.value),!0},getOwnPropertyDescriptor:function(s,r){return{enumerable:!0,configurable:!0}},ownKeys:function(s){return t._value_.__value?Object.keys(t._value_.__value):Object.keys(t._value_)}}}function gn(t,e=null,s){const r=new Nr(t,e,s);let i=null;const n=Xl(r,()=>i);return i=new Proxy(r,n),i}class ec extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=e=>{this.innerHTML=e.toString()}}connectedCallback(){this.publisherId=this.getAttribute("publisher")||"",this.publisher=Nr.instances.get(parseInt(this.publisherId)),this.publisher?.onAssign(this.onAssign)}disconnectedCallback(){this.publisher?.offAssign(this.onAssign)}}try{customElements.define(pr+"-publisher-proxy",ec)}catch{}const vi=(t,e)=>{if(typeof t=="function"){const s=t;return No(),s(),Ro()}if(typeof t=="string"){const s=t.split("."),r=s.shift()||"";let i=me.get(r,e);i=lt.traverse(i,s);const n=new Set;return n.add(i),n}return new Set([t])};function tc(t){const e=mi(t);return vi(e).values().next().value?.get()}function yi(t,e,s){const r=mi(t);return vi(r,s).values().next().value}function sc(t,e){return Io(e)?yi(t,void 0,e):yi(t)}function wi(t,e){return Io(e)?yi(t,void 0,e):yi(t)}function rc(t,e){const s=mi(t);vi(s).values().next().value?.set(e)}let _i=(Te=class{static disable(){this.enabled&&(this.enabled=!1,Array.from(Te.observedElements.keys()).forEach(e=>Te.unObserve(e)))}static observe(e){if(!e||!Te.enabled||Te.observedElements.has(e))return;const s=new MutationObserver(Te.onMutation),r={};r.childList=!0,r.subtree=!0,r.attributes=!0,r.attributeFilter=["data-bind"],s.observe(e,r),e.querySelectorAll("[data-bind]").forEach(i=>Te.addPublisherListeners(i)),Te.observedElements.set(e,s)}static unObserve(e){if(!e)return;const s=this.observedElements.get(e);s&&(s.disconnect(),e.querySelectorAll("[data-bind]").forEach(r=>Te.removePublisherListeners(r)))}static onAdded(e){e.hasAttribute&&e.hasAttribute("data-bind")&&Te.addPublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(s=>Te.addPublisherListeners(s)):e.childNodes.forEach(s=>Te.onAdded(s))}static onRemoved(e){e.hasAttribute&&e.hasAttribute("data-bind")&&Te.removePublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(s=>Te.removePublisherListeners(s)):e.childNodes.forEach(s=>Te.onRemoved(s))}static onMutation(e){for(const s of e)switch(s.type){case"attributes":Te.addPublisherListeners(s.target);break;case"childList":s.addedNodes.forEach(r=>{Te.onAdded(r)}),s.removedNodes.forEach(r=>{Te.onRemoved(r)});break}}static removePublisherListeners(e){const s=Te.publisherListeners.get(e);s&&(Te.publisherListeners.delete(e),s.forEach(r=>{r.publisher?.offAssign(r.onAssign)}))}static getVariablesDescriptor(e){let s=e.match(/(\$(?:\w+\\?\.?)+)/g);return s?s=s.map(r=>r.replace("$","")):s=[e],s=s.filter(r=>r.length>0),{expression:e.replace("\\",""),variables:s.map(r=>r.split(/\b\.\b/).map(i=>i.replace("\\","")))}}static getDataBindItems(e){return"attributes"in e?Array.from(e.attributes).filter(s=>s.name.indexOf("::")==0).map(s=>({propertyToUpdate:s.name.substring(2).replace(/-((html)|\w)/g,i=>i.substring(1).toUpperCase()),bindedVariablesDescriptor:Te.getVariablesDescriptor(s.value)})):[]}static getSubPublisher(e,s){if(!s)return e;for(const r of s)if(r!="_self_"){if(!e)return null;e=e[r]}return e}static addPublisherListeners(e){Te.removePublisherListeners(e);const s=Ge.getAncestorAttributeValue(e.parentNode||e.host||e,"dataProvider");if(!s)return;const r=me.getInstance().get(s),i=Te.getDataBindItems(e),n=[];i.forEach(o=>{const c=o.bindedVariablesDescriptor,h=o.propertyToUpdate;for(const g of c.variables){const A=g;let m=r;m=Te.getSubPublisher(r,A);const f=e,k={publisher:m,onAssign:()=>{const E=c.variables.map(B=>Te.getSubPublisher(r,B)?.get());let O=c.expression,z=!1;if(E.length==1&&c.variables[0].join(".")==O.substring(1)){let B=E[0];B===null&&(B=""),f[h]=B;return}for(let B=0;B<E.length;B++){let S=E[B];const y=c.variables[B];S===null&&(z=!0,S=void 0),O=O.replace("$"+y.join("."),S)}if(O.indexOf("|")!=-1){const B=O.indexOf("|");if(B==0)O=Ir.js(O.substring(1));else{const S=O.substring(0,B),y=O.substring(B+1),F=Ir[S];O=z?"":F?F(y):O}}else O=z?"":O;f[h]=O}};m?.onAssign(k.onAssign),n.push(k)}}),Te.publisherListeners.set(e,n)}},Te.observedElements=new Map,Te.enabled=!0,Te.publisherListeners=new Map,Te);_i.observe(document.documentElement),window.SonicDataBindObserver||(window.SonicDataBindObserver=_i);/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
* @license
|
|
61
61
|
* Copyright 2017 Google LLC
|
|
62
62
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
63
|
-
*/let Dn=class extends br{constructor(e){if(super(e),this.it=se,e.type!==Qs.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===se||e==null)return this._t=void 0,this.it=e;if(e===Nt)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const s=[e];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}};Dn.directiveName="unsafeHTML",Dn.resultType=1;const Be=Os(Dn),En=new Map,sa=t=>{if(!t)return null;const e=Ge.getApiConfiguration(t),s=Ge.getAncestorAttributeValue(t,"wordingProvider"),r=Ge.getAncestorAttributeValue(t,"wordingVersionProvider"),i={apiConfiguration:e,wordingProvider:s,wordingVersionProvider:r};let n=null;for(const[o,c]of En)if(lt.deepEqual(o,i)){n=c;break}return n||(n={api:new Ts(e),keysToTranslate:new Set,translatedKeys:new Set,wordingProvider:s,callIndex:0,wordingVersionProvider:r,apiCallKey:i},En.set(i,n)),n},ra="",Ve=class Ve extends kn{constructor(e){super(e),this.useUnsafeHTML=!1,this.onAssign=s=>{const r=this.useUnsafeHTML?Be(s):s;this.setValue(r)},this.node=e.options.host}unsubscribe(){Ve.publisher["wording_"+this.key].offAssign(this.onAssign)}render(e,s=!1){return this.useUnsafeHTML=s,this.key!==e&&(this.key=e,this.isConnected&&this.subscribe(e)),Nt}static async callApi(e,s,r=!0,i){if(await me.getInstance().isLocalStrorageReady,Ve.firstCall){Ve.firstCall=!1,pn(Ve.reloadWordings);const A=Object.keys(Ve.publisher.get());for(const m of A)Ve.publisher.get()[m]===ra&&delete Ve.publisher[m]}if(e){const A=Ge.getAncestorAttributeValue(e,"wordingVersionProvider");A&&wi(A).onAssign(Ve.handleVersionProvider(e))}let n=Ve.publisher.get()["wording_"+s]!=null;const o=i||sa(e);if(!o)return;if(n&&s!==""){o.translatedKeys.add(s);return}o.callIndex++;const c=o.callIndex,h=o.wordingProvider??"";if(!h&&r){window.setTimeout(async()=>{Ve.callApi(null,s,!1,o)},1e3);return}const g=o.api;window.queueMicrotask(async()=>{if(n=Ve.publisher["wording_"+s].get()!=null,!n&&s!==""&&(o.keysToTranslate.add(s),Ve.publisher["wording_"+s].set(ra)),c!==o.callIndex)return;const A=Array.from(o.keysToTranslate);if(!A.length)return;const m=h.split("?"),f=m.shift(),k=(m.length>0?m.join("?")+"&":"")+"labels[]="+A.join("&labels[]="),E=f+"?"+k;o.translatedKeys=new Set([...o.translatedKeys,...o.keysToTranslate]),o.keysToTranslate.clear();const O=await g.get(E);for(const z in O)Ve.publisher["wording_"+z].set(O[z])})}static reloadWordings(){for(const e of En.values())e.keysToTranslate=new Set(e.translatedKeys),e.keysToTranslate.size>0&&Ve.callApi(null,"",!1,e)}static handleVersionProvider(e){const s=sa(e),r=n=>{};if(!s)return r;if(Ve.versionProviderHandlers.has(s))return Ve.versionProviderHandlers.get(s)||r;const i=function(n){if(!s.wordingVersionProvider)return;const c=Ve.publisher.get().__wording_versions__??[];if(n==null)return;const h=c.find(g=>g.serviceURL===s.api.serviceURL)||{serviceURL:s.api.serviceURL,version:0};c.includes(h)||c.push(h),n!==h.version&&(h.version=n,Ve.publisher.set({__wording_versions__:c}),Ve.reloadWordings())};return Ve.versionProviderHandlers.set(s,i),i}subscribe(e){this.unsubscribe(),Ve.publisher["wording_"+e].onAssign(this.onAssign),Ve.callApi(this.node,e)}disconnected(){this.unsubscribe()}reconnected(){this.key&&this.subscribe(this.key)}};Ve.publisher=me.get("sonic-wording",{localStorageMode:"enabled"}),Ve.firstCall=!0,Ve.versionProviderHandlers=new Map;let vr=Ve;const Rc=Os(vr);var jc=Object.defineProperty,zc=Object.getOwnPropertyDescriptor,ss=(t,e,s,r)=>{for(var i=r>1?void 0:r?zc(e,s):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(i=(r?o(e,s,i):o(i))||i);return r&&i&&jc(e,s,i),i};let $i=!1,On=new Set;const kt=(t,e)=>{var i;const s=(i=class extends t{constructor(...o){super(),this.collectDependenciesVersion=0,this.displayContents=!1,this.noAutoFill=!1,this.forceAutoFill=!1,this.renderOnPropsInternalChange=!1,this.noShadowDom=null,this.propertyMap=null,this.title="",this.dataProvider=null,this.bindPublisher=null,this._props=null,this.shouldRenderLazy=!0,this.defferedDebug=null,this.debug=null,this.onAssign=c=>{this.props=c}}hasAncestorAttribute(o){return this.getAncestorAttributeValue(o)!=null}getAncestorAttributeValue(o){return Ge.getAncestorAttributeValue(this,o)}get props(){return this._props!==null||!this.publisher?this._props:this.publisher.get()}set props(o){typeof o=="string"&&["{","["].includes(o.trim().charAt(0))
|
|
63
|
+
*/let Dn=class extends br{constructor(e){if(super(e),this.it=se,e.type!==Qs.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===se||e==null)return this._t=void 0,this.it=e;if(e===Nt)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const s=[e];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}};Dn.directiveName="unsafeHTML",Dn.resultType=1;const Be=Os(Dn),En=new Map,sa=t=>{if(!t)return null;const e=Ge.getApiConfiguration(t),s=Ge.getAncestorAttributeValue(t,"wordingProvider"),r=Ge.getAncestorAttributeValue(t,"wordingVersionProvider"),i={apiConfiguration:e,wordingProvider:s,wordingVersionProvider:r};let n=null;for(const[o,c]of En)if(lt.deepEqual(o,i)){n=c;break}return n||(n={api:new Ts(e),keysToTranslate:new Set,translatedKeys:new Set,wordingProvider:s,callIndex:0,wordingVersionProvider:r,apiCallKey:i},En.set(i,n)),n},ra="",Ve=class Ve extends kn{constructor(e){super(e),this.useUnsafeHTML=!1,this.onAssign=s=>{const r=this.useUnsafeHTML?Be(s):s;this.setValue(r)},this.node=e.options.host}unsubscribe(){Ve.publisher["wording_"+this.key].offAssign(this.onAssign)}render(e,s=!1){return this.useUnsafeHTML=s,this.key!==e&&(this.key=e,this.isConnected&&this.subscribe(e)),Nt}static async callApi(e,s,r=!0,i){if(await me.getInstance().isLocalStrorageReady,Ve.firstCall){Ve.firstCall=!1,pn(Ve.reloadWordings);const A=Object.keys(Ve.publisher.get());for(const m of A)Ve.publisher.get()[m]===ra&&delete Ve.publisher[m]}if(e){const A=Ge.getAncestorAttributeValue(e,"wordingVersionProvider");A&&wi(A).onAssign(Ve.handleVersionProvider(e))}let n=Ve.publisher.get()["wording_"+s]!=null;const o=i||sa(e);if(!o)return;if(n&&s!==""){o.translatedKeys.add(s);return}o.callIndex++;const c=o.callIndex,h=o.wordingProvider??"";if(!h&&r){window.setTimeout(async()=>{Ve.callApi(null,s,!1,o)},1e3);return}const g=o.api;window.queueMicrotask(async()=>{if(n=Ve.publisher["wording_"+s].get()!=null,!n&&s!==""&&(o.keysToTranslate.add(s),Ve.publisher["wording_"+s].set(ra)),c!==o.callIndex)return;const A=Array.from(o.keysToTranslate);if(!A.length)return;const m=h.split("?"),f=m.shift(),k=(m.length>0?m.join("?")+"&":"")+"labels[]="+A.join("&labels[]="),E=f+"?"+k;o.translatedKeys=new Set([...o.translatedKeys,...o.keysToTranslate]),o.keysToTranslate.clear();const O=await g.get(E);for(const z in O)Ve.publisher["wording_"+z].set(O[z])})}static reloadWordings(){for(const e of En.values())e.keysToTranslate=new Set(e.translatedKeys),e.keysToTranslate.size>0&&Ve.callApi(null,"",!1,e)}static handleVersionProvider(e){const s=sa(e),r=n=>{};if(!s)return r;if(Ve.versionProviderHandlers.has(s))return Ve.versionProviderHandlers.get(s)||r;const i=function(n){if(!s.wordingVersionProvider)return;const c=Ve.publisher.get().__wording_versions__??[];if(n==null)return;const h=c.find(g=>g.serviceURL===s.api.serviceURL)||{serviceURL:s.api.serviceURL,version:0};c.includes(h)||c.push(h),n!==h.version&&(h.version=n,Ve.publisher.set({__wording_versions__:c}),Ve.reloadWordings())};return Ve.versionProviderHandlers.set(s,i),i}subscribe(e){this.unsubscribe(),Ve.publisher["wording_"+e].onAssign(this.onAssign),Ve.callApi(this.node,e)}disconnected(){this.unsubscribe()}reconnected(){this.key&&this.subscribe(this.key)}};Ve.publisher=me.get("sonic-wording",{localStorageMode:"enabled"}),Ve.firstCall=!0,Ve.versionProviderHandlers=new Map;let vr=Ve;const Rc=Os(vr);var jc=Object.defineProperty,zc=Object.getOwnPropertyDescriptor,ss=(t,e,s,r)=>{for(var i=r>1?void 0:r?zc(e,s):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(i=(r?o(e,s,i):o(i))||i);return r&&i&&jc(e,s,i),i};let $i=!1,On=new Set;const kt=(t,e)=>{var i;const s=(i=class extends t{constructor(...o){super(),this.collectDependenciesVersion=0,this.displayContents=!1,this.noAutoFill=!1,this.forceAutoFill=!1,this.renderOnPropsInternalChange=!1,this.noShadowDom=null,this.propertyMap=null,this.title="",this.dataProvider=null,this.bindPublisher=null,this._props=null,this.shouldRenderLazy=!0,this.defferedDebug=null,this.debug=null,this.onAssign=c=>{this.props=c}}hasAncestorAttribute(o){return this.getAncestorAttributeValue(o)!=null}getAncestorAttributeValue(o){return Ge.getAncestorAttributeValue(this,o)}get props(){return this._props!==null||!this.publisher?this._props:this.publisher.get()}set props(o){if(typeof o=="string"&&["{","["].includes(o.trim().charAt(0)))try{o=JSON.parse(o)}catch{}o!=this._props&&(this._props=o,this.publisher&&this.publisher.get()!=o&&this.publisher.set(o),this.requestUpdate())}updated(o){super.updated(o);const h=[...(this.shadowRoot||this).children].filter(A=>A.tagName!="STYLE"),g=this.displayContents?"contents":h.length==0?"none":null;g?this.style.display=g:this.style.removeProperty("display")}connectedCallback(){if(i.instanceCounter++,this.hasAttribute("lazyRendering")){const o={root:null,threshold:.9};let c=!0;const h=new IntersectionObserver(g=>{for(const A of g)if(c&&A.isIntersecting){c=!1,h.disconnect(),this.initWording(),this.shouldRenderLazy=!1,this.startPublisher();break}},o);h.observe(this)}else this.initWording(),this.shouldRenderLazy=!1;this.initPublisher(),this.addDebugger(),super.connectedCallback()}disconnectedCallback(){this.removeDebugger(),super.disconnectedCallback(),this.publisher&&(this.publisher.stopTemplateFilling(this),this.publisher.offInternalMutation(this.requestUpdate)),vr.publisher.stopTemplateFilling(this),this.onAssign&&this.publisher?.offAssign(this.onAssign)}addDebugger(){if(this.hasAttribute("debug")&&!this.defferedDebug){if(!this.debug){this.debug=document.createElement("div");const o=this.debug.style;o.position="fixed",o.top="0",o.right="0",o.margin="auto",o.borderRadius=".7rem",o.backgroundColor="#0f1729",o.color="#c5d4f9",o.padding="16px 16px",o.margin="16px 16px",o.boxShadow="0 10px 30px -18px rgba(0,0,0,.3)",o.overflowY="auto",o.zIndex="99999999",o.maxHeight="calc(100vh - 32px)",o.fontFamily="Consolas, monospace",o.maxWidth="min(50vw,25rem)",o.fontSize="12px",o.minWidth="300px",o.overflowWrap="break-word",o.resize="vertical"}this.addEventListener("click",o=>{o.ctrlKey&&(o.preventDefault(),$i=!$i)}),this.dataProvider&&(window[this.dataProvider]=this.publisher),this.addEventListener("mouseover",()=>{$i||this.removeDebugger(),document.body.appendChild(this.debug),On.add(this.debug)}),this.addEventListener("mouseout",()=>{$i||this.removeDebugger()}),this.publisher?.onInternalMutation(()=>{this.debug.innerHTML=`🤖 DataProvider : "<b style="font-weight:bold;color:#fff;">${this.dataProvider}</b>"<br>
|
|
64
64
|
<div style="font-size:10px;border-top:1px dashed;margin-top:5px;padding-left:23px;opacity:.6;padding-top:5px;">
|
|
65
65
|
Variable disponible dans la console<br>
|
|
66
66
|
ctrl + Clique : épingler / désépingler
|
package/concorde-core.es.js
CHANGED
|
@@ -792,7 +792,7 @@ const Me = class Me {
|
|
|
792
792
|
return new TextDecoder().decode(g);
|
|
793
793
|
}
|
|
794
794
|
};
|
|
795
|
-
Me.buildDate = "
|
|
795
|
+
Me.buildDate = "Sat Oct 03 2026 09:31:26 GMT+0200 (Central European Summer Time)", Me.changed = !1, Me.saving = !1, Me.saveId = 0, Me.instance = null, Me.instances = /* @__PURE__ */ new Map(), Me.pageShowHandlerInitialized = !1;
|
|
796
796
|
let ge = Me;
|
|
797
797
|
if (typeof window < "u") {
|
|
798
798
|
const t = window, e = xn + "PublisherManager", s = t[e] || ge;
|
|
@@ -2412,7 +2412,12 @@ const Dt = (t, e) => {
|
|
|
2412
2412
|
return this._props !== null || !this.publisher ? this._props : this.publisher.get();
|
|
2413
2413
|
}
|
|
2414
2414
|
set props(o) {
|
|
2415
|
-
typeof o == "string" && ["{", "["].includes(o.trim().charAt(0))
|
|
2415
|
+
if (typeof o == "string" && ["{", "["].includes(o.trim().charAt(0)))
|
|
2416
|
+
try {
|
|
2417
|
+
o = JSON.parse(o);
|
|
2418
|
+
} catch {
|
|
2419
|
+
}
|
|
2420
|
+
o != this._props && (this._props = o, this.publisher && this.publisher.get() != o && this.publisher.set(o), this.requestUpdate());
|
|
2416
2421
|
}
|
|
2417
2422
|
updated(o) {
|
|
2418
2423
|
super.updated(o);
|
|
@@ -24,7 +24,7 @@ var ConcordeHF=(function(xe){"use strict";/**
|
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const As={attribute:!0,type:String,converter:Pe,reflect:!1,hasChanged:Fe},Ss=(n=As,e,t)=>{const{kind:s,metadata:i}=t;let r=globalThis.litPropertyMetadata.get(i);if(r===void 0&&globalThis.litPropertyMetadata.set(i,r=new Map),s==="setter"&&((n=Object.create(n)).wrapped=!0),r.set(t.name,n),s==="accessor"){const{name:o}=t;return{set(l){const c=e.get.call(this);e.set.call(this,l),this.requestUpdate(o,c,n)},init(l){return l!==void 0&&this.C(o,void 0,n,l),l}}}if(s==="setter"){const{name:o}=t;return function(l){const c=this[o];e.call(this,l),this.requestUpdate(o,c,n)}}throw Error("Unsupported decorator location: "+s)};function I(n){return(e,t)=>typeof t=="object"?Ss(n,e,t):((s,i,r)=>{const o=i.hasOwnProperty(r);return i.constructor.createProperty(r,s),o?Object.getOwnPropertyDescriptor(i,r):void 0})(n,e,t)}function ks(n){return n}const xs={load:"first-use",trigger:"mutation",debounceMs:50,consentAboveMB:30,allowWasmUpToMB:50,timeoutMs:6e4,maxItems:2e3,maxChars:2e3,persist:!1,resultsCacheBytes:20*1024*1024};let Je=null;const Ge=new Set;function Es(n){Je={...n,defaults:{...xs,...n.defaults}};for(const e of Ge)e(Je)}function Cs(){return Je}function Ut(n){return Ge.add(n),()=>Ge.delete(n)}const Ps=/\$\{|\{\$/;function Ls(n){return Ps.test(n)}function ae(n){const e=typeof n=="string"?n:n.path;if(Ls(e))throw new Error("Static publisher path required for get/set/dp. Use @subscribe, @publish, or @handle for dynamic DataProviderKey paths.");return e}const Ke="1";function Ms(n){const e=n.trim();if(!e)return!1;try{const t=new URL(e,"https://example.invalid/");return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="blob:"}catch{return!1}}class L{static getLanguage(){const e=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||e}static getCookies(){return document.cookie.split(";").reduce((e,t)=>{const s=t.indexOf("=");return e[t.substring(0,s).trim()]=t.substring(s+1),e},{})}static nextComposedAncestor(e){return e instanceof Element&&e.assignedSlot?e.assignedSlot:e.parentNode||e.host||null}static everyAncestors(e,t){let s=e;for(;s;){if(!t(s))return;s=s.parentNode||s.host}}static overflowMatches(e,t){return t.includes(e.overflowY)||t.includes(e.overflowX)}static findAncestorByOverflow(e,t){let s=e;for(;s;){if(s instanceof Element&&s.nodeType===1){const i=window.getComputedStyle(s);if(L.overflowMatches(i,t))return s}s=L.nextComposedAncestor(s)}return null}static getScrollableAncestor(e){return L.findAncestorByOverflow(e,["auto","scroll","hidden","overlay"])}static getScrollingAncestor(e){return L.findAncestorByOverflow(e,["auto","scroll","overlay"])}static scopeAttributeNames(e){const t=e.toLowerCase();return t===e?[e]:[e,t]}static readScopeAttributeOnElement(e,t){for(const s of L.scopeAttributeNames(t))if(e.hasAttribute(s))return e.getAttribute(s)??"";return null}static getAncestorAttributeValue(e,t){if(!e)return null;let s=e;for(;s;){if(s instanceof HTMLElement){const r=L.readScopeAttributeOnElement(s,t);if(r!=null)return r}const i=s.parentNode||s.host;if(!i)break;s=i}return null}static getApiConfiguration(e){const t=L.getAncestorAttributeValue(e,"token"),s=L.getAncestorAttributeValue(e,"addHTTPResponse")!=null,i=L.getAncestorAttributeValue(e,"serviceURL");let r=null,o=null;const l=L.getAncestorAttributeValue(e,"tokenProvider"),c=L.getAncestorAttributeValue(e,"eventsApiToken");t||(r=L.getAncestorAttributeValue(e,"userName"),o=L.getAncestorAttributeValue(e,"password"));const f=L.getAncestorAttributeValue(e,"credentials")||void 0,d=e.getAttribute("cache"),u=e.hasAttribute("blockUntilDone"),m=e.hasAttribute("keepAlive");return{serviceURL:i,token:t,userName:r,password:o,authToken:c,tokenProvider:l,addHTTPResponse:s,credentials:f,cache:d,blockUntilDone:u,keepAlive:m}}static getClosestElement(e,t){let s=e;for(;s&&!(s.nodeName&&s.nodeName.toLowerCase()===t);){const i=s.parentNode||s.host;if(!i){s=null;break}s=i}return s?.nodeName?s:null}static getClosestForm(e){return L.getClosestElement(e,"form")}static getAncestorsByTagNames(e,t){const s=new Set(t.map(o=>o.toLowerCase())),i=[];let r=e.parentNode||e.host;for(;r;)r instanceof Element&&s.has(r.tagName.toLowerCase())&&i.push(r),r=r.parentNode||r.host;return i}static getAncestorsBySelectors(e,t){const s=[];let i=e.parentNode||e.host;for(;i;){if(i instanceof Element)for(const r of t)try{if(i.matches(r)){s.push(i);break}}catch{}i=i.parentNode||i.host}return s}static async loadJS(e){if(!Ms(e))return!1;const t=typeof document<"u"?new URL(e,document.baseURI).href:e,s=Array.from(document.scripts).find(r=>r.src===t);if(s)return s.dataset.concordeLoaded===Ke?!0:new Promise(r=>{let o=!1;const l=f=>{o||(o=!0,f&&(s.dataset.concordeLoaded=Ke),r(f))};s.addEventListener("load",()=>l(!0),{once:!0}),s.addEventListener("error",()=>l(!1),{once:!0});const c=s.readyState;if(c==="complete"||c==="loaded"){l(!0);return}Promise.resolve().then(()=>{Promise.resolve().then(()=>{o||l(!0)})})});const i=/\.es\.js(\?|#|$)/.test(e)||/[?&]module(?:&|=|$)/.test(e);return new Promise(r=>{const o=document.createElement("script");o.src=e,i&&(o.type="module"),o.onload=()=>{o.dataset.concordeLoaded=Ke,r(!0)},o.onerror=()=>r(!1),document.head.appendChild(o)})}static async loadCSS(e){return new Promise(t=>{const s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=e,s.onload=()=>t(!0),s.onerror=()=>t(!0),document.head.appendChild(s)})}}class q{static shallowEqual(e,t,s=!0){const i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length&&s)return!1;for(const o of i){const l=e[o],c=t[o];if(s?l!==c:l!=c)return!1}return!0}static deepEqual(e,t,s=!0){const i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length&&s)return!1;for(const o of i){const l=e[o],c=t[o],f=q.isObject(l)&&q.isObject(c),d=s?l!==c:l!=c;if(f&&!q.deepEqual(l,c)||!f&&d)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}static isUndefindOrNull(e){return e==null}static isEmpty(e){return q.isUndefindOrNull(e)?!0:Object.keys(e).length===0}static traverse(e,t,s=!1){for(const i of t){const r=e[i];if(r===void 0)return;s&&q.isObject(r)?e=Object.assign(Array.isArray(r)?[]:{},e,r):e=e[i]}return e}static traverseDotNotation(e,t,s=!1){return q.traverse(e,t.split("."),s)}static getURLSearchArray(e,t=""){let s=[];for(let i in e){const r=e[i];t&&(i=t+"["+i+"]"),q.isObject(r)?s=[...s,...this.getURLSearchArray(r,i)]:s.push(`${i}=${r}`)}return s}static getURLSearchString(e){return q.getURLSearchArray(e,"").join("&")}}q.traverseDotNotation;let Nt="sonic";typeof __SONIC_PREFIX__<"u"&&(Nt=__SONIC_PREFIX__);let Rt=Nt.replace(/-([a-z])/g,n=>n[1].toUpperCase());const Is=Rt.charAt(0).toUpperCase()+Rt.slice(1);function Ie(n){return Object.prototype.hasOwnProperty.call(n,"__value")}function X(n){return typeof n=="object"&&n!==null}let le="sonic";typeof __SONIC_PREFIX__>"u"&&(le="sonic");const Xe=le=="sonic"?"publisher-proxies-data":le+"-publisher-proxies-data",Z=class Z{constructor(e,t,s){for(this._proxies_=new Map,this._is_savable_=!1,this._expiration_delay_=432e5,this._invalidate_on_page_show_=!1,this._invalidateListeners_=new Set,this._formInvalidateListeners_=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_=e,this.parent=t||null,this._parentKey_=s,this.root=this,this._instanceCounter_=0;this.root.parent;)this.root=this.root.parent}delete(){for(const e in this._proxies_.keys())e!="_parent_"&&this._proxies_.get(e)?.delete();this._invalidateListeners_.clear(),this._formInvalidateListeners_.clear(),this._assignListeners_.clear(),this._mutationListeners_.clear(),this._fillListeners_.clear(),this._templateFillListeners_.clear(),this._proxies_.clear(),Z.instances.delete(this._instanceCounter_)}hasListener(){return this._templateFillListeners_.size>0||this._assignListeners_.size>0||this._invalidateListeners_.size>0||this._formInvalidateListeners_.size>0||this._mutationListeners_.size>0||this._fillListeners_.size>0}_publishInternalMutation_(e=!1){if(this._mutationListeners_.forEach(t=>t()),this._is_savable_&&!D.changed){D.changed=!0,D.saveId++;const t=D.saveId;setTimeout(()=>D.getInstance().saveToLocalStorage(t),1e3)}e||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(e=!1){if(this._assignmentId_++,this._assignmentId_!==this._assignmentId_)return;const s=this.get();this._assignListeners_.forEach(i=>{i(s)}),this._publishInternalMutation_(e)}_publishInvalidation_(){this._invalidateListeners_.forEach(e=>e())}_publishFormInvalidation_(){this._formInvalidateListeners_.forEach(e=>e())}_publishDynamicFilling_(e,t){this._fillListeners_.forEach(s=>{s[e]!==t&&(s[e]=t)}),this._publishTemplateFilling_(e,t)}_publishTemplateFilling_(e,t){this._templateFillListeners_.forEach(s=>{const i=Object.getOwnPropertyDescriptor(s,e);i&&!i.set&&!i.writable||(s.propertyMap&&s.propertyMap[e]&&(e=s.propertyMap[e]),typeof s[e]<"u"&&s[e]!==t&&(s[e]=t))})}onAssign(e,t=!0){typeof e=="function"&&(this._assignListeners_.has(e)||(this._assignListeners_.add(e),t&&e(this.get())))}offAssign(e){this._assignListeners_.delete(e)}onInvalidate(e){typeof e=="function"&&this._invalidateListeners_.add(e)}offInvalidate(e){typeof e=="function"&&this._invalidateListeners_.delete(e)}invalidate(){this._publishInvalidation_()}onFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.add(e)}offFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.delete(e)}invalidateForm(){this._publishFormInvalidation_()}onInternalMutation(e){typeof e=="function"&&(this._mutationListeners_.add(e),e())}offInternalMutation(e){typeof e=="function"&&this._mutationListeners_.delete(e)}startTemplateFilling(e){if(this._templateFillListeners_.add(e),typeof this._value_=="object")for(const t in this._value_){let s=t;const i=this._value_[t];e.propertyMap&&e.propertyMap[t]&&(s=e.propertyMap[t]),typeof e[t]<"u"&&e[t]!==i&&(e[s]=i)}}stopTemplateFilling(e){this._templateFillListeners_.delete(e)}startDynamicFilling(e){this._fillListeners_.add(e);for(const t in this._value_){const s=this._value_[t];e[t]!==s&&(e[t]=s)}}stopDynamicFilling(e){this._fillListeners_.delete(e)}set(e,t=!1){if(this._value_===e||X(this._value_)&&X(e)&&e&&Ie(this._value_)&&Ie(e)&&this._value_.__value===e.__value||!X(e)&&e===this._value_.__value)return!0;this._value_=X(e)?e:{__value:e},this._cachedGet_=void 0;const s=Ie(this._value_);if(this._parentKey_&&this.parent){const i=Ie(this._value_)?this._value_.__value:this._value_;if(this.parent?.get()==null&&this.parent?.get()==null)if(isNaN(Number(this._parentKey_)))this.parent.set({[this._parentKey_]:i});else{const r=[];r[Number(this._parentKey_)]=i,this.parent.set(r)}else this.parent._value_[this._parentKey_]=i}if(s)return this._proxies_.forEach((i,r)=>{r!="_parent_"&&(i.set(null),this._publishDynamicFilling_(r,null))}),this._publishAssignement_(t),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_.__value),!0;for(const i in this._value_)this._value_[i]===void 0&&delete this._value_[i];if(this._proxies_.forEach((i,r)=>{const o=this._value_[r];r!="_parent_"&&o===void 0&&o!==null&&isNaN(Number(r))&&(i.set(null),this._publishDynamicFilling_(r,null))}),this._publishAssignement_(),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_),X(this._value_))for(const i in this._value_){const r=e[i],l=X(r)?r:{__value:r};if(!this._proxies_.has(i)){this._publishDynamicFilling_(i,r);continue}this._proxies_.get(i)?.set(l,!0),this._publishDynamicFilling_(i,r)}return!0}get(){if(Os(this),this._cachedGet_!==void 0)return this._cachedGet_;if(Object.prototype.hasOwnProperty.call(this._value_,"__value")){const e=this._value_.__value;return this._cachedGet_=e??null}return this._cachedGet_=this._value_!=null?this._value_:null}get $tag(){return this._instanceCounter_||(Z.instancesCounter++,this._instanceCounter_=Z.instancesCounter),Z.instances.set(this._instanceCounter_,this),"<"+le+'-publisher-proxy publisher="'+this._instanceCounter_+'"></'+le+"-publisher-proxy>"}};Z.instances=new Map,Z.instancesCounter=0;let Oe=Z;const Dt=[];function Os(n){Dt.length>0&&Dt[0].add(n)}const _=class _{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],_.instance!=null)throw"Singleton / use getInstance";_.instance=this,this.isLocalStrorageReady=this.cleanStorageData(),_.initPageShowHandler()}static initPageShowHandler(){_.pageShowHandlerInitialized||(_.pageShowHandlerInitialized=!0,window.addEventListener("pageshow",e=>{e.persisted&&_.getInstance().invalidateAll()}))}invalidateAll(){this.publishers.forEach(e=>{e._invalidate_on_page_show_&&e.invalidate()})}async cleanStorageData(){return new Promise(e=>{(async()=>{try{let s=localStorage.getItem(Xe),i=null;if(s&&(i=await this.decompress(s,"gzip")),i)try{this.localStorageData=JSON.parse(i)}catch{this.localStorageData={}}else s=await this.compress("{}","gzip"),localStorage.setItem(Xe,s),this.localStorageData={};const r=1e3*60*60*12;for(const o in this.localStorageData){const l=this.localStorageData[o],c=new Date().getTime()-(l.expirationDelayMs||r);l.lastModifiationMS<c&&delete this.localStorageData[o]}e(!0)}catch{window.requestAnimationFrame(()=>{e(!1)}),console.warn("no publisher cache in this browser")}})()})}static getInstance(e){if(e){const t=_.instances.get(e);return t||(console.warn("No PublisherManager instance registered with id:",e,"creating new one"),new _)}return _.instance==null?new _:_.instance}static get(e,t){return _.getInstance().get(e,t)}async setLocalData(e,t){await this.isLocalStrorageReady,e.set(this.localStorageData[t+"¤lang_"+L.getLanguage()]?.data||e.get())}get(e,t){const s=t?.localStorageMode==="enabled",i=t?.invalidateOnPageShow===!0;if(!this.publishers.has(e)){const l=Ye({});this.set(e,l)}const r=this.publishers.get(e);return s&&this.initialisedData.indexOf(e)===-1&&(t?.expirationDelayMs&&(r._expiration_delay_=t.expirationDelayMs),r._is_savable_=!0,this.initialisedData.push(e),this.setLocalData(r,e)),i&&(r._invalidate_on_page_show_=i),this.publishers.get(e)}set(e,t){this.publishers.set(e,t)}delete(e){return this.publishers.has(e)?(this.publishers.delete(e),!0):!1}async saveToLocalStorage(e=0){if(!(e!==_.saveId&&e%10!=0))try{if(!_.changed||_.saving)return;_.saving=!0,_.changed=!1;const t=Array.from(this.publishers.keys());let s=!1;for(const i of t){const r=this.publishers.get(i);if(!r?._is_savable_)continue;const o=r?.get();o&&(this.localStorageData[i+"¤lang_"+L.getLanguage()]={lastModifiationMS:new Date().getTime(),expirationDelayMs:r._expiration_delay_,data:o},s=!0)}if(s){const i=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem(Xe,i)}if(_.saving=!1,_.changed){_.saveId++;const i=_.saveId;setTimeout(()=>this.saveToLocalStorage(i),1e3)}}catch{_.saving=!1}}async compress(e,t){const s=new TextEncoder().encode(e),i=window,r=new i.CompressionStream(t),o=r.writable.getWriter();o.write(s),o.close();const l=await new Response(r.readable).arrayBuffer(),c=new Uint8Array(l);let f="";for(let d=0;d<c.length;d++)f+=String.fromCharCode(c[d]);return btoa(f)}async decompress(e,t){const s=atob(e),r=Uint8Array.from(s,d=>d.charCodeAt(0)).buffer,o=window,l=new o.DecompressionStream(t),c=l.writable.getWriter();c.write(r),c.close();const f=await new Response(l.readable).arrayBuffer();return new TextDecoder().decode(f)}};_.buildDate="Thu Oct 01 2026 19:01:55 GMT+0200 (Central European Summer Time)",_.changed=!1,_.saving=!1,_.saveId=0,_.instance=null,_.instances=new Map,_.pageShowHandlerInitialized=!1;let D=_;if(typeof window<"u"){const n=window,e=Is+"PublisherManager",t=n[e]||D;if(n[e]||(n[e]=D),t!==D){const s=["instance","instances","changed","saving","saveId","pageShowHandlerInitialized"];for(const i of s)Object.defineProperty(D,i,{configurable:!0,get(){return t[i]},set(r){t[i]=r}})}}const Ts=new Set(["invalidate","onInvalidate","offInvalidate","invalidateForm","onFormInvalidate","offFormInvalidate","onAssign","offAssign","startDynamicFilling","stopDynamicFilling","startTemplateFilling","stopTemplateFilling","onInternalMutation","offInternalMutation","set","get","$tag","_cachedGet_","_templateFillListeners_","_fillListeners_","_assignListeners_","_invalidateListeners_","_formInvalidateListeners_","_publishInternalMutation_","hasListener","delete","_mutationListeners_","_publishDynamicFilling_","_publishInvalidation_","_publishFormInvalidation_","_publishTemplateFilling_","_publishAssignement_","_proxies_","parent","_parentKey_","_value_","_is_savable_","_expiration_delay_","_lockInternalMutationPublishing_","_instanceCounter_","_assignmentId_","_invalidate_on_page_show_"]);function Us(n,e){return{get:function(t,s){if(typeof s=="string"&&Ts.has(s))return n[s];if(s==Symbol.toPrimitive)return()=>e().get();if(!n._proxies_.has(s)){const i=n._value_[s],r=Ye(X(i)?i:{__value:i},n,s);r._proxies_.set("_parent_",e()),n._proxies_.set(s,r)}return n._proxies_.get(s)},set:function(t,s,i){if(s=="_value_")return n._value_=i,!0;if(s=="_cachedGet_")return n._cachedGet_=i,!0;if(s=="_assignmentId_")return n._assignmentId_=i,!0;if(s=="_is_savable_")return n._is_savable_=i,!0;if(s=="_expiration_delay_")return n._expiration_delay_=i,!0;if(s=="_invalidate_on_page_show_")return n._invalidate_on_page_show_=i,!0;if(s=="_instanceCounter_")return n._instanceCounter_=i,!0;if(!n._proxies_.has(s)){const o=Ye({},n,s);o._proxies_.set("_parent_",e()),n._proxies_.set(s,o)}return n._value_[s]!==i&&(n._value_[s]=i,n._publishDynamicFilling_(s,i),n._proxies_.get(s)?.set(X(i)?i:{__value:i})),!0},deleteProperty:function(t,s){return n._publishDynamicFilling_(s,null),n._proxies_.get(s)?.set(null),delete n._value_[s]},has:function(t,s){return s in n._value_&&s!="_lockInternalMutationPublishing_"},defineProperty:function(t,s,i){return i&&"value"in i&&(n._value_[s]=i.value),!0},getOwnPropertyDescriptor:function(t,s){return{enumerable:!0,configurable:!0}},ownKeys:function(t){return n._value_.__value?Object.keys(n._value_.__value):Object.keys(n._value_)}}}function Ye(n,e=null,t){const s=new Oe(n,e,t);let i=null;const r=Us(s,()=>i);return i=new Proxy(s,r),i}class Ns extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=e=>{this.innerHTML=e.toString()}}connectedCallback(){this.publisherId=this.getAttribute("publisher")||"",this.publisher=Oe.instances.get(parseInt(this.publisherId)),this.publisher?.onAssign(this.onAssign)}disconnectedCallback(){this.publisher?.offAssign(this.onAssign)}}try{customElements.define(le+"-publisher-proxy",Ns)}catch{}function Rs(n){return ae(n)}function Ds(n){return n.split(".")[0]??n}function js(n){return`${Ds(Rs(n))}/_state_`}const Bs="concorde-hf-results",Ze="results",zs=64;async function Qe(n){const e=globalThis.crypto?.subtle;if(e){const i=await e.digest("SHA-256",n);return[...new Uint8Array(i)].map(r=>r.toString(16).padStart(2,"0")).join("")}let t=2166136261,s=16777619;for(let i=0;i<n.length;i++)t=Math.imul(t^n[i],16777619)>>>0,s=Math.imul(s^n[n.length-1-i],2166136261)>>>0;return`fnv-${t.toString(16)}${s.toString(16)}-${n.length}`}async function et(n){if(n instanceof Blob)return{$blob:await Qe(new Uint8Array(await n.arrayBuffer())),type:n.type};if(ArrayBuffer.isView(n))return{$typed:n.constructor.name,hash:await Qe(new Uint8Array(n.buffer,n.byteOffset,n.byteLength))};if(Array.isArray(n))return Promise.all(n.map(et));if(n&&typeof n=="object"){const e={};for(const t of Object.keys(n).sort())e[t]=await et(n[t]);return e}return n}async function Fs(n){const e=JSON.stringify(await et(n));return Qe(new TextEncoder().encode(e))}function tt(n){return n instanceof Blob?!0:Array.isArray(n)?n.some(tt):n&&typeof n=="object"?Object.values(n).some(tt):!1}const Y=new Map;function st(n,e){for(Y.delete(n),Y.set(n,e);Y.size>zs;){const t=Y.keys().next().value;if(t===void 0)break;Y.delete(t)}}let Te=null;function nt(){return Te||(Te=new Promise(n=>{try{if(typeof indexedDB>"u")return n(null);const e=indexedDB.open(Bs,1);e.onupgradeneeded=()=>{e.result.createObjectStore(Ze,{keyPath:"key"}).createIndex("at","at")},e.onsuccess=()=>n(e.result),e.onerror=()=>n(null),e.onblocked=()=>n(null)}catch{n(null)}}),Te)}function ce(n,e,t){return new Promise(s=>{try{const i=n.transaction(Ze,e),r=t(i.objectStore(Ze));i.oncomplete=()=>s(r?r.result:void 0),i.onerror=()=>s(void 0),i.onabort=()=>s(void 0)}catch{s(void 0)}})}async function Hs(n,e,t){if(Y.has(n)){const r=Y.get(n);return st(n,r),{hit:!0,value:r}}if(!e)return{hit:!1};const s=await nt();if(!s)return{hit:!1};const i=await ce(s,"readonly",r=>r.get(n));return i?t&&Date.now()-i.at>t?{hit:!1}:(st(n,i.value),ce(s,"readwrite",r=>r.put({...i,at:Date.now()})),{hit:!0,value:i.value}):{hit:!1}}async function qs(n,e,t,s){if(st(n,e),!t||tt(e))return;const i=await nt();if(!i)return;let r=0;try{r=JSON.stringify(e).length}catch{return}r>s||(await ce(i,"readwrite",o=>o.put({key:n,value:e,bytes:r,at:Date.now()})),await Ws(i,s))}async function Ws(n,e){const t=await ce(n,"readonly",r=>r.getAll())??[];let s=t.reduce((r,o)=>r+o.bytes,0);if(s<=e)return;t.sort((r,o)=>r.at-o.at);const i=[];for(const r of t){if(s<=e)break;i.push(r.key),s-=r.bytes}await ce(n,"readwrite",r=>{for(const o of i)r.delete(o)})}async function Vs(){Y.clear();const n=await nt();n&&await ce(n,"readwrite",e=>e.clear())}function it(n){return n===null?"null":Array.isArray(n)?"array":n instanceof Blob?"Blob":ArrayBuffer.isView(n)?n.constructor.name:typeof n}function Js(n){if(n==null||n==="")return null;if(typeof n=="function")return s=>{const i=n(s);return typeof i=="string"?i:null};const e=(typeof n=="string"?n.split("+"):[...n]).map(s=>s.trim()).filter(Boolean).map(s=>s.split("."));if(!e.length)return null;const t=(s,i)=>{if(s==null)return[];if(!i.length)return typeof s=="string"?s.trim()?[s.trim()]:[]:typeof s=="number"?[String(s)]:Array.isArray(s)?s.flatMap(l=>t(l,[])):[];if(Array.isArray(s))return s.flatMap(l=>t(l,i));if(typeof s!="object")return[];const[r,...o]=i;return t(s[r],o)};return s=>{const i=e.map(r=>t(s,r).join(", ")).filter(r=>r.length>0);return i.length?i.join(" — "):null}}function Gs(n){return n==null?!0:typeof n=="string"?n.trim().length===0:Array.isArray(n)?n.length===0:typeof n=="object"&&!(n instanceof Blob)&&!ArrayBuffer.isView(n)?Object.keys(n).length===0:!1}function Ks(n,e,t){switch(e.kind){case"text":{let s=null;if(typeof n=="string")s=n.trim();else if(n&&typeof n=="object"&&!Array.isArray(n)){if(!t)return{ok:!1,reason:"objet reçu sans `options.text` pour en extraire le texte"};s=t(n)}else return{ok:!1,reason:`texte attendu, reçu ${it(n)}`};return s?s.length>e.maxChars?{ok:!0,payload:s.slice(0,e.maxChars),truncated:!0}:{ok:!0,payload:s,truncated:!1}:{ok:!1,reason:"texte vide"}}case"image":return typeof n=="string"&&n.trim()?{ok:!0,payload:n.trim(),truncated:!1}:n instanceof Blob?{ok:!0,payload:n,truncated:!1}:{ok:!1,reason:`image attendue (URL, data URL ou Blob), reçu ${it(n)}`};case"audio":return n instanceof Float32Array||n instanceof Float64Array?{ok:!0,payload:n,truncated:!1}:typeof n=="string"&&n.trim()?{ok:!0,payload:n.trim(),truncated:!1}:{ok:!1,reason:`audio attendu (Float32Array, Float64Array ou URL), reçu ${it(n)}`}}}function jt(n,e){if(Gs(n))return{kind:"empty"};const t=Js(e.text),s=Array.isArray(n),i=s?n:[n];if(i.length>e.maxItems)return{kind:"invalid",code:"too-large",message:`Entrée trop grosse : ${i.length} éléments (maximum ${e.maxItems}).`};const r=[],o=[],l=[];let c=0;if(i.forEach((d,u)=>{const m=Ks(d,e,t);m.ok?(r.push(m.payload),o.push(u),m.truncated&&c++):l.push(s?`[${u}] ${m.reason}`:m.reason)}),!r.length)return{kind:"invalid",code:"invalid-input",message:`Entrée invalide : ${l.slice(0,3).join(" ; ")}${l.length>3?` (+${l.length-3})`:""}.`};const f=[];return c&&f.push(`${c} texte(s) tronqué(s) à ${e.maxChars} caractères.`),l.length&&f.push(`${l.length} élément(s) ignoré(s) : ${l.slice(0,3).join(" ; ")}.`),{kind:"ok",many:s,length:i.length,payloads:r,positions:o,skipped:i.length-r.length,truncated:c,warnings:f}}function Bt(n,e){const t=new Array(n.length).fill(null);return n.positions.forEach((s,i)=>{t[s]=e[i]??null}),t}function Xs(n,e){const t=new Map;let s=Promise.resolve();const i=a=>e.postMessage(a),r=(a,h,g)=>i({id:a,ok:!1,error:{code:h,message:g}}),o=a=>{const h=String(a?.message??a).toLowerCase();return a?.code?String(a.code):h.includes("quota")?"quota":h.includes("failed to fetch")||h.includes("network")||h.includes("404")||h.includes("could not locate")?"network":"runtime"},l=a=>{const h={...a.options||{}};return h.revision=a.revision,h},c=async()=>{const a=globalThis.navigator?.gpu;if(!a||typeof a.requestAdapter!="function")return!1;try{return!!await a.requestAdapter()}catch{return!1}},f=a=>a&&typeof a=="object"&&typeof a.tolist=="function"&&"dims"in a,d=a=>a&&typeof a=="object"&&typeof a.toBlob=="function"&&typeof a.width=="number"&&typeof a.channels=="number",u=async a=>{if(f(a))return a.tolist();if(d(a)){const h=await a.toBlob("image/png");return{width:a.width,height:a.height,channels:a.channels,blob:h}}if(Array.isArray(a))return Promise.all(a.map(u));if(a instanceof Blob)return a;if(a&&typeof a=="object"){const h={};for(const g of Object.keys(a))h[g]=await u(a[g]);return h}return a},m=a=>Array.isArray(a)&&a.length===1&&Array.isArray(a[0])?a[0]:a,T={async configure({env:a}){const h=n.env;if(h.allowLocalModels=!1,h.allowRemoteModels=!0,h.useBrowserCache=!0,h.useWasmCache=!0,h.cacheKey=a.cacheKey,a.remoteHost&&(h.remoteHost=a.remoteHost),a.remotePathTemplate&&(h.remotePathTemplate=a.remotePathTemplate),a.wasmPaths&&h.backends?.onnx?.wasm){let g=a.wasmPaths;if(typeof g=="string"){const v=g.endsWith("/")?g:g+"/",E=String(globalThis.navigator?.userAgent??""),H=/Safari\//.test(E)&&!/Chrome|Chromium|Android/.test(E),W=Number((/Version\/(\d+)/.exec(E)??[])[1]??99),A=H&&W<26&&!globalThis.navigator?.gpu?"":".asyncify";g={mjs:`${v}ort-wasm-simd-threaded${A}.mjs`,wasm:`${v}ort-wasm-simd-threaded${A}.wasm`}}h.backends.onnx.wasm.wasmPaths=g}if(a.logLevel&&n.LogLevel){const g=n.LogLevel[String(a.logLevel).toUpperCase()];g!==void 0&&(h.logLevel=g)}return{version:h.version??null}},async inspect({model:a}){const h=n.ModelRegistry,g=l(a);let v=!1,E=null;try{v=!!await h?.is_pipeline_cached?.(a.task,a.repo,g)}catch{v=!1}try{const H=await h?.get_pipeline_files?.(a.task,a.repo,g);if(H&&h?.get_file_metadata){const A=(await Promise.all(H.map(y=>h.get_file_metadata(a.repo,y,{revision:a.revision}).catch(()=>null)))).map(y=>y?.size);A.every(y=>typeof y=="number")&&(E=A.reduce((y,S)=>y+S,0))}}catch{E=null}return{cached:v,totalBytes:E}},async load({model:a,devices:h}){const g=t.get(a.alias);if(g)return{backend:g.pipe.__backend,loadMs:0};const v=performance.now(),E={},H=y=>{if(y.status==="progress_total")i({type:"progress",alias:a.alias,progress:{loadedBytes:y.loaded,totalBytes:y.total,percent:Math.round(y.progress??0)}});else if(y.status==="progress"){E[y.file]={loaded:y.loaded,total:y.total};const S=Object.values(E),U=S.reduce(($e,N)=>$e+(N.loaded||0),0),j=S.reduce(($e,N)=>$e+(N.total||0),0);i({type:"progress",alias:a.alias,progress:{file:y.file,loadedBytes:U,totalBytes:j,percent:j?Math.round(U/j*100):0}})}},W=[];for(const y of h){if(y==="webgpu"&&!await c()){W.push("webgpu indisponible");continue}try{const S=await n.pipeline(a.task,a.repo,{...l(a),device:y,progress_callback:H});return S.__backend=y,t.set(a.alias,{pipe:S,task:a.task}),{backend:y,loadMs:Math.round(performance.now()-v)}}catch(S){const U=o(S);if(U==="network"||U==="quota")throw S;W.push(`${y} : ${String(S?.message??S)}`)}}const A=new Error(`Aucun backend utilisable (${W.join(" ; ")||"aucun autorisé"}).`);throw A.code="unsupported",A},async run({request:a}){const h=t.get(a.alias);if(!h){const A=new Error(`Modèle "${a.alias}" non chargé.`);throw A.code="runtime",A}const{pipe:g}=h,v={...a.call||{}};let E;a.positional&&(E=v[a.positional],delete v[a.positional]);const H=A=>a.positional?g(A,E,v):g(A,v);if(a.batch){const A=[];for(let S=0;S<a.inputs.length;S+=32){const U=a.inputs.slice(S,S+32),j=await u(await H(U));A.push(...Array.isArray(j)?j:[j])}return A}const W=[];for(const A of a.inputs){const y=await u(await H(A));W.push(h.task==="feature-extraction"||h.task==="image-feature-extraction"?m(y):y)}return W},async clear({model:a}){const h=n.ModelRegistry;if(a){const v=t.get(a.alias);return t.delete(a.alias),await v?.pipe?.dispose?.(),await h?.clear_pipeline_cache?.(a.task,a.repo,l(a)),!0}for(const v of t.values())await v.pipe?.dispose?.();t.clear();const g=n.env.cacheKey;return g&&typeof caches<"u"&&await caches.delete(g),!0}};e.addEventListener("message",a=>{const h=a.data;!h||typeof h.id!="number"||!T[h.type]||(s=s.then(()=>T[h.type](h)).then(g=>i({id:h.id,ok:!0,result:g}),g=>r(h.id,o(g),String(g?.message??g))))})}function Ys(n){return[`const hfWorkerMain = ${Xs.toString()};`,"const pending = [];","const buffer = (event) => pending.push(event);",'self.addEventListener("message", buffer);',"let lib;","try {",` lib = await import(${JSON.stringify(n)});`,"} catch (err) {",' self.postMessage({ type: "fatal", message: "Chargement de Transformers.js impossible : " + (err && err.message || err) });'," throw err;","}",'self.removeEventListener("message", buffer);',"hfWorkerMain(lib, {"," postMessage: (message, transfer) => self.postMessage(message, transfer),"," addEventListener: (type, listener) => {"," self.addEventListener(type, listener);"," for (const event of pending.splice(0)) listener(event);"," },","});"].join(`
|
|
27
|
+
*/const As={attribute:!0,type:String,converter:Pe,reflect:!1,hasChanged:Fe},Ss=(n=As,e,t)=>{const{kind:s,metadata:i}=t;let r=globalThis.litPropertyMetadata.get(i);if(r===void 0&&globalThis.litPropertyMetadata.set(i,r=new Map),s==="setter"&&((n=Object.create(n)).wrapped=!0),r.set(t.name,n),s==="accessor"){const{name:o}=t;return{set(l){const c=e.get.call(this);e.set.call(this,l),this.requestUpdate(o,c,n)},init(l){return l!==void 0&&this.C(o,void 0,n,l),l}}}if(s==="setter"){const{name:o}=t;return function(l){const c=this[o];e.call(this,l),this.requestUpdate(o,c,n)}}throw Error("Unsupported decorator location: "+s)};function I(n){return(e,t)=>typeof t=="object"?Ss(n,e,t):((s,i,r)=>{const o=i.hasOwnProperty(r);return i.constructor.createProperty(r,s),o?Object.getOwnPropertyDescriptor(i,r):void 0})(n,e,t)}function ks(n){return n}const xs={load:"first-use",trigger:"mutation",debounceMs:50,consentAboveMB:30,allowWasmUpToMB:50,timeoutMs:6e4,maxItems:2e3,maxChars:2e3,persist:!1,resultsCacheBytes:20*1024*1024};let Je=null;const Ge=new Set;function Es(n){Je={...n,defaults:{...xs,...n.defaults}};for(const e of Ge)e(Je)}function Cs(){return Je}function Ut(n){return Ge.add(n),()=>Ge.delete(n)}const Ps=/\$\{|\{\$/;function Ls(n){return Ps.test(n)}function ae(n){const e=typeof n=="string"?n:n.path;if(Ls(e))throw new Error("Static publisher path required for get/set/dp. Use @subscribe, @publish, or @handle for dynamic DataProviderKey paths.");return e}const Ke="1";function Ms(n){const e=n.trim();if(!e)return!1;try{const t=new URL(e,"https://example.invalid/");return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="blob:"}catch{return!1}}class L{static getLanguage(){const e=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||e}static getCookies(){return document.cookie.split(";").reduce((e,t)=>{const s=t.indexOf("=");return e[t.substring(0,s).trim()]=t.substring(s+1),e},{})}static nextComposedAncestor(e){return e instanceof Element&&e.assignedSlot?e.assignedSlot:e.parentNode||e.host||null}static everyAncestors(e,t){let s=e;for(;s;){if(!t(s))return;s=s.parentNode||s.host}}static overflowMatches(e,t){return t.includes(e.overflowY)||t.includes(e.overflowX)}static findAncestorByOverflow(e,t){let s=e;for(;s;){if(s instanceof Element&&s.nodeType===1){const i=window.getComputedStyle(s);if(L.overflowMatches(i,t))return s}s=L.nextComposedAncestor(s)}return null}static getScrollableAncestor(e){return L.findAncestorByOverflow(e,["auto","scroll","hidden","overlay"])}static getScrollingAncestor(e){return L.findAncestorByOverflow(e,["auto","scroll","overlay"])}static scopeAttributeNames(e){const t=e.toLowerCase();return t===e?[e]:[e,t]}static readScopeAttributeOnElement(e,t){for(const s of L.scopeAttributeNames(t))if(e.hasAttribute(s))return e.getAttribute(s)??"";return null}static getAncestorAttributeValue(e,t){if(!e)return null;let s=e;for(;s;){if(s instanceof HTMLElement){const r=L.readScopeAttributeOnElement(s,t);if(r!=null)return r}const i=s.parentNode||s.host;if(!i)break;s=i}return null}static getApiConfiguration(e){const t=L.getAncestorAttributeValue(e,"token"),s=L.getAncestorAttributeValue(e,"addHTTPResponse")!=null,i=L.getAncestorAttributeValue(e,"serviceURL");let r=null,o=null;const l=L.getAncestorAttributeValue(e,"tokenProvider"),c=L.getAncestorAttributeValue(e,"eventsApiToken");t||(r=L.getAncestorAttributeValue(e,"userName"),o=L.getAncestorAttributeValue(e,"password"));const f=L.getAncestorAttributeValue(e,"credentials")||void 0,d=e.getAttribute("cache"),u=e.hasAttribute("blockUntilDone"),m=e.hasAttribute("keepAlive");return{serviceURL:i,token:t,userName:r,password:o,authToken:c,tokenProvider:l,addHTTPResponse:s,credentials:f,cache:d,blockUntilDone:u,keepAlive:m}}static getClosestElement(e,t){let s=e;for(;s&&!(s.nodeName&&s.nodeName.toLowerCase()===t);){const i=s.parentNode||s.host;if(!i){s=null;break}s=i}return s?.nodeName?s:null}static getClosestForm(e){return L.getClosestElement(e,"form")}static getAncestorsByTagNames(e,t){const s=new Set(t.map(o=>o.toLowerCase())),i=[];let r=e.parentNode||e.host;for(;r;)r instanceof Element&&s.has(r.tagName.toLowerCase())&&i.push(r),r=r.parentNode||r.host;return i}static getAncestorsBySelectors(e,t){const s=[];let i=e.parentNode||e.host;for(;i;){if(i instanceof Element)for(const r of t)try{if(i.matches(r)){s.push(i);break}}catch{}i=i.parentNode||i.host}return s}static async loadJS(e){if(!Ms(e))return!1;const t=typeof document<"u"?new URL(e,document.baseURI).href:e,s=Array.from(document.scripts).find(r=>r.src===t);if(s)return s.dataset.concordeLoaded===Ke?!0:new Promise(r=>{let o=!1;const l=f=>{o||(o=!0,f&&(s.dataset.concordeLoaded=Ke),r(f))};s.addEventListener("load",()=>l(!0),{once:!0}),s.addEventListener("error",()=>l(!1),{once:!0});const c=s.readyState;if(c==="complete"||c==="loaded"){l(!0);return}Promise.resolve().then(()=>{Promise.resolve().then(()=>{o||l(!0)})})});const i=/\.es\.js(\?|#|$)/.test(e)||/[?&]module(?:&|=|$)/.test(e);return new Promise(r=>{const o=document.createElement("script");o.src=e,i&&(o.type="module"),o.onload=()=>{o.dataset.concordeLoaded=Ke,r(!0)},o.onerror=()=>r(!1),document.head.appendChild(o)})}static async loadCSS(e){return new Promise(t=>{const s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=e,s.onload=()=>t(!0),s.onerror=()=>t(!0),document.head.appendChild(s)})}}class q{static shallowEqual(e,t,s=!0){const i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length&&s)return!1;for(const o of i){const l=e[o],c=t[o];if(s?l!==c:l!=c)return!1}return!0}static deepEqual(e,t,s=!0){const i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length&&s)return!1;for(const o of i){const l=e[o],c=t[o],f=q.isObject(l)&&q.isObject(c),d=s?l!==c:l!=c;if(f&&!q.deepEqual(l,c)||!f&&d)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}static isUndefindOrNull(e){return e==null}static isEmpty(e){return q.isUndefindOrNull(e)?!0:Object.keys(e).length===0}static traverse(e,t,s=!1){for(const i of t){const r=e[i];if(r===void 0)return;s&&q.isObject(r)?e=Object.assign(Array.isArray(r)?[]:{},e,r):e=e[i]}return e}static traverseDotNotation(e,t,s=!1){return q.traverse(e,t.split("."),s)}static getURLSearchArray(e,t=""){let s=[];for(let i in e){const r=e[i];t&&(i=t+"["+i+"]"),q.isObject(r)?s=[...s,...this.getURLSearchArray(r,i)]:s.push(`${i}=${r}`)}return s}static getURLSearchString(e){return q.getURLSearchArray(e,"").join("&")}}q.traverseDotNotation;let Nt="sonic";typeof __SONIC_PREFIX__<"u"&&(Nt=__SONIC_PREFIX__);let Rt=Nt.replace(/-([a-z])/g,n=>n[1].toUpperCase());const Is=Rt.charAt(0).toUpperCase()+Rt.slice(1);function Ie(n){return Object.prototype.hasOwnProperty.call(n,"__value")}function X(n){return typeof n=="object"&&n!==null}let le="sonic";typeof __SONIC_PREFIX__>"u"&&(le="sonic");const Xe=le=="sonic"?"publisher-proxies-data":le+"-publisher-proxies-data",Z=class Z{constructor(e,t,s){for(this._proxies_=new Map,this._is_savable_=!1,this._expiration_delay_=432e5,this._invalidate_on_page_show_=!1,this._invalidateListeners_=new Set,this._formInvalidateListeners_=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_=e,this.parent=t||null,this._parentKey_=s,this.root=this,this._instanceCounter_=0;this.root.parent;)this.root=this.root.parent}delete(){for(const e in this._proxies_.keys())e!="_parent_"&&this._proxies_.get(e)?.delete();this._invalidateListeners_.clear(),this._formInvalidateListeners_.clear(),this._assignListeners_.clear(),this._mutationListeners_.clear(),this._fillListeners_.clear(),this._templateFillListeners_.clear(),this._proxies_.clear(),Z.instances.delete(this._instanceCounter_)}hasListener(){return this._templateFillListeners_.size>0||this._assignListeners_.size>0||this._invalidateListeners_.size>0||this._formInvalidateListeners_.size>0||this._mutationListeners_.size>0||this._fillListeners_.size>0}_publishInternalMutation_(e=!1){if(this._mutationListeners_.forEach(t=>t()),this._is_savable_&&!D.changed){D.changed=!0,D.saveId++;const t=D.saveId;setTimeout(()=>D.getInstance().saveToLocalStorage(t),1e3)}e||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(e=!1){if(this._assignmentId_++,this._assignmentId_!==this._assignmentId_)return;const s=this.get();this._assignListeners_.forEach(i=>{i(s)}),this._publishInternalMutation_(e)}_publishInvalidation_(){this._invalidateListeners_.forEach(e=>e())}_publishFormInvalidation_(){this._formInvalidateListeners_.forEach(e=>e())}_publishDynamicFilling_(e,t){this._fillListeners_.forEach(s=>{s[e]!==t&&(s[e]=t)}),this._publishTemplateFilling_(e,t)}_publishTemplateFilling_(e,t){this._templateFillListeners_.forEach(s=>{const i=Object.getOwnPropertyDescriptor(s,e);i&&!i.set&&!i.writable||(s.propertyMap&&s.propertyMap[e]&&(e=s.propertyMap[e]),typeof s[e]<"u"&&s[e]!==t&&(s[e]=t))})}onAssign(e,t=!0){typeof e=="function"&&(this._assignListeners_.has(e)||(this._assignListeners_.add(e),t&&e(this.get())))}offAssign(e){this._assignListeners_.delete(e)}onInvalidate(e){typeof e=="function"&&this._invalidateListeners_.add(e)}offInvalidate(e){typeof e=="function"&&this._invalidateListeners_.delete(e)}invalidate(){this._publishInvalidation_()}onFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.add(e)}offFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.delete(e)}invalidateForm(){this._publishFormInvalidation_()}onInternalMutation(e){typeof e=="function"&&(this._mutationListeners_.add(e),e())}offInternalMutation(e){typeof e=="function"&&this._mutationListeners_.delete(e)}startTemplateFilling(e){if(this._templateFillListeners_.add(e),typeof this._value_=="object")for(const t in this._value_){let s=t;const i=this._value_[t];e.propertyMap&&e.propertyMap[t]&&(s=e.propertyMap[t]),typeof e[t]<"u"&&e[t]!==i&&(e[s]=i)}}stopTemplateFilling(e){this._templateFillListeners_.delete(e)}startDynamicFilling(e){this._fillListeners_.add(e);for(const t in this._value_){const s=this._value_[t];e[t]!==s&&(e[t]=s)}}stopDynamicFilling(e){this._fillListeners_.delete(e)}set(e,t=!1){if(this._value_===e||X(this._value_)&&X(e)&&e&&Ie(this._value_)&&Ie(e)&&this._value_.__value===e.__value||!X(e)&&e===this._value_.__value)return!0;this._value_=X(e)?e:{__value:e},this._cachedGet_=void 0;const s=Ie(this._value_);if(this._parentKey_&&this.parent){const i=Ie(this._value_)?this._value_.__value:this._value_;if(this.parent?.get()==null&&this.parent?.get()==null)if(isNaN(Number(this._parentKey_)))this.parent.set({[this._parentKey_]:i});else{const r=[];r[Number(this._parentKey_)]=i,this.parent.set(r)}else this.parent._value_[this._parentKey_]=i}if(s)return this._proxies_.forEach((i,r)=>{r!="_parent_"&&(i.set(null),this._publishDynamicFilling_(r,null))}),this._publishAssignement_(t),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_.__value),!0;for(const i in this._value_)this._value_[i]===void 0&&delete this._value_[i];if(this._proxies_.forEach((i,r)=>{const o=this._value_[r];r!="_parent_"&&o===void 0&&o!==null&&isNaN(Number(r))&&(i.set(null),this._publishDynamicFilling_(r,null))}),this._publishAssignement_(),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_),X(this._value_))for(const i in this._value_){const r=e[i],l=X(r)?r:{__value:r};if(!this._proxies_.has(i)){this._publishDynamicFilling_(i,r);continue}this._proxies_.get(i)?.set(l,!0),this._publishDynamicFilling_(i,r)}return!0}get(){if(Os(this),this._cachedGet_!==void 0)return this._cachedGet_;if(Object.prototype.hasOwnProperty.call(this._value_,"__value")){const e=this._value_.__value;return this._cachedGet_=e??null}return this._cachedGet_=this._value_!=null?this._value_:null}get $tag(){return this._instanceCounter_||(Z.instancesCounter++,this._instanceCounter_=Z.instancesCounter),Z.instances.set(this._instanceCounter_,this),"<"+le+'-publisher-proxy publisher="'+this._instanceCounter_+'"></'+le+"-publisher-proxy>"}};Z.instances=new Map,Z.instancesCounter=0;let Oe=Z;const Dt=[];function Os(n){Dt.length>0&&Dt[0].add(n)}const _=class _{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],_.instance!=null)throw"Singleton / use getInstance";_.instance=this,this.isLocalStrorageReady=this.cleanStorageData(),_.initPageShowHandler()}static initPageShowHandler(){_.pageShowHandlerInitialized||(_.pageShowHandlerInitialized=!0,window.addEventListener("pageshow",e=>{e.persisted&&_.getInstance().invalidateAll()}))}invalidateAll(){this.publishers.forEach(e=>{e._invalidate_on_page_show_&&e.invalidate()})}async cleanStorageData(){return new Promise(e=>{(async()=>{try{let s=localStorage.getItem(Xe),i=null;if(s&&(i=await this.decompress(s,"gzip")),i)try{this.localStorageData=JSON.parse(i)}catch{this.localStorageData={}}else s=await this.compress("{}","gzip"),localStorage.setItem(Xe,s),this.localStorageData={};const r=1e3*60*60*12;for(const o in this.localStorageData){const l=this.localStorageData[o],c=new Date().getTime()-(l.expirationDelayMs||r);l.lastModifiationMS<c&&delete this.localStorageData[o]}e(!0)}catch{window.requestAnimationFrame(()=>{e(!1)}),console.warn("no publisher cache in this browser")}})()})}static getInstance(e){if(e){const t=_.instances.get(e);return t||(console.warn("No PublisherManager instance registered with id:",e,"creating new one"),new _)}return _.instance==null?new _:_.instance}static get(e,t){return _.getInstance().get(e,t)}async setLocalData(e,t){await this.isLocalStrorageReady,e.set(this.localStorageData[t+"¤lang_"+L.getLanguage()]?.data||e.get())}get(e,t){const s=t?.localStorageMode==="enabled",i=t?.invalidateOnPageShow===!0;if(!this.publishers.has(e)){const l=Ye({});this.set(e,l)}const r=this.publishers.get(e);return s&&this.initialisedData.indexOf(e)===-1&&(t?.expirationDelayMs&&(r._expiration_delay_=t.expirationDelayMs),r._is_savable_=!0,this.initialisedData.push(e),this.setLocalData(r,e)),i&&(r._invalidate_on_page_show_=i),this.publishers.get(e)}set(e,t){this.publishers.set(e,t)}delete(e){return this.publishers.has(e)?(this.publishers.delete(e),!0):!1}async saveToLocalStorage(e=0){if(!(e!==_.saveId&&e%10!=0))try{if(!_.changed||_.saving)return;_.saving=!0,_.changed=!1;const t=Array.from(this.publishers.keys());let s=!1;for(const i of t){const r=this.publishers.get(i);if(!r?._is_savable_)continue;const o=r?.get();o&&(this.localStorageData[i+"¤lang_"+L.getLanguage()]={lastModifiationMS:new Date().getTime(),expirationDelayMs:r._expiration_delay_,data:o},s=!0)}if(s){const i=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem(Xe,i)}if(_.saving=!1,_.changed){_.saveId++;const i=_.saveId;setTimeout(()=>this.saveToLocalStorage(i),1e3)}}catch{_.saving=!1}}async compress(e,t){const s=new TextEncoder().encode(e),i=window,r=new i.CompressionStream(t),o=r.writable.getWriter();o.write(s),o.close();const l=await new Response(r.readable).arrayBuffer(),c=new Uint8Array(l);let f="";for(let d=0;d<c.length;d++)f+=String.fromCharCode(c[d]);return btoa(f)}async decompress(e,t){const s=atob(e),r=Uint8Array.from(s,d=>d.charCodeAt(0)).buffer,o=window,l=new o.DecompressionStream(t),c=l.writable.getWriter();c.write(r),c.close();const f=await new Response(l.readable).arrayBuffer();return new TextDecoder().decode(f)}};_.buildDate="Sat Oct 03 2026 09:31:33 GMT+0200 (Central European Summer Time)",_.changed=!1,_.saving=!1,_.saveId=0,_.instance=null,_.instances=new Map,_.pageShowHandlerInitialized=!1;let D=_;if(typeof window<"u"){const n=window,e=Is+"PublisherManager",t=n[e]||D;if(n[e]||(n[e]=D),t!==D){const s=["instance","instances","changed","saving","saveId","pageShowHandlerInitialized"];for(const i of s)Object.defineProperty(D,i,{configurable:!0,get(){return t[i]},set(r){t[i]=r}})}}const Ts=new Set(["invalidate","onInvalidate","offInvalidate","invalidateForm","onFormInvalidate","offFormInvalidate","onAssign","offAssign","startDynamicFilling","stopDynamicFilling","startTemplateFilling","stopTemplateFilling","onInternalMutation","offInternalMutation","set","get","$tag","_cachedGet_","_templateFillListeners_","_fillListeners_","_assignListeners_","_invalidateListeners_","_formInvalidateListeners_","_publishInternalMutation_","hasListener","delete","_mutationListeners_","_publishDynamicFilling_","_publishInvalidation_","_publishFormInvalidation_","_publishTemplateFilling_","_publishAssignement_","_proxies_","parent","_parentKey_","_value_","_is_savable_","_expiration_delay_","_lockInternalMutationPublishing_","_instanceCounter_","_assignmentId_","_invalidate_on_page_show_"]);function Us(n,e){return{get:function(t,s){if(typeof s=="string"&&Ts.has(s))return n[s];if(s==Symbol.toPrimitive)return()=>e().get();if(!n._proxies_.has(s)){const i=n._value_[s],r=Ye(X(i)?i:{__value:i},n,s);r._proxies_.set("_parent_",e()),n._proxies_.set(s,r)}return n._proxies_.get(s)},set:function(t,s,i){if(s=="_value_")return n._value_=i,!0;if(s=="_cachedGet_")return n._cachedGet_=i,!0;if(s=="_assignmentId_")return n._assignmentId_=i,!0;if(s=="_is_savable_")return n._is_savable_=i,!0;if(s=="_expiration_delay_")return n._expiration_delay_=i,!0;if(s=="_invalidate_on_page_show_")return n._invalidate_on_page_show_=i,!0;if(s=="_instanceCounter_")return n._instanceCounter_=i,!0;if(!n._proxies_.has(s)){const o=Ye({},n,s);o._proxies_.set("_parent_",e()),n._proxies_.set(s,o)}return n._value_[s]!==i&&(n._value_[s]=i,n._publishDynamicFilling_(s,i),n._proxies_.get(s)?.set(X(i)?i:{__value:i})),!0},deleteProperty:function(t,s){return n._publishDynamicFilling_(s,null),n._proxies_.get(s)?.set(null),delete n._value_[s]},has:function(t,s){return s in n._value_&&s!="_lockInternalMutationPublishing_"},defineProperty:function(t,s,i){return i&&"value"in i&&(n._value_[s]=i.value),!0},getOwnPropertyDescriptor:function(t,s){return{enumerable:!0,configurable:!0}},ownKeys:function(t){return n._value_.__value?Object.keys(n._value_.__value):Object.keys(n._value_)}}}function Ye(n,e=null,t){const s=new Oe(n,e,t);let i=null;const r=Us(s,()=>i);return i=new Proxy(s,r),i}class Ns extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=e=>{this.innerHTML=e.toString()}}connectedCallback(){this.publisherId=this.getAttribute("publisher")||"",this.publisher=Oe.instances.get(parseInt(this.publisherId)),this.publisher?.onAssign(this.onAssign)}disconnectedCallback(){this.publisher?.offAssign(this.onAssign)}}try{customElements.define(le+"-publisher-proxy",Ns)}catch{}function Rs(n){return ae(n)}function Ds(n){return n.split(".")[0]??n}function js(n){return`${Ds(Rs(n))}/_state_`}const Bs="concorde-hf-results",Ze="results",zs=64;async function Qe(n){const e=globalThis.crypto?.subtle;if(e){const i=await e.digest("SHA-256",n);return[...new Uint8Array(i)].map(r=>r.toString(16).padStart(2,"0")).join("")}let t=2166136261,s=16777619;for(let i=0;i<n.length;i++)t=Math.imul(t^n[i],16777619)>>>0,s=Math.imul(s^n[n.length-1-i],2166136261)>>>0;return`fnv-${t.toString(16)}${s.toString(16)}-${n.length}`}async function et(n){if(n instanceof Blob)return{$blob:await Qe(new Uint8Array(await n.arrayBuffer())),type:n.type};if(ArrayBuffer.isView(n))return{$typed:n.constructor.name,hash:await Qe(new Uint8Array(n.buffer,n.byteOffset,n.byteLength))};if(Array.isArray(n))return Promise.all(n.map(et));if(n&&typeof n=="object"){const e={};for(const t of Object.keys(n).sort())e[t]=await et(n[t]);return e}return n}async function Fs(n){const e=JSON.stringify(await et(n));return Qe(new TextEncoder().encode(e))}function tt(n){return n instanceof Blob?!0:Array.isArray(n)?n.some(tt):n&&typeof n=="object"?Object.values(n).some(tt):!1}const Y=new Map;function st(n,e){for(Y.delete(n),Y.set(n,e);Y.size>zs;){const t=Y.keys().next().value;if(t===void 0)break;Y.delete(t)}}let Te=null;function nt(){return Te||(Te=new Promise(n=>{try{if(typeof indexedDB>"u")return n(null);const e=indexedDB.open(Bs,1);e.onupgradeneeded=()=>{e.result.createObjectStore(Ze,{keyPath:"key"}).createIndex("at","at")},e.onsuccess=()=>n(e.result),e.onerror=()=>n(null),e.onblocked=()=>n(null)}catch{n(null)}}),Te)}function ce(n,e,t){return new Promise(s=>{try{const i=n.transaction(Ze,e),r=t(i.objectStore(Ze));i.oncomplete=()=>s(r?r.result:void 0),i.onerror=()=>s(void 0),i.onabort=()=>s(void 0)}catch{s(void 0)}})}async function Hs(n,e,t){if(Y.has(n)){const r=Y.get(n);return st(n,r),{hit:!0,value:r}}if(!e)return{hit:!1};const s=await nt();if(!s)return{hit:!1};const i=await ce(s,"readonly",r=>r.get(n));return i?t&&Date.now()-i.at>t?{hit:!1}:(st(n,i.value),ce(s,"readwrite",r=>r.put({...i,at:Date.now()})),{hit:!0,value:i.value}):{hit:!1}}async function qs(n,e,t,s){if(st(n,e),!t||tt(e))return;const i=await nt();if(!i)return;let r=0;try{r=JSON.stringify(e).length}catch{return}r>s||(await ce(i,"readwrite",o=>o.put({key:n,value:e,bytes:r,at:Date.now()})),await Ws(i,s))}async function Ws(n,e){const t=await ce(n,"readonly",r=>r.getAll())??[];let s=t.reduce((r,o)=>r+o.bytes,0);if(s<=e)return;t.sort((r,o)=>r.at-o.at);const i=[];for(const r of t){if(s<=e)break;i.push(r.key),s-=r.bytes}await ce(n,"readwrite",r=>{for(const o of i)r.delete(o)})}async function Vs(){Y.clear();const n=await nt();n&&await ce(n,"readwrite",e=>e.clear())}function it(n){return n===null?"null":Array.isArray(n)?"array":n instanceof Blob?"Blob":ArrayBuffer.isView(n)?n.constructor.name:typeof n}function Js(n){if(n==null||n==="")return null;if(typeof n=="function")return s=>{const i=n(s);return typeof i=="string"?i:null};const e=(typeof n=="string"?n.split("+"):[...n]).map(s=>s.trim()).filter(Boolean).map(s=>s.split("."));if(!e.length)return null;const t=(s,i)=>{if(s==null)return[];if(!i.length)return typeof s=="string"?s.trim()?[s.trim()]:[]:typeof s=="number"?[String(s)]:Array.isArray(s)?s.flatMap(l=>t(l,[])):[];if(Array.isArray(s))return s.flatMap(l=>t(l,i));if(typeof s!="object")return[];const[r,...o]=i;return t(s[r],o)};return s=>{const i=e.map(r=>t(s,r).join(", ")).filter(r=>r.length>0);return i.length?i.join(" — "):null}}function Gs(n){return n==null?!0:typeof n=="string"?n.trim().length===0:Array.isArray(n)?n.length===0:typeof n=="object"&&!(n instanceof Blob)&&!ArrayBuffer.isView(n)?Object.keys(n).length===0:!1}function Ks(n,e,t){switch(e.kind){case"text":{let s=null;if(typeof n=="string")s=n.trim();else if(n&&typeof n=="object"&&!Array.isArray(n)){if(!t)return{ok:!1,reason:"objet reçu sans `options.text` pour en extraire le texte"};s=t(n)}else return{ok:!1,reason:`texte attendu, reçu ${it(n)}`};return s?s.length>e.maxChars?{ok:!0,payload:s.slice(0,e.maxChars),truncated:!0}:{ok:!0,payload:s,truncated:!1}:{ok:!1,reason:"texte vide"}}case"image":return typeof n=="string"&&n.trim()?{ok:!0,payload:n.trim(),truncated:!1}:n instanceof Blob?{ok:!0,payload:n,truncated:!1}:{ok:!1,reason:`image attendue (URL, data URL ou Blob), reçu ${it(n)}`};case"audio":return n instanceof Float32Array||n instanceof Float64Array?{ok:!0,payload:n,truncated:!1}:typeof n=="string"&&n.trim()?{ok:!0,payload:n.trim(),truncated:!1}:{ok:!1,reason:`audio attendu (Float32Array, Float64Array ou URL), reçu ${it(n)}`}}}function jt(n,e){if(Gs(n))return{kind:"empty"};const t=Js(e.text),s=Array.isArray(n),i=s?n:[n];if(i.length>e.maxItems)return{kind:"invalid",code:"too-large",message:`Entrée trop grosse : ${i.length} éléments (maximum ${e.maxItems}).`};const r=[],o=[],l=[];let c=0;if(i.forEach((d,u)=>{const m=Ks(d,e,t);m.ok?(r.push(m.payload),o.push(u),m.truncated&&c++):l.push(s?`[${u}] ${m.reason}`:m.reason)}),!r.length)return{kind:"invalid",code:"invalid-input",message:`Entrée invalide : ${l.slice(0,3).join(" ; ")}${l.length>3?` (+${l.length-3})`:""}.`};const f=[];return c&&f.push(`${c} texte(s) tronqué(s) à ${e.maxChars} caractères.`),l.length&&f.push(`${l.length} élément(s) ignoré(s) : ${l.slice(0,3).join(" ; ")}.`),{kind:"ok",many:s,length:i.length,payloads:r,positions:o,skipped:i.length-r.length,truncated:c,warnings:f}}function Bt(n,e){const t=new Array(n.length).fill(null);return n.positions.forEach((s,i)=>{t[s]=e[i]??null}),t}function Xs(n,e){const t=new Map;let s=Promise.resolve();const i=a=>e.postMessage(a),r=(a,h,g)=>i({id:a,ok:!1,error:{code:h,message:g}}),o=a=>{const h=String(a?.message??a).toLowerCase();return a?.code?String(a.code):h.includes("quota")?"quota":h.includes("failed to fetch")||h.includes("network")||h.includes("404")||h.includes("could not locate")?"network":"runtime"},l=a=>{const h={...a.options||{}};return h.revision=a.revision,h},c=async()=>{const a=globalThis.navigator?.gpu;if(!a||typeof a.requestAdapter!="function")return!1;try{return!!await a.requestAdapter()}catch{return!1}},f=a=>a&&typeof a=="object"&&typeof a.tolist=="function"&&"dims"in a,d=a=>a&&typeof a=="object"&&typeof a.toBlob=="function"&&typeof a.width=="number"&&typeof a.channels=="number",u=async a=>{if(f(a))return a.tolist();if(d(a)){const h=await a.toBlob("image/png");return{width:a.width,height:a.height,channels:a.channels,blob:h}}if(Array.isArray(a))return Promise.all(a.map(u));if(a instanceof Blob)return a;if(a&&typeof a=="object"){const h={};for(const g of Object.keys(a))h[g]=await u(a[g]);return h}return a},m=a=>Array.isArray(a)&&a.length===1&&Array.isArray(a[0])?a[0]:a,T={async configure({env:a}){const h=n.env;if(h.allowLocalModels=!1,h.allowRemoteModels=!0,h.useBrowserCache=!0,h.useWasmCache=!0,h.cacheKey=a.cacheKey,a.remoteHost&&(h.remoteHost=a.remoteHost),a.remotePathTemplate&&(h.remotePathTemplate=a.remotePathTemplate),a.wasmPaths&&h.backends?.onnx?.wasm){let g=a.wasmPaths;if(typeof g=="string"){const v=g.endsWith("/")?g:g+"/",E=String(globalThis.navigator?.userAgent??""),H=/Safari\//.test(E)&&!/Chrome|Chromium|Android/.test(E),W=Number((/Version\/(\d+)/.exec(E)??[])[1]??99),A=H&&W<26&&!globalThis.navigator?.gpu?"":".asyncify";g={mjs:`${v}ort-wasm-simd-threaded${A}.mjs`,wasm:`${v}ort-wasm-simd-threaded${A}.wasm`}}h.backends.onnx.wasm.wasmPaths=g}if(a.logLevel&&n.LogLevel){const g=n.LogLevel[String(a.logLevel).toUpperCase()];g!==void 0&&(h.logLevel=g)}return{version:h.version??null}},async inspect({model:a}){const h=n.ModelRegistry,g=l(a);let v=!1,E=null;try{v=!!await h?.is_pipeline_cached?.(a.task,a.repo,g)}catch{v=!1}try{const H=await h?.get_pipeline_files?.(a.task,a.repo,g);if(H&&h?.get_file_metadata){const A=(await Promise.all(H.map(y=>h.get_file_metadata(a.repo,y,{revision:a.revision}).catch(()=>null)))).map(y=>y?.size);A.every(y=>typeof y=="number")&&(E=A.reduce((y,S)=>y+S,0))}}catch{E=null}return{cached:v,totalBytes:E}},async load({model:a,devices:h}){const g=t.get(a.alias);if(g)return{backend:g.pipe.__backend,loadMs:0};const v=performance.now(),E={},H=y=>{if(y.status==="progress_total")i({type:"progress",alias:a.alias,progress:{loadedBytes:y.loaded,totalBytes:y.total,percent:Math.round(y.progress??0)}});else if(y.status==="progress"){E[y.file]={loaded:y.loaded,total:y.total};const S=Object.values(E),U=S.reduce(($e,N)=>$e+(N.loaded||0),0),j=S.reduce(($e,N)=>$e+(N.total||0),0);i({type:"progress",alias:a.alias,progress:{file:y.file,loadedBytes:U,totalBytes:j,percent:j?Math.round(U/j*100):0}})}},W=[];for(const y of h){if(y==="webgpu"&&!await c()){W.push("webgpu indisponible");continue}try{const S=await n.pipeline(a.task,a.repo,{...l(a),device:y,progress_callback:H});return S.__backend=y,t.set(a.alias,{pipe:S,task:a.task}),{backend:y,loadMs:Math.round(performance.now()-v)}}catch(S){const U=o(S);if(U==="network"||U==="quota")throw S;W.push(`${y} : ${String(S?.message??S)}`)}}const A=new Error(`Aucun backend utilisable (${W.join(" ; ")||"aucun autorisé"}).`);throw A.code="unsupported",A},async run({request:a}){const h=t.get(a.alias);if(!h){const A=new Error(`Modèle "${a.alias}" non chargé.`);throw A.code="runtime",A}const{pipe:g}=h,v={...a.call||{}};let E;a.positional&&(E=v[a.positional],delete v[a.positional]);const H=A=>a.positional?g(A,E,v):g(A,v);if(a.batch){const A=[];for(let S=0;S<a.inputs.length;S+=32){const U=a.inputs.slice(S,S+32),j=await u(await H(U));A.push(...Array.isArray(j)?j:[j])}return A}const W=[];for(const A of a.inputs){const y=await u(await H(A));W.push(h.task==="feature-extraction"||h.task==="image-feature-extraction"?m(y):y)}return W},async clear({model:a}){const h=n.ModelRegistry;if(a){const v=t.get(a.alias);return t.delete(a.alias),await v?.pipe?.dispose?.(),await h?.clear_pipeline_cache?.(a.task,a.repo,l(a)),!0}for(const v of t.values())await v.pipe?.dispose?.();t.clear();const g=n.env.cacheKey;return g&&typeof caches<"u"&&await caches.delete(g),!0}};e.addEventListener("message",a=>{const h=a.data;!h||typeof h.id!="number"||!T[h.type]||(s=s.then(()=>T[h.type](h)).then(g=>i({id:h.id,ok:!0,result:g}),g=>r(h.id,o(g),String(g?.message??g))))})}function Ys(n){return[`const hfWorkerMain = ${Xs.toString()};`,"const pending = [];","const buffer = (event) => pending.push(event);",'self.addEventListener("message", buffer);',"let lib;","try {",` lib = await import(${JSON.stringify(n)});`,"} catch (err) {",' self.postMessage({ type: "fatal", message: "Chargement de Transformers.js impossible : " + (err && err.message || err) });'," throw err;","}",'self.removeEventListener("message", buffer);',"hfWorkerMain(lib, {"," postMessage: (message, transfer) => self.postMessage(message, transfer),"," addEventListener: (type, listener) => {"," self.addEventListener(type, listener);"," for (const event of pending.splice(0)) listener(event);"," },","});"].join(`
|
|
28
28
|
`)}class ue extends Error{constructor(e,t){super(t),this.code=e,this.name="HfEngineError"}}class Ue{constructor(e){this.createWorker=e,this.worker=null,this.nextId=1,this.pending=new Map,this.progressListeners=new Map,this.fatal=null}static fromUrl(e){let t=null;const s=new Ue(()=>{const r=Ys(e);return t=URL.createObjectURL(new Blob([r],{type:"text/javascript"})),new Worker(t,{type:"module",name:"concorde-hf"})}),i=s.dispose.bind(s);return s.dispose=()=>{i(),t&&URL.revokeObjectURL(t)},s}ensureWorker(){if(this.fatal)throw this.fatal;if(this.worker)return this.worker;const e=this.createWorker();return e.addEventListener("message",t=>this.onMessage(t.data)),e.addEventListener("error",t=>{this.failAll(new ue("runtime",`Worker Hugging Face : ${t.message||"erreur de chargement (CSP worker-src / script-src ?)"}`))}),this.worker=e,e}onMessage(e){if("type"in e){e.type==="progress"?this.progressListeners.get(e.alias)?.(e.progress):e.type==="fatal"&&this.failAll(new ue("runtime",e.message));return}const t=this.pending.get(e.id);t&&(this.pending.delete(e.id),e.ok?t.resolve(e.result):t.reject(new ue(e.error.code,e.error.message)))}failAll(e){this.fatal=e;for(const t of this.pending.values())t.reject(e);this.pending.clear()}request(e){let t;try{t=this.ensureWorker()}catch(i){return Promise.reject(i)}const s=this.nextId++;return new Promise((i,r)=>{this.pending.set(s,{resolve:i,reject:r}),t.postMessage({...e,id:s})})}async configure(e){await this.request({type:"configure",env:e})}inspect(e){return this.request({type:"inspect",model:e})}async load(e,t,s){this.progressListeners.set(e.alias,s);try{return await this.request({type:"load",model:e,devices:t})}finally{this.progressListeners.delete(e.alias)}}run(e){return this.request({type:"run",request:e})}async clear(e){await this.request({type:"clear",model:e})}dispose(){this.failAll(new ue("runtime","Moteur arrêté.")),this.worker?.terminate(),this.worker=null}}const Zs="concorde-hf-consent:",Ne=1024*1024;function Re(){try{return typeof localStorage<"u"?localStorage:null}catch{return null}}function Qs(){const n=globalThis.navigator?.connection;return n?n.saveData===!0||n.effectiveType==="slow-2g"||n.effectiveType==="2g":!1}class R extends Error{constructor(e,t){super(t),this.code=e,this.name="HfError"}}class zt{constructor(e){this.config=e,this.entries=new Map,this.engine=null,this.configured=null}get resolvedConfig(){return this.config}getEngine(){if(this.engine)return this.engine;const e=this.config.runtime;return e.source==="engine"?this.engine=e.engine:e.source==="worker"?this.engine=new Ue(e.createWorker):this.engine=Ue.fromUrl(e.url),this.engine}async ready(){const e=this.getEngine();if(!this.configured){const t=this.config.runtime,s=t.source==="engine"?void 0:t.wasmPaths??(t.source==="cdn"?new URL(".",t.url).href:void 0);this.configured=e.configure({cacheKey:`concorde-hf-${t.version}`,remoteHost:this.config.remoteHost,remotePathTemplate:this.config.remotePathTemplate,wasmPaths:s,logLevel:this.config.logLevel})}return await this.configured,e}dispose(){this.engine?.dispose(),this.engine=null,this.configured=null,this.entries.clear()}hasModel(e){return Object.prototype.hasOwnProperty.call(this.config.models,e)}model(e){if(!this.hasModel(e)){const s=Object.keys(this.config.models);throw new R("not-allowed",`[sonic-hugging-face-infer] modèle "${e}" hors liste blanche`+(s.length?` (disponibles : ${s.join(", ")}).`:"."))}const t=this.config.models[e];return{alias:e,task:t.task,repo:t.repo,revision:t.revision,options:t.options??{},devices:t.devices??["webgpu","wasm"],sizeBytes:t.sizeBytes,label:t.label,description:t.description,defaults:t.defaults}}entry(e){let t=this.entries.get(e);return t||(t={state:{phase:"idle",size:null},listeners:new Set},this.entries.set(e,t)),t}state(e){return this.entry(e).state}subscribe(e,t){const s=this.entry(e);return s.listeners.add(t),t(s.state),()=>s.listeners.delete(t)}update(e,t){const s=this.entry(e);s.state={...s.state,...t};for(const i of s.listeners)i(s.state)}inspect(e){const t=this.entry(e);if(!t.inspect){const s=this.model(e);t.inspect=(async()=>{this.update(e,{phase:"checking"});let i=s.sizeBytes??null,r=!1;try{const c=await(await this.ready()).inspect(s);i=c.totalBytes??i,r=c.cached}catch{}const o={totalBytes:i,fromCache:r};return this.update(e,{size:o,phase:"idle"}),o})()}return t.inspect}consentKey(e){return`${Zs}${e}@${this.model(e).revision}`}storedConsent(e){const t=Re()?.getItem(this.consentKey(e));return t==="accepted"||t==="declined"?t:null}accept(e){try{Re()?.setItem(this.consentKey(e),"accepted")}catch{}const t=this.entry(e);t.consent?.resolve(!0),t.consent=void 0,t.state.phase==="declined"&&this.update(e,{phase:"idle"})}decline(e){try{Re()?.setItem(this.consentKey(e),"declined")}catch{}const t=this.entry(e);t.consent?.resolve(!1),t.consent=void 0,this.update(e,{phase:"declined"})}revokeConsent(e){try{Re()?.removeItem(this.consentKey(e))}catch{}this.entry(e).state.phase==="declined"&&this.update(e,{phase:"idle"})}askConsent(e){const t=this.storedConsent(e);if(t)return Promise.resolve(t==="accepted");const s=this.entry(e);if(!s.consent){let i;const r=new Promise(o=>i=o);s.consent={promise:r,resolve:i}}return this.update(e,{phase:"awaiting-consent"}),s.consent.promise}ensureLoaded(e,t){const s=this.entry(e);if(s.state.phase==="ready")return Promise.resolve();if(s.loading)return s.loading;const i=this.load(e,t).finally(()=>{this.entry(e).loading===i&&(s.loading=void 0)});return s.loading=i,i}async load(e,t){const s=this.model(e),i=this.config.defaults,r=await this.inspect(e),o=r?.fromCache===!0,l=r?.totalBytes??null;if(!o&&t!=="manual"){const d=this.storedConsent(e);if(d==="declined"||this.entry(e).state.phase==="declined")throw this.update(e,{phase:"declined"}),new R("declined","Chargement du modèle refusé par l'utilisateur.");const u=l!==null&&l>i.consentAboveMB*Ne;if((t==="consent"||u||Qs())&&d!=="accepted"&&!await this.askConsent(e))throw this.update(e,{phase:"declined"}),new R("declined","Chargement du modèle refusé par l'utilisateur.")}const c=l??s.sizeBytes??null,f=s.devices.filter(d=>d!=="wasm"||c===null||c<=i.allowWasmUpToMB*Ne);if(!f.length)throw this.update(e,{phase:"unsupported",error:{code:"unsupported",message:"Aucune exécution autorisée pour ce modèle."}}),new R("unsupported","Aucune exécution autorisée pour ce modèle.");if(!o&&l){const d=await globalThis.navigator?.storage?.estimate?.().catch(()=>null);if(d?.quota!==void 0){const u=d.quota-(d.usage??0);if(u<l*1.2){const m=`Espace de stockage insuffisant (${Math.round(u/Ne)} Mo libres, ${Math.round(l/Ne)} Mo nécessaires).`;throw this.update(e,{phase:"error",error:{code:"quota",message:m}}),new R("quota",m)}}}this.update(e,{phase:o?"loading":"downloading",error:void 0,progress:void 0});try{const u=await(await this.ready()).load(s,f,T=>this.update(e,{phase:"downloading",progress:T}));let m;i.persist&&!o&&(m=await globalThis.navigator?.storage?.persist?.().catch(()=>!1)),this.update(e,{phase:"ready",backend:u.backend,loadMs:u.loadMs,persisted:m,size:{totalBytes:c,fromCache:o}})}catch(d){const u=d instanceof ue?d.code:"runtime",m=d instanceof Error?d.message:String(d);throw this.update(e,{phase:u==="unsupported"?"unsupported":"error",error:{code:u,message:m}}),new R(u,m)}}async run(e,t){const s=await this.ready();let i;const r=new Promise((o,l)=>{i=setTimeout(()=>l(new R("timeout",`Calcul trop long (> ${t} ms), abandonné.`)),t)});try{return await Promise.race([s.run(e),r])}catch(o){throw o instanceof R?o:o instanceof ue?new R(o.code,o.message):new R("runtime",o instanceof Error?o.message:String(o))}finally{clearTimeout(i)}}async clearModel(e){const t=this.model(e);await(await this.ready()).clear(t);const i=this.entry(e);i.inspect=void 0,this.update(e,{phase:"idle",size:null,backend:void 0,progress:void 0})}async clearAll(){await(await this.ready()).clear();for(const t of this.entries.keys())this.entry(t).inspect=void 0,this.update(t,{phase:"idle",size:null,backend:void 0,progress:void 0})}}let we=null;Ut(n=>{we?.dispose(),we=new zt(n)});function rt(){if(!we){const n=Cs();n&&(we=new zt(n))}return we}function mn(n){return n}const O={type:"boolean"},k=(n,e)=>({type:"number",minimum:n,maximum:e}),b=(n,e)=>({type:"number",integer:!0,minimum:n,maximum:e}),V=(n=500)=>({type:"string",maxLength:n}),he=(n=256)=>({type:"array",items:b(0),maxItems:n}),De=(n=64)=>({type:"array",items:he(),maxItems:n}),ot={type:"array",items:V(200),maxItems:50},en={anyOf:[V(200),ot]},Ft={anyOf:[b(1,50),{type:"null"}]},at={max_length:b(1,1024),max_new_tokens:b(1,1024),min_length:b(0,1024),min_new_tokens:b(0,1024),early_stopping:{anyOf:[O,{enum:["never"]}]},max_time:k(0,120),do_sample:O,num_beams:b(1,8),num_beam_groups:b(1,8),penalty_alpha:k(0,1),use_cache:O,temperature:k(0,5),top_k:b(0,200),top_p:k(0,1),typical_p:k(0,1),epsilon_cutoff:k(0,1),eta_cutoff:k(0,1),diversity_penalty:k(0,10),repetition_penalty:k(0,10),encoder_repetition_penalty:k(0,10),length_penalty:k(-10,10),no_repeat_ngram_size:b(0,32),bad_words_ids:De(),force_words_ids:{anyOf:[De(),{type:"array",items:De(),maxItems:64}]},renormalize_logits:O,forced_bos_token_id:b(0),forced_eos_token_id:{anyOf:[b(0),he()]},remove_invalid_values:O,exponential_decay_length_penalty:{type:"tuple",prefixItems:[b(0),k()]},suppress_tokens:he(),begin_suppress_tokens:he(),forced_decoder_ids:{type:"array",items:{type:"tuple",prefixItems:[b(0),b(0)]},maxItems:64},guidance_scale:k(0,50),num_return_sequences:b(1,8),output_attentions:O,output_hidden_states:O,output_scores:O,return_dict_in_generate:O,pad_token_id:b(0),bos_token_id:b(0),eos_token_id:{anyOf:[b(0),he()]},encoder_no_repeat_ngram_size:b(0,32),decoder_start_token_id:b(0)},tn={"feature-extraction":{pooling:{enum:["none","mean","cls","first_token","eos","last_token"]},normalize:O,quantize:O,precision:{enum:["binary","ubinary"]}},"text-classification":{top_k:Ft},"zero-shot-classification":{candidate_labels:en,hypothesis_template:V(300),multi_label:O},translation:at,"token-classification":{ignore_labels:{type:"array",items:V(100),maxItems:50},aggregation_strategy:{enum:["none","simple"]}},"fill-mask":{top_k:b(1,50)},"question-answering":{context:{anyOf:[V(2e4),{type:"array",items:V(2e4),maxItems:20}]},top_k:b(1,20)},"image-classification":{top_k:Ft},"zero-shot-image-classification":{candidate_labels:ot,hypothesis_template:V(300)},"object-detection":{threshold:k(0,1),percentage:O},"zero-shot-object-detection":{candidate_labels:ot,threshold:k(0,1),top_k:b(1,100),percentage:O},"image-feature-extraction":{pool:O},"image-segmentation":{threshold:k(0,1),mask_threshold:k(0,1),overlap_mask_area_threshold:k(0,1),subtask:{anyOf:[V(50),{type:"null"}]},label_ids_to_fuse:he(),target_sizes:De()},"depth-estimation":{},"background-removal":{},"image-to-text":at,"audio-classification":{top_k:b(1,50)},"automatic-speech-recognition":{...at,return_timestamps:{anyOf:[O,{enum:["word"]}]},chunk_length_s:k(0,60),stride_length_s:k(0,30),force_full_sequences:O,language:V(40),task:{enum:["transcribe","translate"]},num_frames:b(0)}};class lt extends Error{constructor(e){super(e),this.name="HfOptionsError"}}function ve(n){return n===null?"null":Array.isArray(n)?"array":typeof n}function je(n,e,t){if("anyOf"in n){const s=n.anyOf.map(i=>je(i,e,t));return s.some(i=>i===null)?null:s[0]}if("enum"in n)return n.enum.includes(e)?null:`${t} : valeur ${JSON.stringify(e)} non autorisée (attendu : ${n.enum.map(s=>JSON.stringify(s)).join(" | ")}).`;switch(n.type){case"boolean":return typeof e=="boolean"?null:`${t} : booléen attendu, reçu ${ve(e)}.`;case"null":return e===null?null:`${t} : null attendu.`;case"string":return typeof e!="string"?`${t} : texte attendu, reçu ${ve(e)}.`:n.maxLength!==void 0&&e.length>n.maxLength?`${t} : texte trop long (${e.length} > ${n.maxLength}).`:null;case"number":return typeof e!="number"||!Number.isFinite(e)?`${t} : nombre attendu, reçu ${ve(e)}.`:n.integer&&!Number.isInteger(e)?`${t} : entier attendu.`:n.minimum!==void 0&&e<n.minimum?`${t} : minimum ${n.minimum}.`:n.maximum!==void 0&&e>n.maximum?`${t} : maximum ${n.maximum}.`:null;case"array":{if(!Array.isArray(e))return`${t} : liste attendue, reçu ${ve(e)}.`;if(n.maxItems!==void 0&&e.length>n.maxItems)return`${t} : trop d'éléments (${e.length} > ${n.maxItems}).`;for(let s=0;s<e.length;s++){const i=je(n.items,e[s],`${t}[${s}]`);if(i)return i}return null}case"tuple":{if(!Array.isArray(e)||e.length!==n.prefixItems.length)return`${t} : liste de ${n.prefixItems.length} éléments attendue.`;for(let s=0;s<e.length;s++){const i=je(n.prefixItems[s],e[s],`${t}[${s}]`);if(i)return i}return null}}}function sn(n,e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new lt(`[sonic-hugging-face-infer] options.call : objet attendu, reçu ${ve(e)}.`);const t=tn[n];for(const[s,i]of Object.entries(e)){const r=t[s];if(!r){const l=Object.keys(t);throw new lt(`[sonic-hugging-face-infer] option "${s}" inconnue pour la tâche "${n}"`+(l.length?` (autorisées : ${l.join(", ")}).`:" (aucune option)."))}if(i===void 0)continue;const o=je(r,i,`options.call.${s}`);if(o)throw new lt(`[sonic-hugging-face-infer] ${o}`)}return e}function nn(n){if(!n||typeof n!="object")return!1;const e=n;return e.blob instanceof Blob&&(typeof e.width=="number"||typeof e.height=="number"||typeof e.channels=="number"||typeof e.url=="string"||typeof e.blobUrl=="string")}function ct(n){return typeof n!="string"?null:n.trim()||null}function rn(n){if(n==null||n==="")return null;if(typeof n=="string")return ct(n);if(typeof n!="object")return null;const e=n;return ct(e.url)??ct(e.blobUrl)}function ut(n,e){if(Array.isArray(n)){for(let s=0;s<n.length;s++)n[s]=ut(n[s],e);return n}if(!n||typeof n!="object")return n;const t=n;if(nn(t)){if(rn(t))return n;const s=URL.createObjectURL(t.blob);return e.push(s),t.url=s,n}for(const s of Object.keys(t))t[s]=ut(t[s],e);return n}function Ht(n){for(const e of n)try{URL.revokeObjectURL(e)}catch{}}const qt={"zero-shot-classification":"candidate_labels","zero-shot-image-classification":"candidate_labels","zero-shot-object-detection":"candidate_labels","question-answering":"context"},Wt={"feature-extraction":"text","text-classification":"text","zero-shot-classification":"text",translation:"text","token-classification":"text","fill-mask":"text","question-answering":"text","image-classification":"image","zero-shot-image-classification":"image","object-detection":"image","zero-shot-object-detection":"image","image-feature-extraction":"image","image-segmentation":"image","depth-estimation":"image","background-removal":"image","image-to-text":"image","audio-classification":"audio","automatic-speech-recognition":"audio"},on=1024*1024,an=5e3,Vt=1500;function de(n){const e=n.split("."),t=e.shift();let s=D.get(t);return e.length&&(s=q.traverse(s,e)),s}function ln(n){return n===!0||n===1||n==="accepted"||n==="true"||n==="1"||n==="on"}const cn={checking:"loading","awaiting-consent":"awaiting-consent",declined:"declined",downloading:"downloading",loading:"loading",ready:"ready",error:"error",unsupported:"unsupported",idle:"idle"};function un(n,e){switch(n){case"downloading":case"loading":case"running":return{status:"loading",error:null};case"done":return{status:e==null||Array.isArray(e)&&e.length===0?"empty":"ready",error:null};case"error":case"invalid-input":return{status:"error",error:null};default:return{status:"empty",error:null}}}function Jt(n,e){const t=e??rt();if(!t)throw new R("not-allowed","[sonic-hugging-face-infer] configureHuggingFace() n'a pas été appelé.");const s=t.model(n.model),i=s.task,r=t.resolvedConfig.defaults,o=n.load??r.load,l=n.trigger??r.trigger,c=n.debounceMs??r.debounceMs,f=n.emptyValue??null,d=n.onInvalid??"keep",u=(p,w)=>p===void 0?w:n.untrusted?Math.min(p,w):p,m=u(n.maxItems,r.maxItems),T=u(n.maxChars,r.maxChars),a=u(n.timeoutMs,r.timeoutMs),h=n.persistResults??!1,g=t.resolvedConfig.runtime.version,v=ae(n.input),E=ae(n.output);if(v===E||E.startsWith(v+".")||v.startsWith(E+"."))throw new Error(`[sonic-hugging-face-infer] la sortie "${E}" chevauche l'entrée "${v}".`);const H=n.status?ae(n.status):null,W=de(E),A=D.get(js(E)),y=H?de(H):null;let S=null,U={...s.defaults??{}};try{const p=n.untrusted?sn(i,n.call):n.call??{};U={...U,...p}}catch(p){S=p instanceof Error?p.message:String(p)}const j=qt[i],$e=i==="feature-extraction"&&!!U.pooling&&U.pooling!=="none";let N="idle",B=t.state(n.model),ne,Gt,ht,dt,ft=!1,pt,Ae=[],Q=0,z=!1,J=null,gt=!1,Kt=!1;const pn=()=>{switch(N){case"empty":return"empty";case"invalid-input":return"invalid-input";case"running":return"running";case"done":return"done";case"error":return"error";default:return cn[B.phase]??"idle"}},F=()=>{if(z)return;const p=pn();if(A.set(un(p,pt)),!y)return;const w=!["done","running","empty","invalid-input"].includes(p)&&B.error?B.error:void 0,$={state:p,model:{alias:s.alias,task:i,repo:s.repo,revision:s.revision,label:s.label,description:s.description},size:{totalBytes:B.size?.totalBytes??null,totalMB:B.size?.totalBytes==null?null:Math.round(B.size.totalBytes/on),fromCache:B.size?.fromCache??!1},progress:B.progress,backend:B.backend,persisted:B.persisted,skipped:ht,warnings:dt,timings:{loadMs:B.loadMs,lastRunMs:Gt},fromResultsCache:ft,error:ne??w};y.set(JSON.parse(JSON.stringify($)))},Se=p=>{Ht(Ae),Ae=[];const w=ut(p,Ae);pt=w,W.set(w)},_t=async p=>{Kt=!0,await t.ensureLoaded(n.model,p)},gn=async p=>{if(S)return N="error",ne={code:"invalid-input",message:S},F(),null;const w=de(v).get(),$=jt(w,{kind:Wt[i],text:n.text,maxItems:m,maxChars:T});if($.kind==="empty")return N="empty",ht=void 0,dt=void 0,Se(f),F(),null;if($.kind==="invalid")return N="invalid-input",ne={code:$.code,message:$.message},d==="clear"&&Se(f),F(),null;if(j&&(U[j]===void 0||U[j]===""))return N="invalid-input",ne={code:"invalid-input",message:`options.call.${j} est requis pour la tâche "${i}".`},F(),null;ht=$.skipped||void 0,dt=$.warnings.length?$.warnings:void 0;const G=await Fs({payloads:$.payloads,positions:$.positions,length:$.length,many:$.many,alias:s.alias,repo:s.repo,revision:s.revision,options:s.options,runtime:g,call:U});if(p!==Q||z)return null;const C=await Hs(G,h,n.resultsTtlMs);return p!==Q||z?null:C.hit?(N="done",ft=!0,Se(C.value),F(),null):o==="manual"&&B.phase!=="ready"?(N="waiting-model",gt=!0,F(),null):{input:$,key:G}},_n=async(p,w,$)=>{N="waiting-model",F();try{await _t(o)}catch(C){if(p!==Q||z)return;N="waiting-model",pt===void 0&&Se(f),(!(C instanceof R)||C.code==="runtime")&&(ne={code:C instanceof R?C.code:"runtime",message:C instanceof Error?C.message:String(C)}),F();return}if(p!==Q||z)return;N="running",F();const G=performance.now();try{const C=await t.run({alias:s.alias,inputs:w.payloads,call:U,positional:j,batch:$e},a);if(p!==Q||z)return;const Yt=w.many?Bt(w,C):C[0]??null;Gt=Math.round(performance.now()-G),N="done",Se(Yt),F(),qs($,Yt,h,r.resultsCacheBytes)}catch(C){if(p!==Q||z)return;N="error",ne={code:C instanceof R?C.code:"runtime",message:C instanceof Error?C.message:String(C)},F()}},Xt=async()=>{if(z)return;const p=++Q;ne=void 0,ft=!1;const w=await gn(p);!w||p!==Q||z||await _n(p,w.input,w.key)},mt=(p=c)=>{z||(J&&clearTimeout(J),J=setTimeout(()=>{J=null,Xt()},p))},yt=[],bt=(p,w)=>{const $=de(p);$.onInternalMutation(w),yt.push(()=>$.offInternalMutation(w))};if(yt.push(t.subscribe(n.model,p=>{B=p,F(),p.phase==="ready"&>&&(gt=!1,mt(0))})),l==="mutation"?bt(v,()=>mt()):F(),n.triggerProvider){const p=ae(n.triggerProvider);let w=!0,$="";bt(p,()=>{const G=JSON.stringify(de(p).get()??null);if(w){w=!1,$=G;return}G!==$&&($=G,G!=="null"&&mt(0))})}if(n.consentProvider){const p=ae(n.consentProvider);bt(p,()=>{const w=de(p).get();ln(w)?t.accept(n.model):w==="declined"&&t.decline(n.model)})}const ke=p=>{z||Kt||_t(p).catch(()=>{})};if(o==="auto")ke("auto");else if(o==="idle"){const p=globalThis.requestIdleCallback;p?p(()=>ke("idle"),{timeout:an}):setTimeout(()=>ke("idle"),Vt)}else o==="visible"?n.whenVisible?n.whenVisible().then(()=>ke("visible")):setTimeout(()=>ke("visible"),Vt):t.inspect(n.model).catch(()=>{});return{stop(){if(!z){z=!0,J&&clearTimeout(J);for(const p of yt)p();Ht(Ae),Ae=[]}},run(){return J&&clearTimeout(J),J=null,Xt()},async load(){await _t("manual")},accept(){t.accept(n.model)},decline(){t.decline(n.model)}}}var hn=Object.defineProperty,dn=Object.getOwnPropertyDescriptor,M=(n,e,t,s)=>{for(var i=s>1?void 0:s?dn(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(s?o(e,t,i):o(i))||i);return s&&i&&hn(e,t,i),i};let x=class extends be{constructor(){super(...arguments),this.model="",this.inputProvider="",this.outputProvider="",this.statusProvider="",this.triggerProvider="",this.consentProvider="",this.options=null,this.load="",this.trigger="",this.debounce=null,this.emptyValue=null,this.onInvalid="keep",this.maxItems=null,this.maxChars=null,this.timeoutMs=null,this.persistResults=!1,this.resultsTtl=null,this.handle=null,this.offConfig=null,this.visible=null,this.whenVisible=()=>(this.visible||(this.visible=new Promise(n=>{const e=this.parentElement??this;if(typeof IntersectionObserver>"u")return n();const t=new IntersectionObserver(s=>{s.some(i=>i.isIntersecting)&&(t.disconnect(),n())});t.observe(e)})),this.visible)}connectedCallback(){super.connectedCallback(),this.offConfig=Ut(()=>this.restart()),this.hasUpdated&&this.restart()}disconnectedCallback(){this.handle?.stop(),this.handle=null,this.offConfig?.(),this.offConfig=null,super.disconnectedCallback()}updated(n){n.size&&this.isConnected&&this.restart()}run(){return this.handle?.run()??Promise.resolve()}loadModel(){return this.handle?.load()??Promise.resolve()}accept(){this.handle?.accept()}decline(){this.handle?.decline()}restart(){if(this.handle?.stop(),this.handle=null,!!this.isConnected&&!(!this.model||!this.inputProvider||!this.outputProvider)){if(!rt()){console.warn("[sonic-hugging-face-infer] configureHuggingFace() n'a pas été appelé : composant inactif.");return}try{this.handle=Jt({model:this.model,input:this.inputProvider,output:this.outputProvider,status:this.statusProvider||void 0,triggerProvider:this.triggerProvider||void 0,consentProvider:this.consentProvider||void 0,text:this.options?.text,call:this.options?.call,untrusted:!0,load:this.load||void 0,trigger:this.trigger||void 0,debounceMs:this.debounce??void 0,emptyValue:this.emptyValue,onInvalid:this.onInvalid,maxItems:this.maxItems??void 0,maxChars:this.maxChars??void 0,timeoutMs:this.timeoutMs??void 0,persistResults:this.persistResults,resultsTtlMs:this.resultsTtl??void 0,whenVisible:this.whenVisible})}catch(n){console.error(n instanceof Error?n.message:n)}}}render(){return ds`<slot></slot>`}};x.styles=[Qt`
|
|
29
29
|
:host {
|
|
30
30
|
display: contents;
|
|
@@ -1291,7 +1291,7 @@ const m = class m {
|
|
|
1291
1291
|
return new TextDecoder().decode(f);
|
|
1292
1292
|
}
|
|
1293
1293
|
};
|
|
1294
|
-
m.buildDate = "
|
|
1294
|
+
m.buildDate = "Sat Oct 03 2026 09:31:33 GMT+0200 (Central European Summer Time)", m.changed = !1, m.saving = !1, m.saveId = 0, m.instance = null, m.instances = /* @__PURE__ */ new Map(), m.pageShowHandlerInitialized = !1;
|
|
1295
1295
|
let F = m;
|
|
1296
1296
|
if (typeof window < "u") {
|
|
1297
1297
|
const n = window, e = Os + "PublisherManager", t = n[e] || F;
|