1import{store as o,SHEET_ID_PREFIX as p,FAVORITES_UPDATED_EVENT as w}from"woody_addon_favorites_tools";async function y(n){import("woody_favorites_analytics").then(e=>e.init(o)).catch(e=>console.warn("[FAVORITES] suivi indisponible",e));const u=document.querySelector("[data-wfav-dialogs]");let l=null;if(u)try{const e=await import("woody_favorites_dialog");l=e.init(u)?e:null}catch(e){console.warn("[FAVORITES] dialogue indisponible",e)}const d=document.querySelector("[data-wfav-global-live]");function v(e,t){!d||!t||(d.textContent="",window.setTimeout(()=>{d.textContent=t},60))}function c(e,t="remove"){const i=t==="add"?e.dataset.msgAdded:e.dataset.msgRemoved,r=e.dataset.wfavTitle||"";v(e,i?i.replace("%s",r):"")}function m(e,t){const a=t?e.dataset.labelRemove:e.dataset.labelAdd;a&&e.setAttribute("aria-label",a)}const s=globals.sheet_id!==void 0?p+globals.sheet_id:globals.post_id;function S(){const e=globals.woody_options_pages?globals.woody_options_pages.favorites_url:null;return e==null||e===""?[]:(Array.isArray(e)?e:typeof e=="object"?Object.values(e):[e]).map(a=>String(a))}function f(){if(s!==void 0){const e=o.isFavorite(s);n.forEach(t=>{t.closest(".card")===null&&g(t,e)})}document.querySelectorAll(".card[data-postid], .card[data-sheetid]").forEach(e=>{const t=e.querySelector(".button-add-to-favs");if(t===null)return;const a=o.cardStorageId(e);g(t,!!a&&o.isFavorite(a))})}function g(e,t){e.classList.toggle("is-true",t),e.classList.toggle("is-false",!t),e.setAttribute("aria-pressed",t),m(e,t)}document.addEventListener(w,f),s!==void 0&&(!isNaN(s)||String(s).match(new RegExp(`^${p}[0-9]+$`))!==null)&&!S().includes(String(s))&&globals.page_type!=="front_page"&&o.visit(s,{source:"user"}),f(),n.length>0&&n.forEach(e=>{e.addEventListener("click",async function(t){t.preventDefault();const a=e.closest(".card"),i=a!==null?o.cardStorageId(a):s;if(!i)return;if(o.isFavorite(i)){c(e),a!==null?o.remove(i,{source:"user"}):o.unfavorite(i,{source:"user"});return}if(!l){c(e,"add"),o.add(i,{source:"user"});return}const r=await l.openAdd({title:e.dataset.wfavTitle||""});r.confirmed&&(c(e,"add"),o.add(i,{source:"user",groups:r.groups}))})})}export{y as init};
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.