1import{c as rd,f as xl,u as od,i as S,l as H,m as d,x as c,r as Fe,a as $,E as D,T as es,s as Re}from"./lang/af-6Okccdsl.js";const nd=(e,t,r)=>{const o=e[t];return o?"function"==typeof o?o():Promise.resolve(o):new Promise((e,o)=>{("function"==typeof queueMicrotask?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==r?". Note that variables only represent file names one level deep.":""))))})},id="en",$l=["af","am","ar","ay","az","be","bg","bi","bn","bs","ca","ch","cs","cy","da","de","dv","dz","el","en","es","et","eu","fa","fi","fj","fr","ga","gd","gl","gn","gv","he","hi","ho","hr","ht","hu","hy","id","is","it","ja","ka","kk","kl","km","ko","ku","ky","la","lb","lo","lt","lv","mg","mh","mi","mk","mn","ms","mt","my","na","nb","nd","ne","nl","nr","ny","pap","pl","prs","ps","pt","qu","rn","ro","ru","rw","sg","si","sk","sl","sm","sn","so","sq","sr","ss","st","sv","sw","ta","tg","th","ti","tk","tl","tn","to","tr","ts","uk","ur","uz","ve","vi","xh","zh","zu"];var sd=Object.defineProperty,ad=(e,t,r)=>t in e?sd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ni=(e,t,r)=>(ad(e,"symbol"!=typeof t?t+"":t,r),r),ld=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},ii=(e,t)=>{if(Object(t)!==t)throw TypeError('Cannot use the "in" operator on this value');return e.has(t)},Uo=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},va=(e,t,r)=>(ld(e,t,"access private method"),r);function _l(e,t){return Object.is(e,t)}let re=null,to=!1,Yo=1;const en=Symbol("SIGNAL");function fr(e){const t=re;return re=e,t}function cd(){return re}function dd(){return to}const ts={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function Sn(e){if(to)throw new Error(typeof ngDevMode<"u"&&ngDevMode?"Assertion error: signal read during notification phase":"");if(null===re)return;re.consumerOnSignalRead(e);const t=re.nextProducerIndex++;if($r(re),t<re.producerNode.length&&re.producerNode[t]!==e&&$i(re)){En(re.producerNode[t],re.producerIndexOfThis[t])}re.producerNode[t]!==e&&(re.producerNode[t]=e,re.producerIndexOfThis[t]=$i(re)?Sl(e,re,t):0),re.producerLastReadVersion[t]=e.version}function hd(){Yo++}function kl(e){if(e.dirty||e.lastCleanEpoch!==Yo){if(!e.producerMustRecompute(e)&&!md(e))return e.dirty=!1,void(e.lastCleanEpoch=Yo);e.producerRecomputeValue(e),e.dirty=!1,e.lastCleanEpoch=Yo}}function Cl(e){if(void 0===e.liveConsumerNode)return;const t=to;to=!0;try{for(const t of e.liveConsumerNode)t.dirty||pd(t)}finally{to=t}}function ud(){return!1!==re?.consumerAllowSignalWrites}function pd(e){var t;e.dirty=!0,Cl(e),null==(t=e.consumerMarkedDirty)||t.call(e.wrapper??e)}function gd(e){return e&&(e.nextProducerIndex=0),fr(e)}function fd(e,t){if(fr(t),e&&void 0!==e.producerNode&&void 0!==e.producerIndexOfThis&&void 0!==e.producerLastReadVersion){if($i(e))for(let t=e.nextProducerIndex;t<e.producerNode.length;t++)En(e.producerNode[t],e.producerIndexOfThis[t]);for(;e.producerNode.length>e.nextProducerIndex;)e.producerNode.pop(),e.producerLastReadVersion.pop(),e.producerIndexOfThis.pop()}}function md(e){$r(e);for(let t=0;t<e.producerNode.length;t++){const r=e.producerNode[t],o=e.producerLastReadVersion[t];if(o!==r.version||(kl(r),o!==r.version))return!0}return!1}function Sl(e,t,r){var o;if(rs(e),$r(e),0===e.liveConsumerNode.length){null==(o=e.watched)||o.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)e.producerIndexOfThis[t]=Sl(e.producerNode[t],e,t)}return e.liveConsumerIndexOfThis.push(r),e.liveConsumerNode.push(t)-1}function En(e,t){var r;if(rs(e),$r(e),typeof ngDevMode<"u"&&ngDevMode&&t>=e.liveConsumerNode.length)throw new Error(`Assertion error: active consumer index ${t} is out of bounds of ${e.liveConsumerNode.length} consumers)`);if(1===e.liveConsumerNode.length){null==(r=e.unwatched)||r.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)En(e.producerNode[t],e.producerIndexOfThis[t])}const o=e.liveConsumerNode.length-1;if(e.liveConsumerNode[t]=e.liveConsumerNode[o],e.liveConsumerIndexOfThis[t]=e.liveConsumerIndexOfThis[o],e.liveConsumerNode.length--,e.liveConsumerIndexOfThis.length--,t<e.liveConsumerNode.length){const r=e.liveConsumerIndexOfThis[t],o=e.liveConsumerNode[t];$r(o),o.producerIndexOfThis[r]=t}}function $i(e){var t;return e.consumerIsAlwaysLive||((null==(t=e?.liveConsumerNode)?void 0:t.length)??0)>0}function $r(e){e.producerNode??(e.producerNode=[]),e.producerIndexOfThis??(e.producerIndexOfThis=[]),e.producerLastReadVersion??(e.producerLastReadVersion=[])}function rs(e){e.liveConsumerNode??(e.liveConsumerNode=[]),e.liveConsumerIndexOfThis??(e.liveConsumerIndexOfThis=[])}function El(e){if(kl(e),Sn(e),e.value===_i)throw e.error;return e.value}function bd(e){const t=Object.create(vd);t.computation=e;const r=()=>El(t);return r[en]=t,r}const si=Symbol("UNSET"),ai=Symbol("COMPUTING"),_i=Symbol("ERRORED"),vd={...ts,value:si,dirty:!0,error:null,equal:_l,producerMustRecompute:e=>e.value===si||e.value===ai,producerRecomputeValue(e){if(e.value===ai)throw new Error("Detected cycle in computations.");const t=e.value;e.value=ai;const r=gd(e);let o,n=!1;try{o=e.computation.call(e.wrapper),n=t!==si&&t!==_i&&e.equal.call(e.wrapper,t,o)}catch(t){o=_i,e.error=t}finally{fd(e,r)}n?e.value=t:(e.value=o,e.version++)}};function wd(){throw new Error}let yd=wd;function xd(){yd()}function $d(e){const t=Object.create(Cd);t.value=e;const r=()=>(Sn(t),t.value);return r[en]=t,r}function _d(){return Sn(this),this.value}function kd(e,t){ud()||xd(),e.equal.call(e.wrapper,e.value,t)||(e.value=t,Sd(e))}const Cd={...ts,equal:_l,value:void 0};function Sd(e){e.version++,hd(),Cl(e)}const he=Symbol("node");var St;(e=>{var t,r,o,n;t=he,r=new WeakSet,e.isState=e=>"object"==typeof e&&ii(r,e),e.State=class{constructor(o,n={}){Uo(this,r),ni(this,t);const i=$d(o)[en];if(this[he]=i,i.wrapper=this,n){const t=n.equals;t&&(i.equal=t),i.watched=n[e.subtle.watched],i.unwatched=n[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return _d.call(this[he])}set(t){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.set");if(dd())throw new Error("Writes to signals not permitted during Watcher callback");kd(this[he],t)}};o=he,n=new WeakSet,e.isComputed=e=>"object"==typeof e&&ii(n,e),e.Computed=class{constructor(t,r){Uo(this,n),ni(this,o);const i=bd(t)[en];if(i.consumerAllowSignalWrites=!0,this[he]=i,i.wrapper=this,r){const t=r.equals;t&&(i.equal=t),i.watched=r[e.subtle.watched],i.unwatched=r[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return El(this[he])}},(t=>{var r,o,n,i;t.untrack=function(e){let t,r=null;try{r=fr(null),t=e()}finally{fr(r)}return t},t.introspectSources=function(t){var r;if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return(null==(r=t[he].producerNode)?void 0:r.map(e=>e.wrapper))??[]},t.introspectSinks=function(t){var r;if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called introspectSinks without a Signal argument");return(null==(r=t[he].liveConsumerNode)?void 0:r.map(e=>e.wrapper))??[]},t.hasSinks=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called hasSinks without a Signal argument");const r=t[he].liveConsumerNode;return!!r&&r.length>0},t.hasSources=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called hasSources without a Computed or Watcher argument");const r=t[he].producerNode;return!!r&&r.length>0};r=he,o=new WeakSet,n=new WeakSet,i=function(t){for(const r of t)if(!(0,e.isComputed)(r)&&!(0,e.isState)(r))throw new TypeError("Called watch/unwatch without a Computed or State argument")}
1,e.isWatcher=e=>ii(o,e),t.Watcher=class{constructor(e){Uo(this,o),Uo(this,n),ni(this,r);let t=Object.create(ts);t.wrapper=this,t.consumerMarkedDirty=e,t.consumerIsAlwaysLive=!0,t.consumerAllowSignalWrites=!1,t.producerNode=[],this[he]=t}watch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");va(this,n,i).call(this,t);const r=this[he];r.dirty=!1;const o=fr(r);for(const e of t)Sn(e[he]);fr(o)}unwatch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");va(this,n,i).call(this,t);const r=this[he];$r(r);for(let e=r.producerNode.length-1;e>=0;e--)if(t.includes(r.producerNode[e].wrapper)){En(r.producerNode[e],r.producerIndexOfThis[e]);const t=r.producerNode.length-1;if(r.producerNode[e]=r.producerNode[t],r.producerIndexOfThis[e]=r.producerIndexOfThis[t],r.producerNode.length--,r.producerIndexOfThis.length--,r.nextProducerIndex--,e<r.producerNode.length){const t=r.producerIndexOfThis[e],o=r.producerNode[e];rs(o),o.liveConsumerIndexOfThis[t]=e}}}getPending(){if(!(0,e.isWatcher)(this))throw new TypeError("Called getPending without Watcher receiver");return this[he].producerNode.filter(e=>e.dirty).map(e=>e.wrapper)}},t.currentComputed=function(){var e;return null==(e=cd())?void 0:e.wrapper},t.watched=Symbol("watched"),t.unwatched=Symbol("unwatched")})(e.subtle||(e.subtle={}))})(St||(St={}));const Ed=Symbol("SignalWatcherBrand"),Td=new FinalizationRegistry(({watcher:e,signal:t})=>{e.unwatch(t)}),wa=new WeakMap;function yo(e){return!0===e[Ed]?(console.warn("SignalWatcher should not be applied to the same class more than once."),e):class extends e{constructor(){super(...arguments),this._$St=new St.State(0),this._$Si=!1,this._$So=!0,this._$Sh=new Set}_$Sl(){if(void 0!==this._$Su)return;this._$Sv=new St.Computed(()=>{this._$St.get(),super.performUpdate()});const e=this._$Su=new St.subtle.Watcher(function(){const e=wa.get(this);void 0!==e&&(!1===e._$Si&&e.requestUpdate(),this.watch())});wa.set(e,this),Td.register(this,{watcher:e,signal:this._$Sv}),e.watch(this._$Sv)}_$Sp(){void 0!==this._$Su&&(this._$Su.unwatch(this._$Sv),this._$Sv=void 0,this._$Su=void 0)}performUpdate(){this.isUpdatePending&&(this._$Sl(),this._$Si=!0,this._$St.set(this._$St.get()+1),this._$Si=!1,this._$Sv.get())}update(e){try{this._$So?(this._$So=!1,super.update(e)):this._$Sh.forEach(e=>e.commit())}finally{this.isUpdatePending=!1,this._$Sh.clear()}}requestUpdate(e,t,r){this._$So=!0,super.requestUpdate(e,t,r)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),queueMicrotask(()=>{!1===this.isConnected&&this._$Sp()})}_(e){this._$Sh.add(e);const t=this._$So;this.requestUpdate(),this._$So=t}m(e){this._$Sh.delete(e)}}}const Tn={ATTRIBUTE:1,CHILD:2},xo=e=>(...t)=>({_$litDirective$:e,values:t});let $o=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};const Ad=e=>void 0===e.strings,ro=(e,t)=>{const r=e._$AN;if(void 0===r)return!1;for(const e of r)e._$AO?.(t,!1),ro(e,t);return!0},tn=e=>{let t,r;do{if(void 0===(t=e._$AM))break;r=t._$AN,r.delete(e),e=t}while(0===r?.size)},Tl=e=>{for(let t;t=e._$AM;e=t){let r=t._$AN;if(void 0===r)t._$AN=r=new Set;else if(r.has(e))break;r.add(e),Od(t)}};function Id(e){void 0!==this._$AN?(tn(this),this._$AM=e,Tl(this)):this._$AM=e}function Pd(e,t=!1,r=0){const o=this._$AH,n=this._$AN;if(void 0!==n&&0!==n.size)if(t)if(Array.isArray(o))for(let e=r;e<o.length;e++)ro(o[e],!1),tn(o[e]);else null!=o&&(ro(o,!1),tn(o));else ro(this,e)}const Od=e=>{e.type==Tn.CHILD&&(e._$AP??=Pd,e._$AQ??=Id)};class Dd extends $o{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),Tl(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(ro(this,e),tn(this))}setValue(e){if(Ad(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}const os=St.State,Pr=St.Computed,An=(e,t)=>new St.State(e,t),ns={apiUrl:"https://robotoff.openfoodfacts.org/api/v1",dryRun:!1,imgUrl:"https://images.openfoodfacts.org/images/products"},is={apiUrl:"https://api.folksonomy.openfoodfacts.org"};var we=(e=>(e.CLOSE="close",e.SUCCESS="success",e.SAVE="save",e.SUBMIT="submit",e.REFUSE="refuse",e.SKIP="skip",e.QUESTION_STATE="question-state",e.NUTRIENT_STATE="nutrient-state",e.BARCODE_SCANNER_STATE="barcode-scanner-state",e.INGREDIENT_SPELLCHECK_STATE="ingredient-spellcheck-state",e.INGREDIENT_DETECTION_STATE="ingredient-detection-state",e.INPUT="INPUT",e))(we||{}),oo=(e=>(e.NOT_LOADED="not-loaded",e.LOADING="loading",e.LOADED="loaded",e))(oo||{});const Al="en",Md="fr";var V=(e=>(e.LOADING="loading",e.NO_DATA="no-data",e.HAS_DATA="has-data",e.ANNOTATED="annotated",e.FINISHED="FINISHED",e))(V||{});const Il="/assets/images",Rd="carret-bottom.svg",ya="white-carret-bottom.svg";var ue=(e=>(e.QUESTIONS="questions",e.INGREDIENT_SPELLCHECK="ingredient_spellcheck",e.NUTRIENT_EXTRACTION="nutrient_extraction",e.INGREDIENT_DETECTION="ingredient_detection",e))(ue||{});const Nd="https://static.openfoodfacts.org",Pl=An(Il),ct=e=>`${Pl.get()}/${e}`,ss=An(Md),Et=An(Al),{getLocale:h0,setLocale:Ld}
1=rd({sourceLocale:id,targetLocales:$l,loadLocale:e=>nd(Object.assign({
1"./dist/locales/af.ts":()=>import("./lang/af-6Okccdsl.js").then(e=>e.b),
1"./dist/locales/am.ts":()=>import("./lang/am-BOC-qaFU.js"),
1"./dist/locales/ar.ts":()=>import("./lang/ar-CAGdBpy8.js"),
1"./dist/locales/ay.ts":()=>import("./lang/ay-sYDrAWJS.js"),
1"./dist/locales/az.ts":()=>import("./lang/az-Bf5zYk4r.js"),
1"./dist/locales/be.ts":()=>import("./lang/be-fwyFNoQY.js"),
1"./dist/locales/bg.ts":()=>import("./lang/bg-BakC5jvh.js"),
1"./dist/locales/bi.ts":()=>import("./lang/bi-sYDrAWJS.js"),
1"./dist/locales/bn.ts":()=>import("./lang/bn-DNK-QYSC.js"),
1"./dist/locales/bs.ts":()=>import("./lang/bs-WI_Y0LxU.js"),
1"./dist/locales/ca.ts":()=>import("./lang/ca-C-UVA9YG.js"),
1"./dist/locales/ch.ts":()=>import("./lang/ch-sYDrAWJS.js"),
1"./dist/locales/cs.ts":()=>import("./lang/cs-BpJJTP53.js"),
1"./dist/locales/cy.ts":()=>import("./lang/cy-BBq8d3yI.js"),
1"./dist/locales/da.ts":()=>import("./lang/da-Dik5qNW3.js"),
1"./dist/locales/de.ts":()=>import("./lang/de-D7QLmrtK.js"),
1"./dist/locales/dv.ts":()=>import("./lang/dv-sYDrAWJS.js"),
1"./dist/locales/dz.ts":()=>import("./lang/dz-sYDrAWJS.js"),
1"./dist/locales/el.ts":()=>import("./lang/el--lHQayNd.js"),
1"./dist/locales/en.ts":()=>import("./lang/en-sYDrAWJS.js"),
1"./dist/locales/es.ts":()=>import("./lang/es-sYDrAWJS.js"),
1"./dist/locales/et.ts":()=>import("./lang/et-BGf0okCl.js"),
1"./dist/locales/eu.ts":()=>import("./lang/eu-Bue4GdP0.js"),
1"./dist/locales/fa.ts":()=>import("./lang/fa-B6qgKcDM.js"),
1"./dist/locales/fi.ts":()=>import("./lang/fi-yuLIgDB1.js"),
1"./dist/locales/fj.ts":()=>import("./lang/fj-sYDrAWJS.js"),
1"./dist/locales/fr.ts":()=>import("./lang/fr-5YqodAOf.js"),
1"./dist/locales/ga.ts":()=>import("./lang/ga-sYDrAWJS.js"),
1"./dist/locales/gd.ts":()=>import("./lang/gd-DMKCXreH.js"),
1"./dist/locales/gl.ts":()=>import("./lang/gl-Btj5wBwq.js"),
1"./dist/locales/gn.ts":()=>import("./lang/gn-sYDrAWJS.js"),
1"./dist/locales/gv.ts":()=>import("./lang/gv-sYDrAWJS.js"),
1"./dist/locales/he.ts":()=>import("./lang/he-JShN2dCE.js"),
1"./dist/locales/hi.ts":()=>import("./lang/hi-fNzXPRsX.js"),
1"./dist/locales/ho.ts":()=>import("./lang/ho-sYDrAWJS.js"),
1"./dist/locales/hr.ts":()=>import("./lang/hr-IK-5fj96.js"),
1"./dist/locales/ht.ts":()=>import("./lang/ht-CobDZp1Y.js"),
1"./dist/locales/hu.ts":()=>import("./lang/hu-Bp0-YnB9.js"),
1"./dist/locales/hy.ts":()=>import("./lang/hy-sYDrAWJS.js"),
1"./dist/locales/id.ts":()=>import("./lang/id-L2AqcnUd.js"),
1"./dist/locales/is.ts":()=>import("./lang/is-Cd7Bz5FE.js"),
1"./dist/locales/it.ts":()=>import("./lang/it-B2IHMQLB.js"),
1"./dist/locales/ja.ts":()=>import("./lang/ja-CugLeZ52.js"),
1"./dist/locales/ka.ts":()=>import("./lang/ka-CE4HlkCM.js"),
1"./dist/locales/kk.ts":()=>import("./lang/kk-37Jd9fYM.js"),
1"./dist/locales/kl.ts":()=>import("./lang/kl-sYDrAWJS.js"),
1"./dist/locales/km.ts":()=>import("./lang/km-7oEqW-20.js"),
1"./dist/locales/ko.ts":()=>import("./lang/ko-D8HCsLdQ.js"),
1"./dist/locales/ku.ts":()=>import("./lang/ku-Fd5uYha8.js"),
1"./dist/locales/ky.ts":()=>import("./lang/ky-DG0qZEVg.js"),
1"./dist/locales/la.ts":()=>import("./lang/la-sYDrAWJS.js"),
1"./dist/locales/lb.ts":()=>import("./lang/lb-_9r0IedX.js"),
1"./dist/locales/lo.ts":()=>import("./lang/lo-k2phgTP6.js"),
1"./dist/locales/lt.ts":()=>import("./lang/lt-BXeH8JsQ.js"),
1"./dist/locales/lv.ts":()=>import("./lang/lv-335wFYkE.js"),
1"./dist/locales/mg.ts":()=>import("./lang/mg-B80ee8dp.js"),
1"./dist/locales/mh.ts":()=>import("./lang/mh-sYDrAWJS.js"),
1"./dist/locales/mi.ts":()=>import("./lang/mi-CUnnZdii.js"),
1"./dist/locales/mk.ts":()=>import("./lang/mk-sYDrAWJS.js"),
1"./dist/locales/mn.ts":()=>import("./lang/mn-C3-15OoT.js"),
1"./dist/locales/ms.ts":()=>import("./lang/ms-AUjAJbqM.js"),
1"./dist/locales/mt.ts":()=>import("./lang/mt-uz-WMIcq.js"),
1"./dist/locales/my.ts":()=>import("./lang/my-B-kN8i21.js"),
1"./dist/locales/na.ts":()=>import("./lang/na-sYDrAWJS.js"),
1"./dist/locales/nb.ts":()=>import("./lang/nb-CoCeVXOk.js"),
1"./dist/locales/nd.ts":()=>import("./lang/nd-sYDrAWJS.js"),
1"./dist/locales/ne.ts":()=>import("./lang/ne-sYDrAWJS.js"),
1"./dist/locales/nl.ts":()=>import("./lang/nl-sYDrAWJS.js"),
1"./dist/locales/nr.ts":()=>import("./lang/nr-D7Yw3mHp.js"),
1"./dist/locales/ny.ts":()=>import("./lang/ny-sYDrAWJS.js"),
1"./dist/locales/pap.ts":()=>import("./lang/pap-sYDrAWJS.js"),
1"./dist/locales/pl.ts":()=>import("./lang/pl-BDYz0XmF.js"),
1"./dist/locales/prs.ts":()=>import("./lang/prs-sYDrAWJS.js"),
1"./dist/locales/ps.ts":()=>import("./lang/ps-sYDrAWJS.js"),
1"./dist/locales/pt.ts":()=>import("./lang/pt-sYDrAWJS.js"),
1"./dist/locales/qu.ts":()=>import("./lang/qu-Dt5K4v4k.js"),
1"./dist/locales/rn.ts":()=>import("./lang/rn-sYDrAWJS.js"),
1"./dist/locales/ro.ts":()=>import("./lang/ro-g6x6okGw.js"),
1"./dist/locales/ru.ts":()=>import("./lang/ru-Cp9iU5WE.js"),
1"./dist/locales/rw.ts":()=>import("./lang/rw-sYDrAWJS.js"),
1"./dist/locales/sg.ts":()=>import("./lang/sg-D7Yw3mHp.js"),
1"./dist/locales/si.ts":()=>import("./lang/si-sYDrAWJS.js"),
1"./dist/locales/sk.ts":()=>import("./lang/sk-DjQfUYuk.js"),
1"./dist/locales/sl.ts":()=>import("./lang/sl-DoSGc5OO.js"),
1"./dist/locales/sm.ts":()=>import("./lang/sm-sYDrAWJS.js"),
1"./dist/locales/sn.ts":()=>import("./lang/sn-aOWQ9J92.js"),
1"./dist/locales/so.ts":()=>import("./lang/so-wm-8DX31.js"),
1"./dist/locales/sq.ts":()=>import("./lang/sq-Biqugg8s.js"),
1"./dist/locales/sr.ts":()=>import("./lang/sr-sYDrAWJS.js"),
1"./dist/locales/ss.ts":()=>import("./lang/ss-CwW4nmUW.js"),
1"./dist/locales/st.ts":()=>import("./lang/st-llTP0b4k.js"),
1"./dist/locales/sv.ts":()=>import("./lang/sv-sYDrAWJS.js"),
1"./dist/locales/sw.ts":()=>import("./lang/sw-D8JuRPWY.js"),
1"./dist/locales/ta.ts":()=>import("./lang/ta-CeE9GOBG.js"),
1"./dist/locales/tg.ts":()=>import("./lang/tg-CKtqVrMY.js"),
1"./dist/locales/th.ts":()=>import("./lang/th-COf-NrMN.js"),
1"./dist/locales/ti.ts":()=>import("./lang/ti-B-GfFtBd.js"),
1"./dist/locales/tk.ts":()=>import("./lang/tk-sYDrAWJS.js"),
1"./dist/locales/tl.ts":()=>import("./lang/tl-D2pzYlXj.js"),
1"./dist/locales/tn.ts":()=>import("./lang/tn-D-gOesv_.js"),
1"./dist/locales/to.ts":()=>import("./lang/to-sYDrAWJS.js"),
1"./dist/locales/tr.ts":()=>import("./lang/tr-CDHhtyG6.js"),
1"./dist/locales/ts.ts":()=>import("./lang/ts-B-HXuFi1.js"),
1"./dist/locales/uk.ts":()=>import("./lang/uk-Cjqn7idk.js"),
1"./dist/locales/ur.ts":()=>import("./lang/ur-sYDrAWJS.js"),
1"./dist/locales/uz.ts":()=>import("./lang/uz-DAcoXttX.js"),
1"./dist/locales/ve.ts":()=>import("./lang/ve-CP1IzIj_.js"),
1"./dist/locales/vi.ts":()=>import("./lang/vi-QisCAyPR.js"),
1"./dist/locales/xh.ts":()=>import("./lang/xh-BJFioYbN.js"),
1"./dist/locales/zh.ts":()=>import("./lang/zh-sYDrAWJS.js"),
1"./dist/locales/zu.ts":()=>import("./lang/zu-fxEBlvKl.js")
1}),`./dist/locales/${e}.ts`,4)}),zd=e=>{if(!$l.includes(e))throw new Error(`Invalid language code: ${e}`);Ld(e),Et.set(e)};class as extends os{constructor(e,t={}){super(e,t)}getItem(e){return super.get()[e]}setItem(e,t){super.set({...super.get(),[e]:t})}}class je extends as{}const _o=new as({...ns}),ki=e=>`${_o.getItem("imgUrl")}${e}`,Ol=new as({...is}),Bt=new os(null),li=new os(!1),E=e=>(t,r)=>{void 0!==r?r.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},Ud={attribute:!0,type:String,converter:od,reflect:!1,hasChanged:xl},Fd=(e=Ud,t,r)=>{const{kind:o,metadata:n}=r;let i=globalThis.litPropertyMetadata.get(n);if(void 0===i&&globalThis.litPropertyMetadata.set(n,i=new Map),"setter"===o&&((e=Object.create(e)).wrapped=!0),i.set(r.name,e),"accessor"===o){const{name:o}=r;return{set(r){const n=t.get.call(this);t.set.call(this,r),this.requestUpdate(o,n,e)},init(t){return void 0!==t&&this.C(o,void 0,e,t),t}}}if("setter"===o){const{name:o}=r;return function(r){const n=this[o];t.call(this,r),this.requestUpdate(o,n,e)}}throw Error("Unsupported decorator location: "+o)};function g(e){return(t,r)=>"object"==typeof r?Fd(e,t,r):((e,t,r)=>{const o=t.hasOwnProperty(r);return t.constructor.createProperty(r,e),o?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}function b(e){return g({...e,state:!0,attribute:!1})}const jd=(e,t,r)=>(r.configurable=!0,r.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,r),r);function Dt(e,t){return(t,r,o)=>jd(t,r,{get(){return t=this,t.renderRoot?.querySelector(e)??null;var t}})}const Bd=e=>Dl(e)?"":Array.isArray(e)?e.map(e=>encodeURIComponent(e)).join(","):(e="object"==typeof e?JSON.stringify(e):e.toString(),encodeURIComponent(e)),xa=e=>Object.entries(e).reduce((e,[t,r])=>(e&&(e+="&"),e+=`${t}=${Bd(r)}`),""),Ci=(e,t)=>e.includes("?")?`${e}&${xa(t)}`:`${e}?${xa(t)}`,Dl=e=>null==e,Vd=(e,t,r)=>{const o=t.split("."),n=o.pop();let i={};return o.reduce((e,t)=>(e[t]||(e[t]={}),i=e[t],e[t]),e),i[n]=r,e},Hd=()=>Math.random().toString(36).substring(2,15),Gd=(e,t=500)=>{let r;return()=>{clearTimeout(r),r=setTimeout(()=>{e()},t)}},qd=(e=500)=>{let t=null;return{debounce:r=>{t&&clearTimeout(t),t=window.setTimeout(()=>{r(),t=null},e)},clear:()=>{t&&(clearTimeout(t),t=null)}}},Ml=(e,t,r)=>{if(0===e.length)return;const o=[r.join(","),...e.map(e=>e.join(","))].join("\n"),n=new Blob([o],{type:"text/csv;charset=utf-8;"}),i=document.createElement("a"),s=URL.createObjectURL(n),a=`${t}_${(new Date).toISOString().split("T")[0]}.csv`;i.setAttribute("href",s),i.setAttribute("download",a),i.style.visibility="hidden",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(s)},$a=e=>e.replace(/(\.\d*?[1-9])0+$|\.0+$/,"$1"),ls=e=>{e.requestSubmit()},Wd=e=>e%360+(e<0?360:0),Kd="https://openfoodfacts.slack.com",Yd="https://wiki.openfoodfacts.org/Folksonomy_Engine",Zd="https://wiki.openfoodfacts.org/Folksonomy/Property",Rl=(e,t)=>{const r=`${cs.get()}${e}`;return t?Ci(r,t):r};async function Nl(e,t){const r=Rl(`/api/v2/product/${e}/`,t),o=await fetch(r);if(!o.ok)throw new Error("Failed to fetch product data");return await o.json()}async function Xd(e){const t=Rl("/cgi/nutrients.pl",e),r=await fetch(t);if(!r.ok)throw new Error("Failed to fetch nutrients order");return await r.json()}const Ll="https://world.openfoodfacts.org",_a=new je({}),cs=An(Ll),rn=new je({}),zl=(e,t,r)=>{if(e.hasOwnProperty(r.id))return t;if(e[r.id]={index:t,displayInEditForm:r.display_in_edit_form},t++,r.nutrients)for(const o of r.nutrients)t=zl(e,t,o);return t},Qd=async e=>{const t=_a.getItem(e);if(t)return void await t;const r=Xd({cc:e});let o=0;_a.setItem(e,r);const n=await r,i={};return n.nutrients.forEach(e=>{o=zl(i,o,e)}),rn.setItem(e,i),i},Jd=(e,t)=>{const r=rn.getItem(e);return r?t.sort((e,t)=>(r[e]?.index??1/0)-(r[t]?.index??1/0)):t};var eh=Object.defineProperty,th=Object.getOwnPropertyDescriptor,er=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?th(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&eh(t,r,i),i};const Fo={"robotoff-configuration":{propertyName:"robotoffConfiguration",converter:e=>{const t=JSON.parse(e);return{...ns,...t}},fn:e=>{_o.set(e)}},"language-code":{propertyName:"languageCode",fn:e=>{zd(e)}},"country-code":{propertyName:"countryCode",fn:e=>{ss.set(e)}}
1,"assets-images-path":{propertyName:"assetsImagesPath",fn:e=>{Pl.set(e)}},"folksonomy-configuration":{propertyName:"folksonomyConfiguration",converter:e=>{const t=JSON.parse(e);return{...is,...t}},fn:e=>{Ol.set(e)}},"openfoodfacts-api-url":{propertyName:"openfoodfactsApiUrl",fn:e=>{cs.set(e)}}};let Tt=class extends S{constructor(){super(...arguments),this.robotoffConfiguration={...ns},this.languageCode=Al,this.assetsImagesPath=Il,this.folksonomyConfiguration={...is},this.openfoodfactsApiUrl=Ll}attributeChangedCallback(e,t,r){if(super.attributeChangedCallback(e,t,r),e in Fo){let t;const o=Fo[e],n=o.propertyName;t=Fo[e].converter?Fo[e].converter(r):this[n],o.fn.call(this,t)}}};er([g({type:Object,attribute:"robotoff-configuration",reflect:!0})],Tt.prototype,"robotoffConfiguration",2),er([g({type:String,attribute:"language-code",reflect:!0})],Tt.prototype,"languageCode",2),er([g({type:String,attribute:"country-code",reflect:!0})],Tt.prototype,"countryCode",2),er([g({type:String,attribute:"assets-images-path",reflect:!0})],Tt.prototype,"assetsImagesPath",2),er([g({type:Object,attribute:"folksonomy-configuration",reflect:!0})],Tt.prototype,"folksonomyConfiguration",2),er([g({type:String,attribute:"openfoodfacts-api-url",reflect:!0})],Tt.prototype,"openfoodfactsApiUrl",2),Tt=er([E("off-webcomponents-configuration")],Tt);var z=(e=>(e[e.ACCEPT_AND_ADD_DATA=2]="ACCEPT_AND_ADD_DATA",e[e.ACCEPT=1]="ACCEPT",e[e.REFUSE=0]="REFUSE",e[e.SKIP=-1]="SKIP",e))(z||{}),te=(e=>(e.CENTGRAMS="100g",e.SERVING="serving",e))(te||{}),Xe=(e=>(e.ingredient_spellcheck="ingredient_spellcheck",e.nutrient_extraction="nutrient_extraction",e.ingredient_detection="ingredient_detection",e))(Xe||{});const rh=/\{[^{}]+\}/g,oh=()=>"object"==typeof process&&Number.parseInt(process?.versions?.node?.substring(0,2))>=18&&process.versions.undici;function nh(){return Math.random().toString(36).slice(2,11)}function ds(e){let{baseUrl:t="",Request:r=globalThis.Request,fetch:o=globalThis.fetch,querySerializer:n,bodySerializer:i,headers:s,requestInitExt:a,...l}={...e};a=oh()?a:void 0,t=Sa(t);const c=[];async function d(e,d){const{baseUrl:h,fetch:p=o,Request:u=r,headers:g,params:m={},parseAs:f="json",querySerializer:b,bodySerializer:y=i??sh,body:v,...w}=d||{};let x=t;h&&(x=Sa(h)??t);let $="function"==typeof n?n:ka(n);b&&($="function"==typeof b?b:ka({..."object"==typeof n?n:{},...b}));const k=void 0===v?void 0:y(v,Ca(s,g,m.header)),C=Ca(void 0===k||k instanceof FormData?{}:{"Content-Type":"application/json"},s,g,m.header),S={redirect:"follow",...l,...w,body:k,headers:C};let _,E,T,A=new r(ah(e,{baseUrl:x,params:m,querySerializer:$}),S);for(const e in w)e in A||(A[e]=w[e]);if(c.length){_=nh(),E=Object.freeze({baseUrl:x,fetch:p,parseAs:f,querySerializer:$,bodySerializer:y});for(const t of c)if(t&&"object"==typeof t&&"function"==typeof t.onRequest){const o=await t.onRequest({request:A,schemaPath:e,params:m,options:E,id:_});if(o){if(!(o instanceof r)){if(o instanceof Response){T=o;break}throw new Error("onRequest: must return new Request() or Response() when modifying the request")}A=o}}}if(!T){try{T=await p(A,a)}catch(t){let r=t;if(c.length)for(let t=c.length-1;t>=0;t--){const o=c[t];if(o&&"object"==typeof o&&"function"==typeof o.onError){const t=await o.onError({request:A,error:r,schemaPath:e,params:m,options:E,id:_});if(t){if(t instanceof Response){r=void 0,T=t;break}if(t instanceof Error){r=t;continue}throw new Error("onError: must return new Response() or instance of Error")}}}if(r)throw r}if(c.length)for(let t=c.length-1;t>=0;t--){const r=c[t];if(r&&"object"==typeof r&&"function"==typeof r.onResponse){const t=await r.onResponse({request:A,response:T,schemaPath:e,params:m,options:E,id:_});if(t){if(!(t instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");T=t}}}}if(204===T.status||"HEAD"===A.method||"0"===T.headers.get("Content-Length"))return T.ok?{data:void 0,response:T}:{error:void 0,response:T};if(T.ok)return"stream"===f?{data:T.body,response:T}:{data:await T[f](),response:T};let D=await T.text();try{D=JSON.parse(D)}catch{}return{error:D,response:T}}return{request:(e,t,r)=>d(t,{...r,method:e.toUpperCase()}),GET:(e,t)=>d(e,{...t,method:"GET"}),PUT:(e,t)=>d(e,{...t,method:"PUT"}),POST:(e,t)=>d(e,{...t,method:"POST"}),DELETE:(e,t)=>d(e,{...t,method:"DELETE"}),OPTIONS:(e,t)=>d(e,{...t,method:"OPTIONS"}),HEAD:(e,t)=>d(e,{...t,method:"HEAD"}),PATCH:(e,t)=>d(e,{...t,method:"PATCH"}),TRACE:(e,t)=>d(e,{...t,method:"TRACE"}),use(...e){for(const t of e)if(t){if("object"!=typeof t||!("onRequest"in t||"onResponse"in t||"onError"in t))throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");c.push(t)}},eject(...e){for(const t of e){const e=c.indexOf(t);-1!==e&&c.splice(e,1)}}}}function In(e,t,r){if(null==t)return"";if("object"==typeof t)throw new Error("Deeply-nested arrays/objects arenât supported. Provide your own `querySerializer()` to handle these.");return`${e}=${!0===r?.allowReserved?t:encodeURIComponent(t)}`}function Ul(e,t,r){if(!t||"object"!=typeof t)return"";const o=[],n={simple:",",label:".",matrix:";"}[r.style]||"&";if("deepObject"!==r.style&&!1===r.explode){for(const e in t)o.push(e,!0===r.allowReserved?t[e]:encodeURIComponent(t[e]));const n=o.join(",");switch(r.style){case"form":return`${e}=${n}`;case"label":return`.${n}`;case"matrix":return`;${e}=${n}`;default:return n}}for(const n in t){const i="deepObject"===r.style?`${e}[${n}]`:n;o.push(In(i,t[n],r))}const i=o.join(n);return"label"===r.style||"matrix"===r.style?`${n}${i}`:i}function Fl(e,t,r){if(!Array.isArray(t))return"";if(!1===r.explode){const o={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[r.style]||",",n=(!0===r.allowReserved?t:t.map(e=>encodeURIComponent(e))).join(o);switch(r.style){case"simple":return n;case"label":return`.${n}`;case"matrix":return`;${e}=${n}`;default:return`${e}=${n}`}}const o={simple:",",label:".",matrix:";"}[r.style]||"&",n=[];for(const o of t)"simple"===r.style||"label"===r.style?n.push(!0===r.allowReserved?o:encodeURIComponent(o)):n.push(In(e,o,r));return"label"===r.style||"matrix"===r.style?`${o}${n.join(o)}`:n.join(o)}function ka(e){return function(t){const r=[];if(t&&"object"==typeof t)for(const o in t){const n=t[o];if(null!=n){if(Array.isArray(n)){if(0===n.length)continue;r.push(Fl(o,n,{style:"form",explode:!0,...e?.array,allowReserved:e?.allowReserved||!1}));continue}if("object"==typeof n){r.push(Ul(o,n,{style:"deepObject",explode:!0,...e?.object,allowReserved:e?.allowReserved||!1}));continue}r.push(In(o,n,e))}}return r.join("&")}}function ih(e,t){let r=e;for(const o of e.match(rh)??[]){let e=o.substring(1,o.length-1),n=!1,i="simple";if(e.endsWith("*")&&(n=!0,e=e.substring(0,e.length-1)),e.startsWith(".")?(i="label",e=e.substring(1)):e.startsWith(";")&&(i="matrix",e=e.substring(1)),!t||void 0===t[e]||null===t[e])continue;const s=t[e];Array.isArray(s)?r=r.replace(o,Fl(e,s,{style:i,explode:n})):r="object"!=typeof s?"matrix"!==i?r.replace(o,"label"===i?`.${encodeURIComponent(s)}`:encodeURIComponent(s)):r.replace(o,`;${In(e,s)}`):r.replace(o,Ul(e,s,{style:i,explode:n}))}return r}function sh(e,t){return e instanceof FormData?e:t&&"application/x-www-form-urlencoded"===(t.get instanceof Function?t.get("Content-Type")??t.get("content-type"):t["Content-Type"]??t["content-type"])?new URLSearchParams(e).toString():JSON.stringify(e)}function ah(e,t){let r=`${t.baseUrl}${e}`;t.params?.path&&(r=ih(r,t.params.path));let o=t.querySerializer(t.params.query??{});return o.startsWith("?")&&(o=o.substring(1)),o&&(r+=`?${o}`),r}function Ca(...e){const t=new Headers;for(const r of e){if(!r||"object"!=typeof r)continue;const e=r instanceof Headers?r.entries():Object.entries(r);for(const[r,o]of e)if(null===o)t.delete(r);else if(Array.isArray(o))for(const e of o)t.append(r,e);else void 0!==o&&t.set(r,o)}return t}function Sa(e){return e.endsWith("/")?e.substring(0,e.length-1):e}const Si="2.0.0-alpha.19",lh="https://static.openfoodfacts.org",Ei=`OpenFoodFacts - NodeJS ${Si}`;var Ye;!function(e){e.OFF="OFF",e.OBF="OBF",e.OPFF="OPFF",e.OPF="OPF"}(Ye||(Ye={}));const ch={[Ye.OFF]:"openfoodfacts.org",[Ye.OBF]:"openbeautyfacts.org",[Ye.OPFF]:"openpetfoodfacts.org",[Ye.OPF]:"openproductsfacts.org"},dh={[Ye.OFF]:"OpenFoodFacts",[Ye.OBF]:"OpenBeautyFacts",[Ye.OPFF]:"OpenPetFoodFacts",[Ye.OPF]:"OpenProductsFacts"},hh="https://robotoff.openfoodfacts.org/api/v1";function uh(e){const t=new URLSearchParams;for(const[r,o]of Object.entries(e))if(null!=o)switch(typeof o){case"string":t.append(r,o);break;case"boolean":case"number":case"bigint":t.append(r,String(o));break;case"object":t.append(r,JSON.stringify(o));break;default:throw new Error(`Cannot formBody-fy a ${typeof o}!`)}return t.toString()}class jl{constructor(e,t={baseUrl:hh}){this.fetch=e,this.raw=ds({fetch:this.fetch,baseUrl:t.baseUrl,headers:{"User-Agent":Ei}})}
1async annotate(e){return this.raw.POST("/insights/annotate",{body:e,headers:{"Content-Type":"application/x-www-form-urlencoded"},bodySerializer:uh})}questionsByProductCode(e,t){return this.raw.GET("/questions/{barcode}",{params:{path:{barcode:e},query:t}})}insightDetail(e){return this.raw.GET("/insights/detail/{insight_id}",{params:{path:{insight_id:e}}})}insights(e){return this.raw.GET("/insights",{params:{query:e}})}async loadLogo(e){return(await this.raw.GET("/images/logos/{logoId}",{params:{path:{logoId:e}}})).data}}const ph=e=>`${lh}/data/taxonomies/${e}.json`;function Ea(e){const t=new FormData,r=Object.entries(e??{});for(const[e,o]of r)null!=o&&t.append(e,o);return t}class gh{constructor(e,t){this.fetch=e,this.baseUrl=t.host,this.client=ds({fetch:this.fetch,baseUrl:this.baseUrl})}async getTaxoEntry(e,t){return await(await this.fetch(`${this.baseUrl}/api/v2/taxonomy?tagtype=${e}&tags=${t}`)).json()}async performOCR(e,t,r="google_cloud_vision"){return this.client.GET("/cgi/ingredients.pl",{params:{query:{code:e,id:t,ocr_engine:r,process_image:"1"}}})}async search(e){return this.client.GET("/api/v2/search",{params:{query:e}})}async getAttributeGroups(){return this.client.GET("/api/v2/attribute_groups")}async unselectImage(e,t){return this.client.POST("/cgi/product_image_unselect.pl",{body:{code:e,id:t}})}async getProductAttributes(e){var t,r;return(null===(r=null===(t=(await this.client.GET("/api/v2/product/{barcode}",{params:{path:{barcode:e},query:{fields:"product_name,code,attribute_groups_en"}}})).data)||void 0===t?void 0:t.product)||void 0===r?void 0:r.attribute_groups_en)||[]}async addOrEditProductV2(e,t){var r;const o=`${this.baseUrl}/cgi/product_jqm2.pl`,n=Object.keys(e.languages_codes||{}),i=n.reduce((t,r)=>{const o=fh(e,r);return null!=o&&(t[`product_name_${r}`]=o),t},{}),s=n.reduce((t,r)=>{const o=mh(e,r);return null!=o&&(t[`ingredients_text_${r}`]=o),t},{}),a=Ea(Object.assign(Object.assign({code:e.code,user_id:t?.username,password:t?.password,categories:e.categories||"",labels:e.labels||"",brands:e.brands||"",quantity:e.quantity||"",serving_size:e.serving_size||"",stores:e.stores||"",origins:e.origins||"",countries:e.countries||"",emb_codes:e.emb_codes||"",packaging:e.packaging||"",manufacturing_places:e.manufacturing_places||"",comment:null!==(r=e.comment)&&void 0!==r?r:"",product_name:e.product_name||"",ingredients_text:e.ingredients_text||""},i),s));return 200===(await this.fetch(o,{method:"POST",body:a,headers:{"User-Agent":Ei}})).status}async cropImage(e,t,r,o){return this.client.POST("/cgi/product_image_crop.pl",{body:{code:e,imgid:t,id:r,x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2,angle:o.angle,normalize:o.normalize?"true":"false",white_magic:o.white_magic?"true":"false",comment:o.comment,app_name:o.app_name,app_version:o.app_version,app_uuid:o.app_uuid,"User-Agent":o.user_agent}})}async uploadImage(e,t,r){return this.client.POST("/cgi/product_image_upload.pl",{body:{code:e,imagefield:r,[`imgupload_${r}`]:t,"User-Agent":Ei},bodySerializer:Ea})}async rotateImage(e,t,r,o){return await this.client.GET("/cgi/product_image_crop.pl",{params:{query:{code:e,id:t,imgid:r,angle:o}}})}async getProductV2(e){return this.client.GET("/api/v2/product/{barcode}",{params:{path:{barcode:e}}})}async getProductImages(e){var t,r;const o=null===(t=(await this.client.GET("/api/v2/product/{barcode}",{params:{query:{fields:"images"},path:{barcode:e}}})).data)||void 0===t?void 0:t.product;if(!o||!("images"in o))return null;const n=null!==(r=o.images)&&void 0!==r?r:{};return Object.keys(n)}}function fh(e,t){var r;return null!==(r=e[`product_name_${t}`])&&void 0!==r?r:e.product_name}function mh(e,t){var r;return null!==(r=e[`ingredients_text_${t}`])&&void 0!==r?r:e.ingredients_text}class bh{constructor(e,t){this.fetch=e,this.baseUrl=t.host,this.client=ds({fetch:this.fetch,baseUrl:this.baseUrl})}async uploadProductImage(e,t){return this.client.POST("/api/v3/product/{barcode}/images",{params:{path:{barcode:e}},body:Object.assign({},t)})}async deleteProductImage(e,t){return await this.client.DELETE("/api/v3/product/{barcode}/images/uploaded/{imgid}",{params:{path:{barcode:e,imgid:t}}})}async getProductV3(e,t){var r;const{error:o,data:n}=await this.client.GET("/api/v3/product/{barcode}",{params:{path:{barcode:e},query:Object.assign(Object.assign({},t),{fields:null===(r=t?.fields)||void 0===r?void 0:r.join(",")})}});return null!=o?{error:o,data:void 0}:{data:n,error:void 0}}}class vh{constructor(e,t={country:"world",language:"en"}){this.performOCR=(e,t,r)=>this.apiv2.performOCR(e,t,r),this.search=e=>this.apiv2.search(e),this.getAttributeGroups=()=>this.apiv2.getAttributeGroups(),this.getProductAttributes=e=>this.apiv2.getProductAttributes(e),this.getProductV3=(e,t)=>this.apiv3.getProductV3(e,t),this.addOrEditProductV2=(e,t)=>
1{var r,o;const n=null!==(r=t?.username)&&void 0!==r?r:this.defaultOptions.username,i=null!==(o=t?.password)&&void 0!==o?o:this.defaultOptions.password,s=null!=n&&null!=i?{username:n,password:i}:void 0;return this.apiv2.addOrEditProductV2(e,s)},this.uploadImage=(e,t,r)=>this.apiv2.uploadImage(e,t,r),this.cropImage=(e,t,r,o)=>this.apiv2.cropImage(e,t,r,o),this.rotateImage=(e,t,r,o)=>this.apiv2.rotateImage(e,t,r,o),this.unselectImage=(e,t)=>this.apiv2.unselectImage(e,t),this.deleteProductImage=(e,t)=>this.apiv3.deleteProductImage(e,t),this.uploadProductImage=(e,t)=>this.apiv3.uploadProductImage(e,t),this.getProductV2=e=>this.apiv2.getProductV2(e),this.getProductImages=e=>this.apiv2.getProductImages(e),this.validateOptions(t),this.backendType=t.type,this.baseUrl=this.createBaseUrl(t),this.customUserAgent=this.createUserAgent(),this.accessToken=t.accessToken,this.fetch=this.createFetchWrapper(e,t),this.defaultOptions={lang:t.language,country:t.country,username:void 0,password:void 0},this.apiv2=new gh(this.fetch,{host:this.baseUrl}),this.apiv3=new bh(this.fetch,{host:this.baseUrl}),this.robotoff=new jl(e)}validateOptions(e){if(e.host&&e.country||e.type&&e.country)throw new Error("You must provide either `host`, `type`, or `country`, not multiple.")}createBaseUrl(e){return null!=e.host?e.host:null!=e.type?`https://world.${ch[e.type]}`:`https://${e.country||"world"}.openfoodfacts.org`}createUserAgent(){return null!=this.backendType?`${dh[this.backendType]} - NodeJS ${Si}`:`OpenFoodFacts - NodeJS ${Si}`}validateAccessToken(e){if("string"!=typeof e)throw new Error("Access token must be a string.");if(0===e.length)throw new Error("Access token cannot be an empty string.");if(!/^[A-Za-z0-9-_.]+$/.test(e))throw new Error("Access token can only contain alphanumeric characters, dashes, underscores, and periods.");
1if(this.isTokenExpired(e))throw new Error("Access token is expired.")}createFetchWrapper(e,t){let r=this.createUserAgentFetch(e);return null!=t.accessToken&&(this.validateAccessToken(t.accessToken),r=this.createTokenAwareFetch(r,t)),r}createUserAgentFetch(e){return(t,r)=>{const o=new Headers(r?.headers);return o.set("User-Agent",this.customUserAgent),e(t,Object.assign(Object.assign({},r),{headers:o}))}}createTokenAwareFetch(e,t){return async(r,o)=>{const n=new Headers(o?.headers);if(null==this.accessToken)throw new Error("Access token was first specified and now is null.");return this.isTokenExpired(this.accessToken)&&(this.accessToken=await this.refreshAccessToken(t)),n.set("Authorization",`Bearer ${this.accessToken}`),e(r,Object.assign(Object.assign({},o),{headers:n}))}}async refreshAccessToken(e){if(null==e.onAccessTokenExpired)throw new Error("Access token expired and no handler provided to refresh it. You should provide `onAccessTokenExpired` option or wrap the fetch function to handle token expiration.");const t=await e.onAccessTokenExpired();if(null==t)throw new Error("onAccessTokenExpired handler did not return a new access token.");return t}isTokenExpired(e){const t=e.split(".");if(3!==t.length)throw new Error("Invalid JWT token format");const r=JSON.parse(Buffer.from(t[1],"base64").toString("utf-8"));return r.exp&&Date.now()>=1e3*r.exp}getBrand(e){return this.apiv2.getTaxoEntry("brands",e)}getLanguage(e){return this.apiv2.getTaxoEntry("languages",e)}getBrands(){return this.getTaxo("brands")}
1getLanguages(){return this.getTaxo("languages")}getLabels(){return this.getTaxo("labels")}getAdditives(){return this.getTaxo("additives")}getAllergens(){return this.getTaxo("allergens")}getCategories(){return this.getTaxo("categories")}getCountries(){return this.getTaxo("countries")}getIngredients(){return this.getTaxo("ingredients")}getPackagings(){return this.getTaxo("packaging")}getStates(){return this.getTaxo("states")}getStores(){return this.getTaxo("stores")}getNutrients(){return this.getTaxo("nutrients")}async getTaxo(e){return await(await this.fetch(ph(e))).json()}async getFacet(e,t){const r=new URLSearchParams;return t?.page&&r.set("page",`${t.page}`),t?.pageSize&&r.set("page_size",`${t.pageSize}`),t?.sortBy&&r.set("sort_by",t.sortBy),await(await this.fetch(`${this.baseUrl}/facets/${e}.json?${r}`)).json()}async getFacetValue(e,t,r){const o=new URLSearchParams;return r?.page&&o.set("page",`${r.page}`),r?.pageSize&&o.set("page_size",`${r.pageSize}`),r?.sortBy&&o.set("sort_by",r.sortBy),await(await this.fetch(new URL(`${this.baseUrl}/facets/${e}/${t}.json?${o}`))).json()}async getLoginStatus(){const e=await this.fetch(new URL("/cgi/auth.pl?body=1",this.baseUrl));if(e.ok)return await e.json()}}function jo(e){return new jl((t,r)=>e(t,{...r,credentials:"include"}),{baseUrl:_o.getItem("apiUrl")})}const Ti=e=>`${_o.getItem("apiUrl")}${e}`,wh=e=>{const t=Ti("/insights/annotate");return _o.getItem("dryRun")?void console.log("Annotated :",t,e):fetch(t,{method:"POST",body:e,headers:{"Content-Type":"application/x-www-form-urlencoded"},credentials:"include"})},rt={annotate:wh,annotateQuestion:(e,t)=>jo(fetch).annotate({insight_id:e,annotation:t}),annotateNutrients:(e,t,r)=>jo(fetch).annotate({insight_id:e,annotation:t,data:r}),annotateIngredientSpellcheck:(e,t,r)=>jo(fetch).annotate({insight_id:e,annotation:t,...r?{data:{annotation:r}}:{}}),annotateIngredientDetection:(e,t,r)=>jo(fetch).annotate({insight_id:e,annotation:t,...r?{data:r}:{}}),async questionsByProductCode(e,t={}){t.lang||(t.lang=Et.get());const r=Ti(`/questions/${e}`),o=Ci(r,t);return await(await fetch(o,{credentials:"include"})).json()},async insights(e={}){const t=Ti("/insights"),r=Ci(t,e);return await(await fetch(r,{credentials:"include"})).json()},async fetchRobotoffContributionMessageInsights(e={}){return(await this.insights({...e,annotated:!1,insight_types:[Xe.nutrient_extraction,Xe.ingredient_spellcheck,Xe.ingredient_detection]})).insights}},Bl=new je({}),so=new je({}),hs=new je({}),us=new je({}),yh=e=>new Pr(()=>so.get()[e].map(e=>Bl.getItem(e))),on=e=>new Pr(()=>hs.getItem(e)??0),xh=e=>new Pr(()=>so.getItem(e)?.length>0),Vl=e=>new Pr(()=>so.getItem(e)?.length??0),ci=e=>new Pr(()=>us.getItem(e)??!1),Hl=async(e,t={})=>{us.setItem(e,!1),hs.setItem(e,0),so.setItem(e,[]);const r=await rt.questionsByProductCode(e,t);return so.setItem(e,r.questions?.map(e=>e.insight_id)??[]),r.questions?.forEach(e=>{Bl.setItem(e.insight_id,e)}),r.questions??[]},$h=e=>on(e).get()===Vl(e).get()&&(us.setItem(e,!0),!0),_h=async(e,t)=>{await rt.annotateQuestion(e,t)},kh=e=>{const t=on(e).get();return hs.setItem(e,t+1),!$h(e)},Ch=Symbol();let tr=class{get taskComplete(){return this.t||(1===this.i?this.t=new Promise((e,t)=>{this.o=e,this.h=t}):3===this.i?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(e,t,r){this.p=0,this.i=0,(this._=e).addController(this);const o="object"==typeof t?t:{task:t,args:r};this.v=o.task,this.j=o.args,this.m=o.argsEqual??Sh,this.k=o.onComplete,this.A=o.onError,this.autoRun=o.autoRun??!0,"initialValue"in o&&(this.u=o.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){!0===this.autoRun&&this.S()}hostUpdated(){"afterUpdate"===this.autoRun&&this.S()}T(){if(void 0===this.j)return;const e=this.j();if(!Array.isArray(e))throw Error("The args function must return an array");return e}async S(){const e=this.T(),t=this.O;this.O=e,e===t||void 0===e||void 0!==t&&this.m(t,e)||await this.run(e)}async run(e){let t,r;e??=this.T(),this.O=e,1===this.i?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,"afterUpdate"===this.autoRun?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();const o=++this.p;
1this.q=new AbortController;let n=!1;try{t=await this.v(e,{signal:this.q.signal})}catch(e){n=!0,r=e}if(this.p===o){if(t===Ch)this.i=0;else{if(!1===n){try{this.k?.(t)}catch{}this.i=2,this.o?.(t)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=t,this.l=r}this._.requestUpdate()}}abort(e){1===this.i&&this.q?.abort(e)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(e){switch(this.i){case 0:return e.initial?.();case 1:return e.pending?.();case 2:return e.complete?.(this.value);case 3:return e.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}};const Sh=(e,t)=>e===t||e.length===t.length&&e.every((e,r)=>!xl(e,t[r]));var Eh=Object.getOwnPropertyDescriptor,Th=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Eh(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(i)||i);return i};let Ta=class extends S{render(){return c` <div>${d("Loading...")}</div> `}};Ta=Th([E("off-wc-loader"),H()],Ta);const Ah="#fafafa",Ih="rgba(0, 0, 0, 0.75)",Ph="#341100",Oh="#ede0db",Dh="#f0f0f0",Mh="#ccc",Rh="#0064c8",Nh="#8BC34A",Lh="#FF5252",zh="#ffcccc",Uh="#ccffcc",Ai="#199654",xr=Fe(Ah),ao=Fe(Ih),jt=Fe(Ph),Ii=Fe(Oh),ps=Fe(Dh),Ze=Fe(Mh),lo=Fe(Rh),jr=Fe(Nh),Bo=Fe(Lh),Pi=Fe(zh),nn=Fe(Uh),Fh=Fe(Ai);var B=(e=>(e.Chocolate="chocolate",e.Cappucino="cappucino",e.ChocolateOutline="chocolate-outline",e.White="white",e.LINK="link",e.Success="success",e.Danger="danger",e.LightRed="light-red",e.LightGreen="light-green",e))(B||{});const jh=()=>$` 2 .buttons-row { 3 display: flex; 4 gap: 0.5rem; 5 } 6 7 .buttons-row.can-wrap { 8 flex-wrap: wrap; 9 } 10 11 .button { 12 padding: 0.5rem 1rem; 13 border-radius: 0.25rem; 14 font-size: 1rem; 15 border-width: 1px; 16 border-style: solid; 17 cursor: pointer; 18 } 19 20 .button .pre-wrap { 21 white-space: pre-wrap; 22 } 23 .button.rounded { 24 border-radius: 50%; 25 } 26 27 .button:focus { 28 outline: 1px solid black; 29 outline-offset: 4px; 30 } 31 32 .button.small { 33 padding: 0.25rem 0.5rem; 34 font-size: 0.875rem; 35 } 36 37 .button.with-icon { 38 display: flex; 39 align-items: center; 40 gap: 0.5rem; 41 } 42 .button:disabled { 43 cursor: not-allowed; 44 opacity: 0.5; 45 } 46 `,Bh={chocolate:$` 47 .chocolate-button { 48 background-color: ${jt}; 49 border-color: ${jt}; 50 color: white; 51 } 52 53 .chocolate-button:hover { 54 background-color: white; 55 color: ${jt}; 56 } 57 `,cappucino:$` 58 .cappucino-button { 59 background-color: ${Ii}; 60 border-color: ${Ii}; 61 color: black; 62 } 63 64 .cappucino-button:hover { 65 background-color: white; 66 } 67 `,"chocolate-outline":$` 68 .chocolate-button-outline { 69 background-color: transparent; 70 border-color: ${jt}; 71 color: ${jt}; 72 } 73 74 .chocolate-button-outline:hover { 75 background-color: ${jt}; 76 color: white; 77 } 78 `,white:$` 79 .white-button { 80 background-color: white; 81 border-color: white; 82 color: black; 83 } 84 85 .white-button:hover { 86 border-color: black; 87 background-color: black; 88 color: white; 89 } 90 `,link:$` 91 .link-button { 92 text-decoration: none; 93 background-color: transparent; 94 border-color: transparent; 95 cursor: pointer; 96 color: black; 97 } 98 99 .link-button:hover { 100 text-decoration: underline; 101 } 102 `,success:$` 103 .success-button { 104 background-color: ${jr}; 105 border-color: ${jr}; 106 color: white; 107 } 108 .success-button:hover { 109 background-color: white; 110 color: ${jr}; 111 } 112 `,danger:$` 113 .danger-button { 114 background-color: ${Bo}; 115 border-color: ${Bo}; 116 color: white; 117 } 118 .danger-button:hover { 119 background-color: white; 120 color: ${Bo}; 121 } 122 `,"light-red":$` 123 .light-red-button { 124 background-color: ${Pi}; 125 border-color: ${Pi}; 126 color: black; 127 } 128 .light-red-button:hover { 129 background-color: white; 130 color: ${Bo}; 131 } 132 `,"light-green":$` 133 .light-green-button { 134 background-color: ${nn}; 135 border-color: ${nn}; 136 color: black; 137 } 138 .light-green-button:hover { 139 background-color: white; 140 color: ${jr}; 141 border-color: ${jr}; 142 } 143 `},Oe=e=>{const t=[jh()];
143return e.forEach(e=>{t.push(Bh[e])}),t};var Vh=Object.defineProperty,Hh=(e,t,r,o)=>{for(var n,i=void 0,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(t,r,i)||i);return i&&Vh(t,r,i),i};const Gh=750,Pn=(e,t)=>{class r extends e{constructor(){super(...arguments),this.loading=t}showLoading(e){this.startTime=Date.now(),this.loading=e}async hideLoading(){const e=Date.now()-(this.startTime??0),t=Math.max(0,Gh-e);await new Promise(e=>{setTimeout(()=>{this.loading=void 0,e(void 0)},t)})}}return Hh([b()],r.prototype,"loading"),r},Gl=$` 144 .relative { 145 position: relative; 146 } 147`,On=$` 148 .flex { 149 display: flex; 150 } 151 .flex-col { 152 flex-direction: column; 153 } 154 .justify-center { 155 justify-content: center; 156 } 157 .justify-between { 158 justify-content: space-between; 159 } 160 .justify-end { 161 justify-content: flex-end; 162 } 163 .flex-wrap { 164 flex-wrap: wrap; 165 } 166 .align-center { 167 align-items: center; 168 } 169 .gap-0_5 { 170 gap: 0.5rem; 171 } 172 .gap-1 { 173 gap: 1rem; 174 } 175`,qh=$` 176 .is-hidden { 177 display: none; 178 } 179`,Wh=$` 180 .full-width { 181 width: 100%; 182 } 183`;var Kh=Object.defineProperty,Yh=Object.getOwnPropertyDescriptor,gs=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Yh(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Kh(t,r,i),i};let co=class extends S{constructor(){super(...arguments),this.size="24px",this.color="currentColor"}render(){return c` 184 <svg 185 width=${this.size} 186 height=${this.size}
187 viewBox="0 0 16 16" 188 xmlns="http://www.w3.org/2000/svg" 189 fill="none" 190 class="spinner" 191 > 192 <g fill=${this.color} fill-rule="evenodd" clip-rule="evenodd"> 193 <path 194 d="M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8z" 195 opacity=".2" 196 /> 197 198 <path 199 d="M7.25.75A.75.75 0 018 0a8 8 0 018 8 .75.75 0 01-1.5 0A6.5 6.5 0 008 1.5a.75.75 0 01-.75-.75z" 200 /> 201 </g> 202 </svg> 203 `}};co.styles=$` 204 :host { 205 display: inline-flex; 206 } 207 208 .spinner { 209 animation: spin 1s linear infinite; 210 } 211 212 @keyframes spin { 213 from { 214 transform: rotate(0deg); 215 } 216 to { 217 transform: rotate(360deg); 218 } 219 } 220 `,gs([g({type:String})],co.prototype,"size",2),gs([g({type:String})],co.prototype,"color",2),co=gs([E("loading-spin")],co);var Zh=Object.defineProperty,Xh=Object.getOwnPropertyDescriptor,Or=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Xh(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Zh(t,r,i),i};let At=class extends S{constructor(){super(...arguments),this.label="",this.loading=!1,this.disabled=!1,this.cssClasses="",this.type="button"}render(){return c` 221 <button 222 type=${this.type} 223 class="${this.cssClasses}" 224 ?disabled=${this.disabled||this.loading} 225 ?loading=${this.loading} 226 > 227 ${this.loading?c`<loading-spin size="15px"></loading-spin>`:D} 228 <slot><span>${this.label}</span></slot> 229 </button> 230 `}};At.styles=[$` 231 :host { 232 display: inline-block; 233 } 234 button { 235 display: flex; 236 align-items: center; 237 justify-content: center; 238 width: 100%; 239 gap: 0.5rem; 240 } 241 `,...Oe(Object.values(B))],Or([g({type:String,reflect:!0})],At.prototype,"label",2),Or([g({type:Boolean,reflect:!0})],At.prototype,"loading",2),Or([g({type:Boolean,reflect:!0})],At.prototype,"disabled",2),Or([g({type:String,attribute:"css-classes"})],At.prototype,"cssClasses",2),Or([g({type:String})],At.prototype,"type",2),At=Or([E("loading-button")],At);var Qh=Object.getOwnPropertyDescriptor,Jh=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Qh(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(i)||i);return i};let Oi=class extends S{connectedCallback(){super.connectedCallback()}render(){return c` 242 <svg 243 width="800px" 244 height="800px"
245 viewBox="0 0 24 24" 246 fill="none" 247 xmlns="http://www.w3.org/2000/svg" 248 > 249 <path 250 d="M10 17C13.866 17 17 13.866 17 10C17 6.13401 13.866 3 10 3C6.13401 3 3 6.13401 3 10C3 13.866 6.13401 17 10 17Z" 251 stroke="#000000" 252 stroke-width="1.5" 253 stroke-linecap="round" 254 stroke-linejoin="round" 255 /> 256 <path 257 d="M20.9992 21L14.9492 14.95" 258 stroke="#000000" 259 stroke-width="1.5" 260 stroke-linecap="round" 261 stroke-linejoin="round" 262 /> 263 <path 264 d="M6 10H14" 265 stroke="#000000" 266 stroke-width="1.5" 267 stroke-linecap="round" 268 stroke-linejoin="round" 269 /> 270 <path 271 d="M10 6V14" 272 stroke="#000000" 273 stroke-width="1.5" 274 stroke-linecap="round" 275 stroke-linejoin="round" 276 /> 277 </svg> 278 `}};Oi.styles=$` 279 :host { 280 display: inline-block; 281 width: 24px; 282 height: 24px; 283 } 284 svg { 285 width: 100%; 286 height: 100%; 287 } 288 `,Oi=Jh([E("zoom-icon")],Oi);var eu=Object.getOwnPropertyDescriptor,tu=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?eu(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(i)||i);return i};let Di=class extends S{render(){return c` 289 <svg 290 width="800px" 291 height="800px"
292 viewBox="0 0 24 24" 293 fill="none" 294 xmlns="http://www.w3.org/2000/svg" 295 > 296 <path 297 d="M10 17C13.866 17 17 13.866 17 10C17 6.13401 13.866 3 10 3C6.13401 3 3 6.13401 3 10C3 13.866 6.13401 17 10 17Z" 298 stroke="#000000" 299 stroke-width="1.5" 300 stroke-linecap="round" 301 stroke-linejoin="round" 302 /> 303 <path 304 d="M20.9992 21L14.9492 14.95" 305 stroke="#000000" 306 stroke-width="1.5" 307 stroke-linecap="round" 308 stroke-linejoin="round" 309 /> 310 <path 311 d="M6 10H14" 312 stroke="#000000" 313 stroke-width="1.5" 314 stroke-linecap="round" 315 stroke-linejoin="round" 316 /> 317 </svg> 318 `}};Di.styles=$` 319 :host { 320 display: inline-block; 321 width: 24px; 322 height: 24px; 323 } 324 svg { 325 width: 100%; 326 height: 100%; 327 } 328 `,Di=tu([E("unzoom-icon")],Di);var ru=Object.defineProperty,ou=Object.getOwnPropertyDescriptor,ql=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?ou(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&ru(t,r,i),i};let sn=class extends S{constructor(){super(...arguments),this.zoomed=!1}render(){return c` 329 <button title=${this.zoomed?d("Unzoom"):d("Zoom")}> 330 ${this.zoomed?c`<unzoom-icon></unzoom-icon>`:c`<zoom-icon></zoom-icon>`} 331 </button> 332 `}};sn.styles=$` 333 :host { 334 display: inline-block; 335 } 336 button { 337 display: flex; 338 align-items: center; 339 justify-content: center; 340 background-color: white; 341 border: none; 342 border-radius: 50%; 343 width: 26px; 344 height: 26px; 345 cursor: pointer; 346 } 347 button:hover { 348 background-color: ${ps}; 349 } 350 `,ql([g({type:Boolean})],sn.prototype,"zoomed",2),sn=ql([E("zoom-unzoom-button"),H()],sn);const Wl="important",nu=" !"+Wl,_r=xo(class extends $o{constructor(e){if(super(e),e.type!==Tn.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,r)=>{const o=e[r];return null==o?t:t+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${o};`},"")}update(e,[t]){const{style:r}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?r.removeProperty(e):r[e]=null);for(const e in t){const o=t[e];if(null!=o){this.ft.add(e);const t="string"==typeof o&&o.endsWith(nu);e.includes("-")||t?r.setProperty(e,t?o.slice(0,-11):o,t?Wl:""):r[e]=o}}return es}});var iu=Object.getOwnPropertyDescriptor,su=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?iu(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(i)||i);return i};let Mi=class extends S{render(){return c` 351 <svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"> 352 <path 353 d="M7.11 8.53 5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47zM6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47zm1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93z" 354 ></path> 355 </svg> 356 `}};Mi.styles=$` 357 :host { 358 display: inline-block; 359 width: 24px; 360 height: 24px; 361 } 362 svg { 363 width: 100%; 364 height: 100%; 365 } 366 `,Mi=su([E("rotate-left-icon")],Mi);var au=Object.getOwnPropertyDescriptor,lu=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?au(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(i)||i);return i};let Ri=class extends S{render(){return c` 367 <svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"> 368 <path 369 d="M15.55 5.55 11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45zM19.93 11c-.17-1.39-.72-2.73-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47h2.02zM13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03zm3.89-2.42 1.42 1.41c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.48z" 370 ></path> 371 </svg> 372 `}};Ri.styles=$` 373 :host { 374 display: inline-block; 375 width: 24px; 376 height: 24px; 377 } 378 svg { 379 width: 100%; 380 height: 100%; 381 } 382 `,Ri=lu([E("rotate-right-icon")],Ri);var Dn=(e=>(e[e.XS=425]="XS",e[e.SM=768]="SM",e[e.MD=1024]="MD",e[e.LG=1216]="LG",e[e.XL=1408]="XL",e))(Dn||{});const Aa=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk|1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|ch\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
382sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,Ni=()=>{const e=navigator.userAgent||navigator.vendor||window.opera;return Aa.test(e)||Aa.test(e.substr(0,4))},Mn=typeof window<"u"&&typeof window.document<"u",He=Mn?window:{},fs=!!Mn&&"ontouchstart"in He.document.documentElement,ms=!!Mn&&"PointerEvent"in He,Dr="cropper",Rn=`${Dr}-canvas`,cu=`${Dr}-crosshair`,du=`${Dr}-handle`,bs=`${Dr}-image`,Vt=`${Dr}-selection`,hu=`${Dr}-shade`,an="select",Kl="move",kr="scale",Li="rotate",ln="transform",_t="none",Ia="n-resize",Pa="e-resize",Oa="s-resize",Da="w-resize",Br="ne-resize",Vr="nw-resize",Hr="se-resize",Gr="sw-resize",uu="action",pu=fs?"touchend touchcancel":"mouseup",gu=fs?"touchmove":"mousemove",fu=fs?"touchstart":"mousedown",Ma=ms?"pointerdown":fu,Ra=ms?"pointermove":gu,Na=ms?"pointerup pointercancel":pu,La="error",za="keydown",Vo="load",Ua="wheel",Cr="action",Gt="actionend",mu="actionmove",qt="actionstart",mr="change",bu="transform";function vu(e){return"string"==typeof e}const Yl=Number.isNaN||He.isNaN;function R(e){return"number"==typeof e&&!Yl(e)}function Pe(e){return R(e)&&e>0&&e<1/0}function wu(e){return typeof e>"u"}function Zl(e){return"object"==typeof e&&null!==e}const{hasOwnProperty:yu}=Object.prototype;function cn(e){if(!Zl(e))return!1;try{const{constructor:t}=e,{prototype:r}=t;return t&&r&&yu.call(r,"isPrototypeOf")}catch{return!1}}function vs(e){return"function"==typeof e}function xu(e){return"object"==typeof e&&null!==e&&1===e.nodeType}const $u=/([a-z\d])([A-Z])/g;function Fa(e){return String(e).replace($u,"$1-$2").toLowerCase()}const _u=/-[A-z\d]/g;function ja(e){return e.replace(_u,e=>e.slice(1).toUpperCase())}const Xl=/\s\s*/;function pe(e,t,r,o){t.trim().split(Xl).forEach(t=>{e.removeEventListener(t,r,o)})}function ve(e,t,r,o){t.trim().split(Xl).forEach(t=>{e.addEventListener(t,r,o)})}function Ba(e,t,r,o){ve(e,t,r,Object.assign(Object.assign({},o),{once:!0}))}const ku={bubbles:!0,cancelable:!0,composed:!0};function Cu(e,t,r,o){return e.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign(Object.assign({},ku),{detail:r}),o)))}const Va=Promise.resolve();function Su(e,t){return t?Va.then(e?t.bind(e):t):Va}function Ha(e){const{documentElement:t}=e.ownerDocument,r=e.getBoundingClientRect();return{left:r.left+(He.pageXOffset-t.clientLeft),top:r.top+(He.pageYOffset-t.clientTop)}}const Eu=/deg|g?rad|turn$/i;function di(e){const t=parseFloat(e)||0;if(0!==t){const[r="rad"]=String(e).match(Eu)||[];switch(r.toLowerCase()){case"deg":return t/360*(2*Math.PI);case"grad":return t/400*(2*Math.PI);case"turn":return t*(2*Math.PI)}}return t}const Ga="contain",Tu="cover";function Zo(e,t=Ga){const{aspectRatio:r}=e;let{width:o,height:n}=e;const i=Pe(o),s=Pe(n);if(i&&s){const e=n*r;t===Ga&&e>o||t===Tu&&e<o?n=o/r:o=n*r}else i?n=o/r:s&&(o=n*r);return{width:o,height:n}}function Ql(e,...t){if(0===t.length)return e;const[r,o,n,i,s,a]=e,[l,c,d,h,p,u]=t[0];return Ql(e=[r*l+n*c,o*l+i*c,r*d+n*h,o*d+i*h,r*p+n*u+s,o*p+i*u+a],...t.slice(1))}var Au=":host([hidden]){display:none!important}";const Iu=/left|top|width|height/i,qa="open",Ho=new WeakMap,Go=new WeakMap,Wa=new Map,Ka=He.document&&Array.isArray(He.document.adoptedStyleSheets)&&"replaceSync"in He.CSSStyleSheet.prototype;class rr extends HTMLElement{get $sharedStyle(){return`${this.themeColor?`:host{--theme-color: ${this.themeColor};}`:""}${Au}`}constructor(){var e,t;super(),this.shadowRootMode=qa,this.slottable=!0;const r=null===(t=null===(e=Object.getPrototypeOf(this))||void 0===e?void 0:e.constructor)||void 0===t?void 0:t.$name;r&&Wa.set(r,this.tagName.toLowerCase())}static get observedAttributes(){return["shadow-root-mode","slottable","theme-color"]}attributeChangedCallback(e,t,r){if(Object.is(r,t))return;const o=ja(e);let n=r;switch(typeof this[o]){case"boolean":n=null!==r&&"false"!==r;break;case"number":n=Number(r)}if(this[o]=n,"theme-color"===e){const e=Go.get(this),t=this.$sharedStyle;e&&t&&(Ka?e.replaceSync(t):e.textContent=t)}}$propertyChangedCallback(e,t,r){if(!Object.is(r,t))switch(e=Fa(e),typeof r){case"boolean":!0===r?this.hasAttribute(e)||this.setAttribute(e,""):this.removeAttribute(e);break;
382case"number":r=Yl(r)?"":String(r);default:r?this.getAttribute(e)!==r&&this.setAttribute(e,r):this.removeAttribute(e)}}connectedCallback(){Object.getPrototypeOf(this).constructor.observedAttributes.forEach(e=>{const t=ja(e);let r=this[t];wu(r)||this.$propertyChangedCallback(t,void 0,r),Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get:()=>r,set(e){const o=r;r=e,this.$propertyChangedCallback(t,o,e)}})});const e=this.attachShadow({mode:this.shadowRootMode||qa});if(this.shadowRoot||Ho.set(this,e),Go.set(this,this.$addStyles(this.$sharedStyle)),this.$style&&this.$addStyles(this.$style),this.$template){const t=document.createElement("template");t.innerHTML=this.$template,e.appendChild(t.content)}if(this.slottable){const t=document.createElement("slot");e.appendChild(t)}}disconnectedCallback(){Go.has(this)&&Go.delete(this),Ho.has(this)&&Ho.delete(this)}$getTagNameOf(e){var t;return null!==(t=Wa.get(e))&&void 0!==t?t:e}$setStyles(e){return Object.keys(e).forEach(t=>{let r=e[t];R(r)&&(r=0!==r&&Iu.test(t)?`${r}px`:String(r)),this.style[t]=r}),this}$getShadowRoot(){return this.shadowRoot||Ho.get(this)}$addStyles(e){let t;const r=this.$getShadowRoot();return Ka?(t=new CSSStyleSheet,t.replaceSync(e),r.adoptedStyleSheets=r.adoptedStyleSheets.concat(t)):(t=document.createElement("style"),t.textContent=e,r.appendChild(t)),t}$emit(e,t,r){return Cu(this,e,t,r)}$nextTick(e){return Su(this,e)}static $define(e,t){Zl(e)&&(t=e,e=""),e||(e=this.$name||this.name),e=Fa(e),Mn&&He.customElements&&!He.customElements.get(e)&&customElements.define(e,this,t)}}rr.$version="2.0.0";var Pu=':host{display:block;min-height:100px;
382min-width:200px;overflow:hidden;position:relative;touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([background]){background-color:#fff;background-image:repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc),repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc);background-image:repeating-conic-gradient(#ccc 0 25%,#fff 0 50%);background-position:0 0,.5rem .5rem;background-size:1rem 1rem}:host([disabled]){pointer-events:none}:host([disabled]):after{bottom:0;content:"";cursor:not-allowed;display:block;left:0;pointer-events:none;position:absolute;right:0;top:0}';class ws extends rr{constructor(){super(...arguments),this.$onPointerDown=null,this.$onPointerMove=null,this.$onPointerUp=null,this.$onWheel=null,this.$wheeling=!1,this.$pointers=new Map,this.$style=Pu,this.$action=_t,this.background=!1,this.disabled=!1,this.scaleStep=.1,this.themeColor="#39f"}static get observedAttributes(){return super.observedAttributes.concat(["background","disabled","scale-step"])}connectedCallback(){super.connectedCallback(),this.disabled||this.$bind()}disconnectedCallback(){this.disabled||this.$unbind(),super.disconnectedCallback()}$propertyChangedCallback(e,t,r){Object.is(r,t)||(super.$propertyChangedCallback(e,t,r),"disabled"===e&&(r?this.$unbind():this.$bind()))}$bind(){this.$onPointerDown||(this.$onPointerDown=this.$handlePointerDown.bind(this),ve(this,Ma,this.$onPointerDown)),this.$onPointerMove||(this.$onPointerMove=this.$handlePointerMove.bind(this),ve(this.ownerDocument,Ra,this.$onPointerMove)),this.$onPointerUp||(this.$onPointerUp=this.$handlePointerUp.bind(this),ve(this.ownerDocument,Na,this.$onPointerUp)),this.$onWheel||(this.$onWheel=this.$handleWheel.bind(this),ve(this,Ua,this.$onWheel,{passive:!1,capture:!0}))}$unbind(){this.$onPointerDown&&(pe(this,Ma,this.$onPointerDown),this.$onPointerDown=null),this.$onPointerMove&&(pe(this.ownerDocument,Ra,this.$onPointerMove),this.$onPointerMove=null),this.$onPointerUp&&(pe(this.ownerDocument,Na,this.$onPointerUp),this.$onPointerUp=null),this.$onWheel&&(pe(this,Ua,this.$onWheel,{capture:!0}),this.$onWheel=null)}$handlePointerDown(e){const{buttons:t,button:r,type:o}=e;if(this.disabled||("pointerdown"===o&&"mouse"===e.pointerType||"mousedown"===o)&&(R(t)&&1!==t||R(r)&&0!==r||e.ctrlKey))return;const{$pointers:n}=this;let i="";if(e.changedTouches)Array.from(e.changedTouches).forEach(({identifier:e,pageX:t,pageY:r})=>{n.set(e,{startX:t,startY:r,endX:t,endY:r})});else{const{pointerId:t=0,pageX:r,pageY:o}=e;n.set(t,{startX:r,startY:o,endX:r,endY:o})}n.size>1?i=ln:xu(e.target)&&(i=e.target.action||e.target.getAttribute(uu)||""),!1!==this.$emit(qt,{action:i,relatedEvent:e})&&(e.preventDefault(),this.$action=i,this.style.willChange="transform")}$handlePointerMove(e){const{$action:t,$pointers:r}=this;if(this.disabled||t===_t||0===r.size||!1===this.$emit(mu,{action:t,relatedEvent:e}))return;if(e.preventDefault(),e.changedTouches)Array.from(e.changedTouches).forEach(({identifier:e,pageX:t,pageY:o})=>{const n=r.get(e);n&&Object.assign(n,{endX:t,endY:o})});else{const{pointerId:t=0,pageX:o,pageY:n}=e,i=r.get(t);i&&Object.assign(i,{endX:o,endY:n})}const o={action:t,relatedEvent:e};if(t===ln){const t=new Map(r);let n=0,i=0,s=0,a=0,l=e.pageX,c=e.pageY;r.forEach((e,r)=>{t.delete(r),t.forEach(t=>{let r=t.startX-e.startX,o=t.startY-e.startY,d=t.endX-e.endX,h=t.endY-e.endY,p=0,u=0,g=0,m=0;if(0===r?o<0?g=2*Math.PI:o>0&&(g=Math.PI):r>0?g=Math.PI/2+Math.atan(o/r):r<0&&(g=1.5*Math.PI+Math.atan(o/r)),0===d?h<0?m=2*Math.PI:h>0&&(m=Math.PI):d>0?m=Math.PI/2+Math.atan(h/d):d<0&&(m=1.5*Math.PI+Math.atan(h/d)),m>0||g>0){const r=m-g,o=Math.abs(r);o>n&&(n=o,s=r,l=(e.startX+t.startX)/2,c=(e.startY+t.startY)/2)}if(r=Math.abs(r),o=Math.abs(o),d=Math.abs(d),h=Math.abs(h),r>0&&o>0?p=Math.sqrt(r*r+o*o):r>0?p=r:o>0&&(p=o),d>0&&h>0?u=Math.sqrt(d*d+h*h):d>0?u=d:h>0&&(u=h),p>0&&u>0){const r=(u-p)/p,o=Math.abs(r);o>i&&(i=o,a=r,l=(e.startX+t.startX)/2,c=(e.startY+t.startY)/2)}})});const d=n>0,h=i>0;d&&h?(o.rotate=s,o.scale=a,o.centerX=l,o.centerY=c):d?(o.action=Li,o.rotate=s,o.centerX=l,o.centerY=c):h?(o.action=kr,o.scale=a,o.centerX=l,o.centerY=c):o.action=_t}else{const[e]=Array.from(r.values());Object.assign(o,e)}
382r.forEach(e=>{e.startX=e.endX,e.startY=e.endY}),o.action!==_t&&this.$emit(Cr,o,{cancelable:!1})}$handlePointerUp(e){const{$action:t,$pointers:r}=this;if(!this.disabled&&t!==_t&&!1!==this.$emit(Gt,{action:t,relatedEvent:e})){if(e.preventDefault(),e.changedTouches)Array.from(e.changedTouches).forEach(({identifier:e})=>{r.delete(e)});else{const{pointerId:t=0}=e;r.delete(t)}0===r.size&&(this.style.willChange="",this.$action=_t)}}$handleWheel(e){if(this.disabled||(e.preventDefault(),this.$wheeling))return;this.$wheeling=!0,setTimeout(()=>{this.$wheeling=!1},50);const t=(e.deltaY>0?-1:1)*this.scaleStep;this.$emit(Cr,{action:kr,scale:t,relatedEvent:e},{cancelable:!1})}$setAction(e){return vu(e)&&(this.$action=e),this}$toCanvas(e){return new Promise((t,r)=>{if(!this.isConnected)return void r(new Error("The current element is not connected to the DOM."));const o=document.createElement("canvas");let n=this.offsetWidth,i=this.offsetHeight,s=1;cn(e)&&(Pe(e.width)||Pe(e.height))&&(({width:n,height:i}=Zo({aspectRatio:n/i,width:e.width,height:e.height})),s=n/this.offsetWidth),o.width=n,o.height=i;const a=this.querySelector(this.$getTagNameOf(bs));a?a.$ready().then(r=>{const l=o.getContext("2d");if(l){const[t,c,d,h,p,u]=a.$getTransform();let g=p,m=u,f=r.naturalWidth,b=r.naturalHeight;1!==s&&(g*=s,m*=s,f*=s,b*=s);const y=f/2,v=b/2;l.fillStyle="transparent",l.fillRect(0,0,n,i),cn(e)&&vs(e.beforeDraw)&&e.beforeDraw.call(this,l,o),l.save(),l.translate(y,v),l.transform(t,c,d,h,g,m),l.translate(-y,-v),l.drawImage(r,0,0,f,b),l.restore()}t(o)}).catch(r):t(o)})}}ws.$name=Rn,ws.$version="2.0.0";var Ou=":host{display:inline-block}img{display:block;height:100%;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}";const Ya=new WeakMap,Za=["alt","crossorigin","decoding","importance","loading","referrerpolicy","sizes","src","srcset"];class ys extends rr{constructor(){super(...arguments),this.$matrix=[1,0,0,1,0,0],this.$onLoad=null,this.$onCanvasAction=null,this.$onCanvasActionEnd=null,this.$onCanvasActionStart=null,this.$actionStartTarget=null,this.$style=Ou,this.$image=new Image,this.initialCenterSize="contain",this.rotatable=!1,this.scalable=!1,this.skewable=!1,this.slottable=!1,this.translatable=!1}set $canvas(e){Ya.set(this,e)}get $canvas(){return Ya.get(this)}static get observedAttributes(){return super.observedAttributes.concat(Za,["initial-center-size","rotatable","scalable","skewable","translatable"])}attributeChangedCallback(e,t,r){Object.is(r,t)||(super.attributeChangedCallback(e,t,r),Za.includes(e)&&this.$image.setAttribute(e,r))}$propertyChangedCallback(e,t,r){Object.is(r,t)||(super.$propertyChangedCallback(e,t,r),"initialCenterSize"===e&&this.$nextTick(()=>{this.$center(r)}))}connectedCallback(){super.connectedCallback();const{$image:e}=this,t=this.closest(this.$getTagNameOf(Rn));t&&(this.$canvas=t,this.$setStyles({display:"block",position:"absolute"}),this.$onCanvasActionStart=e=>{var t,r;this.$actionStartTarget=null===(r=null===(t=e.detail)||void 0===t?void 0:t.relatedEvent)||void 0===r?void 0:r.target},this.$onCanvasActionEnd=()=>{this.$actionStartTarget=null},this.$onCanvasAction=this.$handleAction.bind(this),ve(t,qt,this.$onCanvasActionStart),ve(t,Gt,this.$onCanvasActionEnd),ve(t,Cr,this.$onCanvasAction)),this.$onLoad=this.$handleLoad.bind(this),ve(e,Vo,this.$onLoad),this.$getShadowRoot().appendChild(e)}disconnectedCallback(){const{$image:e,$canvas:t}=this;t&&(this.$onCanvasActionStart&&(pe(t,qt,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(pe(t,Gt,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(pe(t,Cr,this.$onCanvasAction),this.$onCanvasAction=null)),e&&this.$onLoad&&(pe(e,Vo,this.$onLoad),this.$onLoad=null),this.$getShadowRoot().removeChild(e),super.disconnectedCallback()}$handleLoad(){const{$image:e}=this;this.$setStyles({width:e.naturalWidth,height:e.naturalHeight}),this.$canvas&&this.$center(this.initialCenterSize)}$handleAction(e){if(this.hidden||!(this.rotatable||this.scalable||this.translatable))return;const{$canvas:t}=this,{detail:r}=e;if(r){const{relatedEvent:e}=r;let{action:o}=r;switch(o===ln&&(!this.rotatable||!this.scalable)&&(o=this.rotatable?Li:this.scalable?kr:_t),o){case Kl:if(this.translatable){let o=null;e&&(o=e.target.closest(this.$getTagNameOf(Vt))),o||(o=t.querySelector(this.$getTagNameOf(Vt))),o&&o.multiple&&!o.active&&(o=t.querySelector(`${this.$getTagNameOf(Vt)}[active]`)),(!o||o.hidden||!o.movable||o.dynamic||!this.$actionStartTarget||!o.contains(this.$actionStartTarget))&&this.$move(r.endX-r.startX,r.endY-r.startY)}break;case Li:if(this.rotatable)if(e){const{x:t,y:o}=this.getBoundingClientRect();this.$rotate(r.rotate,e.clientX-t,e.clientY-o)}else this.$rotate(r.rotate);break;case kr:if(this.scalable)if(e){const t=e.target.closest(this.$getTagNameOf(Vt));if(!t||!t.zoomable||t.zoomable&&t.dynamic){const{x:t,y:o}=this.getBoundingClientRect();this.$zoom(r.scale,e.clientX-t,e.clientY-o)}}else this.$zoom(r.scale);break;case ln:if(this.rotatable&&this.scalable){const{rotate:t}=r;let{scale:o}=r;o<0?o=1/(1-o):o+=1;const n=Math.cos(t),i=Math.sin(t),[s,a,l,c]=[n*o,i*o,-i*o,n*o];if(e){const t=this.getBoundingClientRect(),r=e.clientX-t.x,o=e.clientY-t.y,[n,i,d,h]=this.$matrix,p=r-t.width/2,u=o-t.height/2,g=(p*h-d*u)/(n*h-d*i),m=(u*n-i*p)/(n*h-d*i);this.$transform(s,a,l,c,g*(1-s)+m*l,m*(1-c)+g*a)}else this.$transform(s,a,l,c,0,0)}}}}$ready(e){const{$image:t}=this,r=new Promise((e,r)=>{const o=new Error("Failed to load the image source");
382if(t.complete)t.naturalWidth>0&&t.naturalHeight>0?e(t):r(o);else{const n=()=>{pe(t,La,i),e(t)},i=()=>{pe(t,Vo,n),r(o)};Ba(t,Vo,n),Ba(t,La,i)}});return vs(e)&&r.then(t=>(e(t),t)),r}$center(e){const{parentElement:t}=this;if(!t)return this;const r=t.getBoundingClientRect(),o=r.width,n=r.height,{x:i,y:s,width:a,height:l}=this.getBoundingClientRect(),c=i+a/2,d=s+l/2,h=r.x+o/2,p=r.y+n/2;if(this.$move(h-c,p-d),e&&(a!==o||l!==n)){const t=o/a,r=n/l;switch(e){case"cover":this.$scale(Math.max(t,r));break;case"contain":this.$scale(Math.min(t,r))}}return this}$move(e,t=e){if(this.translatable&&R(e)&&R(t)){const[r,o,n,i]=this.$matrix,s=(e*i-n*t)/(r*i-n*o),a=(t*r-o*e)/(r*i-n*o);this.$translate(s,a)}return this}$moveTo(e,t=e){if(this.translatable&&R(e)&&R(t)){const[r,o,n,i]=this.$matrix,s=(e*i-n*t)/(r*i-n*o),a=(t*r-o*e)/(r*i-n*o);this.$setTransform(r,o,n,i,s,a)}return this}$rotate(e,t,r){if(this.rotatable){const o=di(e),n=Math.cos(o),i=Math.sin(o),[s,a,l,c]=[n,i,-i,n];if(R(t)&&R(r)){const[e,o,n,i]=this.$matrix,{width:d,height:h}=this.getBoundingClientRect(),p=t-d/2,u=r-h/2,g=(p*i-n*u)/(e*i-n*o),m=(u*e-o*p)/(e*i-n*o);this.$transform(s,a,l,c,g*(1-s)-m*l,m*(1-c)-g*a)}else this.$transform(s,a,l,c,0,0)}return this}$zoom(e,t,r){if(!this.scalable||0===e)return this;if(e<0?e=1/(1-e):e+=1,R(t)&&R(r)){const[o,n,i,s]=this.$matrix,{width:a,height:l}=this.getBoundingClientRect(),c=t-a/2,d=r-l/2,h=(c*s-i*d)/(o*s-i*n),p=(d*o-n*c)/(o*s-i*n);this.$transform(e,0,0,e,h*(1-e),p*(1-e))}else this.$scale(e);return this}$scale(e,t=e){return this.scalable&&this.$transform(e,0,0,t,0,0),this}$skew(e,t=0){if(this.skewable){const r=di(e),o=di(t);this.$transform(1,Math.tan(o),Math.tan(r),1,0,0)}return this}$translate(e,t=e){return this.translatable&&R(e)&&R(t)&&this.$transform(1,0,0,1,e,t),this}$transform(e,t,r,o,n,i){return R(e)&&R(t)&&R(r)&&R(o)&&R(n)&&R(i)?this.$setTransform(Ql(this.$matrix,[e,t,r,o,n,i])):this}$setTransform(e,t,r,o,n,i){if((this.rotatable||this.scalable||this.skewable||this.translatable)&&(Array.isArray(e)&&([e,t,r,o,n,i]=e),R(e)&&R(t)&&R(r)&&R(o)&&R(n)&&R(i))){const s=[...this.$matrix],a=[e,t,r,o,n,i];if(!1===this.$emit(bu,{matrix:a,oldMatrix:s}))return this;this.$matrix=a,this.style.transform=`matrix(${a.join(", ")})`}return this}$getTransform(){return this.$matrix.slice()}$resetTransform(){return this.$setTransform([1,0,0,1,0,0])}}ys.$name=bs,ys.$version="2.0.0";var Du=':host{background-color:var(--theme-color);display:block}:host([action=move]),:host([action=select]){height:100%;left:0;position:absolute;top:0;width:100%}:host([action=move]){cursor:move}:host([action=select]){cursor:crosshair}:host([action$=-resize]){background-color:transparent;height:15px;position:absolute;width:15px}:host([action$=-resize]):after{background-color:var(--theme-color);content:"";display:block;height:5px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:5px}:host([action=n-resize]),:host([action=s-resize]){cursor:ns-resize;left:50%;transform:translateX(-50%);width:100%}:host([action=n-resize]){top:-8px}:host([action=s-resize]){bottom:-8px}:host([action=e-resize]),:host([action=w-resize]){cursor:ew-resize;height:100%;top:50%;transform:translateY(-50%)}:host([action=e-resize]){right:-8px}:host([action=w-resize]){left:-8px}:host([action=ne-resize]){cursor:nesw-resize;right:-8px;top:-8px}:host([action=nw-resize]){cursor:nwse-resize;left:-8px;top:-8px}:host([action=se-resize]){bottom:-8px;cursor:nwse-resize;right:-8px}:host([action=se-resize]):after{height:15px;width:15px}@media (pointer:coarse){:host([action=se-resize]):after{height:10px;width:10px}}@media (pointer:fine){:host([action=se-resize]):after{height:5px;width:5px}}:host([action=sw-resize]){bottom:-8px;cursor:nesw-resize;left:-8px}:host([plain]){background-color:transparent}';class xs extends rr{constructor(){super(...arguments),this.$onCanvasCropEnd=null,this.$onCanvasCropStart=null,this.$style=Du,this.action=_t,this.plain=!1,this.slottable=!1,this.themeColor="rgba(51, 153, 255, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["action","plain"])}}xs.$name=du,xs.$version="2.0.0";var Mu=':host{display:block;left:0;position:relative;right:0}:host([outlined]){outline:1px solid var(--theme-color)}:host([multiple]){outline:1px dashed hsla(0,0%,100%,.5)}:host([multiple]):after{bottom:0;content:"";cursor:pointer;display:block;left:0;position:absolute;right:0;top:0}:host([multiple][active]){outline-color:var(--theme-color);z-index:1}:host([multiple])>*{visibility:hidden}:host([multiple][active])>*{visibility:visible}:host([multiple][active]):after{display:none}';const Xa=new WeakMap;class $s extends rr{constructor(){super(...arguments),this.$onCanvasAction=null,this.$onCanvasActionStart=null,this.$onCanvasActionEnd=null,this.$onDocumentKeyDown=null,this.$action="",this.$actionStartTarget=null,this.$changing=!1,this.$style=Mu,this.$initialSelection={x:0,y:0,width:0,height:0},this.x=0,this.y=0,this.width=0,this.height=0,this.aspectRatio=NaN,this.initialAspectRatio=NaN,this.initialCoverage=NaN,this.active=!1,this.linked=!1,this.dynamic=!1,this.movable=!1,this.resizable=!1,this.zoomable=!1,this.multiple=!1,this.keyboard=!1,this.outlined=!1,this.precise=!1}set $canvas(e){Xa.set(this,e)}get $canvas(){return Xa.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["active","aspect-ratio","dynamic","height","initial-aspect-ratio","initial-coverage","keyboard","linked","movable","multiple","outlined","precise","resizable","width","x","y","zoomable"])}$propertyChangedCallback(e,t,r){if(!Object.is(r,t))switch(super.$propertyChangedCallback(e,t,r),e){case"x":case"y":case"width":case"height":this.$changing||this.$nextTick(()=>{this.$change(this.x,this.y,this.width,this.height,this.aspectRatio,!0)});break;case"aspectRatio":case"initialAspectRatio":this.$nextTick(()=>{this.$initSelection()});break;case"initialCoverage":this.$nextTick(()=>{Pe(r)&&r<=1&&this.$initSelection(!0,!0)});break;case"keyboard":this.$nextTick(()=>{this.$canvas&&(r?this.$onDocumentKeyDown||(this.$onDocumentKeyDown=this.$handleKeyDown.bind(this),ve(this.ownerDocument,za,this.$onDocumentKeyDown)):this.$onDocumentKeyDown&&(pe(this.ownerDocument,za,this.$onDocumentKeyDown),this.$onDocumentKeyDown=null))});break;case"multiple":this.$nextTick(()=>
vendor: 7,300 bytes, line 382
382{if(this.$canvas){const e=this.$getSelections();r?(e.forEach(e=>{e.active=!1}),this.active=!0,this.$emit(mr,{x:this.x,y:this.y,width:this.width,height:this.height})):(this.active=!1,e.slice(1).forEach(e=>{this.$removeSelection(e)}))}});break;case"precise":this.$nextTick(()=>{this.$change(this.x,this.y)});break;case"linked":r&&(this.dynamic=!0)}}connectedCallback(){super.connectedCallback();const e=this.closest(this.$getTagNameOf(Rn));e?(this.$canvas=e,this.$setStyles({position:"absolute",transform:`translate(${this.x}px, ${this.y}px)`}),this.hidden||this.$render(),this.$initSelection(!0),this.$onCanvasActionStart=this.$handleActionStart.bind(this),this.$onCanvasActionEnd=this.$handleActionEnd.bind(this),this.$onCanvasAction=this.$handleAction.bind(this),ve(e,qt,this.$onCanvasActionStart),ve(e,Gt,this.$onCanvasActionEnd),ve(e,Cr,this.$onCanvasAction)):this.$render()}disconnectedCallback(){const{$canvas:e}=this;e&&(this.$onCanvasActionStart&&(pe(e,qt,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(pe(e,Gt,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(pe(e,Cr,this.$onCanvasAction),this.$onCanvasAction=null)),super.disconnectedCallback()}$getSelections(){let e=[];return this.parentElement&&(e=Array.from(this.parentElement.querySelectorAll(this.$getTagNameOf(Vt)))),e}$initSelection(e=!1,t=!1){const{initialCoverage:r,parentElement:o}=this;if(Pe(r)&&o){const n=this.aspectRatio||this.initialAspectRatio;let i=(t?0:this.width)||o.offsetWidth*r,s=(t?0:this.height)||o.offsetHeight*r;Pe(n)&&({width:i,height:s}=Zo({aspectRatio:n,width:i,height:s})),this.$change(this.x,this.y,i,s),e&&this.$center(),this.$initialSelection={x:this.x,y:this.y,width:this.width,height:this.height}}}$createSelection(){const e=this.cloneNode(!0);return this.hasAttribute("id")&&e.removeAttribute("id"),e.initialCoverage=NaN,this.active=!1,this.parentElement&&this.parentElement.insertBefore(e,this.nextSibling),e}$removeSelection(e=this){if(this.parentElement){const t=this.$getSelections();if(t.length>1){const r=t.indexOf(e),o=t[r+1]||t[r-1];o&&(e.active=!1,this.parentElement.removeChild(e),o.active=!0,o.$emit(mr,{x:o.x,y:o.y,width:o.width,height:o.height}))}else this.$clear()}}$handleActionStart(e){var t,r;const o=null===(r=null===(t=e.detail)||void 0===t?void 0:t.relatedEvent)||void 0===r?void 0:r.target;this.$action="",this.$actionStartTarget=o,!this.hidden&&this.multiple&&!this.active&&o===this&&this.parentElement&&(this.$getSelections().forEach(e=>{e.active=!1}),this.active=!0,this.$emit(mr,{x:this.x,y:this.y,width:this.width,height:this.height}))}$handleAction(e){const{currentTarget:t,detail:r}=e;if(!t||!r)return;const{relatedEvent:o}=r;let{action:n}=r;if(!n&&this.multiple&&(n=this.$action||o?.target.action,this.$action=n),!n||this.hidden&&n!==an||this.multiple&&!this.active&&n!==kr)return;const i=r.endX-r.startX,s=r.endY-r.startY,{width:a,height:l}=this;let{aspectRatio:c}=this;switch(!Pe(c)&&o.shiftKey&&(c=Pe(a)&&Pe(l)?a/l:1),n){case an:if(0!==i&&0!==s){const{$canvas:e}=this,o=Ha(t);(this.multiple&&!this.hidden?this.$createSelection():this).$change(r.startX-o.left,r.startY-o.top,Math.abs(i),Math.abs(s),c),i<0?s<0?n=Vr:s>0&&(n=Gr):i>0&&(s<0?n=Br:s>0&&(n=Hr)),e&&(e.$action=n)}break;case Kl:this.movable&&(this.dynamic||this.$actionStartTarget&&this.contains(this.$actionStartTarget))&&this.$move(i,s);break;case kr:if(o&&this.zoomable&&(this.dynamic||this.contains(o.target))){const e=Ha(t);this.$zoom(r.scale,o.pageX-e.left,o.pageY-e.top)}break;default:this.$resize(n,i,s,c)}}$handleActionEnd(){this.$action="",this.$actionStartTarget=null}$handleKeyDown(e){if(this.hidden||!this.keyboard||this.multiple&&!this.active||e.defaultPrevented)return;const{activeElement:t}=document;if(!t||!["INPUT","TEXTAREA"].includes(t.tagName)&&!["true","plaintext-only"].includes(t.contentEditable))switch(e.key){case"Backspace":e.metaKey&&(e.preventDefault(),this.$removeSelection());break;case"Delete":e.preventDefault(),this.$removeSelection();break;case"ArrowLeft":e.preventDefault(),this.$move(-1,0);break;case"ArrowRight":e.preventDefault(),this.$move(1,0);break;case"ArrowUp":e.preventDefault(),this.$move(0,-1);break;case"ArrowDown":e.preventDefault(),this.$move(0,1);break;case"+":e.preventDefault(),this.$zoom(.1);break;case"-":e.preventDefault(),this.$zoom(-.1)}}$center(){const{parentElement:e}=this;if(!e)return this;const t=(e.offsetWidth-this.width)/2,r=(e.offsetHeight-this.height)/2;return this.$change(t,r)}$move(e,t=e){return this.$moveTo(this.x+e,this.y+t)}$moveTo(e,t=e){return this.movable?this.$change(e,t):this}$resize(e,t=0,r=0,o=this.aspectRatio){if(!this.resizable)return this;const n=Pe(o),{$canvas:i}=this;let{x:s,y:a,width:l,height:c}=this;switch(e){case Ia:a+=r,c-=r,c<0&&(e=Oa,c=-c,a-=c),n&&(s+=(t=r*o)/2,l-=t,l<0&&(l=-l,s-=l));break;case Pa:l+=t,l<0&&(e=Da,l=-l,s-=l),n&&(a-=(r=t/o)/2,c+=r,c<0&&(c=-c,a-=c));break;case Oa:c+=r,c<0&&(e=Ia,c=-c,a-=c),n&&(s-=(t=r*o)/2,l+=t,l<0&&(l=-l,s-=l));break;case Da:s+=t,l-=t,l<0&&(e=Pa,l=-l,s-=l),n&&(a+=(r=t/o)/2,c-=r,c<0&&(c=-c,a-=c));break;case Br:n&&(r=-t/o),a+=r,c-=r,l+=t,l<0&&c<0?(e=Gr,l=-l,c=-c,s-=l,a-=c):l<0?(e=Vr,l=-l,s-=l):c<0&&(e=Hr,c=-c,a-=c);break;case Vr:n&&(r=t/o),s+=t,a+=r,l-=t,c-=r,l<0&&c<0?(e=Hr,l=-l,c=-c,s-=l,a-=c):l<0?(e=Br,l=-l,s-=l):c<0&&(e=Gr,c=-c,a-=c);break;case Hr:n&&(r=t/o),l+=t,c+=r,l<0&&c<0?(e=Vr,l=-l,c=-c,s-=l,a-=c):l<0?(e=Gr,l=-l,s-=l):c<0&&(e=Br,c=-c,a-=c);break;case Gr:n&&(r=-t/o),s+=t,l-=t,c+=r,l<0&&c<0?(e=Br,l=-l,c=-c,s-=l,a-=c):l<0?(e=Hr,l=-l,s-=l):c<0&&(e=Vr,c=-c,a-=c)}return i&&i.$setAction(e),this.$change(s,a,l,c)}$zoom(e,t,r){if(!this.zoomable||0===e)return this;e<0?e=1/(1-e):e+=1;const{width:o,height:n}=this,i=o*e,s=n*e;let a=this.x,l=this.y;return R(t)&&R(r)?(a-=(i-o)*((t-this.x)/o),l-=(s-n)*((r-this.y)/n)):(a-=(i-o)/2,l-=(s-n)/2),this.$change(a,l,i,s)}$change(e,t,r=this.width,o=this.height,n=this.aspectRatio,i=!1){return this.$changing||!R(e)||!R(t)||!R(r)||!R(o)||r<0||o<0?this:(Pe(n)&&({width:r,height:o}=Zo({aspectRatio:n,width:r,height:o},"cover")),this.precise||(e=Math.round(e),t=Math.round(t),r=Math.round(r),o=Math.round(o)),e===this.x&&t===this.y&&r===this.width&&o===this.height&&Object.is(n,this.aspectRatio)&&!i?this:(this.hidden&&(this.hidden=!1),!1===this.$emit(mr,{x:e,y:t,width:r,height:o})?this:(this.$changing=!0,this.x=e,this.y=t,this.width=r,this.height=o,this.$changing=!1,this.$render())))}$reset(){const{x:e,y:t,width:r,height:o}=this.$initialSelection;return this.$change(e,t,r,o)}$clear(){return this.$change(0,0,0,0,NaN,!0),this.hidden=!0,this}$render(){return this.$setStyles({transform:`translate(${this.x}px, ${this.y}px)`,width:this.width,height:this.height})}$toCanvas(e){return new Promise((t,r)=>{if(!this.isConnected)return void r(new Error("The current element is not connected to the DOM."));const o=document.createElement("canvas");let{width:n,height:i}=this,s=1;if(cn(e)&&(Pe(e.width)||Pe(e.height))&&(({width:n,height:i}=Zo({aspectRatio:n/i,width:e.width,height:e.height})),s=n/this.width),o.width=n,o.height=i,!this.$canvas)return void t(o);const a=this.$canvas.querySelector(this.$getTagNameOf(bs));a?a.$ready().then(r=>{const l=o.getContext("2d");if(l){const[t,c,d,h,p,u]=a.$getTransform(),g=-this.x,m=-this.y,f=(g*h-d*m)/(t*h-d*c),b=(m*t-c*g)/(t*h-d*c);
382let y=t*f+d*b+p,v=c*f+h*b+u,w=r.naturalWidth,x=r.naturalHeight;1!==s&&(y*=s,v*=s,w*=s,x*=s);const $=w/2,k=x/2;l.fillStyle="transparent",l.fillRect(0,0,n,i),cn(e)&&vs(e.beforeDraw)&&e.beforeDraw.call(this,l,o),l.save(),l.translate($,k),l.transform(t,c,d,h,y,v),l.translate(-$,-k),l.drawImage(r,0,0,w,x),l.restore()}t(o)}).catch(r):t(o)})}}$s.$name=Vt,$s.$version="2.0.0";var Ru=':host{display:inline-block;height:1em;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1em}:host:after,:host:before{background-color:var(--theme-color);content:"";display:block;position:absolute}:host:before{height:1px;left:0;top:50%;transform:translateY(-50%);width:100%}:host:after{height:100%;left:50%;top:0;transform:translateX(-50%);width:1px}:host([centered]){left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}';class _s extends rr{constructor(){super(...arguments),this.$style=Ru,this.centered=!1,this.slottable=!1,this.themeColor="rgba(238, 238, 238, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["centered"])}}_s.$name=cu,_s.$version="2.0.0";var Nu=":host{display:block;height:0;left:0;outline:var(--theme-color) solid 1px;position:relative;top:0;width:0}:host([transparent]){outline-color:transparent}";const Qa=new WeakMap;class ks extends rr{constructor(){super(...arguments),this.$onCanvasChange=null,this.$onCanvasActionEnd=null,this.$onCanvasActionStart=null,this.$style=Nu,this.x=0,this.y=0,this.width=0,this.height=0,this.slottable=!1,this.themeColor="rgba(0, 0, 0, 0.65)"}set $canvas(e){Qa.set(this,e)}get $canvas(){return Qa.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["height","width","x","y"])}connectedCallback(){super.connectedCallback();const e=this.closest(this.$getTagNameOf(Rn));if(e){this.$canvas=e,this.style.position="absolute";const t=e.querySelector(this.$getTagNameOf(Vt));t&&(this.$onCanvasActionStart=e=>{t.hidden&&e.detail.action===an&&(this.hidden=!1)},this.$onCanvasActionEnd=e=>{t.hidden&&e.detail.action===an&&(this.hidden=!0)},this.$onCanvasChange=e=>{const{x:r,y:o,width:n,height:i}=e.detail;this.$change(r,o,n,i),(t.hidden||0===r&&0===o&&0===n&&0===i)&&(this.hidden=!0)},ve(e,qt,this.$onCanvasActionStart),ve(e,Gt,this.$onCanvasActionEnd),ve(e,mr,this.$onCanvasChange))}this.$render()}disconnectedCallback(){const{$canvas:e}=this;e&&(this.$onCanvasActionStart&&(pe(e,qt,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(pe(e,Gt,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasChange&&(pe(e,mr,this.$onCanvasChange),this.$onCanvasChange=null)),super.disconnectedCallback()}$change(e,t,r=this.width,o=this.height){return R(e)&&R(t)&&R(r)&&R(o)&&(e!==this.x||t!==this.y||r!==this.width||o!==this.height)?(this.hidden&&(this.hidden=!1),this.x=e,this.y=t,this.width=r,this.height=o,this.$render()):this}$reset(){return this.$change(0,0,0,0)}$render(){return this.$setStyles({transform:`translate(${this.x}px, ${this.y}px)`,width:this.width,height:this.height,outlineWidth:He.innerWidth})}}ks.$name=hu,ks.$version="2.0.0";var Lu=Object.defineProperty,zu=Object.getOwnPropertyDescriptor,Cs=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?zu(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Lu(t,r,i),i};let dn=class extends S{constructor(){super(...arguments),this.color="currentColor",this.size="24px"}render(){return c`<svg 383 xmlns="http://www.w3.org/2000/svg" 384 viewBox="0 0 122.88 109.78" 385 fill="${this.color}" 386 width="${this.size}" 387 height="${this.size}" 388 > 389 <title>${d("Center icon")}</title> 390 <path 391 d="M28.94,13.7l.09-.09,5.65-5.67.15-.13c2.61-2.4,5.24-1.62,6.76,1.44a1.59,1.59,0,0,1,.16.54c1.25,10.35,2.1,20.29,3.34,30.64.25,3.42-2.08,4.84-5.24,4.47l-28.21-3c-4.92-.58-7.36-3.84-3.42-7.78,1.78-1.77,3.54-3.58,5.34-5.32l-13-13a2,2,0,0,1,0-2.8L13,.58a2,2,0,0,1,2.81,0L28.94,13.7Zm32.5,27.58A13.61,13.61,0,1,1,47.83,54.89,13.61,13.61,0,0,1,61.44,41.28Zm32.5,54.8-.09.09-5.66,5.67a.86.86,0,0,1-.14.13c-2.61,2.4-5.24,1.62-6.76-1.44a1.58,1.58,0,0,1-.16-.55C79.88,89.64,79,79.7,77.79,69.35c-.25-3.42,2.07-4.84,5.24-4.47l28.21,3c4.92.58,7.36,3.84,3.42,7.78-1.78,1.77-3.54,3.58-5.34,5.32l13,13a2,2,0,0,1,0,2.8l-12.42,12.43a2,2,0,0,1-2.81,0L93.94,96.08Zm-65,0,.09.09,5.65,5.67.15.13c2.61,2.4,5.24,1.62,6.76-1.44a1.58,1.58,0,0,0,.16-.55C43,89.64,43.85,79.7,45.09,69.35c.25-3.42-2.08-4.84-5.24-4.47l-28.21,3c-4.92.58-7.36,3.84-3.42,7.78C10,77.44,11.76,79.25,13.56,81L.58,94a2,2,0,0,0,0,2.8L13,109.21a2,2,0,0,0,2.81,0L28.94,96.08Zm65-82.38-.09-.09L88.19,7.94a.86.86,0,0,0-.14-.13c-2.61-2.4-5.24-1.62-6.76,1.44a1.59,1.59,0,0,0-.16.54C79.88,20.14,79,30.08,77.79,40.43c-.25,3.42,2.07,4.84,5.24,4.47l28.21-3c4.92-.58,7.36-3.84,3.42-7.78-1.78-1.77-3.54-3.58-5.34-5.32l13-13a2,2,0,0,0,0-2.8L109.88.58a2,2,0,0,0-2.81,0L93.94,13.7Z" 392 /> 393 </svg>`}};Cs([g({type:String})],dn.prototype,"color",2),Cs([g({type:String})],dn.prototype,"size",2),dn=Cs([E("arrows-center-icon"),H()],dn);const Jl=$` 394 .textarea { 395 width: 100%; 396 min-height: 10px; 397 background-color: ${xr}; 398 border-style: solid; 399 border-width: 1px; 400 border-color: ${Ze}; 401 color: ${ao}; 402 line-height: 1.5; 403 padding: 0.5rem; 404 border-radius: 4px; 405 resize: vertical; 406 font-family: inherit; 407 font-size: 1rem; 408 box-sizing: border-box; 409 } 410 411 .textarea:focus { 412 outline: none; 413 border-color: ${lo}; 414 box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25); 415 } 416`,Uu=$` 417 .select { 418 position: relative; 419 width: 100%; 420 appearance: none; 421 -webkit-appearance: none !important; 422 -moz-appearance: none !important; 423 background-color: ${xr}; 424 background-position: 100% center; 425 background-repeat: no-repeat; 426 border-style: solid; 427 border-width: 1px; 428 border-color: ${Ze}; 429 color: ${ao}; 430 line-height: normal; 431 padding: 0.25rem 0.5rem; 432 border-radius: 1rem; 433 cursor: pointer; 434 } 435 436 .select.chocolate { 437 background-color: ${jt}; 438 color: white; 439 font-weight: bold; 440 padding-right: 2rem; 441 } 442`,ec=$` 443 .input, 444 .input-number { 445 width: 100%; 446 background-color: ${xr}; 447 border-style: solid; 448 border-width: 1px; 449 border-color: ${Ze}; 450 color: ${ao}; 451 line-height: normal; 452 padding: 0.25rem 0.5rem; 453 border-radius: 5px; 454 appearance: none; 455 -webkit-appearance: none !important; 456 box-sizing: border-box; 457 } 458 .input.cappucino { 459 background-color: ${Ii}; 460 color: black; 461 } 462 463 .input { 464 -moz-appearance: none !important; 465 } 466 467 .input-number::-webkit-outer-spin-button, 468 .input-number::-webkit-inner-spin-button { 469 /* display: none; <- Crashes Chrome on hover */ 470 -webkit-appearance: none; 471 margin: 0; /* <-- Apparently some margin are still there even though it's hidden */ 472 } 473 474 .input-number { 475 padding: 0.25rem 0.5rem; 476 -moz-appearance: textfield !important; 477 } 478 479 .input:disabled, 480 .input-number:disabled { 481 background-color: ${Ze}; 482 color: ${ao};
483 cursor: not-allowed; 484 } 485`,Fu=$` 486 .checkbox { 487 display: flex; 488 align-items: center; 489 gap: 0.4rem; 490 } 491 492 .checkbox input[type="checkbox"] { 493 width: 1.2rem; 494 height: 1.2rem; 495 border: 1px solid ${Ze}; 496 border-radius: 4px; 497 margin-left: 0; 498 margin-right: 0; 499 appearance: none; 500 -webkit-appearance: none; 501 cursor: pointer; 502 position: relative; 503 } 504 505 .checkbox input[type="checkbox"]:checked { 506 background-color: ${lo}; 507 border-color: ${lo}; 508 } 509 510 .checkbox input[type="checkbox"]:checked::after { 511 content: "â"; 512 position: absolute; 513 color: white; 514 font-size: 0.8rem; 515 top: 50%; 516 left: 50%; 517 transform: translate(-50%, -50%); 518 } 519 520 .checkbox input[type="checkbox"]:focus { 521 outline: none; 522 box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25); 523 } 524`,Nn=$` 525 .alert { 526 padding: 8px; 527 } 528 button.alert { 529 display: flex; 530 appearance: none; 531 cursor: pointer; 532 width: 100%; 533 } 534 .error { 535 padding: 1rem; 536 text-align: center; 537 color: #d9534f; 538 background-color: #f8d7da; 539 border: 1px solid #f5c6cb; 540 border-radius: 4px; 541 margin: 0.5rem 0; 542 } 543 544 .info { 545 padding: 1rem; 546 text-align: center; 547 color: #31708f; 548 background-color: #d9edf7; 549 border: 1px solid #bce8f1; 550 border-radius: 4px; 551 margin: 0.5rem 0; 552 } 553 .warning { 554 padding: 0.75rem; 555 color: #8a6d3b; 556 background-color: #fcf8e3; 557 border: 1px solid #faebcc; 558 border-radius: 4px; 559 font-size: 0.9rem; 560 margin: 0.5rem 0; 561 } 562 .success { 563 padding: 1rem; 564 text-align: center; 565 color: ${Fh}; 566 background-color: ${nn}; 567 border: 1px solid #d6e9c6; 568 border-radius: 4px; 569 margin: 0.5rem 0; 570 font-weight: bold; 571 } 572 573 .alert.with-icons { 574 display: grid; 575 grid-template-columns: 2rem 1fr 2rem; 576 align-items: center; 577 gap: 0.5rem; 578 } 579`;var ju=Object.defineProperty,Bu=(e,t,r,o)=>{for(var n,i=void 0,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(t,r,i)||i);return i&&ju(t,r,i),i};const Vu=e=>{const t=class extends e{resetMessage(){this.messageToDisplay=void 0}setErrorMessage(e){this.messageToDisplay={message:e,type:"error"}}setSuccessMessage(e){this.messageToDisplay={message:e,type:"success"}}setInfoMessage(e){this.messageToDisplay={message:e,type:"info"}}renderMessage(){return this.messageToDisplay?.message?c`<div class="alert ${this.messageToDisplay.type}"> 580 ${this.messageToDisplay.message} 581 </div>`:D}};t.styles=[e.styles??[],Nn,$` 582 .alert { 583 margin-top: 1rem; 584 margin-bottom: 1rem; 585 font-weight: 700; 586 } 587 `];let r=t;return Bu([b()],r.prototype,"messageToDisplay"),r};var Hu=Object.defineProperty,Gu=Object.getOwnPropertyDescriptor,Z=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Gu(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Hu(t,r,i),i},$t=(e=>(e.IMAGE_ONLY="image-only",e.CROP_READ="crop-read",e.CROP="crop",e))($t||{});const tc=Vu(S);let K=class extends tc{constructor(){super(...arguments),this.src="",this.boundingBox={x:0,y:0,width:100,height:100},this.fallbackSrc="",this.currentZoom=1,this.scaleStep=.25,this.maxZoom=10,this.minZoom=.3,this.showButtons=!1,this.cropMode="image-only",this.size={width:"100%",height:"30vh"},this._rotation=0,this.currentRotation=0,this.cropResult="",this.isCanvasEnabledInMobile=!1,this.lastTransform=[]}get rotation(){return this._rotation??0}set rotation(e){this._rotation=e,this.resetRotatation()}get isMobileOrTablet(){return Ni()}get isCanvasDisabled(){return this.isMobileOrTablet&&!this.isCanvasEnabledInMobile}get canZoom(){return!Ni()}attributeChangedCallback(e,t,r){switch(super.attributeChangedCallback(e,t,r),e){case"src":this.resetRotatation();break;case"size":this.fitImageToContainer();break;case"crop-mode":this.resetMessage()}}firstUpdated(){this.initCropper()}disconnectedCallback(){this.canvasElement.removeEventListener("actionstart",e=>{this.onCropperCanvasAction(e)}),super.disconnectedCallback()}initZoomLimit(){this.canvasElement.addEventListener("action",e=>{this.onCropperCanvasAction(e)})}resetRotatation(){this.currentRotation=0,this.imageElement?.$resetTransform(),this.rotateImage(this.rotation)}initCropper(){ws.$define(),ys.$define(),xs.$define(),$s.$define(),_s.$define(),ks.$define(),this.initZoomLimit(),this.imageElement.$ready(()=>{this.resetRotatation()})}updateLastTransform(){this.lastTransform=this.imageElement?.$getTransform()}fitImageToContainer(){!this.imageElement&&this.src||requestAnimationFrame(()=>{try{this.imageElement.$center("contain"),this.updateLastTransform()}catch(e){console.error("Error fitting image to container:",e)}})}rotateImage(e){if(this.imageElement)try{this.resetSelection(),this.imageElement.rotatable||(this.imageElement.rotatable=!0),this.imageElement.$rotate(`${e}deg`),this.currentRotation=Wd(this.currentRotation+e),this.dispatchEvent(new CustomEvent("rotate",{detail:{rotation:this.currentRotation}})),this.fitImageToContainer()}catch(e){console.error("Error rotating image:",e)}}renderCenterButton(){return c` 588 <button 589 class="link-button" 590 @click=${this.fitImageToContainer} 591 title=${d("Center image")} 592 aria-label=${d("Center image")} 593 > 594 <arrows-center-icon size="20px" aria-hidden="true"></arrows-center-icon> 595 </button> 596 `}renderRotateButtons(){return c` 597 <button 598 class="link-button" 599 @click=${()=>this.rotateImage(-90)} 600 title=${d("Rotate image to the left")} 601 aria-label=${d("Rotate image to the left")} 602 > 603 <rotate-left-icon aria-hidden="true"></rotate-left-icon> 604 </button> 605 <button 606 class="link-button" 607 @click=${()=>this.rotateImage(90)} 608 title=${d("Rotate image to the right")} 609 aria-label=${d("Rotate image to the right")} 610 > 611 <rotate-right-icon aria-hidden="true"></rotate-right-icon> 612 </button> 613 `}transformCoordsForRotation(e,t,r,o,n,i,s){switch((s%360+360)%360){case 90:return{x:t,y:n-e-r,width:o,height:r};case 180:return{x:n-e-r,y:i-t-o,width:r,height:o};case 270:return{x:i-t-o,y:e,width:o,height:r};default:return{x:e,y:t,width:r,height:o}}}getBoundingBoxFromSelectionElement(){const{x:e,y:t}=this.getOffset(),r=this.getScale();let o=(this.selectionElement.x-e)/r,n=(this.selectionElement.y-t)/r,i=this.selectionElement.width/r,s=this.selectionElement.height/r;if(0!==this.currentRotation){const e=this.imageElement?.$image;
613if(e){const t=e.naturalWidth,r=e.naturalHeight,a=(this.currentRotation%360+360)%360;if(90===a||270===a){const e=r,a=t,l=this.transformCoordsForRotation(o,n,i,s,e,a,this.currentRotation);o=l.x,n=l.y,i=l.width,s=l.height}else{const e=this.transformCoordsForRotation(o,n,i,s,t,r,this.currentRotation);o=e.x,n=e.y,i=e.width,s=e.height}}}return{x:o,y:n,width:i,height:s}}async showCrop(){if(this.resetMessage(),!this.hasSelection())return void this.setErrorMessage(d("Please select a region to crop."));this.resultBoundingBox=this.getBoundingBoxFromSelectionElement();const e=await this.selectionElement.$toCanvas();this.cropResult=e.toDataURL()}resetSelection(){this.resetMessage(),this.selectionElement?.$clear()}resetCrop(){this.cropResult="",this.resultBoundingBox=void 0,this.resetSelection()}submitCrop(){this.dispatchEvent(new CustomEvent(we.SUBMIT,{detail:{newBoundingBox:this.resultBoundingBox,oldBoundingBox:this.boundingBox,rotation:this.currentRotation}})),this.resetCrop()}renderCropMode(){return c` 614 <div> 615 ${this.renderMessage()} 616 <div class="button-container"> 617 <button 618 class="button white-button small" 619 @click=${this.resetCrop} 620 aria-label=${d("Reset selection")} 621 > 622 ${d("Reset selection")} 623 </button> 624 <button 625 class="button chocolate-button small" 626 @click=${this.showCrop} 627 aria-label=${d("Show crop")} 628 > 629 ${d("Show crop")} 630 </button> 631 </div> 632 633 ${this.renderCropImageBoundingBox()} 634 </div> 635 `}renderCropImageBoundingBox(){return this.cropResult?c` 636 <div> 637 <div class="crop-result-title">${d("Crop Result")}</div> 638 <div class="flex justify-center"> 639 <img src=${this.cropResult} alt=${d("Cropped Image")} /> 640 </div> 641 <div class="crop-result-buttons flex justify-center gap-0_5"> 642 <button 643 class="button chocolate-button" 644 @click=${this.submitCrop} 645 aria-label=${d("Validate crop")} 646 > 647 ${d("Validate crop")} 648 </button> 649 <button 650 class="button white-button" 651 @click=${this.resetCrop} 652 aria-label=${d("Reset crop")} 653 > 654 ${d("Reset crop")} 655 </button> 656 </div> 657 </div> 658 `:D}getOffset(){const e=this.imageElement.getBoundingClientRect(),t=this.canvasElement.getBoundingClientRect();return{x:e.left-t.left,y:e.top-t.top}}getScale(){const e=this.imageElement.$getTransform(),t=this.currentRotation/90%2;return Math.abs(e[t])}getImageScaleRelativeToCanvas(){if(!this.imageElement||!this.canvasElement)return 1;const e=this.imageElement.$image,t=this.canvasElement;if(!e||!t)return 1;const r=this.imageElement.getBoundingClientRect(),o=r.width,n=r.height,i=o/t.clientWidth,s=n/t.clientHeight;return Math.max(i,s)}getBoundingBoxDependOnImageSize(){const e=this.imageElement?.$image;if(this.boundingBox||console.error("No bounding box"),!e)return this.boundingBox;const{x:t,y:r}=this.getOffset(),o=this.getScale();let n={...this.boundingBox};if(0!==this.currentRotation){const t=e.naturalWidth,r=e.naturalHeight,o=(360-this.currentRotation)%360;n=this.transformCoordsForRotation(n.x,n.y,n.width,n.height,t,r,o)}return{x:n.x*o+t,y:n.y*o+r,width:n.width*o,height:n.height*o}}renderCropperControls(){if("image-only"===this.cropMode)return c` 659 <cropper-handle action="move" plain aria-label=${d("Move image")}></cropper-handle> 660 `;if("crop-read"===this.cropMode){const e=this.getBoundingBoxDependOnImageSize();return c` 661 <cropper-shade aria-hidden="true"></cropper-shade> 662 <cropper-handle action="move" plain aria-label=${d("Move image")}></cropper-handle> 663 <cropper-selection 664 outlined 665 @change="${this.onCropperSelectionChange}" 666 x=${e?.x??0} 667 y=${e?.y??0} 668 width=${e?.width??0} 669 height=${e?.height??0} 670 dynamic 671 movable 672 resizable 673 aria-label=${d("Selection area")} 674 > 675 <cropper-handle action="move" plain aria-label=${d("Move selection")}></cropper-handle> 676 </cropper-selection> 677 `}return c` 678 <cropper-shade hidden aria-hidden="true"></cropper-shade> 679 <cropper-handle action="select" plain aria-label=${d("Select area")}></cropper-handle> 680 <cropper-selection 681 dynamic 682 movable 683 resizable 684 hidden 685 zoomable 686 @change="${this.onCropperSelectionChange}" 687 aria-label=${d("Selection area")} 688 > 689 <cropper-handle action="move" plain aria-label=${d("Move selection")}></cropper-handle> 690 <cropper-handle action="n-resize" aria-label=${d("Resize top")}></cropper-handle> 691 <cropper-handle action="e-resize" aria-label=${d("Resize right")}></cropper-handle> 692 <cropper-handle action="s-resize" aria-label=${d("Resize bottom")}></cropper-handle> 693 <cropper-handle action="w-resize" aria-label=${d("Resize left")}></cropper-handle> 694 <cropper-handle action="ne-resize" aria-label=${d("Resize top right")}></cropper-handle> 695 <cropper-handle action="nw-resize" aria-label=${d("Resize top left")}></cropper-handle> 696 <cropper-handle 697 action="se-resize" 698 aria-label=${d("Resize bottom right")} 699 ></cropper-handle> 700 <cropper-handle action="sw-resize" aria-label=${d("Resize bottom left")}></cropper-handle> 701 </cropper-selection> 702 `}inSelection(e,t){return e.x>=t.x&&e.y>=t.y&&e.x+e.width<=t.x+t.width&&e.y+e.height<=t.y+t.height}hasSelection(){const e=this.selectionElement?.hidden??!0,t=0===this.selectionElement?.width||0===this.selectionElement?.height;return!e&&!t}onCropperImageTransform(e){if("crop"!==this.cropMode)return;const t=this.canvasElement;if(!t||!this.hasSelection())return;const r=this.selectionElement,o=t.getBoundingClientRect(),n=this.imageElement.cloneNode();n.style.transform=`matrix(${e.detail.matrix.join(", ")})`,n.style.opacity="0",t.appendChild(n);const i=n.getBoundingClientRect();t.removeChild(n);const s=r,a={x:i.left-o.left,y:i.top-o.top,width:i.width,height:i.height};this.inSelection(s,a)||e.preventDefault()}onCropperSelectionChange(e){if("crop"!==this.cropMode)return;const t=this.canvasElement;if(!t)return;const r=t.getBoundingClientRect(),o=e.detail,n=this.imageElement.getBoundingClientRect(),i={x:n.left-r.left,y:n.top-r.top,width:n.width,height:n.height};this.inSelection(o,i)||e.preventDefault()}
702renderMobileCanvasToggle(){return this.isMobileOrTablet?c` 703 <label class="checkbox"> 704 <input 705 type="checkbox" 706 .checked=${this.isCanvasEnabledInMobile} 707 @change=${e=>{this.isCanvasEnabledInMobile=e.target.checked}} 708 /> 709 <span> ${d("Move image")} </span> 710 </label> 711 `:D}renderTopPanel(){return this.showButtons?c` 712 <div class="toolbar flex justify-end" role="toolbar" aria-label=${d("Image controls")}> 713 ${this.renderMobileCanvasToggle()} ${this.renderCenterButton()} 714 ${this.renderRotateButtons()} 715 </div> 716 `:D}allowZoomChange(e){return e<=this.maxZoom&&e>=this.minZoom}onCropperCanvasAction(e){try{const{action:t}=e.detail;"scale"===t&&(this.allowZoomChange(this.getImageScaleRelativeToCanvas())||(e.preventDefault(),this.imageElement.$setTransform(this.lastTransform))),this.updateLastTransform()}catch(e){console.error("Error in cropper canvas action:",e)}}render(){const e="image-only"!==this.cropMode?"anonymous":void 0;return c` 717 <div 718 class="zoomable-image" 719 style=${_r({width:this.size.width,"max-width":this.size["max-width"]})} 720 role="region" 721 aria-label=${d("Zoomable image")} 722 > 723 ${this.renderTopPanel()} 724 <div class="cropper-parent"> 725 <cropper-canvas 726 background 727 style=${_r(this.size)} 728 scale-step=${this.scaleStep} 729 aria-label=${d("Image canvas")} 730 ?disabled=${this.isCanvasDisabled} 731 > 732 <cropper-image 733 src=${this.src} 734 alt=${d("Picture")} 735 rotable 736 scalable 737 skewable 738 translatable 739 ?crossorigin="${e}" 740 @transform=${this.onCropperImageTransform} 741 ></cropper-image> 742 ${this.renderCropperControls()} 743 </cropper-canvas> 744 </div> 745 ${"crop"===this.cropMode?c` ${this.renderCropMode()} `:D} 746 </div> 747 `}};K.styles=[tc.styles||[],On,Oe([B.White,B.Chocolate,B.LINK]),Fu,$` 748 :host { 749 display: block; 750 width: 100%; 751 } 752 .zoomable-image { 753 margin: 0 auto; 754 } 755 .cropper-parent { 756 position: relative; 757 overflow: hidden; 758 border: 1px solid black; 759 background-color: white; 760 } 761 762 .button-container { 763 display: flex; 764 justify-content: end; 765 gap: 0.5rem; 766 margin-top: 0.5rem; 767 } 768 .crop-result-title { 769 font-weight: bold; 770 text-align: center; 771 margin-top: 1rem; 772 margin-bottom: 0.5rem; 773 } 774 .crop-result-buttons { 775 margin-top: 0.5rem; 776 } 777 778 .toolbar .checkbox { 779 margin-right: auto; 780 } 781 782 .toolbar .checkbox span { 783 padding-top: 2px; 784 } 785 786 @media (prefers-color-scheme: dark) { 787 .link-button { 788 filter: invert(1); 789 } 790 } 791 `],Z([Dt("cropper-canvas")],K.prototype,"canvasElement",2),Z([Dt("cropper-image")],K.prototype,"imageElement",2),Z([Dt("cropper-selection")],K.prototype,"selectionElement",2),Z([b()],K.prototype,"image",2),Z([g({type:String,attribute:"src",reflect:!0})],K.prototype,"src",2),Z([g({type:Object,attribute:"bounding-box",reflect:!0})],K.prototype,"boundingBox",2),Z([g({type:String,attribute:"fallback-src",reflect:!0})],K.prototype,"fallbackSrc",2),Z([b()],K.prototype,"currentZoom",2),Z([g({type:Number,attribute:"scale-size"})],K.prototype,"scaleStep",2),Z([g({type:Number,attribute:"max-zoom"})],K.prototype,"maxZoom",2),Z([g({type:Number,attribute:"min-zoom"})],K.prototype,"minZoom",2),Z([g({type:Boolean,attribute:"show-buttons",reflect:!0})],K.prototype,"showButtons",2),Z([g({type:String,attribute:"crop-mode",reflect:!0})],K.prototype,"cropMode",2),Z([g({type:Object,attribute:"size",reflect:!0})],K.prototype,"size",2),Z([g({type:Number,reflect:!0})],K.prototype,"rotation",1),Z([b()],K.prototype,"_rotation",2),Z([b()],K.prototype,"currentRotation",2),Z([b()],K.prototype,"cropResult",2),Z([b()],K.prototype,"resultBoundingBox",2),Z([b()],K.prototype,"isCanvasEnabledInMobile",2),Z([b()],K.prototype,"lastTransform",2),K=Z([E("zoomable-image"),H()],K);var qu=Object.defineProperty,Wu=Object.getOwnPropertyDescriptor,Ss=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Wu(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&qu(t,r,i),i};let ho=class extends(yo(Pn(S,void 0))){constructor(){super(...arguments),this.isImageExpanded=!1,this.emitEventClick=(e,t)=>{e.stopPropagation();const r=new CustomEvent(we.SUBMIT,{detail:{value:t},bubbles:!0,composed:!0});this.dispatchEvent(r)},this._annotateProduct=async(e,t)=>{this.showLoading(t),await _h(this.question?.insight_id,t),this.hideLoading(),this.emitEventClick(e,t)}}get imageSize(){return this.isImageExpanded?{height:"350px",width:"100%","max-width":"350px"}:{height:"200px",width:"200px"}}expandImage(){this.isImageExpanded=!0}_renderImage(){return this.question?.source_image_url?c` 792 <div class="image-wrapper"> 793 <zoomable-image 794 src=${this.question?.source_image_url} 795 .size=${this.imageSize} 796 @click="${this.expandImage}" 797 ?show-buttons="${this.isImageExpanded}" 798 ></zoomable-image> 799 ${this.isImageExpanded?D:c`<div> 800 <button class="expand-button button white-button small" @click="${this.expandImage}"> 801 ${d("Expand image")} 802 </button> 803 </div>`} 804 </div> 805 `:D}renderButtons(){const e=!!this.loading;return c` 806 <div class="buttons-row"> 807 <loading-button 808 css-classes="button success-button" 809 .loading=${this.loading===z.ACCEPT} 810 .disabled=${e} 811 @click="${e=>this._annotateProduct(e,z.ACCEPT)}" 812 label="${d("Yes")}" 813 ></loading-button> 814 <loading-button 815 css-classes="button danger-button" 816 .loading=${this.loading===z.REFUSE} 817 .disabled=${e} 818 @click="${e=>this._annotateProduct(e,z.REFUSE)}" 819 label="${d("No")}" 820 ></loading-button> 821 <loading-button 822 css-classes="button cappucino-button" 823 .loading=${this.loading===z.SKIP} 824 .disabled=${e} 825 @click="${e=>this._annotateProduct(e,z.SKIP)}" 826 label="${d("Skip")}" 827 ></loading-button> 828 </div> 829 `}render(){return this.question?c` 830 <div class="question-form"> 831 <p>${this.question.question} <strong> ${this.question.value} </strong></p> 832 <div>${this._renderImage()}</div> 833 ${this.renderButtons()} 834 </div> 835 `:c`<div>No question</div>`}};ho.styles=[...Oe([B.White]),Wh,$` 836 :host { 837 display: block; 838 } 839 840 .question-form { 841 display: flex; 842 align-items: center; 843 flex-direction: column; 844 } 845 846 .image-wrapper { 847 width: 100%; 848 display: flex; 849 flex-direction: column; 850 align-items: center; 851 position: relative; 852 } 853 854 .img-button-wrapper { 855 position: absolute; 856 bottom: 0.5rem; 857 right: 0.5rem; 858 display: flex; 859 justify-content: center; 860 } 861 .expand-button { 862 margin-top: 1rem; 863 } 864 .buttons-row { 865 margin-top: 1rem; 866 } 867 `],Ss([g({type:Object,reflect:!0})],ho.prototype,"question",2),Ss([g({type:Boolean,attribute:"is-image-expanded"})],ho.prototype,"isImageExpanded",2),ho=Ss([E("robotoff-question-form"),H()],ho);const or=$` 868 :host { 869 font-family: var(--font-family, "Public Sans", Helvetica, Roboto, Arial, sans-serif); 870 } 871`,Es=$` 872 :host { 873 display: inline-flex; 874 } 875`;var Ku=Object.defineProperty,Yu=Object.getOwnPropertyDescriptor,Mt=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Yu(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Ku(t,r,i),i};let Qe=class extends(yo(S)){constructor(){super(...arguments),this.showMessage=!0,this.showLoading=!0,this.showError=!0,this.isImageExpanded=!1,this.productC
875ode="",this.insightTypes="",this.hasAnswered=!1,this._questionsTask=new tr(this,{task:async([e,t])=>{if(this.hasAnswered=!1,!e)return[];const r=t?{insight_types:t}:{};this._emitQuestionStateEvent(V.LOADING),await Hl(e,r);const o=yh(e).get();return this._emitQuestionStateEvent(o?.length>0?V.HAS_DATA:V.NO_DATA),o},args:()=>[this.productCode,this.insightTypes]}),this.onQuestionAnswered=()=>{this.hasAnswered=!0,kh(this.productCode),this.requestUpdate(),this._emitQuestionStateEvent(V.ANNOTATED),ci(this.productCode).get()&&this._emitQuestionStateEvent(V.FINISHED)}}_emitQuestionStateEvent(e){const t=e===V.LOADING?{state:e}:{state:e,index:on(this.productCode).get(),numberOfQuestions:Vl(this.productCode).get()};this.dispatchEvent(new CustomEvent(we.QUESTION_STATE,{detail:t,bubbles:!0,composed:!0}))}renderMessage(){const e=e=>c`<div class="message">${e}</div>`;return ci(this.productCode).get()?e(d("Thank you for your assistance!")):this.showMessage?this.hasAnswered?c`<div>${d("Thanks for your help! Can you assist with another question?")}</div>`:e(d("Open Food Facts needs your help with this product.")):D}render(){return this._questionsTask.render({pending:()=>this.showLoading?c`<off-wc-loader></off-wc-loader>`:D,error:e=>this.showError?c`<div>Error: ${e}</div>`:D,complete:e=>{const t=e[on(this.productCode).get()??0];return xh(this.productCode).get()?c` 876 <div class="question-wrapper"> 877 ${this.renderMessage()} 878 ${ci(this.productCode).get()?D:c` 879 <robotoff-question-form 880 .isImageExpanded=${this.isImageExpanded} 881 .question=${t} 882 @submit=${this.onQuestionAnswered} 883 ></robotoff-question-form> 884 `} 885 </div> 886 `:c`<slot></slot>`}})}};Qe.styles=[or,$` 887 :host { 888 display: block; 889 padding: 1rem; 890 } 891 .question-wrapper { 892 display: flex; 893 flex-direction: column; 894 align-items: center; 895 text-align: center; 896 } 897 .message { 898 font-style: italic; 899 color: var(--robotoff-question-message-color, #444); 900 } 901 @media (prefers-color-scheme: dark) { 902 :host { 903 background: var(--robotoff-question-bg-dark, #181a1b); 904 color: var(--robotoff-question-color-dark, #f3f3f3); 905 } 906 .message { 907 color: var(--robotoff-question-message-color-dark, #b3b3b3); 908 } 909 } 910 `],Mt([g({type:Boolean,attribute:"show-message"})],Qe.prototype,"showMessage",2),Mt([g({type:Boolean,attribute:"show-loading"})],Qe.prototype,"showLoading",2),Mt([g({type:Boolean,attribute:"show-error"})],Qe.prototype,"showError",2),Mt([g({type:Boolean,attribute:"image-expanded"})],Qe.prototype,"isImageExpanded",2),Mt([g({type:String,attribute:"product-code"})],Qe.prototype,"productCode",2),Mt([g({type:String,attribute:"insight-types"})],Qe.prototype,"insightTypes",2),Mt([b()],Qe.prototype,"hasAnswered",2),Qe=Mt([E("robotoff-question"),H()],Qe);const rc=new je({}),Ja=new je({}),Zu=async(e,t={})=>{const r={...t,insight_types:Xe.nutrient_extraction,annotated:!1};e&&(r.barcode=e,Ja.setItem(e,null));const o=await rt.insights(r);return o.insights.forEach(e=>{rc.setItem(e.id,e),Ja.setItem(e.barcode,e.id)}),o.insights},Xu=async e=>{const t=e.data.serving_size?.value??null,r={...e.data};delete r.serving_size;const o={nutrients:r,nutrition_data_per:e.type,serving_size:t};return await rt.annotateNutrients(e.insightId,z.ACCEPT_AND_ADD_DATA,o)},el=async(e,t)=>await rt.annotateNutrients(e,t),Qu={nutrientsTaxonomies:async()=>await new vh(fetch).getNutrients()},hi=new je({nutrients:oo.NOT_LOADED}),Ln=new je({}),Ju=new Pr(()=>{const e=Ln.get();return Object.values(e)}),oc=(e,t)=>e?e.name[t]||e.name.en||e.name.xx||(console.warn("No name found for taxonomy",{taxonomy:e,lang:t}),""):(console.warn("getTaxonomyNameByLang called with undefined taxonomy",{taxonomy:e}),""),ep=(e,t)=>{const r=Ln.getItem(e);return oc(r,t)},nc=e=>{const t=Ln.getItem(e);if(t)return t?.unit?.en},tp=async()=>{if(hi.getItem("nutrients")!=oo.NOT_LOADED)return;hi.setItem("nutrients",oo.LOADING);const e=await Qu.nutrientsTaxonomies();Object.entries(e).forEach(([e,t])=>{const r=e.replace("zz:","");Ln.setItem(r,{...t,id:r})}),hi.setItem("nutrients",oo.LOADED)},tl=["g","mg","µg"],Jr="serving_size",rp=Object.values(te),gr={[te.CENTGRAMS]:"_100g",[te.SERVING]:"_serving"},op="_unit",rl={"energy-kj":"kj","energy-kcal":"kcal","energy-from-fat":"kj"},ol=(e,t)=>e in rl?[rl[e]]:(Dl(t)&&(t=nc(e)),t?tl.includes(t)?tl:[t]:[]),ui="unit__";class np extends $o{render(e,t={}){return _r({...t,"background-image":`url('${ct(e)}')`})}}const pi=xo(np),ic=$` 911 input[type="text"] { 912 width: 100%; 913 padding: 0.5rem; 914 border: 1px solid #ccc; 915 border-radius: 5px; 916 box-sizing: border-box; 917 font-size: 0.9rem; 918 height: 2.2rem; 919 background-color: rgb(252, 251, 251); 920 } 921 922 input[type="text"]:focus { 923 outline: none; 924 border-color: #007bff; 925 box-shadow: 0 0 3px rgba(0, 123, 255, 0.5); 926 } 927`,ko=xo(class extends $o{constructor(e){if(super(e),e.type!==Tn.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}
927update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter(e=>""!==e)));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const r=e.element.classList;for(const e of this.st)e in t||(r.remove(e),this.st.delete(e));for(const e in t){const o=!!t[e];o===this.st.has(e)||this.nt?.has(e)||(o?(r.add(e),this.st.add(e)):(r.remove(e),this.st.delete(e)))}return es}});var ip=Object.defineProperty,sp=Object.getOwnPropertyDescriptor,ot=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?sp(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&ip(t,r,i),i};let ze=class extends S{constructor(){super(...arguments),this.placeholder="",this.suggestions=[],this.showNotFoundOption=!1,this.notFoundText="Not found",this.showSuggestions=!1,this.highlightedIndex=-1,this._id="",this._inputValue=""}get value(){return this._inputValue??""}set value(e){this._inputValue=e,this.requestUpdate()}get suggestionId(){return`autocomplete-list-${this._id}`}getSuggestionItemId(e){return`autocomplete-item-${this._id}-${e}`}get filteredSuggestions(){return this.filterSuggestions(this.value)}get suggestionsWithNotFound(){const e=this.filteredSuggestions;return this.showNotFoundOption&&0===e.length&&this.value.trim().length>0?[{value:"__NOT_FOUND__",label:this.notFoundText.replace("{value}",this.value),isNotFound:!0}]:e}connectedCallback(){super.connectedCallback(),this._id=Hd()}filterSuggestions(e){return e?this.suggestions.filter(t=>this.getSuggestionTextToFilter(t).includes(e.toLowerCase())):this.suggestions}getSuggestionTextToFilter(e){return(e.label??e.value).toLowerCase()}onInput(e){const t=e.target.value;this.value=t,this.highlightedIndex=-1;const r=this.filteredSuggestions,o=this.suggestionsWithNotFound;this.showSuggestions=o.length>0;const n=1===r.length&&this.getSuggestionTextToFilter(r[0])===this.value?r[0]:void 0;this.dispatchEvent(new CustomEvent("input-change",{detail:{value:t,filteredSuggestions:r,matching:n},bubbles:!0,composed:!0}))}selectSuggestion(e){"__NOT_FOUND__"!==e.value&&(this._inputValue=e.value),this.showSuggestions=!1,this.dispatchEvent(new CustomEvent("suggestion-select",{detail:e,bubbles:!0,composed:!0}))}selectMatchingSuggestion(){const e=this.filteredSuggestions.find(e=>this.getSuggestionTextToFilter(e)===this.value);return e&&this.selectSuggestion(e),e}onKeyDown(e){const t=this.suggestionsWithNotFound;if(0!==t.length){if(!this.showSuggestions)return void("Enter"===e.key&&(e.preventDefault(),this.selectMatchingSuggestion()));switch(e.key){case"ArrowDown":e.preventDefault(),this.highlightedIndex=Math.min(this.highlightedIndex+1,t.length-1);break;case"ArrowUp":e.preventDefault(),this.highlightedIndex=Math.max(this.highlightedIndex-1,-1);break;case"Enter":e.preventDefault(),this.highlightedIndex>=0?this.selectSuggestion(t[this.highlightedIndex]):this.selectMatchingSuggestion();break;case"Escape":e.preventDefault(),this.showSuggestions=!1;break;case"Tab":this.highlightedIndex>=0&&(e.preventDefault(),this.selectSuggestion(t[this.highlightedIndex]))}}}onFocus(){this.showSuggestions=this.suggestions.length>0,this.highlightedIndex=-1}render(){return c` 928 <div class="autocomplete-wrapper"> 929 <input 930 id=${this._id} 931 type="text" 932 class="autocomplete-input" 933 .value=${this.value} 934 placeholder=${this.placeholder} 935 @input=${this.onInput} 936 @keydown=${this.onKeyDown} 937 @focus=${()=>this.onFocus()} 938 @blur=${()=>setTimeout(()=>this.showSuggestions=!1,150)} 939 aria-autocomplete="list" 940 aria-controls=${this.suggestionId} 941 aria-expanded=${this.showSuggestions} 942 aria-activedescendant=${this.highlightedIndex>=0?this.getSuggestionItemId(this.highlightedIndex):""} 943 part="autocomplete-input" 944 /> 945 ${this.showSuggestions?c`<ul 946 class="autocomplete-list" 947 id=${this.suggestionId} 948 role="listbox" 949 part="autocomplete-input-list" 950 > 951 ${this.suggestionsWithNotFound.map((e,t)=>c`<li 952 class="autocomplete-item ${ko({highlighted:t===this.highlightedIndex,"not-found":!0===e.isNotFound})}" 953 role="option"
954 id=${this.getSuggestionItemId(t)} 955 @mousedown=${()=>this.selectSuggestion(this.suggestionsWithNotFound[t])} 956 @mouseenter=${()=>this.highlightedIndex=t} 957 aria-selected=${t===this.highlightedIndex} 958 > 959 ${e.label??e.value} 960 </li>`)} 961 </ul>`:null} 962 </div> 963 `}};ze.styles=[ic,$` 964 .autocomplete-wrapper { 965 width: 100%; 966 position: relative; 967 } 968 969 .autocomplete-list { 970 position: absolute; 971 background: #fff; 972 border: 1px solid #ccc; 973 border-top: none; 974 list-style-type: none; 975 padding: 0; 976 margin: 0; 977 max-height: 200px; 978 overflow-y: auto; 979 z-index: 9999; 980 width: 100%; 981 } 982 983 .autocomplete-item { 984 padding: 10px; 985 cursor: pointer; 986 } 987 988 .autocomplete-item:hover { 989 background-color: #f0f0f0; 990 } 991 992 .autocomplete-item.highlighted { 993 background-color: #e0e0e0; 994 font-weight: bold; 995 } 996 997 .autocomplete-item.not-found { 998 background-color: #f8f9fa; 999 border-top: 1px solid #ddd; 1000 color: #007bff; 1001 font-style: italic; 1002 padding: 12px 10px; 1003 } 1004 1005 .autocomplete-item.not-found:hover { 1006 background-color: #e7f3ff; 1007 } 1008 1009 .autocomplete-item.not-found.highlighted { 1010 background-color: #d4ebff; 1011 font-weight: normal; 1012 } 1013 1014 .autocomplete-input:focus { 1015 outline: none; 1016 border-color: ${lo}; 1017 } 1018 `],ot([g({type:String})],ze.prototype,"placeholder",2),ot([g({type:String})],ze.prototype,"value",1),ot([g({type:Array})],ze.prototype,"suggestions",2),ot([g({type:Boolean,attribute:"show-not-found-option"})],ze.prototype,"showNotFoundOption",2),ot([g({type:String,attribute:"not-found-text"})],ze.prototype,"notFoundText",2),ot([b()],ze.prototype,"showSuggestions",2),ot([b()],ze.prototype,"highlightedIndex",2),ot([b()],ze.prototype,"_id",2),ot([b()],ze.prototype,"_inputValue",2),ze=ot([E("autocomplete-input")],ze);var ap=Object.defineProperty,lp=Object.getOwnPropertyDescriptor,Ts=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?lp(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&ap(t,r,i),i};let hn=class extends S{constructor(){super(...arguments),this.color="#000000",this.size="16px"}render(){return c` 1019 <svg 1020 width=${this.size} 1021 height=${this.size}
1022 viewBox="0 0 16 16" 1023 version="1.1" 1024 xmlns="http://www.w3.org/2000/svg" 1025 xmlns:xlink="http://www.w3.org/1999/xlink" 1026 > 1027 <title>${d("Suggestion icon")}</title> 1028 <g id="Suggestion" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 1029 <path 1030 d="M15.7779156,8.17533871 L12.1810436,7.01918172 L11.0248605,3.42207109 C10.9819796,3.28959143 10.8590972,3.19999167 10.7198944,3.19999167 C10.5806916,3.19999167 10.4578092,3.28959143 10.4152483,3.42207109 L9.25906518,7.01918172 L5.66219324,8.17533871 C5.52939059,8.2178986 5.4397888,8.34077828 5.4397888,8.47997792 C5.4397888,8.61917755 5.52939059,8.74205723 5.66187324,8.78461712 L9.25874517,9.94077411 L10.4149283,13.5378847 C10.4578092,13.6703644 10.5806916,13.7599642 10.7198944,13.7599642 C10.8590972,13.7599642 10.9819796,13.6703644 11.0245405,13.5378847 L12.1807236,9.94077411 L15.7775956,8.78461712 C15.9103982,8.74205723 16,8.61917755 16,8.47997792 C16,8.34077828 15.9103982,8.2178986 15.7779156,8.17533871 Z M0.538570771,4.14366921 L3.02694054,4.97310705 L3.85639713,7.46142057 C3.899918,7.59198023 4.02184044,7.67998 4.1597632,7.67998 C4.29768595,7.67998 4.4199284,7.59198023 4.46312926,7.46110057 L5.29258585,4.97278705 L7.78095562,4.14334921 C7.91183824,4.10014932 7.99984,3.97790964 7.99984,3.83999 C7.99984,3.70207036 7.91183824,3.57983068 7.78095562,3.53631079 L5.29258585,2.70687295 L4.46312926,0.218559431 C4.4199284,0.0879997708 4.29768595,-9.76996262e-15 4.1597632,-9.76996262e-15 C4.02184044,-9.76996262e-15 3.89959799,0.0879997708 3.85639713,0.21887943 L3.02694054,2.70687295 L0.538570771,3.53631079 C0.407688154,3.58015068 0.319686394,3.70207036 0.319686394,3.83999 C0.319686394,3.97790964 0.407688154,4.10014932 0.538570771,4.14366921 Z M5.54091082,12.1759683 L3.77255545,11.5865298 L3.18310366,9.81885443 C3.1399028,9.68829477 3.01766035,9.599975 2.87973759,9.599975 C2.74181484,9.599975 2.61957239,9.68797477 2.57637153,9.81885443 L1.98691974,11.5865298 L0.218884378,12.1759683 C0.0883217664,12.2194882 0,12.3417279 0,12.4796475 C0,12.6175671 0.08800176,12.7398068 0.218884378,12.7833267 L1.98723974,13.3727652 L2.57637153,15.1404406 C2.6198924,15.2706802 2.74181484,15.359 2.87973759,15.359 C3.01766035,15.359 3.1399028,15.2710002 3.18310366,15.1401206 L3.77255545,13.3724452 L5.54091082,12.7830067 C5.67179344,12.7394868 5.7597952,12.6172471 5.7597952,12.4796475 C5.7597952,12.3420479 5.67179344,12.2194882 5.54091082,12.1759683 Z" 1031 id="Shape" 1032 fill=${this.color} 1033 fill-rule="nonzero" 1034 ></path> 1035 </g> 1036 </svg> 1037 `}};Ts([g({type:String})],hn.prototype,"color",2),Ts([g({type:String})],hn.prototype,"size",2),hn=Ts([E("suggestion-icon"),H()],hn);var cp=Object.defineProperty,dp=Object.getOwnPropertyDescriptor,As=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?dp(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&cp(t,r,i),i};let un=class extends S{constructor(){super(...arguments),this.color="#FFFFFF",this.size="20px"}render(){return c` 1038 <svg 1039 width=${this.size} 1040 height=${this.size}
1041 viewBox="0 0 20 20" 1042 version="1.1" 1043 xmlns="http://www.w3.org/2000/svg" 1044 xmlns:xlink="http://www.w3.org/1999/xlink" 1045 > 1046 <title>${d("Add")}</title> 1047 <g id="Add" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 1048 <path 1049 d="M10,0 C4.477,0 0,4.477 0,10 C0,15.523 4.477,20 10,20 C15.523,20 20,15.523 20,10 C20,4.477 15.523,0 10,0 Z M13,11 L11,11 L11,13 C11,13.552 10.552,14 10,14 L10,14 C9.448,14 9,13.552 9,13 L9,11 L7,11 C6.448,11 6,10.552 6,10 L6,10 C6,9.448 6.448,9 7,9 L9,9 L9,7 C9,6.448 9.448,6 10,6 L10,6 C10.552,6 11,6.448 11,7 L11,9 L13,9 C13.552,9 14,9.448 14,10 L14,10 C14,10.552 13.552,11 13,11 Z" 1050 id="Shape" 1051 fill=${this.color} 1052 fill-rule="nonzero" 1053 ></path> 1054 </g> 1055 </svg> 1056 `}};As([g({type:String})],un.prototype,"color",2),As([g({type:String})],un.prototype,"size",2),un=As([E("add-icon"),H()],un);var hp=Object.defineProperty,up=Object.getOwnPropertyDescriptor,Is=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?up(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&hp(t,r,i),i};let uo=class extends S{constructor(){super(...arguments),this.color="currentColor",this.size="30px"}render(){return c` 1057 <svg 1058 width=${this.size} 1059 height=${this.size}
1060 viewBox="0 0 30 30" 1061 version="1.1" 1062 xmlns="http://www.w3.org/2000/svg" 1063 xmlns:xlink="http://www.w3.org/1999/xlink" 1064 fill=${this.color} 1065 > 1066 <title>Visible (eye)</title> 1067 <g id="Visible-(eye)" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 1068 <path 1069 d="M15.0022584,4 C5.6518347,4 1.21209194,12.0831308 0.134979845,14.3903814 C-0.0449932884,14.7753814 -0.0449932748,15.2219332 0.134979845,15.6069333 C1.21209194,17.9155582 5.6518347,26 15.0022584,26 C24.3199598,26 28.7626845,17.9740384 29.8588847,15.6337898 C30.0470384,15.2309148 30.0470384,14.7690852 29.8588847,14.3662102 C28.7626845,12.0259609 24.3199598,4 15.0022584,4 Z M15,8 C18.8654,8 22,11.1346 22,15 C22,18.8654 18.8654,22 15,22 C11.1346,22 8,18.8654 8,15 C8,11.1346 11.1346,8 15,8 Z M15,11 C12.790861,11 11,12.790861 11,15 C11,17.209139 12.790861,19 15,19 C17.209139,19 19,17.209139 19,15 C19,12.790861 17.209139,11 15,11 Z" 1070 id="Shape" 1071 fill-rule="nonzero" 1072 fill=${this.color} 1073 ></path> 1074 </g> 1075 </svg> 1076 `}};uo.styles=[Es],Is([g({type:String})],uo.prototype,"color",2),Is([g({type:String})],uo.prototype,"size",2),uo=Is([E("eye-visible-icon")],uo);var pp=Object.defineProperty,gp=Object.getOwnPropertyDescriptor,Ps=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?gp(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&pp(t,r,i),i};let po=class extends S{constructor(){super(...arguments),this.color="currentColor",this.size="30px"}render(){return c` 1077 <svg 1078 width=${this.size} 1079 height=${this.size}
1080 viewBox="0 0 30 30" 1081 version="1.1" 1082 xmlns="http://www.w3.org/2000/svg" 1083 xmlns:xlink="http://www.w3.org/1999/xlink" 1084 fill=${this.color} 1085 > 1086 <title>Invisible (eye)</title> 1087 <g id="Invisible-(eye)" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 1088 <path 1089 d="M1.7070312,0.59 L0.29296875,2.00406245 L28.2929687,30.0040623 L29.707031,28.59 L23.681641,22.5646093 C27.777456,19.7913713 29.799165,15.9136673 29.826172,15.8614843 C29.9396226,15.6951255 30.0000005,15.4983921 30.0000005,15.2970313 C30.0000005,15.0714747 29.9234465,14.8525938 29.783203,14.6759373 C29.679012,14.5082113 23.918297,5.29703125 15,5.29703125 C12.469857,5.29703125 10.199331,6.04722345 8.234375,7.11734375 L1.7070312,0.59 Z M15,8.29703125 C18.866,8.29703125 22,11.4310313 22,15.2970313 C22,16.8689873 21.470043,18.3098793 20.59375,19.4767193 L17.701172,16.5841403 C17.889655,16.1948503 18,15.7598773 18,15.2970313 C18,13.6400313 16.657,12.2970313 15,12.2970313 C14.537154,12.2970313 14.102181,12.4073763 13.712891,12.5958593 L10.820312,9.70328125 C11.987152,8.82698775 13.428044,8.29703125 15,8.29703125 Z M4.9511719,9.37320315 C1.9791583,11.8731563 0.27498083,14.5840623 0.21875,14.6739843 C0.0773890257,14.8509064 0.000265439074,15.0705709 -1.0658141e-13,15.2970313 C-1.0658141e-13,15.4905304 0.0564899972,15.6798222 0.16210938,15.8419533 C0.16340458,15.8439108 0.164706668,15.8458638 0.16601562,15.8478123 C0.18320928,15.8832923 5.0188313,25.2970313 15,25.2970313 C16.85,25.2970313 18.520531,24.9705153 20.019531,24.4435153 L17.431641,21.8536723 C16.672641,22.1356723 15.856,22.2970313 15,22.2970313 C11.134,22.2970313 8,19.1630313 8,15.2970313 C8,14.4410313 8.1613594,13.6243903 8.4433594,12.8653903 L4.9511719,9.37320315 Z" 1090 id="Shape" 1091 fill=${this.color} 1092 fill-rule="nonzero" 1093 ></path> 1094 </g> 1095 </svg> 1096 `}};po.styles=[Es],Ps([g({type:String})],po.prototype,"color",2),Ps([g({type:String})],po.prototype,"size",2),po=Ps([E("eye-invisible-icon")],po);var fp=Object.defineProperty,mp=Object.getOwnPropertyDescriptor,Ne=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?mp(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&fp(t,r,i),i};const bp=["","-","traces"],vp="serving_size_select";let Se=class extends S{constructor(){super(...arguments),this.insightAnnotationSize=te.CENTGRAMS,this.errors={},this._servingSizeValue="",this.inputHiddenBySizeAndNutrientKey={"100g":{},serving:{}},this.debounceUpdatedInsight=Gd(()=>{this.onUpdateInsight()}),this.autocompleteValue="",this.onUpdateInsight=()=>{this._servingSizeValue=this.insight.data.nutrients.serving_size?.value||"",this.insightAnnotationSize=Object.keys(this.insight.data.nutrients).filter(e=>e.endsWith(gr[te.CENTGRAMS])).length?te.CENTGRAMS:te.SERVING,this.updateFormatedNutrients(),this.inputHiddenBySizeAndNutrientKey={[te.CENTGRAMS]:{},[te.SERVING]:{}}},this.getInputValueName=(e,t)=>`${e}_${t}`,this.getInputUnitName=(e,t)=>`${ui}${this.getInputValueName(e,t)}`}get countryCode(){return ss.get()}get nutrientsOrder(){return rn.getItem(this.countryCode)}connectedCallback(){super.connectedCallback(),this.onUpdateInsight()}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),["insight","nutriments-data"].includes(e)&&this.debounceUpdatedInsight()}processRobotoffData(e,t){const r=new Set;return Object.entries(t.data.nutrients).sort((e,t)=>e[1].start-t[1].start).forEach(([t,o])=>{let n;if(t.endsWith(gr[te.CENTGRAMS]))n=t.replace(gr[te.CENTGRAMS],""),e.robotoff[te.CENTGRAMS][n]=o;else{if(!t.endsWith(gr[te.SERVING]))return t===Jr?(e.robotoff.servingSize=o,void(e.servingSize=o?.value)):void console.log("Unknown nutrient key",t,o);n=t.replace(gr[te.SERVING],""),e.robotoff[te.SERVING][n]=o}r.add(n)}),r}processServingSize(e,t){t.serving_size&&(e.servingSize=t.serving_size)}processNutrimentData(e,t){const r=this.nutrientsOrder;console.log("nutrientsOrder",r);const o=new Set;return t.nutriments&&rp.forEach(n=>{const i=gr[n];Object.entries(t.nutriments).filter(([e])=>
1096e.endsWith(i)).forEach(([s,a])=>{const l=s.replace(i,"");if(!r?.[l])return;const c=`${l}${op}`;e[n][l]={value:a.toString(),unit:t.nutriments[c]},o.add(l)})}),o}initializeNutrientsStructure(){return{servingSize:void 0,keys:[],"100g":{},serving:{},robotoff:{servingSize:void 0,"100g":{},serving:{}}}}addKeysSet(e){const t=new Set(this.nutrients.keys);t.add(e),this.nutrients.keys=Array.from(t)}processKeysSet(e,t){const r=rn.getItem(this.countryCode)??{};Object.keys(r).filter(e=>r[e].displayInEditForm).filter(e=>"alcohol"!==e).forEach(e=>t.add(e));let o=Array.from(t);o=o.filter(e=>!/^nutrition-score/.test(e)).filter(e=>"energy"!==e),e.keys=Jd(this.countryCode,o)}updateFormatedNutrients(){const e=this.initializeNutrientsStructure();let t=new Set;return this.insight&&(t=this.processRobotoffData(e,this.insight)),this.nutrimentsData&&(this.processServingSize(e,this.nutrimentsData),this.processNutrimentData(e,this.nutrimentsData).forEach(e=>t.add(e))),this.processKeysSet(e,t),this.nutrients=e,this.nutrients}addRobotoffSuggestionForServingSize(){const e=this.nutrients?.robotoff.servingSize;e?.value&&(this.nutrients.servingSize=e.value,e.unit&&(this.nutrients.servingSize+=` ${e.unit}`),this.servingSizeInput.value=this.nutrients.servingSize,this.requestUpdate())}setUnitInput(e,t,r){if(ol(e).includes(r??"")){const o=this.shadowRoot.querySelector(`select[name="${this.getInputUnitName(e,t)}"]`);o&&(o.value=r??"")}}addRobotoffSuggestion(e,t){const r=this.nutrients?.robotoff[t][e];r?.value&&(Vd(this.nutrients,`${t}.${e}.value`,r.value),r.unit&&(this.nutrients[t][e].unit=r.unit),this.setUnitInput(e,t,r.unit),this.requestUpdate())}renderRobotoffSuggestionForNutrient(e,t){const r=this.nutrients?.robotoff[t][e],o=this.nutrients[t][e];return this.renderRobotoffSuggestion(()=>this.addRobotoffSuggestion(e,t),r,o)}renderRobotoffSuggestionForServingSize(){const e=this.nutrients.robotoff.servingSize??{value:""},t=e.unit?`${e.value} ${e.unit}`:e.value,r={value:this.nutrients.servingSize};return this.renderRobotoffSuggestion(()=>this.addRobotoffSuggestionForServingSize(),{value:t},r)}renderRobotoffSuggestion(e,t,r){const o=$a(t?.value??""),n=$a(r?.value??"");if(!o||n===o&&(!t.unit||r?.unit===t.unit))return D;const i=`${t.value} ${t.unit??""}`;return c`<button 1097 type="button" 1098 class="alert success with-icons" 1099 @click=${()=>e()} 1100 title=${d(Re`Replace current value by ${i}`)} 1101 > 1102 <suggestion-icon size="16px" color=${Ai}></suggestion-icon> 1103 <span>${i}</span> 1104 <add-icon size="16px" color=${Ai}></add-icon> 1105 </button>`}renderRows(){const e=this.nutrients;return e.keys.map(t=>c` 1106 <div> 1107 <div> 1108 ${this.renderInputs(t,this.insightAnnotationSize,e[this.insightAnnotationSize][t])} 1109 </div> 1110 1111 <div>${this.renderRobotoffSuggestionForNutrient(t,this.insightAnnotationSize)}</div> 1112 </div> 1113 `)}renderUnit(e,t,r,o=!1){const n=ol(e,r?.unit),i=this.getInputUnitName(e,t),s=r?.unit??nc(e),a="select chocolate unit-select";return n.length>1?c` 1114 <select 1115 name=${i} 1116 class=${a} 1117 style=${pi(ya)} 1118 ?disabled=${o} 1119 > 1120 ${n.map(e=>c`<option value="${e}" ?selected=${e===s}>${e}</option>`)} 1121 </select> 1122 `:n[0]?c`<input 1123 type="hidden" 1124 name="${i}" 1125 .value="${n[0]}" 1126 ?disabled=${o} 1127 /> 1128 <select 1129 class=${a} 1130 disabled 1131 style=${pi(ya)} 1132 > 1133 <option value="${n[0]}" selected>${n[0]}</option> 1134 </select>`:D}renderInputs(e,t,r){const o=this.getInputValueName(e,t),n=r?.value.toString()??"",i=ep(e,Et.get()),s=this.inputHiddenBySizeAndNutrientKey[t][e];return c` 1135 <div class="inputs-wrapper"> 1136 <div> 1137 <label class="input-label"> 1138 <div>${i}</div> 1139 ${s?c` 1140 <input type="hidden" name="${o}" value="-" /> 1141 <input 1142 type="text" 1143 value="-" 1144 title="${d("value")}" 1145 class="input input-nutritional-value cappucino" 1146 disabled 1147 /> 1148 `:c`<input 1149 type="text" 1150 name="${o}" 1151 .value="${n}"
1152 title="${d("value")}" 1153 class="input input-nutritional-value cappucino" 1154 />`} 1155 </label> 1156 </div> 1157 1158 <div title=${d("unit")} class="unit-wrapper"> 1159 ${this.renderUnit(e,t,r,s)} 1160 </div> 1161 ${this.renderToggleNutrientButton(t,e)} 1162 </div> 1163 ${this.errors[o]?c`<span class="input-error-message" role="alert">${this.errors[o]}</span>`:D} 1164 `}emitSubmitEvent(e){this.dispatchEvent(new CustomEvent(we.SUBMIT,{bubbles:!0,composed:!0,detail:e}))}isUnitInput(e){return e.startsWith(ui)}validateInputValue(e){const t=e?.replace(" ","").replace(",",".")??"";if(bp.includes(t))return{value:t};const r=Number(t.replace(/^</gm,""));return isNaN(r)?{error:d("Error: Invalid value.")}:{value:t}}validateFormData(e){this.errors={};for(const[t,r]of Object.entries(e)){if(t===Jr)continue;const{error:e,value:o}=this.validateInputValue(r.value);e?this.errors[t]=e:r.value=o}return Object.keys(this.errors).length>0?{isValid:!1,validatedData:e}:{isValid:!0,validatedData:e}}submitFormData(e,t){const r={},o=e.entries(),n=this.servingSizeInput.value;r[Jr]={value:n,unit:null};for(const[e,t]of o){let o=e;const n=this.isUnitInput(o);n&&(o=o.replace(ui,"")),r[o]||(r[o]={value:"",unit:null}),r[o][n?"unit":"value"]=t}const{isValid:i,validatedData:s}=this.validateFormData(r);i&&this.emitSubmitEvent({type:t,data:s,insightId:this.insight.id})}onInsightAnnotationSizeChange(e){const t=e.target.value;this.insightAnnotationSize=t}onSkip(){this.dispatchEvent(new CustomEvent(we.SKIP))}onRefuse(){this.dispatchEvent(new CustomEvent(we.REFUSE))}renderSubmitRow(){const e=!!this.loading,t=e&&[z.ACCEPT,z.ACCEPT_AND_ADD_DATA].includes(this.loading);return c` 1165 <div class="submit-row"> 1166 <!-- Trigger the submit event manually because lit component doesn't dispatch the submit event even if button is type submit --> 1167 <loading-button 1168 type="submit" 1169 class="success-loading-button" 1170 css-classes="button success-button" 1171 .loading=${t} 1172 .disabled=${e} 1173 @click=${()=>ls(this.form)} 1174 label="${d("Submit")}" 1175 ></loading-button> 1176 <loading-button 1177 .loading=${this.loading===z.SKIP} 1178 .disabled=${e} 1179 css-classes="button white-button" 1180 @click=${this.onSkip} 1181 label=${d("Skip")} 1182 ></loading-button> 1183 <loading-button 1184 css-classes="button danger-button" 1185 .loading=${this.loading===z.REFUSE} 1186 .disabled=${e} 1187 @click=${this.onRefuse} 1188 label=${d("Invalidate image")} 1189 ></loading-button> 1190 </div> 1191 `}onChangeServingSize(e){const t=e.target.value;this._servingSizeValue=t}renderServingSizeInput(){const e=this.nutrients.servingSize??"";return c`<div class=""> 1192 <label class="serving-size-wrapper flex align-center flex-col"> 1193 <span>${d("Serving size")}</span> 1194 <input 1195 class="input cappucino" 1196 name=${Jr} 1197 type="text" 1198 .value=${e} 1199 @change=${this.onChangeServingSize} 1200 /> 1201 </label> 1202 ${this.renderRobotoffSuggestionForServingSize()} 1203 </div> `}renderInsightAnnotationSizeSelection(){return c` 1204 <div class="serving-size-selection"> 1205 <label> 1206 <span>${d("Nutrition facts are displayed on the packaging:")}</span> 1207 <select 1208 class="select" 1209 name="${vp}" 1210 @change=${this.onInsightAnnotationSizeChange} 1211 style=${pi(Rd)} 1212 > 1213 <option 1214 value="${te.CENTGRAMS}" 1215 ?selected=${this.insightAnnotationSize===te.CENTGRAMS} 1216 > 1217 ${d("per 100g")} 1218 </option> 1219 <option 1220 value="${te.SERVING}" 1221 ?selected=${this.insightAnnotationSize===te.SERVING} 1222 > 1223 <span>${d(Re`per specified serving "${this._servingSizeValue}"`)}</span> 1224 </option> 1225 </select> 1226 </label> 1227 </div> 1228 `}onAddNutrient(e){const t=e.detail.value;this.autocompleteValue=e.detail.label,this.addKeysSet(t),requestAnimationFrame(()=>{this.autocompleteValue=""})}onSubmit(e){e.preventDefault(),e.stopPropagation();const t=new FormData(e.target);this.submitFormData(t,this.insightAnnotationSize)}onAutocompleteInput(e){this.autocompleteValue=e.detail.value}
1228renderAddNutrientRow(e){const t=Et.get(),r=Ju.get().filter(t=>!e.includes(t.id)).map(e=>({id:e.id,label:oc(e,t),value:e.id})).sort((e,t)=>e.label.localeCompare(t.label));return 0===r.length?D:c` 1229 <div class="add-nutrient-row"> 1230 <autocomplete-input 1231 placeholder="${d("Add a nutrient")}" 1232 .value=${this.autocompleteValue} 1233 @input-change=${e=>this.onAutocompleteInput(e)} 1234 .suggestions=${r} 1235 @suggestion-select=${this.onAddNutrient} 1236 ></autocomplete-input> 1237 </div> 1238 `}renderTable(){const e=this.nutrients;return c` 1239 <div> 1240 <div class="nutrient-rows">${this.renderRows()}</div> 1241 <div>${this.renderAddNutrientRow(e.keys)}</div> 1242 <div>${this.renderSubmitRow()}</div> 1243 </div> 1244 `}toggleNutrient(e,t){this.inputHiddenBySizeAndNutrientKey[e][t]=!this.inputHiddenBySizeAndNutrientKey[e][t],this.requestUpdate()}renderToggleNutrientButton(e,t){const r=this.inputHiddenBySizeAndNutrientKey[e][t];return c` 1245 <div class="toggle-nutrient-button-wrapper"> 1246 <button 1247 type="button" 1248 class="button chocolate-button" 1249 @click=${()=>this.toggleNutrient(e,t)} 1250 > 1251 ${r?c`<eye-invisible-icon size="18px"></eye-invisible-icon>`:c` <eye-visible-icon size="18px"></eye-visible-icon>`} 1252 </button> 1253 </div> 1254 `}render(){return c` 1255 <div class="nutrients-table"> 1256 <div>${this.renderServingSizeInput()}</div> 1257 <div>${this.renderInsightAnnotationSizeSelection()}</div> 1258 1259 <form @submit=${this.onSubmit}> 1260 <div class="flex justify-center">${this.renderTable()}</div> 1261 </form> 1262 </div> 1263 `}};Se.styles=[...Oe([B.Chocolate]),Uu,ec,On,Nn,$` 1264 :host { 1265 font-weight: normal; 1266 font-size: 1rem; 1267 } 1268 .inputs-wrapper { 1269 display: grid; 1270 grid-template-columns: 1fr auto auto; 1271 align-items: end; 1272 gap: 0.75rem; 1273 } 1274 .unit-wrapper { 1275 width: 5rem; 1276 } 1277 1278 .unit-wrapper select { 1279 height: 2.5rem; 1280 border-radius: 2.5rem; 1281 padding-left: 1rem; 1282 padding-right: 1rem; 1283 } 1284 .serving-size-wrapper { 1285 gap: 0.3rem; 1286 } 1287 .serving-size-wrapper { 1288 font-weight: bold; 1289 } 1290 .serving-size-wrapper input { 1291 width: 12rem; 1292 text-align: center; 1293 box-sizing: border-box; 1294 } 1295 1296 .submit-row { 1297 display: grid; 1298 grid-template-columns: 1fr 1fr; 1299 gap: 0.5rem; 1300 } 1301 1302 .submit-row .success-loading-button { 1303 grid-column: 1 / 3; 1304 } 1305 .input-error-message { 1306 display: block; 1307 box-sizing: border-box; 1308 margin-top: 0.2rem; 1309 width: 100%; 1310 font-size: 0.7rem; 1311 color: var(--error-color, red); 1312 } 1313 1314 .serving-size-selection label { 1315 display: flex; 1316 flex-direction: column; 1317 text-align: center; 1318 } 1319 .serving-size-selection select { 1320 margin-top: 0.25rem; 1321 padding: 0.5rem 1rem; 1322 } 1323 .add-nutrient-row { 1324 margin-top: 1rem; 1325 margin-bottom: 1rem; 1326 } 1327 .add-nutrient-row select { 1328 padding: 0.5rem 1rem; 1329 width: 100%; 1330 } 1331 1332 .input-label { 1333 display: flex; 1334 flex-direction: column; 1335 gap: 0.2rem; 1336 font-weight: bold; 1337 font-size: 0.9rem; 1338 } 1339 .info { 1340 display: block; 1341 padding: 0; 1342 width: 100%; 1343 } 1344 1345 .nutrient-rows { 1346 display: flex; 1347 flex-direction: column; 1348 gap: 0.75rem; 1349 } 1350 form, 1351 .serving-size-selection { 1352 max-width: 20rem; 1353 width: 100%; 1354 } 1355 .nutrients-table { 1356 display: flex; 1357 flex-direction: column; 1358 align-items: center; 1359 gap: 1rem; 1360 } 1361 .alert { 1362 padding: 0.4rem; 1363 margin-bottom: 0; 1364 } 1365 .toggle-nutrient-button-wrapper button { 1366 display: flex; 1367 align-items: center; 1368 justify-content: center; 1369 width: 40px; 1370 height: 40px; 1371 border-radius: 50%; 1372 } 1373 `],Ne([g({type:Object,attribute:"nutriments-data",reflect:!0})],Se.prototype,"nutrimentsData",2),Ne([g({type:Object,reflect:!0})],Se.prototype,"insight",2),Ne([b()],Se.prototype,"insightAnnotationSize",2),Ne([b()],Se.prototype,"errors",2),Ne([g({type:Number,reflect:!0})],Se.prototype,"loading",2),Ne([b()],Se.prototype,"_servingSizeValue",2),Ne([b()],Se.prototype,"nutrients",2),Ne([b()],Se.prototype,"inputHiddenBySizeAndNutrientKey",2),Ne([b()],Se.prototype,"debounceUpdatedInsight",2),Ne([b()],Se.prototype,"autocompleteValue",2),Ne([Dt("form")],Se.prototype,"form",2),Ne([Dt(`input[name='${Jr}']`)],Se.prototype,"servingSizeInput",2),Se=Ne([E("robotoff-nutrient-extraction-form"),H()],Se);var pn=(e=>(e.IMAGE_INGREDIENTS_URL="image_ingredients_url",e.PRODUCT_NAME="product_name",e.NUTRIMENTS="nutriments",e))(pn||{});const wp=e=>{if(e)return e.replace(/400.jpg$/,"full.jpg")},gi=e=>`${Nd}/images/attributes/dist/${e}`,sc=e=>e??D;var yp=Object.defineProperty,xp=(e,t,r,o)=>{for(var n,i=void 0,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(t,r,i)||i);return i&&yp(t,r,i),i};const zn=e=>{class t extends e{get _languageCodes(){return this.languageCodes||[Et.get()]}}return xp([g({type:Array,attribute:"language-codes",reflect:!0})],t.prototype,"languageCodes"),t};var $p=Object.defineProperty,_p=(e,t,r,o)=>{for(var n,i=void 0,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(t,r,i)||i);return i&&$p(t,r,i),i};const kp=e=>{class t extends e{get _countryCode(){return this.countryCode||ss.get()}}return _p([g({type:String,attribute:"country-codes",reflect:!0})],t.prototype,"countryCode"),t};var Cp=Object.defineProperty,Sp=Object.getOwnPropertyDescriptor,Os=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Sp(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Cp(t,r,i),i};let go=class extends S{constructor(){super(...arguments),this.color="currentColor",this.size="16px"}render(){return c` 1374 <svg 1375 width=${this.size} 1376 height=${this.size}
1377 viewBox="0 0 16 16" 1378 version="1.1" 1379 xmlns="http://www.w3.org/2000/svg" 1380 xmlns:xlink="http://www.w3.org/1999/xlink" 1381 > 1382 <title>External link</title> 1383 <g id="External-link" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 1384 <path 1385 d="M15.085556,0.000370762406 C15.0524534,0.00141697617 15.0194351,0.00431337214 14.9866559,0.00904638777 L10.6610695,0.00904638777 C10.3406923,0.00451536035 10.0426935,0.172842877 9.88118266,0.44957304 C9.71967181,0.726303203 9.71967181,1.0685622 9.88118266,1.34529236 C10.0426935,1.62202252 10.3406923,1.79035004 10.6610695,1.78581901 L12.9583327,1.78581901 L4.70276137,10.0415655 C4.47068619,10.2643881 4.37720105,10.5952667 4.45835987,10.906593 C4.53951869,11.2179193 4.78263955,11.4610453 5.09395927,11.5422057 C5.40527898,11.6233662 5.73615053,11.529879 5.95896837,11.2977988 L14.2145393,3.04205278 L14.2145393,5.33936426 C14.2100084,5.65974827 14.3783323,5.95775341 14.6550566,6.11926769 C14.9317809,6.28078197 15.2740326,6.28078197 15.5507569,6.11926769 C15.8274812,5.95775341 15.9958051,5.65974827 15.9912742,5.33936426 L15.9912742,1.0102161 C16.0270842,0.751330008 15.9470966,0.489808079 15.7725984,0.295248373 C15.5981001,0.100688668 15.3467928,-0.00717209219 15.085556,0.000370762406 Z M1.77739509,0.0089571655 C0.806353686,0.0089571655 0.00066020321,0.814756982 0.00066020321,1.78581901 L0.00066020321,14.2232274 C0.00066020321,15.1942896 0.806353686,16 1.77739509,16 L14.2145393,16 C15.1855809,16 15.9913634,15.1942896 15.9913634,14.2232274 L15.9913634,8.89290951 C15.9958051,8.57252549 15.8274812,8.27452035 15.5507569,8.11300607 C15.2740326,7.95149179 14.9317809,7.95149179 14.6550566,8.11300607 C14.3783323,8.27452035 14.2100084,8.57252549 14.2145393,8.89290951 L14.2145393,14.2232274 L1.77739509,14.2232274 L1.77739509,1.78581901 L7.10759976,1.78581901 C7.42797696,1.79035004 7.72597578,1.62202252 7.88748663,1.34529236 C8.04899748,1.0685622 8.04899748,0.726303203 7.88748663,0.44957304 C7.72597578,0.172842877 7.42797696,0.00451536035 7.10759976,0.0089571655 L1.77739509,0.0089571655 Z" 1386 id="Shape" 1387 fill=${this.color} 1388 fill-rule="nonzero" 1389 ></path> 1390 </g> 1391 </svg> 1392 `}};go.styles=[Es],Os([g({type:String})],go.prototype,"color",2),Os([g({type:String})],go.prototype,"size",2),go=Os([E("external-link-icon")],go);var Ep=Object.defineProperty,Tp=Object.getOwnPropertyDescriptor,ac=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Tp(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Ep(t,r,i),i};let gn=class extends S{get productUrl(){return`${cs.get()}/product/${this.productCode}`}render(){return this.productCode?c` 1393 <a href="${this.productUrl}" target="_blank" rel="noopener noreferrer"> 1394 <button class="link-button button with-icon small"> 1395 <external-link-icon></external-link-icon> 1396 <span>${d("View Product")}</span> 1397 </button> 1398 </a> 1399 `:(console.error("Product code is required"),D)}};gn.styles=[Oe([B.LINK]),$` 1400 :host { 1401 display: inline-block; 1402 } 1403 `],ac([g({type:String,attribute:"product-code",reflect:!0})],gn.prototype,"productCode",2),gn=ac([E("product-link-button")],gn);var Ap=Object.defineProperty,Ip=(e,t,r,o)=>{for(var n,i=void 0,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(t,r,i)||i);return i&&Ap(t,r,i),i};const Ds=e=>{class t extends e{constructor(){super(...arguments),this.displayProductLink=!1}renderProductLink(e){return this.displayProductLink?c`<product-link-button product-code="${e}"></product-link-button>`:D}}return Ip([g({type:Boolean,attribute:"display-product-link",reflect:!0})],t.prototype,"displayProductLink"),t};var Pp=Object.defineProperty,Op=Object.getOwnPropertyDescriptor,Co=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Op(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Pp(t,r,i),i};const lc=700;let Wt=class extends(Ds(zn(kp(Pn(S,void 0))))){constructor(){super(...arguments),this.productCode=void 0,this.insightsIds=[],this.currentInsightIndex=0,this._insightsTask=new tr(this,{task:async([e],{})=>{this.emitNutrientEvent(V.LOADING);const[t]=await Promise.all([Zu(e,{lc:this._languageCodes}),tp(),Qd(this._countryCode)]);this.insightsIds=t.map(e=>e.id),this.insightsIds.length?(this.emitNutrientEvent(V.HAS_DATA),await this.loadInsight(0)):this.emitNutrientEvent(V.NO_DATA)},args:()=>
1403[this.productCode,this.countryCode,...this._languageCodes]})}get currentInsightId(){return this.insightsIds[this.currentInsightIndex]}get currentInsight(){return rc.getItem(this.currentInsightId)}emitNutrientEvent(e){const t={state:e},r=new CustomEvent(we.NUTRIENT_STATE,{detail:t,bubbles:!0,composed:!0});this.dispatchEvent(r)}async loadInsight(e){if(e>=this.insightsIds.length)return void this.emitNutrientEvent(V.FINISHED);this.currentInsightIndex=e;const t=this.currentInsight;await this.getProductNutriments(t.barcode)}async getProductNutriments(e){this.nutrimentsData=void 0;const t=await Nl(e,{fields:[pn.NUTRIMENTS],lc:Et.get()});return this.nutrimentsData=t.product,t.product.nutriments}renderImage(e){if(!e?.source_image)return D;const t=ki(e.source_image);return c` 1404 <div class="image-wrapper"> 1405 <zoomable-image 1406 src=${t} 1407 .size="${{height:"35vh",width:"100%","max-width":"700px"}}" 1408 show-buttons 1409 ></zoomable-image> 1410 </div> 1411 `}async afterInsightAnnotation(){await this.hideLoading(),this.emitNutrientEvent(V.ANNOTATED),this.loadInsight(this.currentInsightIndex+1)}async onSubmit(e){this.showLoading(z.ACCEPT_AND_ADD_DATA),await Xu(e.detail),await this.afterInsightAnnotation()}async onRefuse(){this.showLoading(z.REFUSE),await el(this.currentInsightId,z.REFUSE),await this.afterInsightAnnotation()}async onSkip(){this.showLoading(z.SKIP),await el(this.currentInsightId,z.SKIP),await this.afterInsightAnnotation()}renderHeader(e){return c` 1412 <div> 1413 <h2>${d("Help us correct the nutritional information")}</h2> 1414 ${this.renderProductLink(e.barcode)} 1415 </div> 1416 `}render(){return this._insightsTask.render({pending:()=>c`<off-wc-loader></off-wc-loader>`,complete:()=>{const e=this.currentInsight;return e?c` 1417 <div class="nutrients" part="nutrients"> 1418 ${this.renderHeader(e)} 1419 <div part="nutrients-content-wrapper" class="nutrients-content-wrapper"> 1420 ${this.renderImage(e)} 1421 <robotoff-nutrient-extraction-form 1422 loading=${sc(this.loading)} 1423 .nutrimentsData="${this.nutrimentsData}" 1424 .insight="${e}" 1425 @submit="${this.onSubmit}" 1426 @refuse="${this.onRefuse}" 1427 @skip="${this.onSkip}" 1428 ></robotoff-nutrient-extraction-form> 1429 </div> 1430 </div> 1431 `:c`<slot name="no-insight"></slot>`},error:e=>c`<p>Error: ${e}</p>`})}};Wt.styles=[or,On,...Oe([B.LINK]),$` 1432 .image-wrapper { 1433 position: sticky; 1434 z-index: 1; 1435 top: 1rem; 1436 display: flex; 1437 align-items: center; 1438 margin-bottom: 1rem; 1439 background-color: white; 1440 box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); 1441 border-radius: 5px; 1442 padding-left: 1rem; 1443 padding-right: 1rem; 1444 padding-bottom: 1rem; 1445 box-sizing: border-box; 1446 max-width: ${lc}px; 1447 width: 100%; 1448 } 1449 1450 .nutrients { 1451 container-type: inline-size; 1452 } 1453 1454 .nutrients-content-wrapper { 1455 position: relative; 1456 display: flex; 1457 align-items: start; 1458 gap: 0.5rem 5rem; 1459 } 1460 1461 @container (max-width: ${Dn.MD}px) { 1462 .nutrients-content-wrapper { 1463 flex-direction: column; 1464 justify-content: center; 1465 align-items: center; 1466 } 1467 } 1468 .nutrients product-link-button { 1469 margin-bottom: 1rem; 1470 } 1471 `],Co([g({type:String,attribute:"product-code",reflect:!0})],Wt.prototype,"productCode",2),Co([b()],Wt.prototype,"insightsIds",2),Co([b()],Wt.prototype,"currentInsightIndex",2),Co([b()],Wt.prototype,"nutrimentsData",2),Wt=Co([E("robotoff-nutrient-extraction"),H()],Wt);const cc=new je({});async function Dp(e,t={}){let r;const o={...t,insight_types:Xe.ingredient_spellcheck,annotated:!1};e&&(o.barcode=e);try{r=await rt.insights(o),r.insights.forEach(e=>{cc.setItem(e.id,e)})}catch(e){return console.error("Error fetching spellcheck insights:",e),[]}return r.insights}var Mp=Object.getOwnPropertyDescriptor,Rp=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Mp(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(i)||i);return i};let zi=class extends S{render(){return c` 1472 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> 1473 <path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z" /> 1474 </svg> 1475 `}};zi.styles=$` 1476 :host { 1477 display: inline-block;
1478 width: 20px; 1479 height: 20px; 1480 } 1481 svg { 1482 width: 100%; 1483 height: 100%; 1484 } 1485 `,zi=Rp([E("check-icon")],zi);var Np=Object.getOwnPropertyDescriptor,Lp=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Np(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(i)||i);return i};let Ui=class extends S{render(){return c` 1486 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> 1487 <path 1488 d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" 1489 /> 1490 </svg> 1491 `}};Ui.styles=$` 1492 :host { 1493 display: inline-block; 1494 width: 20px; 1495 height: 20px; 1496 } 1497 svg { 1498 width: 100%; 1499 height: 100%; 1500 } 1501 `,Ui=Lp([E("cross-icon")],Ui);var zp=Object.getOwnPropertyDescriptor,Up=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?zp(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(i)||i);return i};let Fi=class extends S{render(){return c` 1502 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> 1503 <path d="M6 18l8.5-6L6 6v12zM16 6v12h2V6h-2z" /> 1504 </svg> 1505 `}};Fi.styles=$` 1506 :host { 1507 display: inline-block; 1508 width: 20px; 1509 height: 20px; 1510 } 1511 svg { 1512 width: 100%; 1513 height: 100%; 1514 } 1515 `,Fi=Up([E("skip-icon")],Fi);var Fp=Object.getOwnPropertyDescriptor,jp=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Fp(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(i)||i);return i};let ji=class extends S{render(){return c` 1516 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> 1517 <path 1518 d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" 1519 /> 1520 </svg> 1521 `}};ji.styles=$` 1522 :host { 1523 display: inline-block; 1524 width: 20px; 1525 height: 20px; 1526 } 1527 svg { 1528 width: 100%; 1529 height: 100%; 1530 } 1531 `,ji=jp([E("edit-icon")],ji);var Bp=Object.defineProperty,Vp=Object.getOwnPropertyDescriptor,dc=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Vp(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Bp(t,r,i),i};let fn=class extends S{constructor(){super(...arguments),this.customStyles={}}render(){return c` 1532 <svg 1533 xmlns="http://www.w3.org/2000/svg"
1534 viewBox="0 0 24 24" 1535 style="${_r(this.customStyles)}" 1536 fill="currentColor" 1537 width="1em" 1538 height="1em" 1539 display="inline-block" 1540 font-size="24px" 1541 transition="fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms" 1542 flex-shrink="0" 1543 aria-hidden="true" 1544 focusable="false" 1545 > 1546 <path d="M0 0h24v24H0z" fill="none" /> 1547 <path 1548 d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" 1549 /> 1550 </svg> 1551 `}};fn.styles=$` 1552 :host { 1553 display: inline-block; 1554 width: 20px; 1555 height: 20px; 1556 } 1557 svg { 1558 width: 100%; 1559 height: 100%; 1560 } 1561 `,dc([g({type:Object,attribute:"custom-styles"})],fn.prototype,"customStyles",2),fn=dc([E("info-icon")],fn);var Hp=Object.getOwnPropertyDescriptor,Gp=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Hp(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(i)||i);return i};let Bi=class extends S{render(){return c` 1562 <button class="info-button"> 1563 <info-icon .custom-styles="${{fill:"white"}}"></info-icon> 1564 </button> 1565 `}};Bi.styles=$` 1566 .info-button { 1567 display: flex; 1568 align-items: center; 1569 justify-content: center; 1570 background-color: ${lo}; 1571 color: white; 1572 border: none; 1573 border-radius: 50%; 1574 cursor: pointer; 1575 width: 30px; 1576 height: 30px; 1577 padding: 5px; 1578 1579 @media (min-width: ${Dn.SM}px) { 1580 width: 40px; 1581 height: 40px; 1582 padding: 8px; 1583 } 1584 } 1585 button:hover { 1586 opacity: 0.8; 1587 } 1588 `,Bi=Gp([E("info-button")],Bi);const hc=$` 1589 .popover-wrapper { 1590 position: relative; 1591 cursor: pointer; 1592 display: inline-block; 1593 } 1594 1595 .popover { 1596 position: absolute; 1597 z-index: 10; 1598 background-color: ${xr}; 1599 border: 1px solid ${Ze}; 1600 border-radius: 4px; 1601 box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); 1602 padding: 0.75rem; 1603 max-width: 300px; 1604 width: 100%; 1605 height: auto; 1606 top: 100%; 1607 left: 50%; 1608 transform: translateX(-50%); 1609 margin-top: 0.5rem; 1610 white-space: normal; 1611 text-decoration: none; 1612 color: inherit; 1613 } 1614 1615 .popover::before, 1616 .popover::after { 1617 content: ""; 1618 position: absolute; 1619 bottom: 100%; 1620 left: 50%; 1621 transform: translateX(-50%); 1622 border: solid transparent; 1623 } 1624 1625 .popover::before { 1626 border-bottom-color: ${Ze}; 1627 border-width: 8px; 1628 margin-left: 0px; 1629 } 1630 1631 .popover::after { 1632 border-bottom-color: ${xr}; 1633 border-width: 7px; 1634 margin-left: 0px; 1635 } 1636 1637 .popover-content { 1638 display: flex; 1639 flex-direction: column; 1640 gap: 0.5rem; 1641 } 1642 1643 .popover-buttons { 1644 display: flex; 1645 gap: 0.5rem; 1646 justify-content: flex-end; 1647 margin-top: 0.5rem; 1648 } 1649 1650 /* Position variants */ 1651 .popover.popover-top { 1652 top: auto; 1653 bottom: 100%; 1654 margin-top: 0; 1655 margin-bottom: 0.5rem; 1656 } 1657 1658 .popover.popover-top::before, 1659 .popover.popover-top::after { 1660 top: 100%; 1661 bottom: auto; 1662 } 1663 1664 .popover.popover-top::before { 1665 border-top-color: ${Ze}; 1666 border-bottom-color: transparent; 1667 } 1668 1669 .popover.popover-top::after { 1670 border-top-color: ${xr}; 1671 border-bottom-color: transparent; 1672 } 1673 1674 .popover.popover-left { 1675 left: auto; 1676 right: 100%; 1677 transform: translateY(-50%); 1678 top: 50%; 1679 bottom: auto; 1680 margin-top: 0; 1681 margin-right: 1rem; 1682 } 1683 1684 .popover.popover-left::before, 1685 .popover.popover-left::after { 1686 left: 100%; 1687 right: auto; 1688 transform: translateY(-50%); 1689 top: 50%; 1690 bottom: auto; 1691 border-width: 8px 0 8px 8px; 1692 border-color: transparent transparent transparent ${Ze}; 1693 } 1694 1695 .popover.popover-right { 1696 left: auto; 1697 right: 0; 1698 transform: none; 1699 } 1700 1701 .popover.popover-right::before, 1702 .popover.popover-right::after { 1703 left: auto; 1704 right: 20px; 1705 transform: none; 1706 } 1707 1708 .popover .button { 1709 display: flex; 1710 } 1711`,uc=$` 1712 .text-section { 1713 padding-bottom: 0.5rem; 1714 border-bottom: 1px solid ${ps}; 1715 box-shadow: 0 0.5rem 2px -2px rgba(0, 0, 0, 0.1); 1716 } 1717 1718 h2 { 1719 font-size: 1.2rem; 1720 margin-bottom: 0.5rem; 1721 } 1722 1723 .text-content { 1724 border-radius: 4px; 1725 white-space: pre-wrap; 1726 line-height: 1.5; 1727 } 1728 1729 .deletion { 1730 background-color: ${Pi}; 1731 } 1732 1733 .addition { 1734 background-color: ${nn}; 1735 } 1736 1737 .line-through { 1738 text-decoration: line-through; 1739 } 1740`;class qp extends Dd{constructor(e){super(e),this.element=null,this.callback=null,this.clickIsTriggered=!1,this.handleClick=()=>{this.clickIsTriggered?this.clickIsTriggered=!1:this.callback?.()},this.element=e.element,this.addEventListener(),this.clickIsTriggered=!1}render(e){return this.callback=e,this.element}update(e,[t]){return this.element=e.element,this.render(t)}catchEventClickFromElement(){this.clickIsTriggered=!0}disconnected(){this.removeEventListener()}addEventListener(){requestAnimationFrame(()=>{this.element.addEventListener("click",()=>this.catchEventClickFromElement()),document.addEventListener("click",this.handleClick)})}removeEventListener(){this.element.removeEventListener("click",()=>this.catchEventClickFromElement),document.removeEventListener("click",this.handleClick)}}const Wp=xo(qp);var se=(e=>(e.ADDED="added",e.REMOVED="removed",e.CHANGED="changed",e))(se||{});class Vi extends $o{constructor(e){if(super(e),this.it=D,e.type!==Tn.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===D||null==e)return this._t=void 0,this.it=e;if(e===es)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Vi.directiveName="unsafeHTML",Vi.resultType=1;const Kp=xo(Vi),{entries:pc,setPrototypeOf:nl,isFrozen:Yp,getPrototypeOf:Zp,getOwnPropertyDescriptor:Xp}=Object;let{freeze:Ee,seal:Ue,create:gc}=Object,{apply:Hi,construct:Gi}=typeof Reflect<"u"&&Reflect;Ee||(Ee=function(e){return e}),Ue||(Ue=function(e){return e}),Hi||(Hi=function(e,t){for(var r=arguments.length,o=new Array(r>2?r-2:0),n=2;n<r;n++)o[n-2]=arguments[n];return e.apply(t,o)}),Gi||(Gi=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];return new e(...r)});const qo=Te(Array.prototype.forEach),Qp=Te(Array.prototype.lastIndexOf),il=Te(Array.prototype.pop),qr=Te(Array.prototype.push),Jp=Te(Array.prototype.splice),Xo=Te(String.prototype.toLowerCase),fi=Te(String.prototype.toString),mi=Te(String.prototype.match),Wr=Te(String.prototype.replace),eg=Te(String.prototype.indexOf),tg=Te(String.prototype.trim),Be=Te(Object.prototype.hasOwnProperty),_e=Te(RegExp.prototype.test),Kr=rg(TypeError);function Te(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,o=new Array(r>1?r-1:0),n=1;n<r;n++)o[n-1]=arguments[n];return Hi(e,t,o)}}function rg(e){return function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return Gi(e,r)}}function M(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Xo;nl&&nl(e,null);let o=t.length;for(;o--;){let n=t[o];if("string"==typeof n){const e=r(n);e!==n&&(Yp(t)||(t[o]=e),n=e)}e[n]=!0}return e}function og(e){for(let t=0;t<e.length;t++)Be(e,t)||(e[t]=null);return e}function lt(e){const t=gc(null);for(const[r,o]of pc(e))Be(e,r)&&(Array.isArray(o)?t[r]=og(o):o&&"object"==typeof o&&o.constructor===Object?t[r]=lt(o):t[r]=o);return t}function Yr(e,t){for(;null!==e;){const r=Xp(e,t);if(r){if(r.get)return Te(r.get);if("function"==typeof r.value)return Te(r.value)}e=Zp(e)}return function(){return null}}const sl=Ee(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),bi=Ee(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","slot","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),vi=Ee(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ng=Ee(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),wi=Ee(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ig=Ee(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),al=Ee(["#text"]),ll=Ee(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","
1740spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),yi=Ee(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),cl=Ee(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Wo=Ee(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),sg=Ue(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ag=Ue(/<%[\w\W]*|[\w\W]*%>/gm),lg=Ue(/\$\{[\w\W]*/gm),cg=Ue(/^data-[\-\w.\u00B7-\uFFFF]+$/),dg=Ue(/^aria-[\-\w]+$/),fc=Ue(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),hg=Ue(/^(?:\w+script|data):/i),ug=Ue(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),mc=Ue(/^html$/i),pg=Ue(/^[a-z][.\w]*(-[.\w]+)+$/i);var dl=Object.freeze({__proto__:null,ARIA_ATTR:dg,ATTR_WHITESPACE:ug,CUSTOM_ELEMENT:pg,DATA_ATTR:cg,DOCTYPE_NAME:mc,ERB_EXPR:ag,IS_ALLOWED_URI:fc,IS_SCRIPT_OR_DATA:hg,MUSTACHE_EXPR:sg,TMPLIT_EXPR:lg});const Zr={element:1,text:3,progressingInstruction:7,comment:8,document:9},gg=function(){return typeof window>"u"?null:window},fg=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let r=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(r=t.getAttribute(o));const n="dompurify"+(r?"#"+r:"");try{return e.createPolicy(n,{createHTML:e=>e,createScriptURL:e=>e})}catch{return console.warn("TrustedTypes policy "+n+" could not be created."),null}},hl=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function bc(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:gg();const t=e=>bc(e);if(t.version="3.2.7",t.removed=[],!e||!e.document||e.document.nodeType!==Zr.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const o=r,n=o.currentScript,{DocumentFragment:i,HTMLTemplateElement:s,Node:a,Element:l,NodeFilter:c,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:h,DOMParser:p,trustedTypes:u}=e,g=l.prototype,m=Yr(g,"cloneNode"),f=Yr(g,"remove"),b=Yr(g,"nextSibling"),y=Yr(g,"childNodes"),v=Yr(g,"parentNode");if("function"==typeof s){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let w,x="";const{implementation:$,createNodeIterator:k,createDocumentFragment:C,getElementsByTagName:S}=r,{importNode:_}=o;let E=hl();t.isSupported="function"==typeof pc&&"function"==typeof v&&$&&void 0!==$.createHTMLDocument;const{MUSTACHE_EXPR:T,ERB_EXPR:A,TMPLIT_EXPR:D,DATA_ATTR:I,ARIA_ATTR:P,IS_SCRIPT_OR_DATA:O,ATTR_WHITESPACE:R,CUSTOM_ELEMENT:z}=dl;let{IS_ALLOWED_URI:N}=dl,j=null;const L=M({},[...sl,...bi,...vi,...wi,...al]);let U=null;const F=M({},[...ll,...yi,...cl,...Wo]);
1740let B=Object.seal(gc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),V=null,q=null,H=!0,W=!0,G=!1,Y=!0,K=!1,Z=!0,J=!1,X=!1,Q=!1,ee=!1,te=!1,re=!1,oe=!0,ne=!1;let ie=!0,se=!1,ae={},le=null;const ce=M({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let de=null;const he=M({},["audio","video","img","source","image","track"]);let pe=null;const ue=M({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ge="http://www.w3.org/1998/Math/MathML",me="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml";let be=fe,ye=!1,ve=null;const we=M({},[ge,me,fe],fi);let xe=M({},["mi","mo","mn","ms","mtext"]),$e=M({},["annotation-xml"]);const ke=M({},["title","style","font","a","script"]);let Ce=null;const Se=["application/xhtml+xml","text/html"];let Te=null,Ae=null;const De=r.createElement("form"),Me=function(e){return e instanceof RegExp||e instanceof Function},Ie=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Ae||Ae!==e){if((!e||"object"!=typeof e)&&(e={}),e=lt(e),Ce=-1===Se.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Te="application/xhtml+xml"===Ce?fi:Xo,j=Be(e,"ALLOWED_TAGS")?M({},e.ALLOWED_TAGS,Te):L,U=Be(e,"ALLOWED_ATTR")?M({},e.ALLOWED_ATTR,Te):F,ve=Be(e,"ALLOWED_NAMESPACES")?M({},e.ALLOWED_NAMESPACES,fi):we,pe=Be(e,"ADD_URI_SAFE_ATTR")?M(lt(ue),e.ADD_URI_SAFE_ATTR,Te):ue,de=Be(e,"ADD_DATA_URI_TAGS")?M(lt(he),e.ADD_DATA_URI_TAGS,Te):he,le=Be(e,"FORBID_CONTENTS")?M({},e.FORBID_CONTENTS,Te):ce,V=Be(e,"FORBID_TAGS")?M({},e.FORBID_TAGS,Te):lt({}),q=Be(e,"FORBID_ATTR")?M({},e.FORBID_ATTR,Te):lt({}),ae=!!Be(e,"USE_PROFILES")&&e.USE_PROFILES,H=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,G=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Y=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,K=e.SAFE_FOR_TEMPLATES||!1,Z=!1!==e.SAFE_FOR_XML,J=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,re=e.RETURN_TRUSTED_TYPE||!1,Q=e.FORCE_BODY||!1,oe=!1!==e.SANITIZE_DOM,ne=e.SANITIZE_NAMED_PROPS||!1,ie=!1!==e.KEEP_CONTENT,se=e.IN_PLACE||!1,N=e.ALLOWED_URI_REGEXP||fc,be=e.NAMESPACE||fe,xe=e.MATHML_TEXT_INTEGRATION_POINTS||xe,$e=e.HTML_INTEGRATION_POINTS||$e,B=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Me(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(B.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Me(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(B.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(B.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),K&&(W=!1),te&&(ee=!0),ae&&(j=M({},al),U=[],!0===ae.html&&(M(j,sl),M(U,ll)),!0===ae.svg&&(M(j,bi),M(U,yi),M(U,Wo)),!0===ae.svgFilters&&(M(j,vi),M(U,yi),M(U,Wo)),!0===ae.mathMl&&(M(j,wi),M(U,cl),M(U,Wo))),e.ADD_TAGS&&(j===L&&(j=lt(j)),M(j,e.ADD_TAGS,Te)),e.ADD_ATTR&&(U===F&&(U=lt(U)),M(U,e.ADD_ATTR,Te)),e.ADD_URI_SAFE_ATTR&&M(pe,e.ADD_URI_SAFE_ATTR,Te),e.FORBID_CONTENTS&&(le===ce&&(le=lt(le)),M(le,e.FORBID_CONTENTS,Te)),ie&&(j["#text"]=!0),J&&M(j,["html","head","body"]),j.table&&(M(j,["tbody"]),delete V.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Kr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Kr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=e.TRUSTED_TYPES_POLICY,x=w.createHTML("")}else void 0===w&&(w=fg(u,n)),null!==w&&"string"==typeof x&&(x=w.createHTML(""));Ee&&Ee(e),Ae=e}},Pe=M({},[...bi,...vi,...ng]),Oe=M({},[...wi,...ig]),Re=function(e){qr(t.removed,{element:e});try{v(e).removeChild(e)}catch{f(e)}},ze=function(e,r){try{qr(t.removed,{attribute:r.getAttributeNode(e),from:r})}catch{qr(t.removed,{attribute:null,from:r})}if(r.removeAttribute(e),"is"===e)if(ee||te)try{Re(r)}catch{}else try{r.setAttribute(e,"")}catch{}},Ne=function(e){let t=null,o=null;if(Q)e="<remove></remove>"+e;else{const t=mi(e,/^[\r\n\t ]+/);o=t&&t[0]}"application/xhtml+xml"===Ce&&be===fe&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const n=w?w.createHTML(e):e;if(be===fe)try{t=(new p).parseFromString(n,Ce)}catch{}if(!t||!t.documentElement){t=$.createDocument(be,"template",null);try{t.documentElement.innerHTML=ye?x:n}catch{}}const i=t.body||t.documentElement;return e&&o&&i.insertBefore(r.createTextNode(o),i.childNodes[0]||null),be===fe?S.call(t,J?"html":"body")[0]:J?t.documentElement:i},je=function(e){return k.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Le=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Ue=function(e){return"function"==typeof a&&e instanceof a};function Fe(e,r,o){qo(e,e=>{e.call(t,r,o,Ae)})}const Ve=function(e){let r=null;if(Fe(E.beforeSanitizeElements,e,null),Le(e))return Re(e),!0;const o=Te(e.nodeName);if(Fe(E.uponSanitizeElement,e,{tagName:o,allowedTags:j}),Z&&e.hasChildNodes()&&!Ue(e.firstElementChild)&&_e(/<[/\w!]/g,e.innerHTML)&&_e(/<[/\w!]/g,e.textContent)||e.nodeType===Zr.progressingInstruction||Z&&e.nodeType===Zr.comment&&_e(/<[/\w]/g,e.data))return Re(e),!0;if(!j[o]||V[o]){if(!V[o]&&He(o)&&(B.tagNameCheck instanceof RegExp&&_e(B.tagNameCheck,o)||B.tagNameCheck instanceof Function&&B.tagNameCheck(o)))return!1;if(ie&&!le[o]){const t=v(e)||e.parentNode,r=y(e)||e.childNodes;if(r&&t){for(let o=r.length-1;o>=0;--o){const n=m(r[o],!0);n.__removalCount=(e.__removalCount||0)+1,t.insertBefore(n,b(e))}}}return Re(e),!0}return e instanceof l&&!function(e){let t=v(e);(!t||!t.tagName)&&(t={namespaceURI:be,tagName:"template"});const r=Xo(e.tagName),o=Xo(t.tagName);return!!ve[e.namespaceURI]&&(e.namespaceURI===me?t.namespaceURI===fe?"svg"===r:t.namespaceURI===ge?"svg"===r&&("annotation-xml"===o||xe[o]):!!Pe[r]:e.namespaceURI===ge?t.namespaceURI===fe?"math"===r:t.namespaceURI===me?"math"===r&&$e[o]:!!Oe[r]:e.namespaceURI===fe?!(t.namespaceURI===me&&!$e[o]||t.namespaceURI===ge&&!xe[o])&&!Oe[r]&&(ke[r]||!Pe[r]):!("application/xhtml+xml"!==Ce||!ve[e.namespaceURI]))}(e)||("noscript"===o||"noembed"===o||"noframes"===o)&&_e(/<\/no(script|embed|frames)/i,e.innerHTML)?(Re(e),!0):(K&&e.nodeType===Zr.text&&(r=e.textContent,qo([T,A,D],e=>{r=Wr(r,e," ")}),e.textContent!==r&&(qr(t.removed,{element:e.cloneNode()}),e.textContent=r)),Fe(E.afterSanitizeElements,e,null),!1)},qe=function(e,t,o){if(oe&&("id"===t||"name"===t)&&(o in r||o in De))return!1;if((!W||q[t]||!_e(I,t))&&(!H||!_e(P,t)))if(!U[t]||q[t]){if(!(He(e)&&(B.tagNameCheck instanceof RegExp&&_e(B.tagNameCheck,e)||B.tagNameCheck instanceof Function&&B.tagNameCheck(e))&&(B.attributeNameCheck instanceof RegExp&&_e(B.attributeNameCheck,t)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(t,e))||"is"===t&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&_e(B.tagNameCheck,o)||B.tagNameCheck instanceof Function&&B.tagNameCheck(o))))return!1}
1740else if(!pe[t]&&!_e(N,Wr(o,R,""))&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==eg(o,"data:")||!de[e])&&(!G||_e(O,Wr(o,R,"")))&&o)return!1;return!0},He=function(e){return"annotation-xml"!==e&&mi(e,z)},We=function(e){Fe(E.beforeSanitizeAttributes,e,null);const{attributes:r}=e;if(!r||Le(e))return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:U,forceKeepAttr:void 0};let n=r.length;for(;n--;){const i=r[n],{name:s,namespaceURI:a,value:l}=i,c=Te(s),d=l;let h="value"===s?d:tg(d);if(o.attrName=c,o.attrValue=h,o.keepAttr=!0,o.forceKeepAttr=void 0,Fe(E.uponSanitizeAttribute,e,o),h=o.attrValue,ne&&("id"===c||"name"===c)&&(ze(s,e),h="user-content-"+h),Z&&_e(/((--!?|])>)|<\/(style|title|textarea)/i,h)){ze(s,e);continue}if("attributename"===c&&mi(h,"href")){ze(s,e);continue}if(o.forceKeepAttr)continue;if(!o.keepAttr){ze(s,e);continue}if(!Y&&_e(/\/>/i,h)){ze(s,e);continue}K&&qo([T,A,D],e=>{h=Wr(h,e," ")});const p=Te(e.nodeName);if(qe(p,c,h)){if(w&&"object"==typeof u&&"function"==typeof u.getAttributeType&&!a)switch(u.getAttributeType(p,c)){case"TrustedHTML":h=w.createHTML(h);break;case"TrustedScriptURL":h=w.createScriptURL(h)}if(h!==d)try{a?e.setAttributeNS(a,s,h):e.setAttribute(s,h),Le(e)?Re(e):il(t.removed)}catch{ze(s,e)}}else ze(s,e)}Fe(E.afterSanitizeAttributes,e,null)},Ge=function e(t){let r=null;const o=je(t);for(Fe(E.beforeSanitizeShadowDOM,t,null);r=o.nextNode();)Fe(E.uponSanitizeShadowNode,r,null),Ve(r),We(r),r.content instanceof i&&e(r.content);Fe(E.afterSanitizeShadowDOM,t,null)};return t.sanitize=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,s=null,l=null,c=null;if(ye=!e,ye&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ue(e)){if("function"!=typeof e.toString)throw Kr("toString is not a function");if("string"!=typeof(e=e.toString()))throw Kr("dirty is not a string, aborting")}if(!t.isSupported)return e;if(X||Ie(r),t.removed=[],"string"==typeof e&&(se=!1),se){if(e.nodeName){const t=Te(e.nodeName);if(!j[t]||V[t])throw Kr("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof a)n=Ne("\x3c!----\x3e"),s=n.ownerDocument.importNode(e,!0),s.nodeType===Zr.element&&"BODY"===s.nodeName||"HTML"===s.nodeName?n=s:n.appendChild(s);else{if(!ee&&!K&&!J&&-1===e.indexOf("<"))return w&&re?w.createHTML(e):e;if(n=Ne(e),!n)return ee?null:re?x:""}n&&Q&&Re(n.firstChild);const d=je(se?e:n);for(;l=d.nextNode();)Ve(l),We(l),l.content instanceof i&&Ge(l.content);if(se)return e;if(ee){if(te)for(c=C.call(n.ownerDocument);n.firstChild;)c.appendChild(n.firstChild);else c=n;return(U.shadowroot||U.shadowrootmode)&&(c=_.call(o,c,!0)),c}let h=J?n.outerHTML:n.innerHTML;return J&&j["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&_e(mc,n.ownerDocument.doctype.name)&&(h="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+h),K&&qo([T,A,D],e=>{h=Wr(h,e," ")}),w&&re?w.createHTML(h):h},t.setConfig=function(){Ie(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),X=!0},t.clearConfig=function(){Ae=null,X=!1},t.isValidAttribute=function(e,t,r){Ae||Ie({});const o=Te(e),n=Te(t);return qe(o,n,r)},t.addHook=function(e,t){"function"==typeof t&&qr(E[e],t)},t.removeHook=function(e,t){if(void 0!==t){const r=Qp(E[e],t);return-1===r?void 0:Jp(E[e],r,1)[0]}return il(E[e])},t.removeHooks=function(e){E[e]=[]},t.removeAllHooks=function(){E=hl()},t}var mg=bc();const pt=e=>Kp(mg.sanitize(e));class bg{diff(e,t,r={}){let o;"function"==typeof r?(o=r,r={}):"callback"in r&&(o=r.callback);const n=this.castInput(e,r),i=this.castInput(t,r),s=this.removeEmpty(this.tokenize(n,r)),a=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(s,a,r,o)}diffWithOptionsObj(e,t,r,o){var n;const i=e=>(e=this.postProcess(e,r),o?void setTimeout(function(){o(e)},0):e),s=t.length,a=e.length;let l=1,c=s+a;null!=r.maxEditLength&&(c=Math.min(c,r.maxEditLength));const d=null!==(n=r.timeout)&&void 0!==n?n:1/0,h=Date.now()+d,p=[{oldPos:-1,lastComponent:void 0}];let u=this.extractCommon(p[0],t,e,0,r);if(p[0].oldPos+1>=a&&u+1>=s)return i(this.buildValues(p[0].lastComponent,t,e));let g=-1/0,m=1/0;const f=()=>{for(let o=Math.max(g,-l);o<=Math.min(m,l);o+=2){let n;const l=p[o-1],c=p[o+1];l&&(p[o-1]=void 0);let d=!1;if(c){const e=c.oldPos-o;d=c&&0<=e&&e<s}const h=l&&l.oldPos+1<a;if(d||h){if(n=!h||d&&l.oldPos<c.oldPos?this.addToPath(c,!0,!1,0,r):this.addToPath(l,!1,!0,1,r),u=this.extractCommon(n,t,e,o,r),n.oldPos+1>=a&&u+1>=s)return i(this.buildValues(n.lastComponent,t,e))||!0;p[o]=n,n.oldPos+1>=a&&(m=Math.min(m,o-1)),u+1>=s&&(g=Math.max(g,o+1))}else p[o]=void 0}l++};if(o)!function e(){setTimeout(function(){if(l>c||Date.now()>h)return o(void 0);f()||e()},0)}();else for(;l<=c&&Date.now()<=h;){const e=f();if(e)return e}}addToPath(e,t,r,o,n){const i=e.lastComponent;return i&&!n.oneChangePerToken&&i.added===t&&i.removed===r?{oldPos:e.oldPos+o,lastComponent:{count:i.count+1,added:t,removed:r,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:t,removed:r,previousComponent:i}}}extractCommon(e,t,r,o,n){const i=t.length,s=r.length;let a=e.oldPos,l=a-o,c=0;for(;l+1<i&&a+1<s&&this.equals(r[a+1],t[l+1],n);)l++,a++,c++,n.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!n.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,l}equals(e,t,r){return r.comparator?r.comparator(e,t):e===t||!!r.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){const t=[];for(let r=0;r<e.length;r++)e[r]&&t.push(e[r]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,r){const o=[];let n;for(;e;)o.push(e),n=e.previousComponent,delete e.previousComponent,e=n;o.reverse();const i=o.length;let s=0,a=0,l=0;for(;s<i;s++){const e=o[s];if(e.removed)e.value=this.join(r.slice(l,l+e.count)),l+=e.count;else{if(!e.added&&this.useLongestToken){let o=t.slice(a,a+e.count);o=o.map(function(e,t){const o=r[l+t];return o.length>e.length?o:e}),e.value=this.join(o)}else e.value=this.join(t.slice(a,a+e.count));a+=e.count,e.added||(l+=e.count)}}return o}}const ul="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class vg extends bg{tokenize(e){const t=new RegExp(`(\\r?\\n)|[${ul}]+|[^\\S\\n\\r]+|[^${ul}]`,"ug");return e.match(t)||[]}}const wg=new vg;function yg(e,t,r){return wg.diff(e,t,r)}var xg=Object.defineProperty,$g=(e,t,r,o)=>{for(var n,i=void 0,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(t,r,i)||i);return i&&xg(t,r,i),i};const vc=e=>{class t extends e{constructor(){super(...arguments),this.diffResult=[]}getResult(){return this.diffResult.map(e=>e.value).join("")}computeDiffResult(e,t){this.diffResult=yg(e,t).map((e,t)=>({...e,index:t}))}}return $g([b()],t.prototype,"diffResult"),t};var _g=Object.defineProperty,kg=Object.getOwnPropertyDescriptor,So=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?kg(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&_g(t,r,i),i};function Un(e,t="h3"){const r=e.toLowerCase();return["h1","h2","h3","h4","h5","h6"].includes(r)?r:t}function Cg(e,t=1){const r=parseInt(Un(e).substring(1));return`h${Math.min(r+t,6)}`}let Kt=class extends S{constructor(){super(...arguments),this.text="",this.className="",this.headingLevel="h3",this.offset=0}render(){const e=0===this.offset?Un(this.headingLevel):Cg(this.headingLevel,this.offset),t=this.className?`class="${this.className}"`:"",r=pt(`<${e} ${t}>${this.text}</${e}>`);return c`${r}`}};Kt.styles=$` 1741 :host { 1742 display: block; 1743 } 1744 `,So([g({type:String})],Kt.prototype,"text",2),So([g({type:String,attribute:"class-name"})],Kt.prototype,"className",2),So([g({type:String,attribute:"heading-level"})],Kt.prototype,"headingLevel",2),So([g({type:Number})],Kt.prototype,"offset",2),Kt=So([E("heading-renderer")],Kt);var Sg=Object.defineProperty,Eg=Object.getOwnPropertyDescriptor,Eo=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Eg(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Sg(t,r,i),i};let Yt=class extends(vc(S)){constructor(){super(...arguments),this.original="",this.value="",this.headingLevel="h2",this.focusOnFirstUpdated=!1}firstUpdated(e){super.firstUpdated(e),this.focusOnFirstUpdated&&this.shadowRoot.querySelector("textarea").focus()}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),
1744("original"===e||"value"===e)&&requestAnimationFrame(()=>{this.computeDiffResult(this.original,this.value??"")})}renderHighlightedDiff(){return c`${this.diffResult.map(e=>e.added?c`<span class="addition">${e.value}</span>`:e.removed?c`<span class="deletion line-through">${e.value}</span>`:c`<span>${e.value}</span>`)}`}handleTextareaInput(e){e.preventDefault();const t=e.target;this.value=t.value}render(){const e=Un(this.headingLevel);return c` 1745 <div class="text-section"> 1746 ${pt(`<${e}>${d("Preview")}</${e}>`)} 1747 <p class="text-content">${this.renderHighlightedDiff()}</p> 1748 </div> 1749 <div class=""> 1750 ${pt(`<${e}>${d("Edit ingredients list")}</${e}>`)} 1751 <textarea class="textarea" rows="6" @input=${this.handleTextareaInput}> 1752${this.value}</textarea 1753 > 1754 </div> 1755 `}};Yt.styles=[or,Jl,hc,Gl,uc,Oe([B.Cappucino,B.Success,B.Danger,B.White,B.LightRed,B.LightGreen]),$` 1756 .submit-buttons-wrapper { 1757 margin-top: 1rem; 1758 } 1759 `],Eo([g({type:String,reflect:!0})],Yt.prototype,"original",2),Eo([g({type:String,reflect:!0})],Yt.prototype,"value",2),Eo([g({type:String,reflect:!0,attribute:"heading-level"})],Yt.prototype,"headingLevel",2),Eo([g({type:Boolean,reflect:!0,attribute:"focus-on-first-updated"})],Yt.prototype,"focusOnFirstUpdated",2),Yt=Eo([E("text-corrector-highlight")],Yt);var Tg=Object.defineProperty,Ag=Object.getOwnPropertyDescriptor,De=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Ag(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Tg(t,r,i),i};let ye=class extends(vc(S)){constructor(){super(...arguments),this.original="",this.correction="",this.enableKeyboardMode=!1,this.validateChangeResult={},this.currentAnsweredIndex=0,this.groupedChanges=[],this.value="",this.textToCompare="",this.isEditMode=!1,this.showInfoPopover=!1,this.resetAutoFocus=!1}get isConfirmDisabled(){return!this.isEditMode&&this.groupedChanges.some((e,t)=>void 0===this.validateChangeResult[t])}get updateTextMsg(){return d("Please fix the errors or modify the text before confirming")}get filteredNotAnsweredChanges(){return this.groupedChanges.filter((e,t)=>void 0===this.validateChangeResult[t])}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),("original"===e||"correction"===e)&&(this.updateValues(),this.computeWordDiff(!0),this.resetAutoFocus=!0)}firstUpdated(){this.enableKeyboardMode&&this.form.addEventListener("keydown",this.handleKeyboardShortcut.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.enableKeyboardMode&&this.form.removeEventListener("keydown",this.handleKeyboardShortcut.bind(this))}render(){return c` 1760 <form @submit=${this.confirmText}> 1761 <div> 1762 ${this.isEditMode?c`<text-corrector-highlight 1763 .value=${this.value} 1764 original=${this.original} 1765 focus-on-first-updated 1766 ></text-corrector-highlight>`:this.renderSpellCheck()} 1767 </div> 1768 <div class="submit-buttons-wrapper">${this.renderButtons()}</div> 1769 </form> 1770 `}getAcceptSuggestionButtonDataId(e){return`accept-suggestion-${e}`}getKeyboardShortcutText(e){return!this.enableKeyboardMode||this.isEditMode?"":` (${e.toUpperCase()})`}updateValues(){this.value=this.original,this.textToCompare=this.correction}focusFirstButton(){this.enableKeyboardMode&&requestAnimationFrame(()=>{this.shadowRoot.querySelector(`[data-id^="${this.getAcceptSuggestionButtonDataId(0)}"]`).focus()})}focusSaveButton(){this.enableKeyboardMode&&requestAnimationFrame(()=>{const e=this.shadowRoot.querySelector("loading-button[type='submit']");e&&e.shadowRoot&&e.shadowRoot.querySelector("button")?.focus()})}updated(e){super.updated(e),this.resetAutoFocus&&(this.resetAutoFocus=!1,this.focusFirstButton())}computeGroupedChanges(){this.groupedChanges=[],this.currentAnsweredIndex=0;const e=this.diffResult;if(0!==e.length)for(let t=0;t<e.length;t++){const r=e[t];if(!r.added&&!r.removed)continue;const o=t+1,n=o<e.length?e[o]:null,i=this.groupedChanges.length;r.removed&&n&&n.added?(this.groupedChanges.push({type:se.CHANGED,oldValue:r.value,newValue:n.value,indexes:[t,o],position:i}),t++):r.removed?this.groupedChanges.push({type:se.REMOVED,value:r.value,indexes:[t],position:i}):r.added&&this.groupedChanges.push({type:se.ADDED,value:r.value,indexes:[t],position:i})}}computeWordDiff(e=!1){return this.computeDiffResult(this.value,this.textToCompare),e&&(this.validateChangeResult={}),this.computeGroupedChanges(),this.diffResult}goToSuggestion(e){this.currentAnsweredIndex=e,this.unansweredChange(e)}unansweredChange(e){delete this.validateChangeResult[e],this.requestUpdate()}renderChange(e,t,r){let o=e.replace(/\n/g,"â©ï¸<br/>");o=this.cleanSuggestion(o);const n=this.currentAnsweredIndex===t;return c`<span 1771 class="${r} spellcheck ${n?"current":""}" 1772 @click=${()=>this.goToSuggestion(t)} 1773 >${pt(o)}</span 1774 >`}renderUnansweredChange(e,t){return this.renderChange(e,t,"deletion")}renderAnsweredChange(e,t){return this.renderChange(e,t,"answered-change")}renderSpellCheckDiff(){let e=0;return c`${this.diffResult.map(t=>{const r=this.groupedChanges[e];if(r?.indexes[1]===t.index)return e++,D;if(r?.indexes[0]===t.index){const t=e,o=this.validateChangeResult[e];switch(r.type!==se.CHANGED&&e++,r.type){case se.ADDED:return void 0===o?this.renderUnansweredChange("",t):this.renderAnsweredChange(o?r.value:"",t);case se.REMOVED:return void 0===o?this.renderUnansweredChange(r.value,t):this.renderAnsweredChange(o?"":r.value,t);case se.CHANGED:return void 0===o?this.renderUnansweredChange(r.oldValue,t):this.renderAnsweredChange(o?r.newValue:r.oldValue,t)}}return c`<span>${t.value}</span>`})}`}renderEmptySuggestion(){return""}cleanSuggestion(e){if(!e)return this.renderEmptySuggestion();let t=e;return t.match(/^( |\u00A0|\n)+$/)&&(t=t.replace(/( |\u00A0)/g,"â£")),t.replace(/\n/g,"â©ï¸")}renderAcceptSuggestionButton(e,t){let r;switch(e.type){case se.CHANGED:r=`${this.cleanSuggestion(e.newValue)}`;break;case se.ADDED:r=`${this.cleanSuggestion(e.value)}`;break;case se.REMOVED:r=this.renderEmptySuggestion()}return c` 1775 <button 1776 class="suggestion-button button light-green-button small" 1777 @click="${()=>this.updateResult(!0,[e])}" 1778 tabindex="1" 1779 data-id="${this.getAcceptSuggestionButtonDataId(t)}" 1780 title="${r}" 1781 > 1782 ${r}${void 0} 1783 </button> 1784 `}renderRejectSuggestionButton(e){let t;switch(e.type){case se.CHANGED:t=`${this.cleanSuggestion(e.oldValue)}`;break;case se.ADDED:t=this.renderEmptySuggestion();break;case se.REMOVED:t=this.cleanSuggestion(e.value)}return c`<button 1785 class="suggestion-button button light-red-button small" 1786 @click="${()=>this.updateResult(!1,[e])}" 1787 tabindex="2" 1788 title="${t}" 1789 > 1790 ${t}${void 0} 1791 </button>`}renderSummaryItemContent(e,t){return c` 1792 <div class="summary-item"> 1793 ${this.renderRejectSuggestionButton(e)} ${this.renderAcceptSuggestionButton(e,t)} 1794 </div> 1795 `}toggleInfoPopover(){this.showInfoPopover=!this.showInfoPopover}closeInfoPopover(){this.showInfoPopover=!1}renderSummary(){let e=this.filteredNotAnsweredChanges;if(0===e.length)return D;let t=[...e.filter(e=>e.position>=this.currentAnsweredIndex),...e.filter(e=>e.position<this.currentAnsweredIndex)];return c`<div class="summary"> 1796 <div class="relative"> 1797 <div class="info-button-wrapper"> 1798 <info-button @click=${this.toggleInfoPopover}></info-button> 1799 ${this.renderInfoPopover()} 1800 </div> 1801 </div> 1802 <div class="summary-item-wrapper"> 1803 <div class="summary-item"> 1804 <div class="suggestion-button-title"> 1805 ${d("Original")}${this.getKeyboardShortcutText("o")} 1806 </div> 1807 <div class="suggestion-button-title"> 1808 ${d("Suggested fix")}${this.getKeyboardShortcutText("f")} 1809 </div> 1810 </div> 1811 1812 ${t.map((e,t)=>this.renderSummaryItemContent(e,t))} 1813 </div> 1814 </div>`}updateNextAnsweredIndex(){if(void 0===this.validateChangeResult[this.currentAnsweredIndex])return;const e=this.filteredNotAnsweredChanges;if(0===e.length)return this.currentAnsweredIndex=0,void this.focusSaveButton();const t=e.filter(e=>e.position>this.currentAnsweredIndex);this.currentAnsweredIndex=t.length>0?t[0].position:e[0].position,this.focusFirstButton()}updateResult(e,t){0!==this.filteredNotAnsweredChanges.length&&(t.forEach(t=>{this.validateChangeResult[t.position]=e}),this.updateNextAnsweredIndex(),this.requestUpdate())}dispatchSubmitEvent(e){this.dispatchEvent(new CustomEvent(we.SAVE,{detail:e}))}getValueOfGroupedChange(e){const t=this.validateChangeResult[e.position];switch(e.type){case se.ADDED:return t?e.value:"";case se.REMOVED:return t?"":e.value;case se.CHANGED:return t?e.newValue:e.oldValue;default:return""}}buildValueWithAnsweredChanges(){let e="",t=0;for(let r=0;r<this.diffResult.length;r++){const o=this.diffResult[r],n=this.groupedChanges[t];n?.indexes.includes(r)?(e+=this.getValueOfGroupedChange(n),t++,n.type===se.CHANGED&&r++):e+=o.value}return e}acceptTextWithCorrection(){this.dispatchSubmitEvent({correction:this.value,annotation:z.ACCEPT_AND_ADD_DATA})}acceptText(){this.dispatchSubmitEvent({annotation:z.ACCEPT})}confirmText(e){e?.preventDefault(),(this.isEditMode||!this.filteredNotAnsweredChanges.length)&&(this.isEditMode||(this.value=this.buildValueWithAnsweredChanges()),this.isEditMode=!1,this.correction===this.value?this.acceptText():this.original===this.value?this.rejectText():this.acceptTextWithCorrection())}rejectText(){this.dispatchSubmitEvent({annotation:z.REFUSE})}skip(){this.dispatchSubmitEvent({annotation:z.SKIP})}enterEditMode(){this.isEditMode=!0,this.value=this.buildValueWithAnsweredChanges()}
1814cancelEditMode(){this.updateValues(),this.isEditMode=!1,this.computeWordDiff(),this.filteredNotAnsweredChanges.length?this.focusFirstButton():this.focusSaveButton()}renderButtons(){const e=this.isConfirmDisabled?this.updateTextMsg:"",t=!!this.loading,r=[z.ACCEPT,z.ACCEPT_AND_ADD_DATA,z.REFUSE].includes(this.loading),o=c` <loading-button 1815 ?loading=${r} 1816 ?disabled=${t||this.isConfirmDisabled} 1817 type="submit" 1818 title=${e} 1819 @click=${()=>ls(this.form)} 1820 css-classes="button success-button" 1821 > 1822 <span 1823 >${d("Save")}${this.getKeyboardShortcutText("s")}</span 1824 > 1825 <check-icon></check-icon> 1826 </loading-button>`;return this.isEditMode?c` 1827 <div class="submit-buttons buttons-row can-wrap"> 1828 <button 1829 class="button cappucino-button with-icon" 1830 @click=${this.cancelEditMode} 1831 ?disabled=${t} 1832 > 1833 <span>${d("Cancel")}</span><cross-icon></cross-icon> 1834 </button> 1835 ${o} 1836 </div> 1837 `:c` 1838 <div class="submit-buttons buttons-row can-wrap"> 1839 <loading-button 1840 ?loading=${this.loading===z.SKIP} 1841 ?disabled=${t} 1842 css-classes="button white-button" 1843 @click=${this.skip} 1844 > 1845 <span 1846 >${d("Skip")}${this.getKeyboardShortcutText("k")}</span 1847 ><skip-icon></skip-icon> 1848 </loading-button> 1849 ${o} 1850 </div> 1851 `}renderSpellCheck(){const e=!!this.loading;return c` 1852 <div class="text-section"> 1853 <p class="text">${this.renderSpellCheckDiff()}</p> 1854 <div style="display: flex; justify-content: flex-end;"> 1855 <button 1856 class="button cappucino-button with-icon" 1857 @click=${this.enterEditMode} 1858 ?disabled=${e} 1859 > 1860 <span 1861 >${d("Edit")}${this.getKeyboardShortcutText("e")}</span 1862 ><edit-icon></edit-icon> 1863 </button> 1864 </div> 1865 </div> 1866 ${this.renderSummary()} 1867 `}handleKeyboardShortcut(e){if(this.enableKeyboardMode&&!this.isEditMode)switch(e.key){case"f":this.updateResult(!0,[this.groupedChanges[this.currentAnsweredIndex]]);break;case"o":this.updateResult(!1,[this.groupedChanges[this.currentAnsweredIndex]]);break;case"k":this.skip();break;case"e":this.enterEditMode(),e.preventDefault();break;case"s":this.confirmText()}}renderInfoPopover(){return this.showInfoPopover?c` 1868 <div class="popover popover-left info-popover" ${Wp(()=>this.closeInfoPopover())}> 1869 <div class="popover-content"> 1870 <p> 1871 ${d(c`This tool allows you to correct the ingredients list. You can add, remove or edit 1872 ingredients list. 1873 <br /> 1874 This character <span class="highlight">â£</span> represents a space. 1875 <br /> 1876 This character <span class="highlight">â©ï¸</span> represents a line break. `)} 1877 </p> 1878 </div> 1879 </div> 1880 `:D}};ye.styles=[or,Jl,hc,Gl,uc,Oe([B.Cappucino,B.LightRed,B.LightGreen]),$` 1881 .text { 1882 line-height: 1.4rem; 1883 } 1884 .summary { 1885 margin-bottom: 0.5rem; 1886 padding-top: 1.5rem; 1887 padding-bottom: 0rem; 1888 border-bottom: 1px solid ${ps}; 1889 box-shadow: 0 0.5rem 2px -2px rgba(0, 0, 0, 0.1); 1890 } 1891 1892 .submit-buttons-wrapper { 1893 margin-top: 1rem; 1894 } 1895 .submit-buttons { 1896 display: grid; 1897 grid-template-columns: 1fr 1fr; 1898 gap: 1rem; 1899 } 1900 1901 .submit-buttons button { 1902 justify-content: center; 1903 } 1904 .spellcheck { 1905 padding: 2px 5px; 1906 border-radius: 15px; 1907 cursor: pointer; 1908 } 1909 1910 .deletion.current { 1911 outline: 2px solid red; 1912 } 1913 .answered-change { 1914 background-color: ${Ze}; 1915 } 1916 .summary-item-wrapper { 1917 display: flex; 1918 height: 100%; 1919 max-height: 180px; 1920 overflow: hidden; 1921 flex-direction: column; 1922 gap: 1rem; 1923 padding-bottom: 1rem; 1924 1925 margin-top: 1rem; 1926 1927 @media (min-width: ${Dn.SM}px) { 1928 max-height: none; 1929 overflow: auto; 1930 margin-top: 0; 1931 } 1932 } 1933 .summary-item { 1934 display: grid; 1935 width: 100%; 1936 grid-template-columns: 1fr 1fr; 1937 gap: 0.5rem; 1938 padding-left: 0.5rem; 1939 padding-right: 0.5rem; 1940 box-sizing: border-box; 1941 } 1942 .summary-item :first-child { 1943 justify-self: end; 1944 } 1945 .summary-item :last-child { 1946 justify-self: start; 1947 } 1948 1949 .info-popover { 1950 z-index: 2; 1951 min-width: 200px; 1952 } 1953 1954 .suggestion-button { 1955 height: 32px; 1956 font-weight: 500; 1957 border-radius: 30px; 1958 white-space: nowrap; 1959 overflow: hidden; 1960 text-overflow: ellipsis; 1961 max-width: 100%; 1962 } 1963 .suggestion-button-title { 1964 font-weight: bold; 1965 text-align: center; 1966 } 1967 .suggestion-button, 1968 .suggestion-button-title { 1969 width: 100%; 1970 } 1971 1972 .empty-suggestion { 1973 color: ${ao}; 1974 font-weight: bold; 1975 } 1976 1977 .info-button-wrapper { 1978 position: absolute; 1979 top: -12px; 1980 right: 0; 1981 } 1982 `],De([g({type:String})],ye.prototype,"original",2),De([g({type:String})],ye.prototype,"correction",2),De([g({type:Boolean,attribute:"enable-keyboard-mode"})],ye.prototype,"enableKeyboardMode",2),De([b()],ye.prototype,"validateChangeResult",2),De([b()],ye.prototype,"currentAnsweredIndex",2),De([b()],ye.prototype,"groupedChanges",2),De([b()],ye.prototype,"value",2),De([b()],ye.prototype,"textToCompare",2),De([g({type:Number,reflect:!0})],ye.prototype,"loading",2),De([b()],ye.prototype,"isEditMode",2),De([b()],ye.prototype,"showInfoPopover",2),De([b()],ye.prototype,"resetAutoFocus",2),De([Dt("form")],ye.prototype,"form",2),ye=De([E("text-corrector")],ye);var Ig=Object.defineProperty,Pg=Object.getOwnPropertyDescriptor,nr=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Pg(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Ig(t,r,i),i};let gt=class extends(Ds(Pn(zn(S),void 0))){constructor(){super(...arguments),this.titleLevel="h2",this.productC
1982ode=void 0,this.enableKeyboardMode=!1,this._currentIndex=0,this._insightIds=[],this.productData={},this._spellcheckTask=new tr(this,{task:async([e])=>{this._insightIds=[],this._currentIndex=0,this.dispatchIngredientSpellcheckStateEvent({state:V.LOADING});const t=await Dp(e||void 0,{lc:this._languageCodes});this._insightIds=t.map(e=>e.id),this.updateValue(),this.dispatchIngredientSpellcheckStateEvent({state:this._insightIds.length?V.HAS_DATA:V.NO_DATA})},args:()=>[this.productCode,...this._languageCodes]})}get fullImageUrl(){return wp(this.productData.imageUrl)}get allInsightsAreAnswered(){return this._currentIndex>=this._insightIds.length}get _insight(){const e=this._insightIds[this._currentIndex];return cc.getItem(e)}get _enable_keyboard_mode(){return!!this.enableKeyboardMode&&!Ni()}renderHeader(){const e=Un(this.titleLevel),t=`<${e} class="robotoff-ingredient-spellcheck-title">${d("Help us fix errors in ingredients list")}</${e}>`;return c` 1983 <div> 1984 <div>${pt(t)}</div> 1985 </div> 1986 `}updateValue(){const e=this._insight;this.updateIngredientsImageUrl(e)}async updateIngredientsImageUrl(e){if(!e)return this.productData.imageUrl=void 0,void(this.productData.name=void 0);const t=await Nl(e.barcode,{lc:e.data.lang,fields:[pn.IMAGE_INGREDIENTS_URL,pn.PRODUCT_NAME]});this.productData={imageUrl:t.product.image_ingredients_url,name:t.product.product_name}}nextInsight(){this._currentIndex++,this.allInsightsAreAnswered||this.updateValue()}dispatchIngredientSpellcheckStateEvent(e){this.dispatchEvent(new CustomEvent(we.INGREDIENT_SPELLCHECK_STATE,{bubbles:!0,composed:!0,detail:{productCode:this.productCode,...e}}))}async afterInsightAnnotation(){await this.hideLoading(),this.dispatchIngredientSpellcheckStateEvent({state:V.ANNOTATED}),this.nextInsight()}async submitAnnotation(e){this.showLoading(e.detail.annotation);const t=this._insight;t?(await rt.annotateIngredientSpellcheck(t.id,e.detail.annotation,e.detail.correction),await this.afterInsightAnnotation(),this.allInsightsAreAnswered&&this.dispatchIngredientSpellcheckStateEvent({state:V.FINISHED,insightId:t.id,...e.detail})):console.error("No insight found at index",this._currentIndex)}renderImage(){return this.fullImageUrl?c` 1987 <div> 1988 <zoomable-image 1989 src=${this.fullImageUrl} 1990 fallback-src=${this.productData.imageUrl??""} 1991 .size="${{width:"100%",height:"30vh"}}" 1992 show-buttons 1993 ></zoomable-image> 1994 </div> 1995 `:D}render(){return this._spellcheckTask.render({pending:()=>c`<slot name="pending"><off-wc-loader></off-wc-loader></slot>`,complete:()=>{const e=this._insight;if(this.allInsightsAreAnswered)return c`<slot name="complete"> 1996 <p>${d("All insights have been answered! Thanks for your help!")}</p> 1997 </slot>`;if(!e)return D;const t=e.data.correction,r=e.data.original;return c` 1998 <div class="robotoff-ingredient-spellcheck"> 1999 ${this.renderHeader()} 2000 <div> 2001 ${this.renderProductLink(e.barcode)} ${this.renderImage()} 2002 <div> 2003 <text-corrector 2004 loading=${sc(this.loading)} 2005 correction=${t} 2006 original=${r} 2007 @save=${this.submitAnnotation} 2008 ?enable-keyboard-mode=${this._enable_keyboard_mode} 2009 ></text-corrector> 2010 </div> 2011 </div> 2012 </div> 2013 `}})}};gt.styles=[or,ec,Oe([B.Cappucino,B.Success,B.Danger]),$` 2014 .robotoff-ingredient-spellcheck { 2015 max-width: 800px; 2016 margin: 0 auto; 2017 border-radius: 4px; 2018 box-sizing: border-box; 2019 } 2020 2021 .robotoff-ingredient-spellcheck-title { 2022 margin-top: 0; 2023 margin-bottom: 1rem; 2024 } 2025 `],nr([g({type:String,attribute:"title-level"})],gt.prototype,"titleLevel",2),nr([g({type:String,attribute:"product-code",reflect:!0})],gt.prototype,"productCode",2),nr([g({type:Boolean,attribute:"enable-keyboard-mode"})],gt.prototype,"enableKeyboardMode",2),nr([b()],gt.prototype,"_currentIndex",2),nr([b()],gt.prototype,"_insightIds",2),nr([b()],gt.prototype,"productData",2),gt=nr([E("robotoff-ingredient-spellcheck"),H()],gt);const Og=$` 2026 .container { 2027 max-width: 1200px; 2028 margin: 0 auto; 2029 } 2030`,wc=$` 2031 :host { 2032 display: block; 2033 font-family: Arial, sans-serif; 2034 } 2035 2036 .modal { 2037 position: fixed; 2038 top: 50%; 2039 left: 50%; 2040 transform: translate(-50%, -50%); 2041 background: white; 2042 box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); 2043 border-radius: 12px; 2044 z-index: 1000; 2045 max-height: 90%; 2046 width: 95%; 2047 max-width: 500px; 2048 overflow-y: auto; 2049 box-sizing: border-box; 2050 animation: fadeIn 0.3s ease-in-out; 2051 } 2052 2053 .overlay { 2054 position: fixed; 2055 top: 0; 2056 left: 0; 2057 width: 100%; 2058 height: 100%; 2059 background: rgba(0, 0, 0, 0.6); 2060 z-index: 999; 2061 animation: fadeIn 0.3s ease-in-out; 2062 cursor: pointer; 2063 } 2064 2065 h2 { 2066 margin: 0; 2067 font-size: 1.5rem; 2068 color: #333; 2069 text-align: center; 2070 } 2071 2072 .modal-buttons { 2073 display: flex; 2074 justify-content: space-between; 2075 } 2076 2077 .modal-header { 2078 position: sticky; 2079 top: 0.5rem; 2080 display: flex; 2081 justify-content: flex-end; 2082 } 2083 2084 .modal-body { 2085 padding: 0rem 2rem 1rem 2rem; 2086 } 2087 2088 .close-icon { 2089 display: flex; 2090 align-items: center; 2091 justify-content: center; 2092 width: 2rem; 2093 height: 2rem; 2094 border: 1px solid; 2095 border-color: transparent; 2096 border-radius: 50%; 2097 cursor: pointer; 2098 background: transparent; 2099 } 2100 2101 .close-icon:hover { 2102 border-color: black; 2103 } 2104 2105 @keyframes fadeIn { 2106 from { 2107 opacity: 0; 2108 } 2109 to { 2110 opacity: 1; 2111 } 2112 } 2113`;var Dg=Object.defineProperty,Mg=Object.getOwnPropertyDescriptor,Ms=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Mg(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Dg(t,r,i),i};let fo=class extends S{constructor(){super(...arguments),this.isOpen=!1,this.isLoading=!1}closeModal(){this.dispatchEvent(new CustomEvent(we.CLOSE))}render(){return this.isOpen?c` 2114 <div class="overlay" @click="${this.closeModal}" aria-hidden="true"></div> 2115 <div class="modal"> 2116 <div class="modal-content"> 2117 <div class="modal-header"> 2118 <button class="close-icon" @click="${this.closeModal}" aria-label=${d("Close modal")}> 2119 <cross-icon></cross-icon> 2120 </button> 2121 </div> 2122 <div class="modal-body"> 2123 ${this.isLoading?c`<off-wc-loader></off-wc-loader>`:c`<slot></slot>`} 2124 </div> 2125 </div> 2126 </div> 2127 `:D}};fo.styles=[wc],Ms([g({type:Boolean,reflect:!0,attribute:"is-open"})],fo.prototype,"isOpen",2),Ms([g({type:Boolean,attribute:"is-loading"})],fo.prototype,"isLoading",2),fo=Ms([E("modal-component"),H()],fo);const yc=new je({}),Rg=async(e,t={})=>{const r={...t,insight_types:Xe.ingredient_detection,annotated:!1};e&&(r.barcode=e);const o=await rt.insights(r);
2127return o.insights.forEach(e=>{yc.setItem(e.id,e)}),o.insights},Ng=(e,t,r)=>{const[o,n,i,s]=e;return{x:n*t,y:o*r,width:(s-n)*t,height:(i-o)*r}},Lg=(e,t,r)=>{const{x:o,y:n,width:i,height:s}=e;return[n/r,o/t,(n+s)/r,(o+i)/t]};var zg=Object.defineProperty,Ug=Object.getOwnPropertyDescriptor,Rt=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Ug(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&zg(t,r,i),i};let Je=class extends S{constructor(){super(...arguments),this.cropMode=$t.CROP_READ,this.data={annotation:void 0,bounding_box:void 0,rotation:void 0},this.isEditingIngredients=!1,this.imageSize={height:"500px",width:"100%"}}get isLoading(){return!!this.loading||this.cropMode===$t.CROP}get boundingBox(){const e=this.data?.bounding_box;return e&&this.image?Ng(e,this.image.naturalWidth,this.image.naturalHeight):{x:0,y:0,width:0,height:0}}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),"insight"===e&&this.onInsightChange()}onInsightChange(){this.loadImage(),this.isEditingIngredients=!1,this.cropMode=$t.CROP_READ,this.data={bounding_box:this.insight?.data.bounding_box,annotation:this.insight?.data.text,rotation:this.insight?.data.rotation}}connectedCallback(){super.connectedCallback(),this.loadImage()}async loadImage(){this.image=void 0,this.insight?.source_image&&(this.image=new Image,this.image.onload=()=>{this.requestUpdate()},this.image.src=ki(this.insight.source_image))}renderCropAnswerButtons(){return c` 2128 <div class="flex flex-col align-center"> 2129 <div class="button-container"> 2130 <loading-button 2131 css-classes="button success-button" 2132 type="submit" 2133 .loading=${this.loading===z.ACCEPT||this.loading===z.ACCEPT_AND_ADD_DATA} 2134 .disabled=${this.isLoading} 2135 @click="${()=>ls(this.form)}" 2136 label="${d("Validate")}" 2137 ></loading-button> 2138 <loading-button 2139 css-classes="button danger-button" 2140 .loading=${this.loading===z.REFUSE} 2141 .disabled=${this.isLoading} 2142 @click="${()=>this.answer(z.REFUSE)}" 2143 label="${d("Invalidate")}" 2144 ></loading-button> 2145 <loading-button 2146 css-classes="button white-button" 2147 .loading=${this.loading===z.SKIP} 2148 .disabled=${this.isLoading} 2149 @click="${()=>this.answer(z.SKIP)}" 2150 label="${d("Skip")}" 2151 ></loading-button> 2152 </div> 2153 </div> 2154 `}render(){return this.insight?this.renderInsight(this.insight):c`<div>No insight provided</div>`}onSubmit(e){e.preventDefault(),e.stopPropagation();const{text:t,bounding_box:r,rotation:o}=this.insight.data;this.data.annotation!==t||this.data.bounding_box!==r||this.data.rotation!==o?this.answer(z.ACCEPT_AND_ADD_DATA,{annotation:this.data.annotation??t,bounding_box:this.data.bounding_box??r,rotation:this.data.rotation??o}):this.answer(z.ACCEPT)}renderCropButtons(){if(this.cropMode===$t.CROP){const e=!!this.loading;return c` 2155 <loading-button 2156 css-classes="button cappucino-button" 2157 .disabled=${e} 2158 @click="${this.toggleCropMode}" 2159 label="${d("Cancel crop")}" 2160 ></loading-button> 2161 </div> 2162 `}return c` 2163 <loading-button 2164 css-classes="button chocolate-button" 2165 .disabled=${this.isLoading} 2166 @click="${this.toggleCropMode}" 2167 label="${d("I'll propose a better crop")}" 2168 ></loading-button> 2169 `}toggleEditIngredients(){this.isEditingIngredients=!this.isEditingIngredients}onAnnotationChange(e){const t=e.target;this.data.annotation=t.value}renderEditIngredients(e){let t;return t=this.isEditingIngredients?c`<text-corrector-highlight 2170 heading-level="h4" 2171 original=${e.data.text} 2172 .value=${this.data.annotation} 2173 @input="${this.onAnnotationChange}" 2174 ></text-corrector-highlight>`:c` 2175 <p>${e.data.text}</p> 2176 <loading-button 2177 css-classes="button chocolate-button" 2178 .disabled=${this.isLoading} 2179 @click="${this.toggleEditIngredients}" 2180 label="${d("I'll edit the ingredients")}" 2181 ></loading-button> 2182 `,c` 2183 <h3>${d("Ingredients :")}</h3> 2184 ${t} 2185 `}onRotate(e){this.data.rotation=e.detail.rotation}renderInsight(e){if(!e.source_image)return D;const t=ki(e.source_image),r=this.insight?.data.rotation??0;return c` 2186 <form @submit=${this.onSubmit}> 2187 <div> 2188 <zoomable-image 2189 src=${t} 2190 .size=${this.imageSize} 2191 crop-mode=${this.cropMode} 2192 .boundingBox=${this.boundingBox} 2193 show-buttons 2194 @submit=${this.onCropSave} 2195 .rotation=${r} 2196 @rotate=${this.onRotate} 2197 ></zoomable-image> 2198 <div class="crop-button-container">${this.renderCropButtons()}</div> 2199 </div> 2200 <div>${this.renderEditIngredients(e)}</div> 2201 ${this.renderCropAnswerButtons()} 2202 </form> 2203 `}toggleCropMode(){this.cropMode=this.cropMode===$t.CROP?$t.CROP_READ:$t.CROP}updateData(e){this.data={...this.data,...e}}onCropSave(e){if(!this.image)return;
2203const t=Lg(e.detail.newBoundingBox,this.image.naturalWidth,this.image.naturalHeight);this.updateData({bounding_box:t,rotation:e.detail.rotation}),this.toggleCropMode()}async answer(e,t){this.isEditingIngredients=!1,this.dispatchEvent(new CustomEvent(we.SUBMIT,{bubbles:!0,composed:!0,detail:{insightId:this.insight.id,value:e,data:t}}))}};Je.styles=[$` 2204 .button-container { 2205 display: flex; 2206 flex-wrap: wrap; 2207 justify-content: center; 2208 gap: 0.5rem; 2209 margin-top: 1.5rem; 2210 margin-bottom: 0.5rem; 2211 width: 100%; 2212 } 2213 .button-container loading-button { 2214 flex-grow: 1; 2215 flex-shrink: 0; 2216 } 2217 2218 .crop-button-container { 2219 display: flex; 2220 margin-top: 0.5rem; 2221 margin-bottom: 0.5rem; 2222 } 2223 `,On],Rt([Dt("form")],Je.prototype,"form",2),Rt([g({type:Number,reflect:!0})],Je.prototype,"loading",2),Rt([g({type:Object,reflect:!0})],Je.prototype,"insight",2),Rt([b()],Je.prototype,"cropMode",2),Rt([b()],Je.prototype,"image",2),Rt([b()],Je.prototype,"data",2),Rt([b()],Je.prototype,"isEditingIngredients",2),Je=Rt([E("robotoff-ingredient-detection-form"),H()],Je);var Fg=Object.defineProperty,jg=Object.getOwnPropertyDescriptor,Mr=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?jg(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Fg(t,r,i),i};let It=class extends(Ds(zn(Pn(S,void 0)))){constructor(){super(...arguments),this.count=100,this.page=1,this.productCode=void 0,this.index=0,this.insightIds=[],this.insightsTask=new tr(this,{task:async([e,t,r],{})=>{this.insightIds=[];const o=await Rg(r,{count:e,page:t,lc:this._languageCodes});return this.insightIds=o.map(e=>e.id),this.dispatchIngredientDetectionStateEvent({state:this.insightIds.length?V.HAS_DATA:V.NO_DATA}),this.setIndex(0),o},args:()=>[this.count,this.page,this.productCode,...this._languageCodes]})}dispatchIngredientDetectionStateEvent(e){this.dispatchEvent(new CustomEvent(we.INGREDIENT_DETECTION_STATE,{bubbles:!0,composed:!0,detail:{productCode:this.productCode,...e}}))}get insights(){return this.insightIds.map(e=>yc.getItem(e))}get currentInsight(){return this.insights[this.index]}async setIndex(e){this.index=e}render(){return this.insightsTask.render({pending:()=>c`<off-wc-loader></off-wc-loader>`,complete:()=>{const e=this.currentInsight;return e?this.renderInsight(e):D},error:e=>c`<p>Error: ${String(e)}</p>`})}renderInsight(e){return c` 2224 <div> 2225 <h2>${d("Help us for ingredients")}</h2> 2226 <p>${d("Help us validate the ingredient list of the product.")}</p> 2227 ${this.renderProductLink(e.barcode)} 2228 <robotoff-ingredient-detection-form 2229 .insight=${e} 2230 .loading=${this.loading} 2231 @submit=${this.onFormSubmit} 2232 ></robotoff-ingredient-detection-form> 2233 </div> 2234 `}async onFormSubmit(e){const{insightId:t,value:r,data:o}=e.detail;this.showLoading(r),await rt.annotateIngredientDetection(t,r,o),await this.hideLoading(),this.dispatchIngredientDetectionStateEvent({state:V.ANNOTATED});const n=this.index+1;this.setIndex(n),n>=this.insights.length&&this.dispatchIngredientDetectionStateEvent({state:V.FINISHED})}};It.styles=[$` 2235 :host { 2236 display: block; 2237 max-width: 800px; 2238 width: 100%; 2239 } 2240 `],Mr([g({type:Number})],It.prototype,"count",2),Mr([g({type:Number})],It.prototype,"page",2),Mr([g({type:String,attribute:"product-code",reflect:!0})],It.prototype,"productCode",2),Mr([b()],It.prototype,"index",2),Mr([b()],It.prototype,"insightIds",2),It=Mr([E("robotoff-ingredient-detection"),H()],It);var Bg=Object.defineProperty,Vg=Object.getOwnPropertyDescriptor,To=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Vg(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Bg(t,r,i),i};let Zt=class extends S{constructor(){super(...arguments),this.productCode="",this.isLoading=!1}get isOpen(){return!!this.robotoffContributionType}sendSuccessEvent(e){this.dispatchEvent(new CustomEvent(we.SUCCESS,{bubbles:!0,composed:!0,detail:{type:e}}))}onFinished(){const e=this.robotoffContributionType;this.showMessage="success",setTimeout(()=>{"success"===this.showMessage&&(this.showMessage=void 0),this.sendSuccessEvent(e)},1e3)}onAnnotated(){this.showMessage="annotation-success",setTimeout(()=>{"annotation-success"===this.showMessage&&(this.showMessage=void 0)},1e3)}onStateChange(e){switch(e.detail.state){case V.FINISHED:this.onFinished();break;case V.ANNOTATED:this.onAnnotated();break;case V.LOADING:this.isLoading=!0;break;case V.HAS_DATA:this.isLoading=!1;break;case V.NO_DATA:this.isLoading=!1,this.sendSuccessEvent(this.robotoffContributionType)}}renderModalContent(){switch(this.robotoffContributionType){case ue.INGREDIENT_SPELLCHECK:return c`<robotoff-ingredient-spellcheck
2241 product-code="${this.productCode}" 2242 @ingredients-state="${this.onStateChange}" 2243 ></robotoff-ingredient-spellcheck>`;case ue.NUTRIENT_EXTRACTION:return c`<robotoff-nutrient-extraction 2244 product-code="${this.productCode}" 2245 @nutrient-state="${this.onStateChange}" 2246 ></robotoff-nutrient-extraction>`;case ue.INGREDIENT_DETECTION:return c`<robotoff-ingredient-detection 2247 product-code="${this.productCode}" 2248 @ingredient-detection-state="${this.onStateChange}" 2249 ></robotoff-ingredient-detection>`;case ue.QUESTIONS:return c`<robotoff-question 2250 product-code="${this.productCode}" 2251 @question-state="${this.onStateChange}" 2252 ></robotoff-question>`}return D}closeModal(){this.dispatchEvent(new CustomEvent(we.CLOSE))}renderMessage(){if(!this.showMessage)return D;switch(this.showMessage){case"success":return c`<slot name="success-message" 2253 ><div class="success-message">${d("Thanks for your contribution!")}</div></slot 2254 >`;case"annotation-success":return c`<slot name="annotated-message" 2255 ><div class="annotated-message"> 2256 ${d("Saved! Can you help with another one?")} 2257 </div></slot 2258 >`}return D}render(){return c` 2259 <modal-component 2260 ?is-open="${this.isOpen}" 2261 ?is-loading="${this.isLoading}" 2262 @close="${this.closeModal}" 2263 > 2264 ${this.renderMessage()} 2265 <div class=${ko({"is-hidden":!!this.showMessage})}> 2266 ${this.renderModalContent()} 2267 </div> 2268 </modal-component> 2269 `}};Zt.styles=[qh],To([g({type:String,attribute:"robotoff-contribution-type"})],Zt.prototype,"robotoffContributionType",2),To([g({type:String,attribute:"product-code"})],Zt.prototype,"productCode",2),To([b()],Zt.prototype,"isLoading",2),To([b()],Zt.prototype,"showMessage",2),Zt=To([E("robotoff-modal"),H()],Zt);var Hg=Object.defineProperty,Gg=Object.getOwnPropertyDescriptor,Ao=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Gg(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Hg(t,r,i),i};let Xt=class extends(zn(yo(S))){constructor(){super(...arguments),this.productCode="",this.isLoggedIn=!1,this.showMessages={[ue.INGREDIENT_SPELLCHECK]:!1,[ue.NUTRIENT_EXTRACTION]:!1,[ue.INGREDIENT_DETECTION]:!1,[ue.QUESTIONS]:!1},this._fetchDataTask=new tr(this,{task:async([e])=>{console.log("Fetching data for product code",e,this._languageCodes),this.showMessages={[ue.QUESTIONS]:!1,[ue.INGREDIENT_SPELLCHECK]:!1,[ue.NUTRIENT_EXTRACTION]:!1,[ue.INGREDIENT_DETECTION]:!1};const[t,r]=await Promise.allSettled([Hl(e),...this.isLoggedIn?[rt.fetchRobotoffContributionMessageInsights({barcode:e,lc:this._languageCodes})]:[]]),o={[Xe.ingredient_spellcheck]:!1,[Xe.nutrient_extraction]:!1,[Xe.ingredient_detection]:!1};if("fulfilled"===r?.status)for(const e of r.value)if(o[e.type]=!0,Object.values(o).every(e=>e))break;this.showMessages={questions:"fulfilled"===t?.status&&t.value.length>0,...o}},args:()=>[this.productCode,...this._languageCodes]})}get messagesToShow(){return[{type:ue.QUESTIONS,message:d("Answer questions about the product.")},{type:ue.INGREDIENT_SPELLCHECK,message:d("Help us correct the spelling of ingredients.")},{type:ue.NUTRIENT_EXTRACTION,message:d("Help us correct the nutritional information.")},{type:ue.INGREDIENT_DETECTION,message:d("Help us correct the ingredient detection")}].filter(e=>this.showMessages[e.type])}openModal(e){this.robotoffContributionType=e}closeModal(){this.robotoffContributionType=void 0}onSave(e){this.showMessages[e.detail.type]=!1,this.closeModal(),this.requestUpdate()}render(){return this._fetchDataTask.render({complete:()=>this.messagesToShow.length?c` <div> 2270 <robotoff-modal 2271 product-code=${this.productCode} 2272 .robotoffContributionType=${this.robotoffContributionType} 2273 @close=${this.closeModal} 2274 @success=${this.onSave} 2275 ></robotoff-modal> 2276 <div class="robotoff-contribution-message alert info"> 2277 <div class="container"> 2278 <p> 2279 ${d("Hey! You can help us improve the product information by answering the following parts:")} 2280 </p> 2281 <ul> 2282 ${this.messagesToShow.map(e=>c`<li> 2283 <button 2284 class="button white-button small" 2285 @click=${()=>this.openModal(e.type)} 2286 > 2287 ${e.message} 2288 </button> 2289 </li>`)} 2290 </ul> 2291 </div> 2292 </div> 2293 </div>`:D,pending:()=>D,error:()=>D})}};Xt.styles=[Nn,Og,Oe([B.White]),$` 2294 :host { 2295 display: block; 2296 width: 100%; 2297 } 2298 .robotoff-contribution-message.alert { 2299 padding: 1rem; 2300 width: 100%; 2301 text-align: left; 2302 box-sizing: border-box; 2303 } 2304 .robotoff-contribution-message p { 2305 margin-top: 0; 2306 } 2307 .robotoff-contribution-message ul { 2308 margin-bottom: 0; 2309 display: flex; 2310 flex-direction: column; 2311 gap: 0.5rem; 2312 padding-left: 0; 2313 list-style-type: none; 2314 } 2315 .robotoff-contribution-message li { 2316 text-align: left; 2317 } 2318 `],Ao([g({type:String,attribute:"product-code",reflect:!0}
2318)],Xt.prototype,"productCode",2),Ao([g({type:Boolean,attribute:"is-logged-in"})],Xt.prototype,"isLoggedIn",2),Ao([b()],Xt.prototype,"robotoffContributionType",2),Ao([b()],Xt.prototype,"showMessages",2),Xt=Ao([E("robotoff-contribution-message"),H()],Xt);const qg=async(e,t)=>{try{const r=await fetch(e);if(!r.ok)throw new Error(`Failed to fetch: ${r.statusText}`);const o=await r.json();console.log("Raw API response:",o);let n=o;const i=t.split(".");for(const e of i){if(console.log(`Navigating to "${e}"`,n),!n||"object"!=typeof n||!(e in n))throw new Error(`Path "${t}" not found in the response data`);n=n[e]}return console.log("Final knowledge panels result:",n),n}catch(e){throw console.error("Error fetching knowledge panels:",e),e}};var Wg=Object.defineProperty,Kg=Object.getOwnPropertyDescriptor,xc=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Kg(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Wg(t,r,i),i};let mn=class extends S{render(){if(!this.element)return c``;const e=this.element.action_element;if(!e)return c``;const t=e.action_text||"Default Action",r=e.description||"",o=pt(e.html||"");return c` 2319 <div class="action"> 2320 <div>${o}</div> 2321 <button class="button chocolate-button" disabled>${t}</button> 2322 ${r?c`<small>${r}</small>`:""} 2323 <small>(Actions are displayed but not functional in this version)</small> 2324 </div> 2325 `}};mn.styles=$` 2326 .action { 2327 width: 100%; 2328 margin: 1rem 0; 2329 padding: 1rem; 2330 background-color: #f8f9fa; 2331 border-radius: 22px; 2332 border: 1px solid #e8e8e8; 2333 text-align: left; 2334 box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03); 2335 } 2336 2337 .action small { 2338 width: 100%; 2339 display: block; 2340 margin-top: 0.5rem; 2341 font-style: italic; 2342 font-size: 0.85rem; 2343 word-wrap: break-word; 2344 line-height: 1.5; 2345 } 2346 2347 .button { 2348 display: inline-block; 2349 font-weight: 500; 2350 text-align: center; 2351 vertical-align: middle; 2352 cursor: pointer; 2353 padding: 0.375rem 0.75rem; 2354 font-size: 1rem; 2355 line-height: 1.5; 2356 border-radius: 0.25rem; 2357 transition: 2358 color 0.15s ease-in-out, 2359 background-color 0.15s ease-in-out, 2360 border-color 0.15s ease-in-out, 2361 box-shadow 0.15s ease-in-out; 2362 } 2363 2364 .chocolate-button { 2365 color: #fff; 2366 background-color: #7d5437; 2367 border-color: #6a4730; 2368 } 2369 2370 .chocolate-button:hover { 2371 color: #fff; 2372 background-color: #60412b; 2373 border-color: #4d3422; 2374 } 2375 `,xc([g({type:Object})],mn.prototype,"element",2),mn=xc([E("action-element-renderer")],mn);var Yg=Object.defineProperty,Zg=Object.getOwnPropertyDescriptor,$c=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Zg(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Yg(t,r,i),i};let bn=class extends S{render(){const e=this.element?.text_element?.html||this.element?.text_element?.text||this.element?.text||"",t=pt(e);return c`<div class="text_element">${t}</div>`}};bn.styles=$` 2376 .text_element { 2377 width: 100%; 2378 margin-bottom: 0.85rem; 2379 line-height: 1.6; 2380 text-align: left; 2381 word-wrap: break-word; 2382 overflow-wrap: break-word; 2383 color: #333; 2384 } 2385 2386 ul { 2387 padding-left: 1.2rem; 2388 } 2389 2390 p { 2391 margin-top: 0; 2392 margin-bottom: 0.85rem; 2393 } 2394 `,$c([g({type:Object})],bn.prototype,"element",2),bn=$c([E("text-element-renderer")],bn);var Xg=Object.defineProperty,Qg=Object.getOwnPropertyDescriptor,Rs=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Qg(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Xg(t,r,i),i};let mo=class extends S{constructor(){super(...arguments),this.headingLevel="h3"}render(){if(!this.element)return c`<slot name="error">Missing element data</slot>`;const e=this.element.table_element||{};if(!e)return console.error("Invalid table element - missing table_element:",this.element),c`<slot name="error">Invalid table format</slot>`;const t=e.columns||[],r=e.rows||[];return Array.isArray(t)&&Array.isArray(r)?c` 2395 <div class="table_element"> 2396 ${e.title?c`<heading-renderer 2397 text="${e.title}" 2398 class-name="table-title" 2399 heading-level="${this.headingLevel}" 2400 > 2401 </heading-renderer>`:""} 2402 <table> 2403 <thead> 2404 <tr> 2405 ${t.map(e=>c`<th>${pt(e.text||e.id||"")}</th>`)} 2406 </tr> 2407 </thead> 2408 <tbody> 2409 ${r.map(e=>c` 2410 <tr> 2411 ${(e.cells||[]).map(e=>c`<td>${e.text||e.value||""}</td>`)} 2412 </tr> 2413 `)} 2414 </tbody> 2415 </table> 2416 </div> 2417 `:(console.error("Invalid table structure:",e),c`<slot name="error">Invalid table structure</slot>`)}};mo.styles=$` 2418 .table_element { 2419 width: 100%; 2420 overflow-x: auto; 2421 margin-bottom: 1.25rem; 2422 border-radius: 20px; 2423 /*box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);*/ 2424 } 2425 2426 .table_element table { 2427 width: 100%; 2428 border-collapse: separate; 2429 border-spacing: 0; 2430 margin-bottom: 0.5rem; 2431 text-align: left; 2432 border: 1px solid #e6e6e6; 2433 border-radius: 20px; 2434 overflow: hidden; 2435 } 2436 2437 .table_element th, 2438 .table_element td { 2439 border: 1px solid #e6e6e6; 2440 padding: 0.75rem; 2441 text-align: left; 2442 } 2443 2444 .table_element th { 2445 background-color: #f8f9fa; 2446 font-weight: 600; 2447 } 2448 2449 .table_element tr:nth-child(even) { 2450 background-color: #fcfcfc; 2451 } 2452 2453 .table_element tr:hover { 2454 background-color: #f7f7f7; 2455 } 2456 `,Rs([g({type:Object})],mo.prototype,"element",2),Rs([g({type:String})],mo.prototype,"headingLevel",2),mo=Rs([E("table-element-renderer")],mo);var Jg=Object.defineProperty,ef=Object.getOwnPropertyDescriptor,_c=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?ef(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Jg(t,r,i),i};let vn=class extends S{render(){return this.element?c` 2457 <div class="element"> 2458 <div class="element-title">${this.element.title||""}</div> 2459 <div class="element-value">${this.element.text||""}</div> 2460 </div> 2461 `:c``}};function tf(e){const t=[];let r=null;for(const t in e){const o=e[t];if("Nutrition"===o.title||"Nutrition facts"===o.title||"Nutrition"===o.title_element?.title||"Nutrition facts"===o.title_element?.title){r=
2461o;break}}if(r&&r.elements)for(const o of r.elements){if("text"===o.element_type&&o.text_element?.html){const e=o.text_element.html,r=/<img[^>]+src="([^"]+)"[^>]*>/g;let n;for(;null!==(n=r.exec(e));)n[1]&&t.push(n[1])}if("panel_group"===o.element_type&&o.panel_group_element?.image){const e=o.panel_group_element.image,r=e.sizes?.[400]?.url||e.sizes?.full?.url;r&&t.push(r)}if(o.elements&&Qo(o.elements,t),"panel"===o.element_type&&o.panel_element?.panel_id){const r=e[o.panel_element.panel_id];r&&r.elements&&Qo(r.elements,t)}}if(0===t.length)for(const r in e){const o=e[r];o.elements&&Qo(o.elements,t)}return console.log("Extracted nutrition images:",t),t}function Qo(e,t){for(const r of e){if("text"===r.element_type&&r.text_element?.html){const e=r.text_element.html,o=/<img[^>]+src="([^"]+)"[^>]*>/g;let n;for(;null!==(n=o.exec(e));)n[1]&&t.push(n[1])}if("panel_group"===r.element_type&&r.panel_group_element?.image){const e=r.panel_group_element.image,o=e.sizes?.[400]?.url||e.sizes?.full?.url;o&&t.push(o)}r.elements&&Qo(r.elements,t)}}vn.styles=$` 2462 .element { 2463 width: 100%; 2464 display: block; 2465 padding-bottom: 0.85rem; 2466 margin-bottom: 0.85rem; 2467 border-bottom: 1px solid #f5f5f5; 2468 text-align: left; 2469 } 2470 2471 .element:last-child { 2472 border-bottom: none; 2473 margin-bottom: 0; 2474 } 2475 2476 .element-title { 2477 width: 100%; 2478 display: block; 2479 font-weight: 600; 2480 margin-bottom: 0.5rem; 2481 text-align: left; 2482 word-wrap: break-word; 2483 } 2484 2485 .element-value { 2486 width: 100%; 2487 display: block; 2488 color: #444; 2489 text-align: left; 2490 word-wrap: break-word; 2491 line-height: 1.6; 2492 } 2493 `,_c([g({type:Object})],vn.prototype,"element",2),vn=_c([E("titled-text-element-renderer")],vn);var rf=Object.defineProperty,of=Object.getOwnPropertyDescriptor,Fn=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?of(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&rf(t,r,i),i};let Sr=class extends S{constructor(){super(...arguments),this.title="",this.subtitle="",this.headingLevel="h3"}render(){return this.title?c` 2494 <div class="panel-header"> 2495 <heading-renderer 2496 text="${this.title}" 2497 class-name="panel-title" 2498 heading-level="${this.headingLevel}" 2499 > 2500 </heading-renderer> 2501 ${this.subtitle?c`<div class="panel-subtitle">${this.subtitle}</div>`:""} 2502 </div> 2503 `:c``}};Sr.styles=$` 2504 .panel-header { 2505 width: 100%; 2506 border-bottom: 1px solid #eeeeee; 2507 padding: 1rem 1.25rem; 2508 display: block; 2509 } 2510 2511 .panel-subtitle { 2512 width: 100%; 2513 font-size: 0.95rem; 2514 margin-top: 0.35rem; 2515 text-align: left; 2516 word-wrap: break-word; 2517 } 2518 `,Fn([g({type:String})],Sr.prototype,"title",2),Fn([g({type:String})],Sr.prototype,"subtitle",2),Fn([g({type:String})],Sr.prototype,"headingLevel",2),Sr=Fn([E("panel-header-renderer")],Sr);var nf=Object.defineProperty,sf=Object.getOwnPropertyDescriptor,mt=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?sf(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&nf(t,r,i),i};let wn=class extends S{render(){if(!this.panelGroup||!this.panelGroup.image)return c``;const e=this.panelGroup.image.sizes?.[400]?.url||this.panelGroup.image.sizes?.full?.url||"",t=this.panelGroup.image.alt||"Panel image",r=this.panelGroup.image.caption||this.panelGroup.image.description||"";return c` 2519 <div class="panel-image"> 2520 <img src="${e}" alt="${t}" /> 2521 ${r?c`<div class="panel-image-text">${r}</div>`:c``} 2522 </div> 2523 `}};wn.styles=$` 2524 .panel-image { 2525 width: 100%; 2526 margin-bottom: 1.25rem; 2527 text-align: left; 2528 } 2529 2530 .panel-image img { 2531 width: auto; 2532 max-width: 100%; 2533 height: auto; 2534 border-radius: 20px; 2535 border: 1px solid #efefef; 2536 display: block; 2537 box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); 2538 } 2539 2540 .panel-image-text { 2541 width: 100%; 2542 margin-top: 0.65rem; 2543 font-size: 0.9rem; 2544 line-height: 1.5; 2545 text-align: left; 2546 font-style: italic; 2547 word-wrap: break-word; 2548 } 2549 `,mt([g({type:Object})],wn.prototype,"panelGroup",2),wn=mt([E("panel-group-image-renderer")],wn);let Er=class extends S{constructor(){super(...arguments),this.imageUrl="",this.imageAlt="Image",this.imageCaption=""}render(){return this.imageUrl?c` 2550 <div class="panel-image"> 2551 <img src="${this.imageUrl}" alt="${this.imageAlt}" /> 2552 ${this.imageCaption?c`<div class="panel-image-text">${this.imageCaption}</div>`:c``} 2553 </div> 2554 `:c``}};Er.styles=$` 2555 .panel-image { 2556 width: 100%; 2557 margin-bottom: 1.25rem; 2558 text-align: left; 2559 } 2560 2561 .panel-image img { 2562 width: auto; 2563 max-width: 100%; 2564 height: auto; 2565 border-radius: 20px; 2566 border: 1px solid #efefef; 2567 display: block; 2568 box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); 2569 } 2570 2571 .panel-image-text { 2572 width: 100%; 2573 margin-top: 0.65rem; 2574 font-size: 0.9rem; 2575 line-height: 1.5; 2576 text-align: left; 2577 font-style: italic; 2578 word-wrap: break-word; 2579 } 2580 `,mt([g({type:String})],Er.prototype,"imageUrl",2),mt([g({type:String})],Er.prototype,"imageAlt",2),mt([g({type:String})],Er.prototype,"imageCaption",2),Er=mt([E("image-renderer")],Er);let bo=class extends S{constructor(){super(...arguments),this.imageUrl="",this.subtitle=""}render(){return this.imageUrl?c` 2581 <img src="${this.imageUrl}" alt="Nutrition Information" /> 2582 ${this.subtitle?c`<div class="panel-image-text">${this.subtitle}</div>`:""} 2583 `:c``}};bo.styles=$` 2584 :host { 2585 display: block; 2586 } 2587 2588 img { 2589 width: auto; 2590 max-width: 100%; 2591 height: auto; 2592 border-radius: 20px; 2593 border: 1px solid #eee; 2594 display: block; 2595 margin: 0; 2596 } 2597 2598 .panel-image-text { 2599 width: 100%; 2600 margin-top: 0.65rem; 2601 font-size: 0.9rem; 2602 line-height: 1.5; 2603 text-align: left; 2604 font-style: italic; 2605 word-wrap: break-word; 2606 } 2607 `,mt([g({type:String})],bo.prototype,"imageUrl",2),mt([g({type:String})],bo.prototype,"subtitle",2),bo=mt([E("nutrition-image-renderer")],bo);var af=Object.defineProperty,lf=Object.getOwnPropertyDescriptor,Rr=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?lf(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&af(t,r,i),i};let Pt=class extends S{constructor(){super(...arguments),this.frame=!0,this.knowledgePanels=null,this.nutritionImages=[],this.headingLevel="h3"}isNutritionPanel(){if(!this.panel)return!1;const e=this.panel.title_element?.title||this.panel.title||"";return e.toLowerCase().includes("nutrition")||e.toLowerCase().includes("nutritional")}
2607render(){if(!this.panel)return c``;const e=this.panel.title_element?.title||this.panel.title||"",t=this.panel.title_element?.subtitle||"",r=this.panel.elements.length>0?this.panel.elements.map(e=>c`<element-renderer 2608 .element=${e} 2609 .knowledgePanels=${this.knowledgePanels} 2610 headingLevel=${this.headingLevel} 2611 ></element-renderer>`):D,o=this.panel.title_element?.icon_url;return this.frame&&null!=this.panel.title_element?c` 2612 <div 2613 class=" 2614 panel 2615 panel-size-${this.panel.size||"medium"} 2616 panel-level-${this.panel.level||"info"} 2617 " 2618 > 2619 <details .open=${this.panel.expanded??!1}> 2620 <summary> 2621 <div class="panel-header"> 2622 ${o?c` 2623 <img 2624 class="panel-icon panel-icon-${this.panel.title_element?.icon_size}" 2625 .src=${o} 2626 .alt=${e} 2627 /> 2628 <div>${e}</div> 2629 `:c`<div>${e}</div>`} 2630 </div> 2631 <span class="arrow">â¶</span> 2632 </summary> 2633 <div class="panel-content"> 2634 ${t?c`<div class="panel-subtitle">${t}</div>`:""} ${r} 2635 </div> 2636 </details> 2637 </div> 2638 `:c`${r}`}};Pt.styles=$` 2639 .panel { 2640 margin-bottom: 1.5rem; 2641 border-radius: 16px; 2642 border: 1px solid #f2d3ac; 2643 background: #fff; 2644 box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); 2645 border-bottom: 1px solid #f2d3ac; 2646 background: #fffdfa; 2647 overflow: hidden; 2648 transition: box-shadow 0.15s; 2649 } 2650 2651 summary { 2652 background: #ffe9c7; 2653 font-weight: bold; 2654 font-size: 1.12rem; 2655 cursor: pointer; 2656 padding: 1rem 1rem; 2657 border-bottom: 1px solid #f2d3ac; 2658 outline: none; 2659 user-select: none; 2660 display: flex; 2661 align-items: center; 2662 justify-content: space-between; 2663 color: #674d23; 2664 transition: background 0.18s; 2665 } 2666 2667 summary:hover { 2668 background: #ffe0a6; 2669 } 2670 2671 summary::-webkit-details-marker { 2672 display: none; 2673 } 2674 2675 .panel-size-small > details summary { 2676 padding: 0.5rem 1rem; 2677 } 2678 2679 .panel-header { 2680 display: flex; 2681 align-items: center; 2682 gap: 2rem; 2683 } 2684 2685 .panel-size-small .panel-header { 2686 gap: 0.5rem; 2687 } 2688 2689 .panel-icon { 2690 border-radius: 4px; 2691 width: 5rem; 2692 height: 5rem; 2693 object-fit: contain; 2694 } 2695 2696 .panel-icon-small { 2697 width: 1rem; 2698 height: 1rem; 2699 } 2700 2701 .panel-icon-medium { 2702 width: 1.5rem; 2703 height: 1.5rem; 2704 } 2705 2706 .panel-icon-large { 2707 width: 2.5rem; 2708 height: 2.5rem; 2709 } 2710 2711 .arrow { 2712 transition: transform 0.2s; 2713 margin-left: 0.5rem; 2714 font-size: 1.3rem; 2715 } 2716 details[open] .arrow { 2717 transform: rotate(90deg); 2718 } 2719 .panel-content { 2720 padding: 1.2rem 1.3rem; 2721 background: #fffdfa; 2722 } 2723 .panel-subtitle { 2724 margin-bottom: 0.75rem; 2725 font-style: italic; 2726 color: #a88b56; 2727 } 2728 `,Rr([g({type:Object})],Pt.prototype,"panel",2),Rr([g({type:Boolean})],Pt.prototype,"frame",2),Rr([g({type:Object})],Pt.prototype,"knowledgePanels",2),Rr([g({type:Array})],Pt.prototype,"nutritionImages",2),Rr([g({type:String})],Pt.prototype,"headingLevel",2),Pt=Rr([E("panel-renderer")],Pt);var cf=Object.defineProperty,df=Object.getOwnPropertyDescriptor,jn=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?df(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&cf(t,r,i),i};let Tr=class extends S{constructor(){super(...arguments),this.knowledgePanels=null,this.headingLevel="h3"}render(){if(!this.element)return c``;if(this.element.panel_element?.panel_id){const e=this.element.panel_element.panel_id,t=this.knowledgePanels?.[e];return t?c`<panel-renderer 2729 .panel=${t} 2730 .knowledgePanels=${this.knowledgePanels} 2731 headingLevel=${this.headingLevel} 2732 > 2733 </panel-renderer>`:c`<div class="warning">Referenced panel not found: ${e}</div>`}return this.element.elements&&Array.isArray(this.element.elements)?c` 2734 <div class="sub-panel"> 2735 ${this.element.title?c`<heading-renderer 2736 text="${this.element.title}" 2737 class-name="sub-panel-title" 2738 heading-level="${this.headingLevel}" 2739 offset="1" 2740 > 2741 </heading-renderer>`:""} 2742 <div class="elements"> 2743 ${this.element.elements.map(e=>c`<element-renderer 2744 .element=${e} 2745 .knowledgePanels=${this.knowledgePanels} 2746 headingLevel=${this.headingLevel} 2747 > 2748 </element-renderer>`)} 2749 </div> 2750 </div> 2751 `:c`<div class="warning">Panel without elements</div>`}};Tr.styles=$` 2752 :host { 2753 display: block; 2754 width: 100%; 2755 overflow-x: hidden; /* Prevent horizontal overflow at component level */ 2756 } 2757 2758 .warning { 2759 padding: 0.75rem; 2760 margin-bottom: 1rem; 2761 border: 1px solid transparent; 2762 border-radius: 0.25rem; 2763 color: #856404; 2764 background-color: #fff3cd; 2765 border-color: #ffeeba; 2766 } 2767 2768 .sub-panel { 2769 box-sizing: border-box; /* Include padding in width calculation */ 2770 width: 100%; 2771 margin-bottom: 1.25rem; 2772 padding: 1rem; 2773 border-left: 3px solid #e8e8e8; 2774 background-color: #fafafa; 2775 border-radius: 20px; 2776 text-align: left; 2777 box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02); 2778 overflow-x: hidden; /* Prevent horizontal overflow */ 2779 word-wrap: break-word; /* Ensure long words don't cause overflow */ 2780 overflow-wrap: break-word; /* Modern version of word-wrap */ 2781 } 2782 2783 .sub-panel-title { 2784 width: 100%; 2785 margin-top: 0; 2786 margin-bottom: 0.65rem; 2787 font-size: 1.05rem; 2788 border-bottom: none; 2789 padding-bottom: 0; 2790 text-align: left; 2791 word-wrap: break-word; 2792 } 2793 2794 .elements { 2795 width: 100%; 2796 overflow-x: hidden; /* Prevent horizontal overflow in nested elements */ 2797 } 2798 `,jn([g({type:Object})],Tr.prototype,"element",2),jn([g({type:Object})],Tr.prototype,"knowledgePanels",2),jn([g({type:String})],Tr.prototype,"headingLevel",2),Tr=jn([E("panel-element-renderer")],Tr);var hf=Object.defineProperty,uf=Object.getOwnPropertyDescriptor,Bn=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?uf(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&hf(t,r,i),i};let Ar=class extends S{constructor(){super(...arguments),this.knowledgePanels=null,this.headingLevel="h3"}
2798render(){if(!this.element)return c``;const e=this.element.panel_group_element;return e?c` 2799 <div class="panel-group"> 2800 ${e.title?c`<heading-renderer 2801 text="${e.title}" 2802 class-name="panel-group-title" 2803 heading-level="${this.headingLevel}" 2804 offset="1" 2805 > 2806 </heading-renderer>`:""} 2807 <panel-group-image-renderer .panelGroup=${e}></panel-group-image-renderer> 2808 ${this.renderPanelGroupPanels(e)} 2809 </div> 2810 `:c`<div class="warning"> 2811 <heading-renderer 2812 text="Missing Data" 2813 class-name="warning-title" 2814 heading-level="${this.headingLevel}" 2815 offset="1" 2816 > 2817 </heading-renderer> 2818 <p>Panel group without data</p> 2819 </div>`}renderPanelGroupPanels(e){return(e.panel_ids||[]).map(e=>{const t=this.knowledgePanels?.[e];return t?c`<panel-renderer 2820 .panel=${t} 2821 .knowledgePanels=${this.knowledgePanels} 2822 headingLevel=${this.headingLevel} 2823 > 2824 </panel-renderer>`:c`<div class="warning">Referenced panel not found: ${e}</div>`})}};Ar.styles=$` 2825 .panel-group { 2826 width: 100%; 2827 margin-bottom: 1.75rem; 2828 text-align: left; 2829 } 2830 2831 .panel-group-title { 2832 width: 100%; 2833 margin-top: 0; 2834 margin-bottom: 1rem; 2835 font-size: 1.15rem; 2836 font-weight: 600; 2837 padding-bottom: 0.5rem; 2838 border-bottom: 1px solid #f0f0f0; 2839 text-align: left; 2840 word-wrap: break-word; 2841 } 2842 2843 .warning { 2844 padding: 0.75rem; 2845 margin-bottom: 1rem; 2846 border: 1px solid transparent; 2847 border-radius: 0.25rem; 2848 color: #856404; 2849 background-color: #fff3cd; 2850 border-color: #ffeeba; 2851 } 2852 `,Bn([g({type:Object})],Ar.prototype,"element",2),Bn([g({type:Object})],Ar.prototype,"knowledgePanels",2),Bn([g({type:String})],Ar.prototype,"headingLevel",2),Ar=Bn([E("panel-group-element-renderer")],Ar);var pf=Object.defineProperty,gf=Object.getOwnPropertyDescriptor,Vn=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?gf(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&pf(t,r,i),i};let vo=class extends S{constructor(){super(...arguments),this.knowledgePanels=null,this.headingLevel="h3"}render(){if(!this.element||!this.element.element_type)return console.error("Invalid element:",this.element),c``;switch(this.element.element_type){case"text":return c`<text-element-renderer .element=${this.element}></text-element-renderer>`;case"table":return c`<table-element-renderer 2853 .element=${this.element} 2854 headingLevel=${this.headingLevel} 2855 > 2856 </table-element-renderer>`;case"titled_text":return c`<titled-text-element-renderer .element=${this.element}> 2857 </titled-text-element-renderer>`;case"panel":return c`<panel-element-renderer 2858 .element=${this.element} 2859 .knowledgePanels=${this.knowledgePanels} 2860 headingLevel=${this.headingLevel} 2861 > 2862 </panel-element-renderer>`;case"panel_group":return c`<panel-group-element-renderer 2863 .element=${this.element} 2864 .knowledgePanels=${this.knowledgePanels} 2865 headingLevel=${this.headingLevel} 2866 > 2867 </panel-group-element-renderer>`;case"action":return c`<action-element-renderer .element=${this.element}> </action-element-renderer>`;default:return console.log(`Unsupported element type: ${this.element.element_type}`,this.element),c``}}};Vn([g({type:Object})],vo.prototype,"element",2),Vn([g({type:Object})],vo.prototype,"knowledgePanels",2),Vn([g({type:String})],vo.prototype,"headingLevel",2),vo=Vn([E("element-renderer")],vo);var ff=Object.defineProperty,mf=Object.getOwnPropertyDescriptor,Nt=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?mf(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&ff(t,r,i),i};let et=class extends S{constructor(){super(...arguments),this.headingLevel="h3",this.panels=["root"],this.topFrame=!1,this.url="",this.path="",this.knowledgePanels=null,this.nutritionImages=[],this._knowledgePanelsTask=new tr(this,{task:async([e,t])=>e&&t?await qg(e,t):null,args:()=>[this.url,this.path]})}renderError(e){console.error("Task error:",e);const t=e instanceof Error?e.message:String(e);return c` 2868 <slot name="error"> 2869 <heading-renderer 2870 text="Error Loading Knowledge Panels" 2871 class-name="error-title" 2872 heading-level="${this.headingLevel}" 2873 > 2874 </heading-renderer> 2875 <p>${t}</p> 2876 <button class="button cappucino-button" @click=${this._retryLoad}>Retry</button> 2877 </slot> 2878 `}_retryLoad(){this._knowledgePanelsTask.run()}render(){return this._knowledgePanelsTask.render({initial:()=>c`<div class="info">Ready to load knowledge panels.</div>`,pending:()=>c`<off-wc-loader></off-wc-loader>`,complete:e=>this.renderPanelsResult(e),error:e=>this.renderError(e)})}renderPanelsResult(e){const t=e;if(console.log("Panels received:",t),!t||"object"!=typeof t)return console.error("Invalid panels data:",t),c`<slot name="error">Invalid data format received</slot>`;if(0===Object.keys(t).length)return c` 2879 <div class="info"> 2880 <heading-renderer 2881 text="${"No Knowledge Panels Available"}" 2882 class-name="empty-heading" 2883 heading-level="${this.headingLevel}" 2884 > 2885 </heading-renderer> 2886 <p>No knowledge panels were found for this request.</p> 2887 </div> 2888 `;this.knowledgePanels=t,this.nutritionImages=tf(t);const r=Object.entries(t).filter(([e])=>this.panels.includes(e)).map(([,e])=>e);return c` 2889 <div class="knowledge-panels-container"> 2890 ${r.map(e=>e?c`<panel-renderer 2891 .panel=${e} 2892 .knowledgePanels=${this.knowledgePanels} 2893 .nutritionImages=${this.nutritionImages} 2894 .frame=${this.topFrame} 2895 .headingLevel=${this.headingLevel} 2896 > 2897 </panel-renderer>`:c``)} 2898 </div> 2899 `}updated(e){super.updated(e),(e.has("url")||e.has("path"))&&(this.knowledgePanels=null,this.nutritionImages=[])}};et.styles=[or,Nn,...Oe([B.Chocolate,B.Cappucino]),$` 2900 :host { 2901 display: block; 2902 width: 100%; 2903 max-width: 100%; 2904 margin-bottom: 1.5rem; 2905 box-sizing: border-box; 2906 overflow-x: hidden; /* Prevent horizontal scrolling */ 2907 padding: 0 0.5rem; 2908 } 2909 2910 /* Apply box-sizing to all elements */ 2911 *, 2912 *:before, 2913 *:after { 2914 box-sizing: border-box; 2915 } 2916 2917 /* Knowledge panels container */ 2918 .knowledge-panels-container { 2919 width: 100%; 2920 text-align: left; 2921 overflow-x: hidden; /* Prevent horizontal scrolling */ 2922 } 2923 .info { 2924 padding: 0.75rem; 2925 margin-bottom: 1rem; 2926 border: 1px solid transparent; 2927 border-radius: 0.25rem; 2928 color: #0c5460; 2929 background-color: #d1ecf1; 2930 border-color: #bee5eb; 2931 } 2932 2933 .loading { 2934 display: flex; 2935 justify-content: center; 2936 align-items: center; 2937 padding: 2rem; 2938 } 2939 `],Nt([g({type:String,reflect:!0,attribute:"heading-level"})],et.prototype,"headingLevel",2),Nt([g({type:Array,attribute:"top-panels"})],et.prototype,"panels",2),Nt([g({type:Boolean,attribute:"top-frame"})],et.prototype,"topFrame",2),Nt([g({type:String})],et.prototype,"url",2),Nt([g({type:String})],et.prototype,"path",2),Nt([b()],et.prototype,"knowledgePanels",2),Nt([b()],et.prototype,"nutritionImages",2),et=Nt([E("knowledge-panels")],et);class bf{constructor(){this.listeners=new Set,this.handleChange=e=>
2939{this.isDark=e.matches,this.listeners.forEach(e=>e(this.isDark))},this.mq=window.matchMedia("(prefers-color-scheme: dark)"),this.isDark=this.mq.matches,this.mq.addEventListener("change",this.handleChange)}get darkMode(){return this.isDark}subscribe(e){this.listeners.add(e),e(this.isDark)}unsubscribe(e){this.listeners.delete(e)}}const ut=new bf;var vf=Object.defineProperty,wf=Object.getOwnPropertyDescriptor,Ns=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?wf(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&vf(t,r,i),i};let wo=class extends S{constructor(){super(...arguments),this.links={fr:"https://open-food-facts.assoconnect.com/collect/description/476750-c-faire-un-don-a-open-food-facts",default:"https://world.openfoodfacts.org/donate-to-open-food-facts"},this.currentYear=this.getDefaultYear(),this.isDarkMode=ut.darkMode,this._darkModeCb=e=>{this.isDarkMode=e,this.requestUpdate()}}connectedCallback(){super.connectedCallback(),ut.subscribe(this._darkModeCb)}disconnectedCallback(){ut.unsubscribe(this._darkModeCb),super.disconnectedCallback()}getDefaultYear(){return((new Date).getFullYear()+1).toString()}getLinkWithQueryParams(e){const t=new URL(e),r=new URLSearchParams(t.search);return r.has("utm_source")||r.set("utm_source","off"),r.has("utm_medium")||r.set("utm_medium","web"),r.has("utm_campaign")||r.set("utm_campaign",`donate-${this.currentYear}-a`),r.has("utm_term")||r.set("utm_term","en-text-button"),t.search=r.toString(),t.toString()}get donateLink(){const e=Et.get(),t=e in this.links?this.links[e]:this.links.default;return this.getLinkWithQueryParams(t)}render(){const e={"dark-mode":this.isDarkMode};return c`<section class=${ko(e)}> 2940 <div class="donation-banner-footer row"> 2941 <div class="donation-banner-footer__left-aside"> 2942 <div class="donation-banner-footer__hook-section"> 2943 <p> 2944 ${d("Help us inform millions of consumers around the world about what they eat")} 2945 </p> 2946 </div> 2947 <img 2948 class="group-image" 2949 src="${ct("donation-banner-group-photo.png")}" 2950 alt="${d(Re`group photo donation ${this.currentYear}`)}" 2951 /> 2952 </div> 2953 <div class="donation-banner__main-div-wrapper"> 2954 <div style="padding-left: 16px;"> 2955 <div class="donation-banner-footer__main-section"> 2956 <img 2957 width="50" 2958 height="50" 2959 src="${ct("CMJN-ICON_WHITE_BG_OFF.svg")}" 2960 alt="open food facts logo" 2961 /> 2962 <h3 class="donation-banner-footer__main-title"> 2963 ${d(Re`Please give to our ${this.currentYear} Fundraiser`)} 2964 </h3> 2965 </div> 2966 <p style="margin: 0 0 20px; font-size: 14px;"> 2967 ${d("Your donations fund the day-to-day operations of our non-profit association:")} 2968 </p> 2969 <ul class="unordered-list"> 2970 <li>${d("keeping our database open & available to all,")}</li> 2971 <li> 2972 ${d("technical infrastructure (website/mobile app) & a small permanent team")} 2973 </li> 2974 <li> 2975 <p>${d("remain independent of the food industry,")}</p> 2976 </li> 2977 <li> 2978 <p>${d("engage a community of committed citizens,")}</p> 2979 </li> 2980 <li> 2981 <p>${d("support the advancement of public health research.")}</p> 2982 </li> 2983 </ul> 2984 </div> 2985 <div class="donation-banner-footer__actions-section"> 2986 <div class="donation-banner-footer__actions-section__financial"> 2987 <p style="margin: 0px; line-height: 1.6"> 2988 ${d("Each donation counts! We appreciate your support in bringing further food transparency in the world.")} 2989 </p> 2990 </div> 2991 <div class="donation-banner-footer__actions-section__donate-button"> 2992 <a href="${this.donateLink}"> 2993 <button>${d("I SUPPORT")}</button> 2994 </a> 2995 </div> 2996 </div> 2997 </div> 2998 </div> 2999 </section>`}};wo.styles=$` 3000 .donation-banner, 3001 .donation-banner-footer { 3002 position: relative; 3003 display: flex; 3004 justify-content: center; 3005 align-items: center; 3006 padding: 20px 0; 3007 border: 10px solid #ff6e78; 3008 width: 100%; 3009 background-color: white; 3010 box-sizing: border-box; 3011 border-radius: 20px; 3012 } 3013 .dark-mode .donation-banner, 3014 .dark-mode .donation-banner-footer { 3015 background-color: #2d2724; 3016 color: #f9f7f5; 3017 border-color: #ff6e78; 3018 border-radius: 20px; 3019 } 3020 .dark-mode .donation-banner__main-title, 3021 .dark-mode .donation-banner-footer__main-title { 3022 color: #ff6e78; 3023 } 3024 .dark-mode .donation-banner__main-div-wrapper { 3025 color: #f9f7f5; 3026 } 3027 .dark-mode .donation-banner__hook-section, 3028 .dark-mode .donation-banner-footer__hook-section { 3029 background-color: #0050a0; 3030 color: #fff; 3031 } 3032 @media (max-width: 732px) { 3033 .donation-banner, 3034 .donation-banner-footer { 3035 flex-direction: column; 3036 padding: 20px 10px; 3037 } 3038 } 3039 .group-image { 3040 height: auto; 3041 max-width: 100%; 3042 display: inline-block; 3043 vertical-align: middle; 3044 }
3045 .donation-banner__group-photo, 3046 .donation-banner-footer__group-photo { 3047 border-radius: 5px; 3048 } 3049 .donation-banner__close button, 3050 .donation-banner-footer__close button { 3051 position: absolute; 3052 top: 0.3rem; 3053 right: 0.3rem; 3054 cursor: pointer; 3055 background-color: transparent; 3056 color: inherit; 3057 } 3058 .donation-banner__hook-section, 3059 .donation-banner-footer__hook-section { 3060 display: flex; 3061 justify-content: center; 3062 align-items: center; 3063 background-color: #008c8c; 3064 color: white; 3065 padding: 10px; 3066 margin: 10px; 3067 border-radius: 10px; 3068 z-index: 1; 3069 } 3070 .donation-banner__hook-section p, 3071 .donation-banner-footer__hook-section p { 3072 font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif; 3073 font-size: 25px; 3074 font-weight: 700; 3075 line-height: 35px; 3076 text-transform: uppercase; 3077 margin: 0; 3078 } 3079 @media (max-width: 732px) { 3080 .donation-banner__hook-section p, 3081 .donation-banner-footer__hook-section p { 3082 font-size: 15px; 3083 line-height: 20px; 3084 } 3085 } 3086 .donation-banner__left-aside, 3087 .donation-banner-footer__left-aside { 3088 width: 60%; 3089 margin: 0 10px; 3090 display: flex; 3091 flex-direction: column; 3092 align-items: center; 3093 } 3094 .donation-banner__left-aside img, 3095 .donation-banner-footer__left-aside img { 3096 transform: translatey(-15px); 3097 } 3098 .donation-banner__aside, 3099 .donation-banner-footer__aside { 3100 display: flex; 3101 flex-direction: column; 3102 } 3103 .donation-banner__main-title, 3104 .donation-banner-footer__main-title { 3105 font-family: "Public Sans", Helvetica, Roboto, Arial, sans-serif; 3106 color: #ff6e78; 3107 font-weight: 800; 3108 font-size: 25px; 3109 margin: 0.2rem 0rem 0.5rem; 3110 font-weight: 500; 3111 } 3112 .donation-banner__main-div-wrapper { 3113 color: black; 3114 } 3115 .donation-banner__main-div { 3116 font-family: "Public Sans", Helvetica, Roboto, Arial, sans-serif; 3117 } 3118 .donation-banner__main-section, 3119 .donation-banner-footer__main-section { 3120 display: flex; 3121 align-items: center; 3122 } 3123 .donation-banner__actions-section, 3124 .donation-banner-footer__actions-section { 3125 display: flex; 3126 justify-content: space-around; 3127 gap: 15px; 3128 padding: 0 10px; 3129 } 3130 @media (max-width: 732px) { 3131 .donation-banner__actions-section, 3132 .donation-banner-footer__actions-section { 3133 flex-direction: column; 3134 align-items: center; 3135 padding: 20px 10px; 3136 } 3137 } 3138 .donation-banner__actions-section__financial, 3139 .donation-banner-footer__actions-section__financial { 3140 width: 50%; 3141 } 3142 @media (max-width: 732px) { 3143 .donation-banner__actions-section__financial, 3144 .donation-banner-footer__actions-section__financial { 3145 width: 90%; 3146 } 3147 } 3148 .donation-banner__actions-section__financial p, 3149 .donation-banner-footer__actions-section__financial p { 3150 font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif; 3151 font-size: 15px; 3152 color: #008c8c; 3153 font-weight: bolder; 3154 } 3155 .donation-banner__actions-section__donate-button, 3156 .donation-banner-footer__actions-section__donate-button { 3157 width: 40%; 3158 } 3159 .donation-banner__actions-section__donate-button a button, 3160 .donation-banner-footer__actions-section__donate-button a button { 3161 background-color: #ff6e78; 3162 border-radius: 30px; 3163 font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; 3164 font-size: 20px; 3165 font-weight: 900; 3166 padding: 1.1428571429rem 2.2857142857rem 1.2142857143rem; 3167 color: white; 3168 border: none; 3169 cursor: pointer; 3170 } 3171 @media (max-width: 837px) { 3172 .donation-banner-footer__actions-section__donate-button a button { 3173 padding: 1rem 2rem 1rem; 3174 font-size: 16px; 3175 } 3176 } 3177 @media (min-width: 733px) and (max-width: 837px) { 3178 .donation-banner-footer__actions-section__donate-button a button { 3179 padding: 1rem 2rem 1rem; 3180 font-size: 16px; 3181 margin-left: -15px; 3182 } 3183 } 3184 .donation-banner__actions-section__donate-button a button:hover, 3185 .donation-banner-footer__actions-section__donate-button a button:hover { 3186 background-color: rgba(255, 110, 120, 0.8); 3187 } 3188 .unordered-list { 3189 margin-left: 15.4px; 3190 margin-bottom: 20px; 3191 margin-top: 0; 3192 padding: 1px; 3193 line-height: 1.6; 3194 font-size: 14px; 3195 padding-right: 10px; 3196 } 3197 .unordered-list li p { 3198 margin: 0; 3199 } 3200 `,Ns([g({type:Object})],wo.prototype,"links",2),Ns([g({type:String,reflect:!0})],wo.prototype,"currentYear",2),wo=Ns([E("donation-banner"),H()],wo
3200);var yf=Object.defineProperty,xf=Object.getOwnPropertyDescriptor,ir=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?xf(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&yf(t,r,i),i};let ft=class extends S{constructor(){super(...arguments),this.hidePlayStore=!1,this.hideFDroid=!1,this.hideApk=!1,this.hideAppStore=!1,this.hideImage=!1,this.isDarkMode=ut.darkMode,this._darkModeCb=e=>{this.isDarkMode=e,this.requestUpdate()},this.fDroidAppLink="https://f-droid.org/packages/openfoodfacts.github.scrachx.openfood"}connectedCallback(){super.connectedCallback(),ut.subscribe(this._darkModeCb)}disconnectedCallback(){ut.unsubscribe(this._darkModeCb),super.disconnectedCallback()}getAndroidUrlSuffix(e,t){return`?utm_source=off&utf_medium=web&utm_campaign=${t}_${e}`}getAndroidAppLink(e){return`https://play.google.com/store/apps/details?id=org.openfoodfacts.scanner&hl=${e}${this.getAndroidUrlSuffix(e,"install_the_app_android_footer")}`}getAndroidApkAppLink(e){return`https://github.com/openfoodfacts/smooth-app/releases/latest${this.getAndroidUrlSuffix(e,"install_the_app_apk_footer")}`}getAndroidAppIconPath(e){return`https://play.google.com/intl/en_us/badges/static/images/badges/${e}_badge_web_generic.png`}getFDroidAppIconPath(e){return`https://fdroid.gitlab.io/artwork/badge/get-it-on-${e}.png`}getIosAppIconPath(e){return"en"===e?"appstore/black/appstore_UK.svg":`appstore/black/appstore_${e.toLocaleUpperCase()}.svg`}getIosAppLink(e){return`https://apps.apple.com/app/open-food-facts/id588797948?utm_source=off&utf_medium=web&utm_campaign=install_the_app_ios_footer_${e}`}generateBadgeLink(e,t,r,o,n){return c` 3201 <a class="no-text-decoration" href="${e}"> 3202 <img 3203 id="${o}" 3204 src="${t}" 3205 alt="${r}" 3206 loading="lazy" 3207 height="40" 3208 width="120" 3209 @error=${n} 3210 /> 3211 </a> 3212 `}getFilteredBadges(){const e=Et.get();return[{href:this.getAndroidAppLink(e),src:this.getAndroidAppIconPath(e),alt:d("Get It On Google Play"),id:"playstore_badge",hide:this.hidePlayStore,errorHandler:e=>{e.target.src=this.getAndroidAppIconPath("en")}},{href:this.fDroidAppLink,src:this.getFDroidAppIconPath(e),alt:d("Available on F-Droid"),id:"fdroid_badge",hide:this.hideFDroid,errorHandler:e=>{e.target.src=this.getFDroidAppIconPath("en")}},{href:this.getAndroidApkAppLink(e),src:ct("download-apk_en.svg"),alt:d("Android APK"),id:"apk_badge",hide:this.hideApk},{href:this.getIosAppLink(e),src:ct(this.getIosAppIconPath(e)),alt:d("Download on the App Store"),id:"appstore_badge",hide:this.hideAppStore,errorHandler:e=>{e.target.src=ct(this.getIosAppIconPath("en"))}}].filter(e=>0==e.hide)}renderImage(){return this.hideImage?D:c` 3213 <div class="logo-container"> 3214 <img 3215 class="responsive-image" 3216 src="${ct("app-icon-in-the-clouds.svg")}" 3217 alt="The Open Food Facts logo in the cloud" 3218 style="height:120px" 3219 /> 3220 <div id="footer_scan" style="display:block"> 3221 <div id="footer_install_the_app">${d("Install the app!")}</div> 3222 <!-- TODO find fix to add text between span for translations ex for fr : "Scannez vos <span class="foods">aliments</span> de votre <span class="everyday">quotidien</span>" --> 3223 ${d(c`Scan your <span class="everyday">everyday</span> <span class="foods">foods</span>`)} 3224 </div> 3225 </div> 3226 `}renderBadges(){const e=this.getFilteredBadges();return c` ${e.length>0?c` 3227 <div class="badge-container "> 3228 ${e.map(e=>this.generateBadgeLink(e.href,e.src,e.alt,e.id,e.errorHandler))} 3229 </div> 3230 `:""}`}render(){const e={"dark-mode":this.isDarkMode};return c` 3231 <div class=${ko(e)} id="install_the_app_block"> 3232 ${this.renderImage()} ${this.renderBadges()} 3233 </div> 3234 `}};ft.styles=[$` 3235 :host { 3236 display: block; 3237 } 3238 .dark-mode { 3239 background-color: #201a17; 3240 color: #f9f7f5; 3241 } 3242 #footer_scan { 3243 color: #000; 3244 } 3245 .dark-mode #footer_scan { 3246 color: #f9f7f5; 3247 } 3248 .everyday { 3249 background-color: #0064c8; 3250 border-inline: 5px solid #0064c8; 3251 color: #fff; 3252 } 3253 .dark-mode .everyday { 3254 background-color: #0050a0; 3255 border-inline: 5px solid #0050a0; 3256 color: #fff; 3257 } 3258 .foods { 3259 background-color: #ff8714; 3260 border-inline: 5px solid #ff8714; 3261 color: #fff; 3262 } 3263 .dark-mode .foods { 3264 background-color: #cc6c10; 3265 border-inline: 5px solid #cc6c10; 3266 color: #fff; 3267 } 3268 #install_the_app_block { 3269 display: flex; 3270 align-items: center; 3271 justify-content: center; 3272 flex-wrap: wrap; 3273 gap: 2rem; 3274 } 3275 #footer_install_the_app { 3276 font-family: "Public Sans", Helvetica, Roboto, Arial, sans-serif; 3277 font-weight: 550; 3278 font-size: 26px; 3279 line-height: 30px; 3280 text-transform: uppercase; 3281 margin-bottom: 8px; 3282 } 3283 #footer_scan { 3284 font-family: "Public Sans", Helvetica, Roboto, Arial, sans-serif; 3285 font-style: normal; 3286 font-weight: 550; 3287 font-size: 22px; 3288 line-height: 28px; 3289 display: flex; 3290 align-items: center; 3291 text-align: center; 3292 color: #000; 3293 max-width: 420px; 3294 } 3295 @media (max-width: 480px) { 3296 #footer_install_the_app { 3297 font-size: 20px; 3298 line-height: 24px; 3299 } 3300 #footer_scan { 3301 font-size: 18px; 3302 line-height: 22px; 3303 } 3304 } 3305 @media (min-width: 768px) { 3306 #footer_install_the_app { 3307 font-size: 28px; 3308 line-height: 32px; 3309 } 3310 #footer_scan { 3311 font-size: 24px; 3312 line-height: 30px; 3313 } 3314 } 3315 @media (min-width: 1024px) { 3316 #footer_install_the_app { 3317 font-size: 30px; 3318 line-height: 34px; 3319 } 3320 #footer_scan { 3321 font-size: 26px; 3322 line-height: 32px; 3323 } 3324 } 3325 .everyday { 3326 transform: rotate(2.5deg); 3327 background-color: #0064c8; 3328 border-inline: 5px solid #0064c8; 3329 line-height: 130%; 3330 font-weight: 550; 3331 color: #fff; 3332 border-radius: 5px; 3333 text-transform: uppercase; 3334 display: inline-block; 3335 } 3336 .foods { 3337 transform: rotate(-3deg); 3338 background-color: #ff8714; 3339 border-inline: 5px solid #ff8714; 3340 line-height: 130%; 3341 font-weight: 550; 3342 color: #fff; 3343 border-radius: 5px; 3344 text-transform: uppercase; 3345 display: inline-block; 3346 } 3347 .no-text-decoration { 3348 text-decoration: none; 3349 } 3350 .badge-container { 3351 display: grid; 3352 gap: 0.2rem; /* Reduced horizontal gap */ 3353 grid-template-columns: repeat(2, 1fr); 3354 } 3355 @media (min-width: 768px) { 3356 .badge-container { 3357 grid-template-columns: repeat(4, 1fr); 3358 } 3359 } 3360 .responsive-container { 3361 flex-direction: column; 3362 text-align: center; 3363 } 3364 @media (min-width: 768px) { 3365 .badge-container { 3366 display: flex; 3367 justify-content: center; 3368 } 3369 } 3370 @media (max-width: 480px) { 3371 .badge-container { 3372 grid-template-columns: 1fr; 3373 gap: 0.5rem; 3374 } 3375 .responsive-container { 3376 flex-direction: column; 3377 text-align: center; 3378 } 3379 .responsive-image { 3380 margin-bottom: 1rem; 3381 } 3382 .responsive-text { 3383 margin-top: 0.5rem; 3384 } 3385 } 3386 #fdroid_badge { 3387 transform: scale(1.1); 3388 height: 50px; 3389 margin-top: -4px; 3390 } 3391 #playstore_badge { 3392 height: 45px; 3393 } 3394 3395 .logo-container { 3396 display: flex; 3397 justify-content: center; 3398 align-items: center; 3399 max-width: 720px; 3400 gap: 2rem; 3401 flex-wrap: wrap; 3402 } 3403 `],ir([g({type:Boolean,attribute:"hide-play-store"})],ft.prototype,"hidePlayStore",2),ir([g({type:Boolean,attribute:"hide-f-droid"})],ft.prototype,"hideFDroid",2),ir([g({type:Boolean,attribute:"hide-apk"})],ft.prototype,"hideApk",2),ir([g({type:Boolean,attribute:"hide-app-store"})],ft.prototype,"hideAppStore",2),ir([g({type:Boolean,attribute:"hide-image"})],ft.prototype,"hideImage",2),ir([b()],ft.prototype,"fDroidAppLink",2),ft=ir([E("mobile-badges"),H()],ft);var $f=Object.defineProperty,_f=Object.getOwnPropertyDescriptor,kc=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?_f(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&$f(t,r,i),i};let qi=class extends S{constructor(){super(...arguments),this.styleOptions={width:"180px",height:"180px"}}render(){return c` 3404 <img 3405 style=${_r(this.styleOptions)} 3406 src=${ct("qrcode_en.svg")} 3407 alt=${d("Download the OFF app with this QR code")} 3408 title=${d("Download the OFF app with this QR code")} 3409 /> 3410 `}};kc([g({type:Object,attribute:"style-options"})],qi.prototype,"styleOptions",2),qi=kc([E("download-app-qr-code"),H()],qi);var kf=Object.getOwnPropertyDescriptor,Cf=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?kf(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(i)||i);return i};let Wi=class extends S{render(){return c` 3411 <svg 3412 width="37" 3413 height="37"
3414 viewBox="0 0 37 37" 3415 version="1.1" 3416 xmlns="http://www.w3.org/2000/svg" 3417 xmlns:xlink="http://www.w3.org/1999/xlink" 3418 > 3419 <title>${d("Barcode corners icon")}</title> 3420 <g id="Barcode-corners" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 3421 <g id="icons8-barcode" transform="translate(0, 2)" fill="#FFFFFF" fill-rule="nonzero"> 3422 <path 3423 d="M0.80952381,8.36507937 C1.26825397,8.36507937 1.61904762,8.01428571 1.61904762,7.55555556 L1.61904762,3.50793651 C1.61904762,2.45555556 2.45555556,1.61904762 3.50793651,1.61904762 L7.55555556,1.61904762 C8.01428571,1.61904762 8.36507937,1.26825397 8.36507937,0.80952381 C8.36507937,0.350793651 8.01428571,0 7.55555556,0 L3.50793651,0 C1.56507937,0 0,1.56507937 0,3.50793651 L0,7.55555556 C0,8.01428571 0.350793651,8.36507937 0.80952381,8.36507937 Z M3.50793651,33 L7.55555556,33 C8.01428571,33 8.36507937,32.6492063 8.36507937,32.1904762 C8.36507937,31.731746 8.01428571,31.3809524 7.55555556,31.3809524 L3.50793651,31.3809524 C2.45555556,31.3809524 1.61904762,30.5444444 1.61904762,29.4920635 L1.61904762,25.4444444 C1.61904762,24.9857143 1.26825397,24.6349206 0.80952381,24.6349206 C0.350793651,24.6349206 0,24.9857143 0,25.4444444 L0,29.4920635 C0,31.4349206 1.56507937,33 3.50793651,33 Z M36.1904762,24.6349206 C35.731746,24.6349206 35.3809524,24.9857143 35.3809524,25.4444444 L35.3809524,29.4920635 C35.3809524,30.5444444 34.5444444,31.3809524 33.4920635,31.3809524 L29.4444444,31.3809524 C28.9857143,31.3809524 28.6349206,31.731746 28.6349206,32.1904762 C28.6349206,32.6492063 28.9857143,33 29.4444444,33 L33.4920635,33 C35.4349206,33 37,31.4349206 37,29.4920635 L37,25.4444444 C37,24.9857143 36.6492063,24.6349206 36.1904762,24.6349206 Z M33.2871429,1 L29.2395238,1 C28.7807937,1 28.43,1.35079365 28.43,1.80952381 C28.43,2.26825397 28.7807937,2.61904762 29.2395238,2.61904762 L33.2871429,2.61904762 C34.3395238,2.61904762 35.1760317,3.45555556 35.1760317,4.50793651 L35.1760317,8.55555556 C35.1760317,9.01428571 35.5268254,9.36507937 35.9855556,9.36507937 C36.4442857,9.36507937 36.7950794,9.01428571 36.7950794,8.55555556 L36.7950794,4.50793651 C36.7950794,2.56507937 35.23,1 33.2871429,1 Z M10.984127,27.2857143 C11.4428571,27.2857143 11.7936508,26.8453917 11.7936508,26.2695853 L11.7936508,7.30184332 C11.7936508,6.72603687 11.4428571,6.28571429 10.984127,6.28571429 C10.5253968,6.28571429 10.1746032,6.72603687 10.1746032,7.30184332 L10.1746032,26.2695853 C10.1746032,26.8453917 10.5253968,27.2857143 10.984127,27.2857143 Z M6.98412698,27.2857143 C7.44285714,27.2857143 7.79365079,26.8453917 7.79365079,26.2695853 L7.79365079,7.30184332 C7.79365079,6.72603687 7.44285714,6.28571429 6.98412698,6.28571429 C6.52539683,6.28571429 6.17460317,6.72603687 6.17460317,7.30184332 L6.17460317,26.2695853 C6.17460317,26.8453917 6.52539683,27.2857143 6.98412698,27.2857143 Z M14.7619048,27.2857143 C15.2206349,27.2857143 15.5714286,26.8453917 15.5714286,26.2695853 L15.5714286,7.30184332 C15.5714286,6.72603687 15.2206349,6.28571429 14.7619048,6.28571429 C14.3031746,6.28571429 13.952381,6.72603687 13.952381,7.30184332 L13.952381,26.2695853 C13.952381,26.8453917 14.3031746,27.2857143 14.7619048,27.2857143 Z M18.5396825,27.2857143 C18.9984127,27.2857143 19.3492063,26.8453917 19.3492063,26.2695853 L19.3492063,7.30184332 C19.3492063,6.72603687 18.9984127,6.28571429 18.5396825,6.28571429 C18.0809524,6.28571429 17.7301587,6.72603687 17.7301587,7.30184332 L17.7301587,26.2695853 C17.7301587,26.8453917 18.0809524,27.2857143 18.5396825,27.2857143 Z M26.015873,27.2857143 C26.4746032,27.2857143 26.8253968,26.8453917 26.8253968,26.2695853 L26.8253968,7.30184332 C26.8253968,6.72603687 26.4746032,6.28571429 26.015873,6.28571429 C25.5571429,6.28571429 25.2063492,6.72603687 25.2063492,7.30184332 L25.2063492,26.2695853 C25.2063492,26.8453917 25.5571429,27.2857143 26.015873,27.2857143 Z M22.015873,27.2857143 C22.4746032,27.2857143 22.8253968,26.8453917 22.8253968,26.2695853 L22.8253968,7.30184332 C22.8253968,6.72603687 22.4746032,6.28571429 22.015873,6.28571429 C21.5571429,6.28571429 21.2063492,6.72603687 21.2063492,7.30184332 L21.2063492,26.2695853 C21.2063492,26.8453917 21.5571429,27.2857143 22.015873,27.2857143 Z M30.015873,27.2857143 C30.4746032,27.2857143 30.8253968,26.8453917 30.8253968,26.2695853 L30.8253968,7.30184332 C30.8253968,6.72603687 30.4746032,6.28571429 30.015873,6.28571429 C29.5571429,6.28571429 29.2063492,6.72603687 29.2063492,7.30184332 L29.2063492,26.2695853 C29.2063492,26.8453917 29.5571429,27.2857143 30.015873,27.2857143 Z" 3424 id="Shape" 3425 ></path> 3426 </g> 3427 </g> 3428 </svg> 3429 `}};Wi.styles=$` 3430 :host { 3431 display: inline-block; 3432 width: 37px; 3433 height: 37px; 3434 } 3435 svg { 3436 width: 100%; 3437 height: 100%; 3438 } 3439 `,Wi=Cf([E("barcode-icon"),H()],Wi);var Sf=Object.getOwnPropertyDescriptor,Ef=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Sf(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(i)||i);return i};let Ki=class extends S{render(){return c` 3440 <svg 3441 width="16px" 3442 height="16px"
3443 viewBox="0 0 16 16" 3444 version="1.1" 3445 xmlns="http://www.w3.org/2000/svg" 3446 xmlns:xlink="http://www.w3.org/1999/xlink" 3447 > 3448 <title>Shape</title> 3449 <g id="Icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 3450 <g id="Search" fill="#000000" fill-rule="nonzero"> 3451 <path 3452 d="M6.66263618,0 C2.99085545,0 0,2.99085545 0,6.66263618 C0,10.334417 2.99085545,13.3252724 6.66263618,13.3252724 C8.25934227,13.3252724 9.72570654,12.7582727 10.874932,11.8170701 L14.8529942,15.7951322 C15.0201041,15.9691875 15.2682543,16.0393016 15.5017411,15.9784339 C15.7352279,15.9175662 15.9175662,15.7352279 15.9784339,15.5017411 C16.0393016,15.2682543 15.9691875,15.0201041 15.7951322,14.8529942 L11.8170701,10.874932 C12.7582727,9.72570654 13.3252724,8.25934227 13.3252724,6.66263618 C13.3252724,2.99085545 10.334417,0 6.66263618,0 Z M6.66263618,1.33252724 C9.61426595,1.33252724 11.9927451,3.71100667 11.9927451,6.66263618 C11.9927451,9.61426595 9.61426595,11.9927451 6.66263618,11.9927451 C3.71100667,11.9927451 1.33252724,9.61426595 1.33252724,6.66263618 C1.33252724,3.71100667 3.71100667,1.33252724 6.66263618,1.33252724 Z" 3453 id="Shape" 3454 ></path> 3455 </g> 3456 </g> 3457 </svg> 3458 `}};Ki.styles=$` 3459 svg, 3460 svg path { 3461 fill: #ffffff; 3462 } 3463 `,Ki=Ef([E("search-icon")],Ki);var Tf=Object.getOwnPropertyDescriptor,Af=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Tf(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=n(i)||i);return i};let Yi=class extends S{render(){return c` 3464 <svg 3465 width="12px" 3466 height="12px"
3467 viewBox="0 0 12 12" 3468 version="1.1" 3469 xmlns="http://www.w3.org/2000/svg" 3470 xmlns:xlink="http://www.w3.org/1999/xlink" 3471 > 3472 <title>Close</title> 3473 <g id="Close" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> 3474 <g id="close" transform="translate(0, 0.1021)" fill="#000000" fill-rule="nonzero"> 3475 <path 3476 d="M0.752398486,0.000327615426 C0.447676997,0.000407642063 0.173386346,0.185108686 0.0587220133,0.467433469 C-0.0559423192,0.749758252 0.0118849522,1.07340821 0.230256049,1.28593881 L4.94270174,5.9983842 L0.230256049,10.7108297 C0.0346299462,10.8986525 -0.0441726876,11.1775583 0.0242395587,11.439983 C0.092651805,11.7024077 0.29758879,11.9073446 0.560013509,11.9757568 C0.822438228,12.044169 1.10134403,11.9653663 1.28916672,11.7697401 L6.00161211,7.05729458 L10.7140577,11.7697401 C10.9018799,11.9653685 11.1807868,12.0441728 11.4432128,11.9757609 C11.7056389,11.907349 11.9105769,11.702411 11.9789888,11.4399849 C12.0474007,11.1775588 11.9685964,10.898652 11.772968,10.7108297 L7.06052249,5.9983842 L11.772968,1.28593881 C11.9944461,1.07065294 12.0610395,0.741480633 11.9406599,0.457035041 C11.8202802,0.172589449 11.5376228,-0.00877712235 11.2288872,0.000327615426 C11.0343388,0.00612451054 10.8496893,0.0874332576 10.7140577,0.22702814 L6.00161211,4.93947383 L1.28916672,0.22702814 C1.14818126,0.0821025075 0.954587359,0.000339401564 0.752398486,0.000327615426 Z" 3477 id="Path" 3478 ></path> 3479 </g> 3480 </g> 3481 </svg> 3482 `}};Yi.styles=$``,Yi=Af([E("close-icon")],Yi);const If=e=>class extends e{constructor(){super(...arguments),this.lastLogTime={}}logToConsole(e,t,r=3e4){const o=Date.now();o-this.lastLogTime[e]>=r&&(console.log(t),this.lastLogTime[e]=o)}};var Pf=Object.defineProperty,Of=Object.getOwnPropertyDescriptor,Lt=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Of(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Pf(t,r,i),i};let tt=class extends(If(S)){constructor(){super(),this.wrapperStyle={height:"300px",width:"100%","max-width":"100%"}
3482,this.runScanner=!1,this.barcode="",this.stream=null,this.codeReader=null,this.setupBarcodeDetector()}get isVideoPlaying(){return null!==this.stream}get canDetect(){return void 0!==this.detectFn}async firstUpdated(){this.runScanner&&await this.askPermission()}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),this.hasUpdated&&"run-scanner"===e&&(this.runScanner?this.askPermission():this.stream&&this.stopVideo())}setupBarcodeDetector(){try{this.codeReader=new BarcodeDetector({formats:["ean_13","ean_8"]}),this.detectFn=this.detectWithBarcodeDetector,this.sendBarcodeStateEvent({state:"detector-available"})}catch(e){this.sendBarcodeStateEvent({state:"detector-not-available"}),console.warn("BarcodeDetector not available:",e)}}async detectWithBarcodeDetector(e){try{const t=this.codeReader;if(t){const r=await t.detect(e);if(r.length>0)return r[0].rawValue}}catch(e){console.error("Error detecting barcode:",e)}}async askPermission(){if(this.canDetect){try{const e=await navigator.permissions.query({name:"camera"});if(["granted","prompt"].includes(e.state))return void await this.startCamera();console.warn("Camera permission denied. Please enable it in your browser settings.")}catch(e){console.error("Permission query error:",e)}this.sendBarcodeStateEvent({barcode:this.barcode,state:"no-permission"})}else this.sendBarcodeStateEvent({state:"detector-not-available"})}async startCamera(){try{this.stream=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment",width:{ideal:640,max:1280},height:{ideal:480,max:720}}}),this.video&&(this.video.srcObject=this.stream,await this.video.play(),this.sendBarcodeStateEvent({state:"started"}),this.setupFrameCapture())}catch(e){console.error("Error accessing camera: ",e)}}stopVideo(){this.stream&&(this.stream.getTracks().forEach(e=>e.stop()),this.video.srcObject=null,this.stream=null)}sendBarcodeStateEvent(e){this.dispatchEvent(new CustomEvent(we.BARCODE_SCANNER_STATE,{detail:e}))}exit(e){e.stopPropagation(),this.stopVideo(),this.sendBarcodeStateEvent({state:"exited"})}setupFrameCapture(){const e=this.video,t=async()=>{if(e.paused||e.ended)return void requestAnimationFrame(t);let r;try{r=await createImageBitmap(e,0,0,e.videoWidth,e.videoHeight)}catch(e){this.logToConsole("image-bitmap",`Error creating image bitmap: ${e}`)}if(r)try{const e=await this.detectFn(r);if(e)return this.barcode=e,this.sendBarcodeStateEvent({barcode:this.barcode,state:"detected"}),void this.stopVideo()}catch(e){console.error("Barcode detection error:",e)}requestAnimationFrame(t)};requestAnimationFrame(t)}disconnectedCallback(){super.disconnectedCallback(),this.stopVideo()}renderOverlay(){return this.canDetect?this.isVideoPlaying?c` 3483 <div class="cta-overlay-wrapper" @click=${this.askPermission}> 3484 <div class="cta-exit-button"> 3485 <button class="button white-button small" @click=${this.exit}> 3486 <close-icon></close-icon><span>${d("Close")}</span> 3487 </button> 3488 </div> 3489 <div class="centered-overlay"> 3490 <div class="cta-overlay-frame right-top-border"></div> 3491 <div class="cta-overlay-frame left-top-border"></div> 3492 <div class="cta-overlay-frame right-bottom-border"></div> 3493 <div class="cta-overlay-frame left-bottom-border"></div> 3494 <div class="cta-overlay"> 3495 <div class="cta-overlay-icon"> 3496 <button class="cta-overlay-button"> 3497 <search-icon></search-icon> 3498 </button> 3499 </div> 3500 </div> 3501 </div> 3502 </div> 3503 `:c` 3504 <div class="cta-overlay-wrapper" @click=${this.askPermission}> 3505 <div class="centered-overlay"> 3506 <div class="cta-overlay"> 3507 <div class="cta-overlay-icon"> 3508 <button class="cta-overlay-button start-scanning"> 3509 <barcode-icon></barcode-icon> 3510 </button> 3511 </div> 3512 <div class="cta-overlay-text"> 3513 <slot name="message-before-scanning"> 3514 ${d("Click to scan a barcode and find out its details (health, preferences, etc.)")} 3515 </slot> 3516 </div> 3517 </div> 3518 </div> 3519 </div> 3520 `:c` <div class="cta-overlay-wrapper"> 3521 <div class="centered-overlay"> 3522 <div class="cta-overlay"> 3523 <div class="cta-overlay-text"> 3524 ${d("Your browser does not support barcode scanning.")} 3525 </div> 3526 </div> 3527 </div> 3528 </div>`}render(){return c` 3529 <div class="barcode-scanner" style=${_r(this.wrapperStyle)}> 3530 <video width="100%"></video> 3531 <div class="overlay-wrapper">${this.renderOverlay()}</div> 3532 </div> 3533 `}};tt.styles=[or,Oe([B.White]),$` 3534 :host { 3535 width: 100%; 3536 } 3537 .barcode-scanner { 3538 display: block; 3539 position: relative; 3540 width: 100%; 3541 } 3542 .barcode-scanner video { 3543 display: block; 3544 background-color: black; 3545 border-radius: 8px; 3546 width: 100%; 3547 height: 100%; 3548 } 3549 .overlay-wrapper { 3550 top: 0; 3551 left: 0; 3552 width: 100%; 3553 height: 100%; 3554 position: absolute; 3555 cursor: pointer; 3556 z-index: 1; 3557 } 3558 .centered-overlay { 3559 position: relative; 3560 display: flex; 3561 flex-direction: column; 3562 justify-content: center; 3563 align-items: center; 3564 max-width: 100%; 3565 width: 100%; 3566 height: 100%; 3567 } 3568 3569 .video-frame { 3570 border: 3px solid #fff; 3571 border-radius: 8px; 3572 box-sizing: border-box; 3573 } 3574 .cta-overlay-wrapper { 3575 width: 100%; 3576 height: 100%; 3577 padding: 10%; 3578 cursor: pointer; 3579 box-sizing: border-box; 3580 } 3581 3582 .cta-exit-button { 3583 position: absolute; 3584 display: flex; 3585 align-items: baseline; 3586 justify-content: center; 3587 3588 top: 3px; 3589 left: 3px; 3590 z-index: 2; 3591 } 3592 3593 .cta-overlay-text { 3594 text-align: center; 3595 color: white; 3596 } 3597 .cta-overlay-icon { 3598 display: flex; 3599 justify-content: center; 3600 } 3601 .cta-overlay-button { 3602 z-index: 2; 3603 display: flex; 3604 justify-content: center; 3605 align-items: center; 3606 width: 70px; 3607 height: 70px; 3608 border-radius: 50%; 3609 border: none; 3610 margin-top: 1rem; 3611 cursor: pointer; 3612 margin-bottom: 1rem; 3613 background-color: transparent; 3614 } 3615 .cta-overlay-button.start-scanning { 3616 background-color: #4c4c4d; 3617 } 3618 3619 .cta-overlay { 3620 position: relative; 3621 } 3622 3623 .cta-overlay-frame { 3624 width: 15%; 3625 height: 15%; 3626 position: absolute; 3627 } 3628 3629 .cta-overlay-frame.left-top-border { 3630 top: 40px; 3631 left: 0px; 3632 border-left: 2px solid white; 3633 border-top: 2px solid white; 3634 border-radius: 8px 0 0 0; 3635 } 3636 3637 .cta-overlay-frame.left-bottom-border { 3638 left: 0px; 3639 bottom: 40px; 3640 border-left: 2px solid white; 3641 border-bottom: 2px solid white; 3642 border-radius: 0 0 0 8px; 3643 } 3644 .cta-overlay-frame.right-bottom-border { 3645 right: 0px; 3646 bottom: 40px; 3647 border-right: 2px solid white; 3648 border-bottom: 2px solid white; 3649 border-radius: 0 0 8px 0; 3650 } 3651 3652 .cta-overlay-frame.right-top-border { 3653 right: 0px; 3654 top: 40px; 3655 border-right: 2px solid white; 3656 border-top: 2px solid white; 3657 border-radius: 0 8px 0 0; 3658 } 3659 `],Lt([g({type:Object,attribute:"wrapper-style",reflect:!0})],tt.prototype,"wrapperStyle",2),Lt([g({type:Boolean,attribute:"run-scanner",reflect:!0})],tt.prototype,"runScanner",2),Lt([b()],tt.prototype,"barcode",2),Lt([Dt("video")],tt.prototype,"video",2),Lt([b()],tt.prototype,"stream",2),Lt([b()],tt.prototype,"codeReader",2),Lt([b()],tt.prototype,"detectFn",2),tt=Lt([E("barcode-scanner"),H()],tt);var Df=Object.defineProperty,Mf=Object.getOwnPropertyDescriptor,Cc=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Mf(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Df(t,r,i),i};let yn=class extends S{constructor(){super(...arguments),this.open=!0}handleDelete(e){e.preventDefault(),this.dispatchEvent(new CustomEvent("confirm-delete",{bubbles:!0,composed:!0})),this.open=!1}handleCancel(e){e.preventDefault(),this.open=!1}handleKeyDown(e){"Escape"===e.key&&this.handleCancel(e)}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleKeyDown.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleKeyDown.bind(this))}render(){return this.open?c` 3660 <div class="overlay" @click="${this.handleCancel}"></div> 3661 <div class="modal" role="dialog" aria-modal="true" aria-labelledby="modal-title"> 3662 <h2 id="modal-title" class="modal-title">${d("Confirm Delete")}</h2> 3663 <div class="modal-content"> 3664 <p class="modal-message"> 3665 ${d("Are you sure you want to delete this item? This action cannot be undone.")} 3666 </p> 3667 </div> 3668 <div class="modal-buttons"> 3669 <button 3670 type="button" 3671 class="button chocolate-button" 3672 @click="${this.handleCancel}"
3673 aria-label="${d("Cancel deletion")}" 3674 > 3675 ${d("Cancel")} 3676 </button> 3677 <button 3678 class="button danger-button" 3679 @click="${this.handleDelete}" 3680 aria-label="${d("Confirm deletion")}" 3681 > 3682 ${d("Delete")} 3683 </button> 3684 </div> 3685 </div> 3686 `:null}};yn.styles=[wc,...Oe([B.Danger,B.Chocolate]),$` 3687 .overlay { 3688 position: fixed; 3689 top: 0; 3690 left: 0; 3691 right: 0; 3692 bottom: 0; 3693 background: rgba(0, 0, 0, 0.5); 3694 z-index: 1000; 3695 animation: fadeIn 0.2s ease-out; 3696 } 3697 3698 .modal { 3699 position: fixed; 3700 top: 50%; 3701 left: 50%; 3702 transform: translate(-50%, -50%); 3703 background: white; 3704 border-radius: 12px; 3705 padding: 24px; 3706 min-width: 400px; 3707 max-width: 500px; 3708 box-shadow: 3709 0 20px 25px -5px rgba(0, 0, 0, 0.1), 3710 0 10px 10px -5px rgba(0, 0, 0, 0.04); 3711 z-index: 1001; 3712 animation: slideIn 0.3s ease-out; 3713 } 3714 3715 @keyframes fadeIn { 3716 from { 3717 opacity: 0; 3718 } 3719 to { 3720 opacity: 1; 3721 } 3722 } 3723 3724 @keyframes slideIn { 3725 from { 3726 opacity: 0; 3727 transform: translate(-50%, -50%) scale(0.95); 3728 } 3729 to { 3730 opacity: 1; 3731 transform: translate(-50%, -50%) scale(1); 3732 } 3733 } 3734 3735 .modal-title { 3736 font-size: 20px; 3737 font-weight: 600; 3738 color: #1f2937; 3739 margin: 0 0 24px 0; 3740 text-align: center; 3741 margin-bottom: 12px; 3742 } 3743 3744 .modal-content { 3745 margin-bottom: 12px; 3746 } 3747 3748 .modal-message { 3749 font-size: 16px; 3750 color: #6b7280; 3751 line-height: 1.5; 3752 margin: 0; 3753 } 3754 3755 .modal-buttons { 3756 display: flex; 3757 justify-content: flex-end; 3758 gap: 12px; 3759 } 3760 3761 .button { 3762 padding: 12px 24px; 3763 border: none; 3764 border-radius: 8px; 3765 font-size: 14px; 3766 font-weight: 500; 3767 cursor: pointer; 3768 transition: all 0.2s ease; 3769 min-width: 90px; 3770 } 3771 3772 .button:focus { 3773 outline: none; 3774 box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); 3775 } 3776 3777 .chocolate-button { 3778 background: #341100; 3779 border: 1px solid #341100; 3780 color: white; 3781 } 3782 3783 .danger-button { 3784 border: 1px solid #ff5252; 3785 background: #ff5252; 3786 color: white; 3787 } 3788 3789 @media (max-width: 480px) { 3790 .modal { 3791 min-width: 320px; 3792 margin: 16px; 3793 padding: 24px; 3794 } 3795
3796 .modal-buttons { 3797 flex-direction: column-reverse; 3798 } 3799 3800 .button { 3801 width: 100%; 3802 justify-content: center; 3803 } 3804 } 3805 `],Cc([b()],yn.prototype,"open",2),yn=Cc([E("delete-modal")],yn);var Rf=Object.defineProperty,Nf=Object.getOwnPropertyDescriptor,Sc=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Nf(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Rf(t,r,i),i};let xn=class extends S{constructor(){super(...arguments),this.propertyName=""}handleClose(){this.dispatchEvent(new CustomEvent("close-modal",{bubbles:!0,composed:!0}))}handlePropertyNameInput(e){const t=e.target;this.propertyName=t.value.trim()}handleCreateWikiPage(){if(!this.propertyName)return;const e=`https://wiki.openfoodfacts.org/Folksonomy/Property/${encodeURIComponent(this.propertyName)}?action=edit§ion=new&nosummary=true&preload=Folksonomy/Property/property_template`;window.open(e,"_blank")}render(){return c` 3806 <div class="modal-overlay" @click=${this.handleClose}> 3807 <div class="modal-content" @click=${e=>e.stopPropagation()}> 3808 <div class="modal-header"> 3809 <h2 class="modal-title">${d("Creating a New Property")}</h2> 3810 <button class="close-button" @click=${this.handleClose}>Ã</button> 3811 </div> 3812 3813 <div class="instruction-list"> 3814 <div class="instruction-item"> 3815 <div class="instruction-title">1. ${d("Check if a property already exists")}</div> 3816 <div class="instruction-description"> 3817 ${d("Search for your property concept in the existing properties database:")} 3818 </div> 3819 <a href=${Zd} target="_blank" class="instruction-link"> 3820 ${d("Browse and search existing properties")} 3821 </a> 3822 </div> 3823 3824 <div class="instruction-item"> 3825 <div class="instruction-title">2. ${d("Ask the community first")}</div> 3826 <div class="instruction-description"> 3827 ${d("Before creating a new property, discuss it with the community:")} 3828 </div> 3829 <div class="instruction-description"> 3830 ${d("I would like to create a property to [describe your use case]...")} 3831 </div> 3832 <div class="join-slack-discussion"> 3833 <a class="instruction-button" href=${Kd} target="_blank"> 3834 ${d("Join Slack Discussion")} 3835 </a> 3836 </div> 3837 </div> 3838 3839 <div class="instruction-item"> 3840 <div class="instruction-title">3. ${d("Document the New Property")}</div> 3841 <div class="instruction-description"> 3842 ${d("Once you've verified that your property doesn't exist and the community agrees it's useful, you need to first document it in the wiki.")} 3843 </div> 3844 <div class="property-input-section"> 3845 <div class="property-input-container"> 3846 <div class="input-group"> 3847 <label class="input-label">${d("Property name:")}</label> 3848 <input 3849 type="text" 3850 class="property-input" 3851 placeholder="${d("Enter property name...")}" 3852 .value="${this.propertyName}" 3853 @input="${this.handlePropertyNameInput}" 3854 /> 3855 </div> 3856 <button 3857 class="create-wiki-button" 3858 @click="${this.handleCreateWikiPage}" 3859 ?disabled="${!this.propertyName}" 3860 > 3861 ${d("Document the property")} 3862 </button> 3863 </div> 3864 </div> 3865 </div> 3866 3867 <div class="instruction-item"> 3868 <div class="instruction-title">4. ${d("Documentation and Guidelines")}</div> 3869 <div class="instruction-description"> 3870 ${d("Learn more about property creation and guidelines:")} 3871 </div> 3872 <a href=${Yd} target="_blank" class="instruction-link"> 3873 ${d("Folksonomy Engine Documentation")} 3874 </a> 3875 </div> 3876 </div> 3877 </div> 3878 </div> 3879 `}};xn.styles=$`
3880 .modal-overlay { 3881 position: fixed; 3882 top: 0; 3883 left: 0; 3884 right: 0; 3885 bottom: 0; 3886 background: rgba(0, 0, 0, 0.5); 3887 display: flex; 3888 align-items: center; 3889 justify-content: center; 3890 z-index: 10000; 3891 } 3892 3893 .modal-content { 3894 background: white; 3895 padding: 2rem; 3896 border-radius: 8px; 3897 max-width: 600px; 3898 width: 90%; 3899 max-height: 80vh; 3900 overflow-y: auto; 3901 box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); 3902 } 3903 3904 .modal-header { 3905 display: flex; 3906 justify-content: space-between; 3907 align-items: center; 3908 margin-bottom: 1.5rem; 3909 padding-bottom: 1rem; 3910 border-bottom: 1px solid #e0e0e0; 3911 } 3912 3913 .modal-title { 3914 font-size: 1.5rem; 3915 font-weight: 600; 3916 color: #333; 3917 margin: 0; 3918 } 3919 3920 .close-button { 3921 background: none; 3922 border: none; 3923 font-size: 1.5rem; 3924 cursor: pointer; 3925 color: #666; 3926 padding: 0.5rem; 3927 border-radius: 4px; 3928 transition: background-color 0.2s; 3929 } 3930 3931 .close-button:hover { 3932 background-color: #f0f0f0; 3933 } 3934 3935 .property-input-section { 3936 margin-bottom: 1.5rem; 3937 padding: 1rem; 3938 border: 1px solid #ddd; 3939 border-radius: 4px; 3940 } 3941 3942 .property-input-container { 3943 align-items: flex-end; 3944 } 3945 3946 .input-group { 3947 flex: 1; 3948 } 3949 3950 .input-label { 3951 display: block; 3952 margin-bottom: 0.5rem; 3953 font-weight: 500; 3954 } 3955 3956 .property-input { 3957 width: 100%; 3958 padding: 0.5rem; 3959 border: 1px solid #ddd; 3960 border-radius: 4px; 3961 font-size: 1rem; 3962 } 3963 3964 .property-input:focus { 3965 outline: none; 3966 border-color: #007bff; 3967 } 3968 3969 .create-wiki-button { 3970 margin-top: 4px; 3971 background: #007bff; 3972 color: white; 3973 border: none; 3974 padding: 0.5rem 1rem; 3975 border-radius: 4px; 3976 cursor: pointer; 3977 } 3978 3979 .create-wiki-button:hover:not(:disabled) { 3980 background: #0056b3; 3981 } 3982 3983 .create-wiki-button:disabled { 3984 background: #ccc; 3985 cursor: not-allowed; 3986 } 3987 3988 .instruction-list { 3989 margin: 1rem 0; 3990 padding-left: 0; 3991 } 3992 3993 .instruction-item { 3994 margin-bottom: 1.5rem; 3995 padding: 1rem; 3996 border-left: 4px solid #007bff; 3997 background: #f8f9fa; 3998 } 3999 4000 .instruction-title { 4001 font-weight: 600; 4002 color: #007bff; 4003 margin-bottom: 0.5rem; 4004 } 4005 4006 .instruction-description { 4007 color: #555; 4008 margin-bottom: 0.5rem; 4009 } 4010 4011 .instruction-link { 4012 color: #007bff; 4013 text-decoration: none; 4014 font-weight: 500; 4015 } 4016 4017 .instruction-link:hover { 4018 text-decoration: underline; 4019 } 4020 4021 .join-slack-discussion { 4022 padding-top: 6px; 4023 } 4024 4025 .instruction-button { 4026 background: #007bff; 4027 color: white; 4028 border: none; 4029 padding: 0.5rem 1rem; 4030 border-radius: 4px; 4031 cursor: pointer; 4032 text-decoration: none; 4033 } 4034 4035 .instruction-button:hover { 4036 background: #0056b3; 4037 } 4038 4039 @media (max-width: 768px) { 4040 .modal-content { 4041 width: 95%; 4042 padding: 1rem; 4043 } 4044 4045 .property-input-container { 4046 flex-direction: column; 4047 align-items: stretch; 4048 } 4049 4050 .create-wiki-button { 4051 margin-top: 0.5rem; 4052 } 4053 } 4054 `,Sc([b()],xn.prototype,"propertyName",2),xn=Sc([E("new-key-modal"),H()],xn);const Ls="folksonomy-bearer-token",Ec="folksonomy-token-date",Me=e=>`${Ol.getItem("apiUrl")}${e}`;function Lf(){return localStorage.getItem(Ls)}function zf(e){localStorage.setItem(Ls,e),localStorage.setItem(Ec,(new Date).getTime().toString())}function Tc(){localStorage.removeItem(Ls),localStorage.removeItem(Ec)}async function Ac(){try{const e=await fetch(Me("/auth_by_cookie"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const t=await e.json();return t.access_token&&zf(t.access_token),t}catch(e){throw console.error("Error authenticating by cookie:",e),Tc(),e}}async function pl(){return Lf()||(await Ac()).access_token}async function bt(e,t={}){const r=await pl(),o={...t,headers:{...t.headers,Authorization:`Bearer ${r}`}},n=await fetch(e,o);if(401===n.status||403===n.status){console.error("Auth failed, retrying with fresh token..."),Tc();const r=await pl(),o={...t,headers:{...t.headers,Authorization:`Bearer ${r}`}};return fetch(e,o)}return n}async function Uf(e){try{const t=await fetch(Me(`/product/${e}`));if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(e){throw console.error("Error fetching product properties:",e),e}}async function Ff(e,t,r,o){try{const n=await bt(Me("/product"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({product:e,k:t,v:r,version:o})});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return{key:t,value:r,version:1}}catch(e){throw console.error("Error adding product property:",e),e}}async function jf(e,t,r){try{const o=await bt(Me(`/product/${e}/${t}?version=${r}`),{method:"DELETE",headers:{"Content-Type":"application/json"}});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return{success:!0}}catch(e){throw console.error("Error deleting product property:",e),e}}async function Bf(e,t,r,o){try{const n=await bt(Me("/product"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({product:e,k:t,v:r,version:o+1})});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return{key:t,value:r,version:o+1}}catch(e){throw console.error("Error updating product property:",e),e}}async function Vf(){try{const e=await fetch(Me("/keys"),{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){throw console.error("Error fetching keys:",e),e}}async function Hf(e){try{let t=`/products?k=${e}`;const r=await fetch(Me(t),{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return await r.json()||[]}catch(e){throw console.error("Error fetching property products:",e),e}}async function Gf(e){try{const t=await fetch(Me(`/values/${e}`),{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(e){throw console.error("Error fetching values:",e),e}}async function Ic(){try{const e=await bt(Me("/user/me"),{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch(e){throw console.error("Error fetching user info:",e),e}}async function qf(e=!1){if(li.get()&&!e||Bt.get()&&!e)return Bt.get();li.set(!0);try{const e=await Ic();return Bt.set(e),e}catch(e){return console.error("Error fetching user info:",e),Bt.set(null),null}finally{li.set(!1)}}async function Wf(e){try{const t=await bt(Me("/admin/value/replace"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return{success:!0}}catch(e){throw console.error("Error replacing value:",e),e}}async function Kf(e){try{const t=await bt(Me("/admin/value"),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return{success:!0}}catch(e){throw console.error("Error deleting value:",e),e}}async function Yf(e){try{const t=await bt(Me("/admin/property/check-clash"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(e){throw console.error("Error checking property clash:",e),e}}async function Zf(e){try{const t=await bt(Me("/admin/property/rename"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return{success:!0}}catch(e){throw console.error("Error renaming property:",e),e}}async function Xf(e){try{const t=await bt(Me("/admin/property"),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return{success:!0}}catch(e){throw console.error("Error deleting property:",e),e}}const ke={fetchProductProperties:Uf,addProductProperty:Ff,deleteProductProperty:jf,updateProductProperty:Bf,fetchKeys:Vf,fetchProductsProperties:Hf,fetchValues:Gf,authByCookie:Ac,getUserInfo:Ic,fetchUserInfo:qf,replaceValue:Wf,deleteValue:Kf,checkPropertyClash:Yf,renameProperty:Zf,deleteProperty:Xf};var Qf=Object.defineProperty,Jf=Object.getOwnPropertyDescriptor,Ae=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?Jf(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Qf(t,r,i),i};let ge=class extends S{constructor(){super(...arguments),this.keyInput
4054="",this.valueInput="",this.keySuggestions=[],this.valueSuggestions=[],this.tempValue="",this.productCode="",this.version=1,this.rowNumber=1,this.key="",this.value="",this.pageType="view",this.empty=!1,this.editable=!1,this.showNewKeyModal=!1}connectedCallback(){super.connectedCallback(),"edit"===this.pageType&&(this.editable=!0,this.tempValue=this.value),ke.fetchKeys().then(e=>{this.keySuggestions=e.map(e=>({value:e.k}))}).catch(e=>console.error("Error fetching keys:",e))}async fetchValuesForKey(e){try{const t=await ke.fetchValues(e);this.valueSuggestions=t.map(e=>({value:e.v}))}catch(e){console.error("Error fetching values for key:",e)}}onKeyInput(e){const t=e.target.value;this.keyInput=t,this.key=t,e.detail.matching&&this.fetchValuesForKey(t)}onValueInput(e){const t=e.detail.value;this.valueInput=t,this.value=t,e.detail.matching&&this.fetchValuesForKey(this.keyInput)}selectKeySuggestion(e){"__NOT_FOUND__"!==e?this.keyInput!==e&&(this.keyInput=e,this.key=e,this.valueInput="",this.value="",this.fetchValuesForKey(e)):this.showNewKeyModal=!0}selectValueSuggestion(e){this.valueInput=e,this.value=e}handleEdit(){this.editable=!0,this.tempValue=this.value}async handleSave(){try{const e=await ke.updateProductProperty(this.productCode,this.key,this.tempValue,this.version);this.editable=!1,this.dispatchEvent(new CustomEvent("update-row",{detail:{key:e.key,value:e.value,version:e.version},bubbles:!0,composed:!0}))}catch(e){console.error("Failed to update property",e)}}handleCancel(){this.editable=!1,this.tempValue=this.value}async handleDelete(){const e=document.createElement("delete-modal");e.addEventListener("confirm-delete",async()=>{try{await ke.deleteProductProperty(this.productCode,this.key,this.version),this.dispatchEvent(new CustomEvent("delete-row",{detail:{key:this.key},bubbles:!0,composed:!0}))}catch(e){console.error("Failed to delete property",e)}finally{e.remove()}}),document.body.appendChild(e)}async addCustomKeyAndValue(){if(this.keyInput&&this.valueInput)try{const e=await ke.addProductProperty(this.productCode,this.keyInput,this.valueInput,this.version);this.dispatchEvent(new CustomEvent("add-row",{detail:{key:e.key,value:e.value},bubbles:!0,composed:!0})),this.keyInput="",this.valueInput=""}catch(e){console.error("Failed to add custom key and value",e)}}handleInputChange(e){this.tempValue=e.target.value}handleCloseNewKeyModal(){this.showNewKeyModal=!1}render(){return this.empty?c` 4055 <tr class="empty-row ${this.rowNumber%2==0?"even-row":"odd-row"}"> 4056 <td> 4057 <autocomplete-input 4058 placeholder=${d("New key")} 4059 .value=${this.keyInput} 4060 .suggestions=${this.keySuggestions} 4061 show-not-found-option 4062 not-found-text=${d("Not found? Create new key {value}")} 4063 @input-change=${e=>this.onKeyInput(e)} 4064 @suggestion-select=${e=>this.selectKeySuggestion(e.detail.value)} 4065 ></autocomplete-input> 4066 </td> 4067 <td> 4068 <autocomplete-input 4069 placeholder=${d("New value")} 4070 .value=${this.valueInput} 4071 .suggestions=${this.valueSuggestions} 4072 @input-change=${e=>this.onValueInput(e)} 4073 @suggestion-select=${e=>this.selectValueSuggestion(e.detail.value)} 4074 ></autocomplete-input> 4075 </td> 4076 <td> 4077 <div class="button-container"> 4078 <button 4079 class="button chocolate-button" 4080 @click=${this.addCustomKeyAndValue} 4081 id="create-button" 4082 > 4083 ${d("Submit")} 4084 </button> 4085 </div> 4086 </td> 4087 </tr> 4088 ${this.showNewKeyModal?c`<new-key-modal @close-modal=${this.handleCloseNewKeyModal}></new-key-modal>`:null} 4089 `:c` 4090 <tr class="${this.rowNumber%2==0?"even-row":"odd-row"}"> 4091 <td> 4092 <a 4093 class="property-link" 4094 href="https://wiki.openfoodfacts.org/Folksonomy/Property/${this.key}" 4095 >${this.key}</a 4096 > 4097 </td> 4098 <td> 4099 ${this.editable?c`<input 4100 type="text" 4101 class="input" 4102 .value=${this.tempValue}
4103 @input=${this.handleInputChange} 4104 />`:this.value} 4105 </td> 4106 ${"edit"==this.pageType?c`<td> 4107 <div class="button-container"> 4108 ${this.editable?c` 4109 <button class="button chocolate-button" @click=${this.handleSave}> 4110 ${d("Save")} 4111 </button> 4112 <button class="button chocolate-button" @click=${this.handleCancel}> 4113 ${d("Cancel")} 4114 </button> 4115 `:c`<button class="button chocolate-button" @click=${this.handleEdit}> 4116 ${d("Edit")} 4117 </button>`} 4118 <button class="button chocolate-button" @click=${this.handleDelete}> 4119 ${d("Delete")} 4120 </button> 4121 </div> 4122 </td>`:null} 4123 </tr> 4124 ${this.showNewKeyModal?c`<new-key-modal @close-modal=${this.handleCloseNewKeyModal}></new-key-modal>`:null} 4125 `}};ge.styles=[ic,...Oe([B.Chocolate]),$` 4126 :host { 4127 font-family: Arial, sans-serif; 4128 font-size: 0.9rem; 4129 color: #333; 4130 width: 100%; 4131 display: contents; 4132 } 4133 4134 .odd-row { 4135 background-color: #ffffff; 4136 } 4137 4138 .even-row { 4139 background-color: #f2f2f2; 4140 } 4141 4142 .button-container { 4143 display: flex; 4144 gap: 0.5rem; 4145 align-items: center; 4146 width: 10rem; 4147 } 4148 4149 .button-container button { 4150 width: 10rem; 4151 } 4152 4153 td { 4154 padding: 0.5rem 1.2rem; 4155 text-align: left; 4156 border: none; 4157 } 4158 tr:not(.empty-row) td { 4159 overflow: hidden; 4160 text-overflow: ellipsis; 4161 white-space: nowrap; 4162 } 4163 4164 .property-link { 4165 color: black; 4166 } 4167 4168 #create-button { 4169 width: 10rem; 4170 padding: 0.4rem 0.8rem; 4171 } 4172 4173 @media (max-width: 768px) { 4174 .button-container { 4175 flex-direction: column; 4176 } 4177 4178 .button-container { 4179 width: 7rem; 4180 } 4181 4182 .button-container button { 4183 font-size: 0.8rem; 4184 padding: 0.4rem 0.8rem; 4185 height: 2rem; 4186 width: 7rem; 4187 } 4188 4189 #create-button { 4190 font-size: 0.8rem; 4191 padding: 0.4rem 0.8rem; 4192 height: 2rem; 4193 width: 7rem; 4194 } 4195 } 4196 4197 @media (max-width: 480px) { 4198 .button-container { 4199 width: 5rem; 4200 } 4201 4202 .button-container button { 4203 width: 5rem; 4204 font-size: 0.7rem; 4205 padding: 0.3rem 0.5rem; 4206 height: 1.6rem; 4207 } 4208 4209 #create-button { 4210 width: 5rem; 4211 font-size: 0.7rem; 4212 padding: 0.3rem 0.5rem; 4213 height: 1.6rem; 4214 } 4215 4216 td { 4217 padding: 0.4rem 0.5rem; 4218 } 4219 } 4220 autocomplete-input::part(autocomplete-input-list) { 4221 position: relative !important; 4222 } 4223 `],Ae([b()],ge.prototype,"keyInput",2),Ae([b()],ge.prototype,"valueInput",2),Ae([b()],ge.prototype,"keySuggestions",2),Ae([b()],ge.prototype,"valueSuggestions",2),Ae([b()],ge.prototype,"tempValue",2),Ae([g({type:String,attribute:"product-code"})],ge.prototype,"productCode",2),Ae([g({type:Number})],ge.prototype,"version",2),Ae([g({type:Number,attribute:"row-number"})],ge.prototype,"rowNumber",2),Ae([g({type:String})],ge.prototype,"key",2),Ae([g({type:String})],ge.prototype,"value",2),Ae([g({type:String,attribute:"page-type"})],ge.prototype,"pageType",2),Ae([g({type:Boolean})],ge.prototype,"empty",2),Ae([b()],ge.prototype,"editable",2),Ae([b()],ge.prototype,"showNewKeyModal",2),ge=Ae([E("folksonomy-editor-row")],ge);var em=Object.defineProperty,tm=Object.getOwnPropertyDescriptor,vt=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?tm(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&em(t,r,i),i};let Ge=class extends S{constructor(){super(...arguments),this.productCode="",this.pageType="view",this.propertiesBaseUrl="/properties",this.propertiesDocumentationUrl="https://wiki.openfoodfacts.org/Folksonomy/Property",this.folksonomyEngineUrl="https://wiki.openfoodfacts.org/Folksonomy_Engine",this.properties=[],this.sortColumn="key",this.sortDirection="asc"}handleRowDelete(e){const{key:t}=e.detail;this.properties=this.properties.filter(e=>e.key!==t)}handleRowAdd(e){const{key:t,value:r}=e.detail;t&&r?(this.properties=[...this.properties,{key:t,value:r,version:1}],this.sortProperties()):console.error("Key or value is missing in the event detail.")}handleRowUpdate(e){const{key:t,value:r,version:o}=e.detail;this.properties=this.properties.map(e=>e.key===t?{...e,value:r,version:o}:e),this.sortProperties()}handleSort(e){this.sortColumn===e?this.sortDirection="asc"===this.sortDirection?"de
4223sc":"asc":(this.sortColumn=e,this.sortDirection="asc"),this.sortProperties()}sortProperties(){const e=this.sortColumn,t="asc"===this.sortDirection?1:-1;this.properties=[...this.properties].sort((r,o)=>{const n=r[e]?.toString().toLowerCase()??"",i=o[e]?.toString().toLowerCase()??"";return n.localeCompare(i,void 0,{numeric:!0})*t})}connectedCallback(){super.connectedCallback(),this.fetchAndLogFolksonomyKeys(),this.addEventListener("add-row",this.handleRowAdd),this.addEventListener("update-row",this.handleRowUpdate),this.addEventListener("delete-row",this.handleRowDelete)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("add-row",this.handleRowAdd),this.removeEventListener("update-row",this.handleRowUpdate),this.removeEventListener("delete-row",this.handleRowDelete)}async fetchAndLogFolksonomyKeys(){try{const e=await ke.fetchProductProperties(this.productCode);this.properties=e.map(e=>({key:e.k,value:e.v,version:e.version})),this.sortProperties()}catch(e){console.error("Error fetching folksonomy keys:",e)}}renderSortIcon(e){const t=this.sortColumn===e;return c`
4224 <span class="sort-icon"> 4225 <svg 4226 class="sort-arrow ${t&&"asc"===this.sortDirection?"active":""}" 4227 viewBox="0 0 10 6" 4228 > 4229 <polygon points="5,0 10,6 0,6" /> 4230 </svg> 4231 <svg 4232 class="sort-arrow ${t&&"desc"===this.sortDirection?"active":""}" 4233 viewBox="0 0 10 6" 4234 style="transform:rotate(180deg)" 4235 > 4236 <polygon points="5,0 10,6 0,6" /> 4237 </svg> 4238 </span> 4239 `}renderForm(){return c` 4240 <form id="free_properties_form"> 4241 <table> 4242 <tr> 4243 <th 4244 @click=${()=>this.handleSort("key")} 4245 class=${"sortable "+("key"===this.sortColumn?`sort-${this.sortDirection}`:"")} 4246 > 4247 <span class="sort-header"> ${d("Property")} ${this.renderSortIcon("key")} </span> 4248 </th> 4249 <th 4250 @click=${()=>this.handleSort("value")} 4251 class=${"sortable "+("value"===this.sortColumn?`sort-${this.sortDirection}`:"")} 4252 > 4253 <span class="sort-header"> ${d("Value")} ${this.renderSortIcon("value")} </span> 4254 </th> 4255 ${"edit"==this.pageType?c`<th>${d("Actions")}</th>`:null} 4256 </tr> 4257 ${this.properties.map((e,t)=>c`<folksonomy-editor-row 4258 product-code=${this.productCode} 4259 key=${e.key} 4260 value=${e.value} 4261 version=${e.version} 4262 row-number=${t+1} 4263 page-type=${this.pageType} 4264 ></folksonomy-editor-row>`)} 4265 ${"edit"==this.pageType?c`<folksonomy-editor-row 4266 product-code=${this.productCode} 4267 page-type=${this.pageType} 4268 row-number=${this.properties.length+1} 4269 empty 4270 ></folksonomy-editor-row>`:null} 4271 </table> 4272 </form> 4273 `}render(){return c` 4274 <section> 4275 <div class="feus"> 4276 <div> 4277 <div> 4278 <h2> 4279 ${d("Personalized properties")} (<span 4280 data-tooltip 4281 aria-haspopup="true" 4282 data-position="top" 4283 data-alignment="left" 4284 title=${d("Be aware the data model might be modified. Use at your own risk.")} 4285 >beta</span 4286 >) 4287 </h2> 4288 <p> 4289 ${d(c`These properties are created and filed by users for any kind of usages. Feel 4290 free to add your own. The properties and values you create 4291 <strong>must be factual</strong>. You can dive into 4292 <a href="${this.propertiesBaseUrl}" 4293 >the list of properties already used by the community</a 4294 > 4295 or explore the 4296 <a href="${this.propertiesDocumentationUrl}" 4297 >properties' documentation and its search engine</a 4298 >.`)} 4299 </p> 4300 <p>${d("Be aware the data model might be modified. Use at your own risk.")}</p> 4301 <p> 4302 ${d(c`This is brought by the 4303 <a href="${this.folksonomyEngineUrl}">Folksonomy Engine project</a>. Don't 4304 hesitate to participate or give feedback`)} 4305 </p> 4306 ${this.renderForm()} 4307 </div> 4308 </div> 4309 </div> 4310 </section> 4311 `}};Ge.styles=$` 4312 :host { 4313 font-family: Arial, sans-serif; 4314 color: #333; 4315 } 4316 .feus { 4317 margin-bottom: 1rem; 4318 background-color: #fff; 4319 border: 1px solid #ddd; 4320 border-radius: 8px; 4321 box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); 4322 padding: 1rem; 4323 } 4324 .feus h2 { 4325 font-size: 2.2rem; 4326 font-weight: 600; 4327 color: #222; 4328 margin-top: 10px; 4329 margin-bottom: 0.5rem; 4330 } 4331 .feus p { 4332 font-size: 0.9rem; 4333 line-height: 1.5; 4334 margin-bottom: 0.8rem; 4335 } 4336 #free_properties_form table { 4337 width: 100%; 4338 border-collapse: collapse; 4339 margin-top: 1rem; 4340 border: solid 1px #ddd; 4341 font-size: 0.9rem; 4342 table-layout: fixed; 4343 } 4344 #free_properties_form table th, 4345 #free_properties_form table td { 4346 padding: 0.8rem; 4347 text-align: left; 4348 border: solid 1px #ddd; 4349 overflow: hidden; 4350 text-overflow: ellipsis; 4351 white-space: nowrap; 4352 } 4353 #free_properties_form table th { 4354 background-color: #dedede; 4355 font-weight: bold; 4356 cursor: pointer; 4357 user-select: none; 4358 white-space: nowrap; 4359 } 4360 .sort-header { 4361 display: inline-flex; 4362 align-items: center; 4363 gap: 0.2em; 4364 } 4365 .sort-icon { 4366 display: inline-flex; 4367 flex-direction: column; 4368 margin-left: 0.5em; 4369 font-size: 0.9em; 4370 line-height: 1; 4371 } 4372 .sort-arrow { 4373 opacity: 0.3; 4374 height: 0.8em; 4375 width: 0.8em; 4376 padding: 0; 4377 margin: 0; 4378 display: block; 4379 } 4380 .sort-arrow.active { 4381 opacity: 1; 4382 } 4383 #free_properties_form table th.sortable { 4384 padding-right: 0.8em; 4385 } 4386 #free_properties_form table th.sortable::before, 4387 #free_properties_form table th.sortable::after { 4388 display: none; 4389 } 4390 #free_properties_form table tr { 4391 height: 4rem; 4392 } 4393 #free_properties_form table tr:nth-child(even) { 4394 background-color: #f9f9f9; 4395 } 4396 @media (max-width: 480px) { 4397 #free_properties_form table tr:first-child { 4398 height: 0.5rem; 4399 } 4400 } 4401 `,vt([g({type:String,attribute:"product-code"}
4401)],Ge.prototype,"productCode",2),vt([g({type:String,attribute:"page-type"})],Ge.prototype,"pageType",2),vt([g({type:String,attribute:"properties-base-url"})],Ge.prototype,"propertiesBaseUrl",2),vt([g({type:String,attribute:"properties-documentation-url"})],Ge.prototype,"propertiesDocumentationUrl",2),vt([g({type:String,attribute:"folksonomy-engine-url"})],Ge.prototype,"folksonomyEngineUrl",2),vt([b()],Ge.prototype,"properties",2),vt([b()],Ge.prototype,"sortColumn",2),vt([b()],Ge.prototype,"sortDirection",2),Ge=vt([E("folksonomy-editor"),H()],Ge);var rm=Object.defineProperty,om=Object.getOwnPropertyDescriptor,Nr=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?om(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&rm(t,r,i),i};let Ot=class extends S{constructor(){super(...arguments),this.min=0,this.max=100,this.minValue=0,this.maxValue=100,this.type="range"}handleMinInput(e){const t=parseInt(e,10);if(isNaN(t))return;let r=Math.max(this.min,t);r=Math.min(r,this.maxValue),this.dispatchEvent(new CustomEvent("range-change",{detail:{type:this.type,field:"min",value:r}}))}handleMaxInput(e){const t=parseInt(e,10);if(isNaN(t))return;let r=Math.min(this.max,t);r=Math.max(r,this.minValue),this.dispatchEvent(new CustomEvent("range-change",{detail:{type:this.type,field:"max",value:r}}))}render(){if(this.max-this.min<2)return c` 4402 <div class="range-filter-container"> 4403 <div class="range-inputs"> 4404 <input 4405 type="number" 4406 class="range-input" 4407 .value="${this.minValue.toString()}" 4408 min="${this.min}" 4409 max="${this.maxValue}" 4410 @input="${e=>this.handleMinInput(e.target.value)}" 4411 /> 4412 <span class="range-separator">-</span> 4413 <input 4414 type="number" 4415 class="range-input" 4416 .value="${this.maxValue.toString()}" 4417 min="${this.minValue}" 4418 max="${this.max}" 4419 @input="${e=>this.handleMaxInput(e.target.value)}" 4420 /> 4421 </div> 4422 </div> 4423 `;const e=(this.minValue-this.min)/(this.max-this.min)*100,t=(this.maxValue-this.min)/(this.max-this.min)*100;return c` 4424 <div class="range-filter-container"> 4425 <div class="range-inputs"> 4426 <input 4427 type="number" 4428 class="range-input" 4429 .value="${this.minValue.toString()}" 4430 min="${this.min}" 4431 max="${this.maxValue}" 4432 @input="${e=>this.handleMinInput(e.target.value)}" 4433 /> 4434 <span class="range-separator">-</span> 4435 <input 4436 type="number" 4437 class="range-input" 4438 .value="${this.maxValue.toString()}" 4439 min="${this.minValue}" 4440 max="${this.max}" 4441 @input="${e=>this.handleMaxInput(e.target.value)}" 4442 /> 4443 </div> 4444 <div class="dual-range-container"> 4445 <div class="dual-range-slider"> 4446 <div 4447 class="dual-range-track" 4448 style="left: ${e}%; width: ${t-e}%" 4449 ></div> 4450 <input 4451 type="range" 4452 min="${this.min}" 4453 max="${this.max}" 4454 .value="${this.minValue.toString()}" 4455 @input="${e=>this.handleMinInput(e.target.value)}" 4456 /> 4457 <input 4458 type="range" 4459 min="${this.min}" 4460 max="${this.max}" 4461 .value="${this.maxValue.toString()}" 4462 @input="${e=>this.handleMaxInput(e.target.value)}" 4463 /> 4464 </div> 4465 </div> 4466 </div> 4467 `}};Ot.styles=$` 4468 :host { 4469 display: block; 4470 width: 100%; 4471 } 4472 4473 /* Range slider container */ 4474 .range-filter-container { 4475 display: flex; 4476 flex-direction: column; 4477 gap: 0.5rem; 4478 min-width: 200px; 4479 } 4480 4481 .range-inputs { 4482 display: flex; 4483 gap: 0.25rem; 4484 align-items: center; 4485 } 4486 4487 .range-input { 4488 width: 60px; 4489 padding: 0.25rem; 4490 border: 1px solid #ddd; 4491 border-radius: 4px; 4492 font-size: 0.75rem; 4493 text-align: center; 4494 } 4495 4496 .range-input:focus { 4497 outline: none; 4498 border-color: #341100; 4499 } 4500 4501 .range-separator { 4502 font-size: 0.75rem; 4503 color: #666; 4504 } 4505 4506 /* Custom range slider styles */ 4507 .range-slider { 4508 width: 100%; 4509 height: 6px; 4510 border-radius: 3px; 4511 background: #ddd; 4512 outline: none; 4513 opacity: 0.7; 4514 transition: opacity 0.2s; 4515 -webkit-appearance: none; 4516 appearance: none; 4517 position: relative; 4518 } 4519 4520 .range-slider:hover { 4521 opacity: 1; 4522 } 4523 4524 .range-slider::-webkit-slider-thumb { 4525 -webkit-appearance: none; 4526 appearance: none; 4527 width: 16px; 4528 height: 16px; 4529 border-radius: 50%; 4530 background: #341100; 4531 cursor: pointer; 4532 box-shadow: 0px 0px 0px 3px rgba(52, 17, 0, 0.2); 4533 } 4534 4535 .range-slider::-moz-range-thumb { 4536 width: 16px; 4537 height: 16px; 4538 border-radius: 50%; 4539 background: #341100; 4540 cursor: pointer; 4541 border: none; 4542 box-shadow: 0px 0px 0px 3px rgba(52, 17, 0, 0.2); 4543 } 4544 4545 .range-slider-container { 4546 position: relative; 4547 margin: 0.25rem 0; 4548 } 4549 4550 .range-slider-track { 4551 position: absolute; 4552 height: 6px; 4553 background: #341100; 4554 border-radius: 3px; 4555 top: 0; 4556 } 4557 4558 .dual-range-container { 4559 position: relative; 4560 width: 100%; 4561 } 4562 4563 .dual-range-slider { 4564 position: relative; 4565 height: 6px; 4566 background: #ddd; 4567 border-radius: 3px; 4568 margin: 0.5rem 0; 4569 width: 200px; 4570 min-width: 180px; 4571 } 4572 4573 .dual-range-slider input[type="range"] { 4574 position: absolute; 4575 width: 100%; 4576 height: 6px; 4577 background: transparent; 4578 -webkit-appearance: none; 4579 appearance: none; 4580 pointer-events: none; 4581 outline: none; 4582 } 4583 4584 .dual-range-slider input[type="range"]::-webkit-slider-thumb { 4585 -webkit-appearance: none; 4586 appearance: none; 4587 width: 16px; 4588 height: 16px; 4589 margin-top: -5px; 4590 margin-left: -2px; 4591 border-radius: 50%; 4592 background: #341100; 4593 cursor: pointer; 4594 pointer-events: all; 4595 box-shadow: 0px 0px 0px 3px rgba(52, 17, 0, 0.2); 4596 border: none; 4597 } 4598 4599 .dual-range-slider input[type="range"]::-moz-range-thumb { 4600 width: 16px; 4601 height: 16px; 4602 margin-top: -5px; 4603 border-radius: 50%; 4604 background: #341100; 4605 cursor: pointer; 4606 pointer-events: all; 4607 box-shadow: 0px 0px 0px 3px rgba(52, 17, 0, 0.2); 4608 border: none; 4609 } 4610 4611 .dual-range-slider input[type="range"]:first-child::-moz-range-thumb { 4612 margin-left: -8px; 4613 } 4614 4615 .dual-range-slider input[type="range"]:last-child::-moz-range-thumb { 4616 margin-right: -8px; 4617 } 4618 4619 .dual-range-track { 4620 position: absolute; 4621 height: 6px; 4622 background: #341100; 4623 border-radius: 3px; 4624 top: 0; 4625 } 4626 4627 /* Mobile responsiveness */ 4628 @media (max-width: 768px) { 4629 .range-filter-container { 4630 min-width: 180px; 4631 } 4632 4633 .range-input { 4634 width: 50px; 4635 font-size: 0.7rem; 4636 } 4637 } 4638 `,Nr([g({type:Number})],Ot.prototype,"min",2),Nr([g({type:Number})],Ot.prototype,"max",2),Nr([g({type:Number})],Ot.prototype,"minValue",2),Nr([g({type:Number})],Ot.prototype,"maxValue",2),Nr([g({type:String})],Ot.prototype,"type",2),Ot=Nr([E("dual-range-slider")],Ot);var nm=Object.defineProperty,im=Object.getOwnPropertyDescriptor,xe=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?im(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&nm(t,r,i),i};let ae=class extends(yo(S)){constructor(){super(...arguments),this.propertyBasePath="/property/",this.properties=[],this.filteredProperties=[],this.loading=!1,this.error=null,this.filters={property:"",countMin:0,countMax:0,valuesMin:0,valuesMax:0},this.ranges={countMin:0,countMax:0,valuesMin:0,valuesMax:0},this.showRenameModal=!1,this.showDeleteModal=!1,this.showClashModal=!1,this.showMessageModal=!1,this.renameModalData={property:"",newProperty:""},this.deleteModalProperty="",this.clashData=null,this.messageModalData={title:"",message:"",type:"success"},this.filterDebounce=qd(1100)}async connectedCallback(){super.connectedCallback(),await this.fetchProperties(),await ke.fetchUserInfo()}disconnectedCallback(){super.disconnectedCallback(),this.filterDebounce.clear()}async fetchProperties(){this.loading=!0,this.error=null;try{const e=await ke.fetchKeys();if(this.properties=e.sort((e,t)=>
4638e.k.localeCompare(t.k)),this.filteredProperties=[...this.properties],this.properties.length>0){const e=this.properties.map(e=>e.count),t=this.properties.map(e=>e.values),r=Math.min(...e),o=Math.max(...e),n=Math.min(...t),i=Math.max(...t);this.ranges={countMin:r,countMax:Math.max(o,r+1),valuesMin:n,valuesMax:Math.max(i,n+1)},this.filters={property:"",countMin:this.ranges.countMin,countMax:this.ranges.countMax,valuesMin:this.ranges.valuesMin,valuesMax:this.ranges.valuesMax}}}catch(e){console.error("Error fetching folksonomy properties:",e),this.error="error"}finally{this.loading=!1}}get canModerateProperties(){const e=Bt.get();return!0===e?.admin||!0===e?.moderator}getPropertyUrl(e){return`${this.propertyBasePath}${e}`}getDocumentationUrl(e){return`https://wiki.openfoodfacts.org/Folksonomy/Property/${e}`}applyFilters(){const{property:e,countMin:t,countMax:r,valuesMin:o,valuesMax:n}=this.filters;this.filteredProperties=this.properties.filter(i=>{const s=!e||i.k.toLowerCase().includes(e.toLowerCase()),a=i.count>=t&&i.count<=r,l=i.values>=o&&i.values<=n;return s&&a&&l})}handleFilterInput(e,t){this.filters={...this.filters,[e]:t},this.filterDebounce.debounce(()=>{this.applyFilters()})}handleRangeChange(e){const{type:t,field:r,value:o}=e.detail;let n;n="count"===t?"min"===r?"countMin":"countMax":"min"===r?"valuesMin":"valuesMax",this.filters={...this.filters,[n]:o},this.applyFilters()}resetFilters(){this.filters={property:"",countMin:this.ranges.countMin,countMax:this.ranges.countMax,valuesMin:this.ranges.valuesMin,valuesMax:this.ranges.valuesMax},this.filteredProperties=[...this.properties]}handleDownloadCSV(){const e=[d("Property"),d("Count"),d("Values")],t=this.filteredProperties.map(e=>[e.k,e.count,e.values]),r=`folksonomy_properties_${(new Date).toISOString().split("T")[0]}.csv`;Ml(t,r,e)}openRenameModal(e){this.renameModalData={property:e,newProperty:""},this.showRenameModal=!0}closeRenameModal(){this.showRenameModal=!1,this.renameModalData={property:"",newProperty:""}}openDeleteModal(e){this.deleteModalProperty=e,this.showDeleteModal=!0}closeDeleteModal(){this.showDeleteModal=!1,this.deleteModalProperty=""}closeClashModal(){this.showClashModal=!1,this.clashData=null,this.renameModalData={property:"",newProperty:""}}showMessage(e,t,r){this.messageModalData={type:e,title:t,message:r},this.showMessageModal=!0}closeMessageModal(){this.showMessageModal=!1,this.messageModalData={title:"",message:"",type:"success"}}async handleCheckClash(){const{property:e,newProperty:t}=this.renameModalData;if(t.trim()&&t.trim()!==e)try{const r=await ke.checkPropertyClash({old_property:e,new_property:t.trim()});this.clashData=r,this.showRenameModal=!1,this.showClashModal=!0}catch(e){console.error("Error checking property clash:",e),this.showMessage("error",d("Error"),d("Failed to check property conflicts. Please try again."))}}async handleRenameProperty(){const{property:e,newProperty:t}=this.renameModalData;try{await ke.renameProperty({old_property:e,new_property:t.trim()}),this.showClashModal=!1,this.clashData=null,this.renameModalData={property:"",newProperty:""},await this.fetchProperties(),this.showMessage("success",d("Success"),d("Property renamed successfully!"))}catch(e){console.error("Error renaming property:",e),this.showMessage("error",d("Error"),d("Failed to rename property. Please try again."))}}async handleDeleteProperty(){try{await ke.deleteProperty({property:this.deleteModalProperty}),this.closeDeleteModal(),await this.fetchProperties(),this.showMessage("success",d("Success"),d("Property deleted successfully!"))}catch(e){console.error("Error deleting property:",e),this.showMessage("error",d("Error"),d("Failed to delete property. Please try again."))}}renderPropertyActions(e){return c` 4639 <td class="actions-column"> 4640 <div class="actions-buttons"> 4641 <button 4642 class="action-btn" 4643 @click="${()=>this.openRenameModal(e.k)}" 4644 title="${d("Rename this property")}" 4645 > 4646 ${d("Rename")} 4647 </button> 4648 <button 4649 class="action-btn delete" 4650 @click="${()=>this.openDeleteModal(e.k)}" 4651 title="${d("Delete this property")}" 4652 > 4653 ${d("Delete")} 4654 </button> 4655 </div> 4656 </td> 4657 `}renderRenameModal(){return this.showRenameModal?c` 4658 <div class="modal-overlay" @click="${this.closeRenameModal}"> 4659 <div class="modal" @click="${e=>e.stopPropagation()}"> 4660 <div class="modal-header"> 4661 <h3 class="modal-title">${d("Rename Property")}</h3> 4662 </div> 4663 <div class="modal-body"> 4664 <div class="modal-text"> 4665 ${d(Re`Rename property '${this.renameModalData.property}' to:`)} 4666 </div> 4667 <label for="new-property">${d("New property name:")}</label> 4668 <input 4669 id="new-property" 4670 type="text" 4671 class="modal-input" 4672 .value="${this.renameModalData.newProperty}"
4673 @input="${e=>{this.renameModalData={...this.renameModalData,newProperty:e.target.value}}}" 4674 @keydown="${e=>{"Enter"===e.key?this.handleCheckClash():"Escape"===e.key&&this.closeRenameModal()}}" 4675 placeholder="${d("Enter new property name...")}" 4676 autofocus 4677 /> 4678 </div> 4679 <div class="modal-footer"> 4680 <button class="modal-btn modal-btn-secondary" @click="${this.closeRenameModal}"> 4681 ${d("Cancel")} 4682 </button> 4683 <button 4684 class="modal-btn modal-btn-primary" 4685 @click="${this.handleCheckClash}" 4686 ?disabled="${!this.renameModalData.newProperty.trim()||this.renameModalData.newProperty.trim()===this.renameModalData.property}" 4687 > 4688 ${d("Check Conflicts")} 4689 </button> 4690 </div> 4691 </div> 4692 </div> 4693 `:""}renderClashModal(){return this.showClashModal&&this.clashData?c` 4694 <div class="modal-overlay" @click="${this.closeClashModal}"> 4695 <div class="modal" @click="${e=>e.stopPropagation()}"> 4696 <div class="modal-header"> 4697 <h3 class="modal-title">${d("Property Rename Conflicts")}</h3> 4698 </div> 4699 <div class="modal-body"> 4700 <div class="modal-text"> 4701 ${d(Re`Renaming '${this.renameModalData.property}' to '${this.renameModalData.newProperty}' will affect:`)} 4702 </div> 4703 <div class="clash-info"> 4704 <div class="clash-stat"> 4705 <span class="clash-stat-label">${d("Products with both properties:")}</span> 4706 <span class="clash-stat-value">${this.clashData.products_with_both}</span> 4707 </div> 4708 <div class="clash-stat"> 4709 <span class="clash-stat-label">${d("Products with old property only:")}</span> 4710 <span class="clash-stat-value">${this.clashData.products_with_old_only}</span> 4711 </div> 4712 <div class="clash-stat"> 4713 <span class="clash-stat-label">${d("Products with new property only:")}</span> 4714 <span class="clash-stat-value">${this.clashData.products_with_new_only}</span> 4715 </div> 4716 </div> 4717 <div class="modal-text"> 4718 <strong>${d("Do you want to proceed with the rename?")}</strong> 4719 </div> 4720 </div> 4721 <div class="modal-footer"> 4722 <button class="modal-btn modal-btn-secondary" @click="${this.closeClashModal}"> 4723 ${d("Cancel")} 4724 </button> 4725 <button class="modal-btn modal-btn-danger" @click="${this.handleRenameProperty}"> 4726 ${d("Proceed with Rename")} 4727 </button> 4728 </div> 4729 </div> 4730 </div> 4731 `:""}renderDeleteModal(){return this.showDeleteModal?c` 4732 <div class="modal-overlay" @click="${this.closeDeleteModal}"> 4733 <div class="modal" @click="${e=>e.stopPropagation()}"> 4734 <div class="modal-header"> 4735 <h3 class="modal-title">${d("Delete Property")}</h3> 4736 </div> 4737 <div class="modal-body"> 4738 <div class="modal-text"> 4739 ${d(Re`Are you sure you want to delete the property '${this.deleteModalProperty}'?`)} 4740 </div> 4741 <div class="modal-text"> 4742 <strong>${d("This action cannot be undone.")}</strong> 4743 </div> 4744 </div> 4745 <div class="modal-footer"> 4746 <button class="modal-btn modal-btn-secondary" @click="${this.closeDeleteModal}"> 4747 ${d("Cancel")} 4748 </button> 4749 <button class="modal-btn modal-btn-danger" @click="${this.handleDeleteProperty}"> 4750 ${d("Delete")} 4751 </button> 4752 </div> 4753 </div> 4754 </div> 4755 `:""}renderMessageModal(){return this.showMessageModal?c` 4756 <div class="modal-overlay" @click="${this.closeMessageModal}"> 4757 <div class="modal" @click="${e=>e.stopPropagation()}"> 4758 <div class="modal-header"> 4759 <h3 class="modal-title">${this.messageModalData.title}</h3> 4760 </div> 4761 <div class="modal-body"> 4762 <div class="modal-text">${this.messageModalData.message}</div> 4763 </div> 4764 <div class="modal-footer"> 4765 <button class="modal-btn modal-btn-primary" @click="${this.closeMessageModal}"> 4766 ${d("OK")} 4767 </button> 4768 </div> 4769 </div> 4770 </div> 4771 `:""}renderTableHeader(){return c` 4772 <thead> 4773 <tr> 4774 <th></th> 4775 <th class="property-name-header">${d("Property")}</th> 4776 <th class="doc">${d("Documentation")}</th> 4777 <th class="count">${d("Count")}</th> 4778 <th class="values">${d("Values")}</th> 4779 ${this.canModerateProperties?c`<th class="actions-column">${d("Actions")}</th>`:""} 4780 </tr> 4781 <tr class="filter-row"> 4782 <td></td> 4783 <td> 4784 <input 4785 type="text" 4786 class="filter-input" 4787 placeholder="${d("Filter properties...")}" 4788 .value="${this.filters.property}"
4789 @input="${e=>this.handleFilterInput("property",e.target.value)}" 4790 /> 4791 </td> 4792 <td></td> 4793 <td> 4794 <dual-range-slider 4795 type="count" 4796 min="${this.ranges.countMin}" 4797 max="${this.ranges.countMax}" 4798 minValue="${this.filters.countMin}" 4799 maxValue="${this.filters.countMax}" 4800 @range-change="${this.handleRangeChange}" 4801 ></dual-range-slider> 4802 </td> 4803 <td> 4804 <dual-range-slider 4805 type="values" 4806 min="${this.ranges.valuesMin}" 4807 max="${this.ranges.valuesMax}" 4808 minValue="${this.filters.valuesMin}" 4809 maxValue="${this.filters.valuesMax}" 4810 @range-change="${this.handleRangeChange}" 4811 ></dual-range-slider> 4812 </td> 4813 ${this.canModerateProperties?c`<td></td>`:""} 4814 </tr> 4815 </thead> 4816 `}renderPropertyRow(e){return c` 4817 <tr class="property"> 4818 <td></td> 4819 <td> 4820 <a href="${this.getPropertyUrl(e.k)}" class="property-name"> ${e.k} </a> 4821 </td> 4822 <td> 4823 <a 4824 href="${this.getDocumentationUrl(e.k)}" 4825 class="doc-link" 4826 title="${d(Re`Documentation for ${e.k}`)}" 4827 target="_blank" 4828 rel="noopener noreferrer" 4829 > 4830 ð 4831 </a> 4832 </td> 4833 <td class="count">${e.count}</td> 4834 <td class="values">${e.values}</td> 4835 ${this.canModerateProperties?this.renderPropertyActions(e):""} 4836 </tr> 4837 `}renderContent(){return this.loading?c`<div class="loading">${d("Loading properties...")}</div>`:this.error?c`<div class="error"> 4838 ${d("Failed to load properties. Please try again later.")} 4839 </div>`:0===this.properties.length?c` <div class="empty-state">${d("No properties found.")}</div> `:c` 4840 <div class="filter-controls"> 4841 <div class="rows-counter"> 4842 ${d("Rows")}: ${this.filteredProperties.length} / ${this.properties.length} 4843 </div> 4844 <div class="button-group"> 4845 <button class="download-btn" @click="${this.handleDownloadCSV}"> 4846 ${d("Download CSV")} 4847 </button> 4848 <button class="reset-btn" @click="${this.resetFilters}">${d("Reset")}</button> 4849 </div> 4850 </div> 4851 <table class="properties-table" id="folksonomy-properties-table"> 4852 ${this.renderTableHeader()} 4853 <tbody id="free_prop_body"> 4854 ${this.filteredProperties.map(e=>this.renderPropertyRow(e))} 4855 </tbody> 4856 </table> 4857 `}render(){return c` 4858 <div class="properties-container"> 4859 <slot name="properties-introduction"> 4860 <h2 id="property_title">${d("Folksonomy Properties")}</h2> 4861 <p> 4862 ${d("Explore all contributed properties from the Folksonomy Engine project. These properties provide additional metadata and insights about products in the Open Food Facts database.")} 4863 </p> 4864 </slot> 4865 ${this.renderContent()} 4866 </div> 4867 4868 ${this.renderRenameModal()} ${this.renderClashModal()} ${this.renderDeleteModal()} 4869 ${this.renderMessageModal()} 4870 `}};ae.styles=$` 4871 :host { 4872 display: block; 4873 font-family: Arial, sans-serif; 4874 color: #333; 4875 } 4876 4877 .properties-container { 4878 margin-bottom: 1rem; 4879 background-color: #fff; 4880 border: 1px solid #ddd; 4881 border-radius: 8px; 4882 box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); 4883 padding: 1rem; 4884 } 4885 4886 .properties-container h2 { 4887 font-size: 2.2rem; 4888 font-weight: 600; 4889 color: #222; 4890 margin-top: 10px; 4891 margin-bottom: 0.5rem; 4892 } 4893 4894 .properties-container p { 4895 font-size: 0.9rem; 4896 line-height: 1.5; 4897 margin-bottom: 1rem; 4898 color: #222; 4899 } 4900 4901 .properties-container a { 4902 color: #341100; 4903 } 4904 4905 .properties-table { 4906 width: 100%; 4907 border-collapse: collapse; 4908 margin-top: 1rem; 4909 border: solid 1px #ddd; 4910 font-size: 0.9rem; 4911 } 4912 4913 .properties-table th, 4914 .properties-table td { 4915 padding: 0.8rem; 4916 text-align: left; 4917 border: solid 1px #ddd; 4918 } 4919 4920 .properties-table th { 4921 background-color: #f8f9fa; 4922 font-weight: bold; 4923 position: sticky; 4924 top: 0; 4925 z-index: 1; 4926 } 4927 4928 .properties-table tr:nth-child(even) { 4929 background-color: #f9f9f9; 4930 } 4931 4932 .properties-table tr:hover { 4933 background-color: #e8f4fd; 4934 } 4935 4936 .property-name { 4937 font-weight: 500; 4938 color: #341100; 4939 } 4940 4941 .doc-link { 4942 font-size: 1.1rem; 4943 } 4944 4945 .doc-link:hover { 4946 opacity: 0.7; 4947 } 4948 4949 .count { 4950 text-align: right; 4951 font-weight: 500; 4952 } 4953 4954 .values { 4955 text-align: right; 4956 font-weight: 500; 4957 } 4958 4959 .loading { 4960 text-align: center; 4961 padding: 2rem; 4962 color: #666; 4963 } 4964 4965 .error { 4966 color: #dc3545; 4967 text-align: center; 4968 padding: 1rem; 4969 background-color: #f8d7da; 4970 border: 1px solid #f5c6cb; 4971 border-radius: 4px; 4972 margin: 1rem 0; 4973 } 4974 4975 .empty-state { 4976 text-align: center; 4977 padding: 2rem; 4978 color: #666; 4979 } 4980 4981 /* Prepare table for filtering */ 4982 .filter-row { 4983 background-color: #f8f9fa; 4984 } 4985 4986 .filter-input { 4987 width: 100%; 4988 padding: 0.25rem; 4989 border: 1px solid #ddd; 4990 border-radius: 4px; 4991 font-size: 0.875rem; 4992 box-sizing: border-box; 4993 } 4994 4995 .filter-input:focus { 4996 outline: none; 4997 border-color: #007bff; 4998 box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25); 4999 } 5000
5001 .filter-controls { 5002 display: flex; 5003 justify-content: space-between; 5004 align-items: center; 5005 margin: 1rem 0; 5006 padding: 0.5rem; 5007 background-color: #f8f9fa; 5008 border-radius: 4px; 5009 } 5010 5011 .rows-counter { 5012 font-size: 0.875rem; 5013 color: #666; 5014 } 5015 5016 .reset-btn { 5017 background-color: #341100; 5018 color: white; 5019 border: 1px solid #341100; 5020 padding: 0.4rem 0.8rem; 5021 border-radius: 4px; 5022 cursor: pointer; 5023 transition: 5024 background-color 0.3s, 5025 color 0.3s; 5026 margin-left: 1rem; 5027 } 5028 5029 .download-btn { 5030 background-color: #341100; 5031 color: white; 5032 border: 1px solid #341100; 5033 padding: 0.4rem 0.8rem; 5034 border-radius: 4px; 5035 cursor: pointer; 5036 transition: 5037 background-color 0.3s, 5038 color 0.3s; 5039 } 5040 5041 .button-group { 5042 display: flex; 5043 gap: 0.5rem; 5044 } 5045 5046 .status-bar { 5047 font-size: 0.875rem; 5048 color: #666; 5049 font-style: italic; 5050 } 5051 5052 .actions-column { 5053 text-align: center; 5054 width: 120px; 5055 } 5056 5057 .actions-buttons { 5058 display: flex; 5059 gap: 0.25rem; 5060 justify-content: center; 5061 flex-wrap: wrap; 5062 } 5063 5064 .action-btn { 5065 background-color: transparent; 5066 border: 1px solid #341100; 5067 color: #341100; 5068 padding: 0.25rem 0.5rem; 5069 border-radius: 3px; 5070 cursor: pointer; 5071 font-size: 0.75rem; 5072 transition: all 0.2s; 5073 min-width: 50px; 5074 } 5075 5076 .action-btn:hover { 5077 background-color: #341100; 5078 color: white; 5079 } 5080 5081 .action-btn.delete { 5082 border-color: #dc3545; 5083 color: #dc3545; 5084 } 5085 5086 .action-btn.delete:hover { 5087 background-color: #dc3545; 5088 color: white; 5089 } 5090 5091 .action-btn:disabled { 5092 opacity: 0.5; 5093 cursor: not-allowed; 5094 } 5095 5096 .action-btn:disabled:hover { 5097 background-color: transparent; 5098 color: #341100; 5099 } 5100 5101 .action-btn.delete:disabled:hover { 5102 background-color: transparent; 5103 color: #dc3545; 5104 } 5105 5106 /* Modal styles */ 5107 .modal-overlay { 5108 position: fixed; 5109 top: 0; 5110 left: 0; 5111 right: 0; 5112 bottom: 0; 5113 background-color: rgba(0, 0, 0, 0.5); 5114 display: flex; 5115 justify-content: center; 5116 align-items: center; 5117 z-index: 1000; 5118 animation: fadeIn 0.2s ease-out; 5119 } 5120 5121 .modal { 5122 background: white; 5123 border-radius: 8px; 5124 box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); 5125 max-width: 500px; 5126 width: 90%; 5127 max-height: 90vh; 5128 overflow-y: auto; 5129 animation: slideIn 0.2s ease-out; 5130 } 5131 5132 .modal-header { 5133 padding: 1.5rem 1.5rem 0; 5134 border-bottom: 1px solid #eee; 5135 } 5136 5137 .modal-title { 5138 font-size: 1.25rem; 5139 font-weight: 600; 5140 color: #333; 5141 margin: 0 0 1rem 0; 5142 } 5143 5144 .modal-body { 5145 padding: 1.5rem; 5146 } 5147 5148 .modal-footer { 5149 padding: 0 1.5rem 1.5rem; 5150 display: flex; 5151 gap: 0.75rem; 5152 justify-content: flex-end; 5153 } 5154 5155 .modal-input { 5156 width: 100%; 5157 padding: 0.75rem; 5158 border: 1px solid #ddd; 5159 border-radius: 4px; 5160 font-size: 1rem; 5161 margin-top: 0.5rem; 5162 } 5163 5164 .modal-input:focus { 5165 outline: none; 5166 border-color: #341100; 5167 box-shadow: 0 0 0 2px rgba(52, 17, 0, 0.1); 5168 } 5169 5170 .modal-text { 5171 color: #555; 5172 line-height: 1.5; 5173 margin-bottom: 1rem; 5174 } 5175 5176 .modal-btn { 5177 padding: 0.75rem 1.5rem; 5178 border: none; 5179 border-radius: 4px; 5180 font-size: 0.9rem; 5181 font-weight: 500; 5182 cursor: pointer; 5183 transition: all 0.2s; 5184 min-width: 80px; 5185 } 5186 5187 .modal-btn-primary { 5188 background-color: #341100; 5189 color: white; 5190 } 5191 5192 .modal-btn-primary:hover { 5193 background-color: #2a0e00; 5194 } 5195 5196 .modal-btn-danger { 5197 background-color: #dc3545; 5198 color: white; 5199 } 5200 5201 .modal-btn-danger:hover { 5202 background-color: #c82333; 5203 } 5204 5205 .modal-btn-secondary { 5206 background-color: #f8f9fa; 5207 color: #333; 5208 border: 1px solid #ddd; 5209 } 5210 5211 .modal-btn-secondary:hover { 5212 background-color: #e9ecef; 5213 } 5214
5215 .modal-btn:disabled { 5216 opacity: 0.5; 5217 cursor: not-allowed; 5218 } 5219 5220 .clash-info { 5221 background-color: #fff3cd; 5222 border: 1px solid #ffeaa7; 5223 border-radius: 4px; 5224 padding: 1rem; 5225 margin: 1rem 0; 5226 } 5227 5228 .clash-stat { 5229 display: flex; 5230 justify-content: space-between; 5231 margin: 0.5rem 0; 5232 } 5233 5234 .clash-stat-label { 5235 font-weight: 500; 5236 } 5237 5238 .clash-stat-value { 5239 font-weight: bold; 5240 color: #856404; 5241 } 5242 5243 @keyframes fadeIn { 5244 from { 5245 opacity: 0; 5246 } 5247 to { 5248 opacity: 1; 5249 } 5250 } 5251 5252 @keyframes slideIn { 5253 from { 5254 opacity: 0; 5255 transform: translateY(-20px); 5256 } 5257 to { 5258 opacity: 1; 5259 transform: translateY(0); 5260 } 5261 } 5262 5263 /* Mobile responsiveness */ 5264 @media (max-width: 768px) { 5265 .properties-table { 5266 font-size: 0.8rem; 5267 } 5268 5269 .properties-table th, 5270 .properties-table td { 5271 padding: 0.5rem; 5272 } 5273 5274 .properties-container h2 { 5275 font-size: 1.8rem; 5276 } 5277 5278 .properties-container p { 5279 font-size: 0.8rem; 5280 } 5281 5282 .actions-column { 5283 width: 100px; 5284 } 5285 5286 .actions-buttons { 5287 flex-direction: column; 5288 gap: 0.125rem; 5289 } 5290 5291 .action-btn { 5292 font-size: 0.7rem; 5293 padding: 0.2rem 0.4rem; 5294 min-width: 40px; 5295 } 5296 5297 .modal { 5298 width: 95%; 5299 margin: 1rem; 5300 } 5301 5302 .modal-footer { 5303 flex-direction: column; 5304 } 5305 5306 .modal-btn { 5307 width: 100%; 5308 } 5309 } 5310 `,xe([g({attribute:"property-base-path"})],ae.prototype,"propertyBasePath",2),xe([b()],ae.prototype,"properties",2),xe([b()],ae.prototype,"filteredProperties",2),xe([b()],ae.prototype,"loading",2),xe([b()],ae.prototype,"error",2),xe([b()],ae.prototype,"filters",2),xe([b()],ae.prototype,"ranges",2),xe([b()],ae.prototype,"showRenameModal",2),xe([b()],ae.prototype,"showDeleteModal",2),xe([b()],ae.prototype,"showClashModal",2),xe([b()],ae.prototype,"showMessageModal",2),xe([b()],ae.prototype,"renameModalData",2),xe([b()],ae.prototype,"deleteModalProperty",2),xe([b()],ae.prototype,"clashData",2),xe([b()],ae.prototype,"messageModalData",2),ae=xe([E("folksonomy-properties"),H()],ae);var sm=Object.defineProperty,am=Object.getOwnPropertyDescriptor,fe=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?am(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&sm(t,r,i),i};let ne=class extends(yo(S)){constructor(){super(...arguments),this.propertyName="",this.propertiesUrl="/properties",this.products=[],this.filteredProducts=[],this.groupedValues=[],this.filteredValues=[],this.viewMode="products",this.loading=!1,this.error=null,this.filters={barcode:"",value:""},this.showReplaceModal=!1,this.showDeleteModal=!1,this.showMessageModal=!1,this.replaceModalData={value:"",newValue:""},this.deleteModalValue="",this.messageModalData={title:"",message:"",type:"success"},this.filterTimeout=null}async connectedCallback(){super.connectedCallback(),this.propertyName&&await this.fetchProductsPropertiesMain(),await ke.fetchUserInfo()}disconnectedCallback(){super.disconnectedCallback(),this.filterTimeout&&(clearTimeout(this.filterTimeout),this.filterTimeout=null)}async fetchProductsPropertiesMain(){this.loading=!0,this.error=null;try{const e=await ke.fetchProductsProperties(this.propertyName);this.products=e||[],this.filteredProducts=[...this.products];const t=new Map;this.products.forEach(e=>{const r=e.v;t.set(r,(t.get(r)||0)+1)}),this.groupedValues=Array.from(t.entries()).map(([e,t])=>({value:e,count:t})).sort((e,t)=>t.count-e.count),this.filteredValues=[...this.groupedValues]}catch(e){console.error("Error fetching property products:",e),this.error="Failed to load products. Please try again later."}finally{this.loading=!1}}get canModerateValues(){const e=Bt.get();return!0===e?.admin||!0===e?.moderator}openReplaceModal(e){this.replaceModalData={value:e,newValue:""},this.showReplaceModal=!0}closeReplaceModal(){this.showReplaceModal=!1,this.replaceModalData={value:"",newValue:""}}async handleReplaceValue(){const{value:e,newValue:t}=this.replaceModalData;if(t.trim()&&t.trim()!==e)try{await ke.replaceValue({property:this.propertyName,old_value:e,new_value:t.trim()}),this.closeReplaceModal(),await this.fetchProductsPropertiesMain(),this.showMessage("success",d("Success"),d("Value replaced successfully!"))}catch(e){console.error("Error replacing value:",e),this.showMessage("error",d("Error"),d("Failed to replace value. Please try again."))}}openDeleteModal(e){this.deleteModalValue=e,this.showDeleteModal=!0}closeDeleteModal(){this.showDeleteModal=!1,this.deleteModalValue=""}async handleDeleteValue(){try{await ke.deleteValue({property:this.propertyName,value:this.deleteModalValue}),this.closeDeleteModal(),await this.fetchProductsPropertiesMain(),this.showMessage("success",d("Success"),d("Value deleted successfully!"))}catch(e){console.error("Error deleting value:",e),this.showMessage("error",d("Error"),d("Failed to delete value. Please try again."))}}showMessage(e,t,r){this.messageModalData={type:e,title:t,message:r},this.showMessageModal=!0}closeMessageModal(){this.showMessageModal=!1,this.messageModalData={title:"",message:"",type:"success"}}renderReplaceModal(){return this.showReplaceModal?c` 5311 <div class="modal-overlay" @click="${this.closeReplaceModal}"> 5312 <div class="modal" @click="${e=>e.stopPropagation()}"> 5313 <div class="modal-header"> 5314 <h3 class="modal-title">${d("Replace Value")}</h3> 5315 </div> 5316 <div class="modal-body"> 5317 <div class="modal-text"> 5318 ${d(Re`Replace all instances of '${this.replaceModalData.value}' with a new value:`)} 5319 </div> 5320 <label for="new-value">${d("New value:")}</label> 5321 <input 5322 id="new-value" 5323 type="text" 5324 class="modal-input" 5325 .value="${this.replaceModalData.newValue}"
5326 @input="${e=>{this.replaceModalData={...this.replaceModalData,newValue:e.target.value}}}" 5327 @keydown="${e=>{"Enter"===e.key?this.handleReplaceValue():"Escape"===e.key&&this.closeReplaceModal()}}" 5328 placeholder="${d("Enter new value...")}" 5329 autofocus 5330 /> 5331 </div> 5332 <div class="modal-footer"> 5333 <button class="modal-btn modal-btn-secondary" @click="${this.closeReplaceModal}"> 5334 ${d("Cancel")} 5335 </button> 5336 <button 5337 class="modal-btn modal-btn-primary" 5338 @click="${this.handleReplaceValue}" 5339 ?disabled="${!this.replaceModalData.newValue.trim()||this.replaceModalData.newValue.trim()===this.replaceModalData.value}" 5340 > 5341 ${d("Replace")} 5342 </button> 5343 </div> 5344 </div> 5345 </div> 5346 `:""}renderDeleteModal(){return this.showDeleteModal?c` 5347 <div class="modal-overlay" @click="${this.closeDeleteModal}"> 5348 <div class="modal" @click="${e=>e.stopPropagation()}"> 5349 <div class="modal-header"> 5350 <h3 class="modal-title">${d("Delete Value")}</h3> 5351 </div> 5352 <div class="modal-body"> 5353 <div class="modal-text"> 5354 ${d(Re`Are you sure you want to delete all instances of the value '${this.deleteModalValue}'?`)} 5355 </div> 5356 <div class="modal-text"> 5357 <strong>${d("This action cannot be undone.")}</strong> 5358 </div> 5359 </div> 5360 <div class="modal-footer"> 5361 <button class="modal-btn modal-btn-secondary" @click="${this.closeDeleteModal}"> 5362 ${d("Cancel")} 5363 </button> 5364 <button class="modal-btn modal-btn-danger" @click="${this.handleDeleteValue}"> 5365 ${d("Delete")} 5366 </button> 5367 </div> 5368 </div> 5369 </div> 5370 `:""}renderMessageModal(){return this.showMessageModal?c` 5371 <div class="modal-overlay" @click="${this.closeMessageModal}"> 5372 <div class="modal" @click="${e=>e.stopPropagation()}"> 5373 <div class="modal-header"> 5374 <h3 class="modal-title">${this.messageModalData.title}</h3> 5375 </div> 5376 <div class="modal-body"> 5377 <div class="modal-text">${this.messageModalData.message}</div> 5378 </div> 5379 <div class="modal-footer"> 5380 <button class="modal-btn modal-btn-primary" @click="${this.closeMessageModal}"> 5381 ${d("OK")} 5382 </button> 5383 </div> 5384 </div> 5385 </div> 5386 `:""}renderValueActions(e){return c` 5387 <td class="actions-column"> 5388 <div class="actions-buttons"> 5389 <button 5390 class="action-btn" 5391 @click="${()=>this.openReplaceModal(e.value)}" 5392 title="${d("Replace this value across all products")}" 5393 > 5394 ${d("Replace")} 5395 </button> 5396 <button 5397 class="action-btn delete" 5398 @click="${()=>this.openDeleteModal(e.value)}" 5399 title="${d("Delete this value from all products")}" 5400 > 5401 ${d("Delete")} 5402 </button> 5403 </div> 5404 </td> 5405 `}applyFilters(){const{barcode:e,value:t}=this.filters;this.filteredProducts=this.products.filter(r=>{const o=!e||r.product.toLowerCase().includes(e.toLowerCase()),n=!t||r.v.toLowerCase().includes(t.toLowerCase());return o&&n}),this.filteredValues=this.groupedValues.filter(e=>!t||e.value.toLowerCase().includes(t.toLowerCase()))}handleFilterInput(e,t){this.filters={...this.filters,[e]:t},this.filterTimeout&&clearTimeout(this.filterTimeout),this.filterTimeout=window.setTimeout(()=>{this.applyFilters()},300)}resetFilters(){this.filters={barcode:"",value:""},this.filteredProducts=[...this.products],this.filteredValues=[...this.groupedValues]}switchViewMode(e){this.viewMode=e}handleDownloadCSV(){const e="products"===this.viewMode,t=e?[d("Product Barcode"),d("Corresponding Value")]:[d("Value"),d("Product Count")],r=e?this.filteredProducts.map(e=>[e.product,e.v]):this.filteredValues.map(e=>[e.value,e.count]),o=(new Date).toISOString().split("T")[0],n=e?`folksonomy_property_${o}_${this.propertyName}_products.csv`:`folksonomy_property_${o}_${this.propertyName}_values.csv`;Ml(r,n,t)}getProductUrl(e){return`/product/${e}`}getPropertyValueUrl(e){return`/property/${this.propertyName}/value/${e}`}getDocumentationUrl(){return`https://wiki.openfoodfacts.org/Folksonomy/Property/${this.propertyName}`}renderTableHeader(){return c` 5406 <thead> 5407 <tr> 5408 <th class="product-code-header">${d("Product barcode")}</th> 5409 <th class="value-header">${d("Corresponding value")}</th> 5410 </tr> 5411 <tr class="filter-row"> 5412 <td> 5413 <input 5414 type="text" 5415 class="filter-input" 5416 placeholder="${d("Filter barcodes...")}" 5417 .value="${this.filters.barcode}"
5418 @input="${e=>this.handleFilterInput("barcode",e.target.value)}" 5419 /> 5420 </td> 5421 <td> 5422 <input 5423 type="text" 5424 class="filter-input" 5425 placeholder="${d("Filter values...")}" 5426 .value="${this.filters.value}" 5427 @input="${e=>this.handleFilterInput("value",e.target.value)}" 5428 /> 5429 </td> 5430 </tr> 5431 </thead> 5432 `}renderProductRow(e){return c` 5433 <tr> 5434 <td class="product-code"> 5435 <a href="${this.getProductUrl(e.product)}" class="product-code"> 5436 ${e.product} 5437 </a> 5438 </td> 5439 <td class="property-value"> 5440 <a href="${this.getPropertyValueUrl(e.v)}" class="property-value"> ${e.v} </a> 5441 </td> 5442 </tr> 5443 `}renderValueRow(e){return c` 5444 <tr> 5445 <td class="property-value"> 5446 <a href="${this.getPropertyValueUrl(e.value)}" class="property-value"> 5447 ${e.value} 5448 </a> 5449 </td> 5450 <td class="count">${e.count}</td> 5451 ${this.canModerateValues?this.renderValueActions(e):""} 5452 </tr> 5453 `}renderGroupedTableHeader(){return c` 5454 <thead> 5455 <tr> 5456 <th class="value-header">${d("Property Value")}</th> 5457 <th class="count-header">${d("Product Count")}</th> 5458 ${this.canModerateValues?c`<th class="actions-column">${d("Actions")}</th>`:""} 5459 </tr> 5460 <tr class="filter-row"> 5461 <td> 5462 <input 5463 type="text" 5464 class="filter-input" 5465 placeholder="${d("Filter values...")}" 5466 .value="${this.filters.value}" 5467 @input="${e=>this.handleFilterInput("value",e.target.value)}" 5468 /> 5469 </td> 5470 <td></td> 5471 ${this.canModerateValues?c`<td></td>`:""} 5472 </tr> 5473 </thead> 5474 `}renderContent(){if(this.loading)return c`<div class="loading">${d("Loading products...")}</div>`;if(this.error)return c`<div class="error">${this.error}</div>`;if(0===this.products.length)return c`<div class="empty-state">${d("No products found for this property.")}</div>`;const e="products"===this.viewMode,t=e?this.filteredProducts:this.filteredValues,r=e?this.products:this.groupedValues;return c` 5475 <div class="table-container"> 5476 <div class="filter-controls"> 5477 <div class="view-controls"> 5478 <div class="view-mode-toggle"> 5479 <button 5480 class="view-mode-btn ${"products"===this.viewMode?"active":""}" 5481 @click="${()=>this.switchViewMode("products")}" 5482 > 5483 ${d("Individual Products")} 5484 </button> 5485 <button 5486 class="view-mode-btn ${"values"===this.viewMode?"active":""}" 5487 @click="${()=>this.switchViewMode("values")}" 5488 > 5489 ${d("Grouped Values")} 5490 </button> 5491 </div> 5492 <div class="rows-counter"> 5493 ${e?`${d("Products")}: ${t.length} / ${r.length}`:`${d("Values")}: ${t.length} / ${r.length}`} 5494 </div> 5495 </div> 5496 <div class="button-group"> 5497 <button class="download-btn" @click="${this.handleDownloadCSV}"> 5498 ${d("Download CSV")} 5499 </button> 5500 <button class="reset-btn" @click="${this.resetFilters}">${d("Reset")}</button> 5501 </div> 5502 </div> 5503 <table class="products-table" id="products-table"> 5504 ${e?this.renderTableHeader():this.renderGroupedTableHeader()} 5505 <tbody> 5506 ${e?this.filteredProducts.map(e=>this.renderProductRow(e)):this.filteredValues.map(e=>this.renderValueRow(e))} 5507 </tbody> 5508 </table> 5509 </div> 5510 `}render(){return this.propertyName?c` 5511 <div class="property-container"> 5512 <div class="content-wrapper"> 5513 <div class="main-content"> 5514 <div class="header-section"> 5515 <div class="property-title-container"> 5516 <h2 id="property_title">${d("Folksonomy property")}: ${this.propertyName}</h2> 5517 5518 <div id="fe_infobox" class="info-box"> 5519 ${d("Tip: you can also find the")} 5520 <a href="${this.propertiesUrl}" target="_blank" 5521 >${d("list of all properties")}</a 5522 >. 5523 </div> 5524 5525 <p> 5526 <slot name="property-description"> 5527 ${d("You should find a")} 5528 <a 5529 href="${this.getDocumentationUrl()}" 5530 target="_blank" 5531 rel="noopener noreferrer" 5532 > 5533 ${d("dedicated documentation")} 5534 </a> 5535 ${d("about this property on Open Food Facts wiki")} 5536 </slot> 5537 </p> 5538 5539 <p>${d("List of products using this property")}:</p> 5540 </div> 5541 </div> 5542 5543 ${this.renderContent()} 5544 </div> 5545 </div> 5546 </div> 5547 5548 ${this.renderReplaceModal()} ${this.renderDeleteModal()} ${this.renderMessageModal()} 5549 `:c` 5550 <div class="property-container"> 5551 <div class="error"> 5552 ${d("Please provide a property name using the property-name attribute.")} 5553 </div> 5554 </div> 5555 `}};ne.styles=$` 5556 :host { 5557 font-family: Arial, sans-serif; 5558 color: #333; 5559 } 5560 5561 .property-container { 5562 margin: 0 auto 1rem auto; 5563 background-color: #fff; 5564 border: 1px solid #ddd; 5565 border-radius: 8px; 5566 box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); 5567 padding: 1rem; 5568 box-sizing: border-box; 5569 } 5570 5571 .property-container h2 { 5572 font-size: 2.2rem; 5573 font-weight: 400; 5574 color: #222; 5575 margin-top: 10px; 5576 margin-bottom: 0.5rem; 5577 } 5578 5579 .property-container p { 5580 font-size: 0.9rem; 5581 line-height: 1.5; 5582 margin-bottom: 1rem; 5583 color: #222; 5584 } 5585 5586 .property-container a { 5587 color: #341100; 5588 } 5589 5590 .content-wrapper { 5591 display: flex; 5592 gap: 1rem; 5593 align-items: flex-start; 5594 } 5595 5596 .main-content { 5597 flex: 1; 5598 min-width: 0; 5599 } 5600 5601 .header-section { 5602 display: flex; 5603 justify-content: space-between; 5604 align-items: flex-start; 5605 margin-bottom: 1rem; 5606 } 5607 5608 .property-title-container { 5609 flex: 1; 5610 min-width: 0; 5611 } 5612 5613 .info-box { 5614 margin-top: 10px; 5615 align-self: flex-start; 5616 } 5617 5618 .table-container { 5619 width: 100%; 5620 max-width: 1200px; 5621 margin: 0 auto; 5622 } 5623 5624 .products-table { 5625 width: 100%; 5626 border-collapse: collapse; 5627 margin-top: 1rem; 5628 border: solid 1px #ddd; 5629 font-size: 0.9rem; 5630 } 5631 5632 .products-table th, 5633 .products-table td { 5634 padding: 0.8rem; 5635 text-align: left; 5636 border: solid 1px #ddd; 5637 } 5638 5639 .products-table th { 5640 background-color: #f8f9fa; 5641 font-weight: bold; 5642 position: sticky; 5643 top: 0; 5644 z-index: 1; 5645 } 5646 5647 .products-table tr:nth-child(even) { 5648 background-color: #f9f9f9; 5649 } 5650 5651 .products-table tr:hover { 5652 background-color: #e8f4fd; 5653 } 5654 5655 .product-code { 5656 font-weight: 500; 5657 color: #341100; 5658 } 5659 5660 .property-value { 5661 font-weight: 500; 5662 color: #341100; 5663 } 5664 5665 .count { 5666 text-align: right; 5667 font-weight: bold; 5668 color: #333; 5669 } 5670 5671 .count-header { 5672 text-align: right; 5673 } 5674 5675 .loading { 5676 text-align: center; 5677 padding: 2rem; 5678 color: #666; 5679 } 5680 5681 .error { 5682 color: #dc3545; 5683 text-align: center; 5684 padding: 1rem; 5685 background-color: #f8d7da; 5686 border: 1px solid #f5c6cb; 5687 border-radius: 4px; 5688 margin: 1rem 0; 5689 } 5690 5691 .empty-state { 5692 text-align: center; 5693 padding: 2rem; 5694 color: #666; 5695 } 5696 5697 /* Filter styles */ 5698 .filter-row { 5699 background-color: #f8f9fa; 5700 } 5701 5702 .filter-input { 5703 width: 100%; 5704 padding: 0.25rem; 5705 border: 1px solid #ddd; 5706 border-radius: 4px; 5707 font-size: 0.875rem; 5708 box-sizing: border-box; 5709 } 5710 5711 .filter-input:focus { 5712 outline: none; 5713 border-color: #007bff; 5714 box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25); 5715 } 5716
5717 .filter-controls { 5718 display: flex; 5719 justify-content: space-between; 5720 align-items: center; 5721 margin: 1rem 0; 5722 padding: 0.5rem; 5723 background-color: #f8f9fa; 5724 border-radius: 4px; 5725 } 5726 5727 .rows-counter { 5728 font-size: 0.875rem; 5729 color: #666; 5730 } 5731 5732 .download-btn { 5733 background-color: #341100; 5734 color: white; 5735 border: 1px solid #341100; 5736 padding: 0.4rem 0.8rem; 5737 border-radius: 4px; 5738 cursor: pointer; 5739 transition: 5740 background-color 0.3s, 5741 color 0.3s; 5742 } 5743 5744 .download-btn:hover { 5745 background-color: rgb(255, 255, 255); 5746 color: #341100; 5747 border: 1px solid #341100; 5748 } 5749 5750 .reset-btn { 5751 background-color: #341100; 5752 color: white; 5753 border: 1px solid #341100; 5754 padding: 0.4rem 0.8rem; 5755 border-radius: 4px; 5756 cursor: pointer; 5757 transition: 5758 background-color 0.3s, 5759 color 0.3s; 5760 margin-left: 1rem; 5761 } 5762 5763 .reset-btn:hover { 5764 background-color: rgb(255, 255, 255); 5765 color: #341100; 5766 border: 1px solid #341100; 5767 } 5768 5769 .button-group { 5770 display: flex; 5771 gap: 0.5rem; 5772 } 5773 5774 .view-mode-toggle { 5775 display: flex; 5776 background-color: #f8f9fa; 5777 border: 1px solid #ddd; 5778 border-radius: 4px; 5779 overflow: hidden; 5780 } 5781 5782 .view-mode-btn { 5783 background-color: transparent; 5784 border: none; 5785 padding: 0.4rem 0.8rem; 5786 cursor: pointer; 5787 transition: background-color 0.2s; 5788 font-size: 0.875rem; 5789 } 5790 5791 .view-mode-btn:hover { 5792 background-color: #e9ecef; 5793 } 5794 5795 .view-mode-btn.active { 5796 background-color: #341100; 5797 color: white; 5798 } 5799 5800 .view-controls { 5801 display: flex; 5802 align-items: center; 5803 gap: 1rem; 5804 } 5805 5806 /* Mobile responsiveness */ 5807 @media (max-width: 768px) { 5808 .content-wrapper { 5809 flex-direction: column; 5810 } 5811 5812 .header-section { 5813 flex-direction: column; 5814 gap: 1rem; 5815 } 5816 5817 .products-table { 5818 font-size: 0.8rem; 5819 } 5820 5821 .products-table th, 5822 .products-table td { 5823 padding: 0.5rem; 5824 } 5825 5826 .property-container h2 { 5827 font-size: 1.8rem; 5828 } 5829 5830 .property-container p { 5831 font-size: 0.8rem; 5832 } 5833 5834 .filter-controls { 5835 flex-direction: column; 5836 gap: 1rem; 5837 align-items: stretch; 5838 } 5839 5840 .view-controls { 5841 flex-direction: column; 5842 gap: 0.5rem; 5843 align-items: center; 5844 } 5845 5846 .view-mode-toggle { 5847 width: 100%; 5848 max-width: 300px; 5849 } 5850 5851 .view-mode-btn { 5852 flex: 1; 5853 } 5854 } 5855 5856 .actions-column { 5857 text-align: center; 5858 width: 120px; 5859 } 5860 5861 .actions-buttons { 5862 display: flex; 5863 gap: 0.25rem; 5864 justify-content: center; 5865 flex-wrap: wrap; 5866 } 5867 5868 .action-btn { 5869 background-color: transparent; 5870 border: 1px solid #341100; 5871 color: #341100; 5872 padding: 0.25rem 0.5rem; 5873 border-radius: 3px; 5874 cursor: pointer; 5875 font-size: 0.75rem; 5876 transition: all 0.2s; 5877 min-width: 50px; 5878 } 5879 5880 .action-btn:hover { 5881 background-color: #341100; 5882 color: white; 5883 } 5884 5885 .action-btn.delete { 5886 border-color: #dc3545; 5887 color: #dc3545; 5888 } 5889 5890 .action-btn.delete:hover { 5891 background-color: #dc3545; 5892 color: white; 5893 } 5894 5895 .action-btn:disabled { 5896 opacity: 0.5; 5897 cursor: not-allowed; 5898 } 5899 5900 .action-btn:disabled:hover { 5901 background-color: transparent; 5902 color: #341100; 5903 } 5904 5905 .action-btn.delete:disabled:hover { 5906 background-color: transparent; 5907 color: #dc3545; 5908 } 5909 5910 @media (max-width: 768px) { 5911 .actions-column { 5912 width: 100px; 5913 } 5914 5915 .actions-buttons { 5916 flex-direction: column; 5917 gap: 0.125rem; 5918 } 5919 5920 .action-btn { 5921 font-size: 0.7rem; 5922 padding: 0.2rem 0.4rem; 5923 min-width: 40px; 5924 } 5925 } 5926 5927 /* Modal styles */ 5928 .modal-overlay { 5929 position: fixed; 5930 top: 0; 5931 left: 0; 5932 right: 0; 5933 bottom: 0; 5934 background-color: rgba(0, 0, 0, 0.5); 5935 display: flex; 5936 justify-content: center; 5937 align-items: center; 5938 z-index: 1000; 5939 animation: fadeIn 0.2s ease-out; 5940 } 5941 5942 .modal { 5943 background: white; 5944 border-radius: 8px; 5945 box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); 5946 max-width: 500px; 5947 width: 90%; 5948 max-height: 90vh; 5949 overflow-y: auto; 5950 animation: slideIn 0.2s ease-out; 5951 } 5952
5953 .modal-header { 5954 padding: 1.5rem 1.5rem 0; 5955 border-bottom: 1px solid #eee; 5956 } 5957 5958 .modal-title { 5959 font-size: 1.25rem; 5960 font-weight: 600; 5961 color: #333; 5962 margin: 0 0 1rem 0; 5963 } 5964 5965 .modal-body { 5966 padding: 1.5rem; 5967 } 5968 5969 .modal-footer { 5970 padding: 0 1.5rem 1.5rem; 5971 display: flex; 5972 gap: 0.75rem; 5973 justify-content: flex-end; 5974 } 5975 5976 .modal-input { 5977 width: 100%; 5978 padding: 0.75rem; 5979 border: 1px solid #ddd; 5980 border-radius: 4px; 5981 font-size: 1rem; 5982 margin-top: 0.5rem; 5983 } 5984 5985 .modal-input:focus { 5986 outline: none; 5987 border-color: #341100; 5988 box-shadow: 0 0 0 2px rgba(52, 17, 0, 0.1); 5989 } 5990 5991 .modal-text { 5992 color: #555; 5993 line-height: 1.5; 5994 margin-bottom: 1rem; 5995 } 5996 5997 .modal-btn { 5998 padding: 0.75rem 1.5rem; 5999 border: none; 6000 border-radius: 4px; 6001 font-size: 0.9rem; 6002 font-weight: 500; 6003 cursor: pointer; 6004 transition: all 0.2s; 6005 min-width: 80px; 6006 } 6007 6008 .modal-btn-primary { 6009 background-color: #341100; 6010 color: white; 6011 } 6012 6013 .modal-btn-primary:hover { 6014 background-color: #2a0e00; 6015 } 6016 6017 .modal-btn-danger { 6018 background-color: #dc3545; 6019 color: white; 6020 } 6021 6022 .modal-btn-danger:hover { 6023 background-color: #c82333; 6024 } 6025 6026 .modal-btn-secondary { 6027 background-color: #f8f9fa; 6028 color: #333; 6029 border: 1px solid #ddd; 6030 } 6031 6032 .modal-btn-secondary:hover { 6033 background-color: #e9ecef; 6034 } 6035 6036 .modal-btn:disabled { 6037 opacity: 0.5; 6038 cursor: not-allowed; 6039 } 6040 6041 @keyframes fadeIn { 6042 from { 6043 opacity: 0; 6044 } 6045 to { 6046 opacity: 1; 6047 } 6048 } 6049 6050 @keyframes slideIn { 6051 from { 6052 opacity: 0; 6053 transform: translateY(-20px); 6054 } 6055 to { 6056 opacity: 1; 6057 transform: translateY(0); 6058 } 6059 } 6060 6061 @media (max-width: 768px) { 6062 .modal { 6063 width: 95%; 6064 margin: 1rem; 6065 } 6066 6067 .modal-footer { 6068 flex-direction: column; 6069 } 6070 6071 .modal-btn { 6072 width: 100%; 6073 } 6074 } 6075 `,fe([g({type:String,attribute:"property-name"})],ne.prototype,"propertyName",2),fe([g({type:String,attribute:"properties-url"})],ne.prototype,"propertiesUrl",2),fe([b()],ne.prototype,"products",2),fe([b()],ne.prototype,"filteredProducts",2),fe([b()],ne.prototype,"groupedValues",2),fe([b()],ne.prototype,"filteredValues",2),fe([b()],ne.prototype,"viewMode",2),fe([b()],ne.prototype,"loading",2),fe([b()],ne.prototype,"error",2),fe([b()],ne.prototype,"filters",2),fe([b()],ne.prototype,"showReplaceModal",2),fe([b()],ne.prototype,"showDeleteModal",2),fe([b()],ne.prototype,"showMessageModal",2),fe([b()],ne.prototype,"replaceModalData",2),fe([b()],ne.prototype,"deleteModalValue",2),fe([b()],ne.prototype,"messageModalData",2),ne=fe([E("folksonomy-property-products"),H()],ne);var lm=Object.defineProperty,cm=Object.getOwnPropertyDescriptor,wt=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?cm(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&lm(t,r,i),i};let qe=class extends S{constructor(){super(...arguments),this.product={code:"",product_name:"",brands:"",quantity:"",image_front_small_url:"",product_type:"",nutriscore_grade:void 0,nova_group:void 0,greenscore_grade:void 0},this.personalScore=void 0,this.showMatchTag=!1,this.navigating={to:null},this.nutriscoreSrc="",this.novaSrc="",this.greenscoreSrc="",this.placeholderImage=ct("Placeholder.svg"),this.isDarkMode=ut.darkMode,this._darkModeCb=e=>{this.isDarkMode=e,this.requestUpdate()}}connectedCallback(){super.connectedCallback(),ut.subscribe(this._darkModeCb)}disconnectedCallback(){ut.unsubscribe(this._darkModeCb),super.disconnectedCallback()}updated(e){super.updated(e),this.nutriscoreSrc=gi(`nutriscore-${this.product.nutriscore_grade?.toLowerCase()||"unknown"}.svg`),this.novaSrc=gi(`nova-group-${this.product.nova_group||"unknown"}.svg`),this.greenscoreSrc=gi(`green-score-${this.product.greenscore_grade?.toLowerCase()||"unknown"}.svg`)}getMatchTagInfo(){if(this.personalScore){const{score:e,matchStatus:t}=this.personalScore;switch(t){case"very_good_match":return{text:d(Re`Very Good Match ${e}%`),cssClass:"match-tag-very-good-match"};case"good_match":return{text:d(Re`Good Match ${e}%`),cssClass:"match-tag-good-match"};case"poor_match":return{text:d(Re`Poor Match ${e}%`),cssClass:"match-tag-poor-match"};case"does_not_match":return{text:d("Does Not Match"),cssClass:"match-tag-does-not-match"};case"may_not_match":return{text:d("May Not Match"),cssClass:"match-tag-may-not-match"};default:return{text:d("Unknown Match"),cssClass:"match-tag-unknown-match"}}}return{text:d("No Score Available"),cssClass:"match-tag-unknown-match"}}render(){const e=this.navigating.to?.params?.barcode===this.product.code,t=!!this.product.image_front_small_url,r=this.getMatchTagInfo(),o={"card-container":!0,"dark-mode":this.isDarkMode};return c`
6076 <div class=${ko(o)}> 6077 ${this.showMatchTag?c`<div class="match-tag ${r.cssClass}">${r.text}</div>`:D} 6078 <div class="card-content"> 6079 <div class="image-container"> 6080 ${e?c` 6081 <div class="loading-container"> 6082 <span class="loading-ring"></span> 6083 </div> 6084 `:t?c` 6085 <div class="loading-container"> 6086 <img 6087 src=${this.product.image_front_small_url} 6088 class="product-image" 6089 alt="Product front" 6090 /> 6091 </div> 6092 `:c` 6093 <div class="placeholder-container"> 6094 <img 6095 src=${this.placeholderImage} 6096 class="placeholder-image" 6097 alt="Product front" 6098 /> 6099 </div> 6100 `} 6101 </div> 6102 <div class="content-container"> 6103 <div 6104 class="title" 6105 title=${this.product.product_name?this.product.product_name:this.product.code} 6106 > 6107 ${this.product.product_name?this.product.product_name:this.product.code} 6108 </div> 6109 6110 <div class="brand-quantity"> 6111 <p title="${this.product.brands} - ${this.product.quantity}"> 6112 ${this.product.brands} - ${this.product.quantity} 6113 </p> 6114 </div> 6115 6116 ${"food"===this.product.product_type?c` 6117 <div class="scores-container"> 6118 <div class="score-item"> 6119 <img src=${this.nutriscoreSrc} alt="nutriscore" class="score-image" /> 6120 </div> 6121 <div class="score-item"> 6122 <img src=${this.novaSrc} alt="nova" class="score-image" /> 6123 </div> 6124 <div class="score-item"> 6125 <img src=${this.greenscoreSrc} alt="greenscore" class="score-image" /> 6126 </div> 6127 </div> 6128 `:D} 6129 </div> 6130 </div> 6131 </div> 6132 `}};function zs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}qe.styles=$` 6133 :host { 6134 display: block; 6135 font-family: "Plus Jakarta Sans Variable", system-ui, sans-serif; 6136 } 6137 6138 .card-container { 6139 display: flex; 6140 flex-direction: column; 6141 height: 100%; 6142 width: 100%; 6143 max-width: 100%; 6144 border-radius: 1rem; 6145 box-shadow: 6146 0 4px 6px -1px rgba(0, 0, 0, 0.1), 6147 0 2px 4px -1px rgba(0, 0, 0, 0.06); 6148 cursor: pointer; 6149 position: relative; 6150 background-color: white; 6151 overflow: hidden; 6152 } 6153 6154 .card-content { 6155 display: flex; 6156 flex: 1; 6157 border-radius: 1rem; 6158 height: 100%; 6159 } 6160 6161 .dark-mode { 6162 background-color: #2d2724; 6163 color: #f9f7f5; 6164 } 6165 6166 .image-container { 6167 height: 100%; 6168 width: 40%; 6169 text-align: center; 6170 font-size: 0.875rem; 6171 display: flex; 6172 align-items: center; 6173 justify-content: center; 6174 } 6175 6176 @media (min-width: 640px) { 6177 .image-container { 6178 width: 7rem; 6179 } 6180 } 6181 6182 @media (min-width: 1024px) { 6183 .image-container { 6184 width: 9rem; 6185 } 6186 } 6187 6188 .loading-container { 6189 display: flex; 6190 height: 100%; 6191 width: 100%; 6192 align-items: center; 6193 justify-content: center; 6194 } 6195 6196 .loading-ring { 6197 display: inline-block; 6198 position: relative; 6199 width: 64px; 6200 height: 64px; 6201 } 6202 6203 .loading-ring:after { 6204 content: " "; 6205 display: block; 6206 width: 46px; 6207 height: 46px; 6208 margin: 8px; 6209 border-radius: 50%; 6210 border: 5px solid currentColor; 6211 border-color: currentColor transparent currentColor transparent; 6212 animation: loading-ring 1.2s linear infinite; 6213 } 6214 6215 @keyframes loading-ring { 6216 0% { 6217 transform: rotate(0deg); 6218 } 6219 100% { 6220 transform: rotate(360deg); 6221 } 6222 } 6223 6224 .product-image { 6225 height: 100%; 6226 width: 100%; 6227 overflow: hidden; 6228 object-fit: cover; 6229 border-top-left-radius: 1rem; 6230 border-bottom-left-radius: 1rem; 6231 } 6232 6233 .placeholder-container { 6234 display: flex; 6235 height: 100%; 6236 width: 100%; 6237 align-items: center; 6238 justify-content: center; 6239 background-color: transparent; 6240 color: black; 6241 } 6242 6243 .placeholder-image { 6244 height: 100%; 6245 width: 100%; 6246 border-radius: 0.5rem; 6247 background-color: transparent; 6248 object-fit: cover; 6249 opacity: 0.7; 6250 overflow: hidden; 6251 } 6252 6253 .dark-mode .placeholder-image { 6254 filter: invert(1); 6255 } 6256 6257 .content-container { 6258 display: flex; 6259 flex-direction: column; 6260 width: 60%; 6261 align-items: center; 6262 justify-content: space-evenly; 6263 padding: 0.5rem; 6264 padding-left: 0.75rem; 6265 font-weight: 600; 6266 padding-top: 1rem; 6267 } 6268 6269 @media (min-width: 640px) { 6270 .content-container { 6271 width: 10rem; 6272 } 6273 } 6274 6275 @media (min-width: 768px) { 6276 .content-container { 6277 width: 14rem; 6278 } 6279 } 6280 6281 @media (min-width: 1024px) { 6282 .content-container { 6283 width: 13rem; 6284 } 6285 } 6286 6287 .title { 6288 width: 100%; 6289 overflow: hidden; 6290 text-overflow: ellipsis; 6291 white-space: nowrap; 6292 font-size: 1.125rem; 6293 font-weight: 600; 6294 } 6295 6296 @media (min-width: 640px) {
6297 .title { 6298 font-size: 1rem; 6299 } 6300 } 6301 6302 .brand-quantity { 6303 display: flex; 6304 width: 100%; 6305 justify-content: flex-start; 6306 } 6307 6308 .brand-quantity p { 6309 overflow: hidden; 6310 text-overflow: ellipsis; 6311 white-space: nowrap; 6312 font-size: 0.875rem; 6313 margin: 0; 6314 } 6315 6316 .scores-container { 6317 display: flex; 6318 height: 3rem; 6319 width: 100%; 6320 flex-direction: row; 6321 margin-top: 0.5rem; 6322 align-items: stretch; 6323 justify-content: space-evenly; 6324 gap: 0.25rem; 6325 } 6326 6327 .score-item { 6328 display: flex; 6329 align-items: center; 6330 } 6331 6332 .score-image { 6333 height: 100%; 6334 max-height: 2.5rem; 6335 } 6336 6337 @media (min-width: 640px) { 6338 .score-image { 6339 max-height: 2.5rem; 6340 } 6341 } 6342 6343 .match-tag { 6344 position: absolute; 6345 top: 0; 6346 left: 0; 6347 right: 0; 6348 color: white; 6349 padding: 0.25rem 0.5rem; 6350 font-size: 0.75rem; 6351 font-weight: 600; 6352 text-align: center; 6353 border-top-left-radius: 1rem; 6354 border-top-right-radius: 1rem; 6355 z-index: 10; 6356 width: 100%; 6357 box-sizing: border-box; 6358 } 6359 6360 /* Match score color variants */ 6361 .match-tag-very-good-match { 6362 background-color: #10b981; /* Dark green */ 6363 } 6364 6365 .match-tag-good-match { 6366 background-color: #34d399; /* Light green */ 6367 } 6368 6369 .match-tag-poor-match { 6370 background-color: #f59e0b; /* Yellow/Orange */ 6371 } 6372 6373 .match-tag-does-not-match { 6374 background-color: #ef4444; /* Red */ 6375 } 6376 6377 .match-tag-may-not-match { 6378 background-color: #f97316; /* Orange */ 6379 } 6380 6381 .match-tag-unknown-match { 6382 background-color: #6b7280; /* Gray */ 6383 } 6384 `,wt([g({type:Object})],qe.prototype,"product",2),wt([g({type:Object})],qe.prototype,"personalScore",2),wt([g({type:Boolean})],qe.prototype,"showMatchTag",2),wt([g({type:Object})],qe.prototype,"navigating",2),wt([b()],qe.prototype,"nutriscoreSrc",2),wt([b()],qe.prototype,"novaSrc",2),wt([b()],qe.prototype,"greenscoreSrc",2),wt([g({type:String})],qe.prototype,"placeholderImage",2),qe=wt([E("product-card"),H()],qe);var sr=zs();function Pc(e){sr=e}var no={exec:()=>null};function U(e,t=""){let r="string"==typeof e?e:e.source,o={replace:(e,t)=>{let n="string"==typeof t?t:t.source;return n=n.replace(Ce.caret,"$1"),r=r.replace(e,n),o},getRegex:()=>new RegExp(r,t)};return o}var Ce={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},dm=/^(?:[ \t]*(?:\n|$))+/,hm=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,um=/^ {0,3}(`{3,}
vendor: 9,334 bytes, line 6384
6384(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Io=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,pm=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Us=/(?:[*+-]|\d{1,9}[.)])/,Oc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Dc=U(Oc).replace(/bull/g,Us).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),gm=U(Oc).replace(/bull/g,Us).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Fs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,fm=/^[^\n]+/,js=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,mm=U(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",js).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),bm=U(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Us).getRegex(),Hn="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Bs=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,vm=U("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",Bs).replace("tag",Hn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Mc=U(Fs).replace("hr",Io).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Hn).getRegex(),wm=U(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Mc).getRegex(),Vs={blockquote:wm,code:hm,def:mm,fences:um,heading:pm,hr:Io,html:vm,lheading:Dc,list:bm,newline:dm,paragraph:Mc,table:no,text:fm},gl=U("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Io).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Hn).getRegex(),ym={...Vs,lheading:gm,table:gl,paragraph:U(Fs).replace("hr",Io).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",gl).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Hn).getRegex()},xm={...Vs,html:U("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Bs).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:no,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:U(Fs).replace("hr",Io).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Dc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},$m=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,_m=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Rc=/^( {2,}|\\)\n(?!\s*$)/,km=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Gn=/[\p{P}\p{S}]/u,Hs=/[\s\p{P}\p{S}]/u,Nc=/[^\s\p{P}\p{S}]/u,Cm=U(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Hs).getRegex(),Lc=/(?!~)[\p{P}\p{S}]/u,Sm=/(?!~)[\s\p{P}\p{S}]/u,Em=/(?:[^\s\p{P}\p{S}]|~)/u,Tm=/\[[^\[\]]*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,zc=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Am=U(zc,"u").replace(/punct/g,Gn).getRegex(),Im=U(zc,"u").replace(/punct/g,Lc).getRegex(),Uc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Pm=U(Uc,"gu").replace(/notPunctSpace/g,Nc).replace(/punctSpace/g,Hs).replace(/punct/g,Gn).getRegex(),Om=U(Uc,"gu").replace(/notPunctSpace/g,Em).replace(/punctSpace/g,Sm).replace(/punct/g,Lc).getRegex(),Dm=U("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Nc).replace(/punctSpace/g,Hs).replace(/punct/g,Gn).getRegex(),Mm=U(/\\(punct)/,"gu").replace(/punct/g,Gn).getRegex(),Rm=U(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Nm=U(Bs).replace("(?:--\x3e|$)","--\x3e").getRegex(),Lm=U("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Nm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),$n=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/,zm=U(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",$n).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Fc=U(/^!?\[(label)\]\[(ref)\]/).replace("label",$n).replace("ref",js).getRegex(),jc=U(/^!?\[(ref)\](?:\[\])?/).replace("ref",js).getRegex(),Um=U("reflink|nolink(?!\\()","g").replace("reflink",Fc).replace("nolink",jc).getRegex(),Gs={_backpedal:no,anyPunctuation:Mm,autolink:Rm,blockSkip:Tm,br:Rc,code:_m,del:no,emStrongLDelim:Am,emStrongRDelimAst:Pm,emStrongRDelimUnd:Dm,escape:$m,link:zm,nolink:jc,punctuation:Cm,reflink:Fc,reflinkSearch:Um,tag:Lm,text:km,url:no},Fm={...Gs,link:U(/^!?\[(label)\]\((.*?)\)/).replace("label",$n).getRegex(),reflink:U(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",$n).getRegex()},Zi={...Gs,emStrongRDelimAst:Om,emStrongLDelim:Im,url:U(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},jm={...Zi,br:U(Rc).replace("{2,}","*").getRegex(),text:U(Zi.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ko={normal:Vs,gfm:ym,pedantic:xm},Xr={normal:Gs,gfm:Zi,breaks:jm,pedantic:Fm},Bm={"&":"&","<":"<",">":">",'"':""","'":"'"},fl=e=>Bm[e];function Ke(e,t){if(t){if(Ce.escapeTest.test(e))return e.replace(Ce.escapeReplace,fl)}else if(Ce.escapeTestNoEncode.test(e))return e.replace(Ce.escapeReplaceNoEncode,fl);return e}function ml(e){try{e=encodeURI(e).replace(Ce.percentDecode,"%")}catch{return null}return e}function bl(e,t){let r=e.replace(Ce.findPipe,(e,t,r)=>{let o=!1,n=t;for(;--n>=0&&"\\"===r[n];)o=!o;return o?"|":" |"}).split(Ce.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(Ce.slashPipe,"|");return r}function Qr(e,t,r){let o=e.length;if(0===o)return"";let n=0;for(;n<o&&e.charAt(o-n-1)===t;)n++;return e.slice(0,o-n)}
6384function Vm(e,t){if(-1===e.indexOf(t[1]))return-1;let r=0;for(let o=0;o<e.length;o++)if("\\"===e[o])o++;else if(e[o]===t[0])r++;else if(e[o]===t[1]&&(r--,r<0))return o;return r>0?-2:-1}function vl(e,t,r,o,n){let i=t.href,s=t.title||null,a=e[1].replace(n.other.outputLinkReplace,"$1");o.state.inLink=!0;let l={type:"!"===e[0].charAt(0)?"image":"link",raw:r,href:i,title:s,text:a,tokens:o.inlineTokens(a)};return o.state.inLink=!1,l}function Hm(e,t,r){let o=e.match(r.other.indentCodeCompensation);if(null===o)return t;let n=o[1];return t.split("\n").map(e=>{let t=e.match(r.other.beginningSpace);if(null===t)return e;let[o]=t;return o.length>=n.length?e.slice(n.length):e}).join("\n")}var _n=class{options;rules;lexer;constructor(e){this.options=e||sr}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:Qr(e,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],r=Hm(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Qr(e,"#");(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Qr(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Qr(t[0],"\n").split("\n"),r="",o="",n=[];for(;e.length>0;){let t,i=!1,s=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))s.push(e[t]),i=!0;else{if(i)break;s.push(e[t])}e=e.slice(t);let a=s.join("\n"),l=a.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}\n${a}`:a,o=o?`${o}\n${l}`:l;let c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,n,!0),this.lexer.state.top=c,0===e.length)break;let d=n.at(-1);if("code"===d?.type)break;if("blockquote"===d?.type){let t=d,i=t.raw+"\n"+e.join("\n"),s=this.blockquote(i);n[n.length-1]=s,r=r.substring(0,r.length-t.raw.length)+s.raw,o=o.substring(0,o.length-t.text.length)+s.text;break}if("list"===d?.type){let t=d,i=t.raw+"\n"+e.join("\n"),s=this.list(i);n[n.length-1]=s,r=r.substring(0,r.length-d.raw.length)+s.raw,o=o.substring(0,o.length-t.raw.length)+s.raw,e=i.substring(n.at(-1).raw.length).split("\n");continue}}return{type:"blockquote",raw:r,tokens:n,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r=t[1].trim(),o=r.length>1,n={type:"list",raw:"",ordered:o,start:o?+r.slice(0,-1):"",loose:!1,items:[]};r=o?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=o?r:"[*+-]");let i=this.rules.other.listItemRegex(r),s=!1;for(;e;){let r=!1,o="",a="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;o=t[0],e=e.substring(o.length);let l=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,e=>" ".repeat(3*e.length)),c=e.split("\n",1)[0],d=!l.trim(),h=0;if(this.options.pedantic?(h=2,a=l.trimStart()):d?h=t[1].length+1:(h=t[2].search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=l.slice(h),h+=t[1].length),d&&this.rules.other.blankLine.test(c)&&(o+=c+"\n",e=e.substring(c.length+1),r=!0),!r){let t=this.rules.other.nextBulletRegex(h),r=this.rules.other.hrRegex(h),n=this.rules.other.fencesBeginRegex(h),i=this.rules.other.headingBeginRegex(h),s=this.rules.other.htmlBeginRegex(h);for(;e;){let p,u=e.split("\n",1)[0];if(c=u,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),p=c):p=c.replace(this.rules.other.tabCharGlobal," "),n.test(c)||i.test(c)||s.test(c)||t.test(c)||r.test(c))break;if(p.search(this.rules.other.nonSpaceChar)>=h||!c.trim())a+="\n"+p.slice(h);else{if(d||l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||n.test(l)||i.test(l)||r.test(l))break;a+="\n"+c}!d&&!c.trim()&&(d=!0),o+=u+"\n",e=e.substring(u.length+1),l=p.slice(h)}}n.loose||(s?n.loose=!0:this.rules.other.doubleBlankLine.test(o)&&(s=!0));let p,u=null;this.options.gfm&&(u=this.rules.other.listIsTask.exec(a),u&&(p="[ ] "!==u[0],a=a.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:o,task:!!u,checked:p,loose:!1,text:a,tokens:[]}),n.raw+=o}let a=n.items.at(-1);if(!a)return;a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd(),n.raw=n.raw.trimEnd();for(let e=0;e<n.items.length;e++)if(this.lexer.state.top=!1,n.items[e].tokens=this.lexer.blockTokens(n.items[e].text,[]),!n.loose){let t=n.items[e].tokens.filter(e=>
vendor: 6,567 bytes, line 6384
6384"space"===e.type),r=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw));n.loose=r}if(n.loose)for(let e=0;e<n.items.length;e++)n.items[e].loose=!0;return n}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:r,title:o}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let r=bl(t[1]),o=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===o.length){for(let e of o)this.rules.other.tableAlignRight.test(e)?i.align.push("right"):this.rules.other.tableAlignCenter.test(e)?i.align.push("center"):this.rules.other.tableAlignLeft.test(e)?i.align.push("left"):i.align.push(null);for(let e=0;e<r.length;e++)i.header.push({text:r[e],tokens:this.lexer.inline(r[e]),header:!0,align:i.align[e]});for(let e of n)i.rows.push(bl(e,i.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:i.align[t]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Qr(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=Vm(t[2],"()");if(-2===e)return;if(e>-1){let r=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,r).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(r);e&&(r=e[1],o=e[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(r=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?r.slice(1):r.slice(1,-1)),vl(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let e=t[(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){let e=r[0].charAt(0);return{type:"text",raw:e,text:e}}return vl(r,e,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let o=this.rules.inline.emStrongLDelim.exec(e);if(!(!o||o[3]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!o[1]&&!o[2]||!r||this.rules.inline.punctuation.exec(r))){let r,n,i=[...o[0]].length-1,s=i,a=0,l="*"===o[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+i);null!=(o=l.exec(t));){if(r=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!r)continue;if(n=[...r].length,o[3]||o[4]){s+=n;continue}if((o[5]||o[6])&&i%3&&!((i+n)%3)){a+=n;continue}if(s-=n,s>0)continue;n=Math.min(n,n+s+a);let t=[...o[0]][0].length,l=e.slice(0,i+o.index+t+n);if(Math.min(i,n)%2){let e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}let c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(e),o=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return r&&o&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,r;return"@"===t[2]?(e=t[1],r="mailto:"+e):(e=t[1],r=e),{type:"link",raw:t[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,r;if("@"===t[2])e=t[0],r="mailto:"+e;else{let o;do{o=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(o!==t[0]);e=t[0],r="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},dt=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||sr,this.options.tokenizer=this.options.tokenizer||new _n,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Ce,block:Ko.normal,inline:Xr.normal};this.options.pedantic?(t.block=Ko.pedantic,t.inline=Xr.pedantic):this.options.gfm&&(t.block=Ko.gfm,this.options.breaks?t.inline=Xr.breaks:t.inline=Xr.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ko,inline:Xr}}static lex(t,r){return new e(r).lex(t)}static lexInline(t,r){return new e(r).inlineTokens(t)}lex(e){e=e.replace(Ce.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;
vendor: 4,514 bytes, line 6384
6384e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){for(this.options.pedantic&&(e=e.replace(Ce.tabCharGlobal," ").replace(Ce.spaceLine,""));e;){let o;if(this.options.extensions?.block?.some(r=>!!(o=r.call({lexer:this},e,t))&&(e=e.substring(o.raw.length),t.push(o),!0)))continue;if(o=this.tokenizer.space(e)){e=e.substring(o.raw.length);let r=t.at(-1);1===o.raw.length&&void 0!==r?r.raw+="\n":t.push(o);continue}if(o=this.tokenizer.code(e)){e=e.substring(o.raw.length);let r=t.at(-1);"paragraph"===r?.type||"text"===r?.type?(r.raw+=(r.raw.endsWith("\n")?"":"\n")+o.raw,r.text+="\n"+o.text,this.inlineQueue.at(-1).src=r.text):t.push(o);continue}if(o=this.tokenizer.fences(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.heading(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.hr(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.blockquote(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.list(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.html(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.def(e)){e=e.substring(o.raw.length);let r=t.at(-1);"paragraph"===r?.type||"text"===r?.type?(r.raw+=(r.raw.endsWith("\n")?"":"\n")+o.raw,r.text+="\n"+o.raw,this.inlineQueue.at(-1).src=r.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},t.push(o));continue}if(o=this.tokenizer.table(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.lheading(e)){e=e.substring(o.raw.length),t.push(o);continue}let n=e;if(this.options.extensions?.startBlock){let t,r=1/0,o=e.slice(1);this.options.extensions.startBlock.forEach(e=>{t=e.call({lexer:this},o),"number"==typeof t&&t>=0&&(r=Math.min(r,t))}),r<1/0&&r>=0&&(n=e.substring(0,r+1))}if(this.state.top&&(o=this.tokenizer.paragraph(n))){let i=t.at(-1);r&&"paragraph"===i?.type?(i.raw+=(i.raw.endsWith("\n")?"":"\n")+o.raw,i.text+="\n"+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(o),r=n.length!==e.length,e=e.substring(o.raw.length);continue}if(o=this.tokenizer.text(e)){e=e.substring(o.raw.length);let r=t.at(-1);"text"===r?.type?(r.raw+=(r.raw.endsWith("\n")?"":"\n")+o.raw,r.text+="\n"+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(o);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let r=e,o=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(o=this.tokenizer.rules.inline.reflinkSearch.exec(r));)e.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(o=this.tokenizer.rules.inline.anyPunctuation.exec(r));)r=r.slice(0,o.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(o=this.tokenizer.rules.inline.blockSkip.exec(r));)r=r.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let n=!1,i="";for(;e;){let o;if(n||(i=""),n=!1,this.options.extensions?.inline?.some(r=>!!(o=r.call({lexer:this},e,t))&&(e=e.substring(o.raw.length),t.push(o),!0)))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let r=t.at(-1);"text"===o.type&&"text"===r?.type?(r.raw+=o.raw,r.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,r,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t,r=1/0,o=e.slice(1);
6384this.options.extensions.startInline.forEach(e=>{t=e.call({lexer:this},o),"number"==typeof t&&t>=0&&(r=Math.min(r,t))}),r<1/0&&r>=0&&(s=e.substring(0,r+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),"_"!==o.raw.slice(-1)&&(i=o.raw.slice(-1)),n=!0;let r=t.at(-1);"text"===r?.type?(r.raw+=o.raw,r.text+=o.text):t.push(o);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}},kn=class{options;parser;constructor(e){this.options=e||sr}space(e){return""}code({text:e,lang:t,escaped:r}){let o=(t||"").match(Ce.notSpaceStart)?.[0],n=e.replace(Ce.endingNewline,"")+"\n";return o?'<pre><code class="language-'+Ke(o)+'">'+(r?n:Ke(n,!0))+"</code></pre>\n":"<pre><code>"+(r?n:Ke(n,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){let t=e.ordered,r=e.start,o="";for(let t=0;t<e.items.length;t++){let r=e.items[t];o+=this.listitem(r)}let n=t?"ol":"ul";return"<"+n+(t&&1!==r?' start="'+r+'"':"")+">\n"+o+"</"+n+">\n"}listitem(e){let t="";if(e.task){let r=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===e.tokens[0]?.type?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=r+" "+Ke(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",r="";for(let t=0;t<e.header.length;t++)r+=this.tablecell(e.header[t]);t+=this.tablerow({text:r});let o="";for(let t=0;t<e.rows.length;t++){let n=e.rows[t];r="";for(let e=0;e<n.length;e++)r+=this.tablecell(n[e]);o+=this.tablerow({text:r})}return o&&(o=`<tbody>${o}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+o+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Ke(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let o=this.parser.parseInline(r),n=ml(e);if(null===n)return o;let i='<a href="'+(e=n)+'"';return t&&(i+=' title="'+Ke(t)+'"'),i+=">"+o+"</a>",i}image({href:e,title:t,text:r,tokens:o}){o&&(r=this.parser.parseInline(o,this.parser.textRenderer));let n=ml(e);if(null===n)return Ke(r);let i=`<img src="${e=n}" alt="${r}"`;return t&&(i+=` title="${Ke(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ke(e.text)}},qs=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},ht=class e{options;renderer;textRenderer;constructor(e){this.options=e||sr,this.options.renderer=this.options.renderer||new kn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new qs}static parse(t,r){return new e(r).parse(t)}static parseInline(t,r){return new e(r).parseInline(t)}parse(e,t=!0){let r="";for(let o=0;o<e.length;o++){let n=e[o];if(this.options.extensions?.renderers?.[n.type]){let e=n,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(e.type)){r+=t||"";continue}}let i=n;switch(i.type){case"space":r+=this.renderer.space(i);continue;case"hr":r+=this.renderer.hr(i);continue;case"heading":r+=this.renderer.heading(i);continue;case"code":r+=this.renderer.code(i);continue;case"table":r+=this.renderer.table(i);continue;case"blockquote":r+=this.renderer.blockquote(i);continue;case"list":r+=this.renderer.list(i);continue;case"html":r+=this.renderer.html(i);continue;case"def":r+=this.renderer.def(i);continue;
6384case"paragraph":r+=this.renderer.paragraph(i);continue;case"text":{let n=i,s=this.renderer.text(n);for(;o+1<e.length&&"text"===e[o+1].type;)n=e[++o],s+="\n"+this.renderer.text(n);r+=t?this.renderer.paragraph({type:"paragraph",raw:s,text:s,tokens:[{type:"text",raw:s,text:s,escaped:!0}]}):s;continue}default:{let e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return r}parseInline(e,t=this.renderer){let r="";for(let o=0;o<e.length;o++){let n=e[o];if(this.options.extensions?.renderers?.[n.type]){let e=this.options.extensions.renderers[n.type].call({parser:this},n);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){r+=e||"";continue}}let i=n;switch(i.type){case"escape":case"text":r+=t.text(i);break;case"html":r+=t.html(i);break;case"link":r+=t.link(i);break;case"image":r+=t.image(i);break;case"strong":r+=t.strong(i);break;case"em":r+=t.em(i);break;case"codespan":r+=t.codespan(i);break;case"br":r+=t.br(i);break;case"del":r+=t.del(i);break;default:{let e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return r}},eo=class{options;block;constructor(e){this.options=e||sr}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?dt.lex:dt.lexInline}provideParser(){return this.block?ht.parse:ht.parseInline}},Gm=class{defaults=zs();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ht;Renderer=kn;TextRenderer=qs;Lexer=dt;Tokenizer=_n;Hooks=eo;constructor(...e){this.use(...e)}walkTokens(e,t){let r=[];for(let o of e)switch(r=r.concat(t.call(this,o)),o.type){case"table":{let e=o;for(let o of e.header)r=r.concat(this.walkTokens(o.tokens,t));for(let o of e.rows)for(let e of o)r=r.concat(this.walkTokens(e.tokens,t));break}case"list":{let e=o;r=r.concat(this.walkTokens(e.items,t));break}default:{let e=o;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(o=>{let n=e[o].flat(1/0);r=r.concat(this.walkTokens(n,t))}):e.tokens&&(r=r.concat(this.walkTokens(e.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let r={...e};if(r.async=this.defaults.async||r.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){let r=t.renderers[e.name];t.renderers[e.name]=r?function(...t){let o=e.renderer.apply(this,t);return!1===o&&(o=r.apply(this,t)),o}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");let r=t[e.level];r?r.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),r.extensions=t),e.renderer){let t=this.defaults.renderer||new kn(this.defaults);for(let r in e.renderer){if(!(r in t))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let o=r,n=e.renderer[o],i=t[o];t[o]=(...e)=>{let r=n.apply(t,e);return!1===r&&(r=i.apply(t,e)),r||""}}r.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new _n(this.defaults);for(let r in e.tokenizer){if(!(r in t))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let o=r,n=e.tokenizer[o],i=t[o];t[o]=(...e)=>{let r=n.apply(t,e);return!1===r&&(r=i.apply(t,e)),r}}r.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new eo;for(let r in e.hooks){if(!(r in t))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let o=r,n=e.hooks[o],i=t[o];eo.passThroughHooks.has(r)?t[o]=e=>{if(this.defaults.async&&eo.passThroughHooksRespectAsync.has(r))return Promise.resolve(n.call(t,e)).then(e=>i.call(t,e));let o=n.call(t,e);return i.call(t,o)}:t[o]=(...e)=>{let r=n.apply(t,e);return!1===r&&(r=i.apply(t,e)),r}}r.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,o=e.walkTokens;r.walkTokens=function(e){let r=[];return r.push(o.call(this,e)),t&&(r=r.concat(t.call(this,e))),r}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return dt.lex(e,t??this.defaults)}parser(e,t){return ht.parse(e,t??this.defaults)}parseMarkdown(e){return(t,r)=>{let o={...r},n={...this.defaults,...o},i=this.onError(!!n.silent,!!n.async);if(!0===this.defaults.async&&!1===o.async)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return i(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));n.hooks&&(n.hooks.options=n,n.hooks.block=e);let s=n.hooks?n.hooks.provideLexer():e?dt.lex:dt.lexInline,a=n.hooks?n.hooks.provideParser():e?ht.parse:ht.parseInline;if(n.async)return Promise.resolve(n.hooks?n.hooks.preprocess(t):t).then(e=>s(e,n)).then(e=>n.hooks?n.hooks.processAllTokens(e):e).then(e=>n.walkTokens?Promise.all(this.walkTokens(e,n.walkTokens)).then(()=>e):e).then(e=>a(e,n)).then(e=>n.hooks?n.hooks.postprocess(e):e).catch(i);try{n.hooks&&(t=n.hooks.preprocess(t));let e=s(t,n);n.hooks&&(e=n.hooks.processAllTokens(e)),n.walkTokens&&this.walkTokens(e,n.walkTokens);let r=a(e,n);return n.hooks&&(r=n.hooks.postprocess(r)),r}catch(e){return i(e)}}}onError(e,t){return r=>{if(r.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+Ke(r.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(r);throw r}}},Qt=new Gm;function F(e,t){return Qt.parse(e,t)}F.options=F.setOptions=function(e){return Qt.setOptions(e),F.defaults=Qt.defaults,Pc(F.defaults),F},F.getDefaults=zs,F.defaults=sr,F.use=function(...e){return Qt.use(...e),F.defaults=Qt.defaults,Pc(F.defaults),F},F.walkTokens=function(e,t){return Qt.walkTokens(e,t)},F.parseInline=Qt.parseInline,F.Parser=ht,F.parser=ht.parse,F.Renderer=kn,F.TextRenderer=qs,F.Lexer=dt,F.lexer=dt.lex,F.Tokenizer=_n,F.Hooks=eo,F.parse=F,F.options,F.setOptions,F.use,F.walkTokens,F.parseInline,ht.parse,dt.lex;var Bc=60,Vc=60*Bc,Hc=24*Vc,qm=7*Hc,Ir=1e3,xi=Bc*Ir,wl=Vc*Ir,Wm=Hc*Ir,Km=qm*Ir,Ws="millisecond",br="second",vr="minute",wr="hour",kt="day",Jo="week",Ve="month",Gc="quarter",Ct="year",yr="date",Ym="YYYY-MM-DDTHH:mm:ssZ",yl="Invalid Date",Zm=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Xm=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}
vendor: 4,564 bytes, line 6384
6384|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;const Qm={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||t[0])+"]"}};var Ji=function(e,t,r){var o=String(e);return!o||o.length>=t?e:""+Array(t+1-o.length).join(r)+e},Jm=function(e){var t=-e.utcOffset(),r=Math.abs(t),o=Math.floor(r/60),n=r%60;return(t<=0?"+":"-")+Ji(o,2,"0")+":"+Ji(n,2,"0")},e0=function e(t,r){if(t.date()<r.date())return-e(r,t);var o=12*(r.year()-t.year())+(r.month()-t.month()),n=t.clone().add(o,Ve),i=r-n<0,s=t.clone().add(o+(i?-1:1),Ve);return+(-(o+(r-n)/(i?n-s:s-n))||0)},t0=function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},r0=function(e){return{M:Ve,y:Ct,w:Jo,d:kt,D:yr,h:wr,m:vr,s:br,ms:Ws,Q:Gc}[e]||String(e||"").toLowerCase().replace(/s$/,"")},o0=function(e){return void 0===e};const n0={s:Ji,z:Jm,m:e0,a:t0,p:r0,u:o0};var io="en",Ht={};Ht[io]=Qm;var qc="$isDayjsObject",Ks=function(e){return e instanceof qn||!(!e||!e[qc])},Cn=function e(t,r,o){var n;if(!t)return io;if("string"==typeof t){var i=t.toLowerCase();Ht[i]&&(n=i),r&&(Ht[i]=r,n=i);var s=t.split("-");if(!n&&s.length>1)return e(s[0])}else{var a=t.name;Ht[a]=t,n=a}return!o&&n&&(io=n),n||!o&&io},Y=function(e,t){if(Ks(e))return e.clone();var r="object"==typeof t?t:{};return r.date=e,r.args=arguments,new qn(r)},i0=function(e,t){return Y(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})},j=n0;j.l=Cn,j.i=Ks,j.w=i0;var s0=function(e){var t=e.date,r=e.utc;if(null===t)return new Date(NaN);if(j.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var o=t.match(Zm);if(o){var n=o[2]-1||0,i=(o[7]||"0").substring(0,3);return r?new Date(Date.UTC(o[1],n,o[3]||1,o[4]||0,o[5]||0,o[6]||0,i)):new Date(o[1],n,o[3]||1,o[4]||0,o[5]||0,o[6]||0,i)}}return new Date(t)},qn=function(){function e(e){this.$L=Cn(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[qc]=!0}var t=e.prototype;return t.parse=function(e){this.$d=s0(e),this.init()},t.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},t.$utils=function(){return j},t.isValid=function(){return this.$d.toString()!==yl},t.isSame=function(e,t){var r=Y(e);return this.startOf(t)<=r&&r<=this.endOf(t)},t.isAfter=function(e,t){return Y(e)<this.startOf(t)},t.isBefore=function(e,t){return this.endOf(t)<Y(e)},t.$g=function(e,t,r){return j.u(e)?this[t]:this.set(r,e)},t.unix=function(){return Math.floor(this.valueOf()/1e3)},t.valueOf=function(){return this.$d.getTime()},t.startOf=function(e,t){var r=this,o=!!j.u(t)||t,n=j.p(e),i=function(e,t){var n=j.w(r.$u?Date.UTC(r.$y,t,e):new Date(r.$y,t,e),r);return o?n:n.endOf(kt)},s=function(e,t){return j.w(r.toDate()[e].apply(r.toDate("s"),(o?[0,0,0,0]:[23,59,59,999]).slice(t)),r)},a=this.$W,l=this.$M,c=this.$D,d="set"+(this.$u?"UTC":"");switch(n){case Ct:return o?i(1,0):i(31,11);case Ve:return o?i(1,l):i(0,l+1);case Jo:var h=this.$locale().weekStart||0,p=(a<h?a+7:a)-h;return i(o?c-p:c+(6-p),l);case kt:case yr:return s(d+"Hours",0);case wr:return s(d+"Minutes",1);case vr:return s(d+"Seconds",2);case br:return s(d+"Milliseconds",3);default:return this.clone()}},t.endOf=function(e){return this.startOf(e,!1)},t.$set=function(e,t){var r,o=j.p(e),n="set"+(this.$u?"UTC":""),i=(r={},r[kt]=n+"Date",r[yr]=n+"Date",r[Ve]=n+"Month",r[Ct]=n+"FullYear",r[wr]=n+"Hours",r[vr]=n+"Minutes",r[br]=n+"Seconds",r[Ws]=n+"Milliseconds",r)[o],s=o===kt?this.$D+(t-this.$W):t;if(o===Ve||o===Ct){var a=this.clone().set(yr,1);a.$d[i](s),a.init(),this.$d=a.set(yr,Math.min(this.$D,a.daysInMonth())).$d}else i&&this.$d[i](s);return this.init(),this},t.set=function(e,t){return this.clone().$set(e,t)},t.get=function(e){return this[j.p(e)]()},t.add=function(e,t){var r,o=this;e=Number(e);var n=j.p(t),i=function(t){var r=Y(o);return j.w(r.date(r.date()+Math.round(t*e)),o)};if(n===Ve)return this.set(Ve,this.$M+e);if(n===Ct)return this.set(Ct,this.$y+e);if(n===kt)return i(1);if(n===Jo)return i(7);var s=(r={},r[vr]=xi,r[wr]=wl,r[br]=Ir,r)[n]||1,a=this.$d.getTime()+e*s;return j.w(a,this)},t.subtract=function(e,t){return this.add(-1*e,t)},t.format=function(e){var t=this,r=this.$locale();if(!this.isValid())return r.invalidDate||yl;var o=e||Ym,n=j.z(this),i=this.$H,s=this.$m,a=this.$M,l=r.weekdays,c=r.months,d=r.meri
6384diem,h=function(e,r,n,i){return e&&(e[r]||e(t,o))||n[r].slice(0,i)},p=function(e){return j.s(i%12||12,e,"0")},u=d||function(e,t,r){var o=e<12?"AM":"PM";return r?o.toLowerCase():o};return o.replace(Xm,function(e,o){return o||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return j.s(t.$y,4,"0");case"M":return a+1;case"MM":return j.s(a+1,2,"0");case"MMM":return h(r.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return t.$D;case"DD":return j.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return h(r.weekdaysMin,t.$W,l,2);case"ddd":return h(r.weekdaysShort,t.$W,l,3);case"dddd":return l[t.$W];case"H":return String(i);case"HH":return j.s(i,2,"0");case"h":return p(1);case"hh":return p(2);case"a":return u(i,s,!0);case"A":return u(i,s,!1);case"m":return String(s);case"mm":return j.s(s,2,"0");case"s":return String(t.$s);case"ss":return j.s(t.$s,2,"0");case"SSS":return j.s(t.$ms,3,"0");case"Z":return n}return null}(e)||n.replace(":","")})},t.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},t.diff=function(e,t,r){var o,n=this,i=j.p(t),s=Y(e),a=(s.utcOffset()-this.utcOffset())*xi,l=this-s,c=function(){return j.m(n,s)};switch(i){case Ct:o=c()/12;break;case Ve:o=c();break;case Gc:o=c()/3;break;case Jo:o=(l-a)/Km;break;case kt:o=(l-a)/Wm;break;case wr:o=l/wl;break;case vr:o=l/xi;break;case br:o=l/Ir;break;default:o=l}return r?o:j.a(o)},t.daysInMonth=function(){return this.endOf(Ve).$D},t.$locale=function(){return Ht[this.$L]},t.locale=function(e,t){if(!e)return this.$L;var r=this.clone(),o=Cn(e,t,!0);return o&&(r.$L=o),r},t.clone=function(){return j.w(this.$d,this)},t.toDate=function(){return new Date(this.valueOf())},t.toJSON=function(){return this.isValid()?this.toISOString():null},t.toISOString=function(){return this.$d.toISOString()},t.toString=function(){return this.$d.toUTCString()},e}(),Wc=qn.prototype;Y.prototype=Wc,[["$ms",Ws],["$s",br],["$m",vr],["$H",wr],["$W",kt],["$M",Ve],["$y",Ct],["$D",yr]].forEach(function(e){Wc[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),Y.extend=function(e,t){return e.$i||(e(t,qn,Y),e.$i=!0),Y},Y.locale=Cn,Y.isDayjs=Ks,Y.unix=function(e){return Y(1e3*e)},Y.en=Ht[io],Y.Ls=Ht,Y.p={};var a0=Object.defineProperty,l0=Object.getOwnPropertyDescriptor,Po=(e,t,r,o)=>{for(var n,i=o>1?void 0:o?l0(t,r):t,s=e.length-1;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&a0(t,r,i),i};let Jt=class extends S{constructor(){super(...arguments),this._newsTask=new tr(this,{args:()=>[this.url,this.languageCode,this.countryCode,this.appVersion],task:async([e,t,r,o])=>{if(!e)throw new Error("No data URL provided.");const n=await fetch(e);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const i=this.getLang(t),s=this.getFullLang(t),a=await n.json(),l=this.processNewsData(a,{lang:i,fullLang:s}),c=this.filterNews(l,{lang:i,country:r,appVersion:o});return Promise.all(c.map(async e=>({...e,parsedMessage:e.message?await F.parse(e.message):""})))}})}getLang(e){return e||navigator.language?.split("-")[0]||"en"}getFullLang(e){return e||navigator.language||"en"}processNewsData(e,{lang:t,fullLang:r}){const o=[],n=e.news||{},i=e.tagline_feed?.default?.news||[];if(!e.news)return console.warn("[NewsFeed] 'news' object missing in raw data."),[];if(!e.tagline_feed?.default?.news)return console.warn("[NewsFeed] 'tagline_feed.default.news' array missing in raw data."),[];for(const e of i){const i=e.id,s=n[i];if(!s){console.warn(`[NewsFeed] Details not found for news ID: ${i}`);continue}let a=s.translations?.default||{};const l=r.replace("-","_");s.translations&&s.translations[l]?a=s.translations[l]:s.translations&&s.translations[t]&&(a=s.translations[t]);const c=s.translations?.default||{};o.push({id:i,title:a.title||c.title||"",message:a.message||c.message||"",url:a.url||s.url||"",icon_url:a.image?.url||c.image?.url||"",start_date:s.start_date,end_date:s.end_date,languages:s.languages,countries:s.countries,min_app_version:s.min_app_version,max_app_version:s.max_app_version,enabled:!1!==s.enabled,message_type:(s.message_type||"info").toLowerCase()})}return o}versionCompare(e,t){const r=(e||"").split(/[.-]/),o=(t||"").split(/[.-]/);for(let e=0;e<Math.max(r.length,o.length);e++){const t=r[e]||"0",n=o[e]||"0",i=parseInt(t,10),s=parseInt(n,10);if(isNaN(i)||isNaN(s)){if(t>n)return 1;if(t<n)return-1}else{if(i>s)return 1;if(i<s)return-1}}return 0}filterNews(e,{lang:t,country:r,appVersion:o}){const n=Y();return e.filter(e=>{if(!1===e.enabled)return!1;const i=Y(e.start_date).isValid()?Y(e.start_date):null,s=Y(e.end_date).isValid()?Y(e.end_date):null;return!(i&&n.isBefore(i)||s&&n.isAfter(s)||e.languages&&e.languages.length>0&&!e.languages.some(e=>t.toLowerCase()===e.toLowerCase()||t.startsWith(e.toLowerCase()+"-"))||r&&e.countries&&e.countries.length>0&&!e.countries.some(e=>r.toLowerCase()===e.toLowerCase())||o&&(e.min_app_version&&this.versionCompare(o,e.min_app_version)<0||e.max_app_version&&this.versionCompare(o,e.max_app_version)>0))})}
6384_renderNewsItem(e){const t=e.url&&""!==e.url.trim(),r=`placeholder-${e.id||Math.random().toString(36).substring(7)}`,o=e.id?e.id.substring(0,3):"NWS",n=e.icon_url?c` 6385 <img 6386 src=${e.icon_url} 6387 alt="" 6388 class="icon" 6389 @error=${e=>{e.target.style.display="none";this.shadowRoot.querySelector(`#${r}`).style.display="flex"}} 6390 /> 6391 <div id=${r} class="placeholder-icon" style="display: none;"> 6392 ${o} 6393 </div> 6394 `:c`<div id=${r} class="placeholder-icon">${o}</div>`,i=c` 6395 <div class="content"> 6396 ${e.title?c`<h3 class="title">${e.title}</h3>`:""} 6397 <p class="message"> 6398 ${pt(e.parsedMessage)||e.message||"No message content."} 6399 </p> 6400 </div> 6401 `;return t?c` 6402 <a 6403 href=${e.url??""} 6404 target="_blank" 6405 rel="noopener noreferrer" 6406 class="news-item-wrapper" 6407 data-news-id=${e.id} 6408 > 6409 <div class="news-item ${e.message_type}">${n} ${i}</div> 6410 </a> 6411 `:c` 6412 <div class="news-item-wrapper" data-news-id=${e.id}> 6413 <div class="news-item ${e.message_type}">${n} ${i}</div> 6414 </div> 6415 `}render(){return this._newsTask.render({pending:()=>c`<div class="loading-container">Loading news...</div>`,error:e=>c`<div class="error-container">${e}</div>`,complete:e=>c` 6416 <div class="news-container"> 6417 ${e.length>0?e.map(e=>this._renderNewsItem(e)):c`<div class="no-news">No relevant news available right now.</div>`} 6418 </div> 6419 `})}};Jt.styles=$` 6420 :host { 6421 display: block; 6422 font-family: "Inter", sans-serif; 6423 width: 100%; 6424 margin: 1rem auto; 6425 border: 1px solid #e2e8f0; 6426 border-radius: 0.5rem; 6427 box-shadow: 6428 0 1px 3px 0 rgba(0, 0, 0, 0.1), 6429 0 1px 2px 0 rgba(0, 0, 0, 0.06); 6430 overflow: hidden; 6431 background: #fff; 6432 } 6433 6434 .loading-container { 6435 padding: 1rem; 6436 text-align: center; 6437 color: #6b7280; 6438 } 6439 6440 .error-container { 6441 padding: 1rem; 6442 text-align: center; 6443 color: #ef4444; 6444 background-color: #fee2e2; 6445 border-radius: 0.375rem; 6446 } 6447 6448 .news-container { 6449 border-top: 1px solid #e5e7eb; 6450 } 6451 6452 .news-item-wrapper { 6453 transition: background-color 0.2s ease-in-out; 6454 display: block; 6455 text-decoration: none; 6456 color: inherit; 6457 border-bottom: 1px solid #e5e7eb; 6458 } 6459 6460 .news-item-wrapper:last-child { 6461 border-bottom: none; 6462 } 6463 6464 .news-item-wrapper:hover { 6465 background-color: #f9fafb; 6466 } 6467 6468 .news-item { 6469 display: flex; 6470 align-items: flex-start; 6471 padding: 1rem; 6472 } 6473 6474 .icon { 6475 width: 2.5rem; 6476 height: 2.5rem; 6477 object-fit: contain; 6478 margin-right: 0.75rem; 6479 border-radius: 0.375rem; 6480 flex-shrink: 0; 6481 } 6482 6483 .placeholder-icon { 6484 width: 2.5rem; 6485 height: 2.5rem; 6486 background-color: #e5e7eb; 6487 border-radius: 0.375rem; 6488 margin-right: 0.75rem; 6489 display: flex; 6490 align-items: center; 6491 justify-content: center; 6492 color: #9ca3af; 6493 font-size: 0.75rem; 6494 flex-shrink: 0; 6495 text-transform: uppercase; 6496 } 6497 6498 .content { 6499 flex: 1; 6500 min-width: 0; 6501 } 6502 6503 .title { 6504 font-weight: 600; 6505 color: #1f2937; 6506 margin-bottom: 0.25rem; 6507 margin-top: 0; 6508 } 6509 6510 .message { 6511 font-size: 0.875rem; 6512 color: #4b5563; 6513 line-height: 1.4; 6514 margin: 0; 6515 } 6516 6517 .message strong, 6518 .message b { 6519 font-weight: 600; 6520 color: #1f2937; 6521 } 6522 6523 /* Message Type Styles */ 6524 .info { 6525 border-left: 4px solid #3b82f6; /* Blue */ 6526 } 6527 6528 .warning { 6529 border-left: 4px solid #f59e0b; /* Amber */ 6530 } 6531 6532 .error { 6533 border-left: 4px solid #ef4444; /* Red */ 6534 } 6535 6536 .no-news { 6537 padding: 1rem; 6538 text-align: center; 6539 color: #6b7280; 6540 } 6541 6542 /* --- Dark Mode --- */ 6543 @media (prefers-color-scheme: dark) { 6544 :host { 6545 background: #18181b; 6546 border-color: #27272a; 6547 box-shadow: 6548 0 1px 3px 0 rgba(0, 0, 0, 0.4), 6549 0 1px 2px 0 rgba(0, 0, 0, 0.3); 6550 } 6551 .loading-container, 6552 .no-news { 6553 color: #a1a1aa; 6554 } 6555 .error-container { 6556 color: #f87171; 6557 background-color: #7f1d1d; 6558 } 6559 .news-container { 6560 border-top: 1px solid #27272a; 6561 } 6562 .news-item-wrapper { 6563 border-bottom: 1px solid #27272a; 6564 } 6565 .news-item-wrapper:hover { 6566 background-color: #27272a; 6567 } 6568 .news-item { 6569 background: transparent; 6570 } 6571 .icon { 6572 background: white; 6573 } 6574 .placeholder-icon { 6575 background-color: #27272a; 6576 color: #a1a1aa; 6577 }
6578 .title { 6579 color: #fafafa; 6580 } 6581 .message { 6582 color: #d4d4d8; 6583 } 6584 .message strong, 6585 .message b { 6586 color: #fafafa; 6587 } 6588 .info { 6589 border-left: 4px solid #2563eb; 6590 } 6591 .warning { 6592 border-left: 4px solid #fbbf24; 6593 } 6594 .error { 6595 border-left: 4px solid #f87171; 6596 } 6597 } 6598 `,Po([g({attribute:"url"})],Jt.prototype,"url",2),Po([g({attribute:"lang"})],Jt.prototype,"languageCode",2),Po([g({attribute:"country"})],Jt.prototype,"countryCode",2),Po([g({attribute:"app-version"})],Jt.prototype,"appVersion",2),Jt=Po([E("news-feed")],Jt),window?window.OFF_WEBCOMPONENTS_VERSION="1.16.0":globalThis&&(globalThis.OFF_WEBCOMPONENTS_VERSION="1.16.0");export{ze as AutocompleteInput,tt as BarcodeScanner,yn as DeleteModal,wo as DonationBanner,qi as DownloadAppQrCode,Ge as FolksonomyEditor,ae as FolksonomyProperties,ne as FolksonomyPropertyProducts,et as KnowledgePanelsComponent,ft as MobileBadges,Jt as NewsFeed,Tt as OffWebcomponentsConfiguration,qe as ProductCard,Xt as RobotoffContributionMessage,It as RobotoffCrops,gt as RobotoffIngredientSpellcheck,Wt as RobotoffNutrientExtraction,Qe as RobotoffQuestion,h0 as getLocale,Ld as setLocale}; 6599//# sourceMappingURL=off-webcomponents.bundled.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.