Files
archy/demo/aiui/assets/index-8cIrvc8q.js
T

80 lines
366 KiB
JavaScript
Raw Normal View History

2026-08-12 10:55:49 +00:00
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatPage-AitDGZKH.js","assets/chat-BVoaeFpp.js","assets/ChatWindow.vue_vue_type_script_setup_true_lang-zPFvWywX.js","assets/useNostr-XONW-p_l.js","assets/ChatWindow-CHiy55Bk.css","assets/FilmGrid.vue_vue_type_script_setup_true_lang-Dj0SEfcW.js","assets/useContentImages-7wLVntsF.js","assets/SongGrid.vue_vue_type_script_setup_true_lang-IvAOIQYW.js","assets/FilmDetail.vue_vue_type_script_setup_true_lang-BhKlPG3Y.js","assets/SongDetail.vue_vue_type_script_setup_true_lang-B3om3Z8v.js","assets/ChatPage-B49DA8RU.css","assets/GuidePage-DncbNAAY.js","assets/GuidePage-CXT-xcyj.css","assets/WidgetDemoPage-Mol6efr5.js","assets/WidgetDemoPage-BSWX2CxO.css","assets/ConversationViewerPage-PTutY4Lq.js"])))=>i.map(i=>d[i]);
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=n(i);fetch(i.href,r)}})();const np="modulepreload",sp=function(e){return"/aiui/"+e},ac={},wn=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){let l=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=o?.nonce||o?.getAttribute("nonce");i=l(n.map(c=>{if(c=sp(c),c in ac)return;ac[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":np,u||(f.as="script"),f.crossOrigin="",f.href=c,a&&f.setAttribute("nonce",a),document.head.appendChild(f),u)return new Promise((h,b)=>{f.addEventListener("load",h),f.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return t().catch(r)})};function xl(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const $e={},Ks=[],kn=()=>{},vf=()=>!1,Eo=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Tl=e=>e.startsWith("onUpdate:"),lt=Object.assign,Al=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},ip=Object.prototype.hasOwnProperty,Re=(e,t)=>ip.call(e,t),oe=Array.isArray,Gs=e=>gr(e)==="[object Map]",oi=e=>gr(e)==="[object Set]",lc=e=>gr(e)==="[object Date]",he=e=>typeof e=="function",Ye=e=>typeof e=="string",on=e=>typeof e=="symbol",Pe=e=>e!==null&&typeof e=="object",wf=e=>(Pe(e)||he(e))&&he(e.then)&&he(e.catch),_f=Object.prototype.toString,gr=e=>_f.call(e),rp=e=>gr(e).slice(8,-1),kf=e=>gr(e)==="[object Object]",So=e=>Ye(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,ji=xl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Co=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},op=/-\w/g,Xt=Co(e=>e.replace(op,t=>t.slice(1).toUpperCase())),ap=/\B([A-Z])/g,ps=Co(e=>e.replace(ap,"-$1").toLowerCase()),Po=Co(e=>e.charAt(0).toUpperCase()+e.slice(1)),ea=Co(e=>e?`on${Po(e)}`:""),cs=(e,t)=>!Object.is(e,t),Kr=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},xf=(e,t,n,s=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:n})},Io=e=>{const t=parseFloat(e);return isNaN(t)?e:t},lp=e=>{const t=Ye(e)?Number(e):NaN;return isNaN(t)?e:t};let cc;const Ro=()=>cc||(cc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function us(e){if(oe(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],i=Ye(s)?dp(s):us(s);if(i)for(const r in i)t[r]=i[r]}return t}else if(Ye(e)||Pe(e))return e}const cp=/;(?![^(]*\))/g,up=/:([^]+)/,fp=/\/\*[^]*?\*\//g;function dp(e){const t={};return e.replace(fp,"").split(cp).forEach(n=>{if(n){const s=n.split(up);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function st(e){let t="";if(Ye(e))t=e;else if(oe(e))for(let n=0;n<e.length;n++){const s=st(e[n]);s&&(t+=s+" ")}else if(Pe(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const hp="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",pp=xl(hp);functi
`||e[t]==="\r");)t+=1,n-=1;const s=e.lastIndexOf(`
`,t-1),i=s===-1?0:s+1,r=e.indexOf(`
`,t+n),o=r===-1?e.length:r;let a=e.slice(i,o);a=a.replace(e.slice(t,t+n),""),a=a.replace(/\[\[(?:film|song|podcast)(?:_ext)?:[^\]]*\]\]/g,""),a=a.replace(/^\s*[-*•]\s*/,"").replace(/^\s*\d+\.\s*/,""),a=a.replace(/\*\*[^*]+\*\*\s*[-–—:]\s*/,"").replace(/\*\*[^*]+\*\*\s*/,""),a=a.replace(/\*\*/g,"").replace(/\*/g,""),a=a.replace(/\(\d{4}\)\s*/g,""),a=a.replace(/^[\s\-–—:,]+/,"").replace(/[\s\-–—:,]+$/,"");const l=a.trim().slice(0,300);return l.length>=10?l:""}function wo(e){return e.toLowerCase().trim().replace(/\/$/,"")}const fb=2e3;function Au(e){return e.replace(/\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/https?:\/\/\S+/g,"").replace(/\uFE0F/g,"").replace(new RegExp("(?:^|(?<=\\s))[\\p{Emoji_Presentation}\\p{Extended_Pictographic}]+\\s*","gu"),"").replace(/\*\*/g,"").replace(/\*([^*\n]+)\*/g,"$1").replace(/---+/g,"").replace(/^#+\s*/gm,"").replace(/\|/g,", ").replace(/,\s*,+/g,",").replace(/(^|\n)\s*,\s*/g,"$1").replace(/\s*,\s*($|\n)/g,"$1")}function dn(e,t,n,s,i){const r=Au(t).replace(/\s+/g," ").trim().slice(0,150);let o=Au(n).replace(/\n{3,}/g,`
`).trim().slice(0,fb);if(r.length<2||o.length<15)return;const a=r.toLowerCase(),l=o.toLowerCase();if(a.length>=10&&l.startsWith(a.slice(0,Math.min(a.length,40)))&&(o=o.slice(r.length).replace(/^[\s.,:;—–-]+/,"").trim(),o.length<15))return;const c=`${r.slice(0,50)}`;if(s.has(c))return;s.add(c);const u=/!\[[^\]]*\]\((https?:\/\/[^)]+)\)/.exec(n)?.[1],d=u?(()=>{try{const f=new URL(u.trim());return/^https?:$/i.test(f.protocol)?f.href:void 0}catch{return}})():void 0;e.push({title:r,content:o,url:lb(n),author:cb(n),imageUrl:d,group:i})}function Bs(e){return e.replace(/\[\[(?:podcast|film|song|book|tvshow|podcast_ext|film_ext|song_ext|book_ext|tv_ext|place_ext|recipe_ext|event_ext):[^\]]*\]\]/g,"").replace(/^\s*\n---\s*\n?/g,"").replace(/\n---\s*$/g,"").replace(/\n{3,}/g,`
`).trim()}function Eu(e){const t=[],n=new Set,s=e.replace(/\n+(?:Sources|References|Links):?\s*\n[\s\S]*$/i,"").replace(/\n+\*{0,2}For deeper[^:]*:[\s\S]*$/im,""),i=[],r=/^#{2,3}\s+(.+)$/gm;let o;for(;(o=r.exec(s))!==null;){const h=o[1].trim().replace(/[\p{Emoji_Presentation}\p{Extended_Pictographic}]\uFE0F?\s*/gu,"").replace(/^[#*_\s-]+/,"").trim();h.length>1&&i.push({title:h,start:o.index,contentStart:o.index+o[0].length})}for(let f=0;f<i.length;f++){const h=i[f],b=f+1<i.length?i[f+1].start:s.length,g=Bs(s.slice(h.contentStart,b));if(g.length<20)continue;const E=g.split(/\n\s*[-•]\s+/).map(x=>x.replace(/^[-•]\s*/,"").trim()).filter(x=>x.length>10);if(E.length>=2)for(const x of E){const y=Bs(x);if(y.length<15)continue;const k=/^\*\*([^*]+)\*\*\s*[:\u2014\u2013]\s*(.+)/s.exec(y);if(k)dn(t,k[1].trim(),k[2].trim(),n,h.title);else{const w=/^([^.!?]{10,80}[.!?])/.exec(y),C=w?w[1]:y.slice(0,60);dn(t,C,y,n,h.title)}}else dn(t,h.title,g,n)}const a=/\*\*([^*]+(?:camp| side| view)[^*]*)\*\*[🟠🔴🟢]?\s*\n([\s\S]+?)(?=\n\*\*[^*]+(?:camp| side)[^*]*\*\*|\n#{2,3}\s|\n\nThis is|\n\nFor deeper|$)/gimu;for(;(o=a.exec(s))!==null;){const f=o[1].trim(),h=Bs(o[2]);h.length>15&&dn(t,f,h,n)}const l=i.length>0?i[0].start:-1,c=l>0?l:s.indexOf(`
---
`);if(c>0){const f=s.slice(0,c).trim().replace(/^[#*_\s-]+/gm,"").trim();f.length>30&&!n.has("Summary")&&dn(t,"Summary",f,n)}if(t.length===0){const f=/(?:^|\n)\s*\*\*([^*]+?)\*\*\s*:?\s*(?:\n|$)/g,h=[];for(;(o=f.exec(s))!==null;){const x=o[1].trim(),y=s.slice(Math.max(0,o.index-10),o.index);/\d+\.\s*$/.test(y)||/[-•]\s*$/.test(y)||x.length>2&&x.length<100&&h.push({title:x,start:o.index,end:o.index+o[0].length})}const b=/(?:^|\n)\s*\d+\.\s*\*\*([^*]+)\*\*\s*[-–—:]+\s*/g,g=[];for(;(o=b.exec(s))!==null;){const x=o[1].trim();x.length>1&&g.push({title:x,start:o.index,contentStart:o.index+o[0].length})}let E;if(g.length>0&&h.length>0){const x=g[0].start,y=h.filter(k=>k.end<=x).pop();y&&(E=y.title)}for(let x=0;x<g.length;x++){const y=g[x],k=x+1<g.length?g[x+1].start:s.length,w=Bs(s.slice(y.contentStart,k));w.length>=15&&dn(t,y.title,w,n,E)}if(t.length===0){const x=/(?:^|\n)\s*[-•]\s*\*\*([^*]+)\*\*\s*[-–—:]+\s*/g,y=[];for(;(o=x.exec(s))!==null;){const k=o[1].trim();k.length>1&&y.push({title:k,start:o.index,contentStart:o.index+o[0].length})}for(let k=0;k<y.length;k++){const w=y[k],C=k+1<y.length?y[k+1].start:s.length,N=Bs(s.slice(w.contentStart,C));N.length>=15&&dn(t,w.title,N,n)}}if(t.length===0){const x=/(?:^|\n)\s*\*\*([^*]{3,60})\*\*\s*[-–—:]+\s*([\s\S]*?)(?=\n\s*\*\*[^*]{3,60}\*\*\s*[-–—:]|\n{2,}\*\*[^*]+\*\*\s*:|\s*$)/g;for(;(o=x.exec(s))!==null;){const y=o[1].trim(),k=Bs(o[2].trim());y.length>2&&k.length>=15&&dn(t,y,k,n)}}if(t.length>0){const x=g.length>0?g[0].start:s.length,y=h.length>0&&h[0].start<x?h[0].start:x,k=Math.min(x,y);if(k>30){const w=s.slice(0,k).replace(/\*\*/g,"").replace(/^[#*_\s-]+/gm,"").trim();w.length>30&&!n.has("Summary")&&dn(t,"Summary",w,n)}}}const u=/(This is being called[^.]+\.[^"]*"[^"]+"[^.]*\.)/i.exec(s);u&&!n.has("Key")&&dn(t,"Key takeaway",u[1].trim(),n);const d=["Summary","Key takeaway"];return t.sort((f,h)=>{const b=d.indexOf(f.title),g=d.indexOf(h.title);return b>=0&&g>=0?b-g:b>=0?-1:g>=0?1:0}),t}function db(e){return ub(e)}function Su(e){const t=[],n=new Set,s=/\*\*([^*]+)\*\*\s*\(([a-zA-Z0-9][-a-zA-Z0-9.]*\.[a-zA-Z]{2,})\)/g;let i;for(;(i=s.exec(e))!==null;){const r=i[1].trim().slice(0,500),o=i[2].trim();if(r.length<2)continue;const a=/^https?:\/\//i.test(o)?o:`https://${o}`,l=wo(a);n.has(l)||(n.add(l),t.push({title:r,url:a,content:void 0}))}return t}function Cu(e){const t=[],n=new Set;let s;const i=new RegExp(ob.source,"g");for(;(s=i.exec(e))!==null;){const r=s[1].trim().slice(0,500),o=s[2].trim();if(r.length<2||o.length<10||!ab.test(o))continue;try{new URL(o)}catch{continue}const a=o.toLowerCase().replace(/\/$/,"");n.has(a)||(n.add(a),t.push({title:r,url:o,content:void 0}))}return t}function js(e,t){const n=new Map;for(const s of e)n.set(wo(s.url),s);for(const s of t){const i=wo(s.url);n.has(i)||n.set(i,s)}return[...n.values()]}function hb(e){return e.startsWith("f")?e:`f${e}`}function Vo(e){const t=[];let n;const s=new RegExp(th.source,"gi");for(;(n=s.exec(e))!==null;){const i=hb(n[1]);t.includes(i)||t.push(i)}return t}function pb(e){return e.map(t=>sb.find(n=>n.id===t)).filter(t=>!!t)}function mb(e){const t=[],n=new Set;let s;const i=new RegExp(Gl.source,"gi");for(;(s=i.exec(e))!==null;){const r=s[1].trim(),o=parseInt(s[2],10),a=s[3].trim(),l=`${r.toLowerCase()}|${o}`;n.has(l)||(n.add(l),t.push({id:`ext-${l.replace(/\W/g,"-")}`,title:r,year:o,posterUrl:"",synopsis:Wn(e,s.index,s[0].length),genres:[],rating:0,runtime:0,director:a,cast:[],sources:[]}))}return t}function wa(e){const t=pb(Vo(e)),n=mb(e);return[...t,...n]}function gb(e){return e.startsWith("s")?e:`s${e}`}function uh(e){const t=[];let n;const s=new RegExp(nh.source,"gi");for(;(n=s.exec(e))!==null;){const i=gb(n[1]);t.includes(i)||t.push(i)}return t}function yb(e){return e.map(t=>eh.find(n=>n.id===t)).filter(t=>!!t)}function fh(e,t){const n=e.toLowerCase(),s=t.toLowerCase(),i=["latest news","protocol updates","community debates","real-time information","training cutoff","bip discussion","beyond my training","what people are saying","want me to go","search for what","look up things","direct answer","for
`).trim()}function hh(e){return e.replace(nh,"").replace(sh,"").replace(/\n{3,}/g,`
`).trim()}function ph(e){return e.replace(ih,"").replace(rh,"").replace(/\n{3,}/g,`
`).trim()}function Nb(e){return e.replace(rb,"").replace(oh,"").replace(/\n{3,}/g,`
`).trim()}function Mb(e){return e.replace(ah,"").replace(/\n{3,}/g,`
`).trim()}function Ob(e){return e.replace(lh,"").replace(/\n{3,}/g,`
`).trim()}function $b(e){return e.replace(ch,"").replace(/\n{3,}/g,`
`).trim()}function Db(e){return dh(hh(ph(Nb(Mb(Ob(Ub(Bb($b(e)))))))))}function Fb(e){return e.replace(/^[\s]*[-*]\s*\[[^\]]+\]\(https?:\/\/[^)\s]+\)\s*$/gm,"").replace(/\s*\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g,(t,n)=>` ${n}`).replace(/\n{3,}/g,`
`).trim()}const mh=/<recipe_ext\s+([^>]+)>([\s\S]*?)<\/recipe_ext>/gi;function Nu(e){const t=[];let n;for(;(n=mh.exec(e))!==null;){const s=n[1],i=n[2],r=s.match(/title="([^"]*)"/)?.[1]||"Recipe",o=s.match(/servings="([^"]*)"/)?.[1],a=s.match(/time="([^"]*)"/)?.[1],l=s.match(/calories="([^"]*)"/)?.[1],c=i.split(`
`).map(f=>f.trim()).filter(Boolean),u=[],d=[];for(const f of c)/^[-*]\s+/.test(f)?u.push(f.replace(/^[-*]\s+/,"")):/^\d+[.)]\s+/.test(f)&&d.push(f.replace(/^\d+[.)]\s+/,""));t.push({title:r,servings:o,time:a,calories:l,ingredients:u,steps:d})}return t}function Ub(e){return e.replace(mh,"").replace(/\n{3,}/g,`
`).trim()}const gh=/<event_ext\s+([^>]*?)(?:\/>|>([\s\S]*?)<\/event_ext>)/gi;function J_(e){const t=[];let n;for(;(n=gh.exec(e))!==null;){const s=n[1],i=n[2]?.trim(),r=s.match(/title="([^"]*)"/)?.[1]||"Event",o=s.match(/date="([^"]*)"/)?.[1]||"",a=s.match(/location="([^"]*)"/)?.[1],l=s.match(/url="([^"]*)"/)?.[1];t.push({title:r,date:o,location:a,url:l,description:i})}return t}function Bb(e){return e.replace(gh,"").replace(/\n{3,}/g,`
`).trim()}const jb=/\.(com|org|net|io|co|app|dev|xyz|social|news|info|me|tv|fm|live|chat|fyi|ai|so|world|land|pub|lol|cafe|money|exchange|market|tech|design|page|site|online|store|cloud|network|community|foundation)$/i,Hb=/\.(js|ts|css|html|json|md|txt|pdf|png|jpg|jpeg|gif|svg|vue|yaml|yml|xml|csv|sql|sh|py|rb|go|rs|toml|lock|env|log|map|wasm|woff2?|ttf|eot|ico)$/i;function Mu(e){const t=[],n=new Set,s=[];let i;const r=/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g;for(;(i=r.exec(e))!==null;)s.push([i.index,i.index+i[0].length]);const o=/\*\*([^*]+)\*\*\s*\(([a-zA-Z0-9][-a-zA-Z0-9.]*\.[a-zA-Z]{2,})\)/g;for(;(i=o.exec(e))!==null;)s.push([i.index,i.index+i[0].length]);const a=/https?:\/\/[^\s)\]"'<>,]+/g;for(;(i=a.exec(e))!==null;)s.push([i.index,i.index+i[0].length]);function l(u,d){return s.some(([f,h])=>u>=f&&u+d<=h)}const c=/\b([a-zA-Z][a-zA-Z0-9-]*(?:\.[a-zA-Z][a-zA-Z0-9-]*)*\.[a-zA-Z]{2,})\b/g;for(;(i=c.exec(e))!==null;){if(l(i.index,i[0].length))continue;const u=i[1];if(!jb.test(u)||Hb.test(u)||/^\d/.test(u))continue;const d=`https://${u}`,f=wo(d);if(n.has(f))continue;n.add(f);const h=u.charAt(0).toUpperCase()+u.slice(1);t.push({title:h,url:d,content:void 0})}return t}function Ou(e,t){const n=[],s=new Set;let i=!1;const r=new RegExp(ch.source,"gi");let o;for(;(o=r.exec(e))!==null;){i=!0;const d=o[1].trim(),f=o[2]?.trim()||"dev-tool",h=(o[3]?.trim()||"web").split(",").map(x=>x.trim()),b=o[4]?.trim()||"",g=`ext-${d.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;if(s.has(g))continue;s.add(g);const E=va.find(x=>x.name.toLowerCase()===d.toLowerCase()||x.keywords.some(y=>y.toLowerCase()===d.toLowerCase()));if(E&&!s.has(E.id))s.add(E.id),n.push(E);else if(!E){const x=Wn(e,o.index,o[0].length)||`${d} — ${f} app`;n.push({id:g,name:d,description:x,longDescription:x,category:f,platforms:h,url:b,keywords:[d.toLowerCase()]})}}const a=e.toLowerCase();for(const d of va){if(s.has(d.id))continue;const f=[d.name.toLowerCase(),...d.keywords.map(h=>h.toLowerCase())];for(const h of f){if(h.length<3)continue;const b=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if((h.length<=4?new RegExp(`\\b${b}\\b`,"i"):new RegExp(b,"i")).test(a)&&!s.has(d.id)){s.add(d.id),n.push(d);break}}}if(i)return n;const l=t.toLowerCase(),c=va.some(d=>[d.name.toLowerCase(),...d.keywords.map(f=>f.toLowerCase())].some(f=>f.length>=3&&l.includes(f)));return(Kl(t)||ur(t)||c||tb(e))&&n.length>=1||n.length>=2?n:[]}const zb=[],Vb=[],Wb=[],Bt=F(!1),Et=F([]),$u=F([]),Du=F([]),Mr=F([]),Ea=F([]),Fu=F([]),Sa=F([]),Uu=F(null),St=F([]),Ct=F([]),Xn=F([]),Bu=F([]),ju=F([]),Hu=F([]),zu=F([]),yi=F(null),bi=F(null),vi=F(null),wi=F(null),_i=F(null),ki=F(null),xi=F(null),Ti=F(null),Ai=F(null),Ei=F(null),Si=F(null),Hs=F(null),Or=F(0),pe=F("Recommended Films"),Ca=F(""),Vu=F(""),en=F("film"),Zn=F("film"),jt=F([]),$r=F(null),Dr=F(null),Fr=F(null),Ur=F([]),Pa=F(!1),In=F({film:!1,song:!1,podcast:!1,image:!1}),Br=F(!1);function Ia(){function e(A,R="",K=[]){Ca.value=R.trim(),Vu.value=A;const ae=_a(A,R);let m=wa(A);const v=ka(A),T=xa(A,R),S=Ta(A,R);S.length>0&&vo(R)&&(m=m.filter(ye=>!ye.id.startsWith("ext-")));const $=Cu(A),P=Su(A),V=Mu(A);Ea.value=[];const H=$.length>0||P.length>0||V.length>0?$:[],D=js(js(H,P),V),se=D.length>0,X=Ou(A,R),te=X.length>0,ie=Aa(A),de=ie.length>0&&(fl(R)||ku(A)),ge=ur(R)||xu(A),ve=Ru(A,R),He=Lu(A,R),ze=Nu(A),it=ze.length>0||_u(A),Xe=Eu(A),Dt=m.length>0||ae.length>0||v.length>0||T.length>0||S.length>0||ve.length>0||He.length>0,Jt=Xe.length>=1&&(Es(R)||as(A)||/sentiment|bearish|bull case|macro|%|BTC|bitcoin|BIP|protocol|debate|what'?s happening|ETF|inflow|trading at|key developments|price recovery|institutional|analyst watch|market cap/i.test(A)||!Dt&&!se&&Xe.length>=2),Ne=Es(R)||as(A),Ze=Ne&&(K.length>0||D.length>0||Es(R)),Je=js(K,Ea.value);if(D.length>0&&Ne){const ye=D.map(Be=>Be.url);Ky(ye).then(Be=>{if(Be.length===0)return;Ea.value=Be;const je=js(Mr.value,Be);if(Mr.value=je,!jt.value.includes("news")){const Ut=jt.value.indexOf("prompt");Ut>=0?jt.value=[...jt.value.slice(0,Ut),"news",...jt.value.slice(Ut)]:jt.value=["news",...jt.value],Zn.value="news"}const ht=ba(Ca.value);pe.
`);f.push(`**Installed apps on this node:**
${h}
You can view recent app logs by requesting the tail-logs action with an appId.`)}if(hn.value.includes("system")&&Pi.value.name){const h=Pi.value;f.push(`**System:** ${h.name}${h.version?" v"+h.version:""}`)}if(hn.value.includes("network")){const h=jr.value;f.push(`**Network:** ${h.connected?"Connected":"Disconnected"}`)}if(hn.value.includes("wallet")&&Ii.value.available){const h=Ii.value,b=[];h.alias&&b.push(h.alias),h.num_active_channels!==void 0&&b.push(`${h.num_active_channels} channels`),h.num_peers!==void 0&&b.push(`${h.num_peers} peers`),h.balance_sats!==void 0&&b.push(`On-chain: ${h.balance_sats.toLocaleString()} sats`),h.channel_balance_sats!==void 0&&b.push(`In channels: ${h.channel_balance_sats.toLocaleString()} sats`),h.synced_to_chain!==void 0&&b.push(h.synced_to_chain?"synced":"syncing"),f.push(`**Lightning (LND):** ${b.join(" | ")}`)}if(hn.value.includes("bitcoin")&&Li.value.available){const h=Li.value,b=h.sync_progress?(h.sync_progress*100).toFixed(2)+"%":"unknown",g=[`Block ${h.block_height?.toLocaleString()??"?"}`,`${b} synced`];h.chain&&g.push(h.chain),h.mempool_tx_count&&g.push(`mempool: ${h.mempool_tx_count.toLocaleString()} txs`),f.push(`**Bitcoin:** ${g.join(", ")}`)}if(hn.value.includes("files")&&Ri.value.length>0){const h=Ri.value,b=h.filter(N=>N.type==="folder"),g=h.filter(N=>N.type==="file"),E=g.filter(N=>/\.(jpg|jpeg|png|gif|webp|svg|heic|heif)$/i.test(N.name)),x=g.filter(N=>/\.(mp4|mkv|avi|mov|webm)$/i.test(N.name)),y=g.filter(N=>/\.(mp3|flac|wav|ogg|m4a|aac|opus)$/i.test(N.name)),k=g.filter(N=>/\.(pdf|doc|docx|txt|md|ods|xlsx|csv)$/i.test(N.name)),w=[`${h.length} items`];b.length>0&&w.push(`${b.length} folders (${b.map(N=>N.name).join(", ")})`),E.length>0&&w.push(`${E.length} images`),x.length>0&&w.push(`${x.length} videos`),y.length>0&&w.push(`${y.length} audio files`),k.length>0&&w.push(`${k.length} documents`);const C=g.slice(0,15).map(N=>N.name).join(", ");f.push(`**Files:** ${w.join(" | ")}
Recent: ${C}
You can read file contents by requesting the read-file action with a file path.`)}return f.length===0?"":`
**Archy Node Context** (this user is running AIUI on their Archipelago node):
${f.join(`
`)}
You can help the user manage their node, check service status, browse files, and recommend apps. Available actions: open an app (open-app), install an app (install-app), tail app logs (tail-logs), read a file (read-file), navigate in Archy (navigate). When recommending apps, use [[app_ext:...]] tags and check if they're already installed. When discussing the user's files, mention specific files you can see. If the user asks about their photos, videos, or music, reference the file counts above.`}function d(){for(const f of Hr)f();Hr=[],Qt.destroy(),tn.value=!1}return{isEmbedded:Ht(Ra),isInitialized:Ht(tn),permissions:Ht(hn),accentColor:Ht(Wu),installedApps:Ht(Ci),systemInfo:Ht(Pi),networkInfo:Ht(jr),walletInfo:Ht(Ii),fileList:Ht(Ri),bitcoinInfo:Ht(Li),init:e,destroy:d,refreshContext:n,requestAction:s,readFile:i,tailLogs:r,requestArchyContent:o,requestArchyAllContent:a,requestArchyLibrary:l,buildArchyContext:u}}function Qb(){const e=F(0),t=F(!1),n=F(typeof window<"u"?window.innerHeight:0);let s=typeof window<"u"?window.innerHeight:0,i=null;function r(){i&&clearTimeout(i),i=setTimeout(()=>{const a=window.visualViewport;if(!a)return;const l=Math.max(0,s-a.height);e.value=l,t.value=l>100,n.value=a.height},50)}function o(){const a=window.visualViewport;a&&!t.value&&(s=a.height,n.value=a.height)}return Ls(()=>{const a=window.visualViewport;a&&(s=a.height,n.value=a.height,a.addEventListener("resize",r),a.addEventListener("scroll",r)),window.addEventListener("resize",o)}),$o(()=>{const a=window.visualViewport;a&&(a.removeEventListener("resize",r),a.removeEventListener("scroll",r)),window.removeEventListener("resize",o)}),{keyboardHeight:e,isKeyboardOpen:t,viewportHeight:n}}const ev=/^https?:\/\//i,tv=zl("articleOverlay",()=>{const e=F(!1),t=F(null),n=F(""),s=F(null),i=F(null);function r(a,l="",c,u){const d=String(a??"").trim();if(ev.test(d)){try{new URL(d)}catch{return}t.value=d,n.value=String(l??"Article").slice(0,200),s.value=typeof c=="string"&&c.trim().length>0?c.trim():null,i.value=typeof u=="string"&&u.trim().length>0?u.trim():null,e.value=!0}}function o(){e.value=!1,t.value=null,n.value="",s.value=null,i.value=null}return{isOpen:e,url:t,title:n,content:s,imgSrc:i,open:r,close:o}});const{entries:yh,setPrototypeOf:qu,isFrozen:nv,getPrototypeOf:sv,getOwnPropertyDescriptor:iv}=Object;let{freeze:Nt,seal:Zt,create:dl}=Object,{apply:hl,construct:pl}=typeof Reflect<"u"&&Reflect;Nt||(Nt=function(t){return t});Zt||(Zt=function(t){return t});hl||(hl=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),r=2;r<s;r++)i[r-2]=arguments[r];return t.apply(n,i)});pl||(pl=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const zr=Mt(Array.prototype.forEach),rv=Mt(Array.prototype.lastIndexOf),Ku=Mt(Array.prototype.pop),Ni=Mt(Array.prototype.push),ov=Mt(Array.prototype.splice),so=Mt(String.prototype.toLowerCase),La=Mt(String.prototype.toString),Na=Mt(String.prototype.match),Mi=Mt(String.prototype.replace),av=Mt(String.prototype.indexOf),lv=Mt(String.prototype.trim),nn=Mt(Object.prototype.hasOwnProperty),Pt=Mt(RegExp.prototype.test),Oi=cv(TypeError);function Mt(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return hl(e,t,s)}}function cv(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return pl(e,n)}}function we(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:so;qu&&qu(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const r=n(i);r!==i&&(nv(t)||(t[s]=r),i=r)}e[i]=!0}return e}function uv(e){for(let t=0;t<e.length;t++)nn(e,t)||(e[t]=null);return e}function mn(e){const t=dl(null);for(const[n,s]of yh(e))nn(e,n)&&(Array.isArray(s)?t[n]=uv(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=mn(s):t[n]=s);return t}function $i(e,t){for(;e!==null;){const s=iv(e,t);if(s){if(s.get)return Mt(s.get);if(typeof s.value=="function")return Mt(s.value)}e=sv(e)}function n(){return null}return n}const Gu=Nt(["a","abb
`+ht),v&&zr([z,re,_e],Ut=>{ht=Mi(ht,Ut," ")}),w&&H?w.createHTML(ht):ht},t.setConfig=function(){let ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ui(ne),$=!0},t.clearConfig=function(){qn=null,$=!1},t.isValidAttribute=function(ne,_,B){qn||ui({});const Q=Qe(ne),ye=Qe(_);return En(Q,ye,B)},t.addHook=function(ne,_){typeof _=="function"&&Ni(j[ne],_)},t.removeHook=function(ne,_){if(_!==void 0){const B=rv(j[ne],_);return B===-1?void 0:ov(j[ne],B,1)[0]}return Ku(j[ne])},t.removeHooks=function(ne){j[ne]=[]},t.removeAllHooks=function(){j=Qu()},t}var xv=wh();function Tv(e){try{const t=new URL(e);return/^https?:$/i.test(t.protocol)}catch{return!1}}function Q_(e){return!!e&&typeof e=="string"&&/^https?:\/\//i.test(e.trim())}const Av=["p","br","a","strong","em","b","i","ul","ol","li","blockquote","h1","h2","h3","h4","span","div"];function Ev(e){return xv.sanitize(e,{ALLOWED_TAGS:Av,ALLOWED_ATTR:["href","src","target","rel"]})}function Sv(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ek(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}const Cv=["disabled"],Pv=["href"],Iv={class:"relative flex-1 min-h-0 bg-black/20 overflow-hidden"},Rv={class:"[&_p]:mb-3 [&_ul]:list-disc [&_ol]:list-decimal [&_li]:ml-4 [&_a]:underline [&_a]:underline-offset-2 [&_h1]:text-lg [&_h2]:text-base [&_h3]:text-sm [&_blockquote]:border-l-2 [&_blockquote]:pl-3 [&_blockquote]:italic"},Lv=["src","alt"],Nv=["innerHTML"],Mv=["href"],Ov=["src"],$v=ms({__name:"ArticleOverlay",setup(e){const t=tv(),{isDark:n}=ql(),s=Oe(()=>{const d=t.content;return d?/<[a-z][\s\S]*>/i.test(d)?Ev(d):`<p class="whitespace-pre-wrap">${Sv(d)}</p>`:""}),i=F(null),r=F(0),o=F(!1);function a(){o.value=!0,r.value++}function l(){o.value=!1}function c(d){d.key==="Escape"&&t.isOpen&&(t.close(),d.preventDefault(),d.stopPropagation())}Yt(()=>t.isOpen,d=>{d||(o.value=!1)}),Ls(()=>{window.addEventListener("keydown",c,!0)}),Oo(()=>{window.removeEventListener("keydown",c,!0)});const u=["w-full max-w-[calc(100vw-3rem)] h-[80vh] max-h-[calc(100vh-5rem)]","md:max-w-[calc(100vw-5rem)]"];return(d,f)=>(be(),fs(Ol,{to:"body"},[Fe(yo,{name:"app-launcher"},{default:nr(()=>[G(t).isOpen?(be(),xe("div",{key:0,class:"fixed inset-0 z-[2400] flex items-center justify-center p-6 md:p-10",onClick:f[2]||(f[2]=Mn(h=>G(t).close(),["self"]))},[f[7]||(f[7]=L("div",{class:"absolute inset-0 bg-black/60 backdrop-blur-md"},null,-1)),L("div",{class:st(["article-overlay-panel relative z-10 flex flex-col overflow-hidden rounded-2xl shadow-2xl path-glass-card",u])},[L("div",{class:"flex items-center gap-3 px-4 py-3 shrink-0",style:us(G(n)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[G(t).content?xt("",!0):(be(),xe("button",{key:0,type:"button",class:st(["flex items-center justify-center w-9 h-9 rounded-lg transition-colors transition-transform duration-300 disabled:opacity-70 disabled:cursor-not-allowed",G(n)?"hover:bg-white/10 text-white/70":"hover:bg-black/5 text-gray-600"]),"aria-label":"Refresh page",title:"Refresh",disabled:o.value,onClick:a},[(be(),xe("svg",{class:st(["w-5 h-5",{"animate-spin":o.value}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true"},[...f[3]||(f[3]=[L("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},null,-1)])],2))],10,Cv)),L("span",{class:st(["flex-1 truncate text-sm font-medium min-w-0",G(n)?"text-white/90":"text-gray-900"])},dt(G(t).title||"Article"),3),G(t).url?(be(),xe("a",{key:1,href:G(t).url,target:"_blank",rel:"noopener noreferrer",class:st(["flex items-center justify-center w-9 h-9 rounded-lg transition-colors shrink-0",G(n)?"hover:bg-white/10 text-white/70":"hover:bg-black/5 text-gray-600"]),"aria-label":"Open in new tab",title:"Open in new tab",onClick:f[0]||(f[0]=Mn(()=>{},["stop"]))},[...f[4]||(f[4]=[L("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[L("path",{"stroke-
`);if(n!==this.elements.captions.innerHTML){io(this.elements.captions);const i=ce("span",yn(this.config.selectors.caption));i.innerHTML=n,this.elements.captions.appendChild(i),ue.call(this,this.media,"cuechange")}}},zh={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"https://cdn.plyr.io/3.8.4/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/oembed.json?url={0}"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrappe
<rect width="200" height="200" fill="hsl(${s}, ${i}%, 28%)"/>
<rect x="3" y="3" width="194" height="194" rx="12" fill="none" stroke="hsl(${s}, ${i+5}%, 38%)" stroke-width="1"/>
<text x="100" y="82" text-anchor="middle" fill="hsl(${s}, ${i}%, 48%)" font-family="system-ui,sans-serif" font-size="10" font-weight="400" letter-spacing="4">${e}</text>
<line x1="60" y1="92" x2="140" y2="92" stroke="hsl(${s}, ${i+5}%, 40%)" stroke-width="1"/>
<text x="100" y="118" text-anchor="middle" fill="hsl(${s}, ${i+15}%, 78%)" font-family="system-ui,sans-serif" font-size="13" font-weight="700">${ii(t.length>18?t.slice(0,16)+"…":t)}</text>
${n?`<text x="100" y="138" text-anchor="middle" fill="hsl(${s}, ${i}%, 60%)" font-family="system-ui,sans-serif" font-size="10" font-weight="300">${ii(n.length>22?n.slice(0,20)+"…":n)}</text>`:""}
</svg>`;return`data:image/svg+xml,${encodeURIComponent(o)}`}function tk(e,t){const n=[...e+(t??"")].reduce((s,i)=>s+i.charCodeAt(0),0)%360;return li("PODCAST",e,t,n,30)}function nk(e,t){const n=[...e+(t??"")].reduce((s,i)=>s+i.charCodeAt(0),0)%360;return li("MUSIC",e,t,n,30)}function sk(e,t){const n=[...e+(t??"")].reduce((s,i)=>s+i.charCodeAt(0),0)%360;return li("NEWS",e,t,n,22)}function ik(e,t){const n=[...e+(t??"")].reduce((s,i)=>s+i.charCodeAt(0),0)%360;return li("WEBSITE",e,t,n,25)}function _0(e,t){const n=[...e].reduce((i,r)=>i+r.charCodeAt(0),0)%360,s=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 342 513">
<rect width="342" height="513" fill="hsl(${n}, 25%, 28%)"/>
<rect x="3" y="3" width="336" height="507" rx="6" fill="none" stroke="hsl(${n}, 30%, 38%)" stroke-width="1"/>
<text x="171" y="210" text-anchor="middle" fill="hsl(${n}, 25%, 48%)" font-family="'Helvetica Neue',Helvetica,Arial,sans-serif" font-size="13" font-weight="400" letter-spacing="5">FILM</text>
<line x1="121" y1="225" x2="221" y2="225" stroke="hsl(${n}, 30%, 40%)" stroke-width="1"/>
<text x="171" y="265" text-anchor="middle" fill="hsl(${n}, 45%, 78%)" font-family="'Helvetica Neue',Helvetica,Arial,sans-serif" font-size="18" font-weight="700">
${ii(e.length>20?e.slice(0,18)+"…":e)}
</text>
${t?`<text x="171" y="295" text-anchor="middle" fill="hsl(${n}, 30%, 60%)" font-family="'Helvetica Neue',Helvetica,Arial,sans-serif" font-size="14" font-weight="300">${t}</text>`:""}
</svg>`;return`data:image/svg+xml,${encodeURIComponent(s)}`}function rk(e,t){const n=[...e].reduce((i,r)=>i+r.charCodeAt(0),0)%360,s=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 342 513">
<rect width="342" height="513" fill="hsl(${n}, 22%, 28%)"/>
<rect x="3" y="3" width="336" height="507" rx="6" fill="none" stroke="hsl(${n}, 28%, 38%)" stroke-width="1"/>
<text x="171" y="210" text-anchor="middle" fill="hsl(${n}, 22%, 48%)" font-family="'SF Pro Display',system-ui,sans-serif" font-size="13" font-weight="400" letter-spacing="5">SERIES</text>
<line x1="111" y1="225" x2="231" y2="225" stroke="hsl(${n}, 28%, 40%)" stroke-width="1"/>
<text x="171" y="265" text-anchor="middle" fill="hsl(${n}, 40%, 78%)" font-family="'SF Pro Display',system-ui,sans-serif" font-size="18" font-weight="700">
${ii(e.length>20?e.slice(0,18)+"…":e)}
</text>
${t?`<text x="171" y="295" text-anchor="middle" fill="hsl(${n}, 28%, 60%)" font-family="'SF Pro Display',system-ui,sans-serif" font-size="14" font-weight="300">${t}</text>`:""}
</svg>`;return`data:image/svg+xml,${encodeURIComponent(s)}`}function ii(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}async function Xh(e,t,n){const s=`${e}:${Yh(t,n)}`,i=mr.get(s);if(i)return i;const r={posterUrl:null,backdropUrl:null};try{const o=new URLSearchParams({q:t.trim()});n&&n>0&&o.set("y",String(n));const a=await zo(`/api/tmdb/${e}?${o}`);if(!a.ok)return r;const l=await a.json(),c={posterUrl:l.posterUrl??null,backdropUrl:l.backdropUrl??null};return(c.posterUrl||c.backdropUrl)&&(mr.set(s,c),b0()),c}catch{return r}}async function Zh(e,t){return Xh("search",e,t)}async function ok(e,t,n){const s=e.target;if(s.dataset.fallback==="done")return;const i=s.src;h0.add(i);const r=Yh(t,n),o=mr.get(r);if(o?.posterUrl&&o.posterUrl!==i){s.dataset.fallback="tmdb",s.src=o.posterUrl;return}if(s.dataset.fallback!=="tmdb"){const{posterUrl:a}=await Zh(t,n);if(a&&a!==i){s.dataset.fallback="tmdb",s.src=a;return}}if(s.dataset.fallback!=="wiki"){const a=await ri(t,"film");if(a){s.dataset.fallback="wiki",s.src=a;return}}s.dataset.fallback="done",s.src=_0(t,n)}async function k0(e,t){return Xh("search-tv",e,t)}async function ak(e,t){const n=m0(e,t),s=To.get(n);if(s)return s;try{const i=t?`${e} ${t}`:e,r=await fetch(`https://itunes.apple.com/search?term=${encodeURIComponent(i.trim())}&media=podcast&limit=3`);if(!r.ok)return null;const l=(await r.json()).results?.[0]?.artworkUrl100;if(!l)return null;const c=l.replace(/100x100/g,"600x600");return To.set(n,c),w0(),c}catch{return null}}const Ao=new Map,Jh="aiui-book-cover-cache";function Qh(e,t){return`${e.toLowerCase().trim()}|${t.toLowerCase().trim()}`}function x0(){try{const e=sessionStorage.getItem(Jh);if(e){const t=JSON.parse(e);Object.entries(t).forEach(([n,s])=>Ao.set(n,s))}}catch{}}function T0(){try{const e=[...Ao.entries()].slice(-200);sessionStorage.setItem(Jh,JSON.stringify(Object.fromEntries(e)))}catch{}}x0();function lk(e,t){const n=[...e+(t??"")].reduce((i,r)=>i+r.charCodeAt(0),0)%360,s=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 342 513">
<rect width="342" height="513" fill="hsl(${n}, 20%, 28%)"/>
<rect x="3" y="3" width="336" height="507" rx="6" fill="none" stroke="hsl(${n}, 25%, 38%)" stroke-width="1"/>
<text x="171" y="210" text-anchor="middle" fill="hsl(${n}, 18%, 48%)" font-family="Georgia,'Times New Roman',serif" font-size="13" font-weight="400" letter-spacing="5">BOOK</text>
<line x1="121" y1="225" x2="221" y2="225" stroke="hsl(${n}, 22%, 40%)" stroke-width="1"/>
<text x="171" y="265" text-anchor="middle" fill="hsl(${n}, 35%, 78%)" font-family="Georgia,'Times New Roman',serif" font-size="18" font-weight="700">
${ii(e.length>20?e.slice(0,18)+"…":e)}
</text>
${t?`<text x="171" y="295" text-anchor="middle" fill="hsl(${n}, 22%, 60%)" font-family="Georgia,'Times New Roman',serif" font-size="14" font-weight="300">${ii(t.length>24?t.slice(0,22)+"…":t)}</text>`:""}
</svg>`;return`data:image/svg+xml,${encodeURIComponent(s)}`}async function A0(e,t){const n=Qh(e,t),s=Ao.get(n);if(s)return s;try{const i=`${e} ${t}`.trim(),r=await fetch(`https://openlibrary.org/search.json?q=${encodeURIComponent(i)}&limit=1&fields=cover_i`);if(!r.ok)return null;const a=(await r.json()).docs?.[0]?.cover_i;if(!a)return null;const l=`https://covers.openlibrary.org/b/id/${a}-L.jpg`;return Ao.set(n,l),T0(),l}catch{return null}}function ck(e,t){const n=[...e+(t??"")].reduce((s,i)=>s+i.charCodeAt(0),0)%360;return li("PLACE",e,t,n,20)}function uk(e,t){const n=[...e].reduce((s,i)=>s+i.charCodeAt(0),0)%360;return li("RECIPE",e,t,n,30)}async function fk(e,t){if(t){const s=await ri(e,t);if(s)return s}const n=await ri(e,"restaurant");return n||null}async function E0(e,t,n){const s=p0(t,e),i=qs.get(s);if(i)return i;try{const r="/aiui/",o=new URLSearchParams({q:e,title:e,artist:t}),a=await zo(`${r}api/music/search?${o}`);if(a.ok){const l=await a.json();if(l.coverUrl)return qs.set(s,l.coverUrl),za(),l.coverUrl}}catch{}try{const r=`${e} ${t}`.trim(),o=await fetch(`https://wavlake.com/api/v1/content/search?term=${encodeURIComponent(r)}`,{headers:{Accept:"application/json"}});if(o.ok){const a=await o.json();if(Array.isArray(a)){const l=a.find(u=>u.type==="track"),c=l?.albumArtUrl??l?.artistArtUrl;if(c)return qs.set(s,c),za(),c}}}catch{}try{const r=`${t} ${e}`.trim().replace(/\s+/g,"+"),o=await fetch(`https://itunes.apple.com/search?term=${encodeURIComponent(r)}&media=music&limit=3`);if(!o.ok)return null;const c=(await o.json()).results?.[0]?.artworkUrl100;if(!c)return null;const u=c.replace(/100x100/g,"600x600");return qs.set(s,u),za(),u}catch{return null}}const Zs=new Map;async function ri(e,t){const n=`${e.toLowerCase().trim()}|${(t??"").toLowerCase()}`;if(Zs.has(n))return Zs.get(n)??null;const s=async r=>{try{const o=encodeURIComponent(r.trim().replace(/\s+/g,"_")),a=await fetch(`https://en.wikipedia.org/api/rest_v1/page/summary/${o}`);if(!a.ok)return null;const l=await a.json();return l.originalimage?.source??l.thumbnail?.source??null}catch{return null}};let i=null;return t&&(i=await s(`${e} (${t})`)),i||(i=await s(e)),Zs.set(n,i),i}async function S0(e,t){const s=`gbooks:${Qh(e,t??"")}`;if(Zs.has(s))return Zs.get(s)??null;try{const i=t?`intitle:${e}+inauthor:${t}`:`intitle:${e}`,r=await fetch(`https://www.googleapis.com/books/v1/volumes?q=${encodeURIComponent(i)}&maxResults=1`);if(!r.ok)return null;const a=(await r.json()).items?.[0]?.volumeInfo?.imageLinks;let l=a?.thumbnail??a?.smallThumbnail??null;return l&&(l=l.replace(/^http:/,"https:").replace(/&edge=curl/g,""),l.includes("zoom=")||(l+="&zoom=2")),Zs.set(s,l),l}catch{return null}}async function dk(e,t){const n=await Zh(e,t);if(n.posterUrl||n.backdropUrl)return n;const s=await ri(e,"film");return s?{posterUrl:s,backdropUrl:null}:{posterUrl:null,backdropUrl:null}}async function hk(e,t){const n=await k0(e,t);if(n.posterUrl||n.backdropUrl)return n;const s=await ri(e,"TV series");return s?{posterUrl:s,backdropUrl:null}:{posterUrl:null,backdropUrl:null}}async function pk(e,t){const n=await A0(e,t??"");if(n)return n;const s=await S0(e,t);return s||await ri(e,"novel")}const C0={key:0,class:"flex flex-col"},P0={class:"flex items-center gap-3 px-3 py-2"},I0={class:"w-10 h-10 rounded-lg overflow-hidden shrink-0 flex items-center justify-center path-glass-icon"},R0=["src","alt"],L0={key:1,class:"text-base"},N0={class:"min-w-0 flex-1"},M0={class:"text-sm font-semibold truncate text-white/90"},O0={class:"text-xs truncate text-white/50"},$0=["disabled"],D0={key:0,class:"w-6 h-6 animate-spin text-white/90",fill:"none",viewBox:"0 0 24 24"},F0={key:1,class:"w-6 h-6 text-white/90",fill:"currentColor",viewBox:"0 0 24 24"},U0={key:2,class:"w-6 h-6 text-white/90",fill:"currentColor",viewBox:"0 0 24 24"},B0=["disabled"],j0={key:0,class:"text-xs text-red-400/60 px-3 pb-1 truncate"},H0={key:1,class:"flex items-center gap-4 px-4 py-3"},z0={class:"flex items-center gap-3 min-w-0 flex-1 max-w-[280px]"},V0={class:"w-12 h-12 rounded-lg overflow-hidden shrink-0 flex items-center justify-ce