@maxhealth.tech/prefab 0.3.23 → 0.3.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/a2ui.min.js +1 -1
- package/dist/auto/chart.js +1 -1
- package/dist/auto/chart.js.map +1 -1
- package/dist/auto/comparison.js +1 -1
- package/dist/auto/comparison.js.map +1 -1
- package/dist/auto/form.d.ts +1 -1
- package/dist/auto/form.d.ts.map +1 -1
- package/dist/auto/form.js +15 -2
- package/dist/auto/form.js.map +1 -1
- package/dist/auto/index.d.ts +2 -10
- package/dist/auto/index.d.ts.map +1 -1
- package/dist/auto/index.js +5 -61
- package/dist/auto/index.js.map +1 -1
- package/dist/auto/metrics.js +1 -1
- package/dist/auto/metrics.js.map +1 -1
- package/dist/auto/progress.d.ts.map +1 -1
- package/dist/auto/progress.js +8 -7
- package/dist/auto/progress.js.map +1 -1
- package/dist/auto/status.d.ts +17 -0
- package/dist/auto/status.d.ts.map +1 -0
- package/dist/auto/status.js +79 -0
- package/dist/auto/status.js.map +1 -0
- package/dist/auto/timeline.d.ts.map +1 -1
- package/dist/auto/timeline.js +3 -14
- package/dist/auto/timeline.js.map +1 -1
- package/dist/components/form/index.d.ts +1 -1
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/index.js +7 -1
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/layout/index.d.ts +7 -1
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/components/layout/index.js +6 -2
- package/dist/components/layout/index.js.map +1 -1
- package/dist/core/version.d.ts +1 -1
- package/dist/core/version.js +1 -1
- package/dist/prefab.css +85 -2
- package/dist/renderer/cdn.d.ts +5 -0
- package/dist/renderer/cdn.d.ts.map +1 -0
- package/dist/renderer/cdn.js +19 -0
- package/dist/renderer/cdn.js.map +1 -0
- package/dist/renderer/components/alert.d.ts.map +1 -1
- package/dist/renderer/components/alert.js +2 -1
- package/dist/renderer/components/alert.js.map +1 -1
- package/dist/renderer/components/charts/helpers.d.ts.map +1 -1
- package/dist/renderer/components/charts/helpers.js +21 -6
- package/dist/renderer/components/charts/helpers.js.map +1 -1
- package/dist/renderer/components/charts/scatter.d.ts.map +1 -1
- package/dist/renderer/components/charts/scatter.js +23 -4
- package/dist/renderer/components/charts/scatter.js.map +1 -1
- package/dist/renderer/components/data.d.ts.map +1 -1
- package/dist/renderer/components/data.js +2 -1
- package/dist/renderer/components/data.js.map +1 -1
- package/dist/renderer/components/form.d.ts.map +1 -1
- package/dist/renderer/components/form.js +3 -0
- package/dist/renderer/components/form.js.map +1 -1
- package/dist/renderer/components/layout.js +28 -7
- package/dist/renderer/components/layout.js.map +1 -1
- package/dist/renderer/components/media.d.ts.map +1 -1
- package/dist/renderer/components/media.js +23 -8
- package/dist/renderer/components/media.js.map +1 -1
- package/dist/renderer/components/pdf.d.ts +38 -0
- package/dist/renderer/components/pdf.d.ts.map +1 -1
- package/dist/renderer/components/pdf.js +152 -174
- package/dist/renderer/components/pdf.js.map +1 -1
- package/dist/renderer/icons.d.ts +5 -0
- package/dist/renderer/icons.d.ts.map +1 -0
- package/dist/renderer/icons.generated.d.ts +3 -0
- package/dist/renderer/icons.generated.d.ts.map +1 -0
- package/dist/renderer/icons.generated.js +64 -0
- package/dist/renderer/icons.generated.js.map +1 -0
- package/dist/renderer/icons.js +23 -0
- package/dist/renderer/icons.js.map +1 -0
- package/dist/renderer.auto.min.js +9 -9
- package/dist/renderer.min.js +9 -9
- package/package.json +3 -1
package/dist/renderer.min.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(()=>{var{defineProperty:Ct,getOwnPropertyNames:_r,getOwnPropertyDescriptor:Jr}=Object,Kr=Object.prototype.hasOwnProperty;function zr(e){return this[e]}var Wr=(e)=>{var t=(nn??=new WeakMap).get(e),n;if(t)return t;if(t=Ct({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var r of _r(e))if(!Kr.call(t,r))Ct(t,r,{get:zr.bind(e,r),enumerable:!(n=Jr(e,r))||n.enumerable})}return nn.set(e,t),t},nn;var Gr=(e)=>e;function qr(e,t){this[e]=Gr.bind(null,t)}var Ur=(e,t)=>{for(var n in t)Ct(e,n,{get:t[n],enumerable:!0,configurable:!0,set:qr.bind(t,n)})};var Bs={};Ur(Bs,{Bridge:()=>we,DestroyRegistry:()=>je,PrefabRenderer:()=>U,app:()=>bt,applyHostTheme:()=>Ke,createLogger:()=>vt,createThemeToggle:()=>Je,getLogLevel:()=>on,isIframe:()=>Pe,isValidWireFormat:()=>Or,listPipes:()=>We,log:()=>A,registerComponent:()=>p,registerPipe:()=>De,setLogLevel:()=>ze,unregisterPipe:()=>Ie,validateWireFormat:()=>Oe});var rn={silent:0,error:1,warn:2,info:3,debug:4},yt="warn";function ze(e){yt=e}function on(){return yt}function vt(e){let t=e?`[prefab:${e}]`:"[prefab]",n=(r,o,i)=>{if(rn[r]>rn[yt])return;console[r](`${t} ${o}`,...i)};return{error:(r,...o)=>n("error",r,o),warn:(r,...o)=>n("warn",r,o),info:(r,...o)=>n("info",r,o),debug:(r,...o)=>n("debug",r,o)}}var A=vt();function E(e){return e!=null&&typeof e==="object"&&!Array.isArray(e)}function b(e){return typeof e==="string"?e:void 0}function D(e){return typeof e==="number"?e:void 0}function P(e){return E(e)?e:void 0}function z(e){return Array.isArray(e)?e.filter(E):[]}function xt(e){return E(e)?[e]:z(e)}function Xr(e){return typeof e==="string"||typeof e==="number"||typeof e==="boolean"}function sn(e){let t={};if(!E(e))return t;for(let[n,r]of Object.entries(e))if(Xr(r))t[n]=String(r);return t}class $e{data={};subscribers=new Map;globalSubscribers=new Set;generation=0;constructor(e){if(e)this.data=structuredClone(e)}get(e){return Yr(this.data,e)}getAll(){return this.data}set(e,t){an(this.data,e,t),this.notify(e)}toggle(e){let t=this.get(e),n=t==null||t===!1||t===0||t==="";this.set(e,n)}append(e,t,n){let r=this.get(e);if(!Array.isArray(r)){this.set(e,[t]);return}if(n!==void 0)r.splice(n,0,t);else r.push(t);this.notify(e)}pop(e,t){let n=this.get(e);if(!Array.isArray(n))return;if(typeof t==="number")n.splice(t,1);else{let r=n.indexOf(t);if(r>=0)n.splice(r,1)}this.notify(e)}merge(e){for(let[t,n]of Object.entries(e))an(this.data,t,n);for(let t of Object.keys(e))this.notify(t)}subscribe(e,t){if(!this.subscribers.has(e))this.subscribers.set(e,new Set);return this.subscribers.get(e)?.add(t),()=>this.subscribers.get(e)?.delete(t)}subscribeAll(e){return this.globalSubscribers.add(e),()=>this.globalSubscribers.delete(e)}notify(e){this.generation++;let t=e.split(".");for(let n=1;n<=t.length;n++){let r=t.slice(0,n).join("."),o=this.subscribers.get(r);if(o)o.forEach((i)=>i())}this.globalSubscribers.forEach((n)=>n())}}function Yr(e,t){let n=t.split("."),r=e;for(let o of n){if(r==null||typeof r!=="object")return;r=Reflect.get(r,o)}return r}var Zr=new Set(["__proto__","constructor","prototype"]);function an(e,t,n){let r=t.split(".");if(r.some((i)=>Zr.has(i))){A.warn(`Blocked prototype pollution attempt: ${t}`);return}let o=e;for(let i=0;i<r.length-1;i++){let s=r[i],a=o[s];if(E(a))o=a;else{let l={};o[s]=l,o=l}}o[r[r.length-1]]=n}function ln(e){return typeof e==="function"}var Ee=new Map;function De(e,t){if(Ee.has(e)&&Ee.get(e)!==t)A.warn(`pipe "${e}" re-registered`);Ee.set(e,t)}function Ie(e){return Ee.delete(e)}function We(){return[...Ee.keys()]}function Ge(e){return Ee.get(e)}function k(e){if(e==null)return"";if(typeof e==="string")return e;if(typeof e==="number"||typeof e==="boolean"||typeof e==="bigint")return String(e);if(typeof e==="symbol")return e.description??"";if(typeof e==="function")return e.name;if(e instanceof Date)return Number.isNaN(e.getTime())?"":e.toISOString();if(Array.isArray(e))return e.map(k).join(", ");try{return JSON.stringify(e)??""}catch{return""}}function wt(e,t){let n=e instanceof Date?e:typeof e==="string"||typeof e==="number"?new Date(e):void 0;return n&&!Number.isNaN(n.getTime())?t(n):e}var cn=-1,kt=new Map,Qr=/\{\{\s*(.+?)\s*\}\}/g;function G(e){return typeof e==="string"&&e.includes("{{")&&e.includes("}}")}function q(e,t,n){let r=e.trim();if(r.startsWith("{{")&&r.endsWith("}}")&&so(r,"{{")===1){let o=r.slice(2,-2).trim();return dn(o,t,n)}return e.replace(Qr,(o,i)=>{let s=dn(i.trim(),t,n);return k(s)})}function dn(e,t,n){let[r,...o]=io(e),i=W(r.trim(),t,n);for(let s of o)i=eo(s.trim(),i,t,n);return i}function W(e,t,n){let r=ro(e);if(r>=0){let s=e.slice(0,r).trim(),a=e.slice(r+1),l=oo(a);if(l>=0){let c=a.slice(0,l).trim(),d=a.slice(l+1).trim(),f=W(s,t,n);return f!==null&&f!==void 0&&f!==!1&&f!==0&&f!==""?W(c,t,n):W(d,t,n)}}let o=qe(e,"||");if(o>=0){let s=W(e.slice(0,o).trim(),t,n);return s!==null&&s!==void 0&&s!==!1&&s!==0&&s!==""?s:W(e.slice(o+2).trim(),t,n)}let i=qe(e,"&&");if(i>=0){let s=W(e.slice(0,i).trim(),t,n);if(s===null||s===void 0||s===!1||s===0||s==="")return s;return W(e.slice(i+2).trim(),t,n)}for(let[s,a]of to){let l=qe(e,s);if(l>=0){let c=W(e.slice(0,l).trim(),t,n),d=W(e.slice(l+s.length).trim(),t,n);return a(c,d)}}if(e.startsWith("!")){let s=W(e.slice(1).trim(),t,n);return s===null||s===void 0||s===!1||s===0||s===""}for(let[s,a]of no){let l=qe(e,s);if(l>=0){let c=W(e.slice(0,l).trim(),t,n),d=W(e.slice(l+s.length).trim(),t,n);return a(Number(c),Number(d))}}if(e==="true")return!0;if(e==="false")return!1;if(e==="null"||e==="undefined")return null;if(/^-?\d+(\.\d+)?$/.test(e))return Number(e);if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);if(n&&e.startsWith("$")){let s=e.indexOf(".");if(s>=0){let a=e.slice(0,s),l=e.slice(s+1),c=n[a];return Ue(c,l)}return n[e]}if(n){let s=e.split(".")[0];if(s in n)return Ue(n[s],e.includes(".")?e.slice(s.length+1):"")}return t.get(e)}var un=new Set(["find","dot","length","upper","lower","truncate","join","first","last","abs","round","number","currency","percent","compact","date","time","datetime","pluralize","default","selectattr","rejectattr"]);function eo(e,t,n,r){let o=e.indexOf(":"),i=o>=0?e.slice(0,o).trim():e,s=o>=0?e.slice(o+1).trim():void 0,a=s?Et(s):void 0;switch(i){case"find":{if(!Array.isArray(t)||!s)return;let l=pn(s);if(l.length<2)return;let c=String(Et(l[0])),d=l[1].trim(),f;if(d.startsWith("'")&&d.endsWith("'")||d.startsWith('"')&&d.endsWith('"'))f=d.slice(1,-1);else if(n){if(r&&d.startsWith("$")){let h=d.indexOf(".");if(h>=0){let y=d.slice(0,h);if(y in r)f=Ue(r[y],d.slice(h+1))}else if(d in r)f=r[d]}if(f===void 0&&!(r&&d.startsWith("$")))if(r){let h=d.split(".")[0];f=h in r?Ue(r[h],d.includes(".")?d.slice(h.length+1):""):n.get(d)}else f=n.get(d)}else f=d;if(f==null)return;let u=n?.generation??0;if(u!==cn)kt=new Map,cn=u;let g=kt.get(t);if(!g)g=new Map,kt.set(t,g);let C=g.get(c);if(!C){C=new Map;for(let h of t)if(E(h)){let y=h[c];if(y!=null)C.set(k(y),h)}g.set(c,C)}return C.get(k(f))}case"dot":{if(t==null||typeof t!=="object"||typeof a!=="string")return;return Reflect.get(t,a)}case"length":return Array.isArray(t)?t.length:typeof t==="string"?t.length:0;case"upper":return typeof t==="string"?t.toUpperCase():t;case"lower":return typeof t==="string"?t.toLowerCase():t;case"truncate":if(typeof t==="string"&&typeof a==="number")return t.slice(0,a);return t;case"join":return Array.isArray(t)?t.join(typeof a==="string"?a:", "):t;case"first":return Array.isArray(t)?t[0]:t;case"last":return Array.isArray(t)?t[t.length-1]:t;case"abs":return Math.abs(Number(t));case"round":return typeof a==="number"?Number(Number(t).toFixed(a)):Math.round(Number(t));case"number":return typeof a==="number"?Number(Number(t).toFixed(a)):Number(t);case"currency":{let l=typeof a==="string"?a:"USD";try{return new Intl.NumberFormat("en-US",{style:"currency",currency:l}).format(Number(t))}catch{return t}}case"percent":return typeof a==="number"?`${(Number(t)*100).toFixed(a)}%`:`${Math.round(Number(t)*100)}%`;case"compact":{let l=typeof a==="number"?a:1;try{return new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:l}).format(Number(t))}catch{return t}}case"date":return wt(t,(l)=>l.toLocaleDateString());case"time":return wt(t,(l)=>l.toLocaleTimeString());case"datetime":return wt(t,(l)=>l.toLocaleString());case"pluralize":{let l=Number(t),c=typeof a==="string"?a:"";return l===1?c:`${c}s`}case"default":return t==null||t===""?a:t;case"selectattr":return Array.isArray(t)&&typeof a==="string"?t.filter((l)=>E(l)&&Boolean(l[a])):t;case"rejectattr":return Array.isArray(t)&&typeof a==="string"?t.filter((l)=>{if(!E(l))return!1;let c=l[a];return c==null||c===!1||c===0||c===""}):t;default:{let l=Ge(i);if(l){let c=s?pn(s).map(Et):[];return l(t,...c)}return t}}}var to=[["!==",(e,t)=>e!==t],["===",(e,t)=>e===t],["!=",(e,t)=>e!=t],["==",(e,t)=>e==t],[">=",(e,t)=>Number(e)>=Number(t)],["<=",(e,t)=>Number(e)<=Number(t)],[">",(e,t)=>Number(e)>Number(t)],["<",(e,t)=>Number(e)<Number(t)]],no=[[" + ",(e,t)=>e+t],[" - ",(e,t)=>e-t],[" * ",(e,t)=>e*t],[" / ",(e,t)=>t!==0?e/t:0],[" % ",(e,t)=>t!==0?e%t:0]];function qe(e,t){let n=null;for(let r=0;r<e.length;r++){let o=e[r];if(o==="'"||o==='"')n=n===o?null:n??o;if(!n&&e.slice(r,r+t.length)===t)return r}return-1}function ro(e){let t=0,n=null;for(let r=0;r<e.length;r++){let o=e[r];if(o==="'"||o==='"')n=n===o?null:n??o;if(!n){if(o==="(")t++;else if(o===")")t--;else if(o==="?"&&t===0)return r}}return-1}function oo(e){let t=0,n=null;for(let r=0;r<e.length;r++){let o=e[r];if(o==="'"||o==='"')n=n===o?null:n??o;if(!n){if(o==="?"||o==="(")t++;else if(o===")")t--;else if(o===":"&&t===0)return r}}return-1}function io(e){let t=[],n="",r=null;for(let o=0;o<e.length;o++){let i=e[o];if(i==="'"||i==='"')r=r===i?null:r??i;if(i==="|"&&!r)if(e[o+1]==="|")n+="||",o++;else t.push(n),n="";else n+=i}return t.push(n),t}function Et(e){let t=e.replace(/^['"]|['"]$/g,"");if(t==="true")return!0;if(t==="false")return!1;let n=Number(t);return isNaN(n)?t:n}function pn(e){let t=[],n="",r=null;for(let o of e){if(o==="'"||o==='"')r=r===o?null:r??o;if(o===","&&!r)t.push(n),n="";else n+=o}return t.push(n),t}function Ue(e,t){if(!t)return e;let n=t.split("."),r=e;for(let o of n){if(!E(r)&&!Array.isArray(r))return;r=Reflect.get(r,o)}return r}function so(e,t){let n=0,r=0;while((r=e.indexOf(t,r))!==-1)n++,r+=t.length;return n}function Xe(e){return e.replace(/_([a-z])/g,(t,n)=>n.toUpperCase())}function Rt(e){let t={};for(let[n,r]of Object.entries(e)){let o=n.startsWith("$")?n:Xe(n);if(Array.isArray(r))t[o]=r.map((i)=>E(i)?Rt(i):i);else if(E(r))t[o]=Rt(r);else t[o]=r}return t}async function I(e,t){for(let n of xt(e))await ao(n,t)}function F(e,t){e.catch((n)=>A.error(`${t} failed:`,n))}async function Ye(e,t,n,r){if(n!=null)A.debug(`${e} failed:`,t),await Fe(n,r,{$error:t});else A.warn(`${e} failed:`,t)}async function ao(e,t){let n=Rt(e);switch(b(n.action)){case"setState":{lo(n,t);return}case"toggleState":{co(n,t);return}case"appendState":{po(n,t);return}case"popState":{uo(n,t);return}case"showToast":{fo(n,t);return}case"closeOverlay":{mo(n,t);return}case"openLink":{go(n);return}case"setInterval":{bo(n,t);return}case"toolCall":case"callTool":return Co(n,t);case"sendMessage":return yo(n,t);case"updateContext":{vo(n,t);return}case"fetch":return xo(n,t);case"openFilePicker":{wo(n,t);return}case"callHandler":return ko(n,t);case"requestDisplayMode":{Eo(n,t);return}case"subscribe":{So(n,t);return}case"unsubscribe":{Ao(n);return}default:A.warn(`Unknown action: ${k(n.action)}`)}}function et(e,t){let n=b(e.key);if(n===void 0)A.warn(`${t}: missing key`);return n}function lo(e,t){let n=et(e,"setState");if(n===void 0)return;let r=e.value;if(G(r))r=q(r,t.store,t.scope);t.store.set(n,r),t.rerender(),Fe(e.onSuccess,t)}function co(e,t){let n=et(e,"toggleState");if(n===void 0)return;t.store.toggle(n),t.rerender()}function po(e,t){let n=et(e,"appendState");if(n===void 0)return;let r=e.value??e.item;if(G(r))r=q(r,t.store,t.scope);t.store.append(n,r,D(e.index)),t.rerender()}function uo(e,t){let n=et(e,"popState");if(n===void 0)return;let r=G(e.index)?q(e.index,t.store,t.scope):e.index;if(typeof r!=="number"&&typeof r!=="string"){A.warn("popState: missing index");return}t.store.pop(n,r),t.rerender()}function fo(e,t){t.onToast?.({message:Qe(e.message,t),description:e.description!=null?Qe(e.description,t):void 0,variant:b(e.variant),duration:D(e.duration)})}function mo(e,t){if(typeof document<"u")document.dispatchEvent(new CustomEvent("prefab:close-overlay"))}function go(e){if(typeof window<"u"){let t=b(e.url);if(!t){A.warn("openLink: missing url");return}if(!vn(t)){A.warn(`Blocked unsafe URL scheme: ${t}`);return}window.open(t,b(e.target)??"_blank")}}var Ze=new Set,ho=20,Tt=100;function bo(e,t){let n=Math.max(D(e.intervalMs)??Tt,Tt),r=xt(e.onTick);if(typeof globalThis.setInterval!=="function")return;if(r.length===0){A.warn("setInterval: missing onTick");return}if(Ze.size>=ho){A.warn("Max intervals reached, ignoring new setInterval");return}let o=globalThis.setInterval(()=>F(I(r,t),"interval action"),n);Ze.add(o)}function fn(){for(let e of Ze)globalThis.clearInterval(e);Ze.clear()}async function mn(e,t,n){let r=b(e.resultKey);if(r!==void 0)n.store.set(r,t);let o=Cn(t);if(o&&n.remount)n.remount(o);else yn(t,n),n.rerender();await Fe(e.onSuccess,n,{$result:t})}async function gn(e,t,n,r,o){let i=xn(P(n.arguments),r);try{if(t===void 0)throw Error(`${e}: missing tool name`);let s=await o.callTool(t,i);await mn(n,s,r)}catch(s){await Ye(e,s,n.onError,r)}}async function Co(e,t){if(!t.transport){A.warn("No MCP transport configured for toolCall");return}await gn("toolCall",b(e.tool),e,t,t.transport)}async function yo(e,t){if(!t.transport){A.warn("No MCP transport configured for sendMessage");return}await t.transport.sendMessage(Qe(e.message,t))}function vo(e,t){let n=P(e.context);if(n!=null)t.store.merge(n),t.rerender()}async function xo(e,t){let n=Qe(e.url,t);if(!vn(n)){A.warn(`Blocked unsafe URL in fetch: ${n}`);return}let r=b(e.method)??"GET",o=sn(e.headers),i=e.body!==void 0?JSON.stringify(e.body):void 0;try{let s=await globalThis.fetch(n,{method:r,headers:{"Content-Type":"application/json",...o},...i&&{body:i}}),a=await s.json().catch(()=>s.text());await mn(e,a,t)}catch(s){await Ye("fetch",s,e.onError,t)}}function wo(e,t){if(typeof document>"u")return;let n=document.createElement("input");n.type="file";let r=b(e.accept);if(r!==void 0)n.accept=r;if(e.multiple===!0)n.multiple=!0;n.addEventListener("change",()=>{let o=Array.from(n.files??[]),i=b(e.resultKey);if(i!==void 0)t.store.set(i,o);t.rerender(),Fe(e.onSuccess,t,{$result:o})}),n.click()}async function ko(e,t){let n=b(e.handler);if(!t.transport){A.warn(`No transport configured for callHandler: ${n??""}`);return}await gn("callHandler",n,e,t,t.transport)}function Eo(e,t){if(typeof document<"u")document.dispatchEvent(new CustomEvent("prefab:request-display-mode",{detail:{mode:e.mode}}))}var Z=new Map,Ro=50,To=2000;function So(e,t){let n=b(e.uri),r=b(e.stateKey);if(!n||!r){A.warn("subscribe: missing uri or stateKey");return}if(Z.has(n))return;if(Z.size>=Ro){A.warn("Max subscriptions reached, ignoring new subscribe");return}let o=(f)=>{let u=Cn(f);if(u&&t.remount)t.remount(u);else{if(!yn(f,t))t.store.set(r,f);t.rerender()}Fe(e.onData,t,{$data:f})};if(e.push!==!1&&t.transport?.subscribe&&t.transport.capabilities?.subscriptions){let f=t.transport.subscribe(n,o,(u)=>{if(Z.get(n)===f)Z.delete(n);Ye("subscribe",u,e.onError,t)});Z.set(n,f);return}let i=b(e.fallbackTool),s=D(e.fallbackInterval)??To;if(!i){A.warn("subscribe: host lacks subscriptions and no fallbackTool specified");return}if(!t.transport){A.warn("No MCP transport configured for subscribe fallback");return}let a=P(e.fallbackArgs)??{},l=Math.max(s,Tt),c=t.transport,d=globalThis.setInterval(()=>{(async()=>{try{let f=xn(a,t),u=await c.callTool(i,f);o(u)}catch(f){Ye("subscribe",f,e.onError,t)}})()},l);Z.set(n,()=>globalThis.clearInterval(d))}function Ao(e){let t=b(e.uri);if(!t){A.warn("unsubscribe: missing uri");return}let n=Z.get(t);if(n)n(),Z.delete(t)}function hn(){for(let[e,t]of Z)try{t()}catch(n){A.warn(`Error cleaning up subscription '${e}':`,n)}Z.clear()}function Mo(e){try{return JSON.parse(e)}catch{return}}function bn(e,t){if(!E(e))return null;if(t(e))return e;let n=e.structuredContent;if(E(n)&&t(n))return n;for(let r of z(e.content)){if(r.type!=="text"||typeof r.text!=="string")continue;let o=Mo(r.text);if(E(o)&&t(o))return o}return null}function No(e){return"$prefab"in e&&"view"in e}function Lo(e){return"$prefab"in e&&E(e.update)&&"state"in e.update}function Cn(e){return bn(e,No)}function yn(e,t){let n=bn(e,Lo);if(!n)return!1;let{update:r}=n,o=P(r.state);if(o)t.store.merge(o);if(r.actions!=null)F(I(r.actions,t),"update action");return!0}var Ho=/^\s*(javascript|vbscript|data):/i;function vn(e){return!Ho.test(e)}function Qe(e,t){if(G(e)){let n=q(e,t.store,t.scope);return k(n)}return k(e)}function xn(e,t){if(!e)return{};let n={};for(let[r,o]of Object.entries(e))n[r]=G(o)?q(o,t.store,t.scope):o;return n}async function Fe(e,t,n){if(e==null)return;let r={...t.scope,...n};await I(e,{...t,scope:r})}function tt(e,t){return e===void 0||t(e)}function St(e){return E(e)||Array.isArray(e)&&e.every(E)}function Re(e){return E(e)&&typeof e.type==="string"&&tt(e.id,(t)=>typeof t==="string")&&tt(e.cssClass,(t)=>typeof t==="string")&&tt(e.onMount,St)&&tt(e.children,(t)=>Array.isArray(t)&&t.every(Re))}function fe(e){return Array.isArray(e)?e.filter(Re):[]}function Mt(e){let t={};for(let[n,r]of Object.entries(e)){let o=n.startsWith("$")?n:Xe(n);if(Array.isArray(r))t[o]=r.map((i)=>E(i)?Mt(i):i);else if(E(r))t[o]=Mt(r);else t[o]=r}return t}function Po(e){let{id:t,cssClass:n,onMount:r,children:o,...i}=Mt(e),s={...i,type:e.type};if(typeof t==="string")s.id=t;if(typeof n==="string")s.cssClass=n;if(St(r))s.onMount=r;if(Array.isArray(o))s.children=fe(o);return s}class je{callbacks=[];track(e){this.callbacks.push(e)}flush(){for(let e of this.callbacks)try{e()}catch(t){A.warn("destroy callback error:",t)}this.callbacks=[]}get size(){return this.callbacks.length}}function Oo(e){return typeof e==="object"&&"element"in e}var nt=new Map;function p(e,t){if(nt.has(e))A.warn(`overriding existing renderer for "${e}"`);nt.set(e,t)}function Nt(){return[...nt.keys()].sort()}var wn=new Set;function En(e){wn.clear();for(let t of e)wn.add(t)}function B(e,t){let n=Po(e);if(t.defs?.[n.type]){let i={...t.defs[n.type],...n,type:t.defs[n.type].type};return B(i,t)}let r=nt.get(n.type),o;if(r){let i=r(n,t);if(Oo(i))o=i.element,t.destroyRegistry?.track(i.destroy);else o=i}else if(o=document.createElement("div"),o.setAttribute("data-prefab-type",n.type),n.children)for(let i of n.children)o.appendChild(B(i,t));if(o instanceof HTMLElement){if(n.id)o.id=n.id;if(n.cssClass){let i=v(n.cssClass,t);if(i)o.className=(o.className?o.className+" ":"")+i}if(n.onClick!=null){if(o.addEventListener("click",()=>{F(I(n.onClick,J(t)),"onClick")}),o.tagName!=="BUTTON"&&o.tagName!=="A")o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.addEventListener("keydown",(i)=>{if(i.key==="Enter"||i.key===" ")i.preventDefault(),F(I(n.onClick,J(t)),"onClick")})}}if(n.onMount){let i=n.onMount,s=J(t);queueMicrotask(()=>F(I(i,s),"onMount"))}return o}function M(e,t,n){if(!e.children)return;me(e.children,t,n)}function me(e,t,n){let r=0;while(r<e.length){let o=e[r];if(o.type==="If")r=$o(e,r,t,n);else if(o.type==="Elif"||o.type==="Else")r++;else t.appendChild(B(o,n)),r++}}function $o(e,t,n,r){let o=!1,i=t,s=e[i];if(kn(b(s.condition)??"",r))At(s,n,r),o=!0;i++;while(i<e.length){let a=e[i];if(a.type==="Elif"){if(!o&&kn(b(a.condition)??"",r))At(a,n,r),o=!0;i++}else if(a.type==="Else"){if(!o)At(a,n,r);i++;break}else break}return i}function kn(e,t){if(!e)return!1;if(G(e))return Boolean(q(e,t.store,t.scope));return Boolean(t.store.get(e))}function At(e,t,n){if(!e.children)return;me(e.children,t,n)}function v(e,t){if(G(e)){let n=q(e,t.store,t.scope);return k(n)}return k(e)}function K(e,t){if(G(e))return q(e,t.store,t.scope);return e}function J(e){return{store:e.store,transport:e.transport,scope:e.scope,rerender:e.rerender,onToast:e.onToast,remount:e.remount}}function m(e,t){let n=document.createElement(e);if(t)n.className=t;return n}function Lt(e,t){return e.textContent=t,e}function Mn(){p("Column",Do),p("Row",Io),p("Grid",Rn),p("GridItem",Tn),p("Container",Fo),p("Div",Sn),p("Span",jo),p("Dashboard",Rn),p("DashboardItem",Tn),p("Pages",Vo),p("Page",Sn),p("Detail",Bo),p("MasterDetail",_o)}function Do(e,t){let n=m("div","pf-column");n.style.display="flex",n.style.flexDirection="column";let r=rt(e);if(r!=null)n.style.gap=`${r*4}px`;return Nn(n,e),M(e,n,t),n}function Io(e,t){let n=m("div","pf-row");n.style.display="flex",n.style.flexDirection="row";let r=rt(e);if(r!=null)n.style.gap=`${r*4}px`;if(Nn(n,e),e.wrap===!0)n.style.flexWrap="wrap";return M(e,n,t),n}function Rn(e,t){let n=m("div","pf-grid");n.style.display="grid",n.style.gridTemplateColumns=`repeat(${zo(e.columns)}, minmax(0, 1fr))`;let r=rt(e);if(r!=null)n.style.gap=`${r*4}px`;return M(e,n,t),n}function Tn(e,t){let n=m("div","pf-grid-item"),r=D(e.colSpan),o=D(e.rowSpan);if(r!=null)n.style.gridColumn=`span ${r}`;if(o!=null)n.style.gridRow=`span ${o}`;return M(e,n,t),n}function Fo(e,t){let n=m("div","pf-container");n.style.maxWidth=b(e.maxWidth)??"1200px",n.style.margin="0 auto";let r=D(e.padding);if(r!=null)n.style.padding=`${r*4}px`;return M(e,n,t),n}function Sn(e,t){let n=m("div","pf-div");return M(e,n,t),n}function jo(e,t){let n=m("span","pf-span");return M(e,n,t),n}function Vo(e,t){let n=m("div","pf-pages");return M(e,n,t),n}function Bo(e,t){let n=m("div","pf-detail"),r=e.of!=null?K(e.of,t):void 0;if(r!=null&&r!==""&&r!==!1&&r!==0)M(e,n,t);else if(Re(e.empty))n.appendChild(B(e.empty,t));return n}function _o(e,t){let n=m("div","pf-master-detail"),r=rt(e);if(r!=null)n.style.gap=`${r*4}px`;let o=b(e.masterWidth)??"33%",i=e.children??[];if(i.length>0){let s=m("div","pf-master-detail-master");s.style.width=o,s.appendChild(B(i[0],t)),n.appendChild(s)}if(i.length>1){let s=m("div","pf-master-detail-detail");s.appendChild(B(i[1],t)),n.appendChild(s)}return n}var Jo=/\bgap-(\d+)\b/;function rt(e){let t=D(e.gap);if(t!=null)return t;if(typeof e.cssClass==="string"){let n=Jo.exec(e.cssClass);if(n)return Number(n[1])}return null}var Ko=["default","base","xs","sm","md","lg","xl","2xl"],An=3;function zo(e){if(typeof e==="number")return e;if(!E(e))return An;let t=Ko.map((n)=>e[n]).filter((n)=>typeof n==="number");return t.length>0?t[t.length-1]:An}function Nn(e,t){let n=b(t.align),r=b(t.justify);if(n!=null)e.style.alignItems=Wo(n);if(r!=null)e.style.justifyContent=Go(r)}function Wo(e){return{start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"}[e]??e}function Go(e){return{start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly"}[e]??e}var qo={"&":"&","<":"<",">":">",'"':""","'":"'"};function Q(e){return e.replace(/[&<>"']/g,(t)=>qo[t]??t)}function Hn(){p("Heading",Uo),p("H1",(e,t)=>ot(e,t,"h1")),p("H2",(e,t)=>ot(e,t,"h2")),p("H3",(e,t)=>ot(e,t,"h3")),p("H4",(e,t)=>ot(e,t,"h4")),p("Text",Xo),p("P",Yo),p("Lead",(e,t)=>Te(e,t,"p","pf-lead")),p("Large",(e,t)=>Te(e,t,"span","pf-large")),p("Small",(e,t)=>Te(e,t,"small","pf-small")),p("Muted",(e,t)=>Te(e,t,"p","pf-muted")),p("BlockQuote",(e,t)=>Te(e,t,"blockquote","pf-blockquote")),p("Label",(e,t)=>Te(e,t,"label","pf-label")),p("Link",Qo),p("Code",ei),p("Markdown",ti),p("Kbd",ni)}function Uo(e,t){let n=D(e.level)??2,r=`h${Math.min(Math.max(n,1),6)}`,o=document.createElement(r);return o.className=`pf-heading pf-${r}`,o.textContent=v(e.content,t),o}function ot(e,t,n){let r=document.createElement(n);return r.className=`pf-heading pf-${n}`,r.textContent=v(e.content,t),r}function Xo(e,t){return Lt(m("span","pf-text"),v(e.content,t))}function Yo(e,t){return Lt(m("p","pf-p"),v(e.content,t))}function Te(e,t,n,r){let o=document.createElement(n);return o.className=r,o.textContent=v(e.content,t),o}var Zo=/^\s*(javascript|vbscript|data):/i;function Qo(e,t){let n=document.createElement("a");if(n.className="pf-link",n.textContent=v(e.content,t),e.href!=null){let r=v(e.href,t);if(!Zo.test(r))n.href=r}if(e.target!=null)n.target=v(e.target,t);return n}function ei(e,t){let n=m("pre","pf-code"),r=m("code");if(r.textContent=v(e.content,t),e.language!=null)r.setAttribute("data-language",k(e.language));return n.appendChild(r),n}function ti(e,t){let n=m("div","pf-markdown"),r=v(e.content,t);return n.innerHTML=Pn(r),n.setAttribute("data-markdown","true"),n}var Ln=/^\s*(javascript|vbscript|data):/i;function it(e){let t=Q(e),n=[];return t=t.replace(/`([^`]+)`/g,(r,o)=>(n.push(`<code>${o}</code>`),`CODE${n.length-1}`)),t=t.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(r,o,i)=>{if(Ln.test(i))return Q(o);return`<img src="${i}" alt="${o}" />`}),t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,o,i)=>{if(Ln.test(i))return o;return`<a href="${i}">${o}</a>`}),t=t.replace(/\*{3}(.+?)\*{3}/g,"<strong><em>$1</em></strong>"),t=t.replace(/_{3}(.+?)_{3}/g,"<strong><em>$1</em></strong>"),t=t.replace(/\*{2}(.+?)\*{2}/g,"<strong>$1</strong>"),t=t.replace(/_{2}(.+?)_{2}/g,"<strong>$1</strong>"),t=t.replace(/\*(.+?)\*/g,"<em>$1</em>"),t=t.replace(/(?<!\w)_(.+?)_(?!\w)/g,"<em>$1</em>"),t=t.replace(/~~(.+?)~~/g,"<del>$1</del>"),t=t.replace(/\uFDD0CODE(\d+)\uFDD0/g,(r,o)=>n[parseInt(o)]),t}function Pn(e){let t=e.replace(/\r\n?/g,`
|
|
1
|
+
(()=>{var{defineProperty:wt,getOwnPropertyNames:eo,getOwnPropertyDescriptor:to}=Object,no=Object.prototype.hasOwnProperty;function ro(e){return this[e]}var oo=(e)=>{var t=(ln??=new WeakMap).get(e),n;if(t)return t;if(t=wt({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var r of eo(e))if(!no.call(t,r))wt(t,r,{get:ro.bind(e,r),enumerable:!(n=to(e,r))||n.enumerable})}return ln.set(e,t),t},ln;var io=(e)=>e;function so(e,t){this[e]=io.bind(null,t)}var ao=(e,t)=>{for(var n in t)wt(e,n,{get:t[n],enumerable:!0,configurable:!0,set:so.bind(t,n)})};var la={};ao(la,{Bridge:()=>we,DestroyRegistry:()=>Ve,PrefabRenderer:()=>U,app:()=>xt,applyHostTheme:()=>Ue,createLogger:()=>Mt,createThemeToggle:()=>qe,getLogLevel:()=>dn,isIframe:()=>Oe,isValidWireFormat:()=>Wr,listPipes:()=>Ze,log:()=>A,registerComponent:()=>p,registerPipe:()=>Fe,setLogLevel:()=>Xe,unregisterPipe:()=>Ie,validateWireFormat:()=>$e});var cn={silent:0,error:1,warn:2,info:3,debug:4},kt="warn";function Xe(e){kt=e}function dn(){return kt}function Mt(e){let t=e?`[prefab:${e}]`:"[prefab]",n=(r,o,i)=>{if(cn[r]>cn[kt])return;console[r](`${t} ${o}`,...i)};return{error:(r,...o)=>n("error",r,o),warn:(r,...o)=>n("warn",r,o),info:(r,...o)=>n("info",r,o),debug:(r,...o)=>n("debug",r,o)}}var A=Mt();function E(e){return e!=null&&typeof e==="object"&&!Array.isArray(e)}function b(e){return typeof e==="string"?e:void 0}function O(e){return typeof e==="number"?e:void 0}function P(e){return E(e)?e:void 0}function K(e){return Array.isArray(e)?e.filter(E):[]}function Rt(e){return E(e)?[e]:K(e)}function lo(e){return typeof e==="string"||typeof e==="number"||typeof e==="boolean"}function pn(e){let t={};if(!E(e))return t;for(let[n,r]of Object.entries(e))if(lo(r))t[n]=String(r);return t}class De{data={};subscribers=new Map;globalSubscribers=new Set;generation=0;constructor(e){if(e)this.data=structuredClone(e)}get(e){return co(this.data,e)}getAll(){return this.data}set(e,t){un(this.data,e,t),this.notify(e)}toggle(e){let t=this.get(e),n=t==null||t===!1||t===0||t==="";this.set(e,n)}append(e,t,n){let r=this.get(e);if(!Array.isArray(r)){this.set(e,[t]);return}if(n!==void 0)r.splice(n,0,t);else r.push(t);this.notify(e)}pop(e,t){let n=this.get(e);if(!Array.isArray(n))return;if(typeof t==="number")n.splice(t,1);else{let r=n.indexOf(t);if(r>=0)n.splice(r,1)}this.notify(e)}merge(e){for(let[t,n]of Object.entries(e))un(this.data,t,n);for(let t of Object.keys(e))this.notify(t)}subscribe(e,t){if(!this.subscribers.has(e))this.subscribers.set(e,new Set);return this.subscribers.get(e)?.add(t),()=>this.subscribers.get(e)?.delete(t)}subscribeAll(e){return this.globalSubscribers.add(e),()=>this.globalSubscribers.delete(e)}notify(e){this.generation++;let t=e.split(".");for(let n=1;n<=t.length;n++){let r=t.slice(0,n).join("."),o=this.subscribers.get(r);if(o)o.forEach((i)=>i())}this.globalSubscribers.forEach((n)=>n())}}function co(e,t){let n=t.split("."),r=e;for(let o of n){if(r==null||typeof r!=="object")return;r=Reflect.get(r,o)}return r}var po=new Set(["__proto__","constructor","prototype"]);function un(e,t,n){let r=t.split(".");if(r.some((i)=>po.has(i))){A.warn(`Blocked prototype pollution attempt: ${t}`);return}let o=e;for(let i=0;i<r.length-1;i++){let s=r[i],a=o[s];if(E(a))o=a;else{let l={};o[s]=l,o=l}}o[r[r.length-1]]=n}function fn(e){return typeof e==="function"}var Me=new Map;function Fe(e,t){if(Me.has(e)&&Me.get(e)!==t)A.warn(`pipe "${e}" re-registered`);Me.set(e,t)}function Ie(e){return Me.delete(e)}function Ze(){return[...Me.keys()]}function Ye(e){return Me.get(e)}function T(e){if(e==null)return"";if(typeof e==="string")return e;if(typeof e==="number"||typeof e==="boolean"||typeof e==="bigint")return String(e);if(typeof e==="symbol")return e.description??"";if(typeof e==="function")return e.name;if(e instanceof Date)return Number.isNaN(e.getTime())?"":e.toISOString();if(Array.isArray(e))return e.map(T).join(", ");try{return JSON.stringify(e)??""}catch{return""}}function Et(e,t){let n=e instanceof Date?e:typeof e==="string"||typeof e==="number"?new Date(e):void 0;return n&&!Number.isNaN(n.getTime())?t(n):e}var mn=-1,Tt=new Map,uo=/\{\{\s*(.+?)\s*\}\}/g;function G(e){return typeof e==="string"&&e.includes("{{")&&e.includes("}}")}function q(e,t,n){let r=e.trim();if(r.startsWith("{{")&&r.endsWith("}}")&&Co(r,"{{")===1){let o=r.slice(2,-2).trim();return hn(o,t,n)}return e.replace(uo,(o,i)=>{let s=hn(i.trim(),t,n);return T(s)})}function hn(e,t,n){let[r,...o]=yo(e),i=W(r.trim(),t,n);for(let s of o)i=fo(s.trim(),i,t,n);return i}function W(e,t,n){let r=go(e);if(r>=0){let s=e.slice(0,r).trim(),a=e.slice(r+1),l=bo(a);if(l>=0){let c=a.slice(0,l).trim(),d=a.slice(l+1).trim(),u=W(s,t,n);return u!==null&&u!==void 0&&u!==!1&&u!==0&&u!==""?W(c,t,n):W(d,t,n)}}let o=Qe(e,"||");if(o>=0){let s=W(e.slice(0,o).trim(),t,n);return s!==null&&s!==void 0&&s!==!1&&s!==0&&s!==""?s:W(e.slice(o+2).trim(),t,n)}let i=Qe(e,"&&");if(i>=0){let s=W(e.slice(0,i).trim(),t,n);if(s===null||s===void 0||s===!1||s===0||s==="")return s;return W(e.slice(i+2).trim(),t,n)}for(let[s,a]of mo){let l=Qe(e,s);if(l>=0){let c=W(e.slice(0,l).trim(),t,n),d=W(e.slice(l+s.length).trim(),t,n);return a(c,d)}}if(e.startsWith("!")){let s=W(e.slice(1).trim(),t,n);return s===null||s===void 0||s===!1||s===0||s===""}for(let[s,a]of ho){let l=Qe(e,s);if(l>=0){let c=W(e.slice(0,l).trim(),t,n),d=W(e.slice(l+s.length).trim(),t,n);return a(Number(c),Number(d))}}if(e==="true")return!0;if(e==="false")return!1;if(e==="null"||e==="undefined")return null;if(/^-?\d+(\.\d+)?$/.test(e))return Number(e);if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);if(n&&e.startsWith("$")){let s=e.indexOf(".");if(s>=0){let a=e.slice(0,s),l=e.slice(s+1),c=n[a];return et(c,l)}return n[e]}if(n){let s=e.split(".")[0];if(s in n)return et(n[s],e.includes(".")?e.slice(s.length+1):"")}return t.get(e)}var bn=new Set(["find","dot","length","upper","lower","truncate","join","first","last","abs","round","number","currency","percent","compact","date","time","datetime","pluralize","default","selectattr","rejectattr"]);function fo(e,t,n,r){let o=e.indexOf(":"),i=o>=0?e.slice(0,o).trim():e,s=o>=0?e.slice(o+1).trim():void 0,a=s?At(s):void 0;switch(i){case"find":{if(!Array.isArray(t)||!s)return;let l=gn(s);if(l.length<2)return;let c=String(At(l[0])),d=l[1].trim(),u;if(d.startsWith("'")&&d.endsWith("'")||d.startsWith('"')&&d.endsWith('"'))u=d.slice(1,-1);else if(n){if(r&&d.startsWith("$")){let g=d.indexOf(".");if(g>=0){let y=d.slice(0,g);if(y in r)u=et(r[y],d.slice(g+1))}else if(d in r)u=r[d]}if(u===void 0&&!(r&&d.startsWith("$")))if(r){let g=d.split(".")[0];u=g in r?et(r[g],d.includes(".")?d.slice(g.length+1):""):n.get(d)}else u=n.get(d)}else u=d;if(u==null)return;let h=n?.generation??0;if(h!==mn)Tt=new Map,mn=h;let m=Tt.get(t);if(!m)m=new Map,Tt.set(t,m);let v=m.get(c);if(!v){v=new Map;for(let g of t)if(E(g)){let y=g[c];if(y!=null)v.set(T(y),g)}m.set(c,v)}return v.get(T(u))}case"dot":{if(t==null||typeof t!=="object"||typeof a!=="string")return;return Reflect.get(t,a)}case"length":return Array.isArray(t)?t.length:typeof t==="string"?t.length:0;case"upper":return typeof t==="string"?t.toUpperCase():t;case"lower":return typeof t==="string"?t.toLowerCase():t;case"truncate":if(typeof t==="string"&&typeof a==="number")return t.slice(0,a);return t;case"join":return Array.isArray(t)?t.join(typeof a==="string"?a:", "):t;case"first":return Array.isArray(t)?t[0]:t;case"last":return Array.isArray(t)?t[t.length-1]:t;case"abs":return Math.abs(Number(t));case"round":return typeof a==="number"?Number(Number(t).toFixed(a)):Math.round(Number(t));case"number":return typeof a==="number"?Number(Number(t).toFixed(a)):Number(t);case"currency":{let l=typeof a==="string"?a:"USD";try{return new Intl.NumberFormat("en-US",{style:"currency",currency:l}).format(Number(t))}catch{return t}}case"percent":return typeof a==="number"?`${(Number(t)*100).toFixed(a)}%`:`${Math.round(Number(t)*100)}%`;case"compact":{let l=typeof a==="number"?a:1;try{return new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:l}).format(Number(t))}catch{return t}}case"date":return Et(t,(l)=>l.toLocaleDateString());case"time":return Et(t,(l)=>l.toLocaleTimeString());case"datetime":return Et(t,(l)=>l.toLocaleString());case"pluralize":{let l=Number(t),c=typeof a==="string"?a:"";return l===1?c:`${c}s`}case"default":return t==null||t===""?a:t;case"selectattr":return Array.isArray(t)&&typeof a==="string"?t.filter((l)=>E(l)&&Boolean(l[a])):t;case"rejectattr":return Array.isArray(t)&&typeof a==="string"?t.filter((l)=>{if(!E(l))return!1;let c=l[a];return c==null||c===!1||c===0||c===""}):t;default:{let l=Ye(i);if(l){let c=s?gn(s).map(At):[];return l(t,...c)}return t}}}var mo=[["!==",(e,t)=>e!==t],["===",(e,t)=>e===t],["!=",(e,t)=>e!=t],["==",(e,t)=>e==t],[">=",(e,t)=>Number(e)>=Number(t)],["<=",(e,t)=>Number(e)<=Number(t)],[">",(e,t)=>Number(e)>Number(t)],["<",(e,t)=>Number(e)<Number(t)]],ho=[[" + ",(e,t)=>e+t],[" - ",(e,t)=>e-t],[" * ",(e,t)=>e*t],[" / ",(e,t)=>t!==0?e/t:0],[" % ",(e,t)=>t!==0?e%t:0]];function Qe(e,t){let n=null;for(let r=0;r<e.length;r++){let o=e[r];if(o==="'"||o==='"')n=n===o?null:n??o;if(!n&&e.slice(r,r+t.length)===t)return r}return-1}function go(e){let t=0,n=null;for(let r=0;r<e.length;r++){let o=e[r];if(o==="'"||o==='"')n=n===o?null:n??o;if(!n){if(o==="(")t++;else if(o===")")t--;else if(o==="?"&&t===0)return r}}return-1}function bo(e){let t=0,n=null;for(let r=0;r<e.length;r++){let o=e[r];if(o==="'"||o==='"')n=n===o?null:n??o;if(!n){if(o==="?"||o==="(")t++;else if(o===")")t--;else if(o===":"&&t===0)return r}}return-1}function yo(e){let t=[],n="",r=null;for(let o=0;o<e.length;o++){let i=e[o];if(i==="'"||i==='"')r=r===i?null:r??i;if(i==="|"&&!r)if(e[o+1]==="|")n+="||",o++;else t.push(n),n="";else n+=i}return t.push(n),t}function At(e){let t=e.replace(/^['"]|['"]$/g,"");if(t==="true")return!0;if(t==="false")return!1;let n=Number(t);return isNaN(n)?t:n}function gn(e){let t=[],n="",r=null;for(let o of e){if(o==="'"||o==='"')r=r===o?null:r??o;if(o===","&&!r)t.push(n),n="";else n+=o}return t.push(n),t}function et(e,t){if(!t)return e;let n=t.split("."),r=e;for(let o of n){if(!E(r)&&!Array.isArray(r))return;r=Reflect.get(r,o)}return r}function Co(e,t){let n=0,r=0;while((r=e.indexOf(t,r))!==-1)n++,r+=t.length;return n}function tt(e){return e.replace(/_([a-z])/g,(t,n)=>n.toUpperCase())}function St(e){let t={};for(let[n,r]of Object.entries(e)){let o=n.startsWith("$")?n:tt(n);if(Array.isArray(r))t[o]=r.map((i)=>E(i)?St(i):i);else if(E(r))t[o]=St(r);else t[o]=r}return t}async function I(e,t){for(let n of Rt(e))await vo(n,t)}function j(e,t){e.catch((n)=>A.error(`${t} failed:`,n))}async function nt(e,t,n,r){if(n!=null)A.debug(`${e} failed:`,t),await je(n,r,{$error:t});else A.warn(`${e} failed:`,t)}async function vo(e,t){let n=St(e);switch(b(n.action)){case"setState":{xo(n,t);return}case"toggleState":{wo(n,t);return}case"appendState":{ko(n,t);return}case"popState":{Mo(n,t);return}case"showToast":{Ro(n,t);return}case"closeOverlay":{Eo(n,t);return}case"openLink":{To(n);return}case"setInterval":{So(n,t);return}case"toolCall":case"callTool":return Lo(n,t);case"sendMessage":return No(n,t);case"updateContext":{Ho(n,t);return}case"fetch":return Po(n,t);case"openFilePicker":{Oo(n,t);return}case"callHandler":return $o(n,t);case"requestDisplayMode":{Do(n,t);return}case"subscribe":{jo(n,t);return}case"unsubscribe":{Vo(n);return}default:A.warn(`Unknown action: ${T(n.action)}`)}}function it(e,t){let n=b(e.key);if(n===void 0)A.warn(`${t}: missing key`);return n}function xo(e,t){let n=it(e,"setState");if(n===void 0)return;let r=e.value;if(G(r))r=q(r,t.store,t.scope);t.store.set(n,r),t.rerender(),je(e.onSuccess,t)}function wo(e,t){let n=it(e,"toggleState");if(n===void 0)return;t.store.toggle(n),t.rerender()}function ko(e,t){let n=it(e,"appendState");if(n===void 0)return;let r=e.value??e.item;if(G(r))r=q(r,t.store,t.scope);t.store.append(n,r,O(e.index)),t.rerender()}function Mo(e,t){let n=it(e,"popState");if(n===void 0)return;let r=G(e.index)?q(e.index,t.store,t.scope):e.index;if(typeof r!=="number"&&typeof r!=="string"){A.warn("popState: missing index");return}t.store.pop(n,r),t.rerender()}function Ro(e,t){t.onToast?.({message:ot(e.message,t),description:e.description!=null?ot(e.description,t):void 0,variant:b(e.variant),duration:O(e.duration)})}function Eo(e,t){if(typeof document<"u")document.dispatchEvent(new CustomEvent("prefab:close-overlay"))}function To(e){if(typeof window<"u"){let t=b(e.url);if(!t){A.warn("openLink: missing url");return}if(!Rn(t)){A.warn(`Blocked unsafe URL scheme: ${t}`);return}window.open(t,b(e.target)??"_blank")}}var rt=new Set,Ao=20,Lt=100;function So(e,t){let n=Math.max(O(e.intervalMs)??Lt,Lt),r=Rt(e.onTick);if(typeof globalThis.setInterval!=="function")return;if(r.length===0){A.warn("setInterval: missing onTick");return}if(rt.size>=Ao){A.warn("Max intervals reached, ignoring new setInterval");return}let o=globalThis.setInterval(()=>j(I(r,t),"interval action"),n);rt.add(o)}function yn(){for(let e of rt)globalThis.clearInterval(e);rt.clear()}async function Cn(e,t,n){let r=b(e.resultKey);if(r!==void 0)n.store.set(r,t);let o=kn(t);if(o&&n.remount)n.remount(o);else Mn(t,n),n.rerender();await je(e.onSuccess,n,{$result:t})}async function vn(e,t,n,r,o){let i=En(P(n.arguments),r);try{if(t===void 0)throw Error(`${e}: missing tool name`);let s=await o.callTool(t,i);await Cn(n,s,r)}catch(s){await nt(e,s,n.onError,r)}}async function Lo(e,t){if(!t.transport){A.warn("No MCP transport configured for toolCall");return}await vn("toolCall",b(e.tool),e,t,t.transport)}async function No(e,t){if(!t.transport){A.warn("No MCP transport configured for sendMessage");return}await t.transport.sendMessage(ot(e.message,t))}function Ho(e,t){let n=P(e.context);if(n!=null)t.store.merge(n),t.rerender()}async function Po(e,t){let n=ot(e.url,t);if(!Rn(n)){A.warn(`Blocked unsafe URL in fetch: ${n}`);return}let r=b(e.method)??"GET",o=pn(e.headers),i=e.body!==void 0?JSON.stringify(e.body):void 0;try{let s=await globalThis.fetch(n,{method:r,headers:{"Content-Type":"application/json",...o},...i&&{body:i}}),a=await s.json().catch(()=>s.text());await Cn(e,a,t)}catch(s){await nt("fetch",s,e.onError,t)}}function Oo(e,t){if(typeof document>"u")return;let n=document.createElement("input");n.type="file";let r=b(e.accept);if(r!==void 0)n.accept=r;if(e.multiple===!0)n.multiple=!0;n.addEventListener("change",()=>{let o=Array.from(n.files??[]),i=b(e.resultKey);if(i!==void 0)t.store.set(i,o);t.rerender(),je(e.onSuccess,t,{$result:o})}),n.click()}async function $o(e,t){let n=b(e.handler);if(!t.transport){A.warn(`No transport configured for callHandler: ${n??""}`);return}await vn("callHandler",n,e,t,t.transport)}function Do(e,t){if(typeof document<"u")document.dispatchEvent(new CustomEvent("prefab:request-display-mode",{detail:{mode:e.mode}}))}var Y=new Map,Fo=50,Io=2000;function jo(e,t){let n=b(e.uri),r=b(e.stateKey);if(!n||!r){A.warn("subscribe: missing uri or stateKey");return}if(Y.has(n))return;if(Y.size>=Fo){A.warn("Max subscriptions reached, ignoring new subscribe");return}let o=(u)=>{let h=kn(u);if(h&&t.remount)t.remount(h);else{if(!Mn(u,t))t.store.set(r,u);t.rerender()}je(e.onData,t,{$data:u})};if(e.push!==!1&&t.transport?.subscribe&&t.transport.capabilities?.subscriptions){let u=t.transport.subscribe(n,o,(h)=>{if(Y.get(n)===u)Y.delete(n);nt("subscribe",h,e.onError,t)});Y.set(n,u);return}let i=b(e.fallbackTool),s=O(e.fallbackInterval)??Io;if(!i){A.warn("subscribe: host lacks subscriptions and no fallbackTool specified");return}if(!t.transport){A.warn("No MCP transport configured for subscribe fallback");return}let a=P(e.fallbackArgs)??{},l=Math.max(s,Lt),c=t.transport,d=globalThis.setInterval(()=>{(async()=>{try{let u=En(a,t),h=await c.callTool(i,u);o(h)}catch(u){nt("subscribe",u,e.onError,t)}})()},l);Y.set(n,()=>globalThis.clearInterval(d))}function Vo(e){let t=b(e.uri);if(!t){A.warn("unsubscribe: missing uri");return}let n=Y.get(t);if(n)n(),Y.delete(t)}function xn(){for(let[e,t]of Y)try{t()}catch(n){A.warn(`Error cleaning up subscription '${e}':`,n)}Y.clear()}function Bo(e){try{return JSON.parse(e)}catch{return}}function wn(e,t){if(!E(e))return null;if(t(e))return e;let n=e.structuredContent;if(E(n)&&t(n))return n;for(let r of K(e.content)){if(r.type!=="text"||typeof r.text!=="string")continue;let o=Bo(r.text);if(E(o)&&t(o))return o}return null}function _o(e){return"$prefab"in e&&"view"in e}function zo(e){return"$prefab"in e&&E(e.update)&&"state"in e.update}function kn(e){return wn(e,_o)}function Mn(e,t){let n=wn(e,zo);if(!n)return!1;let{update:r}=n,o=P(r.state);if(o)t.store.merge(o);if(r.actions!=null)j(I(r.actions,t),"update action");return!0}var Jo=/^\s*(javascript|vbscript|data):/i;function Rn(e){return!Jo.test(e)}function ot(e,t){if(G(e)){let n=q(e,t.store,t.scope);return T(n)}return T(e)}function En(e,t){if(!e)return{};let n={};for(let[r,o]of Object.entries(e))n[r]=G(o)?q(o,t.store,t.scope):o;return n}async function je(e,t,n){if(e==null)return;let r={...t.scope,...n};await I(e,{...t,scope:r})}function st(e,t){return e===void 0||t(e)}function Nt(e){return E(e)||Array.isArray(e)&&e.every(E)}function Re(e){return E(e)&&typeof e.type==="string"&&st(e.id,(t)=>typeof t==="string")&&st(e.cssClass,(t)=>typeof t==="string")&&st(e.onMount,Nt)&&st(e.children,(t)=>Array.isArray(t)&&t.every(Re))}function me(e){return Array.isArray(e)?e.filter(Re):[]}function Pt(e){let t={};for(let[n,r]of Object.entries(e)){let o=n.startsWith("$")?n:tt(n);if(Array.isArray(r))t[o]=r.map((i)=>E(i)?Pt(i):i);else if(E(r))t[o]=Pt(r);else t[o]=r}return t}function Ko(e){let{id:t,cssClass:n,onMount:r,children:o,...i}=Pt(e),s={...i,type:e.type};if(typeof t==="string")s.id=t;if(typeof n==="string")s.cssClass=n;if(Nt(r))s.onMount=r;if(Array.isArray(o))s.children=me(o);return s}class Ve{callbacks=[];track(e){this.callbacks.push(e)}flush(){for(let e of this.callbacks)try{e()}catch(t){A.warn("destroy callback error:",t)}this.callbacks=[]}get size(){return this.callbacks.length}}function Wo(e){return typeof e==="object"&&"element"in e}var at=new Map;function p(e,t){if(at.has(e))A.warn(`overriding existing renderer for "${e}"`);at.set(e,t)}function Ot(){return[...at.keys()].sort()}var Tn=new Set;function Sn(e){Tn.clear();for(let t of e)Tn.add(t)}function B(e,t){let n=Ko(e);if(t.defs?.[n.type]){let i={...t.defs[n.type],...n,type:t.defs[n.type].type};return B(i,t)}let r=at.get(n.type),o;if(r){let i=r(n,t);if(Wo(i))o=i.element,t.destroyRegistry?.track(i.destroy);else o=i}else if(o=document.createElement("div"),o.setAttribute("data-prefab-type",n.type),n.children)for(let i of n.children)o.appendChild(B(i,t));if(o instanceof HTMLElement){if(n.id)o.id=n.id;if(n.cssClass){let i=C(n.cssClass,t);if(i)o.className=(o.className?o.className+" ":"")+i}if(n.onClick!=null){if(o.addEventListener("click",()=>{j(I(n.onClick,z(t)),"onClick")}),o.tagName!=="BUTTON"&&o.tagName!=="A")o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.addEventListener("keydown",(i)=>{if(i.key==="Enter"||i.key===" ")i.preventDefault(),j(I(n.onClick,z(t)),"onClick")})}}if(n.onMount){let i=n.onMount,s=z(t);queueMicrotask(()=>j(I(i,s),"onMount"))}return o}function L(e,t,n){if(!e.children)return;he(e.children,t,n)}function he(e,t,n){let r=0;while(r<e.length){let o=e[r];if(o.type==="If")r=Go(e,r,t,n);else if(o.type==="Elif"||o.type==="Else")r++;else t.appendChild(B(o,n)),r++}}function Go(e,t,n,r){let o=!1,i=t,s=e[i];if(An(b(s.condition)??"",r))Ht(s,n,r),o=!0;i++;while(i<e.length){let a=e[i];if(a.type==="Elif"){if(!o&&An(b(a.condition)??"",r))Ht(a,n,r),o=!0;i++}else if(a.type==="Else"){if(!o)Ht(a,n,r);i++;break}else break}return i}function An(e,t){if(!e)return!1;if(G(e))return Boolean(q(e,t.store,t.scope));return Boolean(t.store.get(e))}function Ht(e,t,n){if(!e.children)return;he(e.children,t,n)}function C(e,t){if(G(e)){let n=q(e,t.store,t.scope);return T(n)}return T(e)}function J(e,t){if(G(e))return q(e,t.store,t.scope);return e}function z(e){return{store:e.store,transport:e.transport,scope:e.scope,rerender:e.rerender,onToast:e.onToast,remount:e.remount}}function f(e,t){let n=document.createElement(e);if(t)n.className=t;return n}function $t(e,t){return e.textContent=t,e}function Dn(){p("Column",qo),p("Row",Uo),p("Grid",Ln),p("GridItem",Hn),p("Container",Xo),p("Div",Pn),p("Span",Zo),p("Dashboard",Ln),p("DashboardItem",Hn),p("Pages",Yo),p("Page",Pn),p("Detail",Qo),p("MasterDetail",ei)}function qo(e,t){let n=f("div","pf-column");n.style.display="flex",n.style.flexDirection="column";let r=lt(e);if(r!=null)n.style.gap=`${r*4}px`;return Fn(n,e),L(e,n,t),n}function Uo(e,t){let n=f("div","pf-row");n.style.display="flex",n.style.flexDirection="row";let r=lt(e);if(r!=null)n.style.gap=`${r*4}px`;if(Fn(n,e),e.wrap===!0)n.style.flexWrap="wrap";return L(e,n,t),n}function Ln(e,t){let n=f("div","pf-grid");n.style.display="grid",n.style.gridTemplateColumns=`repeat(${ri(e.columns)}, minmax(0, 1fr))`;let r=lt(e);if(r!=null)n.style.gap=`${r*4}px`;let o=O(e.rowHeight);if(o!=null)n.style.gridAutoRows=`minmax(${o}px, auto)`;return L(e,n,t),n}function Nn(e,t){if(e!=null)return t!=null?`${e} / span ${t}`:String(e);return t!=null?`span ${t}`:void 0}function Hn(e,t){let n=f("div","pf-grid-item"),r=Nn(O(e.col),O(e.colSpan)),o=Nn(O(e.row),O(e.rowSpan));if(r!=null)n.style.gridColumn=r;if(o!=null)n.style.gridRow=o;return L(e,n,t),n}function Xo(e,t){let n=f("div","pf-container");n.style.maxWidth=b(e.maxWidth)??"1200px",n.style.margin="0 auto";let r=O(e.padding);if(r!=null)n.style.padding=`${r*4}px`;return L(e,n,t),n}function Pn(e,t){let n=f("div","pf-div");return L(e,n,t),n}function Zo(e,t){let n=f("span","pf-span");return L(e,n,t),n}function On(e){return b(e.name)??b(e.value)??b(e.title)}function Yo(e,t){let n=f("div","pf-pages"),r=e.children??[],o=b(e.name),i=o!=null?t.store.get(o):void 0,s=typeof i==="string"?i:b(e.value),a=r.find((l)=>s!=null&&On(l)===s)??r.at(0);if(a!=null)n.setAttribute("data-page",On(a)??""),n.appendChild(B(a,t));return n}function Qo(e,t){let n=f("div","pf-detail"),r=e.of!=null?J(e.of,t):void 0;if(r!=null&&r!==""&&r!==!1&&r!==0)L(e,n,t);else if(Re(e.empty))n.appendChild(B(e.empty,t));return n}function ei(e,t){let n=f("div","pf-master-detail"),r=lt(e);if(r!=null)n.style.gap=`${r*4}px`;let o=b(e.masterWidth)??"33%",i=e.children??[];if(i.length>0){let s=f("div","pf-master-detail-master");s.style.width=o,s.appendChild(B(i[0],t)),n.appendChild(s)}if(i.length>1){let s=f("div","pf-master-detail-detail");s.appendChild(B(i[1],t)),n.appendChild(s)}return n}var ti=/\bgap-(\d+)\b/;function lt(e){let t=O(e.gap);if(t!=null)return t;if(typeof e.cssClass==="string"){let n=ti.exec(e.cssClass);if(n)return Number(n[1])}return null}var ni=["default","base","xs","sm","md","lg","xl","2xl"],$n=3;function ri(e){if(typeof e==="number")return e;if(!E(e))return $n;let t=ni.map((n)=>e[n]).filter((n)=>typeof n==="number");return t.length>0?t[t.length-1]:$n}function Fn(e,t){let n=b(t.align),r=b(t.justify);if(n!=null)e.style.alignItems=oi(n);if(r!=null)e.style.justifyContent=ii(r)}function oi(e){return{start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"}[e]??e}function ii(e){return{start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly"}[e]??e}var si={"&":"&","<":"<",">":">",'"':""","'":"'"};function Q(e){return e.replace(/[&<>"']/g,(t)=>si[t]??t)}function jn(){p("Heading",ai),p("H1",(e,t)=>ct(e,t,"h1")),p("H2",(e,t)=>ct(e,t,"h2")),p("H3",(e,t)=>ct(e,t,"h3")),p("H4",(e,t)=>ct(e,t,"h4")),p("Text",li),p("P",ci),p("Lead",(e,t)=>Ee(e,t,"p","pf-lead")),p("Large",(e,t)=>Ee(e,t,"span","pf-large")),p("Small",(e,t)=>Ee(e,t,"small","pf-small")),p("Muted",(e,t)=>Ee(e,t,"p","pf-muted")),p("BlockQuote",(e,t)=>Ee(e,t,"blockquote","pf-blockquote")),p("Label",(e,t)=>Ee(e,t,"label","pf-label")),p("Link",pi),p("Code",ui),p("Markdown",fi),p("Kbd",mi)}function ai(e,t){let n=O(e.level)??2,r=`h${Math.min(Math.max(n,1),6)}`,o=document.createElement(r);return o.className=`pf-heading pf-${r}`,o.textContent=C(e.content,t),o}function ct(e,t,n){let r=document.createElement(n);return r.className=`pf-heading pf-${n}`,r.textContent=C(e.content,t),r}function li(e,t){return $t(f("span","pf-text"),C(e.content,t))}function ci(e,t){return $t(f("p","pf-p"),C(e.content,t))}function Ee(e,t,n,r){let o=document.createElement(n);return o.className=r,o.textContent=C(e.content,t),o}var di=/^\s*(javascript|vbscript|data):/i;function pi(e,t){let n=document.createElement("a");if(n.className="pf-link",n.textContent=C(e.content,t),e.href!=null){let r=C(e.href,t);if(!di.test(r))n.href=r}if(e.target!=null)n.target=C(e.target,t);return n}function ui(e,t){let n=f("pre","pf-code"),r=f("code");if(r.textContent=C(e.content,t),e.language!=null)r.setAttribute("data-language",T(e.language));return n.appendChild(r),n}function fi(e,t){let n=f("div","pf-markdown"),r=C(e.content,t);return n.innerHTML=Vn(r),n.setAttribute("data-markdown","true"),n}var In=/^\s*(javascript|vbscript|data):/i;function dt(e){let t=Q(e),n=[];return t=t.replace(/`([^`]+)`/g,(r,o)=>(n.push(`<code>${o}</code>`),`CODE${n.length-1}`)),t=t.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(r,o,i)=>{if(In.test(i))return Q(o);return`<img src="${i}" alt="${o}" />`}),t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,o,i)=>{if(In.test(i))return o;return`<a href="${i}">${o}</a>`}),t=t.replace(/\*{3}(.+?)\*{3}/g,"<strong><em>$1</em></strong>"),t=t.replace(/_{3}(.+?)_{3}/g,"<strong><em>$1</em></strong>"),t=t.replace(/\*{2}(.+?)\*{2}/g,"<strong>$1</strong>"),t=t.replace(/_{2}(.+?)_{2}/g,"<strong>$1</strong>"),t=t.replace(/\*(.+?)\*/g,"<em>$1</em>"),t=t.replace(/(?<!\w)_(.+?)_(?!\w)/g,"<em>$1</em>"),t=t.replace(/~~(.+?)~~/g,"<del>$1</del>"),t=t.replace(/\uFDD0CODE(\d+)\uFDD0/g,(r,o)=>n[parseInt(o)]),t}function Vn(e){let t=e.replace(/\r\n?/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),n=[],r=0;while(r<t.length){let o=t[r];if(o.trimStart().startsWith("```")){let a=o.trimStart().slice(3).trim(),l=[];r++;while(r<t.length&&!t[r].trimStart().startsWith("```"))l.push(Q(t[r])),r++;r++;let c=a?` data-language="${Q(a)}"`:"";n.push(`<pre class="pf-code"><code${c}>${l.join(`
|
|
4
|
-
`)}</code></pre>`);continue}if(/^(\s*[-*_]\s*){3,}$/.test(o)){n.push("<hr />"),r++;continue}let i=/^(#{1,6})\s+(.+)$/.exec(o);if(i){let a=i[1].length;n.push(`<h${a}>${
|
|
5
|
-
`))}</blockquote>`);continue}if(/^[\s]*[-*+]\s+/.test(o)){n.push("<ul>");while(r<t.length&&/^[\s]*[-*+]\s+/.test(t[r]))n.push(`<li>${
|
|
6
|
-
`)}function ni(e,t){let n=document.createElement("kbd");return n.className="pf-kbd",n.textContent=v(e.content,t),n}function $n(){p("Card",ri),p("CardHeader",Ht("pf-card-header")),p("CardTitle",On("pf-card-title","h3")),p("CardDescription",On("pf-card-description","p")),p("CardContent",Ht("pf-card-content")),p("CardFooter",Ht("pf-card-footer"))}function ri(e,t){let n=m("div","pf-card");return M(e,n,t),n}function Ht(e){return(t,n)=>{let r=m("div",e);return M(t,r,n),r}}function On(e,t){return(n,r)=>{let o=document.createElement(t);return o.className=e,o.textContent=v(n.content,r),o}}var _=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899"],X="var(--muted-foreground, #6b7280)",ge="var(--border, #e5e7eb)",le="11";function st(e,t,n,r=!1){let o=n?44:0,i=e-(r?44:0),s=10,a=t-24;return{plotLeft:o,plotRight:i,plotTop:10,plotBottom:a,plotWidth:i-o,plotHeight:a-10}}function oi(e,t){let n=e/t,r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o<=1.5?1:o<=3?2:o<=7?5:10)*r}function Dn(e,t=5){if(e<=0)return[0];return at(0,e,t)}function at(e,t,n=4){let r=t>e?t:e+1,o=oi(r-e,n),i=Math.floor(e/o)*o,s=[];for(let a=i;a<=r+o*0.01||s.length<2;a+=o)s.push(Math.round(a*1000)/1000);return s}function In(e,t,n,r,o){let i=Dn(n);for(let s of i){let a=t.plotBottom-(n>0?s/n*t.plotHeight:0),l=N("text",{x:t.plotLeft-6,y:a+3,"text-anchor":"end","font-size":le,fill:X});if(l.textContent=Ot(s,o),e.appendChild(l),r&&s>0)e.appendChild(N("line",{x1:t.plotLeft,y1:a,x2:t.plotRight,y2:a,stroke:ge,"stroke-width":1,"stroke-dasharray":"4 3"}))}}function Fn(e,t,n,r){let o=Dn(n);for(let i of o){let s=t.plotBottom-(n>0?i/n*t.plotHeight:0),a=N("text",{x:t.plotRight+6,y:s+3,"text-anchor":"start","font-size":le,fill:X});a.textContent=Ot(i,r),e.appendChild(a)}}function Pt(e,t,n,r,o,i){for(let s=0;s<t.length;s++){let a=t[s][n],l=N("text",{x:r(s),y:o+14,"text-anchor":"middle","font-size":le,fill:X});l.textContent=a==null?"":i?i(a):k(a),e.appendChild(l)}}function lt(e,t){e.appendChild(N("line",{x1:t.plotLeft,y1:t.plotBottom,x2:t.plotRight,y2:t.plotBottom,stroke:X,"stroke-width":1}))}function Se(e,t,n){if(e==null)return"";let r=K(`{{ __v | ${t} }}`,{...n,scope:{...n.scope,__v:e}});return k(r??e)}function Ot(e,t){if(t==="currency")return`$${e.toLocaleString()}`;if(t==="percent")return`${e}%`;if(e>=1e6)return`${(e/1e6).toFixed(1)}M`;if(e>=1000)return`${(e/1000).toFixed(1)}K`;return String(e)}function Ve(e){let t=b(e.yAxisFormat)??b(e.valueFormat);return t&&t!=="auto"?t:void 0}function Ae(e,t,n=String){let r=Ve(e);return(o)=>r?Se(o,r,t):n(o)}function $t(e,t,n){return(r,o)=>{if(r===null||r===void 0)return"—";if(o.tooltipFormat)return Se(r,o.tooltipFormat,e);let i=o.yAxisId==="right"?n:t;return Ot(Number(r),i)}}function re(e,t,n){return N("svg",{width:e,height:t,viewBox:`0 0 ${e} ${t}`,role:"img",...n?{"aria-label":`${n} chart`}:{}})}var ae=400,ii=160;function Me(e){return(t,n)=>{let r=e(t,n,ae);if(typeof ResizeObserver>"u")return r;let o=ae,i=new ResizeObserver((s)=>{let a=Math.floor(s[0]?.contentRect.width??0);if(a<ii||Math.abs(a-o)<1||!r.isConnected)return;o=a;let l=e(t,n,a);i.unobserve(r),r.replaceWith(l),r=l,i.observe(r)});return i.observe(r),{element:r,destroy:()=>{i.disconnect()}}}}function N(e,t){let n=document.createElementNS("http://www.w3.org/2000/svg",e);for(let[r,o]of Object.entries(t))n.setAttribute(r,String(o));return n}function Be(e,t){let n=N("text",e);return n.textContent=t,n}function he(e,t,n,r){let o=r*Math.PI/180;return{x:e+n*Math.cos(o),y:t-n*Math.sin(o)}}function Dt(e,t,n,r,o){let i=Math.max(2,Math.ceil(Math.abs(o-r)/4)),s=[];for(let a=0;a<=i;a++){let l=he(e,t,n,r+(o-r)*a/i);s.push(`${a===0?"M":"L"} ${l.x.toFixed(2)} ${l.y.toFixed(2)}`)}return s.join(" ")}function oe(e,t,n){if(!n||t.length<=1)return;let r=m("div","pf-chart-legend");for(let o=0;o<t.length;o++){let i=m("div","pf-chart-legend-item"),s=m("span","pf-chart-legend-dot");s.style.backgroundColor=t[o].color??_[o%_.length];let a=m("span");a.textContent=t[o].label??t[o].dataKey,i.appendChild(s),i.appendChild(a),r.appendChild(i)}e.appendChild(r)}function jn(){p("DataTable",si),p("Badge",ai),p("Dot",li),p("Metric",ci),p("Ring",di),p("Progress",pi),p("Separator",ui),p("Loader",fi),p("Icon",mi),p("Sparkline",gi)}function si(e,t){let n=m("div","pf-datatable-wrapper"),r=document.createElement("table");r.className="pf-datatable";let o=z(e.columns).map((u)=>({key:k(u.key),header:u.header!=null?k(u.header):void 0,format:b(u.format),accessor:b(u.accessor)})),i=K(e.rows,t),s=b(e.rowKey),a=b(e.selected),l=document.createElement("thead"),c=document.createElement("tr");for(let u of o){let g=document.createElement("th");g.className="pf-datatable-th",g.setAttribute("scope","col"),g.textContent=u.header??u.key,c.appendChild(g)}l.appendChild(c),r.appendChild(l);let d=document.createElement("tbody");if(Array.isArray(i)){let u=a!=null?K(a,t):void 0;for(let g of i){let C=document.createElement("tr");C.className="pf-datatable-row";let h=g,y=E(h)?h:{},T=g===null||typeof g!=="object";if(s&&u!=null&&y[s]!=null&&k(y[s])===k(u))C.classList.add("pf-datatable-row-selected");if(e.onRowClick!=null&&s)C.classList.add("pf-datatable-row-clickable"),C.addEventListener("click",()=>{let w={...t.scope,$item:h,$index:i.indexOf(g)},R=J({...t,scope:w});F(I(e.onRowClick,R),"onRowClick")});for(let w of o){let R=document.createElement("td");R.className="pf-datatable-td";let x;if(w.accessor)x=K(`{{ $item.${w.accessor} }}`,{...t,scope:{...t.scope,$item:h}});else if(x=T?g:y[w.key],w.format&&x!=null)x=K(`{{ __fmtVal | ${w.format} }}`,{...t,scope:{...t.scope,__fmtVal:x}});R.textContent=k(x),C.appendChild(R)}d.appendChild(C)}}if(!Array.isArray(i)||i.length===0){let u=document.createElement("tr"),g=document.createElement("td");g.className="pf-datatable-empty",g.colSpan=Math.max(1,o.length),g.textContent="No results",u.appendChild(g),d.appendChild(u)}if(r.appendChild(d),e.search===!0){let u=document.createElement("input");u.type="text",u.placeholder="Search...",u.className="pf-datatable-search",u.setAttribute("aria-label","Search table"),u.addEventListener("input",()=>{let g=u.value.toLowerCase();for(let C of d.querySelectorAll("tr.pf-datatable-row"))C.style.display=C.textContent.toLowerCase().includes(g)?"":"none"}),n.appendChild(u)}let f=m("div","pf-datatable-scroll");return f.appendChild(r),n.appendChild(f),n}function ai(e,t){let n=m("span","pf-badge"),r=b(e.variant)??"default";return n.setAttribute("data-variant",r),n.textContent=v(e.label??e.content,t),n}function li(e,t){let n=m("span","pf-dot"),r=b(e.color);if(r!=null)n.style.backgroundColor=r;return n}function ci(e,t){let n=m("div","pf-metric"),r=m("div","pf-metric-label");r.textContent=v(e.label,t),n.appendChild(r);let o=m("div","pf-metric-row"),i=m("div","pf-metric-value");if(i.textContent=v(e.value,t),o.appendChild(i),e.delta!=null){let s=m("span","pf-metric-delta"),a=b(e.trend),l=a==="up"?"↑ ":a==="down"?"↓ ":"";s.textContent=l+v(e.delta,t),s.setAttribute("data-sentiment",b(e.trendSentiment)??"neutral"),o.appendChild(s)}if(n.appendChild(o),e.description!=null){let s=m("div","pf-metric-desc");s.textContent=v(e.description,t),n.appendChild(s)}return n}function di(e,t){let n=m("div","pf-ring");n.setAttribute("data-variant",b(e.variant)??"default");let r=D(e.size)??80,o=D(e.thickness)??8,i=Number(K(e.value,t)??0),s=Math.max(0,Math.min(100,i)),a=(r-o)/2,l=2*Math.PI*a,c=l*(1-s/100),d=N("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`}),f={cx:r/2,cy:r/2,r:a,fill:"none","stroke-width":o},u=N("circle",{...f,class:"pf-ring-track",stroke:"var(--muted, #e5e7eb)"}),g=N("circle",{...f,class:"pf-ring-fill",stroke:"var(--primary, #3b82f6)","stroke-dasharray":l,"stroke-dashoffset":c,"stroke-linecap":"round"});if(d.appendChild(u),d.appendChild(g),n.appendChild(d),n.setAttribute("role","img"),n.setAttribute("aria-label",`${String(s)}%`),e.label!=null){let C=m("div","pf-ring-label");C.textContent=v(e.label,t),n.appendChild(C)}return n}function pi(e,t){let n=m("div","pf-progress");n.setAttribute("role","progressbar"),n.setAttribute("data-variant",b(e.variant)??"default");let r=Number(K(e.value,t)??0),o=D(e.max)??100,i=o>0?Math.max(0,Math.min(100,r/o*100)):0;n.setAttribute("aria-valuenow",String(r)),n.setAttribute("aria-valuemin","0"),n.setAttribute("aria-valuemax",String(o));let s=m("div","pf-progress-fill");return s.style.width=`${i}%`,n.appendChild(s),n}function ui(e,t){let n=document.createElement("hr");if(n.className="pf-separator",e.orientation==="vertical")n.setAttribute("data-orientation","vertical"),n.setAttribute("aria-orientation","vertical");return n}function fi(e,t){let n=m("div","pf-loader");return n.setAttribute("role","status"),n.setAttribute("aria-label","Loading"),n}function mi(e,t){let n=m("span","pf-icon");return n.setAttribute("data-icon",v(e.name??e.content,t)),n}function gi(e,t){let n=m("div","pf-sparkline"),r=Array.isArray(e.data)?e.data.filter((u)=>typeof u==="number"&&Number.isFinite(u)):[];if(r.length===0)return n;let o=D(e.width)??120,i=D(e.height)??32,s=Math.max(...r),a=Math.min(...r),l=s-a||1,c=N("svg",{width:o,height:i,viewBox:`0 0 ${o} ${i}`}),d=r.length>1?r.length-1:1,f=r.map((u,g)=>{let C=g/d*o,h=i-(u-a)/l*(i-4)-2;return`${C},${h}`}).join(" ");return c.appendChild(N("polyline",{points:f,fill:"none",stroke:"var(--primary, #3b82f6)","stroke-width":1.5})),n.appendChild(c),n}function Kn(){p("Form",hi),p("Input",bi),p("Textarea",be(Ci)),p("Button",yi),p("ButtonGroup",Ne("pf-button-group")),p("Checkbox",Bn("pf-checkbox")),p("Switch",Bn("pf-switch")),p("Slider",be(vi)),p("Calendar",be(Jn("pf-calendar"))),p("DatePicker",be(Jn("pf-datepicker"))),p("Field",Ne("pf-field")),p("FieldTitle",Le("pf-field-title")),p("FieldDescription",Le("pf-field-description")),p("FieldContent",Ne("pf-field-content")),p("FieldError",Le("pf-field-error"))}function hi(e,t){let n=document.createElement("form");return n.className="pf-form",n.addEventListener("submit",(r)=>{r.preventDefault();let o=new FormData(n),i={};for(let s of new Set(o.keys())){let a=o.getAll(s),l=n.elements.namedItem(s),c=l instanceof HTMLSelectElement&&l.multiple||a.length>1;i[s]=c?a:a[0]}if(t.store.merge(i),e.onSubmit!=null){let s=J(t);s.scope={...t.scope,...i},F(I(e.onSubmit,s),"onSubmit")}}),M(e,n,t),n}var Vn=0;function ce(e,t){return Vn+=1,`pf-${e}-${t??"field"}-${String(Vn)}`}function zn(e,t,n){if(t.label==null)return;let r=document.createElement("label");r.className="pf-input-label",r.textContent=v(t.label,n);let o=e.querySelector("input, select, textarea");if(o){if(!o.id)o.id=ce("control",b(t.name));r.htmlFor=o.id}if(t.required===!0)r.setAttribute("data-required","");e.insertBefore(r,e.firstChild)}function Wn(e,t,n){if(t.error==null||t.error===!1||t.error==="")return;let r=e.querySelector("input, select, textarea");if(r?.setAttribute("aria-invalid","true"),t.error===!0)return;let o=m("p","pf-field-error");o.id=ce("error",b(t.name)),o.textContent=v(t.error,n),r?.setAttribute("aria-describedby",o.id),e.appendChild(o)}function be(e){return(t,n)=>{let r=e(t,n);return r.classList.add("pf-labeled"),zn(r,t,n),Wn(r,t,n),r}}function Ce(e,t){if(t.required!==!0)return;if(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement)e.required=!0;e.setAttribute("aria-required","true")}function It(e,t,n,r="input",o=()=>e.value){let i=b(t.name)??(e.name||void 0);if(!i)return;let s=n.store.get(i);if(s!=null)e.value=k(s);e.addEventListener(r,()=>{let a=o();if(n.store.set(i,a),t.onChange!=null)F(I(t.onChange,{...J(n),scope:{...n.scope,$event:a}}),"onChange")})}function bi(e,t){let n=m("div","pf-input-wrapper"),r=document.createElement("input");if(r.className="pf-input",r.type=b(e.inputType)??"text",e.name!=null)r.name=k(e.name);if(r.id=ce("input",b(e.name)),e.placeholder!=null)r.placeholder=v(e.placeholder,t);if(e.disabled===!0)r.disabled=!0;return Ce(r,e),It(r,e,t),n.appendChild(r),zn(n,e,t),Wn(n,e,t),n}function Ci(e,t){let n=m("div","pf-textarea-wrapper"),r=document.createElement("textarea");if(r.className="pf-textarea",e.name!=null)r.name=k(e.name);if(r.id=ce("textarea",b(e.name)),e.placeholder!=null)r.placeholder=v(e.placeholder,t);if(e.rows!=null)r.rows=Number(e.rows);if(e.disabled===!0)r.disabled=!0;return Ce(r,e),It(r,e,t),n.appendChild(r),n}function yi(e,t){let n=document.createElement("button");if(n.className="pf-button",n.type=e.submit===!0?"submit":"button",n.textContent=v(e.label,t),n.setAttribute("data-variant",b(e.variant)??"default"),e.size!=null)n.setAttribute("data-size",k(e.size));if(e.disabled===!0)n.disabled=!0;return n}function Bn(e){return(t,n)=>{let r=m("label",`${e}-wrapper`),o=document.createElement("input");if(o.type="checkbox",o.className=e,e==="pf-switch")o.setAttribute("role","switch");if(t.name!=null)o.name=k(t.name);if(t.checked===!0)o.checked=!0;if(t.disabled===!0)o.disabled=!0;let i=b(t.name);if(i){let s=n.store.get(i);if(typeof s==="boolean")o.checked=s;o.addEventListener("change",()=>{if(n.store.set(i,o.checked),t.onChange!=null)F(I(t.onChange,{...J(n),scope:{...n.scope,$event:o.checked}}),"onChange")})}if(r.appendChild(o),t.label!=null){let s=m("span");s.textContent=v(t.label,n),r.appendChild(s)}return r}}function _n(e){let t=Number(e.min||0),n=Number(e.max||100),r=n>t?(Number(e.value)-t)/(n-t)*100:0;e.style.setProperty("--pf-fill",`${String(Math.round(Math.max(0,Math.min(100,r))*100)/100)}%`)}function vi(e,t){let n=m("div","pf-slider-wrapper"),r=document.createElement("input");if(r.type="range",r.className="pf-slider",e.name!=null)r.name=k(e.name);if(e.min!=null)r.min=k(e.min);if(e.max!=null)r.max=k(e.max);if(e.step!=null)r.step=k(e.step);if(e.disabled===!0)r.disabled=!0;return It(r,e,t,"input",()=>Number(r.value)),_n(r),r.addEventListener("input",()=>{_n(r)}),n.appendChild(r),n}function Ne(e){return(t,n)=>{let r=m("div",e);return M(t,r,n),r}}function Le(e){return(t,n)=>{let r=m("span",e);return r.textContent=v(t.content,n),r}}function Ft(){let e=document.createElement("hr");return e.className="pf-separator",e}function Jn(e){return(t,n)=>{let r=m("div",e),o=document.createElement("input");if(o.type="date",o.className="pf-input",o.name=v(t.name,n),o.id=ce("date",o.name||void 0),Ce(o,t),t.placeholder!=null)o.placeholder=v(t.placeholder,n);if(t.value!==void 0)o.value=v(t.value,n);if(t.minDate!=null)o.min=v(t.minDate,n);if(t.maxDate!=null)o.max=v(t.maxDate,n);if(t.disabled===!0)o.disabled=!0;let i=n.store.get(o.name);if(i!=null)o.value=k(i);return o.addEventListener("change",()=>{if(n.store.set(o.name,o.value),t.onChange!=null)F(I(t.onChange,J(n)),"onChange")}),r.appendChild(o),r}}function Gn(){p("Select",be(xi)),p("SelectOption",Ei),p("SelectGroup",Ne("pf-select-group")),p("SelectLabel",Le("pf-select-label")),p("SelectSeparator",Ft),p("Radio",Ri),p("RadioGroup",Ti),p("Combobox",be(Si)),p("ComboboxOption",Ai),p("ComboboxGroup",Ne("pf-combobox-group")),p("ComboboxLabel",Le("pf-combobox-label")),p("ComboboxSeparator",Ft),p("ChoiceCard",Mi)}function xi(e,t){let n=m("div","pf-select-wrapper"),r=document.createElement("select");if(r.className="pf-select",e.name!=null)r.name=k(e.name);if(r.id=ce("select",b(e.name)),e.multiple===!0)r.multiple=!0;if(e.disabled===!0)r.disabled=!0;if(Ce(r,e),e.placeholder!=null){let i=document.createElement("option");i.value="",i.textContent=v(e.placeholder,t),i.disabled=!0,i.selected=!0,i.hidden=!0,r.appendChild(i)}for(let i of z(e.options)){let s=document.createElement("option");s.value=k(i.value),s.textContent=i.label!=null?k(i.label):s.value,r.appendChild(s)}if(e.children)for(let i of e.children)if(i.type==="SelectOption"){let s=document.createElement("option");s.value=b(i.value)??"",s.textContent=b(i.label)??s.value,r.appendChild(s)}else r.appendChild(B(i,t));let o=b(e.name);if(o){let i=t.store.get(o);if(i!=null)ki(r,i);r.addEventListener("change",()=>{let s=wi(r);if(t.store.set(o,s),e.onChange!=null)F(I(e.onChange,{...J(t),scope:{...t.scope,$event:s}}),"onChange")})}return n.appendChild(r),n}function wi(e){if(!e.multiple)return e.value;return Array.from(e.selectedOptions,(t)=>t.value)}function ki(e,t){if(!e.multiple){e.value=k(t);return}let n=new Set((Array.isArray(t)?t:[t]).map((r)=>k(r)));for(let r of e.options)r.selected=n.has(r.value)}function Ei(e,t){return m("span")}function Ri(e,t){let n=m("label","pf-radio"),r=document.createElement("input");if(r.type="radio",r.className="pf-radio-input",e.disabled===!0)r.disabled=!0;if(r.value=v(e.value,t),n.appendChild(r),e.label!=null){let o=m("span","pf-radio-label");o.textContent=v(e.label,t),n.appendChild(o)}return n}function Ti(e,t){let n=m("fieldset","pf-radio-group");if(Ce(n,e),e.label!=null){let i=document.createElement("legend");if(i.className="pf-radio-legend",i.textContent=v(e.label,t),e.required===!0)i.setAttribute("data-required","");n.appendChild(i)}M(e,n,t);let r=v(e.name,t),o=t.store.get(r);for(let i of n.querySelectorAll('input[type="radio"]')){if(!(i instanceof HTMLInputElement))continue;if(i.name=r,o!=null&&i.value===k(o))i.checked=!0}return n.addEventListener("change",(i)=>{let s=i.target;if(s instanceof HTMLInputElement&&s.type==="radio"){if(t.store.set(r,s.value),e.onChange!=null)F(I(e.onChange,J(t)),"onChange")}}),n}function Si(e,t){let n=m("div","pf-combobox"),r=document.createElement("input");if(r.className="pf-combobox-input",r.type="text",r.name=v(e.name,t),r.id=ce("combobox",r.name||void 0),r.autocomplete="off",r.setAttribute("role","combobox"),r.setAttribute("aria-autocomplete","list"),r.setAttribute("aria-expanded","false"),Ce(r,e),e.placeholder!=null)r.placeholder=v(e.placeholder,t);if(e.value!==void 0)r.value=v(e.value,t);if(e.disabled===!0)r.disabled=!0;let o=t.store.get(r.name);if(o!=null)r.value=k(o);let i=m("div","pf-combobox-dropdown");i.id=`${r.id}-list`,i.setAttribute("role","listbox"),i.style.display="none",r.setAttribute("aria-controls",i.id),M(e,i,t);let s=()=>Array.from(i.querySelectorAll(".pf-combobox-option")).filter((c)=>c.style.display!=="none"),a=(c)=>{if(i.style.display=c?"block":"none",r.setAttribute("aria-expanded",c?"true":"false"),!c)for(let d of s())d.setAttribute("aria-selected","false")},l=(c)=>{let d=s();if(d.length===0)return;let f=d.findIndex((g)=>g.getAttribute("aria-selected")==="true"),u=d[(f+c+d.length)%d.length];for(let g of d)g.setAttribute("aria-selected",g===u?"true":"false");u.scrollIntoView({block:"nearest"})};if(r.addEventListener("focus",()=>{a(!0)}),r.addEventListener("blur",()=>{setTimeout(()=>{a(!1)},150)}),r.addEventListener("keydown",(c)=>{if(c.key==="ArrowDown"||c.key==="ArrowUp")c.preventDefault(),a(!0),l(c.key==="ArrowDown"?1:-1);else if(c.key==="Enter"){let d=s().find((f)=>f.getAttribute("aria-selected")==="true");if(d)c.preventDefault(),d.dispatchEvent(new MouseEvent("mousedown")),a(!1)}else if(c.key==="Escape")a(!1)}),e.searchable!==!1)r.addEventListener("input",()=>{let c=r.value.toLowerCase();for(let d of i.querySelectorAll(".pf-combobox-option"))if(d instanceof HTMLElement)d.style.display=d.textContent.toLowerCase().includes(c)?"":"none";a(!0)});if(e.onChange!=null)n.addEventListener("pf-combobox-select",()=>{F(I(e.onChange,{...J(t),scope:{...t.scope,$event:r.value}}),"onChange")});return n.appendChild(r),n.appendChild(i),n}function Ai(e,t){let n=m("div","pf-combobox-option");return n.setAttribute("role","option"),n.setAttribute("aria-selected","false"),n.textContent=v(e.label??e.value,t),n.dataset.value=v(e.value,t),n.addEventListener("mousedown",()=>{let r=n.closest(".pf-combobox"),o=r?.querySelector("input");if(o)o.value=n.dataset.value??"",t.store.set(o.name,o.value),r?.dispatchEvent(new CustomEvent("pf-combobox-select",{bubbles:!1}))}),n}function Mi(e,t){let n=m("div","pf-choice-card");n.dataset.value=v(e.value,t);let r=typeof e.selected==="string"?K(e.selected,t):e.selected;if(r===!0||r==="true")n.dataset.selected="true";if(e.onClick!=null)n.setAttribute("aria-pressed",n.dataset.selected==="true"?"true":"false");if(e.label!=null){let o=m("div","pf-choice-card-label");o.textContent=v(e.label,t),n.appendChild(o)}if(e.description!=null){let o=m("div","pf-choice-card-description");o.textContent=v(e.description,t),n.appendChild(o)}return M(e,n,t),n}var de=(e)=>`${e}-${Math.random().toString(36).slice(2,8)}`;function jt(e,t){if(!Re(e))return;let n=B(e,t);if(n instanceof HTMLElement)return n;let r=m("span","pf-trigger");return r.style.display="contents",r.appendChild(n),r}function qn(){p("Tabs",Ni),p("Tab",Li),p("Accordion",Hi),p("AccordionItem",Pi),p("Dialog",Oi),p("Popover",$i),p("Tooltip",Di),p("HoverCard",Ii),p("Carousel",Fi)}function Ni(e,t){let n=m("div","pf-tabs"),r=m("div","pf-tabs-bar");r.setAttribute("role","tablist");let o=[],i=[],s=e.children??[],a=(()=>{let c=e.defaultTab;if(typeof c==="number")return c>=0&&c<s.length?c:0;if(typeof c==="string"){let d=s.findIndex((f)=>f.title===c);return d>=0?d:0}return 0})();s.forEach((c,d)=>{let f=de("pf-tab"),u=de("pf-panel"),g=document.createElement("button");g.type="button",g.className="pf-tab-trigger",g.textContent=b(c.title)??`Tab ${String(d+1)}`,g.setAttribute("role","tab"),g.setAttribute("aria-controls",u),g.id=f,g.addEventListener("click",()=>{l(d,!0)});let C=m("div","pf-tab-panel");C.setAttribute("role","tabpanel"),C.setAttribute("aria-labelledby",f),C.id=u,C.tabIndex=0,M(c,C,t),i.push(g),o.push(C),r.appendChild(g)});function l(c,d){if(i.forEach((f,u)=>{let g=u===c;f.classList.toggle("pf-tab-active",g),f.setAttribute("aria-selected",g?"true":"false"),f.tabIndex=g?0:-1,o[u].style.display=g?"block":"none"}),d)i[c]?.focus()}if(i.length>0)l(a,!1);r.addEventListener("keydown",(c)=>{let d=i.findIndex((u)=>u===c.target);if(d<0)return;let f;if(c.key==="ArrowRight")f=(d+1)%i.length;else if(c.key==="ArrowLeft")f=(d-1+i.length)%i.length;else if(c.key==="Home")f=0;else if(c.key==="End")f=i.length-1;else return;c.preventDefault(),l(f,!0)}),n.appendChild(r);for(let c of o)n.appendChild(c);return n}function Li(e,t){let n=m("div","pf-tab");return M(e,n,t),n}function Hi(e,t){let n=m("div","pf-accordion");return M(e,n,t),n}function Pi(e,t){let n=m("div","pf-accordion-item"),r=document.createElement("button");r.type="button",r.className="pf-accordion-trigger",r.id=de("pf-acc-trigger"),r.textContent=b(e.title)??"",r.setAttribute("aria-expanded","false");let o=m("div","pf-accordion-content");return o.id=de("pf-acc"),o.setAttribute("role","region"),o.setAttribute("aria-labelledby",r.id),o.style.display="none",r.setAttribute("aria-controls",o.id),M(e,o,t),r.addEventListener("click",()=>{let i=o.style.display!=="none";o.style.display=i?"none":"block",r.setAttribute("aria-expanded",i?"false":"true")}),n.appendChild(r),n.appendChild(o),n}function Oi(e,t){let n=m("div","pf-dialog-wrapper"),r=document.createElement("dialog");r.className="pf-dialog",r.setAttribute("aria-modal","true");let o=e.dismissible!==!1,i=jt(e.trigger,t);if(i)i.setAttribute("aria-haspopup","dialog"),i.addEventListener("click",()=>{r.showModal()}),n.appendChild(i);if(e.title!=null){let l=m("h2","pf-dialog-title");l.textContent=v(e.title,t),l.id=de("pf-dialog-title"),r.setAttribute("aria-labelledby",l.id),r.appendChild(l)}if(e.description!=null){let l=m("p","pf-dialog-desc");l.textContent=v(e.description,t),l.id=de("pf-dialog-desc"),r.setAttribute("aria-describedby",l.id),r.appendChild(l)}let s=m("div","pf-dialog-body");if(M(e,s,t),r.appendChild(s),o){let l=document.createElement("button");l.type="button",l.className="pf-dialog-close",l.setAttribute("aria-label","Close"),l.textContent="×",l.addEventListener("click",()=>{r.close()}),r.appendChild(l),r.addEventListener("click",(c)=>{if(c.target===r)r.close()})}else r.addEventListener("cancel",(l)=>{l.preventDefault()});let a=()=>{r.close()};return document.addEventListener("prefab:close-overlay",a),n.appendChild(r),{element:n,destroy:()=>{document.removeEventListener("prefab:close-overlay",a)}}}function $i(e,t){let n=m("div","pf-popover"),r=m("div","pf-popover-content");if(r.id=de("pf-popover"),r.setAttribute("role","dialog"),r.style.display="none",e.title!=null){let c=m("div","pf-popover-title");c.textContent=v(e.title,t),r.appendChild(c)}M(e,r,t);let o=jt(e.trigger,t),i=()=>r.style.display!=="none",s=(c)=>{r.style.display=c?"block":"none",o?.setAttribute("aria-expanded",c?"true":"false")};if(o)o.setAttribute("aria-haspopup","dialog"),o.setAttribute("aria-controls",r.id),o.setAttribute("aria-expanded","false"),o.addEventListener("click",(c)=>{c.stopPropagation(),s(!i())}),n.appendChild(o);else n.addEventListener("click",(c)=>{if(c.target instanceof Node&&r.contains(c.target)&&i())return;s(!i())});let a=(c)=>{if(i()&&c.target instanceof Node&&!n.contains(c.target))s(!1)},l=(c)=>{if(c.key==="Escape"&&i())s(!1)};return document.addEventListener("click",a),document.addEventListener("keydown",l),n.appendChild(r),{element:n,destroy:()=>{document.removeEventListener("click",a),document.removeEventListener("keydown",l)}}}function Di(e,t){let n=m("div","pf-tooltip"),r=m("div","pf-tooltip-content");r.id=de("pf-tip"),r.setAttribute("role","tooltip"),r.textContent=v(e.content??"",t),r.style.display="none",M(e,n,t),n.setAttribute("aria-describedby",r.id);let o=()=>{r.style.display="block"},i=()=>{r.style.display="none"};return n.addEventListener("mouseenter",o),n.addEventListener("mouseleave",i),n.addEventListener("focus",o,!0),n.addEventListener("blur",i,!0),n.appendChild(r),n}function Ii(e,t){let n=m("div","pf-hover-card"),r=m("div","pf-hover-card-content");r.style.display="none";let o=jt(e.trigger,t);if(o)n.appendChild(o);return M(e,r,t),n.addEventListener("mouseenter",()=>{r.style.display="block"}),n.addEventListener("mouseleave",()=>{r.style.display="none"}),n.addEventListener("focusin",()=>{r.style.display="block"}),n.addEventListener("focusout",()=>{r.style.display="none"}),n.appendChild(r),n}function Fi(e,t){let n=m("div","pf-carousel");n.setAttribute("role","region"),n.setAttribute("aria-roledescription","carousel"),n.setAttribute("aria-label",v(e.label??"Carousel",t));let r=m("div","pf-carousel-track");M(e,r,t);let o=0,i=e.children?.length??0,s=(d,f,u)=>{let g=document.createElement("button");return g.type="button",g.className=d,g.textContent=f,g.setAttribute("aria-label",u),g},a=s("pf-carousel-prev","‹","Previous slide"),l=s("pf-carousel-next","›","Next slide"),c=()=>{r.style.transform=`translateX(-${String(o*100)}%)`,a.disabled=o<=0,l.disabled=o>=i-1};return a.addEventListener("click",()=>{if(i===0)return;o=Math.max(0,o-1),c()}),l.addEventListener("click",()=>{if(i===0)return;o=Math.min(i-1,o+1),c()}),c(),n.appendChild(r),n.appendChild(a),n.appendChild(l),n}function ji(e){if(!E(e))return{};return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,fe(n)]))}function Un(){p("ForEach",Vi),p("If",Xn),p("Elif",Bi),p("Else",_i),p("Condition",Ji),p("Define",Ki),p("Use",zi),p("Slot",Wi)}function Vi(e,t){let n=document.createDocumentFragment(),r=b(e.expression);if(!r)return n;let o;if(G(r)){let s=q(r,t.store,t.scope);o=Array.isArray(s)?s:[]}else{let s=t.store.get(r);o=Array.isArray(s)?s:[]}let i=P(e.let)??{};for(let s=0;s<o.length;s++){let a=o[s],l={...t.scope,$item:a,$index:s,...i},c={...t,scope:l};if(e.children)me(e.children,n,c)}return n}function Xn(e,t){if(Yn(b(e.condition)??"",t)){let r=document.createDocumentFragment();if(e.children)me(e.children,r,t);return r}return document.createDocumentFragment()}function Bi(e,t){return Xn(e,t)}function _i(e,t){let n=document.createDocumentFragment();if(e.children)me(e.children,n,t);return n}function Yn(e,t){if(!e)return!1;if(G(e))return Boolean(q(e,t.store,t.scope));return Boolean(t.store.get(e))}function Ji(e,t){let n=document.createDocumentFragment(),r=z(e.cases).find((o)=>Yn(b(o.when)??"",t));return me(fe(r?r.children:e.else),n,t),n}function Ki(e,t){let n=b(e.name);if(n&&e.children)t.templates=t.templates??{},t.templates[n]=e.children;return document.createDocumentFragment()}function zi(e,t){let n=document.createDocumentFragment(),r=b(e.def??e.name),o=r!=null?t.templates?.[r]:void 0;if(!o)return n;let i=P(e.overrides)??{},s={...t.scope,...i},a={...t.slots??{},...ji(e.slots)};if(Array.isArray(e.children))a.default=e.children;let l={...t,scope:s,slots:a};for(let c of o)n.appendChild(B(c,l));return n}function Wi(e,t){let n=document.createDocumentFragment(),r=b(e.name)??"default",i=t.slots?.[r]??e.children;if(i)for(let s of i)n.appendChild(B(s,t));return n}function Zn(){p("Alert",Gi),p("AlertTitle",qi),p("AlertDescription",Ui)}function Gi(e,t){let n=m("div","pf-alert");n.setAttribute("role","alert");let r=b(e.variant)??"default";if(n.setAttribute("data-variant",r),e.icon!=null){let o=m("span","pf-alert-icon");o.setAttribute("data-icon",k(e.icon)),n.appendChild(o)}return M(e,n,t),n}function qi(e,t){let n=m("h5","pf-alert-title");return n.textContent=v(e.content,t),n}function Ui(e,t){let n=m("p","pf-alert-description");return n.textContent=v(e.content,t),n}function Qn(){p("Image",Xi),p("Audio",Yi),p("Video",Zi),p("Embed",Qi),p("Svg",ts),p("DropZone",rs),p("Mermaid",os)}function Xi(e,t){let n=document.createElement("img");if(n.className="pf-image",n.src=v(e.src,t),e.alt!=null)n.alt=v(e.alt,t);if(e.width!=null)n.width=Number(e.width);if(e.height!=null)n.height=Number(e.height);return n.loading="lazy",n}function Yi(e,t){let n=document.createElement("audio");return n.className="pf-audio",n.src=v(e.src,t),n.controls=!0,n}function Zi(e,t){let n=document.createElement("video");if(n.className="pf-video",n.src=v(e.src,t),n.controls=!0,e.width!=null)n.width=Number(e.width);if(e.height!=null)n.height=Number(e.height);return n}function Qi(e,t){let n=m("div","pf-embed"),r=document.createElement("iframe");return r.src=v(e.src,t),r.style.height=e.height!=null?`${String(Number(e.height))}px`:"400px",r.setAttribute("sandbox","allow-scripts"),n.appendChild(r),n}var es=new Set(["svg","g","path","rect","circle","ellipse","line","polyline","polygon","text","tspan","textpath","defs","use","symbol","clippath","mask","pattern","lineargradient","radialgradient","stop","filter","fegaussianblur","feoffset","femerge","femergenode","fecolormatrix","feblend","title","desc"]);function ts(e,t){let n=m("div","pf-svg"),r=v(e.content,t);if(!r.includes("<svg"))return n;if(!/<svg[^>]*\sxmlns\s*=/.test(r))r=r.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"');let i=new DOMParser().parseFromString(r,"image/svg+xml").querySelector("svg");if(!i)return n;return er(i),n.appendChild(document.importNode(i,!0)),n}function er(e){let t=Array.from(e.children);for(let n of t){if(!es.has(n.tagName.toLowerCase())){n.remove();continue}for(let r of Array.from(n.attributes)){let o=r.name.toLowerCase();if(o.startsWith("on")||o==="href"&&r.value.trim().toLowerCase().startsWith("javascript:"))n.removeAttribute(r.name)}er(n)}}function ns(e,t){let n=(t??"").split(",").map((i)=>i.trim().toLowerCase()).filter(Boolean);if(n.length===0)return!0;let r=e.name.toLowerCase(),o=e.type.toLowerCase();return n.some((i)=>{if(i.startsWith("."))return r.endsWith(i);if(i.endsWith("/*"))return o.startsWith(i.slice(0,-1));return o===i})}function rs(e,t){let n=m("div","pf-dropzone");n.textContent=v(e.label??"Drop files here",t);let r=document.createElement("input");if(r.type="file",r.style.display="none",e.accept!=null)r.accept=k(e.accept);if(e.multiple===!0)r.multiple=!0;n.appendChild(r),n.setAttribute("role","button"),n.tabIndex=0;function o(s){let a=Array.from(s??[]).filter((l)=>ns(l,b(e.accept)));return e.multiple===!0?a:a.slice(0,1)}function i(s){if(s.length===0)return;let a=b(e.resultKey);if(a!=null)t.store.set(a,s),t.rerender();if(e.onDrop!=null)F(I(e.onDrop,{...J(t),scope:{...t.scope,$result:s}}),"onDrop")}return r.addEventListener("change",()=>{i(o(r.files)),r.value=""}),n.addEventListener("click",()=>r.click()),n.addEventListener("keydown",(s)=>{if(s.key==="Enter"||s.key===" ")s.preventDefault(),r.click()}),n.addEventListener("dragover",(s)=>{s.preventDefault(),n.classList.add("pf-dropzone-active")}),n.addEventListener("dragleave",()=>{n.classList.remove("pf-dropzone-active")}),n.addEventListener("drop",(s)=>{s.preventDefault(),n.classList.remove("pf-dropzone-active"),i(o(s.dataTransfer?.files??null))}),n}function os(e,t){let n=m("div","pf-mermaid");n.setAttribute("data-mermaid","true");let r=v(e.content,t);if(n.textContent=r,"mermaid"in globalThis)n.classList.add("mermaid"),n.textContent=r;return n}var is="https://cdn.jsdelivr.net/npm/pdfjs-dist@4.9/build/pdf.min.mjs",ss="https://cdn.jsdelivr.net/npm/pdfjs-dist@4.9/build/pdf.worker.min.mjs",Vt=null,ct=null;function as(e){return E(e)&&typeof e.getDocument==="function"&&E(e.GlobalWorkerOptions)}function Bt(e,t){let n=typeof e==="string"&&e.trim()!==""?Number(e):e;return typeof n==="number"&&Number.isFinite(n)?n:t}function ls(e){return e==="fit-page"||e==="fit-width"?e:Bt(e,0)||"fit-width"}async function cs(){if(Vt)return Vt;if(ct)return ct;return ct=import(is).then((e)=>{if(!as(e))throw Error("PDF.js did not load");let t=e;return t.GlobalWorkerOptions.workerSrc=ss,Vt=t,t}),ct}function nr(){p("PdfViewer",ds)}function ds(e,t){let n=m("div","pf-pdf-viewer"),r=e.src!=null?v(e.src,t):void 0,o=b(e.data),i=Bt(e.page,1),s=ls(e.zoom),a=e.toolbar!==!1,l=Bt(e.height,600);n.style.height=`${l}px`,n.style.display="flex",n.style.flexDirection="column",n.style.overflow="hidden",n.style.border="1px solid var(--color-border-primary, #e5e7eb)",n.style.borderRadius="var(--border-radius-md, 0.375rem)",n.style.background="var(--color-background-secondary, #f9fafb)";let c=m("div","pf-pdf-loading");return c.textContent="Loading PDF…",c.style.display="flex",c.style.alignItems="center",c.style.justifyContent="center",c.style.flex="1",c.style.color="var(--color-text-secondary, #6b7280)",n.appendChild(c),ps(n,c,{src:r,data:o,initialPage:i,zoom:s,showToolbar:a}),n}async function ps(e,t,n){try{let r=await cs(),o;if(n.src)o={url:n.src};else if(n.data){let u=atob(n.data),g=new Uint8Array(u.length);for(let C=0;C<u.length;C++)g[C]=u.charCodeAt(C);o={data:g}}else{t.textContent="Error: No PDF source provided";return}let i=await r.getDocument(o).promise;t.remove();let s=Math.max(1,Math.min(n.initialPage,i.numPages)),a=null,l=null;if(n.showToolbar){let u=us(i.numPages,s,{onPrev:()=>{if(s>1)s--,f()},onNext:()=>{if(s<i.numPages)s++,f()},onPageChange:(g)=>{let C=Math.max(1,Math.min(g,i.numPages));if(C!==s)s=C,f()}});a=u.pageInput,l=u.pageCount,e.insertBefore(u.el,e.firstChild)}let c=m("div","pf-pdf-canvas-container");c.style.flex="1",c.style.overflow="auto",c.style.display="flex",c.style.justifyContent="center",c.style.padding="8px",e.appendChild(c);let d=document.createElement("canvas");d.style.display="block",d.style.boxShadow="var(--shadow-md, 0 4px 6px -1px rgba(0,0,0,.1))",c.appendChild(d);async function f(){let u=await i.getPage(s),g=c.clientWidth-16,C,h=u.getViewport({scale:1});if(n.zoom==="fit-width")C=g/h.width;else if(n.zoom==="fit-page"){let w=c.clientHeight-16,R=g/h.width,x=w/h.height;C=Math.min(R,x)}else C=typeof n.zoom==="number"?n.zoom:1;let y=u.getViewport({scale:C});d.width=y.width,d.height=y.height,d.style.width=`${y.width}px`,d.style.height=`${y.height}px`;let T=d.getContext("2d");if(!T)return;if(await u.render({canvasContext:T,viewport:y}).promise,a)a.value=String(s);if(l)l.textContent=`/ ${i.numPages}`}await f()}catch(r){t.textContent=`PDF Error: ${r instanceof Error?r.message:String(r)}`,t.style.color="var(--color-text-danger, #dc2626)"}}function us(e,t,n){let r=m("div","pf-pdf-toolbar");r.style.display="flex",r.style.alignItems="center",r.style.gap="8px",r.style.padding="6px 12px",r.style.borderBottom="1px solid var(--color-border-primary, #e5e7eb)",r.style.background="var(--color-background-primary, #fff)",r.style.flexShrink="0",r.style.fontSize="13px";let o=document.createElement("button");o.textContent="‹",o.title="Previous page",o.className="pf-pdf-btn",tr(o),o.addEventListener("click",n.onPrev);let i=document.createElement("button");i.textContent="›",i.title="Next page",i.className="pf-pdf-btn",tr(i),i.addEventListener("click",n.onNext);let s=document.createElement("input");s.type="number",s.min="1",s.max=String(e),s.value=String(t),s.style.width="48px",s.style.textAlign="center",s.style.border="1px solid var(--color-border-primary, #e5e7eb)",s.style.borderRadius="4px",s.style.padding="2px 4px",s.style.fontSize="13px",s.addEventListener("change",()=>{let l=parseInt(s.value,10);if(!isNaN(l))n.onPageChange(l)});let a=document.createElement("span");return a.textContent=`/ ${e}`,a.style.color="var(--color-text-secondary, #6b7280)",r.appendChild(o),r.appendChild(s),r.appendChild(a),r.appendChild(i),{el:r,pageInput:s,pageCount:a}}function tr(e){e.style.border="1px solid var(--color-border-primary, #e5e7eb)",e.style.borderRadius="4px",e.style.background="var(--color-background-primary, #fff)",e.style.cursor="pointer",e.style.padding="2px 8px",e.style.fontSize="16px",e.style.lineHeight="1"}function ie(e,t){let n=document.createElement("div");return n.className="pf-chart-tooltip",e.appendChild(n),e.addEventListener("mouseleave",()=>{n.classList.remove("pf-visible")}),{wrapper:e,tooltip:n,svgEl:t}}function rr(e,t,n,r,o){let{tooltip:i,svgEl:s,wrapper:a}=e;if(o.length===0)return;let l="";if(r)l+=`<div class="pf-chart-tooltip-label">${Q(r)}</div>`;for(let y of o)l+='<div class="pf-chart-tooltip-row">',l+=`<span class="pf-chart-tooltip-dot" style="background:${Q(y.color)}"></span>`,l+=`<span>${Q(y.label)}:</span> <strong>${Q(String(y.value))}</strong>`,l+="</div>";i.innerHTML=l;let c=s.getBoundingClientRect(),d=a.getBoundingClientRect(),f=s.viewBox.baseVal,u=c.width/(f.width||1),g=c.left-d.left+t*u,C=i.offsetWidth||100,h=g+12;if(h+C>d.width)h=g-C-12;i.style.left=`${Math.max(0,h)}px`,i.style.top="4px",i.classList.add("pf-visible")}function or(e){e.tooltip.classList.remove("pf-visible")}function ir(e,t,n){e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",n),e.addEventListener("touchstart",t,{passive:!0}),e.addEventListener("touchend",n,{passive:!0})}function ye(e,t,n,r,o,i){ir(e,()=>{rr(t,n,r,o,i)},()=>{or(t)})}function sr(e,t){let{data:n,series:r,xAxisKey:o,formatValue:i,formatLabel:s}=e,a=o?n[t][o]:void 0,l=a!=null?s?s(a):k(a):void 0,c=r.map((d,f)=>({label:d.label??d.dataKey,value:i(n[t][d.dataKey],d,f),color:d.color??_[f%_.length]}));return{label:l,entries:c}}function ar(e,t,n){let r=N("rect",{x:e,y:n.plotTop,width:t,height:n.plotHeight,fill:"transparent"});return r.style.cursor="default",r}function lr(e,t,n,r,o,i,s,a){let l={data:n,series:r,xAxisKey:i,formatValue:s,formatLabel:a},c=o.plotWidth/n.length;for(let d=0;d<n.length;d++){let f=o.plotLeft+d*c,u=ar(f,c,o),{label:g,entries:C}=sr(l,d);ye(u,e,f+c/2,o.plotTop,g,C),t.appendChild(u)}}function cr(e,t,n,r,o,i,s,a,l,c){let d={data:n,series:r,xAxisKey:i,formatValue:s,formatLabel:c},f=n.length===1?o.plotWidth:o.plotWidth/(n.length-1);for(let u=0;u<n.length;u++){let g=n.length===1?(o.plotLeft+o.plotRight)/2:o.plotLeft+u/(n.length-1)*o.plotWidth,C=Math.max(o.plotLeft,n.length===1?o.plotLeft:g-f/2),h=ar(C,Math.min(f,o.plotRight-C),o),{label:y,entries:T}=sr(d,u);ir(h,()=>{if(rr(e,g,o.plotTop,y,T),a)a.setAttribute("x1",String(g)),a.setAttribute("x2",String(g)),a.setAttribute("opacity","1");if(l)for(let x of l){for(let S of x)S.setAttribute("data-visible","false");x[u]?.setAttribute("data-visible","true")}},()=>{if(or(e),a)a.setAttribute("opacity","0");if(l)for(let x of l)for(let S of x)S.setAttribute("data-visible","false")}),t.appendChild(h)}}function ve(e,t){return z(K(e.data,t))}function dr(e,t){let n=K(e.data,t);if(!Array.isArray(n))return;let r=n.filter((o)=>typeof o==="number"&&Number.isFinite(o));return r.length>0?r:void 0}function fs(e){return e==="left"||e==="right"?e:void 0}function ms(e){if(!E(e)||typeof e.dataKey!=="string")return;let t=b(e.label),n=b(e.color),r=fs(e.yAxisId),o=b(e.tooltipFormat);return{dataKey:e.dataKey,...t!==void 0&&{label:t},...n!==void 0&&{color:n},...r!==void 0&&{yAxisId:r},...o!==void 0&&{tooltipFormat:o}}}function xe(e){if(!Array.isArray(e.series))return[];return e.series.flatMap((t)=>{let n=ms(t);return n?[n]:[]})}function pe(e,t){return D(e.height)??t}function _e(e,t){return Math.max(...e.flatMap((n)=>t.map((r)=>Number(n[r.dataKey]??0))),1)}function _t(e,t){return{valueKey:b(e.dataKey)??t[0]?.dataKey,nameKey:b(e.nameKey)??b(e.tooltipXKey)??b(e.xAxis)}}function Jt(e,t){return{rows:ve(e,t),series:xe(e),height:pe(e,300),showYAxis:e.showYAxis!==!1,showGrid:e.showGrid===!0,showYAxisRight:e.showYAxisRight===!0,showTooltip:e.showTooltip!==!1,showLegend:e.showLegend!==!1,xAxisKey:b(e.xAxis),tooltipXKey:b(e.tooltipXKey),xAxisFormat:b(e.xAxisFormat),tooltipXFormat:b(e.tooltipXFormat),yAxisRightFormat:b(e.yAxisRightFormat)}}function pr(e,t,n,r){let o=t.series.filter((f)=>f.yAxisId!=="right"),i=t.series.filter((f)=>f.yAxisId==="right"),s=t.showYAxisRight&&i.length>0,a=o.length>0?_e(t.rows,o):1,l=s?_e(t.rows,i):1,c=st(r,t.height,t.showYAxis,s),d=re(r,t.height,n);if(t.showYAxis)In(d,c,a,t.showGrid,Ve(e));if(s)Fn(d,c,l,t.yAxisRightFormat);return lt(d,c),{layout:c,svg:d,leftMax:a,rightMax:l}}function dt(e,t){return e?(n)=>Se(n,e,t):void 0}function ur(e,t,n=ae){let r=m("div","pf-chart pf-bar-chart"),o=Jt(e,t),{rows:i,series:s}=o;if(i.length===0||s.length===0)return r.textContent="No chart data",r;let{layout:a,svg:l,leftMax:c,rightMax:d}=pr(e,o,"Bar",n),f=a.plotWidth/i.length,u=f/(s.length+1);for(let g=0;g<i.length;g++)for(let C=0;C<s.length;C++){let h=s[C],y=i[g][h.dataKey];if(y===null||y===void 0)continue;let T=h.yAxisId==="right"?d:c,w=Math.max(0,Number(y)/T*a.plotHeight),R=a.plotLeft+g*f+C*u+u/2;l.appendChild(N("rect",{x:R,y:a.plotBottom-w,width:u*0.8,height:w,fill:h.color??_[C%_.length],rx:2}))}if(o.xAxisKey)Pt(l,i,o.xAxisKey,(g)=>a.plotLeft+g*f+f/2,a.plotBottom,dt(o.xAxisFormat,t));if(o.showTooltip){let g=ie(r,l),C=$t(t,Ve(e),o.yAxisRightFormat);lr(g,l,i,s,a,o.tooltipXKey??o.xAxisKey,C,dt(o.tooltipXFormat,t))}return oe(r,s,o.showLegend),r.appendChild(l),r}function gs(e,t,n,r){let o=[],i=()=>{if(o.length<2){o=[];return}let s=`M ${o[0].x},${n} `+o.map((a)=>`L ${a.x},${a.y}`).join(" ")+` L ${o[o.length-1].x},${n} Z`;e.appendChild(N("path",{d:s,fill:r,opacity:0.15})),o=[]};for(let s of t){if(s.isNull){i();continue}o.push(s)}i()}function hs(e,t,n,r){let o="";for(let i of t){if(i.isNull)continue;let s=t.indexOf(i),a=s===0||t[s-1].isNull;o+=`${a?"M":"L"} ${i.x},${i.y} `}if(!o)return;e.appendChild(N("path",{d:o.trim(),fill:"none",stroke:n,"stroke-width":2,...r?{"stroke-dasharray":"6 3"}:{}}))}function bs(e,t,n){let r=[];for(let o of t){let i=N("circle",{cx:o.x,cy:o.y,r:4,fill:n,class:"pf-data-dot","data-visible":"false"});if(i.style.pointerEvents="none",o.isNull)i.style.display="none";e.appendChild(i),r.push(i)}return r}function Cs(e,t){let n=N("line",{class:"pf-crosshair",x1:t.plotLeft,x2:t.plotLeft,y1:t.plotTop,y2:t.plotBottom,stroke:X,"stroke-width":1,"stroke-dasharray":"3 3",opacity:0});return e.appendChild(n),n}function Kt(e,t,n=ae){let r=m("div",`pf-chart pf-${e.type.toLowerCase()}-chart`),o=Jt(e,t),{rows:i,series:s}=o;if(i.length===0||s.length===0)return r.textContent="No chart data",r;let a=e.type==="AreaChart",{layout:l,svg:c,leftMax:d,rightMax:f}=pr(e,o,a?"Area":"Line",n),u=(h)=>i.length===1?(l.plotLeft+l.plotRight)/2:l.plotLeft+h/(i.length-1)*l.plotWidth,g=[];for(let h=0;h<s.length;h++){let y=s[h],T=y.yAxisId==="right",w=T?f:d,R=y.color??_[h%_.length],x=i.map((S,L)=>{let j=S[y.dataKey],H=j===null||j===void 0,V=H?l.plotBottom:l.plotBottom-Number(j)/w*l.plotHeight;return{x:u(L),y:V,isNull:H}});if(a)gs(c,x,l.plotBottom,R);hs(c,x,R,T),g.push(bs(c,x,R))}let C=Cs(c,l);if(o.xAxisKey)Pt(c,i,o.xAxisKey,u,l.plotBottom,dt(o.xAxisFormat,t));if(o.showTooltip){let h=ie(r,c),y=$t(t,Ve(e),o.yAxisRightFormat);cr(h,c,i,s,l,o.tooltipXKey??o.xAxisKey,y,C,g,dt(o.tooltipXFormat,t))}return oe(r,s,o.showLegend),r.appendChild(c),r}function fr(e,t){let n=m("div","pf-chart pf-pie-chart"),r=ve(e,t),o=xe(e),i=Math.min(pe(e,300),300),s=e.showTooltip!==!1,{valueKey:a,nameKey:l}=_t(e,o),c=o.length>0?o:a?[{dataKey:a,label:a}]:[];if(r.length===0||!a)return n.textContent="No chart data",n;let d=re(i,i,"Pie"),f=i/2,u=i/2,g=i/2-10,C=b(e.tooltipXFormat),h=Ae(e,t),y=r.map((x)=>Number(x[a]??0)),T=y.reduce((x,S)=>x+S,0);if(T===0)return n.textContent="No chart data",n.appendChild(d),n;let w=s?ie(n,d):void 0,R=-Math.PI/2;for(let x=0;x<y.length;x++){let S=y[x]/T*2*Math.PI,L=R+S,j=S>Math.PI?1:0,H=f+g*Math.cos(R),V=u+g*Math.sin(R),ee=f+g*Math.cos(L),te=u+g*Math.sin(L),Y=_[x%_.length],ne=N("path",{d:`M ${f},${u} L ${H},${V} A ${g},${g} 0 ${j} 1 ${ee},${te} Z`,fill:Y});if(ne.style.cursor="default",w){let ke=l?r[x][l]:void 0,O=ke!=null?C?Se(ke,C,t):k(ke):`Slice ${x+1}`,ue=`${(y[x]/T*100).toFixed(1)}%`,se=f+g*0.6*Math.cos(R+S/2);ye(ne,w,se,u,O,[{label:c[0].label??a,value:`${h(y[x])} (${ue})`,color:Y}])}d.appendChild(ne),R=L}return oe(n,c,e.showLegend!==!1),n.appendChild(d),n}function mr(e,t){let n=m("div","pf-chart pf-radial-chart"),r=ve(e,t),o=xe(e),{valueKey:i,nameKey:s}=_t(e,o);if(r.length===0||!i)return n.textContent="No chart data",n;let a=Math.min(pe(e,300),300),l=a/2,c=a/2,d=a/2-10,f=Math.max(0,Math.min(D(e.innerRadius)??30,d-10)),u=D(e.startAngle)??180,g=D(e.endAngle)??0,C=r.map((L)=>Number(L[i]??0)),h=Math.max(...C,1),y=re(a,a,"Radial"),T=(d-f)/r.length,w=Math.max(2,T*0.7),R=Ae(e,t),x=e.showTooltip!==!1?ie(n,y):void 0,S=[];for(let L=0;L<r.length;L++){let j=d-T*L-T/2,H=o[L]?.color??_[L%_.length],V=u+C[L]/h*(g-u),ee=s?r[L][s]:null,te=ee!=null?k(ee):o[L]?.label??i;S.push({dataKey:te||i,label:te||i,color:H}),y.appendChild(N("path",{d:Dt(l,c,j,u,g),fill:"none",stroke:ge,"stroke-width":w,"stroke-linecap":"round"}));let Y=N("path",{d:Dt(l,c,j,u,V),fill:"none",stroke:H,"stroke-width":w,"stroke-linecap":"round"});if(x){let ne=he(l,c,j,(u+V)/2);ye(Y,x,ne.x,ne.y,te||i,[{label:i,value:R(C[L]),color:H}])}y.appendChild(Y)}return oe(n,S,e.showLegend!==!1),n.appendChild(y),n}function gr(e,t){let n=m("div","pf-chart pf-radar-chart"),r=ve(e,t),o=xe(e),i=b(e.axisKey)??b(e.xAxis);if(r.length===0||o.length===0)return n.textContent="No chart data",n;let s=e.filled!==!1,a=e.showDots===!0,l=e.showGrid!==!1,c=Math.min(pe(e,300),320),d=c/2,f=c/2,u=c/2-24,g=r.length,C=_e(r,o),h=(x)=>90-360*x/g,y=(x)=>x.map((S)=>`${S.x.toFixed(1)},${S.y.toFixed(1)}`).join(" "),T=re(c,c,"Radar");if(l){for(let S=1;S<=4;S++){let L=u*S/4,j=Array.from({length:g},(H,V)=>he(d,f,L,h(V)));T.appendChild(N("polygon",{points:y(j),fill:"none",stroke:ge,"stroke-width":1}))}for(let S=0;S<g;S++){let L=he(d,f,u,h(S));T.appendChild(N("line",{x1:d,y1:f,x2:L.x,y2:L.y,stroke:ge,"stroke-width":1}))}}for(let x=0;x<g;x++){let S=he(d,f,u+12,h(x)),L=i?r[x][i]:null;T.appendChild(Be({x:S.x,y:S.y+3,"text-anchor":"middle","font-size":le,fill:X},k(L)))}let w=e.showTooltip!==!1?ie(n,T):void 0,R=Ae(e,t);for(let x=0;x<o.length;x++){let S=o[x],L=S.color??_[x%_.length],j=r.map((H,V)=>he(d,f,Number(H[S.dataKey]??0)/C*u,h(V)));if(T.appendChild(N("polygon",{points:y(j),fill:s?L:"none","fill-opacity":s?0.2:0,stroke:L,"stroke-width":2})),!a&&!w)continue;for(let H=0;H<j.length;H++){let V=N("circle",{cx:j[H].x,cy:j[H].y,r:a?3:6,fill:a?L:"transparent","fill-opacity":a?1:0});if(w){let ee=i?r[H][i]:null,te=ee!=null?k(ee):S.label??S.dataKey,Y=[{label:S.label??S.dataKey,value:R(Number(r[H][S.dataKey]??0)),color:L}];ye(V,w,j[H].x,j[H].y,te,Y)}T.appendChild(V)}}return oe(n,o,e.showLegend!==!1),n.appendChild(T),n}var hr=(e)=>String(Math.round(e*100)/100);function br(e,t,n=ae){let r=m("div","pf-chart pf-scatter-chart"),o=ve(e,t),i=b(e.xAxis),s=b(e.yAxis),a=b(e.zAxis),l=xe(e),c=pe(e,300);if(o.length===0||!i||!s)return r.textContent="No chart data",r;let d=e.showGrid!==!1,f=l[0]?.color??_[0],u=Ae(e,t,hr),g=o.map((O)=>Number(O[i]??0)),C=o.map((O)=>Number(O[s]??0)),h=at(Math.min(...g),Math.max(...g),5),y=at(Math.min(...C),Math.max(...C),4),T=h[0],w=h[h.length-1]-T||1,R=y[0],x=y[y.length-1]-R||1,S=a?o.map((O)=>Number(O[a]??0)):[],L=a?Math.max(...S,1):1,j=a?18:4,H=st(n,c,!0),V=re(n,c,"Scatter"),ee=H.plotLeft+j,te=Math.max(1,H.plotWidth-j*2),Y=(O)=>ee+(O-T)/w*te,ne=(O)=>H.plotBottom-(O-R)/x*H.plotHeight;for(let O=0;O<y.length;O++){let ue=y[O],se=ne(ue);if(V.appendChild(Be({x:H.plotLeft-6,y:se+3,"text-anchor":"end","font-size":le,fill:X},u(ue))),d&&O>0)V.appendChild(N("line",{x1:H.plotLeft,y1:se,x2:H.plotRight,y2:se,stroke:ge,"stroke-width":1,"stroke-dasharray":"4 3"}))}lt(V,H);for(let O of h)V.appendChild(Be({x:Y(O),y:H.plotBottom+14,"text-anchor":"middle","font-size":le,fill:X},hr(O)));let ke=e.showTooltip!==!1?ie(r,V):void 0;for(let O=0;O<o.length;O++){let ue=Y(g[O]),se=ne(C[O]),jr=a?4+Math.sqrt(S[O]/L)*14:4,tn=N("circle",{cx:ue,cy:se,r:jr,fill:f,"fill-opacity":a?0.6:0.85});if(ke){let Vr=[{label:i,value:u(g[O]),color:f},{label:s,value:u(C[O]),color:f},...a?[{label:a,value:u(S[O]),color:f}]:[]],Br=l[0]?.label??"Point";ye(tn,ke,ue,se,Br,Vr)}V.appendChild(tn)}return oe(r,l,e.showLegend!==!1),r.appendChild(V),r}function Cr(e,t,n=ae){let r=m("div","pf-chart pf-histogram"),o=dr(e,t);if(!o)return r.textContent="No data",r;let i=D(e.bins)??10,s=pe(e,200),a=b(e.color)??_[0],l=Math.min(...o),d=(Math.max(...o)-l)/i||1,f=Array(i).fill(0);for(let h of o){let y=Math.min(Math.floor((h-l)/d),i-1);f[y]++}let u=Math.max(...f),g=n/i,C=re(n,s,"Histogram");for(let h=0;h<i;h++){let y=u>0?f[h]/u*s:0;C.appendChild(N("rect",{x:h*g,y:s-y,width:g-1,height:y,fill:a}))}return r.appendChild(C),r}function yr(){p("BarChart",Me(ur)),p("LineChart",Me(Kt)),p("AreaChart",Me(Kt)),p("PieChart",fr),p("RadarChart",gr),p("ScatterChart",Me(br)),p("RadialChart",mr),p("Histogram",Me(Cr))}function xr(){p("Table",ys),p("TableHead",(e,t)=>zt(e)?pt("thead",e,t):vr(e,t)),p("TableHeader",(e,t)=>zt(e)?pt("thead",e,t):vr(e,t)),p("TableBody",(e,t)=>pt("tbody",e,t)),p("TableFooter",(e,t)=>pt("tfoot",e,t)),p("TableRow",vs),p("TableCell",xs),p("TableCaption",ws),p("ExpandableRow",ks)}function zt(e){return(e.children?.length??0)>0}function ys(e,t){let n=document.createElement("table");n.className=e.striped===!0?"pf-table pf-table-striped":"pf-table",M(e,n,t);let r=Array.from(n.children).find((o)=>o.tagName==="CAPTION");if(r&&r!==n.firstChild)n.insertBefore(r,n.firstChild);return n}function pt(e,t,n){let r=document.createElement(e);return r.className=`pf-${e}`,M(t,r,n),r}function vs(e,t){let n=document.createElement("tr");return n.className="pf-table-row",M(e,n,t),n}function vr(e,t){let n=document.createElement("th");return n.className="pf-table-header",n.setAttribute("scope","col"),n.textContent=v(e.content,t),n}function xs(e,t){let n=document.createElement("td");if(n.className="pf-table-cell",e.colSpan!=null)n.colSpan=Number(e.colSpan);if(e.rowSpan!=null)n.rowSpan=Number(e.rowSpan);if(e.content!=null&&!zt(e))n.textContent=v(e.content,t);else M(e,n,t);return n}function ws(e,t){let n=document.createElement("caption");return n.className="pf-table-caption",n.textContent=v(e.content,t),n}function ks(e,t){let n=m("div","pf-expandable-row"),r=m("div","pf-expandable-row-summary");if(r.setAttribute("role","button"),r.setAttribute("aria-expanded","false"),r.tabIndex=0,r.appendChild(m("span","pf-expandable-arrow")),typeof e.summary==="string"){let a=m("span");a.textContent=v(e.summary,t),r.appendChild(a)}else for(let a of fe(e.summary))r.appendChild(B(a,t));let o=m("div","pf-expandable-row-detail");o.style.display="none",M(e,o,t);let i=!1,s=()=>{i=!i,o.style.display=i?"block":"none",r.setAttribute("aria-expanded",i?"true":"false")};return r.addEventListener("click",s),r.addEventListener("keydown",(a)=>{if(a.key==="Enter"||a.key===" ")a.preventDefault(),s()}),n.appendChild(r),n.appendChild(o),n}var wr=!1;function ut(){if(wr)return;wr=!0;let e=new Set(Nt());Mn(),Hn(),$n(),jn(),Kn(),Gn(),qn(),Un(),Zn(),Qn(),nr(),yr(),xr(),En(Nt().filter((t)=>!e.has(t)))}function Gt(e){return e.replace(/[^a-zA-Z0-9_-]/g,"")}function qt(e){return e.replace(/[{}<>;]/g,"").replace(/\b(url|expression)\s*\(/gi,"")}function Wt(e,t=" "){return Object.entries(e).map(([n,r])=>`${t}--${Gt(n)}: ${qt(r)};`).join(`
|
|
7
|
-
`)}function
|
|
8
|
-
${
|
|
9
|
-
}`);if(e.dark&&Object.keys(e.dark).length>0){let n=
|
|
4
|
+
`)}</code></pre>`);continue}if(/^(\s*[-*_]\s*){3,}$/.test(o)){n.push("<hr />"),r++;continue}let i=/^(#{1,6})\s+(.+)$/.exec(o);if(i){let a=i[1].length;n.push(`<h${a}>${dt(i[2])}</h${a}>`),r++;continue}if(o.startsWith("> ")||o===">"){let a=[];while(r<t.length&&(t[r].startsWith("> ")||t[r]===">"))a.push(t[r].replace(/^>\s?/,"")),r++;n.push(`<blockquote>${Vn(a.join(`
|
|
5
|
+
`))}</blockquote>`);continue}if(/^[\s]*[-*+]\s+/.test(o)){n.push("<ul>");while(r<t.length&&/^[\s]*[-*+]\s+/.test(t[r]))n.push(`<li>${dt(t[r].replace(/^[\s]*[-*+]\s+/,""))}</li>`),r++;n.push("</ul>");continue}if(/^[\s]*\d+\.\s+/.test(o)){n.push("<ol>");while(r<t.length&&/^[\s]*\d+\.\s+/.test(t[r]))n.push(`<li>${dt(t[r].replace(/^[\s]*\d+\.\s+/,""))}</li>`),r++;n.push("</ol>");continue}if(o.trim()===""){r++;continue}let s=[];while(r<t.length&&t[r].trim()!==""&&!/^#{1,6}\s/.test(t[r])&&!/^[-*+]\s/.test(t[r])&&!/^\d+\.\s/.test(t[r])&&!t[r].startsWith("> ")&&!t[r].trimStart().startsWith("```")&&!/^(\s*[-*_]\s*){3,}$/.test(t[r]))s.push(t[r]),r++;n.push(`<p>${s.map(dt).join("<br />")}</p>`)}return n.join(`
|
|
6
|
+
`)}function mi(e,t){let n=document.createElement("kbd");return n.className="pf-kbd",n.textContent=C(e.content,t),n}function _n(){p("Card",hi),p("CardHeader",Dt("pf-card-header")),p("CardTitle",Bn("pf-card-title","h3")),p("CardDescription",Bn("pf-card-description","p")),p("CardContent",Dt("pf-card-content")),p("CardFooter",Dt("pf-card-footer"))}function hi(e,t){let n=f("div","pf-card");return L(e,n,t),n}function Dt(e){return(t,n)=>{let r=f("div",e);return L(t,r,n),r}}function Bn(e,t){return(n,r)=>{let o=document.createElement(t);return o.className=e,o.textContent=C(n.content,r),o}}var _=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899"],X="var(--muted-foreground, #6b7280)",ge="var(--border, #e5e7eb)",ee="11";function Be(e,t,n,r=!1){let o=n?44:0,i=e-(r?44:0),s=10,a=t-24;return{plotLeft:o,plotRight:i,plotTop:10,plotBottom:a,plotWidth:i-o,plotHeight:a-10}}function gi(e,t){let n=e/t,r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o<=1.5?1:o<=3?2:o<=7?5:10)*r}function zn(e,t=5){if(e<=0)return[0];return _e(0,e,t)}function _e(e,t,n=4){let r=t>e?t:e+1,o=gi(r-e,n),i=Math.floor(e/o)*o,s=[];for(let a=i;a<=r+o*0.01||s.length<2;a+=o)s.push(Math.round(a*1000)/1000);return s}function pt(e,t,n,r,o){let i=zn(n);for(let s of i){let a=t.plotBottom-(n>0?s/n*t.plotHeight:0),l=H("text",{x:t.plotLeft-6,y:a+3,"text-anchor":"end","font-size":ee,fill:X});if(l.textContent=It(s,o),e.appendChild(l),r&&s>0)e.appendChild(H("line",{x1:t.plotLeft,y1:a,x2:t.plotRight,y2:a,stroke:ge,"stroke-width":1,"stroke-dasharray":"4 3"}))}}function Jn(e,t,n,r){let o=zn(n);for(let i of o){let s=t.plotBottom-(n>0?i/n*t.plotHeight:0),a=H("text",{x:t.plotRight+6,y:s+3,"text-anchor":"start","font-size":ee,fill:X});a.textContent=It(i,r),e.appendChild(a)}}function Ft(e,t,n,r,o,i){let s=t.map((d)=>{let u=d[n];return u==null?"":i?i(u):T(u)}),a=t.length>1?Math.abs(r(t.length-1)-r(0))/(t.length-1):1/0,l=Math.max(1,...s.map((d)=>d.length))*Number(ee)*0.6+8,c=Math.max(1,Math.ceil(l/a));for(let d=0;d<t.length;d++){if(d%c!==0)continue;let u=H("text",{x:r(d),y:o+14,"text-anchor":"middle","font-size":ee,fill:X});u.textContent=s[d],e.appendChild(u)}}function ze(e,t){e.appendChild(H("line",{x1:t.plotLeft,y1:t.plotBottom,x2:t.plotRight,y2:t.plotBottom,stroke:X,"stroke-width":1}))}function Te(e,t,n){if(e==null)return"";let r=J(`{{ __v | ${t} }}`,{...n,scope:{...n.scope,__v:e}});return T(r??e)}function It(e,t){if(t==="currency")return`$${e.toLocaleString()}`;if(t==="percent")return`${e}%`;if(e>=1e6)return`${(e/1e6).toFixed(1)}M`;if(e>=1000)return`${(e/1000).toFixed(1)}K`;return String(e)}function Je(e){let t=b(e.yAxisFormat)??b(e.valueFormat);return t&&t!=="auto"?t:void 0}function Ae(e,t,n=String){let r=Je(e);return(o)=>r?Te(o,r,t):n(o)}function jt(e,t,n){return(r,o)=>{if(r===null||r===void 0)return"—";if(o.tooltipFormat)return Te(r,o.tooltipFormat,e);let i=o.yAxisId==="right"?n:t;return It(Number(r),i)}}function ie(e,t,n){return H("svg",{width:e,height:t,viewBox:`0 0 ${e} ${t}`,role:"img",...n?{"aria-label":`${n} chart`}:{}})}var le=400,bi=160;function Se(e){return(t,n)=>{let r=e(t,n,le);if(typeof ResizeObserver>"u")return r;let o=le,i=0,s=(l)=>{if(!r.isConnected)return;o=l;let c=e(t,n,l);a.unobserve(r),r.replaceWith(c),r=c,a.observe(r)},a=new ResizeObserver((l)=>{let c=Math.floor(l[0]?.contentRect.width??0);if(c<bi||Math.abs(c-o)<1)return;cancelAnimationFrame(i),i=requestAnimationFrame(()=>{s(c)})});return a.observe(r),{element:r,destroy:()=>{cancelAnimationFrame(i),a.disconnect()}}}}function H(e,t){let n=document.createElementNS("http://www.w3.org/2000/svg",e);for(let[r,o]of Object.entries(t))n.setAttribute(r,String(o));return n}function Le(e,t){let n=H("text",e);return n.textContent=t,n}function be(e,t,n,r){let o=r*Math.PI/180;return{x:e+n*Math.cos(o),y:t-n*Math.sin(o)}}function Vt(e,t,n,r,o){let i=Math.max(2,Math.ceil(Math.abs(o-r)/4)),s=[];for(let a=0;a<=i;a++){let l=be(e,t,n,r+(o-r)*a/i);s.push(`${a===0?"M":"L"} ${l.x.toFixed(2)} ${l.y.toFixed(2)}`)}return s.join(" ")}function se(e,t,n){if(!n||t.length<=1)return;let r=f("div","pf-chart-legend");for(let o=0;o<t.length;o++){let i=f("div","pf-chart-legend-item"),s=f("span","pf-chart-legend-dot");s.style.backgroundColor=t[o].color??_[o%_.length];let a=f("span");a.textContent=t[o].label??t[o].dataKey,i.appendChild(s),i.appendChild(a),r.appendChild(i)}e.appendChild(r)}var yi=["accountCircle","add","arrowBack","arrowForward","attachFile","calendarToday","call","camera","check","close","delete","download","edit","event","error","fastForward","favorite","favoriteOff","folder","help","home","info","locationOn","lock","lockOpen","mail","menu","moreVert","moreHoriz","notificationsOff","notifications","pause","payment","person","phone","photo","play","print","refresh","rewind","search","send","settings","share","shoppingCart","skipNext","skipPrevious","star","starHalf","starOff","stop","upload","visibility","visibilityOff","volumeDown","volumeMute","volumeOff","volumeUp","warning"],Ci=new Map(yi.map((e)=>[Kn(e),e])),vi={alertcircle:"error",alerttriangle:"warning",alertoctagon:"error",xcircle:"error",circlex:"error",circlealert:"error",checkcircle:"check",circlecheck:"check",checkcircle2:"check",infocircle:"info",circleinfo:"info",helpcircle:"help",circlehelp:"help",bell:"notifications",belloff:"notificationsOff",arrowleft:"arrowBack",arrowright:"arrowForward",chevronleft:"arrowBack",chevronright:"arrowForward",x:"close",plus:"add",trash:"delete",trash2:"delete",ellipsisvertical:"moreVert",ellipsis:"moreHoriz",morehorizontal:"moreHoriz",morevertical:"moreVert",pencil:"edit",pen:"edit",squarepen:"edit",user:"person",usercircle:"accountCircle",circleuser:"accountCircle",eye:"visibility",eyeoff:"visibilityOff",mappin:"locationOn",map:"locationOn",image:"photo",images:"photo",file:"folder",files:"folder",calendar:"calendarToday",calendardays:"calendarToday",clock:"event",creditcard:"payment",cart:"shoppingCart",shoppingbag:"shoppingCart",phonecall:"call",mailopen:"mail",inbox:"mail",cog:"settings",gear:"settings",sliders:"settings",rotatecw:"refresh",rotateccw:"refresh",refreshcw:"refresh",heart:"favorite",heartoff:"favoriteOff",volume:"volumeUp",volume1:"volumeDown",volume2:"volumeUp",volumex:"volumeOff",skipforward:"skipNext",skipback:"skipPrevious",paperclip:"attachFile",link:"share",share2:"share",magnifyingglass:"search",searchicon:"search"};function Kn(e){return e.replace(/[\s._-]/g,"").toLowerCase()}function Wn(e){let t=Kn(e);return Ci.get(t)??vi[t]}var Bt={accountCircle:'<path d="M18 20a6 6 0 0 0-12 0"/><circle cx="12" cy="10" r="4"/><circle cx="12" cy="12" r="10"/>',add:'<path d="M5 12h14"/><path d="M12 5v14"/>',arrowBack:'<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>',arrowForward:'<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',attachFile:'<path d="M13.234 20.252 21 12.3"/><path d="m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486"/>',calendarToday:'<path d="M8 2v4"/><path d="M16 2v4"/><rect width="18" height="18" x="3" y="4" rx="2"/><path d="M3 10h18"/>',call:'<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/>',camera:'<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>',check:'<path d="M20 6 9 17l-5-5"/>',close:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',delete:'<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/>',download:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/>',edit:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',event:'<path d="M8 2v4"/><path d="M16 2v4"/><rect width="18" height="18" x="3" y="4" rx="2"/><path d="M3 10h18"/><path d="M8 14h.01"/><path d="M12 14h.01"/><path d="M16 14h.01"/><path d="M8 18h.01"/><path d="M12 18h.01"/><path d="M16 18h.01"/>',error:'<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',fastForward:'<polygon points="13 19 22 12 13 5 13 19"/><polygon points="2 19 11 12 2 5 2 19"/>',favorite:'<path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"/>',favoriteOff:'<line x1="2" y1="2" x2="22" y2="22"/><path d="M16.5 16.5 12 21l-7-7c-1.5-1.45-3-3.2-3-5.5a5.5 5.5 0 0 1 2.14-4.35"/><path d="M8.76 3.1c1.15.22 2.13.78 3.24 1.9 1.5-1.5 2.74-2 4.5-2A5.5 5.5 0 0 1 22 8.5c0 2.12-1.3 3.78-2.67 5.17"/>',folder:'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',help:'<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',home:'<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',locationOn:'<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/>',lock:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',lockOpen:'<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',mail:'<rect width="20" height="16" x="2" y="4" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>',menu:'<line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/>',moreVert:'<circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/>',moreHoriz:'<circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/>',notificationsOff:'<path d="M10.268 21a2 2 0 0 0 3.464 0"/><path d="M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742"/><path d="m2 2 20 20"/><path d="M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05"/>',notifications:'<path d="M10.268 21a2 2 0 0 0 3.464 0"/><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"/>',pause:'<rect x="14" y="4" width="4" height="16" rx="1"/><rect x="6" y="4" width="4" height="16" rx="1"/>',payment:'<rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/>',person:'<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',phone:'<rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/>',photo:'<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',play:'<polygon points="6 3 20 12 6 21 6 3"/>',print:'<path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><path d="M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6"/><rect x="6" y="14" width="12" height="8" rx="1"/>',refresh:'<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>',rewind:'<polygon points="11 19 2 12 11 5 11 19"/><polygon points="22 19 13 12 22 5 22 19"/>',search:'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',send:'<path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/>',settings:'<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>',share:'<circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" x2="15.42" y1="13.51" y2="17.49"/><line x1="15.41" x2="8.59" y1="6.51" y2="10.49"/>',shoppingCart:'<circle cx="8" cy="21" r="1"/><circle cx="19" cy="21" r="1"/><path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"/>',skipNext:'<polygon points="5 4 15 12 5 20 5 4"/><line x1="19" x2="19" y1="5" y2="19"/>',skipPrevious:'<polygon points="19 20 9 12 19 4 19 20"/><line x1="5" x2="5" y1="19" y2="5"/>',star:'<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/>',starHalf:'<path d="M12 18.338a2.1 2.1 0 0 0-.987.244L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16l2.309-4.679A.53.53 0 0 1 12 2"/>',starOff:'<path d="M8.34 8.34 2 9.27l5 4.87L5.82 21 12 17.77 18.18 21l-.59-3.43"/><path d="M18.42 12.76 22 9.27l-6.91-1L12 2l-1.44 2.91"/><line x1="2" x2="22" y1="2" y2="22"/>',stop:'<rect width="18" height="18" x="3" y="3" rx="2"/>',upload:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" x2="12" y1="3" y2="15"/>',visibility:'<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',visibilityOff:'<path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"/><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"/><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"/><path d="m2 2 20 20"/>',volumeDown:'<path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"/><path d="M16 9a5 5 0 0 1 0 6"/>',volumeMute:'<path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"/>',volumeOff:'<path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"/><line x1="22" x2="16" y1="9" y2="15"/><line x1="16" x2="22" y1="9" y2="15"/>',volumeUp:'<path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"/><path d="M16 9a5 5 0 0 1 0 6"/><path d="M19.364 18.364a9 9 0 0 0 0-12.728"/>',warning:'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>'};var xi='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">';function wi(e){let t=Wn(e);if(t==null||!(t in Bt))return;return`${xi}${Bt[t]}</svg>`}function ut(e,t){e.setAttribute("data-icon",t);let n=wi(t);if(n===void 0){if(t!=="")A.warn(`icon "${t}" has no glyph`);return}e.innerHTML=n}function Gn(){p("DataTable",ki),p("Badge",Mi),p("Dot",Ri),p("Metric",Ei),p("Ring",Ti),p("Progress",Ai),p("Separator",Si),p("Loader",Li),p("Icon",Ni),p("Sparkline",Hi)}function ki(e,t){let n=f("div","pf-datatable-wrapper"),r=document.createElement("table");r.className="pf-datatable";let o=K(e.columns).map((h)=>({key:T(h.key),header:h.header!=null?T(h.header):void 0,format:b(h.format),accessor:b(h.accessor)})),i=J(e.rows,t),s=b(e.rowKey),a=b(e.selected),l=document.createElement("thead"),c=document.createElement("tr");for(let h of o){let m=document.createElement("th");m.className="pf-datatable-th",m.setAttribute("scope","col"),m.textContent=h.header??h.key,c.appendChild(m)}l.appendChild(c),r.appendChild(l);let d=document.createElement("tbody");if(Array.isArray(i)){let h=a!=null?J(a,t):void 0;for(let m of i){let v=document.createElement("tr");v.className="pf-datatable-row";let g=m,y=E(g)?g:{},M=m===null||typeof m!=="object";if(s&&h!=null&&y[s]!=null&&T(y[s])===T(h))v.classList.add("pf-datatable-row-selected");if(e.onRowClick!=null&&s)v.classList.add("pf-datatable-row-clickable"),v.addEventListener("click",()=>{let w={...t.scope,$item:g,$index:i.indexOf(m)},k=z({...t,scope:w});j(I(e.onRowClick,k),"onRowClick")});for(let w of o){let k=document.createElement("td");k.className="pf-datatable-td";let x;if(w.accessor)x=J(`{{ $item.${w.accessor} }}`,{...t,scope:{...t.scope,$item:g}});else if(x=M?m:y[w.key],w.format&&x!=null)x=J(`{{ __fmtVal | ${w.format} }}`,{...t,scope:{...t.scope,__fmtVal:x}});k.textContent=T(x),v.appendChild(k)}d.appendChild(v)}}if(!Array.isArray(i)||i.length===0){let h=document.createElement("tr"),m=document.createElement("td");m.className="pf-datatable-empty",m.colSpan=Math.max(1,o.length),m.textContent="No results",h.appendChild(m),d.appendChild(h)}if(r.appendChild(d),e.search===!0){let h=document.createElement("input");h.type="text",h.placeholder="Search...",h.className="pf-datatable-search",h.setAttribute("aria-label","Search table"),h.addEventListener("input",()=>{let m=h.value.toLowerCase();for(let v of d.querySelectorAll("tr.pf-datatable-row"))v.style.display=v.textContent.toLowerCase().includes(m)?"":"none"}),n.appendChild(h)}let u=f("div","pf-datatable-scroll");return u.appendChild(r),n.appendChild(u),n}function Mi(e,t){let n=f("span","pf-badge"),r=b(e.variant)??"default";return n.setAttribute("data-variant",r),n.textContent=C(e.label??e.content,t),n}function Ri(e,t){let n=f("span","pf-dot"),r=b(e.color);if(r!=null)n.style.backgroundColor=r;return n}function Ei(e,t){let n=f("div","pf-metric"),r=f("div","pf-metric-label");r.textContent=C(e.label,t),n.appendChild(r);let o=f("div","pf-metric-row"),i=f("div","pf-metric-value");if(i.textContent=C(e.value,t),o.appendChild(i),e.delta!=null){let s=f("span","pf-metric-delta"),a=b(e.trend),l=a==="up"?"↑ ":a==="down"?"↓ ":"";s.textContent=l+C(e.delta,t),s.setAttribute("data-sentiment",b(e.trendSentiment)??"neutral"),o.appendChild(s)}if(n.appendChild(o),e.description!=null){let s=f("div","pf-metric-desc");s.textContent=C(e.description,t),n.appendChild(s)}return n}function Ti(e,t){let n=f("div","pf-ring");n.setAttribute("data-variant",b(e.variant)??"default");let r=O(e.size)??80,o=O(e.thickness)??8,i=Number(J(e.value,t)??0),s=Math.max(0,Math.min(100,i)),a=(r-o)/2,l=2*Math.PI*a,c=l*(1-s/100),d=H("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`}),u={cx:r/2,cy:r/2,r:a,fill:"none","stroke-width":o},h=H("circle",{...u,class:"pf-ring-track",stroke:"var(--muted, #e5e7eb)"}),m=H("circle",{...u,class:"pf-ring-fill",stroke:"var(--primary, #3b82f6)","stroke-dasharray":l,"stroke-dashoffset":c,"stroke-linecap":"round"});if(d.appendChild(h),d.appendChild(m),n.appendChild(d),n.setAttribute("role","img"),n.setAttribute("aria-label",`${String(s)}%`),e.label!=null){let v=f("div","pf-ring-label");v.textContent=C(e.label,t),n.appendChild(v)}return n}function Ai(e,t){let n=f("div","pf-progress");n.setAttribute("role","progressbar"),n.setAttribute("data-variant",b(e.variant)??"default");let r=Number(J(e.value,t)??0),o=O(e.max)??100,i=o>0?Math.max(0,Math.min(100,r/o*100)):0;n.setAttribute("aria-valuenow",String(r)),n.setAttribute("aria-valuemin","0"),n.setAttribute("aria-valuemax",String(o));let s=f("div","pf-progress-fill");return s.style.width=`${i}%`,n.appendChild(s),n}function Si(e,t){let n=document.createElement("hr");if(n.className="pf-separator",e.orientation==="vertical")n.setAttribute("data-orientation","vertical"),n.setAttribute("aria-orientation","vertical");return n}function Li(e,t){let n=f("div","pf-loader");return n.setAttribute("role","status"),n.setAttribute("aria-label","Loading"),n}function Ni(e,t){let n=f("span","pf-icon");return ut(n,C(e.name??e.content,t)),n}function Hi(e,t){let n=f("div","pf-sparkline"),r=Array.isArray(e.data)?e.data.filter((h)=>typeof h==="number"&&Number.isFinite(h)):[];if(r.length===0)return n;let o=O(e.width)??120,i=O(e.height)??32,s=Math.max(...r),a=Math.min(...r),l=s-a||1,c=H("svg",{width:o,height:i,viewBox:`0 0 ${o} ${i}`}),d=r.length>1?r.length-1:1,u=r.map((h,m)=>{let v=m/d*o,g=i-(h-a)/l*(i-4)-2;return`${v},${g}`}).join(" ");return c.appendChild(H("polyline",{points:u,fill:"none",stroke:"var(--primary, #3b82f6)","stroke-width":1.5})),n.appendChild(c),n}function Yn(){p("Form",Pi),p("Input",Oi),p("Textarea",ye($i)),p("Button",Di),p("ButtonGroup",Ne("pf-button-group")),p("Checkbox",Un("pf-checkbox")),p("Switch",Un("pf-switch")),p("Slider",ye(Fi)),p("Calendar",ye(Zn("pf-calendar"))),p("DatePicker",ye(Zn("pf-datepicker"))),p("Field",Ne("pf-field")),p("FieldTitle",He("pf-field-title")),p("FieldDescription",He("pf-field-description")),p("FieldContent",Ne("pf-field-content")),p("FieldError",He("pf-field-error"))}function Pi(e,t){let n=document.createElement("form");return n.className="pf-form",n.addEventListener("submit",(r)=>{r.preventDefault();let o=new FormData(n),i={};for(let s of new Set(o.keys())){let a=o.getAll(s),l=n.elements.namedItem(s),c=l instanceof HTMLSelectElement&&l.multiple||a.length>1;i[s]=c?a:a[0]}for(let s of n.querySelectorAll('input[type="checkbox"][name]'))i[s.name]=s.checked;if(t.store.merge(i),e.onSubmit!=null){let s=z(t);s.scope={...t.scope,...i},j(I(e.onSubmit,s),"onSubmit")}}),L(e,n,t),n}var qn=0;function ce(e,t){return qn+=1,`pf-${e}-${t??"field"}-${String(qn)}`}function Qn(e,t,n){if(t.label==null)return;let r=document.createElement("label");r.className="pf-input-label",r.textContent=C(t.label,n);let o=e.querySelector("input, select, textarea");if(o){if(!o.id)o.id=ce("control",b(t.name));r.htmlFor=o.id}if(t.required===!0)r.setAttribute("data-required","");e.insertBefore(r,e.firstChild)}function er(e,t,n){if(t.error==null||t.error===!1||t.error==="")return;let r=e.querySelector("input, select, textarea");if(r?.setAttribute("aria-invalid","true"),t.error===!0)return;let o=f("p","pf-field-error");o.id=ce("error",b(t.name)),o.textContent=C(t.error,n),r?.setAttribute("aria-describedby",o.id),e.appendChild(o)}function ye(e){return(t,n)=>{let r=e(t,n);return r.classList.add("pf-labeled"),Qn(r,t,n),er(r,t,n),r}}function Ce(e,t){if(t.required!==!0)return;if(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement)e.required=!0;e.setAttribute("aria-required","true")}function _t(e,t,n,r="input",o=()=>e.value){let i=b(t.name)??(e.name||void 0);if(!i)return;let s=n.store.get(i);if(s!=null)e.value=T(s);e.addEventListener(r,()=>{let a=o();if(n.store.set(i,a),t.onChange!=null)j(I(t.onChange,{...z(n),scope:{...n.scope,$event:a}}),"onChange")})}function Oi(e,t){let n=f("div","pf-input-wrapper"),r=document.createElement("input");if(r.className="pf-input",r.type=b(e.inputType)??"text",e.name!=null)r.name=T(e.name);if(r.id=ce("input",b(e.name)),e.placeholder!=null)r.placeholder=C(e.placeholder,t);if(e.disabled===!0)r.disabled=!0;return Ce(r,e),_t(r,e,t),n.appendChild(r),Qn(n,e,t),er(n,e,t),n}function $i(e,t){let n=f("div","pf-textarea-wrapper"),r=document.createElement("textarea");if(r.className="pf-textarea",e.name!=null)r.name=T(e.name);if(r.id=ce("textarea",b(e.name)),e.placeholder!=null)r.placeholder=C(e.placeholder,t);if(e.rows!=null)r.rows=Number(e.rows);if(e.disabled===!0)r.disabled=!0;return Ce(r,e),_t(r,e,t),n.appendChild(r),n}function Di(e,t){let n=document.createElement("button");if(n.className="pf-button",n.type=e.submit===!0?"submit":"button",n.textContent=C(e.label,t),n.setAttribute("data-variant",b(e.variant)??"default"),e.size!=null)n.setAttribute("data-size",T(e.size));if(e.disabled===!0)n.disabled=!0;return n}function Un(e){return(t,n)=>{let r=f("label",`${e}-wrapper`),o=document.createElement("input");if(o.type="checkbox",o.className=e,e==="pf-switch")o.setAttribute("role","switch");if(t.name!=null)o.name=T(t.name);if(t.checked===!0)o.checked=!0;if(t.disabled===!0)o.disabled=!0;let i=b(t.name);if(i){let s=n.store.get(i);if(typeof s==="boolean")o.checked=s;o.addEventListener("change",()=>{if(n.store.set(i,o.checked),t.onChange!=null)j(I(t.onChange,{...z(n),scope:{...n.scope,$event:o.checked}}),"onChange")})}if(r.appendChild(o),t.label!=null){let s=f("span");s.textContent=C(t.label,n),r.appendChild(s)}return r}}function Xn(e){let t=Number(e.min||0),n=Number(e.max||100),r=n>t?(Number(e.value)-t)/(n-t)*100:0;e.style.setProperty("--pf-fill",`${String(Math.round(Math.max(0,Math.min(100,r))*100)/100)}%`)}function Fi(e,t){let n=f("div","pf-slider-wrapper"),r=document.createElement("input");if(r.type="range",r.className="pf-slider",e.name!=null)r.name=T(e.name);if(e.min!=null)r.min=T(e.min);if(e.max!=null)r.max=T(e.max);if(e.step!=null)r.step=T(e.step);if(e.disabled===!0)r.disabled=!0;return _t(r,e,t,"input",()=>Number(r.value)),Xn(r),r.addEventListener("input",()=>{Xn(r)}),n.appendChild(r),n}function Ne(e){return(t,n)=>{let r=f("div",e);return L(t,r,n),r}}function He(e){return(t,n)=>{let r=f("span",e);return r.textContent=C(t.content,n),r}}function zt(){let e=document.createElement("hr");return e.className="pf-separator",e}function Zn(e){return(t,n)=>{let r=f("div",e),o=document.createElement("input");if(o.type="date",o.className="pf-input",o.name=C(t.name,n),o.id=ce("date",o.name||void 0),Ce(o,t),t.placeholder!=null)o.placeholder=C(t.placeholder,n);if(t.value!==void 0)o.value=C(t.value,n);if(t.minDate!=null)o.min=C(t.minDate,n);if(t.maxDate!=null)o.max=C(t.maxDate,n);if(t.disabled===!0)o.disabled=!0;let i=n.store.get(o.name);if(i!=null)o.value=T(i);return o.addEventListener("change",()=>{if(n.store.set(o.name,o.value),t.onChange!=null)j(I(t.onChange,z(n)),"onChange")}),r.appendChild(o),r}}function tr(){p("Select",ye(Ii)),p("SelectOption",Bi),p("SelectGroup",Ne("pf-select-group")),p("SelectLabel",He("pf-select-label")),p("SelectSeparator",zt),p("Radio",_i),p("RadioGroup",zi),p("Combobox",ye(Ji)),p("ComboboxOption",Ki),p("ComboboxGroup",Ne("pf-combobox-group")),p("ComboboxLabel",He("pf-combobox-label")),p("ComboboxSeparator",zt),p("ChoiceCard",Wi)}function Ii(e,t){let n=f("div","pf-select-wrapper"),r=document.createElement("select");if(r.className="pf-select",e.name!=null)r.name=T(e.name);if(r.id=ce("select",b(e.name)),e.multiple===!0)r.multiple=!0;if(e.disabled===!0)r.disabled=!0;if(Ce(r,e),e.placeholder!=null){let i=document.createElement("option");i.value="",i.textContent=C(e.placeholder,t),i.disabled=!0,i.selected=!0,i.hidden=!0,r.appendChild(i)}for(let i of K(e.options)){let s=document.createElement("option");s.value=T(i.value),s.textContent=i.label!=null?T(i.label):s.value,r.appendChild(s)}if(e.children)for(let i of e.children)if(i.type==="SelectOption"){let s=document.createElement("option");s.value=b(i.value)??"",s.textContent=b(i.label)??s.value,r.appendChild(s)}else r.appendChild(B(i,t));let o=b(e.name);if(o){let i=t.store.get(o);if(i!=null)Vi(r,i);r.addEventListener("change",()=>{let s=ji(r);if(t.store.set(o,s),e.onChange!=null)j(I(e.onChange,{...z(t),scope:{...t.scope,$event:s}}),"onChange")})}return n.appendChild(r),n}function ji(e){if(!e.multiple)return e.value;return Array.from(e.selectedOptions,(t)=>t.value)}function Vi(e,t){if(!e.multiple){e.value=T(t);return}let n=new Set((Array.isArray(t)?t:[t]).map((r)=>T(r)));for(let r of e.options)r.selected=n.has(r.value)}function Bi(e,t){return f("span")}function _i(e,t){let n=f("label","pf-radio"),r=document.createElement("input");if(r.type="radio",r.className="pf-radio-input",e.disabled===!0)r.disabled=!0;if(r.value=C(e.value,t),n.appendChild(r),e.label!=null){let o=f("span","pf-radio-label");o.textContent=C(e.label,t),n.appendChild(o)}return n}function zi(e,t){let n=f("fieldset","pf-radio-group");if(Ce(n,e),e.label!=null){let i=document.createElement("legend");if(i.className="pf-radio-legend",i.textContent=C(e.label,t),e.required===!0)i.setAttribute("data-required","");n.appendChild(i)}L(e,n,t);let r=C(e.name,t),o=t.store.get(r);for(let i of n.querySelectorAll('input[type="radio"]')){if(!(i instanceof HTMLInputElement))continue;if(i.name=r,o!=null&&i.value===T(o))i.checked=!0}return n.addEventListener("change",(i)=>{let s=i.target;if(s instanceof HTMLInputElement&&s.type==="radio"){if(t.store.set(r,s.value),e.onChange!=null)j(I(e.onChange,z(t)),"onChange")}}),n}function Ji(e,t){let n=f("div","pf-combobox"),r=document.createElement("input");if(r.className="pf-combobox-input",r.type="text",r.name=C(e.name,t),r.id=ce("combobox",r.name||void 0),r.autocomplete="off",r.setAttribute("role","combobox"),r.setAttribute("aria-autocomplete","list"),r.setAttribute("aria-expanded","false"),Ce(r,e),e.placeholder!=null)r.placeholder=C(e.placeholder,t);if(e.value!==void 0)r.value=C(e.value,t);if(e.disabled===!0)r.disabled=!0;let o=t.store.get(r.name);if(o!=null)r.value=T(o);let i=f("div","pf-combobox-dropdown");i.id=`${r.id}-list`,i.setAttribute("role","listbox"),i.style.display="none",r.setAttribute("aria-controls",i.id),L(e,i,t);let s=()=>Array.from(i.querySelectorAll(".pf-combobox-option")).filter((c)=>c.style.display!=="none"),a=(c)=>{if(i.style.display=c?"block":"none",r.setAttribute("aria-expanded",c?"true":"false"),!c)for(let d of s())d.setAttribute("aria-selected","false")},l=(c)=>{let d=s();if(d.length===0)return;let u=d.findIndex((m)=>m.getAttribute("aria-selected")==="true"),h=d[(u+c+d.length)%d.length];for(let m of d)m.setAttribute("aria-selected",m===h?"true":"false");h.scrollIntoView({block:"nearest"})};if(r.addEventListener("focus",()=>{a(!0)}),r.addEventListener("blur",()=>{setTimeout(()=>{a(!1)},150)}),r.addEventListener("keydown",(c)=>{if(c.key==="ArrowDown"||c.key==="ArrowUp")c.preventDefault(),a(!0),l(c.key==="ArrowDown"?1:-1);else if(c.key==="Enter"){let d=s().find((u)=>u.getAttribute("aria-selected")==="true");if(d)c.preventDefault(),d.dispatchEvent(new MouseEvent("mousedown")),a(!1)}else if(c.key==="Escape")a(!1)}),e.searchable!==!1)r.addEventListener("input",()=>{let c=r.value.toLowerCase();for(let d of i.querySelectorAll(".pf-combobox-option"))if(d instanceof HTMLElement)d.style.display=d.textContent.toLowerCase().includes(c)?"":"none";a(!0)});if(e.onChange!=null)n.addEventListener("pf-combobox-select",()=>{j(I(e.onChange,{...z(t),scope:{...t.scope,$event:r.value}}),"onChange")});return n.appendChild(r),n.appendChild(i),n}function Ki(e,t){let n=f("div","pf-combobox-option");return n.setAttribute("role","option"),n.setAttribute("aria-selected","false"),n.textContent=C(e.label??e.value,t),n.dataset.value=C(e.value,t),n.addEventListener("mousedown",()=>{let r=n.closest(".pf-combobox"),o=r?.querySelector("input");if(o)o.value=n.dataset.value??"",t.store.set(o.name,o.value),r?.dispatchEvent(new CustomEvent("pf-combobox-select",{bubbles:!1}))}),n}function Wi(e,t){let n=f("div","pf-choice-card");n.dataset.value=C(e.value,t);let r=typeof e.selected==="string"?J(e.selected,t):e.selected;if(r===!0||r==="true")n.dataset.selected="true";if(e.onClick!=null)n.setAttribute("aria-pressed",n.dataset.selected==="true"?"true":"false");if(e.label!=null){let o=f("div","pf-choice-card-label");o.textContent=C(e.label,t),n.appendChild(o)}if(e.description!=null){let o=f("div","pf-choice-card-description");o.textContent=C(e.description,t),n.appendChild(o)}return L(e,n,t),n}var de=(e)=>`${e}-${Math.random().toString(36).slice(2,8)}`;function Jt(e,t){if(!Re(e))return;let n=B(e,t);if(n instanceof HTMLElement)return n;let r=f("span","pf-trigger");return r.style.display="contents",r.appendChild(n),r}function nr(){p("Tabs",Gi),p("Tab",qi),p("Accordion",Ui),p("AccordionItem",Xi),p("Dialog",Zi),p("Popover",Yi),p("Tooltip",Qi),p("HoverCard",es),p("Carousel",ts)}function Gi(e,t){let n=f("div","pf-tabs"),r=f("div","pf-tabs-bar");r.setAttribute("role","tablist");let o=[],i=[],s=e.children??[],a=(()=>{let c=e.defaultTab;if(typeof c==="number")return c>=0&&c<s.length?c:0;if(typeof c==="string"){let d=s.findIndex((u)=>u.title===c);return d>=0?d:0}return 0})();s.forEach((c,d)=>{let u=de("pf-tab"),h=de("pf-panel"),m=document.createElement("button");m.type="button",m.className="pf-tab-trigger",m.textContent=b(c.title)??`Tab ${String(d+1)}`,m.setAttribute("role","tab"),m.setAttribute("aria-controls",h),m.id=u,m.addEventListener("click",()=>{l(d,!0)});let v=f("div","pf-tab-panel");v.setAttribute("role","tabpanel"),v.setAttribute("aria-labelledby",u),v.id=h,v.tabIndex=0,L(c,v,t),i.push(m),o.push(v),r.appendChild(m)});function l(c,d){if(i.forEach((u,h)=>{let m=h===c;u.classList.toggle("pf-tab-active",m),u.setAttribute("aria-selected",m?"true":"false"),u.tabIndex=m?0:-1,o[h].style.display=m?"block":"none"}),d)i[c]?.focus()}if(i.length>0)l(a,!1);r.addEventListener("keydown",(c)=>{let d=i.findIndex((h)=>h===c.target);if(d<0)return;let u;if(c.key==="ArrowRight")u=(d+1)%i.length;else if(c.key==="ArrowLeft")u=(d-1+i.length)%i.length;else if(c.key==="Home")u=0;else if(c.key==="End")u=i.length-1;else return;c.preventDefault(),l(u,!0)}),n.appendChild(r);for(let c of o)n.appendChild(c);return n}function qi(e,t){let n=f("div","pf-tab");return L(e,n,t),n}function Ui(e,t){let n=f("div","pf-accordion");return L(e,n,t),n}function Xi(e,t){let n=f("div","pf-accordion-item"),r=document.createElement("button");r.type="button",r.className="pf-accordion-trigger",r.id=de("pf-acc-trigger"),r.textContent=b(e.title)??"",r.setAttribute("aria-expanded","false");let o=f("div","pf-accordion-content");return o.id=de("pf-acc"),o.setAttribute("role","region"),o.setAttribute("aria-labelledby",r.id),o.style.display="none",r.setAttribute("aria-controls",o.id),L(e,o,t),r.addEventListener("click",()=>{let i=o.style.display!=="none";o.style.display=i?"none":"block",r.setAttribute("aria-expanded",i?"false":"true")}),n.appendChild(r),n.appendChild(o),n}function Zi(e,t){let n=f("div","pf-dialog-wrapper"),r=document.createElement("dialog");r.className="pf-dialog",r.setAttribute("aria-modal","true");let o=e.dismissible!==!1,i=Jt(e.trigger,t);if(i)i.setAttribute("aria-haspopup","dialog"),i.addEventListener("click",()=>{r.showModal()}),n.appendChild(i);if(e.title!=null){let l=f("h2","pf-dialog-title");l.textContent=C(e.title,t),l.id=de("pf-dialog-title"),r.setAttribute("aria-labelledby",l.id),r.appendChild(l)}if(e.description!=null){let l=f("p","pf-dialog-desc");l.textContent=C(e.description,t),l.id=de("pf-dialog-desc"),r.setAttribute("aria-describedby",l.id),r.appendChild(l)}let s=f("div","pf-dialog-body");if(L(e,s,t),r.appendChild(s),o){let l=document.createElement("button");l.type="button",l.className="pf-dialog-close",l.setAttribute("aria-label","Close"),l.textContent="×",l.addEventListener("click",()=>{r.close()}),r.appendChild(l),r.addEventListener("click",(c)=>{if(c.target===r)r.close()})}else r.addEventListener("cancel",(l)=>{l.preventDefault()});let a=()=>{r.close()};return document.addEventListener("prefab:close-overlay",a),n.appendChild(r),{element:n,destroy:()=>{document.removeEventListener("prefab:close-overlay",a)}}}function Yi(e,t){let n=f("div","pf-popover"),r=f("div","pf-popover-content");if(r.id=de("pf-popover"),r.setAttribute("role","dialog"),r.style.display="none",e.title!=null){let c=f("div","pf-popover-title");c.textContent=C(e.title,t),r.appendChild(c)}L(e,r,t);let o=Jt(e.trigger,t),i=()=>r.style.display!=="none",s=(c)=>{r.style.display=c?"block":"none",o?.setAttribute("aria-expanded",c?"true":"false")};if(o)o.setAttribute("aria-haspopup","dialog"),o.setAttribute("aria-controls",r.id),o.setAttribute("aria-expanded","false"),o.addEventListener("click",(c)=>{c.stopPropagation(),s(!i())}),n.appendChild(o);else n.addEventListener("click",(c)=>{if(c.target instanceof Node&&r.contains(c.target)&&i())return;s(!i())});let a=(c)=>{if(i()&&c.target instanceof Node&&!n.contains(c.target))s(!1)},l=(c)=>{if(c.key==="Escape"&&i())s(!1)};return document.addEventListener("click",a),document.addEventListener("keydown",l),n.appendChild(r),{element:n,destroy:()=>{document.removeEventListener("click",a),document.removeEventListener("keydown",l)}}}function Qi(e,t){let n=f("div","pf-tooltip"),r=f("div","pf-tooltip-content");r.id=de("pf-tip"),r.setAttribute("role","tooltip"),r.textContent=C(e.content??"",t),r.style.display="none",L(e,n,t),n.setAttribute("aria-describedby",r.id);let o=()=>{r.style.display="block"},i=()=>{r.style.display="none"};return n.addEventListener("mouseenter",o),n.addEventListener("mouseleave",i),n.addEventListener("focus",o,!0),n.addEventListener("blur",i,!0),n.appendChild(r),n}function es(e,t){let n=f("div","pf-hover-card"),r=f("div","pf-hover-card-content");r.style.display="none";let o=Jt(e.trigger,t);if(o)n.appendChild(o);return L(e,r,t),n.addEventListener("mouseenter",()=>{r.style.display="block"}),n.addEventListener("mouseleave",()=>{r.style.display="none"}),n.addEventListener("focusin",()=>{r.style.display="block"}),n.addEventListener("focusout",()=>{r.style.display="none"}),n.appendChild(r),n}function ts(e,t){let n=f("div","pf-carousel");n.setAttribute("role","region"),n.setAttribute("aria-roledescription","carousel"),n.setAttribute("aria-label",C(e.label??"Carousel",t));let r=f("div","pf-carousel-track");L(e,r,t);let o=0,i=e.children?.length??0,s=(d,u,h)=>{let m=document.createElement("button");return m.type="button",m.className=d,m.textContent=u,m.setAttribute("aria-label",h),m},a=s("pf-carousel-prev","‹","Previous slide"),l=s("pf-carousel-next","›","Next slide"),c=()=>{r.style.transform=`translateX(-${String(o*100)}%)`,a.disabled=o<=0,l.disabled=o>=i-1};return a.addEventListener("click",()=>{if(i===0)return;o=Math.max(0,o-1),c()}),l.addEventListener("click",()=>{if(i===0)return;o=Math.min(i-1,o+1),c()}),c(),n.appendChild(r),n.appendChild(a),n.appendChild(l),n}function ns(e){if(!E(e))return{};return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,me(n)]))}function rr(){p("ForEach",rs),p("If",or),p("Elif",os),p("Else",is),p("Condition",ss),p("Define",as),p("Use",ls),p("Slot",cs)}function rs(e,t){let n=document.createDocumentFragment(),r=b(e.expression);if(!r)return n;let o;if(G(r)){let s=q(r,t.store,t.scope);o=Array.isArray(s)?s:[]}else{let s=t.store.get(r);o=Array.isArray(s)?s:[]}let i=P(e.let)??{};for(let s=0;s<o.length;s++){let a=o[s],l={...t.scope,$item:a,$index:s,...i},c={...t,scope:l};if(e.children)he(e.children,n,c)}return n}function or(e,t){if(ir(b(e.condition)??"",t)){let r=document.createDocumentFragment();if(e.children)he(e.children,r,t);return r}return document.createDocumentFragment()}function os(e,t){return or(e,t)}function is(e,t){let n=document.createDocumentFragment();if(e.children)he(e.children,n,t);return n}function ir(e,t){if(!e)return!1;if(G(e))return Boolean(q(e,t.store,t.scope));return Boolean(t.store.get(e))}function ss(e,t){let n=document.createDocumentFragment(),r=K(e.cases).find((o)=>ir(b(o.when)??"",t));return he(me(r?r.children:e.else),n,t),n}function as(e,t){let n=b(e.name);if(n&&e.children)t.templates=t.templates??{},t.templates[n]=e.children;return document.createDocumentFragment()}function ls(e,t){let n=document.createDocumentFragment(),r=b(e.def??e.name),o=r!=null?t.templates?.[r]:void 0;if(!o)return n;let i=P(e.overrides)??{},s={...t.scope,...i},a={...t.slots??{},...ns(e.slots)};if(Array.isArray(e.children))a.default=e.children;let l={...t,scope:s,slots:a};for(let c of o)n.appendChild(B(c,l));return n}function cs(e,t){let n=document.createDocumentFragment(),r=b(e.name)??"default",i=t.slots?.[r]??e.children;if(i)for(let s of i)n.appendChild(B(s,t));return n}function sr(){p("Alert",ds),p("AlertTitle",ps),p("AlertDescription",us)}function ds(e,t){let n=f("div","pf-alert");n.setAttribute("role","alert");let r=b(e.variant)??"default";if(n.setAttribute("data-variant",r),e.icon!=null){let o=f("span","pf-alert-icon");ut(o,T(e.icon)),n.appendChild(o)}return L(e,n,t),n}function ps(e,t){let n=f("h5","pf-alert-title");return n.textContent=C(e.content,t),n}function us(e,t){let n=f("p","pf-alert-description");return n.textContent=C(e.content,t),n}var Kt=new Map;function ft(e){let t=Kt.get(e);if(t)return t;let n=import(e);return Kt.set(e,n),n.catch(()=>{Kt.delete(e)}),n}function ar(e){let t=e.closest("[data-theme], .dark, .light");if(t)return t.getAttribute("data-theme")==="dark"||t.classList.contains("dark");return typeof matchMedia==="function"&&matchMedia("(prefers-color-scheme: dark)").matches}function cr(){p("Image",fs),p("Audio",ms),p("Video",hs),p("Embed",gs),p("Svg",ys),p("DropZone",vs),p("Mermaid",ks)}function fs(e,t){let n=document.createElement("img");if(n.className="pf-image",n.src=C(e.src,t),e.alt!=null)n.alt=C(e.alt,t);if(e.width!=null)n.width=Number(e.width);if(e.height!=null)n.height=Number(e.height);return n.loading="lazy",n}function ms(e,t){let n=document.createElement("audio");return n.className="pf-audio",n.src=C(e.src,t),n.controls=!0,n}function hs(e,t){let n=document.createElement("video");if(n.className="pf-video",n.src=C(e.src,t),n.controls=!0,e.width!=null)n.width=Number(e.width);if(e.height!=null)n.height=Number(e.height);return n}function gs(e,t){let n=f("div","pf-embed"),r=document.createElement("iframe");return r.src=C(e.src,t),r.style.height=e.height!=null?`${String(Number(e.height))}px`:"400px",r.setAttribute("sandbox","allow-scripts"),n.appendChild(r),n}var bs=new Set(["svg","g","path","rect","circle","ellipse","line","polyline","polygon","text","tspan","textpath","defs","use","symbol","clippath","mask","pattern","lineargradient","radialgradient","stop","filter","fegaussianblur","feoffset","femerge","femergenode","fecolormatrix","feblend","title","desc"]);function ys(e,t){let n=f("div","pf-svg"),r=C(e.content,t);if(!r.includes("<svg"))return n;if(!/<svg[^>]*\sxmlns\s*=/.test(r))r=r.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"');let i=new DOMParser().parseFromString(r,"image/svg+xml").querySelector("svg");if(!i)return n;return dr(i),n.appendChild(document.importNode(i,!0)),n}function dr(e){let t=Array.from(e.children);for(let n of t){if(!bs.has(n.tagName.toLowerCase())){n.remove();continue}for(let r of Array.from(n.attributes)){let o=r.name.toLowerCase();if(o.startsWith("on")||o==="href"&&r.value.trim().toLowerCase().startsWith("javascript:"))n.removeAttribute(r.name)}dr(n)}}function Cs(e,t){let n=(t??"").split(",").map((i)=>i.trim().toLowerCase()).filter(Boolean);if(n.length===0)return!0;let r=e.name.toLowerCase(),o=e.type.toLowerCase();return n.some((i)=>{if(i.startsWith("."))return r.endsWith(i);if(i.endsWith("/*"))return o.startsWith(i.slice(0,-1));return o===i})}function vs(e,t){let n=f("div","pf-dropzone");n.textContent=C(e.label??"Drop files here",t);let r=document.createElement("input");if(r.type="file",r.style.display="none",e.accept!=null)r.accept=T(e.accept);if(e.multiple===!0)r.multiple=!0;n.appendChild(r),n.setAttribute("role","button"),n.tabIndex=0;function o(s){let a=Array.from(s??[]).filter((l)=>Cs(l,b(e.accept)));return e.multiple===!0?a:a.slice(0,1)}function i(s){if(s.length===0)return;let a=b(e.resultKey);if(a!=null)t.store.set(a,s),t.rerender();if(e.onDrop!=null)j(I(e.onDrop,{...z(t),scope:{...t.scope,$result:s}}),"onDrop")}return r.addEventListener("change",()=>{i(o(r.files)),r.value=""}),n.addEventListener("click",()=>r.click()),n.addEventListener("keydown",(s)=>{if(s.key==="Enter"||s.key===" ")s.preventDefault(),r.click()}),n.addEventListener("dragover",(s)=>{s.preventDefault(),n.classList.add("pf-dropzone-active")}),n.addEventListener("dragleave",()=>{n.classList.remove("pf-dropzone-active")}),n.addEventListener("drop",(s)=>{s.preventDefault(),n.classList.remove("pf-dropzone-active"),i(o(s.dataTransfer?.files??null))}),n}var xs="https://cdn.jsdelivr.net/npm/mermaid@11.4.1/dist/mermaid.esm.min.mjs",lr=0;function ws(e){return E(e)&&typeof e.initialize==="function"&&typeof e.render==="function"}function ks(e,t){let n=f("div","pf-mermaid");n.setAttribute("data-mermaid","true");let r=C(e.content,t),o=f("pre","pf-mermaid-source");if(o.textContent=r,n.appendChild(o),r.trim()==="")return n;return ft(xs).then(async(i)=>{let s=E(i)?i.default:void 0;if(!ws(s))return;s.initialize({startOnLoad:!1,securityLevel:"strict",theme:ar(n)?"dark":"neutral",fontFamily:"inherit"}),lr+=1;let{svg:a}=await s.render(`pf-mermaid-${String(lr)}`,r);n.innerHTML=a,n.setAttribute("data-state","rendered")}).catch(()=>{n.setAttribute("data-state","source")}),n}var Ms="https://cdn.jsdelivr.net/npm/pdfjs-dist@4.9/build/pdf.min.mjs",Rs="https://cdn.jsdelivr.net/npm/pdfjs-dist@4.9/build/pdf.worker.min.mjs",pr=1.25,fr=0.25,mr=5,ur=32;function Es(e){if(!E(e)||typeof e.getDocument!=="function")return!1;let t=e.GlobalWorkerOptions;return typeof t==="function"||E(t)}function Wt(e,t){let n=typeof e==="string"&&e.trim()!==""?Number(e):e;return typeof n==="number"&&Number.isFinite(n)?n:t}function Ts(e){return e==="fit-page"||e==="fit-width"?e:Wt(e,0)||"fit-width"}async function As(){let e=await ft(Ms);if(!Es(e))throw Error("PDF.js did not load");return e.GlobalWorkerOptions.workerSrc=Rs,e}function hr(){p("PdfViewer",Ss)}function Ss(e,t){let n=f("div","pf-pdf-viewer");n.style.height=`${Wt(e.height,600)}px`;let r=f("div","pf-pdf-message");r.setAttribute("role","status"),r.textContent="Loading PDF…",n.appendChild(r);let o={destroyed:!1,cleanup:()=>{return}};return Ns(n,r,o,{src:e.src!=null?C(e.src,t):void 0,data:b(e.data),initialPage:Wt(e.page,1),zoom:Ts(e.zoom),showToolbar:e.toolbar!==!1}),{element:n,destroy:()=>{o.destroyed=!0,o.cleanup()}}}function Ls(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}async function Ns(e,t,n,r){try{let v=function(y){let M=Math.max(1,Math.min(y,i.numPages));if(M!==s)s=M,g()};if(!r.src&&!r.data)throw Error("No PDF source provided");let i=await(await As()).getDocument(r.src?{url:r.src}:{data:Ls(r.data??"")}).promise;if(n.destroyed)return;t.remove();let s=Math.max(1,Math.min(r.initialPage,i.numPages)),a=r.zoom,l=1,c,d=0,u=r.showToolbar?Ps(i.numPages,{onPage:(y)=>{v(y)},onZoom:(y)=>{a=Hs(l*y),g()},onFit:()=>{a=a==="fit-page"?"fit-width":"fit-page",g()}}):void 0;if(u)e.appendChild(u.el);let h=f("div","pf-pdf-canvas-container"),m=document.createElement("canvas");m.className="pf-pdf-canvas",h.appendChild(m),e.appendChild(h);async function g(){d+=1;let y=d;c?.cancel();let M=await i.getPage(s);if(n.destroyed||y!==d)return;let w=M.getViewport({scale:1}),k=Math.max(1,h.clientWidth-ur),x=Math.max(1,h.clientHeight-ur);l=a==="fit-width"?k/w.width:a==="fit-page"?Math.min(k/w.width,x/w.height):a;let R=M.getViewport({scale:l}),S=window.devicePixelRatio||1;m.width=Math.floor(R.width*S),m.height=Math.floor(R.height*S),m.style.width=`${Math.floor(R.width)}px`,m.style.height=`${Math.floor(R.height)}px`;let F=m.getContext("2d");if(!F)return;let N=M.render({canvasContext:F,viewport:R,transform:S!==1?[S,0,0,S,0,0]:void 0});c=N;try{await N.promise}catch(V){if(y!==d)return;throw V}u?.update(s,l,a)}if(typeof ResizeObserver<"u"){let y=0,M=new ResizeObserver((w)=>{let k=Math.round(w[0]?.contentRect.width??0);if(typeof a==="number"||k===y)return;y=k,g()});M.observe(h),n.cleanup=()=>{M.disconnect()}}await g()}catch(o){t.textContent=`Could not load PDF: ${o instanceof Error?o.message:String(o)}`,t.setAttribute("data-state","error")}}function Hs(e){return Math.min(mr,Math.max(fr,e))}function Ke(e,t,n){let r=document.createElement("button");return r.type="button",r.className="pf-pdf-btn",r.textContent=e,r.title=t,r.setAttribute("aria-label",t),r.addEventListener("click",n),r}function Ps(e,t){let n=f("div","pf-pdf-toolbar"),r=1,o=Ke("‹","Previous page",()=>{t.onPage(r-1)}),i=Ke("›","Next page",()=>{t.onPage(r+1)}),s=document.createElement("input");s.type="text",s.inputMode="numeric",s.className="pf-pdf-page-input",s.setAttribute("aria-label","Page number"),s.addEventListener("change",()=>{let m=parseInt(s.value,10);if(isNaN(m))s.value=String(r);else t.onPage(m)});let a=f("span","pf-pdf-page-count");a.textContent=`/ ${String(e)}`;let l=f("span","pf-pdf-spacer"),c=Ke("−","Zoom out",()=>{t.onZoom(1/pr)}),d=f("span","pf-pdf-zoom-label"),u=Ke("+","Zoom in",()=>{t.onZoom(pr)}),h=Ke("⤢","Fit page / fit width",t.onFit);return n.append(o,s,a,i,l,c,d,u,h),{el:n,update(m,v,g){r=m,s.value=String(m),o.disabled=m<=1,i.disabled=m>=e,d.textContent=`${String(Math.round(v*100))}%`,c.disabled=v<=fr,u.disabled=v>=mr,h.setAttribute("aria-pressed",typeof g==="number"?"false":"true")}}}function te(e,t){let n=document.createElement("div");return n.className="pf-chart-tooltip",e.appendChild(n),e.addEventListener("mouseleave",()=>{n.classList.remove("pf-visible")}),{wrapper:e,tooltip:n,svgEl:t}}function gr(e,t,n,r,o){let{tooltip:i,svgEl:s,wrapper:a}=e;if(o.length===0)return;let l="";if(r)l+=`<div class="pf-chart-tooltip-label">${Q(r)}</div>`;for(let y of o)l+='<div class="pf-chart-tooltip-row">',l+=`<span class="pf-chart-tooltip-dot" style="background:${Q(y.color)}"></span>`,l+=`<span>${Q(y.label)}:</span> <strong>${Q(String(y.value))}</strong>`,l+="</div>";i.innerHTML=l;let c=s.getBoundingClientRect(),d=a.getBoundingClientRect(),u=s.viewBox.baseVal,h=c.width/(u.width||1),m=c.left-d.left+t*h,v=i.offsetWidth||100,g=m+12;if(g+v>d.width)g=m-v-12;i.style.left=`${Math.max(0,g)}px`,i.style.top="4px",i.classList.add("pf-visible")}function br(e){e.tooltip.classList.remove("pf-visible")}function yr(e,t,n){e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",n),e.addEventListener("touchstart",t,{passive:!0}),e.addEventListener("touchend",n,{passive:!0})}function pe(e,t,n,r,o,i){yr(e,()=>{gr(t,n,r,o,i)},()=>{br(t)})}function Cr(e,t){let{data:n,series:r,xAxisKey:o,formatValue:i,formatLabel:s}=e,a=o?n[t][o]:void 0,l=a!=null?s?s(a):T(a):void 0,c=r.map((d,u)=>({label:d.label??d.dataKey,value:i(n[t][d.dataKey],d,u),color:d.color??_[u%_.length]}));return{label:l,entries:c}}function vr(e,t,n){let r=H("rect",{x:e,y:n.plotTop,width:t,height:n.plotHeight,fill:"transparent"});return r.style.cursor="default",r}function xr(e,t,n,r,o,i,s,a){let l={data:n,series:r,xAxisKey:i,formatValue:s,formatLabel:a},c=o.plotWidth/n.length;for(let d=0;d<n.length;d++){let u=o.plotLeft+d*c,h=vr(u,c,o),{label:m,entries:v}=Cr(l,d);pe(h,e,u+c/2,o.plotTop,m,v),t.appendChild(h)}}function wr(e,t,n,r,o,i,s,a,l,c){let d={data:n,series:r,xAxisKey:i,formatValue:s,formatLabel:c},u=n.length===1?o.plotWidth:o.plotWidth/(n.length-1);for(let h=0;h<n.length;h++){let m=n.length===1?(o.plotLeft+o.plotRight)/2:o.plotLeft+h/(n.length-1)*o.plotWidth,v=Math.max(o.plotLeft,n.length===1?o.plotLeft:m-u/2),g=vr(v,Math.min(u,o.plotRight-v),o),{label:y,entries:M}=Cr(d,h);yr(g,()=>{if(gr(e,m,o.plotTop,y,M),a)a.setAttribute("x1",String(m)),a.setAttribute("x2",String(m)),a.setAttribute("opacity","1");if(l)for(let x of l){for(let R of x)R.setAttribute("data-visible","false");x[h]?.setAttribute("data-visible","true")}},()=>{if(br(e),a)a.setAttribute("opacity","0");if(l)for(let x of l)for(let R of x)R.setAttribute("data-visible","false")}),t.appendChild(g)}}function ve(e,t){return K(J(e.data,t))}function kr(e,t){let n=J(e.data,t);if(!Array.isArray(n))return;let r=n.filter((o)=>typeof o==="number"&&Number.isFinite(o));return r.length>0?r:void 0}function Os(e){return e==="left"||e==="right"?e:void 0}function $s(e){if(!E(e)||typeof e.dataKey!=="string")return;let t=b(e.label),n=b(e.color),r=Os(e.yAxisId),o=b(e.tooltipFormat);return{dataKey:e.dataKey,...t!==void 0&&{label:t},...n!==void 0&&{color:n},...r!==void 0&&{yAxisId:r},...o!==void 0&&{tooltipFormat:o}}}function xe(e){if(!Array.isArray(e.series))return[];return e.series.flatMap((t)=>{let n=$s(t);return n?[n]:[]})}function ue(e,t){return O(e.height)??t}function We(e,t){return Math.max(...e.flatMap((n)=>t.map((r)=>Number(n[r.dataKey]??0))),1)}function Gt(e,t){return{valueKey:b(e.dataKey)??t[0]?.dataKey,nameKey:b(e.nameKey)??b(e.tooltipXKey)??b(e.xAxis)}}function qt(e,t){return{rows:ve(e,t),series:xe(e),height:ue(e,300),showYAxis:e.showYAxis!==!1,showGrid:e.showGrid===!0,showYAxisRight:e.showYAxisRight===!0,showTooltip:e.showTooltip!==!1,showLegend:e.showLegend!==!1,xAxisKey:b(e.xAxis),tooltipXKey:b(e.tooltipXKey),xAxisFormat:b(e.xAxisFormat),tooltipXFormat:b(e.tooltipXFormat),yAxisRightFormat:b(e.yAxisRightFormat)}}function Mr(e,t,n,r){let o=t.series.filter((u)=>u.yAxisId!=="right"),i=t.series.filter((u)=>u.yAxisId==="right"),s=t.showYAxisRight&&i.length>0,a=o.length>0?We(t.rows,o):1,l=s?We(t.rows,i):1,c=Be(r,t.height,t.showYAxis,s),d=ie(r,t.height,n);if(t.showYAxis)pt(d,c,a,t.showGrid,Je(e));if(s)Jn(d,c,l,t.yAxisRightFormat);return ze(d,c),{layout:c,svg:d,leftMax:a,rightMax:l}}function mt(e,t){return e?(n)=>Te(n,e,t):void 0}function Rr(e,t,n=le){let r=f("div","pf-chart pf-bar-chart"),o=qt(e,t),{rows:i,series:s}=o;if(i.length===0||s.length===0)return r.textContent="No chart data",r;let{layout:a,svg:l,leftMax:c,rightMax:d}=Mr(e,o,"Bar",n),u=a.plotWidth/i.length,h=u/(s.length+1);for(let m=0;m<i.length;m++)for(let v=0;v<s.length;v++){let g=s[v],y=i[m][g.dataKey];if(y===null||y===void 0)continue;let M=g.yAxisId==="right"?d:c,w=Math.max(0,Number(y)/M*a.plotHeight),k=a.plotLeft+m*u+v*h+h/2;l.appendChild(H("rect",{x:k,y:a.plotBottom-w,width:h*0.8,height:w,fill:g.color??_[v%_.length],rx:2}))}if(o.xAxisKey)Ft(l,i,o.xAxisKey,(m)=>a.plotLeft+m*u+u/2,a.plotBottom,mt(o.xAxisFormat,t));if(o.showTooltip){let m=te(r,l),v=jt(t,Je(e),o.yAxisRightFormat);xr(m,l,i,s,a,o.tooltipXKey??o.xAxisKey,v,mt(o.tooltipXFormat,t))}return se(r,s,o.showLegend),r.appendChild(l),r}function Ds(e,t,n,r){let o=[],i=()=>{if(o.length<2){o=[];return}let s=`M ${o[0].x},${n} `+o.map((a)=>`L ${a.x},${a.y}`).join(" ")+` L ${o[o.length-1].x},${n} Z`;e.appendChild(H("path",{d:s,fill:r,opacity:0.15})),o=[]};for(let s of t){if(s.isNull){i();continue}o.push(s)}i()}function Fs(e,t,n,r){let o="";for(let i of t){if(i.isNull)continue;let s=t.indexOf(i),a=s===0||t[s-1].isNull;o+=`${a?"M":"L"} ${i.x},${i.y} `}if(!o)return;e.appendChild(H("path",{d:o.trim(),fill:"none",stroke:n,"stroke-width":2,...r?{"stroke-dasharray":"6 3"}:{}}))}function Is(e,t,n){let r=[];for(let o of t){let i=H("circle",{cx:o.x,cy:o.y,r:4,fill:n,class:"pf-data-dot","data-visible":"false"});if(i.style.pointerEvents="none",o.isNull)i.style.display="none";e.appendChild(i),r.push(i)}return r}function js(e,t){let n=H("line",{class:"pf-crosshair",x1:t.plotLeft,x2:t.plotLeft,y1:t.plotTop,y2:t.plotBottom,stroke:X,"stroke-width":1,"stroke-dasharray":"3 3",opacity:0});return e.appendChild(n),n}function Ut(e,t,n=le){let r=f("div",`pf-chart pf-${e.type.toLowerCase()}-chart`),o=qt(e,t),{rows:i,series:s}=o;if(i.length===0||s.length===0)return r.textContent="No chart data",r;let a=e.type==="AreaChart",{layout:l,svg:c,leftMax:d,rightMax:u}=Mr(e,o,a?"Area":"Line",n),h=(g)=>i.length===1?(l.plotLeft+l.plotRight)/2:l.plotLeft+g/(i.length-1)*l.plotWidth,m=[];for(let g=0;g<s.length;g++){let y=s[g],M=y.yAxisId==="right",w=M?u:d,k=y.color??_[g%_.length],x=i.map((R,S)=>{let F=R[y.dataKey],N=F===null||F===void 0,V=N?l.plotBottom:l.plotBottom-Number(F)/w*l.plotHeight;return{x:h(S),y:V,isNull:N}});if(a)Ds(c,x,l.plotBottom,k);Fs(c,x,k,M),m.push(Is(c,x,k))}let v=js(c,l);if(o.xAxisKey)Ft(c,i,o.xAxisKey,h,l.plotBottom,mt(o.xAxisFormat,t));if(o.showTooltip){let g=te(r,c),y=jt(t,Je(e),o.yAxisRightFormat);wr(g,c,i,s,l,o.tooltipXKey??o.xAxisKey,y,v,m,mt(o.tooltipXFormat,t))}return se(r,s,o.showLegend),r.appendChild(c),r}function Er(e,t){let n=f("div","pf-chart pf-pie-chart"),r=ve(e,t),o=xe(e),i=Math.min(ue(e,300),300),s=e.showTooltip!==!1,{valueKey:a,nameKey:l}=Gt(e,o),c=o.length>0?o:a?[{dataKey:a,label:a}]:[];if(r.length===0||!a)return n.textContent="No chart data",n;let d=ie(i,i,"Pie"),u=i/2,h=i/2,m=i/2-10,v=b(e.tooltipXFormat),g=Ae(e,t),y=r.map((x)=>Number(x[a]??0)),M=y.reduce((x,R)=>x+R,0);if(M===0)return n.textContent="No chart data",n.appendChild(d),n;let w=s?te(n,d):void 0,k=-Math.PI/2;for(let x=0;x<y.length;x++){let R=y[x]/M*2*Math.PI,S=k+R,F=R>Math.PI?1:0,N=u+m*Math.cos(k),V=h+m*Math.sin(k),ne=u+m*Math.cos(S),re=h+m*Math.sin(S),Z=_[x%_.length],oe=H("path",{d:`M ${u},${h} L ${N},${V} A ${m},${m} 0 ${F} 1 ${ne},${re} Z`,fill:Z});if(oe.style.cursor="default",w){let ke=l?r[x][l]:void 0,D=ke!=null?v?Te(ke,v,t):T(ke):`Slice ${x+1}`,fe=`${(y[x]/M*100).toFixed(1)}%`,ae=u+m*0.6*Math.cos(k+R/2);pe(oe,w,ae,h,D,[{label:c[0].label??a,value:`${g(y[x])} (${fe})`,color:Z}])}d.appendChild(oe),k=S}return se(n,c,e.showLegend!==!1),n.appendChild(d),n}function Tr(e,t){let n=f("div","pf-chart pf-radial-chart"),r=ve(e,t),o=xe(e),{valueKey:i,nameKey:s}=Gt(e,o);if(r.length===0||!i)return n.textContent="No chart data",n;let a=Math.min(ue(e,300),300),l=a/2,c=a/2,d=a/2-10,u=Math.max(0,Math.min(O(e.innerRadius)??30,d-10)),h=O(e.startAngle)??180,m=O(e.endAngle)??0,v=r.map((S)=>Number(S[i]??0)),g=Math.max(...v,1),y=ie(a,a,"Radial"),M=(d-u)/r.length,w=Math.max(2,M*0.7),k=Ae(e,t),x=e.showTooltip!==!1?te(n,y):void 0,R=[];for(let S=0;S<r.length;S++){let F=d-M*S-M/2,N=o[S]?.color??_[S%_.length],V=h+v[S]/g*(m-h),ne=s?r[S][s]:null,re=ne!=null?T(ne):o[S]?.label??i;R.push({dataKey:re||i,label:re||i,color:N}),y.appendChild(H("path",{d:Vt(l,c,F,h,m),fill:"none",stroke:ge,"stroke-width":w,"stroke-linecap":"round"}));let Z=H("path",{d:Vt(l,c,F,h,V),fill:"none",stroke:N,"stroke-width":w,"stroke-linecap":"round"});if(x){let oe=be(l,c,F,(h+V)/2);pe(Z,x,oe.x,oe.y,re||i,[{label:i,value:k(v[S]),color:N}])}y.appendChild(Z)}return se(n,R,e.showLegend!==!1),n.appendChild(y),n}function Ar(e,t){let n=f("div","pf-chart pf-radar-chart"),r=ve(e,t),o=xe(e),i=b(e.axisKey)??b(e.xAxis);if(r.length===0||o.length===0)return n.textContent="No chart data",n;let s=e.filled!==!1,a=e.showDots===!0,l=e.showGrid!==!1,c=Math.min(ue(e,300),320),d=c/2,u=c/2,h=c/2-24,m=r.length,v=We(r,o),g=(x)=>90-360*x/m,y=(x)=>x.map((R)=>`${R.x.toFixed(1)},${R.y.toFixed(1)}`).join(" "),M=ie(c,c,"Radar");if(l){for(let R=1;R<=4;R++){let S=h*R/4,F=Array.from({length:m},(N,V)=>be(d,u,S,g(V)));M.appendChild(H("polygon",{points:y(F),fill:"none",stroke:ge,"stroke-width":1}))}for(let R=0;R<m;R++){let S=be(d,u,h,g(R));M.appendChild(H("line",{x1:d,y1:u,x2:S.x,y2:S.y,stroke:ge,"stroke-width":1}))}}for(let x=0;x<m;x++){let R=be(d,u,h+12,g(x)),S=i?r[x][i]:null;M.appendChild(Le({x:R.x,y:R.y+3,"text-anchor":"middle","font-size":ee,fill:X},T(S)))}let w=e.showTooltip!==!1?te(n,M):void 0,k=Ae(e,t);for(let x=0;x<o.length;x++){let R=o[x],S=R.color??_[x%_.length],F=r.map((N,V)=>be(d,u,Number(N[R.dataKey]??0)/v*h,g(V)));if(M.appendChild(H("polygon",{points:y(F),fill:s?S:"none","fill-opacity":s?0.2:0,stroke:S,"stroke-width":2})),!a&&!w)continue;for(let N=0;N<F.length;N++){let V=H("circle",{cx:F[N].x,cy:F[N].y,r:a?3:6,fill:a?S:"transparent","fill-opacity":a?1:0});if(w){let ne=i?r[N][i]:null,re=ne!=null?T(ne):R.label??R.dataKey,Z=[{label:R.label??R.dataKey,value:k(Number(r[N][R.dataKey]??0)),color:S}];pe(V,w,F[N].x,F[N].y,re,Z)}M.appendChild(V)}}return se(n,o,e.showLegend!==!1),n.appendChild(M),n}var Ge=(e)=>String(Math.round(e*100)/100);function Sr(e,t,n=le){let r=f("div","pf-chart pf-scatter-chart"),o=ve(e,t),i=b(e.xAxis),s=b(e.yAxis),a=b(e.zAxis),l=xe(e),c=ue(e,300);if(o.length===0||!i||!s)return r.textContent="No chart data",r;let d=e.showGrid!==!1,u=l[0]?.color??_[0],h=Ae(e,t,Ge),m=o.map((D)=>Number(D[i]??0)),v=o.map((D)=>Number(D[s]??0)),g=_e(Math.min(...m),Math.max(...m),5),y=_e(Math.min(...v),Math.max(...v),4),M=g[0],w=g[g.length-1]-M||1,k=y[0],x=y[y.length-1]-k||1,R=a?o.map((D)=>Number(D[a]??0)):[],S=a?Math.max(...R,1):1,F=a?18:4,N=Be(n,c,!0),V=ie(n,c,"Scatter"),ne=N.plotLeft+F,re=Math.max(1,N.plotWidth-F*2),Z=(D)=>ne+(D-M)/w*re,oe=(D)=>N.plotBottom-(D-k)/x*N.plotHeight;for(let D=0;D<y.length;D++){let fe=y[D],ae=oe(fe);if(V.appendChild(Le({x:N.plotLeft-6,y:ae+3,"text-anchor":"end","font-size":ee,fill:X},h(fe))),d&&D>0)V.appendChild(H("line",{x1:N.plotLeft,y1:ae,x2:N.plotRight,y2:ae,stroke:ge,"stroke-width":1,"stroke-dasharray":"4 3"}))}ze(V,N);for(let D of g)V.appendChild(Le({x:Z(D),y:N.plotBottom+14,"text-anchor":"middle","font-size":ee,fill:X},Ge(D)));let ke=e.showTooltip!==!1?te(r,V):void 0;for(let D=0;D<o.length;D++){let fe=Z(m[D]),ae=oe(v[D]),Zr=a?4+Math.sqrt(R[D]/S)*14:4,an=H("circle",{cx:fe,cy:ae,r:Zr,fill:u,"fill-opacity":a?0.6:0.85});if(ke){let Yr=[{label:i,value:h(m[D]),color:u},{label:s,value:h(v[D]),color:u},...a?[{label:a,value:h(R[D]),color:u}]:[]],Qr=l[0]?.label??"Point";pe(an,ke,fe,ae,Qr,Yr)}V.appendChild(an)}return se(r,l,e.showLegend!==!1),r.appendChild(V),r}function Lr(e,t,n=le){let r=f("div","pf-chart pf-histogram"),o=kr(e,t);if(!o)return r.textContent="No data",r;let i=O(e.bins)??10,s=ue(e,200),a=b(e.color)??_[0],l=Math.min(...o),d=(Math.max(...o)-l)/i||1,u=Array(i).fill(0);for(let x of o){let R=Math.min(Math.floor((x-l)/d),i-1);u[R]++}let h=Math.max(...u),m=e.showYAxis!==!1,v=e.showXAxis!==!1,g=_e(0,Math.max(1,h)).at(-1)??h,y=Be(n,s,m),M=ie(n,s,"Histogram");if(m)pt(M,y,g,e.showGrid!==!1);ze(M,y);let w=e.showTooltip!==!1?te(r,M):void 0,k=y.plotWidth/i;for(let x=0;x<i;x++){let R=g>0?u[x]/g*y.plotHeight:0,S=y.plotLeft+x*k,F=H("rect",{x:S+1,y:y.plotBottom-R,width:Math.max(1,k-2),height:R,fill:a,rx:2});if(w){let N=`${Ge(l+x*d)} – ${Ge(l+(x+1)*d)}`;pe(F,w,S+k/2,y.plotBottom-R,N,[{label:"Count",value:u[x],color:a}])}M.appendChild(F)}if(v)for(let[x,R]of[[0,l],[i/2,l+i/2*d],[i,l+i*d]])M.appendChild(Le({x:y.plotLeft+x*k,y:y.plotBottom+14,"text-anchor":x===0?"start":x===i?"end":"middle","font-size":ee,fill:X},Ge(R)));return r.appendChild(M),r}function Nr(){p("BarChart",Se(Rr)),p("LineChart",Se(Ut)),p("AreaChart",Se(Ut)),p("PieChart",Er),p("RadarChart",Ar),p("ScatterChart",Se(Sr)),p("RadialChart",Tr),p("Histogram",Se(Lr))}function Pr(){p("Table",Vs),p("TableHead",(e,t)=>Xt(e)?ht("thead",e,t):Hr(e,t)),p("TableHeader",(e,t)=>Xt(e)?ht("thead",e,t):Hr(e,t)),p("TableBody",(e,t)=>ht("tbody",e,t)),p("TableFooter",(e,t)=>ht("tfoot",e,t)),p("TableRow",Bs),p("TableCell",_s),p("TableCaption",zs),p("ExpandableRow",Js)}function Xt(e){return(e.children?.length??0)>0}function Vs(e,t){let n=document.createElement("table");n.className=e.striped===!0?"pf-table pf-table-striped":"pf-table",L(e,n,t);let r=Array.from(n.children).find((o)=>o.tagName==="CAPTION");if(r&&r!==n.firstChild)n.insertBefore(r,n.firstChild);return n}function ht(e,t,n){let r=document.createElement(e);return r.className=`pf-${e}`,L(t,r,n),r}function Bs(e,t){let n=document.createElement("tr");return n.className="pf-table-row",L(e,n,t),n}function Hr(e,t){let n=document.createElement("th");return n.className="pf-table-header",n.setAttribute("scope","col"),n.textContent=C(e.content,t),n}function _s(e,t){let n=document.createElement("td");if(n.className="pf-table-cell",e.colSpan!=null)n.colSpan=Number(e.colSpan);if(e.rowSpan!=null)n.rowSpan=Number(e.rowSpan);if(e.content!=null&&!Xt(e))n.textContent=C(e.content,t);else L(e,n,t);return n}function zs(e,t){let n=document.createElement("caption");return n.className="pf-table-caption",n.textContent=C(e.content,t),n}function Js(e,t){let n=f("div","pf-expandable-row"),r=f("div","pf-expandable-row-summary");if(r.setAttribute("role","button"),r.setAttribute("aria-expanded","false"),r.tabIndex=0,r.appendChild(f("span","pf-expandable-arrow")),typeof e.summary==="string"){let a=f("span");a.textContent=C(e.summary,t),r.appendChild(a)}else for(let a of me(e.summary))r.appendChild(B(a,t));let o=f("div","pf-expandable-row-detail");o.style.display="none",L(e,o,t);let i=!1,s=()=>{i=!i,o.style.display=i?"block":"none",r.setAttribute("aria-expanded",i?"true":"false")};return r.addEventListener("click",s),r.addEventListener("keydown",(a)=>{if(a.key==="Enter"||a.key===" ")a.preventDefault(),s()}),n.appendChild(r),n.appendChild(o),n}var Or=!1;function gt(){if(Or)return;Or=!0;let e=new Set(Ot());Dn(),jn(),_n(),Gn(),Yn(),tr(),nr(),rr(),sr(),cr(),hr(),Nr(),Pr(),Sn(Ot().filter((t)=>!e.has(t)))}function Yt(e){return e.replace(/[^a-zA-Z0-9_-]/g,"")}function Qt(e){return e.replace(/[{}<>;]/g,"").replace(/\b(url|expression)\s*\(/gi,"")}function Zt(e,t=" "){return Object.entries(e).map(([n,r])=>`${t}--${Yt(n)}: ${Qt(r)};`).join(`
|
|
7
|
+
`)}function $r(e){if(!e)return"";let t=[];if(e.light&&Object.keys(e.light).length>0)t.push(`:root {
|
|
8
|
+
${Zt(e.light)}
|
|
9
|
+
}`);if(e.dark&&Object.keys(e.dark).length>0){let n=Zt(e.dark);t.push(`.dark, [data-theme="dark"] {
|
|
10
10
|
${n}
|
|
11
11
|
}`),t.push(`@media (prefers-color-scheme: dark) {
|
|
12
12
|
:root:not([data-theme="light"]):not(.light) {
|
|
13
|
-
${
|
|
13
|
+
${Zt(e.dark," ")}
|
|
14
14
|
}
|
|
15
15
|
}`)}return t.join(`
|
|
16
|
-
`)}function He(e,t){e.setAttribute("data-theme",t),e.classList.toggle("dark",t==="dark"),e.classList.toggle("light",t==="light")}function Ut(e,t){if(!t)return;if(t.light)for(let[n,r]of Object.entries(t.light))e.style.setProperty(`--${Gt(n)}`,qt(r));if(t.dark){let r=document.getElementById("prefab-dark-theme");if(!r)r=document.createElement("style"),r.id="prefab-dark-theme",document.head.appendChild(r);r.textContent=kr({dark:t.dark})}}function Xt(e,t){if(!e||typeof document>"u")return;let n=(r)=>{for(let[o,i]of Object.entries(e))if(Es(o,r))r.preventDefault(),t(i)};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)}function Es(e,t){let n=e.toLowerCase().split("+").map((i)=>i.trim()),r=n[n.length-1],o=new Set(n.slice(0,-1));if(o.has("ctrl")!==(t.ctrlKey||t.metaKey))return!1;if(o.has("shift")!==t.shiftKey)return!1;if(o.has("alt")!==t.altKey)return!1;return t.key.toLowerCase()===r}var Er='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"/></svg>',Rr='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z"/></svg>',Rs=new Set(["top-right","top-left","bottom-right","bottom-left"]);function Ts(e,t){try{let r=localStorage.getItem(t);if(r==="light"||r==="dark")return r}catch{}let n=e.getAttribute("data-theme")??document.documentElement.getAttribute("data-theme");if(n==="light"||n==="dark")return n;if(typeof window<"u"&&window.matchMedia("(prefers-color-scheme: light)").matches)return"light";return"dark"}function Je(e,t){if(typeof document>"u")return()=>{};let n=t?.position??"top-right",r=t?.storageKey??"prefab-theme",o=t?.syncDocument??!0,i=getComputedStyle(e).position;if(i==="static"||i==="")e.style.position="relative";let s=document.createElement("button");s.className="pf-theme-toggle",s.setAttribute("aria-label","Toggle theme"),s.setAttribute("title","Toggle light/dark"),s.type="button",s.setAttribute("data-position",Rs.has(n)?n:"top-right");function a(d){if(He(e,d),o)He(document.documentElement,d);s.innerHTML=d==="dark"?Rr:Er;try{localStorage.setItem(r,d)}catch{}}let l=Ts(e,r);a(l),s.addEventListener("click",()=>{let d=e.getAttribute("data-theme")??"dark";a(d==="dark"?"light":"dark")}),e.appendChild(s);let c;if(o)c=new MutationObserver((d)=>{for(let f of d)if(f.type==="attributes"&&f.attributeName==="data-theme"){let u=document.documentElement.getAttribute("data-theme");if((u==="light"||u==="dark")&&u!==e.getAttribute("data-theme")){He(e,u),s.innerHTML=u==="dark"?Rr:Er;try{localStorage.setItem(r,u)}catch{}}}}),c.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});return()=>{c?.disconnect(),s.remove()}}function ft(e){let t=e?.baseUrl??(typeof window<"u"?window.location.origin:""),n={"Content-Type":"application/json",...e?.headers},r=e?.fetch??globalThis.fetch.bind(globalThis);return{async callTool(o,i){let s=await r(`${t}/mcp/tools/call`,{method:"POST",headers:n,body:JSON.stringify({jsonrpc:"2.0",method:"tools/call",params:{name:o,arguments:i}})});if(!s.ok)throw Error(`MCP tool call failed: ${s.status} ${s.statusText}`);let a=await s.json(),l=P(a);if(!l)return a;if(Boolean(l.error))throw Error(b(P(l.error)?.message)??"MCP tool call returned error");let d=z(P(l.result)?.content??l.content);for(let f of d)if(f.type==="text"&&typeof f.text==="string"){try{return JSON.parse(f.text)}catch{}return f.text}return l.result??l},async sendMessage(o){await r(`${t}/mcp/messages`,{method:"POST",headers:n,body:JSON.stringify({message:o})})}}}function mt(){return{callTool(e){return A.warn(`No MCP transport: callTool('${e}') ignored`),Promise.resolve(null)},sendMessage(e){return A.warn("No MCP transport: sendMessage ignored",e),Promise.resolve()}}}var Tr="0.3.23";var Ss=["light","dark","auto"],As=["inline","fullscreen","pip"];function Sr(e){return E(e)&&typeof e.type==="string"&&(e.id===void 0||typeof e.id==="string")&&(e.payload===void 0||E(e.payload))}function gt(e){return typeof e==="boolean"?e:void 0}function Ar(e){let t=P(e.capabilities)??{},n=P(e.theme),r=P(e.toolInput),o=P(e.meta);return{hostName:b(e.hostName),hostVersion:b(e.hostVersion),capabilities:{toast:gt(t.toast),clipboard:gt(t.clipboard),navigation:gt(t.navigation),messaging:gt(t.messaging),displayModes:Yt(t.displayModes)},...n&&{theme:Ms(n)},...r&&{toolInput:r},...o&&{meta:o}}}function Ms(e){let t=b(e.fontCss);return{...ht({theme:e.colorScheme,styles:{variables:e.variables}}),...t!=null&&{fontCss:t}}}function Yt(e){let t=Array.isArray(e)?e:[];return As.filter((n)=>t.includes(n))}function ht(e){let t={},n=Ss.find((s)=>s===e.theme);if(n)t.colorScheme=n;let r=P(e.styles),o=P(r?.variables);if(o)t.variables=Object.fromEntries(Object.entries(o).filter((s)=>typeof s[1]==="string"));let i=b(P(r?.css)?.fonts);if(i!=null)t.fontCss=i;return t}function Ns(e){return E(e)&&e.jsonrpc==="2.0"}class we{hostOrigin;listeners=new Map;protocol="prefab";cleanup;pending=new Map;callIdCounter=0;rpcPending=new Map;rpcIdCounter=0;sentRpcIds=new Set;postFn;_hostSupportsSubscriptions=!1;constructor(e="*"){this.hostOrigin=e}connect(){if(typeof window>"u")return;let e=Hs();if(e)this.postFn=(n)=>e.postMessage(n);let t=(n)=>{if(this.hostOrigin!=="*"&&n.origin!==this.hostOrigin)return;let r=n.data;if(Ns(r)){this.handleJsonRpc(r);return}if(!Sr(r)||!r.type.startsWith("prefab:"))return;let o=r;if(o.type==="prefab:tool-call-response"&&o.id){let s=this.pending.get(o.id);if(s){if(this.pending.delete(o.id),o.payload?.error!=null)s.reject(Error(k(o.payload.error)));else s.resolve(o.payload?.result);return}}let i=this.listeners.get(o.type);if(i)for(let s of i)s(o.payload??{})};window.addEventListener("message",t),this.cleanup=()=>window.removeEventListener("message",t)}async initialize(e){try{return await Promise.any([this.initPrefab(e),this.initJsonRpc(e)])}catch(t){let n=t instanceof AggregateError?t.errors.map((r)=>r.message).join("; "):String(t);throw Error(`Bridge init failed — no host responded. Tried: ${n}`,{cause:t})}}createTransport(){if(this.protocol==="jsonrpc")return this.createJsonRpcTransport();return this.createPrefabTransport()}requestMode(e){if(this.protocol==="jsonrpc")this.sendRpcRequest("ui/request-display-mode",{mode:e});else this.sendPrefab("prefab:request-mode",{mode:e})}openLink(e,t){if(this.protocol==="jsonrpc")this.sendRpcRequest("ui/open-link",{url:e,target:t});else this.sendPrefab("prefab:open-link",{url:e,target:t})}updateContext(e){if(this.protocol==="jsonrpc")this.sendRpcRequest("ui/update-model-context",{structuredContent:e});else this.sendPrefab("prefab:update-context",{context:e})}setupAutoResize(e){if(typeof ResizeObserver>"u")return Mr;let t=-1,n=-1,r=(s,a)=>{if(s===t&&a===n)return;if(t=s,n=a,this.protocol==="jsonrpc")this.sendRpcNotification("ui/notifications/size-changed",{width:s,height:a});else this.sendPrefab("prefab:size-changed",{width:s,height:a})},o=new ResizeObserver((s)=>{for(let a of s)if(a.borderBoxSize.length){let l=a.borderBoxSize[0];r(Math.ceil(l.inlineSize),Math.ceil(l.blockSize))}else{let l=a.target.getBoundingClientRect();r(Math.ceil(l.width),Math.ceil(l.height))}});o.observe(e);let i=e.getBoundingClientRect();return r(Math.ceil(i.width),Math.ceil(i.height)),()=>o.disconnect()}notifyPreferredSize(e){if(this.protocol==="jsonrpc")this.sendRpcNotification("ui/notifications/preferred-size",e);else this.sendPrefab("prefab:preferred-size",e)}subscribe(e,t,n){let r=(o)=>{if(o.uri!==e)return;t(o.contents??o.data??o)};if(this.protocol==="jsonrpc")this.on("prefab:resource-updated",r),this.sendRpcRequest("resources/subscribe",{uri:e}).catch((o)=>{this.off("prefab:resource-updated",r),n?.(o)});else this.on("prefab:resource-updated",r),this.sendPrefab("prefab:subscribe",{uri:e});return()=>{if(this.off("prefab:resource-updated",r),this.protocol==="jsonrpc")this.sendRpcRequest("resources/unsubscribe",{uri:e}).catch(Mr);else this.sendPrefab("prefab:unsubscribe",{uri:e})}}get supportsSubscriptions(){return this._hostSupportsSubscriptions}on(e,t){if(!this.listeners.has(e))this.listeners.set(e,new Set);let n=this.listeners.get(e);if(n)n.add(t)}off(e,t){this.listeners.get(e)?.delete(t)}disconnect(){this.cleanup?.(),this.listeners.clear();for(let[,e]of this.pending)e.reject(Error("Bridge disconnected"));this.pending.clear();for(let[,e]of this.rpcPending)e.reject(Error("Bridge disconnected"));this.rpcPending.clear(),this.sentRpcIds.clear()}get activeProtocol(){return this.protocol}initPrefab(e){return new Promise((t,n)=>{let r=!1,o=(i)=>{if(r)return;r=!0,this.off("prefab:init-response",o),this.protocol="prefab",this._hostSupportsSubscriptions=P(i.capabilities)?.subscriptions===!0,t(Ar(i))};this.on("prefab:init-response",o),this.sendPrefab("prefab:init",{capabilities:e}),setTimeout(()=>{if(!r)r=!0,this.off("prefab:init-response",o),n(Error("prefab:init timeout"))},2000)})}createPrefabTransport(){return{callTool:(e,t)=>{let n=`tc-${++this.callIdCounter}`;return new Promise((r,o)=>{this.pending.set(n,{resolve:r,reject:o}),this.sendPrefab("prefab:tool-call",{tool:e,arguments:t},n),setTimeout(()=>{if(this.pending.has(n))this.pending.delete(n),o(Error(`Tool call '${e}' timed out`))},30000)})},sendMessage:(e)=>(this.sendPrefab("prefab:send-message",{message:e}),Promise.resolve()),updateModelContext:(e)=>(this.sendPrefab("prefab:update-context",{context:e.structuredContent,content:e.content}),Promise.resolve()),subscribe:(e,t,n)=>this.subscribe(e,t,n),capabilities:{subscriptions:this._hostSupportsSubscriptions}}}sendPrefab(e,t,n){if(typeof window>"u")return;let r=window.parent!==window?window.parent:window,o={type:e,payload:t,id:n};r.postMessage(o,this.hostOrigin)}handleJsonRpc(e){if(!("method"in e)){let r=this.rpcPending.get(e.id);if(r)if(this.rpcPending.delete(e.id),e.error)r.reject(Error(e.error.message));else r.resolve(e.result);return}let t=e.method,n=e.params??{};if(e.id!=null&&this.sentRpcIds.delete(e.id))return;if(e.id!=null)this.postJsonRpc({jsonrpc:"2.0",id:e.id,result:{}});switch(t){case"ui/notifications/tool-input":this.dispatch("prefab:tool-input",{args:n.arguments??n});break;case"ui/notifications/tool-input-partial":this.dispatch("prefab:tool-input-partial",{args:n.arguments??n});break;case"ui/notifications/tool-result":this.dispatch("prefab:tool-result",{result:n});break;case"ui/notifications/tool-cancelled":this.dispatch("prefab:tool-cancelled",n);break;case"ui/notifications/host-context-changed":{this.dispatch("prefab:theme-update",{...ht(n)}),this.dispatch("prefab:host-context-changed",n);break}case"ui/resource-teardown":this.dispatch("prefab:teardown",n);break;case"ui/notifications/resource-updated":case"notifications/resources/updated":this.dispatch("prefab:resource-updated",n);break}}initJsonRpc(e){return new Promise((t,n)=>{let r=++this.rpcIdCounter,o=!1;this.rpcPending.set(r,{resolve:(i)=>{if(o)return;o=!0,this.protocol="jsonrpc";let s=P(i)??{},a=P(s.hostInfo)??{},l=P(s.hostContext)??{},c=P(s.hostCapabilities)??{},d=typeof l.theme==="string"||E(l.styles)?ht(l):void 0;this.postJsonRpc({jsonrpc:"2.0",method:"ui/notifications/initialized",params:{}});let f=P(c.resources);this._hostSupportsSubscriptions=c.subscriptions===!0||f?.subscribe===!0,t({hostName:b(a.name),hostVersion:b(a.version),capabilities:{toast:!0,navigation:c.openLinks!=null,messaging:!0,displayModes:Yt(l.availableDisplayModes)},theme:d,toolInput:void 0,meta:l})},reject:(i)=>{if(o)return;o=!0,n(i)}}),this.postJsonRpc({jsonrpc:"2.0",id:r,method:"ui/initialize",params:{protocolVersion:"2026-01-26",appInfo:{name:"prefab",version:Tr},appCapabilities:{...e.displayModes&&{availableDisplayModes:e.displayModes}}}}),setTimeout(()=>{if(!o)o=!0,this.rpcPending.delete(r),n(Error("ui/initialize timeout"))},2000)})}createJsonRpcTransport(){return{callTool:(e,t)=>this.sendRpcRequest("tools/call",{name:e,arguments:t}),sendMessage:async(e)=>{await this.sendRpcRequest("ui/message",{role:"user",content:[{type:"text",text:e}]})},updateModelContext:async(e)=>{await this.sendRpcRequest("ui/update-model-context",{...e})},subscribe:(e,t,n)=>this.subscribe(e,t,n),capabilities:{subscriptions:this._hostSupportsSubscriptions}}}sendRpcRequest(e,t){let n=++this.rpcIdCounter;return new Promise((r,o)=>{this.rpcPending.set(n,{resolve:r,reject:o}),this.postJsonRpc({jsonrpc:"2.0",id:n,method:e,params:t}),setTimeout(()=>{if(this.rpcPending.has(n))this.rpcPending.delete(n),o(Error(`JSON-RPC '${e}' timed out`))},30000)})}sendRpcNotification(e,t){this.postJsonRpc({jsonrpc:"2.0",method:e,params:t})}postJsonRpc(e){if(typeof window>"u")return;if((typeof e.id==="number"||typeof e.id==="string")&&typeof e.method==="string")this.sentRpcIds.add(e.id);if(this.postFn)this.postFn(e);else(window.parent!==window?window.parent:window).postMessage(e,this.hostOrigin)}dispatch(e,t){let n=this.listeners.get(e);if(n)for(let r of n)r(t)}}var Mr=()=>{};function Ke(e,t){if(t.variables)for(let[n,r]of Object.entries(t.variables))e.style.setProperty(n.startsWith("--")?n:`--${n}`,r);if(t.colorScheme&&t.colorScheme!=="auto")e.setAttribute("data-theme",t.colorScheme);if(t.fontCss)Ls(t.fontCss)}function Ls(e){if(document.getElementById("__prefab-host-fonts"))return;let n=document.createElement("style");n.id="__prefab-host-fonts",n.textContent=e,document.head.appendChild(n)}function Pe(){if(typeof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function Hs(){if(typeof window>"u")return;let e=Reflect.get(window,"acquireVsCodeApi");if(typeof e==="function")try{let t=Reflect.apply(e,void 0,[]);if(E(t)&&typeof t.postMessage==="function"){let n=t.postMessage;return{postMessage:(r)=>{Reflect.apply(n,t,[r])}}}}catch{return}return}async function bt(e){ut();let t=e?.mode??"auto",n=t==="bridge"||t==="auto"&&Pe(),r,o,i={capabilities:{}};if(n)o=new we(e?.hostOrigin),o.connect(),i=await o.initialize(e?.capabilities??{toolInput:!0}),r=o.createTransport();else if(e?.transport)r=ft(e.transport);else r=mt();if(i.theme&&typeof document<"u")Ke(document.documentElement,i.theme);if(typeof document<"u"&&!o)Os();let s,a,l,c,d,f=i.toolInput,u;if(o)o.on("prefab:tool-input",(h)=>{let y=P(h.args)??h;if(s)s(y);else f=y}),o.on("prefab:tool-result",(h)=>{let y=h.result??h;if(a)a(y);else u=y}),o.on("prefab:tool-cancelled",()=>{l?.()}),o.on("prefab:tool-input-partial",(h)=>{c?.(P(h.args)??h)}),o.on("prefab:theme-update",(h)=>{if(typeof document<"u")Ke(document.documentElement,h)}),o.on("prefab:host-context-changed",(h)=>{d?.(h)});function g(h,...y){let T=Zt(h),w=new $e,R={store:w,scope:{},transport:r,rerender:()=>x(),onToast:void 0};function x(){T.innerHTML="";for(let S of y)T.appendChild(B(S,R))}return x(),{rerender:x,store:w,destroy:()=>{T.innerHTML=""}}}return{callTool:(h,y={})=>r.callTool(h,y),sendMessage:(h)=>r.sendMessage(h),onToolInput:(h)=>{if(s=h,f){let y=f;f=void 0,queueMicrotask(()=>h(y))}},onToolResult:(h)=>{if(a=h,u!==void 0){let y=u;u=void 0,queueMicrotask(()=>h(y))}},onToolCancelled:(h)=>{l=h},onToolInputPartial:(h)=>{c=h},onHostContextChanged:(h)=>{d=h},render:g,mount:(h,y,T)=>{let w=Zt(h);return U.mount(w,y,{transport:r,...T})},requestMode:(h)=>o?.requestMode(h),openLink:(h,y)=>{if(o)o.openLink(h,y);else if(typeof window<"u")window.open(h,y??"_blank")},updateContext:(h)=>{if(o)o.updateContext(h)},setupAutoResize:(h)=>{if(!o)return Ps;let y=typeof h==="string"?Zt(h):h;return o.setupAutoResize(y)},notifyPreferredSize:(h)=>{if(o)o.notifyPreferredSize(h)},host:i,capabilities:i.capabilities,theme:i.theme,transport:r,destroy:()=>o?.disconnect()}}var Ps=()=>{};function Zt(e){if(typeof e==="string"){if(typeof document>"u")throw Error("Cannot resolve selector outside browser");let t=document.querySelector(e);if(!(t instanceof HTMLElement))throw Error(`Element not found: ${e}`);return t}return e}function Os(){function e(){let n=document.body.getAttribute("data-vscode-theme-kind");if(!n)return;let r=n.includes("light")?"light":"dark";document.documentElement.setAttribute("data-theme",r)}e(),new MutationObserver(e).observe(document.body,{attributes:!0,attributeFilter:["data-vscode-theme-kind"]})}var Nr=["Accordion","AccordionItem","Alert","AlertDescription","AlertTitle","AreaChart","Audio","Badge","BarChart","BlockQuote","Button","ButtonGroup","Calendar","Card","CardContent","CardDescription","CardFooter","CardHeader","CardTitle","Carousel","Checkbox","ChoiceCard","Code","Column","Combobox","ComboboxGroup","ComboboxLabel","ComboboxOption","ComboboxSeparator","Condition","Container","Dashboard","DashboardItem","DataTable","DatePicker","Define","Detail","Dialog","Div","Dot","DropZone","Elif","Else","Embed","ExpandableRow","Field","FieldContent","FieldDescription","FieldError","FieldTitle","ForEach","Form","Grid","GridItem","H1","H2","H3","H4","Heading","Histogram","HoverCard","Icon","If","Image","Input","Kbd","Label","Large","Lead","LineChart","Link","Loader","Markdown","MasterDetail","Mermaid","Metric","Muted","P","Page","Pages","PdfViewer","PieChart","Popover","Progress","RadarChart","RadialChart","Radio","RadioGroup","Ring","Row","ScatterChart","Select","SelectGroup","SelectLabel","SelectOption","SelectSeparator","Separator","Slider","Slot","Small","Span","Sparkline","Svg","Switch","Tab","Table","TableBody","TableCaption","TableCell","TableFooter","TableHead","TableHeader","TableRow","Tabs","Text","Textarea","Tooltip","Use","Video"];var Pr=new Set(Nr);function Oe(e,t={}){let n=[],r=t.strict??!1;if(!E(e))return n.push({path:"$",message:"Wire data must be a non-null object"}),{valid:!1,errors:n};let o=e,i=o.$prefab;if(!E(i))n.push({path:"$.$prefab",message:"Missing or invalid $prefab header"});else if(typeof i.version!=="string")n.push({path:"$.$prefab.version",message:"version must be a string"});if(o.view==null)n.push({path:"$.view",message:'Missing required "view" field'});else Qt(o.view,"$.view",n,r);if(o.state!==void 0){if(o.state===null||typeof o.state!=="object"||Array.isArray(o.state))n.push({path:"$.state",message:"state must be a plain object"})}if(o.theme!==void 0)Ds(o.theme,n);if(o.css!==void 0)Hr(o.css,"$.css",n);if(o.stylesheets!==void 0)Hr(o.stylesheets,"$.stylesheets",n);if(o.mode!==void 0&&o.mode!=="light"&&o.mode!=="dark")n.push({path:"$.mode",message:'mode must be "light" or "dark"'});let s=o.defs;if(s!==void 0)if(!E(s))n.push({path:"$.defs",message:"defs must be a plain object"});else for(let[l,c]of Object.entries(s))Qt(c,`$.defs.${l}`,n,r);let a=o.keyBindings;if(a!==void 0)if(!E(a))n.push({path:"$.keyBindings",message:"keyBindings must be a plain object"});else for(let[l,c]of Object.entries(a))en(c,`$.keyBindings.${l}`,n);return{valid:n.length===0,errors:n}}function Or(e){return Oe(e).valid}function Qt(e,t,n,r){if(!E(e)){n.push({path:t,message:"Component must be a plain object"});return}let o=e;if(typeof o.type!=="string"||o.type.length===0){n.push({path:`${t}.type`,message:'Component must have a non-empty "type" string'});return}if(r&&!Pr.has(o.type))n.push({path:`${t}.type`,message:`Unknown component type: "${o.type}"`});if(o.children!==void 0)if(!Array.isArray(o.children))n.push({path:`${t}.children`,message:"children must be an array"});else for(let s=0;s<o.children.length;s++)Qt(o.children[s],`${t}.children[${s}]`,n,r);let i=["onClick","on_click","onChange","on_change","onSubmit","on_submit","onMount","on_mount","onClose","on_close"];for(let s of i)if(o[s]!==void 0)en(o[s],`${t}.${s}`,n);for(let[s,a]of Object.entries(o)){if(s==="type"||$s.has(s)||i.includes(s))continue;if(Lr(a)||Array.isArray(a)&&a.some(Lr))n.push({path:`${t}.${s}`,message:`Components under "${s}" are ignored by the renderer; move them into "children"`})}}var $s=new Set(["children","fallback","trigger","empty","else","summary"]);function Lr(e){return E(e)&&typeof e.type==="string"&&Pr.has(e.type)}function en(e,t,n){if(Array.isArray(e)){for(let i=0;i<e.length;i++)en(e[i],`${t}[${i}]`,n);return}if(!E(e)){n.push({path:t,message:"Action must be an object or array of objects"});return}let r=e,o=typeof r.action==="string"&&r.action.length>0?r.action:typeof r.type==="string"&&r.type.length>0?r.type:void 0;if(o===void 0){n.push({path:`${t}.type`,message:'Action must have a non-empty "type" or "action" string'});return}if(o.toLowerCase()==="showtoast"){if(typeof r.message!=="string"||r.message.length===0)n.push({path:`${t}.message`,message:'showToast requires a non-empty "message" string'})}}function Hr(e,t,n){if(!Array.isArray(e)){n.push({path:t,message:`${t} must be an array of strings`});return}for(let r=0;r<e.length;r++)if(typeof e[r]!=="string")n.push({path:`${t}[${r}]`,message:"must be a string"})}function Ds(e,t){if(!E(e)){t.push({path:"$.theme",message:"theme must be a plain object"});return}for(let n of["light","dark"])if(e[n]!==void 0){if(!E(e[n]))t.push({path:`$.theme.${n}`,message:`theme.${n} must be a plain object`})}}var U={mount(e,t,n){if(ut(),e.classList.add("pf-app-root"),n?.validate!==!1)for(let w of Oe(t).errors)A.warn(`wire validation ${w.path}: ${w.message}`);let r=t,o={tracked:[],evalBlocked:!1};if(r.pipes)for(let[w,R]of Object.entries(r.pipes))$r(w,R,o);let i=new $e(r.state),s=n?.transport,a;if(!s)a=mt();else if("callTool"in s)a=s;else a=ft(s);let l=n?.onToast??Fs,c=new je;function d(w){if(!U.isPrefabData(w))return;let R=w;if(r=R,R.state)i.merge(R.state);if(R.defs)u.defs=R.defs;if(R.theme)Ut(e,R.theme);if(R.mode)Dr(e,R.mode);if(R.pipes)for(let[x,S]of Object.entries(R.pipes))$r(x,S,o);for(let x of g)x.remove();if(g.length=0,g.push(...Ir(R.css,R.stylesheets)),Fr(e,R.layout),C?.(),C=void 0,R.keyBindings)C=Xt(R.keyBindings,(x)=>{F(I(x,{store:i,transport:a,scope:{},rerender:()=>T(),remount:d,onToast:l}),"keyBinding")});T(),f(R)}function f(w){if(w.onMount!=null)F(I(w.onMount,u),"onMount")}let u={store:i,scope:{},transport:a,rerender:()=>T(),remount:d,onToast:l,defs:r.defs,destroyRegistry:c};if(Ut(e,r.theme),r.mode)Dr(e,r.mode);Fr(e,r.layout);let g=Ir(r.css,r.stylesheets),C;if(r.keyBindings)C=Xt(r.keyBindings,(w)=>{F(I(w,{store:i,transport:a,scope:{},rerender:()=>T(),remount:d,onToast:l}),"keyBinding")});let h,y=n?.themeToggle??!0;if(y!==!1)h=Je(e,typeof y==="object"?y:void 0);function T(){c.flush();let w=e.querySelector(".pf-theme-toggle");e.innerHTML="";let R=B(r.view,u);if(e.appendChild(R),w)e.appendChild(w)}return T(),f(r),{rerender:()=>T(),update(w){if(i.merge(w.update.state),T(),w.update.actions!=null)F(I(w.update.actions,u),"update action")},store:i,destroy(){c.flush(),h?.(),C?.(),fn(),hn();for(let w of g)w.remove();for(let w of o.tracked)Ie(w);e.innerHTML=""}}},isPrefabData(e){return e!=null&&typeof e==="object"&&"$prefab"in e},isPrefabUpdate(e){return e!=null&&typeof e==="object"&&"$prefab"in e&&"update"in e}};function Is(e){if(e instanceof EvalError)return!0;return e instanceof Error&&/unsafe-eval|Content Security Policy|call to Function/i.test(e.message)}function $r(e,t,n){if(un.has(e)){A.warn(`wire pipe "${e}" ignored — shadows built-in`);return}if(Ge(e)!=null){A.debug(`wire pipe "${e}" — already registered, keeping local implementation`);return}if(n.evalBlocked)return;try{let r=Function("return ("+t+")")();if(!ln(r)){A.warn(`wire pipe "${e}" — source did not evaluate to a function`);return}De(e,r),n.tracked.push(e)}catch(r){if(Is(r)){n.evalBlocked=!0,A.warn("wire pipes cannot be hydrated — this host's CSP forbids eval. Pre-register them with "+"prefab.registerPipe() from a companion script (rendererHtml({ scripts })) and they are used as-is.");return}A.warn(`wire pipe "${e}" — failed to hydrate:`,r)}}function Fs(e){if(typeof document>"u")return;let t=Vs(),n=document.createElement("div"),r=e.variant??"default";n.className=`pf-toast${r!=="default"?` pf-toast--${r}`:""}`,n.setAttribute("data-variant",r),n.setAttribute("role",r==="error"?"alert":"status");let o=document.createElement("div");if(o.className="pf-toast-title",o.textContent=e.message,n.appendChild(o),e.description){let s=document.createElement("div");s.className="pf-toast-description",s.textContent=e.description,n.appendChild(s)}t.appendChild(n);let i=e.duration??4000;setTimeout(()=>{n.classList.add("pf-toast--leaving"),setTimeout(()=>n.remove(),300)},i)}function Dr(e,t){if(He(e,t),typeof document<"u")He(document.documentElement,t)}function js(e){let t=e.trim();if(t.includes("{")||t.includes("}"))return!1;return/^(https?:)?\/\//i.test(t)||t.startsWith("/")||/\.css(\?|#|$)/i.test(t)}function Ir(e,t){let n=[];if(typeof document>"u")return n;for(let r of e??[]){let o=document.createElement("style");o.textContent=r,o.dataset.prefab="injected",document.head.appendChild(o),n.push(o)}for(let r of t??[])if(js(r)){let o=document.createElement("link");o.rel="stylesheet",o.href=r,o.dataset.prefab="injected",document.head.appendChild(o),n.push(o)}else{let o=document.createElement("style");o.textContent=r,o.dataset.prefab="injected",document.head.appendChild(o),n.push(o)}return n}function Fr(e,t){if(e.style.height="",e.style.minHeight="",e.style.maxHeight="",e.style.overflow="",!t)return;if(t.preferredHeight!=null)e.style.height=`${t.preferredHeight}px`;if(t.minHeight!=null)e.style.minHeight=`${t.minHeight}px`;if(t.maxHeight!=null)e.style.maxHeight=`${t.maxHeight}px`,e.style.overflow="auto"}function Vs(){let t=document.getElementById("prefab-toast-container");if(!t)t=document.createElement("div"),t.id="prefab-toast-container",t.className="pf-toast-region",t.setAttribute("aria-live","polite"),document.body.appendChild(t);return t}if(typeof window<"u"){Object.assign(window,{PrefabRenderer:U}),Object.assign(window,{prefab:{app:bt,mount:U.mount.bind(U),isPrefabData:U.isPrefabData.bind(U),isPrefabUpdate:U.isPrefabUpdate.bind(U),Bridge:we,isIframe:Pe,registerPipe:De,unregisterPipe:Ie,listPipes:We,registerComponent:p,createThemeToggle:Je,validateWireFormat:Oe,setLogLevel:ze}});let e=Reflect.get(window,"__PREFAB_DATA__");if(U.isPrefabData(e)){let t=document.getElementById("prefab-root");if(t)U.mount(t,e)}}})();
|
|
16
|
+
`)}function Pe(e,t){e.setAttribute("data-theme",t),e.classList.toggle("dark",t==="dark"),e.classList.toggle("light",t==="light")}function en(e,t){if(!t)return;if(t.light)for(let[n,r]of Object.entries(t.light))e.style.setProperty(`--${Yt(n)}`,Qt(r));if(t.dark){let r=document.getElementById("prefab-dark-theme");if(!r)r=document.createElement("style"),r.id="prefab-dark-theme",document.head.appendChild(r);r.textContent=$r({dark:t.dark})}}function tn(e,t){if(!e||typeof document>"u")return;let n=(r)=>{for(let[o,i]of Object.entries(e))if(Ks(o,r))r.preventDefault(),t(i)};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)}function Ks(e,t){let n=e.toLowerCase().split("+").map((i)=>i.trim()),r=n[n.length-1],o=new Set(n.slice(0,-1));if(o.has("ctrl")!==(t.ctrlKey||t.metaKey))return!1;if(o.has("shift")!==t.shiftKey)return!1;if(o.has("alt")!==t.altKey)return!1;return t.key.toLowerCase()===r}var Dr='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"/></svg>',Fr='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z"/></svg>',Ws=new Set(["top-right","top-left","bottom-right","bottom-left"]);function Gs(e,t){try{let r=localStorage.getItem(t);if(r==="light"||r==="dark")return r}catch{}let n=e.getAttribute("data-theme")??document.documentElement.getAttribute("data-theme");if(n==="light"||n==="dark")return n;if(typeof window<"u"&&window.matchMedia("(prefers-color-scheme: light)").matches)return"light";return"dark"}function qe(e,t){if(typeof document>"u")return()=>{};let n=t?.position??"top-right",r=t?.storageKey??"prefab-theme",o=t?.syncDocument??!0,i=getComputedStyle(e).position;if(i==="static"||i==="")e.style.position="relative";let s=document.createElement("button");s.className="pf-theme-toggle",s.setAttribute("aria-label","Toggle theme"),s.setAttribute("title","Toggle light/dark"),s.type="button",s.setAttribute("data-position",Ws.has(n)?n:"top-right");function a(d){if(Pe(e,d),o)Pe(document.documentElement,d);s.innerHTML=d==="dark"?Fr:Dr;try{localStorage.setItem(r,d)}catch{}}let l=Gs(e,r);a(l),s.addEventListener("click",()=>{let d=e.getAttribute("data-theme")??"dark";a(d==="dark"?"light":"dark")}),e.appendChild(s);let c;if(o)c=new MutationObserver((d)=>{for(let u of d)if(u.type==="attributes"&&u.attributeName==="data-theme"){let h=document.documentElement.getAttribute("data-theme");if((h==="light"||h==="dark")&&h!==e.getAttribute("data-theme")){Pe(e,h),s.innerHTML=h==="dark"?Fr:Dr;try{localStorage.setItem(r,h)}catch{}}}}),c.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});return()=>{c?.disconnect(),s.remove()}}function bt(e){let t=e?.baseUrl??(typeof window<"u"?window.location.origin:""),n={"Content-Type":"application/json",...e?.headers},r=e?.fetch??globalThis.fetch.bind(globalThis);return{async callTool(o,i){let s=await r(`${t}/mcp/tools/call`,{method:"POST",headers:n,body:JSON.stringify({jsonrpc:"2.0",method:"tools/call",params:{name:o,arguments:i}})});if(!s.ok)throw Error(`MCP tool call failed: ${s.status} ${s.statusText}`);let a=await s.json(),l=P(a);if(!l)return a;if(Boolean(l.error))throw Error(b(P(l.error)?.message)??"MCP tool call returned error");let d=K(P(l.result)?.content??l.content);for(let u of d)if(u.type==="text"&&typeof u.text==="string"){try{return JSON.parse(u.text)}catch{}return u.text}return l.result??l},async sendMessage(o){await r(`${t}/mcp/messages`,{method:"POST",headers:n,body:JSON.stringify({message:o})})}}}function yt(){return{callTool(e){return A.warn(`No MCP transport: callTool('${e}') ignored`),Promise.resolve(null)},sendMessage(e){return A.warn("No MCP transport: sendMessage ignored",e),Promise.resolve()}}}var Ir="0.3.24";var qs=["light","dark","auto"],Us=["inline","fullscreen","pip"];function jr(e){return E(e)&&typeof e.type==="string"&&(e.id===void 0||typeof e.id==="string")&&(e.payload===void 0||E(e.payload))}function Ct(e){return typeof e==="boolean"?e:void 0}function Vr(e){let t=P(e.capabilities)??{},n=P(e.theme),r=P(e.toolInput),o=P(e.meta);return{hostName:b(e.hostName),hostVersion:b(e.hostVersion),capabilities:{toast:Ct(t.toast),clipboard:Ct(t.clipboard),navigation:Ct(t.navigation),messaging:Ct(t.messaging),displayModes:nn(t.displayModes)},...n&&{theme:Xs(n)},...r&&{toolInput:r},...o&&{meta:o}}}function Xs(e){let t=b(e.fontCss);return{...vt({theme:e.colorScheme,styles:{variables:e.variables}}),...t!=null&&{fontCss:t}}}function nn(e){let t=Array.isArray(e)?e:[];return Us.filter((n)=>t.includes(n))}function vt(e){let t={},n=qs.find((s)=>s===e.theme);if(n)t.colorScheme=n;let r=P(e.styles),o=P(r?.variables);if(o)t.variables=Object.fromEntries(Object.entries(o).filter((s)=>typeof s[1]==="string"));let i=b(P(r?.css)?.fonts);if(i!=null)t.fontCss=i;return t}function Zs(e){return E(e)&&e.jsonrpc==="2.0"}class we{hostOrigin;listeners=new Map;protocol="prefab";cleanup;pending=new Map;callIdCounter=0;rpcPending=new Map;rpcIdCounter=0;sentRpcIds=new Set;postFn;_hostSupportsSubscriptions=!1;constructor(e="*"){this.hostOrigin=e}connect(){if(typeof window>"u")return;let e=Qs();if(e)this.postFn=(n)=>e.postMessage(n);let t=(n)=>{if(this.hostOrigin!=="*"&&n.origin!==this.hostOrigin)return;let r=n.data;if(Zs(r)){this.handleJsonRpc(r);return}if(!jr(r)||!r.type.startsWith("prefab:"))return;let o=r;if(o.type==="prefab:tool-call-response"&&o.id){let s=this.pending.get(o.id);if(s){if(this.pending.delete(o.id),o.payload?.error!=null)s.reject(Error(T(o.payload.error)));else s.resolve(o.payload?.result);return}}let i=this.listeners.get(o.type);if(i)for(let s of i)s(o.payload??{})};window.addEventListener("message",t),this.cleanup=()=>window.removeEventListener("message",t)}async initialize(e){try{return await Promise.any([this.initPrefab(e),this.initJsonRpc(e)])}catch(t){let n=t instanceof AggregateError?t.errors.map((r)=>r.message).join("; "):String(t);throw Error(`Bridge init failed — no host responded. Tried: ${n}`,{cause:t})}}createTransport(){if(this.protocol==="jsonrpc")return this.createJsonRpcTransport();return this.createPrefabTransport()}requestMode(e){if(this.protocol==="jsonrpc")this.sendRpcRequest("ui/request-display-mode",{mode:e});else this.sendPrefab("prefab:request-mode",{mode:e})}openLink(e,t){if(this.protocol==="jsonrpc")this.sendRpcRequest("ui/open-link",{url:e,target:t});else this.sendPrefab("prefab:open-link",{url:e,target:t})}updateContext(e){if(this.protocol==="jsonrpc")this.sendRpcRequest("ui/update-model-context",{structuredContent:e});else this.sendPrefab("prefab:update-context",{context:e})}setupAutoResize(e){if(typeof ResizeObserver>"u")return Br;let t=-1,n=-1,r=(s,a)=>{if(s===t&&a===n)return;if(t=s,n=a,this.protocol==="jsonrpc")this.sendRpcNotification("ui/notifications/size-changed",{width:s,height:a});else this.sendPrefab("prefab:size-changed",{width:s,height:a})},o=new ResizeObserver((s)=>{for(let a of s)if(a.borderBoxSize.length){let l=a.borderBoxSize[0];r(Math.ceil(l.inlineSize),Math.ceil(l.blockSize))}else{let l=a.target.getBoundingClientRect();r(Math.ceil(l.width),Math.ceil(l.height))}});o.observe(e);let i=e.getBoundingClientRect();return r(Math.ceil(i.width),Math.ceil(i.height)),()=>o.disconnect()}notifyPreferredSize(e){if(this.protocol==="jsonrpc")this.sendRpcNotification("ui/notifications/preferred-size",e);else this.sendPrefab("prefab:preferred-size",e)}subscribe(e,t,n){let r=(o)=>{if(o.uri!==e)return;t(o.contents??o.data??o)};if(this.protocol==="jsonrpc")this.on("prefab:resource-updated",r),this.sendRpcRequest("resources/subscribe",{uri:e}).catch((o)=>{this.off("prefab:resource-updated",r),n?.(o)});else this.on("prefab:resource-updated",r),this.sendPrefab("prefab:subscribe",{uri:e});return()=>{if(this.off("prefab:resource-updated",r),this.protocol==="jsonrpc")this.sendRpcRequest("resources/unsubscribe",{uri:e}).catch(Br);else this.sendPrefab("prefab:unsubscribe",{uri:e})}}get supportsSubscriptions(){return this._hostSupportsSubscriptions}on(e,t){if(!this.listeners.has(e))this.listeners.set(e,new Set);let n=this.listeners.get(e);if(n)n.add(t)}off(e,t){this.listeners.get(e)?.delete(t)}disconnect(){this.cleanup?.(),this.listeners.clear();for(let[,e]of this.pending)e.reject(Error("Bridge disconnected"));this.pending.clear();for(let[,e]of this.rpcPending)e.reject(Error("Bridge disconnected"));this.rpcPending.clear(),this.sentRpcIds.clear()}get activeProtocol(){return this.protocol}initPrefab(e){return new Promise((t,n)=>{let r=!1,o=(i)=>{if(r)return;r=!0,this.off("prefab:init-response",o),this.protocol="prefab",this._hostSupportsSubscriptions=P(i.capabilities)?.subscriptions===!0,t(Vr(i))};this.on("prefab:init-response",o),this.sendPrefab("prefab:init",{capabilities:e}),setTimeout(()=>{if(!r)r=!0,this.off("prefab:init-response",o),n(Error("prefab:init timeout"))},2000)})}createPrefabTransport(){return{callTool:(e,t)=>{let n=`tc-${++this.callIdCounter}`;return new Promise((r,o)=>{this.pending.set(n,{resolve:r,reject:o}),this.sendPrefab("prefab:tool-call",{tool:e,arguments:t},n),setTimeout(()=>{if(this.pending.has(n))this.pending.delete(n),o(Error(`Tool call '${e}' timed out`))},30000)})},sendMessage:(e)=>(this.sendPrefab("prefab:send-message",{message:e}),Promise.resolve()),updateModelContext:(e)=>(this.sendPrefab("prefab:update-context",{context:e.structuredContent,content:e.content}),Promise.resolve()),subscribe:(e,t,n)=>this.subscribe(e,t,n),capabilities:{subscriptions:this._hostSupportsSubscriptions}}}sendPrefab(e,t,n){if(typeof window>"u")return;let r=window.parent!==window?window.parent:window,o={type:e,payload:t,id:n};r.postMessage(o,this.hostOrigin)}handleJsonRpc(e){if(!("method"in e)){let r=this.rpcPending.get(e.id);if(r)if(this.rpcPending.delete(e.id),e.error)r.reject(Error(e.error.message));else r.resolve(e.result);return}let t=e.method,n=e.params??{};if(e.id!=null&&this.sentRpcIds.delete(e.id))return;if(e.id!=null)this.postJsonRpc({jsonrpc:"2.0",id:e.id,result:{}});switch(t){case"ui/notifications/tool-input":this.dispatch("prefab:tool-input",{args:n.arguments??n});break;case"ui/notifications/tool-input-partial":this.dispatch("prefab:tool-input-partial",{args:n.arguments??n});break;case"ui/notifications/tool-result":this.dispatch("prefab:tool-result",{result:n});break;case"ui/notifications/tool-cancelled":this.dispatch("prefab:tool-cancelled",n);break;case"ui/notifications/host-context-changed":{this.dispatch("prefab:theme-update",{...vt(n)}),this.dispatch("prefab:host-context-changed",n);break}case"ui/resource-teardown":this.dispatch("prefab:teardown",n);break;case"ui/notifications/resource-updated":case"notifications/resources/updated":this.dispatch("prefab:resource-updated",n);break}}initJsonRpc(e){return new Promise((t,n)=>{let r=++this.rpcIdCounter,o=!1;this.rpcPending.set(r,{resolve:(i)=>{if(o)return;o=!0,this.protocol="jsonrpc";let s=P(i)??{},a=P(s.hostInfo)??{},l=P(s.hostContext)??{},c=P(s.hostCapabilities)??{},d=typeof l.theme==="string"||E(l.styles)?vt(l):void 0;this.postJsonRpc({jsonrpc:"2.0",method:"ui/notifications/initialized",params:{}});let u=P(c.resources);this._hostSupportsSubscriptions=c.subscriptions===!0||u?.subscribe===!0,t({hostName:b(a.name),hostVersion:b(a.version),capabilities:{toast:!0,navigation:c.openLinks!=null,messaging:!0,displayModes:nn(l.availableDisplayModes)},theme:d,toolInput:void 0,meta:l})},reject:(i)=>{if(o)return;o=!0,n(i)}}),this.postJsonRpc({jsonrpc:"2.0",id:r,method:"ui/initialize",params:{protocolVersion:"2026-01-26",appInfo:{name:"prefab",version:Ir},appCapabilities:{...e.displayModes&&{availableDisplayModes:e.displayModes}}}}),setTimeout(()=>{if(!o)o=!0,this.rpcPending.delete(r),n(Error("ui/initialize timeout"))},2000)})}createJsonRpcTransport(){return{callTool:(e,t)=>this.sendRpcRequest("tools/call",{name:e,arguments:t}),sendMessage:async(e)=>{await this.sendRpcRequest("ui/message",{role:"user",content:[{type:"text",text:e}]})},updateModelContext:async(e)=>{await this.sendRpcRequest("ui/update-model-context",{...e})},subscribe:(e,t,n)=>this.subscribe(e,t,n),capabilities:{subscriptions:this._hostSupportsSubscriptions}}}sendRpcRequest(e,t){let n=++this.rpcIdCounter;return new Promise((r,o)=>{this.rpcPending.set(n,{resolve:r,reject:o}),this.postJsonRpc({jsonrpc:"2.0",id:n,method:e,params:t}),setTimeout(()=>{if(this.rpcPending.has(n))this.rpcPending.delete(n),o(Error(`JSON-RPC '${e}' timed out`))},30000)})}sendRpcNotification(e,t){this.postJsonRpc({jsonrpc:"2.0",method:e,params:t})}postJsonRpc(e){if(typeof window>"u")return;if((typeof e.id==="number"||typeof e.id==="string")&&typeof e.method==="string")this.sentRpcIds.add(e.id);if(this.postFn)this.postFn(e);else(window.parent!==window?window.parent:window).postMessage(e,this.hostOrigin)}dispatch(e,t){let n=this.listeners.get(e);if(n)for(let r of n)r(t)}}var Br=()=>{};function Ue(e,t){if(t.variables)for(let[n,r]of Object.entries(t.variables))e.style.setProperty(n.startsWith("--")?n:`--${n}`,r);if(t.colorScheme&&t.colorScheme!=="auto")e.setAttribute("data-theme",t.colorScheme);if(t.fontCss)Ys(t.fontCss)}function Ys(e){if(document.getElementById("__prefab-host-fonts"))return;let n=document.createElement("style");n.id="__prefab-host-fonts",n.textContent=e,document.head.appendChild(n)}function Oe(){if(typeof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function Qs(){if(typeof window>"u")return;let e=Reflect.get(window,"acquireVsCodeApi");if(typeof e==="function")try{let t=Reflect.apply(e,void 0,[]);if(E(t)&&typeof t.postMessage==="function"){let n=t.postMessage;return{postMessage:(r)=>{Reflect.apply(n,t,[r])}}}}catch{return}return}async function xt(e){gt();let t=e?.mode??"auto",n=t==="bridge"||t==="auto"&&Oe(),r,o,i={capabilities:{}};if(n)o=new we(e?.hostOrigin),o.connect(),i=await o.initialize(e?.capabilities??{toolInput:!0}),r=o.createTransport();else if(e?.transport)r=bt(e.transport);else r=yt();if(i.theme&&typeof document<"u")Ue(document.documentElement,i.theme);if(typeof document<"u"&&!o)ta();let s,a,l,c,d,u=i.toolInput,h;if(o)o.on("prefab:tool-input",(g)=>{let y=P(g.args)??g;if(s)s(y);else u=y}),o.on("prefab:tool-result",(g)=>{let y=g.result??g;if(a)a(y);else h=y}),o.on("prefab:tool-cancelled",()=>{l?.()}),o.on("prefab:tool-input-partial",(g)=>{c?.(P(g.args)??g)}),o.on("prefab:theme-update",(g)=>{if(typeof document<"u")Ue(document.documentElement,g)}),o.on("prefab:host-context-changed",(g)=>{d?.(g)});function m(g,...y){let M=rn(g),w=new De,k={store:w,scope:{},transport:r,rerender:()=>x(),onToast:void 0};function x(){M.innerHTML="";for(let R of y)M.appendChild(B(R,k))}return x(),{rerender:x,store:w,destroy:()=>{M.innerHTML=""}}}return{callTool:(g,y={})=>r.callTool(g,y),sendMessage:(g)=>r.sendMessage(g),onToolInput:(g)=>{if(s=g,u){let y=u;u=void 0,queueMicrotask(()=>g(y))}},onToolResult:(g)=>{if(a=g,h!==void 0){let y=h;h=void 0,queueMicrotask(()=>g(y))}},onToolCancelled:(g)=>{l=g},onToolInputPartial:(g)=>{c=g},onHostContextChanged:(g)=>{d=g},render:m,mount:(g,y,M)=>{let w=rn(g);return U.mount(w,y,{transport:r,...M})},requestMode:(g)=>o?.requestMode(g),openLink:(g,y)=>{if(o)o.openLink(g,y);else if(typeof window<"u")window.open(g,y??"_blank")},updateContext:(g)=>{if(o)o.updateContext(g)},setupAutoResize:(g)=>{if(!o)return ea;let y=typeof g==="string"?rn(g):g;return o.setupAutoResize(y)},notifyPreferredSize:(g)=>{if(o)o.notifyPreferredSize(g)},host:i,capabilities:i.capabilities,theme:i.theme,transport:r,destroy:()=>o?.disconnect()}}var ea=()=>{};function rn(e){if(typeof e==="string"){if(typeof document>"u")throw Error("Cannot resolve selector outside browser");let t=document.querySelector(e);if(!(t instanceof HTMLElement))throw Error(`Element not found: ${e}`);return t}return e}function ta(){function e(){let n=document.body.getAttribute("data-vscode-theme-kind");if(!n)return;let r=n.includes("light")?"light":"dark";document.documentElement.setAttribute("data-theme",r)}e(),new MutationObserver(e).observe(document.body,{attributes:!0,attributeFilter:["data-vscode-theme-kind"]})}var _r=["Accordion","AccordionItem","Alert","AlertDescription","AlertTitle","AreaChart","Audio","Badge","BarChart","BlockQuote","Button","ButtonGroup","Calendar","Card","CardContent","CardDescription","CardFooter","CardHeader","CardTitle","Carousel","Checkbox","ChoiceCard","Code","Column","Combobox","ComboboxGroup","ComboboxLabel","ComboboxOption","ComboboxSeparator","Condition","Container","Dashboard","DashboardItem","DataTable","DatePicker","Define","Detail","Dialog","Div","Dot","DropZone","Elif","Else","Embed","ExpandableRow","Field","FieldContent","FieldDescription","FieldError","FieldTitle","ForEach","Form","Grid","GridItem","H1","H2","H3","H4","Heading","Histogram","HoverCard","Icon","If","Image","Input","Kbd","Label","Large","Lead","LineChart","Link","Loader","Markdown","MasterDetail","Mermaid","Metric","Muted","P","Page","Pages","PdfViewer","PieChart","Popover","Progress","RadarChart","RadialChart","Radio","RadioGroup","Ring","Row","ScatterChart","Select","SelectGroup","SelectLabel","SelectOption","SelectSeparator","Separator","Slider","Slot","Small","Span","Sparkline","Svg","Switch","Tab","Table","TableBody","TableCaption","TableCell","TableFooter","TableHead","TableHeader","TableRow","Tabs","Text","Textarea","Tooltip","Use","Video"];var Kr=new Set(_r);function $e(e,t={}){let n=[],r=t.strict??!1;if(!E(e))return n.push({path:"$",message:"Wire data must be a non-null object"}),{valid:!1,errors:n};let o=e,i=o.$prefab;if(!E(i))n.push({path:"$.$prefab",message:"Missing or invalid $prefab header"});else if(typeof i.version!=="string")n.push({path:"$.$prefab.version",message:"version must be a string"});if(o.view==null)n.push({path:"$.view",message:'Missing required "view" field'});else on(o.view,"$.view",n,r);if(o.state!==void 0){if(o.state===null||typeof o.state!=="object"||Array.isArray(o.state))n.push({path:"$.state",message:"state must be a plain object"})}if(o.theme!==void 0)ra(o.theme,n);if(o.css!==void 0)Jr(o.css,"$.css",n);if(o.stylesheets!==void 0)Jr(o.stylesheets,"$.stylesheets",n);if(o.mode!==void 0&&o.mode!=="light"&&o.mode!=="dark")n.push({path:"$.mode",message:'mode must be "light" or "dark"'});let s=o.defs;if(s!==void 0)if(!E(s))n.push({path:"$.defs",message:"defs must be a plain object"});else for(let[l,c]of Object.entries(s))on(c,`$.defs.${l}`,n,r);let a=o.keyBindings;if(a!==void 0)if(!E(a))n.push({path:"$.keyBindings",message:"keyBindings must be a plain object"});else for(let[l,c]of Object.entries(a))sn(c,`$.keyBindings.${l}`,n);return{valid:n.length===0,errors:n}}function Wr(e){return $e(e).valid}function on(e,t,n,r){if(!E(e)){n.push({path:t,message:"Component must be a plain object"});return}let o=e;if(typeof o.type!=="string"||o.type.length===0){n.push({path:`${t}.type`,message:'Component must have a non-empty "type" string'});return}if(r&&!Kr.has(o.type))n.push({path:`${t}.type`,message:`Unknown component type: "${o.type}"`});if(o.children!==void 0)if(!Array.isArray(o.children))n.push({path:`${t}.children`,message:"children must be an array"});else for(let s=0;s<o.children.length;s++)on(o.children[s],`${t}.children[${s}]`,n,r);let i=["onClick","on_click","onChange","on_change","onSubmit","on_submit","onMount","on_mount","onClose","on_close"];for(let s of i)if(o[s]!==void 0)sn(o[s],`${t}.${s}`,n);for(let[s,a]of Object.entries(o)){if(s==="type"||na.has(s)||i.includes(s))continue;if(zr(a)||Array.isArray(a)&&a.some(zr))n.push({path:`${t}.${s}`,message:`Components under "${s}" are ignored by the renderer; move them into "children"`})}}var na=new Set(["children","fallback","trigger","empty","else","summary"]);function zr(e){return E(e)&&typeof e.type==="string"&&Kr.has(e.type)}function sn(e,t,n){if(Array.isArray(e)){for(let i=0;i<e.length;i++)sn(e[i],`${t}[${i}]`,n);return}if(!E(e)){n.push({path:t,message:"Action must be an object or array of objects"});return}let r=e,o=typeof r.action==="string"&&r.action.length>0?r.action:typeof r.type==="string"&&r.type.length>0?r.type:void 0;if(o===void 0){n.push({path:`${t}.type`,message:'Action must have a non-empty "type" or "action" string'});return}if(o.toLowerCase()==="showtoast"){if(typeof r.message!=="string"||r.message.length===0)n.push({path:`${t}.message`,message:'showToast requires a non-empty "message" string'})}}function Jr(e,t,n){if(!Array.isArray(e)){n.push({path:t,message:`${t} must be an array of strings`});return}for(let r=0;r<e.length;r++)if(typeof e[r]!=="string")n.push({path:`${t}[${r}]`,message:"must be a string"})}function ra(e,t){if(!E(e)){t.push({path:"$.theme",message:"theme must be a plain object"});return}for(let n of["light","dark"])if(e[n]!==void 0){if(!E(e[n]))t.push({path:`$.theme.${n}`,message:`theme.${n} must be a plain object`})}}var U={mount(e,t,n){if(gt(),e.classList.add("pf-app-root"),n?.validate!==!1)for(let w of $e(t).errors)A.warn(`wire validation ${w.path}: ${w.message}`);let r=t,o={tracked:[],evalBlocked:!1};if(r.pipes)for(let[w,k]of Object.entries(r.pipes))Gr(w,k,o);let i=new De(r.state),s=n?.transport,a;if(!s)a=yt();else if("callTool"in s)a=s;else a=bt(s);let l=n?.onToast??ia,c=new Ve;function d(w){if(!U.isPrefabData(w))return;let k=w;if(r=k,k.state)i.merge(k.state);if(k.defs)h.defs=k.defs;if(k.theme)en(e,k.theme);if(k.mode)qr(e,k.mode);if(k.pipes)for(let[x,R]of Object.entries(k.pipes))Gr(x,R,o);for(let x of m)x.remove();if(m.length=0,m.push(...Ur(k.css,k.stylesheets)),Xr(e,k.layout),v?.(),v=void 0,k.keyBindings)v=tn(k.keyBindings,(x)=>{j(I(x,{store:i,transport:a,scope:{},rerender:()=>M(),remount:d,onToast:l}),"keyBinding")});M(),u(k)}function u(w){if(w.onMount!=null)j(I(w.onMount,h),"onMount")}let h={store:i,scope:{},transport:a,rerender:()=>M(),remount:d,onToast:l,defs:r.defs,destroyRegistry:c};if(en(e,r.theme),r.mode)qr(e,r.mode);Xr(e,r.layout);let m=Ur(r.css,r.stylesheets),v;if(r.keyBindings)v=tn(r.keyBindings,(w)=>{j(I(w,{store:i,transport:a,scope:{},rerender:()=>M(),remount:d,onToast:l}),"keyBinding")});let g,y=n?.themeToggle??!0;if(y!==!1)g=qe(e,typeof y==="object"?y:void 0);function M(){c.flush();let w=e.querySelector(".pf-theme-toggle");e.innerHTML="";let k=B(r.view,h);if(e.appendChild(k),w)e.appendChild(w)}return M(),u(r),{rerender:()=>M(),update(w){if(i.merge(w.update.state),M(),w.update.actions!=null)j(I(w.update.actions,h),"update action")},store:i,destroy(){c.flush(),g?.(),v?.(),yn(),xn();for(let w of m)w.remove();for(let w of o.tracked)Ie(w);e.innerHTML=""}}},isPrefabData(e){return e!=null&&typeof e==="object"&&"$prefab"in e},isPrefabUpdate(e){return e!=null&&typeof e==="object"&&"$prefab"in e&&"update"in e}};function oa(e){if(e instanceof EvalError)return!0;return e instanceof Error&&/unsafe-eval|Content Security Policy|call to Function/i.test(e.message)}function Gr(e,t,n){if(bn.has(e)){A.warn(`wire pipe "${e}" ignored — shadows built-in`);return}if(Ye(e)!=null){A.debug(`wire pipe "${e}" — already registered, keeping local implementation`);return}if(n.evalBlocked)return;try{let r=Function("return ("+t+")")();if(!fn(r)){A.warn(`wire pipe "${e}" — source did not evaluate to a function`);return}Fe(e,r),n.tracked.push(e)}catch(r){if(oa(r)){n.evalBlocked=!0,A.warn("wire pipes cannot be hydrated — this host's CSP forbids eval. Pre-register them with "+"prefab.registerPipe() from a companion script (rendererHtml({ scripts })) and they are used as-is.");return}A.warn(`wire pipe "${e}" — failed to hydrate:`,r)}}function ia(e){if(typeof document>"u")return;let t=aa(),n=document.createElement("div"),r=e.variant??"default";n.className=`pf-toast${r!=="default"?` pf-toast--${r}`:""}`,n.setAttribute("data-variant",r),n.setAttribute("role",r==="error"?"alert":"status");let o=document.createElement("div");if(o.className="pf-toast-title",o.textContent=e.message,n.appendChild(o),e.description){let s=document.createElement("div");s.className="pf-toast-description",s.textContent=e.description,n.appendChild(s)}t.appendChild(n);let i=e.duration??4000;setTimeout(()=>{n.classList.add("pf-toast--leaving"),setTimeout(()=>n.remove(),300)},i)}function qr(e,t){if(Pe(e,t),typeof document<"u")Pe(document.documentElement,t)}function sa(e){let t=e.trim();if(t.includes("{")||t.includes("}"))return!1;return/^(https?:)?\/\//i.test(t)||t.startsWith("/")||/\.css(\?|#|$)/i.test(t)}function Ur(e,t){let n=[];if(typeof document>"u")return n;for(let r of e??[]){let o=document.createElement("style");o.textContent=r,o.dataset.prefab="injected",document.head.appendChild(o),n.push(o)}for(let r of t??[])if(sa(r)){let o=document.createElement("link");o.rel="stylesheet",o.href=r,o.dataset.prefab="injected",document.head.appendChild(o),n.push(o)}else{let o=document.createElement("style");o.textContent=r,o.dataset.prefab="injected",document.head.appendChild(o),n.push(o)}return n}function Xr(e,t){if(e.style.height="",e.style.minHeight="",e.style.maxHeight="",e.style.overflow="",!t)return;if(t.preferredHeight!=null)e.style.height=`${t.preferredHeight}px`;if(t.minHeight!=null)e.style.minHeight=`${t.minHeight}px`;if(t.maxHeight!=null)e.style.maxHeight=`${t.maxHeight}px`,e.style.overflow="auto"}function aa(){let t=document.getElementById("prefab-toast-container");if(!t)t=document.createElement("div"),t.id="prefab-toast-container",t.className="pf-toast-region",t.setAttribute("aria-live","polite"),document.body.appendChild(t);return t}if(typeof window<"u"){Object.assign(window,{PrefabRenderer:U}),Object.assign(window,{prefab:{app:xt,mount:U.mount.bind(U),isPrefabData:U.isPrefabData.bind(U),isPrefabUpdate:U.isPrefabUpdate.bind(U),Bridge:we,isIframe:Oe,registerPipe:Fe,unregisterPipe:Ie,listPipes:Ze,registerComponent:p,createThemeToggle:qe,validateWireFormat:$e,setLogLevel:Xe}});let e=Reflect.get(window,"__PREFAB_DATA__");if(U.isPrefabData(e)){let t=document.getElementById("prefab-root");if(t)U.mount(t,e)}}})();
|