System.register(["./index-legacy-BGUFxny_.js"],function(e,t){"use strict";var r,i,n,a,o,s,c,l,h,y,f,d,u,w,p;return{setters:[e=>{r=e.j,i=e.B,n=e.e3,a=e.a4,o=e.au,s=e.N,c=e.ax,l=e.aZ,h=e.D,y=e.ac,f=e.S,d=e.aa,u=e.o,w=e.co,p=e.eb}],execute:function(){var t=c("<div id=heic-container><canvas>");e("default",()=>{const e=u();r();const[c,g]=i(!0),[m,v]=i(!1),{libHeifPath:P}=n();let b,j,x,C=a.objs.filter(e=>/\.(heic|heif|avif|vvc|avc|jpeg|jpg)$/i.test(e.name));0===C.length&&(C=[a.obj]),o(()=>{$()}),s(()=>{b&&j&&(j=null),b=null});const $=async()=>{g(!0),v(!1);try{window.libheif||await _(`${P()}/libheif.js`,"libheif-script");const e=await B(`${P()}/libheif.wasm`);b=window.libheif({wasmBinary:e}),j=new b.HeifDecoder,await D(a.raw_url)}catch(e){console.error("HEIC初始化失败:",e),v(!0),g(!1)}},_=(e,t)=>new Promise((r,i)=>{const n=document.createElement("script");n.src=e,n.id=t,n.onload=()=>r(),n.onerror=()=>i(`脚本加载失败: ${e}`),document.head.appendChild(n)}),B=async e=>{const t=await fetch(e);if(!t.ok)throw`WASM加载失败: ${e}`;return await t.arrayBuffer()},D=async e=>{try{g(!0),v(!1);const t=await fetch(e);if(!t.ok)throw"文件获取失败";const r=await t.arrayBuffer(),i=j.decode(r);if(!i||0===i.length)throw"没有可解码的图像";const n=i[0];await H(n),g(!1)}catch(t){console.error("HEIC解码失败:",t),v(!0),g(!1)}},H=e=>new Promise(t=>{if(!x)return t();const r=e.get_width(),i=e.get_height();x.width=r,x.height=i;const n=new ImageData(r,i);e.display(n,e=>{if(!e||!x)return t();const r=x.getContext("2d");if(!r)return t();r.putImageData(e,0,0),t()})});return I=t(),k=I.firstChild,I.style.setProperty("position","relative"),I.style.setProperty("width","100%"),I.style.setProperty("height","75vh"),I.style.setProperty("display","flex"),I.style.setProperty("justify-content","center"),I.style.setProperty("align-items","center"),I.style.setProperty("overflow","hidden"),"function"==typeof x?p(x,k):x=k,k.style.setProperty("max-width","100%"),k.style.setProperty("max-height","100%"),k.style.setProperty("object-fit","contain"),l(I,h(f,{get when(){return c()},get children(){return h(y,{})}}),null),l(I,h(f,{get when(){return m()},get children(){return h(d,{get msg(){return e("preview.failed_load_heic")},h:"75vh"})}}),null),w(e=>null!=(e=c()||m()?"none":"block")?k.style.setProperty("display",e):k.style.removeProperty("display")),I;var I,k})}}});
