import{a1 as n,p as c,d as u,i as g,u as p}from"../chunks/Dpn8_Hnn.mjs";import{u as m,f}from"../chunks/DTHo7gyJ.mjs";import{q as h,r as I}from"../chunks/CyJ0Hgdp.mjs";import{e as O,s as b,n as y,t as k,h as P,I as _}from"../chunks/DeJ6PESe.mjs";import"../chunks/E-vkuI0X.mjs";import{i as v}from"../chunks/DueIe5zz.mjs";import{p as T}from"../chunks/CUWjGq9Z.mjs";const N=async function(e,t){const{clozes:a,noteCount:i}=O(t);if(i===0)return;const d=n(y),l=n(k);let o=d[0].textareaValue,s=d[1].textareaValue;o=o?`<div>${o}</div>`:"",s=s?`<div>${s}</div>`:"",e.kind=="edit"?(await m({noteId:e.noteId,occlusions:a,header:o,backExtra:s,tags:l})).note&&r(e.noteId,i):(await f({notetypeId:BigInt(e.notetypeId),imagePath:e.imagePath,occlusions:a,header:o,backExtra:s,tags:l}),r(null,i))},r=(e,t)=>{const a=e?h({count:t}):I({count:t});b(a,"success")};async function w(){N(globalThis.anki.imageOcclusion.mode,n(P))}const x=(async({params:e})=>{let t;return/^\d+/.test(e.imagePathOrNoteId)?t={kind:"edit",noteId:BigInt(e.imagePathOrNoteId)}:t={kind:"add",imagePath:e.imagePathOrNoteId,notetypeId:0n},globalThis.anki=globalThis.anki||{},globalThis.anki.imageOcclusion={mode:t,save:w},{mode:t}}),V=Object.freeze(Object.defineProperty({__proto__:null,load:x},Symbol.toStringTag,{value:"Module"}));function q(e,t){c(t,!1);let a=T(t,"data",8);v(),_(e,{get mode(){return g(a()),p(()=>a().mode)}}),u()}export{q as component,V as universal};
