@cloudcrane/app-runtime 0.3.0 → 0.6.0
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/README.md +15 -1
- package/dist/compiler/compile.d.ts +1 -0
- package/dist/compiler/compile.js +7 -2
- package/dist/compiler/runtime.generated.d.ts +3 -3
- package/dist/compiler/runtime.generated.js +3 -3
- package/dist/host.d.ts +1 -1
- package/dist/host.js +1 -1
- package/dist/runtime/styles.d.ts +1 -1
- package/dist/runtime/styles.js +2 -1
- package/package.json +3 -3
- package/runtime-lock.json +3 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const RUNTIME_VERSION = "0.
|
|
2
|
-
export declare const RUNTIME_SHA256 = "
|
|
3
|
-
export declare const RUNTIME_JS = "var iv=Object.create;var Vc=Object.defineProperty;var ov=Object.getOwnPropertyDescriptor;var sv=Object.getOwnPropertyNames;var av=Object.getPrototypeOf,cv=Object.prototype.hasOwnProperty;var $d=(n,e)=>()=>{try{return e||n((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},uv=(n,e)=>{for(var t in e)Vc(n,t,{get:e[t],enumerable:!0})},lv=(n,e,t,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let i of sv(e))!cv.call(n,i)&&i!==t&&Vc(n,i,{get:()=>e[i],enumerable:!(r=ov(e,i))||r.enumerable});return n};var Id=(n,e,t)=>(t=n!=null?iv(av(n)):{},lv(e||!n||!n.__esModule?Vc(t,\"default\",{value:n,enumerable:!0}):t,n));var Jh=$d((MR,Kh)=>{Kh.exports=(function(n){var e={};function t(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return n[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=n,t.c=e,t.d=function(r,i,o){t.o(r,i)||Object.defineProperty(r,i,{enumerable:!0,get:o})},t.r=function(r){typeof Symbol<\"u\"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(r,\"__esModule\",{value:!0})},t.t=function(r,i){if(1&i&&(r=t(r)),8&i||4&i&&typeof r==\"object\"&&r&&r.__esModule)return r;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,\"default\",{enumerable:!0,value:r}),2&i&&typeof r!=\"string\")for(var s in r)t.d(o,s,function(a){return r[a]}.bind(null,s));return o},t.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(i,\"a\",i),i},t.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},t.p=\"\",t(t.s=0)})([function(n,e,t){\"use strict\";t.r(e),t.d(e,\"validateHTMLColorName\",(function(){return s})),t.d(e,\"validateHTMLColorSpecialName\",(function(){return a})),t.d(e,\"validateHTMLColorHex\",(function(){return c})),t.d(e,\"validateHTMLColorRgb\",(function(){return h})),t.d(e,\"validateHTMLColorHsl\",(function(){return b})),t.d(e,\"validateHTMLColorHwb\",(function(){return v})),t.d(e,\"validateHTMLColorLab\",(function(){return x})),t.d(e,\"validateHTMLColorLch\",(function(){return $})),t.d(e,\"validateHTMLColor\",(function(){return M}));let r=w=>w&&typeof w==\"string\",i=[\"AliceBlue\",\"AntiqueWhite\",\"Aqua\",\"Aquamarine\",\"Azure\",\"Beige\",\"Bisque\",\"Black\",\"BlanchedAlmond\",\"Blue\",\"BlueViolet\",\"Brown\",\"BurlyWood\",\"CadetBlue\",\"Chartreuse\",\"Chocolate\",\"Coral\",\"CornflowerBlue\",\"Cornsilk\",\"Crimson\",\"Cyan\",\"DarkBlue\",\"DarkCyan\",\"DarkGoldenrod\",\"DarkGray\",\"DarkGrey\",\"DarkGreen\",\"DarkKhaki\",\"DarkMagenta\",\"DarkOliveGreen\",\"DarkOrange\",\"DarkOrchid\",\"DarkRed\",\"DarkSalmon\",\"DarkSeaGreen\",\"DarkSlateBlue\",\"DarkSlateGray\",\"DarkSlateGrey\",\"DarkTurquoise\",\"DarkViolet\",\"DeepPink\",\"DeepSkyBlue\",\"DimGray\",\"DimGrey\",\"DodgerBlue\",\"FireBrick\",\"FloralWhite\",\"ForestGreen\",\"Fuchsia\",\"Gainsboro\",\"GhostWhite\",\"Gold\",\"Goldenrod\",\"Gray\",\"Grey\",\"Green\",\"GreenYellow\",\"HoneyDew\",\"HotPink\",\"IndianRed\",\"Indigo\",\"Ivory\",\"Khaki\",\"Lavender\",\"LavenderBlush\",\"LawnGreen\",\"LemonChiffon\",\"LightBlue\",\"LightCoral\",\"LightCyan\",\"LightGoldenrodYellow\",\"LightGray\",\"LightGrey\",\"LightGreen\",\"LightPink\",\"LightSalmon\",\"LightSalmon\",\"LightSeaGreen\",\"LightSkyBlue\",\"LightSlateGray\",\"LightSlateGrey\",\"LightSteelBlue\",\"LightYellow\",\"Lime\",\"LimeGreen\",\"Linen\",\"Magenta\",\"Maroon\",\"MediumAquamarine\",\"MediumBlue\",\"MediumOrchid\",\"MediumPurple\",\"MediumSeaGreen\",\"MediumSlateBlue\",\"MediumSlateBlue\",\"MediumSpringGreen\",\"MediumTurquoise\",\"MediumVioletRed\",\"MidnightBlue\",\"MintCream\",\"MistyRose\",\"Moccasin\",\"NavajoWhite\",\"Navy\",\"OldLace\",\"Olive\",\"OliveDrab\",\"Orange\",\"OrangeRed\",\"Orchid\",\"PaleGoldenrod\",\"PaleGreen\",\"PaleTurquoise\",\"PaleVioletRed\",\"PapayaWhip\",\"PeachPuff\",\"Peru\",\"Pink\",\"Plum\",\"PowderBlue\",\"Purple\",\"RebeccaPurple\",\"Red\",\"RosyBrown\",\"RoyalBlue\",\"SaddleBrown\",\"Salmon\",\"SandyBrown\",\"SeaGreen\",\"SeaShell\",\"Sienna\",\"Silver\",\"SkyBlue\",\"SlateBlue\",\"SlateGray\",\"SlateGrey\",\"Snow\",\"SpringGreen\",\"SteelBlue\",\"Tan\",\"Teal\",\"Thistle\",\"Tomato\",\"Turquoise\",\"Violet\",\"Wheat\",\"White\",\"WhiteSmoke\",\"Yellow\",\"YellowGreen\"],o=[\"currentColor\",\"inherit\",\"transparent\"],s=w=>{let N=!1;return r(w)&&i.map(L=>(w.toLowerCase()===L.toLowerCase()&&(N=!0),null)),N},a=w=>{let N=!1;return r(w)&&o.map(L=>(w.toLowerCase()===L.toLowerCase()&&(N=!0),null)),N},c=w=>r(w)?w&&/^#([\\da-f]{3}){1,2}$|^#([\\da-f]{4}){1,2}$/i.test(w):!1,u=\"(([\\\\d]{0,5})((\\\\.([\\\\d]{1,5}))?))\",l=`(${u}%)`,p=\"(([0-9]|[1-9][0-9]|100)%)\",f=`(${p}|(0?((\\\\.([\\\\d]{1,5}))?))|1)`,m=`([\\\\s]{0,5})\\\\)?)(([\\\\s]{0,5})(\\\\/?)([\\\\s]{1,5})${`(((${p}))|(0?((\\\\.([\\\\d]{1,5}))?))|1))?`}([\\\\s]{0,5})\\\\)`,g=\"(-?(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-5][0-9])((\\\\.([\\\\d]{1,5}))?)|360)(deg)?)\",h=w=>{if(r(w)){let N=\"([\\\\s]{0,5})([\\\\d]{1,5})%?([\\\\s]{0,5}),?\",L=\"((([\\\\s]{0,5}),?([\\\\s]{0,5}))|(([\\\\s]{1,5})))\",V=new RegExp(`^(rgb)a?\\\\(${`${N}${L}`}${`${N}${L}`}${`${N}${L}`}((\\\\/?([\\\\s]{0,5})(0?\\\\.?([\\\\d]{1,5})%?([\\\\s]{0,5}))?|1|0))?\\\\)$`);return w&&V.test(w)}return!1},b=w=>{if(r(w)){let N=new RegExp(`^(hsl)a?\\\\((([\\\\s]{0,5})(${g}|(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-9][0-9]|400)grad)|((([0-5])?\\\\.([\\\\d]{1,5})|6\\\\.([0-9]|1[0-9]|2[0-8])|[0-6])rad)|((0?((\\\\.([\\\\d]{1,5}))?)|1)turn))((([\\\\s]{0,5}),([\\\\s]{0,5}))|(([\\\\s]{1,5}))))(([\\\\s]{0,5})(0|${p})((([\\\\s]{0,5}),([\\\\s]{0,5}))|(([\\\\s]{1,5}))))(([\\\\s]{0,5})(0|${p})([\\\\s]{0,5})\\\\)?)(([\\\\s]{0,5})(\\\\/?|,?)([\\\\s]{0,5})(((${p}))|(0?((\\\\.([\\\\d]{1,5}))?))|1))?\\\\)$`);return w&&N.test(w)}return!1},v=w=>{if(r(w)){let N=new RegExp(`^(hwb\\\\(([\\\\s]{0,5})${g}([\\\\s]{1,5}))((0|${p})([\\\\s]{1,5}))((0|${p})${m}$`);return w&&N.test(w)}return!1},x=w=>{if(r(w)){let N=\"(-?(([0-9]|[1-9][0-9]|1[0-5][0-9])((\\\\.([\\\\d]{1,5}))?)?|160))\",L=new RegExp(`^(lab\\\\(([\\\\s]{0,5})${l}([\\\\s]{1,5})${N}([\\\\s]{1,5})${N}${m}$`);return w&&L.test(w)}return!1},$=w=>{if(r(w)){let N=\"((([0-9]|[1-9][0-9])?((\\\\.([\\\\d]{1,5}))?)|100)(%)?)\",L=\"\"+u,V=`((${g})|(0|${f})|(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-5][0-9])((\\\\.([\\\\d]{1,5}))?)|360))`,O=`(\\\\/([\\\\s]{0,5})${f})`,J=new RegExp(`^lch\\\\(${`(([\\\\s]{0,5})${N}([\\\\s]{1,5})${L}([\\\\s]{1,5})${V}([\\\\s]{0,5})(${O})?)`}\\\\)$`);return w&&J.test(w)}return!1},M=w=>!!(w&&c(w)||h(w)||b(w)||v(w)||x(w)||$(w));e.default=w=>!!(w&&c(w)||s(w)||a(w)||h(w)||b(w)||v(w)||x(w)||$(w))}])});var Mb=$d((CL,Nb)=>{\"use strict\";Nb.exports=function n(e){if(typeof e==\"number\"&&isNaN(e))throw new Error(\"NaN is not allowed\");if(typeof e==\"number\"&&!isFinite(e))throw new Error(\"Infinity is not allowed\");return e===null||typeof e!=\"object\"?JSON.stringify(e):e.toJSON instanceof Function?n(e.toJSON()):Array.isArray(e)?`[${e.reduce((i,o,s)=>`${i}${s===0?\"\":\",\"}${n(o===void 0||typeof o==\"symbol\"?null:o)}`,\"\")}]`:`{${Object.keys(e).sort().reduce((r,i)=>{if(e[i]===void 0||typeof e[i]==\"symbol\")return r;let o=r.length===0?\"\":\",\";return`${r}${o}${n(i)}:${n(e[i])}`},\"\")}}`}});var Io,K,Nd,dv,Zn,Fd,Md,jd,Uc,Us,ko,Pd,Wc,zc,qc,Ld,zs={},qs=[],fv=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Fo=Array.isArray;function nn(n,e){for(var t in e)n[t]=e[t];return n}function Hc(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function vt(n,e,t){var r,i,o,s={};for(o in e)o==\"key\"?r=e[o]:o==\"ref\"?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?Io.call(arguments,2):t),typeof n==\"function\"&&n.defaultProps!=null)for(o in n.defaultProps)s[o]===void 0&&(s[o]=n.defaultProps[o]);return $o(n,s,r,i,null)}function $o(n,e,t,r,i){var o={type:n,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Nd,__i:-1,__u:0};return i==null&&K.vnode!=null&&K.vnode(o),o}function Gc(){return{current:null}}function Ie(n){return n.children}function Ft(n,e){this.props=n,this.context=e}function $r(n,e){if(e==null)return n.__?$r(n.__,n.__i+1):null;for(var t;e<n.__k.length;e++)if((t=n.__k[e])!=null&&t.__e!=null)return t.__e;return typeof n.type==\"function\"?$r(n):null}function pv(n){if(n.__P&&n.__d){var e=n.__v,t=e.__e,r=[],i=[],o=nn({},e);o.__v=e.__v+1,K.vnode&&K.vnode(o),Kc(n.__P,o,e,n.__n,n.__P.namespaceURI,32&e.__u?[t]:null,r,t??$r(e),!!(32&e.__u),i),o.__v=e.__v,o.__.__k[o.__i]=o,qd(r,o,i),e.__e=e.__=null,o.__e!=t&&Bd(o)}}function Bd(n){if((n=n.__)!=null&&n.__c!=null)return n.__e=n.__c.base=null,n.__k.some(function(e){if(e!=null&&e.__e!=null)return n.__e=n.__c.base=e.__e}),Bd(n)}function Zc(n){(!n.__d&&(n.__d=!0)&&Zn.push(n)&&!Zs.__r++||Fd!=K.debounceRendering)&&((Fd=K.debounceRendering)||Md)(Zs)}function Zs(){try{for(var n,e=1;Zn.length;)Zn.length>e&&Zn.sort(jd),n=Zn.shift(),e=Zn.length,pv(n)}finally{Zn.length=Zs.__r=0}}function Vd(n,e,t,r,i,o,s,a,c,u,l){var p,f,m,g,h,b,v=r&&r.__k||qs,x=e.length;for(c=hv(t,e,v,c,x),p=0;p<x;p++)(m=t.__k[p])!=null&&(f=m.__i!=-1&&v[m.__i]||zs,m.__i=p,b=Kc(n,m,f,i,o,s,a,c,u,l),g=m.__e,m.ref&&f.ref!=m.ref&&(f.ref&&Jc(f.ref,null,m),l.push(m.ref,m.__c||g,m)),h==null&&g!=null&&(h=g),4&m.__u?(c=Ud(m,c,n),f.__e&&(f.__e=null)):typeof m.type==\"function\"&&b!==void 0?c=b:g&&(c=g.nextSibling),m.__u&=-7);return t.__e=h,c}function hv(n,e,t,r,i){var o,s,a,c,u,l=t.length,p=l,f=0;for(n.__k=new Array(i),o=0;o<i;o++)(s=e[o])!=null&&typeof s!=\"boolean\"&&typeof s!=\"function\"?(typeof s==\"string\"||typeof s==\"number\"||typeof s==\"bigint\"||s.constructor==String?s=n.__k[o]=$o(null,s,null,null,null):Fo(s)?s=n.__k[o]=$o(Ie,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=n.__k[o]=$o(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):n.__k[o]=s,c=o+f,s.__=n,s.__b=n.__b+1,a=null,(u=s.__i=mv(s,t,c,p))!=-1&&(p--,(a=t[u])&&(a.__u|=2)),a==null||a.__v==null?(u==-1&&(i>l?f--:i<l&&f++),typeof s.type!=\"function\"&&(s.__u|=4)):u!=c&&(u==c-1?f--:u==c+1?f++:(u>c?f--:f++,s.__u|=4))):n.__k[o]=null;if(p)for(o=0;o<l;o++)(a=t[o])!=null&&(2&a.__u)==0&&(a.__e==r&&(r=$r(a)),Wd(a,a));return r}function Ud(n,e,t){var r,i;if(typeof n.type==\"function\"){for(r=n.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=n,e=Ud(r[i],e,t));return e}n.__e!=e&&(e&&n.type&&!e.parentNode&&(e=$r(n)),e=t.insertBefore(n.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function rn(n,e){return e=e||[],n==null||typeof n==\"boolean\"||(Fo(n)?n.some(function(t){rn(t,e)}):e.push(n)),e}function mv(n,e,t,r){var i,o,s,a=n.key,c=n.type,u=e[t],l=u!=null&&(2&u.__u)==0;if(u===null&&a==null||l&&a==u.key&&c==u.type)return t;if(r>(l?1:0)){for(i=t-1,o=t+1;i>=0||o<e.length;)if((u=e[s=i>=0?i--:o++])!=null&&(2&u.__u)==0&&a==u.key&&c==u.type)return s}return-1}function Rd(n,e,t){e[0]==\"-\"?n.setProperty(e,t??\"\"):n[e]=t==null?\"\":typeof t!=\"number\"||fv.test(e)?t:t+\"px\"}function Vs(n,e,t,r,i){var o,s;e:if(e==\"style\")if(typeof t==\"string\")n.style.cssText=t;else{if(typeof r==\"string\"&&(n.style.cssText=r=\"\"),r)for(e in r)t&&e in t||Rd(n.style,e,\"\");if(t)for(e in t)r&&t[e]==r[e]||Rd(n.style,e,t[e])}else if(e[0]==\"o\"&&e[1]==\"n\")o=e!=(e=e.replace(Pd,\"$1\")),s=e.toLowerCase(),e=s in n||e==\"onFocusOut\"||e==\"onFocusIn\"?s.slice(2):e.slice(2),n.l||(n.l={}),n.l[e+o]=t,t?r?t[ko]=r[ko]:(t[ko]=Wc,n.addEventListener(e,o?qc:zc,o)):n.removeEventListener(e,o?qc:zc,o);else{if(i==\"http://www.w3.org/2000/svg\")e=e.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(e!=\"width\"&&e!=\"height\"&&e!=\"href\"&&e!=\"list\"&&e!=\"form\"&&e!=\"tabIndex\"&&e!=\"download\"&&e!=\"rowSpan\"&&e!=\"colSpan\"&&e!=\"role\"&&e!=\"popover\"&&e in n)try{n[e]=t??\"\";break e}catch{}typeof t==\"function\"||(t==null||t===!1&&e[4]!=\"-\"?n.removeAttribute(e):n.setAttribute(e,e==\"popover\"&&t==1?\"\":t))}}function Od(n){return function(e){if(this.l){var t=this.l[e.type+n];if(e[Us]==null)e[Us]=Wc++;else if(e[Us]<t[ko])return;return t(K.event?K.event(e):e)}}}function Kc(n,e,t,r,i,o,s,a,c,u){var l,p,f,m,g,h,b,v,x,$,M,w,N,L,V,O,J=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),o=[a=e.__e=t.__e]),(l=K.__b)&&l(e);e:if(typeof J==\"function\"){p=s.length;try{if(x=e.props,$=J.prototype&&J.prototype.render,M=(l=J.contextType)&&r[l.__c],w=l?M?M.props.value:l.__:r,t.__c?v=(f=e.__c=t.__c).__=f.__E:($?e.__c=f=new J(x,w):(e.__c=f=new Ft(x,w),f.constructor=J,f.render=yv),M&&M.sub(f),f.state||(f.state={}),f.__n=r,m=f.__d=!0,f.__h=[],f._sb=[]),$&&f.__s==null&&(f.__s=f.state),$&&J.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=nn({},f.__s)),nn(f.__s,J.getDerivedStateFromProps(x,f.__s))),g=f.props,h=f.state,f.__v=e,m)$&&J.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),$&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if($&&J.getDerivedStateFromProps==null&&x!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(x,w),e.__v==t.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(x,f.__s,w)===!1){e.__v!=t.__v&&(f.props=x,f.state=f.__s,f.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(Y){Y&&(Y.__=e)}),qs.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f),a=$r(t);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(x,f.__s,w),$&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,b)})}if(f.context=w,f.props=x,f.__P=n,f.__e=!1,N=K.__r,L=0,$)f.state=f.__s,f.__d=!1,N&&N(e),l=f.render(f.props,f.state,f.context),qs.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,N&&N(e),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++L<25);f.state=f.__s,f.getChildContext!=null&&(r=nn(nn({},r),f.getChildContext())),$&&!m&&f.getSnapshotBeforeUpdate!=null&&(b=f.getSnapshotBeforeUpdate(g,h)),V=l!=null&&l.type===Ie&&l.key==null?Zd(l.props.children):l,a=Vd(n,Fo(V)?V:[V],e,t,r,i,o,s,a,c,u),f.base=e.__e,e.__u&=-161,f.__h.length&&s.push(f),v&&(f.__E=f.__=null)}catch(Y){if(s.length=p,e.__v=null,c||o!=null){if(Y.then){for(e.__u|=c?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o!=null&&(o[o.indexOf(a)]=null),e.__e=a}else if(o!=null)for(O=o.length;O--;)Hc(o[O])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),Y.then||zd(e),K.__e(Y,e,t)}}else o==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=gv(t.__e,e,t,r,i,o,s,c,u);return(l=K.diffed)&&l(e),128&e.__u?void 0:a}function zd(n){n&&(n.__c&&(n.__c.__e=!0),n.__k&&n.__k.some(zd))}function qd(n,e,t){for(var r=0;r<t.length;r++)Jc(t[r],t[++r],t[++r]);K.__c&&K.__c(e,n),n.some(function(i){try{n=i.__h,i.__h=[],n.some(function(o){o.call(i)})}catch(o){K.__e(o,i.__v)}})}function Zd(n){return typeof n!=\"object\"||n==null||n.__b>0?n:Fo(n)?n.map(Zd):n.constructor!==void 0?null:nn({},n)}function gv(n,e,t,r,i,o,s,a,c){var u,l,p,f,m,g,h,b=t.props||zs,v=e.props,x=e.type;if(x==\"svg\"?i=\"http://www.w3.org/2000/svg\":x==\"math\"?i=\"http://www.w3.org/1998/Math/MathML\":i||(i=\"http://www.w3.org/1999/xhtml\"),o!=null){for(u=0;u<o.length;u++)if((m=o[u])&&\"setAttribute\"in m==!!x&&(x?m.localName==x:m.nodeType==3)){n=m,o[u]=null;break}}if(n==null){if(x==null)return document.createTextNode(v);n=document.createElementNS(i,x,v.is&&v),a&&(K.__m&&K.__m(e,o),a=!1),o=null}if(x==null)b===v||a&&n.data==v||(n.data=v);else{if(o=x==\"textarea\"&&v.defaultValue!=null?null:o&&Io.call(n.childNodes),!a&&o!=null)for(b={},u=0;u<n.attributes.length;u++)b[(m=n.attributes[u]).name]=m.value;for(u in b)m=b[u],u==\"dangerouslySetInnerHTML\"?p=m:u==\"children\"||u in v||u==\"value\"&&\"defaultValue\"in v||u==\"checked\"&&\"defaultChecked\"in v||Vs(n,u,null,m,i);for(u in v)m=v[u],u==\"children\"?f=m:u==\"dangerouslySetInnerHTML\"?l=m:u==\"value\"?g=m:u==\"checked\"?h=m:a&&typeof m!=\"function\"||b[u]===m||Vs(n,u,m,b[u],i);if(l)a||p&&(l.__html==p.__html||l.__html==n.innerHTML)||(n.innerHTML=l.__html),e.__k=[];else if(p&&(n.innerHTML=\"\"),Vd(e.type==\"template\"?n.content:n,Fo(f)?f:[f],e,t,r,x==\"foreignObject\"?\"http://www.w3.org/1999/xhtml\":i,o,s,o?o[0]:t.__k&&$r(t,0),a,c),o!=null)for(u=o.length;u--;)Hc(o[u]);a&&x!=\"textarea\"||(u=\"value\",x==\"progress\"&&g==null?n.removeAttribute(\"value\"):g!=null&&(g!==n[u]||x==\"progress\"&&!g||x==\"option\"&&g!=b[u])&&Vs(n,u,g,b[u],i),u=\"checked\",h!=null&&h!=n[u]&&Vs(n,u,h,b[u],i))}return n}function Jc(n,e,t){try{if(typeof n==\"function\"){var r=typeof n.__u==\"function\";r&&n.__u(),r&&e==null||(n.__u=n(e))}else n.current=e}catch(i){K.__e(i,t)}}function Wd(n,e,t){var r,i;if(K.unmount&&K.unmount(n),(r=n.ref)&&(r.current&&r.current!=n.__e||Jc(r,null,e)),(r=n.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){K.__e(o,e)}r.base=r.__P=r.__n=null}if(r=n.__k)for(i=0;i<r.length;i++)r[i]&&Wd(r[i],e,t||typeof n.type!=\"function\");t||Hc(n.__e),n.__c=n.__=n.__e=void 0}function yv(n,e,t){return this.constructor(n,t)}function Wn(n,e,t){var r,i,o,s;e==document&&(e=document.documentElement),K.__&&K.__(n,e),i=(r=typeof t==\"function\")?null:t&&t.__k||e.__k,o=[],s=[],Kc(e,n=(!r&&t||e).__k=vt(Ie,null,[n]),i||zs,zs,e.namespaceURI,!r&&t?[t]:i?null:e.firstChild?Io.call(e.childNodes):null,o,!r&&t?t:i?i.__e:e.firstChild,r,s),qd(o,n,s),n.props.children=null}function Yc(n,e){Wn(n,e,Yc)}function Hd(n,e,t){var r,i,o,s,a=nn({},n.props);for(o in n.type&&n.type.defaultProps&&(s=n.type.defaultProps),e)o==\"key\"?r=e[o]:o==\"ref\"?i=e[o]:a[o]=e[o]===void 0&&s!=null?s[o]:e[o];return arguments.length>2&&(a.children=arguments.length>3?Io.call(arguments,2):t),$o(n.type,a,r||n.key,i||n.ref,null)}function Ro(n){function e(t){var r,i;return this.getChildContext||(r=new Set,(i={})[e.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(o){this.props.value!=o.value&&r.forEach(function(s){s.__e=!0,Zc(s)})},this.sub=function(o){r.add(o);var s=o.componentWillUnmount;o.componentWillUnmount=function(){r&&r.delete(o),s&&s.call(o)}}),t.children}return e.__c=\"__cC\"+Ld++,e.__=n,e.Provider=e.__l=(e.Consumer=function(t,r){return t.children(r)}).contextType=e,e}Io=qs.slice,K={__e:function(n,e,t,r){for(var i,o,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(n)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(n,r||{}),s=i.__d),s)return i.__E=i}catch(a){n=a}throw n}},Nd=0,dv=function(n){return n!=null&&n.constructor===void 0},Ft.prototype.setState=function(n,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=nn({},this.state),typeof n==\"function\"&&(n=n(nn({},t),this.props)),n&&nn(t,n),n!=null&&this.__v&&(e&&this._sb.push(e),Zc(this))},Ft.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),Zc(this))},Ft.prototype.render=Ie,Zn=[],Md=typeof Promise==\"function\"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,jd=function(n,e){return n.__v.__b-e.__v.__b},Zs.__r=0,Uc=Math.random().toString(8),Us=\"__d\"+Uc,ko=\"__a\"+Uc,Pd=/(PointerCapture)$|Capture$/i,Wc=0,zc=Od(!1),qc=Od(!0),Ld=0;var d={};uv(d,{BRAND:()=>zv,DIRTY:()=>Ir,EMPTY_PATH:()=>xv,INVALID:()=>z,NEVER:()=>S0,OK:()=>Ge,ParseStatus:()=>Le,Schema:()=>te,ZodAny:()=>Kn,ZodArray:()=>wn,ZodBigInt:()=>Rr,ZodBoolean:()=>Or,ZodBranded:()=>No,ZodCatch:()=>Zr,ZodDate:()=>Nr,ZodDefault:()=>qr,ZodDiscriminatedUnion:()=>Gs,ZodEffects:()=>Nt,ZodEnum:()=>Ur,ZodError:()=>dt,ZodFirstPartyTypeKind:()=>T,ZodFunction:()=>Js,ZodIntersection:()=>Lr,ZodIssueCode:()=>S,ZodLazy:()=>Br,ZodLiteral:()=>Vr,ZodMap:()=>Vi,ZodNaN:()=>zi,ZodNativeEnum:()=>zr,ZodNever:()=>zt,ZodNull:()=>jr,ZodNullable:()=>an,ZodNumber:()=>Fr,ZodObject:()=>ft,ZodOptional:()=>Rt,ZodParsedType:()=>R,ZodPipeline:()=>Mo,ZodPromise:()=>Jn,ZodReadonly:()=>Wr,ZodRecord:()=>Ks,ZodSchema:()=>te,ZodSet:()=>Ui,ZodString:()=>Gn,ZodSymbol:()=>Li,ZodTransformer:()=>Nt,ZodTuple:()=>sn,ZodType:()=>te,ZodUndefined:()=>Mr,ZodUnion:()=>Pr,ZodUnknown:()=>Dn,ZodVoid:()=>Bi,addIssueToContext:()=>I,any:()=>Xv,array:()=>n0,bigint:()=>Hv,boolean:()=>of,coerce:()=>E0,custom:()=>tf,date:()=>Gv,datetimeRegex:()=>Qd,defaultErrorMap:()=>An,discriminatedUnion:()=>s0,effect:()=>b0,enum:()=>m0,function:()=>f0,getErrorMap:()=>Mi,getParsedType:()=>on,instanceof:()=>Zv,intersection:()=>a0,isAborted:()=>Ws,isAsync:()=>ji,isDirty:()=>Hs,isValid:()=>Hn,late:()=>qv,lazy:()=>p0,literal:()=>h0,makeIssue:()=>Oo,map:()=>l0,nan:()=>Wv,nativeEnum:()=>g0,never:()=>e0,null:()=>Yv,nullable:()=>_0,number:()=>rf,object:()=>r0,objectUtil:()=>Xc,oboolean:()=>w0,onumber:()=>D0,optional:()=>v0,ostring:()=>C0,pipeline:()=>A0,preprocess:()=>x0,promise:()=>y0,quotelessJson:()=>bv,record:()=>u0,set:()=>d0,setErrorMap:()=>_v,strictObject:()=>i0,string:()=>nf,symbol:()=>Kv,transformer:()=>b0,tuple:()=>c0,undefined:()=>Jv,union:()=>o0,unknown:()=>Qv,util:()=>ce,void:()=>t0});var ce;(function(n){n.assertEqual=i=>{};function e(i){}n.assertIs=e;function t(i){throw new Error}n.assertNever=t,n.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},n.getValidEnumValues=i=>{let o=n.objectKeys(i).filter(a=>typeof i[i[a]]!=\"number\"),s={};for(let a of o)s[a]=i[a];return n.objectValues(s)},n.objectValues=i=>n.objectKeys(i).map(function(o){return i[o]}),n.objectKeys=typeof Object.keys==\"function\"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},n.find=(i,o)=>{for(let s of i)if(o(s))return s},n.isInteger=typeof Number.isInteger==\"function\"?i=>Number.isInteger(i):i=>typeof i==\"number\"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,o=\" | \"){return i.map(s=>typeof s==\"string\"?`'${s}'`:s).join(o)}n.joinValues=r,n.jsonStringifyReplacer=(i,o)=>typeof o==\"bigint\"?o.toString():o})(ce||(ce={}));var Xc;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Xc||(Xc={}));var R=ce.arrayToEnum([\"string\",\"nan\",\"number\",\"integer\",\"float\",\"boolean\",\"date\",\"bigint\",\"symbol\",\"function\",\"undefined\",\"null\",\"array\",\"object\",\"unknown\",\"promise\",\"void\",\"never\",\"map\",\"set\"]),on=n=>{switch(typeof n){case\"undefined\":return R.undefined;case\"string\":return R.string;case\"number\":return Number.isNaN(n)?R.nan:R.number;case\"boolean\":return R.boolean;case\"function\":return R.function;case\"bigint\":return R.bigint;case\"symbol\":return R.symbol;case\"object\":return Array.isArray(n)?R.array:n===null?R.null:n.then&&typeof n.then==\"function\"&&n.catch&&typeof n.catch==\"function\"?R.promise:typeof Map<\"u\"&&n instanceof Map?R.map:typeof Set<\"u\"&&n instanceof Set?R.set:typeof Date<\"u\"&&n instanceof Date?R.date:R.object;default:return R.unknown}};var S=ce.arrayToEnum([\"invalid_type\",\"invalid_literal\",\"custom\",\"invalid_union\",\"invalid_union_discriminator\",\"invalid_enum_value\",\"unrecognized_keys\",\"invalid_arguments\",\"invalid_return_type\",\"invalid_date\",\"invalid_string\",\"too_small\",\"too_big\",\"invalid_intersection_types\",\"not_multiple_of\",\"not_finite\"]),bv=n=>JSON.stringify(n,null,2).replace(/\"([^\"]+)\":/g,\"$1:\"),dt=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=\"ZodError\",this.issues=e}format(e){let t=e||function(o){return o.message},r={_errors:[]},i=o=>{for(let s of o.issues)if(s.code===\"invalid_union\")s.unionErrors.map(i);else if(s.code===\"invalid_return_type\")i(s.returnTypeError);else if(s.code===\"invalid_arguments\")i(s.argumentsError);else if(s.path.length===0)r._errors.push(t(s));else{let a=r,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(t(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),r}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ce.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];t[o]=t[o]||[],t[o].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};dt.create=n=>new dt(n);var vv=(n,e)=>{let t;switch(n.code){case S.invalid_type:n.received===R.undefined?t=\"Required\":t=`Expected ${n.expected}, received ${n.received}`;break;case S.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,ce.jsonStringifyReplacer)}`;break;case S.unrecognized_keys:t=`Unrecognized key(s) in object: ${ce.joinValues(n.keys,\", \")}`;break;case S.invalid_union:t=\"Invalid input\";break;case S.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ce.joinValues(n.options)}`;break;case S.invalid_enum_value:t=`Invalid enum value. Expected ${ce.joinValues(n.options)}, received '${n.received}'`;break;case S.invalid_arguments:t=\"Invalid function arguments\";break;case S.invalid_return_type:t=\"Invalid function return type\";break;case S.invalid_date:t=\"Invalid date\";break;case S.invalid_string:typeof n.validation==\"object\"?\"includes\"in n.validation?(t=`Invalid input: must include \"${n.validation.includes}\"`,typeof n.validation.position==\"number\"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):\"startsWith\"in n.validation?t=`Invalid input: must start with \"${n.validation.startsWith}\"`:\"endsWith\"in n.validation?t=`Invalid input: must end with \"${n.validation.endsWith}\"`:ce.assertNever(n.validation):n.validation!==\"regex\"?t=`Invalid ${n.validation}`:t=\"Invalid\";break;case S.too_small:n.type===\"array\"?t=`Array must contain ${n.exact?\"exactly\":n.inclusive?\"at least\":\"more than\"} ${n.minimum} element(s)`:n.type===\"string\"?t=`String must contain ${n.exact?\"exactly\":n.inclusive?\"at least\":\"over\"} ${n.minimum} character(s)`:n.type===\"number\"?t=`Number must be ${n.exact?\"exactly equal to \":n.inclusive?\"greater than or equal to \":\"greater than \"}${n.minimum}`:n.type===\"bigint\"?t=`Number must be ${n.exact?\"exactly equal to \":n.inclusive?\"greater than or equal to \":\"greater than \"}${n.minimum}`:n.type===\"date\"?t=`Date must be ${n.exact?\"exactly equal to \":n.inclusive?\"greater than or equal to \":\"greater than \"}${new Date(Number(n.minimum))}`:t=\"Invalid input\";break;case S.too_big:n.type===\"array\"?t=`Array must contain ${n.exact?\"exactly\":n.inclusive?\"at most\":\"less than\"} ${n.maximum} element(s)`:n.type===\"string\"?t=`String must contain ${n.exact?\"exactly\":n.inclusive?\"at most\":\"under\"} ${n.maximum} character(s)`:n.type===\"number\"?t=`Number must be ${n.exact?\"exactly\":n.inclusive?\"less than or equal to\":\"less than\"} ${n.maximum}`:n.type===\"bigint\"?t=`BigInt must be ${n.exact?\"exactly\":n.inclusive?\"less than or equal to\":\"less than\"} ${n.maximum}`:n.type===\"date\"?t=`Date must be ${n.exact?\"exactly\":n.inclusive?\"smaller than or equal to\":\"smaller than\"} ${new Date(Number(n.maximum))}`:t=\"Invalid input\";break;case S.custom:t=\"Invalid input\";break;case S.invalid_intersection_types:t=\"Intersection results could not be merged\";break;case S.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case S.not_finite:t=\"Number must be finite\";break;default:t=e.defaultError,ce.assertNever(n)}return{message:t}},An=vv;var Gd=An;function _v(n){Gd=n}function Mi(){return Gd}var Oo=n=>{let{data:e,path:t,errorMaps:r,issueData:i}=n,o=[...t,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a=\"\",c=r.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}},xv=[];function I(n,e){let t=Mi(),r=Oo({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===An?void 0:An].filter(i=>!!i)});n.common.issues.push(r)}var Le=class n{constructor(){this.value=\"valid\"}dirty(){this.value===\"valid\"&&(this.value=\"dirty\")}abort(){this.value!==\"aborted\"&&(this.value=\"aborted\")}static mergeArray(e,t){let r=[];for(let i of t){if(i.status===\"aborted\")return z;i.status===\"dirty\"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let i of t){let o=await i.key,s=await i.value;r.push({key:o,value:s})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let i of t){let{key:o,value:s}=i;if(o.status===\"aborted\"||s.status===\"aborted\")return z;o.status===\"dirty\"&&e.dirty(),s.status===\"dirty\"&&e.dirty(),o.value!==\"__proto__\"&&(typeof s.value<\"u\"||i.alwaysSet)&&(r[o.value]=s.value)}return{status:e.value,value:r}}},z=Object.freeze({status:\"aborted\"}),Ir=n=>({status:\"dirty\",value:n}),Ge=n=>({status:\"valid\",value:n}),Ws=n=>n.status===\"aborted\",Hs=n=>n.status===\"dirty\",Hn=n=>n.status===\"valid\",ji=n=>typeof Promise<\"u\"&&n instanceof Promise;var P;(function(n){n.errToObj=e=>typeof e==\"string\"?{message:e}:e||{},n.toString=e=>typeof e==\"string\"?e:e?.message})(P||(P={}));var Ot=class{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Kd=(n,e)=>{if(Hn(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error(\"Validation failed but no issues detected.\");return{success:!1,get error(){if(this._error)return this._error;let t=new dt(n.common.issues);return this._error=t,this._error}}};function Q(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:i}=n;if(e&&(t||r))throw new Error(`Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:c}=n;return s.code===\"invalid_enum_value\"?{message:c??a.defaultError}:typeof a.data>\"u\"?{message:c??r??a.defaultError}:s.code!==\"invalid_type\"?{message:a.defaultError}:{message:c??t??a.defaultError}},description:i}}var te=class{get description(){return this._def.description}_getType(e){return on(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:on(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Le,ctx:{common:e.parent.common,data:e.data,parsedType:on(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ji(t))throw new Error(\"Synchronous parse encountered promise.\");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:on(e)},i=this._parseSync({data:e,path:r.path,parent:r});return Kd(r,i)}\"~validate\"(e){let t={common:{issues:[],async:!!this[\"~standard\"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:on(e)};if(!this[\"~standard\"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Hn(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes(\"encountered\")&&(this[\"~standard\"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>Hn(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:on(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(ji(i)?i:Promise.resolve(i));return Kd(r,o)}refine(e,t){let r=i=>typeof t==\"string\"||typeof t>\"u\"?{message:t}:typeof t==\"function\"?t(i):t;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:S.custom,...r(i)});return typeof Promise<\"u\"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,t){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof t==\"function\"?t(r,i):t),!1))}_refinement(e){return new Nt({schema:this,typeName:T.ZodEffects,effect:{type:\"refinement\",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[\"~standard\"]={version:1,vendor:\"zod\",validate:t=>this[\"~validate\"](t)}}optional(){return Rt.create(this,this._def)}nullable(){return an.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wn.create(this)}promise(){return Jn.create(this,this._def)}or(e){return Pr.create([this,e],this._def)}and(e){return Lr.create(this,e,this._def)}transform(e){return new Nt({...Q(this._def),schema:this,typeName:T.ZodEffects,effect:{type:\"transform\",transform:e}})}default(e){let t=typeof e==\"function\"?e:()=>e;return new qr({...Q(this._def),innerType:this,defaultValue:t,typeName:T.ZodDefault})}brand(){return new No({typeName:T.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e==\"function\"?e:()=>e;return new Zr({...Q(this._def),innerType:this,catchValue:t,typeName:T.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Mo.create(this,e)}readonly(){return Wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Av=/^c[^\\s-]{8,}$/i,Cv=/^[0-9a-z]+$/,Dv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wv=/^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i,Ev=/^[a-z0-9_-]{21}$/i,Sv=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,Tv=/^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/,kv=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,$v=\"^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$\",Qc,Iv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Fv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,Rv=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ov=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Nv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Mv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Yd=\"((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))\",jv=new RegExp(`^${Yd}$`);function Xd(n){let e=\"[0-5]\\\\d\";n.precision?e=`${e}\\\\.\\\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\\\.\\\\d+)?`);let t=n.precision?\"+\":\"?\";return`([01]\\\\d|2[0-3]):[0-5]\\\\d(:${e})${t}`}function Pv(n){return new RegExp(`^${Xd(n)}$`)}function Qd(n){let e=`${Yd}T${Xd(n)}`,t=[];return t.push(n.local?\"Z?\":\"Z\"),n.offset&&t.push(\"([+-]\\\\d{2}:?\\\\d{2})\"),e=`${e}(${t.join(\"|\")})`,new RegExp(`^${e}$`)}function Lv(n,e){return!!((e===\"v4\"||!e)&&Iv.test(n)||(e===\"v6\"||!e)&&Rv.test(n))}function Bv(n,e){if(!Sv.test(n))return!1;try{let[t]=n.split(\".\");if(!t)return!1;let r=t.replace(/-/g,\"+\").replace(/_/g,\"/\").padEnd(t.length+(4-t.length%4)%4,\"=\"),i=JSON.parse(atob(r));return!(typeof i!=\"object\"||i===null||\"typ\"in i&&i?.typ!==\"JWT\"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Vv(n,e){return!!((e===\"v4\"||!e)&&Fv.test(n)||(e===\"v6\"||!e)&&Ov.test(n))}var Gn=class n extends te{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==R.string){let o=this._getOrReturnCtx(e);return I(o,{code:S.invalid_type,expected:R.string,received:o.parsedType}),z}let r=new Le,i;for(let o of this._def.checks)if(o.kind===\"min\")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),I(i,{code:S.too_small,minimum:o.value,type:\"string\",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind===\"max\")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),I(i,{code:S.too_big,maximum:o.value,type:\"string\",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind===\"length\"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?I(i,{code:S.too_big,maximum:o.value,type:\"string\",inclusive:!0,exact:!0,message:o.message}):a&&I(i,{code:S.too_small,minimum:o.value,type:\"string\",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind===\"email\")kv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"email\",code:S.invalid_string,message:o.message}),r.dirty());else if(o.kind===\"emoji\")Qc||(Qc=new RegExp($v,\"u\")),Qc.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"emoji\",code:S.invalid_string,message:o.message}),r.dirty());else if(o.kind===\"uuid\")wv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"uuid\",code:S.invalid_string,message:o.message}),r.dirty());else if(o.kind===\"nanoid\")Ev.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"nanoid\",code:S.invalid_string,message:o.message}),r.dirty());else if(o.kind===\"cuid\")Av.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"cuid\",code:S.invalid_string,message:o.message}),r.dirty());else if(o.kind===\"cuid2\")Cv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"cuid2\",code:S.invalid_string,message:o.message}),r.dirty());else if(o.kind===\"ulid\")Dv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"ulid\",code:S.invalid_string,message:o.message}),r.dirty());else if(o.kind===\"url\")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),I(i,{validation:\"url\",code:S.invalid_string,message:o.message}),r.dirty()}else o.kind===\"regex\"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"regex\",code:S.invalid_string,message:o.message}),r.dirty())):o.kind===\"trim\"?e.data=e.data.trim():o.kind===\"includes\"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),I(i,{code:S.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind===\"toLowerCase\"?e.data=e.data.toLowerCase():o.kind===\"toUpperCase\"?e.data=e.data.toUpperCase():o.kind===\"startsWith\"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),I(i,{code:S.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind===\"endsWith\"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),I(i,{code:S.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind===\"datetime\"?Qd(o).test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{code:S.invalid_string,validation:\"datetime\",message:o.message}),r.dirty()):o.kind===\"date\"?jv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{code:S.invalid_string,validation:\"date\",message:o.message}),r.dirty()):o.kind===\"time\"?Pv(o).test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{code:S.invalid_string,validation:\"time\",message:o.message}),r.dirty()):o.kind===\"duration\"?Tv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"duration\",code:S.invalid_string,message:o.message}),r.dirty()):o.kind===\"ip\"?Lv(e.data,o.version)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"ip\",code:S.invalid_string,message:o.message}),r.dirty()):o.kind===\"jwt\"?Bv(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"jwt\",code:S.invalid_string,message:o.message}),r.dirty()):o.kind===\"cidr\"?Vv(e.data,o.version)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"cidr\",code:S.invalid_string,message:o.message}),r.dirty()):o.kind===\"base64\"?Nv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"base64\",code:S.invalid_string,message:o.message}),r.dirty()):o.kind===\"base64url\"?Mv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"base64url\",code:S.invalid_string,message:o.message}),r.dirty()):ce.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(i=>e.test(i),{validation:t,code:S.invalid_string,...P.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:\"email\",...P.errToObj(e)})}url(e){return this._addCheck({kind:\"url\",...P.errToObj(e)})}emoji(e){return this._addCheck({kind:\"emoji\",...P.errToObj(e)})}uuid(e){return this._addCheck({kind:\"uuid\",...P.errToObj(e)})}nanoid(e){return this._addCheck({kind:\"nanoid\",...P.errToObj(e)})}cuid(e){return this._addCheck({kind:\"cuid\",...P.errToObj(e)})}cuid2(e){return this._addCheck({kind:\"cuid2\",...P.errToObj(e)})}ulid(e){return this._addCheck({kind:\"ulid\",...P.errToObj(e)})}base64(e){return this._addCheck({kind:\"base64\",...P.errToObj(e)})}base64url(e){return this._addCheck({kind:\"base64url\",...P.errToObj(e)})}jwt(e){return this._addCheck({kind:\"jwt\",...P.errToObj(e)})}ip(e){return this._addCheck({kind:\"ip\",...P.errToObj(e)})}cidr(e){return this._addCheck({kind:\"cidr\",...P.errToObj(e)})}datetime(e){return typeof e==\"string\"?this._addCheck({kind:\"datetime\",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:\"datetime\",precision:typeof e?.precision>\"u\"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...P.errToObj(e?.message)})}date(e){return this._addCheck({kind:\"date\",message:e})}time(e){return typeof e==\"string\"?this._addCheck({kind:\"time\",precision:null,message:e}):this._addCheck({kind:\"time\",precision:typeof e?.precision>\"u\"?null:e?.precision,...P.errToObj(e?.message)})}duration(e){return this._addCheck({kind:\"duration\",...P.errToObj(e)})}regex(e,t){return this._addCheck({kind:\"regex\",regex:e,...P.errToObj(t)})}includes(e,t){return this._addCheck({kind:\"includes\",value:e,position:t?.position,...P.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:\"startsWith\",value:e,...P.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:\"endsWith\",value:e,...P.errToObj(t)})}min(e,t){return this._addCheck({kind:\"min\",value:e,...P.errToObj(t)})}max(e,t){return this._addCheck({kind:\"max\",value:e,...P.errToObj(t)})}length(e,t){return this._addCheck({kind:\"length\",value:e,...P.errToObj(t)})}nonempty(e){return this.min(1,P.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:\"trim\"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:\"toLowerCase\"}]})}toUpperCase(){return new n({...this._def,checks:[...this._def.checks,{kind:\"toUpperCase\"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===\"datetime\")}get isDate(){return!!this._def.checks.find(e=>e.kind===\"date\")}get isTime(){return!!this._def.checks.find(e=>e.kind===\"time\")}get isDuration(){return!!this._def.checks.find(e=>e.kind===\"duration\")}get isEmail(){return!!this._def.checks.find(e=>e.kind===\"email\")}get isURL(){return!!this._def.checks.find(e=>e.kind===\"url\")}get isEmoji(){return!!this._def.checks.find(e=>e.kind===\"emoji\")}get isUUID(){return!!this._def.checks.find(e=>e.kind===\"uuid\")}get isNANOID(){return!!this._def.checks.find(e=>e.kind===\"nanoid\")}get isCUID(){return!!this._def.checks.find(e=>e.kind===\"cuid\")}get isCUID2(){return!!this._def.checks.find(e=>e.kind===\"cuid2\")}get isULID(){return!!this._def.checks.find(e=>e.kind===\"ulid\")}get isIP(){return!!this._def.checks.find(e=>e.kind===\"ip\")}get isCIDR(){return!!this._def.checks.find(e=>e.kind===\"cidr\")}get isBase64(){return!!this._def.checks.find(e=>e.kind===\"base64\")}get isBase64url(){return!!this._def.checks.find(e=>e.kind===\"base64url\")}get minLength(){let e=null;for(let t of this._def.checks)t.kind===\"min\"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===\"max\"&&(e===null||t.value<e)&&(e=t.value);return e}};Gn.create=n=>new Gn({checks:[],typeName:T.ZodString,coerce:n?.coerce??!1,...Q(n)});function Uv(n,e){let t=(n.toString().split(\".\")[1]||\"\").length,r=(e.toString().split(\".\")[1]||\"\").length,i=t>r?t:r,o=Number.parseInt(n.toFixed(i).replace(\".\",\"\")),s=Number.parseInt(e.toFixed(i).replace(\".\",\"\"));return o%s/10**i}var Fr=class n extends te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==R.number){let o=this._getOrReturnCtx(e);return I(o,{code:S.invalid_type,expected:R.number,received:o.parsedType}),z}let r,i=new Le;for(let o of this._def.checks)o.kind===\"int\"?ce.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{code:S.invalid_type,expected:\"integer\",received:\"float\",message:o.message}),i.dirty()):o.kind===\"min\"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),I(r,{code:S.too_small,minimum:o.value,type:\"number\",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind===\"max\"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),I(r,{code:S.too_big,maximum:o.value,type:\"number\",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind===\"multipleOf\"?Uv(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),I(r,{code:S.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind===\"finite\"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{code:S.not_finite,message:o.message}),i.dirty()):ce.assertNever(o);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit(\"min\",e,!0,P.toString(t))}gt(e,t){return this.setLimit(\"min\",e,!1,P.toString(t))}lte(e,t){return this.setLimit(\"max\",e,!0,P.toString(t))}lt(e,t){return this.setLimit(\"max\",e,!1,P.toString(t))}setLimit(e,t,r,i){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:P.toString(i)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:\"int\",message:P.toString(e)})}positive(e){return this._addCheck({kind:\"min\",value:0,inclusive:!1,message:P.toString(e)})}negative(e){return this._addCheck({kind:\"max\",value:0,inclusive:!1,message:P.toString(e)})}nonpositive(e){return this._addCheck({kind:\"max\",value:0,inclusive:!0,message:P.toString(e)})}nonnegative(e){return this._addCheck({kind:\"min\",value:0,inclusive:!0,message:P.toString(e)})}multipleOf(e,t){return this._addCheck({kind:\"multipleOf\",value:e,message:P.toString(t)})}finite(e){return this._addCheck({kind:\"finite\",message:P.toString(e)})}safe(e){return this._addCheck({kind:\"min\",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:P.toString(e)})._addCheck({kind:\"max\",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:P.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===\"min\"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===\"max\"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===\"int\"||e.kind===\"multipleOf\"&&ce.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind===\"finite\"||r.kind===\"int\"||r.kind===\"multipleOf\")return!0;r.kind===\"min\"?(t===null||r.value>t)&&(t=r.value):r.kind===\"max\"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Fr.create=n=>new Fr({checks:[],typeName:T.ZodNumber,coerce:n?.coerce||!1,...Q(n)});var Rr=class n extends te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==R.bigint)return this._getInvalidInput(e);let r,i=new Le;for(let o of this._def.checks)o.kind===\"min\"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),I(r,{code:S.too_small,type:\"bigint\",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind===\"max\"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),I(r,{code:S.too_big,type:\"bigint\",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind===\"multipleOf\"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),I(r,{code:S.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):ce.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return I(t,{code:S.invalid_type,expected:R.bigint,received:t.parsedType}),z}gte(e,t){return this.setLimit(\"min\",e,!0,P.toString(t))}gt(e,t){return this.setLimit(\"min\",e,!1,P.toString(t))}lte(e,t){return this.setLimit(\"max\",e,!0,P.toString(t))}lt(e,t){return this.setLimit(\"max\",e,!1,P.toString(t))}setLimit(e,t,r,i){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:P.toString(i)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:\"min\",value:BigInt(0),inclusive:!1,message:P.toString(e)})}negative(e){return this._addCheck({kind:\"max\",value:BigInt(0),inclusive:!1,message:P.toString(e)})}nonpositive(e){return this._addCheck({kind:\"max\",value:BigInt(0),inclusive:!0,message:P.toString(e)})}nonnegative(e){return this._addCheck({kind:\"min\",value:BigInt(0),inclusive:!0,message:P.toString(e)})}multipleOf(e,t){return this._addCheck({kind:\"multipleOf\",value:e,message:P.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===\"min\"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===\"max\"&&(e===null||t.value<e)&&(e=t.value);return e}};Rr.create=n=>new Rr({checks:[],typeName:T.ZodBigInt,coerce:n?.coerce??!1,...Q(n)});var Or=class extends te{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==R.boolean){let r=this._getOrReturnCtx(e);return I(r,{code:S.invalid_type,expected:R.boolean,received:r.parsedType}),z}return Ge(e.data)}};Or.create=n=>new Or({typeName:T.ZodBoolean,coerce:n?.coerce||!1,...Q(n)});var Nr=class n extends te{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==R.date){let o=this._getOrReturnCtx(e);return I(o,{code:S.invalid_type,expected:R.date,received:o.parsedType}),z}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return I(o,{code:S.invalid_date}),z}let r=new Le,i;for(let o of this._def.checks)o.kind===\"min\"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),I(i,{code:S.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:\"date\"}),r.dirty()):o.kind===\"max\"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),I(i,{code:S.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:\"date\"}),r.dirty()):ce.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:\"min\",value:e.getTime(),message:P.toString(t)})}max(e,t){return this._addCheck({kind:\"max\",value:e.getTime(),message:P.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===\"min\"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===\"max\"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Nr.create=n=>new Nr({checks:[],coerce:n?.coerce||!1,typeName:T.ZodDate,...Q(n)});var Li=class extends te{_parse(e){if(this._getType(e)!==R.symbol){let r=this._getOrReturnCtx(e);return I(r,{code:S.invalid_type,expected:R.symbol,received:r.parsedType}),z}return Ge(e.data)}};Li.create=n=>new Li({typeName:T.ZodSymbol,...Q(n)});var Mr=class extends te{_parse(e){if(this._getType(e)!==R.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:S.invalid_type,expected:R.undefined,received:r.parsedType}),z}return Ge(e.data)}};Mr.create=n=>new Mr({typeName:T.ZodUndefined,...Q(n)});var jr=class extends te{_parse(e){if(this._getType(e)!==R.null){let r=this._getOrReturnCtx(e);return I(r,{code:S.invalid_type,expected:R.null,received:r.parsedType}),z}return Ge(e.data)}};jr.create=n=>new jr({typeName:T.ZodNull,...Q(n)});var Kn=class extends te{constructor(){super(...arguments),this._any=!0}_parse(e){return Ge(e.data)}};Kn.create=n=>new Kn({typeName:T.ZodAny,...Q(n)});var Dn=class extends te{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ge(e.data)}};Dn.create=n=>new Dn({typeName:T.ZodUnknown,...Q(n)});var zt=class extends te{_parse(e){let t=this._getOrReturnCtx(e);return I(t,{code:S.invalid_type,expected:R.never,received:t.parsedType}),z}};zt.create=n=>new zt({typeName:T.ZodNever,...Q(n)});var Bi=class extends te{_parse(e){if(this._getType(e)!==R.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:S.invalid_type,expected:R.void,received:r.parsedType}),z}return Ge(e.data)}};Bi.create=n=>new Bi({typeName:T.ZodVoid,...Q(n)});var wn=class n extends te{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==R.array)return I(t,{code:S.invalid_type,expected:R.array,received:t.parsedType}),z;if(i.exactLength!==null){let s=t.data.length>i.exactLength.value,a=t.data.length<i.exactLength.value;(s||a)&&(I(t,{code:s?S.too_big:S.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:\"array\",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(I(t,{code:S.too_small,minimum:i.minLength.value,type:\"array\",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(I(t,{code:S.too_big,maximum:i.maxLength.value,type:\"array\",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((s,a)=>i.type._parseAsync(new Ot(t,s,t.path,a)))).then(s=>Le.mergeArray(r,s));let o=[...t.data].map((s,a)=>i.type._parseSync(new Ot(t,s,t.path,a)));return Le.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:P.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:P.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:P.toString(t)}})}nonempty(e){return this.min(1,e)}};wn.create=(n,e)=>new wn({type:n,minLength:null,maxLength:null,exactLength:null,typeName:T.ZodArray,...Q(e)});function Pi(n){if(n instanceof ft){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=Rt.create(Pi(r))}return new ft({...n._def,shape:()=>e})}else return n instanceof wn?new wn({...n._def,type:Pi(n.element)}):n instanceof Rt?Rt.create(Pi(n.unwrap())):n instanceof an?an.create(Pi(n.unwrap())):n instanceof sn?sn.create(n.items.map(e=>Pi(e))):n}var ft=class n extends te{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=ce.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==R.object){let u=this._getOrReturnCtx(e);return I(u,{code:S.invalid_type,expected:R.object,received:u.parsedType}),z}let{status:r,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof zt&&this._def.unknownKeys===\"strip\"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=o[u],p=i.data[u];c.push({key:{status:\"valid\",value:u},value:l._parse(new Ot(i,p,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof zt){let u=this._def.unknownKeys;if(u===\"passthrough\")for(let l of a)c.push({key:{status:\"valid\",value:l},value:{status:\"valid\",value:i.data[l]}});else if(u===\"strict\")a.length>0&&(I(i,{code:S.unrecognized_keys,keys:a}),r.dirty());else if(u!==\"strip\")throw new Error(\"Internal ZodObject error: invalid unknownKeys value.\")}else{let u=this._def.catchall;for(let l of a){let p=i.data[l];c.push({key:{status:\"valid\",value:l},value:u._parse(new Ot(i,p,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let p=await l.key,f=await l.value;u.push({key:p,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Le.mergeObjectSync(r,u)):Le.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return P.errToObj,new n({...this._def,unknownKeys:\"strict\",...e!==void 0?{errorMap:(t,r)=>{let i=this._def.errorMap?.(t,r).message??r.defaultError;return t.code===\"unrecognized_keys\"?{message:P.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new n({...this._def,unknownKeys:\"strip\"})}passthrough(){return new n({...this._def,unknownKeys:\"passthrough\"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:T.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};for(let r of ce.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}omit(e){let t={};for(let r of ce.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return Pi(this)}partial(e){let t={};for(let r of ce.objectKeys(this.shape)){let i=this.shape[r];e&&!e[r]?t[r]=i:t[r]=i.optional()}return new n({...this._def,shape:()=>t})}required(e){let t={};for(let r of ce.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Rt;)o=o._def.innerType;t[r]=o}return new n({...this._def,shape:()=>t})}keyof(){return ef(ce.objectKeys(this.shape))}};ft.create=(n,e)=>new ft({shape:()=>n,unknownKeys:\"strip\",catchall:zt.create(),typeName:T.ZodObject,...Q(e)});ft.strictCreate=(n,e)=>new ft({shape:()=>n,unknownKeys:\"strict\",catchall:zt.create(),typeName:T.ZodObject,...Q(e)});ft.lazycreate=(n,e)=>new ft({shape:n,unknownKeys:\"strip\",catchall:zt.create(),typeName:T.ZodObject,...Q(e)});var Pr=class extends te{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function i(o){for(let a of o)if(a.result.status===\"valid\")return a.result;for(let a of o)if(a.result.status===\"dirty\")return t.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new dt(a.ctx.common.issues));return I(t,{code:S.invalid_union,unionErrors:s}),z}if(t.common.async)return Promise.all(r.map(async o=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of r){let u={...t,common:{...t.common,issues:[]},parent:null},l=c._parseSync({data:t.data,path:t.path,parent:u});if(l.status===\"valid\")return l;l.status===\"dirty\"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new dt(c));return I(t,{code:S.invalid_union,unionErrors:a}),z}}get options(){return this._def.options}};Pr.create=(n,e)=>new Pr({options:n,typeName:T.ZodUnion,...Q(e)});var Cn=n=>n instanceof Br?Cn(n.schema):n instanceof Nt?Cn(n.innerType()):n instanceof Vr?[n.value]:n instanceof Ur?n.options:n instanceof zr?ce.objectValues(n.enum):n instanceof qr?Cn(n._def.innerType):n instanceof Mr?[void 0]:n instanceof jr?[null]:n instanceof Rt?[void 0,...Cn(n.unwrap())]:n instanceof an?[null,...Cn(n.unwrap())]:n instanceof No||n instanceof Wr?Cn(n.unwrap()):n instanceof Zr?Cn(n._def.innerType):[],Gs=class n extends te{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.object)return I(t,{code:S.invalid_type,expected:R.object,received:t.parsedType}),z;let r=this.discriminator,i=t.data[r],o=this.optionsMap.get(i);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(I(t,{code:S.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let i=new Map;for(let o of t){let s=Cn(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \\`${e}\\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new n({typeName:T.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...Q(r)})}};function eu(n,e){let t=on(n),r=on(e);if(n===e)return{valid:!0,data:n};if(t===R.object&&r===R.object){let i=ce.objectKeys(e),o=ce.objectKeys(n).filter(a=>i.indexOf(a)!==-1),s={...n,...e};for(let a of o){let c=eu(n[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(t===R.array&&r===R.array){if(n.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<n.length;o++){let s=n[o],a=e[o],c=eu(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return t===R.date&&r===R.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Lr=class extends te{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(o,s)=>{if(Ws(o)||Ws(s))return z;let a=eu(o.value,s.value);return a.valid?((Hs(o)||Hs(s))&&t.dirty(),{status:t.value,value:a.data}):(I(r,{code:S.invalid_intersection_types}),z)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Lr.create=(n,e,t)=>new Lr({left:n,right:e,typeName:T.ZodIntersection,...Q(t)});var sn=class n extends te{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.array)return I(r,{code:S.invalid_type,expected:R.array,received:r.parsedType}),z;if(r.data.length<this._def.items.length)return I(r,{code:S.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:\"array\"}),z;!this._def.rest&&r.data.length>this._def.items.length&&(I(r,{code:S.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:\"array\"}),t.dirty());let o=[...r.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Ot(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>Le.mergeArray(t,s)):Le.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};sn.create=(n,e)=>{if(!Array.isArray(n))throw new Error(\"You must pass an array of schemas to z.tuple([ ... ])\");return new sn({items:n,typeName:T.ZodTuple,rest:null,...Q(e)})};var Ks=class n extends te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.object)return I(r,{code:S.invalid_type,expected:R.object,received:r.parsedType}),z;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in r.data)i.push({key:o._parse(new Ot(r,a,r.path,a)),value:s._parse(new Ot(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Le.mergeObjectAsync(t,i):Le.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof te?new n({keyType:e,valueType:t,typeName:T.ZodRecord,...Q(r)}):new n({keyType:Gn.create(),valueType:e,typeName:T.ZodRecord,...Q(t)})}},Vi=class extends te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.map)return I(r,{code:S.invalid_type,expected:R.map,received:r.parsedType}),z;let i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([a,c],u)=>({key:i._parse(new Ot(r,a,r.path,[u,\"key\"])),value:o._parse(new Ot(r,c,r.path,[u,\"value\"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status===\"aborted\"||l.status===\"aborted\")return z;(u.status===\"dirty\"||l.status===\"dirty\")&&t.dirty(),a.set(u.value,l.value)}return{status:t.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status===\"aborted\"||l.status===\"aborted\")return z;(u.status===\"dirty\"||l.status===\"dirty\")&&t.dirty(),a.set(u.value,l.value)}return{status:t.value,value:a}}}};Vi.create=(n,e,t)=>new Vi({valueType:e,keyType:n,typeName:T.ZodMap,...Q(t)});var Ui=class n extends te{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.set)return I(r,{code:S.invalid_type,expected:R.set,received:r.parsedType}),z;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(I(r,{code:S.too_small,minimum:i.minSize.value,type:\"set\",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(I(r,{code:S.too_big,maximum:i.maxSize.value,type:\"set\",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status===\"aborted\")return z;l.status===\"dirty\"&&t.dirty(),u.add(l.value)}return{status:t.value,value:u}}let a=[...r.data.values()].map((c,u)=>o._parse(new Ot(r,c,r.path,u)));return r.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,t){return new n({...this._def,minSize:{value:e,message:P.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:P.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ui.create=(n,e)=>new Ui({valueType:n,minSize:null,maxSize:null,typeName:T.ZodSet,...Q(e)});var Js=class n extends te{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.function)return I(t,{code:S.invalid_type,expected:R.function,received:t.parsedType}),z;function r(a,c){return Oo({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Mi(),An].filter(u=>!!u),issueData:{code:S.invalid_arguments,argumentsError:c}})}function i(a,c){return Oo({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Mi(),An].filter(u=>!!u),issueData:{code:S.invalid_return_type,returnTypeError:c}})}let o={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Jn){let a=this;return Ge(async function(...c){let u=new dt([]),l=await a._def.args.parseAsync(c,o).catch(m=>{throw u.addIssue(r(c,m)),u}),p=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(p,o).catch(m=>{throw u.addIssue(i(p,m)),u})})}else{let a=this;return Ge(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new dt([r(c,u.error)]);let l=Reflect.apply(s,this,u.data),p=a._def.returns.safeParse(l,o);if(!p.success)throw new dt([i(l,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:sn.create(e).rest(Dn.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||sn.create([]).rest(Dn.create()),returns:t||Dn.create(),typeName:T.ZodFunction,...Q(r)})}},Br=class extends te{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Br.create=(n,e)=>new Br({getter:n,typeName:T.ZodLazy,...Q(e)});var Vr=class extends te{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return I(t,{received:t.data,code:S.invalid_literal,expected:this._def.value}),z}return{status:\"valid\",value:e.data}}get value(){return this._def.value}};Vr.create=(n,e)=>new Vr({value:n,typeName:T.ZodLiteral,...Q(e)});function ef(n,e){return new Ur({values:n,typeName:T.ZodEnum,...Q(e)})}var Ur=class n extends te{_parse(e){if(typeof e.data!=\"string\"){let t=this._getOrReturnCtx(e),r=this._def.values;return I(t,{expected:ce.joinValues(r),received:t.parsedType,code:S.invalid_type}),z}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return I(t,{received:t.data,code:S.invalid_enum_value,options:r}),z}return Ge(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return n.create(e,{...this._def,...t})}exclude(e,t=this._def){return n.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};Ur.create=ef;var zr=class extends te{_parse(e){let t=ce.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==R.string&&r.parsedType!==R.number){let i=ce.objectValues(t);return I(r,{expected:ce.joinValues(i),received:r.parsedType,code:S.invalid_type}),z}if(this._cache||(this._cache=new Set(ce.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ce.objectValues(t);return I(r,{received:r.data,code:S.invalid_enum_value,options:i}),z}return Ge(e.data)}get enum(){return this._def.values}};zr.create=(n,e)=>new zr({values:n,typeName:T.ZodNativeEnum,...Q(e)});var Jn=class extends te{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.promise&&t.common.async===!1)return I(t,{code:S.invalid_type,expected:R.promise,received:t.parsedType}),z;let r=t.parsedType===R.promise?t.data:Promise.resolve(t.data);return Ge(r.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Jn.create=(n,e)=>new Jn({type:n,typeName:T.ZodPromise,...Q(e)});var Nt=class extends te{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===T.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{I(r,s),s.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type===\"preprocess\"){let s=i.transform(r.data,o);if(r.common.async)return Promise.resolve(s).then(async a=>{if(t.value===\"aborted\")return z;let c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status===\"aborted\"?z:c.status===\"dirty\"?Ir(c.value):t.value===\"dirty\"?Ir(c.value):c});{if(t.value===\"aborted\")return z;let a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status===\"aborted\"?z:a.status===\"dirty\"?Ir(a.value):t.value===\"dirty\"?Ir(a.value):a}}if(i.type===\"refinement\"){let s=a=>{let c=i.refinement(a,o);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error(\"Async refinement encountered during synchronous parse operation. Use .parseAsync instead.\");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status===\"aborted\"?z:(a.status===\"dirty\"&&t.dirty(),s(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status===\"aborted\"?z:(a.status===\"dirty\"&&t.dirty(),s(a.value).then(()=>({status:t.value,value:a.value}))))}if(i.type===\"transform\")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Hn(s))return z;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error(\"Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.\");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Hn(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:t.value,value:a})):z);ce.assertNever(i)}};Nt.create=(n,e,t)=>new Nt({schema:n,typeName:T.ZodEffects,effect:e,...Q(t)});Nt.createWithPreprocess=(n,e,t)=>new Nt({schema:e,effect:{type:\"preprocess\",transform:n},typeName:T.ZodEffects,...Q(t)});var Rt=class extends te{_parse(e){return this._getType(e)===R.undefined?Ge(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Rt.create=(n,e)=>new Rt({innerType:n,typeName:T.ZodOptional,...Q(e)});var an=class extends te{_parse(e){return this._getType(e)===R.null?Ge(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};an.create=(n,e)=>new an({innerType:n,typeName:T.ZodNullable,...Q(e)});var qr=class extends te{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===R.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};qr.create=(n,e)=>new qr({innerType:n,typeName:T.ZodDefault,defaultValue:typeof e.default==\"function\"?e.default:()=>e.default,...Q(e)});var Zr=class extends te{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ji(i)?i.then(o=>({status:\"valid\",value:o.status===\"valid\"?o.value:this._def.catchValue({get error(){return new dt(r.common.issues)},input:r.data})})):{status:\"valid\",value:i.status===\"valid\"?i.value:this._def.catchValue({get error(){return new dt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Zr.create=(n,e)=>new Zr({innerType:n,typeName:T.ZodCatch,catchValue:typeof e.catch==\"function\"?e.catch:()=>e.catch,...Q(e)});var zi=class extends te{_parse(e){if(this._getType(e)!==R.nan){let r=this._getOrReturnCtx(e);return I(r,{code:S.invalid_type,expected:R.nan,received:r.parsedType}),z}return{status:\"valid\",value:e.data}}};zi.create=n=>new zi({typeName:T.ZodNaN,...Q(n)});var zv=Symbol(\"zod_brand\"),No=class extends te{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},Mo=class n extends te{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status===\"aborted\"?z:o.status===\"dirty\"?(t.dirty(),Ir(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status===\"aborted\"?z:i.status===\"dirty\"?(t.dirty(),{status:\"dirty\",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:T.ZodPipeline})}},Wr=class extends te{_parse(e){let t=this._def.innerType._parse(e),r=i=>(Hn(i)&&(i.value=Object.freeze(i.value)),i);return ji(t)?t.then(i=>r(i)):r(t)}unwrap(){return this._def.innerType}};Wr.create=(n,e)=>new Wr({innerType:n,typeName:T.ZodReadonly,...Q(e)});function Jd(n,e){let t=typeof n==\"function\"?n(e):typeof n==\"string\"?{message:n}:n;return typeof t==\"string\"?{message:t}:t}function tf(n,e={},t){return n?Kn.create().superRefine((r,i)=>{let o=n(r);if(o instanceof Promise)return o.then(s=>{if(!s){let a=Jd(e,r),c=a.fatal??t??!0;i.addIssue({code:\"custom\",...a,fatal:c})}});if(!o){let s=Jd(e,r),a=s.fatal??t??!0;i.addIssue({code:\"custom\",...s,fatal:a})}}):Kn.create()}var qv={object:ft.lazycreate},T;(function(n){n.ZodString=\"ZodString\",n.ZodNumber=\"ZodNumber\",n.ZodNaN=\"ZodNaN\",n.ZodBigInt=\"ZodBigInt\",n.ZodBoolean=\"ZodBoolean\",n.ZodDate=\"ZodDate\",n.ZodSymbol=\"ZodSymbol\",n.ZodUndefined=\"ZodUndefined\",n.ZodNull=\"ZodNull\",n.ZodAny=\"ZodAny\",n.ZodUnknown=\"ZodUnknown\",n.ZodNever=\"ZodNever\",n.ZodVoid=\"ZodVoid\",n.ZodArray=\"ZodArray\",n.ZodObject=\"ZodObject\",n.ZodUnion=\"ZodUnion\",n.ZodDiscriminatedUnion=\"ZodDiscriminatedUnion\",n.ZodIntersection=\"ZodIntersection\",n.ZodTuple=\"ZodTuple\",n.ZodRecord=\"ZodRecord\",n.ZodMap=\"ZodMap\",n.ZodSet=\"ZodSet\",n.ZodFunction=\"ZodFunction\",n.ZodLazy=\"ZodLazy\",n.ZodLiteral=\"ZodLiteral\",n.ZodEnum=\"ZodEnum\",n.ZodEffects=\"ZodEffects\",n.ZodNativeEnum=\"ZodNativeEnum\",n.ZodOptional=\"ZodOptional\",n.ZodNullable=\"ZodNullable\",n.ZodDefault=\"ZodDefault\",n.ZodCatch=\"ZodCatch\",n.ZodPromise=\"ZodPromise\",n.ZodBranded=\"ZodBranded\",n.ZodPipeline=\"ZodPipeline\",n.ZodReadonly=\"ZodReadonly\"})(T||(T={}));var Zv=(n,e={message:`Input not instance of ${n.name}`})=>tf(t=>t instanceof n,e),nf=Gn.create,rf=Fr.create,Wv=zi.create,Hv=Rr.create,of=Or.create,Gv=Nr.create,Kv=Li.create,Jv=Mr.create,Yv=jr.create,Xv=Kn.create,Qv=Dn.create,e0=zt.create,t0=Bi.create,n0=wn.create,r0=ft.create,i0=ft.strictCreate,o0=Pr.create,s0=Gs.create,a0=Lr.create,c0=sn.create,u0=Ks.create,l0=Vi.create,d0=Ui.create,f0=Js.create,p0=Br.create,h0=Vr.create,m0=Ur.create,g0=zr.create,y0=Jn.create,b0=Nt.create,v0=Rt.create,_0=an.create,x0=Nt.createWithPreprocess,A0=Mo.create,C0=()=>nf().optional(),D0=()=>rf().optional(),w0=()=>of().optional(),E0={string:(n=>Gn.create({...n,coerce:!0})),number:(n=>Fr.create({...n,coerce:!0})),boolean:(n=>Or.create({...n,coerce:!0})),bigint:(n=>Rr.create({...n,coerce:!0})),date:(n=>Nr.create({...n,coerce:!0}))};var S0=z;var Yn=class extends Error{constructor(e,t=\"UNKNOWN_ERROR\"){super(e),this.name=this.constructor.name,this.code=t,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},U=class extends Yn{constructor(e,t,r=\"VALIDATION_ERROR\"){super(e,r),this.details=t}},nt=class extends Yn{constructor(e,t){super(e,\"DATA_ERROR\"),this.path=t}},de=class extends Yn{constructor(e,t,r){super(e,\"EXPRESSION_ERROR\"),this.expression=t,this.details=r}},Xn=class extends Yn{constructor(e){super(e,\"STATE_ERROR\")}},Fe=class extends Yn{constructor(e,t=\"CATALOG_ERROR\"){super(e,t)}},qt=class extends U{constructor(e,t,r=\"INTEGRITY_ERROR\"){super(e,t,r),this.name=\"A2uiIntegrityError\"}},cn=class extends U{constructor(e,t,r=\"RECURSION_ERROR\"){super(e,t,r),this.name=\"A2uiRecursionError\"}},we;(function(n){n.INVALID_FUNCTION_CALL=\"INVALID_FUNCTION_CALL\",n.EXECUTION_ERROR=\"EXECUTION_ERROR\",n.UNKNOWN_FUNCTION=\"UNKNOWN_FUNCTION\",n.UNKNOWN_ERROR=\"UNKNOWN_ERROR\",n.TIMEOUT=\"TIMEOUT\",n.CANCELLED=\"CANCELLED\",n.DISPOSED=\"DISPOSED\",n.DUPLICATE=\"DUPLICATE\",n.NO_LISTENER=\"NO_LISTENER\"})(we||(we={}));var Zt=class extends Yn{constructor(e,t=we.UNKNOWN_ERROR,r,i){let o=t||we.UNKNOWN_ERROR;super(`[${o}] ${e}`,o),this.functionCallId=r,this.details=i,this.name=\"A2uiRpcError\"}};var T0=/^[vV]?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:\\.(0|[1-9]\\d*))?(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/;function En(n){if(!n||typeof n!=\"string\")return\"\";let e=n.trim().replace(/^[vV]/,\"\"),t=e.indexOf(\"-\"),r=e.indexOf(\"+\"),i=e.length;return t!==-1&&r!==-1?i=Math.min(t,r):t!==-1?i=t:r!==-1&&(i=r),`${e.slice(0,i).replace(/_/g,\".\")}${e.slice(i)}`}function k0(n){if(!n||typeof n!=\"string\")return null;let e=n.trim().match(T0);return e?{major:parseInt(e[1],10),minor:parseInt(e[2],10),patch:e[3]!==void 0?parseInt(e[3],10):0,prerelease:e[4]?e[4].split(\".\"):[],build:e[5]?e[5].split(\".\"):[]}:null}function Qn(n){if(!n)return null;if(typeof n==\"object\"){let e=n;return typeof e.major!=\"number\"||!Number.isInteger(e.major)||e.major<0||typeof e.minor==\"number\"&&(!Number.isInteger(e.minor)||e.minor<0)||typeof e.patch==\"number\"&&(!Number.isInteger(e.patch)||e.patch<0)?null:{major:e.major,minor:typeof e.minor==\"number\"?e.minor:0,patch:typeof e.patch==\"number\"?e.patch:0,prerelease:Array.isArray(e.prerelease)?e.prerelease:[],build:Array.isArray(e.build)?e.build:[]}}return k0(En(n))}function ke(n){if(!n)return null;let e=Qn(n);if(!e)return null;if(e.patch===0&&e.prerelease.length===0&&e.build.length===0)return`${e.major}.${e.minor}`;let t=e.prerelease.length>0?`-${e.prerelease.join(\".\")}`:\"\",r=e.build.length>0?`+${e.build.join(\".\")}`:\"\";return`${e.major}.${e.minor}.${e.patch}${t}${r}`}function $0(n,e){let t=/^\\d+$/.test(n),r=/^\\d+$/.test(e);return t&&r?n.length!==e.length?n.length-e.length:n<e?-1:n>e?1:0:t?-1:r?1:n<e?-1:n>e?1:0}function I0(n,e){if(n.length===0&&e.length===0)return 0;if(n.length===0)return 1;if(e.length===0)return-1;let t=Math.min(n.length,e.length);for(let r=0;r<t;r++){let i=$0(n[r],e[r]);if(i!==0)return i}return n.length-e.length}function tu(n,e){let t=Qn(n),r=Qn(e);return!t&&!r?0:t?r?t.major!==r.major?t.major-r.major:t.minor!==r.minor?t.minor-r.minor:t.patch!==r.patch?t.patch-r.patch:I0(t.prerelease,r.prerelease):1:-1}function ge(n,e){if(!n)return!1;let t=Qn(n),r=Qn(e);return!t||!r?!1:tu(t,r)>=0}var Hr;(function(n){n.V0_8=\"v0.8\",n.V0_9=\"v0.9\",n.V0_9_1=\"v0.9.1\",n.V1_0=\"v1.0\"})(Hr||(Hr={}));function Sn(n,e){return n._def.a2uiChildRef=e,n}function er(n){return n?._def?.a2uiChildRef}var Tn=Sn(d.string().describe(\"REF:common_types.json#/$defs/ComponentId|The unique identifier for a component, used for both definitions and references within the same surface.\"),\"component-id\"),kn=d.object({path:d.string().describe(\"A JSON Pointer path to a value in the data model.\").optional(),\"@path\":d.string().describe(\"A JSON Pointer path to a value in the data model.\").optional()}).refine(n=>n[\"@path\"]!==void 0||n.path!==void 0,{message:\"Either '@path' or 'path' must be provided.\"}).describe(\"REF:common_types.json#/$defs/DataBinding\"),Wt=d.object({call:d.string().describe(\"The name of the function to call.\").optional(),\"@call\":d.string().describe(\"The name of the function to call.\").optional(),args:d.record(d.string(),d.unknown()).describe(\"Arguments passed to the function.\").optional(),returnType:d.enum([\"string\",\"number\",\"boolean\",\"array\",\"object\",\"any\",\"void\"]).describe(\"The expected return type of the function call.\").optional(),catalogId:d.string().describe(\"The catalog ID for this function, overriding any surface-level default catalogId.\").optional()}).refine(n=>n[\"@call\"]!==void 0||n.call!==void 0,{message:\"Either '@call' or 'call' must be provided.\"}).describe(\"REF:common_types.json#/$defs/FunctionCall|Invokes a named function, combining common function properties with the catalog function definition.\"),qi=d.union([d.string(),kn,Wt]).describe(\"REF:common_types.json#/$defs/DynamicString|Represents a string\"),jo=d.union([d.boolean(),kn,Wt]).describe(\"REF:common_types.json#/$defs/DynamicBoolean|A boolean value that can be a literal, a path, or a function call returning a boolean or a validation result object (coerced to its \\\\'valid\\\\' boolean).\"),tr=d.object({label:qi.optional(),description:qi.optional(),live:d.enum([\"off\",\"polite\",\"assertive\"]).default(\"off\").describe(\"Controls screen reader announcements for dynamic updates (WAI-ARIA aria-live). 'polite' waits for user pause; 'assertive' interrupts immediately for alerts.\").optional(),hidden:jo.optional()}).describe(\"REF:common_types.json#/$defs/AccessibilityAttributes|Attributes to enhance accessibility when using assistive technologies like screen readers or model understanding.\"),sf=d.record(d.string(),d.unknown()).superRefine((n,e)=>{for(let t in n)t.match(/^[\\p{XID_Start}_][\\p{XID_Continue}]*$/u)||e.addIssue({path:[t],code:d.ZodIssueCode.custom,message:`Invalid extension key \"${t}\": Keys MUST be Unicode identifiers (UAX #31).`})}).describe(\"REF:#/$defs/Extensions|Optional extension metadata. Keys MUST be Unicode identifiers (UAX #31). Keys starting with 'a2ui_' are reserved for official extensions.\"),Po=d.object({id:Tn,accessibility:tr.optional(),catalogId:d.string().describe(\"The catalog ID for this component, overriding any surface-level default catalogId.\").optional(),metadata:d.object({extensions:sf.optional()}).strict().describe(\"Optional component-level metadata for vendor extensions.\").optional()}).describe(\"REF:common_types.json#/$defs/ComponentCommon\"),Ys=Sn(d.union([d.array(Tn).describe(\"A static list of child component IDs.\"),d.object({componentId:Tn,path:d.string().describe(\"The path to the list of component property objects in the data model.\")}).describe(\"A template for generating a dynamic list of children.\")]).describe(\"REF:common_types.json#/$defs/ChildList\"),\"child-list\"),nu=d.union([d.string(),d.number(),d.boolean(),d.array(d.unknown()),kn,Wt,d.record(d.string(),d.unknown()).refine(n=>!n||!(\"@path\"in n)&&!(\"path\"in n)&&!(\"@call\"in n)&&!(\"call\"in n))]).describe(\"REF:common_types.json#/$defs/DynamicValue|A value that can be a literal, a path, or a function call returning any type.\"),Xs=d.union([d.number(),kn,Wt]).describe(\"REF:common_types.json#/$defs/DynamicNumber|Represents a value that can be either a literal number, a path to a number in the data model, or a function call returning a number.\"),ru=d.union([d.array(d.string()),kn,Wt]).describe(\"REF:common_types.json#/$defs/DynamicStringList|Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array.\"),Qs=d.object({condition:d.union([jo,kn,Wt]).describe(\"Path or function call evaluating to a structured validation result object or a boolean.\"),message:d.string().describe(\"Optional fallback error message.\").optional()}).describe(\"REF:common_types.json#/$defs/CheckRule|A single validation check rule applied to an input component. The condition function or path evaluates to a structured validation result object or a boolean (which is coerced to a validation result object).\"),iu=d.object({checks:d.array(Qs).describe(\"A list of validation check rules to perform on the component.\").optional()}).describe(\"REF:common_types.json#/$defs/Checkable|Properties for components that support renderer-side checks.\"),ou=d.union([d.object({event:d.object({name:d.string().describe(\"The name of the action to be dispatched to the server.\"),context:d.record(d.string(),d.unknown()).describe(\"A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.\").optional()}).strict().describe(\"The event to dispatch to the server.\")}).strict().describe(\"Triggers a server-side event.\"),d.object({functionCall:Wt}).strict().describe(\"Executes a local client-side function.\"),d.object({event:d.object({name:d.string().describe(\"The name of the action to be dispatched to the agent.\"),userMessage:qi.optional(),context:d.record(d.string(),d.unknown()).describe(\"A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.\").optional()}).strict().describe(\"The event to dispatch to the agent.\")}).strict().describe(\"Triggers an agent-side event.\"),d.object({functionCall:Wt}).strict().describe(\"Executes a renderer or agent-side function.\")]).describe(\"REF:common_types.json#/$defs/Action|Defines an interaction handler that can either trigger an agent-side event or execute a local renderer-side function.\"),af=d.string().describe(\"REF:common_types.json#/$defs/CallId|The unique identifier for a function call.\"),su=Tn,F0=d.object({call:d.string().describe(\"The name of the function to call.\").optional(),\"@call\":d.string().describe(\"The name of the function to call.\").optional(),catalogId:d.string().describe(\"The catalog ID for this function, overriding any surface-level default catalogId.\").optional()}).refine(n=>n[\"@call\"]!==void 0||n.call!==void 0,{message:\"Either '@call' or 'call' must be provided.\"}).describe(\"REF:common_types.json#/$defs/FunctionCommon|Baseline envelope properties common to all function calls. Function-specific argument schemas ('args') are defined individually by each function in the active catalog.\"),R0=d.object({call:d.literal(\"@index\").optional(),\"@call\":d.literal(\"@index\").optional(),args:d.object({offset:Xs.optional()}).optional()}).refine(n=>n[\"@call\"]!==void 0||n.call!==void 0,{message:\"Either '@call' or 'call' must be '@index'.\"}).describe(\"REF:common_types.json#/$defs/IndexSystemFunction|Returns the 0-based index of the current item when rendering a dynamic list from a template. This function MUST ONLY be available when evaluating template items within a list context.\"),O0=d.object({component:d.literal(\"Surface\").optional(),child:d.literal(\"root\").optional()}).strict().describe(\"REF:common_types.json#/$defs/Surface|The reserved canonical container component representing an A2UI surface. The Surface component is immutable and always has \\\\'child\\\\': \\\\'root\\\\'.\"),N0=d.object({functionCallId:af,value:d.unknown().describe(\"The return value of the function.\").optional(),error:d.object({code:d.string(),message:d.string()}).strict().describe(\"An error object indicating failure of the function execution.\").optional()}).strict().describe(\"REF:common_types.json#/$defs/FunctionResponse|The return response matching a callAgentFunction or callRendererFunction invocation.\"),cf={ComponentId:Tn,DataBinding:kn,FunctionCall:Wt,DynamicString:qi,DynamicBoolean:jo,AccessibilityAttributes:tr,Extensions:sf,ComponentCommon:Po,ChildList:Ys,DynamicValue:nu,DynamicNumber:Xs,DynamicStringList:ru,CheckRule:Qs,Checkable:iu,Action:ou,CallId:af,Child:su,FunctionCommon:F0,IndexSystemFunction:R0,Surface:O0,FunctionResponse:N0};var Lo=new WeakMap;function Vo(n){return Lo.get(n)}function df(n,e){for(let[t,r]of Object.entries(e)){let i=!1,o;Object.defineProperty(n,t,{enumerable:!0,get(){return i||(o=r(),i=!0),o}})}}function uf(n){return typeof n==\"object\"&&n!==null&&!Array.isArray(n)}function lf(n){return Array.isArray(n)?n.filter(e=>typeof e==\"string\"):void 0}var ea=class{constructor(e,t,r){this.name=e,Lo.set(this,t),df(this,{schema:()=>r(t),allowedParents:()=>lf(t.allowedParents),allowedChildren:()=>lf(t.allowedChildren)}),Object.freeze(this)}get jsonSchema(){return Lo.get(this)}},Bo=class{constructor(e,t,r){this.name=e,Lo.set(this,t);let i=uf(t.properties)?t.properties:void 0,o=s=>{let a=i?.[s];return uf(a)?a.const:void 0};df(this,{schema:()=>r(t),returnType:()=>{let s=t.returnType??o(\"returnType\");return typeof s==\"string\"?s:\"any\"},description:()=>typeof t.description==\"string\"?t.description:void 0,allowedCallers:()=>t.allowedCallers??o(\"allowedCallers\"),requiresUserActivation:()=>t.requiresUserActivation??o(\"requiresUserActivation\")}),Object.freeze(this)}get jsonSchema(){return Lo.get(this)}};var pf=Symbol(\"Let zodToJsonSchema decide on which parser to use\");var ff={name:void 0,$refStrategy:\"root\",basePath:[\"#\"],effectStrategy:\"input\",pipeStrategy:\"all\",dateStrategy:\"format:date-time\",mapStrategy:\"entries\",removeAdditionalStrategy:\"passthrough\",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:\"definitions\",target:\"jsonSchema7\",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:\"escape\",applyRegexFlags:!1,emailStrategy:\"format:email\",base64Strategy:\"contentEncoding:base64\",nameStrategy:\"ref\",openAiAnyTypeName:\"OpenAiAnyType\"},hf=n=>typeof n==\"string\"?{...ff,name:n}:{...ff,...n};var mf=n=>{let e=hf(n),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}};function au(n,e,t,r){r?.errorMessages&&t&&(n.errorMessage={...n.errorMessage,[e]:t})}function le(n,e,t,r,i){n[e]=t,au(n,e,r,i)}var ta=(n,e)=>{let t=0;for(;t<n.length&&t<e.length&&n[t]===e[t];t++);return[(n.length-t).toString(),...e.slice(t)].join(\"/\")};function ve(n){if(n.target!==\"openAi\")return{};let e=[...n.basePath,n.definitionPath,n.openAiAnyTypeName];return n.flags.hasReferencedOpenAiAnyType=!0,{$ref:n.$refStrategy===\"relative\"?ta(e,n.currentPath):e.join(\"/\")}}function gf(n,e){let t={type:\"array\"};return n.type?._def&&n.type?._def?.typeName!==T.ZodAny&&(t.items=W(n.type._def,{...e,currentPath:[...e.currentPath,\"items\"]})),n.minLength&&le(t,\"minItems\",n.minLength.value,n.minLength.message,e),n.maxLength&&le(t,\"maxItems\",n.maxLength.value,n.maxLength.message,e),n.exactLength&&(le(t,\"minItems\",n.exactLength.value,n.exactLength.message,e),le(t,\"maxItems\",n.exactLength.value,n.exactLength.message,e)),t}function yf(n,e){let t={type:\"integer\",format:\"int64\"};if(!n.checks)return t;for(let r of n.checks)switch(r.kind){case\"min\":e.target===\"jsonSchema7\"?r.inclusive?le(t,\"minimum\",r.value,r.message,e):le(t,\"exclusiveMinimum\",r.value,r.message,e):(r.inclusive||(t.exclusiveMinimum=!0),le(t,\"minimum\",r.value,r.message,e));break;case\"max\":e.target===\"jsonSchema7\"?r.inclusive?le(t,\"maximum\",r.value,r.message,e):le(t,\"exclusiveMaximum\",r.value,r.message,e):(r.inclusive||(t.exclusiveMaximum=!0),le(t,\"maximum\",r.value,r.message,e));break;case\"multipleOf\":le(t,\"multipleOf\",r.value,r.message,e);break}return t}function bf(){return{type:\"boolean\"}}function na(n,e){return W(n.type._def,e)}var vf=(n,e)=>W(n.innerType._def,e);function cu(n,e,t){let r=t??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((i,o)=>cu(n,e,i))};switch(r){case\"string\":case\"format:date-time\":return{type:\"string\",format:\"date-time\"};case\"format:date\":return{type:\"string\",format:\"date\"};case\"integer\":return M0(n,e)}}var M0=(n,e)=>{let t={type:\"integer\",format:\"unix-time\"};if(e.target===\"openApi3\")return t;for(let r of n.checks)switch(r.kind){case\"min\":le(t,\"minimum\",r.value,r.message,e);break;case\"max\":le(t,\"maximum\",r.value,r.message,e);break}return t};function _f(n,e){return{...W(n.innerType._def,e),default:n.defaultValue()}}function xf(n,e){return e.effectStrategy===\"input\"?W(n.schema._def,e):ve(e)}function Af(n){return{type:\"string\",enum:Array.from(n.values)}}var j0=n=>\"type\"in n&&n.type===\"string\"?!1:\"allOf\"in n;function Cf(n,e){let t=[W(n.left._def,{...e,currentPath:[...e.currentPath,\"allOf\",\"0\"]}),W(n.right._def,{...e,currentPath:[...e.currentPath,\"allOf\",\"1\"]})].filter(o=>!!o),r=e.target===\"jsonSchema2019-09\"?{unevaluatedProperties:!1}:void 0,i=[];return t.forEach(o=>{if(j0(o))i.push(...o.allOf),o.unevaluatedProperties===void 0&&(r=void 0);else{let s=o;if(\"additionalProperties\"in o&&o.additionalProperties===!1){let{additionalProperties:a,...c}=o;s=c}else r=void 0;i.push(s)}}),i.length?{allOf:i,...r}:void 0}function Df(n,e){let t=typeof n.value;return t!==\"bigint\"&&t!==\"number\"&&t!==\"boolean\"&&t!==\"string\"?{type:Array.isArray(n.value)?\"array\":\"object\"}:e.target===\"openApi3\"?{type:t===\"bigint\"?\"integer\":t,enum:[n.value]}:{type:t===\"bigint\"?\"integer\":t,const:n.value}}var uu,Ht={cuid:/^[cC][^\\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_'+\\-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$/,emoji:()=>(uu===void 0&&(uu=RegExp(\"^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$\",\"u\")),uu),uuid:/^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/};function ra(n,e){let t={type:\"string\"};if(n.checks)for(let r of n.checks)switch(r.kind){case\"min\":le(t,\"minLength\",typeof t.minLength==\"number\"?Math.max(t.minLength,r.value):r.value,r.message,e);break;case\"max\":le(t,\"maxLength\",typeof t.maxLength==\"number\"?Math.min(t.maxLength,r.value):r.value,r.message,e);break;case\"email\":switch(e.emailStrategy){case\"format:email\":Gt(t,\"email\",r.message,e);break;case\"format:idn-email\":Gt(t,\"idn-email\",r.message,e);break;case\"pattern:zod\":rt(t,Ht.email,r.message,e);break}break;case\"url\":Gt(t,\"uri\",r.message,e);break;case\"uuid\":Gt(t,\"uuid\",r.message,e);break;case\"regex\":rt(t,r.regex,r.message,e);break;case\"cuid\":rt(t,Ht.cuid,r.message,e);break;case\"cuid2\":rt(t,Ht.cuid2,r.message,e);break;case\"startsWith\":rt(t,RegExp(`^${lu(r.value,e)}`),r.message,e);break;case\"endsWith\":rt(t,RegExp(`${lu(r.value,e)}$`),r.message,e);break;case\"datetime\":Gt(t,\"date-time\",r.message,e);break;case\"date\":Gt(t,\"date\",r.message,e);break;case\"time\":Gt(t,\"time\",r.message,e);break;case\"duration\":Gt(t,\"duration\",r.message,e);break;case\"length\":le(t,\"minLength\",typeof t.minLength==\"number\"?Math.max(t.minLength,r.value):r.value,r.message,e),le(t,\"maxLength\",typeof t.maxLength==\"number\"?Math.min(t.maxLength,r.value):r.value,r.message,e);break;case\"includes\":{rt(t,RegExp(lu(r.value,e)),r.message,e);break}case\"ip\":{r.version!==\"v6\"&&Gt(t,\"ipv4\",r.message,e),r.version!==\"v4\"&&Gt(t,\"ipv6\",r.message,e);break}case\"base64url\":rt(t,Ht.base64url,r.message,e);break;case\"jwt\":rt(t,Ht.jwt,r.message,e);break;case\"cidr\":{r.version!==\"v6\"&&rt(t,Ht.ipv4Cidr,r.message,e),r.version!==\"v4\"&&rt(t,Ht.ipv6Cidr,r.message,e);break}case\"emoji\":rt(t,Ht.emoji(),r.message,e);break;case\"ulid\":{rt(t,Ht.ulid,r.message,e);break}case\"base64\":{switch(e.base64Strategy){case\"format:binary\":{Gt(t,\"binary\",r.message,e);break}case\"contentEncoding:base64\":{le(t,\"contentEncoding\",\"base64\",r.message,e);break}case\"pattern:zod\":{rt(t,Ht.base64,r.message,e);break}}break}case\"nanoid\":rt(t,Ht.nanoid,r.message,e);case\"toLowerCase\":case\"toUpperCase\":case\"trim\":break;default:}return t}function lu(n,e){return e.patternStrategy===\"escape\"?L0(n):n}var P0=new Set(\"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789\");function L0(n){let e=\"\";for(let t=0;t<n.length;t++)P0.has(n[t])||(e+=\"\\\\\"),e+=n[t];return e}function Gt(n,e,t,r){n.format||n.anyOf?.some(i=>i.format)?(n.anyOf||(n.anyOf=[]),n.format&&(n.anyOf.push({format:n.format,...n.errorMessage&&r.errorMessages&&{errorMessage:{format:n.errorMessage.format}}}),delete n.format,n.errorMessage&&(delete n.errorMessage.format,Object.keys(n.errorMessage).length===0&&delete n.errorMessage)),n.anyOf.push({format:e,...t&&r.errorMessages&&{errorMessage:{format:t}}})):le(n,\"format\",e,t,r)}function rt(n,e,t,r){n.pattern||n.allOf?.some(i=>i.pattern)?(n.allOf||(n.allOf=[]),n.pattern&&(n.allOf.push({pattern:n.pattern,...n.errorMessage&&r.errorMessages&&{errorMessage:{pattern:n.errorMessage.pattern}}}),delete n.pattern,n.errorMessage&&(delete n.errorMessage.pattern,Object.keys(n.errorMessage).length===0&&delete n.errorMessage)),n.allOf.push({pattern:wf(e,r),...t&&r.errorMessages&&{errorMessage:{pattern:t}}})):le(n,\"pattern\",wf(e,r),t,r)}function wf(n,e){if(!e.applyRegexFlags||!n.flags)return n.source;let t={i:n.flags.includes(\"i\"),m:n.flags.includes(\"m\"),s:n.flags.includes(\"s\")},r=t.i?n.source.toLowerCase():n.source,i=\"\",o=!1,s=!1,a=!1;for(let c=0;c<r.length;c++){if(o){i+=r[c],o=!1;continue}if(t.i){if(s){if(r[c].match(/[a-z]/)){a?(i+=r[c],i+=`${r[c-2]}-${r[c]}`.toUpperCase(),a=!1):r[c+1]===\"-\"&&r[c+2]?.match(/[a-z]/)?(i+=r[c],a=!0):i+=`${r[c]}${r[c].toUpperCase()}`;continue}}else if(r[c].match(/[a-z]/)){i+=`[${r[c]}${r[c].toUpperCase()}]`;continue}}if(t.m){if(r[c]===\"^\"){i+=`(^|(?<=[\\r\n]))`;continue}else if(r[c]===\"$\"){i+=`($|(?=[\\r\n]))`;continue}}if(t.s&&r[c]===\".\"){i+=s?`${r[c]}\\r\n`:`[${r[c]}\\r\n]`;continue}i+=r[c],r[c]===\"\\\\\"?o=!0:s&&r[c]===\"]\"?s=!1:!s&&r[c]===\"[\"&&(s=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join(\"/\")} to a flag-independent form! Falling back to the flag-ignorant source`),n.source}return i}function ia(n,e){if(e.target===\"openAi\"&&console.warn(\"Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.\"),e.target===\"openApi3\"&&n.keyType?._def.typeName===T.ZodEnum)return{type:\"object\",required:n.keyType._def.values,properties:n.keyType._def.values.reduce((r,i)=>({...r,[i]:W(n.valueType._def,{...e,currentPath:[...e.currentPath,\"properties\",i]})??ve(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:\"object\",additionalProperties:W(n.valueType._def,{...e,currentPath:[...e.currentPath,\"additionalProperties\"]})??e.allowedAdditionalProperties};if(e.target===\"openApi3\")return t;if(n.keyType?._def.typeName===T.ZodString&&n.keyType._def.checks?.length){let{type:r,...i}=ra(n.keyType._def,e);return{...t,propertyNames:i}}else{if(n.keyType?._def.typeName===T.ZodEnum)return{...t,propertyNames:{enum:n.keyType._def.values}};if(n.keyType?._def.typeName===T.ZodBranded&&n.keyType._def.type._def.typeName===T.ZodString&&n.keyType._def.type._def.checks?.length){let{type:r,...i}=na(n.keyType._def,e);return{...t,propertyNames:i}}}return t}function Ef(n,e){if(e.mapStrategy===\"record\")return ia(n,e);let t=W(n.keyType._def,{...e,currentPath:[...e.currentPath,\"items\",\"items\",\"0\"]})||ve(e),r=W(n.valueType._def,{...e,currentPath:[...e.currentPath,\"items\",\"items\",\"1\"]})||ve(e);return{type:\"array\",maxItems:125,items:{type:\"array\",items:[t,r],minItems:2,maxItems:2}}}function Sf(n){let e=n.values,r=Object.keys(n.values).filter(o=>typeof e[e[o]]!=\"number\").map(o=>e[o]),i=Array.from(new Set(r.map(o=>typeof o)));return{type:i.length===1?i[0]===\"string\"?\"string\":\"number\":[\"string\",\"number\"],enum:r}}function Tf(n){return n.target===\"openAi\"?void 0:{not:ve({...n,currentPath:[...n.currentPath,\"not\"]})}}function kf(n){return n.target===\"openApi3\"?{enum:[\"null\"],nullable:!0}:{type:\"null\"}}var Uo={ZodString:\"string\",ZodNumber:\"number\",ZodBigInt:\"integer\",ZodBoolean:\"boolean\",ZodNull:\"null\"};function If(n,e){if(e.target===\"openApi3\")return $f(n,e);let t=n.options instanceof Map?Array.from(n.options.values()):n.options;if(t.every(r=>r._def.typeName in Uo&&(!r._def.checks||!r._def.checks.length))){let r=t.reduce((i,o)=>{let s=Uo[o._def.typeName];return s&&!i.includes(s)?[...i,s]:i},[]);return{type:r.length>1?r:r[0]}}else if(t.every(r=>r._def.typeName===\"ZodLiteral\"&&!r.description)){let r=t.reduce((i,o)=>{let s=typeof o._def.value;switch(s){case\"string\":case\"number\":case\"boolean\":return[...i,s];case\"bigint\":return[...i,\"integer\"];case\"object\":if(o._def.value===null)return[...i,\"null\"];default:return i}},[]);if(r.length===t.length){let i=r.filter((o,s,a)=>a.indexOf(o)===s);return{type:i.length>1?i:i[0],enum:t.reduce((o,s)=>o.includes(s._def.value)?o:[...o,s._def.value],[])}}}else if(t.every(r=>r._def.typeName===\"ZodEnum\"))return{type:\"string\",enum:t.reduce((r,i)=>[...r,...i._def.values.filter(o=>!r.includes(o))],[])};return $f(n,e)}var $f=(n,e)=>{let t=(n.options instanceof Map?Array.from(n.options.values()):n.options).map((r,i)=>W(r._def,{...e,currentPath:[...e.currentPath,\"anyOf\",`${i}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r==\"object\"&&Object.keys(r).length>0));return t.length?{anyOf:t}:void 0};function Ff(n,e){if([\"ZodString\",\"ZodNumber\",\"ZodBigInt\",\"ZodBoolean\",\"ZodNull\"].includes(n.innerType._def.typeName)&&(!n.innerType._def.checks||!n.innerType._def.checks.length))return e.target===\"openApi3\"?{type:Uo[n.innerType._def.typeName],nullable:!0}:{type:[Uo[n.innerType._def.typeName],\"null\"]};if(e.target===\"openApi3\"){let r=W(n.innerType._def,{...e,currentPath:[...e.currentPath]});return r&&\"$ref\"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}let t=W(n.innerType._def,{...e,currentPath:[...e.currentPath,\"anyOf\",\"0\"]});return t&&{anyOf:[t,{type:\"null\"}]}}function Rf(n,e){let t={type:\"number\"};if(!n.checks)return t;for(let r of n.checks)switch(r.kind){case\"int\":t.type=\"integer\",au(t,\"type\",r.message,e);break;case\"min\":e.target===\"jsonSchema7\"?r.inclusive?le(t,\"minimum\",r.value,r.message,e):le(t,\"exclusiveMinimum\",r.value,r.message,e):(r.inclusive||(t.exclusiveMinimum=!0),le(t,\"minimum\",r.value,r.message,e));break;case\"max\":e.target===\"jsonSchema7\"?r.inclusive?le(t,\"maximum\",r.value,r.message,e):le(t,\"exclusiveMaximum\",r.value,r.message,e):(r.inclusive||(t.exclusiveMaximum=!0),le(t,\"maximum\",r.value,r.message,e));break;case\"multipleOf\":le(t,\"multipleOf\",r.value,r.message,e);break}return t}function Of(n,e){let t=e.target===\"openAi\",r={type:\"object\",properties:{}},i=[],o=n.shape();for(let a in o){let c=o[a];if(c===void 0||c._def===void 0)continue;let u=V0(c);u&&t&&(c._def.typeName===\"ZodOptional\"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=W(c._def,{...e,currentPath:[...e.currentPath,\"properties\",a],propertyPath:[...e.currentPath,\"properties\",a]});l!==void 0&&(r.properties[a]=l,u||i.push(a))}i.length&&(r.required=i);let s=B0(n,e);return s!==void 0&&(r.additionalProperties=s),r}function B0(n,e){if(n.catchall._def.typeName!==\"ZodNever\")return W(n.catchall._def,{...e,currentPath:[...e.currentPath,\"additionalProperties\"]});switch(n.unknownKeys){case\"passthrough\":return e.allowedAdditionalProperties;case\"strict\":return e.rejectedAdditionalProperties;case\"strip\":return e.removeAdditionalStrategy===\"strict\"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function V0(n){try{return n.isOptional()}catch{return!0}}var Nf=(n,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return W(n.innerType._def,e);let t=W(n.innerType._def,{...e,currentPath:[...e.currentPath,\"anyOf\",\"1\"]});return t?{anyOf:[{not:ve(e)},t]}:ve(e)};var Mf=(n,e)=>{if(e.pipeStrategy===\"input\")return W(n.in._def,e);if(e.pipeStrategy===\"output\")return W(n.out._def,e);let t=W(n.in._def,{...e,currentPath:[...e.currentPath,\"allOf\",\"0\"]}),r=W(n.out._def,{...e,currentPath:[...e.currentPath,\"allOf\",t?\"1\":\"0\"]});return{allOf:[t,r].filter(i=>i!==void 0)}};function jf(n,e){return W(n.type._def,e)}function Pf(n,e){let r={type:\"array\",uniqueItems:!0,items:W(n.valueType._def,{...e,currentPath:[...e.currentPath,\"items\"]})};return n.minSize&&le(r,\"minItems\",n.minSize.value,n.minSize.message,e),n.maxSize&&le(r,\"maxItems\",n.maxSize.value,n.maxSize.message,e),r}function Lf(n,e){return n.rest?{type:\"array\",minItems:n.items.length,items:n.items.map((t,r)=>W(t._def,{...e,currentPath:[...e.currentPath,\"items\",`${r}`]})).reduce((t,r)=>r===void 0?t:[...t,r],[]),additionalItems:W(n.rest._def,{...e,currentPath:[...e.currentPath,\"additionalItems\"]})}:{type:\"array\",minItems:n.items.length,maxItems:n.items.length,items:n.items.map((t,r)=>W(t._def,{...e,currentPath:[...e.currentPath,\"items\",`${r}`]})).reduce((t,r)=>r===void 0?t:[...t,r],[])}}function Bf(n){return{not:ve(n)}}function Vf(n){return ve(n)}var Uf=(n,e)=>W(n.innerType._def,e);var zf=(n,e,t)=>{switch(e){case T.ZodString:return ra(n,t);case T.ZodNumber:return Rf(n,t);case T.ZodObject:return Of(n,t);case T.ZodBigInt:return yf(n,t);case T.ZodBoolean:return bf();case T.ZodDate:return cu(n,t);case T.ZodUndefined:return Bf(t);case T.ZodNull:return kf(t);case T.ZodArray:return gf(n,t);case T.ZodUnion:case T.ZodDiscriminatedUnion:return If(n,t);case T.ZodIntersection:return Cf(n,t);case T.ZodTuple:return Lf(n,t);case T.ZodRecord:return ia(n,t);case T.ZodLiteral:return Df(n,t);case T.ZodEnum:return Af(n);case T.ZodNativeEnum:return Sf(n);case T.ZodNullable:return Ff(n,t);case T.ZodOptional:return Nf(n,t);case T.ZodMap:return Ef(n,t);case T.ZodSet:return Pf(n,t);case T.ZodLazy:return()=>n.getter()._def;case T.ZodPromise:return jf(n,t);case T.ZodNaN:case T.ZodNever:return Tf(t);case T.ZodEffects:return xf(n,t);case T.ZodAny:return ve(t);case T.ZodUnknown:return Vf(t);case T.ZodDefault:return _f(n,t);case T.ZodBranded:return na(n,t);case T.ZodReadonly:return Uf(n,t);case T.ZodCatch:return vf(n,t);case T.ZodPipeline:return Mf(n,t);case T.ZodFunction:case T.ZodVoid:case T.ZodSymbol:return;default:return(r=>{})(e)}};function W(n,e,t=!1){let r=e.seen.get(n);if(e.override){let a=e.override?.(n,e,r,t);if(a!==pf)return a}if(r&&!t){let a=U0(r,e);if(a!==void 0)return a}let i={def:n,path:e.currentPath,jsonSchema:void 0};e.seen.set(n,i);let o=zf(n,n.typeName,e),s=typeof o==\"function\"?W(o(),e):o;if(s&&z0(n,e,s),e.postProcess){let a=e.postProcess(s,n,e);return i.jsonSchema=s,a}return i.jsonSchema=s,s}var U0=(n,e)=>{switch(e.$refStrategy){case\"root\":return{$ref:n.path.join(\"/\")};case\"relative\":return{$ref:ta(e.currentPath,n.path)};case\"none\":case\"seen\":return n.path.length<e.currentPath.length&&n.path.every((t,r)=>e.currentPath[r]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join(\"/\")}! Defaulting to any`),ve(e)):e.$refStrategy===\"seen\"?ve(e):void 0}},z0=(n,e,t)=>(n.description&&(t.description=n.description,e.markdownDescription&&(t.markdownDescription=n.description)),t);var _t=(n,e)=>{let t=mf(e),r=typeof e==\"object\"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:W(l._def,{...t,currentPath:[...t.basePath,t.definitionPath,u]},!0)??ve(t)}),{}):void 0,i=typeof e==\"string\"?e:e?.nameStrategy===\"title\"?void 0:e?.name,o=W(n._def,i===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,i]},!1)??ve(t),s=typeof e==\"object\"&&e.name!==void 0&&e.nameStrategy===\"title\"?e.name:void 0;s!==void 0&&(o.title=s),t.flags.hasReferencedOpenAiAnyType&&(r||(r={}),r[t.openAiAnyTypeName]||(r[t.openAiAnyTypeName]={type:[\"string\",\"number\",\"integer\",\"boolean\",\"array\",\"null\"],items:{$ref:t.$refStrategy===\"relative\"?\"1\":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join(\"/\")}}));let a=i===void 0?r?{...o,[t.definitionPath]:r}:o:{$ref:[...t.$refStrategy===\"relative\"?[]:t.basePath,t.definitionPath,i].join(\"/\"),[t.definitionPath]:{...r,[i]:o}};return t.target===\"jsonSchema7\"?a.$schema=\"http://json-schema.org/draft-07/schema#\":(t.target===\"jsonSchema2019-09\"||t.target===\"openAi\")&&(a.$schema=\"https://json-schema.org/draft/2019-09/schema#\"),t.target===\"openAi\"&&(\"anyOf\"in a||\"oneOf\"in a||\"allOf\"in a||\"type\"in a&&Array.isArray(a.type))&&console.warn(\"Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.\"),a};var du=new WeakMap;function X(n,e){let t=n.describe(n.description);return du.set(t,{...du.get(n),...e}),t}function fu(n,e,t={}){return X(e,{...t,defName:n})}function zo(n){return typeof n==\"object\"&&n!==null?du.get(n):void 0}var qf={ComponentId:{description:\"The unique identifier for a component, used for both definitions and references within the same surface.\",type:\"string\"},TextItem:{additionalProperties:!1,description:\"The value of the text field. This can be a literal string or a reference to a value in the data model ('path', e.g. '/user/name').\",properties:{literalString:{type:\"string\"},path:{type:\"string\"}},type:\"object\"},UrlItem:{additionalProperties:!1,description:\"The URL of the audio to be played. This can be a literal string ('literal') or a reference to a value in the data model ('path', e.g. '/song/url').\",properties:{literalString:{type:\"string\"},path:{type:\"string\"}},type:\"object\"},AltTextItem:{additionalProperties:!1,description:\"The alt text for the image. This can be a literal string ('literal') or a reference to a value in the data model ('path', e.g. '/thumbnail/altText').\",properties:{literalString:{type:\"string\"},path:{type:\"string\"}},type:\"object\"},NameItem:{additionalProperties:!1,description:\"The name of the icon to display. This can be a literal string or a reference to a value in the data model ('path', e.g. '/form/submit').\",properties:{literalString:{enum:[\"accountCircle\",\"add\",\"arrowBack\",\"arrowForward\",\"attachFile\",\"calendarToday\",\"call\",\"camera\",\"check\",\"close\",\"delete\",\"download\",\"edit\",\"event\",\"error\",\"favorite\",\"favoriteOff\",\"folder\",\"help\",\"home\",\"info\",\"locationOn\",\"lock\",\"lockOpen\",\"mail\",\"menu\",\"moreVert\",\"moreHoriz\",\"notificationsOff\",\"notifications\",\"payment\",\"person\",\"phone\",\"photo\",\"print\",\"refresh\",\"search\",\"send\",\"settings\",\"share\",\"shoppingCart\",\"star\",\"starHalf\",\"starOff\",\"upload\",\"visibility\",\"visibilityOff\",\"warning\"],type:\"string\"},path:{type:\"string\"}},type:\"object\"},DescriptionItem:{additionalProperties:!1,description:\"A description of the audio, such as a title or summary. This can be a literal string or a reference to a value in the data model ('path', e.g. '/song/title').\",properties:{literalString:{type:\"string\"},path:{type:\"string\"}},type:\"object\"},ChildrenItem:{additionalProperties:!1,description:\"Defines the children. Use 'explicitList' for a fixed set of children, or 'template' to generate children from a data list.\",properties:{explicitList:{items:{type:\"string\"},type:\"array\"},template:{$ref:\"#/$defs/TemplateItem\",description:\"A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.\"}},type:\"object\"},TemplateItem:{additionalProperties:!1,description:\"A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.\",properties:{componentId:{type:\"string\"},dataBinding:{type:\"string\"}},required:[\"componentId\",\"dataBinding\"],type:\"object\"},TabItemItem:{additionalProperties:!1,properties:{child:{type:\"string\"},title:{$ref:\"#/$defs/TitleItem\"}},required:[\"title\",\"child\"],type:\"object\"},TitleItem:{additionalProperties:!1,description:\"The tab title. Defines the value as either a literal value or a path to data model value (e.g. '/options/title').\",properties:{literalString:{type:\"string\"},path:{type:\"string\"}},type:\"object\"},ActionItem:{additionalProperties:!1,description:\"The client-side action to be dispatched when the button is clicked. It includes the action's name and an optional context payload.\",properties:{context:{items:{$ref:\"#/$defs/ContextItem\"},type:\"array\"},name:{type:\"string\"}},required:[\"name\"],type:\"object\"},ContextItem:{additionalProperties:!1,properties:{key:{type:\"string\"},value:{$ref:\"#/$defs/ValueItem\",description:\"Defines the value to be included in the context as either a literal value or a path to a data model value (e.g. '/user/name').\"}},required:[\"key\",\"value\"],type:\"object\"},ValueItem:{additionalProperties:!1,description:\"The current value of the slider. This can be a literal number ('literalNumber') or a reference to a value in the data model ('path', e.g. '/restaurant/cost').\",properties:{literalNumber:{type:\"number\"},path:{type:\"string\"}},type:\"object\"},LabelItem:{additionalProperties:!1,description:\"The label for the slider. This can be a literal string or a reference to a value in the data model ('path').\",properties:{literalString:{type:\"string\"},path:{type:\"string\"}},type:\"object\"},OptionItem:{additionalProperties:!1,properties:{label:{$ref:\"#/$defs/LabelItem\",description:\"The text to display for this option. This can be a literal string or a reference to a value in the data model (e.g. '/option/label').\"},value:{description:\"The value to be associated with this option when selected.\",type:\"string\"}},required:[\"label\",\"value\"],type:\"object\"},SelectionItem:{additionalProperties:!1,description:\"The currently selected values for the component. This can be a literal array of strings or a path to an array in the data model('path', e.g. '/hotel/options').\",properties:{literalArray:{items:{type:\"string\"},type:\"array\"},path:{type:\"string\"}},type:\"object\"}};var Zf={childRefNames:new Set([\"ComponentId\",\"Child\",\"ChildComponentId\"]),childListRefNames:new Set([\"ChildList\",\"TemplateChildList\",\"ChildrenItem\",\"TemplateItem\"])},oa={ComponentId:{type:\"string\",description:\"The unique identifier for a component, used for both definitions and references within the same surface.\"},AccessibilityAttributes:{type:\"object\",description:\"Attributes to enhance accessibility when using assistive technologies like screen readers.\",properties:{label:{$ref:\"#/$defs/DynamicString\",description:\"A short string, typically 1 to 3 words, used by assistive technologies to convey the purpose or intent of an element. For example, an input field might have an accessible label of 'User ID' or a button might be labeled 'Submit'.\"},description:{$ref:\"#/$defs/DynamicString\",description:\"Additional information provided by assistive technologies about an element such as instructions, format requirements, or result of an action. For example, a mute button might have a label of 'Mute' and a description of 'Silences notifications about this conversation'.\"}}},ComponentCommon:{type:\"object\",properties:{id:{$ref:\"#/$defs/ComponentId\"},accessibility:{$ref:\"#/$defs/AccessibilityAttributes\"}},required:[\"id\"]},ChildList:{oneOf:[{type:\"array\",description:\"A static list of child component IDs.\",items:{$ref:\"#/$defs/ComponentId\"}},{type:\"object\",description:\"A template for generating a dynamic list of children from a data model list. The `componentId` is the component to use as a template.\",properties:{componentId:{$ref:\"#/$defs/ComponentId\"},path:{type:\"string\",description:\"The path to the list of component property objects in the data model.\"}},required:[\"componentId\",\"path\"],additionalProperties:!1}]},DataBinding:{type:\"object\",properties:{path:{type:\"string\",description:\"A JSON Pointer path to a value in the data model.\"}},required:[\"path\"],additionalProperties:!1},DynamicValue:{description:\"A value that can be a literal, a path, or a function call returning any type.\",oneOf:[{type:\"string\"},{type:\"number\"},{type:\"boolean\"},{type:\"array\"},{$ref:\"#/$defs/DataBinding\"},{$ref:\"#/$defs/FunctionCall\"}]},DynamicString:{description:\"Represents a string\",oneOf:[{type:\"string\"},{$ref:\"#/$defs/DataBinding\"},{allOf:[{$ref:\"#/$defs/FunctionCall\"},{properties:{returnType:{const:\"string\"}}}]}]},DynamicNumber:{description:\"Represents a value that can be either a literal number, a path to a number in the data model, or a function call returning a number.\",oneOf:[{type:\"number\"},{$ref:\"#/$defs/DataBinding\"},{allOf:[{$ref:\"#/$defs/FunctionCall\"},{properties:{returnType:{const:\"number\"}}}]}]},DynamicBoolean:{description:\"A boolean value that can be a literal, a path, or a function call returning a boolean.\",oneOf:[{type:\"boolean\"},{$ref:\"#/$defs/DataBinding\"},{allOf:[{$ref:\"#/$defs/FunctionCall\"},{properties:{returnType:{const:\"boolean\"}}}]}]},DynamicStringList:{description:\"Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array.\",oneOf:[{type:\"array\",items:{type:\"string\"}},{$ref:\"#/$defs/DataBinding\"},{allOf:[{$ref:\"#/$defs/FunctionCall\"},{properties:{returnType:{const:\"array\"}}}]}]},FunctionCall:{type:\"object\",description:\"Invokes a named function on the client.\",properties:{call:{type:\"string\",description:\"The name of the function to call.\"},args:{type:\"object\",description:\"Arguments passed to the function.\",additionalProperties:{anyOf:[{$ref:\"#/$defs/DynamicValue\"},{type:\"object\",description:\"A literal object argument (e.g. configuration).\"}]}},returnType:{type:\"string\",description:\"The expected return type of the function call.\",enum:[\"string\",\"number\",\"boolean\",\"array\",\"object\",\"any\",\"void\"],default:\"boolean\"}},required:[\"call\"],oneOf:[{$ref:\"catalog.json#/$defs/anyFunction\"}]},CheckRule:{type:\"object\",description:\"A single validation rule applied to an input component.\",properties:{condition:{$ref:\"#/$defs/DynamicBoolean\"},message:{type:\"string\",description:\"The error message to display if the check fails.\"}},required:[\"condition\",\"message\"],additionalProperties:!1},Checkable:{type:\"object\",description:\"Properties for components that support client-side checks.\",properties:{checks:{type:\"array\",description:\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\",items:{$ref:\"#/$defs/CheckRule\"}}}},Action:{description:\"Defines an interaction handler that can either trigger a server-side event or execute a local client-side function.\",oneOf:[{type:\"object\",description:\"Triggers a server-side event.\",properties:{event:{type:\"object\",description:\"The event to dispatch to the server.\",properties:{name:{type:\"string\",description:\"The name of the action to be dispatched to the server.\"},context:{type:\"object\",description:\"A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.\",additionalProperties:{$ref:\"#/$defs/DynamicValue\"}}},required:[\"name\"],additionalProperties:!1}},required:[\"event\"],additionalProperties:!1},{type:\"object\",description:\"Executes a local client-side function.\",properties:{functionCall:{$ref:\"#/$defs/FunctionCall\"}},required:[\"functionCall\"],additionalProperties:!1}]}};var pu={ComponentId:{type:\"string\",description:\"The unique identifier for a component, used for both definitions and references within the same surface.\"},CallId:{type:\"string\",description:\"The unique identifier for a function call.\"},AccessibilityAttributes:{type:\"object\",description:\"Attributes to enhance accessibility when using assistive technologies like screen readers or model understanding.\",properties:{label:{$ref:\"#/$defs/DynamicString\",description:\"A short string, typically 1 to 3 words, used by assistive technologies to convey the purpose or intent of an element. For example, an input field might have an accessible label of 'User ID' or a button might be labeled 'Submit'.\"},description:{$ref:\"#/$defs/DynamicString\",description:\"Additional information provided by assistive technologies about an element such as instructions, format requirements, or result of an action. For example, a mute button might have a label of 'Mute' and a description of 'Silences notifications about this conversation'.\"},live:{type:\"string\",description:\"Controls screen reader announcements for dynamic updates (WAI-ARIA aria-live). 'polite' waits for user pause; 'assertive' interrupts immediately for alerts.\",enum:[\"off\",\"polite\",\"assertive\"],default:\"off\"},hidden:{$ref:\"#/$defs/DynamicBoolean\",description:\"Hides the element and its children from assistive technologies when true. Default is false.\"}},additionalProperties:!1},Extensions:{type:\"object\",description:\"Optional extension metadata. Keys MUST be Unicode identifiers (UAX #31). Keys starting with 'a2ui_' are reserved for official extensions.\",patternProperties:{\"^[\\\\p{XID_Start}_][\\\\p{XID_Continue}]*$\":{}},additionalProperties:!1},ComponentCommon:{type:\"object\",properties:{id:{$ref:\"#/$defs/ComponentId\"},catalogId:{type:\"string\",description:\"The catalog ID for this component, overriding any surface-level default catalogId.\"},accessibility:{$ref:\"#/$defs/AccessibilityAttributes\"},metadata:{type:\"object\",description:\"Optional component-level metadata for vendor extensions.\",properties:{extensions:{$ref:\"#/$defs/Extensions\"}},additionalProperties:!1}},required:[\"id\"]},Child:{$ref:\"#/$defs/ComponentId\",description:\"A reference to a single child component ID.\"},ChildList:{oneOf:[{type:\"array\",description:\"A static list of child component IDs.\",items:{$ref:\"#/$defs/ComponentId\"}},{type:\"object\",description:\"A template for generating a dynamic list of children from a data model list. The `componentId` is the component to use as a template.\",properties:{componentId:{$ref:\"#/$defs/ComponentId\"},path:{type:\"string\",description:\"The path to the list of component property objects in the data model.\"}},required:[\"componentId\",\"path\"],additionalProperties:!1}]},DataBinding:{type:\"object\",properties:{\"@path\":{type:\"string\",description:\"A JSON Pointer path to a value in the data model.\"}},required:[\"@path\"],additionalProperties:!1},DynamicValue:{description:\"A value that can be a literal, a path, or a function call returning any type.\",oneOf:[{type:\"string\"},{type:\"number\"},{type:\"boolean\"},{type:\"array\"},{type:\"object\",propertyNames:{not:{pattern:\"^@([^@]|$)\"}},not:{anyOf:[{required:[\"@path\"]},{required:[\"@call\"]}]}},{$ref:\"#/$defs/DataBinding\"},{$ref:\"#/$defs/FunctionCall\"}]},DynamicString:{description:\"Represents a string\",oneOf:[{type:\"string\"},{$ref:\"#/$defs/DataBinding\"},{$ref:\"#/$defs/FunctionCall\"}]},DynamicNumber:{description:\"Represents a value that can be either a literal number, a path to a number in the data model, or a function call returning a number.\",oneOf:[{type:\"number\"},{$ref:\"#/$defs/DataBinding\"},{$ref:\"#/$defs/FunctionCall\"}]},DynamicBoolean:{description:\"A boolean value that can be a literal, a path, or a function call returning a boolean or a validation result object (coerced to its 'valid' boolean).\",oneOf:[{type:\"boolean\"},{$ref:\"#/$defs/DataBinding\"},{$ref:\"#/$defs/FunctionCall\"}]},DynamicStringList:{description:\"Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array.\",oneOf:[{type:\"array\",items:{type:\"string\"}},{$ref:\"#/$defs/DataBinding\"},{$ref:\"#/$defs/FunctionCall\"}]},FunctionCommon:{type:\"object\",description:\"Baseline envelope properties common to all function calls. Function-specific argument schemas ('args') are defined individually by each function in the active catalog.\",properties:{\"@call\":{type:\"string\",description:\"The name of the function to call.\"},catalogId:{type:\"string\",description:\"The catalog ID for this function, overriding any surface-level default catalogId.\"}},required:[\"@call\"]},IndexSystemFunction:{type:\"object\",description:\"Returns the 0-based index of the current item when rendering a dynamic list from a template. This function MUST ONLY be available when evaluating template items within a list context.\",properties:{\"@call\":{const:\"@index\"},args:{type:\"object\",properties:{offset:{$ref:\"#/$defs/DynamicNumber\",description:\"Optional. An offset to add to the 0-based index (e.g., 1 for 1-based indexing). Defaults to 0.\",default:0}},unevaluatedProperties:!1}},required:[\"@call\"],unevaluatedProperties:!1},FunctionCall:{type:\"object\",description:\"Invokes a named function, combining common function properties with the catalog function definition.\",allOf:[{$ref:\"#/$defs/FunctionCommon\"},{oneOf:[{$ref:\"catalog.json#/$defs/anyFunction\"},{$ref:\"#/$defs/IndexSystemFunction\"}]}],unevaluatedProperties:!1},CheckRule:{type:\"object\",description:\"A single validation check rule applied to an input component. The condition function or path evaluates to a structured validation result object or a boolean (which is coerced to a validation result object).\",properties:{condition:{description:\"Path or function call evaluating to a structured validation result object or a boolean.\",oneOf:[{$ref:\"#/$defs/DataBinding\"},{$ref:\"#/$defs/FunctionCall\"}]},message:{type:\"string\",description:\"Optional fallback error message.\"}},required:[\"condition\"],additionalProperties:!1},Checkable:{type:\"object\",description:\"Properties for components that support renderer-side checks.\",properties:{checks:{type:\"array\",description:\"A list of validation check rules to perform on the component.\",items:{$ref:\"#/$defs/CheckRule\"}}}},Action:{description:\"Defines an interaction handler that can either trigger an agent-side event or execute a local renderer-side function.\",oneOf:[{type:\"object\",description:\"Triggers an agent-side event.\",properties:{event:{type:\"object\",description:\"The event to dispatch to the agent.\",properties:{name:{type:\"string\",description:\"The name of the action to be dispatched to the agent.\"},userMessage:{$ref:\"#/$defs/DynamicString\",description:\"An optional human-readable message describing the action performed by the user, resolved by the renderer and included in the outbound action message.\"},context:{type:\"object\",description:\"A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.\",additionalProperties:{$ref:\"#/$defs/DynamicValue\"}}},required:[\"name\"],additionalProperties:!1}},required:[\"event\"],additionalProperties:!1},{type:\"object\",description:\"Executes a renderer or agent-side function.\",properties:{functionCall:{$ref:\"#/$defs/FunctionCall\"}},required:[\"functionCall\"],additionalProperties:!1}]},Surface:{title:\"Surface Container Component\",description:\"The reserved canonical container component representing an A2UI surface. The Surface component is immutable and always has 'child': 'root'.\",type:\"object\",allowedParents:[],properties:{component:{const:\"Surface\"},child:{const:\"root\"}},additionalProperties:!1},FunctionResponse:{type:\"object\",description:\"The return response matching a callAgentFunction or callRendererFunction invocation.\",properties:{functionCallId:{$ref:\"#/$defs/CallId\",description:\"The unique ID matching the initiating function call.\"},value:{description:\"The return value of the function.\"},error:{type:\"object\",description:\"An error object indicating failure of the function execution.\",properties:{code:{type:\"string\"},message:{type:\"string\"}},required:[\"code\",\"message\"],additionalProperties:!1}},required:[\"functionCallId\"],oneOf:[{required:[\"value\"]},{required:[\"error\"]}],additionalProperties:!1}};var nr=\"common_types.json\",Wf={\"0.8\":qf,\"0.9\":oa,\"0.9.1\":oa,\"1.0\":pu};function gu(n){if(n){let e=ke(n)??En(n);if(e in Wf)return Wf[e];if(ge(n,\"1.0\"))return pu}return oa}function Hf(n){return JSON.parse(JSON.stringify(n))}function sa(n){return typeof n==\"object\"&&n!==null&&!Array.isArray(n)}function Gr(n){return n._def}var hu=new Set([\"id\",\"component\"]);function Kf(n){return qo(n).mixins!==void 0}function Jf(n){return Object.keys(qo(n)).length>0}function qo(n){let e=[],t=n;for(;t&&typeof t==\"object\"&&\"_def\"in t;){let r=zo(t);r&&e.push(r);let i=Zo(t);if(!i)break;t=i}return e.reduceRight((r,i)=>({...r,...i}),{})}function Zo(n){let e=Gr(n);switch(e.typeName){case\"ZodOptional\":case\"ZodDefault\":case\"ZodCatch\":case\"ZodReadonly\":return e.innerType;case\"ZodEffects\":return e.schema;case\"ZodBranded\":return e.type;default:return}}var Wo=class{constructor(e,t=nr){this.commonTypesUri=t,this.isV08=!ge(e,\"0.9\"),this.isV10=ge(e,\"1.0\"),this.standardDefs=gu(e)}componentSchema(e,t,r,i){let o=new Map,s;if(this.isV08){s=this.toJson(t);let a=s.properties;if(sa(a))for(let c of hu)delete a[c];if(Array.isArray(s.required)){let c=s.required.filter(u=>!hu.has(u));c.length>0?s.required=c:delete s.required}}else{let a=qo(t),c=a.mixins??[],u=new Set(hu),l=[];for(let v of c){l.push({$ref:this.mixinRef(v,o)});for(let x of this.mixinProperties(v))u.add(x)}let p=mu(t),f=q0(t),m=this.objectSchema(p,a,v=>!u.has(v)),g={component:{const:e},...m.properties},h=[\"component\",...m.required??[]],b={type:\"object\"};f!==void 0&&!this.isV10&&(b.description=f),b.properties=g,b.required=h,s={type:\"object\"},this.isV10?(f!==void 0&&(s.description=f),l.length>0?s.allOf=[...l,b]:(s.properties=g,s.required=h)):(s.allOf=[...l,b],s.unevaluatedProperties=!1)}return r&&r.length>0&&(s.allowedParents=[...r]),i&&i.length>0&&(s.allowedChildren=[...i]),{schema:s,catalogDefs:o}}functionSchema(e,t){let r=this.toJson(t.schema),i=Array.isArray(r.required)&&r.required.length>0,o={type:\"object\"};return t.description&&(o.description=t.description),this.isV10?(o.returnType=t.returnType,t.allowedCallers&&(o.allowedCallers=t.allowedCallers),t.requiresUserActivation&&(o.requiresUserActivation=!0),o.properties={\"@call\":{const:e},args:r},o.required=i?[\"@call\",\"args\"]:[\"@call\"],o):(t.allowedCallers&&(o.allowedCallers=t.allowedCallers),t.requiresUserActivation&&(o.requiresUserActivation=!0),o.properties={call:{const:e},args:r,returnType:{const:t.returnType}},o.required=i?[\"call\",\"args\"]:[\"call\"],o.unevaluatedProperties=!1,o)}defSchema(e){return this.toJson(e)}mixinRef(e,t){if(typeof e==\"string\")return`${this.commonTypesUri}#/$defs/${e}`;let r=qo(e).defName;if(r===void 0)throw new Error(\"A component mixin model must be named with specDef().\");return t.set(r,e),`#/$defs/${r}`}mixinProperties(e){if(typeof e!=\"string\"){let i=mu(e);return Gr(i).typeName===\"ZodObject\"?Object.keys(i.shape):[]}let t=[],r=(i,o)=>{if(!(!sa(i)||o.has(i))){o.add(i),sa(i.properties)&&t.push(...Object.keys(i.properties));for(let s of Array.isArray(i.allOf)?i.allOf:[]){let a=sa(s)?s.$ref:void 0,c=typeof a==\"string\"&&a.startsWith(\"#/$defs/\")?this.standardDefs[a.substring(8)]:s;r(c,o)}}};return r(this.standardDefs[e],new Set),t}toJson(e){let t=qo(e),r=Yf(e),i=Z0(e),o,s=r;if(r!==void 0&&r.startsWith(\"REF:\")){let c=r.substring(4),u=c.indexOf(\"|\"),l=u===-1?c:c.substring(0,u);s=u===-1?void 0:c.substring(u+1),o={$ref:this.refTarget(l)}}else o=this.coreJson(mu(e),t);t.keywords&&Object.assign(o,Hf(t.keywords));let a=t.allOf?{allOf:[o,...t.allOf.map(c=>Hf(c))]}:o;return s&&(a.description=s),i!==void 0&&(a.default=i),a}refTarget(e){return e.startsWith(\"#/$defs/\")?`${this.commonTypesUri}${e}`:e}coreJson(e,t){let r=Gr(e);switch(r.typeName){case\"ZodObject\":return this.objectSchema(e,t,()=>!0);case\"ZodString\":return W0(r);case\"ZodNumber\":return H0(r);case\"ZodBoolean\":return{type:\"boolean\"};case\"ZodNull\":return{type:\"null\"};case\"ZodEnum\":return{type:\"string\",enum:[...r.values]};case\"ZodLiteral\":return{const:r.value};case\"ZodAny\":case\"ZodUnknown\":return{};case\"ZodNever\":return{not:{}};case\"ZodArray\":{let i={type:\"array\",items:this.toJson(r.type)},o=r.minLength,s=r.maxLength;return o&&(i.minItems=o.value),s&&(i.maxItems=s.value),i}case\"ZodUnion\":case\"ZodDiscriminatedUnion\":return{oneOf:[...r.options].map(o=>this.toJson(o))};case\"ZodRecord\":return{type:\"object\",additionalProperties:this.toJson(r.valueType)};case\"ZodLazy\":return this.toJson(r.getter());default:return G0(e)}}objectSchema(e,t,r){let i=Gr(e);if(i.typeName!==\"ZodObject\")return this.toJson(e);let o=e.shape,s={},a=[];for(let[g,h]of Object.entries(o))r(g)&&(s[g]=this.toJson(h),h.isOptional()||a.push(g));let c={type:\"object\",properties:s},u=t.required?.filter(g=>a.includes(g)),l=a.filter(g=>!u?.includes(g));a.length>0&&(c.required=u?[...u,...l]:a);let p=i.unknownKeys,f=i.catchall,m=t.closure??(p===\"strict\"?\"additionalProperties\":\"none\");return f&&Gr(f).typeName!==\"ZodNever\"?c[m===\"none\"?\"additionalProperties\":m]=this.toJson(f):m!==\"none\"&&(c[m]=p===\"passthrough\"),c}};function mu(n){let e=n;for(let t=Zo(e);t;t=Zo(e))e=t;return e}function Yf(n){for(let e=n;e;e=Zo(e)){let t=Gr(e).description;if(typeof t==\"string\")return t}}function q0(n){let e=Yf(n);return e!==void 0&&!e.startsWith(\"REF:\")?e:void 0}function Z0(n){for(let e=n;e;e=Zo(e)){let t=Gr(e);if(t.typeName===\"ZodDefault\")return t.defaultValue()}}var Gf={email:\"email\",url:\"uri\",uuid:\"uuid\",datetime:\"date-time\",date:\"date\",time:\"time\"};function W0(n){let e={type:\"string\"};for(let t of n.checks??[])t.kind===\"regex\"?e.pattern=t.regex.source:t.kind===\"min\"?e.minLength=t.value:t.kind===\"max\"?e.maxLength=t.value:t.kind in Gf&&(e.format=Gf[t.kind]);return e}function H0(n){let e=n.checks??[],t={type:e.some(r=>r.kind===\"int\")?\"integer\":\"number\"};for(let r of e)r.kind===\"min\"?t[r.inclusive?\"minimum\":\"exclusiveMinimum\"]=r.value:r.kind===\"max\"&&(t[r.inclusive?\"maximum\":\"exclusiveMaximum\"]=r.value);return t}function G0(n){let e=_t(n,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});return delete e.$schema,delete e.definitions,delete e.$defs,e}var K0=new Set([\"anyComponent\",\"anyFunction\"]),_u=[\"theme\",\"themeSchema\",\"styles\"];function Re(n){return n===void 0?n:JSON.parse(JSON.stringify(n))}function rr(n){if(typeof n==\"object\"&&n!==null&&!Object.isFrozen(n)){Object.freeze(n);for(let e of Object.values(n))rr(e)}return n}function xu(n){return typeof n!=\"object\"||n===null||Object.isFrozen(n)?n:rr(Re(n))}function un(n){return typeof n==\"object\"&&n!==null&&!Array.isArray(n)}function aa(n,e){if(Array.isArray(n)){for(let r of n)aa(r,e);return}if(!un(n))return;let t=n.$ref;typeof t==\"string\"&&t.startsWith(\"#/$defs/\")&&e.add(t.slice(8).split(\"/\")[0].replace(/~1/g,\"/\").replace(/~0/g,\"~\"));for(let r of Object.values(n))aa(r,e)}function yu(n,e){let t=new Set,r=new Set;for(let i of n)aa(i,r);for(;r.size>0;){let[i]=r;r.delete(i),!t.has(i)&&(t.add(i),i in e&&aa(e[i],r))}return t}function bu(n,e){let t=Vo(n);if(!un(t))return;let r=e??{};for(let i of yu([t],r))if(!(i in r)&&!K0.has(i))return;return t}function Xf(n){return typeof n.name==\"string\"&&!(\"properties\"in n)}function tp(n,e,t,r){if(!n)return n;let i=l=>l.map(p=>bu(p,n)).filter(p=>p!==void 0),o=yu(i(e),n),s=Object.keys(n).filter(l=>!o.has(l)),a=yu([...i(t),r,...s.map(l=>n[l])],n),c={},u=!1;for(let[l,p]of Object.entries(n))!o.has(l)||a.has(l)?c[l]=p:u=!0;return u?c:n}function vu(n,e,t=nr){if(Array.isArray(n)){for(let r of n)vu(r,e,t);return}if(un(n)){if(typeof n.description==\"string\"&&n.description.startsWith(\"REF:\")){let r=n.description.substring(4),i=r.indexOf(\"|\"),o=i===-1?r:r.substring(0,i),s=i===-1?\"\":r.substring(i+1),a=n.default;for(let l of Object.keys(n))delete n[l];let c=o.split(/#\\/(?:\\$defs|definitions)\\//)[1],u=c?.split(\"/\")[0];n.$ref=u===void 0||o.startsWith(\"#\")&&e.has(u)?o:`${t}#/$defs/${c}`,a!==void 0&&(n.default=a),s&&(n.description=s);return}Array.isArray(n.anyOf)&&(n.oneOf=n.anyOf,delete n.anyOf);for(let r of[\"additionalProperties\",\"unevaluatedProperties\"]){let i=n[r];un(i)&&Object.keys(i).length===0&&(n[r]=!0)}delete n.$schema;for(let r of Object.values(n))vu(r,e,t)}}function Au(n,e,t=nr){if(!n||typeof n!=\"object\"||!(\"safeParse\"in n))return{type:\"object\",properties:{}};let r=_t(n,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});return delete r.definitions,delete r.$defs,vu(r,e,t),r}function J0(n){if(n.type!==\"object\")return;let e=n.unevaluatedProperties??n.additionalProperties;delete n.additionalProperties,n.unevaluatedProperties=typeof e==\"boolean\"||un(e)?e:!1}function Y0(n,e,t,r=nr){let i=Au(e.schema,t,r),{component:o,id:s,...a}=un(i.properties)?i.properties:{},c=Array.isArray(i.required)?i.required.filter(p=>p!==\"component\"&&p!==\"id\"):[],u=i.unevaluatedProperties??i.additionalProperties,l={type:\"object\",properties:{component:{const:n},...a},required:[\"component\",...c],unevaluatedProperties:typeof u==\"boolean\"||un(u)?u:!1};return e.allowedParents&&e.allowedParents.length>0&&(l.allowedParents=[...e.allowedParents]),e.allowedChildren&&e.allowedChildren.length>0&&(l.allowedChildren=[...e.allowedChildren]),l}function Qf(n,e,t,r,i,o=nr){let s=Au(e.schema,t,o);if(i)return{name:n,...e.description?{description:e.description}:{},returnType:e.returnType,parameters:s,...e.allowedCallers?{allowedCallers:e.allowedCallers}:{},...e.requiresUserActivation!==void 0?{requiresUserActivation:e.requiresUserActivation}:{}};J0(s);let a=Array.isArray(s.required)&&s.required.length>0,c={type:\"object\"};return e.description&&(c.description=e.description),r?(c.returnType=e.returnType,e.allowedCallers&&(c.allowedCallers=e.allowedCallers),e.requiresUserActivation!==void 0&&(c.requiresUserActivation=e.requiresUserActivation),c.properties={\"@call\":{const:n},args:s},c.required=a?[\"@call\",\"args\"]:[\"@call\"],c):(e.allowedCallers&&(c.allowedCallers=e.allowedCallers),e.requiresUserActivation!==void 0&&(c.requiresUserActivation=e.requiresUserActivation),c.properties={call:{const:n},args:s,returnType:{const:e.returnType}},c.required=a?[\"call\",\"args\"]:[\"call\"],c.unevaluatedProperties=!1,c)}function X0(n,e,t=nr){let r=Au(n,e,t);return{type:\"object\",properties:un(r.properties)?r.properties:{},...Array.isArray(r.required)&&r.required.length>0?{required:r.required}:{},additionalProperties:r.additionalProperties!==void 0?r.additionalProperties:!0}}var np={not:{}};function Cu(n){let e=[...n].map(t=>({$ref:`#/components/${rp(t)}`}));return e.length===0?{...np}:{oneOf:e,discriminator:{propertyName:\"component\"}}}function Du(n){let e=[...n].map(t=>({$ref:`#/functions/${rp(t)}`}));return e.length===0?{...np}:{oneOf:e}}function rp(n){return n.replace(/~/g,\"~0\").replace(/\\//g,\"~1\")}var ep=new WeakMap;function wu(n){let e=ep.get(n);return e||(e=Q0(n),ep.set(n,e)),e}function Q0(n){let e=new Wo(n.protocolVersion,n.commonTypesUri),t=new Map,r=new Map;for(let[c,u]of n.components){if(Vo(u)||!Kf(u.schema))continue;let{schema:l,catalogDefs:p}=e.componentSchema(c,u.schema,u.allowedParents,u.allowedChildren);r.set(c,rr(l));for(let[f,m]of p)t.set(f,m)}for(let c of n.defModels??[]){let u=zo(c)?.defName;if(u===void 0)throw new Error(\"A catalog definition model must be named with specDef().\");t.set(u,c)}let i={...n.defs};for(let[c,u]of t)c in i||(i[c]=e.defSchema(u));let o={...n.extensionFields};if(n.themeLocation===\"styles\"&&n.themeSchema&&!ip(n)){let c=e.defSchema(n.themeSchema);o.styles=un(c.properties)?c.properties:{}}let s=new Map;for(let[c,u]of n.components)s.set(c,r.get(c)??bu(u,i));let a=new Map;for(let[c,u]of n.functions){let l=bu(u,i);a.set(c,l??(!Vo(u)&&Jf(u.schema)?rr(e.functionSchema(c,u)):void 0))}return{components:s,functions:a,defs:rr(i),extensionFields:rr(o)}}function ip(n){return un(n.defs?.theme)||_u.some(e=>n.extensionFields?.[e]!==void 0)}function op(n){let e=ge(n.protocolVersion,\"1.0\"),t=wu(n),r=new Set(Object.keys(t.defs)),i={};n.schemaUri!==void 0&&(i.$schema=n.schemaUri),n.schemaId!==void 0&&(i.$id=n.schemaId),typeof n.declaredProtocolVersion==\"string\"?i.protocolVersion=n.declaredProtocolVersion:n.declaredProtocolVersion===void 0&&(i.protocolVersion=ke(n.protocolVersion)??n.protocolVersion),n.title!==void 0&&(i.title=n.title),n.description!==void 0&&(i.description=n.description),n.declaresCatalogId!==!1&&(i.catalogId=n.id),n.instructions!==void 0&&(i.instructions=n.instructions);let o=n.commonTypesUri??nr;if(n.declaresComponents!==!1||n.components.size>0){let p={};for(let[f,m]of n.components){let g=t.components.get(f);p[f]=g?Re(g):Y0(f,m,r,o)}i.components=p}let s=[...n.functions].filter(([p,f])=>Vo(f)!==void 0||!p.startsWith(\"@\")),a=s.map(([p])=>p);if(n.functionsLayout===\"list\")i.functions=s.map(([p,f])=>{let m=t.functions.get(p);return m&&Xf(m)?Re(m):Qf(p,f,r,e,!0,o)});else if(n.functionsLayout===\"map\"||s.length>0){let p={};for(let[f,m]of s){let g=t.functions.get(f);p[f]=g&&!Xf(g)?Re(g):Qf(f,m,r,e,!1,o)}i.functions=p}for(let[p,f]of Object.entries(t.extensionFields))p in i||(i[p]=Re(f));let c=Re({...t.defs});(n.themeLocation??(e?void 0:\"defs\"))===\"defs\"&&n.themeSchema&&!ip(t)&&(c.theme=zo(n.themeSchema)?new Wo(n.protocolVersion,n.commonTypesUri).defSchema(n.themeSchema):X0(n.themeSchema,r,o));let l=n.unions??{anyComponent:e||n.components.size>0,anyFunction:e||a.length>0};if(l.anyComponent&&!(\"anyComponent\"in c)){let p=c.anyFunction;p!==void 0&&delete c.anyFunction,c.anyComponent=Cu(n.components.keys()),p!==void 0&&(c.anyFunction=p)}return l.anyFunction&&!(\"anyFunction\"in c)&&(c.anyFunction=Du(a)),(n.defs!==void 0||Object.keys(c).length>0)&&(i.$defs=c),i}var e_=/^[\\p{XID_Start}_][\\p{XID_Continue}]*$/u;function Eu(n,e=!1){if(!n)return!1;let t=e&&n.startsWith(\"@\")?n.slice(1):n;return e_.test(t)}function Ho(n,e,t=!1){if(!Eu(n,t))throw new Fe(`Invalid UAX #31 ${e}`)}var t_=\"0.9\",yp={DynamicString:qi,DynamicNumber:Xs,DynamicBoolean:jo,DynamicStringList:ru,DynamicValue:nu,ComponentId:Tn,Child:su,ChildList:Ys,Action:ou,CheckRule:Qs,Checkable:iu,AccessibilityAttributes:tr,DataBinding:kn,FunctionCall:Wt},bp=\"common_types.json\",Su=\"catalog.json\";function vp(n,e){return n===e||n.endsWith(`/${e}`)}function sp(n){return n.slice(n.lastIndexOf(\"/\")+1)}function Tu(n){let e=n.indexOf(\"#\");return e<0?{doc:n,fragment:\"\"}:{doc:n.slice(0,e),fragment:n.slice(e)}}function _p(n){return typeof n.toJson==\"function\"}function ap(n){if(_p(n))return{id:n.id,schemaId:n.schemaId};let e=n.catalogId,t=n.$id;return{id:typeof e==\"string\"?e:void 0,schemaId:typeof t==\"string\"?t:void 0}}function cp(n,e){if(!n)return{kind:\"self\"};if(vp(n,bp))return{kind:\"commonTypes\"};if(n===Su)return{kind:\"self\"};for(let r of e){let{id:i,schemaId:o}=ap(r);for(let s of[i,o])if(s&&(n===s||s.endsWith(`/${n}`)||n.endsWith(`/${s}`)))return{kind:\"peer\",peer:r}}if(n.endsWith(`/${Su}`))return{kind:\"self\"};let t=sp(n);for(let r of e){let{id:i,schemaId:o}=ap(r);for(let s of[o,i])if(s&&sp(s)===t)return{kind:\"peer\",peer:r}}return{kind:\"unresolved\"}}function da(n){if(Array.isArray(n))return n.some(da);if(!n||typeof n!=\"object\")return!1;for(let[e,t]of Object.entries(n))if(e===\"$ref\"&&typeof t==\"string\"){let{doc:r}=Tu(t);if(r&&r!==Su&&!vp(r,bp))return!0}else if(da(t))return!0;return!1}var up=new WeakMap,n_=0;function r_(n){let e=up.get(n);return e===void 0&&(e=n_++,up.set(n,e)),e}var fa=class{constructor(e=[]){this.peers=e,this.documents=new Map}documentOf(e){if(!_p(e))return e;let t=this.documents.get(e);return t||(t=e.toJson(),this.documents.set(e,t)),t}resolve(e,t){let{doc:r,fragment:i}=Tu(e);if(!i.startsWith(\"#/\"))return;let o=cp(r,this.peers);if(o.kind===\"self\")return{doc:t,pointer:i,key:`${r_(t)}:${i}`,isPeer:!1};if(o.kind===\"peer\")return{doc:this.documentOf(o.peer),pointer:i,key:e,isPeer:!0}}assertResolvable(e){cp(Tu(e).doc,this.peers).kind===\"unresolved\"&&ma(e)}};function ma(n){throw new Fe(`Unresolvable schema reference: '${n}'`)}var $n=class extends Map{constructor(e=[]){super(),this.scope=new fa(e)}},pa=new WeakMap;function ku(n,e){let t=pa.get(n);return t?t(e):n}function xp(n){let e={};for(let[t,r]of Object.entries(n))t===\"unevaluatedProperties\"||t===\"additionalProperties\"||t===\"title\"||(e[t]=r);if(e.properties&&typeof e.properties==\"object\"&&!Array.isArray(e.properties)){let t={};for(let[r,i]of Object.entries(e.properties))ha(r)||(t[r]=i);e.properties=t}if(Array.isArray(e.required)&&(e.required=e.required.filter(t=>typeof t==\"string\"&&!ha(t))),Array.isArray(e.allOf)){let t=[],r=[];for(let i of e.allOf)if(i&&typeof i==\"object\"&&!Array.isArray(i)){let o=i,s=o.properties,a=!!s&&typeof s==\"object\"&&!Array.isArray(s)&&\"component\"in s,c=xp(o);a?t.push(c):r.push(c)}else r.push(i);e.allOf=[...t,...r]}return e}function Ap(n,e){return!e.startsWith(\"#/components/\")||e.slice(2).split(\"/\").length!==2?n:xp(n)}function $u(n){let e=n.doc,t=Wi(e,n.pointer);return t?{doc:e,target:Ap(t,n.pointer)}:void 0}function Jo(n,e,t=[],r={}){return Go(n,e,new fa(t),r.inlineLocalDefs??!0,r.visited??new Set)}function Go(n,e,t,r,i){if(Array.isArray(n))return n.map(a=>Go(a,e,t,r,i));if(!n||typeof n!=\"object\")return n;let o=n;if(typeof o.$ref==\"string\"){let a=t.resolve(o.$ref,e);if(a&&!a.isPeer){let c=a.pointer.split(\"/\").pop()??\"\";(a.pointer.startsWith(\"#/$defs/\")&&(c in yp||c===\"ComponentCommon\")||!r&&a.pointer.startsWith(\"#/$defs/\"))&&(a=void 0)}if(a&&!i.has(a.key)){let c=Wi(a.doc,a.pointer);if(c){let u=new Set(i);u.add(a.key);let l=Go(c,a.doc,t,a.isPeer?!0:r,u);if(l&&typeof l==\"object\"&&!Array.isArray(l)){let f={...Ap(l,a.pointer)};for(let[m,g]of Object.entries(o)){if(m===\"$ref\")continue;let h=Go(g,e,t,r,i);if(m in f&&f[m]&&typeof f[m]==\"object\"&&!Array.isArray(f[m])&&h&&typeof h==\"object\"&&!Array.isArray(h))f[m]={...f[m],...h};else if(Array.isArray(f[m])&&Array.isArray(h)){let b=f[m];f[m]=[...b,...h.filter(v=>!b.includes(v))]}else f[m]=h}return f}return l}}}let s={};for(let[a,c]of Object.entries(o))s[a]=Go(c,e,t,r,i);return s}function Wi(n,e){if(!e.startsWith(\"#/\"))return;let t=e.slice(2).split(\"/\").map(i=>i.replace(/~1/g,\"/\").replace(/~0/g,\"~\")),r=n;for(let i of t)if(r&&typeof r==\"object\"&&i in r)r=r[i];else return;return typeof r==\"object\"&&r!==null?r:void 0}function Cp(n){let e=n.split(/#\\/(?:\\$defs|definitions)\\//)[1];return e?yp[e]:void 0}function i_(n){return n.length===0?d.unknown():n.every(e=>typeof e==\"string\")?d.enum(n):n.length===1?d.literal(n[0]):d.union(n.map(e=>d.literal(e)))}function Ko(n){return n===null||typeof n!=\"object\"?JSON.stringify(n):Array.isArray(n)?`[${n.map(Ko).join(\",\")}]`:`{${Object.keys(n).sort().map(r=>`${JSON.stringify(r)}:${Ko(n[r])}`).join(\",\")}}`}function ir(n,e,t,r,i){let o=n;if(e.not&&typeof e.not==\"object\"){let s=Zi(e.not,t,new Set(r),i);o=o.refine(a=>!s.safeParse(a).success,{message:'Value matched prohibited \"not\" schema'})}return e.default!==void 0&&(o=o.default(e.default)),typeof e.description==\"string\"&&(o=o.describe(e.description)),o}function o_(n,e,t,r,i){let o=Cp(n);if(o){let f=n.split(/#\\/(?:\\$defs|definitions)\\//)[1],m=typeof e.description==\"string\"?`REF:common_types.json#/$defs/${f}|${e.description}`:o.description;return m?o.describe(m):o}if(!t)return;let s=i.scope.resolve(n,t);if(!s){i.scope.assertResolvable(n);return}let a,c;if(s.isPeer){let f=$u(s);f||ma(n),{doc:a,target:c}=f}else if(a=t,c=Wi(t,s.pointer),!c)return n.startsWith(\"#\")?d.unknown().superRefine((f,m)=>{m.addIssue({code:d.ZodIssueCode.custom,message:`Unresolvable schema reference: '${n}'`})}):void 0;let u=s.key,l=c;if(r.has(u)){let f=i.get(u);return d.lazy(()=>(f||(f=i.get(u)??Zi(l,a,new Set([u]),i),i.set(u,f)),f))}let p=i.get(u);if(!p){let f=new Set(r);f.add(u),p=Zi(l,a,f,i),i.set(u,p)}return typeof e.description==\"string\"&&(p=p.describe(e.description)),p}function s_(n,e,t,r){let i=Array.isArray(n.oneOf),s=(n.oneOf||n.anyOf).filter(f=>typeof f==\"object\"&&f!==null);if(s.length===0)return;let a=s.find(f=>Array.isArray(f.enum)),c=s.some(f=>typeof f.$ref==\"string\"&&f.$ref.includes(\"DataBinding\")),u=s.map(f=>Zi(f,e,new Set(t),r)),l;if(u.length===1)l=u[0];else{let f=d.union([u[0],u[1],...u.slice(2)]);l=i?d.any().superRefine((m,g)=>{let h=0;for(let b of u)if(b.safeParse(m).success&&++h>1){g.addIssue({code:d.ZodIssueCode.custom,message:\"Value matched more than one schema in oneOf\"});return}}).pipe(f):f}n.default!==void 0&&(l=l.default(n.default));let p=(typeof n.description==\"string\"?n.description:void 0)||(a&&c?\"REF:common_types.json#/$defs/DynamicString\":void 0);return p?l.describe(p):l}function Zi(n,e,t=new Set,r=new $n){if(!n||typeof n!=\"object\")return d.unknown();if(n instanceof d.ZodType)return n;if(n.$ref&&typeof n.$ref==\"string\"){let i=o_(n.$ref,n,e,t,r);if(i)return i}if(Array.isArray(n.oneOf)||Array.isArray(n.anyOf)){let i=s_(n,e,t,r);if(i)return i}if(n.const!==void 0){let i=d.literal(n.const);return ir(i,n,e,t,r)}if(Array.isArray(n.enum)&&n.enum.length>0){let i=i_(n.enum);return ir(i,n,e,t,r)}if(n.type===\"array\"){let i=n.items&&typeof n.items==\"object\"?Zi(n.items,e,new Set(t),r):d.unknown(),o=d.array(i);return typeof n.minItems==\"number\"&&(o=o.min(n.minItems)),typeof n.maxItems==\"number\"&&(o=o.max(n.maxItems)),n.uniqueItems===!0&&(o=o.refine(s=>new Set(s.map(Ko)).size===s.length,{message:\"Array items must be unique\"})),ir(o,n,e,t,r)}switch(n.type){case\"string\":{let i=d.string();if(typeof n.minLength==\"number\"&&(i=i.min(n.minLength)),typeof n.maxLength==\"number\"&&(i=i.max(n.maxLength)),typeof n.pattern==\"string\")try{i=i.regex(new RegExp(n.pattern,\"u\"))}catch{}return ir(i,n,e,t,r)}case\"integer\":case\"number\":{let i=n.type===\"integer\"?d.number().int():d.number();return typeof n.minimum==\"number\"&&(i=i.min(n.minimum)),typeof n.maximum==\"number\"&&(i=i.max(n.maximum)),typeof n.exclusiveMinimum==\"number\"&&(i=i.gt(n.exclusiveMinimum)),typeof n.exclusiveMaximum==\"number\"&&(i=i.lt(n.exclusiveMaximum)),typeof n.multipleOf==\"number\"&&(i=i.multipleOf(n.multipleOf)),ir(i,n,e,t,r)}case\"boolean\":return ir(d.boolean(),n,e,t,r);case\"object\":{let i=n.properties,o;if(typeof i==\"object\"&&i!==null){let s=Array.isArray(n.required)?new Set(n.required.filter(u=>typeof u==\"string\")):new Set,a=d.object(Iu(i,s,!1,e,t,r));o=n.additionalProperties===!1||n.unevaluatedProperties===!1?a.strict():a.passthrough()}else o=d.record(d.unknown());return ir(o,n,e,t,r)}default:return ir(d.unknown(),n,e,t,r)}}function ha(n){return n===\"id\"||n===\"component\"||n===\"catalogId\"}function Iu(n,e,t=!1,r,i,o=new $n){let s={};for(let[a,c]of Object.entries(n)){if(t&&ha(a))continue;let u=Zi(typeof c==\"object\"&&c!==null?c:{},r,i?new Set(i):new Set,o);e.has(a)?u.safeParse(void 0).success?s[a]=u.refine(l=>l!==void 0,{message:\"Required\"}):s[a]=u:s[a]=u.optional()}return s}function ua(n,e,t,r=new Set,i=!1){if(!n||typeof n!=\"object\")return[];let o=[],s=[],a=[];if(Array.isArray(n.allOf)){for(let u of n.allOf)if(!(!u||typeof u!=\"object\"))if(typeof u.$ref==\"string\"){let l=u.$ref;if(l.includes(\"common_types.json\")&&l.includes(\"ComponentCommon\")){let{accessibility:p,metadata:f}=Po.shape;o.push({kind:\"zod\",properties:i?{accessibility:p,metadata:f}:{accessibility:p}})}else{let p=l.startsWith(\"#/\")?void 0:Cp(l),f=p instanceof d.ZodObject?void 0:t.resolve(l,e);if(p instanceof d.ZodObject)o.push({kind:\"zod\",properties:{...p.shape}});else if(!f)t.assertResolvable(l);else if(f.isPeer){if(!r.has(f.key)){let m=$u(f);m||ma(l);let g=new Set(r).add(f.key);s.push(...ua(m.target,m.doc,t,g,i))}}else if(!r.has(f.key)){r.add(f.key);let m=Wi(e,f.pointer);m&&s.push(...ua(m,e,t,r,i))}}}else a.push(...ua(u,e,t,r,i))}let c=[...o,...s,...a];return n.properties&&c.push({kind:\"json\",schema:n,rootDoc:e}),c}function Dp(n,e,t=!0,r=new $n,i=!1){let o={},s=ua(n,e,r.scope,void 0,i),a=new Set;for(let l of s)l.kind===\"json\"&&Array.isArray(l.schema.required)&&l.schema.required.forEach(p=>{typeof p==\"string\"&&a.add(p)});for(let l of s){if(l.kind===\"zod\"){for(let[f,m]of Object.entries(l.properties))t&&ha(f)||(o[f]=m);continue}let p=Iu(l.schema.properties||{},a,t,l.rootDoc,void 0,r);Object.assign(o,p)}let c=d.object(o);return n.unevaluatedProperties===!0||typeof n.unevaluatedProperties==\"object\"&&n.unevaluatedProperties!==null||n.additionalProperties===!0||typeof n.additionalProperties==\"object\"&&n.additionalProperties!==null?c.passthrough():c.strict()}function Fu(n){if(!n||typeof n!=\"object\"||Array.isArray(n))return!1;let e=n;return Object.keys(e).length>0&&e.properties===void 0&&typeof e.type!=\"string\"&&!(\"$ref\"in e)&&!(\"allOf\"in e)&&!(\"oneOf\"in e)&&!(\"anyOf\"in e)&&!(\"not\"in e)&&Object.values(e).every(t=>t!==null&&(typeof t==\"object\"||typeof t==\"boolean\"))}function lp(n){return n.unevaluatedProperties===!0||typeof n.unevaluatedProperties==\"object\"&&n.unevaluatedProperties!==null||n.additionalProperties===!0||typeof n.additionalProperties==\"object\"&&n.additionalProperties!==null}function la(n,e,t,r=new Set){let i={schemas:[],hasUnresolvable:!1};if(!n||typeof n!=\"object\"||Array.isArray(n))return i;if(Fu(n))return i.schemas.push({schema:{type:\"object\",properties:n},doc:e}),i;let o=s=>{i.schemas.push(...s.schemas),s.hasUnresolvable&&(i.hasUnresolvable=!0)};if(typeof n.$ref==\"string\"){let s=n.$ref,a=e?t.resolve(s,e):void 0;if(!a||!e)e&&t.assertResolvable(s),i.hasUnresolvable=!0;else if(a.isPeer){if(!r.has(a.key)){let c=$u(a);c||ma(s);let u=new Set(r).add(a.key);o(la(c.target,c.doc,t,u))}}else if(!r.has(a.key)){r.add(a.key);let c=Wi(e,a.pointer);c?o(la(c,e,t,r)):i.hasUnresolvable=!0}}if(Array.isArray(n.allOf))for(let s of n.allOf)s&&typeof s==\"object\"&&!Array.isArray(s)&&o(la(s,e,t,r));return(Array.isArray(n.anyOf)||Array.isArray(n.oneOf))&&(i.hasUnresolvable=!0),(n.properties||n.required||n.additionalProperties!==void 0||n.unevaluatedProperties!==void 0)&&i.schemas.push({schema:n,doc:e}),i}function dp(n,e,t=new $n){let r=la(n,e,t.scope),i=new Set;for(let{schema:c}of r.schemas)if(Array.isArray(c.required))for(let u of c.required)typeof u==\"string\"&&i.add(u);let o={};for(let{schema:c,doc:u}of r.schemas)if(c.properties&&typeof c.properties==\"object\"&&!Array.isArray(c.properties)){let l=Iu(c.properties,i,!1,u,void 0,t);Object.assign(o,l)}let s=d.object(o);return r.hasUnresolvable||r.schemas.some(({schema:c})=>lp(c))||lp(n)?s.passthrough():s.strict()}function fp(n,e){if(!n||typeof n!=\"object\"||Array.isArray(n))return[];let t=n,r=[],i=new Set,o=s=>{if(!s||typeof s!=\"object\"||Array.isArray(s))return;let a=s;if(typeof a.$ref==\"string\"&&e&&a.$ref.startsWith(\"#/\")&&!i.has(a.$ref)){i.add(a.$ref);let c=Wi(e,a.$ref);c&&o(c)}if(a.properties&&typeof a.properties==\"object\"&&a.properties!==null&&!Array.isArray(a.properties)&&r.push(...Object.keys(a.properties)),Array.isArray(a.allOf))for(let c of a.allOf)o(c)};return t.properties&&typeof t.properties==\"object\"&&t.properties!==null&&!Array.isArray(t.properties)||Array.isArray(t.allOf)||typeof t.$ref==\"string\"?(o(t),r):Fu(t)?Object.keys(t):[]}function a_(n,e,t,r=!1){let i=[];if(!n)return i;let o=(s,a)=>{if(r){Ho(s,`function identifier: '${s}'`);for(let c of a)Ho(c,`argument identifier: '${c}' in function '${s}'`)}};if(Array.isArray(n)){for(let s of n)if(s&&typeof s==\"object\"&&typeof s.name==\"string\"){let a=fp(s.parameters,e);if(o(s.name,a),t&&!t.has(s.name))continue;let c=u=>{let l=new Bo(s.name,s,p=>p.parameters&&typeof p.parameters==\"object\"?dp(p.parameters,e,new $n(u)):d.record(d.unknown()));return pa.set(l,c),l};i.push(c([]))}return i}if(typeof n==\"object\"&&n!==null)for(let[s,a]of Object.entries(n)){let u=pp(a&&typeof a==\"object\"?a:{}),l=fp(u,e);if(o(s,l),t&&!t.has(s)||!a||typeof a!=\"object\")continue;let p=f=>{let m=new Bo(s,a,g=>{let h=pp(g);return h?dp(h,e,new $n(f)):d.record(d.unknown())});return pa.set(m,p),m};i.push(p([]))}return i}function pp(n){let e=n.properties&&typeof n.properties==\"object\"&&n.properties!==null&&!Array.isArray(n.properties)?n.properties:void 0,t=e?.args??n.args??n.parameters;return!t&&e&&!(\"call\"in e)&&!(\"@call\"in e)&&!(\"function\"in e)?t=n:Fu(t)&&(t={type:\"object\",properties:t,required:n.required,additionalProperties:n.additionalProperties}),t&&typeof t==\"object\"&&!Array.isArray(t)?t:void 0}function hp(n,e){if(!Array.isArray(n))return;let t=new Set;for(let r of n)if(typeof r?.$ref==\"string\"&&r.$ref.startsWith(e)){let o=r.$ref.slice(e.length).replace(/~([01])/g,(s,a)=>a===\"1\"?\"/\":\"~\");t.add(o)}return t}function c_(n,e,t,r){let i=[];for(let[o,s]of Object.entries(n)){let a=s||{};if(t){Ho(o,`component identifier: '${o}'`);let u=a.properties;if(u&&typeof u==\"object\")for(let l of Object.keys(u))Ho(l,`property identifier: '${l}' in component '${o}'`)}if(r&&!r.has(o))continue;let c=u=>{let l=new ea(o,a,p=>Dp(p,e,!0,new $n(u),t));return pa.set(l,c),l};i.push(c([]))}return i}function u_(n,e){let t=n.theme??n.themeSchema??n.styles??e?.theme;if(t&&typeof t==\"object\"){let r=t,i=\"properties\"in r||\"allOf\"in r||r.type===\"object\"?r:{type:\"object\",properties:r},o=Dp(i,n,!1);return i.additionalProperties===!1||i.unevaluatedProperties===!1?o:o.passthrough()}}function wp(n,e,t){let r=Re(n),i=t??r.catalogId??r.$id??r.id;if(!i||typeof i!=\"string\")throw new Error(\"Catalog ID must be specified via catalog metadata ('catalogId' or '$id').\");let o=r.$defs,s=o?.anyComponent,a=hp(s?.oneOf,\"#/components/\"),c=e??r.protocolVersion??t_,u=ge(c,\"1.0\"),l=r.components??{},p=c_(l,r,u,a),f=o?.anyFunction,m=hp(f?.oneOf,\"#/functions/\"),g=a_(r.functions,r,m,u),h=u_(r,o);return rr(r),{id:i,protocolVersion:c,components:p,functions:g,themeSchema:h,...d_(r,p,g)}}var mp={$schema:\"schemaUri\",$id:\"schemaId\",title:\"title\",description:\"description\",instructions:\"instructions\"},l_=new Set([\"protocolVersion\",\"catalogId\",\"components\"]);function ca(n){return typeof n==\"object\"&&n!==null&&!Array.isArray(n)}function gp(n,e){return Ko(n)===Ko(e)}function d_(n,e,t){let r={},i={};for(let[o,s]of Object.entries(n))if(o in mp&&typeof s==\"string\")r[mp[o]]=s;else if(o===\"protocolVersion\"&&typeof s==\"string\")r.declaredProtocolVersion=s;else if(o===\"functions\"&&(Array.isArray(s)||ca(s)))r.functionsLayout=Array.isArray(s)?\"list\":\"map\";else if(o===\"$defs\"&&ca(s)){let a=gp(s.anyComponent,Cu(e.map(l=>l.name))),c=gp(s.anyFunction,Du(t.map(l=>l.name)));r.unions={anyComponent:a,anyFunction:c};let u={};for(let[l,p]of Object.entries(s))l===\"anyComponent\"&&a||l===\"anyFunction\"&&c||(u[l]=p);r.defs=Object.freeze(u)}else(!l_.has(o)||o===\"components\"&&!ca(s))&&(i[o]=s);return r.declaredProtocolVersion??=null,r.declaresCatalogId=typeof n.catalogId==\"string\",r.declaresComponents=ca(n.components),r.unions??={anyComponent:!1,anyFunction:!1},Object.keys(i).length>0&&(r.extensionFields=Object.freeze(i)),r}function f_(n,e){return e?.standardDefs?e.standardDefs:gu(e?.protocolVersion??n.protocolVersion)}var Nu=/^[^#]+#\\/(?:\\$defs|definitions)\\/([^/]+)(\\/.*)?$/;function Sp(n){let e=Nu.exec(n);return e?`#/$defs/${e[1]}${e[2]??\"\"}`:`#/$defs/${n.split(\"/\").pop()}`}function p_(n){if(n.startsWith(\"#/$defs/\"))return n.substring(8).split(\"/\")[0].replace(/~1/g,\"/\").replace(/~0/g,\"~\")}function h_(n){if(typeof n.description!=\"string\"||!n.description.startsWith(\"REF:\"))return!1;let e=n.description.substring(4),t=e.indexOf(\"|\"),r=t===-1?e:e.substring(0,t),i=t===-1?\"\":e.substring(t+1),o=n.default;for(let s of Object.keys(n))delete n[s];return n.$ref=r.startsWith(\"#\")?r:Sp(r),o!==void 0&&(n.default=o),i&&(n.description=i),!0}function m_(n,e={}){if(Array.isArray(n.allOf)){let t=n.allOf.filter(i=>!(typeof i==\"object\"&&i!==null&&Object.keys(i).length===0)),r=t.length===1?t[0]:void 0;typeof r==\"object\"&&r!==null&&!Array.isArray(r)&&Object.keys(r).every(i=>!(i in n)||i===\"allOf\")?(delete n.allOf,Object.assign(n,r)):t.length===0?delete n.allOf:n.allOf=t}Array.isArray(n.anyOf)&&(n.oneOf=n.anyOf,delete n.anyOf),e.stripAdditionalProperties?(delete n.additionalProperties,delete n.unevaluatedProperties):(n.additionalProperties&&typeof n.additionalProperties==\"object\"&&Object.keys(n.additionalProperties).length===0&&(n.additionalProperties=!0),n.unevaluatedProperties&&typeof n.unevaluatedProperties==\"object\"&&Object.keys(n.unevaluatedProperties).length===0&&(n.unevaluatedProperties=!0)),\"$schema\"in n&&delete n.$schema}function In(n,e=new Set,t={}){if(typeof n!=\"object\"||n===null||e.has(n))return;if(e.add(n),Array.isArray(n)){for(let i of n)In(i,e,t);return}let r=n;if(!h_(r)){m_(r,t);for(let i of Object.keys(r))In(r[i],e,t)}}function it(n){return typeof n==\"object\"&&n!==null&&!Array.isArray(n)}var g_=new Set([\"description\",\"title\",\"default\",\"deprecated\",\"readOnly\",\"writeOnly\",\"examples\"]),Ep=new Set([\"id\",\"component\",\"catalogId\"]),y_=new Set([\"anyComponent\",\"anyFunction\",\"theme\"]),b_=/^(?:([^#]*common_types\\.json))?#\\/\\$defs\\/([^/]+)(\\/.*)?$/,v_=/\\/(ComponentCommon|Checkable)$/;function Ru(n,e,t,r=\"\"){if(n.$ref=`#/$defs/${e}${r}`,r||n.description!==void 0)return;let i=t[e];it(i)&&typeof i.description==\"string\"&&(n.description=i.description)}function Yo(n,e,t){if(Array.isArray(n)){for(let o of n)Yo(o,e,t);return}if(!it(n))return;let r=n.$ref,i=typeof r==\"string\"?b_.exec(r):null;if(i){let[,o,s,a]=i;if(o!==void 0||s in e){if(t){for(let c of Object.keys(n))c!==\"$ref\"&&!g_.has(c)&&delete n[c];Ru(n,s,e,a);return}Ru(n,s,e,a)}}for(let o of Object.values(n))Yo(o,e,t)}function __(n,e){if(!e.startsWith(\"#/\"))return;let t=n;for(let r of e.substring(2).split(\"/\")){let i=r.replace(/~([01])/g,(o,s)=>s===\"1\"?\"/\":\"~\");if(!it(t)||!(i in t))return;t=t[i]}return t}function ga(n,e,t){let r=[],i=[],o=[];for(let a of Array.isArray(n.allOf)?n.allOf:[]){if(!it(a))continue;let c=a.$ref;if(typeof c!=\"string\"){r.push(...ga(a,e,t));continue}let u=v_.exec(c)?.[1],l=c.startsWith(\"#/\")?__(e.rootDoc,c):void 0;if(u===void 0&&it(l)){t.has(c)||(t.add(c),i.push(...ga(l,e,t)));continue}if(u===void 0&&!c.startsWith(\"#/\")&&e.peers.length>0&&!t.has(c)){let g=Jo(a,e.rootDoc,e.peers,{inlineLocalDefs:!1,visited:t});if(it(g)&&g.$ref!==c){let h=new Set(t);h.add(c),i.push(...ga(g,e,h));continue}}let p=Nu.exec(c),f=u??(p&&!p[2]?p[1]:void 0),m=f!==void 0?e.standardDefs[f]:void 0;it(m)&&it(m.properties)&&o.push({properties:Re(m.properties),...Array.isArray(m.required)?{required:m.required}:{}})}let s=[...o,...i,...r];return(\"properties\"in n||\"description\"in n)&&s.push(n),s}function x_(n,e){let t=ga(n,e,new Set),r,i={},o=new Set;for(let a of t)if(typeof a.description==\"string\"&&(r=a.description),it(a.properties)&&Object.assign(i,a.properties),Array.isArray(a.required))for(let c of a.required)typeof c==\"string\"&&o.add(c);let s={};for(let[a,c]of Object.entries(i)){if(Ep.has(a))continue;let u=Jo(Re(c),e.rootDoc,e.peers,{inlineLocalDefs:!1});Yo(u,e.standardDefs,!0),s[a]=u}return{props:s,required:[...o].filter(a=>!Ep.has(a)).sort(),...r!==void 0?{description:r}:{}}}function A_(n,e){let t=e.model.functions.get(n);if(!t)return;let r=it(t.properties)?t.properties:void 0,i=r?.args??t.args??t.parameters;if(i!==void 0)return it(i)?Object.keys(i).length>0&&!(\"properties\"in i)&&!(\"type\"in i)?{type:\"object\",properties:i,...t.required!==void 0?{required:t.required}:{},...t.additionalProperties!==void 0?{additionalProperties:t.additionalProperties}:{}}:i:{};let o=r&&(\"call\"in r||\"@call\"in r||\"function\"in r);if(!r||o)return{};let{description:s,title:a,name:c,returnType:u,allowedCallers:l,requiresUserActivation:p,...f}=t;return f}function C_(n){let e=_u.map(t=>n.extensionFields[t]).find(t=>t!==void 0)??n.defs.theme;if(it(e))return\"properties\"in e||\"allOf\"in e||e.type===\"object\"?e:{type:\"object\",properties:e}}function D_(n){return(ke(n.protocolVersion)??n.protocolVersion)===\"0.8\"||n.id.includes(\"v0_8\")||n.id.includes(\"v0.8\")}function w_(n,e,t,r){if(!n.themeSchema)return;let i=D_(n),o=C_(r.model);if(o){let u=Re({...o});!i&&u.additionalProperties===void 0&&u.unevaluatedProperties===void 0&&(u.additionalProperties=!0),e.theme=u;return}let s=_t(n.themeSchema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});In(s),Mu(s,e,t);let a=s.additionalProperties===!1,c={type:\"object\",...typeof s.description==\"string\"&&!s.description.startsWith(\"REF:\")?{description:s.description}:{},properties:s.properties||{},...Array.isArray(s.required)&&s.required.length>0?{required:s.required}:{},...a?{additionalProperties:!1}:i?{}:{additionalProperties:s.additionalProperties!==void 0?s.additionalProperties:!0}};t.push(c),e.theme=c}function Mu(n,e,t){let r=it(n.definitions)?n.definitions:it(n.$defs)?n.$defs:void 0;delete n.definitions,delete n.$defs,r&&(Object.assign(e,r),t.push(r))}function E_(n,e,t){if(!n.schema||typeof n.schema!=\"object\"||!(\"safeParse\"in n.schema))return{props:{},reqList:[],additionalProps:void 0};let r=_t(n.schema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});In(r),Mu(r,e,t);let i=r.properties||{},o=Array.isArray(r.required)?r.required.filter(c=>c!==\"component\"&&c!==\"id\"):[],s=r.unevaluatedProperties??r.additionalProperties,a=typeof s==\"boolean\"||it(s)?s:void 0;return{props:i,reqList:o,additionalProps:a}}function S_(n){let e=n.schema?.description;return typeof e==\"string\"&&!e.startsWith(\"REF:\")?e:void 0}function T_(n){return n.unevaluatedProperties??n.additionalProperties}function k_(n,e,t,r,i,o){let s,a,c,u,l=i.model.components.get(n);if(l)({props:s,required:a,description:c}=x_(l,i)),u=T_(l)??(i.isV10?void 0:!1);else{let b=E_(e,t,r),{component:v,id:x,...$}=b.props;r.push($),s=$,a=b.reqList,c=S_(e),u=i.isV10?void 0:b.additionalProps??!1}let p={};Ru(p,\"ComponentId\",i.standardDefs);let f={id:p,...s,component:{const:n}},m=[\"id\",...a,\"component\"],g=u!==void 0?{unevaluatedProperties:u}:{},h;return o?.componentEnvelopeRef?h={...c!==void 0?{description:c}:{},allOf:[{$ref:o.componentEnvelopeRef},{type:\"object\",properties:f,required:m}],...g}:h={type:\"object\",...c!==void 0?{description:c}:{},properties:f,required:m,...g},e.allowedParents&&e.allowedParents.length>0&&(h.allowedParents=e.allowedParents),e.allowedChildren&&e.allowedChildren.length>0&&(h.allowedChildren=e.allowedChildren),h}function $_(n,e,t,r,i,o){if(n.components.size===0){e.components={};return}let s={};for(let[a,c]of n.components.entries())s[a]=k_(a,c,t,r,i,o);e.components=s,t.anyComponent={oneOf:Array.from(n.components.keys()).map(a=>({$ref:`#/components/${a}`})),discriminator:{propertyName:\"component\"}}}function I_(n,e,t,r,i){let o,s=A_(n,i);if(s)o=Jo(Re(s),i.rootDoc,i.peers,{inlineLocalDefs:!1}),Yo(o,i.standardDefs,!1);else if(e.schema&&typeof e.schema==\"object\"&&\"safeParse\"in e.schema){let a=_t(e.schema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});In(a),Mu(a,t,r),r.push(a),o=a}else o={type:\"object\",properties:{}};if(o.type===\"object\"){let a=o.additionalProperties;delete o.additionalProperties,o.unevaluatedProperties=o.unevaluatedProperties??a??!1}return o}function F_(n,e,t,r,i){let o=I_(n,e,t,r,i),s=Array.isArray(o.required)&&o.required.length>0,a=i.isV10?\"@call\":\"call\",c=s?[a,\"args\"]:[a];return i.isV10?{type:\"object\",...e.description?{description:e.description}:{},returnType:e.returnType,...e.allowedCallers!==void 0?{allowedCallers:e.allowedCallers}:{},...e.requiresUserActivation!==void 0?{requiresUserActivation:e.requiresUserActivation}:{},properties:{\"@call\":{const:n},args:o},required:c}:{type:\"object\",...e.description?{description:e.description}:{},properties:{call:{const:n},args:o,returnType:{const:e.returnType}},required:c,unevaluatedProperties:!1}}function R_(n,e,t,r,i){let o=Array.from(n.functions.keys()).filter(a=>!a.startsWith(\"@\"));if(o.length===0)return;let s={};for(let a of o)s[a]=F_(a,n.functions.get(a),t,r,i);e.functions=s,t.anyFunction={oneOf:o.map(a=>({$ref:`#/functions/${a}`}))}}var O_=new Map(Object.values(cf).flatMap(n=>{let e=n.description;if(typeof e!=\"string\"||!e.startsWith(\"REF:\"))return[];let t=e.substring(4),r=t.indexOf(\"|\");return r===-1?[]:[[t.substring(0,r).split(\"/\").pop(),t.substring(r+1)]]}));function Hi(n,e,t=new Set){if(typeof n!=\"object\"||n===null||t.has(n))return;if(t.add(n),Array.isArray(n)){for(let o of n)Hi(o,e,t);return}let r=n,i=r.$ref;if(typeof i==\"string\"&&!i.startsWith(\"#\")&&i!==e){if(!Nu.test(i))throw new Error(`Cannot bundle the external schema reference '${i}'.`);r.$ref=Sp(i)}for(let o of Object.values(r))Hi(o,e,t)}function Ou(n,e,t=new Set){if(typeof n!=\"object\"||n===null||t.has(n))return;if(t.add(n),Array.isArray(n)){for(let o of n)Ou(o,e,t);return}let r=n,i=r.$ref;if(typeof i==\"string\"&&i.startsWith(\"#/$defs/\")){let o=i.substring(8),s=o.includes(\"/\")?void 0:e[o],a=r.description===void 0||r.description===O_.get(o);s&&a&&(typeof s.description==\"string\"?r.description=s.description:delete r.description)}for(let o of Object.values(r))Ou(o,e,t)}function ya(n,e,t=new Set){if(!(typeof n!=\"object\"||n===null)&&!t.has(n)){if(t.add(n),typeof n.$ref==\"string\"){let r=p_(n.$ref);r!==void 0&&e.add(r)}if(Array.isArray(n))for(let r of n)ya(r,e,t);else for(let r of Object.values(n))ya(r,e,t)}}function Tp(n,e){let t={$schema:\"https://json-schema.org/draft/2020-12/schema\",...typeof n.declaredProtocolVersion==\"string\"?{protocolVersion:n.declaredProtocolVersion.trim().replace(/^[vV](?=\\d)/,\"\")}:{},catalogId:n.id};n.instructions&&(t.instructions=n.instructions);let r=f_(n,e),i=e?.protocolVersion??n.protocolVersion,o=wu(n),s=o.defs,a={standardDefs:r,model:o,defs:s,rootDoc:{$defs:s,components:Object.fromEntries(o.components),functions:Object.fromEntries(o.functions)},peers:n.peerCatalogs??[],isV10:!!i&&ge(i,\"1.0\")},c={},u=[];w_(n,c,u,a),$_(n,t,c,u,a,e),R_(n,t,c,u,a),Hi(t,e?.componentEnvelopeRef),Hi(c);for(let p of u)Ou(p,r);let l;do{l=Object.keys(c).length;let p=new Set;ya(t,p),ya(c,p),(p.has(\"DynamicString\")||p.has(\"DynamicNumber\")||p.has(\"DynamicBoolean\")||p.has(\"DynamicValue\"))&&(p.add(\"DataBinding\"),p.add(\"FunctionCall\"));for(let f of p)if(!(f in c)){if(f in r){let m=Re(r[f]);Hi(m),c[f]=m}else if(!y_.has(f)&&f in s){let m=Re(s[f]);Yo(m,r,!1),Hi(m),c[f]=m}}p.has(\"anyFunction\")&&!(\"anyFunction\"in c)&&(c.anyFunction={not:{}})}while(Object.keys(c).length>l);return Object.keys(c).length>0&&(t.$defs=c),t}function Kr(n){if(!n)return\"\";let e=n.lastIndexOf(\"#\");return(e!==-1?n.slice(e+1):n).split(\"/\").filter(Boolean).pop()??\"\"}function kp(n,e){if(!n?._def)return null;if(e){if(e.has(n))return null;e.add(n)}switch(n._def.typeName){case\"ZodOptional\":case\"ZodNullable\":case\"ZodDefault\":case\"ZodReadonly\":return n._def.innerType;case\"ZodBranded\":return n._def.type;case\"ZodEffects\":return n._def.schema;case\"ZodLazy\":return n._def.getter();default:return null}}function N_(n){let e=[],t=new Set,r=n;for(;r;){r.description&&e.push(r.description),r._def?.description&&e.push(r._def.description);let i=kp(r,t);if(!i)break;r=i}return e}function Jr(n){let e=new Set,t=n;for(;t;){let r=kp(t,e);if(!r)break;t=r}return t}function M_(n,e){if(!n)return null;let t=Kr(n),r=e.childListRefNames,i=e.childRefNames;return r.has(t)?{isChild:!1,isChildList:!0}:i.has(t)?{isChild:!0,isChildList:!1}:null}function j_(n,e){let t=!1;for(let r of n){if(typeof r!=\"object\"||r===null)continue;let i=ju(r,e);if(i.isChildList)return{isChild:!1,isChildList:!0};i.isChild&&(t=!0)}return t?{isChild:!0,isChildList:!1}:null}function P_(n,e){let t=!1;for(let r of[\"oneOf\",\"anyOf\",\"allOf\"]){let i=n[r];if(!Array.isArray(i))continue;let o=j_(i,e);if(o?.isChildList)return o;o?.isChild&&(t=!0)}return t?{isChild:!0,isChildList:!1}:null}function ju(n,e){let t=typeof n.$ref==\"string\"?n.$ref:\"\",r=M_(t,e);if(r)return r;if(n.type===\"array\"&&n.items){let o=ju(n.items,e);if(o.isChild||o.isChildList)return{isChild:!1,isChildList:!0}}let i=P_(n,e);return i||(n.type===\"object\"&&n.properties&&(\"componentId\"in n.properties&&(\"path\"in n.properties||\"dataBinding\"in n.properties)||\"explicitList\"in n.properties||\"template\"in n.properties)?{isChild:!1,isChildList:!0}:{isChild:!1,isChildList:!1})}function L_(n){if(n?._def?.typeName===\"ZodObject\"&&typeof n._def.shape==\"function\"){let e=n._def.shape();return!!(e.componentId&&(e.path||e.dataBinding)||e.explicitList||e.template)}return!1}function B_(n,e){if(n?._def?.typeName===\"ZodArray\"){let t=Jr(n._def.type);return Yr(t,e).isChild}return!1}function V_(n,e){let t=!1,r=!1,i=!1;for(let o of n){let s=Jr(o);L_(s)&&(t=!0),B_(s,e)&&(r=!0);let a=Yr(s,e);if(a.isChildList)return{isChild:!1,isChildList:!0};a.isChild&&(i=!0)}return t||r?{isChild:!1,isChildList:!0}:i?{isChild:!0,isChildList:!1}:{isChild:!1,isChildList:!1}}function U_(n,e){if(!n)return!1;if(n.startsWith(\"REF:\")){let i=Kr(n.substring(4).split(\"|\")[0]);if(e.has(i))return!0}let t=Kr(n.split(\"|\")[0]);if(t&&e.has(t))return!0;let r=n.trim();return!!e.has(r)}function z_(n,e){if(!n)return!1;if(n.startsWith(\"REF:\")){let i=Kr(n.substring(4).split(\"|\")[0]);if(e.has(i))return!0}let t=Kr(n.split(\"|\")[0]);if(t&&e.has(t))return!0;let r=n.trim();return!!e.has(r)}function q_(n,e){let t=e.childListRefNames,r=e.childRefNames;for(let i of n){if(U_(i,t))return{isChild:!1,isChildList:!0};if(z_(i,r))return{isChild:!0,isChildList:!1}}return null}function Z_(n,e){let t=Yr(n,e);return t.isChild||t.isChildList?{isChild:!1,isChildList:!0}:{isChild:!1,isChildList:!1}}function Yr(n,e){if(!n||typeof n!=\"object\")return{isChild:!1,isChildList:!1};let t=er(n);if(t===\"component-id\")return{isChild:!0,isChildList:!1};if(t===\"child-list\")return{isChild:!1,isChildList:!0};let r=q_(N_(n),e);if(r)return r;let i=Jr(n);if(!i?._def)return ju(n,e);let o=er(i);if(o===\"component-id\")return{isChild:!0,isChildList:!1};if(o===\"child-list\")return{isChild:!1,isChildList:!0};let s=i._def.typeName;if(s===\"ZodArray\"){let a=Jr(i._def.type);return Z_(a,e)}if(s===\"ZodUnion\"){let a=i._def.options??[];return V_(a,e)}if(s===\"ZodObject\"&&typeof i._def.shape==\"function\"){let a=i._def.shape();if(a.componentId&&(a.path||a.dataBinding)||a.explicitList||a.template)return{isChild:!1,isChildList:!0}}return{isChild:!1,isChildList:!1}}function $p(n,e,t){let r=n.nestedRefs[e];if(r){r.add(t);return}n.nestedRefs[e]=new Set([t])}function W_(n,e,t,r){let i=Yr(e,r);if(i.isChildList){t.listRefs.add(n);return}if(i.isChild){t.singleRefs.add(n);return}let o=Jr(e);if(o?._def?.typeName!==\"ZodArray\")return;let s=Jr(o._def.type);if(s?._def?.typeName!==\"ZodObject\"||typeof s._def.shape!=\"function\")return;let a=s._def.shape();for(let[c,u]of Object.entries(a)){let l=Yr(u,r);(l.isChild||l.isChildList)&&(t.listRefs.add(n),$p(t,n,c))}}function H_(n){if(typeof n!=\"object\"||n===null)return null;let e=n;if(e.type!==\"array\"&&!(\"items\"in e))return null;let t=e.items;if(typeof t!=\"object\"||t===null)return null;let r=t.properties;return typeof r!=\"object\"||r===null?null:r}function G_(n,e,t){for(let[r,i]of Object.entries(n)){let o=Yr(i,t);if(o.isChildList){e.listRefs.add(r);continue}if(o.isChild){e.singleRefs.add(r);continue}let s=H_(i);if(s)for(let[a,c]of Object.entries(s)){let u=Yr(c,t);(u.isChild||u.isChildList)&&(e.listRefs.add(r),$p(e,r,a))}}}function K_(n,e,t){if(!n)return;let r=Jr(n);if(r?._def?.typeName===\"ZodObject\"&&typeof r._def.shape==\"function\"){let i=r._def.shape();for(let[o,s]of Object.entries(i))W_(o,s,e,t);return}if(typeof n==\"object\"&&n!==null&&\"properties\"in n){let i=n.properties;typeof i==\"object\"&&i!==null&&G_(i,e,t)}}function Ip(n,e){let t={},r=typeof n?.components?.values==\"function\"?Array.from(n.components.values()):Array.isArray(n)?n:Array.from(n.values());for(let i of r){let o={singleRefs:new Set,listRefs:new Set,nestedRefs:{}};K_(i.schema,o,e),t[i.name]={singleRefs:o.singleRefs,listRefs:o.listRefs,nestedRefs:o.nestedRefs}}return t}var J_=Symbol.for(\"preact-signals\");function xa(){if(Fn>1)Fn--;else{var n,e=!1;for((function(){var i=va;for(va=void 0;i!==void 0;){var o=i.S;if(o.v===i.v)for(var s=o.t;s!==void 0;s=s.x)s.i===i.i&&(s.i=o.i);i=i.o}})();Qo!==void 0;){var t=Qo;for(Qo=void 0,ba++;t!==void 0;){var r=t.u;if(t.u=void 0,t.f&=-3,!(8&t.f)&&Np(t))try{t.c()}catch(i){e||(n=i,e=!0)}t=r}}if(ba=0,Fn--,e)throw n}}function Fp(n){if(Fn>0)return n();Pu=++Y_,Fn++;try{return n()}finally{xa()}}var Xo,_e=void 0;function Aa(n){var e=_e,t=Xo;_e=void 0,Xo=void 0;try{return n()}finally{_e=e,Xo=t}}var Qo=void 0,Fn=0,ba=0,Y_=0,Pu=0,va=void 0,_a=0;function Rp(n){if(_e!==void 0){var e=n.n;if(e===void 0||e.t!==_e)return e={i:0,S:n,p:_e.s,n:void 0,t:_e,e:void 0,x:void 0,r:e},_e.s!==void 0&&(_e.s.n=e),_e.s=e,n.n=e,32&_e.f&&n.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=_e.s,e.n=void 0,_e.s.n=e,_e.s=e),e}}function ot(n,e){this.v=n,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}ot.prototype.brand=J_;ot.prototype.h=function(){return!0};ot.prototype.S=function(n){var e=this,t=this.t;t!==n&&n.e===void 0&&(n.x=t,this.t=n,t!==void 0?t.e=n:Aa(function(){var r;(r=e.W)==null||r.call(e)}))};ot.prototype.U=function(n){var e=this;if(this.t!==void 0){var t=n.e,r=n.x;t!==void 0&&(t.x=r,n.e=void 0),r!==void 0&&(r.e=t,n.x=void 0),n===this.t&&(this.t=r,r===void 0&&Aa(function(){var i;(i=e.Z)==null||i.call(e)}))}};ot.prototype.subscribe=function(n){var e=this;return Bu(function(){var t=e.value;Aa(function(){return n(t)})},{name:\"sub\"})};ot.prototype.valueOf=function(){return this.value};ot.prototype.toString=function(){return this.value+\"\"};ot.prototype.toJSON=function(){return this.value};ot.prototype.peek=function(){var n=this;return Aa(function(){return n.value})};Object.defineProperty(ot.prototype,\"value\",{get:function(){var n=Rp(this);return n!==void 0&&(n.i=this.i),this.v},set:function(n){if(n!==this.v){if(ba>100)throw new Error(\"Cycle detected\");(function(t){Fn!==0&&ba===0&&t.l!==Pu&&(t.l=Pu,va={S:t,v:t.v,i:t.i,o:va})})(this),this.v=n,this.i++,_a++,Fn++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{xa()}}}});function Op(n,e){return new ot(n,e)}function Np(n){for(var e=n.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function Mp(n){for(var e=n.s;e!==void 0;e=e.n){var t=e.S.n;if(t!==void 0&&(e.r=t),e.S.n=e,e.i=-1,e.n===void 0){n.s=e;break}}}function jp(n){for(var e=n.s,t=void 0;e!==void 0;){var r=e.p;e.i===-1?(e.S.U(e),r!==void 0&&(r.n=e.n),e.n!==void 0&&(e.n.p=r)):t=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=r}n.s=t}function Rn(n,e){ot.call(this,void 0,e),this.x=n,this.s=void 0,this.g=_a-1,this.f=4}Rn.prototype=new ot;Rn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===_a))return!0;if(this.g=_a,this.f|=1,this.i>0&&!Np(this))return this.f&=-2,!0;var n=_e;try{Mp(this),_e=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return _e=n,jp(this),this.f&=-2,!0};Rn.prototype.S=function(n){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}ot.prototype.S.call(this,n)};Rn.prototype.U=function(n){if(this.t!==void 0&&(ot.prototype.U.call(this,n),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};Rn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var n=this.t;n!==void 0;n=n.x)n.t.N()}};Object.defineProperty(Rn.prototype,\"value\",{get:function(){if(1&this.f)throw new Error(\"Cycle detected\");var n=Rp(this);if(this.h(),n!==void 0&&(n.i=this.i),16&this.f)throw this.v;return this.v}});function Pp(n,e){return new Rn(n,e)}function Lp(n){var e=n.j;if(n.j=void 0,typeof e==\"function\"){Fn++;var t=_e;_e=void 0;try{e()}catch(r){throw n.f&=-2,n.f|=8,Lu(n),r}finally{_e=t,xa()}}}function Lu(n){for(var e=n.s;e!==void 0;e=e.n)e.S.U(e);n.x=void 0,n.s=void 0,Lp(n)}function X_(n){if(_e!==this)throw new Error(\"Out-of-order effect\");jp(this),_e=n,this.f&=-2;try{8&this.f&&Lu(this)}finally{xa()}}function Gi(n,e){this.x=n,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=e?.name,Xo&&Xo.push(this)}Gi.prototype.c=function(){var n=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e==\"function\"&&(this.j=e)}finally{n()}};Gi.prototype.S=function(){if(1&this.f)throw new Error(\"Cycle detected\");this.f|=1,this.f&=-9,Lp(this),Mp(this),Fn++;var n=_e;return _e=this,X_.bind(this,n)};Gi.prototype.N=function(){2&this.f||(this.f|=2,this.u=Qo,Qo=this)};Gi.prototype.d=function(){this.f|=8,1&this.f||Lu(this)};Gi.prototype.dispose=function(){this.d()};function Bu(n,e){var t=new Gi(n,e);try{t.c()}catch(i){throw t.d(),i}var r=t.d.bind(t);return r[Symbol.dispose]=r,r}var Bp,Vp,Up,zp,qp,Zp,Wp,Hp,Gp={signal:Op,computed:Pp,effect:Bu,batchWrite:Fp,isSignal:n=>!!n&&typeof n==\"object\"&&\"value\"in n&&\"peek\"in n,getValue:n=>n.value,setValue:(n,e)=>{n instanceof Rn||(n.value=e)},peekValue:n=>n.peek()};Kp(Gp);function Kp(n){Bp=n.signal,Vp=n.computed,Up=n.effect,zp=n.batchWrite,qp=n.isSignal,Zp=n.getValue,Wp=n.setValue,Hp=n.peekValue}function Ke(n){return Bp(n)}function Xr(n){return Vp(n)}function ln(n){return Up(n)}function Ca(n){return zp(n)}function On(n){return qp(n)}function Be(n){return Zp(n)}function Je(n,e){Wp(n,e)}function Ye(n){return Hp(n)}function es(n){return/^(0|[1-9]\\d*)$/.test(n)}var or=1e4,Q_=new Set([\"__proto__\",\"constructor\",\"prototype\"]),sr=class{constructor(e={}){this.data={},this.signals=new Map,this.subscriptions=new Set,this.data=e}getSignal(e){let t=this.normalizePath(e);return this.signals.has(t)||this.signals.set(t,Ke(this.get(t))),this.signals.get(t)}set(e,t){if(e==null)throw new nt(\"Path cannot be null or undefined.\");let r=this.parsePath(e);if(r.length===0)return this.data=t??{},this.notifyAllSignals(),this;let i=r.pop();if(t==null&&this.get(e)===void 0)return this;if(this.data===void 0||this.data===null)this.data={};else if(typeof this.data!=\"object\")throw new nt(`Cannot set path '${e}': the data model root is a primitive value.`,e);let o=this.data;for(let s=0;s<r.length;s++){let a=r[s];if(Array.isArray(o)){if(!es(a))throw new nt(`Cannot use non-numeric segment '${a}' on an array in path '${e}'.`,e);let c=parseInt(a,10);if(c>or)throw new nt(`Cannot set path '${e}': array index '${a}' exceeds maximum supported index (${or}).`,e);let u=o[c];if(u!=null&&typeof u!=\"object\")throw new nt(`Cannot set path '${e}': segment '${a}' is a primitive value.`,e);if(u==null){let l=s<r.length-1?r[s+1]:i;if(es(l)){if(parseInt(l,10)>or)throw new nt(`Cannot set path '${e}': array index '${l}' exceeds maximum supported index (${or}).`,e);o[c]=[]}else o[c]={}}}else{let c=Object.prototype.hasOwnProperty.call(o,a);if(c){let u=o[a];if(u!=null&&typeof u!=\"object\")throw new nt(`Cannot set path '${e}': segment '${a}' is a primitive value.`,e)}if(!c||o[a]===void 0||o[a]===null){let u=s<r.length-1?r[s+1]:i;if(es(u)){if(parseInt(u,10)>or)throw new nt(`Cannot set path '${e}': array index '${u}' exceeds maximum supported index (${or}).`,e);o[a]=[]}else o[a]={}}}o=o[a]}if(Array.isArray(o)){if(!es(i))throw new nt(`Cannot use non-numeric segment '${i}' on an array in path '${e}'.`,e);if(parseInt(i,10)>or)throw new nt(`Cannot set path '${e}': array index '${i}' exceeds maximum supported index (${or}).`,e)}if(t==null)if(Array.isArray(o)){let s=parseInt(i,10);s<o.length&&(o[s]=void 0)}else delete o[i];else o[i]=t;return this.notifySignals(e),this}delete(e){return this.set(e,void 0)}static resolvePath(e,t){return e.startsWith(\"/\")?e:t?`${t.endsWith(\"/\")?t:`${t}/`}${e}`:`/${e}`}get(e){if(e==null)throw new nt(\"Path cannot be null or undefined.\");if(e===\"/\"||e===\"\")return this.data;let t=this.parsePath(e),r=this.data;for(let i of t){if(r==null||typeof r!=\"object\")return;if(Array.isArray(r)){if(!es(i))return;let o=parseInt(i,10);if(o<0||o>=r.length)return;r=r[o]}else{if(!Object.prototype.hasOwnProperty.call(r,i))return;r=r[i]}}return r}hasPath(e){return e==null?!1:this.get(e)!==void 0}subscribe(e,t){let r=this.getSignal(e),i=!0,o=Ye(r),s=ln(()=>{let a=Be(r);o=a,i||t(a)});return i=!1,this.subscriptions.add(s),{get value(){return o},unsubscribe:()=>{s(),this.subscriptions.delete(s)}}}dispose(){for(let e of this.subscriptions)e();this.subscriptions.clear(),this.signals.clear()}normalizePath(e){let t=e.split(\"/\").filter(r=>r.length>0);return t.length===0?\"/\":`/${t.join(\"/\")}`}parsePath(e){return e.split(\"/\").filter(t=>t.length>0).map(t=>{let r=t.replace(/~([01])/g,(i,o)=>o===\"1\"?\"/\":\"~\");if(Q_.has(r))throw new nt(`Forbidden path segment '${r}' in path '${e}'.`,e);return r})}notifySignals(e){let t=this.normalizePath(e);Ca(()=>{this.updateSignal(t);let r=t;for(;r!==\"/\"&&r!==\"\";)r=r.substring(0,r.lastIndexOf(\"/\"))||\"/\",this.updateSignal(r);for(let i of this.signals.keys())this.isDescendant(i,t)&&this.updateSignal(i)})}updateSignal(e){let t=this.signals.get(e);if(t){let r=this.get(e);Array.isArray(r)?Je(t,r.slice()):typeof r==\"object\"&&r!==null?Je(t,{...r}):Je(t,r)}}notifyAllSignals(){Ca(()=>{for(let e of this.signals.keys())this.updateSignal(e)})}isDescendant(e,t){return t===\"/\"||t===\"\"?e!==\"/\":e.startsWith(t+\"/\")}};var Ki=1e3;var U1=d.object({component:d.string().describe(\"The type name of the component.\"),id:d.lazy(()=>Tn).optional(),weight:d.number().optional()}).passthrough().describe(\"A generic A2UI component definition.\");function ts(n,e,t){if(e!==void 0){let r=n.availableCatalogs?.get(e);if(!r)throw new Fe(`Catalog not found: ${e}`);return r}if(!n.defaultCatalog)throw new Fe(`${t} names no catalogId and surface '${n.id}' has no default catalogId.`);return n.defaultCatalog}var Vu=new WeakMap,ex=\"a2ui:system-functions\",Jp;function tx(){return Jp??=new jt(ex,Hr.V1_0,[],eh),Jp}function Yi(n){if(Vu.has(n))return Vu.get(n);let e=(()=>{let t=n;for(;t;){if(t instanceof d.ZodObject||t._def?.typeName===\"ZodObject\"){if(t._def?.unknownKeys===\"passthrough\")return null;let r=typeof t.shape==\"function\"?t.shape():t.shape;return r&&typeof r==\"object\"?new Set(Object.keys(r)):null}if(t instanceof d.ZodEffects||t._def?.typeName===\"ZodEffects\"){t=t._def.schema;continue}if(t instanceof d.ZodOptional||t instanceof d.ZodNullable||t._def?.typeName===\"ZodOptional\"||t._def?.typeName===\"ZodNullable\"){t=t._def.innerType;continue}if(t instanceof d.ZodDefault||t._def?.typeName===\"ZodDefault\"){t=t._def.innerType;continue}if(t instanceof d.ZodCatch||t._def?.typeName===\"ZodCatch\"){t=t._def.innerType;continue}if(t instanceof d.ZodIntersection||t._def?.typeName===\"ZodIntersection\"){let r=Yi(t._def.left),i=Yi(t._def.right);return!r||!i?null:new Set([...r,...i])}if(t instanceof d.ZodUnion||t._def?.typeName===\"ZodUnion\"){let r=t._def.options,i=new Set;for(let o of r){let s=Yi(o);if(!s)return null;for(let a of s)i.add(a)}return i}return null}return null})();return Vu.set(n,e),e}function Yp(n,e,t){if(!e||typeof e!=\"object\"||Array.isArray(e))return;let r=Object.keys(e);if(r.length>Ki)throw new de(`Function call '${n}' exceeds maximum allowed arguments count (${Ki})`,n);let i=t?.functions?.get?.(n)??(n===\"@index\"&&t?.protocolVersion&&ge(t.protocolVersion,Hr.V1_0)?Xi:void 0);if(!i?.schema)return;let o=Yi(i.schema);if(o){for(let s of r)if(!o.has(s))throw new de(`Unknown argument '${s}' passed to function '${n}'`,n);if(r.length>o.size)throw new de(`Too many arguments for function '${n}': expected at most ${o.size}, received ${r.length}`,n)}}function nx(n){return n.startsWith(\"@\")&&!n.startsWith(\"@@\")}function Xp(n){return n.startsWith(\"@@\")?n.slice(1):n}var Qp=new Set([\"@path\",\"@call\"]);function Da(n,e){if(ge(e,\"1.0\")){for(let t of n)if(nx(t)&&!Qp.has(t))throw new U(`Unrecognized reserved protocol directive '${t}' in v1.0 dynamic object. Reserved keys must be in ${Array.from(Qp).join(\", \")}, or escaped with prefix doubling (e.g. '@${t}').`,void 0,\"INVALID_RESERVED_KEY\")}}function Uu(n){let e=n;for(;e;){if(e.explicitIndex!==void 0&&Number.isFinite(e.explicitIndex))return e.explicitIndex;if(!(e instanceof Mt)&&typeof e.getIndex==\"function\"){let t=e.getIndex();if(t!==void 0&&Number.isFinite(t))return t}if(!(e instanceof Mt)&&typeof e.index==\"number\"&&Number.isFinite(e.index))return e.index;if(typeof e.path==\"string\"){let t=e.path.split(\"/\").filter(Boolean);if(t.length>0&&/^\\d+$/.test(t[t.length-1]))return parseInt(t[t.length-1],10)}e=e.parent}}var Ji=1e3,Mt=class n{constructor(e,t,r,i){this.path=t,this._isUserActivated=!1,this._isPassiveEvaluation=!1,e instanceof sr?(this.surface=void 0,this.dataModel=e,this.functionInvoker=()=>{}):(this.surface=e,this.dataModel=e.dataModel,this.functionInvoker=e.defaultCatalog?.invoker??((o,...s)=>ts(e,void 0,`Function call '${o}'`).invoker(o,...s))),this.explicitIndex=r,this.parent=i,this.warnedPaths=i?i.warnedPaths:new Set}get isUserActivated(){return this._isUserActivated||!!this.parent?.isUserActivated}get isPassiveEvaluation(){return this._isPassiveEvaluation||!!this.parent?.isPassiveEvaluation}getIndex(){return Uu(this)}get index(){return this.getIndex()}set(e,t){let r=this.resolvePath(e);this.dataModel.set(r,t)}get surfaceProtocolVersion(){return this.surface?.protocolVersion??this.surface?.defaultCatalog?.protocolVersion}get atLeastV10(){return this._cachedAtLeastV10===void 0&&(this._cachedAtLeastV10=ge(this.surfaceProtocolVersion,\"1.0\")),this._cachedAtLeastV10}isDataBindingObject(e){return(this.atLeastV10?\"@path\"in e&&typeof e[\"@path\"]==\"string\":\"path\"in e&&typeof e.path==\"string\")&&!(\"componentId\"in e)}isFunctionCallObject(e){return this.atLeastV10?\"@call\"in e&&typeof e[\"@call\"]==\"string\":\"call\"in e&&typeof e.call==\"string\"}containsDynamicValue(e){if(e===null||typeof e!=\"object\")return!1;if(Array.isArray(e))return e.some(r=>this.containsDynamicValue(r));let t=e;if(this.isDataBindingObject(t)||this.isFunctionCallObject(t))return!0;if(this.atLeastV10){for(let r of Object.keys(t))if(r.startsWith(\"@\"))return!0}return Object.values(t).some(r=>this.containsDynamicValue(r))}emitMissingDataBindingWarning(e){typeof this.dataModel?.hasPath==\"function\"&&!this.dataModel.hasPath(e)&&!this.warnedPaths.has(e)&&(this.warnedPaths.add(e),this.surface?.dispatchWarning?.({code:\"MISSING_DATA_BINDING\",path:e,message:`Preflight DataBinding Warning: The bound JSON Pointer '${e}' does not physically exist in the active DataModel. Evaluating to None.`}))}resolveDynamicValue(e,t=0,r=!1){if(t>Ji){let o=new de(`Maximum dynamic value nesting depth exceeded (${Ji})`);this.dispatchExpressionError(o,\"DynamicValue\");return}if(e===null||typeof e!=\"object\")return e;if(Array.isArray(e))return this.containsDynamicValue(e)?e.map(o=>this.resolveDynamicValue(o,t+1,r)):e;let i=e;if(this.isDataBindingObject(i)){let o=i[\"@path\"]??i.path,s=this.resolvePath(o),a=this.dataModel.get(s);return a===void 0&&this.emitMissingDataBindingWarning(s),a}return this.isFunctionCallObject(i)?this.resolveFunctionCallValue(i,t,r):this.resolvePlainObjectValue(i,t)}resolveFunctionCallValue(e,t=0,r=!1){let i=e[\"@call\"]??e.call,o=this.resolveCallCatalog(i,e);if(!o)return;try{Yp(i,e.args,o)}catch(l){this.dispatchExpressionError(l,i);return}let s={};for(let[l,p]of Object.entries(e.args??{}))s[l]=this.resolveDynamicValue(p,t+1,r);let a=new AbortController,c=this._isUserActivated;this._isUserActivated=c||r;let u;try{u=this.evaluateFunctionReactive(i,s,o.invoker,a.signal)}finally{this._isUserActivated=c}if(u!==void 0)return On(u)?Ye(u):u}resolvePlainObjectValue(e,t=0){if(this.atLeastV10&&Da(Object.keys(e),this.surfaceProtocolVersion),!this.containsDynamicValue(e))return e;let r={};for(let[i,o]of Object.entries(e)){let s=this.atLeastV10?Xp(i):i;r[s]=this.resolveDynamicValue(o,t+1)}return r}subscribeDynamicValue(e,t){let r=this.resolveSignal(e),i=!0,o=Ye(r),s=ln(()=>{let a=Be(r);o=a,i||t(a)});return i=!1,{get value(){return o},unsubscribe:()=>{s(),r.unsubscribe?.()}}}resolveSignal(e,t=0){if(t>Ji){let a=new de(`Maximum dynamic value nesting depth exceeded (${Ji})`);return this.dispatchExpressionError(a,typeof e==\"object\"&&e&&(\"@call\"in e||\"call\"in e)?e[\"@call\"]??e.call:\"DynamicValue\"),Ke(void 0)}if(typeof e!=\"object\"||e===null)return Ke(e);if(Array.isArray(e)){if(!this.containsDynamicValue(e))return Ke(e);let a=e.map(u=>this.resolveSignal(u,t+1)),c=Xr(()=>a.map(u=>Be(u)));return c.unsubscribe=()=>{for(let u of a)u.unsubscribe?.()},c}let r=e;if(this.isDataBindingObject(r)){let a=r[\"@path\"]??r.path,c=this.resolvePath(a);return this.emitMissingDataBindingWarning(c),this.dataModel.getSignal(c)}if(this.isFunctionCallObject(r)){let a=r,c=a[\"@call\"]??a.call,u=this.resolveCallCatalog(c,a);if(!u)return Ke(void 0);try{Yp(c,a.args,u)}catch(v){return this.dispatchExpressionError(v,c),Ke(void 0)}let l={};for(let[v,x]of Object.entries(a.args??{}))l[v]=this.resolveSignal(x,t+1);if(Object.keys(l).length===0){let v=new AbortController,x=this.evaluateFunctionPassive({name:c,args:{},abortSignal:v.signal,invoker:u.invoker}),$=On(x)?x:Ke(x);return $.unsubscribe=()=>v.abort(),$}let p=Object.keys(l),f=Ke(void 0),m,g,h=Xr(()=>{let v={};for(let x=0;x<p.length;x++)v[p[x]]=Be(l[p[x]]);return v}),b=ln(()=>{try{let v=Be(h);m&&m.abort(),g&&(g(),g=void 0),m=new AbortController;let x=this.evaluateFunctionPassive({name:c,args:v,abortSignal:m.signal,invoker:u.invoker});On(x)?g=ln(()=>{Je(f,Be(x))}):Je(f,x)}catch(v){this.dispatchExpressionError(v,c),Je(f,void 0)}});return f.unsubscribe=()=>{b(),g&&g(),m&&m.abort();for(let v=0;v<p.length;v++)l[p[v]].unsubscribe?.()},f}if(this.atLeastV10&&Da(Object.keys(r),this.surfaceProtocolVersion),!this.containsDynamicValue(r))return Ke(e);let i=Object.entries(r).map(([a,c])=>[this.atLeastV10?Xp(a):a,this.resolveSignal(c,t+1)]),o=Xr(()=>{let a={};for(let[c,u]of i)a[c]=Be(u);return a}),s=o.unsubscribe?.bind(o);return o.unsubscribe=()=>{s?.();for(let[,a]of i)a.unsubscribe?.()},o}resolveAction(e){if(\"event\"in e&&typeof e.event==\"object\"&&e.event!==null){let t={},r=e.event;if(r.context&&typeof r.context==\"object\"&&!Array.isArray(r.context))for(let[o,s]of Object.entries(r.context))t[o]=this.resolveDynamicValue(s);let i={...r,context:t};return r.userMessage!==void 0&&(i.userMessage=this.resolveDynamicValue(r.userMessage)),{...e,event:i}}if(\"name\"in e){let t=e,r={};if(t.context&&typeof t.context==\"object\"&&!Array.isArray(t.context))for(let[o,s]of Object.entries(t.context))r[o]=this.resolveDynamicValue(s);let i={...t,context:r};return t.userMessage!==void 0&&(i.userMessage=this.resolveDynamicValue(t.userMessage)),i}return\"functionCall\"in e?this.resolveDynamicValue(e.functionCall,0,!0):\"call\"in e?this.resolveDynamicValue(e,0,!0):e}resolveFunctionCatalog(e,t,r){if(this.atLeastV10&&e.startsWith(\"@\")){if(r)throw new de(`System function '${e}' belongs to no catalog and must not name a catalogId.`,e);return tx()}if(!this.surface)throw new Fe(`No surface available to resolve catalog: ${t??\"default\"}`);return ts(this.surface,this.atLeastV10?t:void 0,`Function call '${e}'`)}resolveCallCatalog(e,t){try{return this.resolveFunctionCatalog(e,t.catalogId,\"catalogId\"in t)}catch(r){r instanceof Fe&&this.surface?this.surface.dispatchError({code:\"CATALOG_ERROR\",message:r.message,expression:e}):this.dispatchExpressionError(r,e);return}}evaluateFunctionPassive(e){let{name:t,args:r,invoker:i,abortSignal:o}=e,s=this._isPassiveEvaluation;this._isPassiveEvaluation=!0;try{return this.evaluateFunctionReactive(t,r,i,o)}finally{this._isPassiveEvaluation=s}}evaluateFunctionReactive(e,t,r,i){try{return r(e,t,this,i)}catch(o){this.dispatchExpressionError(o,e);return}}dispatchExpressionError(e,t){if(this.surface)if(e instanceof d.ZodError||typeof e==\"object\"&&e!==null&&e.name===\"ZodError\"){let r=e,i=new de(`Validation failed for function '${t}': ${r.message}`,t,r.errors??r.issues);this.surface.dispatchError({code:\"EXPRESSION_ERROR\",message:i.message,expression:t,details:i.details})}else if(e instanceof de)this.surface.dispatchError({code:\"EXPRESSION_ERROR\",message:e.message,expression:e.expression,details:e.details});else{let r=typeof e==\"object\"&&e!==null?e:{};this.surface.dispatchError({code:\"EXPRESSION_ERROR\",message:r.message??`An unexpected error occurred in function ${t}.`,expression:t})}}nested(e,t){let r=this.resolvePath(e);return new n(this.surface??this.dataModel,r,t,this)}resolvePath(e){if(e.startsWith(\"/\"))return e;let t=this.path;return t.endsWith(\"/\")&&t.length>1&&(t=t.slice(0,-1)),e===\"\"||e===\".\"?t||\"/\":(t===\"/\"&&(t=\"\"),`${t}/${e}`)}};var ns=Sn(d.string().describe(\"REF:#/$defs/ComponentId|The unique identifier for a component, used for both definitions and references within the same surface.\"),\"component-id\"),zu=d.string().describe(\"REF:#/$defs/CallId|The unique identifier for a function call.\"),ar=d.object({\"@path\":d.string().describe(\"A JSON Pointer path to a value in the data model.\").optional(),path:d.string().describe(\"A JSON Pointer path to a value in the data model.\").optional()}).refine(n=>n[\"@path\"]!==void 0||n.path!==void 0,{message:\"Either '@path' or 'path' must be provided.\"}).describe(\"REF:#/$defs/DataBinding\"),rx=d.object({\"@call\":d.string().describe(\"The name of the function to call.\").optional(),call:d.string().describe(\"The name of the function to call.\").optional(),catalogId:d.string().describe(\"The catalog ID for this function, overriding any surface-level default catalogId.\").optional()}).refine(n=>n[\"@call\"]!==void 0||n.call!==void 0,{message:\"Either '@call' or 'call' must be provided.\"}).describe(\"REF:#/$defs/FunctionCommon|Baseline envelope properties common to all function calls. Function-specific argument schemas ('args') are defined individually by each function in the active catalog.\"),Kt=d.record(d.string(),d.any()).and(d.intersection(rx,d.any())).describe(\"REF:#/$defs/FunctionCall|Invokes a named function, combining common function properties with the catalog function definition.\"),wa=d.union([d.string(),ar,Kt]).describe(\"REF:#/$defs/DynamicString|Represents a string\"),th=d.union([d.boolean(),ar,Kt]).describe(\"REF:#/$defs/DynamicBoolean|A boolean value that can be a literal, a path, or a function call returning a boolean or a validation result object (coerced to its 'valid' boolean).\"),ix=d.object({label:wa.optional(),description:wa.optional(),live:d.enum([\"off\",\"polite\",\"assertive\"]).describe(\"Controls screen reader announcements for dynamic updates (WAI-ARIA aria-live). 'polite' waits for user pause; 'assertive' interrupts immediately for alerts.\").default(\"off\"),hidden:th.optional()}).strict().describe(\"REF:#/$defs/AccessibilityAttributes|Attributes to enhance accessibility when using assistive technologies like screen readers or model understanding.\"),qu=d.record(d.string(),d.unknown()).superRefine((n,e)=>{for(let t in n)t.match(/^[\\p{XID_Start}_][\\p{XID_Continue}:-]*$/u)||e.addIssue({path:[t],code:d.ZodIssueCode.custom,message:`Invalid extension key \"${t}\": Keys MUST be Unicode identifiers (UAX #31).`})}).describe(\"REF:#/$defs/Extensions|Optional extension metadata. Keys MUST be Unicode identifiers (UAX #31). Keys starting with 'a2ui_' are reserved for official extensions.\"),nh=d.object({id:ns,catalogId:d.string().describe(\"The catalog ID for this component, overriding any surface-level default catalogId.\").optional(),accessibility:ix.optional(),metadata:d.object({extensions:qu.optional()}).strict().describe(\"Optional component-level metadata for vendor extensions.\").optional()}).describe(\"REF:#/$defs/ComponentCommon\");var ox=Sn(d.union([d.array(ns).describe(\"A static list of child component IDs.\"),d.object({componentId:ns,path:d.string().describe(\"The path to the list of component property objects in the data model.\")}).strict().describe(\"A template for generating a dynamic list of children from a data model list. The `componentId` is the component to use as a template.\")]).describe(\"REF:#/$defs/ChildList\"),\"child-list\"),rh=d.union([d.string(),d.number(),d.boolean(),d.array(d.any()),d.record(d.string(),d.unknown()).refine(n=>!n||!(\"@path\"in n)&&!(\"path\"in n)&&!(\"@call\"in n)&&!(\"call\"in n)),ar,Kt]).describe(\"REF:#/$defs/DynamicValue|A value that can be a literal, a path, or a function call returning any type.\"),ih=d.union([d.number(),ar,Kt]).describe(\"REF:#/$defs/DynamicNumber|Represents a value that can be either a literal number, a path to a number in the data model, or a function call returning a number.\"),sx=d.union([d.array(d.string()),ar,Kt]).describe(\"REF:#/$defs/DynamicStringList|Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array.\"),o$=d.object({\"@call\":d.literal(\"@index\").optional(),call:d.literal(\"@index\").optional(),args:d.object({offset:ih.optional()}).optional()}).refine(n=>n[\"@call\"]!==void 0||n.call!==void 0,{message:\"Either '@call' or 'call' must be '@index'.\"}).describe(\"REF:#/$defs/IndexSystemFunction\"),ax=d.object({condition:d.union([ar,Kt]).describe(\"Path or function call evaluating to a structured validation result object or a boolean.\"),message:d.string().describe(\"Optional fallback error message.\").optional()}).strict().describe(\"REF:#/$defs/CheckRule|A single validation check rule applied to an input component. The condition function or path evaluates to a structured validation result object or a boolean (which is coerced to a validation result object).\"),s$=d.object({checks:d.array(ax).describe(\"A list of validation check rules to perform on the component.\").optional()}).describe(\"REF:#/$defs/Checkable|Properties for components that support renderer-side checks.\"),a$=d.union([d.object({event:d.object({name:d.string().describe(\"The name of the action to be dispatched to the agent.\"),userMessage:wa.optional(),context:d.record(d.string(),rh).describe(\"A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.\").optional()}).strict().describe(\"The event to dispatch to the agent.\")}).strict().describe(\"Triggers an agent-side event.\"),d.object({functionCall:Kt}).strict().describe(\"Executes a renderer or agent-side function.\")]).describe(\"REF:#/$defs/Action|Defines an interaction handler that can either trigger an agent-side event or execute a local renderer-side function.\"),c$=d.object({component:d.literal(\"Surface\").optional(),child:d.literal(\"root\").optional()}).strict().describe(\"REF:#/$defs/Surface|The reserved canonical container component representing an A2UI surface. The Surface component is immutable and always has 'child': 'root'.\"),oh=d.object({functionCallId:zu,value:d.any().describe(\"The return value of the function.\").optional(),error:d.object({code:d.string(),message:d.string()}).strict().describe(\"An error object indicating failure of the function execution.\").optional()}).strict().superRefine((n,e)=>{let t=\"value\"in n,r=\"error\"in n;(t&&r||!t&&!r)&&e.addIssue({code:d.ZodIssueCode.custom,message:'FunctionResponse must have either \"value\" or \"error\", but not both or neither.'})}).describe(\"REF:#/$defs/FunctionResponse|The return response matching a callAgentFunction or callRendererFunction invocation.\");var Xi={name:\"@index\",returnType:\"number\",allowedCallers:\"rendererOnly\",schema:d.object({offset:d.union([ar,Kt,d.coerce.number()]).optional()})},Zu=Ae(Xi,(n,e)=>{let t=typeof n.offset==\"number\"&&Number.isFinite(n.offset)?n.offset:0,r=Uu(e);if(r===void 0||!Number.isFinite(r))throw new U(\"@index function can only be evaluated inside a collection template iteration scope.\");return r+t}),eh=[Zu];function Ae(n,e){return{name:n.name,returnType:n.returnType,schema:n.schema,allowedCallers:n.allowedCallers,requiresUserActivation:n.requiresUserActivation,description:n.description,execute:e}}var jt=class n{get peerCatalogs(){return this._peerCatalogs}withPeerCatalogs(e){let t=Ea(this),r=new Set([t]),i=[],o=u=>{if(!u)return;let l=Ea(u);r.has(l)||(r.add(l),i.push(l))};for(let u of this._peerCatalogs)o(u);for(let u of e)o(u._sourceCatalog),o(u);if(i.length===this._peerCatalogs.length&&i.every((u,l)=>u===this._peerCatalogs[l]))return this;let s=new Map;for(let[u,l]of this.components)s.set(u,ku(l,i));let a=new Map;for(let[u,l]of this.functions)a.set(u,ku(l,i));let c=Object.create(Object.getPrototypeOf(this));return Object.assign(c,this,{components:s,functions:a,invoker:ah(this.id,this.protocolVersion,a),cachedValidationSchema:void 0,_componentRefMap:void 0,_peerCatalogs:Object.freeze(i),_linkedFrom:t}),c}get validationSchema(){return this.cachedValidationSchema||(this.cachedValidationSchema=Tp(this)),Re(this.cachedValidationSchema)}get catalogSchema(){return this.validationSchema}toJson(){return this.cachedDocument||(this.cachedDocument=op(this)),Re(this.cachedDocument)}withEntries(e,t){let r=e.length!==this.components.size||e.some(c=>this.components.get(c.name)!==c),i=t.length!==this.functions.size||t.some(c=>this.functions.get(c.name)!==c),o=this.defs;if(o&&(r||i)){let c={...o};r&&delete c.anyComponent,i&&delete c.anyFunction,o=c}let s=this.unions?{anyComponent:this.unions.anyComponent||r,anyFunction:this.unions.anyFunction||i}:void 0,a=new n(this.id,this.protocolVersion,e,t,{themeSchema:this.themeSchema,instructions:this.instructions,schemaUri:this.schemaUri,schemaId:this.schemaId,title:this.title,description:this.description,declaredProtocolVersion:this.declaredProtocolVersion,declaresCatalogId:this.declaresCatalogId,declaresComponents:this.declaresComponents,functionsLayout:this.functionsLayout,unions:s,defs:tp(o,[...this.components.values(),...this.functions.values()],[...e,...t],this.extensionFields),extensionFields:this.extensionFields,commonTypesUri:this.commonTypesUri,themeLocation:this.themeLocation,defModels:this.defModels});return a._sourceCatalog=this._sourceCatalog??Ea(this),this._peerCatalogs.length>0?a.withPeerCatalogs(this._peerCatalogs):a}get componentRefMap(){return this._componentRefMap||(this._componentRefMap=Ip(this,Zf)),this._componentRefMap}constructor(e,t,r=[],i=[],o,s){if(this._peerCatalogs=[],!t)throw new Fe(\"protocolVersion must be provided.\");this.id=e,this.protocolVersion=t;let a=new Map;for(let l of r)a.set(l.name,l);this.components=a;let c=new Map;for(let l of i)c.set(l.name,l);this.functions=c;let u=ux(o)?{themeSchema:o}:o??{};this.themeSchema=u.themeSchema,this.instructions=u.instructions??s,this.schemaUri=u.schemaUri,this.schemaId=u.schemaId,this.title=u.title,this.description=u.description,this.declaredProtocolVersion=u.declaredProtocolVersion,this.declaresCatalogId=u.declaresCatalogId??!0,this.declaresComponents=u.declaresComponents??!0,this.functionsLayout=u.functionsLayout,this.unions=u.unions?Object.freeze({...u.unions}):void 0,this.defs=xu(u.defs),this.extensionFields=xu(u.extensionFields),this.commonTypesUri=u.commonTypesUri,this.themeLocation=u.themeLocation,this.defModels=u.defModels?Object.freeze([...u.defModels]):void 0,this.invoker=ah(this.id,this.protocolVersion,this.functions)}static fromJson(e,t,r){let{id:i,protocolVersion:o,components:s,functions:a,...c}=wp(e,t,r);return new n(i,o,s,a,c)}static fromSchema(e,t){return n.fromJson(e,t)}};function Ea(n){return n._linkedFrom??n}var sh=new WeakMap;function cx(n){let e=Ea(n),t=sh.get(e);return t===void 0&&(t=da(e.toJson()),sh.set(e,t)),t}function ch(n,e=[]){let t=Array.from(n),r=Array.from(e);return t.length+r.length<2?t:t.map((i,o)=>{if(typeof i.withPeerCatalogs!=\"function\"||!cx(i))return i;let s=[...r,...t.filter((a,c)=>c!==o&&a!==i)];return i.withPeerCatalogs(s)})}function ux(n){return typeof n==\"object\"&&n!==null&&typeof n.safeParse==\"function\"}function ah(n,e,t){return(r,i,o,s)=>{let a=t.get(r)??(ge(e,Hr.V1_0)&&r===\"@index\"?Zu:void 0);if(!a)throw new de(`Function not found in catalog '${n}': ${r}`,r);lx(a,o);let c=a.execute;if(typeof c!=\"function\")throw new de(`Function '${r}' in catalog '${n}' is schema-only and has no implementation.`,r);try{let u=a.schema.parse(i);return c.call(a,u,o,s)}catch(u){throw u?.name===\"ZodError\"||u instanceof d.ZodError?new de(`Validation failed for function '${r}': ${u.message}`,r,u.errors??u.issues):u}}}function lx(n,e){if(!n.requiresUserActivation)return;let t=!!e?.isPassiveEvaluation,i=!!!e?.isUserActivated&&typeof navigator<\"u\"&&!(navigator.userActivation?.isActive??!0);if(t||i)throw new de(`Function '${n.name}' requires user activation and cannot be evaluated without an active user gesture.`,n.name)}var Ve=class{constructor(){this.listeners=new Set}subscribe(e){return this.listeners.add(e),{unsubscribe:()=>this.listeners.delete(e)}}async emit(e){for(let t of this.listeners)try{await t(e)}catch(r){console.error(\"EventEmitter error:\",r)}}dispose(){this.listeners.clear()}};var ka=50,Sa=5,dx=/^(?:(?:\\/(?:[^~/]|~[01])*)*|(?:[^~/]|~[01])+(?:\\/(?:[^~/]|~[01])*)*)$/;function*Ta(n,e,t){if(typeof n==\"string\")yield[n,e];else if(Array.isArray(n))for(let r=0;r<n.length;r++){let i=n[r],o=`${e}[${r}]`;yield*Ta(i,o,t)}else if(typeof n==\"object\"&&n!==null){let r=n;if(\"componentId\"in r&&typeof r.componentId==\"string\"&&(\"path\"in r||\"dataBinding\"in r))yield[r.componentId,`${e}.componentId`];else if(t?.size)for(let i of t)i in r&&(yield*Ta(r[i],`${e}.${i}`));else for(let[i,o]of Object.entries(r))yield*Ta(o,`${e}.${i}`)}}function fx(n){return n.componentRefMap}function*$a(n,e){if(!n||typeof n!=\"object\")return;let t=e instanceof jt?fx(e):e,r=n.component,i=\"\",o=n;if(typeof r==\"string\")i=r;else if(typeof r==\"object\"&&r!==null){let l=r;i=Object.keys(l)[0]??\"\",o=l[i]??{}}if(!i||typeof o!=\"object\"||o===null)return;let s=t[i],a=s?s.singleRefs:new Set,c=s?s.listRefs:new Set,u=s?.nestedRefs;for(let[l,p]of Object.entries(o))(a.has(l)||c.has(l))&&(yield*Ta(p,l,u?.[l]))}var px=Object.freeze({allowOrphanComponents:!1,allowDanglingReferences:!1,allowMissingRoot:!1,allowUnknownElements:!1}),hx=Object.freeze({allowOrphanComponents:!0,allowDanglingReferences:!0,allowMissingRoot:!0,allowUnknownElements:!0});function Qr(n,e,t){if(e>ka)throw new cn(`Global recursion limit exceeded: Depth > ${ka}`);if(Array.isArray(n)){for(let r of n)Qr(r,e+1,t);return}if(typeof n==\"object\"&&n!==null){let r=n;for(let s of[r.path,r[\"@path\"]])if(typeof s==\"string\"&&!dx.test(s))throw new U(`Invalid path syntax: '${s}'`);let i=\"functionCall\"in r&&typeof r.functionCall==\"object\"&&r.functionCall!==null,o=(\"call\"in r||\"@call\"in r)&&\"args\"in r;if(i){if(t>=Sa)throw new cn(`Recursion limit exceeded: functionCall depth > ${Sa}`);for(let[s,a]of Object.entries(r))s===\"functionCall\"?Qr(a,e+1,t+1):Qr(a,e+1,t)}else if(o){if(t>=Sa)throw new cn(`Recursion limit exceeded: functionCall depth > ${Sa}`);for(let[s,a]of Object.entries(r))s===\"args\"?Qr(a,e+1,t+1):Qr(a,e+1,t)}else for(let s of Object.values(r))Qr(s,e+1,t)}}function uh(n){Qr(n,0,0)}var Qi=class{constructor(e){this.components=new Map,this._onCreated=new Ve,this._onDeleted=new Ve,this.onCreated=this._onCreated,this.onDeleted=this._onDeleted,e&&this.setCatalog(e)}setCatalog(e){this.refMap=e instanceof jt?e.componentRefMap:e}get(e){return this.components.get(e)}getAll(){return new Map(this.components)}has(e){return this.components.has(e)}get entries(){return this.components.entries()}get keys(){return this.components.keys()}get values(){return this.components.values()}get size(){return this.components.size}get componentsMap(){return this.components}addComponent(e){if(this.components.has(e.id))throw new Xn(`Component with id '${e.id}' already exists.`);this.components.set(e.id,e),this._onCreated.emit(e)}removeComponent(e){let t=this.components.get(e);t&&(this.components.delete(e),t.dispose(),this._onDeleted.emit(e))}getChildReferences(e){let t=this.components.get(e);if(!t)return[];let r=t.catalog.components.size?t.catalog.componentRefMap:this.refMap??t.catalog.componentRefMap;return Array.from($a(t.componentTree,r))}getChildIds(e){return this.getChildReferences(e).map(([t])=>t)}detectCycles(e={}){let t=e.rootId??\"root\",r=e.maxDepth??ka,i=e.allowMissingRoot??!1;for(let c of this.components.values())for(let[u,l]of this.getChildReferences(c.id))if(u===c.id)throw new cn(`Circular reference detected: Component '${c.id}' references itself in field '${l}' (Self-reference detected)`);let o=new Set,s=new Set,a=(c,u)=>{if(u>r)throw new cn(`Global recursion limit exceeded: logical depth > ${r}`);o.add(c),s.add(c);let l=this.getChildIds(c);for(let p of l)if(this.components.has(p)){if(!o.has(p))a(p,u+1);else if(s.has(p))throw new cn(`Circular reference detected involving component '${p}'`)}s.delete(c)};if(i){let c=Array.from(this.components.keys()).sort();for(let u of c)o.has(u)||a(u,0)}else this.components.has(t)&&a(t,0);return o}validateTopology(e={}){if(this.components.size===0)return;let t=e.rootId??\"root\",r=e.allowMissingRoot??!1,i=e.allowDanglingReferences??!1,o=e.allowOrphanComponents??!1;if(!r&&!this.components.has(t))throw new qt(`Missing root component: No component has id='${t}'`);if(!i){for(let a of this.components.values())for(let[c,u]of this.getChildReferences(a.id))if(!this.components.has(c))throw new qt(`Component '${a.id}' references non-existent component '${c}' in field '${u}' (Dangling reference '${c}' in component '${a.id}')`)}let s=this.detectCycles({rootId:t,allowMissingRoot:r,maxDepth:e.maxDepth});if(!o&&!r&&s.size<this.components.size){let a=Array.from(this.components.keys()).filter(c=>!s.has(c)).sort();if(a.length>0)throw new qt(`Component '${a[0]}' is not reachable from '${t}' (Orphaned component '${a[0]}' is not reachable from root)`)}}validateReferences(e={}){let t=[];try{this.validateTopology(e)}catch(r){r instanceof U?t.push(r):r instanceof Error&&t.push(new U(r.message))}return t}dispose(){for(let e of this.components.values())e.dispose();this.components.clear(),this._onCreated.dispose(),this._onDeleted.dispose()}};function mx(n){if(!n)return;let e=ke(n);return e?`v${e}`:n}var ei=class{constructor(e,t,r=new Map,i={},o=!1,s,a=\"root\",c,u){if(this.id=e,this.defaultCatalog=t,this.theme=i,this.sendDataModel=o,this.rootId=a,this.metadata=c,this._onAction=new Ve,this._onError=new Ve,this._onWarning=new Ve,this.onAction=this._onAction,this.onError=this._onError,this.onWarning=this._onWarning,this.protocolVersion=mx(u??t?.protocolVersion),r!=null&&!(r instanceof Map))throw new TypeError(\"availableCatalogs must be a Map, or undefined/null. Note that availableCatalogs is now the 3rd argument to SurfaceModel and theme is the 4th argument.\");let l=new Map(r??[]);t?.id&&!l.has(t.id)&&l.set(t.id,t),this.availableCatalogs=l,this.dataModel=s??new sr({}),this.componentsModel=new Qi(t)}get catalog(){return this.defaultCatalog}resolveCatalog(e,t=\"Item\"){return ts(this,e,t)}async dispatchAction(e,t){if(!e||typeof e!=\"object\")return;let r=gx(e);if(!r)return;let i=r.name;if(!i||typeof i!=\"string\")return;let o=r.context,s=o&&typeof o==\"object\"&&!Array.isArray(o)?o:{},a={name:i,surfaceId:this.id,sourceComponentId:t,timestamp:new Date().toISOString(),context:s},c=r.catalogId??e.catalogId;typeof c==\"string\"&&c&&(a.catalogId=c),typeof r.userMessage==\"string\"&&r.userMessage.length>0&&(a.userMessage=r.userMessage),await this._onAction.emit(a)}async dispatchError(e){await this._onError.emit({...e,surfaceId:this.id})}async dispatchWarning(e){await this._onWarning.emit({...e,surfaceId:this.id})}dispose(){this.dataModel.dispose(),this.componentsModel.dispose(),this._onAction.dispose(),this._onError.dispose(),this._onWarning.dispose()}};function gx(n){return\"event\"in n&&n.event&&typeof n.event==\"object\"?n.event:\"name\"in n&&typeof n.name==\"string\"?n:null}var Ia=class{constructor(){this.surfaces=new Map,this.surfaceUnsubscribers=new Map,this._onSurfaceCreated=new Ve,this._onSurfaceDeleted=new Ve,this._onAction=new Ve,this.onSurfaceCreated=this._onSurfaceCreated,this.onSurfaceDeleted=this._onSurfaceDeleted,this.onAction=this._onAction}addSurface(e){if(this.surfaces.has(e.id)){console.warn(`Surface ${e.id} already exists. Ignoring.`);return}this.surfaces.set(e.id,e);let t=e.onAction.subscribe(r=>this._onAction.emit(r));this.surfaceUnsubscribers.set(e.id,t),this._onSurfaceCreated.emit(e)}deleteSurface(e){let t=this.surfaces.get(e);if(t){let r=this.surfaceUnsubscribers.get(e);r&&(r.unsubscribe(),this.surfaceUnsubscribers.delete(e)),this.surfaces.delete(e),t.dispose(),this._onSurfaceDeleted.emit(e)}}getSurface(e){return this.surfaces.get(e)}get surfacesMap(){return this.surfaces}dispose(){for(let e of Array.from(this.surfaces.keys()))this.deleteSurface(e);this._onSurfaceCreated.dispose(),this._onSurfaceDeleted.dispose(),this._onAction.dispose()}};var cr=class{constructor(e,t,r,i,o){this.id=e,this.type=t,this.catalog=i,this.metadata=o,this._onUpdated=new Ve,this.onUpdated=this._onUpdated,this._properties=r}get properties(){return this._properties}set properties(e){this._properties=e,this._onUpdated.emit(this)}dispose(){this._onUpdated.dispose()}get componentTree(){return{...this._properties,id:this.id,component:this.type,...this.metadata!==void 0?{metadata:this.metadata}:{}}}};function Nn(n){let e=n.path.join(\".\")||\"root\";switch(n.code){case d.ZodIssueCode.invalid_union:{let t=n.unionErrors?.flatMap(r=>r.issues);return t&&t.length>0?t.map(Nn).join(\"; \"):`${e}: Invalid union`}case d.ZodIssueCode.unrecognized_keys:{let t=n.keys.map(r=>`'${r}'`).join(\", \");return`${e}: Unrecognized key(s) in object: ${t}`}case d.ZodIssueCode.invalid_enum_value:{let t=n,r=t.options.map(i=>String(i)).join(\" | \");return`${e}: Invalid enum value. Expected ${r}, received '${String(t.received)}'`}case d.ZodIssueCode.invalid_type:{let t=n;return`${e}: Expected ${t.expected}, received ${t.received}`}case d.ZodIssueCode.custom:return`${e}: ${n.message}`;default:return n.message?`${e}: ${n.message}`:`${e}: Validation error (${n.code})`}}var yx={\"0.8\":new Set([\"0.8\"]),\"0.9\":new Set([\"0.9\",\"0.9.1\"]),\"0.9.1\":new Set([\"0.9.1\",\"0.9\"]),\"1.0\":new Set([\"1.0\"])};function dn(n,e,t=yx){if(!n||!e)return!1;let r=ke(n),i=ke(e);if(r&&i){if(r===i)return!0;let a=t[i];if(a&&a.has(r))return!0;let c=Qn(n),u=Qn(e);return!!(c&&u&&c.major>=1&&c.major===u.major)}if(typeof n!=\"string\"||typeof e!=\"string\")return!1;let o=En(n),s=En(e);return o.length>0&&o===s}var Wu;function lh(n){Wu=n}function bx(n,e){for(let t of e){let r=n[t];if(r&&typeof r==\"object\"){let i=r;if(\"surfaceId\"in i&&i.surfaceId!==void 0&&typeof i.surfaceId!=\"string\")throw new U(\"surfaceId must be a string\")}}}var ur=class{get compatibleCatalogVersions(){let e=ke(this.version);return e?new Set([e]):new Set}get validActions(){return new Set(this.getNativeActionKeys())}isCatalogCompatible(e){return e?dn(e,this.version):!1}extractOperations(e){if(!e||typeof e!=\"object\")return[];if(Array.isArray(e))return e.flatMap(a=>this.extractOperations(a));let t=e;if(Array.isArray(t.messages))return this.extractOperations(t.messages);let r=this.getNativeActionKeys();bx(t,r);let i=r.filter(a=>a in t).sort();if(i.length>1)throw new U(`Message contains multiple conflicting update actions: ${i.join(\", \")}.`);if(i.length===0){let a=Wu?Wu():new Set(r),c=Object.keys(t).find(l=>a.has(l)&&!r.includes(l)),u=r.slice().sort().join(\", \");throw c?new U(`Invalid ${this.version} message: action '${c}' is not supported in protocol version ${this.version}. Allowed actions: ${u}.`):new U(`Invalid ${this.version} message: message must contain exactly one update action: ${u}.`)}let o=this.preparePayloadForValidation(t),s=this.schema.safeParse(o);if(!s.success){let a=s.error.errors.map(Nn).join(\"; \");throw new U(`Invalid ${this.version} message: ${a}`,s.error)}return this.extractOperationsFromObject(t)}preparePayloadForValidation(e){return\"version\"in e?e:{version:this.version,...e}}};var fn=(n,e)=>{let t=Object.keys(n).filter(r=>n[r]!==void 0);t.length!==1&&e.addIssue({code:d.ZodIssueCode.custom,message:`Must define exactly one property, found ${t.length} (${t.join(\", \")}).`})},Pt=d.object({path:d.string().optional(),literalString:d.string().optional(),literal:d.string().optional()}).strict().superRefine(fn),dh=d.lazy(()=>d.object({key:d.string(),valueString:d.string().optional(),valueNumber:d.number().optional(),valueBoolean:d.boolean().optional(),valueMap:d.array(dh).optional()}).strict().superRefine((n,e)=>{let t=0;n.valueString!==void 0&&t++,n.valueNumber!==void 0&&t++,n.valueBoolean!==void 0&&t++,n.valueMap!==void 0&&t++,t!==1&&e.addIssue({code:d.ZodIssueCode.custom,message:`Value map item must have exactly one value property (valueString, valueNumber, valueBoolean, valueMap), found ${t}.`})}));function vx(n={}){let e=n.maxDepth??5;return dh.superRefine((t,r)=>{let i=(o,s)=>{if(s>e){r.addIssue({code:d.ZodIssueCode.custom,message:`valueMap recursion exceeded maximum depth of ${e}.`});return}if(o.valueMap&&Array.isArray(o.valueMap))for(let a of o.valueMap)i(a,s+1)};i(t,1)})}var fh=vx(),Q$=d.object({path:d.string().optional(),literalNumber:d.number().optional(),literal:d.number().optional()}).strict().superRefine(fn),eI=d.object({path:d.string().optional(),literalBoolean:d.boolean().optional(),literal:d.boolean().optional()}).strict().superRefine(fn),_x=d.object({name:d.string().describe(\"A unique name identifying the action (e.g., 'submitForm').\"),context:d.array(d.object({key:d.string(),value:d.object({path:d.string().describe(\"A data binding reference to a location in the data model (e.g., '/user/name').\").optional(),literalString:d.string().describe(\"A fixed, hardcoded string value.\").optional(),literalNumber:d.number().optional(),literalBoolean:d.boolean().optional()}).describe(\"The dynamic value. Define EXACTLY ONE of the nested properties.\").strict().superRefine(fn)})).describe(\"A key-value map of data bindings to be resolved when the action is triggered.\").optional()}),tI=d.object({text:Pt,usageHint:d.enum([\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"caption\",\"body\"]).optional()}),nI=d.object({url:Pt,usageHint:d.enum([\"icon\",\"avatar\",\"smallFeature\",\"mediumFeature\",\"largeFeature\",\"header\"]).optional(),fit:d.enum([\"contain\",\"cover\",\"fill\",\"none\",\"scale-down\"]).optional(),altText:Pt.optional()}),rI=d.object({name:Pt}),iI=d.object({url:Pt}),oI=d.object({url:Pt,description:Pt.optional().describe(\"A label, title, or placeholder text.\")}),sI=d.object({tabItems:d.array(d.object({title:d.object({path:d.string().describe(\"A data binding reference to a location in the data model (e.g., '/user/name').\").optional(),literalString:d.string().describe(\"A fixed, hardcoded string value.\").optional()}),child:d.string().describe(\"A reference to a component instance by its unique ID.\")}).strict().superRefine((n,e)=>{n.title||e.addIssue({code:d.ZodIssueCode.custom,message:\"Tab item is missing 'title'.\"}),n.child||e.addIssue({code:d.ZodIssueCode.custom,message:\"Tab item is missing 'child'.\"}),n.title&&fn(n.title,e)})).describe(\"A list of tabs, each with a title and a child component ID.\")}),aI=d.object({axis:d.enum([\"horizontal\",\"vertical\"]).optional().describe(\"The orientation.\"),color:d.string().optional().describe(\"The color of the divider (e.g., hex code or semantic name).\"),thickness:d.number().optional().describe(\"The thickness of the divider.\")}),cI=d.object({entryPointChild:d.string().describe(\"The ID of the component (e.g., a button) that triggers the modal.\"),contentChild:d.string().describe(\"The ID of the component to display as the modal's content.\")}),uI=d.object({child:d.string().describe(\"The ID of the component to display as the button's content.\"),action:_x.describe(\"Represents a user-initiated action.\"),primary:d.boolean().optional().describe(\"Indicates if this button should be styled as the primary action.\")}),lI=d.object({label:Pt,value:d.object({path:d.string().describe(\"A data binding reference to a location in the data model (e.g., '/user/name').\").optional(),literalBoolean:d.boolean().optional()}).strict().superRefine(fn)}),dI=d.object({text:Pt.optional(),label:Pt.describe(\"A label, title, or placeholder text.\"),textFieldType:d.enum([\"shortText\",\"number\",\"date\",\"longText\",\"obscured\"]).optional(),validationRegexp:d.string().optional().describe(\"A regex string to validate the input.\")}),fI=d.object({value:Pt,enableDate:d.boolean().optional(),enableTime:d.boolean().optional(),outputFormat:d.string().optional().describe(\"The string format for the output (e.g., 'YYYY-MM-DD').\")}),pI=d.object({selections:d.object({path:d.string().describe(\"A data binding reference to a location in the data model (e.g., '/user/name').\").optional(),literalArray:d.array(d.string()).optional()}).strict().superRefine(fn),options:d.array(d.object({label:d.object({path:d.string().describe(\"A data binding reference to a location in the data model (e.g., '/user/name').\").optional(),literalString:d.string().describe(\"A fixed, hardcoded string value.\").optional()}).strict().superRefine(fn),value:d.string()})).optional(),maxAllowedSelections:d.number().optional(),type:d.enum([\"checkbox\",\"chips\"]).optional(),filterable:d.boolean().optional()}),hI=d.object({value:d.object({path:d.string().describe(\"A data binding reference to a location in the data model (e.g., '/user/name').\").optional(),literalNumber:d.number().optional()}).strict().superRefine(fn),minValue:d.number().optional(),maxValue:d.number().optional(),label:Pt.optional()}),xx=d.object({componentId:d.string(),dataBinding:d.string()}),Hu=d.object({explicitList:d.array(d.string()).optional(),template:xx.describe(\"A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.\").optional()}).strict().superRefine(fn),mI=d.object({children:Hu,distribution:d.enum([\"start\",\"center\",\"end\",\"spaceBetween\",\"spaceAround\",\"spaceEvenly\"]).optional(),alignment:d.enum([\"start\",\"center\",\"end\",\"stretch\"]).optional()}),gI=d.object({children:Hu,distribution:d.enum([\"start\",\"center\",\"end\",\"spaceBetween\",\"spaceAround\",\"spaceEvenly\"]).optional(),alignment:d.enum([\"start\",\"center\",\"end\",\"stretch\"]).optional()}),yI=d.object({children:Hu,direction:d.enum([\"vertical\",\"horizontal\"]).optional(),alignment:d.enum([\"start\",\"center\",\"end\",\"stretch\"]).optional()}),bI=d.object({child:d.string().describe(\"The ID of the component to be rendered inside the card.\")});var Ax=fh.describe(\"A single data entry. Exactly one 'value*' property should be provided alongside the key.\"),Cx=d.record(d.any()).refine(n=>Object.keys(n).length===1,\"A wrapper object that MUST contain exactly one key, which is the name of the component type (e.g., 'Heading').\");var Dx=d.object({id:d.string().describe(\"The unique identifier for this component.\"),weight:d.number().optional().describe(\"The relative weight of this component within a Row or Column. This corresponds to the CSS 'flex-grow' property. Note: this may ONLY be set when the component is a direct descendant of a Row or Column.\"),component:Cx.describe(\"A wrapper object that MUST contain exactly one key, which is the name of the component type (e.g., 'Heading'). The value is an object containing the properties for that specific component.\")}).strict().describe(\"Represents a *single* component in a UI widget tree. This component could be one of many supported types.\"),wx=d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be rendered.\"),catalogId:d.string().optional().describe(\"The identifier of the component catalog to use for this surface. If omitted, the client MUST default to the standard catalog for this A2UI version (https://a2ui.org/specification/v0_8/standard_catalog_definition.json).\"),root:d.string().describe(\"The ID of the root component to render.\"),styles:d.object({font:d.string().optional().describe(\"The primary font for the UI.\"),primaryColor:d.string().regex(/^#[0-9a-fA-F]{6}$/).optional().describe(\"The primary UI color as a hexadecimal code (e.g., '#00BFFF').\")}).strict().optional().describe(\"Styling information for the UI.\")}).strict().describe(\"Signals the client to begin rendering a surface with a root component and specific styles.\"),Ex=d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be updated. If you are adding a new surface this *must* be a new, unique identified that has never been used for any existing surfaces shown.\"),components:d.array(Dx).min(1).describe(\"A list containing all UI components for the surface.\")}).strict().superRefine((n,e)=>{let t=new Set;for(let i of n.components)i.id&&(t.has(i.id)&&e.addIssue({code:d.ZodIssueCode.custom,message:`Duplicate component ID found: ${i.id}`,path:[\"components\"]}),t.add(i.id));let r=(i,o)=>{for(let s of i)s&&!t.has(s)&&e.addIssue({code:d.ZodIssueCode.custom,message:`Component '${o}' references non-existent component ID '${s}'.`,path:[\"components\"]})};for(let i of n.components){if(!i.id||!i.component)continue;let o=Object.keys(i.component);if(o.length!==1)continue;let s=o[0],a=i.component[s];switch(s){case\"Row\":case\"Column\":case\"List\":if(a.children&&!Array.isArray(a.children)){let c=!!a.children.explicitList,u=!!a.children.template;(c&&u||!c&&!u)&&e.addIssue({code:d.ZodIssueCode.custom,message:`Component '${i.id}' must have either 'explicitList' or 'template' in children, but not both or neither.`}),c&&r(a.children.explicitList,i.id),u&&r([a.children.template?.componentId],i.id)}break;case\"Card\":a.child&&r([a.child],i.id);break;case\"Tabs\":a.tabItems&&Array.isArray(a.tabItems)&&a.tabItems.forEach(c=>{c.child&&r([c.child],i.id)});break;case\"Modal\":r([a.entryPointChild,a.contentChild],i.id);break;case\"Button\":a.child&&r([a.child],i.id);break}}}).describe(\"Updates a surface with a new set of components.\"),Sx=d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface this data model update applies to.\"),path:d.string().optional().describe(\"An optional path to a location within the data model (e.g., '/user/name'). If omitted, or set to '/', the entire data model will be replaced.\"),contents:d.array(Ax).describe(\"An array of data entries. Each entry must contain a 'key' and exactly one corresponding typed 'value*' property.\")}).strict().describe(\"Updates the data model for a surface.\"),Tx=d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be deleted.\")}).strict().describe(\"Signals the client to delete the surface identified by 'surfaceId'.\"),ph=d.object({beginRendering:wx.optional(),surfaceUpdate:Ex.optional(),dataModelUpdate:Sx.optional(),deleteSurface:Tx.optional()}).strict().superRefine((n,e)=>{Object.keys(n).filter(r=>[\"beginRendering\",\"surfaceUpdate\",\"dataModelUpdate\",\"deleteSurface\"].includes(r)).length!==1&&e.addIssue({code:d.ZodIssueCode.custom,message:\"A2UI Protocol message must have exactly one of: surfaceUpdate, dataModelUpdate, beginRendering, deleteSurface.\"})}).describe(\"Describes a JSON payload for an A2UI (Agent to UI) message, which is used to dynamically construct and update user interfaces. A message MUST contain exactly ONE of the action properties: 'beginRendering', 'surfaceUpdate', 'dataModelUpdate', or 'deleteSurface'.\");function hh(n){if(!n||typeof n!=\"object\")return{id:\"\",component:\"\"};let e=n,t=typeof e.component==\"string\"?e.component:\"\",r={};for(let[i,o]of Object.entries(e))i!==\"component\"&&i!==\"id\"&&(r[i]=o);if(e.component&&typeof e.component==\"object\"){let i=e.component,o=Object.keys(i);if(o.length>0){t=o[0];let s=i[o[0]];s&&typeof s==\"object\"&&s!==null&&!Array.isArray(s)&&Object.assign(r,s)}}return{...r,id:String(e.id??\"\"),component:t}}var Fa=class extends ur{constructor(){super(...arguments),this.version=\"v0.8\",this.schema=ph}getNativeActionKeys(){return[\"beginRendering\",\"surfaceUpdate\",\"dataModelUpdate\",\"deleteSurface\"]}preparePayloadForValidation(e){let t={...e};return delete t.version,t}extractOperationsFromObject(e){let t=[];if(\"beginRendering\"in e){let r=e.beginRendering;t.push({type:\"createSurface\",surfaceId:String(r?.surfaceId??\"\"),catalogId:typeof r?.catalogId==\"string\"?r.catalogId:void 0,theme:r?.theme??r?.styles,sendDataModel:!!r?.sendDataModel,components:Array.isArray(r?.components)?r.components.map(hh):void 0,dataModel:r?.dataModel&&typeof r.dataModel==\"object\"&&!Array.isArray(r.dataModel)?r.dataModel:void 0,version:typeof e.version==\"string\"?e.version:this.version,rootId:typeof r?.root==\"string\"&&r.root?r.root:void 0})}if(\"surfaceUpdate\"in e){let r=e.surfaceUpdate;t.push({type:\"updateComponents\",surfaceId:String(r?.surfaceId??\"\"),components:Array.isArray(r?.components)?r.components.map(hh):[]})}if(\"dataModelUpdate\"in e){let r=e.dataModelUpdate,i=String(r?.surfaceId??\"\"),o=typeof r?.path==\"string\"?r.path.trim():\"\",s=o&&o!==\"/\"?(o.startsWith(\"/\")?o:`/${o}`).replace(/\\/+$/,\"\"):\"\",a=c=>{if(\"valueNumber\"in c)return c.valueNumber;if(\"valueString\"in c)return c.valueString;if(\"valueBoolean\"in c)return c.valueBoolean;if(\"valueObject\"in c)return c.valueObject;if(\"valueArray\"in c)return c.valueArray;if(Array.isArray(c.valueMap)){let u={};for(let l of c.valueMap)l&&typeof l==\"object\"&&typeof l.key==\"string\"&&(u[l.key]=a(l));return u}return c.value};if(Array.isArray(r?.contents)){for(let c of r.contents)if(c&&typeof c==\"object\"&&typeof c.key==\"string\"){let u=a(c),l=c.key.replace(/^\\/+/,\"\"),p=l===\".\"||l===\"\"?s||\"/\":`${s}/${l}`;t.push({type:\"updateDataModel\",surfaceId:i,path:p,value:u})}}else t.push({type:\"updateDataModel\",surfaceId:i,path:typeof r?.path==\"string\"?r.path:void 0,value:r?.value})}if(\"deleteSurface\"in e){let r=e.deleteSurface;t.push({type:\"deleteSurface\",surfaceId:String(r?.surfaceId??\"\")})}return t}};var kx=d.object({version:d.enum([\"v0.9\",\"v0.9.1\"]),createSurface:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be rendered.\"),catalogId:d.string().describe(\"A string that uniquely identifies this catalog. It is recommended to prefix this with an internet domain that you own, to avoid conflicts e.g. mycompany.com:somecatalog'.\"),theme:d.any().optional(),sendDataModel:d.boolean().describe(\"If true, the client will send the full data model of this surface in the metadata of every A2A message sent to the server that created the surface. Defaults to false.\").optional()}).strict().describe(\"Signals the client to create a new surface and begin rendering it. It is an error to send 'createSurface' for a surfaceId that already exists without first deleting it. When this message is sent, the client will expect 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId that define the component tree.\")}).strict(),$x=d.object({version:d.enum([\"v0.9\",\"v0.9.1\"]),updateComponents:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be updated.\"),components:d.array(d.record(d.string(),d.any())).min(1).describe(\"A list containing all UI components for the surface.\")}).strict().describe(\"Updates a surface with a new set of components. This message can be sent multiple times to update the component tree of an existing surface. One of the components in one of the components lists MUST have an 'id' of 'root' to serve as the root of the component tree. A createSurface message MUST have been previously sent for the 'surfaceId' in this message; the surface's catalog is the one specified by that createSurface.\")}).strict(),Ix=d.object({version:d.enum([\"v0.9\",\"v0.9.1\"]),updateDataModel:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface this data model update applies to.\"),path:d.string().describe(\"An optional path to a location within the data model (e.g., '/user/name'). If omitted, or set to '/', refers to the entire data model.\").optional(),value:d.any().describe(\"The data to be updated in the data model. If present, the value at 'path' is replaced (or created). If omitted, the key at 'path' is removed.\").optional()}).strict().describe(\"Updates the data model for an existing surface. This message can be sent multiple times to update the data model. A createSurface message MUST have been previously sent for the 'surfaceId' in this message; the surface's catalog is the one specified by that createSurface.\")}).strict(),Fx=d.object({version:d.enum([\"v0.9\",\"v0.9.1\"]),deleteSurface:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be deleted.\")}).strict().describe(\"Signals the client to delete the surface identified by 'surfaceId'. A createSurface message MUST have been previously sent for the 'surfaceId' in this message; the surface's catalog is the one specified by that createSurface.\")}).strict(),Gu=d.union([kx,$x,Ix,Fx]),Rx=d.array(Gu).describe(\"A list of messages.\"),SI=d.object({messages:Rx}).strict().describe(\"An object wrapping a list of messages.\");var rs=class extends ur{constructor(){super(...arguments),this.version=\"v0.9\",this.schema=Gu}get compatibleCatalogVersions(){return new Set([\"0.9\",\"0.9.1\"])}getNativeActionKeys(){return[\"createSurface\",\"updateComponents\",\"updateDataModel\",\"deleteSurface\"]}extractOperationsFromObject(e){let t=[];if(\"createSurface\"in e){let r=e.createSurface;t.push({type:\"createSurface\",surfaceId:String(r?.surfaceId||\"\"),catalogId:typeof r?.catalogId==\"string\"?r.catalogId:void 0,theme:r?.theme,sendDataModel:!!r?.sendDataModel,components:Array.isArray(r?.components)?r.components:void 0,dataModel:r?.dataModel&&typeof r.dataModel==\"object\"&&!Array.isArray(r.dataModel)?r.dataModel:void 0,version:typeof e.version==\"string\"?e.version:this.version})}if(\"updateComponents\"in e){let r=e.updateComponents;t.push({type:\"updateComponents\",surfaceId:String(r?.surfaceId||\"\"),components:Array.isArray(r?.components)?r.components:[]})}if(\"updateDataModel\"in e){let r=e.updateDataModel;t.push({type:\"updateDataModel\",surfaceId:String(r?.surfaceId||\"\"),path:typeof r?.path==\"string\"?r.path:void 0,value:r?.value})}if(\"deleteSurface\"in e){let r=e.deleteSurface;t.push({type:\"deleteSurface\",surfaceId:String(r?.surfaceId||\"\")})}return t}};var Ku=[\"createSurface\",\"updateComponents\",\"updateDataModel\",\"deleteSurface\",\"callRendererFunction\",\"agentFunctionResponse\"];function mh(n){return typeof n==\"object\"&&n!==null&&\"type\"in n&&typeof n.type==\"string\"&&Ku.includes(n.type)}var NI=d.object({componentId:d.lazy(()=>ns),path:d.string().describe(\"The path to the list of component property objects in the data model.\")}).strict().describe(\"REF:#/$defs/TemplateChildList|A template for generating a dynamic list of children from a data model list. The `componentId` is the component to use as a template.\");var Ox=d.lazy(()=>nh.extend({component:d.string()}).passthrough().refine(n=>n.component!==\"Surface\",{message:'Component type cannot be \"Surface\". \"Surface\" is a top-level protocol container defined in createSurface, not a child component.'})),Ju=d.array(Ox).min(1),MI=d.record(d.string(),d.any());var Nx=d.object({version:d.literal(\"v1.0\"),createSurface:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be rendered. It must be globally unique for the renderer's lifetime.\"),catalogId:d.string().describe(\"A string that uniquely identifies the default catalog for this surface. It is recommended to prefix this with an internet domain that you own, to avoid conflicts e.g. 'mycompany.com:somecatalog'. Components and function calls that do not explicitly specify a catalogId will use this surface-level default catalogId.\").optional(),sendDataModel:d.boolean().describe(\"If true, the renderer will send the full data model of this surface in the metadata of every A2A message sent to the agent that created the surface. Defaults to false.\").optional(),components:Ju.optional(),dataModel:d.record(d.string(),d.any()).describe(\"The initial root data model object for the surface.\").optional(),metadata:d.object({extensions:qu.optional()}).strict().describe(\"Optional surface-level metadata.\").optional()}).strict().describe(\"Signals the renderer to create a new surface and begin rendering it. Creating a surface implicitly instantiates the canonical 'Surface' container component ('common_types.json#/$defs/Surface') with 'child': 'root'. It is an error to try to create a surface with an existing ID without first deleting it; surfaceId MUST be globally unique for the renderer's lifetime. When this message is sent, the renderer expects 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId to define the component tree.\")}).strict(),Mx=d.object({version:d.literal(\"v1.0\"),updateComponents:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be updated. It must be globally unique for the renderer's lifetime.\"),components:Ju}).strict().describe(\"Updates a surface with a new set of components. This message can be sent multiple times to update the component tree of an existing surface. One of the components in one of the components lists MUST have an 'id' of 'root' to serve as the root of the component tree. The createSurface message MUST have been previously sent for this surfaceId.\")}).strict(),jx=d.object({version:d.literal(\"v1.0\"),updateDataModel:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface this data model update applies to. It must be globally unique for the renderer's lifetime.\"),path:d.string().describe(\"An optional path to a location within the data model (e.g., '/user/name'). If omitted, or set to '/', refers to the entire data model.\").optional(),value:d.any().describe(\"The data to be updated in the data model. To delete the key/value at 'path', set 'value' explicitly to null.\")}).strict().describe(\"Updates the data model for an existing surface. This message can be sent multiple times to update the data model. The createSurface message MUST have been previously sent for this surfaceId.\")}).strict(),Px=d.object({version:d.literal(\"v1.0\"),deleteSurface:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be deleted. It must be globally unique for the renderer's lifetime.\")}).strict().describe(\"Signals the renderer to delete the surface identified by 'surfaceId'. The createSurface message MUST have been previously sent for this surfaceId.\")}).strict(),Lx=d.object({version:d.literal(\"v1.0\"),callRendererFunction:d.object({surfaceId:d.string().describe(\"Optional ID of the surface whose data model provides the evaluation context for this call. If omitted, the function executes in a surface-independent root context with an empty data model.\").optional(),functionCallId:zu,callFunction:d.intersection(Kt,d.object({catalogId:d.string()}).passthrough())}).strict().describe(\"Signals the renderer to execute a function locally on behalf of the agent.\")}).strict(),Bx=d.object({version:d.literal(\"v1.0\"),agentFunctionResponse:oh}).strict(),gh=d.union([Nx,Mx,jx,Px,Lx,Bx]);var Ra=class extends ur{constructor(){super(...arguments),this.version=\"v1.0\",this.schema=gh}getNativeActionKeys(){return[...Ku]}extractOperationsFromObject(e){let t=[];if(\"createSurface\"in e){let r=e.createSurface;t.push({type:\"createSurface\",surfaceId:String(r?.surfaceId||\"\"),catalogId:typeof r?.catalogId==\"string\"?r.catalogId:void 0,theme:r?.theme,sendDataModel:!!r?.sendDataModel,components:Array.isArray(r?.components)?r.components:void 0,dataModel:r?.dataModel&&typeof r.dataModel==\"object\"&&!Array.isArray(r.dataModel)?r.dataModel:void 0,version:typeof e.version==\"string\"?e.version:this.version,metadata:r?.metadata&&typeof r.metadata==\"object\"&&!Array.isArray(r.metadata)?r.metadata:void 0})}if(\"updateComponents\"in e){let r=e.updateComponents;t.push({type:\"updateComponents\",surfaceId:String(r?.surfaceId||\"\"),components:Array.isArray(r?.components)?r.components:[]})}if(\"updateDataModel\"in e){let r=e.updateDataModel;t.push({type:\"updateDataModel\",surfaceId:String(r?.surfaceId||\"\"),path:typeof r?.path==\"string\"?r.path:void 0,value:r?.value})}if(\"deleteSurface\"in e){let r=e.deleteSurface;t.push({type:\"deleteSurface\",surfaceId:String(r?.surfaceId||\"\")})}if(\"callRendererFunction\"in e){let r=e.callRendererFunction,i=r?.callFunction||{};t.push({type:\"callRendererFunction\",surfaceId:typeof r?.surfaceId==\"string\"?r.surfaceId:void 0,functionCallId:String(r?.functionCallId||\"\"),call:String(i?.[\"@call\"]||i?.call||\"\"),version:this.version,catalogId:typeof i?.catalogId==\"string\"?i.catalogId:void 0,args:i?.args&&typeof i.args==\"object\"&&!Array.isArray(i.args)?i.args:{}})}if(\"agentFunctionResponse\"in e){let r=e.agentFunctionResponse;t.push({type:\"agentFunctionResponse\",functionCallId:String(r?.functionCallId||\"\"),version:this.version,value:r?.value,error:r?.error&&typeof r.error==\"object\"?r.error:void 0})}return t}};var Yu=class{constructor(){this.adapters=new Map([[\"0.8\",new Fa],[\"0.9\",new rs],[\"0.9.1\",new rs],[\"1.0\",new Ra]])}getAllKnownActions(){let e=new Set;for(let t of this.adapters.values())if(t.validActions)for(let r of t.validActions)e.add(r);return e}registerAdapter(e){let t=ke(e.version)??En(e.version);this.adapters.set(t,e)}getAdapter(e){let t=ke(e)??En(e),r=this.adapters.get(t);if(!r){let i=Array.from(new Set(Array.from(this.adapters.keys()).map(o=>o.startsWith(\"v\")?o:`v${o}`))).sort().join(\", \");throw new U(`[VersionAdapterFactory] Unsupported protocol version '${e}'. Supported versions: ${i}.`)}return r}resolveFromPayload(e){let t=Array.isArray(e)?e[0]:e;if(typeof t==\"object\"&&t!==null){if(\"messages\"in t&&Array.isArray(t.messages))return this.resolveFromPayload(t.messages);if(\"version\"in t){let r=t.version;if(typeof r!=\"string\")throw new U(`[VersionAdapterFactory] Message payload is missing a valid 'version' string: 'version' property must be a string, got ${typeof r}.`);return this.getAdapter(r)}if(\"beginRendering\"in t||\"surfaceUpdate\"in t||\"dataModelUpdate\"in t||\"deleteSurface\"in t)return this.getAdapter(\"v0.8\")}throw new U(\"[VersionAdapterFactory] Message payload is missing a valid 'version' string.\")}static registerAdapter(e){ti.registerAdapter(e)}static getAdapter(e){return ti.getAdapter(e)}static resolveFromPayload(e){return ti.resolveFromPayload(e)}static getAllKnownActions(){return ti.getAllKnownActions()}},ti=new Yu;lh(()=>ti.getAllKnownActions());var Vx=[\"id\",\"component\",\"catalogId\",\"metadata\"];function Ux(n){return n===Xi.name?Xi:void 0}function zx(n,e){if(e.catalogId!==void 0)throw new U(`System function '${n}' belongs to no catalog and must not name a catalogId.`)}function Xu(n){return`Function call '${n}' has a non-string 'catalogId'.`}function Qu(n,e,{catalogIsDefault:t}){return n===void 0?t:n===e}var lr=class{constructor(e,t){this.catalog=e,this.config=t,this.enforceIdentifiers=ge(e.protocolVersion,\"1.0\")}get allowUnknown(){return this.config?this.config.allowUnknownElements??!1:!0}validateComponent(e,t){let r=e.id;if(typeof r!=\"string\"||!r)throw new U(`Component '${e.component}' is missing an 'id'; entries require a valid string 'id'.`);this.assertIdentifier(r,`Component id '${r}' must be a valid UAX #31 identifier`);let i=e.component,o=typeof i==\"string\"?i:t;if(!o)throw new U(`Cannot create component ${r} without a type.`);let s=e.catalogId,a=typeof s==\"string\"?s:void 0,c=qx(e),u=this.catalog.components.get(o);if(!u){if(!this.allowUnknown)throw new U(`Unknown component type '${o}' not found in catalog '${this.catalog.id}'.`);this.validateNestedFunctions(c,a);return}let l=Yi(u.schema);this.validateCommonEnvelopeFields(c,l,o,r,a);let p=u.schema.safeParse(c);if(!p.success){let f=p.error.errors.map(Nn).join(\", \");throw new U(`Validation failed for component '${o}' (${r}): ${f}`,p.error.issues)}this.validateNestedFunctions(c,a)}validateCommonEnvelopeFields(e,t,r,i,o){if(\"accessibility\"in e&&!t?.has(\"accessibility\")){let s=e.accessibility;delete e.accessibility;let a=tr.optional().safeParse(s);if(!a.success){let c=a.error.errors.map(Nn).join(\", \");throw new U(`Validation failed for component '${r}' (${i}): ${c}`,a.error.issues)}this.validateNestedFunctions(s,o)}if(\"metadata\"in e&&!t?.has(\"metadata\")){let s=e.metadata;delete e.metadata;let a=Po.shape.metadata.safeParse(s);if(!a.success){let c=a.error.errors.map(Nn).join(\", \");throw new U(`Validation failed for component '${r}' (${i}): ${c}`,a.error.issues)}}}assertFunctionIdentifiers(e,t){if(this.assertIdentifier(e,`Function name '${e}' must be a valid UAX #31 identifier`,!0),this.enforceIdentifiers&&t!==void 0&&t!==null&&(typeof t!=\"object\"||Array.isArray(t)))throw new U(`Validation failed for function '${e}': Expected object, received ${Array.isArray(t)?\"array\":typeof t}`);if(t&&typeof t==\"object\"&&!Array.isArray(t)){let r=Object.keys(t);if(r.length>Ki)throw new U(`Function call '${e}' exceeds maximum allowed arguments count (${Ki})`);for(let i of r)this.assertIdentifier(i,`Function argument '${i}' in function '${e}' must be a valid UAX #31 identifier`)}}validateNestedFunctions(e,t){if(Array.isArray(e)){for(let o of e)this.validateNestedFunctions(o,t);return}if(typeof e!=\"object\"||e===null)return;let r=e;this.enforceIdentifiers&&Da(Object.keys(r),this.catalog.protocolVersion);let i=this.enforceIdentifiers?r[\"@call\"]:r.call??r.function;if(typeof i==\"string\"&&(this.enforceIdentifiers||i.length>0)){let o=r.args,s=o!==void 0?o:{};if(!this.enforceIdentifiers)this.validateFunction(i,s);else if(i.startsWith(\"@\"))zx(i,r),this.validateFunction(i,s);else{let a=r.catalogId;if(a!==void 0&&typeof a!=\"string\")throw new U(Xu(i));Qu(a,this.catalog.id,{catalogIsDefault:t===void 0})?this.validateFunction(i,s):this.assertFunctionIdentifiers(i,s)}}for(let o of Object.values(r))this.validateNestedFunctions(o,t)}validateFunction(e,t){this.assertFunctionIdentifiers(e,t);let r=this.enforceIdentifiers&&e.startsWith(\"@\")?Ux(e):this.catalog.functions.get(e);if(!r){if(!this.allowUnknown)throw new U(`Unrecognized function '${e}'`);return t??{}}if(!r.schema){if(t!==void 0&&(typeof t!=\"object\"||t===null||Array.isArray(t)))throw new U(`Validation failed for function '${e}': Expected object, received ${Array.isArray(t)?\"array\":typeof t}`);return t??{}}let i=r.schema.safeParse(t??{});if(!i.success){let o=i.error.errors.map(Nn).join(\", \");throw new U(`Validation failed for function '${e}': ${o}`,i.error.issues)}return i.data}validateTheme(e){let t=this.catalog.themeSchema;if(!t)return e;let r=t.safeParse(e);if(!r.success){let i=r.error.errors.map(Nn).join(\", \");throw new U(`Validation failed for theme: ${i}`,r.error.issues)}return r.data}assertIdentifier(e,t,r=!1){if(this.enforceIdentifiers&&!Eu(e,r))throw new U(t)}};function qx(n){let e={};for(let[t,r]of Object.entries(n))Vx.includes(t)||(e[t]=r);return e}var Oa=class{constructor(e,t){if(this.pendingAgentCalls=new Map,this.isDisposed=!1,Array.isArray(e))this.catalogs=e,this.outboundListener=t,this.defaultTimeoutMs=3e4;else{let r=e??{};this.catalogs=r.catalogs??[],this.outboundListener=r.outboundListener,this.defaultTimeoutMs=r.defaultTimeoutMs??3e4}}get disposed(){return this.isDisposed}async handleCallRendererFunction(e,t,r=!1){let i=this.validateInboundMessage(e);if(i)return await this.emitOutboundResponse(i),i;let{version:o,callRendererFunction:s}=e,{surfaceId:a,functionCallId:c,callFunction:u}=s;if(a!==void 0&&t?.surface?.id!==a){let $=this.createResponseError(c,we.INVALID_FUNCTION_CALL,`Surface not found: ${a}`,o);return await this.emitOutboundResponse($),$}let l=u[\"@call\"]??u.call,{catalogId:p,args:f}=u,m=this.resolveFunctionImplementation(p,l,t,o);if(\"error\"in m){let $=this.createResponseError(c,we.INVALID_FUNCTION_CALL,m.error,o);return await this.emitOutboundResponse($),$}let g=this.checkExecutionPermissions(m.funcImpl,l,r);if(g){let $=this.createResponseError(c,we.INVALID_FUNCTION_CALL,g,o);return await this.emitOutboundResponse($),$}let h=this.ensureDataContext(t,m.catalog,c),b=this.resolveDynamicArguments(f,h,r);if(\"error\"in b){let $=this.createResponseError(c,we.EXECUTION_ERROR,b.error,o);return await this.emitOutboundResponse($),$}let v=this.parseArguments(m.catalog,m.funcImpl,b.args,l);if(\"error\"in v){let $=this.createResponseError(c,we.INVALID_FUNCTION_CALL,v.error,o);return await this.emitOutboundResponse($),$}let x=await this.executeFunctionSafely(m.funcImpl,v.args,h,c,o);return await this.emitOutboundResponse(x),x}handleAgentFunctionResponse(e){if(!e||!e.agentFunctionResponse)return;let{functionCallId:t,value:r,error:i}=e.agentFunctionResponse,o=this.pendingAgentCalls.get(t);if(o)if(this.pendingAgentCalls.delete(t),i){let s=i.code??we.UNKNOWN_ERROR,a=i.message??\"Agent function execution failed\";o.reject(new Zt(a,s,t,i))}else o.resolve(r)}callAgentFunction(e,t,r){if(this.isDisposed)return Promise.reject(new Zt(\"RpcHandler has been disposed.\",we.DISPOSED));if(!this.outboundListener)return Promise.reject(new Zt(\"Cannot call agent function without outboundListener configured.\",we.NO_LISTENER));let i=t?.[\"@call\"]??t?.call;if(!t||!i)return Promise.reject(new Zt(\"Missing or invalid function call name.\",we.INVALID_FUNCTION_CALL));let o=r??{},s=o.functionCallId??this.generateFunctionCallId(),a=o.timeoutMs??this.defaultTimeoutMs;if(this.pendingAgentCalls.has(s))return Promise.reject(new Zt(`A call with functionCallId '${s}' is already pending.`,we.DUPLICATE,s));let c={functionCallId:s,call:t,effectiveTimeoutMs:a,version:o.version};return this.dispatchAgentCall(e,c)}dispose(){if(!this.isDisposed){this.isDisposed=!0;for(let[e,t]of this.pendingAgentCalls.entries())t.reject(new Zt(`RpcHandler disposed while call '${e}' was pending.`,we.CANCELLED,e));this.pendingAgentCalls.clear()}}async emitOutboundResponse(e){if(this.outboundListener)try{let t=this.outboundListener(e);t&&typeof t.catch==\"function\"&&await t}catch{}}validateInboundMessage(e){if(!e)return this.createResponseError(\"unknown\",we.INVALID_FUNCTION_CALL,\"Inbound message is null or undefined.\",\"unknown\");let t=e.version;return this.isDisposed?this.createResponseError(e.callRendererFunction?.functionCallId??\"unknown\",we.DISPOSED,\"RpcHandler has been disposed.\",t):e.callRendererFunction?.callFunction?null:this.createResponseError(e.callRendererFunction?.functionCallId??\"unknown\",we.INVALID_FUNCTION_CALL,\"Malformed message: missing callRendererFunction or callFunction.\",t)}resolveFunctionImplementation(e,t,r,i){let o;if(e&&(o=r?.surface?.availableCatalogs?.get(e)??this.catalogs.find(a=>a.id===e),!o))return{error:`Catalog not found: ${e}`};if(!o)return{error:\"No catalog available for function resolution.\"};if(o.protocolVersion&&i&&!dn(o.protocolVersion,i))return{error:`Catalog '${o.id}' specification version (${o.protocolVersion}) does not match message protocol version (${i}).`};let s=o.functions?.get(t);return s?{funcImpl:s,catalog:o}:{error:`Function not found: ${t}`}}ensureDataContext(e,t,r){if(e instanceof Mt&&e.surface)return e;let i=new Map;for(let s of this.catalogs)t.protocolVersion&&s.protocolVersion&&dn(t.protocolVersion,s.protocolVersion)&&i.set(s.id,s);i.set(t.id,t);let o=new ei(`_rpc_fallback_${r||\"default\"}`,t,i);return new Mt(o,\"/\")}resolveDynamicArguments(e,t,r){if(e===void 0||typeof e!=\"object\"||e===null||Array.isArray(e))return{args:e};let i={},o,s=t.surface?.onError.subscribe(a=>{!o&&a?.code===\"EXPRESSION_ERROR\"&&(o=a.message||\"An error occurred during function execution.\")});try{for(let[a,c]of Object.entries(e))i[a]=t.resolveDynamicValue(c,0,r)}catch(a){o=this.extractErrorMessage(a)||\"An error occurred during function execution.\"}finally{s?.unsubscribe()}return o?{error:o}:{args:i}}checkExecutionPermissions(e,t,r){let i=e.allowedCallers??\"rendererOnly\";return i===\"rendererOrAgent\"||i===\"agentOnly\"?e.requiresUserActivation&&!r?`Function '${t}' requires user activation context to execute.`:null:`Function '${t}' cannot be called by agent (allowedCallers is ${i}).`}parseArguments(e,t,r,i){try{return{args:new lr(e,{allowUnknownElements:!1}).validateFunction(i,r)}}catch(o){let s=this.extractErrorMessage(o);return{error:`Invalid function arguments for '${i}': ${s}`}}}async executeFunctionSafely(e,t,r,i,o){let s=o||\"v1.0\";try{let a=await Promise.resolve(e.execute(t,r)),c=On(a)?Be(a):a;return{version:s,rendererFunctionResponse:{functionCallId:i,value:c!==void 0?c:null}}}catch(a){let c=this.extractErrorMessage(a);return{version:s,rendererFunctionResponse:{functionCallId:i,error:{code:we.EXECUTION_ERROR,message:c||\"An error occurred during function execution.\"}}}}}generateFunctionCallId(){if(typeof globalThis.crypto?.randomUUID==\"function\")return globalThis.crypto.randomUUID();let e=Math.random().toString(36).substring(2,15).padEnd(13,\"0\");return`call-${Date.now()}-${e}`}dispatchAgentCall(e,t){let{functionCallId:r,call:i,effectiveTimeoutMs:o,version:s}=t;return new Promise((a,c)=>{let u,l=()=>{u&&(clearTimeout(u),u=void 0),this.pendingAgentCalls.delete(r)},p=(i[\"@call\"]??i.call)||\"unknown\";u=this.createTimeoutTimer(r,p,o,l,c),this.pendingAgentCalls.set(r,{resolve:f=>{l(),a(f)},reject:f=>{l(),c(f)}}),this.sendOutboundMessage(e,r,i,s,l,c)})}createTimeoutTimer(e,t,r,i,o){if(!(r<=0))return setTimeout(()=>{this.pendingAgentCalls.delete(e)&&(i(),o(new Zt(`Agent function call '${t}' timed out after ${r}ms.`,we.TIMEOUT,e)))},r)}sendOutboundMessage(e,t,r,i,o,s){let a={version:i||\"v1.0\",callAgentFunction:{surfaceId:e,functionCallId:t,callFunction:r}};try{let c=this.outboundListener(a);c&&typeof c.catch==\"function\"&&c.catch(u=>{o(),s(u)})}catch(c){o(),s(c)}}extractErrorMessage(e){return e instanceof Error?e.message:String(e)}createResponseError(e,t,r,i){return{version:i||\"v1.0\",rendererFunctionResponse:{functionCallId:e,error:{code:t,message:r}}}}};var Na=class{constructor(e,t,r){this.actionHandler=t,this.catalogs=ch(e),this.model=new Ia,this.adapterRegistry=r?.adapterRegistry??ti,this.rpc=new Oa({catalogs:this.catalogs,outboundListener:r?.outboundListener,defaultTimeoutMs:r?.defaultTimeoutMs}),r?.validationConfig?this.validationConfig={allowOrphanComponents:!1,allowDanglingReferences:!1,allowMissingRoot:!1,allowUnknownElements:!1,...r.validationConfig}:this.validationConfig=void 0,this.actionHandler&&this.model.onAction.subscribe(this.actionHandler)}callAgentFunction(e,t,r){return this.rpc.callAgentFunction(e,t,r)}dispose(){this.rpc.dispose()}getRendererCapabilities(e){if(!e?.versions||e.versions.length===0)throw new U(\"At least one protocol version must be provided in CapabilitiesOptions to generate renderer capabilities.\");let t=e.versions,r={};for(let i of t){let o={supportedCatalogIds:this.catalogs.map(a=>a.id)},s=e?.includeInlineCatalogs?this.catalogs.map(a=>tu(i,\"1.0\")>=0?this.generateInlineCatalog(a):this.generateLegacyInlineCatalog(a,e?.componentEnvelopeRef??\"common_types.json#/$defs/ComponentCommon\")):void 0;s&&(o.inlineCatalogs=s),r[i]=o}return r}getClientCapabilities(e){return this.getRendererCapabilities(e)}generateInlineCatalog(e){let t=e.toJson();t.catalogId=e.id;let r=typeof t.protocolVersion==\"string\"?t.protocolVersion:ke(e.protocolVersion)??e.protocolVersion;return t.protocolVersion=r.trim().replace(/^[vV](?=\\d)/,\"\"),t}generateLegacyInlineCatalog(e,t=\"common_types.json#/$defs/ComponentCommon\"){let r={};for(let[s,a]of e.components.entries()){let c={},u=[];if(a.schema&&typeof a.schema==\"object\"&&\"safeParse\"in a.schema){let m=_t(a.schema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});In(m,void 0,{stripAdditionalProperties:!0}),c=m.properties||{},u=Array.isArray(m.required)?m.required.filter(g=>g!==\"component\"&&g!==\"id\"):[]}let{component:l,id:p,...f}=c;r[s]={allOf:[{$ref:t},{properties:{component:{const:s},...f},required:[\"component\",...u]}]}}let i=[];for(let s of e.functions.values()){let a={type:\"object\",properties:{}};if(s.schema&&typeof s.schema==\"object\"&&\"safeParse\"in s.schema){let c=_t(s.schema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});In(c,void 0,{stripAdditionalProperties:!0}),a=c}i.push({name:s.name,...s.description?{description:s.description}:{},returnType:s.returnType,parameters:a})}let o;if(e.themeSchema){let s=_t(e.themeSchema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});In(s,void 0,{stripAdditionalProperties:!0}),o=s.properties||void 0}return{catalogId:e.id,...Object.keys(r).length>0?{components:r}:{},...i.length>0?{functions:i}:{},...o?{theme:o}:{}}}getRendererDataModel(e){let t=Array.from(this.model.surfacesMap.values()).filter(s=>s.sendDataModel);if(t.length===0)return;if(e!==void 0){let s={};for(let a of t){let c=a.protocolVersion;(!c||dn(c,e))&&(s[a.id]=a.dataModel.get(\"/\"))}return Object.keys(s).length===0?void 0:{version:e,surfaces:s}}let r=new Set;for(let s of t)if(s.protocolVersion){let a=ke(s.protocolVersion),c=a?`v${a}`:s.protocolVersion;r.add(c)}if(r.size>1)throw new U(`Multiple protocol versions detected among active surfaces: ${Array.from(r).sort().join(\", \")}. Specify a target protocol version in getRendererDataModel(version).`);let i=r.size===1?r.values().next().value:\"v1.0\",o={};for(let s of t)o[s.id]=s.dataModel.get(\"/\");return{version:i,surfaces:o}}getClientDataModel(e){return this.getRendererDataModel(e)}resolvePath(e,t){return sr.resolvePath(e,t)}getSurfaces(){return this.model.surfacesMap}getSurface(e){return this.model.getSurface(e)}onSurfaceCreated(e){return this.model.onSurfaceCreated.subscribe(e)}onSurfaceDeleted(e){return this.model.onSurfaceDeleted.subscribe(e)}processMessages(e,t){let r=this.prepareOperations(e);for(let i of r)this.processOperation(i,t)}async processMessagesAsync(e,t){let r=this.prepareOperations(e),i=[];for(let o of r){let s=await this.processOperationAsync(o,t);s&&i.push(s)}return i}prepareOperations(e){return!e||Array.isArray(e)&&e.length===0?[]:(this.validationConfig&&uh(e),this.validationConfig?.targetVersion&&this.validateTargetVersion(e),mh(e)?[e]:this.adapterRegistry.resolveFromPayload(e).extractOperations(e))}validateTargetVersion(e){let t=this.validationConfig?.targetVersion;if(!t)return;let r=i=>{if(typeof i==\"object\"&&i!==null&&\"version\"in i){let o=i.version;if(o){let s=ke(o)??o,a=ke(t)??t;if(s!==a)throw new U(`Message version '${o}' does not match expected target version '${t}'`)}}};if(Array.isArray(e))for(let i of e)r(i);else r(e)}applyStateOperation(e){if(this.validationConfig?.allowedMessages&&!this.validationConfig.allowedMessages.includes(e.type))throw new U(`Operation '${e.type}' is not permitted by ValidationConfig.allowedMessages`);switch(e.type){case\"createSurface\":this.processCreateSurfaceOp(e);break;case\"deleteSurface\":this.processDeleteSurfaceOp(e);break;case\"updateComponents\":this.processUpdateComponentsOp(e);break;case\"updateDataModel\":this.processUpdateDataModelOp(e);break;case\"agentFunctionResponse\":this.rpc.handleAgentFunctionResponse({version:e.version??\"v1.0\",agentFunctionResponse:{functionCallId:e.functionCallId,value:e.value,error:e.error}});break;case\"callRendererFunction\":break}}resolveRpcDataContext(e){if(e.surfaceId!==void 0){let o=this.model.surfacesMap.get(e.surfaceId);return o?new Mt(o,\"/\"):void 0}let t=e.catalogId?this.catalogs.find(o=>o.id===e.catalogId):void 0;if(!t)return;let r=`_rpc_fallback_${e.functionCallId||\"default\"}`,i=new Map;for(let o of this.catalogs)t?.protocolVersion&&o.protocolVersion&&dn(t.protocolVersion,o.protocolVersion)&&i.set(o.id,o);return t&&i.set(t.id,t),new Mt(new ei(r,t,i),\"/\")}processOperation(e,t){if(e.type===\"callRendererFunction\"){let r=this.resolveRpcDataContext(e),i=t?.isUserActivated??e.isUserActivated??!1,o={version:e.version??\"v1.0\",callRendererFunction:{...e.surfaceId!==void 0?{surfaceId:e.surfaceId}:{},functionCallId:e.functionCallId,callFunction:{call:e.call,catalogId:e.catalogId,args:e.args}}};this.rpc.handleCallRendererFunction(o,r,i).catch(s=>{console.error(`Unhandled error in callRendererFunction (${e.call}):`,s)});return}this.applyStateOperation(e)}async processOperationAsync(e,t){if(e.type===\"callRendererFunction\"){let r=this.resolveRpcDataContext(e),i=t?.isUserActivated??e.isUserActivated??!1,o={version:e.version??\"v1.0\",callRendererFunction:{...e.surfaceId!==void 0?{surfaceId:e.surfaceId}:{},functionCallId:e.functionCallId,callFunction:{call:e.call,catalogId:e.catalogId,args:e.args}}};return await this.rpc.handleCallRendererFunction(o,r,i)}return this.applyStateOperation(e),null}processCreateSurfaceOp(e){let{surfaceId:t,catalogId:r,theme:i,sendDataModel:o,components:s,dataModel:a}=e,c=e.version,u=r===void 0&&c!==void 0&&ge(c,\"1.0\"),l=u?void 0:Wx(this.catalogs,r,c);if(!l&&!u)throw r!==void 0?new Fe(`Catalog not found: ${r}`):new Fe(`No default catalog available for surface '${t}'.`);if(l?.protocolVersion&&c&&!dn(l.protocolVersion,c))throw new U(`Surface '${t}' catalog '${r??l.id}' specification version (${l.protocolVersion}) does not match message protocol version (${c}).`);if(this.model.getSurface(t))throw new qt(`Surface ${t} already exists.`);let p=i;if(i&&l?.themeSchema)try{p=new lr(l,this.validationConfig).validateTheme(i)}catch(h){throw h instanceof U?new U(h.message.replace(/^Validation failed for theme:/,`Validation failed for theme on surface '${t}':`),h.details):h}let f=l?.protocolVersion??c,m=new Map(this.catalogs.filter(h=>dn(h.protocolVersion,f)).map(h=>[h.id,h])),g=new ei(t,l,m,p,o??!1,void 0,e.rootId??\"root\",e.metadata,f);this.model.addSurface(g),a&&g.dataModel.set(\"/\",a),s&&s.length>0&&this.processUpdateComponentsOp({type:\"updateComponents\",surfaceId:t,components:s})}processDeleteSurfaceOp(e){e.surfaceId&&this.model.deleteSurface(e.surfaceId)}validateComponentProperties(e,t){let{id:r,component:i}=e;if(typeof r!=\"string\"||!r)throw new U(`Component '${i}' is missing an 'id'; entries require a valid string 'id'.`);let o=this.resolveComponentCatalog(e,t),s=t.componentsModel.get(r);new lr(o,this.validationConfig).validateComponent(this.componentPayloadForValidation(e,t,o),s?.type),this.validateNestedFunctionCalls(e,t,o)}componentPayloadForValidation(e,t,r){let{catalogId:i,...o}=e;return ge(t.protocolVersion,\"1.0\")&&r!==t.defaultCatalog&&(o.catalogId=r.id),o}resolveComponentCatalog(e,t){let{id:r,component:i,catalogId:o}=e,s=`Component '${r}'`,a=ge(t.protocolVersion,\"1.0\");if(typeof o==\"string\"&&(o||a))return this.resolveSurfaceItemCatalog(t,o,s);if(!a){let c=typeof r==\"string\"?t.componentsModel.get(r):void 0;if(c&&(typeof i!=\"string\"||!i||i===c.type))return c.catalog}return this.resolveSurfaceItemCatalog(t,void 0,s)}validateNestedFunctionCalls(e,t,r){if(!ge(t.protocolVersion,\"1.0\"))return;let i=o=>{if(Array.isArray(o)){o.forEach(i);return}if(typeof o!=\"object\"||o===null)return;let s=o,a=s[\"@call\"];if(typeof a==\"string\"&&!a.startsWith(\"@\")){let c=s.catalogId;if(c!==void 0&&typeof c!=\"string\")throw new U(Xu(a));let u=c,l=this.resolveSurfaceItemCatalog(t,u,`Function call '${a}'`);if(!Qu(u,r.id,{catalogIsDefault:r===t.defaultCatalog})){let f=s.args;new lr(l,this.validationConfig).validateFunction(a,f??{})}}Object.values(s).forEach(i)};for(let[o,s]of Object.entries(e))o===\"id\"||o===\"component\"||o===\"catalogId\"||o===\"metadata\"||i(s)}resolveSurfaceItemCatalog(e,t,r){if(t!==void 0&&!e.availableCatalogs.has(t)){let i=this.catalogs.find(o=>o.id===t);if(i)throw new Fe(`${r} names catalog '${t}', whose specification version (${i.protocolVersion}) does not match surface '${e.id}' version (${e.protocolVersion}).`)}return e.resolveCatalog(t,r)}applyComponentUpdate(e,t){let{id:r,component:i,catalogId:o,metadata:s,...a}=e;if(typeof r!=\"string\")return;let c=Zx(s),u=this.resolveComponentCatalog(e,t),l=t.componentsModel.get(r);if(l){let p=typeof i==\"string\"?i:l.type;if(p!==l.type||l.catalog.id!==u.id){t.componentsModel.removeComponent(r);let f=new cr(r,p,a,u,c);t.componentsModel.addComponent(f)}else l.metadata=c,l.properties=a}else{if(typeof i!=\"string\"||!i)throw new U(`Cannot create component ${r} without a type.`);let p=new cr(r,i,a,u,c);t.componentsModel.addComponent(p)}}processUpdateComponentsOp(e){if(!e.surfaceId)return;let t=this.model.getSurface(e.surfaceId);if(!t)throw new qt(`Surface not found for message: ${e.surfaceId}`);let r=new Set;for(let i of e.components){if(i&&typeof i==\"object\"&&typeof i.id==\"string\"){if(r.has(i.id))throw new qt(`Duplicate component ID: '${i.id}'`,[i.id]);r.add(i.id)}this.validateComponentProperties(i,t)}this.validateCompositionConstraints(t,e.components),this.validateCandidateTopology(t,e.components);for(let i of e.components)this.applyComponentUpdate(i,t)}processUpdateDataModelOp(e){if(!e.surfaceId)return;let t=this.model.getSurface(e.surfaceId);if(!t)throw new qt(`Surface not found for message: ${e.surfaceId}`);let r=e.path||\"/\",i=e.value;t.dataModel.set(r,i)}validateParentConstraints(e,t,r,i){if(!i||i.length===0){if((e===\"root\"||this.validationConfig&&this.validationConfig.allowOrphanComponents===!1)&&!r.includes(\"Surface\"))throw new U(`Component '${e}' (${t}) cannot be placed under parent 'Surface' (Surface). Allowed parents: ${JSON.stringify(r)}.`,void 0,\"UNALLOWED_PARENT\");return}for(let o of i)if(!r.includes(o.parentType))throw new U(`Component '${e}' (${t}) cannot be placed under parent '${o.parentId}' (${o.parentType||\"unknown\"}). Allowed parents: ${JSON.stringify(r)}.`,void 0,\"UNALLOWED_PARENT\")}validateChildConstraints(e,t,r,i,o){for(let s of i){let a=o.get(s);if(a&&!r.includes(a))throw new U(`Container '${e}' (${t}) cannot contain child '${s}' (${a}). Allowed children: ${JSON.stringify(r)}.`,void 0,\"UNALLOWED_CHILD\")}}buildCompositionTopology(e,t){let r=new Map,i=new Map,o=new Map;for(let[a,c]of e.componentsModel.entries){r.set(a,c.type),i.set(a,c.catalog);let u=e.componentsModel.getChildIds(a);u.length>0&&o.set(a,u)}for(let a of t){let{id:c,component:u,...l}=a;if(typeof c!=\"string\")continue;let p=this.resolveComponentCatalog(a,e);i.set(c,p);let f=e.componentsModel.get(c),m=(typeof u==\"string\"?u:f?.type)??\"\";m&&r.set(c,m);let g={id:c,component:m,...l},h=Array.from($a(g,p)).map(([b])=>b);h.length>0?o.set(c,h):o.delete(c)}let s=new Map;for(let[a,c]of o.entries()){let u=r.get(a)||\"Unknown\";for(let l of c){let p=s.get(l)??[];p.push({parentId:a,parentType:u}),s.set(l,p)}}return{typeMap:r,compCatalogMap:i,childMap:o,parentMap:s}}validateCompositionConstraints(e,t){let{typeMap:r,compCatalogMap:i,childMap:o,parentMap:s}=this.buildCompositionTopology(e,t);for(let[a,c]of r.entries()){let l=i.get(a)?.components.get(c);l&&(l.allowedParents&&l.allowedParents.length>0&&this.validateParentConstraints(a,c,l.allowedParents,s.get(a)),l.allowedChildren&&l.allowedChildren.length>0&&this.validateChildConstraints(a,c,l.allowedChildren,o.get(a)||[],r))}}validateCandidateTopology(e,t){if(!this.validationConfig)return;let r=new Qi(e.defaultCatalog);for(let[i,o]of e.componentsModel.entries)r.addComponent(new cr(i,o.type,o.properties,o.catalog));for(let i of t){let{id:o,component:s,...a}=i;if(typeof o!=\"string\"||!o)continue;let c=this.resolveComponentCatalog(i,e);delete a.catalogId,delete a.metadata;let u=r.get(o),l=(typeof s==\"string\"?s:u?.type)||\"\";l&&(u?l!==u.type||u.catalog.id!==c.id?(r.removeComponent(o),r.addComponent(new cr(o,l,a,c))):u.properties=a:r.addComponent(new cr(o,l,a,c)))}r.validateTopology({...this.validationConfig,rootId:this.validationConfig.rootId??e.rootId})}};function Zx(n){if(n&&typeof n==\"object\"&&!Array.isArray(n))return n}function Wx(n,e,t){return e!==void 0?n.find(r=>r.id===e):n.find(r=>t?dn(r.protocolVersion,t):!0)??n[0]}var eo=class{constructor(e,t,r=\"/\",i,o){let s=e.componentsModel.get(t);if(!s)throw new Xn(`Component not found: ${t}`);this.componentModel=s,this.surfaceComponents=e.componentsModel,this.theme=e.theme,this.dataContext=new Mt(e,r,o,i),this._actionDispatcher=a=>e.dispatchAction(a,this.componentModel.id)}dispatchAction(e){return this._actionDispatcher(e)}};var yh=new WeakMap;function tl(n){let e=yh.get(n);if(e)return e;let t=Ma(n),r=t.type===\"OBJECT\"&&t.shape&&!(\"accessibility\"in t.shape)?{...t,shape:{...t.shape,accessibility:Ma(tr)}}:t;return yh.set(n,r),r}function is(n){let e=n;for(;e;){let t=e._def?.typeName;if(t===\"ZodOptional\"||t===\"ZodNullable\"||t===\"ZodDefault\"||t===\"ZodReadonly\")e=e._def.innerType;else if(t===\"ZodEffects\")e=e._def.schema;else if(t===\"ZodBranded\")e=e._def.type;else if(t===\"ZodLazy\")e=e._def.getter();else break}return e}function dr(n){let e=n,t=\"\";for(;e&&(t=e.description??e._def?.description??\"\",!t);){let i=e._def?.typeName;if(i===\"ZodOptional\"||i===\"ZodNullable\"||i===\"ZodDefault\"||i===\"ZodReadonly\")e=e._def.innerType;else if(i===\"ZodEffects\")e=e._def.schema;else if(i===\"ZodBranded\")e=e._def.type;else if(i===\"ZodLazy\")e=e._def.getter();else break}if(!t||!t.startsWith(\"REF:\"))return\"\";let r=t.slice(4);return Kr(r.split(\"|\")[0])}function Hx(n){let e=dr(n);if(e===\"Checkable\"||e===\"CheckRule\")return!0;let t=is(n);if(t?._def?.typeName===\"ZodArray\"){let r=t._def.type;if(dr(r)===\"CheckRule\")return!0}return!1}function Gx(n){if(dr(n)===\"Action\")return!0;let t=is(n)._def;return t?.typeName===\"ZodObject\"&&!!t.shape?.().event}function Kx(n){let e=dr(n);if(e===\"DataBinding\"||e===\"FunctionCall\"||e.startsWith(\"Dynamic\"))return!0;let r=is(n)._def;if(r?.typeName!==\"ZodObject\")return!1;let i=r.shape?.()||{},o=Object.values(i).some(s=>dr(s)===\"ComponentId\");return(!!i[\"@path\"]||!!i.path||!!i[\"@call\"]||!!i.call)&&!o}function Jx(n){if(er(n)===\"child-list\"||dr(n)===\"ChildList\")return!0;let t=is(n)._def;if(t?.typeName!==\"ZodObject\")return!1;let r=t.shape?.()||{};return Object.values(r).some(i=>dr(i)===\"ComponentId\")}function Yx(n,e){return(n===\"DataBinding\"||n===\"FunctionCall\"||n.startsWith(\"Dynamic\"))&&e!==\"ZodObject\"&&e!==\"ZodArray\"}function Xx(n){if(n.some(Gx))return{type:\"ACTION\"};if(n.some(Kx))return{type:\"DYNAMIC\"};if(n.some(Jx))return{type:\"STRUCTURAL\"}}function Qx(n){let e={};for(let[t,r]of Object.entries(n))e[t]=Ma(r);return e}function Ma(n){let e=dr(n);if(Hx(n))return{type:\"CHECKABLE\"};if(e===\"Action\")return{type:\"ACTION\"};let t=is(n);if(er(t)===\"child-list\"||e===\"ChildList\")return{type:\"STRUCTURAL\"};if(Yx(e,t._def?.typeName))return{type:\"DYNAMIC\"};if(t._def.typeName===\"ZodUnion\"){let r=Xx(t._def.options);if(r)return r}return t._def.typeName===\"ZodArray\"?{type:\"ARRAY\",element:Ma(t._def.type)}:t._def.typeName===\"ZodObject\"?{type:\"OBJECT\",shape:Qx(t._def.shape())}:{type:\"STATIC\"}}var bh=1e4;function nl(n){return Array.isArray(n)?n.length>bh?n.slice(0,bh):n:[]}var Mn=class{constructor(e,t){this.dataListeners=[],this.propsListeners=[],this.currentProps={},this.isConnected=!1,this.actionClosures=new Map,this.context=e,this.behaviorTree=tl(t),this.behaviorTree.type!==\"OBJECT\"&&(this.behaviorTree={type:\"OBJECT\",shape:{}}),this.resolveInitialProps()}resolveInitialProps(){let e=this.context.componentModel.properties,t=this.resolveAndBind(e,this.behaviorTree,[],!0);this.currentProps={...this.currentProps,...t||{}}}connect(){if(this.isConnected)return;this.isConnected=!0;let e=this.context.componentModel.onUpdated.subscribe(()=>{this.rebuildAllBindings()});this.compUnsub=()=>e.unsubscribe(),this.rebuildAllBindings()}rebuildAllBindings(){this.dataListeners.forEach(r=>r()),this.dataListeners=[];let e=this.context.componentModel.properties,t=this.resolveAndBind(e,this.behaviorTree,[],!1);this.currentProps={...this.currentProps,...t||{}},this.notify()}bindDynamicValue(e,t,r){let i=this.context.dataContext.subscribeDynamicValue(e,o=>{this.updateDeepValue(t,o),this.notify()});return r?i.unsubscribe():this.dataListeners.push(()=>i.unsubscribe()),i.value}resolveDeepSync(e,t=0){if(typeof e!=\"object\"||e===null)return e;if(t>Ji)return;if(\"path\"in e||\"call\"in e||\"@path\"in e||\"@call\"in e)return this.context.dataContext.resolveDynamicValue(e,t);if(Array.isArray(e))return e.map(i=>this.resolveDeepSync(i,t+1));let r={};for(let[i,o]of Object.entries(e))r[i]=this.resolveDeepSync(o,t+1);return r}resolveActionContext(e){if(typeof e!=\"object\"||e===null||Array.isArray(e))return;let t={};for(let[r,i]of Object.entries(e))t[r]=this.resolveDeepSync(i,1);return t}resolveEventAction(e){if(typeof e!=\"object\"||e===null)return e;let t=e;if(\"event\"in t&&typeof t.event==\"object\"&&t.event!==null){let r=t.event,i={...r,context:r.context?this.resolveActionContext(r.context):void 0};return r.userMessage!==void 0&&(i.userMessage=this.resolveDeepSync(r.userMessage,1)),{...t,event:i}}if(\"name\"in t){let r={...t,context:t.context?this.resolveActionContext(t.context):void 0};return t.userMessage!==void 0&&(r.userMessage=this.resolveDeepSync(t.userMessage,1)),r}return this.resolveDeepSync(e,0)}bindAction(e,t){let r=t.join(\"/\"),i=this.actionClosures.get(r);if(i&&el(i.raw,e))return i.closure;let o=async()=>{if(e&&typeof e==\"object\"){let s=e,a=!!(s.functionCall&&typeof s.functionCall==\"object\"),c=a?s.functionCall:s,u=c[\"@call\"]??c.call;if(typeof u==\"string\"){let l=a&&!(\"@call\"in c)?{\"@call\":u,...c}:c;await this.context.dataContext.resolveDynamicValue(l,0,!0);return}}return this.context.dispatchAction(this.resolveEventAction(e))};return this.actionClosures.set(r,{raw:e,closure:o}),o}mapTemplateChildren(e,t,r){let i=nl(e),o=this.context.dataContext.nested(r);return i.map((s,a)=>({id:t,basePath:o.nested(String(a)).path}))}bindStructuralTemplate(e,t,r){if(!e||typeof e!=\"object\"||Array.isArray(e))return e;let i=e,o=typeof i.path==\"string\"?i.path:void 0,s=typeof i.componentId==\"string\"?i.componentId:void 0;if(!o||!s)return e;let c=ge(this.context.dataContext.surface?.protocolVersion??this.context.dataContext.surface?.defaultCatalog?.protocolVersion,\"1.0\")?{\"@path\":o}:{path:o},u=this.context.dataContext.subscribeDynamicValue(c,l=>{let p=this.mapTemplateChildren(l,s,o);this.updateDeepValue(t,p),this.notify()});return r?u.unsubscribe():this.dataListeners.push(()=>u.unsubscribe()),this.mapTemplateChildren(u.value,s,o)}extractValidationResult(e,t){if(typeof e==\"object\"&&e!==null&&\"valid\"in e){let r=e,i=r.message,o=r.severity===\"warning\"||r.severity===\"info\"?r.severity:\"error\",s=typeof r.code==\"string\"?r.code:void 0;return{valid:!!r.valid,message:i!=null?String(i):t,...s!==void 0?{code:s}:{},severity:o}}return{valid:!!e,message:t,severity:\"error\"}}bindCheckable(e,t,r){let i=Array.isArray(e)?e:[],o=i.map(()=>({valid:!0,message:\"\",severity:\"error\"})),s=t.slice(0,-1),a=()=>{let u=o.filter(p=>!p.valid&&p.severity===\"error\").map(p=>p.message),l=o.filter(p=>!p.valid);this.updateDeepValue([...s,\"isValid\"],u.length===0),this.updateDeepValue([...s,\"validationErrors\"],u),this.updateDeepValue([...s,\"validationResults\"],l)},c=()=>{a(),this.notify()};return i.forEach((u,l)=>{let p=typeof u==\"object\"&&u!==null?u:void 0,f=p&&p.condition!==void 0?p.condition:u,m=typeof p?.message==\"string\"?p.message:\"Validation failed\";o[l].message=m;let g=this.context.dataContext.subscribeDynamicValue(f,h=>{o[l]=this.extractValidationResult(h,m),c()});r?g.unsubscribe():this.dataListeners.push(()=>g.unsubscribe()),o[l]=this.extractValidationResult(g.value,m)}),a(),e}bindObject(e,t,r,i){let o={};for(let[s,a]of Object.entries(e)){let c=t[s]||{type:\"STATIC\"};o[s]=this.resolveAndBind(a,c,[...r,s],i)}for(let[s,a]of Object.entries(t))if(a.type===\"DYNAMIC\"){let c=`set${s.charAt(0).toUpperCase()+s.slice(1)}`,u=e[s];o[c]=l=>{if(u&&typeof u==\"object\"){let p=u,f=this.context.dataContext.atLeastV10?\"@path\":\"path\",m=p[f];typeof m==\"string\"&&(this.context.dataContext.atLeastV10||!(\"componentId\"in p))&&this.context.dataContext.set(m,l)}}}return o}resolveAndBind(e,t,r,i){if(e==null)return e;switch(t.type){case\"DYNAMIC\":return this.bindDynamicValue(e,r,i);case\"ACTION\":return this.bindAction(e,r);case\"STRUCTURAL\":return this.bindStructuralTemplate(e,r,i);case\"CHECKABLE\":return this.bindCheckable(e,r,i);case\"STATIC\":return e;case\"ARRAY\":return Array.isArray(e)?e.map((o,s)=>this.resolveAndBind(o,t.element,[...r,s.toString()],i)):e;case\"OBJECT\":return typeof e!=\"object\"?e:this.bindObject(e,t.shape,r,i)}}updateDeepValue(e,t){this.currentProps=this.cloneAndUpdate(this.currentProps,e,t)}cloneAndUpdate(e,t,r){if(t.length===0)return r;let[i,...o]=t;if(Array.isArray(e)){let s=[...e];return s[Number(i)]=this.cloneAndUpdate(s[Number(i)],o,r),s}else{let s=typeof e==\"object\"&&e!==null?e:{};return{...s,[i]:this.cloneAndUpdate(s[i],o,r)}}}dispose(){this.isConnected&&(this.isConnected=!1,this.dataListeners.forEach(e=>e()),this.dataListeners=[],this.compUnsub&&(this.compUnsub(),this.compUnsub=void 0))}notify(){this.propsListeners.forEach(e=>e(this.currentProps))}subscribe(e){return this.propsListeners.length===0&&this.connect(),this.propsListeners.push(e),{unsubscribe:()=>{this.propsListeners=this.propsListeners.filter(t=>t!==e),this.propsListeners.length===0&&this.dispose()}}}get snapshot(){return this.currentProps}};function el(n,e){if(Object.is(n,e))return!0;if(typeof n!=\"object\"||typeof e!=\"object\"||n===null||e===null)return!1;if(Array.isArray(n)||Array.isArray(e))return!Array.isArray(n)||!Array.isArray(e)||n.length!==e.length?!1:n.every((i,o)=>el(i,e[o]));let t=Object.keys(n),r=Object.keys(e);return t.length!==r.length?!1:t.every(i=>Object.prototype.hasOwnProperty.call(e,i)&&el(n[i],e[i]))}var st=class{constructor(e){this.value=e}},os=class extends st{constructor(e,t,r){super(e),this.set=t,this.path=r}};function to(n){return n instanceof os}function _h(n,e){return to(n)!==to(e)||to(n)&&to(e)&&n.path!==e.path?!1:rl(n.value,e.value)}function rl(n,e){if(Object.is(n,e))return!0;if(Array.isArray(n)&&Array.isArray(e))return n.length===e.length&&n.every((t,r)=>rl(t,e[r]));if(vh(n)&&vh(e)){let t=Object.keys(n),r=Object.keys(e);return t.length===r.length&&t.every(i=>i in e&&rl(n[i],e[i]))}return!1}function vh(n){if(typeof n!=\"object\"||n===null)return!1;let e=Object.getPrototypeOf(n);return e===Object.prototype||e===null}var xh=Symbol.for(\"a2ui.nodeId\");function Ah(){let n=globalThis,e=(n[xh]??0)+1;return n[xh]=e,`a2ui-n${e}`}var Pa=\"Placeholder\";function xt(n){return n instanceof fr}var fr=class{constructor(e,t,r,i,o,s,a,c=\"resolved\"){this.id=Ah(),this._onDestroyed=new Ve,this.onDestroyed=this._onDestroyed,this.cleanups=[],this._disposed=!1,this.instanceId=e,this.componentId=t,this.type=r,this.dataPath=i,this.props=Ke(o),this.impl=s,this.context=a,this.state=c}get disposed(){return this._disposed}get isPlaceholder(){return this.state!==\"resolved\"}addCleanup(e){this.cleanups.push(e)}toJSON(){if(this.isPlaceholder)return{id:this.componentId,type:this.type,state:this.state};let e={id:this.componentId,type:this.type},t=Ye(this.props);for(let[r,i]of Object.entries(t))e[r]=ja(i);return e}setProps(e){if(this._disposed)return;let t=Ye(this.props);eA(t,e)||Je(this.props,e)}dispose(){if(!this._disposed){this._disposed=!0;for(let e of this.cleanups)try{e()}catch(t){console.error(`ComponentNode cleanup error (${this.instanceId}):`,t)}this.cleanups=[],this._onDestroyed.emit(),this._onDestroyed.dispose()}}};function ja(n){if(xt(n))return n.toJSON();if(n instanceof st)return ja(n.value);if(typeof n==\"function\")return\"<Action>\";if(Array.isArray(n))return n.map(ja);if(n&&typeof n==\"object\"){let e={};for(let[t,r]of Object.entries(n))e[t]=ja(r);return e}return n}function eA(n,e){if(Object.is(n,e))return!0;let t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;for(let i of t)if(!Object.is(n[i],e[i]))return!1;return!0}var tA=\"REF:common_types.json#/$defs/ComponentId\",nA=\"REF:common_types.json#/$defs/ChildList\",Ch=new Map,il=new WeakMap;function Dh(n){let e=il.get(n);if(e)return e;let t=La(n);if(t.schema._def.typeName!==\"ZodObject\")return il.set(n,Ch),Ch;let r=new Map,i=t.schema.shape;for(let[s,a]of Object.entries(i)){let c=La(a);if(rA(c)||iA(c.schema)){r.set(s,{kind:\"list\"});continue}if(ol(c)){r.set(s,{kind:\"single\"});continue}if(c.schema._def.typeName===\"ZodArray\"){let u=La(c.schema._def.type);if(ol(u)){r.set(s,{kind:\"list\"});continue}if(u.schema._def.typeName===\"ZodObject\"){let l=new Set,p=u.schema.shape;for(let[f,m]of Object.entries(p))ol(La(m))&&l.add(f);l.size>0&&r.set(s,{kind:\"nested\",keys:l})}}}let o=r;return il.set(n,o),o}function La(n){let e=[],t=new Set,r=n;for(;;){r.description&&e.push(r.description);let i=er(r);i&&t.add(i);let o=r._def.typeName;if(o===\"ZodOptional\"||o===\"ZodNullable\"||o===\"ZodDefault\")r=r._def.innerType;else if(o===\"ZodEffects\")r=r._def.schema;else return{schema:r,descriptions:e,refs:t}}}function ol(n){return n.refs.has(\"component-id\")||wh(n.descriptions,tA)}function rA(n){return n.refs.has(\"child-list\")||wh(n.descriptions,nA)}function wh(n,e){return n.some(t=>t.startsWith(e))}function iA(n){return n._def.typeName!==\"ZodUnion\"?!1:n._def.options.some(t=>{if(t._def.typeName!==\"ZodObject\")return!1;let r=t.shape;return r.componentId&&r.path})}var oA=\"root\",al=\"/\",sl=new Map,Va=class{constructor(e,t=e.defaultCatalog){if(this.records=new Map,this.nodesByEdge=new Map,this.nodesByComponentId=new Map,this.pendingParents=new Map,this.dispatchedErrors=new Map,this.modelSubs=[],this._disposed=!1,t!==e.defaultCatalog)throw new Xn(\"NodeResolver requires the same catalog instance its surface was constructed with.\");this.surface=e,this.rootId=e.rootId??oA,this.rootNode=Ke(void 0),this.modelSubs.push(e.componentsModel.onCreated.subscribe(r=>this.onComponentCreated(r))),this.modelSubs.push(e.componentsModel.onDeleted.subscribe(r=>this.onComponentDeleted(r))),e.componentsModel.get(this.rootId)&&this.buildRoot()}dispatchOnce(e,t,r,i){let o=this.dispatchedErrors.get(t);o||(o=new Map,this.dispatchedErrors.set(t,o));let s=o.get(r);s||(s=new Set,o.set(r,s)),!s.has(e)&&(s.add(e),this.surface.dispatchError({code:e,message:i}))}clearDispatched(e,t){let r=this.dispatchedErrors.get(e);r?.delete(t)&&r.size===0&&this.dispatchedErrors.delete(e)}get activeNodeCount(){return this.records.size}get disposed(){return this._disposed}dispose(){if(!this._disposed){this._disposed=!0;for(let e of this.modelSubs)e.unsubscribe();this.modelSubs.length=0;for(let e of[...this.records.keys()])this.disposeNode(e);this.pendingParents.clear(),this.dispatchedErrors.clear(),this.rootRecord=void 0,Je(this.rootNode,void 0)}}buildRoot(){if(this.rootRecord)return;let e=`>${At(this.rootId)}>${At(this.rootId)}@/`,t=this.createNode(this.rootId,al,e,void 0);this.rootRecord=this.records.get(t),Je(this.rootNode,t)}onComponentCreated(e){if(this._disposed)return;if(e.id===this.rootId){let r=this.surface.componentsModel.get(this.rootId);this.rootRecord&&this.rootRecord.componentModel!==r&&(this.disposeNode(this.rootRecord.node),this.rootRecord=void 0,r||Je(this.rootNode,void 0)),r&&this.buildRoot()}let t=this.pendingParents.get(e.id);if(t){this.pendingParents.delete(e.id);for(let r of t){let i=this.records.get(r);i&&!r.disposed&&this.materialize(i)}}}onComponentDeleted(e){if(this._disposed)return;this.dispatchedErrors.delete(e);let t=this.surface.componentsModel.get(e),r=this.nodesByComponentId.get(e);if(!r)return;let i=new Set,o=!1;for(let s of[...r]){let a=this.records.get(s);a&&(a.parent?i.add(a.parent):o=!0)}o&&this.rootRecord&&(t?this.rootRecord.componentModel!==t&&(this.disposeNode(this.rootRecord.node),this.rootRecord=void 0,this.buildRoot()):(this.disposeNode(this.rootRecord.node),this.rootRecord=void 0,Je(this.rootNode,void 0)));for(let s of i){let a=this.records.get(s);a&&!s.disposed&&this.materialize(a)}}createNode(e,t,r,i,o=1){let s=this.surface.componentsModel.get(e);if(!s){let f=this.registerNode(new fr(Ba(e,t,o),e,Pa,t,{},void 0,void 0,\"pending\"),{edgeKey:r,parent:i,occurrence:o,refFields:sl});return i&&this.registerPendingParent(e,i),f.node}let a=this.catalogFor(s),c=a.components.get(s.type);if(!c)return this.dispatchOnce(\"UNKNOWN_COMPONENT_TYPE\",e,t,`Component '${e}' has type '${s.type}', which is not in catalog '${a.id}'.`),this.registerNode(new fr(Ba(e,t,o),e,s.type,t,{},void 0,void 0,\"unknown-type\"),{edgeKey:r,parent:i,occurrence:o,refFields:sl,componentModel:s}).node;this.clearDispatched(e,t);let u=new eo(this.surface,e,t,i?.context?.dataContext),l=new Mn(u,c.schema),p=this.registerNode(new fr(Ba(e,t,o),e,s.type,t,{},c,u),{edgeKey:r,parent:i,occurrence:o,refFields:Dh(c.schema),behavior:tl(c.schema),componentModel:s,binder:l});return p.binderSub=l.subscribe(f=>{p.lastBinderProps=f,this.materialize(p)}),p.lastBinderProps=l.snapshot,this.materialize(p),p.node}catalogFor(e){return e.catalog}registerNode(e,t){let r={node:e,edgeKey:t.edgeKey,parent:t.parent,occurrence:t.occurrence,refFields:t.refFields,behavior:t.behavior,componentModel:t.componentModel,binder:t.binder,childEdges:new Map};this.records.set(e,r),this.nodesByEdge.set(t.edgeKey,e);let i=this.nodesByComponentId.get(e.componentId);return i||(i=new Set,this.nodesByComponentId.set(e.componentId,i)),i.add(e),r}childNode(e,t,r,i,o=1){let s=this.nodesByEdge.get(r);if(this.isCyclic(e,t,i))return s&&!s.disposed&&s.isPlaceholder&&this.records.get(s)?.occurrence===o?s:(s&&!s.disposed&&this.disposeNode(s),this.dispatchOnce(\"CYCLIC_REFERENCE\",e,t,`Component '${e}' at '${t}' is referenced by one of its own descendants; rendering a placeholder instead.`),this.registerNode(new fr(Ba(e,t,o),e,Pa,t,{},void 0,void 0,\"cyclic\"),{edgeKey:r,parent:i,occurrence:o,refFields:sl}).node);if(s&&!s.disposed){let a=this.surface.componentsModel.get(e),c=a?this.catalogFor(a).components.get(a.type):void 0,u=this.records.get(s);if(s.componentId===e&&s.dataPath===t&&u?.occurrence===o&&(s.isPlaceholder?a===void 0&&s.state===\"pending\"||a!==void 0&&c===void 0&&s.state===\"unknown-type\"&&u?.componentModel===a:a!==void 0&&s.type===a.type&&u?.componentModel===a))return s.state===\"pending\"&&this.registerPendingParent(e,i),s;this.disposeNode(s)}return this.createNode(e,t,r,i,o)}registerPendingParent(e,t){let r=this.pendingParents.get(e);r||(r=new Set,this.pendingParents.set(e,r)),r.add(t)}isCyclic(e,t,r){for(let i=r;i;i=this.records.get(i)?.parent)if(i.componentId===e&&i.dataPath===t)return!0;return!1}materialize(e){if(e.node.disposed)return;let r={...e.lastBinderProps??e.binder?.snapshot??{}},i=new Map,o=e.componentModel?.properties;if(o)for(let l of e.refFields.keys())l in r&&!(l in o)&&delete r[l];let s=new Map,a=(l,p,f)=>{let m=`${At(p)}@${At(f)}`,g=(s.get(m)??0)+1;s.set(m,g);let h=`${e.edgeKey}>${l}>${m}`,b=this.childNode(p,f,h,e.node,g);return i.set(h,b),b};for(let[l,p]of e.refFields)switch(p.kind){case\"single\":{let f=r[l];typeof f==\"string\"&&f&&(r[l]=a(At(l),f,e.node.dataPath));break}case\"list\":{let f=r[l];if(!Array.isArray(f))break;let m=nl(f);r[l]=m.map((g,h)=>{if(typeof g==\"string\"&&g)return a(`${At(l)}[${h}]`,g,e.node.dataPath);if(g&&typeof g==\"object\"&&!Array.isArray(g)){let b=g;if(typeof b.id==\"string\"&&typeof b.basePath==\"string\")return a(`${At(l)}[${h}]`,b.id,b.basePath);if(typeof b.componentId==\"string\"&&b.componentId)return a(`${At(l)}[${h}]`,b.componentId,e.node.dataPath)}return g});break}case\"nested\":{let f=r[l];if(!Array.isArray(f))break;r[l]=f.map((m,g)=>{if(!m||typeof m!=\"object\"||Array.isArray(m))return m;let h={...m},b=!1;for(let v of p.keys){let x=h[v];typeof x==\"string\"&&x&&(h[v]=a(`${At(l)}[${g}].${At(v)}`,x,e.node.dataPath),b=!0)}return b?h:m});break}}for(let[l,p]of e.childEdges)if(!i.has(l)&&(this.disposeNode(p),p.isPlaceholder&&![...i.values()].some(m=>m.isPlaceholder&&m.componentId===p.componentId))){let m=this.pendingParents.get(p.componentId);m&&(m.delete(e.node),m.size===0&&this.pendingParents.delete(p.componentId))}e.childEdges=i;let c=e.behavior&&e.node.context?cl(r,e.behavior,o??{},e.node.context.dataContext):r,u=Ye(e.node.props);for(let l of Object.keys(c))c[l]=ul(u[l],c[l]);e.node.setProps(c)}disposeNode(e){if(e.disposed)return;let t=this.records.get(e);if(t){for(let i of t.childEdges.values())this.disposeNode(i);t.childEdges.clear(),t.binderSub?.unsubscribe(),t.binderSub=void 0,this.nodesByEdge.get(t.edgeKey)===e&&this.nodesByEdge.delete(t.edgeKey),this.records.delete(e)}let r=this.nodesByComponentId.get(e.componentId);r&&(r.delete(e),r.size===0&&this.nodesByComponentId.delete(e.componentId));for(let[i,o]of this.pendingParents)o.delete(e),o.size===0&&this.pendingParents.delete(i);e.state===\"cyclic\"&&this.clearDispatched(e.componentId,e.dataPath),e.dispose()}},sA={\"~\":\"~0\",\"#\":\"~1\",\"[\":\"~2\",\"]\":\"~3\",\">\":\"~4\",\"@\":\"~5\"};function At(n){return n.replace(/[~#[\\]>@]/g,e=>sA[e])}function Ba(n,e,t){let r=e.replace(/\\/+$/,\"\")||al,i=e===al?At(n):`${At(n)}-[${At(r)}]`;return t>1?`${i}#${t}`:i}function cl(n,e,t,r){switch(e.type){case\"DYNAMIC\":{let i=r.atLeastV10?\"@path\":\"path\",o=t&&typeof t==\"object\"&&!Array.isArray(t)?t:void 0,s=o&&typeof o[i]==\"string\"&&!(\"componentId\"in o)?o[i]:void 0;return s===void 0?new st(n):new os(n,a=>r.set(s,a),s)}case\"ARRAY\":{if(!Array.isArray(n))return n;let i=Array.isArray(t)?t:[];return n.map((o,s)=>cl(o,e.element,i[s],r))}case\"OBJECT\":{if(!n||typeof n!=\"object\"||Array.isArray(n))return n;let i=new Set;for(let[a,c]of Object.entries(e.shape))c.type===\"DYNAMIC\"&&i.add(`set${a.charAt(0).toUpperCase()}${a.slice(1)}`);let o=t&&typeof t==\"object\"&&!Array.isArray(t)?t:{},s={};for(let[a,c]of Object.entries(n))i.has(a)||(s[a]=cl(c,e.shape[a]??{type:\"STATIC\"},o[a],r));for(let[a,c]of Object.entries(e.shape))c.type===\"DYNAMIC\"&&!(a in s)&&(s[a]=new st(void 0));return s}default:return n}}function ul(n,e){if(Object.is(n,e))return e;if(n instanceof st&&e instanceof st)return _h(n,e)?n:e;if(xt(n)||xt(e))return e;if(Array.isArray(n)&&Array.isArray(e)&&n.length===e.length){let t=!0,r=e.map((i,o)=>{let s=ul(n[o],i);return Object.is(s,n[o])||(t=!1),s});return t?n:r}if(Eh(n)&&Eh(e)){let t=Object.keys(n),r=Object.keys(e);if(t.length===r.length){let i=!0,o={};for(let s of r){let a=ul(n[s],e[s]);o[s]=a,(!(s in n)||!Object.is(a,n[s]))&&(i=!1)}return i?n:o}}return e}function Eh(n){if(!n||typeof n!=\"object\"||Array.isArray(n)||xt(n))return!1;let e=Object.getPrototypeOf(n);return e===Object.prototype||e===null}var pn=Sn(d.string().describe(\"REF:#/$defs/ComponentId|The unique identifier for a component, used for both definitions and references within the same surface.\"),\"component-id\"),pr=d.object({path:d.string().describe(\"A JSON Pointer path to a value in the data model.\")}).strict().describe(\"REF:#/$defs/DataBinding\"),ss=d.union([d.string(),d.number(),d.boolean(),d.array(d.any()),pr,d.lazy(()=>ni)]).describe(\"REF:#/$defs/DynamicValue|A value that can be a literal, a path, or a function call returning any type.\"),ni=d.object({call:d.string().describe(\"The name of the function to call.\"),args:d.record(d.string(),d.union([ss,d.record(d.string(),d.any()).describe(\"A literal object argument (e.g. configuration).\")])).describe(\"Arguments passed to the function.\").optional(),returnType:d.enum([\"string\",\"number\",\"boolean\",\"array\",\"object\",\"any\",\"void\"]).describe(\"The expected return type of the function call.\").default(\"boolean\")}).describe(\"REF:#/$defs/FunctionCall|Invokes a named function on the client.\"),fe=d.union([d.string(),pr,ni]).describe(\"REF:#/$defs/DynamicString|Represents a string\"),Se=d.object({label:fe.optional(),description:fe.optional()}).describe(\"REF:#/$defs/AccessibilityAttributes|Attributes to enhance accessibility when using assistive technologies like screen readers.\"),aA=d.object({id:pn,accessibility:Se.optional()}).describe(\"REF:#/$defs/ComponentCommon\"),as=Sn(d.union([d.array(pn).describe(\"A static list of child component IDs.\"),d.object({componentId:pn,path:d.string().describe(\"The path to the list of component property objects in the data model.\")}).strict().describe(\"A template for generating a dynamic list of children from a data model list. The `componentId` is the component to use as a template.\")]).describe(\"REF:#/$defs/ChildList\"),\"child-list\"),hn=d.union([d.number(),pr,ni]).describe(\"REF:#/$defs/DynamicNumber|Represents a value that can be either a literal number, a path to a number in the data model, or a function call returning a number.\"),mn=d.union([d.boolean(),pr,ni]).describe(\"REF:#/$defs/DynamicBoolean|A boolean value that can be a literal, a path, or a function call returning a boolean.\"),ll=d.union([d.array(d.string()),pr,ni]).describe(\"REF:#/$defs/DynamicStringList|Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array.\"),jn=d.object({condition:mn,message:d.string().describe(\"The error message to display if the check fails.\")}).strict().describe(\"REF:#/$defs/CheckRule|A single validation rule applied to an input component.\"),cA=d.object({checks:d.array(jn).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional()}).describe(\"REF:#/$defs/Checkable|Properties for components that support client-side checks.\"),dl=d.union([d.object({event:d.object({name:d.string().describe(\"The name of the action to be dispatched to the server.\"),context:d.record(d.string(),ss).describe(\"A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.\").optional()}).strict().describe(\"The event to dispatch to the server.\")}).strict().describe(\"Triggers a server-side event.\"),d.object({functionCall:ni}).strict().describe(\"Executes a local client-side function.\")]).describe(\"REF:#/$defs/Action|Defines an interaction handler that can either trigger a server-side event or execute a local client-side function.\"),pt={ComponentId:pn,DataBinding:pr,DynamicValue:ss,FunctionCall:ni,DynamicString:fe,AccessibilityAttributes:Se,ComponentCommon:aA,ChildList:as,DynamicNumber:hn,DynamicBoolean:mn,DynamicStringList:ll,CheckRule:jn,Checkable:cA,Action:dl};function $e(n,e){return{...e,tagName:n.tagName,element:n}}var Ua=globalThis,za=Ua.ShadowRoot&&(Ua.ShadyCSS===void 0||Ua.ShadyCSS.nativeShadow)&&\"adoptedStyleSheets\"in Document.prototype&&\"replace\"in CSSStyleSheet.prototype,fl=Symbol(),Sh=new WeakMap,cs=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==fl)throw Error(\"CSSResult is not constructable. Use `unsafeCSS` or `css` instead.\");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(za&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Sh.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Sh.set(t,e))}return e}toString(){return this.cssText}},Th=n=>new cs(typeof n==\"string\"?n:n+\"\",void 0,fl),re=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s==\"number\")return s;throw Error(\"Value passed to 'css' function must be a 'css' function result: \"+s+\". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.\")})(i)+n[o+1],n[0]);return new cs(t,n,fl)},kh=(n,e)=>{if(za)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement(\"style\"),i=Ua.litNonce;i!==void 0&&r.setAttribute(\"nonce\",i),r.textContent=t.cssText,n.appendChild(r)}},pl=za?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t=\"\";for(let r of e.cssRules)t+=r.cssText;return Th(t)})(n):n;var{is:uA,defineProperty:lA,getOwnPropertyDescriptor:dA,getOwnPropertyNames:fA,getOwnPropertySymbols:pA,getPrototypeOf:hA}=Object,qa=globalThis,$h=qa.trustedTypes,mA=$h?$h.emptyScript:\"\",gA=qa.reactiveElementPolyfillSupport,us=(n,e)=>n,ls={toAttribute(n,e){switch(e){case Boolean:n=n?mA:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},Za=(n,e)=>!uA(n,e),Ih={attribute:!0,type:String,converter:ls,reflect:!1,useDefault:!1,hasChanged:Za};Symbol.metadata??=Symbol(\"metadata\"),qa.litPropertyMetadata??=new WeakMap;var Pn=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ih){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&lA(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=dA(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ih}static _$Ei(){if(this.hasOwnProperty(us(\"elementProperties\")))return;let e=hA(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(us(\"finalized\")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(us(\"properties\"))){let t=this.properties,r=[...fA(t),...pA(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(pl(i))}else e!==void 0&&t.push(pl(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r==\"string\"?r:typeof e==\"string\"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return kh(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:ls).toAttribute(t,r.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){let r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),s=typeof o.converter==\"function\"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ls;this._$Em=i;let a=s.fromAttribute(t,o.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,r,i=!1,o){if(e!==void 0){let s=this.constructor;if(i===!1&&(o=this[e]),r??=s.getPropertyOptions(e),!((r.hasChanged??Za)(o,t)||r.useDefault&&r.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:o},s){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),o!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r){let{wrapped:s}=o,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,o,a)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};Pn.elementStyles=[],Pn.shadowRootOptions={mode:\"open\"},Pn[us(\"elementProperties\")]=new Map,Pn[us(\"finalized\")]=new Map,gA?.({ReactiveElement:Pn}),(qa.reactiveElementVersions??=[]).push(\"2.1.2\");var ml=globalThis,Fh=n=>n,Wa=ml.trustedTypes,Rh=Wa?Wa.createPolicy(\"lit-html\",{createHTML:n=>n}):void 0,gl=\"$lit$\",Ln=`lit$${Math.random().toFixed(9).slice(2)}$`,yl=\"?\"+Ln,yA=`<${yl}>`,oi=document,fs=()=>oi.createComment(\"\"),ps=n=>n===null||typeof n!=\"object\"&&typeof n!=\"function\",bl=Array.isArray,Lh=n=>bl(n)||typeof n?.[Symbol.iterator]==\"function\",hl=`[ \t\n\\f\\r]`,ds=/<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g,Oh=/-->/g,Nh=/>/g,ri=RegExp(`>|${hl}(?:([^\\\\s\"'>=/]+)(${hl}*=${hl}*(?:[^ \t\n\\f\\r\"'\\`<>=]|(\"|')|))|$)`,\"g\"),Mh=/'/g,jh=/\"/g,Bh=/^(?:script|style|textarea|title)$/i,vl=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),F=vl(1),AF=vl(2),CF=vl(3),Ue=Symbol.for(\"lit-noChange\"),k=Symbol.for(\"lit-nothing\"),Ph=new WeakMap,ii=oi.createTreeWalker(oi,129);function Vh(n,e){if(!bl(n)||!n.hasOwnProperty(\"raw\"))throw Error(\"invalid template strings array\");return Rh!==void 0?Rh.createHTML(e):e}var Uh=(n,e)=>{let t=n.length-1,r=[],i,o=e===2?\"<svg>\":e===3?\"<math>\":\"\",s=ds;for(let a=0;a<t;a++){let c=n[a],u,l,p=-1,f=0;for(;f<c.length&&(s.lastIndex=f,l=s.exec(c),l!==null);)f=s.lastIndex,s===ds?l[1]===\"!--\"?s=Oh:l[1]!==void 0?s=Nh:l[2]!==void 0?(Bh.test(l[2])&&(i=RegExp(\"</\"+l[2],\"g\")),s=ri):l[3]!==void 0&&(s=ri):s===ri?l[0]===\">\"?(s=i??ds,p=-1):l[1]===void 0?p=-2:(p=s.lastIndex-l[2].length,u=l[1],s=l[3]===void 0?ri:l[3]==='\"'?jh:Mh):s===jh||s===Mh?s=ri:s===Oh||s===Nh?s=ds:(s=ri,i=void 0);let m=s===ri&&n[a+1].startsWith(\"/>\")?\" \":\"\";o+=s===ds?c+yA:p>=0?(r.push(u),c.slice(0,p)+gl+c.slice(p)+Ln+m):c+Ln+(p===-2?a:m)}return[Vh(n,o+(n[t]||\"<?>\")+(e===2?\"</svg>\":e===3?\"</math>\":\"\")),r]},hs=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,c=this.parts,[u,l]=Uh(e,t);if(this.el=n.createElement(u,r),ii.currentNode=this.el.content,t===2||t===3){let p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=ii.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let p of i.getAttributeNames())if(p.endsWith(gl)){let f=l[s++],m=i.getAttribute(p).split(Ln),g=/([.?@])?(.*)/.exec(f);c.push({type:1,index:o,name:g[2],strings:m,ctor:g[1]===\".\"?Ga:g[1]===\"?\"?Ka:g[1]===\"@\"?Ja:ai}),i.removeAttribute(p)}else p.startsWith(Ln)&&(c.push({type:6,index:o}),i.removeAttribute(p));if(Bh.test(i.tagName)){let p=i.textContent.split(Ln),f=p.length-1;if(f>0){i.textContent=Wa?Wa.emptyScript:\"\";for(let m=0;m<f;m++)i.append(p[m],fs()),ii.nextNode(),c.push({type:2,index:++o});i.append(p[f],fs())}}}else if(i.nodeType===8)if(i.data===yl)c.push({type:2,index:o});else{let p=-1;for(;(p=i.data.indexOf(Ln,p+1))!==-1;)c.push({type:7,index:o}),p+=Ln.length-1}o++}}static createElement(e,t){let r=oi.createElement(\"template\");return r.innerHTML=e,r}};function si(n,e,t=n,r){if(e===Ue)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,o=ps(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=si(n,i._$AS(n,e.values),i,r)),e}var Ha=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??oi).importNode(t,!0);ii.currentNode=i;let o=ii.nextNode(),s=0,a=0,c=r[0];for(;c!==void 0;){if(s===c.index){let u;c.type===2?u=new no(o,o.nextSibling,this,e):c.type===1?u=new c.ctor(o,c.name,c.strings,this,e):c.type===6&&(u=new Ya(o,this,e)),this._$AV.push(u),c=r[++a]}s!==c?.index&&(o=ii.nextNode(),s++)}return ii.currentNode=oi,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},no=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=si(this,e,t),ps(e)?e===k||e==null||e===\"\"?(this._$AH!==k&&this._$AR(),this._$AH=k):e!==this._$AH&&e!==Ue&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Lh(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==k&&ps(this._$AH)?this._$AA.nextSibling.data=e:this.T(oi.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r==\"number\"?this._$AC(e):(r.el===void 0&&(r.el=hs.createElement(Vh(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new Ha(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=Ph.get(e.strings);return t===void 0&&Ph.set(e.strings,t=new hs(e)),t}k(e){bl(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let o of e)i===t.length?t.push(r=new n(this.O(fs()),this.O(fs()),this,this.options)):r=t[i],r._$AI(o),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=Fh(e).nextSibling;Fh(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ai=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,o){this.type=1,this._$AH=k,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,r.length>2||r[0]!==\"\"||r[1]!==\"\"?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=k}_$AI(e,t=this,r,i){let o=this.strings,s=!1;if(o===void 0)e=si(this,e,t,0),s=!ps(e)||e!==this._$AH&&e!==Ue,s&&(this._$AH=e);else{let a=e,c,u;for(e=o[0],c=0;c<o.length-1;c++)u=si(this,a[r+c],t,c),u===Ue&&(u=this._$AH[c]),s||=!ps(u)||u!==this._$AH[c],u===k?e=k:e!==k&&(e+=(u??\"\")+o[c+1]),this._$AH[c]=u}s&&!i&&this.j(e)}j(e){e===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??\"\")}},Ga=class extends ai{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===k?void 0:e}},Ka=class extends ai{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==k)}},Ja=class extends ai{constructor(e,t,r,i,o){super(e,t,r,i,o),this.type=5}_$AI(e,t=this){if((e=si(this,e,t,0)??k)===Ue)return;let r=this._$AH,i=e===k&&r!==k||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,o=e!==k&&(r===k||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==\"function\"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ya=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){si(this,e)}},zh={M:gl,P:Ln,A:yl,C:1,L:Uh,R:Ha,D:Lh,V:si,I:no,H:ai,N:Ka,U:Ja,B:Ga,F:Ya},bA=ml.litHtmlPolyfillSupport;bA?.(hs,no),(ml.litHtmlVersions??=[]).push(\"3.3.3\");var qh=(n,e,t)=>{let r=t?.renderBefore??e,i=r._$litPart$;if(i===void 0){let o=t?.renderBefore??null;r._$litPart$=i=new no(e.insertBefore(fs(),o),o,void 0,t??{})}return i._$AI(n),i};var _l=globalThis,hr=class extends Pn{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=qh(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ue}};hr._$litElement$=!0,hr.finalized=!0,_l.litElementHydrateSupport?.({LitElement:hr});var vA=_l.litElementPolyfillSupport;vA?.({LitElement:hr});(_l.litElementVersions??=[]).push(\"4.2.2\");var _A={attribute:!0,type:String,converter:ls,reflect:!1,hasChanged:Za},xA=(n=_A,e,t)=>{let{kind:r,metadata:i}=t,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),r===\"setter\"&&((n=Object.create(n)).wrapped=!0),o.set(t.name,n),r===\"accessor\"){let{name:s}=t;return{set(a){let c=e.get.call(this);e.set.call(this,a),this.requestUpdate(s,c,n,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,n,a),a}}}if(r===\"setter\"){let{name:s}=t;return function(a){let c=this[s];e.call(this,a),this.requestUpdate(s,c,n,!0,a)}}throw Error(\"Unsupported decorator location: \"+r)};function ms(n){return(e,t)=>typeof t==\"object\"?xA(n,e,t):((r,i,o)=>{let s=i.hasOwnProperty(o);return i.constructor.createProperty(o,r),s?Object.getOwnPropertyDescriptor(i,o):void 0})(n,e,t)}function ro(n){return ms({...n,state:!0,attribute:!1})}var gn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ct=n=>(...e)=>({_$litDirective$:n,values:e}),ht=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};function mr(n){return typeof n==\"object\"&&n!==null&&\"tagName\"in n&&typeof n.tagName==\"string\"&&\"element\"in n&&typeof n.element==\"function\"}var Zh=!1;function io(n){if(typeof customElements>\"u\"){Zh||(Zh=!0,console.error(`Cannot register \"${n.tagName}\": \\`customElements\\` is not available in this environment, so universal components will not render.`));return}let e=customElements.get(n.tagName);if(!e){customElements.define(n.tagName,n.element);return}if(e!==n.element)throw new Error(`Custom element tag name collision for \"${n.tagName}\": attempted to register ${n.element.name||\"anonymous constructor\"}, but tag name is already registered with ${e.name||\"another constructor\"}.`)}var xl=class extends ht{render(e,t,r){return(!this.element||this.tagName!==e)&&(this.tagName=e,this.element=document.createElement(e)),this.element.node=r,this.element.context=t,this.element}},Wh=Ct(xl);function Al(n,e){if(xt(n))return AA(n);let t=n.componentModel.type,r=e?.components.get(t);return!r||!r.tagName?(console.warn(`Component implementation not found or missing tagName for type: ${t}`),k):(mr(r)&&typeof customElements<\"u\"&&!customElements.get(r.tagName)&&io(r),Wh(r.tagName,n))}function AA(n){if(n.isPlaceholder||n.disposed||!n.context)return k;let e=n.impl;return e?.tagName?(mr(e)&&io(e),Wh(e.tagName,n.context,n)):(console.warn(`Component implementation not found or missing tagName for type: ${n.type}`),k)}var Qa=class{get props(){return this._props}constructor(e,t){this.host=e,this.binder=new Mn(this.host.context,t.schema),this._props=this.binder.snapshot,this.host.addController(this),this.host.isConnected&&this.hostConnected()}hostConnected(){this.subscription||(this.subscription=this.binder.subscribe(e=>{this._props=e,this.host.requestUpdate()})),this.componentsSubscription||(this.componentsSubscription=this.host.context.dataContext.surface?.componentsModel?.onCreated.subscribe(()=>{this.host.requestUpdate()}))}hostDisconnected(){this.subscription?.unsubscribe(),this.subscription=void 0,this.componentsSubscription?.unsubscribe(),this.componentsSubscription=void 0}dispose(){this.hostDisconnected(),this.binder.dispose()}};var Hh=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect==\"object\"&&typeof Reflect.decorate==\"function\")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ci=class extends hr{get controller(){return this._controller}adoptLightDomStyles(){if(typeof document>\"u\")return;let e=this.getRootNode(),t=this.constructor,r=t.styles;if(!r)return;let i=this.tagName.toLowerCase();if(!t._processedSheet&&t._processedCss===void 0){let c=(Array.isArray(r)?r:[r]).map(l=>l&&typeof l==\"object\"&&\"cssText\"in l?String(l.cssText):String(l)).join(`\n`).replace(/:where\\(:host\\)/g,`:where(${i})`).replace(/:host\\(([^)]+)\\)/g,`${i}$1`).replace(/:host/g,i),u=c;try{let l=new CSSStyleSheet;l.replaceSync(c);let p=m=>{if(typeof CSSStyleRule<\"u\"&&m instanceof CSSStyleRule)return`${m.selectorText.split(\",\").map(h=>(h=h.trim(),h===i||h.startsWith(i+\" \")||h.startsWith(i+\".\")||h.startsWith(i+\":\")||h.startsWith(i+\"[\")||h.startsWith(`:where(${i}`)||h.startsWith(`:is(${i}`)?h:`${i} ${h}`)).join(\", \")} { ${m.style.cssText} }`;if(typeof CSSMediaRule<\"u\"&&m instanceof CSSMediaRule){let g=Array.from(m.cssRules).map(p).join(`\n`);return`@media ${m.conditionText} {\n${g}\n}`}return m.cssText};u=Array.from(l.cssRules).map(p).join(`\n`);let f=new CSSStyleSheet;f.replaceSync(u),t._processedSheet=f}catch{}t._processedCss=u,t._processedStyle=re([u]),t._adoptedRoots=new WeakSet}let o=typeof ShadowRoot<\"u\"&&e instanceof ShadowRoot?e:typeof document<\"u\"?document:void 0;o&&(t._adoptedRoots||(t._adoptedRoots=new WeakSet),t._adoptedRoots.has(o)||(t._adoptedRoots.add(o),t._processedSheet&&o.adoptedStyleSheets&&(o.adoptedStyleSheets=[...o.adoptedStyleSheets,t._processedSheet])))}connectedCallback(){super.connectedCallback(),this.adoptLightDomStyles()}createController(){let e=this.api??this.findCatalogApi();if(!e)throw new Error(`[A2uiLitElement] Either define 'protected readonly api = ...' on ${this.constructor.name} or override 'createController()'.`);return new Qa(this,e)}findCatalogApi(){if(this.node?.impl)return this.node.impl;let e=this.context?.componentModel;return e?e.catalog.components.get(e.type):void 0}renderNode(e,t){if(!e||!this.context?.dataContext)return k;let{surface:r,path:i}=this.context.dataContext;if(!r)return k;if(!!!r.componentsModel?.get(this.context.componentModel.id))return k;let s,a=t;if(typeof e==\"object\"?(s=e.id||e.componentId,a=a??e.basePath??e.path):s=e,!s||!r.componentsModel?.get(s))return k;if(a=a??i,this.node){let l=DA(this.node,s,a);if(l)return Al(l)}let c=new eo(r,s,a),u=c.componentModel.catalog;return Al(c,u)}willUpdate(e){super.willUpdate(e);let t=e.has(\"context\");if(e.has(\"node\")&&this.node?.context&&this.node.context!==this.context&&(this.context=this.node.context,t=!0),t&&this.context){if(this._controller&&CA(this._controllerContext,this.context)){this._controllerContext=this.context;return}this._controller&&(this.removeController(this._controller),this._controller.dispose()),this._controller=this.createController(),this._controllerContext=this.context}}update(e){this._controller&&super.update(e)}};Hh([ms({type:Object})],ci.prototype,\"context\",void 0);Hh([ms({type:Object})],ci.prototype,\"node\",void 0);function CA(n,e){return n===e?!0:!n?.componentModel||!e?.componentModel||!n.dataContext||!e.dataContext?!1:n.componentModel===e.componentModel&&n.surfaceComponents===e.surfaceComponents&&n.theme===e.theme&&n.dataContext.surface===e.dataContext.surface&&n.dataContext.dataModel===e.dataContext.dataModel&&n.dataContext.path===e.dataContext.path&&n.dataContext.explicitIndex===e.dataContext.explicitIndex&&n.dataContext.parent===e.dataContext.parent}function DA(n,e,t){let r=i=>{if(xt(i))return i.componentId===e&&i.dataPath===t?i:void 0;if(i instanceof st)return r(i.value);if(Array.isArray(i)){for(let o of i){let s=r(o);if(s)return s}return}if(i&&typeof i==\"object\"&&Object.getPrototypeOf(i)===Object.prototype)for(let o of Object.values(i)){let s=r(o);if(s)return s}};return r(Ye(n.props))}var wA=`\n :where(:root) {\n color-scheme: light dark;\n }\n\n :where(.a2ui-dark) {\n color-scheme: dark;\n }\n\n :where(.a2ui-light) {\n color-scheme: light;\n }\n\n :where(:root), :where(.a2ui-dark), :where(.a2ui-light) {\n --a2ui-color-background: light-dark(#eee, #111);\n --a2ui-color-on-background: light-dark(#333, #eee);\n\n --a2ui-color-surface: light-dark(\n color-mix(in oklab, var(--a2ui-color-background) 85%, white),\n color-mix(in oklab, var(--a2ui-color-background) 95%, white)\n );\n --a2ui-color-on-surface: light-dark(#333, #eee);\n\n --a2ui-color-primary: #17e;\n --a2ui-color-primary-light: ${yn(\"light\",{colorVar:\"--a2ui-color-primary\"})};\n --a2ui-color-primary-dark: ${yn(\"dark\",{colorVar:\"--a2ui-color-primary\"})};\n --a2ui-color-primary-hover: ${yn(\"hover\",{darkVar:\"--a2ui-color-primary-dark\",lightVar:\"--a2ui-color-primary-light\"})};\n --a2ui-color-on-primary: #fff;\n\n --a2ui-color-secondary: light-dark(#ddd, #333);\n --a2ui-color-secondary-light: ${yn(\"light\",{colorVar:\"--a2ui-color-secondary\"})};\n --a2ui-color-secondary-dark: ${yn(\"dark\",{colorVar:\"--a2ui-color-secondary\",percentage:95})};\n --a2ui-color-secondary-hover: ${yn(\"hover\",{darkVar:\"--a2ui-color-secondary-dark\",lightVar:\"--a2ui-color-secondary-light\"})};\n --a2ui-color-on-secondary: light-dark(#333, #eee);\n\n --a2ui-border-radius: 0.25rem;\n --a2ui-color-border: light-dark(#ccc, #444);\n --a2ui-border-width: 1px;\n --a2ui-border: 1px solid var(--a2ui-color-border, #ccc);\n\n --a2ui-font-family-title: inherit;\n --a2ui-font-family-monospace: monospace;\n --a2ui-color-input: light-dark(#fff, #2a2a2a);\n --a2ui-color-on-input: light-dark(#333, #eee);\n\n --a2ui-grid-base: 0.5rem;\n --a2ui-spacing-xs: calc(var(--a2ui-spacing-s) / 2);\n --a2ui-spacing-s: calc(var(--a2ui-spacing-m) / 2);\n --a2ui-spacing-m: var(--a2ui-grid-base);\n --a2ui-spacing-l: calc(var(--a2ui-spacing-m) * 2);\n --a2ui-spacing-xl: calc(var(--a2ui-spacing-l) * 2);\n\n --a2ui-font-size: 1rem;\n --a2ui-font-scale: 1.2;\n --a2ui-font-size-xs: calc(var(--a2ui-font-size-s) / var(--a2ui-font-scale));\n --a2ui-font-size-s: calc(var(--a2ui-font-size-m) / var(--a2ui-font-scale));\n --a2ui-font-size-m: var(--a2ui-font-size);\n --a2ui-font-size-l: calc(var(--a2ui-font-size-m) * var(--a2ui-font-scale));\n --a2ui-font-size-xl: calc(var(--a2ui-font-size-l) * var(--a2ui-font-scale));\n --a2ui-font-size-2xl: calc(var(--a2ui-font-size-xl) * var(--a2ui-font-scale));\n\n --a2ui-line-height-headings: 1.2;\n --a2ui-line-height-body: 1.5;\n }\n`,ec;function EA(){return ec||(ec=new CSSStyleSheet,ec.replaceSync(wA)),ec}function Gh(n){if(typeof document>\"u\")return;let e=EA(),t=typeof document<\"u\"?document.adoptedStyleSheets:null;if(t&&typeof t.includes==\"function\"&&!t.includes(e))try{document.adoptedStyleSheets=[...t,e]}catch{}if(n&&n!==document){let r=n.adoptedStyleSheets;if(r&&typeof r.includes==\"function\"&&!r.includes(e))try{n.adoptedStyleSheets=[...r,e]}catch{}}}function yn(n,e){switch(n){case\"light\":{let t=e;return`color-mix(in oklab, var(${t.colorVar}) ${t.percentage??85}%, ${t.mixColor??\"white\"})`}case\"dark\":{let t=e;return`color-mix(in oklab, var(${t.colorVar}) ${t.percentage??85}%, ${t.mixColor??\"black\"})`}case\"hover\":{let t=e;return`light-dark(var(${t.darkVar}), var(${t.lightVar}))`}}}var tc=Id(Jh(),1);var SA=/^var\\(\\s*--[a-zA-Z0-9_-]+(?:\\s*,\\s*[^)]+)?\\s*\\)$/;function Cl(n){if(typeof n!=\"string\"||!n.trim())return!1;let e=n.trim();if(SA.test(e))return!0;if(typeof CSS<\"u\"&&typeof CSS.supports==\"function\")return CSS.supports(\"color\",e);let t=typeof tc.default==\"function\"?tc.default:tc.default?.default;return typeof t==\"function\"?t(e):!1}var Yh=d.object({primaryColor:d.string().refine(n=>Cl(n),\"primaryColor must be a valid CSS color (e.g. '#00BFFF', '#17e', 'red', 'rgb(255, 0, 0)')\").optional().describe(\"The primary brand color used for highlights (e.g., primary buttons, active borders). Renderers may generate variants of this color for different contexts. Format: Hexadecimal code, named color, or functional notation (e.g., '#00BFFF', 'red', 'rgb(255, 0, 0)').\"),iconUrl:d.string().optional().describe(\"A URL for an image that identifies the agent or tool associated with the surface.\"),agentDisplayName:d.string().optional().describe(\"Text to be displayed next to the surface to identify the agent or tool that created it.\")}).passthrough();var oe=class extends ci{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Gh()}willUpdate(e){super.willUpdate(e);let t=this.controller?.props;t&&t.weight!==void 0?this.style.flex=String(t.weight):this.style.removeProperty(\"flex\");let r=this.context?.theme?.primaryColor;typeof r==\"string\"&&Cl(r)?(this.style.setProperty(\"--a2ui-color-primary\",r),this.style.setProperty(\"--a2ui-color-primary-light\",yn(\"light\",{colorVar:\"--a2ui-color-primary\"})),this.style.setProperty(\"--a2ui-color-primary-dark\",yn(\"dark\",{colorVar:\"--a2ui-color-primary\"})),this.style.setProperty(\"--a2ui-color-primary-hover\",yn(\"hover\",{darkVar:\"--a2ui-color-primary-dark\",lightVar:\"--a2ui-color-primary-light\"}))):(this.style.removeProperty(\"--a2ui-color-primary\"),this.style.removeProperty(\"--a2ui-color-primary-light\"),this.style.removeProperty(\"--a2ui-color-primary-dark\"),this.style.removeProperty(\"--a2ui-color-primary-hover\")),this.applyAccessibilityAttributes(t?.accessibility)}renderValidationErrors(e){return e?.isValid===!1&&e.validationErrors?.length?e.validationErrors.map(t=>F`<div class=\"a2ui-error-message\">${t}</div>`):k}applyAccessibilityAttributes(e){this.setOrRemoveAttribute(\"aria-label\",e?.label),this.setOrRemoveAttribute(\"aria-description\",e?.description),this.setOrRemoveAttribute(\"aria-live\",e?.live),typeof e?.hidden==\"boolean\"?this.setAttribute(\"aria-hidden\",String(e.hidden)):this.removeAttribute(\"aria-hidden\")}setOrRemoveAttribute(e,t){t!=null&&t!==\"\"?this.setAttribute(e,String(t)):this.removeAttribute(e)}};var ui=class extends oe{render(){let e=this.controller.props;return e?F`\n <div class=\"a2ui-audio-player\">\n ${e.description?F`<div class=\"a2ui-audio-description\">${e.description}</div>`:k}\n <audio src=${e.url||k} controls class=\"a2ui-audio\">\n Your browser does not support the audio tag.\n </audio>\n </div>\n `:k}};ui.tagName=\"a2ui-audioplayer\";ui.styles=re`\n .a2ui-audio-player {\n display: flex;\n flex-direction: column;\n gap: var(--a2ui-spacing-xs, 0.25rem);\n background: var(--a2ui-audioplayer-background, transparent);\n border-radius: var(--a2ui-audioplayer-border-radius, 0);\n padding: var(--a2ui-audioplayer-padding, 0);\n width: 100%;\n }\n .a2ui-audio-description {\n font-size: var(--a2ui-font-size-s, 0.875rem);\n color: var(\n --a2ui-audioplayer-description-color,\n var(--a2ui-text-caption-color, light-dark(#666, #aaa))\n );\n }\n .a2ui-audio {\n width: 100%;\n }\n `;var at=Ct(class extends ht{constructor(n){if(super(n),n.type!==gn.ATTRIBUTE||n.name!==\"class\"||n.strings?.length>2)throw Error(\"`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.\")}render(n){return\" \"+Object.keys(n).filter(e=>n[e]).join(\" \")+\" \"}update(n,[e]){if(this.st===void 0){this.st=new Set,n.strings!==void 0&&(this.nt=new Set(n.strings.join(\" \").split(/\\s/).filter(r=>r!==\"\")));for(let r in e)e[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(e)}let t=n.element.classList;for(let r of this.st)r in e||(t.remove(r),this.st.delete(r));for(let r in e){let i=!!e[r];i===this.st.has(r)||this.nt?.has(r)||(i?(t.add(r),this.st.add(r)):(t.remove(r),this.st.delete(r)))}return Ue}});var li=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.isValid===!1,i={\"a2ui-button\":!0,[\"a2ui-button-\"+(e.variant??\"default\")]:!0};return F`\n <button\n type=\"button\"\n class=${at(i)}\n @click=${()=>{t||e.action?.()}}\n ?disabled=${t}\n >\n ${e.child?F`${this.renderNode(e.child)}`:k}\n </button>\n `}};li.tagName=\"a2ui-basic-button\";li.styles=re`\n .a2ui-button {\n padding: var(\n --a2ui-button-padding,\n var(--a2ui-spacing-m, 0.5rem) var(--a2ui-spacing-l, 1rem)\n );\n border-radius: var(--a2ui-button-border-radius, var(--a2ui-spacing-s, 0.25rem));\n border: var(\n --a2ui-button-border,\n var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)\n );\n cursor: pointer;\n margin: var(--a2ui-button-margin, var(--a2ui-spacing-m, 0.5rem));\n background: var(--a2ui-button-background, var(--a2ui-color-surface, #fff));\n box-shadow: var(--a2ui-button-box-shadow, none);\n font-weight: var(--a2ui-button-font-weight, normal);\n --_a2ui-text-margin: 0;\n --_a2ui-text-color: var(--a2ui-color-on-secondary, #333);\n color: var(--_a2ui-text-color);\n }\n .a2ui-button:hover {\n background-color: var(--a2ui-color-secondary-hover, #ddd);\n }\n .a2ui-button.a2ui-button-primary {\n background: var(--a2ui-color-primary, #17e);\n --_a2ui-text-color: var(--a2ui-color-on-primary, #fff);\n color: var(--_a2ui-text-color);\n border: none;\n }\n .a2ui-button.a2ui-button-primary:hover {\n background-color: var(--a2ui-color-primary-hover, #fbd);\n }\n .a2ui-button.a2ui-button-borderless {\n background: none;\n border: none;\n padding: 0;\n color: var(--a2ui-color-primary, #17e);\n }\n .a2ui-button:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n `;var di=class extends oe{render(){let e=this.controller.props;return e?F`\n <div class=\"a2ui-card\">${e.child?this.renderNode(e.child):k}</div>\n `:k}};di.tagName=\"a2ui-card\";di.styles=re`\n .a2ui-card {\n padding: var(--a2ui-card-padding, var(--a2ui-spacing-m, 16px));\n border-radius: var(--a2ui-card-border-radius, var(--a2ui-border-radius, 8px));\n box-shadow: var(--a2ui-card-box-shadow, 0 2px 4px rgba(0, 0, 0, 0.1));\n background: var(--a2ui-card-background, var(--a2ui-color-surface, #fff));\n color: var(--a2ui-color-on-surface, #333);\n border: var(\n --a2ui-card-border,\n var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)\n );\n margin: var(--a2ui-card-margin, var(--a2ui-spacing-m, 16px));\n }\n `;var fi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.isValid===!1,r={\"a2ui-checkbox\":!0,\"a2ui-invalid\":t},i={\"a2ui-invalid\":t};return F`\n <div class=\"a2ui-checkbox-container\">\n <label class=${at(r)}>\n <input\n type=\"checkbox\"\n class=${at(i)}\n .checked=${e.value||!1}\n @change=${o=>e.setValue?.(o.target.checked)}\n />\n <span class=\"a2ui-check-box-text\">${e.label}</span>\n </label>\n ${this.renderValidationErrors(e)}\n </div>\n `}};fi.tagName=\"a2ui-checkbox\";fi.styles=re`\n :host,\n a2ui-checkbox {\n display: block;\n }\n .a2ui-checkbox-container {\n display: flex;\n flex-direction: column;\n margin: var(--a2ui-checkbox-margin, var(--a2ui-spacing-m));\n }\n label.a2ui-checkbox {\n display: inline-flex;\n align-items: center;\n gap: var(--a2ui-checkbox-gap, var(--a2ui-spacing-s, 0.5rem));\n font-size: var(\n --a2ui-checkbox-label-font-size,\n var(--a2ui-label-font-size, var(--a2ui-font-size-s))\n );\n font-weight: var(--a2ui-checkbox-label-font-weight, var(--a2ui-label-font-weight, bold));\n cursor: pointer;\n }\n label.a2ui-invalid {\n color: var(--a2ui-checkbox-color-error, red);\n }\n input {\n width: var(--a2ui-checkbox-size, 1rem);\n height: var(--a2ui-checkbox-size, 1rem);\n background: var(--a2ui-checkbox-background, inherit);\n border: var(--a2ui-checkbox-border, var(--a2ui-border));\n border-radius: var(--a2ui-checkbox-border-radius, 4px);\n }\n input.a2ui-invalid {\n outline: 1px solid var(--a2ui-checkbox-color-error, red);\n }\n .a2ui-error-message {\n color: var(--a2ui-checkbox-color-error, red);\n font-size: var(--a2ui-font-size-xs, 0.75rem);\n margin-top: 4px;\n }\n `;var TA=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect==\"object\"&&typeof Reflect.decorate==\"function\")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},gr=class extends oe{constructor(){super(...arguments),this.filter=\"\"}render(){let e=this.controller?.props;if(!e)return k;let t=e.value,r=Array.isArray(t)?t:typeof t==\"string\"?[t]:[],i=e.variant===\"multipleSelection\",o=e.displayStyle===\"chips\",s=m=>{let g=e.setValue;typeof g==\"function\"&&(i?r.includes(m)?g(r.filter(h=>h!==m)):g([...r,m]):g([m]))},a=(e.options||[]).filter(m=>!e.filterable||this.filter===\"\"||String(m.label).toLowerCase().includes(this.filter.toLowerCase())),c=this.context?.dataContext?.surface?.id||\"default\",u=this.context?.componentModel?.id||\"choice-picker\",p=(this.context?.dataContext?.path||\"/\").replace(/[^a-zA-Z0-9-]/g,\"_\"),f=`a2ui-choice-${c}-${u}-${p}`;return F`\n ${e.label?F`<label>${e.label}</label>`:k}\n ${e.filterable?F`\n <input\n type=\"text\"\n class=\"a2ui-filter-input\"\n placeholder=\"Filter options...\"\n aria-label=\"Filter options\"\n .value=${this.filter}\n @input=${m=>this.filter=m.target.value}\n />\n `:k}\n <div\n class=${at({\"a2ui-choice-picker\":!0,\"a2ui-options-group\":!o,\"a2ui-chips-group\":o})}\n >\n ${a.map(m=>o?F`\n <button\n type=\"button\"\n class=${at({\"a2ui-chip\":!0,\"a2ui-chip-selected\":r.includes(m.value)})}\n aria-pressed=${r.includes(m.value)}\n @click=${()=>s(m.value)}\n >\n ${m.label}\n </button>\n `:F`\n <label class=\"a2ui-option-label\">\n <input\n type=${i?\"checkbox\":\"radio\"}\n name=${i?k:f}\n value=${m.value}\n .checked=${r.includes(m.value)}\n @change=${()=>s(m.value)}\n class=\"a2ui-option-input\"\n />\n <span class=\"a2ui-option-text\">${m.label}</span>\n </label>\n `)}\n </div>\n ${this.renderValidationErrors(e)}\n `}};gr.tagName=\"a2ui-choicepicker\";gr.styles=re`\n :host,\n .a2ui-choice-picker {\n display: flex;\n flex-direction: column;\n width: 100%;\n gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));\n padding: var(--a2ui-choicepicker-padding, 0);\n }\n .a2ui-options-group {\n display: flex;\n flex-direction: column;\n gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));\n }\n label,\n .a2ui-option-label {\n display: flex;\n align-items: center;\n gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));\n cursor: pointer;\n color: var(--a2ui-text-color-text, var(--a2ui-choicepicker-label-color, inherit));\n font-size: var(--a2ui-choicepicker-label-font-size, inherit);\n }\n :host,\n a2ui-choicepicker > label {\n font-size: var(\n --a2ui-choicepicker-label-font-size,\n var(--a2ui-label-font-size, var(--a2ui-font-size-s))\n );\n font-weight: var(--a2ui-choicepicker-label-font-weight, var(--a2ui-label-font-weight, bold));\n }\n .a2ui-filter-input {\n background-color: var(--a2ui-color-input, #fff);\n color: var(--a2ui-color-on-input, #333);\n border: var(\n --a2ui-textfield-border,\n var(--a2ui-border, 1px solid var(--a2ui-color-border, #ccc))\n );\n border-radius: var(--a2ui-textfield-border-radius, var(--a2ui-spacing-m, 4px));\n padding: var(\n --a2ui-choicepicker-filter-padding,\n var(--a2ui-spacing-xs, 4px) var(--a2ui-spacing-s, 8px)\n );\n margin-bottom: var(--a2ui-choicepicker-filter-margin-bottom, var(--a2ui-spacing-s, 0.25rem));\n font-family: inherit;\n }\n .a2ui-filter-input:focus {\n outline: none;\n border-color: var(--a2ui-textfield-color-border-focus, var(--a2ui-color-primary, #17e));\n }\n .a2ui-option-input {\n width: var(--a2ui-choicepicker-checkbox-size, 1rem);\n height: var(--a2ui-choicepicker-checkbox-size, 1rem);\n }\n .a2ui-chips-group {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));\n }\n .a2ui-chip {\n padding: var(\n --a2ui-choicepicker-chip-padding,\n var(--a2ui-spacing-s, 4px) var(--a2ui-spacing-m, 8px)\n );\n border-radius: var(--a2ui-choicepicker-chip-border-radius, 999px);\n border: var(--a2ui-choicepicker-chip-border, 1px solid var(--a2ui-color-border, #ccc));\n background-color: var(--a2ui-choicepicker-chip-background, var(--a2ui-color-surface, #fff));\n color: var(--a2ui-color-on-surface, inherit);\n cursor: pointer;\n font-size: var(--a2ui-choicepicker-chip-font-size, var(--a2ui-font-size-xs, 0.75rem));\n font-family: inherit;\n font-weight: var(--a2ui-choicepicker-chip-font-weight, normal);\n transition: all 0.2s;\n }\n .a2ui-chip.a2ui-chip-selected {\n background-color: var(\n --a2ui-choicepicker-chip-background-selected,\n var(--a2ui-color-primary, #007bff)\n );\n color: var(--a2ui-color-on-primary, #fff);\n border-color: var(\n --a2ui-choicepicker-chip-background-selected,\n var(--a2ui-color-primary, #007bff)\n );\n }\n .a2ui-error-message {\n color: var(--a2ui-choicepicker-color-error, red);\n font-size: var(--a2ui-font-size-xs, 0.75rem);\n }\n `;TA([ro()],gr.prototype,\"filter\",void 0);var{I:kA}=zh,Xh=n=>n;var em=n=>n.strings===void 0,Qh=()=>document.createComment(\"\"),oo=(n,e,t)=>{let r=n._$AA.parentNode,i=e===void 0?n._$AB:e._$AA;if(t===void 0){let o=r.insertBefore(Qh(),i),s=r.insertBefore(Qh(),i);t=new kA(o,s,n,n.options)}else{let o=t._$AB.nextSibling,s=t._$AM,a=s!==n;if(a){let c;t._$AQ?.(n),t._$AM=n,t._$AP!==void 0&&(c=n._$AU)!==s._$AU&&t._$AP(c)}if(o!==i||a){let c=t._$AA;for(;c!==o;){let u=Xh(c).nextSibling;Xh(r).insertBefore(c,i),c=u}}}return t},yr=(n,e,t=n)=>(n._$AI(e,t),n),$A={},tm=(n,e=$A)=>n._$AH=e,nm=n=>n._$AH,nc=n=>{n._$AR(),n._$AA.remove()};var rm=(n,e,t)=>{let r=new Map;for(let i=e;i<=t;i++)r.set(n[i],i);return r},br=Ct(class extends ht{constructor(n){if(super(n),n.type!==gn.CHILD)throw Error(\"repeat() can only be used in text expressions\")}dt(n,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);let i=[],o=[],s=0;for(let a of n)i[s]=r?r(a,s):s,o[s]=t(a,s),s++;return{values:o,keys:i}}render(n,e,t){return this.dt(n,e,t).values}update(n,[e,t,r]){let i=nm(n),{values:o,keys:s}=this.dt(e,t,r);if(!Array.isArray(i))return this.ut=s,o;let a=this.ut??=[],c=[],u,l,p=0,f=i.length-1,m=0,g=o.length-1;for(;p<=f&&m<=g;)if(i[p]===null)p++;else if(i[f]===null)f--;else if(a[p]===s[m])c[m]=yr(i[p],o[m]),p++,m++;else if(a[f]===s[g])c[g]=yr(i[f],o[g]),f--,g--;else if(a[p]===s[g])c[g]=yr(i[p],o[g]),oo(n,c[g+1],i[p]),p++,g--;else if(a[f]===s[m])c[m]=yr(i[f],o[m]),oo(n,i[p],i[f]),f--,m++;else if(u===void 0&&(u=rm(s,m,g),l=rm(a,p,f)),u.has(a[p]))if(u.has(a[f])){let h=l.get(s[m]),b=h!==void 0?i[h]:null;if(b===null){let v=oo(n,i[p]);yr(v,o[m]),c[m]=v}else c[m]=yr(b,o[m]),oo(n,i[p],b),i[h]=null;m++}else nc(i[f]),f--;else nc(i[p]),p++;for(;m<=g;){let h=oo(n,c[g+1]);yr(h,o[m]),c[m++]=h}for(;p<=f;){let h=i[p++];h!==null&&nc(h)}return this.ut=s,tm(n,c),Ue}});var IA={start:\"flex-start\",center:\"center\",end:\"flex-end\",spaceBetween:\"space-between\",spaceAround:\"space-around\",spaceEvenly:\"space-evenly\",stretch:\"stretch\"},FA={start:\"flex-start\",center:\"center\",end:\"flex-end\",stretch:\"stretch\",baseline:\"baseline\"};function RA(n){return typeof n==\"object\"&&n!==null?`${n.basePath??\"\"}/${n.id}`:String(n)}var pi=class extends oe{updated(e){super.updated(e);let t=this.controller.props;t&&(t.justify?this.style.justifyContent=IA[t.justify]??\"flex-start\":this.style.removeProperty(\"justify-content\"),t.align?this.style.alignItems=FA[t.align]??\"stretch\":this.style.removeProperty(\"align-items\"))}render(){let e=this.controller.props;if(!e)return k;let t=Array.isArray(e.children)?e.children:[];return F` ${br(t,RA,r=>F`${this.renderNode(r)}`)} `}};pi.tagName=\"a2ui-basic-column\";pi.styles=re`\n :host,\n a2ui-basic-column {\n display: flex;\n flex-direction: column;\n width: var(--a2ui-column-width, 100%);\n gap: var(--a2ui-column-gap, var(--a2ui-spacing-m));\n }\n `;function OA(){let n=new Date,e=n.getFullYear(),t=String(n.getMonth()+1).padStart(2,\"0\"),r=String(n.getDate()).padStart(2,\"0\");return`${e}-${t}-${r}`}function so(n,e){if(!n)return\"\";if(n.includes(\"T\")){let[r,i]=n.split(\"T\");switch(e){case\"date\":return r?.substring(0,10)??\"\";case\"time\":return i?.substring(0,5)??\"\";case\"datetime-local\":return`${r?.substring(0,10)??\"\"}T${i?.substring(0,5)??\"\"}`}}return e===\"date\"?n.includes(\"-\")?n.substring(0,10):\"\":e===\"time\"&&n.includes(\":\")?n.substring(0,5):\"\"}var hi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.enableTime??!1,r=e.enableDate??!t,i=typeof e.value==\"string\"?e.value:e.value?String(e.value):\"\",o=typeof e.min==\"string\"?e.min:e.min?String(e.min):\"\",s=typeof e.max==\"string\"?e.max:e.max?String(e.max):\"\",a=so(i,\"date\"),c=so(i,\"time\"),u=so(o,\"date\"),l=so(s,\"date\"),p=so(o,\"time\"),f=so(s,\"time\"),m=h=>{let b=h.target.value;if(t){let v=i.includes(\"T\")?i.split(\"T\")[1]:i.includes(\":\")?i:\"00:00:00\";e.setValue?.(`${b}T${v}`)}else e.setValue?.(b)},g=h=>{let b=h.target.value;if(r){let v=i.includes(\"T\")?i.split(\"T\")[0]:i.includes(\"-\")?i:OA();e.setValue?.(`${v}T${b}:00`)}else e.setValue?.(b)};return F`\n <div class=\"a2ui-date-time-container\">\n ${e.label?F`<label class=\"a2ui-date-time-label\">${e.label}</label>`:k}\n <div class=\"a2ui-date-time-inputs\">\n ${r?F`\n <input\n type=\"date\"\n min=${u||k}\n max=${l||k}\n .value=${a}\n @change=${m}\n class=\"a2ui-date-time-input\"\n />\n `:k}\n ${t?F`\n <input\n type=\"time\"\n min=${p||k}\n max=${f||k}\n .value=${c}\n @change=${g}\n class=\"a2ui-date-time-input\"\n />\n `:k}\n </div>\n ${this.renderValidationErrors(e)}\n </div>\n `}};hi.tagName=\"a2ui-datetimeinput\";hi.styles=re`\n .a2ui-date-time-container {\n display: flex;\n flex-direction: column;\n gap: var(--a2ui-spacing-xs, 4px);\n width: var(--a2ui-datetimeinput-width, 100%);\n }\n input {\n box-sizing: border-box;\n width: 100%;\n }\n .a2ui-date-time-label {\n font-size: var(\n --a2ui-datetimeinput-label-font-size,\n var(--a2ui-label-font-size, var(--a2ui-font-size-s, 14px))\n );\n font-weight: var(--a2ui-datetimeinput-label-font-weight, bold);\n color: var(--a2ui-text-color-text, var(--a2ui-color-on-background, #333));\n }\n .a2ui-date-time-inputs {\n display: flex;\n gap: var(--a2ui-spacing-s, 8px);\n width: 100%;\n }\n .a2ui-date-time-input {\n padding: var(--a2ui-datetimeinput-padding, 8px);\n border-radius: var(--a2ui-datetimeinput-border-radius, 4px);\n border: var(--a2ui-datetimeinput-border, 1px solid var(--a2ui-color-border, #ccc));\n background-color: var(--a2ui-datetimeinput-background, var(--a2ui-color-input, #fff));\n color: var(--a2ui-datetimeinput-color, var(--a2ui-color-on-input, #333));\n font-family: inherit;\n flex: 1;\n }\n .a2ui-date-time-input::-webkit-datetime-edit,\n .a2ui-date-time-input::-webkit-datetime-edit-fields-wrapper {\n color: var(--a2ui-datetimeinput-color, var(--a2ui-color-on-input, #333));\n }\n .a2ui-error-message {\n color: var(--a2ui-datetimeinput-color-error, red);\n font-size: var(--a2ui-font-size-xs, 0.75rem);\n }\n `;var mi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let r={\"a2ui-divider\":!0,[\"a2ui-divider-\"+(e.axis??\"horizontal\")]:!0};return F`<hr class=${at(r)} />`}};mi.tagName=\"a2ui-divider\";mi.styles=re`\n .a2ui-divider {\n border: 0;\n border-top: var(\n --a2ui-divider-border,\n var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)\n );\n margin: var(--a2ui-divider-spacing, var(--a2ui-spacing-m, 16px)) 0;\n width: 100%;\n }\n .a2ui-divider.a2ui-divider-vertical {\n width: var(--a2ui-border-width, 1px);\n height: 100%;\n margin: 0 var(--a2ui-divider-spacing, var(--a2ui-spacing-m, 16px));\n border-top: 0;\n border-left: var(\n --a2ui-divider-border,\n var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)\n );\n }\n `;var im={play:\"play_arrow\",rewind:\"fast_rewind\",favoriteOff:\"favorite_border\",starOff:\"star_border\"};function NA(n){return im[n]?im[n]:n.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}var gi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.name;if(typeof t==\"object\"&&t!==null&&\"svgPath\"in t){let o=t.svgPath;return F`\n <svg class=\"a2ui-icon a2ui-icon-svg\" viewBox=\"0 0 24 24\">\n <path d=${o}></path>\n </svg>\n `}let i=typeof t==\"string\"?NA(t):\"\";return F`<i class=\"material-icons a2ui-icon\">${i}</i>`}};gi.tagName=\"a2ui-icon\";gi.styles=re`\n .a2ui-icon {\n display: inline-block;\n width: var(--a2ui-icon-size, 24px);\n height: var(--a2ui-icon-size, 24px);\n font-size: var(--a2ui-icon-size, 24px);\n font-style: normal;\n font-weight: normal;\n font-family: var(--a2ui-icon-font-family, 'Material Icons', 'Material Symbols Outlined');\n color: var(\n --a2ui-icon-color,\n var(--a2ui-text-color-text, var(--a2ui-color-on-background, #333))\n );\n font-variation-settings: var(--a2ui-icon-font-variation-settings, 'FILL' 1);\n line-height: 1;\n text-transform: none;\n letter-spacing: normal;\n word-wrap: normal;\n white-space: nowrap;\n direction: ltr;\n -webkit-font-smoothing: antialiased;\n text-rendering: optimizeLegibility;\n -moz-osx-font-smoothing: grayscale;\n font-feature-settings: 'liga';\n vertical-align: middle;\n }\n .a2ui-icon.a2ui-icon-svg {\n fill: currentColor;\n }\n `;var om=\"important\",MA=\" !\"+om,rc=Ct(class extends ht{constructor(n){if(super(n),n.type!==gn.ATTRIBUTE||n.name!==\"style\"||n.strings?.length>2)throw Error(\"The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.\")}render(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];return r==null?e:e+`${t=t.includes(\"-\")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,\"-$&\").toLowerCase()}:${r};`},\"\")}update(n,[e]){let{style:t}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let r of this.ft)e[r]==null&&(this.ft.delete(r),r.includes(\"-\")?t.removeProperty(r):t[r]=null);for(let r in e){let i=e[r];if(i!=null){this.ft.add(r);let o=typeof i==\"string\"&&i.endsWith(MA);r.includes(\"-\")||o?t.setProperty(r,o?i.slice(0,-11):i,o?om:\"\"):t[r]=i}}return Ue}});var jA={contain:\"contain\",cover:\"cover\",fill:\"fill\",none:\"none\",scaleDown:\"scale-down\"},yi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.variant||\"default\",r=e.fit||\"cover\",i=jA[r]??r;return F`<img\n src=${e.url}\n alt=${e.description||\"\"}\n style=${rc({objectFit:i})}\n class=\"a2ui-image a2ui-image-${t}\"\n />`}};yi.tagName=\"a2ui-image\";yi.styles=re`\n .a2ui-image {\n display: block;\n max-width: 100%;\n height: auto;\n border-radius: var(--a2ui-image-border-radius, 0);\n }\n .a2ui-image.a2ui-image-icon {\n width: var(--a2ui-image-icon-size, 24px);\n height: var(--a2ui-image-icon-size, 24px);\n }\n .a2ui-image.a2ui-image-avatar {\n width: var(--a2ui-image-avatar-size, 40px);\n height: var(--a2ui-image-avatar-size, 40px);\n border-radius: 50%;\n }\n .a2ui-image.a2ui-image-smallFeature {\n max-width: var(--a2ui-image-small-feature-size, 100px);\n }\n .a2ui-image.a2ui-image-largeFeature {\n max-height: var(--a2ui-image-large-feature-size, 400px);\n }\n .a2ui-image.a2ui-image-header {\n height: var(--a2ui-image-header-size, 200px);\n }\n `;var PA={start:\"flex-start\",center:\"center\",end:\"flex-end\",stretch:\"stretch\",baseline:\"baseline\"};function Dl(n){return typeof n==\"object\"&&n!==null?`${n.basePath??\"\"}/${n.id}`:String(n)}var bi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=Array.isArray(e.children)?e.children:[],r=e.listStyle,i=e.direction||\"vertical\",o=e.align?PA[e.align]??\"stretch\":void 0,s=o?rc({alignItems:o}):k;return r===\"ordered\"?F`\n <ol class=\"a2ui-list a2ui-list-${i}\" style=${s}>\n ${br(t,Dl,a=>F`<li>${this.renderNode(a)}</li>`)}\n </ol>\n `:r===\"unordered\"?F`\n <ul class=\"a2ui-list a2ui-list-${i}\" style=${s}>\n ${br(t,Dl,a=>F`<li>${this.renderNode(a)}</li>`)}\n </ul>\n `:F`\n <div class=\"a2ui-list a2ui-list-${i}\" style=${s}>\n ${br(t,Dl,a=>F`<div class=\"a2ui-list-item-none\">${this.renderNode(a)}</div>`)}\n </div>\n `}};bi.tagName=\"a2ui-list\";bi.styles=re`\n .a2ui-list {\n display: flex;\n padding-inline-start: var(--a2ui-list-padding, var(--a2ui-spacing-l, 24px));\n margin: 0;\n }\n .a2ui-list.a2ui-list-vertical {\n flex-direction: column;\n gap: var(--a2ui-list-gap, var(--a2ui-spacing-s, 8px));\n }\n .a2ui-list.a2ui-list-horizontal {\n flex-direction: row;\n gap: var(--a2ui-list-gap, var(--a2ui-spacing-m, 16px));\n list-style-position: inside;\n }\n .a2ui-list-item-none {\n display: block;\n }\n .a2ui-list-horizontal .a2ui-list-item-none {\n display: inline-block;\n }\n `;var LA=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect==\"object\"&&typeof Reflect.decorate==\"function\")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},vr=class extends oe{constructor(){super(...arguments),this.isOpen=!1}openModal(){this.isOpen=!0}closeModal(){this.isOpen=!1}render(){let e=this.controller.props;return e?F`\n <div class=\"a2ui-modal-wrapper\">\n <div @click=${()=>this.openModal()} class=\"a2ui-modal-trigger\">\n ${e.trigger?F`${this.renderNode(e.trigger)}`:k}\n </div>\n ${this.isOpen?F`\n <div class=\"a2ui-modal-overlay\" @click=${()=>this.closeModal()}>\n <div\n class=\"a2ui-modal-content\"\n role=\"dialog\"\n aria-modal=\"true\"\n @click=${t=>t.stopPropagation()}\n >\n <button\n type=\"button\"\n class=\"a2ui-modal-close\"\n aria-label=\"Close\"\n @click=${()=>this.closeModal()}\n >\n ×\n </button>\n ${e.content?F`${this.renderNode(e.content)}`:k}\n </div>\n </div>\n `:k}\n </div>\n `:k}};vr.tagName=\"a2ui-modal\";vr.styles=re`\n :host,\n a2ui-modal {\n display: inline-block;\n }\n .a2ui-modal-wrapper {\n display: inline-block;\n }\n .a2ui-modal-trigger {\n cursor: pointer;\n }\n .a2ui-modal-overlay {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: var(--a2ui-modal-backdrop-bg, rgba(0, 0, 0, 0.5));\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1000;\n }\n .a2ui-modal-content {\n background: var(--a2ui-modal-background, var(--a2ui-color-surface, #fff));\n padding: var(--a2ui-modal-padding, var(--a2ui-spacing-xl, 32px));\n border-radius: var(--a2ui-modal-border-radius, var(--a2ui-border-radius, 8px));\n position: relative;\n min-width: 300px;\n max-width: 80%;\n max-height: 80%;\n overflow-y: auto;\n box-shadow: var(--a2ui-modal-box-shadow, 0 10px 25px rgba(0, 0, 0, 0.2));\n }\n .a2ui-modal-close {\n position: absolute;\n top: 10px;\n right: 15px;\n border: none;\n background: none;\n font-size: 24px;\n cursor: pointer;\n color: var(--a2ui-text-caption-color, #999);\n }\n .a2ui-modal-close:hover {\n color: var(--a2ui-text-color, #333);\n }\n `;LA([ro()],vr.prototype,\"isOpen\",void 0);var BA={start:\"flex-start\",center:\"center\",end:\"flex-end\",spaceBetween:\"space-between\",spaceAround:\"space-around\",spaceEvenly:\"space-evenly\",stretch:\"stretch\"},VA={start:\"flex-start\",center:\"center\",end:\"flex-end\",stretch:\"stretch\",baseline:\"baseline\"};function UA(n){return typeof n==\"object\"&&n!==null?`${n.basePath??\"\"}/${n.id}`:String(n)}var vi=class extends oe{updated(e){super.updated(e);let t=this.controller.props;t&&(t.justify?this.style.justifyContent=BA[t.justify]??\"flex-start\":this.style.removeProperty(\"justify-content\"),t.align?this.style.alignItems=VA[t.align]??\"stretch\":this.style.removeProperty(\"align-items\"))}render(){let e=this.controller.props;if(!e)return k;let t=Array.isArray(e.children)?e.children:[];return F` ${br(t,UA,r=>F`${this.renderNode(r)}`)} `}};vi.tagName=\"a2ui-basic-row\";vi.styles=re`\n :host,\n a2ui-basic-row {\n display: flex;\n flex-direction: row;\n gap: var(--a2ui-row-gap, var(--a2ui-spacing-m));\n }\n `;var _i=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.min??0,r=e.max??100,i=\"steps\"in e?e.steps:void 0,o=typeof i==\"number\"&&i>0&&r>t?(r-t)/i:k;return F`\n <div class=\"a2ui-slider-container\">\n <div class=\"a2ui-slider-header\">\n <span class=\"a2ui-slider-label\">${e.label}</span>\n <span class=\"a2ui-slider-value\">${e.value}</span>\n </div>\n <input\n type=\"range\"\n min=${t}\n max=${r}\n step=${o}\n .value=${e.value?.toString()||\"0\"}\n @input=${s=>e.setValue?.(Number(s.target.value))}\n class=\"a2ui-slider\"\n />\n ${this.renderValidationErrors(e)}\n </div>\n `}};_i.tagName=\"a2ui-slider\";_i.styles=re`\n .a2ui-slider-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: var(--a2ui-spacing-xs, 4px);\n margin: var(--a2ui-slider-margin, var(--a2ui-spacing-m, 16px));\n }\n .a2ui-slider-header {\n display: flex;\n justify-content: space-between;\n font-size: var(\n --a2ui-slider-label-font-size,\n var(--a2ui-label-font-size, var(--a2ui-font-size-s, 14px))\n );\n font-weight: var(--a2ui-slider-label-font-weight, bold);\n color: var(--a2ui-text-color-text, var(--a2ui-color-on-background, #333));\n }\n .a2ui-slider {\n width: 100%;\n cursor: pointer;\n accent-color: var(--a2ui-slider-thumb-color, var(--a2ui-color-primary, #007bff));\n background: var(--a2ui-slider-track-color, var(--a2ui-color-secondary, #e9ecef));\n }\n .a2ui-error-message {\n color: var(--a2ui-slider-color-error, red);\n font-size: var(--a2ui-font-size-xs, 0.75rem);\n }\n `;var zA=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect==\"object\"&&typeof Reflect.decorate==\"function\")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},_r=class extends oe{constructor(){super(...arguments),this.activeIndex=0}willUpdate(e){super.willUpdate(e);let t=this.controller?.props;t?.tabs&&this.activeIndex>=t.tabs.length&&(this.activeIndex=0)}render(){let e=this.controller?.props;return!e||!e.tabs?k:F`\n <div class=\"a2ui-tabs\">\n <div class=\"a2ui-tab-bar\">\n ${e.tabs?.map((t,r)=>F`\n <button\n class=${at({\"a2ui-tab-button\":!0,\"a2ui-tab-button-active\":r===this.activeIndex})}\n @click=${()=>this.activeIndex=r}\n >\n ${t.title}\n </button>\n `)}\n </div>\n <div class=\"a2ui-tab-content\">\n ${e.tabs[this.activeIndex]?F`${this.renderNode(e.tabs[this.activeIndex].child)}`:k}\n </div>\n </div>\n `}};_r.tagName=\"a2ui-tabs\";_r.styles=re`\n .a2ui-tabs {\n display: flex;\n flex-direction: column;\n width: 100%;\n }\n .a2ui-tab-bar {\n display: flex;\n border-bottom: var(--a2ui-tabs-border, 2px solid var(--a2ui-color-border, #eee));\n gap: var(--a2ui-spacing-m, 16px);\n }\n .a2ui-tab-button {\n padding: var(--a2ui-spacing-s, 8px) var(--a2ui-spacing-m, 16px);\n border: none;\n background: var(--a2ui-tabs-header-background, transparent);\n cursor: pointer;\n font-weight: 500;\n color: var(--a2ui-tabs-header-color, var(--a2ui-text-caption-color, #666));\n border-bottom: 2px solid transparent;\n margin-bottom: -2px;\n }\n .a2ui-tab-button.a2ui-tab-button-active {\n background: var(--a2ui-tabs-header-background-active, transparent);\n color: var(--a2ui-tabs-header-color-active, var(--a2ui-color-primary, #007bff));\n border-bottom: 2px solid var(--a2ui-color-primary, #007bff);\n }\n .a2ui-tab-content {\n padding: var(--a2ui-tabs-content-padding, var(--a2ui-spacing-m, 16px) 0);\n }\n `;zA([ro()],_r.prototype,\"activeIndex\",void 0);var xi=class extends Event{constructor(e,t,r,i){super(\"context-request\",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=r,this.subscribe=i??!1}};var ao=class{constructor(e,t,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,s)),this.unsubscribe=s},this.host=e,t.context!==void 0){let o=t;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??!1}else this.context=t,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new xi(this.context,this.host,this.t,this.subscribe))}};function wl({context:n,subscribe:e}){return(t,r)=>{typeof r==\"object\"?r.addInitializer((function(){new ao(this,{context:n,callback:i=>{t.set.call(this,i)},subscribe:e})})):t.constructor.addInitializer((i=>{new ao(i,{context:n,callback:o=>{i[r]=o},subscribe:e})}))}}var sm=Symbol.for(\"A2UIMarkdown\");var am={markdown:sm};var gs=(n,e)=>{let t=n._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),gs(r,e);return!0},ic=n=>{let e,t;do{if((e=n._$AM)===void 0)break;t=e._$AN,t.delete(n),n=e}while(t?.size===0)},cm=n=>{for(let e;e=n._$AM;n=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(n))break;t.add(n),GA(e)}};function WA(n){this._$AN!==void 0?(ic(this),this._$AM=n,cm(this)):this._$AM=n}function HA(n,e=!1,t=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let o=t;o<r.length;o++)gs(r[o],!1),ic(r[o]);else r!=null&&(gs(r,!1),ic(r));else gs(this,n)}var GA=n=>{n.type==gn.CHILD&&(n._$AP??=HA,n._$AQ??=WA)},oc=class extends ht{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),cm(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(gs(this,e),ic(this))}setValue(e){if(em(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var ys=class extends ht{constructor(e){if(super(e),this.it=k,e.type!==gn.CHILD)throw Error(this.constructor.directiveName+\"() can only be used in child bindings\")}render(e){if(e===k||e==null)return this._t=void 0,this.it=e;if(e===Ue)return e;if(typeof e!=\"string\")throw Error(this.constructor.directiveName+\"() called with a non-string value\");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};ys.directiveName=\"unsafeHTML\",ys.resultType=1;var um=Ct(ys);var El;function Sl(n){El=n}var sc=class n extends oc{constructor(){super(...arguments),this.renderToken=0,this.lastValue=null,this.lastRenderer=void 0,this.lastTagClassMap=null}static resetWarningForTesting(){n.defaultMarkdownWarningLogged=!1}update(e,[t,r,i]){let o=r??El,s=JSON.stringify(i?.tagClassMap);return this.lastValue===t&&this.lastRenderer===o&&s===this.lastTagClassMap?Ue:(this.lastValue=t,this.lastRenderer=o,this.lastTagClassMap=s,this.render(t,o,i))}render(e,t,r){let i=t??El;if(i){let o=++this.renderToken;try{Promise.resolve(i(e,r)).then(s=>{this.isConnected&&o===this.renderToken&&this.setValue(um(s))}).catch(s=>{console.error(\"[MarkdownDirective] Error rendering markdown:\",s)})}catch(s){console.error(\"[MarkdownDirective] Synchronous error rendering markdown:\",s)}return F`<span class=\"no-markdown-renderer\">${e}</span>`}return n.defaultMarkdownWarningLogged||(console.warn(\"[MarkdownDirective]\",`can't render markdown because no markdown renderer is configured.\n`,\"Use `@a2ui/markdown-it`, or your own markdown renderer.\"),n.defaultMarkdownWarningLogged=!0),F`<span class=\"no-markdown-renderer\">${e}</span>`}};sc.defaultMarkdownWarningLogged=!1;var Tl=Ct(sc);var KA=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect==\"object\"&&typeof Reflect.decorate==\"function\")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},JA=new Set([\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"caption\"]),xr=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.variant||\"body\",r=typeof e.text==\"string\"?e.text:String(e.text??\"\"),i=typeof e.weight==\"number\"?`flex: ${e.weight};`:k;if(JA.has(t)){let s=F`${r}`;switch(t){case\"h1\":s=F`<h1>${r}</h1>`;break;case\"h2\":s=F`<h2>${r}</h2>`;break;case\"h3\":s=F`<h3>${r}</h3>`;break;case\"h4\":s=F`<h4>${r}</h4>`;break;case\"h5\":s=F`<h5>${r}</h5>`;break;case\"caption\":s=F`<em>${r}</em>`;break}return F`<span class=\"a2ui-text a2ui-text-${t}\" style=${i}\n >${s}</span\n >`}let o=Tl(r,this.markdownRenderer);return F`<span class=\"a2ui-text a2ui-text-${t}\" style=${i}\n >${o}</span\n >`}};xr.tagName=\"a2ui-basic-text\";xr.styles=re`\n :host {\n display: contents;\n }\n .a2ui-text p,\n .a2ui-text h1,\n .a2ui-text h2,\n .a2ui-text h3,\n .a2ui-text h4,\n .a2ui-text h5,\n .a2ui-text h6,\n .a2ui-text ol,\n .a2ui-text ul,\n .a2ui-text li,\n .a2ui-text blockquote,\n .a2ui-text pre {\n margin: var(--_a2ui-text-margin, 0);\n }\n .a2ui-text {\n color: var(--_a2ui-text-color, var(--a2ui-text-color-text, var(--a2ui-color-on-background)));\n }\n .a2ui-text h1,\n .a2ui-text h2,\n .a2ui-text h3,\n .a2ui-text h4,\n .a2ui-text h5,\n .a2ui-text h6 {\n font-family: var(--a2ui-font-family-title, inherit);\n line-height: var(--a2ui-line-height-headings, 1.2);\n }\n .a2ui-text h1 {\n font-size: var(--a2ui-font-size-2xl);\n }\n .a2ui-text h2 {\n font-size: var(--a2ui-font-size-xl);\n }\n .a2ui-text h3 {\n font-size: var(--a2ui-font-size-l);\n }\n .a2ui-text p,\n .a2ui-text h4 {\n font-size: var(--a2ui-font-size-m);\n }\n .a2ui-text h5 {\n font-size: var(--a2ui-font-size-s);\n }\n .a2ui-text p {\n line-height: var(--a2ui-line-height-body, 1.5);\n }\n .a2ui-text.a2ui-text-caption {\n font-size: var(--a2ui-font-size-xs);\n color: var(--a2ui-text-caption-color, light-dark(#666, #aaa));\n }\n .a2ui-text a {\n color: var(--a2ui-text-a-color, inherit);\n font-weight: var(--a2ui-text-a-font-weight, inherit);\n }\n `;KA([wl({context:am.markdown,subscribe:!0})],xr.prototype,\"markdownRenderer\",void 0);var Ai=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.isValid===!1,r=a=>e.setValue?.(a.target.value),i=\"text\";e.variant===\"number\"&&(i=\"number\"),e.variant===\"obscured\"&&(i=\"password\");let o={\"a2ui-textfield\":!0,\"a2ui-invalid\":t},s=\"placeholder\"in e&&e.placeholder||k;return F`\n ${e.label?F`<label>${e.label}</label>`:k}\n ${e.variant===\"longText\"?F`<textarea\n class=${at(o)}\n placeholder=${s}\n .value=${e.value||\"\"}\n @input=${r}\n ></textarea>`:F`<input\n type=${i}\n class=${at(o)}\n placeholder=${s}\n .value=${e.value||\"\"}\n @input=${r}\n />`}\n ${this.renderValidationErrors(e)}\n `}};Ai.tagName=\"a2ui-basic-textfield\";Ai.styles=re`\n :host,\n a2ui-basic-textfield {\n display: flex;\n flex-direction: column;\n width: var(--a2ui-textfield-width, 100%);\n gap: var(--a2ui-spacing-xs, 0.25rem);\n }\n .a2ui-textfield {\n box-sizing: border-box;\n width: 100%;\n background-color: var(--a2ui-color-input, #fff);\n color: var(--a2ui-color-on-input, #333);\n border: var(--a2ui-textfield-border, var(--a2ui-border));\n border-radius: var(--a2ui-textfield-border-radius, var(--a2ui-spacing-m));\n padding: var(--a2ui-textfield-padding, var(--a2ui-spacing-m));\n font-family: inherit;\n }\n .a2ui-textfield:focus {\n outline: none;\n border-color: var(--a2ui-textfield-color-border-focus, var(--a2ui-color-primary, #17e));\n }\n .a2ui-textfield.a2ui-invalid {\n border-color: var(--a2ui-textfield-color-error, red);\n }\n label {\n font-size: var(\n --a2ui-textfield-label-font-size,\n var(--a2ui-label-font-size, var(--a2ui-font-size-s))\n );\n font-weight: var(--a2ui-textfield-label-font-weight, var(--a2ui-label-font-weight, bold));\n }\n .a2ui-error-message {\n color: var(--a2ui-textfield-color-error, red);\n font-size: var(--a2ui-font-size-xs, 0.75rem);\n }\n `;var Ci=class extends oe{render(){let e=this.controller.props;return e?F`\n <div class=\"a2ui-video-container\">\n <video\n src=${e.url||k}\n poster=${\"posterUrl\"in e&&e.posterUrl||k}\n controls\n class=\"a2ui-video\"\n >\n Your browser does not support the video tag.\n </video>\n </div>\n `:k}};Ci.tagName=\"a2ui-video\";Ci.styles=re`\n .a2ui-video-container {\n width: 100%;\n max-width: 100%;\n }\n .a2ui-video {\n width: 100%;\n height: auto;\n display: block;\n border-radius: var(--a2ui-video-border-radius, 0);\n }\n `;var ue=fu(\"CatalogComponentCommon\",d.object({weight:d.number().describe(\"The relative weight of this component within a Row or Column. This is similar to the CSS 'flex-grow' property. Note: this may ONLY be set when the component is a direct descendant of a Row or Column.\").optional()})),YA=fu(\"theme\",d.object({primaryColor:d.string().regex(new RegExp(\"^#[0-9a-fA-F]{6}$\")).describe(\"The primary brand color used for highlights (e.g., primary buttons, active borders). Renderers may generate variants of this color for different contexts. Format: Hexadecimal code (e.g., '#00BFFF').\").optional(),iconUrl:X(d.string().describe(\"A URL for an image that identifies the agent or tool associated with the surface.\"),{keywords:{format:\"uri\"}}).optional(),agentDisplayName:d.string().describe(\"Text to be displayed next to the surface to identify the agent or tool that created it.\").optional()}),{keywords:{additionalProperties:!0}}),lm={name:\"Text\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),text:fe.describe(\"REF:#/$defs/DynamicString|The text content to display. While simple Markdown formatting is supported (i.e. without HTML, images, or links), utilizing dedicated UI components is generally preferred for a richer and more structured presentation.\"),variant:d.enum([\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"caption\",\"body\"]).default(\"body\").describe(\"A hint for the base text style.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue]})},dm={name:\"Image\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),url:fe.describe(\"REF:#/$defs/DynamicString|The URL of the image to display.\"),description:fe.describe(\"REF:#/$defs/DynamicString|Accessibility text for the image.\").optional(),fit:d.enum([\"contain\",\"cover\",\"fill\",\"none\",\"scaleDown\"]).default(\"fill\").describe(\"Specifies how the image should be resized to fit its container. This corresponds to the CSS 'object-fit' property.\").optional(),variant:d.enum([\"icon\",\"avatar\",\"smallFeature\",\"mediumFeature\",\"largeFeature\",\"header\"]).default(\"mediumFeature\").describe(\"A hint for the image size and style.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue]})},fm={name:\"Icon\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),name:d.union([d.enum([\"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\"]),X(d.object({svgPath:d.string()}),{closure:\"additionalProperties\"}),pr.describe(\"REF:#/$defs/DataBinding\")]).describe(\"The name of the icon to display.\")}).strict(),{mixins:[\"ComponentCommon\",ue]})},pm={name:\"Video\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),url:fe.describe(\"REF:#/$defs/DynamicString|The URL of the video to display.\")}).strict(),{mixins:[\"ComponentCommon\",ue]})},hm={name:\"AudioPlayer\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),url:fe.describe(\"REF:#/$defs/DynamicString|The URL of the audio to be played.\"),description:fe.describe(\"REF:#/$defs/DynamicString|A description of the audio, such as a title or summary.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue]})},mm={name:\"Row\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),children:as.describe(\"REF:#/$defs/ChildList|Defines the children. Use an array of strings for a fixed set of children, or a template object to generate children from a data list. Children cannot be defined inline, they must be referred to by ID.\"),justify:d.enum([\"center\",\"end\",\"spaceAround\",\"spaceBetween\",\"spaceEvenly\",\"start\",\"stretch\"]).default(\"start\").describe(\"Defines the arrangement of children along the main axis (horizontally). Use 'spaceBetween' to push items to the edges, or 'start'/'end'/'center' to pack them together.\").optional(),align:d.enum([\"start\",\"center\",\"end\",\"stretch\"]).default(\"stretch\").describe(\"Defines the alignment of children along the cross axis (vertically). This is similar to the CSS 'align-items' property, but uses camelCase values (e.g., 'start').\").optional()}).describe(\"A layout component that arranges its children horizontally. To create a grid layout, nest Columns within this Row.\").strict(),{mixins:[\"ComponentCommon\",ue]})},gm={name:\"Column\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),children:as.describe(\"REF:#/$defs/ChildList|Defines the children. Use an array of strings for a fixed set of children, or a template object to generate children from a data list. Children cannot be defined inline, they must be referred to by ID.\"),justify:d.enum([\"start\",\"center\",\"end\",\"spaceBetween\",\"spaceAround\",\"spaceEvenly\",\"stretch\"]).default(\"start\").describe(\"Defines the arrangement of children along the main axis (vertically). Use 'spaceBetween' to push items to the edges (e.g. header at top, footer at bottom), or 'start'/'end'/'center' to pack them together.\").optional(),align:d.enum([\"center\",\"end\",\"start\",\"stretch\"]).default(\"stretch\").describe(\"Defines the alignment of children along the cross axis (horizontally). This is similar to the CSS 'align-items' property.\").optional()}).describe(\"A layout component that arranges its children vertically. To create a grid layout, nest Rows within this Column.\").strict(),{mixins:[\"ComponentCommon\",ue]})},ym={name:\"List\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),children:as.describe(\"REF:#/$defs/ChildList|Defines the children. Use an array of strings for a fixed set of children, or a template object to generate children from a data list.\"),direction:d.enum([\"vertical\",\"horizontal\"]).default(\"vertical\").describe(\"The direction in which the list items are laid out.\").optional(),align:d.enum([\"start\",\"center\",\"end\",\"stretch\"]).default(\"stretch\").describe(\"Defines the alignment of children along the cross axis.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue]})},bm={name:\"Card\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),child:pn.describe(\"REF:#/$defs/ComponentId|The ID of the single child component to be rendered inside the card. To display multiple elements, you MUST wrap them in a layout component (like Column or Row) and pass that container's ID here. Do NOT pass multiple IDs or a non-existent ID.\")}).strict(),{mixins:[\"ComponentCommon\",ue]})},vm={name:\"Tabs\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),tabs:d.array(X(d.object({title:fe.describe(\"REF:#/$defs/DynamicString|The tab title.\"),child:pn.describe(\"REF:#/$defs/ComponentId|The ID of the child component.\")}),{closure:\"additionalProperties\"})).min(1).describe(\"An array of objects, where each object defines a tab with a title and a child component.\")}).strict(),{mixins:[\"ComponentCommon\",ue]})},_m={name:\"Modal\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),trigger:pn.describe(\"REF:#/$defs/ComponentId|The ID of the component that opens the modal when interacted with (e.g., a button).\"),content:pn.describe(\"REF:#/$defs/ComponentId|The ID of the component to be displayed inside the modal.\")}).strict(),{mixins:[\"ComponentCommon\",ue]})},xm={name:\"Divider\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),axis:d.enum([\"horizontal\",\"vertical\"]).default(\"horizontal\").describe(\"The orientation of the divider.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue]})},Am={name:\"Button\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(jn.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),child:pn.describe(\"REF:#/$defs/ComponentId|The ID of the child component. Use a 'Text' component for a labeled button. Only use an 'Icon' if the requirements explicitly ask for an icon-only button.\"),variant:d.enum([\"default\",\"primary\",\"borderless\"]).default(\"default\").describe(\"A hint for the button style. If omitted, a default button style is used. 'primary' indicates this is the main call-to-action button. 'borderless' means the button has no visual border or background, making its child content appear like a clickable link.\").optional(),action:dl.describe(\"REF:#/$defs/Action\")}).strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"]})},Cm={name:\"TextField\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(jn.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),label:fe.describe(\"REF:#/$defs/DynamicString|The text label for the input field.\"),value:fe.describe(\"REF:#/$defs/DynamicString|The value of the text field.\").optional(),variant:d.enum([\"longText\",\"number\",\"shortText\",\"obscured\"]).default(\"shortText\").describe(\"The type of input field to display.\").optional(),validationRegexp:d.string().describe(\"A regular expression used for client-side validation of the input.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"]})},Dm={name:\"CheckBox\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(jn.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),label:fe.describe(\"REF:#/$defs/DynamicString|The text to display next to the checkbox.\"),value:mn.describe(\"REF:#/$defs/DynamicBoolean|The current state of the checkbox (true for checked, false for unchecked).\")}).strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"]})},wm={name:\"ChoicePicker\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(jn.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),label:fe.describe(\"REF:#/$defs/DynamicString|The label for the group of options.\").optional(),variant:d.enum([\"multipleSelection\",\"mutuallyExclusive\"]).default(\"mutuallyExclusive\").describe(\"A hint for how the choice picker should be displayed and behave.\").optional(),options:d.array(X(d.object({label:fe.describe(\"REF:#/$defs/DynamicString|The text to display for this option.\"),value:d.string().describe(\"The stable value associated with this option.\")}),{closure:\"additionalProperties\"})).describe(\"The list of available options to choose from.\"),value:ll.describe(\"REF:#/$defs/DynamicStringList|The list of currently selected values. This should be bound to a string array in the data model.\"),displayStyle:d.enum([\"checkbox\",\"chips\"]).default(\"checkbox\").describe(\"The display style of the component.\").optional(),filterable:d.boolean().default(!1).describe(\"If true, displays a search input to filter the options.\").optional()}).describe(\"A component that allows selecting one or more options from a list.\").strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"]})},Em={name:\"Slider\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(jn.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),label:fe.describe(\"REF:#/$defs/DynamicString|The label for the slider.\").optional(),min:d.number().default(0).describe(\"The minimum value of the slider.\").optional(),max:d.number().describe(\"The maximum value of the slider.\"),value:hn.describe(\"REF:#/$defs/DynamicNumber|The current value of the slider.\")}).strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"],required:[\"value\",\"max\"]})},Sm={name:\"DateTimeInput\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(jn.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),value:fe.describe(\"REF:#/$defs/DynamicString|The selected date and/or time value in ISO 8601 format. If not yet set, initialize with an empty string.\"),enableDate:d.boolean().default(!1).describe(\"If true, allows the user to select a date.\").optional(),enableTime:d.boolean().default(!1).describe(\"If true, allows the user to select a time.\").optional(),min:X(fe.describe(\"REF:#/$defs/DynamicString|The minimum allowed date/time in ISO 8601 format.\"),{allOf:[{if:{type:\"string\"},then:{oneOf:[{format:\"date\"},{format:\"time\"},{format:\"date-time\"}]}}]}).optional(),max:X(fe.describe(\"REF:#/$defs/DynamicString|The maximum allowed date/time in ISO 8601 format.\"),{allOf:[{if:{type:\"string\"},then:{oneOf:[{format:\"date\"},{format:\"time\"},{format:\"date-time\"}]}}]}).optional(),label:fe.describe(\"REF:#/$defs/DynamicString|The text label for the input field.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"]})};var Tm={schemaUri:\"https://json-schema.org/draft/2020-12/schema\",schemaId:\"https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json\",title:\"A2UI Basic Catalog\",description:\"Unified catalog of basic A2UI components and functions.\",declaredProtocolVersion:null,commonTypesUri:\"https://a2ui.org/specification/v0_9/common_types.json\",defModels:[YA]};var km=$e(ui,hm),$m=$e(li,Am),Im=$e(di,bm),Fm=$e(fi,Dm),Rm=$e(gr,wm),Om=$e(pi,gm),Nm=$e(hi,Sm),Mm=$e(mi,xm),jm=$e(gi,fm),Pm=$e(yi,dm),Lm=$e(bi,ym),Bm=$e(vr,_m),Vm=$e(vi,mm),Um=$e(_i,Em),zm=$e(_r,vm),qm=$e(xr,lm),Zm=$e(Ai,Cm),Wm=$e(Ci,pm);var Hm={name:\"required\",returnType:\"boolean\",description:\"Checks that the value is not null, undefined, or empty.\",schema:X(d.object({value:d.any().refine(n=>n!==void 0,\"Required\").describe(\"The value to check.\")}),{closure:\"additionalProperties\"})},Gm={name:\"regex\",returnType:\"boolean\",description:\"Checks that the value matches a regular expression string.\",schema:X(d.object({value:fe.describe(\"REF:#/$defs/DynamicString\"),pattern:d.string().describe(\"The regex pattern to match against.\")}),{closure:\"unevaluatedProperties\"})},Km={name:\"length\",returnType:\"boolean\",description:\"Checks string length constraints.\",schema:X(d.object({value:fe.describe(\"REF:#/$defs/DynamicString\"),min:X(d.number().int().describe(\"The minimum allowed length.\"),{keywords:{minimum:0}}).optional(),max:X(d.number().int().describe(\"The maximum allowed length.\"),{keywords:{minimum:0}}).optional()}),{closure:\"unevaluatedProperties\",keywords:{anyOf:[{required:[\"min\"]},{required:[\"max\"]}]}})},Jm={name:\"numeric\",returnType:\"boolean\",description:\"Checks numeric range constraints.\",schema:X(d.object({value:hn.describe(\"REF:#/$defs/DynamicNumber\"),min:d.number().describe(\"The minimum allowed value.\").optional(),max:d.number().describe(\"The maximum allowed value.\").optional()}),{closure:\"unevaluatedProperties\",keywords:{anyOf:[{required:[\"min\"]},{required:[\"max\"]}]}})},Ym={name:\"email\",returnType:\"boolean\",description:\"Checks that the value is a valid email address.\",schema:X(d.object({value:fe.describe(\"REF:#/$defs/DynamicString\")}),{closure:\"unevaluatedProperties\"})},Xm={name:\"formatString\",returnType:\"string\",description:\"Performs string interpolation of data model values and other functions in the catalog functions list and returns the resulting string. The value string can contain interpolated expressions in the `${expression}` format. Supported expression types include: JSON Pointer paths to the data model (e.g., `${/absolute/path}` or `${relative/path}`), and client-side function calls (e.g., `${now()}`). Function arguments must be named (e.g., `${formatDate(value:${/currentDate}, format:'MM-dd')}`). To include a literal `${` sequence, escape it as `\\\\${`.\",schema:X(d.object({value:fe.describe(\"REF:#/$defs/DynamicString\")}),{closure:\"unevaluatedProperties\"})},Qm={name:\"formatNumber\",returnType:\"string\",description:\"Formats a number with the specified grouping and decimal precision.\",schema:X(d.object({value:hn.describe(\"REF:#/$defs/DynamicNumber|The number to format.\"),decimals:hn.describe(\"REF:#/$defs/DynamicNumber|Optional. The number of decimal places to show. Defaults to 0 or 2 depending on locale.\").optional(),grouping:mn.describe(\"REF:#/$defs/DynamicBoolean|Optional. If true, uses locale-specific grouping separators (e.g. '1,000'). If false, returns raw digits (e.g. '1000'). Defaults to true.\").optional()}),{closure:\"unevaluatedProperties\"})},eg={name:\"formatCurrency\",returnType:\"string\",description:\"Formats a number as a currency string.\",schema:X(d.object({value:hn.describe(\"REF:#/$defs/DynamicNumber|The monetary amount.\"),currency:fe.describe(\"REF:#/$defs/DynamicString|The ISO 4217 currency code (e.g., 'USD', 'EUR').\"),decimals:hn.describe(\"REF:#/$defs/DynamicNumber|Optional. The number of decimal places to show. Defaults to 0 or 2 depending on locale.\").optional(),grouping:mn.describe(\"REF:#/$defs/DynamicBoolean|Optional. If true, uses locale-specific grouping separators (e.g. '1,000'). If false, returns raw digits (e.g. '1000'). Defaults to true.\").optional()}),{required:[\"currency\",\"value\"],closure:\"unevaluatedProperties\"})},tg={name:\"formatDate\",returnType:\"string\",description:\"Formats a timestamp into a string using a pattern.\",schema:X(d.object({value:ss.describe(\"REF:#/$defs/DynamicValue|The date to format.\"),format:fe.describe(`REF:#/$defs/DynamicString|A Unicode TR35 date pattern string.\n\nToken Reference:\n- Year: 'yy' (26), 'yyyy' (2026)\n- Month: 'M' (1), 'MM' (01), 'MMM' (Jan), 'MMMM' (January)\n- Day: 'd' (1), 'dd' (01), 'E' (Tue), 'EEEE' (Tuesday)\n- Hour (12h): 'h' (1-12), 'hh' (01-12) - requires 'a' for AM/PM\n- Hour (24h): 'H' (0-23), 'HH' (00-23) - Military Time\n- Minute: 'mm' (00-59)\n- Second: 'ss' (00-59)\n- Period: 'a' (AM/PM)\n\nExamples:\n- 'MMM dd, yyyy' -> 'Jan 16, 2026'\n- 'HH:mm' -> '14:30' (Military)\n- 'h:mm a' -> '2:30 PM'\n- 'EEEE, d MMMM' -> 'Friday, 16 January'`)}),{required:[\"format\",\"value\"],closure:\"unevaluatedProperties\"})},ng={name:\"pluralize\",returnType:\"string\",description:\"Returns a localized string based on the Common Locale Data Repository (CLDR) plural category of the count (zero, one, two, few, many, other). Requires an 'other' fallback. For English, just use 'one' and 'other'.\",schema:X(d.object({value:hn.describe(\"REF:#/$defs/DynamicNumber|The numeric value used to determine the plural category.\"),zero:fe.describe(\"REF:#/$defs/DynamicString|String for the 'zero' category (e.g., 0 items).\").optional(),one:fe.describe(\"REF:#/$defs/DynamicString|String for the 'one' category (e.g., 1 item).\").optional(),two:fe.describe(\"REF:#/$defs/DynamicString|String for the 'two' category (used in Arabic, Welsh, etc.).\").optional(),few:fe.describe(\"REF:#/$defs/DynamicString|String for the 'few' category (e.g., small groups in Slavic languages).\").optional(),many:fe.describe(\"REF:#/$defs/DynamicString|String for the 'many' category (e.g., large groups in various languages).\").optional(),other:fe.describe(\"REF:#/$defs/DynamicString|The default/fallback string (used for general plural cases).\")}),{closure:\"unevaluatedProperties\"})},rg={name:\"openUrl\",returnType:\"void\",description:\"Opens the specified URL in a browser or handler. This function has no return value.\",schema:X(d.object({url:X(d.string().describe(\"The URL to open.\"),{keywords:{format:\"uri\"}})}),{closure:\"additionalProperties\"})},ig={name:\"and\",returnType:\"boolean\",description:\"Performs a logical AND operation on a list of boolean values.\",schema:X(d.object({values:d.array(mn.describe(\"REF:#/$defs/DynamicBoolean\")).min(2).describe(\"The list of boolean values to evaluate.\")}),{closure:\"unevaluatedProperties\"})},og={name:\"or\",returnType:\"boolean\",description:\"Performs a logical OR operation on a list of boolean values.\",schema:X(d.object({values:d.array(mn.describe(\"REF:#/$defs/DynamicBoolean\")).min(2).describe(\"The list of boolean values to evaluate.\")}),{closure:\"unevaluatedProperties\"})},sg={name:\"not\",returnType:\"boolean\",description:\"Performs a logical NOT operation on a boolean value.\",schema:X(d.object({value:mn.describe(\"REF:#/$defs/DynamicBoolean|The boolean value to negate.\")}),{closure:\"unevaluatedProperties\"})};var ag=1e4,cg=1e3,XA=/^[+-]?(?:[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,bs=class n{parse(e,t=0){if(t>n.MAX_DEPTH)throw new de(\"Max recursion depth reached in parse\");if(e&&e.length>ag)throw new de(`Expression template length (${e.length}) exceeds maximum limit (${ag})`);if(!e)return[];if(!e.includes(\"${\"))return[e];let r=[],i=new ac(e);for(;!i.isAtEnd();){if(r.length>=cg)throw new de(`Expression parts count exceeds maximum limit (${cg})`);if(i.matches(\"${\")){i.advance(2);let o=this.extractInterpolationContent(i),s=this.parseExpression(o,t+1);s!==null&&r.push(s)}else if(i.peek()===\"\\\\\"&&i.peek(1)===\"$\"&&i.peek(2)===\"{\")i.advance(),r.push(\"${\"),i.advance(2);else{let o=i.pos;for(;!i.isAtEnd()&&!(i.matches(\"${\")||i.peek()===\"\\\\\"&&i.peek(1)===\"$\"&&i.peek(2)===\"{\");)i.advance();r.push(i.input.substring(o,i.pos))}}return r.filter(o=>o!==null&&o!==\"\")}extractInterpolationContent(e){let t=e.pos,r=1;for(;!e.isAtEnd()&&r>0;){let i=e.advance();if(i===\"{\")r++;else if(i===\"}\")r--;else if(i===\"'\"||i==='\"'){let o=i;for(;!e.isAtEnd();){let s=e.advance();if(s===\"\\\\\")e.advance();else if(s===o)break}}}if(r>0)throw new de(\"Unclosed interpolation: missing '}'\");return e.input.substring(t,e.pos-1)}parseExpression(e,t=0){if(e=e.trim(),!e)return\"\";let r=new ac(e),i=this.parseExpressionInternal(r,t);if(!r.isAtEnd())throw new de(`Unexpected characters at end of expression: '${r.input.substring(r.pos)}'`);return i}parseExpressionInternal(e,t){if(t>n.MAX_DEPTH)throw new de(\"Max recursion depth reached in parse\");if(e.skipWhitespace(),e.isAtEnd())return\"\";if(e.matches(\"${\")){e.advance(2);let i=this.extractInterpolationContent(e);return this.parseExpression(i,t+1)}if(e.matchesString(\"'\")||e.matchesString('\"'))return this.parseStringLiteral(e);if(this.isNumberStart(e))return this.parseNumberLiteral(e);if(e.matchesKeyword(\"true\"))return!0;if(e.matchesKeyword(\"false\"))return!1;if(e.matchesKeyword(\"null\"))return\"\";let r=this.scanPathOrIdentifier(e);return e.skipWhitespace(),e.peek()===\"(\"?this.parseFunctionCall(r,e,t):r?{path:r}:\"\"}scanPathOrIdentifier(e){let t=e.pos;for(;!e.isAtEnd();){let r=e.peek();if(kl(r)||r===\"/\"||r===\".\"||r===\"-\")e.advance();else break}return e.input.substring(t,e.pos)}parseFunctionCall(e,t,r){t.match(\"(\"),t.skipWhitespace();let i={};for(;!t.isAtEnd()&&t.peek()!==\")\";){let o=this.scanIdentifier(t);if(t.skipWhitespace(),!t.match(\":\"))throw new de(`Expected ':' after argument name '${o}' in function '${e}'`);t.skipWhitespace(),i[o]=this.parseExpressionInternal(t,r+1),t.skipWhitespace(),t.peek()===\",\"&&(t.advance(),t.skipWhitespace())}if(!t.match(\")\"))throw new de(`Expected ')' after function arguments for '${e}'`);return{call:e,args:i,returnType:\"any\"}}scanIdentifier(e){let t=e.pos;for(;!e.isAtEnd()&&kl(e.peek());)e.advance();return e.input.substring(t,e.pos)}parseStringLiteral(e){let t=e.advance(),r=\"\";for(;!e.isAtEnd();){let i=e.advance();if(i===\"\\\\\"){let o=e.advance();o===\"n\"?r+=`\n`:o===\"t\"?r+=\"\t\":o===\"r\"?r+=\"\\r\":r+=o}else{if(i===t)break;r+=i}}return r}isNumberStart(e){let t=0;return(e.peek()===\"-\"||e.peek()===\"+\")&&(t=1),this.isDigit(e.peek(t))?!0:e.peek(t)===\".\"&&this.isDigit(e.peek(t+1))}parseNumberLiteral(e){let t=e.pos;for((e.peek()===\"-\"||e.peek()===\"+\")&&e.advance();!e.isAtEnd()&&(this.isDigit(e.peek())||e.peek()===\".\");)e.advance();this.skipExponent(e);let r=e.input.substring(t,e.pos);if(!XA.test(r))throw new de(`Invalid number literal: '${r}'`);let i=Number(r);if(!Number.isFinite(i))throw new de(`Number literal is out of range: '${r}'`);return i===0?0:i}skipExponent(e){if(!(e.isAtEnd()||e.peek()!==\"e\"&&e.peek()!==\"E\"))for(e.advance(),!e.isAtEnd()&&(e.peek()===\"+\"||e.peek()===\"-\")&&e.advance();!e.isAtEnd()&&this.isDigit(e.peek());)e.advance()}isDigit(e){return e>=\"0\"&&e<=\"9\"}};bs.MAX_DEPTH=100;var QA=/^\\p{XID_Continue}$/u;function kl(n){return Array.from(n).length!==1?!1:QA.test(n)}var ac=class{constructor(e){this.input=e,this.pos=0}isAtEnd(){return this.pos>=this.input.length}peek(e=0){let t=this.pos+e;if(t>=this.input.length)return\"\\0\";let r=this.input.codePointAt(t);return r===void 0?\"\\0\":String.fromCodePoint(r)}advance(e){let t=e??(this.peek()===\"\\0\"?1:this.peek().length),r=this.input.substring(this.pos,this.pos+t);return this.pos+=t,r}match(e){return this.peek()===e?(this.advance(),!0):!1}matches(e){return!!this.input.startsWith(e,this.pos)}matchesString(e){return this.peek()===e}matchesKeyword(e){if(this.input.startsWith(e,this.pos)){let t=this.peek(e.length);if(!kl(t))return this.advance(e.length),!0}return!1}skipWhitespace(){for(;!this.isAtEnd()&&/\\s/.test(this.peek());)this.advance()}};var Oe=function(){return Oe=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Oe.apply(this,arguments)};function xe(n,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s=Object.create((typeof Iterator==\"function\"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol==\"function\"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(r)throw new TypeError(\"Generator is already executing.\");for(;s&&(s=0,u[0]&&(t=0)),t;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1],o=u;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(u);break}o[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(n,t)}catch(l){u=[6,l],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function ze(n){var e=typeof Symbol==\"function\"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length==\"number\")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?\"Object is not iterable.\":\"Symbol.iterator is not defined.\")}function q(n,e){var t=typeof Symbol==\"function\"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(s)throw s.error}}return o}function B(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return n.concat(o||Array.prototype.slice.call(e))}var bg={exports:{}};(function(n){(function(){var e=String.fromCodePoint||(function(){var i=String.fromCharCode,o=Math.floor;return function(){var a=16384,c=[],u,l,p=-1,f=arguments.length;if(!f)return\"\";for(var m=\"\";++p<f;){var g=Number(arguments[p]);if(!isFinite(g)||g<0||g>1114111||o(g)!=g)throw RangeError(\"Invalid code point: \"+g);g<=65535?c.push(g):(g-=65536,u=(g>>10)+55296,l=g%1024+56320,c.push(u,l)),(p+1==f||c.length>a)&&(m+=i.apply(null,c),c.length=0)}return m}})();function t(i,o,s){s||(s={});function a(y,_){return y.range[0]=_,y.raw=i.substring(_,y.range[1]),y}function c(y,_){return{type:\"anchor\",kind:y,range:[E-_,E],raw:i.substring(E-_,E)}}function u(y,_,A,C){return{type:\"value\",kind:y,codePoint:_,range:[A,C],raw:i.substring(A,C)}}function l(y,_,A,C){return C=C||0,u(y,_,E-(A.length+C),E)}function p(y){var _=y[0],A=_.charCodeAt(0);if(Ee){var C;if(_.length===1&&A>=55296&&A<=56319&&(C=Z().charCodeAt(0),C>=56320&&C<=57343))return E++,u(\"symbol\",(A-55296)*1024+C-56320+65536,E-2,E)}return u(\"symbol\",A,E-1,E)}function f(y,_,A){return{type:\"disjunction\",body:y,range:[_,A],raw:i.substring(_,A)}}function m(){return{type:\"dot\",range:[E-1,E],raw:\".\"}}function g(y){return{type:\"characterClassEscape\",value:y,range:[E-2,E],raw:i.substring(E-2,E)}}function h(y){var _=E-1-y.length;return{type:\"reference\",matchIndex:parseInt(y,10),range:[_,E],raw:i.substring(_,E)}}function b(y){var _=y.range[0]-3;return{type:\"reference\",name:y,range:[_,E],raw:i.substring(_,E)}}function v(y,_,A,C){return{type:\"group\",behavior:y,body:_,range:[A,C],raw:i.substring(A,C)}}function x(y,_,A,C,G){return C==null&&(A=E-1,C=E),{type:\"quantifier\",min:y,max:_,greedy:!0,body:null,symbol:G,range:[A,C],raw:i.substring(A,C)}}function $(y,_,A){return{type:\"alternative\",body:y,range:[_,A],raw:i.substring(_,A)}}function M(y,_,A,C){return{type:\"characterClass\",kind:y.kind,body:y.body,negative:_,range:[A,C],raw:i.substring(A,C)}}function w(y,_,A,C){return y.codePoint>_.codePoint&&ie(\"invalid range in character class\",y.raw+\"-\"+_.raw,A,C),{type:\"characterClassRange\",min:y,max:_,range:[A,C],raw:i.substring(A,C)}}function N(y,_,A){return{type:\"classStrings\",strings:y,range:[_,A],raw:i.substring(_,A)}}function L(y,_,A){return{type:\"classString\",characters:y,range:[_,A],raw:i.substring(_,A)}}function V(y){return y.type===\"alternative\"?y.body:[y]}function O(y){y=y||1,E+=y}function J(y){var _=i.substring(E,E+=y);return _}function Y(y){se(y)||ie(\"character\",y)}function se(y){var _=y.length;if(i.substring(E,E+_)===y)return O(_),y}function ae(y){if(i[E]===y)return E++,y}function Z(){return i[E]}function ne(y){return i[E]===y}function yt(y){var _=y.length;return i.substring(E,E+_)===y}function je(y){return i[E+1]===y}function pe(y){var _=i.substring(E),A=_.match(y);return A&&(E+=A[0].length),A}function ct(){var y=[],_=E;for(y.push(We());ae(\"|\");)y.push(We());return y.length===1?y[0]:f(y,_,E)}function We(){for(var y=[],_=E,A;A=ut();)y.push(A);return y.length===1?y[0]:$(y,_,E)}function ut(){if(E>=i.length||ne(\"|\")||ne(\")\"))return null;var y=_n(),_;if(y){var A=E;if(_=Lt()||!1,_){if(!Ee&&y.type===\"group\")return _.body=V(y),a(_,y.range[0]),_;E=A,ie(\"Expected atom\")}return y}var C=Qe();if(C||(A=E,_=Lt()||!1,_&&(E=A,ie(\"Expected atom\")),!Ee&&ae(\"{\")?C=p(\"{\"):ie(\"Expected atom\")),_=Lt()||!1,_){var G=C.type,he=C.behavior;return G===\"group\"&&(he===\"negativeLookbehind\"||he===\"lookbehind\")&&ie(\"Invalid quantifier\",\"\",_.range[0],_.range[1]),_.body=V(C),a(_,C.range[0]),_}return C}function St(y,_,A,C){var G=null,he=E;if(se(y))G=_;else if(se(A))G=C;else return!1;return me(G,he)}function me(y,_){var A=ct();A||ie(\"Expected disjunction\"),Y(\")\");var C=v(y,V(A),_,E);return y==\"normal\"&&Ni&&zn++,C}function _n(){switch(Z()){case\"^\":return O(),c(\"start\",1);case\"$\":return O(),c(\"end\",1);case\"\\\\\":{if(je(\"b\"))return O(2),c(\"boundary\",2);if(je(\"B\"))return O(2),c(\"not-boundary\",2);break}case\"(\":return St(\"(?=\",\"lookahead\",\"(?!\",\"negativeLookahead\");default:return}}function Lt(){var y,_=E,A,C,G;switch(Z()){case\"*\":O(),A=x(0,void 0,void 0,void 0,\"*\");break;case\"+\":O(),A=x(1,void 0,void 0,void 0,\"+\");break;case\"?\":O(),A=x(0,1,void 0,void 0,\"?\");break;case\"{\":(y=pe(/^\\{(\\d+)\\}/))?(C=parseInt(y[1],10),A=x(C,C,_,E)):(y=pe(/^\\{(\\d+),\\}/))?(C=parseInt(y[1],10),A=x(C,void 0,_,E)):(y=pe(/^\\{(\\d+),(\\d+)\\}/))&&(C=parseInt(y[1],10),G=parseInt(y[2],10),C>G&&ie(\"numbers out of order in {} quantifier\",\"\",_,E),A=x(C,G,_,E)),(C&&!Number.isSafeInteger(C)||G&&!Number.isSafeInteger(G))&&ie(\"iterations outside JS safe integer range in quantifier\",\"\",_,E)}return A&&ae(\"?\")&&(A.greedy=!1,A.range[1]+=1),A}function Qe(){var y;switch(y=Z()){case\".\":return O(),m();case\"\\\\\":{if(O(),y=xn(),!y){if(!Ee&&Z()==\"c\")return u(\"symbol\",92,E-1,E);ie(\"atomEscape\")}return y}case\"[\":return Bt();case\"(\":{if(s.lookbehind&&(y=St(\"(?<=\",\"lookbehind\",\"(?<!\",\"negativeLookbehind\")))return y;if(s.namedGroups&&se(\"(?<\")){var _=Te();Y(\">\");var A=me(\"normal\",_.range[0]-3);return A.name=_,A}else return s.modifiers&&yt(\"(?\")&&i[E+2]!=\":\"?Xt():St(\"(?:\",\"ignore\",\"(\",\"normal\")}case\"]\":case\"}\":if(!Ee)return O(),p(y);break;case\"^\":case\"$\":case\"*\":case\"+\":case\"?\":case\"{\":case\")\":case\"|\":break;default:return O(),p(y)}}function Xt(){function y(tt){for(var Ut=0;Ut<tt.length;){if(tt.indexOf(tt[Ut],Ut+1)!=-1)return!0;Ut++}return!1}var _=E;O(2);var A=pe(/^[sim]+/),C;ae(\"-\")&&Z()!==\":\"?(C=pe(/^[sim]+/),C||ie(\"Invalid flags for modifiers group\")):A||ie(\"Invalid flags for modifiers group\"),A=A?A[0]:\"\",C=C?C[0]:\"\";var G=A+C;(G.length>3||y(G))&&ie(\"flags cannot be duplicated for modifiers group\"),ae(\":\")||ie(\"Invalid flags for modifiers group\");var he=me(\"ignore\",_);return he.modifierFlags={enabling:A,disabling:C},he}function lt(y,_){if(_){var A,C;if(y.kind==\"unicodeEscape\"&&(A=y.codePoint)>=55296&&A<=56319&&ne(\"\\\\\")&&je(\"u\")){var G=E;E++;var he=et();he.kind==\"unicodeEscape\"&&(C=he.codePoint)>=56320&&C<=57343?(y.kind=\"unicodeCodePointEscape\",y.codePoint=(A-55296)*1024+C-56320+65536,y.range[1]=E,y.raw=i.substring(y.range[0],E)):E=G}}return y}function et(){return xn(!0)}function xn(y){var _,A=E,C;switch(C=Z()){case\"0\":case\"1\":case\"2\":case\"3\":case\"4\":case\"5\":case\"6\":case\"7\":case\"8\":case\"9\":return Qt(y);case\"B\":if(y){ie(\"\\\\B not possible inside of CharacterClass\",\"\",A);break}else return $t();case\"b\":return y?(O(),l(\"singleEscape\",8,\"\\\\b\")):$t();case\"c\":{if(y){if(!Ee&&(_=pe(/^c(\\d)/)))return l(\"controlLetter\",_[1]+16,_[1],2);if(!Ee&&se(\"c_\"))return l(\"controlLetter\",31,\"_\",2)}return Tt()}case\"d\":case\"D\":case\"w\":case\"W\":case\"s\":case\"S\":return O(),g(C);case\"k\":return Er()||$t();case\"p\":case\"P\":return en()||$t();case\"-\":return y&&Ee?(O(),l(\"singleEscape\",45,\"\\\\-\")):$t();default:return Tt()}}function Qt(y){var _,A,C=E;if(_=pe(/^(?!0)\\d+/)){A=_[0];var G=parseInt(_[0],10);if(G<=zn&&!y)return h(_[0]);if(To.push(G),Ni?Sr=!0:He(C,E),O(-_[0].length),_=pe(/^[0-7]{1,3}/))return l(\"octal\",parseInt(_[0],8),_[0],1);var he=E;return _=p(pe(/^[89]/)),a(_,he-1)}else if(_=pe(/^[0-7]{1,3}/))return A=_[0],A!==\"0\"&&He(C,E),/^0{1,3}$/.test(A)?l(\"null\",0,\"0\",A.length):l(\"octal\",parseInt(A,8),A,1);return!1}function He(y,_){Ee&&ie(\"Invalid decimal escape in unicode mode\",null,y,_)}function en(){var y,_=E;return s.unicodePropertyEscape&&Ee&&(y=pe(/^([pP])\\{([^}]+)\\}/))?{type:\"unicodePropertyEscape\",negative:y[1]===\"P\",value:y[2],range:[_-1,E],raw:i.substring(_-1,E)}:!1}function Er(){if(s.namedGroups&&pe(/^k<(?=.*?>)/)){var y=Te();return Y(\">\"),b(y)}}function tn(y){var _;if(_=pe(/^u([0-9a-fA-F]{4})/))return lt(l(\"unicodeEscape\",parseInt(_[1],16),_[1],2),y);if(y&&(_=pe(/^u\\{([0-9a-fA-F]+)\\}/)))return l(\"unicodeCodePointEscape\",parseInt(_[1],16),_[1],4)}function Tt(){var y,_=E;switch(Z()){case\"t\":return O(),l(\"singleEscape\",9,\"\\\\t\");case\"n\":return O(),l(\"singleEscape\",10,\"\\\\n\");case\"v\":return O(),l(\"singleEscape\",11,\"\\\\v\");case\"f\":return O(),l(\"singleEscape\",12,\"\\\\f\");case\"r\":return O(),l(\"singleEscape\",13,\"\\\\r\");case\"c\":if(y=pe(/^c([a-zA-Z])/))return l(\"controlLetter\",y[1].charCodeAt(0)%32,y[1],2);break;case\"x\":if(y=pe(/^x([0-9a-fA-F]{2})/))return l(\"hexadecimalEscape\",parseInt(y[1],16),y[1],2);break;case\"u\":if(y=tn(Ee))return(!y||y.codePoint>1114111)&&ie(\"Invalid escape sequence\",null,_,E),y;break}return $t()}function bt(y){var _=Z(),A=E;if(_===\"\\\\\"){O();var C=tn(!0);return(!C||!y(C.codePoint))&&ie(\"Invalid escape sequence\",null,A,E),e(C.codePoint)}var G=_.charCodeAt(0);if(G>=55296&&G<=56319){_+=i[E+1];var he=_.charCodeAt(1);he>=56320&&he<=57343&&(G=(G-55296)*1024+he-56320+65536)}if(y(G))return O(),G>65535&&O(),_}function Te(){var y=E,_=bt(De);_||ie(\"Invalid identifier\");for(var A;A=bt(kt);)_+=A;return{type:\"identifier\",value:_,range:[y,E],raw:i.substring(y,E)}}function De(y){var _=/[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088F\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5C\\u0C5D\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDC-\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C8A\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2118-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309B-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7DC\\uA7F1-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]|\\uD800[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDD40-\\uDD74\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDF00-\\uDF1F\\uDF2D-\\uDF4A\\uDF50-\\uDF75\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF\\uDFD1-\\uDFD5]|\\uD801[\\uDC00-\\uDC9D\\uDCB0-\\uDCD3\\uDCD8-\\uDCFB\\uDD00-\\uDD27\\uDD30-\\uDD63\\uDD70-\\uDD7A\\uDD7C-\\uDD8A\\uDD8C-\\uDD92\\uDD94\\uDD95\\uDD97-\\uDDA1\\uDDA3-\\uDDB1\\uDDB3-\\uDDB9\\uDDBB\\uDDBC\\uDDC0-\\uDDF3\\uDE00-\\uDF36\\uDF40-\\uDF55\\uDF60-\\uDF67\\uDF80-\\uDF85\\uDF87-\\uDFB0\\uDFB2-\\uDFBA]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC60-\\uDC76\\uDC80-\\uDC9E\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDD40-\\uDD59\\uDD80-\\uDDB7\\uDDBE\\uDDBF\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE35\\uDE60-\\uDE7C\\uDE80-\\uDE9C\\uDEC0-\\uDEC7\\uDEC9-\\uDEE4\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72\\uDF80-\\uDF91]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2\\uDD00-\\uDD23\\uDD4A-\\uDD65\\uDD6F-\\uDD85\\uDE80-\\uDEA9\\uDEB0\\uDEB1\\uDEC2-\\uDEC7\\uDF00-\\uDF1C\\uDF27\\uDF30-\\uDF45\\uDF70-\\uDF81\\uDFB0-\\uDFC4\\uDFE0-\\uDFF6]|\\uD804[\\uDC03-\\uDC37\\uDC71\\uDC72\\uDC75\\uDC83-\\uDCAF\\uDCD0-\\uDCE8\\uDD03-\\uDD26\\uDD44\\uDD47\\uDD50-\\uDD72\\uDD76\\uDD83-\\uDDB2\\uDDC1-\\uDDC4\\uDDDA\\uDDDC\\uDE00-\\uDE11\\uDE13-\\uDE2B\\uDE3F\\uDE40\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61\\uDF80-\\uDF89\\uDF8B\\uDF8E\\uDF90-\\uDFB5\\uDFB7\\uDFD1\\uDFD3]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC5F-\\uDC61\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDEB8\\uDF00-\\uDF1A\\uDF40-\\uDF46]|\\uD806[\\uDC00-\\uDC2B\\uDCA0-\\uDCDF\\uDCFF-\\uDD06\\uDD09\\uDD0C-\\uDD13\\uDD15\\uDD16\\uDD18-\\uDD2F\\uDD3F\\uDD41\\uDDA0-\\uDDA7\\uDDAA-\\uDDD0\\uDDE1\\uDDE3\\uDE00\\uDE0B-\\uDE32\\uDE3A\\uDE50\\uDE5C-\\uDE89\\uDE9D\\uDEB0-\\uDEF8\\uDFC0-\\uDFE0]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F\\uDD00-\\uDD06\\uDD08\\uDD09\\uDD0B-\\uDD30\\uDD46\\uDD60-\\uDD65\\uDD67\\uDD68\\uDD6A-\\uDD89\\uDD98\\uDDB0-\\uDDDB\\uDEE0-\\uDEF2\\uDF02\\uDF04-\\uDF10\\uDF12-\\uDF33\\uDFB0]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC00-\\uDC6E\\uDC80-\\uDD43]|\\uD80B[\\uDF90-\\uDFF0]|[\\uD80C\\uD80E\\uD80F\\uD81C-\\uD822\\uD840-\\uD868\\uD86A-\\uD86D\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD88C][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2F\\uDC41-\\uDC46\\uDC60-\\uDFFF]|\\uD810[\\uDC00-\\uDFFA]|\\uD811[\\uDC00-\\uDE46]|\\uD818[\\uDD00-\\uDD1D]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDE70-\\uDEBE\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF40-\\uDF43\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDD40-\\uDD6C\\uDE40-\\uDE7F\\uDEA0-\\uDEB8\\uDEBB-\\uDED3\\uDF00-\\uDF4A\\uDF50\\uDF93-\\uDF9F\\uDFE0\\uDFE1\\uDFE3\\uDFF2-\\uDFF6]|\\uD823[\\uDC00-\\uDCD5\\uDCFF-\\uDD1E\\uDD80-\\uDDF2]|\\uD82B[\\uDFF0-\\uDFF3\\uDFF5-\\uDFFB\\uDFFD\\uDFFE]|\\uD82C[\\uDC00-\\uDD22\\uDD32\\uDD50-\\uDD52\\uDD55\\uDD64-\\uDD67\\uDD70-\\uDEFB]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD1E-\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD52-\\uDEA5\\uDEA8-\\uDEC0\\uDEC2-\\uDEDA\\uDEDC-\\uDEFA\\uDEFC-\\uDF14\\uDF16-\\uDF34\\uDF36-\\uDF4E\\uDF50-\\uDF6E\\uDF70-\\uDF88\\uDF8A-\\uDFA8\\uDFAA-\\uDFC2\\uDFC4-\\uDFCB]|\\uD837[\\uDF00-\\uDF1E\\uDF25-\\uDF2A]|\\uD838[\\uDC30-\\uDC6D\\uDD00-\\uDD2C\\uDD37-\\uDD3D\\uDD4E\\uDE90-\\uDEAD\\uDEC0-\\uDEEB]|\\uD839[\\uDCD0-\\uDCEB\\uDDD0-\\uDDED\\uDDF0\\uDEC0-\\uDEDE\\uDEE0-\\uDEE2\\uDEE4\\uDEE5\\uDEE7-\\uDEED\\uDEF0-\\uDEF4\\uDEFE\\uDEFF\\uDFE0-\\uDFE6\\uDFE8-\\uDFEB\\uDFED\\uDFEE\\uDFF0-\\uDFFE]|\\uD83A[\\uDC00-\\uDCC4\\uDD00-\\uDD43\\uDD4B]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEAD\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0\\uDFF0-\\uDFFF]|\\uD87B[\\uDC00-\\uDE5D]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD88D[\\uDC00-\\uDC79]/;return y===36||y===95||y>=65&&y<=90||y>=97&&y<=122||y>=128&&_.test(e(y))}function kt(y){var _=/[\\xB7\\u0300-\\u036F\\u0387\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u0669\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u06F0-\\u06F9\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07C0-\\u07C9\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u0897-\\u089F\\u08CA-\\u08E1\\u08E3-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962\\u0963\\u0966-\\u096F\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u09E6-\\u09EF\\u09FE\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A66-\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2\\u0AE3\\u0AE6-\\u0AEF\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B55-\\u0B57\\u0B62\\u0B63\\u0B66-\\u0B6F\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C04\\u0C3C\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0CE6-\\u0CEF\\u0CF3\\u0D00-\\u0D03\\u0D3B\\u0D3C\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4D\\u0D57\\u0D62\\u0D63\\u0D66-\\u0D6F\\u0D81-\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0E50-\\u0E59\\u0EB1\\u0EB4-\\u0EBC\\u0EC8-\\u0ECE\\u0ED0-\\u0ED9\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102B-\\u103E\\u1040-\\u1049\\u1056-\\u1059\\u105E-\\u1060\\u1062-\\u1064\\u1067-\\u106D\\u1071-\\u1074\\u1082-\\u108D\\u108F-\\u109D\\u135D-\\u135F\\u1369-\\u1371\\u1712-\\u1715\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4-\\u17D3\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u180F-\\u1819\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u194F\\u19D0-\\u19DA\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AB0-\\u1ABD\\u1ABF-\\u1ADD\\u1AE0-\\u1AEB\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BB0-\\u1BB9\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1C40-\\u1C49\\u1C50-\\u1C59\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF4\\u1CF7-\\u1CF9\\u1DC0-\\u1DFF\\u200C\\u200D\\u203F\\u2040\\u2054\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\u30FB\\uA620-\\uA629\\uA66F\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA82C\\uA880\\uA881\\uA8B4-\\uA8C5\\uA8D0-\\uA8D9\\uA8E0-\\uA8F1\\uA8FF-\\uA909\\uA926-\\uA92D\\uA947-\\uA953\\uA980-\\uA983\\uA9B3-\\uA9C0\\uA9D0-\\uA9D9\\uA9E5\\uA9F0-\\uA9F9\\uAA29-\\uAA36\\uAA43\\uAA4C\\uAA4D\\uAA50-\\uAA59\\uAA7B-\\uAA7D\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5\\uAAF6\\uABE3-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF10-\\uFF19\\uFF3F\\uFF65]|\\uD800[\\uDDFD\\uDEE0\\uDF76-\\uDF7A]|\\uD801[\\uDCA0-\\uDCA9]|\\uD802[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F\\uDEE5\\uDEE6]|\\uD803[\\uDD24-\\uDD27\\uDD30-\\uDD39\\uDD40-\\uDD49\\uDD69-\\uDD6D\\uDEAB\\uDEAC\\uDEFA-\\uDEFF\\uDF46-\\uDF50\\uDF82-\\uDF85]|\\uD804[\\uDC00-\\uDC02\\uDC38-\\uDC46\\uDC66-\\uDC70\\uDC73\\uDC74\\uDC7F-\\uDC82\\uDCB0-\\uDCBA\\uDCC2\\uDCF0-\\uDCF9\\uDD00-\\uDD02\\uDD27-\\uDD34\\uDD36-\\uDD3F\\uDD45\\uDD46\\uDD73\\uDD80-\\uDD82\\uDDB3-\\uDDC0\\uDDC9-\\uDDCC\\uDDCE-\\uDDD9\\uDE2C-\\uDE37\\uDE3E\\uDE41\\uDEDF-\\uDEEA\\uDEF0-\\uDEF9\\uDF00-\\uDF03\\uDF3B\\uDF3C\\uDF3E-\\uDF44\\uDF47\\uDF48\\uDF4B-\\uDF4D\\uDF57\\uDF62\\uDF63\\uDF66-\\uDF6C\\uDF70-\\uDF74\\uDFB8-\\uDFC0\\uDFC2\\uDFC5\\uDFC7-\\uDFCA\\uDFCC-\\uDFD0\\uDFD2\\uDFE1\\uDFE2]|\\uD805[\\uDC35-\\uDC46\\uDC50-\\uDC59\\uDC5E\\uDCB0-\\uDCC3\\uDCD0-\\uDCD9\\uDDAF-\\uDDB5\\uDDB8-\\uDDC0\\uDDDC\\uDDDD\\uDE30-\\uDE40\\uDE50-\\uDE59\\uDEAB-\\uDEB7\\uDEC0-\\uDEC9\\uDED0-\\uDEE3\\uDF1D-\\uDF2B\\uDF30-\\uDF39]|\\uD806[\\uDC2C-\\uDC3A\\uDCE0-\\uDCE9\\uDD30-\\uDD35\\uDD37\\uDD38\\uDD3B-\\uDD3E\\uDD40\\uDD42\\uDD43\\uDD50-\\uDD59\\uDDD1-\\uDDD7\\uDDDA-\\uDDE0\\uDDE4\\uDE01-\\uDE0A\\uDE33-\\uDE39\\uDE3B-\\uDE3E\\uDE47\\uDE51-\\uDE5B\\uDE8A-\\uDE99\\uDF60-\\uDF67\\uDFF0-\\uDFF9]|\\uD807[\\uDC2F-\\uDC36\\uDC38-\\uDC3F\\uDC50-\\uDC59\\uDC92-\\uDCA7\\uDCA9-\\uDCB6\\uDD31-\\uDD36\\uDD3A\\uDD3C\\uDD3D\\uDD3F-\\uDD45\\uDD47\\uDD50-\\uDD59\\uDD8A-\\uDD8E\\uDD90\\uDD91\\uDD93-\\uDD97\\uDDA0-\\uDDA9\\uDDE0-\\uDDE9\\uDEF3-\\uDEF6\\uDF00\\uDF01\\uDF03\\uDF34-\\uDF3A\\uDF3E-\\uDF42\\uDF50-\\uDF5A]|\\uD80D[\\uDC40\\uDC47-\\uDC55]|\\uD818[\\uDD1E-\\uDD39]|\\uD81A[\\uDE60-\\uDE69\\uDEC0-\\uDEC9\\uDEF0-\\uDEF4\\uDF30-\\uDF36\\uDF50-\\uDF59]|\\uD81B[\\uDD70-\\uDD79\\uDF4F\\uDF51-\\uDF87\\uDF8F-\\uDF92\\uDFE4\\uDFF0\\uDFF1]|\\uD82F[\\uDC9D\\uDC9E]|\\uD833[\\uDCF0-\\uDCF9\\uDF00-\\uDF2D\\uDF30-\\uDF46]|\\uD834[\\uDD65-\\uDD69\\uDD6D-\\uDD72\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44]|\\uD835[\\uDFCE-\\uDFFF]|\\uD836[\\uDE00-\\uDE36\\uDE3B-\\uDE6C\\uDE75\\uDE84\\uDE9B-\\uDE9F\\uDEA1-\\uDEAF]|\\uD838[\\uDC00-\\uDC06\\uDC08-\\uDC18\\uDC1B-\\uDC21\\uDC23\\uDC24\\uDC26-\\uDC2A\\uDC8F\\uDD30-\\uDD36\\uDD40-\\uDD49\\uDEAE\\uDEEC-\\uDEF9]|\\uD839[\\uDCEC-\\uDCF9\\uDDEE\\uDDEF\\uDDF1-\\uDDFA\\uDEE3\\uDEE6\\uDEEE\\uDEEF\\uDEF5]|\\uD83A[\\uDCD0-\\uDCD6\\uDD44-\\uDD4A\\uDD50-\\uDD59]|\\uD83E[\\uDFF0-\\uDFF9]|\\uDB40[\\uDD00-\\uDDEF]/;return De(y)||y>=48&&y<=57||y>=128&&_.test(e(y))}function $t(){var y,_=Z();return Ee&&/[\\^$.*+?()\\\\[\\]{}|/]/.test(_)||!Ee&&_!==\"c\"?_===\"k\"&&s.lookbehind?null:(y=J(1),l(\"identifier\",y.charCodeAt(0),y,1)):null}function Bt(){var y,_=E;return(y=se(\"[^\"))?(y=It(),Y(\"]\"),M(y,!0,_,E)):ae(\"[\")?(y=It(),Y(\"]\"),M(y,!1,_,E)):null}function It(){var y;return ne(\"]\")?{kind:\"union\",body:[]}:kr?Ps():(y=Ns(),y||ie(\"nonEmptyClassRanges\"),{kind:\"union\",body:y})}function Pe(y){var _,A,C,G,he;if(ne(\"-\")&&!je(\"]\")){_=y.range[0],O(),he=p(\"-\"),G=Vt(),G||ie(\"classAtom\"),A=E;var tt=It();return tt||ie(\"classContents\"),!(\"codePoint\"in y)||!(\"codePoint\"in G)?Ee?ie(\"invalid character class\"):C=[y,he,G]:C=[w(y,G,_,A)],tt.type===\"empty\"?C:C.concat(tt.body)}return C=Ms(),C||ie(\"nonEmptyClassRangesNoDash\"),[y].concat(C)}function Ns(){var y=Vt();return y||ie(\"classAtom\"),ne(\"]\")?[y]:Pe(y)}function Ms(){var y=Vt();return y||ie(\"classAtom\"),ne(\"]\")?y:Pe(y)}function Vt(){return ae(\"-\")?p(\"-\"):js()}function js(){var y;switch(y=Z()){case\"\\\\\":{if(O(),y=et(),!y){if(!Ee&&Z()==\"c\")return p(\"\\\\\");ie(\"classEscape\")}return lt(y,Ee)}case\"]\":case\"-\":break;default:return O(),p(y)}}function Ps(){var y=[],_,A=Ii(!0);for(y.push(A),A.type===\"classRange\"?_=\"union\":ne(\"&\")?_=\"intersection\":ne(\"-\")?_=\"subtraction\":_=\"union\";!ne(\"]\");)_===\"intersection\"?(Y(\"&\"),Y(\"&\"),ne(\"&\")&&ie(\"&& cannot be followed by &. Wrap it in brackets: &&[&].\")):_===\"subtraction\"&&(Y(\"-\"),Y(\"-\")),A=Ii(_===\"union\"),y.push(A);return{kind:_,body:y}}function Ii(y){var _=E,A,C;if(ae(\"\\\\\")){if(se(\"q{\"))return Ls();if(C=et())A=C;else{if(C=So())return C;ie(\"Invalid escape\",\"\\\\\"+Z(),_)}}else if(C=Ri())A=C;else{if(C=Bt())return C;ie(\"Invalid character\",Z())}if(y&&ne(\"-\")&&!je(\"-\")){if(O(),C=Fi())return w(A,C,_,E);ie(\"Invalid range end\",Z())}return A}function Fi(){if(ae(\"\\\\\")){var y,_=E;if(y=So())return y;ie(\"Invalid escape\",\"\\\\\"+Z(),_)}return Ri()}function Ri(){var y;if(pe(/^(?:&&|!!|##|\\$\\$|%%|\\*\\*|\\+\\+|,,|\\.\\.|::|;;|<<|==|>>|\\?\\?|@@|\\^\\^|``|~~)/)&&ie(\"Invalid set operation in character class\"),y=pe(/^[^()[\\]{}/\\-\\\\|]/))return p(y)}function So(){var y;if(ae(\"b\"))return l(\"singleEscape\",8,\"\\\\b\");if(ae(\"B\"))ie(\"\\\\B not possible inside of ClassContents\",\"\",E-2);else return(y=pe(/^[&\\-!#%,:;<=>@`~]/))?l(\"identifier\",y[0].codePointAt(0),y[0]):(y=Tt())?y:null}function Ls(){var y=E-3,_=[];do _.push(Oi());while(ae(\"|\"));return Y(\"}\"),N(_,y,E)}function Oi(){for(var y=[],_=E,A;A=Fi();)y.push(A);return L(y,_,E)}function ie(y,_,A,C){A=A??E,C=C??A;var G=Math.max(0,A-10),he=Math.min(C+10,i.length),tt=\" \"+i.substring(G,he),Ut=\" \"+new Array(A-G+1).join(\" \")+\"^\";throw SyntaxError(y+\" at position \"+A+(_?\": \"+_:\"\")+`\n`+tt+`\n`+Ut)}var To=[],zn=0,Ni=!0,Sr=!1,Tr=(o||\"\").indexOf(\"u\")!==-1,kr=(o||\"\").indexOf(\"v\")!==-1,Ee=Tr||kr,E=0;if(kr&&!s.unicodeSet)throw new Error('The \"v\" flag is only supported when the .unicodeSet option is enabled.');if(Tr&&kr)throw new Error('The \"u\" and \"v\" flags are mutually exclusive.');i=String(i),i===\"\"&&(i=\"(?:)\");var qn=ct();return qn.range[1]!==i.length&&ie(\"Could not parse entire input - got stuck\",\"\",qn.range[1]),Sr=Sr||To.some(function(y){return y<=zn}),Sr?(E=0,Ni=!1,ct()):qn}var r={parse:t};n.exports?n.exports=r:window.regjsparser=r})()})(bg);var eC=bg.exports;function vg(n,e){var t=eC.parse(n,e?\"u\":\"\",{lookbehind:!0,unicodePropertyEscape:!0});return t}function $l(n){var e=n.length;return e?n[e-1]:null}function _g(n,e){var t;for(t=0;t<n.length&&t<e.length&&n[t]===e[t];t++);return{a:n.slice(t),b:e.slice(t)}}var ug=[\"lookahead\",\"lookbehind\",\"negativeLookahead\",\"negativeLookbehind\"];function tC(n,e,t,r){return\"\".concat(n.slice(0,t)).concat(e).concat(n.slice(r))}function lg(n){var e=n.after,t=n.offsets,r=n.shiftAmount;return new Set(B([],q(t),!1).map(function(i){return i>e?i+r:i}))}function nC(n){return n.symbol?\"\".concat(n.symbol).concat(n.greedy?\"\":\"?\"):n.min===n.max?\"{\".concat(n.min,\"}\"):\"{\".concat(n.min,\",\").concat(n.max||\"\",\"}\").concat(n.greedy?\"\":\"?\")}function xg(n){if(n.type!==\"alternative\")return!1;var e=n.body;if(e.length<1)return!1;var t=q(e,1),r=t[0];if(r.type!==\"quantifier\"||r.min!==0||r.max!==void 0||r.greedy)return!1;var i=r.body[0];return!(i.type!==\"characterClass\"||(i.kind,i.body.length!==0)||!i.negative)}function rC(n){if(xg(n))return!1;var e=function(t){var r,i;if(t.type===\"anchor\")return t.kind===\"start\"?\"anchor\":null;if(t.type===\"quantifier\"&&t.max===0)return null;if(t.type===\"alternative\"||t.type===\"group\"||t.type===\"quantifier\"){var o=t.type===\"quantifier\"&&t.min===0;try{for(var s=ze(t.body),a=s.next();!a.done;a=s.next()){var c=a.value,u=e(c);if(u===\"consumingNode\")return\"consumingNode\";if(u===\"anchor\")return o?null:\"anchor\"}}catch(l){r={error:l}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return null}if(t.type===\"disjunction\"){var u=t.body.map(function(p){return e(p)});return u.some(function(p){return p===\"consumingNode\"})?\"consumingNode\":u.every(function(p){return p===\"anchor\"})?\"anchor\":null}return\"consumingNode\"};return e(n)===\"consumingNode\"}function iC(n){var e=new Map,t=function(i,o){var s=function(c,u){var l=\"\";return c.forEach(function(p){l+=t(p,u+l.length)}),l};switch(i.type){case\"anchor\":case\"characterClass\":case\"characterClassEscape\":case\"unicodePropertyEscape\":case\"value\":case\"dot\":return i.raw;case\"reference\":return e.set(i,o),i.raw;case\"group\":switch(i.behavior){case\"normal\":return\"(?:\".concat(s(i.body,o+3),\")\");case\"ignore\":return\"(?:\".concat(s(i.body,o+3),\")\");case\"lookahead\":case\"lookbehind\":case\"negativeLookahead\":case\"negativeLookbehind\":return\"\"}case\"disjunction\":{var a=\"\";return i.body.forEach(function(c,u){u>0&&(a+=\"|\"),a+=t(c,o+a.length)}),a}case\"alternative\":return s(i.body,o);case\"quantifier\":return\"\".concat(t(i.body[0],o)).concat(nC(i))}},r=t(n,0);return{referencesWithOffset:e,result:r}}function oC(n){for(var e=n.pattern,t=n.unicode,r=function(c){var u=vg(c.pattern,t),l=[],p=!1,f=u.type===\"disjunction\",m=new Map,g=new Set,h=1,b=function(N,L){if(N.body.length!==1)return!1;var V=N.body[0];return V===L},v=function(N){var L=N.nodeStack,V=N.nodes,O=N.passedStartAnchor,J=N.serial,Y=null;V.forEach(function(se){J?(x({immediatelyPrecedingLookahead:Y,node:se,nodeStack:L,passedStartAnchor:O}),Y=se.type===\"group\"&&se.behavior===\"lookahead\"?se:null):x({immediatelyPrecedingLookahead:Y,node:se,nodeStack:L,passedStartAnchor:Oe({},O)})})},x=function(N){var L=N.immediatelyPrecedingLookahead,V=N.node,O=N.nodeStack,J=N.passedStartAnchor,Y=function(){J.value||(p=!0)};switch(V.type){case\"characterClass\":case\"characterClassEscape\":case\"unicodePropertyEscape\":case\"value\":case\"dot\":Y();return;case\"anchor\":{V.kind===\"start\"&&(J.value=!0);return}case\"group\":{var se=null;V.behavior===\"normal\"&&(se=h,h++),v({nodeStack:B(B([],q(O),!1),[V],!1),nodes:V.body,passedStartAnchor:J,serial:!0}),se!==null&&V.behavior===\"normal\"&&m.set(se,{group:V,stack:B([],q(O),!1)});return}case\"disjunction\":{v({nodeStack:B(B([],q(O),!1),[V],!1),nodes:V.body,passedStartAnchor:J,serial:!1});return}case\"alternative\":{v({nodeStack:B(B([],q(O),!1),[V],!1),nodes:V.body,passedStartAnchor:J,serial:!0});return}case\"quantifier\":{V.max!==0&&(V.max===void 0&&B([],q(O),!1).reverse().some(function(me){if(me.type===\"group\"){if(ug.indexOf(me.behavior)>=0)return!0;g.add(me)}return!1}),v({nodeStack:B(B([],q(O),!1),[V],!1),nodes:V.body,passedStartAnchor:V.min===0?Oe({},J):J,serial:!0}));return}case\"reference\":{Y();var ae=m.get(V.matchIndex);if(ae){var Z=ae.group,ne=ae.stack,yt=_g(ne,O).a,je=yt.flatMap(function(me){return me.type===\"group\"&&ug.indexOf(me.behavior)>=0?[me]:[]}),pe=yt.some(function(me){return me.type===\"disjunction\"||me.type===\"quantifier\"&&me.min===0}),ct=je.length>0,We=je.every(function(me){return me.behavior!==\"negativeLookahead\"&&me.behavior!==\"negativeLookbehind\"});if(We&&(ct||g.has(Z))){var ut=!!L&&b(L,Z),St=ct&&pe;l.push({atomicOrOptional:ut?\"atomic\":St?\"optional\":null,group:Z,reference:V})}}return}}};x({immediatelyPrecedingLookahead:null,node:u,nodeStack:[],passedStartAnchor:{value:!1}});var $=c.pattern,M=new Set(c.atomicGroupOffsets),w=!1;return B([],q(l),!1).sort(function(N,L){return L.reference.range[0]-N.reference.range[0]}).forEach(function(N){var L=N.atomicOrOptional,V=N.group,O=q(N.reference.range,2),J=O[0],Y=O[1],se=iC(V),ae=se.result,Z=se.referencesWithOffset;Z.size>0&&(w=!0);var ne=L===\"optional\"?\"(?:\".concat(ae,\"?)\"):ae;$=tC($,ne,J,Y);var yt=ne.length-(Y-J);M=lg({after:J,offsets:M,shiftAmount:yt}),L===\"atomic\"&&M.add(J),l.forEach(function(je){var pe=je.atomicOrOptional,ct=je.reference;if(pe===\"atomic\"){var We=Z.get(ct);We!==void 0&&M.add(J+We)}})}),p&&!xg(u)&&(f&&($=\"(?:\".concat($,\")\")),$=\"[^]*?\".concat($),M=lg({after:-1,offsets:M,shiftAmount:f?8:5})),{needToRerun:w,result:{atomicGroupOffsets:M,pattern:$}}},i={atomicGroupOffsets:new Set,pattern:e};;){var o=r(i),s=o.result,a=o.needToRerun;if(i=s,!a)break}return i}function sC(n){return new FinalizationRegistry(n)}var Rl=Symbol(\"fork\"),cc=Symbol(\"pendingResults\");function aC(n){var e=new Set,t=sC(function(o){e.delete(o)}),r=function(){var o=n.next();e.forEach(function(s){return s(o)})},i=function(o){var s,a=(s={},s[Rl]=function(){return i(this[cc])},s[cc]=o.slice(0),s.next=function(l){if(l!==void 0)throw new Error(\"`ForkableIterator` `next()` cannot take a value\");var p=this[cc];return p.length||r(),p.shift()},s),c=new WeakRef(a),u=function(l){var p=c.deref();p?.[cc].push(l)};return t.register(a,u),e.add(u),a};return i([])}function uc(n){if(!n||!n[Rl])throw new Error(\"The provided value was not a `ForkableIterator` from `buildForkableIterator()`\");return n[Rl]()}function cC(){return xe(this,function(n){return[2]})}function lo(n){return aC(n)}function uC(n){var e,t,r,i,o,s,a;return xe(this,function(c){switch(c.label){case 0:c.trys.push([0,6,7,8]),e=ze(n),t=e.next(),c.label=1;case 1:if(t.done)return[3,5];r=t.value,i=void 0,c.label=2;case 2:return(i=r.next()).done?[3,4]:[4,i.value];case 3:return c.sent(),[3,2];case 4:return t=e.next(),[3,1];case 5:return[3,8];case 6:return o=c.sent(),s={error:o},[3,8];case 7:try{t&&!t.done&&(a=e.return)&&a.call(e)}finally{if(s)throw s.error}return[7];case 8:return[2]}})}function xs(n){return xe(this,function(e){switch(e.label){case 0:return[5,ze(n)];case 1:return e.sent(),[2]}})}function dg(n,e){var t=[];return n[0]<e[0]&&t.push([n[0],Math.min(e[0]-1,n[1])]),n[1]>e[1]&&t.push([Math.max(e[1]+1,n[0]),n[1]]),t}function lC(n,e){var t=Math.max(n[0],e[0]),r=Math.min(n[1],e[1]);return t>r?null:[t,r]}function dC(n){for(var e=B([],q(n),!1).sort(function(c,u){return c-u}),t=[],r=0,i=0;i<e.length;i++){var o=e[r],s=e[i],a=i+1<e.length?e[i+1]:null;(a===null||a-o!==i-r+1)&&(t.push([o,s]),r=i+1)}return t}function Pl(n){for(var e=[],t=0;t<n.length+1;t++){var r=t-1>=0?n[t-1]:null,i=t<n.length?n[t]:null,o=r?r[1]+1:-1/0,s=i?i[0]-1:1/0;if(o-s!==1){if(o>s)throw new Error(\"Internal error: invalid ranges input\");e.push([o,s])}}return e}function Ll(n){return!n.rangesNegated&&!n.ranges.length&&!n.unicodePropertyEscapes.size}function Bl(n,e){var t,r,i,o,s,a;n.rangesNegated?e.rangesNegated?(a=!0,s=B(B([],q(n.ranges),!1),q(e.ranges),!1)):(a=!1,s=B([],q(e.ranges),!1),n.ranges.forEach(function(h){var b=[];s.forEach(function(v){b.push.apply(b,B([],q(dg(v,h)),!1))}),s=b})):e.rangesNegated?(a=!1,s=B([],q(n.ranges),!1),e.ranges.forEach(function(h){var b=[];s.forEach(function(v){b.push.apply(b,B([],q(dg(v,h)),!1))}),s=b})):(a=!1,s=[],n.ranges.forEach(function(h){e.ranges.forEach(function(b){var v=lC(h,b);v&&s.push(v)})}));var c=new Set(B(B([],q(n.unicodePropertyEscapes.keys()),!1),q(e.unicodePropertyEscapes.keys()),!1)),u=new Map;try{for(var l=ze(c),p=l.next();!p.done;p=l.next()){var f=p.value,m=(i=n.unicodePropertyEscapes.get(f))!==null&&i!==void 0?i:null,g=(o=e.unicodePropertyEscapes.get(f))!==null&&o!==void 0?o:null;m!==null&&g===null?u.set(f,m):m===null&&g!==null?u.set(f,g):m!==null&&g!==null&&m===g&&u.set(f,m)}}catch(h){t={error:h}}finally{try{p&&!p.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return{ranges:s,rangesNegated:a,unicodePropertyEscapes:u}}function fC(n){return xe(this,function(e){switch(e.label){case 0:return[4,{bounded:!1,offset:n,stack:[],subType:\"end\",type:Dt}];case 1:throw e.sent(),new Error(\"Internal error: should not be reading after end\")}})}function Ag(n,e){var t=function(r,i,o){var s,a,c,u,l,p;return o===void 0&&(o=0),xe(this,function(f){switch(f.label){case 0:s=0,f.label=1;case 1:return a=r(s,o),a!==\"stop\"?[3,2]:[2];case 2:return a!==\"fork\"?[3,4]:[4,{reader:function(){return cC()},subType:null,type:Ar}];case 3:f.sent(),f.label=4;case 4:c=!1,u=i(s),l=void 0,p=function(){var m,g,h,b;return xe(this,function(v){switch(v.label){case 0:switch(m=l.value,g=m.type,g){case Ar:return[3,1];case Dt:return[3,3]}return[3,5];case 1:return h=s,b=o,[4,{reader:function(){return t(function(x,$){return x===0?\"continue\":r(x+h,$)},function(x){return x===0?m.reader():i(x+h)},b)},subType:m.subType,type:Ar}];case 2:return v.sent(),[3,5];case 3:return m.subType!==\"null\"&&m.subType!==\"start\"&&m.subType!==\"end\"&&(c=!0),[4,m];case 4:return v.sent(),[3,5];case 5:return[2]}})},f.label=5;case 5:return(l=u.next()).done?[3,7]:[5,p()];case 6:return f.sent(),[3,5];case 7:o=c?0:o+1,f.label=8;case 8:return s++,[3,1];case 9:return[2]}})};return t(n,e)}function lc(n){var e=n.length;return Ag(function(t){return t<e?\"continue\":\"stop\"},function(t){return n[t]()})}function Ol(n){var e=n.caseInsensitive,t=n.dotAll,r=n.nodes;return lc(r.map(function(i){return function(){return _s({caseInsensitive:e,dotAll:t,node:i})}}))}function Nl(n,e){var t=function(r){var i,o;return xe(this,function(s){switch(s.label){case 0:o=function(){var a,c;return xe(this,function(u){switch(u.label){case 0:switch(a=i.value,c=a.type,c){case Ar:return[3,1];case Dt:return[3,3]}return[3,5];case 1:return[4,{reader:function(){return t(a.reader())},subType:a.subType,type:Ar}];case 2:return u.sent(),[3,5];case 3:return[4,e(a)];case 4:return u.sent(),[3,5];case 5:return[2]}})},s.label=1;case 1:return(i=r.next()).done?[3,3]:[5,o()];case 2:return s.sent(),[3,1];case 3:return[2]}})};return t(n)}function pC(n){return new Set(n.flatMap(function(e){return e.type===\"group\"?[e.group]:[]}))}function hC(n){var e,t,r=[];try{for(var i=ze(n),o=i.next();!o.done;o=i.next()){var s=o.value;if(s.type===\"group\"){var a=s.group,c=a.behavior;(c===\"lookbehind\"||c===\"negativeLookbehind\"||c===\"negativeLookahead\"||c===\"lookahead\")&&r.push(a)}}}catch(u){e={error:u}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return r}function mC(n){var e=n.caseInsensitive,t=n.dotAll,r=n.node;switch(r.behavior){case\"lookbehind\":case\"negativeLookbehind\":case\"lookahead\":case\"negativeLookahead\":return xs([{reader:function(){return lc([function(){return Nl(Ol({caseInsensitive:e,dotAll:t,nodes:r.body}),function(i){return Oe(Oe({},i),{stack:B([{group:r,type:\"group\"}],q(i.stack),!1)})})},function(){return fC(r.range[1])}])},subType:r.behavior,type:Ar}]);case\"ignore\":case\"normal\":return Nl(Ol({caseInsensitive:e,dotAll:t,nodes:r.body}),function(i){return Oe(Oe({},i),{stack:B([{group:r,type:\"group\"}],q(i.stack),!1)})})}}function fg(n){return xe(this,function(e){switch(e.label){case 0:return[4,{offset:n,stack:[],subType:\"null\",type:Dt}];case 1:return e.sent(),[2]}})}function vs(n,e){if(!n.has(e))throw new Error(\"Internal error: map missing key\");return n.get(e)}function gC(n,e){var t=n.some(function(r){if(r.type!==\"group\"||r.group.behavior!==\"normal\")return!1;var i=vs(e.capturingGroupToIndex,r.group),o=e.reachableReferences.some(function(s){return s.matchIndex===i});return o});return t?new Set:new Set(n.flatMap(function(r){return r.type===\"quantifier\"?[r]:[]}).filter(function(r){var i=r.iteration,o=r.quantifier;return i>=1&&i>=o.min}).map(function(r){var i=r.quantifier;return i}))}function yC(n){var e=new Map;return n.flatMap(function(t){return t.type===\"quantifier\"?[t]:[]}).forEach(function(t){var r=t.iteration,i=t.quantifier;return e.set(i,r)}),e}function bC(n){var e=n.caseInsensitive,t=n.dotAll,r=n.node,i=r.min,o=r.max,s=o===void 0?1/0:o;return lc([function(){return fg(r.body[0].range[0])},function(){return Ag(function(a,c){return c>1||a>=s?\"stop\":a>=i?\"fork\":\"continue\"},function(a){return Nl(lc(B(B([],q(a>0?[function(){return fg(r.body[0].range[0])}]:[]),!1),[function(){return _s({caseInsensitive:e,dotAll:t,node:r.body[0]})}],!1)),function(c){return Oe(Oe({},c),{stack:B([{iteration:a,quantifier:r,type:\"quantifier\"}],q(c.stack),!1)})})})}])}function vC(n){var e;return xe(this,function(t){switch(t.label){case 0:switch(e=n.kind,e){case\"end\":return[3,1];case\"start\":return[3,3];case\"boundary\":return[3,5];case\"not-boundary\":return[3,5]}return[3,6];case 1:return[4,{bounded:!0,offset:n.range[0],stack:[],subType:\"end\",type:Dt}];case 2:throw t.sent(),new Error(\"Internal error: should not be reading after end\");case 3:return[4,{offset:n.range[0],stack:[],subType:\"start\",type:Dt}];case 4:return t.sent(),[3,6];case 5:return[3,6];case 6:return[2]}})}var Cg=[[48,57]],_C=Pl(Cg),Dg=[[48,57],[65,90],[95,95],[97,122]],xC=Pl(Dg),wg=[[9,9],[10,10],[11,11],[12,12],[13,13],[32,32],[160,160],[5760,5760],[8192,8202],[8232,8233],[8239,8239],[8287,8287],[12288,12288],[65279,65279]],AC=Pl(wg);function Eg(n){switch(n){case\"d\":case\"D\":return n===\"d\"?Cg:_C;case\"w\":case\"W\":return n===\"w\"?Dg:xC;case\"s\":case\"S\":return n===\"s\"?wg:AC}}function CC(n){var e,t;return xe(this,function(r){switch(r.label){case 0:return e=n.value,t=Eg(e),[4,{characterGroups:{ranges:t,rangesNegated:!1,unicodePropertyEscapes:new Map},node:n,stack:[],subType:\"groups\",type:Dt}];case 1:return r.sent(),[2]}})}function DC(n){if(n.length>1)return null;var e=n.codePointAt(0);if(!e)throw new Error(\"Internal error: expected codepoint\");return e}function Sg(n){var e=String.fromCodePoint(n).toUpperCase(),t=DC(e);return t!==null?t:n}function wC(n){var e=n.caseInsensitive,t=n.highCodePoint,r=n.lowCodePoint;if(!e)return[[r,t]];for(var i=new Set,o=r;o<=t;o++)i.add(Sg(o));return dC(i)}function Tg(n){var e=n.caseInsensitive,t=n.value,r=t.codePoint;return e?Sg(r):r}function EC(n){var e=n.caseInsensitive,t=n.node,r=Tg({caseInsensitive:e,value:t});return xs([{characterGroups:{ranges:[[r,r]],rangesNegated:!1,unicodePropertyEscapes:new Map},node:t,stack:[],subType:\"groups\",type:Dt}])}function SC(n){var e,t,r=n.caseInsensitive,i=n.node,o=[],s=new Map,a=!1;try{e:for(var c=ze(i.body),u=c.next();!u.done;u=c.next()){var l=u.value;switch(l.type){case\"value\":{var p=Tg({caseInsensitive:r,value:l});o.push([p,p]);break}case\"characterClassRange\":{o.push.apply(o,B([],q(wC({caseInsensitive:r,highCodePoint:l.max.codePoint,lowCodePoint:l.min.codePoint})),!1));break}case\"characterClassEscape\":{var f=l.value;o.push.apply(o,B([],q(Eg(f)),!1));break}case\"unicodePropertyEscape\":{var m=l.negative!==i.negative;if(s.get(l.value)===!m){a=!0;break e}s.set(l.value,m);break}}}}catch(g){e={error:g}}finally{try{u&&!u.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}return xs([{characterGroups:a?{ranges:[],rangesNegated:!0,unicodePropertyEscapes:new Map}:{ranges:o,rangesNegated:i.negative,unicodePropertyEscapes:s},node:i,stack:[],subType:\"groups\",type:Dt}])}function TC(n){var e=n.caseInsensitive,t=n.dotAll,r=n.node;return uC([xs(r.body.slice(0,-1).map(function(i){return{reader:function(){return _s({caseInsensitive:e,dotAll:t,node:i})},subType:null,type:Ar}})),_s({caseInsensitive:e,dotAll:t,node:r.body[r.body.length-1]})])}function kC(n){var e=n.dotAll,t=n.node;return xe(this,function(r){switch(r.label){case 0:return[4,{characterGroups:{ranges:e?[]:[[10,10],[13,13],[8232,8233]],rangesNegated:!0,unicodePropertyEscapes:new Map},node:t,stack:[],subType:\"groups\",type:Dt}];case 1:return r.sent(),[2]}})}function $C(n){return xe(this,function(e){switch(e.label){case 0:return[4,{node:n,referenceIndex:n.matchIndex,stack:[],subType:\"reference\",type:Dt}];case 1:return e.sent(),[2]}})}function IC(n){return xs([{characterGroups:{ranges:[],rangesNegated:!1,unicodePropertyEscapes:new Map([[n.value,n.negative]])},node:n,stack:[],subType:\"groups\",type:Dt}])}var Dt=Symbol(\"characterReaderTypeCharacterEntry\"),Ar=Symbol(\"characterReaderTypeSplit\");function _s(n){var e=n.caseInsensitive,t=n.dotAll,r=n.node;switch(r.type){case\"anchor\":return vC(r);case\"characterClass\":return SC({caseInsensitive:e,node:r});case\"characterClassEscape\":return CC(r);case\"unicodePropertyEscape\":return IC(r);case\"reference\":return $C(r);case\"value\":return EC({caseInsensitive:e,node:r});case\"dot\":return kC({dotAll:t,node:r});case\"alternative\":return Ol({caseInsensitive:e,dotAll:t,nodes:r.body});case\"disjunction\":return TC({caseInsensitive:e,dotAll:t,node:r});case\"group\":return mC({caseInsensitive:e,dotAll:t,node:r});case\"quantifier\":return bC({caseInsensitive:e,dotAll:t,node:r})}}var kg=Symbol(\"characterReaderLevel2TypeSplit\"),Ml=Symbol(\"characterReaderLevel1TypeEntry\");function FC(n){var e=n.caseInsensitive,t=n.dotAll,r=n.node,i=function(o,s){var a,c,u;return xe(this,function(l){switch(l.label){case 0:c=function(){var p,f,m,g;return xe(this,function(h){switch(h.label){case 0:switch(p=a.value.type,p){case Dt:return[3,1];case Ar:return[3,10]}return[3,12];case 1:switch(f=a.value.subType,f){case\"groups\":return[3,2];case\"reference\":return[3,4];case\"end\":return[3,6];case\"null\":return[3,7];case\"start\":return[3,8]}return[3,9];case 2:return[4,{characterGroups:a.value.characterGroups,node:a.value.node,precedingZeroWidthEntries:s,stack:a.value.stack,subType:\"groups\",type:Ml}];case 3:return h.sent(),s=[],[3,9];case 4:return[4,{node:a.value.node,precedingZeroWidthEntries:s,referenceIndex:a.value.referenceIndex,stack:a.value.stack,subType:a.value.subType,type:Ml}];case 5:return h.sent(),s=[],[3,9];case 6:return[2,{value:{bounded:a.value.bounded,precedingZeroWidthEntries:s}}];case 7:return s=B(B([],q(s),!1),[{offset:a.value.offset,stack:a.value.stack,type:\"null\"}],!1),[3,9];case 8:return s=B(B([],q(s),!1),[{offset:a.value.offset,stack:a.value.stack,type:\"start\"}],!1),[3,9];case 9:return[3,12];case 10:return m=a.value,g=s,[4,{reader:function(){return i(m.reader(),g)},subType:m.subType,type:kg}];case 11:return h.sent(),[3,12];case 12:return[2]}})},l.label=1;case 1:return(a=o.next()).done?[3,3]:[5,c()];case 2:return u=l.sent(),typeof u==\"object\"?[2,u.value]:[3,1];case 3:return[2,{bounded:!1,precedingZeroWidthEntries:s}]}})};return i(_s({caseInsensitive:e,dotAll:t,node:r}),[])}var Vl=Symbol(\"characterReaderLevel2TypeSplit\"),dc=Symbol(\"characterReaderLevel2TypeEntry\"),$g=Symbol(\"internalReaderTypeSplit\"),Ul=Symbol(\"internalReaderTypeEntry\");function Ig(n){var e,t;return xe(this,function(r){switch(r.label){case 0:t=function(){var i,o;return xe(this,function(s){switch(s.label){case 0:switch(i=e.value,o=i.type,o){case kg:return[3,1];case Ml:return[3,3]}return[3,5];case 1:return[4,{reader:function(){return Ig(i.reader())},subType:i.subType,type:$g}];case 2:return s.sent(),[3,5];case 3:return[4,Oe(Oe({},i),{type:Ul})];case 4:return s.sent(),[3,5];case 5:return[2]}})},r.label=1;case 1:return(e=n.next()).done?[3,3]:[5,t()];case 2:return r.sent(),[3,1];case 3:return[2,e.value]}})}function RC(n,e){var t,r;try{for(var i=ze(e),o=i.next();!o.done;o=i.next()){var s=q(o.value,2),a=s[0],c=s[1],u=n.get(a)||0;if(c-u>1)return!0}}catch(l){t={error:l}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return!1}function OC(n){var e,t,r,i,o,s,a,c,u,l=n.groupContentsStore,p=n.groups,f=n.groupsWithInfiniteSize,m=n.nodeExtra,g=n.value;return xe(this,function(h){switch(h.label){case 0:if(e=vs(m.indexToCapturingGroup,g.referenceIndex),t=l.get(g.referenceIndex)||{contents:[],group:e},r=_g(vs(m.nodeToLookaheadStack,t.group),vs(m.nodeToLookaheadStack,g.node)).a,r.length){if(r.some(function(b){var v=b.behavior;return v===\"negativeLookahead\"||v===\"negativeLookbehind\"}))return[2,{bounded:!1,precedingZeroWidthEntries:[]}];throw new Error(\"Unsupported reference (\".concat(g.referenceIndex,\" at position \").concat(g.node.range[0],\"). Pattern needs downgrading. See the `downgradePattern` option.\"))}if(p.has(t.group))return[2,{bounded:!1,precedingZeroWidthEntries:[]}];if(f.has(g.referenceIndex))throw new Error(\"Unsupported reference to group \".concat(g.referenceIndex,\" as group is not a finite size. Pattern needs downgrading. See the `downgradePattern` option.\"));h.label=1;case 1:h.trys.push([1,6,7,8]),i=ze(t.contents),o=i.next(),h.label=2;case 2:return o.done?[3,5]:(s=o.value,[4,{characterGroups:s.characterGroups,node:s.node,precedingZeroWidthEntries:s.precedingZeroWidthEntries,stack:B(B(B([],q(s.stack),!1),[{reference:g.node,type:\"reference\"}],!1),q(g.stack),!1),subType:\"groups\",type:Ul}]);case 3:h.sent(),h.label=4;case 4:return o=i.next(),[3,2];case 5:return[3,8];case 6:return a=h.sent(),c={error:a},[3,8];case 7:try{o&&!o.done&&(u=i.return)&&u.call(i)}finally{if(c)throw c.error}return[7];case 8:return[2,{bounded:!1,precedingZeroWidthEntries:[]}]}})}function pg(n){var e=n.caseInsensitive,t=n.dotAll,r=n.node,i=n.nodeExtra,o=function(s){var a,c;return xe(this,function(u){switch(u.label){case 0:a=function(){var l,p,f,m,g,h,b,v,x,$,M,w,N,L,V,O,J,Y,se,ae,Z,ne,yt,je,pe,ct,We,ut,St,me,_n,Lt,Qe,Xt,lt,et,xn,Qt,He,en,Er,tn,Tt;return xe(this,function(bt){switch(bt.label){case 0:if(l=s.precedingZeroWidthEntries,p=s.groupsWithInfiniteSize,f=s.groupContentsStore,m=s.quantifierIterationsAtLastGroup,g=s.characterReader,h=s.referenceCharacterReaderWithReference,b=h?.reader||g,v=b.next(),v.done){if(h){if(v.value.bounded)throw new Error(\"Internal error: end of reference reader cannot be bounded\");return s={characterReader:g,groupContentsStore:f,groupsWithInfiniteSize:p,precedingZeroWidthEntries:B(B([],q(l),!1),q(v.value.precedingZeroWidthEntries),!1),quantifierIterationsAtLastGroup:m,referenceCharacterReaderWithReference:null},[2,\"continue-outer\"]}return[2,{value:{bounded:v.value.bounded,precedingZeroWidthEntries:B(B([],q(l),!1),q(v.value.precedingZeroWidthEntries),!1),type:\"end\"}}]}switch(x=v.value,$=x.type,$){case $g:return[3,1];case Ul:return[3,3]}return[3,7];case 1:if(h)throw new Error(\"Internal error: should not be seeing a split from a reference reader\");return M=f,w=m,N=p,L=l,[4,{reader:function(){return o({characterReader:lo(x.reader()),groupContentsStore:M,groupsWithInfiniteSize:N,precedingZeroWidthEntries:L,quantifierIterationsAtLastGroup:w,referenceCharacterReaderWithReference:h})},subType:x.subType,type:Vl}];case 2:return bt.sent(),[3,7];case 3:switch(l=B(B([],q(l),!1),q(x.precedingZeroWidthEntries),!1),V=yC(x.stack),O=hC(x.stack),J=pC(x.stack),Y=x.subType,Y){case\"reference\":return[3,4];case\"groups\":return[3,5]}return[3,7];case 4:{if(h)throw new Error(\"Internal error: should not be seeing a reference from a reference reader\");return RC(m,V)?[2,{value:{type:\"abort\"}}]:(se=lo(OC({groupContentsStore:f,groups:J,groupsWithInfiniteSize:p,nodeExtra:i,value:x})),s={characterReader:g,groupContentsStore:f,groupsWithInfiniteSize:p,precedingZeroWidthEntries:l,quantifierIterationsAtLastGroup:m,referenceCharacterReaderWithReference:{reader:se,reference:x.node}},[3,7])}case 5:if(ae=new Map(f),!h)try{for(Z=(Qt=void 0,ze(f)),ne=Z.next();!ne.done;ne=Z.next()){yt=q(ne.value,2),je=yt[0],pe=yt[1].group,ct=B(B([],q(l.map(function(Te){var De=Te.offset;return De})),!1),[x.node.range[0]],!1);try{for(We=(en=void 0,ze(ct)),ut=We.next();!ut.done;ut=We.next())if(St=ut.value,pe.range[0]>=St){ae.delete(je);break}}catch(Te){en={error:Te}}finally{try{ut&&!ut.done&&(Er=We.return)&&Er.call(We)}finally{if(en)throw en.error}}}}catch(Te){Qt={error:Te}}finally{try{ne&&!ne.done&&(He=Z.return)&&He.call(Z)}finally{if(Qt)throw Qt.error}}me=!1,_n=B([],q(x.stack),!1).reverse(),Lt=_n.findIndex(function(Te){var De=Te.type;return De===\"reference\"}),Qe=_n.slice(0,Lt>=0?Lt:x.stack.length),Xt=function(Te){if(Te.type===\"quantifier\"&&Te.quantifier.max===void 0)return me=!0,\"continue\";if(Te.type!==\"group\")return\"continue\";var De=Te.group;if(De.behavior===\"lookbehind\"||De.behavior===\"negativeLookbehind\"||De.behavior===\"negativeLookahead\"||De.behavior===\"lookahead\")return me=!1,\"continue\";if(De.behavior!==\"normal\")return\"continue\";var kt=vs(i.capturingGroupToIndex,De);if(me){var $t=new Set(p);$t.add(kt),p=$t}var Bt=ae.get(kt)||{contents:[],group:De};ae.set(kt,Oe(Oe({},Bt),{contents:B(B([],q(Bt.contents),!1),[Oe(Oe({},x),{precedingZeroWidthEntries:l.filter(function(It){var Pe=It.offset;return Pe>=De.range[0]&&Pe<=De.range[1]})})],!1)}))};try{for(lt=(tn=void 0,ze(Qe)),et=lt.next();!et.done;et=lt.next())xn=et.value,Xt(xn)}catch(Te){tn={error:Te}}finally{try{et&&!et.done&&(Tt=lt.return)&&Tt.call(lt)}finally{if(tn)throw tn.error}}return f=ae,m=V,[4,{characterGroups:x.characterGroups,groups:J,lookaheadStack:O,node:x.node,precedingZeroWidthEntries:l,stack:x.stack,type:dc}];case 6:return bt.sent(),l=[],s={characterReader:g,groupContentsStore:f,groupsWithInfiniteSize:p,precedingZeroWidthEntries:l,quantifierIterationsAtLastGroup:m,referenceCharacterReaderWithReference:h},[3,7];case 7:return[2]}})},u.label=1;case 1:return[5,a()];case 2:if(c=u.sent(),typeof c==\"object\")return[2,c.value];if(c===\"continue-outer\")return[3,3];u.label=3;case 3:return[3,1];case 4:return[2]}})};return o({characterReader:lo(Ig(FC({caseInsensitive:e,dotAll:t,node:r}))),groupContentsStore:new Map,groupsWithInfiniteSize:new Set,precedingZeroWidthEntries:[],quantifierIterationsAtLastGroup:new Map,referenceCharacterReaderWithReference:null})}var NC=(function(){function n(e,t){this._history=[],this._isEqual=e,t&&(this._history=B([],q(t.getHistory()),!1))}return n.prototype._isEntryEqual=function(e,t){return this._isEqual(e.left,t.left)&&this._isEqual(e.right,t.right)},n.prototype.append=function(e){this._history.push(e)},n.prototype.clone=function(){return new n(this._isEqual,this)},n.prototype.getHistory=function(){return B([],q(this._history),!1)},n.prototype.getRepeatingEntries=function(){var e=this._history.length;e:for(var t=1;t<=e/2;t++){for(var r=e-t*2,i=0;i<t;i++)if(!this._isEntryEqual(this._history[r+i],this._history[r+t+i]))continue e;return this._history.slice(r,r+t)}return null},n})();function bn(n){var e=!1,t;return function(){return e||(e=!0,t=n()),t}}var jl=Symbol(\"isUnboundedReaderTypeStep\"),MC={ranges:[[10,10],[13,13],[8232,8233]],rangesNegated:!0,unicodePropertyEscapes:new Map};function hg(n){var e,t,r,i,o=n.multiLine,s=n.reader;return xe(this,function(a){switch(a.label){case 0:e=uc(s),t=[{get:bn(function(){return e.next()}),reader:e}],r=function(){var c,u,l,p,f;return xe(this,function(m){switch(m.label){case 0:return c=t.pop(),c?[4,{type:jl}]:[2,\"break\"];case 1:if(m.sent(),u=c.get(),u.done){if(u.value.type===\"end\"&&!u.value.bounded)return[2,{value:!0}]}else switch(u.value.type){case Vl:{l=u.value,t.push({get:bn(function(){return c.reader.next()}),reader:c.reader}),l.subType===null&&(p=l.reader(),t.push({get:bn(function(){return p.next()}),reader:p}));break}case dc:{o&&(f=Ll(Bl(MC,u.value.characterGroups)),f&&t.push({get:bn(function(){return c.reader.next()}),reader:c.reader}));break}}return[2]}})},a.label=1;case 1:return[5,r()];case 2:if(i=a.sent(),typeof i==\"object\")return[2,i.value];if(i===\"break\")return[3,4];a.label=3;case 3:return[3,1];case 4:return[2,!1]}})}function jC(n,e){return new Set(B(B([],q(n),!1),q(e),!1))}function PC(n,e){return n.size===e.size&&jC(n,e).size===n.size}var Fg=Symbol(\"checkerReaderTypeTrail\");function LC(n,e){return n===e}function uo(n,e){return n.map(function(t){switch(t.type){case\"quantifier\":return\"q:\".concat(t.quantifier.range[0],\":\").concat(e&&t.quantifier.max===void 0&&t.iteration>=t.quantifier.min?\"*\":\"\".concat(t.iteration));case\"reference\":return\"r:\".concat(t.reference.range[0]);case\"group\":return\"g:\".concat(t.group.range[0])}}).filter(Boolean).join(\",\")}function Il(n,e){for(var t=new Set,r=0;r<n.length;r++){var i=n[r];i.type===\"group\"&&e.has(i.group.range[0])&&t.add(uo(n.slice(0,r+1),!1))}return t}function BC(n){return[n.type,n.offset,uo(n.stack,!1)].join(\":\")}function mg(n,e){return B(B([],q(n.precedingZeroWidthEntries.map(function(t){return{hash:[\"zw\",BC(t)].join(\":\"),stack:t.stack}})),!1),[{hash:[\"s\",e].join(\":\"),stack:n.stack}],!1)}function co(n,e){return n.hash===e.hash}function VC(n){var e,t,r,i,o,s,a,c,u,l,p,f,m,g,h,b,v,x;return xe(this,function($){switch($.label){case 0:e=new Set,t=new Set,r=new Map,i=0,o=Date.now()+n.timeout,s=!1,a=!1,c=lo(n.leftStreamReader),u=lo(n.rightStreamReader),l=[{infiniteLoopTracker:new NC(LC),streamReadersWithGetters:[{get:bn(function(){return c.next()}),reader:c},{get:bn(function(){return u.next()}),reader:u}],trail:[]}],p=function(){var M,w,N,L,V,O,He,J,Y,se,ae,Z,ne,yt,je,pe,ct,We,ut,St,me,_n,Lt,Qe,Xt,lt,et,xn,Qt,He,en,Er,tn,Tt,bt,Pe,Te,De,kt,Pe,$t,Bt,It,Pe,Ns,Ms,Vt,js,Ps,Ii,Fi,Ri,So,Ls,Oi,ie,To,zn,Ni,Sr,Tr,kr,Ee,E,qn,y;return xe(this,function(_){switch(_.label){case 0:if(s=Date.now()>o,s||i>n.maxSteps)return[2,\"break\"];if(M=l.pop(),!M)return[2,\"break\"];for(w=M.streamReadersWithGetters,N=M.infiniteLoopTracker,L=M.trail,V=[],O=function(A){i+=.5;var C=w[A].get();if(!C.done&&C.value.type===Vl){var G=C.value;l.push({infiniteLoopTracker:N,streamReadersWithGetters:w.map(function(tt,Ut){var Bs=tt.reader,Bc=tt.get;return{get:Ut===A?bn(function(){return Bs.next()}):Bc,reader:Bs}}),trail:L});var he=w.map(function(tt,Ut){var Bs=tt.reader,Bc=tt.get,kd=Ut===A?lo(G.reader()):uc(Bs);return{get:Ut<A?Bc:bn(function(){return kd.next()}),reader:kd}});return l.push({infiniteLoopTracker:N.clone(),streamReadersWithGetters:he,trail:L}),\"continue-outer\"}else V.push(C)},He=0;He<w.length;He++)if(J=O(He),J===\"continue-outer\")return[2,J];if(Y=q(V,2),se=Y[0],ae=Y[1],i>n.maxSteps||se.done||ae.done)return[2,\"continue\"];if(se.value.type!==dc||ae.value.type!==dc)throw new Error(\"Internal error: impossible leftValue/rightValue type\");if(Z=se.value,ne=ae.value,yt=Z.precedingZeroWidthEntries.some(function(A){var C=A.type;return C===\"start\"}),je=ne.precedingZeroWidthEntries.some(function(A){var C=A.type;return C===\"start\"}),pe=yt||je,L.length>0&&pe)return[2,\"continue\"];if(ct=$l(Z.lookaheadStack),We=$l(ne.lookaheadStack),ct!==We)return[2,\"continue\"];if(ut=Bl(Z.characterGroups,ne.characterGroups),Ll(ut))return[2,\"continue\"];if(St=uo(Z.stack,!1),me=uo(ne.stack,!1),_n=[Z.node.range[0],St].join(\":\"),Lt=[ne.node.range[0],me].join(\":\"),Qe=$l(L),Xt=new Set(Qe?.left.atomicGroupsEnteredTogether),lt=new Set(Qe?.right.atomicGroupsEnteredTogether),et=!!Qe?.diverged,!et)for(xn=mg(Z,_n),Qt=mg(ne,Lt),He=0;He<Math.min(xn.length,Qt.length);He++){if(en=xn[He],Er=Qt[He],en.hash!==Er.hash){et=!0;break}tn=Il(en.stack,n.atomicGroupOffsets);try{for(Tt=(Tr=void 0,ze(tn)),bt=Tt.next();!bt.done;bt=Tt.next())Pe=bt.value,Xt.add(Pe),lt.add(Pe)}catch(A){Tr={error:A}}finally{try{bt&&!bt.done&&(kr=Tt.return)&&kr.call(Tt)}finally{if(Tr)throw Tr.error}}}Te=Il(Z.stack,n.atomicGroupOffsets);try{for(De=(Ee=void 0,ze(Xt)),kt=De.next();!kt.done;kt=De.next())Pe=kt.value,Te.has(Pe)||Xt.delete(Pe)}catch(A){Ee={error:A}}finally{try{kt&&!kt.done&&(E=De.return)&&E.call(De)}finally{if(Ee)throw Ee.error}}$t=Il(ne.stack,n.atomicGroupOffsets);try{for(Bt=(qn=void 0,ze(lt)),It=Bt.next();!It.done;It=Bt.next())Pe=It.value,$t.has(Pe)||lt.delete(Pe)}catch(A){qn={error:A}}finally{try{It&&!It.done&&(y=Bt.return)&&y.call(Bt)}finally{if(qn)throw qn.error}}if(Ns={atomicGroupsEnteredTogether:Xt,characterGroups:Z.characterGroups,contextTrail:St,hash:_n,node:Z.node,stack:Z.stack},Ms={atomicGroupsEnteredTogether:lt,characterGroups:ne.characterGroups,contextTrail:me,hash:Lt,node:ne.node,stack:ne.stack},Vt={diverged:et,intersection:ut,left:Ns,right:Ms},L=B(B([],q(L),!1),[Vt],!1),js=gC(Z.stack,n.nodeExtra),js.size>0&&(Ps=L.every(function(A){var C=A.left,G=A.right;return co(C,G)}),Ps))return[2,\"continue\"];if(Ii={left:[Z.node.range[0],uo(Z.stack,!0)].join(\":\"),right:[ne.node.range[0],uo(Z.stack,!0)].join(\":\")},r.set(Ii,Vt),N.append(Ii),Fi=N.getRepeatingEntries(),Fi){if(Ri=r.get(Fi[0]),!Ri)throw new Error(\"Internal error: missing entry at start of loop\");return t.add(Ri),[2,\"continue\"]}if(!PC(Vt.left.atomicGroupsEnteredTogether,Vt.right.atomicGroupsEnteredTogether))return[2,\"continue-outer\"];if(So=co(Vt.left,Vt.right),So)return[3,2];{for(Ls=hg({multiLine:n.multiLine,reader:uc(w[0].reader)}),Oi=void 0;!(Oi=Ls.next()).done;)switch(Oi.value.type){case jl:{if(i+=.5,i>n.maxSteps)return[2,\"break-outer\"];break}}if(ie=Oi.value,ie)return[2,\"continue\"]}{for(To=hg({multiLine:n.multiLine,reader:uc(w[1].reader)}),zn=void 0;!(zn=To.next()).done;)switch(zn.value.type){case jl:{if(i+=.5,i>n.maxSteps)return[2,\"break-outer\"];break}}if(Ni=zn.value,Ni)return[2,\"continue\"]}return Sr=function(){var A=B([],q(e),!1).some(function(C){return C.length!==L.length?!1:C.every(function(G,he){return co(G.left,L[he].left)&&co(G.right,L[he].right)})||C.every(function(G,he){return co(G.left,L[he].right)&&co(G.right,L[he].left)})});return!A},Sr()?(e.add(L),[4,{trail:L,type:Fg}]):[3,2];case 1:_.sent(),_.label=2;case 2:return l.push({infiniteLoopTracker:N,streamReadersWithGetters:w.map(function(A){var C=A.reader;return{get:bn(function(){return C.next()}),reader:C}}),trail:L}),[2]}})},$.label=1;case 1:return[5,p()];case 2:if(f=$.sent(),f===\"break\")return[3,4];switch(f){case\"break-outer\":return[3,4];case\"continue-outer\":return[3,3]}$.label=3;case 3:return[3,1];case 4:if(t.size>0)try{for(m=ze(e),g=m.next();!g.done;g=m.next())if(h=g.value,h.some(function(M){return t.has(M)})){a=!0;break}}catch(M){v={error:M}}finally{try{g&&!g.done&&(x=m.return)&&x.call(m)}finally{if(v)throw v.error}}return b=i>n.maxSteps?\"hitMaxSteps\":s?\"timedOut\":null,[2,b?{error:b}:{error:null,infinite:a}]}})}var UC=[\"lookahead\",\"lookbehind\",\"negativeLookahead\",\"negativeLookbehind\"];function zC(n){var e=new Map,t=new Map,r=new Map,i=[],o=function(s,a,c){switch(s.type){case\"anchor\":case\"characterClass\":case\"characterClassEscape\":case\"characterClassRange\":case\"unicodePropertyEscape\":case\"value\":case\"dot\":return;case\"reference\":{r.set(s,a),c&&i.push(s);break}case\"alternative\":case\"disjunction\":{s.body.forEach(function(p){return o(p,a,c)});return}case\"group\":{if(s.behavior===\"normal\"){var u=e.size+1;e.set(s,u),t.set(u,s),r.set(s,a)}var l=B([],q(a),!1);s.behavior!==\"normal\"&&UC.indexOf(s.behavior)>=0&&l.push(s),s.body.forEach(function(p){return o(p,l,c)});return}case\"quantifier\":{s.body.forEach(function(p){return o(p,a,c&&s.max!==0)});return}}};return o(n,[],!0),{capturingGroupToIndex:e,indexToCapturingGroup:t,nodeToLookaheadStack:r,reachableReferences:i}}var qC=(function(){function n(){this._cache=new Map}return n.prototype.addResult=function(e,t,r){var i=this._cache.get(e)||new Map;i.set(t,r),this._cache.set(e,i);var o=this._cache.get(t)||new Map;o.set(e,r),this._cache.set(t,o)},n.prototype.getResult=function(e,t){var r;return(r=this._cache.get(e))===null||r===void 0?void 0:r.get(t)},n})(),Rg=(function(){function n(e){this.decode=e,this.root=new Map,this.results=new Map,this._items=function(){return[]}}return n.prototype.add=function(e){var t=this.decode(e);if(t.length!==0){for(var r=this.results,i={children:this.root},o=t.length,s=0;s<o;s++){var a=t[s],c=s===o-1,u=i.children.get(a);if(u)i=u,c||r.delete(u);else{var l={children:new Map,value:a};i.children.set(a,l),i=l,c&&r.set(l,e)}}this._items=bn(function(){return Array.from(r.values())})}},Object.defineProperty(n.prototype,\"items\",{get:function(){return this._items()},enumerable:!1,configurable:!0}),n})(),Fl=25e3,ZC=(function(){function n(e,t){this.trail=e,this.isEmptyCache=t,this.tree=new Rg(function(r){return r.map(function(i){var o=i.hash;return o})}),this.inputStringSchema=e.map(function(r){var i=r.intersection;return i}),this.length=e.length,this.onNewTrail(this)}return Object.defineProperty(n.prototype,\"matches\",{get:function(){return this.tree.items},enumerable:!1,configurable:!0}),n.prototype.getLongestMatch=function(e,t){var r=this;if(t.length>e.length)throw new Error(\"Internal error: trail should be <= than input string schema\");var i=t.findIndex(function(o,s){var a=r.isEmptyCache.getResult(o.characterGroups,e[s]);if(a!==void 0)return a;var c=Ll(Bl(o.characterGroups,e[s]));return r.isEmptyCache.addResult(o.characterGroups,e[s],c),c});return i===-1?t:t.slice(0,i)},n.prototype.onNewTrail=function(e){var t,r,i=[],o=[];try{for(var s=ze(e.trail),a=s.next();!a.done;a=s.next()){var c=a.value;i.push(c.left),o.push(c.right)}}catch(p){t={error:p}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}var u=this.getLongestMatch(this.inputStringSchema,i);u.length===this.length&&this.tree.add(u);var l=this.getLongestMatch(this.inputStringSchema,o);l.length===this.length&&this.tree.add(l)},n})();function WC(n){var e,t,r=n.atomicGroupOffsets,i=n.node,o=n.maxScore,s=n.maxSteps,a=n.multiLine,c=n.timeout,u=n.caseInsensitive,l=n.dotAll,p=new qC,f=zC(i),m={caseInsensitive:u,dotAll:l,node:i,nodeExtra:f},g=pg(m),h=pg(m),b=VC({atomicGroupOffsets:r,leftStreamReader:g,maxSteps:s,multiLine:a,nodeExtra:f,rightStreamReader:h,timeout:c}),v=new Rg(function(Y){var se=Y.trail;return se}),x=1,$=0,M;e:for(;!(M=b.next()).done;)switch(M.value.type){case Fg:{var w=new ZC(M.value.trail,p),N=function(Y){var se=Y.matches,ae=se.length;ae>x&&(x=ae)};if($<Fl){try{for(var L=(e=void 0,ze(v.items)),V=L.next();!V.done;V=L.next()){var O=V.value;if(O.length===w.length){if($+=w.length,$>=Fl)break;w.onNewTrail(O),O.onNewTrail(w),N(O)}}}catch(Y){e={error:Y}}finally{try{V&&!V.done&&(t=L.return)&&t.call(L)}finally{if(e)throw e.error}}N(w)}if($>=Fl&&(x+=1),v.add(w),x>o)break e;break}}var J=null;return M.done?M.value.error?(x=1/0,J=M.value.error):M.value.infinite&&(x=1/0,J=\"hitMaxScore\"):(x=1/0,J=\"hitMaxScore\"),{error:J,score:x,trails:v.items.map(function(Y){var se=Y.trail;return se})}}var HC=1/0,GC=200,KC=2e4,JC=!1,YC=!1,XC=!1,QC=!1;function fc(n){return{end:{offset:n.range[1]},source:n.raw,start:{offset:n.range[0]}}}function gg(n){return n.flatMap(function(e){return e.type===\"reference\"?[e.reference]:[]}).reverse().map(function(e){return{index:e.matchIndex,node:fc(e)}})}function yg(n){var e=B([],q(n),!1).reverse(),t=e.findIndex(function(i){var o=i.type;return o===\"reference\"}),r=e.slice(0,t>=0?t:n.length).reverse();return r.flatMap(function(i){return i.type===\"quantifier\"?[i]:[]}).map(function(i){var o=i.quantifier,s=i.iteration;return{iteration:s,node:fc(o)}})}function zl(n,e){var t=e===void 0?{}:e,r=t.atomicGroupOffsets,i=t.maxScore,o=i===void 0?GC:i,s=t.maxSteps,a=s===void 0?KC:s,c=t.multiLine,u=c===void 0?JC:c,l=t.timeout,p=l===void 0?HC:l,f=t.caseInsensitive,m=f===void 0?XC:f,g=t.dotAll,h=g===void 0?QC:g,b=t.unicode,v=b===void 0?YC:b,x=t.downgradePattern,$=x===void 0?!0:x;if(m&&v)throw new Error(\"`caseInsensitive` cannot be used with `unicode`.\");if($&&r)throw new Error(\"`atomicGroupOffsets` cannot be used with `downgradePattern: true`.\");if(p<=0)throw new Error(\"`timeout` must be a positive number.\");if(o<0)throw new Error(\"`maxScore` must be a positive number or 0.\");if(a<=0)throw new Error(\"`maxSteps` must be a positive number.\");var M=$?oC({pattern:n,unicode:v}):{atomicGroupOffsets:new Set(r||[]),pattern:n},w=M.pattern,N=M.atomicGroupOffsets,L=$&&n!==w,V=vg(w,v);if(!$&&rC(V))throw new Error(\"Pattern is not bounded at the start and needs downgrading. See the `downgradePattern` option.\");var O=WC({atomicGroupOffsets:N,caseInsensitive:m,dotAll:h,maxScore:o,maxSteps:a,multiLine:u,node:V,timeout:p});return Oe(Oe({},O.error?{error:O.error,safe:!1}:{error:null,safe:!0}),{pattern:w,patternDowngraded:L,score:O.score===1/0?{infinite:!0}:{infinite:!1,value:O.score},trails:O.trails.map(function(J){var Y={trail:J.map(function(se){var ae=se.left,Z=se.right,ne={a:{backreferenceStack:gg(Z.stack),node:fc(Z.node),quantifierIterations:yg(Z.stack)},b:{backreferenceStack:gg(ae.stack),node:fc(ae.node),quantifierIterations:yg(ae.stack)}};return ne})};return Y})})}function Og(n,e={}){if(n==null||typeof n!=\"string\"||n.length===0)return!0;let t=e.maxPatternLength??256;if(n.length>t)return!1;try{return new RegExp(n),zl(n).safe&&zl(`^(?:${n})$`).safe}catch{return!1}}var Di=\"en-US\";function pc(n){if(!n)return Di;try{return Intl.NumberFormat.supportedLocalesOf(n).length>0?n:Di}catch{return Di}}function eD(n){if(n==null)return\"\";if(typeof n==\"object\")try{return JSON.stringify(n)??String(n)}catch{return String(n)}return String(n)}function Bg(n){let e=!0;return(n==null||typeof n==\"string\"&&n===\"\"||Array.isArray(n)&&n.length===0)&&(e=!1),{valid:e,...e?{}:{message:\"This field is required.\"}}}function Vg(n,e){if(!Og(e))throw new de(`Unsafe regex pattern (catastrophic backtracking risk): ${e}`,\"regex\");try{let t=new RegExp(e).test(String(n??\"\"));return{valid:t,...t?{}:{message:\"Value does not match required pattern.\"}}}catch(t){throw new de(`Invalid regex pattern: ${e}`,\"regex\",t)}}function Ug(n,e,t){let r=0;(typeof n==\"string\"||Array.isArray(n))&&(r=n.length);let i=!0,o;return e!==void 0&&!isNaN(e)&&r<e?(i=!1,o=`Minimum length is ${e}.`):t!==void 0&&!isNaN(t)&&r>t&&(i=!1,o=`Maximum length is ${t}.`),{valid:i,...o?{message:o}:{}}}function zg(n,e,t){let r=Number(n);if(isNaN(r))return{valid:!1,message:\"Value must be a valid number.\"};let i=!0,o;return e!==void 0&&!isNaN(e)&&r<e?(i=!1,o=`Minimum value is ${e}.`):t!==void 0&&!isNaN(t)&&r>t&&(i=!1,o=`Maximum value is ${t}.`),{valid:i,...o?{message:o}:{}}}var tD=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/;function qg(n){let e=typeof n==\"string\"&&tD.test(n);return{valid:e,...e?{}:{message:\"Must be a valid email address.\"}}}var Ng=new Map;function nD(n,e,t){let r=`${n}:${e??\"undef\"}:${t??\"true\"}`,i=Ng.get(r);return i||(i=new Intl.NumberFormat(n,{minimumFractionDigits:e,maximumFractionDigits:e,useGrouping:t}),Ng.set(r,i)),i}var Mg=new Map;function rD(n,e,t,r){let i=`${n}:${e}:${t??\"undef\"}:${r??\"true\"}`,o=Mg.get(i);return o||(o=new Intl.NumberFormat(n,{style:\"currency\",currency:e,minimumFractionDigits:t,maximumFractionDigits:t,useGrouping:r}),Mg.set(i,o)),o}var iD=\"USD\",jg=new Map;function oD(n,e,t){let r=`${n}:${e??\"undef\"}:${t??\"true\"}`,i=jg.get(r);return i||(i=new Intl.NumberFormat(n,{style:\"currency\",currency:iD,currencyDisplay:\"code\",minimumFractionDigits:e,maximumFractionDigits:e,useGrouping:t}),jg.set(r,i)),i}var Pg=new Map;function sD(n){let e=Pg.get(n);if(!e){let t=(o,s)=>{let a=new Intl.DateTimeFormat(n,{...o,timeZone:\"UTC\"});return s.map(c=>a.format(c))},r=Array.from({length:12},(o,s)=>new Date(Date.UTC(2021,s,15))),i=Array.from({length:7},(o,s)=>new Date(Date.UTC(2021,2,1+s)));e={monthsLong:t({month:\"long\"},r),monthsShort:t({month:\"short\"},r),weekdaysLong:t({weekday:\"long\"},i),weekdaysShort:t({weekday:\"short\"},i)},Pg.set(n,e)}return e}var aD=/yyyy|yy|MMMM|MMM|MM|M|EEEE|E|dd|d|HH|H|hh|h|mm|ss|a/g,cD=/(?:Z|[+-]\\d{2}:?\\d{2})$/,uD=/^([+-]?\\d{4,6})-(\\d{2})-(\\d{2})(?:[T ](\\d{2})(?::(\\d{2})(?::(\\d{2}))?)?)?/;function lD(n){let e=cD.test(n),t=new Date(e?n:`${n}Z`);if(isNaN(t.getTime()))return null;let r=0,i=/([+-])(\\d{2}):?(\\d{2})$/.exec(n);i&&(r=(i[1]===\"-\"?-1:1)*(Number(i[2])*60+Number(i[3])));let o=new Date(t.getTime()+r*6e4);return dD(n,o)?{shifted:o,instant:t}:null}function dD(n,e){let t=uD.exec(n);if(!t)return!1;let r=i=>t[i]===void 0?void 0:Number(t[i]);return r(1)===e.getUTCFullYear()&&r(2)===e.getUTCMonth()+1&&r(3)===e.getUTCDate()&&(r(4)??e.getUTCHours())===e.getUTCHours()&&(r(5)??e.getUTCMinutes())===e.getUTCMinutes()&&(r(6)??e.getUTCSeconds())===e.getUTCSeconds()}var Lg=new Map;function fD(n){let e=Lg.get(n);return e||(e=new Intl.PluralRules(n),Lg.set(n,e)),e}var fo=n=>!!n;function pD(n,e=fo){if(!Array.isArray(n)||n.length<2)throw new de(\"and requires at least 2 values\",\"and\");return n.every(e)}function hD(n,e=fo){if(!Array.isArray(n)||n.length<2)throw new de(\"or requires at least 2 values\",\"or\");return n.some(e)}function mD(n,e=fo){return!e(n)}function Zg(n){if(typeof n!=\"object\"||n===null||Array.isArray(n))return n;if(\"path\"in n&&typeof n.path==\"string\"&&!(\"@path\"in n))return{\"@path\":n.path};if(\"call\"in n&&typeof n.call==\"string\"&&!(\"@call\"in n)){let e={};if(n.args&&typeof n.args==\"object\")for(let[t,r]of Object.entries(n.args))e[t]=Zg(r);return{\"@call\":n.call,args:e,returnType:n.returnType}}return n}function gD(n,e){let r=new bs().parse(n);if(r.length===0)return\"\";let i=ge(e.surface?.protocolVersion??e.surface?.defaultCatalog?.protocolVersion,\"1.0\"),o=r.map(s=>{if(typeof s!=\"object\"||s===null||Array.isArray(s))return s;let a=i?Zg(s):s;return e.resolveSignal(a)});return Xr(()=>o.map(s=>eD(On(s)?Be(s):s)).join(\"\"))}function yD(n,e,t,r=Di){return isNaN(n)?\"\":nD(r,e,t).format(n)}function bD(n,e,t=2,r,i=Di){if(isNaN(n))return\"\";let o=String(e).toUpperCase();try{return rD(i,o,t,r).format(n)}catch{return oD(i,t,r).formatToParts(n).map(s=>s.type===\"currency\"?o:s.value).join(\"\")}}function vD(n,e=\"yyyy-MM-dd\",t=Di){if(!n)return\"\";let r=lD(String(n));if(!r)return\"\";let{shifted:i,instant:o}=r,s=e||\"yyyy-MM-dd\";if(s===\"ISO\")return o.toISOString();let a=sD(t),c=(i.getUTCDay()+6)%7,u=i.getUTCHours(),l=u%12||12;return s.replace(aD,p=>{switch(p){case\"yyyy\":return String(i.getUTCFullYear());case\"yy\":return String(i.getUTCFullYear()).slice(-2);case\"MMMM\":return a.monthsLong[i.getUTCMonth()];case\"MMM\":return a.monthsShort[i.getUTCMonth()];case\"MM\":return String(i.getUTCMonth()+1).padStart(2,\"0\");case\"M\":return String(i.getUTCMonth()+1);case\"EEEE\":return a.weekdaysLong[c];case\"E\":return a.weekdaysShort[c];case\"dd\":return String(i.getUTCDate()).padStart(2,\"0\");case\"d\":return String(i.getUTCDate());case\"HH\":return String(u).padStart(2,\"0\");case\"H\":return String(u);case\"hh\":return String(l).padStart(2,\"0\");case\"h\":return String(l);case\"mm\":return String(i.getUTCMinutes()).padStart(2,\"0\");case\"ss\":return String(i.getUTCSeconds()).padStart(2,\"0\");case\"a\":return u<12?\"AM\":\"PM\";default:return p}})}function _D(n,e,t=Di){let r;return n===0&&e.zero!==void 0?r=\"zero\":n===1&&e.one!==void 0?r=\"one\":n===2&&e.two!==void 0?r=\"two\":r=fD(t).select(n),String(e[r]??e.other??\"\")}function xD(n){let e=typeof n==\"string\"?n:void 0;if(!e||typeof window>\"u\"||typeof window.open!=\"function\")return;let t=typeof window<\"u\"&&typeof window.location<\"u\"&&window.location.href?window.location.href:void 0,r;try{r=t?new URL(e,t):new URL(e)}catch(i){throw new de(`Invalid URL specified: ${e}`,\"openUrl\",i)}if(r.protocol!==\"https:\"&&r.protocol!==\"http:\"&&r.protocol!==\"mailto:\"&&r.protocol!==\"tel:\")throw new de(`Unsupported URL scheme: ${r.protocol}`,\"openUrl\");window.open(r.href,\"_blank\",\"noopener,noreferrer\")}function Wg(n,{truthy:e=fo}={}){return Ae(n,t=>pD(t.values,e))}function Hg(n,{truthy:e=fo}={}){return Ae(n,t=>hD(t.values,e))}function Gg(n,{truthy:e=fo}={}){return Ae(n,t=>mD(t.value,e))}function Kg(n){return Ae(n,(e,t)=>gD(e.value,t))}function Jg(n,e){let t=pc(e);return Ae(n,r=>yD(r.value,r.decimals,r.grouping,t))}function Yg(n,e){let t=pc(e);return Ae(n,r=>bD(r.value,r.currency,r.decimals??2,r.grouping,t))}function Xg(n,e){let t=pc(e);return Ae(n,r=>vD(r.value,r.format,t))}function Qg(n,e){let t=pc(e);return Ae(n,r=>_D(r.value,r,t))}function ey(n){return Ae(n,e=>xD(e.url))}var AD=Wg(ig),CD=Hg(og),DD=Gg(sg),wD=Ae(Hm,n=>Bg(n.value).valid),ED=Ae(Gm,n=>Vg(n.value,n.pattern).valid),SD=Ae(Km,n=>Ug(n.value,n.min,n.max).valid),TD=Ae(Jm,n=>zg(n.value,n.min,n.max).valid),kD=Ae(Ym,n=>qg(n.value).valid),$D=Kg(Xm);function ty(n){return Jg(Qm,n)}var dj=ty();function ny(n){return Yg(eg,n)}var fj=ny();function ry(n){return Xg(tg,n)}var pj=ry();function iy(n){return Qg(ng,n)}var hj=iy(),ID=ey(rg);function FD(n){let e=n?.locale;return[wD,ED,SD,TD,kD,$D,ty(e),ny(e),ry(e),iy(e),ID,AD,CD,DD]}var oy=FD();var po=new jt(\"https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json\",\"0.9\",[qm,Pm,jm,Wm,km,Vm,Om,Lm,Im,zm,Bm,Mm,$m,Zm,Fm,Rm,Um,Nm],oy,{themeSchema:Yh,...Tm});var Cr,be,ql,sy,ho=0,hy=[],Ce=K,ay=Ce.__b,cy=Ce.__r,uy=Ce.diffed,ly=Ce.__c,dy=Ce.unmount,fy=Ce.__;function mo(n,e){Ce.__h&&Ce.__h(be,n,ho||e),ho=0;var t=be.__H||(be.__H={__:[],__h:[]});return n>=t.__.length&&t.__.push({}),t.__[n]}function mc(n){return ho=1,gc(my,n)}function gc(n,e,t){var r=mo(Cr++,2);if(r.t=n,!r.__c&&(r.__=[t?t(e):my(void 0,e),function(a){var c=r.__N?r.__N[0]:r.__[0],u=r.t(c,a);c!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=be,!be.__f)){var i=function(a,c,u){if(!r.__c.__H)return!0;var l=!1,p=r.__c.props!==a;if(r.__c.__H.__.some(function(m){if(m.__N){l=!0;var g=m.__[0];m.__=m.__N,m.__N=void 0,g!==m.__[0]&&(p=!0)}}),o){var f=o.call(this,a,c,u);return l?f||p:f}return!l||p};be.__f=!0;var o=be.shouldComponentUpdate,s=be.componentWillUpdate;be.componentWillUpdate=function(a,c,u){if(this.__e){var l=o;o=void 0,i(a,c,u),o=l}s&&s.call(this,a,c,u)},be.shouldComponentUpdate=i}return r.__N||r.__}function wt(n,e){var t=mo(Cr++,3);!Ce.__s&&Kl(t.__H,e)&&(t.__=n,t.u=e,be.__H.__h.push(t))}function Dr(n,e){var t=mo(Cr++,4);!Ce.__s&&Kl(t.__H,e)&&(t.__=n,t.u=e,be.__h.push(t))}function mt(n){return ho=5,Bn(function(){return{current:n}},[])}function Wl(n,e,t){ho=6,Dr(function(){if(typeof n==\"function\"){var r=n(e());return function(){n(null),r&&typeof r==\"function\"&&r()}}if(n)return n.current=e(),function(){return n.current=null}},t==null?t:t.concat(n))}function Bn(n,e){var t=mo(Cr++,7);return Kl(t.__H,e)&&(t.__=n(),t.__H=e,t.__h=n),t.__}function Xe(n,e){return ho=8,Bn(function(){return n},e)}function As(n){var e=be.context[n.__c],t=mo(Cr++,9);return t.c=n,e?(t.__==null&&(t.__=!0,e.sub(be)),e.props.value):n.__}function Hl(n,e){Ce.useDebugValue&&Ce.useDebugValue(e?e(n):n)}function Gl(){var n=mo(Cr++,11);if(!n.__){for(var e=be.__v;e!==null&&!e.__m&&e.__!==null;)e=e.__;var t=e.__m||(e.__m=[0,0]);n.__=\"P\"+t[0]+\"-\"+t[1]++}return n.__}function RD(){for(var n;n=hy.shift();){var e=n.__H;if(n.__P&&e)try{e.__h.some(hc),e.__h.some(Zl),e.__h=[]}catch(t){e.__h=[],Ce.__e(t,n.__v)}}}Ce.__b=function(n){be=null,ay&&ay(n)},Ce.__=function(n,e){n&&e.__k&&e.__k.__m&&(n.__m=e.__k.__m),fy&&fy(n,e)},Ce.__r=function(n){cy&&cy(n),Cr=0;var e=(be=n.__c).__H;e&&(ql===be?(e.__h=[],be.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.some(hc),e.__h.some(Zl),e.__h=[],Cr=0)),ql=be},Ce.diffed=function(n){uy&&uy(n);var e=n.__c;e&&e.__H&&(e.__H.__h.length&&(hy.push(e)!==1&&sy===Ce.requestAnimationFrame||((sy=Ce.requestAnimationFrame)||OD)(RD)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),ql=be=null},Ce.__c=function(n,e){e.some(function(t){try{t.__h.some(hc),t.__h=t.__h.filter(function(r){return!r.__||Zl(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],Ce.__e(r,t.__v)}}),ly&&ly(n,e)},Ce.unmount=function(n){dy&&dy(n);var e,t=n.__c;t&&t.__H&&(t.__H.__.some(function(r){try{hc(r)}catch(i){e=i}}),t.__H=void 0,e&&Ce.__e(e,t.__v))};var py=typeof requestAnimationFrame==\"function\";function OD(n){var e,t=function(){clearTimeout(r),py&&cancelAnimationFrame(e),setTimeout(n)},r=setTimeout(t,35);py&&(e=requestAnimationFrame(t))}function hc(n){var e=be,t=n.__c;typeof t==\"function\"&&(n.__c=void 0,t()),be=e}function Zl(n){var e=be;n.__c=n.__(),be=e}function Kl(n,e){return!n||n.length!==e.length||e.some(function(t,r){return t!==n[r]})}function my(n,e){return typeof e==\"function\"?e(n):e}function Dy(n,e){for(var t in e)n[t]=e[t];return n}function Yl(n,e){for(var t in n)if(t!==\"__source\"&&!(t in e))return!0;for(var r in e)if(r!==\"__source\"&&n[r]!==e[r])return!0;return!1}function wi(n,e){var t=e(),r=mc({t:{__:t,u:e}}),i=r[0].t,o=r[1];return Dr(function(){i.__=t,i.u=e,Jl(i)&&o({t:i})},[n,t,e]),wt(function(){return Jl(i)&&o({t:i}),n(function(){Jl(i)&&o({t:i})})},[n]),t}function Jl(n){try{return!((e=n.__)===(t=n.u())&&(e!==0||1/e==1/t)||e!=e&&t!=t)}catch{return!0}var e,t}function wy(n){n()}function Ey(n){return n}function Sy(){return[!1,wy]}var Ty=Dr;function Xl(n,e){this.props=n,this.context=e}function go(n,e){function t(i){var o=this.props.ref;return o!=i.ref&&o&&(typeof o==\"function\"?o(null):o.current=null),e?!e(this.props,i)||o!=i.ref:Yl(this.props,i)}function r(i){return this.shouldComponentUpdate=t,vt(n,i)}return r.displayName=\"Memo(\"+(n.displayName||n.name)+\")\",r.__f=r.prototype.isReactComponent=!0,r.type=n,r}(Xl.prototype=new Ft).isPureReactComponent=!0,Xl.prototype.shouldComponentUpdate=function(n,e){return Yl(this.props,n)||Yl(this.state,e)};var gy=K.__b;K.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),gy&&gy(n)};var ND=typeof Symbol<\"u\"&&Symbol.for&&Symbol.for(\"react.forward_ref\")||3911;function MD(n){function e(t){var r=Dy({},t);return delete r.ref,n(r,t.ref||null)}return e.$$typeof=ND,e.render=n,e.prototype.isReactComponent=e.__f=!0,e.displayName=\"ForwardRef(\"+(n.displayName||n.name)+\")\",e}var yy=function(n,e){return n==null?null:rn(rn(n).map(e))},jD={map:yy,forEach:yy,count:function(n){return n?rn(n).length:0},only:function(n){var e=rn(n);if(e.length!==1)throw\"Children.only\";return e[0]},toArray:rn},PD=K.__e;K.__e=function(n,e,t,r){if(n.then){for(var i,o=e;o=o.__;)if((i=o.__c)&&i.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k||[]),i.__c(n,e)}PD(n,e,t,r)};var by=K.unmount;function ky(n,e,t){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(r){typeof r.__c==\"function\"&&r.__c()}),n.__c.__H=null),(n=Dy({},n)).__c!=null&&(n.__c.__P===t&&(n.__c.__P=e),n.__c.__e=!0,n.__c=null),n.__k=n.__k&&n.__k.map(function(r){return ky(r,e,t)})),n}function $y(n,e,t){return n&&t&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(r){return $y(r,e,t)}),n.__c&&n.__c.__P===e&&(n.__e&&t.appendChild(n.__e),n.__c.__e=!0,n.__c.__P=t)),n}function yc(){this.__u=0,this.o=null,this.__b=null}function Iy(n){var e=n.__&&n.__.__c;return e&&e.__a&&e.__a(n)}function LD(n){var e,t,r,i=null;function o(s){if(e||(e=n()).then(function(a){a&&(i=a.default||a),r=!0},function(a){t=a,r=!0}),t)throw t;if(!r)throw e;return i?vt(i,s):null}return o.displayName=\"Lazy\",o.__f=!0,o}function Cs(){this.i=null,this.l=null}K.unmount=function(n){var e=n.__c;e&&(e.__z=!0),e&&e.__R&&e.__R(),e&&32&n.__u&&(n.type=null),by&&by(n)},(yc.prototype=new Ft).__c=function(n,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var i=Iy(r.__v),o=!1,s=function(){o||r.__z||(o=!0,t.__R=null,i?i(c):c())};t.__R=s;var a=t.__P;t.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var u=r.state.__a;r.__v.__k[0]=$y(u,u.__c.__P,u.__c.__O)}var l;for(r.setState({__a:r.__b=null});l=r.o.pop();)l.__P=a,l.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(s,s)},yc.prototype.componentWillUnmount=function(){this.o=[]},yc.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var t=document.createElement(\"div\"),r=this.__v.__k[0].__c;this.__v.__k[0]=ky(this.__b,t,r.__O=r.__P)}this.__b=null}var i=e.__a&&vt(Ie,null,n.fallback);return i&&(i.__u&=-33),[vt(Ie,null,e.__a?null:n.children),i]};var vy=function(n,e,t){if(++t[1]===t[0]&&n.l.delete(e),n.props.revealOrder&&(n.props.revealOrder[0]!==\"t\"||!n.l.size))for(t=n.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;n.i=t=t[2]}};function BD(n){return this.getChildContext=function(){return n.context},n.children}function VD(n){var e=this,t=n.h;if(e.componentWillUnmount=function(){Wn(null,e.v),e.v=null,e.h=null},e.h&&e.h!==t&&e.componentWillUnmount(),!e.v){for(var r=e.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;e.h=t,e.v={nodeType:1,parentNode:t,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:t.namespaceURI,insertBefore:function(i,o){this.childNodes.push(i),e.h.insertBefore(i,o)},removeChild:function(i){this.childNodes.splice(this.childNodes.indexOf(i)>>>1,1),e.h.removeChild(i)}}}Wn(vt(BD,{context:e.context},n.__v),e.v)}function Ql(n,e){var t=vt(VD,{__v:n,h:e});return t.containerInfo=e,t}(Cs.prototype=new Ft).__a=function(n){var e=this,t=Iy(e.__v),r=e.l.get(n);return r[0]++,function(i){var o=function(){e.props.revealOrder?(r.push(i),vy(e,n,r)):i()};t?t(o):o()}},Cs.prototype.render=function(n){this.i=null,this.l=new Map;var e=rn(n.children);n.revealOrder&&n.revealOrder[0]===\"b\"&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return n.children},Cs.prototype.componentDidUpdate=Cs.prototype.componentDidMount=function(){var n=this;this.l.forEach(function(e,t){vy(n,t,e)})};var Fy=typeof Symbol<\"u\"&&Symbol.for&&Symbol.for(\"react.element\")||60103,UD=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,zD=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,qD=/[A-Z0-9]/g,ZD=typeof document<\"u\",WD=function(n){return(typeof Symbol<\"u\"&&typeof Symbol()==\"symbol\"?/fil|che|rad/:/fil|che|ra/).test(n)};function HD(n,e,t){return e.__k==null&&(e.textContent=\"\"),Wn(n,e),typeof t==\"function\"&&t(),n?n.__c:null}function GD(n,e,t){return Yc(n,e),typeof t==\"function\"&&t(),n?n.__c:null}Ft.prototype.isReactComponent=!0,[\"componentWillMount\",\"componentWillReceiveProps\",\"componentWillUpdate\"].forEach(function(n){Object.defineProperty(Ft.prototype,n,{configurable:!0,get:function(){return this[\"UNSAFE_\"+n]},set:function(e){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:e})}})});var _y=K.event;K.event=function(n){return _y&&(n=_y(n)),n.persist=function(){},n.isPropagationStopped=function(){return this.cancelBubble},n.isDefaultPrevented=function(){return this.defaultPrevented},n.nativeEvent=n};var ed,KD={configurable:!0,get:function(){return this.class}},xy=K.vnode;K.vnode=function(n){typeof n.type==\"string\"&&(function(e){var t=e.props,r=e.type,i={},o=r.indexOf(\"-\")==-1;for(var s in t){var a=t[s];if(!(s===\"value\"&&\"defaultValue\"in t&&a==null||ZD&&s===\"children\"&&r===\"noscript\"||s===\"class\"||s===\"className\")){var c=s.toLowerCase();s===\"defaultValue\"&&\"value\"in t&&t.value==null?s=\"value\":s===\"download\"&&a===!0?a=\"\":c===\"translate\"&&a===\"no\"?a=!1:c[0]===\"o\"&&c[1]===\"n\"?c===\"ondoubleclick\"?s=\"ondblclick\":c!==\"onchange\"||r!==\"input\"&&r!==\"textarea\"||WD(t.type)?c===\"onfocus\"?s=\"onfocusin\":c===\"onblur\"?s=\"onfocusout\":zD.test(s)&&(s=c):c=s=\"oninput\":o&&UD.test(s)?s=s.replace(qD,\"-$&\").toLowerCase():a===null&&(a=void 0),c===\"oninput\"&&i[s=c]&&(s=\"oninputCapture\"),i[s]=a}}r==\"select\"&&(i.multiple&&Array.isArray(i.value)&&(i.value=rn(t.children).forEach(function(u){u.props.selected=i.value.indexOf(u.props.value)!=-1})),i.defaultValue!=null&&(i.value=rn(t.children).forEach(function(u){u.props.selected=i.multiple?i.defaultValue.indexOf(u.props.value)!=-1:i.defaultValue==u.props.value}))),t.class&&!t.className?(i.class=t.class,Object.defineProperty(i,\"className\",KD)):t.className&&(i.class=i.className=t.className),e.props=i})(n),n.$$typeof=Fy,xy&&xy(n)};var Ay=K.__r;K.__r=function(n){Ay&&Ay(n),ed=n.__c};var Cy=K.diffed;K.diffed=function(n){Cy&&Cy(n);var e=n.props,t=n.__e;t!=null&&n.type===\"textarea\"&&\"value\"in e&&e.value!==t.value&&(t.value=e.value==null?\"\":e.value),ed=null};var JD={ReactCurrentDispatcher:{current:{readContext:function(n){return ed.__n[n.__c].props.value},useCallback:Xe,useContext:As,useDebugValue:Hl,useDeferredValue:Ey,useEffect:wt,useId:Gl,useImperativeHandle:Wl,useInsertionEffect:Ty,useLayoutEffect:Dr,useMemo:Bn,useReducer:gc,useRef:mt,useState:mc,useSyncExternalStore:wi,useTransition:Sy}}};function YD(n){return vt.bind(null,n)}function bc(n){return!!n&&n.$$typeof===Fy}function XD(n){return bc(n)&&n.type===Ie}function QD(n){return!!n&&typeof n.displayName==\"string\"&&n.displayName.indexOf(\"Memo(\")==0}function ew(n){return bc(n)?Hd.apply(null,arguments):n}function tw(n){return!!n.__k&&(Wn(null,n),!0)}function nw(n){return n&&(n.base||n.nodeType===1&&n)||null}var rw=function(n,e){return n(e)},iw=function(n,e){var t,r=K.debounceRendering;K.debounceRendering=function(o){t=o};try{var i=n(e);return t&&t(),i}finally{K.debounceRendering=r}},ow=bc,Ry={useState:mc,useId:Gl,useReducer:gc,useEffect:wt,useLayoutEffect:Dr,useInsertionEffect:Ty,useTransition:Sy,useDeferredValue:Ey,useSyncExternalStore:wi,startTransition:wy,useRef:mt,useImperativeHandle:Wl,useMemo:Bn,useCallback:Xe,useContext:As,useDebugValue:Hl,version:\"18.3.1\",Children:jD,render:HD,hydrate:GD,unmountComponentAtNode:tw,createPortal:Ql,createElement:vt,createContext:Ro,createFactory:YD,cloneElement:ew,createRef:Gc,Fragment:Ie,isValidElement:bc,isElement:ow,isFragment:XD,isMemo:QD,findDOMNode:nw,Component:Ft,PureComponent:Xl,memo:go,forwardRef:MD,flushSync:iw,unstable_batchedUpdates:rw,StrictMode:Ie,Suspense:yc,SuspenseList:Cs,lazy:LD,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:JD};var sw=0;function ee(n,e,t,r,i,o){e||(e={});var s,a,c=e;if(\"ref\"in c)for(a in c={},e)a==\"ref\"?s=e[a]:c[a]=e[a];var u={type:n,props:c,key:t,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--sw,__i:-1,__u:0,__source:i,__self:o};if(typeof n==\"function\"&&(s=n.defaultProps))for(a in s)c[a]===void 0&&(c[a]=s[a]);return K.vnode&&K.vnode(u),u}var aw=class{},nd=new WeakMap;function cw(n,e){nd.set(n,e)}function uw(n){return nd.has(n)}function lw(n){let e=n.parentNode;for(;e;){let t=e instanceof Element?nd.get(e):void 0;if(t)return t;e=e instanceof ShadowRoot?e.host:e.parentNode}return null}var By=class vc{static registries=new WeakMap;static forSurface(e){let t=vc.registries.get(e);return t||(t=new vc,vc.registries.set(e,t)),t}hosts=new Map;snapshots=new Map;listeners=new Map;add(e,t,r){let i=this.hosts.get(e);i&&i.entry.node===t&&i.owner===r||(this.hosts.set(e,{entry:{host:e,node:t},owner:r}),i&&i.owner!==r&&this.publish(i.owner),this.publish(r))}delete(e){let t=this.hosts.get(e);t&&(this.hosts.delete(e),this.publish(t.owner))}has(e){return this.hosts.has(e)}entries(){return[...this.hosts.values()].map(({entry:e})=>e)}subscribe(e,t){let r=this.listeners.get(e);return r||(r=new Set,this.listeners.set(e,r)),r.add(t),()=>{r.delete(t)}}getSnapshot(e){let t=this.snapshots.get(e);return t||(t=this.compute(e),this.snapshots.set(e,t)),t}compute(e){let t=[];for(let{entry:r,owner:i}of this.hosts.values())i===e&&t.push(r);return t}publish(e){this.snapshots.set(e,this.compute(e));for(let t of this.listeners.get(e)??[])t()}},dw=class extends HTMLElement{context;_node;registry;connectedCallback(){this.style.display=\"contents\",this.register()}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||(this.registry?.delete(this),this.registry=void 0)})}set node(n){this._node=n,this.context=n?.context,this.register()}get node(){return this._node}register(){let n=this._node,e=n?.context?.dataContext.surface;if(!this.isConnected||!n||!e||uw(this))return;let t=By.forSurface(e);this.registry!==t&&(this.registry?.delete(this),this.registry=t),t.add(this,n,lw(this))}},Oy=new WeakMap,Ny=new Map;function fw(n){let e=`a2ui-react-${n.toLowerCase()}`,t=(Ny.get(e)??0)+1;return Ny.set(e,t),t===1?e:`${e}-${t}`}function pw(n){if(mr(n))return n;let e=Oy.get(n);if(e)return e;let t={...n,tagName:fw(n.name),element:class extends dw{}};return Oy.set(n,t),t}var My=new WeakSet;function jy(n){if(My.has(n))return;My.add(n);let e=n.components;for(let[t,r]of e)mr(r)||e.set(t,pw(r))}function hw(n){n.defaultCatalog&&jy(n.defaultCatalog);for(let e of n.availableCatalogs.values())jy(e)}function Py(n,e){n.context=e.context,n.node=e}var td=go(({node:n,owner:e,children:t})=>{let r=n.impl;if(!mr(r))throw new Error(`A2UI catalog entry '${n.type}' has no element. A2uiSurface prepares the surface's default and available catalogs; this entry came from another catalog.`);io(r);let i=mt(null),o=mt(n);o.current=n;let s=Xe(a=>{i.current=a,a&&(e&&cw(a,e),Py(a,o.current))},[e]);return wt(()=>{i.current&&Py(i.current,n)},[n]),Ry.createElement(r.tagName,{ref:s},t)});td.displayName=\"WebComponentNode\";function Vy(n){if(!n.context)throw new Error(`A2UI views render only resolved nodes; '${n.componentId}' has no context.`);return n.context}var Uy=({componentId:n})=>ee(\"div\",{style:{color:\"gray\",padding:\"4px\"},children:[\"[Loading \",n,\"...]\"]}),Ly=new WeakMap,zy=({surface:n,id:e,requestedPath:t,detail:r})=>{let i=`Unresolved child reference '${e}' at '${t}': ${r}`;return wt(()=>{let o=Ly.get(n);o||(o=new Set,Ly.set(n,o));let s=JSON.stringify([e,t]);o.has(s)||(o.add(s),n.dispatchError({code:\"UNRESOLVED_CHILD_REFERENCE\",message:i}))},[n,e,t,i]),ee(\"div\",{style:{color:\"red\"},children:i})};function qy(n){let e=Xe(r=>ln(()=>{Be(n),r()}),[n]),t=Xe(()=>Ye(n),[n]);return wi(e,t)}function mw(n,e){return n.set(e.id,e),e.id}function _c(n,e,t){if(xt(e)){let r=mw(t,e);return e.dataPath!==n.dataPath?{id:r,basePath:e.dataPath}:r}return e instanceof st?_c(n,e.value,t):Array.isArray(e)?e.map(r=>_c(n,r,t)):gw(e)?Zy(n,e,t):e}function gw(n){if(!n||typeof n!=\"object\")return!1;let e=Object.getPrototypeOf(n);return e===Object.prototype||e===null}function Zy(n,e,t){let r={};for(let[i,o]of Object.entries(e))o instanceof st?(r[i]=_c(n,o.value,t),r[`set${i.charAt(0).toUpperCase()}${i.slice(1)}`]=to(o)?o.set:()=>{}):r[i]=_c(n,o,t);return r}function Wy(n,e){let t=Vy(n),r=t.dataContext.surface,i=qy(n.props),{viewProps:o,childIndex:s}=Bn(()=>{let u=new Map;return{viewProps:Zy(n,i,u),childIndex:u}},[n,i]),a=Xe((u,l)=>{let p=l??n.dataPath,f=[...s.values()].filter(h=>h.componentId===u),m=f.find(h=>h.dataPath===p);if(m)return e(m,l);let g=[...new Set(f.map(h=>h.dataPath))];return g.length>0?ee(zy,{surface:r,id:u,requestedPath:p,detail:`instances exist at ${g.join(\", \")}. Instances are created only at the data paths the payload implies; buildChild selects among them.`},JSON.stringify([u,p])):e(u,l)},[e,n,r,s]),c=Xe((u,l)=>{let p=s.get(u);return p?e(p,l):a(u,l)},[e,a,s]);return{viewProps:o,context:t,viewBuildChild:c,rawBuildChild:a}}var yw=({node:n,impl:e,buildChild:t})=>{let{context:r,rawBuildChild:i}=Wy(n,t),o=e.render;return ee(o,{context:r,buildChild:i})},rd=go(({node:n})=>{let e=Bn(()=>new aw,[]);if(n.state===\"unknown-type\")return ee(\"div\",{style:{color:\"red\"},children:[\"Unknown component type: \",n.type]});if(n.isPlaceholder||!n.impl||!n.context)return ee(Uy,{componentId:n.componentId});if(\"render\"in n.impl)return ee(td,{node:n,owner:e,children:ee(id,{node:n})});let t=n.context.dataContext.surface;return ee(Ie,{children:[ee(td,{node:n,owner:e}),ee(Hy,{surface:t,owner:e})]})});rd.displayName=\"ChildElement\";var Hy=({surface:n,owner:e})=>{let t=By.forSurface(n),r=Xe(s=>t.subscribe(e,s),[t,e]),i=Xe(()=>t.getSnapshot(e),[t,e]),o=wi(r,i);return ee(Ie,{children:o.map(({host:s,node:a})=>Ql(ee(id,{node:a}),s,a.id))})},id=go(({node:n})=>{let e=Vy(n).dataContext.surface,t=Xe((o,s)=>{if(xt(o))return ee(rd,{node:o},o.id);let a=s??n.dataPath,c=e.componentsModel.get(o)?\"the component exists, but the catalog schema does not mark the referencing property as a component id. Use componentId() or childList() from @a2ui/web_core.\":\"no component with this id exists on the surface.\";return ee(zy,{surface:e,id:o,requestedPath:a,detail:c},JSON.stringify([o,a]))},[e,n]),r=n.impl;if(n.disposed||!r||!(\"render\"in r))return null;let i=r.view;return i?ee(i,{node:n,buildChild:t}):ee(yw,{node:n,impl:r,buildChild:t})});id.displayName=\"NodeContent\";var Gy=Ro(void 0),Ky=()=>As(Gy),od=({surface:n})=>{let e=Ky();Dr(()=>{e&&Sl(e)},[e]);let t=Bn(()=>({resolver:void 0}),[n]),r=Xe(s=>{hw(n);let a=new Va(n,n.defaultCatalog);t.resolver=a;let c=ln(()=>{Be(a.rootNode),s()});return()=>{c(),a.dispose(),t.resolver===a&&(t.resolver=void 0)}},[n,t]),i=Xe(()=>t.resolver?Ye(t.resolver.rootNode):void 0,[t]),o=wi(r,i);return o?ee(Ie,{children:[ee(rd,{node:o}),ee(Hy,{surface:n,owner:null})]}):ee(Uy,{componentId:\"root\"})};function Ei(n,e){let t=go(e,(o,s)=>!(o.props!==s.props||o.buildChild!==s.buildChild||o.context.componentModel.id!==s.context.componentModel.id||o.context.dataContext.path!==s.context.dataContext.path)),r=({context:o,buildChild:s})=>{let a=mt(null);a.current?a.current.context!==o&&(a.current.dispose(),a.current=new Mn(o,n.schema)):a.current=new Mn(o,n.schema);let c=a.current,u=Xe(f=>{let m=c.subscribe(f);return()=>m.unsubscribe()},[c]),l=Xe(()=>c.snapshot,[c]),p=wi(u,l);return wt(()=>()=>c.dispose(),[c]),ee(t,{props:p||{},buildChild:s,context:o})},i=({node:o,buildChild:s})=>{let{viewProps:a,context:c,viewBuildChild:u}=Wy(o,s);return ee(t,{props:a,buildChild:u,context:c})};return i.displayName=`${n.name}.view`,{name:n.name,schema:n.schema,render:r,view:i}}var yo=class extends Error{#e;#t;#r;#i;constructor({name:e,code:t,message:r,node:i,cause:o,range:s}){super(r,o?{cause:o}:void 0),this.name=e,this.#t=t,this.#i=r,this.#e=i,this.#r=s&&sd(s)||sd(i),i?.input&&(this.message=Jy(this.#i,i,this.#r))}get node(){return this.#e}get code(){return this.#t}get range(){return this.#r}get summary(){return this.#i}withAst(e){return this.#e||!e?.input?this:(this.#e=e,this.#r??=sd(e),this.message=Jy(this.#i,e,this.#r),this)}};function ad(n,e,t,r,i){if(typeof t==\"string\")return{name:n,code:e,message:t,node:r,cause:i};let o=t;if(typeof o!=\"object\")throw new Error(\"First param to error must be a string or object\");return{name:n,code:o.code||e,message:o.message,node:o.node,cause:o.cause,range:o.range}}var Ds=class extends yo{constructor(e,t,r){super(ad(\"ParseError\",\"parse_error\",e,t,r))}},Si=class extends yo{constructor(e,t,r){super(ad(\"EvaluationError\",\"evaluation_error\",e,t,r))}},ws=class extends yo{constructor(e,t,r){super(ad(\"TypeError\",\"type_error\",e,t,r))}};function qe(n,e,t){return typeof n==\"object\"?new Ds(n):new Ds({code:n,message:e,node:t})}function H(n,e,t){return typeof n==\"object\"?new Si(n):new Si({code:n,message:e,node:t})}function Yy(n,e,t){return typeof n==\"object\"?new ws(n):new ws({code:n,message:e,node:t})}function sd(n){let e=n?.pos??n?.start;if(typeof e!=\"number\")return;let t=typeof n.end==\"number\"?n.end:e;return{start:e,end:t}}function Jy(n,e,t){let r=e.pos??t?.start;if(typeof r!=\"number\")return n;let i=e.input,o=1,s=0,a=0;for(;s<r;)i[s]===`\n`?(o++,a=0):a++,s++;let c=r,u=r;for(;c>0&&i[c-1]!==`\n`;)c--;for(;u<i.length&&i[u]!==`\n`;)u++;let l=i.slice(c,u),p=`> ${`${o}`.padStart(4,\" \")} | ${l}\n${\" \".repeat(9+a)}^`;return`${n}\n\n${p}`}function Es(n,e){return n instanceof yo?n.withAst(e):n}var Et=class n{#e;constructor(e){this.#e=e}static of(e){return e===void 0?Ss:new n(e)}static none(){return Ss}hasValue(){return this.#e!==void 0}value(){if(this.#e===void 0)throw H(\"optional_value_missing\",\"Optional value is not present\");return this.#e}or(e){if(this.#e!==void 0)return this;if(e instanceof n)return e;throw H(\"invalid_optional_argument\",\"Optional.or must be called with an Optional argument\")}orValue(e){return this.#e===void 0?e:this.#e}get[Symbol.toStringTag](){return\"optional\"}[Symbol.for(\"nodejs.util.inspect.custom\")](){return this.#e===void 0?\"Optional { none }\":`Optional { value: ${JSON.stringify(this.#e)} }`}},Ss=Object.freeze(new Et),xc=class{},Xy=new xc;function Qy(n,e){let t=e?Xy:void 0;n.deleteVariable(\"optional\"),n.registerConstant(\"optional\",\"OptionalNamespace\",t)}function eb(n){let e={async:!1},t=(f,m)=>n.registerFunctionOverload(f,m,e),r=n.enableOptionalTypes?Xy:void 0;n.registerType(\"OptionalNamespace\",xc),n.registerConstant(\"optional\",\"OptionalNamespace\",r),t(\"optional.hasValue(): bool\",f=>f.hasValue()),t(\"optional<A>.value(): A\",f=>f.value()),n.registerFunctionOverload(\"OptionalNamespace.none(): optional<T>\",()=>Et.none()),t(\"OptionalNamespace.of(A): optional<A>\",(f,m)=>Et.of(m));function i(f,m,g){if(f instanceof Et)return f;throw H(\"optional_expected\",`${g} must be optional`,m)}function o(f,m,g){let h=f.run(m.receiver,g);return h instanceof Promise?h.then(b=>s(b,f,m,g)):s(h,f,m,g)}function s(f,m,g,h){let b=i(f,g.receiver,`${g.functionDesc} receiver`);return b.hasValue()?g.onHasValue(b):g.onEmpty(m,g,h)}function a(f,m,g,h){let b=f.check(m,g);if(b.kind===\"optional\")return b;if(b.kind===\"dyn\")return f.getType(\"optional\");throw f.createError(\"optional_expected\",`${h} must be optional, got '${b}'`,m)}function c({functionDesc:f,evaluate:m,typeCheck:g,onHasValue:h,onEmpty:b}){return({ast:v,args:x,receiver:$})=>({ast:v,functionDesc:f,receiver:$,arg:x[0],evaluate:m,typeCheck:g,onHasValue:h,onEmpty:b})}let u=\"optional.orValue() receiver\",l=\"optional.or(optional) receiver\",p=\"optional.or(optional) argument\";n.registerFunctionOverload(\"optional.or(ast): optional<dyn>\",c({functionDesc:\"optional.or(optional)\",evaluate:o,typeCheck(f,m,g){let h=a(f,m.receiver,g,l),b=a(f,m.arg,g,p);m.receiver.maybeAsync||m.arg.maybeAsync||m.ast.setMeta(\"async\",!1);let v=h.unify(f.registry,b);if(v)return v;throw f.createError(\"incompatible_argument_type\",`${m.functionDesc} argument must be compatible type, got '${h}' and '${b}'`,m.arg)},onHasValue:f=>f,onEmpty(f,m,g){let h=m.arg,b=f.run(h,g);return b instanceof Promise?b.then(v=>i(v,h,p)):i(b,h,p)}})),n.registerFunctionOverload(\"optional.orValue(ast): dyn\",c({functionDesc:\"optional.orValue(value)\",onHasValue:f=>f.value(),onEmpty(f,m,g){return f.run(m.arg,g)},evaluate:o,typeCheck(f,m,g){let h=a(f,m.receiver,g,u).valueType,b=f.check(m.arg,g);m.receiver.maybeAsync||m.arg.maybeAsync||m.ast.setMeta(\"async\",!1);let v=h.unify(f.registry,b);if(v)return v;throw f.createError(\"incompatible_argument_type\",`${m.functionDesc} argument must be compatible type, got '${h}' and '${b}'`,m.arg)}}))}var bo=Object.hasOwn,Ze=Object.keys,Jt=Object.freeze,tb=Object.entries,Ti=Array.isArray,cd=Array.from,ki=0n,nb=18446744073709551615n,Ac=9223372036854775807n,Cc=-9223372036854775808n;function Ts(n,e){return n?.[Symbol.toStringTag]===\"AsyncFunction\"?!0:typeof e==\"boolean\"?e:!0}var vo=new Set([\"as\",\"break\",\"const\",\"continue\",\"else\",\"for\",\"function\",\"if\",\"import\",\"let\",\"loop\",\"package\",\"namespace\",\"return\",\"var\",\"void\",\"while\",\"__proto__\",\"prototype\"]);var Ne=class{#e;constructor(e){this.verify(typeof e==\"bigint\"?e:BigInt(e))}get value(){return this.#e}valueOf(){return this.#e}toString(){return`${this.#e}`}verify(e){if(e<ki||e>nb)throw H(\"numeric_overflow\",\"Unsigned integer overflow\");this.#e=e}get[Symbol.toStringTag](){return`value = ${this.#e}`}[Symbol.for(\"nodejs.util.inspect.custom\")](){return`UnsignedInteger { value: ${this.#e} }`}},_o=1e9,xo=1000000000n,bw={h:3600000000000n,m:60000000000n,s:xo,ms:1000000n,us:1000n,\u00B5s:1000n,ns:1n},wr=class n{#e;#t;constructor(e,t=0){this.#e=BigInt(e),this.#t=t}get seconds(){return this.#e}get nanos(){return this.#t}valueOf(){return Number(this.#e)*1e3+this.#t/1e6}static fromMilliseconds(e){let t=BigInt(Math.trunc(e*1e6)),r=t/xo,i=Number(t%xo);return new n(r,i)}addDuration(e){let t=this.#t+e.nanos;return new n(this.#e+e.seconds+BigInt(Math.floor(t/_o)),t%_o)}subtractDuration(e){let t=this.#t-e.nanos;return new n(this.#e-e.seconds+BigInt(Math.floor(t/_o)),(t+_o)%_o)}extendTimestamp(e){return new Date(e.getTime()+Number(this.#e)*1e3+Math.floor(this.#t/1e6))}subtractTimestamp(e){return new Date(e.getTime()-Number(this.#e)*1e3-Math.floor(this.#t/1e6))}toString(){let e=this.#t?(this.#t/_o).toLocaleString(\"en-US\",{useGrouping:!1,maximumFractionDigits:9}).slice(1):\"\";return`${this.#e}${e}s`}getHours(){return this.#e/3600n}getMinutes(){return this.#e/60n}getSeconds(){return this.#e}getMilliseconds(){return this.#e*1000n+BigInt(Math.floor(this.#t/1e6))}get[Symbol.toStringTag](){return\"google.protobuf.Duration\"}[Symbol.for(\"nodejs.util.inspect.custom\")](){return`google.protobuf.Duration { seconds: ${this.#e}, nanos: ${this.#t} }`}};function ib(n){let e={async:!1},t=(h,b)=>n.registerFunctionOverload(h,b,e),r=h=>h;t(\"dyn(dyn): dyn\",r);for(let h in Vn){let b=Vn[h];b instanceof Me&&t(`type(${b.name}): type`,()=>b)}t(\"bool(bool): bool\",r),t(\"bool(string): bool\",h=>{switch(h){case\"1\":case\"t\":case\"true\":case\"TRUE\":case\"True\":return!0;case\"0\":case\"f\":case\"false\":case\"FALSE\":case\"False\":return!1;default:throw H(\"bool_conversion_error\",`bool() conversion error: invalid string value \"${h}\"`)}}),t(\"size(string): int\",h=>BigInt(rb(h))),t(\"size(bytes): int\",h=>BigInt(h.length)),t(\"size(list): int\",h=>BigInt(h.length??h.size)),t(\"size(map): int\",h=>BigInt(h instanceof Map?h.size:Ze(h).length)),t(\"string.size(): int\",h=>BigInt(rb(h))),t(\"bytes.size(): int\",h=>BigInt(h.length)),t(\"list.size(): int\",h=>BigInt(h.length??h.size)),t(\"map.size(): int\",h=>BigInt(h instanceof Map?h.size:Ze(h).length)),t(\"bytes(string): bytes\",h=>s.fromString(h)),t(\"bytes(bytes): bytes\",r),t(\"double(double): double\",r),t(\"double(int): double\",h=>Number(h)),t(\"double(uint): double\",h=>Number(h)),t(\"double(string): double\",h=>{if(!h||h!==h.trim())throw H(\"double_conversion_error\",\"double() type error: cannot convert to double\");switch(h.toLowerCase()){case\"inf\":case\"+inf\":case\"infinity\":case\"+infinity\":return Number.POSITIVE_INFINITY;case\"-inf\":case\"-infinity\":return Number.NEGATIVE_INFINITY;case\"nan\":return Number.NaN;default:{let v=Number(h);if(!Number.isNaN(v))return v;throw H(\"double_conversion_error\",\"double() type error: cannot convert to double\")}}}),t(\"int(int): int\",r),t(\"int(double): int\",h=>{if(Number.isFinite(h))return BigInt(Math.trunc(h));throw H(\"numeric_overflow\",\"int() type error: integer overflow\")}),t(\"int(string): int\",h=>{if(h!==h.trim()||h.length>20||h.includes(\"0x\"))throw H(\"int_conversion_error\",\"int() type error: cannot convert to int\");try{let b=BigInt(h);if(b<=Ac&&b>=Cc)return b}catch{}throw H(\"int_conversion_error\",\"int() type error: cannot convert to int\")}),t(\"uint(uint): uint\",r),t(\"uint(int): uint\",h=>{try{return new Ne(h)}catch{throw H(\"uint_conversion_error\",\"uint() type error: cannot convert to uint\")}}),t(\"uint(double): uint\",h=>{try{return new Ne(Math.trunc(h))}catch{throw H(\"numeric_overflow\",\"uint() type error: unsigned integer overflow\")}}),t(\"uint(string): uint\",h=>{if(h!==h.trim()||h.length>20||h.includes(\"0x\"))throw H(\"uint_conversion_error\",\"uint() type error: cannot convert to uint\");try{return new Ne(h)}catch{throw H(\"uint_conversion_error\",\"uint() type error: cannot convert to uint\")}}),t(\"string(string): string\",r),t(\"string(bool): string\",h=>`${h}`),t(\"string(int): string\",h=>`${h}`),t(\"string(uint): string\",h=>`${h}`),t(\"string(bytes): string\",h=>s.toUtf8(h)),t(\"string(double): string\",h=>h===1/0?\"+Inf\":h===-1/0?\"-Inf\":`${h}`),t(\"string.startsWith(string): bool\",(h,b)=>h.startsWith(b)),t(\"string.endsWith(string): bool\",(h,b)=>h.endsWith(b)),t(\"string.contains(string): bool\",(h,b)=>h.includes(b)),t(\"string.lowerAscii(): string\",h=>h.toLowerCase()),t(\"string.upperAscii(): string\",h=>h.toUpperCase()),t(\"string.trim(): string\",h=>h.trim()),t(\"string.indexOf(string): int\",(h,b)=>BigInt(h.indexOf(b))),t(\"string.indexOf(string, int): int\",(h,b,v)=>{if(b===\"\")return v;if(v=Number(v),v<0||v>=h.length)throw H(\"index_out_of_range\",\"string.indexOf(search, fromIndex): fromIndex out of range\");return BigInt(h.indexOf(b,v))}),t(\"string.lastIndexOf(string): int\",(h,b)=>BigInt(h.lastIndexOf(b))),t(\"string.lastIndexOf(string, int): int\",(h,b,v)=>{if(b===\"\")return v;if(v=Number(v),v<0||v>=h.length)throw H(\"index_out_of_range\",\"string.lastIndexOf(search, fromIndex): fromIndex out of range\");return BigInt(h.lastIndexOf(b,v))}),t(\"string.substring(int): string\",(h,b)=>{if(b=Number(b),b<0||b>h.length)throw H(\"index_out_of_range\",\"string.substring(start, end): start index out of range\");return h.substring(b)}),t(\"string.substring(int, int): string\",(h,b,v)=>{if(b=Number(b),b<0||b>h.length)throw H(\"index_out_of_range\",\"string.substring(start, end): start index out of range\");if(v=Number(v),v<b||v>h.length)throw H(\"index_out_of_range\",\"string.substring(start, end): end index out of range\");return h.substring(b,v)}),t(\"string.matches(string): bool\",(h,b)=>{try{return new RegExp(b).test(h)}catch{throw H(\"invalid_regular_expression\",`Invalid regular expression: ${b}`)}}),t(\"string.split(string): list<string>\",(h,b)=>h.split(b)),t(\"string.split(string, int): list<string>\",(h,b,v)=>{if(v=Number(v),v===0)return[];let x=h.split(b);if(v<0||x.length<=v)return x;let $=x.slice(0,v-1);return $.push(x.slice(v-1).join(b)),$}),t(\"list<string>.join(): string\",h=>{for(let b=0;b<h.length;b++)if(typeof h[b]!=\"string\")throw H(\"invalid_list_element_type\",\"string.join(): list must contain only strings\");return h.join(\"\")}),t(\"list<string>.join(string): string\",(h,b)=>{for(let v=0;v<h.length;v++)if(typeof h[v]!=\"string\")throw H(\"invalid_list_element_type\",\"string.join(separator): list must contain only strings\");return h.join(b)});let i=new TextEncoder(\"utf8\"),o=new TextDecoder(\"utf8\"),s=typeof Buffer<\"u\"?{byteLength:h=>Buffer.byteLength(h),fromString:h=>Buffer.from(h,\"utf8\"),toHex:h=>Buffer.prototype.hexSlice.call(h,0,h.length),toBase64:h=>Buffer.prototype.base64Slice.call(h,0,h.length),toUtf8:h=>Buffer.prototype.utf8Slice.call(h,0,h.length),jsonParse:h=>JSON.parse(h)}:{textEncoder:new TextEncoder(\"utf8\"),byteLength:h=>i.encode(h).length,fromString:h=>i.encode(h),toHex:Uint8Array.prototype.toHex?h=>h.toHex():h=>cd(h,b=>b.toString(16).padStart(2,\"0\")).join(\"\"),toBase64:Uint8Array.prototype.toBase64?h=>h.toBase64():h=>btoa(cd(h,b=>String.fromCodePoint(b)).join(\"\")),toUtf8:h=>o.decode(h),jsonParse:h=>JSON.parse(i.decode(h))};t(\"bytes.json(): map\",s.jsonParse),t(\"bytes.hex(): string\",s.toHex),t(\"bytes.string(): string\",s.toUtf8),t(\"bytes.base64(): string\",s.toBase64),t(\"bytes.at(int): int\",(h,b)=>{if(b<0||b>=h.length)throw H(\"index_out_of_range\",\"Bytes index out of range\");return BigInt(h[b])});let a=\"google.protobuf.Timestamp\",c=\"google.protobuf.Duration\",u=n.registerType(a,Date).typeType,l=n.registerType(c,wr).typeType;n.registerConstant(\"google\",\"map<string, map<string, type>>\",{protobuf:{Duration:l,Timestamp:u}});function p(h,b){return new Date(h.toLocaleString(\"en-US\",{timeZone:b}))}function f(h,b){let v=b?p(h,b):new Date(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate()),x=new Date(v.getFullYear(),0,0);return BigInt(Math.floor((v-x)/864e5)-1)}t(`timestamp(string): ${a}`,h=>{if(h.length<20||h.length>30)throw H(\"invalid_timestamp\",\"timestamp() requires a string in ISO 8601 format\");let b=new Date(h);if(b<=0xe677d21fdbff&&b>=-621355968e5)return b;throw H(\"invalid_timestamp\",\"timestamp() requires a string in ISO 8601 format\")}),t(`timestamp(int): ${a}`,h=>{if(h=Number(h)*1e3,h<=0xe677d21fdbff&&h>=-621355968e5)return new Date(h);throw H(\"invalid_timestamp\",\"timestamp() requires a valid integer unix timestamp\")}),t(`${a}.getDate(): int`,h=>BigInt(h.getUTCDate())),t(`${a}.getDate(string): int`,(h,b)=>BigInt(p(h,b).getDate())),t(`${a}.getDayOfMonth(): int`,h=>BigInt(h.getUTCDate()-1)),t(`${a}.getDayOfMonth(string): int`,(h,b)=>BigInt(p(h,b).getDate()-1)),t(`${a}.getDayOfWeek(): int`,h=>BigInt(h.getUTCDay())),t(`${a}.getDayOfWeek(string): int`,(h,b)=>BigInt(p(h,b).getDay())),t(`${a}.getDayOfYear(): int`,f),t(`${a}.getDayOfYear(string): int`,f),t(`${a}.getFullYear(): int`,h=>BigInt(h.getUTCFullYear())),t(`${a}.getFullYear(string): int`,(h,b)=>BigInt(p(h,b).getFullYear())),t(`${a}.getHours(): int`,h=>BigInt(h.getUTCHours())),t(`${a}.getHours(string): int`,(h,b)=>BigInt(p(h,b).getHours())),t(`${a}.getMilliseconds(): int`,h=>BigInt(h.getUTCMilliseconds())),t(`${a}.getMilliseconds(string): int`,h=>BigInt(h.getUTCMilliseconds())),t(`${a}.getMinutes(): int`,h=>BigInt(h.getUTCMinutes())),t(`${a}.getMinutes(string): int`,(h,b)=>BigInt(p(h,b).getMinutes())),t(`${a}.getMonth(): int`,h=>BigInt(h.getUTCMonth())),t(`${a}.getMonth(string): int`,(h,b)=>BigInt(p(h,b).getMonth())),t(`${a}.getSeconds(): int`,h=>BigInt(h.getUTCSeconds())),t(`${a}.getSeconds(string): int`,(h,b)=>BigInt(p(h,b).getSeconds()));let m=/(\\d*\\.?\\d*)(ns|us|\u00B5s|ms|s|m|h)/;function g(h){if(!h)throw H(\"invalid_duration\",\"Invalid duration string: ''\");let b=h[0]===\"-\";(h[0]===\"-\"||h[0]===\"+\")&&(h=h.slice(1));let v=BigInt(0);for(;;){let M=m.exec(h);if(!M)throw H(\"invalid_duration\",`Invalid duration string: ${h}`);if(M.index!==0)throw H(\"invalid_duration\",`Invalid duration string: ${h}`);h=h.slice(M[0].length);let w=bw[M[2]],[N=\"0\",L=\"\"]=M[1].split(\".\"),V=BigInt(N)*w,O=L?BigInt(L.slice(0,13).padEnd(13,\"0\"))*w/10000000000000n:0n;if(v+=V+O,h===\"\")break}let x=v>=xo?v/xo:0n,$=Number(v%xo);return b?new wr(-x,-$):new wr(x,$)}t(\"duration(string): google.protobuf.Duration\",h=>g(h)),t(\"google.protobuf.Duration.getHours(): int\",h=>h.getHours()),t(\"google.protobuf.Duration.getMinutes(): int\",h=>h.getMinutes()),t(\"google.protobuf.Duration.getSeconds(): int\",h=>h.getSeconds()),t(\"google.protobuf.Duration.getMilliseconds(): int\",h=>h.getMilliseconds()),eb(n)}function rb(n){let e=0;for(let t of n)e++;return e}var Me=class{#e;constructor(e){this.#e=e,Jt(this)}get name(){return this.#e}get[Symbol.toStringTag](){return`Type<${this.#e}>`}toString(){return`Type<${this.#e}>`}},Vn={string:new Me(\"string\"),bool:new Me(\"bool\"),int:new Me(\"int\"),uint:new Me(\"uint\"),double:new Me(\"double\"),map:new Me(\"map\"),list:new Me(\"list\"),bytes:new Me(\"bytes\"),null_type:new Me(\"null\"),type:new Me(\"type\")},vw=new Me(\"optional\"),Ec={dyn(n,e){switch(typeof n){case\"string\":case\"bigint\":case\"number\":case\"boolean\":return!0;case\"object\":switch(n&&n.constructor){case null:case void 0:case Object:case Map:case Array:case Set:return!0;default:if(e.objectTypesByConstructor.get(n.constructor))return!0}}return!!e.debugType(n)},string(n){return typeof n==\"string\"},int(n){return typeof n==\"bigint\"},double(n){return typeof n==\"number\"},bool(n){return typeof n==\"boolean\"},null(n){return n===null},bytes(n){return n instanceof Uint8Array},uint(n){return n instanceof Ne},type(n){return n instanceof Me},list(n){switch(n?.constructor){case Array:case Set:return!0;default:return!1}},map(n){switch(typeof n==\"object\"&&n?n.constructor:null){case void 0:case Object:case Map:return!0;default:return!1}},optional(n){return n instanceof Et},message(n,e){return this===e.debugType(n)}};Ec.param=Ec.dyn;var Yt=class{#e=new WeakMap;constructor({kind:e,type:t,name:r,keyType:i,valueType:o}){this.kind=e,this.type=t,this.name=r,this.keyType=i,this.valueType=o,this.unwrappedType=e===\"dyn\"&&o?o.unwrappedType:this,this.wrappedType=e===\"dyn\"?this:ub(this.unwrappedType),this.hasDynType=this.kind===\"dyn\"||this.valueType?.hasDynType||this.keyType?.hasDynType||!1,this.hasPlaceholderType=this.kind===\"param\"||this.keyType?.hasPlaceholderType||this.valueType?.hasPlaceholderType||!1,e===\"list\"?this.fieldLazy=this.#s:e===\"map\"?this.fieldLazy=this.#i:e===\"message\"?this.fieldLazy=this.#r:e===\"optional\"&&(this.fieldLazy=this.#t),this.matchesValueType=Ec[r]||Ec[e],Jt(this)}isDynOrBool(){return this.type===\"bool\"||this.kind===\"dyn\"}isEmpty(){return this.valueType&&this.valueType.kind===\"param\"}unify(e,t){let r=this;if(r===t||r.kind===\"dyn\"||t.kind===\"param\")return r;if(t.kind===\"dyn\"||r.kind===\"param\")return t;if(r.kind!==t.kind||!(r.hasPlaceholderType||t.hasPlaceholderType||r.hasDynType||t.hasDynType))return null;let i=r.valueType.unify(e,t.valueType);if(!i)return null;switch(r.kind){case\"optional\":return e.getOptionalType(i);case\"list\":return e.getListType(i);case\"map\":let o=r.keyType.unify(e,t.keyType);return o?e.getMapType(o,i):null}}templated(e,t){if(!this.hasPlaceholderType)return this;switch(this.kind){case\"dyn\":return this.valueType.templated(e,t);case\"param\":return t?.get(this.name)||this;case\"map\":return e.getMapType(this.keyType.templated(e,t),this.valueType.templated(e,t));case\"list\":return e.getListType(this.valueType.templated(e,t));case\"optional\":return e.getOptionalType(this.valueType.templated(e,t));default:return this}}toString(){return this.name}#t(e,t,r,i){if(e=e instanceof Et?e.orValue():e,e===void 0)return Ss;let o=i.debugType(e);try{return Et.of(o.fieldLazy(e,t,r,i))}catch(s){if(s instanceof Si)return Ss;throw s}}#r(e,t,r,i){let o=e?i.objectTypesByConstructor.get(e.constructor):void 0;if(!o)return;let s=o.fields?o.fields[t]:gt;if(!s)return;let a=e instanceof Map?e.get(t):e[t];if(a!==void 0){if(s.matchesValueType(a,i))return a;throw H(\"field_type_mismatch\",`Field '${t}' is not of type '${s}', got '${i.debugType(a)}'`,r)}}#i(e,t,r,i){let o=e instanceof Map?e.get(t):e&&bo(e,t)?e[t]:void 0;if(o!==void 0){if(this.valueType.matchesValueType(o,i))return o;throw H(\"field_type_mismatch\",`Field '${t}' is not of type '${this.valueType}', got '${i.debugType(o)}'`,r)}}#o(e,t){switch(e?.constructor){case Array:return e[t];case Set:{let r=0;for(let i of e)if(r++===t)return i}}}#s(e,t,r,i){if(typeof t==\"bigint\")t=Number(t);else if(typeof t!=\"number\")return;let o=this.#o(e,t);if(o===void 0){if(!e)return;throw H(\"index_out_of_bounds\",`No such key: index out of bounds, index ${t} ${t<0?\"< 0\":`>= size ${e.length||e.size}`}`,r)}if(this.valueType.matchesValueType(o,i))return o;throw H(\"list_item_type_mismatch\",`List item with index '${t}' is not of type '${this.valueType}', got '${i.debugType(o)}'`,r)}fieldLazy(){}field(e,t,r,i){let o=this.fieldLazy(e,t,r,i);if(o!==void 0)return o;throw H(\"no_such_key\",`No such key: ${t}`,r)}matchesBoth(e){return this.matches(e)&&e.matches(this)}matches(e){let t=this.unwrappedType;return e=e.unwrappedType,t===e||t.kind===\"dyn\"||e.kind===\"dyn\"||e.kind===\"param\"?!0:this.#e.get(e)??this.#e.set(e,this.#n(t,e)).get(e)}#n(e,t){switch(e.kind){case\"dyn\":case\"param\":return!0;case\"list\":return t.kind===\"list\"&&e.valueType.matches(t.valueType);case\"map\":return t.kind===\"map\"&&e.keyType.matches(t.keyType)&&e.valueType.matches(t.valueType);case\"optional\":return t.kind===\"optional\"&&e.valueType.matches(t.valueType);default:return e.name===t.name}}},_w=\"have a .callAst property or .evaluate(checker, macro, ctx) method.\",xw=\"have a .callAst property or .typeCheck(checker, macro, ctx) method.\";function Aw(n,e){let t=`Macro '${n}' must`;return function(i){let o=e(i);if(!o||typeof o!=\"object\")throw new Error(`${t} return an object.`);if(o.callAst)return o;if(!o.evaluate)throw new Error(`${t} ${_w}`);if(!o.typeCheck)throw new Error(`${t} ${xw}`);return o}}var ks=class{constructor(e,t,r,i){this.name=e,this.type=t,this.description=r??null,this.constant=i!==void 0,this.value=i,Jt(this)}},ld=class{constructor({name:e,receiverType:t,returnType:r,handler:i,description:o,params:s,async:a}){if(typeof e!=\"string\")throw new Error(\"name must be a string\");if(typeof i!=\"function\")throw new Error(\"handler must be a function\");this.name=e,this.async=Ts(i,a),this.receiverType=t??null,this.returnType=r,this.description=o??null,this.params=s,this.argTypes=s.map(u=>u.type),this.macro=this.argTypes.includes(db);let c=t?`${t}.`:\"\";this.signature=`${c}${e}(${this.argTypes.join(\", \")}): ${r}`,this.handler=this.macro?Aw(this.signature,i):i,this.partitionKey=`${t?\"rcall\":\"call\"}:${e}:${s.length}`,this.hasPlaceholderType=this.returnType.hasPlaceholderType||this.receiverType?.hasPlaceholderType||this.argTypes.some(u=>u.hasPlaceholderType)||!1,Jt(this)}matchesArgs(e){return e.length===this.argTypes.length&&this.argTypes.every((t,r)=>t.matches(e[r]))?this:null}},$i=class{constructor({op:e,leftType:t,rightType:r,handler:i,returnType:o,async:s}){this.operator=e,this.leftType=t,this.rightType=r||null,this.handler=i,this.async=Ts(i,s),this.returnType=o,r?this.signature=`${t} ${e} ${r}: ${o}`:this.signature=`${e}${t}: ${o}`,this.hasPlaceholderType=this.leftType.hasPlaceholderType||this.rightType?.hasPlaceholderType||!1,Jt(this)}equals(e){return this.operator===e.operator&&this.leftType===e.leftType&&this.rightType===e.rightType}};function hd(n){return new Yt({kind:\"list\",name:`list<${n}>`,type:\"list\",valueType:n})}function Un(n){return new Yt({kind:\"primitive\",name:n,type:n})}function Cw(n){return new Yt({kind:\"message\",name:n,type:n})}function ub(n){let e=n?`dyn<${n}>`:\"dyn\";return new Yt({kind:\"dyn\",name:e,type:e,valueType:n})}function lb(n){let e=`optional<${n}>`;return new Yt({kind:\"optional\",name:e,type:\"optional\",valueType:n})}function md(n,e){return new Yt({kind:\"map\",name:`map<${n}, ${e}>`,type:\"map\",keyType:n,valueType:e})}function Dw(n){return new Yt({kind:\"param\",name:n,type:n})}var gt=ub(),db=Un(\"ast\"),ob=hd(gt),sb=md(gt,gt),ye={string:Un(\"string\"),bool:Un(\"bool\"),int:Un(\"int\"),uint:Un(\"uint\"),double:Un(\"double\"),bytes:Un(\"bytes\"),dyn:gt,null:Un(\"null\"),type:Un(\"type\"),optional:lb(gt),list:ob,\"list<dyn>\":ob,map:sb,\"map<dyn, dyn>\":sb};for(let n of[ye.string,ye.double,ye.int]){let e=hd(n),t=md(ye.string,n);ye[e.name]=e,ye[t.name]=t}Object.freeze(ye);var dd=class{returnType=null;async=!1;macro=!1;#e=null;#t=null;declarations=[];constructor(e){this.registry=e}[Symbol.iterator](){return this.declarations[Symbol.iterator]()}add(e){this.returnType=(this.returnType||e.returnType).unify(this.registry,e.returnType)||gt,e.macro&&(this.macro=e),e.async&&!this.async&&(this.async=!0),this.declarations.push(e),this.#e?.clear(),this.#t?.clear()}findFunction(e,t=null){for(let r=0;r<this.declarations.length;r++){let i=this.#a(this.declarations[r],e,t);if(i)return i}return null}findUnaryOverload(e){let t=(this.#e??=new Map).get(e);if(t!==void 0)return t;let r=!1;for(let i of this.declarations)if(i.leftType===e){r=i;break}return this.#e.set(e,r),r}findBinaryOverload(e,t){return e.kind===\"dyn\"&&e.valueType?t=t.wrappedType:t.kind===\"dyn\"&&t.valueType&&(e=e.wrappedType),(this.#e??=new Map).get(e)?.get(t)??this.#r(this.#e,e,t,this.#i(e,t))}checkBinaryOverload(e,t){return(this.#t??=new Map).get(e)?.get(t)??this.#r(this.#t,e,t,this.#o(e,t))}#r(e,t,r,i){return(e.get(t)||e.set(t,new Map).get(t)).set(r,i),i}#i(e,t){let r=this.#s(e,t);if(r.length===0)return!1;if(r.length===1)return r[0];throw new Error(`Operator overload '${r[0].signature}' overlaps with '${r[1].signature}'.`)}#o(e,t){let r=this.#s(e,t);if(r.length===0)return!1;let i=r[0].returnType;for(let o=1;o<r.length;o++)i=i.unify(this.registry,r[o].returnType)||gt;return i}#s(e,t){let r=[];for(let i of this.declarations){if(i.leftType===e&&i.rightType===t)return[i];let o=this.#n(i,e,t);o&&r.push(o)}if(r.length===0){let i=this.declarations[0]?.operator;if((i===\"==\"||i===\"!=\")&&e.kind===\"dyn\")return Sw[i]}return r}#n(e,t,r){let i=e.hasPlaceholderType?new Map:null,o=this.#u(e.leftType,t,i);if(!o)return;let s=this.#u(e.rightType,r,i);if(s)return(e.operator===\"==\"||e.operator===\"!=\")&&e.leftType.kind===\"dyn\"&&e.leftType.valueType&&t.kind!==\"dyn\"&&r.kind!==\"dyn\"?!1:e.hasPlaceholderType?{async:e.async,signature:e.signature,handler:e.handler,leftType:o,rightType:s,returnType:e.returnType.templated(this.registry,i)}:e}#a(e,t,r){if(e.hasPlaceholderType)return this.#d(e,t,r);if(!(r&&e.receiverType&&!r.matches(e.receiverType)))return e.matchesArgs(t)}#d(e,t,r){let i=new Map;if(r&&e.receiverType&&!this.#u(e.receiverType,r,i))return null;for(let o=0;o<t.length;o++)if(!this.#u(e.argTypes[o],t[o],i))return null;return{async:e.async,handler:e.handler,signature:e.signature,returnType:e.returnType.templated(this.registry,i)}}#u(e,t,r){if(!e.hasPlaceholderType)return t.matches(e)?t:null;let i=t.kind===\"dyn\";return this.#l(e,t,r,i)&&(i||t.matches(e.templated(this.registry,r)))?t:null}#l(e,t,r,i=!1){if(!e.hasPlaceholderType)return!0;if(!t)return!1;let o=i||t.kind===\"dyn\";switch(t=t.unwrappedType,e.kind){case\"param\":{let s=o?gt:t,a=r.get(e.name);return a?a.kind===\"dyn\"||s.kind===\"dyn\"?!0:a.matchesBoth(s):r.set(e.name,s)&&!0}case\"list\":return t.name===\"dyn\"&&(t=e),t.kind!==\"list\"?!1:this.#l(e.valueType,t.valueType,r,o);case\"map\":return t.name===\"dyn\"&&(t=e),t.kind!==\"map\"?!1:this.#l(e.keyType,t.keyType,r,o)&&this.#l(e.valueType,t.valueType,r,o);case\"optional\":return t.name===\"dyn\"&&(t=e),t.kind!==\"optional\"?!1:this.#l(e.valueType,t.valueType,r,o)}return!0}};function ab(n){let e=[],t=\"\",r=0;for(let i of n){if(i===\"<\")r++;else if(i===\">\")r--;else if(i===\",\"&&r===0){e.push(t.trim()),t=\"\";continue}t+=i}return t&&e.push(t.trim()),e}var fb=[[Ne,\"uint\",Vn.uint,ye.uint],[Me,\"type\",Vn.type,ye.type],[Et,\"optional\",vw,ye.optional],[Uint8Array,\"bytes\",Vn.bytes,ye.bytes],...typeof Buffer<\"u\"?[[Buffer,\"bytes\",Vn.bytes,ye.bytes]]:[]].map(([n,e,t,r])=>Object.freeze({name:e,typeType:t,type:r,ctor:n})),ww=fb.map(n=>[n.name,n]),Ew=fb.map(n=>[n.ctor,n]),Dc=n=>new Error(`Invalid variable declaration: ${n}`),wc=n=>new Error(`Invalid type declaration: ${n}`),Sw={\"==\":[{handler:(n,e)=>n===e,returnType:ye.bool}],\"!=\":[{handler:(n,e)=>n!==e,returnType:ye.bool}]},fd=class n{#e=null;#t;#r=!0;#i=null;#o=null;#s=null;#n=null;#a=null;#d=null;#u=null;#l=null;#f=!1;constructor(e={}){this.enableOptionalTypes=e.enableOptionalTypes??!1,this.unlistedVariablesAreDyn=e.unlistedVariablesAreDyn??!1;let t=e.parent instanceof n?e.parent:null;if(t){this.#e=t;let r=t;for(;r&&!r.#i;)r=r.#e;let i=t;for(;i&&!i.#o;)i=i.#e;this.#s=t.#s,this.#n=t.#n,this.#l={operators:r.#i,functions:i.#o},this.objectTypes=new Map(t.objectTypes),this.objectTypesByConstructor=new Map(t.objectTypesByConstructor),this.variables=t.variables,this.#r=!1,this.#t=t.#t,this.#a=t.#a,this.#d=t.#d,this.#u=t.#u,(this.enableOptionalTypes!==t.enableOptionalTypes||this.unlistedVariablesAreDyn!==t.unlistedVariablesAreDyn)&&Qy(this,this.enableOptionalTypes)}else{this.#i=[],this.#o=[],this.objectTypes=new Map(ww),this.objectTypesByConstructor=new Map(Ew),this.#t=new Map(tb(ye)),this.#a=new Map,this.#d=new Map,this.#u=new Map,this.variables=new Map,this.variables.dyn=this.unlistedVariablesAreDyn;for(let r in Vn)this.registerConstant(r,\"type\",Vn[r])}}#v(){this.#r||(this.variables=new Map(this.variables),this.variables.dyn=this.unlistedVariablesAreDyn,this.#r=!0)}deleteVariable(e){this.#v(),this.variables.delete(e)}#g(e){this.#i||(this.#s=null),this.operatorCandidates(e.operator).add(e),this.#i.push(e)}#A(e){this.#o||(this.#n=null),this.#y(e.partitionKey).add(e),this.#o.push(e)}#p(e,t){return e.get(t)||e.set(t,new dd(this)).get(t)}#C(){return this.#i?this.#i:this.#i=[...this.#l.operators]}#_(){return this.#o?this.#o:this.#o=[...this.#l.functions]}operatorCandidates(e){if(this.#s)return this.#p(this.#s,e);let t=this.#s=new Map;for(let r of this.#C())this.#p(t,r.operator).add(r);return this.#p(t,e)}functionCandidates(e,t,r){return this.#y(`${e?\"rcall\":\"call\"}:${t}:${r}`)}#y(e){if(this.#n)return this.#p(this.#n,e);let t=this.#n=new Map;for(let r of this.#_())this.#p(t,r.partitionKey).add(r);return this.#p(t,e)}registerVariable(e,t,r){if(this.#f)throw new Error(\"Cannot modify frozen registry\");let i=r?.description,o;if(typeof e==\"string\"&&typeof t==\"object\"&&!(t instanceof Yt)?(i=t.description,o=t.value,t.schema?t=this.registerType({name:`$${e}`,schema:t.schema}).type:t=t.type):typeof e==\"object\"&&(e.schema?t=this.registerType({name:`$${e.name}`,schema:e.schema}).type:t=e.type,i=e.description,o=e.value,e=e.name),typeof e!=\"string\"||!e)throw Dc(\"name must be a string\");if(vo.has(e))throw Dc(`'${e}' is a reserved name`);if(this.variables.get(e)!==void 0)throw Dc(`'${e}' is already registered`);if(typeof t==\"string\")t=this.getType(t);else if(!(t instanceof Yt))throw Dc(\"type is required\");return this.#v(),this.variables.set(e,new ks(e,t,i,o)),this}#D(e,t){let r=Object.create(null);for(let i of Ze(t)){let o=t[i];if(typeof o==\"object\"&&o)r[i]=this.registerType({name:`${e}.${i}`,schema:o}).type.name;else if(typeof o==\"string\")r[i]=o;else throw new Error(`Invalid field definition for '${e}.${i}'`)}return r}registerConstant(e,t,r){return typeof e==\"object\"?this.registerVariable(e):this.registerVariable({name:e,type:t,value:r}),this}getType(e){return this.#c(e,!0)}getListType(e){return this.#a.get(e)||this.#a.set(e,this.#c(`list<${e}>`,!0)).get(e)}getMapType(e,t){return this.#d.get(e)?.get(t)||(this.#d.get(e)||this.#d.set(e,new Map).get(e)).set(t,this.#c(`map<${e}, ${t}>`,!0)).get(t)}getOptionalType(e){return this.#u.get(e)||this.#u.set(e,this.#c(`optional<${e}>`,!0)).get(e)}assertType(e,t,r){try{return this.#c(e,!0)}catch(i){throw i.message=`Invalid ${t} '${i.unknownType||e}' in '${r}'`,i}}getFunctionType(e){if(e===\"ast\")return db;let t=this.#c(e,!0);if(t.kind===\"dyn\"&&t.valueType)throw new Error(`type '${t.name}' is not supported`);return t}registerType(e,t){if(this.#f)throw new Error(\"Cannot modify frozen registry\");if(typeof e==\"object\"&&(t=e,e=t.fullName||t.name||t.ctor?.name),typeof e==\"string\"&&e[0]===\".\"&&(e=e.slice(1)),typeof e!=\"string\"||e.length<2||vo.has(e))throw wc(`name '${e}' is not valid`);if(this.objectTypes.has(e))throw wc(`type '${e}' already registered`);let r=this.#c(e,!1);if(r.kind!==\"message\")throw wc(`type '${e}' is not valid`);let i={name:e,typeType:new Me(e),type:r,ctor:typeof t==\"function\"?t:t?.ctor,convert:typeof t==\"function\"?void 0:t?.convert,fields:typeof t?.schema==\"object\"?this.#x(e,this.#D(e,t.schema)):this.#x(e,typeof t==\"function\"?void 0:t?.fields)};if(typeof i.ctor!=\"function\"){if(!i.fields)throw wc(`type '${e}' requires a constructor or fields`);Object.assign(i,this.#S(e,i.fields))}return this.objectTypes.set(e,Object.freeze(i)),this.objectTypesByConstructor.set(i.ctor,i),this.registerFunctionOverload(`type(${e}): type`,()=>i.typeType,{async:!1}),i}#c(e,t=!0){let r=this.#t.get(e);if(r)return r;if(typeof e!=\"string\"||!e.length)throw new Error(\"Invalid type: must be a string\");if(r=e.match(/^[A-Z]$/),r)return this.#h(Dw,e,e);if(r=e.match(/^(dyn|list|map|optional)<(.+)>$/),!r){if(t){let s=new Error(`Unknown type: ${e}`);throw s.unknownType=e,s}return this.#h(Cw,e,e)}let i=r[1],o=r[2].trim();switch(i){case\"dyn\":{let s=this.#c(o,t).wrappedType;return this.#t.set(s.name,s),s}case\"list\":{let s=this.#c(o,t);return this.#h(hd,`list<${s}>`,s)}case\"map\":{let s=ab(o);if(s.length!==2)throw new Error(`Invalid map type: ${e}`);let a=this.#c(s[0],t),c=this.#c(s[1],t);return this.#h(md,`map<${a}, ${c}>`,a,c)}case\"optional\":{let s=this.#c(o,t);return this.#h(lb,`optional<${s}>`,s)}}}#h(e,t,...r){return this.#t.get(t)||this.#t.set(t,e(...r)).get(t)}findMacro(e,t,r){return this.functionCandidates(t,e,r).macro}findUnaryOverload(e,t){return this.operatorCandidates(e).findUnaryOverload(t)}findBinaryOverload(e,t,r){return this.operatorCandidates(e).findBinaryOverload(t,r)}#w(e){return typeof e==\"string\"?{type:e}:e.id?Tw(e):e}#E(e,t,r,i=!1){try{let o=this.#w(t[r]);if(typeof o?.type!=\"string\")throw new Error(\"unsupported declaration\");return this.#c(o.type,i)}catch(o){throw o.message=`Field '${r}' in type '${e}' has unsupported declaration: ${JSON.stringify(t[r])}`,o}}#x(e,t){if(!t)return;let r=Object.create(null);for(let i of Ze(t))r[i]=this.#E(e,t,i);return r}#S(e,t){let r=Ze(t),i=Object.create(null);for(let s of r){let a=t[s],c=a.kind===\"message\"&&this.objectTypes.get(a.name);c===!1?i[s]=!1:i[s]=c.convert?c:!1}let o={[e]:class extends Map{#m;constructor(s){super(),this.#m=s}[Symbol.iterator](){if(this.size!==r.length)for(let s of r)this.get(s);return super[Symbol.iterator]()}get(s){let a=super.get(s);if(a!==void 0||this.has(s))return a;let c=i[s];if(c!==void 0){if(a=this.#m instanceof Map?this.#m.get(s):this.#m?.[s],c&&a&&typeof a==\"object\")switch(a.constructor){case void 0:case Object:case Map:a=c.convert(a)}return super.set(s,a),a}}}}[e];return{ctor:o,convert(s){if(s)return s.constructor===o?s:new o(s)}}}clone(e){return this.#f=!0,new n({parent:this,unlistedVariablesAreDyn:e.unlistedVariablesAreDyn,enableOptionalTypes:e.enableOptionalTypes})}getDefinitions(){let e=[],t=[];for(let[,r]of this.variables)r&&e.push({name:r.name,description:r.description||null,type:r.type.name});for(let r of this.#_())t.push({signature:r.signature,name:r.name,description:r.description,receiverType:r.receiverType?r.receiverType.name:null,returnType:r.returnType.name,params:r.params.map(i=>({name:i.name,type:i.type.name,description:i.description}))});return{variables:e,functions:t}}#T(e){if(typeof e!=\"string\")throw new Error(\"Invalid signature: must be a string\");let t=e.match(/^(?:([a-zA-Z0-9.<>]+)\\.)?(\\w+)\\(([^)]*)\\):(.*)$/);if(!t)throw new Error(`Invalid signature: ${e}`);let r=t[4].trim();if(!r)throw new Error(`Invalid signature: ${e}`);return{receiverType:t[1]||null,name:t[2],argTypes:ab(t[3]),returnType:r}}#k(e,t){return e.name!==t.name||e.argTypes.length!==t.argTypes.length||(e.receiverType||t.receiverType)&&(!e.receiverType||!t.receiverType)?!1:!(e.receiverType!==t.receiverType&&e.receiverType!==gt&&t.receiverType!==gt)&&(t.macro||e.macro||t.argTypes.every((i,o)=>{let s=e.argTypes[o];return i===s||i===gt||s===gt}))}#$(e){for(let t of this.#y(e.partitionKey))if(this.#k(t,e))throw new Error(`Function signature '${e.signature}' overlaps with existing overload '${t.signature}'.`)}#I(e,t,r){if(!r)return{type:this.getFunctionType(t),name:`arg${e}`,description:null};let i=r.type||t;if(!i)throw new Error(`params[${e}].type is required`);if(t&&i!==t)throw new Error(`params[${e}].type not equal to signature type`);return{name:r.name||`arg${e}`,type:this.getFunctionType(i),description:r.description??null}}registerFunctionOverload(e,t,r){if(this.#f)throw new Error(\"Cannot modify frozen registry\");typeof e==\"object\"?r=e:typeof t==\"object\"?r=t:r||(r={});let i=typeof e==\"string\"?e:r.signature??void 0,o=i!==void 0?this.#T(i):void 0,s=o?.name||r.name,a=o?.receiverType||r.receiverType,c=o?.argTypes,u=o?.returnType||r.returnType,l=r.params;t=typeof t==\"function\"?t:r.handler;let p;try{if(!s)throw new Error(\"signature or name are required\");if(!u)throw new Error(\"must have a returnType\");if(l){if(c&&l.length!==c.length)throw new Error(\"mismatched length in params and args in signature\")}else if(!c)throw new Error(\"signature or params are required\");p=new ld({name:s,async:r?.async,receiverType:a?this.getType(a):null,returnType:this.getType(u),handler:t,description:r.description,params:(c||l).map((f,m)=>this.#I(m,c?.[m],l?.[m]))})}catch(f){throw typeof i==\"string\"?f.message=`Invalid function declaration '${i}': ${f.message}`:s?f.message=`Invalid function declaration '${s}': ${f.message}`:f.message=`Invalid function declaration: ${f.message}`,f}this.#$(p),this.#A(p)}registerOperatorOverload(e,t,r){let i=e.match(/^([-!])([\\w.<>]+)(?::\\s*([\\w.<>]+))?$/);if(i){let[,l,p,f]=i;return this.unaryOverload(l,p,t,f,r?.async)}let o=e.match(/^([\\w.<>]+) ([-+*%/]|==|!=|<|<=|>|>=|in) ([\\w.<>]+)(?::\\s*([\\w.<>]+))?$/);if(!o)throw new Error(`Operator overload invalid: ${e}`);let[,s,a,c,u]=o;return this.binaryOverload(s,a,c,t,u)}unaryOverload(e,t,r,i,o){if(this.#f)throw new Error(\"Cannot modify frozen registry\");let s=this.assertType(t,\"type\",`${e}${t}`),a=this.assertType(i||t,\"return type\",`${e}${t}: ${i||t}`),c=new $i({op:`${e}_`,leftType:s,returnType:a,handler:r,async:o});this.#g(this.#b(c))}#F(e){for(let t of this.operatorCandidates(e.operator))if(e.equals(t))return!0;return!1}#b(e){if(!this.#F(e))return e;throw new Error(`Operator overload already registered: ${e.signature}`)}binaryOverload(e,t,r,i,o,s){if(this.#f)throw new Error(\"Cannot modify frozen registry\");o??=cb.has(t)?\"bool\":e;let a=`${e} ${t} ${r}: ${o}`,c=this.assertType(e,\"left type\",a),u=this.assertType(r,\"right type\",a),l=this.assertType(o,\"return type\",a);if(c.kind===\"dyn\"&&c.valueType?u=u.wrappedType:u.kind===\"dyn\"&&u.valueType&&(c=c.wrappedType),cb.has(t)&&l.type!==\"bool\")throw new Error(`Comparison operator '${t}' must return 'bool', got '${l.type}'`);let p=new $i({op:t,leftType:c,rightType:u,returnType:l,handler:i,async:s});if(p.hasPlaceholderType&&!(u.hasPlaceholderType&&c.hasPlaceholderType))throw new Error(`Operator overload with placeholders must use them in both left and right types: ${a}`);if(this.#b(p),t===\"==\"){let f=[new $i({op:\"!=\",leftType:c,rightType:u,handler(m,g,h,b){return!i(m,g,h,b)},returnType:l,async:s})];c!==u&&f.push(new $i({op:\"==\",leftType:u,rightType:c,handler(m,g,h,b){return i(g,m,h,b)},returnType:l,async:s}),new $i({op:\"!=\",leftType:u,rightType:c,handler(m,g,h,b){return!i(g,m,h,b)},returnType:l,async:s}));for(let m of f)this.#b(m);for(let m of f)this.#g(m)}this.#g(p)}},cb=new Set([\"<\",\"<=\",\">\",\">=\",\"==\",\"!=\",\"in\"]);function pb(n){return new fd(n)}var Ao=class{#e;#t;#r;#i;constructor(e,t){if(this.#e=e.variables,t!=null){if(typeof t!=\"object\")throw H(\"invalid_context\",\"Context must be an object\");t instanceof Map?this.#r=t:this.#t=t}}getValue(e){return this.#i?.get(e)||(this.#t?this.#t[e]:this.#r?.get(e))}getVariable(e){return this.#e.get(e)??(this.#e.dyn&&!vo.has(e)?new ks(e,gt):void 0)}getCheckedValue(e,t){let r=this.getValue(t.args);if(r===void 0)throw e.createError(\"unknown_variable\",`Unknown variable: ${t.args}`,t);if(t.checkedType.matchesValueType(r,e))return r;let i=t.checkedType,o=e.debugType(r);if(i.kind===\"message\"&&o.kind===\"map\"){let s=e.objectTypes.get(i.name)?.convert?.(r);if(s)return(this.#i??=new Map).set(t.args,s),s}throw e.createError(\"variable_type_mismatch\",`Variable '${t.args}' is not of type '${i}', got '${o}'`,t)}forkWithVariable(e,t){return new pd(this,e,t)}},pd=class n{#e;accuType;accuValue;iterValue;constructor(e,t,r){this.#e=e,this.iterVar=t,this.iterType=r}forkWithVariable(e,t){return new n(this,e,t)}reuse(e){if(!this.async)return this.#e=e,this;let t=new n(e,this.iterVar,this.iterType);return t.accuType=this.accuType,t}setIterValue(e,t){if(this.iterType.matchesValueType(e,t))return this.iterValue=e,this;let r=this.iterType,i=t.debugType(e);if(r.kind===\"message\"&&i.kind===\"map\"){let o=t.objectTypes.get(r.name)?.convert?.(e);if(o)return this.iterValue=o,this}throw t.createError(\"variable_type_mismatch\",`Variable '${this.iterVar}' is not of type '${r}', got '${i}'`)}setAccuType(e){return this.accuType=e,this}setAccuValue(e){return this.accuValue=e,this}getValue(e){return this.iterVar===e?this.iterValue:this.#e.getValue(e)}getCheckedValue(e,t){return this.iterVar===t.args?this.iterValue:this.#e.getCheckedValue(e,t)}getVariable(e){return this.iterVar===e?new ks(e,this.iterType):this.#e.getVariable(e)}};function Tw(n){let e;if(n.map){let t=ud(n.keyType,n.resolvedKeyType),r=ud(n.type,n.resolvedType);e=`map<${t}, ${r}>`}else e=ud(n.type,n.resolvedType);return{type:n.repeated?`list<${e}>`:e}}function ud(n,e){switch(n){case\"string\":return\"string\";case\"bytes\":return\"bytes\";case\"bool\":return\"bool\";case\"double\":case\"float\":case\"int32\":case\"int64\":case\"sint32\":case\"sint64\":case\"sfixed32\":case\"sfixed64\":case\"uint32\":case\"uint64\":case\"fixed32\":case\"fixed64\":return\"double\";default:switch(e?.constructor.name){case\"Type\":return e.fullName.slice(1);case\"Enum\":return\"int\"}return n?.includes(\".\")?n:\"dyn\"}}var Db=ye.dyn,Do=class{dynType=ye.dyn;optionalType=ye.optional;stringType=ye.string;intType=ye.int;doubleType=ye.double;boolType=ye.bool;nullType=ye.null;listType=ye.list;mapType=ye.map;constructor(e){this.opts=e.opts,this.registry=e.registry,this.objectTypes=this.registry.objectTypes,this.objectTypesByConstructor=this.registry.objectTypesByConstructor}getType(e){return this.registry.getType(e)}debugType(e){switch(typeof e){case\"string\":return this.stringType;case\"bigint\":return this.intType;case\"number\":return this.doubleType;case\"boolean\":return this.boolType;case\"object\":if(e===null)return this.nullType;switch(e.constructor){case void 0:case Object:case Map:return this.mapType;case Array:case Set:return this.listType;default:return this.objectTypesByConstructor.get(e.constructor)?.type||yd(this,e.constructor?.name||typeof e)}default:yd(this,typeof e)}}};function yd(n,e){throw n.createError(\"unsupported_type\",`Unsupported type: ${e}`)}var hb=n=>Array.isArray(n)?n.some(e=>e.maybeAsync):!1;function vn(n,e,t){return e===!0||e&&(e?.maybeAsync||hb(e))?kw(t):n===!0||n&&(n?.maybeAsync||hb(n))?$w(t):t}function kw(n){return n.__asyncBoth??=function(t,r,i,o){return t instanceof Promise||r instanceof Promise?r instanceof Promise?t instanceof Promise?Promise.all([t,r]).then(s=>n(s[0],s[1],i,o)):r.then(s=>n(t,s,i,o)):t.then(s=>n(s,r,i,o)):n(t,r,i,o)}}function $w(n){return n.__asyncFirst??=function(t,r,i,o){return t instanceof Promise?t.then(s=>n(s,r,i,o)):n(t,r,i,o)}}function mb(n,e,t){e.right=e.args[1];let r=n.check(e.left=e.args[0],t);return e.op===\"[]\"&&n.check(e.right,t),e.handle=vn(e.left,e.op===\"[]\"?e.right:!1,r!==Db?Ww:Gw),r.kind!==\"optional\"?n.checkAccessOnType(e,t,r):n.registry.getOptionalType(n.checkAccessOnType(e,t,r.valueType,!0))}function gb(n,e,t){e.right=e.args[1];let r=n.check(e.left=e.args[0],t);e.op===\"[?]\"&&n.check(e.right,t),e.handle=vn(e.left,e.op===\"[?]\"?e.right:!1,Zw);let i=r.kind===\"optional\"?r.valueType:r;return n.registry.getOptionalType(n.checkAccessOnType(e,t,i,!0))}var Iw={heterogeneous_list_element:\"List elements must have the same type,\",heterogeneous_map_key:\"Map key uses wrong type,\",heterogeneous_map_value:\"Map value uses wrong type,\"};function yb(n,e,t,r,i){let o=n.check(r,e);if(o===t||t.isEmpty())return o;if(o.isEmpty())return t;throw n.createError(i,`${Iw[i]} expected type '${n.formatType(t)}' but found '${n.formatType(o)}'`,r)}function bb(n,e,t,r){return t.unify(n.registry,n.check(r,e))||Db}function Fw(n,e,t){let r=n.debugRuntimeType(e);return n.createError(\"invalid_condition_type\",`${t.meta.label||\"Ternary condition must be bool\"}, got '${r}'`,t)}function Rw(n,e,t,r){if(n===!0)return e.run(t.left,r);if(n===!1)return e.run(t.right,r);throw Fw(e,n,t.condition)}function vd(n,e,t){let r=n.debugRuntimeType(e);return n.createError(\"invalid_logical_operand\",`Logical operator requires bool operands, got '${r}'`,t)}function wb(n,e,t){return e instanceof Error?e:vd(n,e,t)}function Co(n,e,t,r,i){if(i===n)return n;if(i===!n){if(r===i)return i;throw wb(e,r,t.left)}if(i instanceof Promise)return i.then(o=>Ow(n,e,t,r,o));throw vd(e,i,t.left)}function Ow(n,e,t,r,i){if(i===n)return n;if(typeof i!=\"boolean\")throw vd(e,i,t.right);if(typeof r!=\"boolean\")throw wb(e,r,t.left);return!n}function vb(n,e,t){let r=n.check(e.left=e.args[0],t),i=n.check(e.right=e.args[1],t);if(!r.isDynOrBool())throw n.createError(\"invalid_logical_operand\",`Logical operator requires bool operands, got '${n.formatType(r)}'`,e);if(!i.isDynOrBool())throw n.createError(\"invalid_logical_operand\",`Logical operator requires bool operands, got '${n.formatType(i)}'`,e);return n.boolType}function _b(n,e,t){let r=e.op,i=n.check(e.args,t);if(e.candidates=n.registry.operatorCandidates(r),i.kind===\"dyn\")return e.handle=vn(e.args,!1,Nw),e.candidates.returnType;let o=e.candidates.findUnaryOverload(i);if(!o)throw n.createError(\"no_such_overload\",`no such overload: ${r[0]}${n.formatType(i)}`,e);return e.handle=vn(e.args,!1,o.handler),o.returnType}function Nw(n,e,t){let r=t.debugRuntimeType(n,e.args.checkedType),i=e.candidates.findUnaryOverload(r);if(i)return i.handler(n);throw t.createError(\"no_such_overload\",`no such overload: ${e.op[0]}${r}`,e)}function xb(n,e,t){return e.handle(n.run(e.args,t),e,n)}function Mw(n,e,t){let r=e.op,i=n.check(e.left=e.args[0],t),o=n.check(e.right=e.args[1],t);e.candidates=n.registry.operatorCandidates(r);let s=i.hasDynType||o.hasDynType?void 0:e.candidates.findBinaryOverload(i,o);if(e.handle=vn(e.left,e.right,s?.handler||jw),s)return s.returnType;let a=e.candidates.checkBinaryOverload(i,o);if(i.hasDynType||(e.leftStaticType=i),o.hasDynType||(e.rightStaticType=o),a)return a;throw n.createError(\"no_such_overload\",`no such overload: ${n.formatType(i)} ${r} ${n.formatType(o)}`,e)}function bd(n,e,t){return e.handle(n.run(e.left,t),n.run(e.right,t),e,n)}function Ab(n,e,t){return e.handle(n.run(e.left,t),e.right,e,n)}function jw(n,e,t,r){let i=t.leftStaticType||r.debugTypeDeep(n).wrappedType,o=t.rightStaticType||r.debugTypeDeep(e).wrappedType,s=t.candidates.findBinaryOverload(i,o);if(s)return s.handler(n,e,t,r);throw r.createError(\"no_such_overload\",`no such overload: ${i} ${t.op} ${o}`,t)}function Sc(n,e,t,r){try{let i=n.apply(e,t);return i instanceof Promise?i.catch(o=>{throw Es(o,r)}):i}catch(i){throw Es(i,r)}}function Pw(n,e,t){let r=e.args[1],i=e.argTypes,o=r.length;for(;o--;)i[o]=t.debugRuntimeType(n[o],r[o].checkedType);let s=e.candidates.findFunction(i);if(s)return Sc(s.handler,t,n,e);throw t.createError(\"no_matching_overload\",`found no matching overload for '${e.args[0]}(${i.map(a=>a.unwrappedType).join(\", \")})'`,e)}function Lw(n,e,t){let[,r,i]=t.args,o=t.argTypes;for(let c=0;c<o.length;c++)o[c]=e.debugRuntimeType(n[c+1],i[c].checkedType);let s=e.debugRuntimeType(n[0],r.checkedType),a=t.candidates.findFunction(o,s);if(a)return Sc(a.handler,e,n,t);throw e.createError(\"no_matching_overload\",`found no matching overload for '${s.type}.${t.args[0]}(${o.map(c=>c.unwrappedType).join(\", \")})'`,t)}function gd(n,e,t,r=e.length){if(r===0)return[];let i,o=new Array(r);for(;r--;)(o[r]=n.run(e[r],t))instanceof Promise&&(i??=!0);return i?Promise.all(o):o}function Cb(n){let e={};for(let t=0;t<n.length;t++){let[r,i]=n[t];r===\"__proto__\"||r===\"constructor\"||r===\"prototype\"||(e[r]=i)}return e}function Bw(n,e,t){let r=n.check(e,t);if(r.kind===\"dyn\")return r;if(r.kind===\"list\")return r.valueType;if(r.kind===\"map\")return r.keyType;throw n.createError(\"invalid_comprehension_range\",`Expression of type '${n.formatType(r)}' cannot be range of a comprehension (must be list, map, or dynamic).`,e)}function Eb(n,e,t){if(t instanceof Set)return[...t];if(t instanceof Map)return[...t.keys()];if(t&&typeof t==\"object\")return Ze(t);throw n.createError(\"invalid_comprehension_range\",`Expression of type '${n.debugType(t)}' cannot be range of a comprehension (must be list, map, or dynamic).`,e.iterable)}function Vw(n,e,t,r){Ti(n)||(n=Eb(t,e,n));let i=t.run(e.init,r=e.iterCtx.reuse(r));return r.accuValue=i,r===e.iterCtx?qw(t,r,e,n,i,0):Tb(t,r,e,n,i,0)}function Uw(n,e,t,r){Ti(n)||(n=Eb(t,e,n));let i=t.run(e.init,r=e.iterCtx.reuse(r));return r.accuValue=i,r===e.iterCtx?zw(t,r,e,n,i,0):Sb(t,r,e,n,i,0)}function zw(n,e,t,r,i,o){let s=t.condition,a=t.step,c=r.length;for(;o<c&&!(s&&!s(i));)if(i=n.run(a,e.setIterValue(r[o++],n)),i instanceof Promise)return Sb(n,e,t,r,i,o);return t.result(i)}async function Sb(n,e,t,r,i,o){e===t.iterCtx&&(e.async=!0);let s=t.condition,a=t.step,c=r.length;for(i=await i;o<c;){if(s&&!s(i))return t.result(i);i=n.run(a,e.setIterValue(r[o++],n)),i instanceof Promise&&(i=await i)}return t.result(i)}function qw(n,e,t,r,i,o,s,a){let c=t.condition,u=t.step,l=r.length;for(;o<l;){if(!c(i))return t.result(i);if(a=n.tryEval(u,e.setIterValue(r[o++],n)),a instanceof Promise)return Tb(n,e,t,r,i,o,s,a);a instanceof Error&&(s??=a)||(i=a)}if(s&&c(i))throw s;return t.result(i)}async function Tb(n,e,t,r,i,o,s,a){e===t.iterCtx&&(e.async=!0);let c=t.condition,u=t.step,l=r.length;for(a=await a,a instanceof Error?s??=a:i=a;o<l;){if(!c(i))return t.result(i);a=n.tryEval(u,e.setIterValue(r[o++],n)),a instanceof Promise&&(a=await a),!(a instanceof Error&&(s??=a))&&(i=a)}if(s&&c(i))throw s;return t.result(i)}function Zw(n,e,t,r){return r.optionalType.field(n,e,t,r)}function Ww(n,e,t,r){return t.left.checkedType.field(n,e,t,r)}var Hw=Object.create(null);function Gw(n,e,t,r){switch(n?.constructor){case void 0:case Object:{let o=bo(n||Hw,e)?n[e]:void 0;if(o!==void 0)return r.debugType(o),o;break}case Map:{let o=n.get(e);if(o!==void 0)return r.debugType(o),o;break}case Array:case Set:return r.listType.field(n,e,t,r);default:let i=r.objectTypesByConstructor.get(n.constructor);if(i)return i.type.field(n,e,t,r);typeof n==\"object\"&&yd(r,n.constructor.name)}throw r.createError(\"no_such_key\",`No such key: ${e}`,t)}var Kw=()=>[],Jw=()=>({}),j={value:{check(n,e){return n.debugType(e.args)},evaluate(n,e){return e.args}},id:{check(n,e,t){let r=t.getVariable(e.args);if(!r)throw n.createError(\"unknown_variable\",`Unknown variable: ${e.args}`,e);if(r.constant){let i=e.clone(j.value,r.value);return e.setMeta(\"alternate\",i),n.check(i,t)}return r.type},evaluate(n,e,t){return t.getCheckedValue(n,e)}},\".\":{alias:\"fieldAccess\",check:mb,evaluate:Ab},\".?\":{alias:\"optionalFieldAccess\",check:gb,evaluate:Ab},\"[]\":{alias:\"bracketAccess\",check:mb,evaluate:bd},\"[?]\":{alias:\"optionalBracketAccess\",check:gb,evaluate:bd},call:{check(n,e,t){let[r,i]=e.args,o=e.candidates=n.registry.functionCandidates(!1,r,i.length),s=e.argTypes=i.map(u=>n.check(u,t)),a=o.findFunction(s);if(!a)throw n.createError(\"no_matching_overload\",`found no matching overload for '${r}(${n.formatTypeList(s)})'`,e);let c=s.some(u=>u.hasDynType)?Pw:a.handler.__handle??=(u,l,p)=>Sc(a.handler,p,u,l);return e.handle=vn(i,!1,c),a.returnType},evaluate(n,e,t){return e.handle(gd(n,e.args[1],t),e,n)}},rcall:{check(n,e,t){let[r,i,o]=e.args,s=n.check(i,t),a=e.candidates=n.registry.functionCandidates(!0,r,o.length),c=e.argTypes=o.map(l=>n.check(l,t));if(e.receiverWithArgs=[i,...o],e.handle=vn(e.receiverWithArgs,!1,Lw),s.kind===\"dyn\"&&a.returnType)return a.returnType;let u=a.findFunction(c,s);if(!u)throw n.createError(\"no_matching_overload\",`found no matching overload for '${s.type}.${r}(${n.formatTypeList(c)})'`,e);if(!s.hasPlaceholderType&&!c.some(l=>l.hasDynType)){let l=u.handler,p=l.__handle??=(f,m,g)=>Sc(l,m,f,g);e.handle=vn(e.receiverWithArgs,!1,p)}return u.returnType},evaluate(n,e,t){return e.handle(gd(n,e.receiverWithArgs,t),n,e)}},list:{check(n,e,t){let r=e.args,i=r.length;if(i===0)return e.setMeta(\"evaluate\",Kw)&&n.getType(\"list<T>\");let o=n.check(r[0],t),s=n.opts.homogeneousAggregateLiterals?yb:bb;for(let a=1;a<i;a++)o=s(n,t,o,r[a],\"heterogeneous_list_element\");return n.registry.getListType(o)},evaluate(n,e,t){return gd(n,e.args,t)}},map:{check(n,e,t){let r=e.args,i=r.length;if(i===0)return e.setMeta(\"evaluate\",Jw)&&n.getType(\"map<K, V>\");let o=n.opts.homogeneousAggregateLiterals?yb:bb,s=n.check(r[0][0],t),a=n.check(r[0][1],t);for(let c=1;c<i;c++){let u=r[c];s=o(n,t,s,u[0],\"heterogeneous_map_key\"),a=o(n,t,a,u[1],\"heterogeneous_map_value\")}return n.registry.getMapType(s,a)},evaluate(n,e,t){let r=e.args,i=r.length,o=new Array(i),s;for(let a=0;a<i;a++){let c=r[a],u=n.run(c[0],t),l=n.run(c[1],t);u instanceof Promise||l instanceof Promise?(o[a]=Promise.all([u,l]),s??=!0):o[a]=[u,l]}return s?Promise.all(o).then(Cb):Cb(o)}},comprehension:{check(n,e,t){let r=e.args;r.iterCtx=t.forkWithVariable(r.iterVarName,Bw(n,r.iterable,t)).setAccuType(n.check(r.init,t));let i=n.check(r.step,r.iterCtx),o=r.errorsAreFatal?Uw:Vw;return e.handle=vn(r.iterable,!1,o),r.kind===\"quantifier\"?n.boolType:i},evaluate(n,e,t){return e.handle(n.run(e.args.iterable,t),e.args,n,t)}},accuValue:{check(n,e,t){return t.accuType},evaluate(n,e,t){return t.accuValue}},accuInc:{check(n,e,t){return t.accuType},evaluate(n,e,t){return t.accuValue+=1}},accuPush:{check(n,e,t){let r=t.accuType,i=n.check(e.args,t);return e.args.maybeAsync||e.setMeta(\"evaluate\",j.accuPush.evaluateSync),r.kind===\"list\"&&r.valueType.kind!==\"param\"?r:n.registry.getListType(i)},evaluateSync(n,e,t){return t.accuValue.push(n.run(e.args,t)),t.accuValue},evaluate(n,e,t){let r=t.accuValue,i=n.run(e.args,t);return i instanceof Promise?i.then(o=>r.push(o)&&r):(r.push(i),r)}},\"?:\":{alias:\"ternary\",check(n,e,t){let r=e.condition=e.args[0],i=e.left=e.args[1],o=e.right=e.args[2],s=n.check(r,t);if(!s.isDynOrBool())throw n.createError(\"invalid_condition_type\",`${r.meta.label||\"Ternary condition must be bool\"}, got '${n.formatType(s)}'`,r);let a=n.check(i,t),c=n.check(o,t),u=a.unify(n.registry,c);if(e.handle=vn(r,!1,Rw),u)return u;throw n.createError(\"incompatible_ternary_branches\",`Ternary branches must have the same type, got '${n.formatType(a)}' and '${n.formatType(c)}'`,e)},evaluate(n,e,t){return e.handle(n.run(e.condition,t),n,e,t)}},\"||\":{check:vb,evaluate(n,e,t){let r=n.tryEval(e.left,t);if(r===!0)return!0;if(r===!1){let i=n.run(e.right,t);return typeof i==\"boolean\"?i:Co(!0,n,e,r,i)}return r instanceof Promise?r.then(i=>i===!0?i:Co(!0,n,e,i,n.run(e.right,t))):Co(!0,n,e,r,n.run(e.right,t))}},\"&&\":{check:vb,evaluate(n,e,t){let r=n.tryEval(e.left,t);if(r===!1)return!1;if(r===!0){let i=n.run(e.right,t);return typeof i==\"boolean\"?i:Co(!1,n,e,r,i)}return r instanceof Promise?r.then(i=>i===!1?i:Co(!1,n,e,i,n.run(e.right,t))):Co(!1,n,e,r,n.run(e.right,t))}},\"!_\":{alias:\"unaryNot\",check:_b,evaluate:xb},\"-_\":{alias:\"unaryMinus\",check:_b,evaluate:xb}},Yw=[\"!=\",\"==\",\"in\",\"+\",\"-\",\"*\",\"/\",\"%\",\"<\",\"<=\",\">\",\">=\"];for(let n of Yw)j[n]={check:Mw,evaluate:bd};for(let n of Ze(j)){let e=j[n];e.name=n,e.alias&&(j[e.alias]=e)}var Tc=n=>n;function kc(n,e){if(n.op===\"id\")return n.args;throw qe(\"invalid_macro_argument\",e,n)}function kb(n){let e=n?\"map(var, filter, transform)\":\"map(var, transform)\",t=`${e} invalid predicate iteration variable`,r=`${e} filter predicate must return bool`;return({args:i,receiver:o,ast:s})=>{let[a,c,u]=n?i:[i[0],null,i[1]],l=u.clone(j.accuPush,u);if(c){let p=c.clone(j.accuValue);l=c.clone(j.ternary,[c.setMeta(\"label\",r),l,p])}return{callAst:s.clone(j.comprehension,{errorsAreFatal:!0,iterable:o,iterVarName:kc(a,t),init:s.clone(j.list,[]),step:l,result:Tc})}}}function Xw(){let n=\"filter(var, predicate)\",e=`${n} invalid predicate iteration variable`,t=`${n} predicate must return bool`;return({args:r,receiver:i,ast:o})=>{let s=kc(r[0],e),a=o.clone(j.accuValue),c=r[1].setMeta(\"label\",t),u=o.clone(j.accuPush,o.clone(j.id,s)),l=c.clone(j.ternary,[c,u,a]);return{callAst:o.clone(j.comprehension,{errorsAreFatal:!0,iterable:i,iterVarName:s,init:o.clone(j.list,[]),step:l,result:Tc})}}}function _d(n){let e=`${n.name}(var, predicate) invalid predicate iteration variable`,t=`${n.name}(var, predicate) predicate must return bool`;return({args:r,receiver:i,ast:o})=>{let s=r[1].setMeta(\"label\",t),a=n.transform({args:r,ast:o,predicate:s,opts:n});return{callAst:o.clone(j.comprehension,{kind:\"quantifier\",errorsAreFatal:n.errorsAreFatal||!1,iterable:i,iterVarName:kc(r[0],e),init:a.init,condition:a.condition,step:a.step,result:a.result||Tc})}}}function Qw(){let n=\"has() invalid argument\";function e(r,i,o){let s=i.macroHasProps,a=s.length,c=r.run(s[--a],o),u;for(;a--;){let l=s[a];if(l.op===\".?\"&&(u??=!0),c=r.debugType(c).fieldLazy(c,l.args[1],l,r),c===void 0){if(!(!u&&a&&l.op===\".\"))break;throw H(\"no_such_key\",`No such key: ${l.args[1]}`,l)}}return c!==void 0}function t(r,i,o){let s=i.args[0];if(s.op!==\".\")throw r.createError(\"invalid_macro_argument\",n,s);if(!i.macroHasProps){let a=[];for(;s.op===\".\"||s.op===\".?\";)s=a.push(s)&&s.args[0];if(s.op!==\"id\")throw r.createError(\"invalid_macro_argument\",n,s);r.check(s,o),a.push(s),i.macroHasProps=a}return r.getType(\"bool\")}return function({args:r}){return{args:r,evaluate:e,typeCheck:t,async:!1}}}function $b(n){let e=(c,u)=>n.registerFunctionOverload(c,u);e(\"has(ast): bool\",Qw()),e(\"list.all(ast, ast): bool\",_d({name:\"all\",transform({ast:c,predicate:u,opts:l}){return{init:c.clone(j.value,!0),condition:Tc,step:u.clone(j.ternary,[u,u.clone(j.value,!0),u.clone(j.value,!1)])}}})),e(\"list.exists(ast, ast): bool\",_d({name:\"exists\",condition(c){return!c},transform({ast:c,predicate:u,opts:l}){return{init:c.clone(j.value,!1),condition:l.condition,step:u.clone(j.ternary,[u,u.clone(j.value,!0),u.clone(j.value,!1)])}}})),e(\"list.exists_one(ast, ast): bool\",_d({name:\"exists_one\",errorsAreFatal:!0,result(c){return c===1},transform({ast:c,predicate:u,opts:l}){let p=c.clone(j.accuValue);return{init:c.clone(j.value,0),step:u.clone(j.ternary,[u,c.clone(j.accuInc),p]),result:l.result}}})),e(\"list.map(ast, ast): list<dyn>\",kb(!1)),e(\"list.map(ast, ast, ast): list<dyn>\",kb(!0)),e(\"list.filter(ast, ast): list<dyn>\",Xw());class t{}let r=new t;n.registerType(\"CelNamespace\",t),n.registerConstant(\"cel\",\"CelNamespace\",r);function i(c,u,l){u.bindCtx=l.forkWithVariable(u.var,c.check(u.val,l));let p=c.check(u.exp,u.bindCtx);return u.val.maybeAsync||u.exp.maybeAsync||(u.ast.setMeta(\"async\",!1),u.evaluate=a),p}function o(c,u,l,p,f){let m=c.run(u,p=l.reuse(p).setIterValue(f,c));return m instanceof Promise&&p===l&&(p.async=!0),m}function s(c,{val:u,exp:l,bindCtx:p},f){let m=c.run(u,f);return m instanceof Promise?m.then(g=>o(c,l,p,f,g)):o(c,l,p,f,m)}function a(c,{val:u,exp:l,bindCtx:p},f){return c.run(l,p.reuse(f).setIterValue(c.run(u,f),c))}e(\"CelNamespace.bind(ast, dyn, ast): dyn\",({ast:c,args:u})=>({ast:c,var:kc(u[0],\"invalid variable argument\"),val:u[1],exp:u[2],bindCtx:void 0,typeCheck:i,evaluate:s}))}function Ib(n){let e=(p,f,m,g)=>n.unaryOverload(p,f,m,g,!1),t=(p,f,m,g,h)=>n.binaryOverload(p,f,m,g,h,!1);function r(p,f){if(p<=Ac&&p>=Cc)return p;throw H(\"numeric_overflow\",`integer overflow: ${p}`,f)}function i(p){throw H(\"division_by_zero\",\"division by zero\",p)}function o(p){throw H(\"modulo_by_zero\",\"modulo by zero\",p)}e(\"!\",\"bool\",p=>!p),e(\"-\",\"int\",p=>-p),t(\"dyn<int>\",\"==\",\"double\",(p,f)=>p==f),t(\"dyn<int>\",\"==\",\"uint\",(p,f)=>p==f.valueOf()),t(\"int\",\"*\",\"int\",(p,f,m)=>r(p*f,m)),t(\"int\",\"+\",\"int\",(p,f,m)=>r(p+f,m)),t(\"int\",\"-\",\"int\",(p,f,m)=>r(p-f,m)),t(\"int\",\"/\",\"int\",(p,f,m)=>f===ki?i(m):p/f),t(\"int\",\"%\",\"int\",(p,f,m)=>f===ki?o(m):p%f),e(\"-\",\"double\",p=>-p),t(\"double\",\"*\",\"double\",(p,f)=>p*f),t(\"double\",\"+\",\"double\",(p,f)=>p+f),t(\"double\",\"-\",\"double\",(p,f)=>p-f),t(\"double\",\"/\",\"double\",(p,f)=>p/f),t(\"string\",\"+\",\"string\",(p,f)=>p+f),t(\"list<V>\",\"+\",\"list<V>\",(p,f)=>[...p,...f]),t(\"bytes\",\"+\",\"bytes\",(p,f)=>{if(!p.length)return f;if(!f.length)return p;let m=new Uint8Array(p.length+f.length);return m.set(p,0),m.set(f,p.length),m});let s=\"google.protobuf.Duration\";t(s,\"+\",s,(p,f)=>p.addDuration(f)),t(s,\"-\",s,(p,f)=>p.subtractDuration(f)),t(s,\"==\",s,(p,f)=>p.seconds===f.seconds&&p.nanos===f.nanos);let a=\"google.protobuf.Timestamp\";t(a,\"==\",a,(p,f)=>p.getTime()===f.getTime()),t(a,\"-\",a,(p,f)=>wr.fromMilliseconds(p.getTime()-f.getTime()),s),t(a,\"-\",s,(p,f)=>f.subtractTimestamp(p)),t(a,\"+\",s,(p,f)=>f.extendTimestamp(p)),t(s,\"+\",a,(p,f)=>p.extendTimestamp(f));function c(p,f,m,g){if(f instanceof Set&&f.has(p))return!0;for(let h of f)if($s(p,h,m,g))return!0;return!1}function u(p,f){return f instanceof Map?f.get(p)!==void 0:bo(f,p)?f[p]!==void 0:!1}function l(p,f,m,g){return c(p,f,m,g)}t(\"V\",\"in\",\"list<V>\",l),t(\"K\",\"in\",\"map<K, V>\",u);for(let p of[\"type\",\"null\",\"bool\",\"string\",\"int\",\"double\"])t(p,\"==\",p,(f,m)=>f===m);t(\"bytes\",\"==\",\"bytes\",(p,f)=>{if(p===f)return!0;let m=p.length;if(m!==f.length)return!1;for(;m--;)if(p[m]!==f[m])return!1;return!0}),t(\"list<V>\",\"==\",\"list<V>\",(p,f,m,g)=>{if(p===f)return!0;if(Ti(p)&&Ti(f)){let v=p.length;if(v!==f.length)return!1;for(let x=0;x<v;x++)if(!$s(p[x],f[x],m,g))return!1;return!0}if(p instanceof Set&&f instanceof Set){if(p.size!==f.size)return!1;for(let v of p)if(!f.has(v))return!1;return!0}let h=p instanceof Set?f:p,b=p instanceof Set?p:f;if(!Ti(h)||h.length!==b?.size)return!1;for(let v=0;v<h.length;v++)if(!b.has(h[v]))return!1;return!0}),t(\"map<K, V>\",\"==\",\"map<K, V>\",(p,f,m,g)=>{if(p===f)return!0;if(p instanceof Map&&f instanceof Map){if(p.size!==f.size)return!1;for(let[v,x]of p)if(!(f.has(v)&&$s(x,f.get(v),m,g)))return!1;return!0}if(p instanceof Map||f instanceof Map){let v=p instanceof Map?f:p,x=p instanceof Map?p:f,$=Ze(v);if(x.size!==$.length)return!1;for(let[M,w]of x)if(!(M in v&&$s(w,v[M],m,g)))return!1;return!0}let h=Ze(p),b=Ze(f);if(h.length!==b.length)return!1;for(let v=0;v<h.length;v++){let x=h[v];if(!(x in f&&$s(p[x],f[x],m,g)))return!1}return!0}),t(\"uint\",\"==\",\"uint\",(p,f)=>p.valueOf()===f.valueOf()),t(\"dyn<uint>\",\"==\",\"double\",(p,f)=>p.valueOf()==f),t(\"uint\",\"+\",\"uint\",(p,f)=>new Ne(p.valueOf()+f.valueOf())),t(\"uint\",\"-\",\"uint\",(p,f)=>new Ne(p.valueOf()-f.valueOf())),t(\"uint\",\"*\",\"uint\",(p,f)=>new Ne(p.valueOf()*f.valueOf())),t(\"uint\",\"/\",\"uint\",(p,f,m)=>f.valueOf()===ki?i(m):new Ne(p.valueOf()/f.valueOf())),t(\"uint\",\"%\",\"uint\",(p,f,m)=>f.valueOf()===ki?o(m):new Ne(p.valueOf()%f.valueOf()));for(let[p,f]of[[\"bool\",\"bool\"],[\"int\",\"int\"],[\"uint\",\"uint\"],[\"double\",\"double\"],[\"string\",\"string\"],[\"google.protobuf.Timestamp\",\"google.protobuf.Timestamp\"],[\"google.protobuf.Duration\",\"google.protobuf.Duration\"],[\"int\",\"uint\"],[\"int\",\"double\"],[\"double\",\"int\"],[\"double\",\"uint\"],[\"uint\",\"int\"],[\"uint\",\"double\"]])t(p,\"<\",f,(m,g)=>m<g),t(p,\"<=\",f,(m,g)=>m<=g),t(p,\">\",f,(m,g)=>m>g),t(p,\">=\",f,(m,g)=>m>=g)}function $s(n,e,t,r){if(n===e)return!0;switch(typeof n){case\"undefined\":case\"string\":case\"boolean\":return!1;case\"bigint\":return typeof e==\"number\"?n==e:!1;case\"number\":return typeof e==\"bigint\"?n==e:!1;case\"object\":if(typeof e!=\"object\")return!1;let i=r.debugType(n),o=r.debugType(e);if(i!==o)return!1;let s=r.registry.findBinaryOverload(\"==\",i,o);return s?s.handler(n,e,t,r):!1}throw H(\"invalid_comparison_type\",`Cannot compare values of type ${typeof n}`,t)}var eE=new Map().set(\"A\",\"dyn\").set(\"T\",\"dyn\").set(\"K\",\"dyn\").set(\"V\",\"dyn\"),Is=class extends Do{constructor(e,t){super(e),this.createError=t?H:Yy}check(e,t){try{return e.checkedType??=e.check(this,e,t)}catch(r){throw Es(r,e)}}checkAccessOnType(e,t,r,i=!1){if(r===this.dynType)return r;let o=(e.op===\"[]\"||e.op===\"[?]\"?this.check(e.args[1],t):this.stringType).type;if(r.kind===\"list\"){if(o===\"int\"||o===\"dyn\")return r.valueType;throw this.createError(\"invalid_index_type\",`List index must be int, got '${o}'`,e)}if(r.kind===\"map\")return r.valueType;let s=this.objectTypes.get(r.name);if(s){if(!(o===\"string\"||o===\"dyn\"))throw this.createError(\"invalid_index_type\",`Cannot index type '${r.name}' with type '${o}'`,e);if(s.fields){let a;if(e.op===\".\"||e.op===\".?\"?a=e.args[1]:e.args[1].op===\"value\"&&(a=e.args[1].args),typeof a==\"string\"){let c=s.fields[a];if(c)return c;if(i)return this.dynType;throw this.createError(\"no_such_key\",`No such key: ${a}`,e)}}return this.dynType}throw this.createError(\"cannot_index_type\",`Cannot index type '${this.formatType(r)}'`,e)}formatType(e){return e.hasPlaceholderType?e.templated(this.registry,eE).name:e.name}formatTypeList(e){return e.map(t=>this.formatType(t)).join(\", \")}};var D={EOF:0,NUMBER:1,STRING:2,BOOLEAN:3,NULL:4,IDENTIFIER:5,PLUS:6,MINUS:7,MULTIPLY:8,DIVIDE:9,MODULO:10,EQ:11,NE:12,LT:13,LE:14,GT:15,GE:16,AND:17,OR:18,NOT:19,IN:20,LPAREN:21,RPAREN:22,LBRACKET:23,RBRACKET:24,LBRACE:25,RBRACE:26,DOT:27,COMMA:28,COLON:29,QUESTION:30,BYTES:31},$c={[D.EQ]:j[\"==\"],[D.PLUS]:j[\"+\"],[D.MINUS]:j[\"-\"],[D.MULTIPLY]:j[\"*\"],[D.DIVIDE]:j[\"/\"],[D.MODULO]:j[\"%\"],[D.LE]:j[\"<=\"],[D.LT]:j[\"<\"],[D.GE]:j[\">=\"],[D.GT]:j[\">\"],[D.NE]:j[\"!=\"],[D.IN]:j.in},Ic={};for(let n in D)Ic[D[n]]=n;var Rb=new Uint8Array(128);for(let n of\"0123456789abcdefABCDEF\")Rb[n.charCodeAt(0)]=1;var tE={bytes_unicode_escape:n=>`\\\\${n} not allowed in bytes literals`,invalid_unicode_escape:n=>`Invalid Unicode escape: \\\\${n}`,invalid_unicode_surrogate:n=>`Invalid Unicode surrogate: \\\\${n}`,invalid_hex_escape:n=>`Invalid hex escape: \\\\${n}`,invalid_octal_escape:()=>\"Octal escape must be 3 digits\",octal_escape_out_of_range:n=>`Octal escape out of range: \\\\${n}`,invalid_escape_sequence:n=>`Invalid escape sequence: \\\\${n}`},Fb={\"\\\\\":\"\\\\\",\"?\":\"?\",'\"':'\"',\"'\":\"'\",\"`\":\"`\",a:\"\\x07\",b:\"\\b\",f:\"\\f\",n:`\n`,r:\"\\r\",t:\"\t\",v:\"\\v\"},xd=class n{#e;#t;constructor(e,t,r,i,o,s){this.#e={check:o.check,evaluate:o.evaluate},this.#t=e,this.op=o.name,this.args=s,this.pos=t,this.start=r,this.end=i}clone(e,t){return new n(this.#t,this.pos,this.start,this.end,e,t)}get meta(){return this.#e}get input(){return this.#t}#r(){let e=this.#e.alternate??this;switch(e.op){case\"value\":case\"id\":case\"accuValue\":case\"accuInc\":return!1;case\"accuPush\":return e.args.maybeAsync;case\"!_\":case\"-_\":return e.candidates?.async!==!1?!0:e.args.maybeAsync;case\"!=\":case\"==\":case\"in\":case\"+\":case\"-\":case\"*\":case\"/\":case\"%\":case\"<\":case\"<=\":case\">\":case\">=\":return e.candidates?.async!==!1?!0:e.args.some(t=>t.maybeAsync);case\"call\":case\"rcall\":return e.candidates?.async!==!1?!0:(e.receiverWithArgs||e.args[1]).some(t=>t.maybeAsync);case\"comprehension\":return e.args.iterable.maybeAsync||e.args.step.maybeAsync;case\".\":case\".?\":return e.args[0].maybeAsync;case\"?:\":case\"list\":case\"[]\":case\"[?]\":return e.args.some(t=>t.maybeAsync);case\"||\":case\"&&\":return e.args.some(t=>t.maybeAsync);case\"map\":return e.args.some(t=>t[0].maybeAsync||t[1].maybeAsync);default:return!0}}get maybeAsync(){return this.#e.async??=this.#r()}check(e,t,r){let i=this.#e;return i.alternate?e.check(i.alternate,r):i.macro?i.macro.typeCheck(e,i.macro,r):i.check(e,t,r)}evaluate(e,t,r){let i=this.#e;return i.alternate?this.evaluate=this.#i:i.macro?this.evaluate=this.#o:this.evaluate=i.evaluate,this.evaluate(e,t,r)}#i(e,t,r){return(t=this.#e.alternate).evaluate(e,t,r)}#o(e,t,r){return(t=this.#e.macro).evaluate(e,t,r)}setMeta(e,t){return this.#e[e]=t,this}get range(){return{start:this.start,end:this.end}}toOldStructure(){let e=Array.isArray(this.args)?this.args:[this.args];return[this.op,...e.map(t=>t instanceof n?t.toOldStructure():t)]}},Ad=class{input;pos;length;tokenPos;tokenType;tokenValue;reset(e){return this.pos=0,this.input=e,this.length=e.length,e}token(e,t,r){return this.tokenPos=e,this.tokenType=t,this.tokenValue=r,this}nextToken(){for(;;){let{pos:e,input:t,length:r}=this;if(e>=r)return this.token(e,D.EOF);let i=t[e];switch(i){case\" \":case\"\t\":case`\n`:case\"\\r\":this.pos++;continue;case\"=\":if(t[e+1]!==\"=\")break;return this.token((this.pos+=2)-2,D.EQ);case\"&\":if(t[e+1]!==\"&\")break;return this.token((this.pos+=2)-2,D.AND);case\"|\":if(t[e+1]!==\"|\")break;return this.token((this.pos+=2)-2,D.OR);case\"+\":return this.token(this.pos++,D.PLUS);case\"-\":return this.token(this.pos++,D.MINUS);case\"*\":return this.token(this.pos++,D.MULTIPLY);case\"/\":if(t[e+1]===\"/\"){for(;this.pos<r&&this.input[this.pos]!==`\n`;)this.pos++;continue}return this.token(this.pos++,D.DIVIDE);case\"%\":return this.token(this.pos++,D.MODULO);case\"<\":return t[e+1]===\"=\"?this.token((this.pos+=2)-2,D.LE):this.token(this.pos++,D.LT);case\">\":return t[e+1]===\"=\"?this.token((this.pos+=2)-2,D.GE):this.token(this.pos++,D.GT);case\"!\":return t[e+1]===\"=\"?this.token((this.pos+=2)-2,D.NE):this.token(this.pos++,D.NOT);case\"(\":return this.token(this.pos++,D.LPAREN);case\")\":return this.token(this.pos++,D.RPAREN);case\"[\":return this.token(this.pos++,D.LBRACKET);case\"]\":return this.token(this.pos++,D.RBRACKET);case\"{\":return this.token(this.pos++,D.LBRACE);case\"}\":return this.token(this.pos++,D.RBRACE);case\".\":return this.token(this.pos++,D.DOT);case\",\":return this.token(this.pos++,D.COMMA);case\":\":return this.token(this.pos++,D.COLON);case\"?\":return this.token(this.pos++,D.QUESTION);case'\"':case\"'\":return this.readString(i);case\"b\":case\"B\":case\"r\":case\"R\":{let o=t[e+1];return o==='\"'||o===\"'\"?++this.pos&&this.readString(o,i):this.readIdentifier()}default:{let o=i.charCodeAt(0);if(o<=57&&o>=48)return this.readNumber();if(this._isIdentifierCharCode(o))return this.readIdentifier()}}throw qe(\"unexpected_character\",`Unexpected character: ${i}`,{pos:e,start:e,end:e+1,input:t})}}_isIdentifierCharCode(e){return e<48||e>122?!1:e>=97||e>=65&&e<=90||e<=57||e===95}_parseAsDouble(e,t){let r=Number(this.input.substring(e,t));if(Number.isFinite(r))return this.token(e,D.NUMBER,r);throw qe(\"invalid_number\",`Invalid number: ${r}`,{pos:e,start:e,end:t,input:this.input})}_parseAsBigInt(e,t,r,i){let o=this.input.substring(e,t);if(i===\"u\"||i===\"U\"){this.pos++;try{return this.token(e,D.NUMBER,new Ne(o))}catch{}}else try{return this.token(e,D.NUMBER,BigInt(o))}catch{}throw qe(r?\"invalid_hex_integer\":\"invalid_integer\",r?`Invalid hex integer: ${o}`:`Invalid integer: ${o}`,{pos:e,start:e,end:this.pos,input:this.input})}_readDigits(e,t,r,i){for(;r<t&&(i=e.charCodeAt(r))&&!(i>57||i<48);)r++;return r}_readExponent(e,t,r){let i=r<t&&e[r];if(i===\"e\"||i===\"E\"){i=++r<t&&e[r],(i===\"-\"||i===\"+\")&&r++;let o=r;if(r=this._readDigits(e,t,r),o===r)throw qe(\"invalid_exponent\",\"Invalid exponent\",{pos:r,start:r,end:Math.min(r+1,e.length),input:e})}return r}readNumber(){let{input:e,length:t,pos:r}=this,i=r;if(e[i]===\"0\"&&(e[i+1]===\"x\"||e[i+1]===\"X\")){for(i+=2;i<t&&Rb[e[i].charCodeAt(0)];)i++;return this._parseAsBigInt(r,this.pos=i,!0,e[i])}if(i=this._readDigits(e,t,i),i+1<t){let o=!1,s=e[i]===\".\"?this._readDigits(e,t,i+1):i+1;if(s!==i+1&&(o=!0)&&(i=s),s=this._readExponent(e,t,i),s!==i&&(o=!0)&&(i=s),o)return this._parseAsDouble(r,this.pos=i)}return this._parseAsBigInt(r,this.pos=i,!1,e[i])}readString(e,t){let{input:r,pos:i}=this;return r[i+1]===e&&r[i+2]===e?this.readTripleQuotedString(e,t):this.readSingleQuotedString(e,t)}_closeQuotedString(e,t,r,i){switch(r){case\"b\":case\"B\":{let o=this.processEscapes(e,t,!0),s=new Uint8Array(o.length);for(let a=0;a<o.length;a++)s[a]=o.charCodeAt(a)&255;return this.token(i-1,D.BYTES,s)}case\"r\":case\"R\":return this.token(i-1,D.STRING,t);default:{let o=this.processEscapes(e,t,!1);return this.token(i,D.STRING,o)}}}readSingleQuotedString(e,t){let{input:r,length:i,pos:o}=this,s,a=this.pos+1;for(;a<i&&(s=r[a]);){switch(s){case e:let c=o+1,u=r.slice(c,a);return this.pos=++a,this._closeQuotedString(c,u,t,o);case`\n`:case\"\\r\":throw qe(\"newline_in_string\",\"Newlines not allowed in single-quoted strings\",{pos:a,start:a,end:a+1,input:r});case\"\\\\\":a++}a++}throw qe(\"unterminated_string\",\"Unterminated string\",{pos:o,start:o,end:r.length,input:r})}readTripleQuotedString(e,t){let{input:r,length:i,pos:o}=this,s,a=this.pos+3;for(;a<i&&(s=r[a]);){switch(s){case e:if(r[a+1]===e&&r[a+2]===e){let c=o+3,u=r.slice(c,a);return this.pos=a+3,this._closeQuotedString(c,u,t,o)}break;case\"\\\\\":a++}a++}throw qe(\"unterminated_triple_quoted_string\",\"Unterminated triple-quoted string\",{pos:o,start:o,end:r.length,input:r})}#e(e,t,r,i,o,s){let a=t+i;return qe(e,tE[e](s),{input:this.input,pos:a,start:a,end:Math.min(a+o,t+r)})}processEscapes(e,t,r){if(!t.includes(\"\\\\\"))return t;let i=t.length,o=\"\",s=0;for(;s<i;){if(t[s]!==\"\\\\\"||s+1>=i){o+=t[s++];continue}let a=t[s+1];if(Fb[a])o+=Fb[a],s+=2;else if(a===\"u\"||a===\"U\"){if(r)throw this.#e(\"bytes_unicode_escape\",e,i,s,2,a);let c=a===\"u\"?4:8,u=t.substring(s+2,s+2+c),l=Number.parseInt(u,16);if(u.length!==c||!/^[0-9a-fA-F]+$/.test(u)||l>1114111)throw this.#e(\"invalid_unicode_escape\",e,i,s,2+c,a+u);if(l>=55296&&l<=57343)throw this.#e(\"invalid_unicode_surrogate\",e,i,s,2+c,a+u);o+=String.fromCodePoint(l),s+=2+c}else if(a===\"x\"||a===\"X\"){let c=t.substring(s+2,s+4);if(!/^[0-9a-fA-F]{2}$/.test(c))throw this.#e(\"invalid_hex_escape\",e,i,s,4,a+c);o+=String.fromCharCode(Number.parseInt(c,16)),s+=4}else if(a>=\"0\"&&a<=\"7\"){let c=t.substring(s+1,s+4);if(!/^[0-7]{3}$/.test(c))throw this.#e(\"invalid_octal_escape\",e,i,s,4);let u=Number.parseInt(c,8);if(u>255)throw this.#e(\"octal_escape_out_of_range\",e,i,s,4,c);o+=String.fromCharCode(u),s+=4}else throw this.#e(\"invalid_escape_sequence\",e,i,s,2,a)}return o}readIdentifier(){let{pos:e,input:t,length:r}=this,i=e;for(;i<r&&this._isIdentifierCharCode(t[i].charCodeAt(0));)i++;let o=t.substring(e,this.pos=i);switch(o){case\"true\":return this.token(e,D.BOOLEAN,!0);case\"false\":return this.token(e,D.BOOLEAN,!1);case\"null\":return this.token(e,D.NULL,null);case\"in\":return this.token(e,D.IN);default:return this.token(e,D.IDENTIFIER,o)}}},nE=new Ad,Fc=class{lexer=nE;input=null;maxDepthRemaining=null;astNodesRemaining=null;type=null;pos=null;constructor(e,t){this.limits=e,this.registry=t}#e(e,t=this.pos){throw qe(\"limit_exceeded\",`Exceeded ${e} (${this.limits[e]})`,{pos:t,start:t,end:t,input:this.input})}#t(e,t,r,i,o=e){let s=new xd(this.input,o,e,t,r,i);return this.astNodesRemaining--||this.#e(\"maxAstNodes\",o),s}#r(e,t,r){return this.#t(t.start,r.end,e,[t,r])}#i(e,t,r){return this.#t(e.start,r.end,j.ternary,[e,t,r])}#o(e,t,r){return this.#t(e,r.end,t,r)}#s(e,t,r,i,o=t.start){return this.#t(t.start,i,e,[t,r],o)}#n(e=this.pos){let t=this.lexer.nextToken();return this.pos=t.tokenPos,this.type=t.tokenType,e}get value(){return this.lexer.tokenValue}consume(e){if(this.type===e)return this.#n();throw qe(\"expected_token\",`Expected ${Ic[e]}, got ${Ic[this.type]}`,{pos:this.pos,start:this.pos,end:this.lexer.pos,input:this.input})}match(e){return this.type===e}parse(e){if(typeof e!=\"string\")throw qe(\"expression_must_be_string\",\"Expression must be a string\");this.input=this.lexer.reset(e),this.#n(),this.maxDepthRemaining=this.limits.maxDepth,this.astNodesRemaining=this.limits.maxAstNodes;let t=this.parseExpression();if(this.match(D.EOF))return t;throw qe(\"unexpected_character\",`Unexpected character: '${this.input[this.lexer.pos-1]}'`,{pos:this.pos,start:this.pos,end:this.lexer.pos,input:this.input})}#a(e,t,r,i){let o=i[0],s=r===j.rcall?i[1]:null,a=r===j.rcall?i[2]:i[1],c=this.registry.findMacro(o,!!s,a.length),u=this.#t(e,t,r,i);if(!c)return u;let l=c.handler({ast:u,args:a,receiver:s,methodName:o,parser:this});return l.callAst?u.setMeta(\"alternate\",l.callAst):u.setMeta(\"macro\",l).setMeta(\"async\",Ts(l.evaluate,l.async))}parseExpression(){this.maxDepthRemaining--||this.#e(\"maxDepth\");let e=this.parseLogicalOr();if(!this.match(D.QUESTION))return++this.maxDepthRemaining&&e;this.#n();let t=this.parseExpression();this.consume(D.COLON);let r=this.parseExpression();return this.maxDepthRemaining++,this.#i(e,t,r)}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.match(D.OR);)this.#n(),e=this.#r(j[\"||\"],e,this.parseLogicalAnd());return e}parseLogicalAnd(){let e=this.parseEquality();for(;this.match(D.AND);)this.#n(),e=this.#r(j[\"&&\"],e,this.parseEquality());return e}parseEquality(){let e=this.parseRelational();for(;this.match(D.EQ)||this.match(D.NE);){let t=$c[this.type];this.#n(),e=this.#r(t,e,this.parseRelational())}return e}parseRelational(){let e=this.parseAdditive();for(;this.match(D.LT)||this.match(D.LE)||this.match(D.GT)||this.match(D.GE)||this.match(D.IN);){let t=$c[this.type];this.#n(),e=this.#r(t,e,this.parseAdditive())}return e}parseAdditive(){let e=this.parseMultiplicative();for(;this.match(D.PLUS)||this.match(D.MINUS);){let t=$c[this.type];this.#n(),e=this.#r(t,e,this.parseMultiplicative())}return e}parseMultiplicative(){let e=this.parseUnary();for(;this.match(D.MULTIPLY)||this.match(D.DIVIDE)||this.match(D.MODULO);){let t=$c[this.type];this.#n(),e=this.#r(t,e,this.parseUnary())}return e}parseUnary(){return this.type===D.NOT?this.#o(this.#n(),j.unaryNot,this.parseUnary()):this.type===D.MINUS?this.#o(this.#n(),j.unaryMinus,this.parseUnary()):this.parsePostfix()}parsePostfix(){let e=this.parsePrimary(),t=this.maxDepthRemaining;for(;;){if(this.match(D.DOT)){let r=this.#n();this.maxDepthRemaining--||this.#e(\"maxDepth\",r);let i=this.match(D.QUESTION)&&this.registry.enableOptionalTypes&&this.#n()?j.optionalFieldAccess:j.fieldAccess,o=this.value,s=this.pos,a=this.lexer.pos;if(this.consume(D.IDENTIFIER),i===j.fieldAccess&&this.match(D.LPAREN)&&this.#n()){let c=this.parseArgumentList(),u=this.lexer.pos;this.consume(D.RPAREN),e=this.#a(e.start,u,j.rcall,[o,e,c])}else e=this.#s(i,e,o,a,s);continue}if(this.match(D.LBRACKET)){let r=this.#n();this.maxDepthRemaining--||this.#e(\"maxDepth\",r);let i=this.match(D.QUESTION)&&this.registry.enableOptionalTypes&&this.#n()?j.optionalBracketAccess:j.bracketAccess,o=this.parseExpression(),s=this.lexer.pos;this.consume(D.RBRACKET),e=this.#s(i,e,o,s);continue}break}return this.maxDepthRemaining=t,e}parsePrimary(){switch(this.type){case D.NUMBER:case D.STRING:case D.BYTES:case D.BOOLEAN:case D.NULL:return this.#d();case D.IDENTIFIER:return this.#u();case D.LPAREN:return this.#l();case D.LBRACKET:return this.parseList();case D.LBRACE:return this.parseMap()}throw qe(\"unexpected_token\",`Unexpected token: ${Ic[this.type]}`,{pos:this.pos,start:this.pos,end:this.lexer.pos,input:this.input})}#d(){return this.#n(this.#t(this.pos,this.lexer.pos,j.value,this.value))}#u(){let e=this.value,t=this.lexer.pos,r=this.consume(D.IDENTIFIER);if(vo.has(e))throw qe(\"reserved_identifier\",`Reserved identifier: ${e}`,{pos:r,start:r,end:t,input:this.input});if(!this.match(D.LPAREN))return this.#t(r,t,j.id,e);this.#n();let i=this.parseArgumentList(),o=this.lexer.pos;return this.consume(D.RPAREN),this.#a(r,o,j.call,[e,i])}#l(){this.consume(D.LPAREN);let e=this.parseExpression();return this.consume(D.RPAREN),e}parseList(){let e=this.consume(D.LBRACKET),t=[],r=this.limits.maxListElements;if(!this.match(D.RBRACKET))for(t.push(this.parseExpression()),r--||this.#e(\"maxListElements\",t.at(-1).pos);this.match(D.COMMA)&&(this.#n(),!this.match(D.RBRACKET));)t.push(this.parseExpression()),r--||this.#e(\"maxListElements\",t.at(-1).pos);let i=this.lexer.pos;return this.consume(D.RBRACKET),this.#t(e,i,j.list,t)}parseMap(){let e=this.consume(D.LBRACE),t=[],r=this.limits.maxMapEntries;if(!this.match(D.RBRACE))for(t.push(this.parseProperty()),r--||this.#e(\"maxMapEntries\",t.at(-1)[0].pos);this.match(D.COMMA)&&(this.#n(),!this.match(D.RBRACE));)t.push(this.parseProperty()),r--||this.#e(\"maxMapEntries\",t.at(-1)[0].pos);let i=this.lexer.pos;return this.consume(D.RBRACE),this.#t(e,i,j.map,t)}parseProperty(){return[this.parseExpression(),(this.consume(D.COLON),this.parseExpression())]}parseArgumentList(){let e=[],t=this.limits.maxCallArguments;if(!this.match(D.RPAREN))for(e.push(this.parseExpression()),t--||this.#e(\"maxCallArguments\",e.at(-1).pos);this.match(D.COMMA)&&(this.#n(),!this.match(D.RPAREN));)e.push(this.parseExpression()),t--||this.#e(\"maxCallArguments\",e.at(-1).pos);return e}};var Dd=Jt({maxAstNodes:1e5,maxDepth:250,maxListElements:1e3,maxMapEntries:1e3,maxCallArguments:32}),rE=new Set(Ze(Dd));function iE(n,e=Dd){let t=n?Ze(n):void 0;if(!t?.length)return e;let r={...e};for(let i of t){if(!rE.has(i))throw new TypeError(`Unknown limits option: ${i}`);let o=n[i];typeof o==\"number\"&&(r[i]=o)}return Jt(r)}var oE=Jt({unlistedVariablesAreDyn:!1,homogeneousAggregateLiterals:!0,enableOptionalTypes:!1,limits:Dd});function Cd(n,e,t){let r=n?.[t]??e?.[t];if(typeof r!=\"boolean\")throw new TypeError(`Invalid option: ${t}`);return r}function Ob(n,e=oE){return n?Jt({unlistedVariablesAreDyn:Cd(n,e,\"unlistedVariablesAreDyn\"),homogeneousAggregateLiterals:Cd(n,e,\"homogeneousAggregateLiterals\"),enableOptionalTypes:Cd(n,e,\"enableOptionalTypes\"),limits:iE(n.limits,e.limits)}):e}var Rc=pb({enableOptionalTypes:!1});ib(Rc);Ib(Rc);$b(Rc);var wo=class n{#e;#t;#r;#i;#o;constructor(e,t){this.opts=Ob(e,t?.opts),this.#e=(t instanceof n?t.#e:Rc).clone(this.opts);let r={registry:this.#e,opts:this.opts};this.#r=new Is(r),this.#i=new Is(r,!0),this.#t=new wd(r),this.#o=new Fc(this.opts.limits,this.#e),Object.freeze(this)}clone(e){return new n(e,this)}registerFunction(e,t,r){return this.#e.registerFunctionOverload(e,t,r),this}registerOperator(e,t,r){return this.#e.registerOperatorOverload(e,t,r),this}registerType(e,t){return this.#e.registerType(e,t),this}registerVariable(e,t,r){return this.#e.registerVariable(e,t,r),this}registerConstant(e,t,r){return this.#e.registerConstant(e,t,r),this}hasVariable(e){return this.#e.variables.has(e)}getDefinitions(){return this.#e.getDefinitions()}check(e){try{return this.#s(this.#o.parse(e))}catch(t){return{valid:!1,error:t}}}#s(e){try{let t=this.#r.check(e,new Ao(this.#e));return{valid:!0,type:this.#n(t)}}catch(t){return{valid:!1,error:t}}}#n(e){return e.name===\"list<dyn>\"?\"list\":e.name===\"map<dyn, dyn>\"?\"map\":e.name}parse(e){let t=this.#o.parse(e),r=this.#a.bind(this,t);return r.check=this.#s.bind(this,t),r.ast=t,r}evaluate(e,t){return this.#a(this.#o.parse(e),t)}#a(e,t){return e.checkedType?e.evaluate(this.#t,e,new Ao(this.#e,t)):(this.#i.check(e,t=new Ao(this.#e,t)),e.evaluate(this.#t,e,t))}},wd=class extends Do{constructor(e){super(e),this.createError=H}#e(e){if(e instanceof Map)return e.entries().next().value;for(let t in e)return[t,e[t]]}debugRuntimeType(e,t){return t?.hasDynType===!1?t:this.debugTypeDeep(e)}debugTypeDeep(e){let t=this.debugType(e);switch(t.kind){case\"list\":{let r=e instanceof Array?e[0]:e.values().next().value;return r===void 0?t:this.registry.getListType(this.debugTypeDeep(r))}case\"map\":{let r=this.#e(e);return r?this.registry.getMapType(t.keyType.hasDynType?this.debugTypeDeep(r[0]):t.keyType,t.valueType.hasDynType?this.debugTypeDeep(r[1]):t.valueType):t}default:return t}}tryEval(e,t){try{let r=this.run(e,t);return r instanceof Promise?r.catch(i=>i):r}catch(r){return r}}run(e,t){return e.evaluate(this,e,t)}},uL=new wo({unlistedVariablesAreDyn:!0});var sE=Id(Mb(),1);var jb=3660,aE=64,cE=/^(\\d{4})-(\\d{2})-(\\d{2})$/;function Fs(n){return typeof n==\"number\"&&Number.isInteger(n)?BigInt(n):Array.isArray(n)?n.map(Fs):n&&typeof n==\"object\"?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Fs(t)])):n}function Rs(n){return typeof n==\"bigint\"?Number(n):Array.isArray(n)?n.map(Rs):n instanceof Map?Object.fromEntries([...n].map(([e,t])=>[String(e),Rs(t)])):n&&typeof n==\"object\"?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Rs(t)])):n}function Eo(n){let e=cE.exec(n);if(!e)throw new Error(`not a day: ${n}`);let[t,r,i]=[Number(e[1]),Number(e[2]),Number(e[3])],o=Date.UTC(t,r-1,i),s=new Date(o);if(s.getUTCFullYear()!==t||s.getUTCMonth()!==r-1||s.getUTCDate()!==i)throw new Error(`not a day: ${n}`);return o/864e5}var Ed=n=>new Date(n*864e5).toISOString().slice(0,10),Oc={addDays:(n,e)=>Ed(Eo(n)+Number(e)),daysBetween:(n,e)=>BigInt(Eo(e)-Eo(n)),weekStart:n=>{let e=Eo(n);return Ed(e-(new Date(e*864e5).getUTCDay()+6)%7)},dateRange:(n,e)=>{let[t,r]=[Eo(n),Eo(e)];if(r-t>jb)throw new Error(`a range of at most ${jb} days`);let i=[];for(let o=t;o<r;o++)i.push(Ed(o));return i}};var Nc=class{constructor(e){this.logic=e;this.consts=Fs(e.consts);let t=new wo({unlistedVariablesAreDyn:!0,homogeneousAggregateLiterals:!1});t.registerFunction(\"addDays(string, int): string\",Oc.addDays),t.registerFunction(\"daysBetween(string, string): int\",Oc.daysBetween),t.registerFunction(\"weekStart(string): string\",Oc.weekStart),t.registerFunction(\"dateRange(string, string): list<string>\",Oc.dateRange),t.registerFunction(\"list.sort(): list\",r=>[...r].sort((i,o)=>i<o?-1:i>o?1:0)),t.registerFunction(\"fold(list, dyn, string): dyn\",(r,i,o)=>{if(!(o in e.functions))throw new Error(`fold: no function ${o}`);return r.reduce((s,a)=>this.call(o,[s,a]),i)});for(let[r,i]of Object.entries(e.functions))t.registerFunction(`${r}(${i.params.map(()=>\"dyn\").join(\", \")}): dyn`,(...o)=>this.call(r,o));this.env=t}logic;env;consts;depth=0;call(e,t){let r=this.logic.functions[e];if(++this.depth>aE)throw this.depth=0,new Error(\"calls nest too deep\");try{return this.env.evaluate(r.cel,{...this.consts,...Object.fromEntries(r.params.map((i,o)=>[i,t[o]??null]))})}finally{this.depth--}}evaluate(e,t={}){try{return this.depth=0,Rs(this.env.evaluate(e,{...this.consts,...Fs(t)}))}catch{return null}}apply(e,t){try{return this.depth=0,Rs(this.call(e,t.map(Fs)))}catch{return null}}parseError(e){try{return this.env.parse(e),null}catch(t){return t.message.split(`\n`)[0]??\"doesn't parse\"}}};var Pb=n=>n===void 0?n:structuredClone(n);function Os(n,e,t){if(!(typeof e.path!=\"string\"||!e.path.startsWith(\"/\"))){if(e.op===\"set\")n.set(e.path,Pb(e.value));else if(e.op===\"push\"){let r=n.get(e.path);n.set(e.path,[...Array.isArray(r)?r:[],Pb(e.value)])}else if(e.op===\"removeAt\"){let r=n.get(e.path);if(!Array.isArray(r)||t===void 0||t<0||t>=r.length)return;let i=r.slice();i.splice(t,1),n.set(e.path,i)}}}function Lb(n,e,t){for(let r of e)Os(n,r,t)}function Bb(n,e,t){return Object.keys(e).sort().map(r=>[r,n.evaluate(e[r],t)])}function Vb(n=new Date){let e=t=>String(t).padStart(2,\"0\");return`${n.getFullYear()}-${e(n.getMonth()+1)}-${e(n.getDate())}`}var uE=\"button, input, select, textarea, [role=button], [role=checkbox]\";function Ub(n){for(let e of n.querySelectorAll(\"[aria-label]\")){if(!e.tagName.startsWith(\"A2UI-\"))continue;let t=e.querySelector(uE);if(!t||t.hasAttribute(\"aria-label\")||t.hasAttribute(\"aria-labelledby\"))continue;t.setAttribute(\"aria-label\",e.getAttribute(\"aria-label\"));let r=e.getAttribute(\"aria-description\");r&&!t.hasAttribute(\"aria-description\")&&t.setAttribute(\"aria-description\",r)}}function zb(n){Ub(n),new MutationObserver(()=>Ub(n)).observe(n,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[\"aria-label\"]})}var qb=`(function(){\"use strict\";\nvar port=null,out=[],on={},opts=null,ready=false,begun=false,rate=10,acc=0,seed=1,last;\nvar cv=document.querySelector(\"canvas\"),g=cv.getContext(\"2d\"),W=0,H=0;\nfunction send(m){if(port)port.postMessage(m);else out.push(m)}\nfunction fire(n,a,b){(on[n]||[]).forEach(function(f){f(a,b)})}\nfunction fit(){var r=Math.min(window.devicePixelRatio||1,3);W=cv.clientWidth;H=cv.clientHeight;cv.width=Math.round(W*r);cv.height=Math.round(H*r);g.setTransform(r,0,0,r,0,0)}\nfunction report(){if(!game.state||typeof game.state!==\"object\")return;var s;try{s=JSON.stringify(game.state)}catch(e){return}if(s!==undefined&&s!==last){last=s;send({state:JSON.parse(s)})}}\nfunction paint(){if(opts.draw){g.clearRect(0,0,W,H);opts.draw(g,W,H)}}\nfunction begin(){if(begun||!ready||!opts)return;begun=true;fit();if(opts.setup)opts.setup();paint();report()}\nfunction frame(dt){if(!begun||game.paused)return;var each=1000/rate,n=0;acc+=Math.max(0,Math.min(dt,60000));\nwhile(acc>=each&&n<rate*60){acc-=each;n++;if(opts.step)opts.step()}if(acc>=each)acc=0;\npaint();report()}\nvar game={inputs:{},state:null,paused:false,\nstart:function(o){opts=o||{};rate=Math.max(1,Math.min(60,Number(opts.rate)||10));begin()},\non:function(n,f){(on[n]=on[n]||[]).push(f)},\nemit:function(n,d){send({emit:{name:String(n),data:d}})},\nrandom:function(){seed=(seed+0x6D2B79F5)|0;var t=Math.imul(seed^(seed>>>15),1|seed);t=(t+Math.imul(t^(t>>>7),61|t))^t;return((t^(t>>>14))>>>0)/4294967296}};\nwindow.game=game;\naddEventListener(\"message\",function(e){if(e.data!==\"cc-port\"||port||!e.ports||!e.ports[0])return;port=e.ports[0];\nport.onmessage=function(m){var d=m.data||{};\nif(d.init){seed=(Number(d.init.seed)|0)||1;game.inputs=d.init.inputs||{};ready=true;begin()}\nif(d.input){game.inputs[d.input.name]=d.input.value;fire(\"input\",d.input.name,d.input.value)}\nif(typeof d.tick===\"number\")frame(d.tick);\nif(typeof d.visible===\"boolean\")game.paused=!d.visible};\nvar q=out;out=[];q.forEach(send)});\naddEventListener(\"resize\",function(){if(begun){fit();paint()}});\nvar x0,y0,t0;\ncv.addEventListener(\"pointerdown\",function(e){x0=e.offsetX;y0=e.offsetY;t0=e.timeStamp});\ncv.addEventListener(\"pointerup\",function(e){if(x0===undefined)return;var dx=e.offsetX-x0,dy=e.offsetY-y0;\nif(Math.abs(dx)<12&&Math.abs(dy)<12){if(e.timeStamp-t0<600)fire(\"tap\",x0,y0)}\nelse fire(\"swipe\",Math.abs(dx)>Math.abs(dy)?(dx>0?\"right\":\"left\"):(dy>0?\"down\":\"up\"));x0=undefined});\nvar KEYS={ArrowUp:\"up\",ArrowDown:\"down\",ArrowLeft:\"left\",ArrowRight:\"right\"};\naddEventListener(\"keydown\",function(e){if(KEYS[e.key]){e.preventDefault();fire(\"swipe\",KEYS[e.key])}else if(e.key===\" \"||e.key===\"Enter\"){e.preventDefault();fire(\"tap\",W/2,H/2)}});\n})();`;var lE={number:n=>typeof n==\"number\"&&Number.isFinite(n),string:n=>typeof n==\"string\"&&n.length<=1e3,boolean:n=>typeof n==\"boolean\",list:n=>Array.isArray(n),map:n=>!!n&&typeof n==\"object\"&&!Array.isArray(n)};function Zb(n,e,t){if(!Object.hasOwn(n.events,e))return null;let r=n.events[e],i={};if(!t||typeof t!=\"object\")return i;for(let[o,s]of Object.entries(r)){let a=t[o];lE[s](a)&&(i[o]=a)}return i}var dE=8*1024;function Wb(n){if(!n||typeof n!=\"object\"||Array.isArray(n))return null;let e;try{e=JSON.stringify(n)}catch{return null}return e.length<=dE?JSON.parse(e):null}var fE=\"html,body{margin:0;height:100%;overflow:hidden;background:transparent}canvas{display:block;width:100%;height:100%;touch-action:none}\";function Hb(n){return`<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><style>${fE}</style><canvas></canvas><script>${qb}<\\/script><script>${n}<\\/script>`}var pE={name:\"Coded\",schema:d.object({use:d.string(),label:pt.DynamicString,aspect:d.number().optional(),inputs:d.array(d.object({name:d.string(),value:pt.DynamicValue})).optional(),on:d.array(d.object({name:d.string(),action:pt.Action})).optional()})},Mc={components:{},set(){}};function Kb(n){Mc=n}var hE=(n,e)=>{let t=document.createElement(\"div\");t.style.cssText=\"display:block;width:100%;height:100%\";let r=t.attachShadow({mode:\"closed\"}),i=document.createElement(\"iframe\");i.setAttribute(\"sandbox\",\"allow-scripts\"),i.setAttribute(\"title\",\"Custom part of this app\"),i.setAttribute(\"style\",\"border:0;display:block;width:100%;height:100%\"),i.setAttribute(\"srcdoc\",e);let o=new MessageChannel;return i.addEventListener(\"load\",()=>i.contentWindow?.postMessage(\"cc-port\",\"*\",[o.port2]),{once:!0}),r.appendChild(i),n.appendChild(t),o.port1},mE=(n,e)=>{let t=window.__ccFrame;return typeof t==\"function\"?t(n,e):hE(n,e)},Gb=n=>Object.fromEntries((n.inputs??[]).map(e=>[e.name,e.value])),Jb=Ei(pE,({props:n,context:e})=>{let t=n,r=e.componentModel.id,i=mt(null),o=mt(null),s=mt(t);s.current=t;let a=mt({});return wt(()=>{let c=Mc.components[t.use];if(!c||!i.current)return;let u=`/ui/coded/${r}`,l=mE(i.current,Hb(c.code));o.current=l;let p=\"\";l.onmessage=x=>{let $=x.data??{};if(\"state\"in $){let M=Wb($.state),w=M&&JSON.stringify(M);M&&w!==p&&(p=w,Mc.set(`${u}/state`,M))}if($.emit&&typeof $.emit.name==\"string\"){let M=Zb(c,$.emit.name,$.emit.data);if(!M)return;Mc.set(`${u}/${$.emit.name}`,M),s.current.on?.find(w=>w.name===$.emit.name)?.action()}};let f=Gb(s.current);a.current=Object.fromEntries(Object.entries(f).map(([x,$])=>[x,JSON.stringify($)])),l.postMessage({init:{seed:Math.floor(Math.random()*2**31),inputs:f}});let m=0,g=null,h=x=>{g!==null&&l.postMessage({tick:x-g}),g=x,m=requestAnimationFrame(h)},b=()=>{l.postMessage({visible:!document.hidden}),cancelAnimationFrame(m),g=null,document.hidden||(m=requestAnimationFrame(h))};document.addEventListener(\"visibilitychange\",b),b();let v=i.current;return()=>{cancelAnimationFrame(m),document.removeEventListener(\"visibilitychange\",b),l.close(),o.current=null,v.replaceChildren()}},[t.use,r]),wt(()=>{if(o.current)for(let[c,u]of Object.entries(Gb(t))){let l=JSON.stringify(u);a.current[c]!==l&&(a.current[c]=l,o.current.postMessage({input:{name:c,value:u}}))}}),ee(\"div\",{class:\"cc-coded\",ref:i,role:\"group\",\"aria-label\":t.label,style:{aspectRatio:String(t.aspect??1)}})});var gE={name:\"DateStrip\",schema:d.object({days:d.number().int().min(2).max(60).optional(),today:pt.DynamicString,value:pt.DynamicString,statuses:pt.DynamicValue.optional()})},Yb=[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],yE=[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],bE={complete:\"var(--a2ui-color-success, #10b981)\",partial:\"var(--a2ui-color-warning, #fbbf24)\",incomplete:\"var(--a2ui-color-error, #ef4444)\",active:\"var(--a2ui-color-primary)\"},Xb=n=>{let[e,t,r]=n.split(\"-\").map(Number);return new Date(Date.UTC(e,t-1,r))},Qb=n=>n.toISOString().slice(0,10),ev=Ei(gE,({props:n})=>{let e=n,t=mt(null);wt(()=>{t.current&&(t.current.scrollLeft=t.current.scrollWidth)},[]);let r=typeof e.today==\"string\"&&/^\\d{4}-\\d{2}-\\d{2}$/.test(e.today)?e.today:Qb(new Date),i=e.days??14,o=Xb(r),s=Array.from({length:i},(c,u)=>Qb(new Date(o.getTime()-(i-1-u)*864e5))),a=new Map;if(Array.isArray(e.statuses))for(let c of e.statuses)typeof c?.day==\"string\"&&typeof c?.status==\"string\"&&a.set(c.day,c.status);return ee(\"div\",{class:\"cc-datestrip\",ref:t,role:\"group\",\"aria-label\":\"Days\",children:s.map(c=>{let u=Xb(c),l=c===e.value,p=c===r,f=a.get(c);return ee(\"button\",{type:\"button\",class:`cc-day${l?\" cc-on\":\"\"}${p?\" cc-today\":\"\"}`,\"aria-pressed\":l,\"aria-label\":`${p?\"Today, \":\"\"}${Yb[u.getUTCDay()]} ${u.getUTCDate()} ${yE[u.getUTCMonth()]}${f?`, ${f}`:\"\"}`,onClick:()=>e.setValue?.(c),children:[ee(\"span\",{class:\"cc-wd\",children:p?\"Today\":Yb[u.getUTCDay()]}),ee(\"span\",{class:\"cc-n\",children:u.getUTCDate()}),ee(\"span\",{class:\"cc-dot\",style:{background:f?l&&f===\"active\"?\"var(--a2ui-color-on-primary, #fff)\":bE[f]:\"transparent\"}})]},c)})})});var vE=po.components.get(\"TextField\"),tv=Ei(vE,({props:n})=>{let e=n,t=e.variant===\"number\"?\"number\":e.variant===\"obscured\"?\"password\":\"text\",r=e.isValid===!1,i=o=>e.setValue?.(o.target.value);return ee(\"label\",{class:`cc-field${r?\" cc-invalid\":\"\"}`,children:[e.label?ee(\"span\",{class:\"cc-field-label\",children:e.label}):null,e.variant===\"longText\"?ee(\"textarea\",{value:e.value??\"\",onInput:i,\"aria-invalid\":r||void 0}):ee(\"input\",{type:t,inputMode:t===\"number\"?\"numeric\":void 0,value:e.value??\"\",onInput:i,\"aria-invalid\":r||void 0}),r&&e.validationErrors?.length?ee(\"span\",{class:\"cc-field-error\",children:e.validationErrors[0]}):null]})});var Sd=n=>!!n&&typeof n==\"object\"&&!Array.isArray(n);function nv(n,e,t){let r=c=>({saved:structuredClone(e.initial),version:e.version,note:c});if(n===null)return r(\"new\");let i;try{i=JSON.parse(n)}catch{return r(\"unreadable\")}if(!Sd(i)||typeof i.v!=\"number\")return r(\"unreadable\");let{v:o,...s}=i;if(o===e.version)return{saved:s,version:o,note:\"loaded\"};if(o>e.version)return{saved:s,version:o,note:\"newer\"};let a=s;for(let c=o;c<e.version;c++){let u=e.migrations.find(p=>p.from===c);if(!u)return r(\"unreadable\");let l=t.evaluate(u.cel,{saved:a});if(!Sd(l))return r(\"unreadable\");a=l}return{saved:a,version:e.version,note:\"migrated\"}}function rv(n,e,t){return e.note===\"newer\"?null:JSON.stringify({v:t.version,...Sd(n)?n:{}})}var _E=n=>n.replace(/~/g,\"~0\").replace(/\\//g,\"~1\"),Td=(n,e)=>JSON.stringify(n)===JSON.stringify(e),jc=n=>n===void 0?n:structuredClone(n);function xE(n,e){return n.replace(/\\$\\{(\\/[^}]*)\\}/g,(t,r)=>_E(String(e.get(r)??\"\")))}var Pc=class{constructor(e){this.views=e}views;last=new Map;sync(e){let t=!1;for(let r of this.views){let i=xE(r.source,e),o=e.get(r.path),s=this.last.get(r.path);if(s!==void 0&&s.source===i&&!Td(o,s.value)){let c=e.get(i);!(c===void 0&&Array.isArray(o)&&o.length===0)&&!Td(c,o)&&(e.set(i,jc(o)),t=!0),this.last.set(r.path,{source:i,value:jc(o)})}else{let c=e.get(i),u=c===void 0?[]:c;Td(o,u)||(e.set(r.path,jc(u)),t=!0),this.last.set(r.path,{source:i,value:jc(u)})}}return t}};var AE=\"https://cloudcrane.ai/catalogs/app/v1.json\",Lc=n=>({get:e=>n.dataModel.get(e),set:(e,t)=>n.dataModel.set(e,t)}),CE=[Ae({name:\"set\",returnType:\"void\",schema:d.object({path:pt.DynamicString,value:pt.DynamicValue}),allowedCallers:\"rendererOnly\"},(n,e)=>Os(Lc(e),{op:\"set\",path:n.path,value:n.value},void 0)),Ae({name:\"push\",returnType:\"void\",schema:d.object({path:pt.DynamicString,value:pt.DynamicValue}),allowedCallers:\"rendererOnly\"},(n,e)=>Os(Lc(e),{op:\"push\",path:n.path,value:n.value},void 0)),Ae({name:\"removeAt\",returnType:\"void\",schema:d.object({path:pt.DynamicString}),allowedCallers:\"rendererOnly\"},(n,e)=>{let t=e;Os(Lc(t),{op:\"removeAt\",path:n.path},t.getIndex())}),Ae({name:\"batch\",returnType:\"void\",schema:d.object({steps:d.array(d.record(d.unknown()))}),allowedCallers:\"rendererOnly\"},(n,e)=>{let t=e,r=n.steps.map(i=>({op:i.op,path:t.resolveDynamicValue(i.target),value:t.resolveDynamicValue(i.value)}));Lb(Lc(t),r,t.getIndex())})];function DE(){let n=JSON.parse(document.getElementById(\"cc-spec\").textContent),e=new Nc(n.logic),t=null;try{t=localStorage.getItem(n.data.key)}catch{t=null}let r=nv(t,n.data,e),i=[...po.components.values()].filter(x=>x.name!==\"TextField\"),o=new jt(AE,\"v0.9\",[...i,tv,ev,Jb],[...po.functions.values(),...CE]),s=new Na([o]);s.processMessages(n.surface.messages);let a=[...s.model.surfacesMap.values()][0],c=a.dataModel;a.onError.subscribe(x=>console.error(\"[a2ui]\",JSON.stringify(x))),a.onWarning.subscribe(x=>console.warn(\"[a2ui]\",JSON.stringify(x)));let u=n.data.persist;Kb({components:n.components??{},set:(x,$)=>c.set(x,$)});let l=window.__ccToday??Vb();c.set(\"/today\",l),(c.get(\"/ui/selected\")??\"\")===\"\"&&c.set(\"/ui/selected\",l),c.set(u,r.saved);let p=new Pc(n.data.views),f={get:x=>c.get(x),set:(x,$)=>c.set(x,$)},m=!1,g=()=>{if(!m){m=!0;try{for(let x=0;x<5&&(p.sync(f)||h());x++);}finally{m=!1}}},h=()=>{let x=!1,$={saved:c.get(u),ui:c.get(\"/ui\"),today:l};for(let[M,w]of Bb(e,n.logic.computed,$))JSON.stringify(c.get(M))!==JSON.stringify(w)&&(c.set(M,w),x=!0);return x},b=()=>{let x=rv(c.get(u),r,n.data);if(x!==null)try{localStorage.setItem(n.data.key,x)}catch{}};g(),c.subscribe(u,()=>{g(),b()}),c.subscribe(\"/ui\",g),r.note===\"migrated\"&&b(),window.appState=()=>({data:c.get(\"/\"),today:l,loaded:r.note});let v=document.getElementById(\"app\");Wn(vt(od,{surface:a}),v),zb(v)}DE();export{AE as CLOUDCRANE_CATALOG_ID};\n";
|
|
1
|
+
export declare const RUNTIME_VERSION = "0.4.0";
|
|
2
|
+
export declare const RUNTIME_SHA256 = "fb23d7d56b0faa780af23867052087b9807ae0ec4c79de100e531681dbb1bade";
|
|
3
|
+
export declare const RUNTIME_JS = "var lv=Object.create;var Vc=Object.defineProperty;var dv=Object.getOwnPropertyDescriptor;var fv=Object.getOwnPropertyNames;var pv=Object.getPrototypeOf,hv=Object.prototype.hasOwnProperty;var $d=(n,e)=>()=>{try{return e||n((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},mv=(n,e)=>{for(var t in e)Vc(n,t,{get:e[t],enumerable:!0})},gv=(n,e,t,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let i of fv(e))!hv.call(n,i)&&i!==t&&Vc(n,i,{get:()=>e[i],enumerable:!(r=dv(e,i))||r.enumerable});return n};var Id=(n,e,t)=>(t=n!=null?lv(pv(n)):{},gv(e||!n||!n.__esModule?Vc(t,\"default\",{value:n,enumerable:!0}):t,n));var Jh=$d((HR,Kh)=>{Kh.exports=(function(n){var e={};function t(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return n[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=n,t.c=e,t.d=function(r,i,o){t.o(r,i)||Object.defineProperty(r,i,{enumerable:!0,get:o})},t.r=function(r){typeof Symbol<\"u\"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(r,\"__esModule\",{value:!0})},t.t=function(r,i){if(1&i&&(r=t(r)),8&i||4&i&&typeof r==\"object\"&&r&&r.__esModule)return r;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,\"default\",{enumerable:!0,value:r}),2&i&&typeof r!=\"string\")for(var s in r)t.d(o,s,function(a){return r[a]}.bind(null,s));return o},t.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(i,\"a\",i),i},t.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},t.p=\"\",t(t.s=0)})([function(n,e,t){\"use strict\";t.r(e),t.d(e,\"validateHTMLColorName\",(function(){return s})),t.d(e,\"validateHTMLColorSpecialName\",(function(){return a})),t.d(e,\"validateHTMLColorHex\",(function(){return c})),t.d(e,\"validateHTMLColorRgb\",(function(){return h})),t.d(e,\"validateHTMLColorHsl\",(function(){return y})),t.d(e,\"validateHTMLColorHwb\",(function(){return v})),t.d(e,\"validateHTMLColorLab\",(function(){return x})),t.d(e,\"validateHTMLColorLch\",(function(){return $})),t.d(e,\"validateHTMLColor\",(function(){return P}));let r=D=>D&&typeof D==\"string\",i=[\"AliceBlue\",\"AntiqueWhite\",\"Aqua\",\"Aquamarine\",\"Azure\",\"Beige\",\"Bisque\",\"Black\",\"BlanchedAlmond\",\"Blue\",\"BlueViolet\",\"Brown\",\"BurlyWood\",\"CadetBlue\",\"Chartreuse\",\"Chocolate\",\"Coral\",\"CornflowerBlue\",\"Cornsilk\",\"Crimson\",\"Cyan\",\"DarkBlue\",\"DarkCyan\",\"DarkGoldenrod\",\"DarkGray\",\"DarkGrey\",\"DarkGreen\",\"DarkKhaki\",\"DarkMagenta\",\"DarkOliveGreen\",\"DarkOrange\",\"DarkOrchid\",\"DarkRed\",\"DarkSalmon\",\"DarkSeaGreen\",\"DarkSlateBlue\",\"DarkSlateGray\",\"DarkSlateGrey\",\"DarkTurquoise\",\"DarkViolet\",\"DeepPink\",\"DeepSkyBlue\",\"DimGray\",\"DimGrey\",\"DodgerBlue\",\"FireBrick\",\"FloralWhite\",\"ForestGreen\",\"Fuchsia\",\"Gainsboro\",\"GhostWhite\",\"Gold\",\"Goldenrod\",\"Gray\",\"Grey\",\"Green\",\"GreenYellow\",\"HoneyDew\",\"HotPink\",\"IndianRed\",\"Indigo\",\"Ivory\",\"Khaki\",\"Lavender\",\"LavenderBlush\",\"LawnGreen\",\"LemonChiffon\",\"LightBlue\",\"LightCoral\",\"LightCyan\",\"LightGoldenrodYellow\",\"LightGray\",\"LightGrey\",\"LightGreen\",\"LightPink\",\"LightSalmon\",\"LightSalmon\",\"LightSeaGreen\",\"LightSkyBlue\",\"LightSlateGray\",\"LightSlateGrey\",\"LightSteelBlue\",\"LightYellow\",\"Lime\",\"LimeGreen\",\"Linen\",\"Magenta\",\"Maroon\",\"MediumAquamarine\",\"MediumBlue\",\"MediumOrchid\",\"MediumPurple\",\"MediumSeaGreen\",\"MediumSlateBlue\",\"MediumSlateBlue\",\"MediumSpringGreen\",\"MediumTurquoise\",\"MediumVioletRed\",\"MidnightBlue\",\"MintCream\",\"MistyRose\",\"Moccasin\",\"NavajoWhite\",\"Navy\",\"OldLace\",\"Olive\",\"OliveDrab\",\"Orange\",\"OrangeRed\",\"Orchid\",\"PaleGoldenrod\",\"PaleGreen\",\"PaleTurquoise\",\"PaleVioletRed\",\"PapayaWhip\",\"PeachPuff\",\"Peru\",\"Pink\",\"Plum\",\"PowderBlue\",\"Purple\",\"RebeccaPurple\",\"Red\",\"RosyBrown\",\"RoyalBlue\",\"SaddleBrown\",\"Salmon\",\"SandyBrown\",\"SeaGreen\",\"SeaShell\",\"Sienna\",\"Silver\",\"SkyBlue\",\"SlateBlue\",\"SlateGray\",\"SlateGrey\",\"Snow\",\"SpringGreen\",\"SteelBlue\",\"Tan\",\"Teal\",\"Thistle\",\"Tomato\",\"Turquoise\",\"Violet\",\"Wheat\",\"White\",\"WhiteSmoke\",\"Yellow\",\"YellowGreen\"],o=[\"currentColor\",\"inherit\",\"transparent\"],s=D=>{let F=!1;return r(D)&&i.map(M=>(D.toLowerCase()===M.toLowerCase()&&(F=!0),null)),F},a=D=>{let F=!1;return r(D)&&o.map(M=>(D.toLowerCase()===M.toLowerCase()&&(F=!0),null)),F},c=D=>r(D)?D&&/^#([\\da-f]{3}){1,2}$|^#([\\da-f]{4}){1,2}$/i.test(D):!1,u=\"(([\\\\d]{0,5})((\\\\.([\\\\d]{1,5}))?))\",l=`(${u}%)`,p=\"(([0-9]|[1-9][0-9]|100)%)\",f=`(${p}|(0?((\\\\.([\\\\d]{1,5}))?))|1)`,m=`([\\\\s]{0,5})\\\\)?)(([\\\\s]{0,5})(\\\\/?)([\\\\s]{1,5})${`(((${p}))|(0?((\\\\.([\\\\d]{1,5}))?))|1))?`}([\\\\s]{0,5})\\\\)`,g=\"(-?(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-5][0-9])((\\\\.([\\\\d]{1,5}))?)|360)(deg)?)\",h=D=>{if(r(D)){let F=\"([\\\\s]{0,5})([\\\\d]{1,5})%?([\\\\s]{0,5}),?\",M=\"((([\\\\s]{0,5}),?([\\\\s]{0,5}))|(([\\\\s]{1,5})))\",V=new RegExp(`^(rgb)a?\\\\(${`${F}${M}`}${`${F}${M}`}${`${F}${M}`}((\\\\/?([\\\\s]{0,5})(0?\\\\.?([\\\\d]{1,5})%?([\\\\s]{0,5}))?|1|0))?\\\\)$`);return D&&V.test(D)}return!1},y=D=>{if(r(D)){let F=new RegExp(`^(hsl)a?\\\\((([\\\\s]{0,5})(${g}|(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-9][0-9]|400)grad)|((([0-5])?\\\\.([\\\\d]{1,5})|6\\\\.([0-9]|1[0-9]|2[0-8])|[0-6])rad)|((0?((\\\\.([\\\\d]{1,5}))?)|1)turn))((([\\\\s]{0,5}),([\\\\s]{0,5}))|(([\\\\s]{1,5}))))(([\\\\s]{0,5})(0|${p})((([\\\\s]{0,5}),([\\\\s]{0,5}))|(([\\\\s]{1,5}))))(([\\\\s]{0,5})(0|${p})([\\\\s]{0,5})\\\\)?)(([\\\\s]{0,5})(\\\\/?|,?)([\\\\s]{0,5})(((${p}))|(0?((\\\\.([\\\\d]{1,5}))?))|1))?\\\\)$`);return D&&F.test(D)}return!1},v=D=>{if(r(D)){let F=new RegExp(`^(hwb\\\\(([\\\\s]{0,5})${g}([\\\\s]{1,5}))((0|${p})([\\\\s]{1,5}))((0|${p})${m}$`);return D&&F.test(D)}return!1},x=D=>{if(r(D)){let F=\"(-?(([0-9]|[1-9][0-9]|1[0-5][0-9])((\\\\.([\\\\d]{1,5}))?)?|160))\",M=new RegExp(`^(lab\\\\(([\\\\s]{0,5})${l}([\\\\s]{1,5})${F}([\\\\s]{1,5})${F}${m}$`);return D&&M.test(D)}return!1},$=D=>{if(r(D)){let F=\"((([0-9]|[1-9][0-9])?((\\\\.([\\\\d]{1,5}))?)|100)(%)?)\",M=\"\"+u,V=`((${g})|(0|${f})|(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-5][0-9])((\\\\.([\\\\d]{1,5}))?)|360))`,N=`(\\\\/([\\\\s]{0,5})${f})`,J=new RegExp(`^lch\\\\(${`(([\\\\s]{0,5})${F}([\\\\s]{1,5})${M}([\\\\s]{1,5})${V}([\\\\s]{0,5})(${N})?)`}\\\\)$`);return D&&J.test(D)}return!1},P=D=>!!(D&&c(D)||h(D)||y(D)||v(D)||x(D)||$(D));e.default=D=>!!(D&&c(D)||s(D)||a(D)||h(D)||y(D)||v(D)||x(D)||$(D))}])});var Mb=$d((OL,Nb)=>{\"use strict\";Nb.exports=function n(e){if(typeof e==\"number\"&&isNaN(e))throw new Error(\"NaN is not allowed\");if(typeof e==\"number\"&&!isFinite(e))throw new Error(\"Infinity is not allowed\");return e===null||typeof e!=\"object\"?JSON.stringify(e):e.toJSON instanceof Function?n(e.toJSON()):Array.isArray(e)?`[${e.reduce((i,o,s)=>`${i}${s===0?\"\":\",\"}${n(o===void 0||typeof o==\"symbol\"?null:o)}`,\"\")}]`:`{${Object.keys(e).sort().reduce((r,i)=>{if(e[i]===void 0||typeof e[i]==\"symbol\")return r;let o=r.length===0?\"\":\",\";return`${r}${o}${n(i)}:${n(e[i])}`},\"\")}}`}});var Fo,K,Nd,yv,Zn,Fd,Md,jd,Uc,zs,$o,Pd,Wc,zc,qc,Ld,qs={},Zs=[],bv=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ro=Array.isArray;function nn(n,e){for(var t in e)n[t]=e[t];return n}function Hc(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function vt(n,e,t){var r,i,o,s={};for(o in e)o==\"key\"?r=e[o]:o==\"ref\"?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?Fo.call(arguments,2):t),typeof n==\"function\"&&n.defaultProps!=null)for(o in n.defaultProps)s[o]===void 0&&(s[o]=n.defaultProps[o]);return Io(n,s,r,i,null)}function Io(n,e,t,r,i){var o={type:n,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Nd,__i:-1,__u:0};return i==null&&K.vnode!=null&&K.vnode(o),o}function Gc(){return{current:null}}function Ie(n){return n.children}function Ft(n,e){this.props=n,this.context=e}function $r(n,e){if(e==null)return n.__?$r(n.__,n.__i+1):null;for(var t;e<n.__k.length;e++)if((t=n.__k[e])!=null&&t.__e!=null)return t.__e;return typeof n.type==\"function\"?$r(n):null}function vv(n){if(n.__P&&n.__d){var e=n.__v,t=e.__e,r=[],i=[],o=nn({},e);o.__v=e.__v+1,K.vnode&&K.vnode(o),Kc(n.__P,o,e,n.__n,n.__P.namespaceURI,32&e.__u?[t]:null,r,t??$r(e),!!(32&e.__u),i),o.__v=e.__v,o.__.__k[o.__i]=o,qd(r,o,i),e.__e=e.__=null,o.__e!=t&&Bd(o)}}function Bd(n){if((n=n.__)!=null&&n.__c!=null)return n.__e=n.__c.base=null,n.__k.some(function(e){if(e!=null&&e.__e!=null)return n.__e=n.__c.base=e.__e}),Bd(n)}function Zc(n){(!n.__d&&(n.__d=!0)&&Zn.push(n)&&!Ws.__r++||Fd!=K.debounceRendering)&&((Fd=K.debounceRendering)||Md)(Ws)}function Ws(){try{for(var n,e=1;Zn.length;)Zn.length>e&&Zn.sort(jd),n=Zn.shift(),e=Zn.length,vv(n)}finally{Zn.length=Ws.__r=0}}function Vd(n,e,t,r,i,o,s,a,c,u,l){var p,f,m,g,h,y,v=r&&r.__k||Zs,x=e.length;for(c=_v(t,e,v,c,x),p=0;p<x;p++)(m=t.__k[p])!=null&&(f=m.__i!=-1&&v[m.__i]||qs,m.__i=p,y=Kc(n,m,f,i,o,s,a,c,u,l),g=m.__e,m.ref&&f.ref!=m.ref&&(f.ref&&Jc(f.ref,null,m),l.push(m.ref,m.__c||g,m)),h==null&&g!=null&&(h=g),4&m.__u?(c=Ud(m,c,n),f.__e&&(f.__e=null)):typeof m.type==\"function\"&&y!==void 0?c=y:g&&(c=g.nextSibling),m.__u&=-7);return t.__e=h,c}function _v(n,e,t,r,i){var o,s,a,c,u,l=t.length,p=l,f=0;for(n.__k=new Array(i),o=0;o<i;o++)(s=e[o])!=null&&typeof s!=\"boolean\"&&typeof s!=\"function\"?(typeof s==\"string\"||typeof s==\"number\"||typeof s==\"bigint\"||s.constructor==String?s=n.__k[o]=Io(null,s,null,null,null):Ro(s)?s=n.__k[o]=Io(Ie,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=n.__k[o]=Io(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):n.__k[o]=s,c=o+f,s.__=n,s.__b=n.__b+1,a=null,(u=s.__i=xv(s,t,c,p))!=-1&&(p--,(a=t[u])&&(a.__u|=2)),a==null||a.__v==null?(u==-1&&(i>l?f--:i<l&&f++),typeof s.type!=\"function\"&&(s.__u|=4)):u!=c&&(u==c-1?f--:u==c+1?f++:(u>c?f--:f++,s.__u|=4))):n.__k[o]=null;if(p)for(o=0;o<l;o++)(a=t[o])!=null&&(2&a.__u)==0&&(a.__e==r&&(r=$r(a)),Wd(a,a));return r}function Ud(n,e,t){var r,i;if(typeof n.type==\"function\"){for(r=n.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=n,e=Ud(r[i],e,t));return e}n.__e!=e&&(e&&n.type&&!e.parentNode&&(e=$r(n)),e=t.insertBefore(n.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function rn(n,e){return e=e||[],n==null||typeof n==\"boolean\"||(Ro(n)?n.some(function(t){rn(t,e)}):e.push(n)),e}function xv(n,e,t,r){var i,o,s,a=n.key,c=n.type,u=e[t],l=u!=null&&(2&u.__u)==0;if(u===null&&a==null||l&&a==u.key&&c==u.type)return t;if(r>(l?1:0)){for(i=t-1,o=t+1;i>=0||o<e.length;)if((u=e[s=i>=0?i--:o++])!=null&&(2&u.__u)==0&&a==u.key&&c==u.type)return s}return-1}function Rd(n,e,t){e[0]==\"-\"?n.setProperty(e,t??\"\"):n[e]=t==null?\"\":typeof t!=\"number\"||bv.test(e)?t:t+\"px\"}function Us(n,e,t,r,i){var o,s;e:if(e==\"style\")if(typeof t==\"string\")n.style.cssText=t;else{if(typeof r==\"string\"&&(n.style.cssText=r=\"\"),r)for(e in r)t&&e in t||Rd(n.style,e,\"\");if(t)for(e in t)r&&t[e]==r[e]||Rd(n.style,e,t[e])}else if(e[0]==\"o\"&&e[1]==\"n\")o=e!=(e=e.replace(Pd,\"$1\")),s=e.toLowerCase(),e=s in n||e==\"onFocusOut\"||e==\"onFocusIn\"?s.slice(2):e.slice(2),n.l||(n.l={}),n.l[e+o]=t,t?r?t[$o]=r[$o]:(t[$o]=Wc,n.addEventListener(e,o?qc:zc,o)):n.removeEventListener(e,o?qc:zc,o);else{if(i==\"http://www.w3.org/2000/svg\")e=e.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(e!=\"width\"&&e!=\"height\"&&e!=\"href\"&&e!=\"list\"&&e!=\"form\"&&e!=\"tabIndex\"&&e!=\"download\"&&e!=\"rowSpan\"&&e!=\"colSpan\"&&e!=\"role\"&&e!=\"popover\"&&e in n)try{n[e]=t??\"\";break e}catch{}typeof t==\"function\"||(t==null||t===!1&&e[4]!=\"-\"?n.removeAttribute(e):n.setAttribute(e,e==\"popover\"&&t==1?\"\":t))}}function Od(n){return function(e){if(this.l){var t=this.l[e.type+n];if(e[zs]==null)e[zs]=Wc++;else if(e[zs]<t[$o])return;return t(K.event?K.event(e):e)}}}function Kc(n,e,t,r,i,o,s,a,c,u){var l,p,f,m,g,h,y,v,x,$,P,D,F,M,V,N,J=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),o=[a=e.__e=t.__e]),(l=K.__b)&&l(e);e:if(typeof J==\"function\"){p=s.length;try{if(x=e.props,$=J.prototype&&J.prototype.render,P=(l=J.contextType)&&r[l.__c],D=l?P?P.props.value:l.__:r,t.__c?v=(f=e.__c=t.__c).__=f.__E:($?e.__c=f=new J(x,D):(e.__c=f=new Ft(x,D),f.constructor=J,f.render=Cv),P&&P.sub(f),f.state||(f.state={}),f.__n=r,m=f.__d=!0,f.__h=[],f._sb=[]),$&&f.__s==null&&(f.__s=f.state),$&&J.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=nn({},f.__s)),nn(f.__s,J.getDerivedStateFromProps(x,f.__s))),g=f.props,h=f.state,f.__v=e,m)$&&J.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),$&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if($&&J.getDerivedStateFromProps==null&&x!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(x,D),e.__v==t.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(x,f.__s,D)===!1){e.__v!=t.__v&&(f.props=x,f.state=f.__s,f.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(Y){Y&&(Y.__=e)}),Zs.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f),a=$r(t);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(x,f.__s,D),$&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,y)})}if(f.context=D,f.props=x,f.__P=n,f.__e=!1,F=K.__r,M=0,$)f.state=f.__s,f.__d=!1,F&&F(e),l=f.render(f.props,f.state,f.context),Zs.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,F&&F(e),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++M<25);f.state=f.__s,f.getChildContext!=null&&(r=nn(nn({},r),f.getChildContext())),$&&!m&&f.getSnapshotBeforeUpdate!=null&&(y=f.getSnapshotBeforeUpdate(g,h)),V=l!=null&&l.type===Ie&&l.key==null?Zd(l.props.children):l,a=Vd(n,Ro(V)?V:[V],e,t,r,i,o,s,a,c,u),f.base=e.__e,e.__u&=-161,f.__h.length&&s.push(f),v&&(f.__E=f.__=null)}catch(Y){if(s.length=p,e.__v=null,c||o!=null){if(Y.then){for(e.__u|=c?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o!=null&&(o[o.indexOf(a)]=null),e.__e=a}else if(o!=null)for(N=o.length;N--;)Hc(o[N])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),Y.then||zd(e),K.__e(Y,e,t)}}else o==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=Av(t.__e,e,t,r,i,o,s,c,u);return(l=K.diffed)&&l(e),128&e.__u?void 0:a}function zd(n){n&&(n.__c&&(n.__c.__e=!0),n.__k&&n.__k.some(zd))}function qd(n,e,t){for(var r=0;r<t.length;r++)Jc(t[r],t[++r],t[++r]);K.__c&&K.__c(e,n),n.some(function(i){try{n=i.__h,i.__h=[],n.some(function(o){o.call(i)})}catch(o){K.__e(o,i.__v)}})}function Zd(n){return typeof n!=\"object\"||n==null||n.__b>0?n:Ro(n)?n.map(Zd):n.constructor!==void 0?null:nn({},n)}function Av(n,e,t,r,i,o,s,a,c){var u,l,p,f,m,g,h,y=t.props||qs,v=e.props,x=e.type;if(x==\"svg\"?i=\"http://www.w3.org/2000/svg\":x==\"math\"?i=\"http://www.w3.org/1998/Math/MathML\":i||(i=\"http://www.w3.org/1999/xhtml\"),o!=null){for(u=0;u<o.length;u++)if((m=o[u])&&\"setAttribute\"in m==!!x&&(x?m.localName==x:m.nodeType==3)){n=m,o[u]=null;break}}if(n==null){if(x==null)return document.createTextNode(v);n=document.createElementNS(i,x,v.is&&v),a&&(K.__m&&K.__m(e,o),a=!1),o=null}if(x==null)y===v||a&&n.data==v||(n.data=v);else{if(o=x==\"textarea\"&&v.defaultValue!=null?null:o&&Fo.call(n.childNodes),!a&&o!=null)for(y={},u=0;u<n.attributes.length;u++)y[(m=n.attributes[u]).name]=m.value;for(u in y)m=y[u],u==\"dangerouslySetInnerHTML\"?p=m:u==\"children\"||u in v||u==\"value\"&&\"defaultValue\"in v||u==\"checked\"&&\"defaultChecked\"in v||Us(n,u,null,m,i);for(u in v)m=v[u],u==\"children\"?f=m:u==\"dangerouslySetInnerHTML\"?l=m:u==\"value\"?g=m:u==\"checked\"?h=m:a&&typeof m!=\"function\"||y[u]===m||Us(n,u,m,y[u],i);if(l)a||p&&(l.__html==p.__html||l.__html==n.innerHTML)||(n.innerHTML=l.__html),e.__k=[];else if(p&&(n.innerHTML=\"\"),Vd(e.type==\"template\"?n.content:n,Ro(f)?f:[f],e,t,r,x==\"foreignObject\"?\"http://www.w3.org/1999/xhtml\":i,o,s,o?o[0]:t.__k&&$r(t,0),a,c),o!=null)for(u=o.length;u--;)Hc(o[u]);a&&x!=\"textarea\"||(u=\"value\",x==\"progress\"&&g==null?n.removeAttribute(\"value\"):g!=null&&(g!==n[u]||x==\"progress\"&&!g||x==\"option\"&&g!=y[u])&&Us(n,u,g,y[u],i),u=\"checked\",h!=null&&h!=n[u]&&Us(n,u,h,y[u],i))}return n}function Jc(n,e,t){try{if(typeof n==\"function\"){var r=typeof n.__u==\"function\";r&&n.__u(),r&&e==null||(n.__u=n(e))}else n.current=e}catch(i){K.__e(i,t)}}function Wd(n,e,t){var r,i;if(K.unmount&&K.unmount(n),(r=n.ref)&&(r.current&&r.current!=n.__e||Jc(r,null,e)),(r=n.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){K.__e(o,e)}r.base=r.__P=r.__n=null}if(r=n.__k)for(i=0;i<r.length;i++)r[i]&&Wd(r[i],e,t||typeof n.type!=\"function\");t||Hc(n.__e),n.__c=n.__=n.__e=void 0}function Cv(n,e,t){return this.constructor(n,t)}function Wn(n,e,t){var r,i,o,s;e==document&&(e=document.documentElement),K.__&&K.__(n,e),i=(r=typeof t==\"function\")?null:t&&t.__k||e.__k,o=[],s=[],Kc(e,n=(!r&&t||e).__k=vt(Ie,null,[n]),i||qs,qs,e.namespaceURI,!r&&t?[t]:i?null:e.firstChild?Fo.call(e.childNodes):null,o,!r&&t?t:i?i.__e:e.firstChild,r,s),qd(o,n,s),n.props.children=null}function Yc(n,e){Wn(n,e,Yc)}function Hd(n,e,t){var r,i,o,s,a=nn({},n.props);for(o in n.type&&n.type.defaultProps&&(s=n.type.defaultProps),e)o==\"key\"?r=e[o]:o==\"ref\"?i=e[o]:a[o]=e[o]===void 0&&s!=null?s[o]:e[o];return arguments.length>2&&(a.children=arguments.length>3?Fo.call(arguments,2):t),Io(n.type,a,r||n.key,i||n.ref,null)}function Oo(n){function e(t){var r,i;return this.getChildContext||(r=new Set,(i={})[e.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(o){this.props.value!=o.value&&r.forEach(function(s){s.__e=!0,Zc(s)})},this.sub=function(o){r.add(o);var s=o.componentWillUnmount;o.componentWillUnmount=function(){r&&r.delete(o),s&&s.call(o)}}),t.children}return e.__c=\"__cC\"+Ld++,e.__=n,e.Provider=e.__l=(e.Consumer=function(t,r){return t.children(r)}).contextType=e,e}Fo=Zs.slice,K={__e:function(n,e,t,r){for(var i,o,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(n)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(n,r||{}),s=i.__d),s)return i.__E=i}catch(a){n=a}throw n}},Nd=0,yv=function(n){return n!=null&&n.constructor===void 0},Ft.prototype.setState=function(n,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=nn({},this.state),typeof n==\"function\"&&(n=n(nn({},t),this.props)),n&&nn(t,n),n!=null&&this.__v&&(e&&this._sb.push(e),Zc(this))},Ft.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),Zc(this))},Ft.prototype.render=Ie,Zn=[],Md=typeof Promise==\"function\"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,jd=function(n,e){return n.__v.__b-e.__v.__b},Ws.__r=0,Uc=Math.random().toString(8),zs=\"__d\"+Uc,$o=\"__a\"+Uc,Pd=/(PointerCapture)$|Capture$/i,Wc=0,zc=Od(!1),qc=Od(!0),Ld=0;var d={};mv(d,{BRAND:()=>Kv,DIRTY:()=>Ir,EMPTY_PATH:()=>Sv,INVALID:()=>z,NEVER:()=>R0,OK:()=>Ge,ParseStatus:()=>Le,Schema:()=>te,ZodAny:()=>Kn,ZodArray:()=>wn,ZodBigInt:()=>Rr,ZodBoolean:()=>Or,ZodBranded:()=>Mo,ZodCatch:()=>Zr,ZodDate:()=>Nr,ZodDefault:()=>qr,ZodDiscriminatedUnion:()=>Ks,ZodEffects:()=>Nt,ZodEnum:()=>Ur,ZodError:()=>dt,ZodFirstPartyTypeKind:()=>T,ZodFunction:()=>Ys,ZodIntersection:()=>Lr,ZodIssueCode:()=>S,ZodLazy:()=>Br,ZodLiteral:()=>Vr,ZodMap:()=>Ui,ZodNaN:()=>qi,ZodNativeEnum:()=>zr,ZodNever:()=>zt,ZodNull:()=>jr,ZodNullable:()=>an,ZodNumber:()=>Fr,ZodObject:()=>ft,ZodOptional:()=>Rt,ZodParsedType:()=>O,ZodPipeline:()=>jo,ZodPromise:()=>Jn,ZodReadonly:()=>Wr,ZodRecord:()=>Js,ZodSchema:()=>te,ZodSet:()=>zi,ZodString:()=>Gn,ZodSymbol:()=>Bi,ZodTransformer:()=>Nt,ZodTuple:()=>sn,ZodType:()=>te,ZodUndefined:()=>Mr,ZodUnion:()=>Pr,ZodUnknown:()=>Dn,ZodVoid:()=>Vi,addIssueToContext:()=>I,any:()=>i0,array:()=>c0,bigint:()=>Qv,boolean:()=>of,coerce:()=>F0,custom:()=>tf,date:()=>e0,datetimeRegex:()=>Qd,defaultErrorMap:()=>An,discriminatedUnion:()=>f0,effect:()=>D0,enum:()=>x0,function:()=>b0,getErrorMap:()=>ji,getParsedType:()=>on,instanceof:()=>Yv,intersection:()=>p0,isAborted:()=>Hs,isAsync:()=>Pi,isDirty:()=>Gs,isValid:()=>Hn,late:()=>Jv,lazy:()=>v0,literal:()=>_0,makeIssue:()=>No,map:()=>g0,nan:()=>Xv,nativeEnum:()=>A0,never:()=>s0,null:()=>r0,nullable:()=>E0,number:()=>rf,object:()=>u0,objectUtil:()=>Xc,oboolean:()=>I0,onumber:()=>$0,optional:()=>w0,ostring:()=>k0,pipeline:()=>T0,preprocess:()=>S0,promise:()=>C0,quotelessJson:()=>Dv,record:()=>m0,set:()=>y0,setErrorMap:()=>Ev,strictObject:()=>l0,string:()=>nf,symbol:()=>t0,transformer:()=>D0,tuple:()=>h0,undefined:()=>n0,union:()=>d0,unknown:()=>o0,util:()=>ce,void:()=>a0});var ce;(function(n){n.assertEqual=i=>{};function e(i){}n.assertIs=e;function t(i){throw new Error}n.assertNever=t,n.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},n.getValidEnumValues=i=>{let o=n.objectKeys(i).filter(a=>typeof i[i[a]]!=\"number\"),s={};for(let a of o)s[a]=i[a];return n.objectValues(s)},n.objectValues=i=>n.objectKeys(i).map(function(o){return i[o]}),n.objectKeys=typeof Object.keys==\"function\"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},n.find=(i,o)=>{for(let s of i)if(o(s))return s},n.isInteger=typeof Number.isInteger==\"function\"?i=>Number.isInteger(i):i=>typeof i==\"number\"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,o=\" | \"){return i.map(s=>typeof s==\"string\"?`'${s}'`:s).join(o)}n.joinValues=r,n.jsonStringifyReplacer=(i,o)=>typeof o==\"bigint\"?o.toString():o})(ce||(ce={}));var Xc;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Xc||(Xc={}));var O=ce.arrayToEnum([\"string\",\"nan\",\"number\",\"integer\",\"float\",\"boolean\",\"date\",\"bigint\",\"symbol\",\"function\",\"undefined\",\"null\",\"array\",\"object\",\"unknown\",\"promise\",\"void\",\"never\",\"map\",\"set\"]),on=n=>{switch(typeof n){case\"undefined\":return O.undefined;case\"string\":return O.string;case\"number\":return Number.isNaN(n)?O.nan:O.number;case\"boolean\":return O.boolean;case\"function\":return O.function;case\"bigint\":return O.bigint;case\"symbol\":return O.symbol;case\"object\":return Array.isArray(n)?O.array:n===null?O.null:n.then&&typeof n.then==\"function\"&&n.catch&&typeof n.catch==\"function\"?O.promise:typeof Map<\"u\"&&n instanceof Map?O.map:typeof Set<\"u\"&&n instanceof Set?O.set:typeof Date<\"u\"&&n instanceof Date?O.date:O.object;default:return O.unknown}};var S=ce.arrayToEnum([\"invalid_type\",\"invalid_literal\",\"custom\",\"invalid_union\",\"invalid_union_discriminator\",\"invalid_enum_value\",\"unrecognized_keys\",\"invalid_arguments\",\"invalid_return_type\",\"invalid_date\",\"invalid_string\",\"too_small\",\"too_big\",\"invalid_intersection_types\",\"not_multiple_of\",\"not_finite\"]),Dv=n=>JSON.stringify(n,null,2).replace(/\"([^\"]+)\":/g,\"$1:\"),dt=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=\"ZodError\",this.issues=e}format(e){let t=e||function(o){return o.message},r={_errors:[]},i=o=>{for(let s of o.issues)if(s.code===\"invalid_union\")s.unionErrors.map(i);else if(s.code===\"invalid_return_type\")i(s.returnTypeError);else if(s.code===\"invalid_arguments\")i(s.argumentsError);else if(s.path.length===0)r._errors.push(t(s));else{let a=r,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(t(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),r}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ce.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];t[o]=t[o]||[],t[o].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};dt.create=n=>new dt(n);var wv=(n,e)=>{let t;switch(n.code){case S.invalid_type:n.received===O.undefined?t=\"Required\":t=`Expected ${n.expected}, received ${n.received}`;break;case S.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,ce.jsonStringifyReplacer)}`;break;case S.unrecognized_keys:t=`Unrecognized key(s) in object: ${ce.joinValues(n.keys,\", \")}`;break;case S.invalid_union:t=\"Invalid input\";break;case S.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ce.joinValues(n.options)}`;break;case S.invalid_enum_value:t=`Invalid enum value. Expected ${ce.joinValues(n.options)}, received '${n.received}'`;break;case S.invalid_arguments:t=\"Invalid function arguments\";break;case S.invalid_return_type:t=\"Invalid function return type\";break;case S.invalid_date:t=\"Invalid date\";break;case S.invalid_string:typeof n.validation==\"object\"?\"includes\"in n.validation?(t=`Invalid input: must include \"${n.validation.includes}\"`,typeof n.validation.position==\"number\"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):\"startsWith\"in n.validation?t=`Invalid input: must start with \"${n.validation.startsWith}\"`:\"endsWith\"in n.validation?t=`Invalid input: must end with \"${n.validation.endsWith}\"`:ce.assertNever(n.validation):n.validation!==\"regex\"?t=`Invalid ${n.validation}`:t=\"Invalid\";break;case S.too_small:n.type===\"array\"?t=`Array must contain ${n.exact?\"exactly\":n.inclusive?\"at least\":\"more than\"} ${n.minimum} element(s)`:n.type===\"string\"?t=`String must contain ${n.exact?\"exactly\":n.inclusive?\"at least\":\"over\"} ${n.minimum} character(s)`:n.type===\"number\"?t=`Number must be ${n.exact?\"exactly equal to \":n.inclusive?\"greater than or equal to \":\"greater than \"}${n.minimum}`:n.type===\"bigint\"?t=`Number must be ${n.exact?\"exactly equal to \":n.inclusive?\"greater than or equal to \":\"greater than \"}${n.minimum}`:n.type===\"date\"?t=`Date must be ${n.exact?\"exactly equal to \":n.inclusive?\"greater than or equal to \":\"greater than \"}${new Date(Number(n.minimum))}`:t=\"Invalid input\";break;case S.too_big:n.type===\"array\"?t=`Array must contain ${n.exact?\"exactly\":n.inclusive?\"at most\":\"less than\"} ${n.maximum} element(s)`:n.type===\"string\"?t=`String must contain ${n.exact?\"exactly\":n.inclusive?\"at most\":\"under\"} ${n.maximum} character(s)`:n.type===\"number\"?t=`Number must be ${n.exact?\"exactly\":n.inclusive?\"less than or equal to\":\"less than\"} ${n.maximum}`:n.type===\"bigint\"?t=`BigInt must be ${n.exact?\"exactly\":n.inclusive?\"less than or equal to\":\"less than\"} ${n.maximum}`:n.type===\"date\"?t=`Date must be ${n.exact?\"exactly\":n.inclusive?\"smaller than or equal to\":\"smaller than\"} ${new Date(Number(n.maximum))}`:t=\"Invalid input\";break;case S.custom:t=\"Invalid input\";break;case S.invalid_intersection_types:t=\"Intersection results could not be merged\";break;case S.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case S.not_finite:t=\"Number must be finite\";break;default:t=e.defaultError,ce.assertNever(n)}return{message:t}},An=wv;var Gd=An;function Ev(n){Gd=n}function ji(){return Gd}var No=n=>{let{data:e,path:t,errorMaps:r,issueData:i}=n,o=[...t,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a=\"\",c=r.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}},Sv=[];function I(n,e){let t=ji(),r=No({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===An?void 0:An].filter(i=>!!i)});n.common.issues.push(r)}var Le=class n{constructor(){this.value=\"valid\"}dirty(){this.value===\"valid\"&&(this.value=\"dirty\")}abort(){this.value!==\"aborted\"&&(this.value=\"aborted\")}static mergeArray(e,t){let r=[];for(let i of t){if(i.status===\"aborted\")return z;i.status===\"dirty\"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let i of t){let o=await i.key,s=await i.value;r.push({key:o,value:s})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let i of t){let{key:o,value:s}=i;if(o.status===\"aborted\"||s.status===\"aborted\")return z;o.status===\"dirty\"&&e.dirty(),s.status===\"dirty\"&&e.dirty(),o.value!==\"__proto__\"&&(typeof s.value<\"u\"||i.alwaysSet)&&(r[o.value]=s.value)}return{status:e.value,value:r}}},z=Object.freeze({status:\"aborted\"}),Ir=n=>({status:\"dirty\",value:n}),Ge=n=>({status:\"valid\",value:n}),Hs=n=>n.status===\"aborted\",Gs=n=>n.status===\"dirty\",Hn=n=>n.status===\"valid\",Pi=n=>typeof Promise<\"u\"&&n instanceof Promise;var L;(function(n){n.errToObj=e=>typeof e==\"string\"?{message:e}:e||{},n.toString=e=>typeof e==\"string\"?e:e?.message})(L||(L={}));var Ot=class{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Kd=(n,e)=>{if(Hn(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error(\"Validation failed but no issues detected.\");return{success:!1,get error(){if(this._error)return this._error;let t=new dt(n.common.issues);return this._error=t,this._error}}};function Q(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:i}=n;if(e&&(t||r))throw new Error(`Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:c}=n;return s.code===\"invalid_enum_value\"?{message:c??a.defaultError}:typeof a.data>\"u\"?{message:c??r??a.defaultError}:s.code!==\"invalid_type\"?{message:a.defaultError}:{message:c??t??a.defaultError}},description:i}}var te=class{get description(){return this._def.description}_getType(e){return on(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:on(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Le,ctx:{common:e.parent.common,data:e.data,parsedType:on(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Pi(t))throw new Error(\"Synchronous parse encountered promise.\");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:on(e)},i=this._parseSync({data:e,path:r.path,parent:r});return Kd(r,i)}\"~validate\"(e){let t={common:{issues:[],async:!!this[\"~standard\"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:on(e)};if(!this[\"~standard\"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Hn(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes(\"encountered\")&&(this[\"~standard\"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>Hn(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:on(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(Pi(i)?i:Promise.resolve(i));return Kd(r,o)}refine(e,t){let r=i=>typeof t==\"string\"||typeof t>\"u\"?{message:t}:typeof t==\"function\"?t(i):t;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:S.custom,...r(i)});return typeof Promise<\"u\"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,t){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof t==\"function\"?t(r,i):t),!1))}_refinement(e){return new Nt({schema:this,typeName:T.ZodEffects,effect:{type:\"refinement\",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[\"~standard\"]={version:1,vendor:\"zod\",validate:t=>this[\"~validate\"](t)}}optional(){return Rt.create(this,this._def)}nullable(){return an.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wn.create(this)}promise(){return Jn.create(this,this._def)}or(e){return Pr.create([this,e],this._def)}and(e){return Lr.create(this,e,this._def)}transform(e){return new Nt({...Q(this._def),schema:this,typeName:T.ZodEffects,effect:{type:\"transform\",transform:e}})}default(e){let t=typeof e==\"function\"?e:()=>e;return new qr({...Q(this._def),innerType:this,defaultValue:t,typeName:T.ZodDefault})}brand(){return new Mo({typeName:T.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e==\"function\"?e:()=>e;return new Zr({...Q(this._def),innerType:this,catchValue:t,typeName:T.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return jo.create(this,e)}readonly(){return Wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Tv=/^c[^\\s-]{8,}$/i,kv=/^[0-9a-z]+$/,$v=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Iv=/^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i,Fv=/^[a-z0-9_-]{21}$/i,Rv=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,Ov=/^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/,Nv=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,Mv=\"^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$\",Qc,jv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Pv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,Lv=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Bv=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Vv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Uv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Yd=\"((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))\",zv=new RegExp(`^${Yd}$`);function Xd(n){let e=\"[0-5]\\\\d\";n.precision?e=`${e}\\\\.\\\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\\\.\\\\d+)?`);let t=n.precision?\"+\":\"?\";return`([01]\\\\d|2[0-3]):[0-5]\\\\d(:${e})${t}`}function qv(n){return new RegExp(`^${Xd(n)}$`)}function Qd(n){let e=`${Yd}T${Xd(n)}`,t=[];return t.push(n.local?\"Z?\":\"Z\"),n.offset&&t.push(\"([+-]\\\\d{2}:?\\\\d{2})\"),e=`${e}(${t.join(\"|\")})`,new RegExp(`^${e}$`)}function Zv(n,e){return!!((e===\"v4\"||!e)&&jv.test(n)||(e===\"v6\"||!e)&&Lv.test(n))}function Wv(n,e){if(!Rv.test(n))return!1;try{let[t]=n.split(\".\");if(!t)return!1;let r=t.replace(/-/g,\"+\").replace(/_/g,\"/\").padEnd(t.length+(4-t.length%4)%4,\"=\"),i=JSON.parse(atob(r));return!(typeof i!=\"object\"||i===null||\"typ\"in i&&i?.typ!==\"JWT\"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Hv(n,e){return!!((e===\"v4\"||!e)&&Pv.test(n)||(e===\"v6\"||!e)&&Bv.test(n))}var Gn=class n extends te{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==O.string){let o=this._getOrReturnCtx(e);return I(o,{code:S.invalid_type,expected:O.string,received:o.parsedType}),z}let r=new Le,i;for(let o of this._def.checks)if(o.kind===\"min\")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),I(i,{code:S.too_small,minimum:o.value,type:\"string\",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind===\"max\")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),I(i,{code:S.too_big,maximum:o.value,type:\"string\",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind===\"length\"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?I(i,{code:S.too_big,maximum:o.value,type:\"string\",inclusive:!0,exact:!0,message:o.message}):a&&I(i,{code:S.too_small,minimum:o.value,type:\"string\",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind===\"email\")Nv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"email\",code:S.invalid_string,message:o.message}),r.dirty());else if(o.kind===\"emoji\")Qc||(Qc=new RegExp(Mv,\"u\")),Qc.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"emoji\",code:S.invalid_string,message:o.message}),r.dirty());else if(o.kind===\"uuid\")Iv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"uuid\",code:S.invalid_string,message:o.message}),r.dirty());else if(o.kind===\"nanoid\")Fv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"nanoid\",code:S.invalid_string,message:o.message}),r.dirty());else if(o.kind===\"cuid\")Tv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"cuid\",code:S.invalid_string,message:o.message}),r.dirty());else if(o.kind===\"cuid2\")kv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"cuid2\",code:S.invalid_string,message:o.message}),r.dirty());else if(o.kind===\"ulid\")$v.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"ulid\",code:S.invalid_string,message:o.message}),r.dirty());else if(o.kind===\"url\")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),I(i,{validation:\"url\",code:S.invalid_string,message:o.message}),r.dirty()}else o.kind===\"regex\"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"regex\",code:S.invalid_string,message:o.message}),r.dirty())):o.kind===\"trim\"?e.data=e.data.trim():o.kind===\"includes\"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),I(i,{code:S.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind===\"toLowerCase\"?e.data=e.data.toLowerCase():o.kind===\"toUpperCase\"?e.data=e.data.toUpperCase():o.kind===\"startsWith\"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),I(i,{code:S.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind===\"endsWith\"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),I(i,{code:S.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind===\"datetime\"?Qd(o).test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{code:S.invalid_string,validation:\"datetime\",message:o.message}),r.dirty()):o.kind===\"date\"?zv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{code:S.invalid_string,validation:\"date\",message:o.message}),r.dirty()):o.kind===\"time\"?qv(o).test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{code:S.invalid_string,validation:\"time\",message:o.message}),r.dirty()):o.kind===\"duration\"?Ov.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"duration\",code:S.invalid_string,message:o.message}),r.dirty()):o.kind===\"ip\"?Zv(e.data,o.version)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"ip\",code:S.invalid_string,message:o.message}),r.dirty()):o.kind===\"jwt\"?Wv(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"jwt\",code:S.invalid_string,message:o.message}),r.dirty()):o.kind===\"cidr\"?Hv(e.data,o.version)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"cidr\",code:S.invalid_string,message:o.message}),r.dirty()):o.kind===\"base64\"?Vv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"base64\",code:S.invalid_string,message:o.message}),r.dirty()):o.kind===\"base64url\"?Uv.test(e.data)||(i=this._getOrReturnCtx(e,i),I(i,{validation:\"base64url\",code:S.invalid_string,message:o.message}),r.dirty()):ce.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(i=>e.test(i),{validation:t,code:S.invalid_string,...L.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:\"email\",...L.errToObj(e)})}url(e){return this._addCheck({kind:\"url\",...L.errToObj(e)})}emoji(e){return this._addCheck({kind:\"emoji\",...L.errToObj(e)})}uuid(e){return this._addCheck({kind:\"uuid\",...L.errToObj(e)})}nanoid(e){return this._addCheck({kind:\"nanoid\",...L.errToObj(e)})}cuid(e){return this._addCheck({kind:\"cuid\",...L.errToObj(e)})}cuid2(e){return this._addCheck({kind:\"cuid2\",...L.errToObj(e)})}ulid(e){return this._addCheck({kind:\"ulid\",...L.errToObj(e)})}base64(e){return this._addCheck({kind:\"base64\",...L.errToObj(e)})}base64url(e){return this._addCheck({kind:\"base64url\",...L.errToObj(e)})}jwt(e){return this._addCheck({kind:\"jwt\",...L.errToObj(e)})}ip(e){return this._addCheck({kind:\"ip\",...L.errToObj(e)})}cidr(e){return this._addCheck({kind:\"cidr\",...L.errToObj(e)})}datetime(e){return typeof e==\"string\"?this._addCheck({kind:\"datetime\",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:\"datetime\",precision:typeof e?.precision>\"u\"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...L.errToObj(e?.message)})}date(e){return this._addCheck({kind:\"date\",message:e})}time(e){return typeof e==\"string\"?this._addCheck({kind:\"time\",precision:null,message:e}):this._addCheck({kind:\"time\",precision:typeof e?.precision>\"u\"?null:e?.precision,...L.errToObj(e?.message)})}duration(e){return this._addCheck({kind:\"duration\",...L.errToObj(e)})}regex(e,t){return this._addCheck({kind:\"regex\",regex:e,...L.errToObj(t)})}includes(e,t){return this._addCheck({kind:\"includes\",value:e,position:t?.position,...L.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:\"startsWith\",value:e,...L.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:\"endsWith\",value:e,...L.errToObj(t)})}min(e,t){return this._addCheck({kind:\"min\",value:e,...L.errToObj(t)})}max(e,t){return this._addCheck({kind:\"max\",value:e,...L.errToObj(t)})}length(e,t){return this._addCheck({kind:\"length\",value:e,...L.errToObj(t)})}nonempty(e){return this.min(1,L.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:\"trim\"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:\"toLowerCase\"}]})}toUpperCase(){return new n({...this._def,checks:[...this._def.checks,{kind:\"toUpperCase\"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===\"datetime\")}get isDate(){return!!this._def.checks.find(e=>e.kind===\"date\")}get isTime(){return!!this._def.checks.find(e=>e.kind===\"time\")}get isDuration(){return!!this._def.checks.find(e=>e.kind===\"duration\")}get isEmail(){return!!this._def.checks.find(e=>e.kind===\"email\")}get isURL(){return!!this._def.checks.find(e=>e.kind===\"url\")}get isEmoji(){return!!this._def.checks.find(e=>e.kind===\"emoji\")}get isUUID(){return!!this._def.checks.find(e=>e.kind===\"uuid\")}get isNANOID(){return!!this._def.checks.find(e=>e.kind===\"nanoid\")}get isCUID(){return!!this._def.checks.find(e=>e.kind===\"cuid\")}get isCUID2(){return!!this._def.checks.find(e=>e.kind===\"cuid2\")}get isULID(){return!!this._def.checks.find(e=>e.kind===\"ulid\")}get isIP(){return!!this._def.checks.find(e=>e.kind===\"ip\")}get isCIDR(){return!!this._def.checks.find(e=>e.kind===\"cidr\")}get isBase64(){return!!this._def.checks.find(e=>e.kind===\"base64\")}get isBase64url(){return!!this._def.checks.find(e=>e.kind===\"base64url\")}get minLength(){let e=null;for(let t of this._def.checks)t.kind===\"min\"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===\"max\"&&(e===null||t.value<e)&&(e=t.value);return e}};Gn.create=n=>new Gn({checks:[],typeName:T.ZodString,coerce:n?.coerce??!1,...Q(n)});function Gv(n,e){let t=(n.toString().split(\".\")[1]||\"\").length,r=(e.toString().split(\".\")[1]||\"\").length,i=t>r?t:r,o=Number.parseInt(n.toFixed(i).replace(\".\",\"\")),s=Number.parseInt(e.toFixed(i).replace(\".\",\"\"));return o%s/10**i}var Fr=class n extends te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==O.number){let o=this._getOrReturnCtx(e);return I(o,{code:S.invalid_type,expected:O.number,received:o.parsedType}),z}let r,i=new Le;for(let o of this._def.checks)o.kind===\"int\"?ce.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{code:S.invalid_type,expected:\"integer\",received:\"float\",message:o.message}),i.dirty()):o.kind===\"min\"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),I(r,{code:S.too_small,minimum:o.value,type:\"number\",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind===\"max\"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),I(r,{code:S.too_big,maximum:o.value,type:\"number\",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind===\"multipleOf\"?Gv(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),I(r,{code:S.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind===\"finite\"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{code:S.not_finite,message:o.message}),i.dirty()):ce.assertNever(o);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit(\"min\",e,!0,L.toString(t))}gt(e,t){return this.setLimit(\"min\",e,!1,L.toString(t))}lte(e,t){return this.setLimit(\"max\",e,!0,L.toString(t))}lt(e,t){return this.setLimit(\"max\",e,!1,L.toString(t))}setLimit(e,t,r,i){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:L.toString(i)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:\"int\",message:L.toString(e)})}positive(e){return this._addCheck({kind:\"min\",value:0,inclusive:!1,message:L.toString(e)})}negative(e){return this._addCheck({kind:\"max\",value:0,inclusive:!1,message:L.toString(e)})}nonpositive(e){return this._addCheck({kind:\"max\",value:0,inclusive:!0,message:L.toString(e)})}nonnegative(e){return this._addCheck({kind:\"min\",value:0,inclusive:!0,message:L.toString(e)})}multipleOf(e,t){return this._addCheck({kind:\"multipleOf\",value:e,message:L.toString(t)})}finite(e){return this._addCheck({kind:\"finite\",message:L.toString(e)})}safe(e){return this._addCheck({kind:\"min\",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:L.toString(e)})._addCheck({kind:\"max\",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:L.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===\"min\"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===\"max\"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===\"int\"||e.kind===\"multipleOf\"&&ce.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind===\"finite\"||r.kind===\"int\"||r.kind===\"multipleOf\")return!0;r.kind===\"min\"?(t===null||r.value>t)&&(t=r.value):r.kind===\"max\"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Fr.create=n=>new Fr({checks:[],typeName:T.ZodNumber,coerce:n?.coerce||!1,...Q(n)});var Rr=class n extends te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==O.bigint)return this._getInvalidInput(e);let r,i=new Le;for(let o of this._def.checks)o.kind===\"min\"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),I(r,{code:S.too_small,type:\"bigint\",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind===\"max\"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),I(r,{code:S.too_big,type:\"bigint\",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind===\"multipleOf\"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),I(r,{code:S.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):ce.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return I(t,{code:S.invalid_type,expected:O.bigint,received:t.parsedType}),z}gte(e,t){return this.setLimit(\"min\",e,!0,L.toString(t))}gt(e,t){return this.setLimit(\"min\",e,!1,L.toString(t))}lte(e,t){return this.setLimit(\"max\",e,!0,L.toString(t))}lt(e,t){return this.setLimit(\"max\",e,!1,L.toString(t))}setLimit(e,t,r,i){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:L.toString(i)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:\"min\",value:BigInt(0),inclusive:!1,message:L.toString(e)})}negative(e){return this._addCheck({kind:\"max\",value:BigInt(0),inclusive:!1,message:L.toString(e)})}nonpositive(e){return this._addCheck({kind:\"max\",value:BigInt(0),inclusive:!0,message:L.toString(e)})}nonnegative(e){return this._addCheck({kind:\"min\",value:BigInt(0),inclusive:!0,message:L.toString(e)})}multipleOf(e,t){return this._addCheck({kind:\"multipleOf\",value:e,message:L.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===\"min\"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===\"max\"&&(e===null||t.value<e)&&(e=t.value);return e}};Rr.create=n=>new Rr({checks:[],typeName:T.ZodBigInt,coerce:n?.coerce??!1,...Q(n)});var Or=class extends te{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==O.boolean){let r=this._getOrReturnCtx(e);return I(r,{code:S.invalid_type,expected:O.boolean,received:r.parsedType}),z}return Ge(e.data)}};Or.create=n=>new Or({typeName:T.ZodBoolean,coerce:n?.coerce||!1,...Q(n)});var Nr=class n extends te{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==O.date){let o=this._getOrReturnCtx(e);return I(o,{code:S.invalid_type,expected:O.date,received:o.parsedType}),z}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return I(o,{code:S.invalid_date}),z}let r=new Le,i;for(let o of this._def.checks)o.kind===\"min\"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),I(i,{code:S.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:\"date\"}),r.dirty()):o.kind===\"max\"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),I(i,{code:S.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:\"date\"}),r.dirty()):ce.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:\"min\",value:e.getTime(),message:L.toString(t)})}max(e,t){return this._addCheck({kind:\"max\",value:e.getTime(),message:L.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===\"min\"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===\"max\"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Nr.create=n=>new Nr({checks:[],coerce:n?.coerce||!1,typeName:T.ZodDate,...Q(n)});var Bi=class extends te{_parse(e){if(this._getType(e)!==O.symbol){let r=this._getOrReturnCtx(e);return I(r,{code:S.invalid_type,expected:O.symbol,received:r.parsedType}),z}return Ge(e.data)}};Bi.create=n=>new Bi({typeName:T.ZodSymbol,...Q(n)});var Mr=class extends te{_parse(e){if(this._getType(e)!==O.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:S.invalid_type,expected:O.undefined,received:r.parsedType}),z}return Ge(e.data)}};Mr.create=n=>new Mr({typeName:T.ZodUndefined,...Q(n)});var jr=class extends te{_parse(e){if(this._getType(e)!==O.null){let r=this._getOrReturnCtx(e);return I(r,{code:S.invalid_type,expected:O.null,received:r.parsedType}),z}return Ge(e.data)}};jr.create=n=>new jr({typeName:T.ZodNull,...Q(n)});var Kn=class extends te{constructor(){super(...arguments),this._any=!0}_parse(e){return Ge(e.data)}};Kn.create=n=>new Kn({typeName:T.ZodAny,...Q(n)});var Dn=class extends te{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ge(e.data)}};Dn.create=n=>new Dn({typeName:T.ZodUnknown,...Q(n)});var zt=class extends te{_parse(e){let t=this._getOrReturnCtx(e);return I(t,{code:S.invalid_type,expected:O.never,received:t.parsedType}),z}};zt.create=n=>new zt({typeName:T.ZodNever,...Q(n)});var Vi=class extends te{_parse(e){if(this._getType(e)!==O.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:S.invalid_type,expected:O.void,received:r.parsedType}),z}return Ge(e.data)}};Vi.create=n=>new Vi({typeName:T.ZodVoid,...Q(n)});var wn=class n extends te{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==O.array)return I(t,{code:S.invalid_type,expected:O.array,received:t.parsedType}),z;if(i.exactLength!==null){let s=t.data.length>i.exactLength.value,a=t.data.length<i.exactLength.value;(s||a)&&(I(t,{code:s?S.too_big:S.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:\"array\",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(I(t,{code:S.too_small,minimum:i.minLength.value,type:\"array\",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(I(t,{code:S.too_big,maximum:i.maxLength.value,type:\"array\",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((s,a)=>i.type._parseAsync(new Ot(t,s,t.path,a)))).then(s=>Le.mergeArray(r,s));let o=[...t.data].map((s,a)=>i.type._parseSync(new Ot(t,s,t.path,a)));return Le.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:L.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:L.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:L.toString(t)}})}nonempty(e){return this.min(1,e)}};wn.create=(n,e)=>new wn({type:n,minLength:null,maxLength:null,exactLength:null,typeName:T.ZodArray,...Q(e)});function Li(n){if(n instanceof ft){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=Rt.create(Li(r))}return new ft({...n._def,shape:()=>e})}else return n instanceof wn?new wn({...n._def,type:Li(n.element)}):n instanceof Rt?Rt.create(Li(n.unwrap())):n instanceof an?an.create(Li(n.unwrap())):n instanceof sn?sn.create(n.items.map(e=>Li(e))):n}var ft=class n extends te{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=ce.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==O.object){let u=this._getOrReturnCtx(e);return I(u,{code:S.invalid_type,expected:O.object,received:u.parsedType}),z}let{status:r,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof zt&&this._def.unknownKeys===\"strip\"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=o[u],p=i.data[u];c.push({key:{status:\"valid\",value:u},value:l._parse(new Ot(i,p,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof zt){let u=this._def.unknownKeys;if(u===\"passthrough\")for(let l of a)c.push({key:{status:\"valid\",value:l},value:{status:\"valid\",value:i.data[l]}});else if(u===\"strict\")a.length>0&&(I(i,{code:S.unrecognized_keys,keys:a}),r.dirty());else if(u!==\"strip\")throw new Error(\"Internal ZodObject error: invalid unknownKeys value.\")}else{let u=this._def.catchall;for(let l of a){let p=i.data[l];c.push({key:{status:\"valid\",value:l},value:u._parse(new Ot(i,p,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let p=await l.key,f=await l.value;u.push({key:p,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Le.mergeObjectSync(r,u)):Le.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return L.errToObj,new n({...this._def,unknownKeys:\"strict\",...e!==void 0?{errorMap:(t,r)=>{let i=this._def.errorMap?.(t,r).message??r.defaultError;return t.code===\"unrecognized_keys\"?{message:L.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new n({...this._def,unknownKeys:\"strip\"})}passthrough(){return new n({...this._def,unknownKeys:\"passthrough\"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:T.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};for(let r of ce.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}omit(e){let t={};for(let r of ce.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return Li(this)}partial(e){let t={};for(let r of ce.objectKeys(this.shape)){let i=this.shape[r];e&&!e[r]?t[r]=i:t[r]=i.optional()}return new n({...this._def,shape:()=>t})}required(e){let t={};for(let r of ce.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Rt;)o=o._def.innerType;t[r]=o}return new n({...this._def,shape:()=>t})}keyof(){return ef(ce.objectKeys(this.shape))}};ft.create=(n,e)=>new ft({shape:()=>n,unknownKeys:\"strip\",catchall:zt.create(),typeName:T.ZodObject,...Q(e)});ft.strictCreate=(n,e)=>new ft({shape:()=>n,unknownKeys:\"strict\",catchall:zt.create(),typeName:T.ZodObject,...Q(e)});ft.lazycreate=(n,e)=>new ft({shape:n,unknownKeys:\"strip\",catchall:zt.create(),typeName:T.ZodObject,...Q(e)});var Pr=class extends te{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function i(o){for(let a of o)if(a.result.status===\"valid\")return a.result;for(let a of o)if(a.result.status===\"dirty\")return t.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new dt(a.ctx.common.issues));return I(t,{code:S.invalid_union,unionErrors:s}),z}if(t.common.async)return Promise.all(r.map(async o=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of r){let u={...t,common:{...t.common,issues:[]},parent:null},l=c._parseSync({data:t.data,path:t.path,parent:u});if(l.status===\"valid\")return l;l.status===\"dirty\"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new dt(c));return I(t,{code:S.invalid_union,unionErrors:a}),z}}get options(){return this._def.options}};Pr.create=(n,e)=>new Pr({options:n,typeName:T.ZodUnion,...Q(e)});var Cn=n=>n instanceof Br?Cn(n.schema):n instanceof Nt?Cn(n.innerType()):n instanceof Vr?[n.value]:n instanceof Ur?n.options:n instanceof zr?ce.objectValues(n.enum):n instanceof qr?Cn(n._def.innerType):n instanceof Mr?[void 0]:n instanceof jr?[null]:n instanceof Rt?[void 0,...Cn(n.unwrap())]:n instanceof an?[null,...Cn(n.unwrap())]:n instanceof Mo||n instanceof Wr?Cn(n.unwrap()):n instanceof Zr?Cn(n._def.innerType):[],Ks=class n extends te{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.object)return I(t,{code:S.invalid_type,expected:O.object,received:t.parsedType}),z;let r=this.discriminator,i=t.data[r],o=this.optionsMap.get(i);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(I(t,{code:S.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let i=new Map;for(let o of t){let s=Cn(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \\`${e}\\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new n({typeName:T.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...Q(r)})}};function eu(n,e){let t=on(n),r=on(e);if(n===e)return{valid:!0,data:n};if(t===O.object&&r===O.object){let i=ce.objectKeys(e),o=ce.objectKeys(n).filter(a=>i.indexOf(a)!==-1),s={...n,...e};for(let a of o){let c=eu(n[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(t===O.array&&r===O.array){if(n.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<n.length;o++){let s=n[o],a=e[o],c=eu(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return t===O.date&&r===O.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Lr=class extends te{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(o,s)=>{if(Hs(o)||Hs(s))return z;let a=eu(o.value,s.value);return a.valid?((Gs(o)||Gs(s))&&t.dirty(),{status:t.value,value:a.data}):(I(r,{code:S.invalid_intersection_types}),z)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Lr.create=(n,e,t)=>new Lr({left:n,right:e,typeName:T.ZodIntersection,...Q(t)});var sn=class n extends te{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.array)return I(r,{code:S.invalid_type,expected:O.array,received:r.parsedType}),z;if(r.data.length<this._def.items.length)return I(r,{code:S.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:\"array\"}),z;!this._def.rest&&r.data.length>this._def.items.length&&(I(r,{code:S.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:\"array\"}),t.dirty());let o=[...r.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Ot(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>Le.mergeArray(t,s)):Le.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};sn.create=(n,e)=>{if(!Array.isArray(n))throw new Error(\"You must pass an array of schemas to z.tuple([ ... ])\");return new sn({items:n,typeName:T.ZodTuple,rest:null,...Q(e)})};var Js=class n extends te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.object)return I(r,{code:S.invalid_type,expected:O.object,received:r.parsedType}),z;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in r.data)i.push({key:o._parse(new Ot(r,a,r.path,a)),value:s._parse(new Ot(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Le.mergeObjectAsync(t,i):Le.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof te?new n({keyType:e,valueType:t,typeName:T.ZodRecord,...Q(r)}):new n({keyType:Gn.create(),valueType:e,typeName:T.ZodRecord,...Q(t)})}},Ui=class extends te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.map)return I(r,{code:S.invalid_type,expected:O.map,received:r.parsedType}),z;let i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([a,c],u)=>({key:i._parse(new Ot(r,a,r.path,[u,\"key\"])),value:o._parse(new Ot(r,c,r.path,[u,\"value\"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status===\"aborted\"||l.status===\"aborted\")return z;(u.status===\"dirty\"||l.status===\"dirty\")&&t.dirty(),a.set(u.value,l.value)}return{status:t.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status===\"aborted\"||l.status===\"aborted\")return z;(u.status===\"dirty\"||l.status===\"dirty\")&&t.dirty(),a.set(u.value,l.value)}return{status:t.value,value:a}}}};Ui.create=(n,e,t)=>new Ui({valueType:e,keyType:n,typeName:T.ZodMap,...Q(t)});var zi=class n extends te{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==O.set)return I(r,{code:S.invalid_type,expected:O.set,received:r.parsedType}),z;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(I(r,{code:S.too_small,minimum:i.minSize.value,type:\"set\",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(I(r,{code:S.too_big,maximum:i.maxSize.value,type:\"set\",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status===\"aborted\")return z;l.status===\"dirty\"&&t.dirty(),u.add(l.value)}return{status:t.value,value:u}}let a=[...r.data.values()].map((c,u)=>o._parse(new Ot(r,c,r.path,u)));return r.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,t){return new n({...this._def,minSize:{value:e,message:L.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:L.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};zi.create=(n,e)=>new zi({valueType:n,minSize:null,maxSize:null,typeName:T.ZodSet,...Q(e)});var Ys=class n extends te{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.function)return I(t,{code:S.invalid_type,expected:O.function,received:t.parsedType}),z;function r(a,c){return No({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ji(),An].filter(u=>!!u),issueData:{code:S.invalid_arguments,argumentsError:c}})}function i(a,c){return No({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ji(),An].filter(u=>!!u),issueData:{code:S.invalid_return_type,returnTypeError:c}})}let o={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Jn){let a=this;return Ge(async function(...c){let u=new dt([]),l=await a._def.args.parseAsync(c,o).catch(m=>{throw u.addIssue(r(c,m)),u}),p=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(p,o).catch(m=>{throw u.addIssue(i(p,m)),u})})}else{let a=this;return Ge(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new dt([r(c,u.error)]);let l=Reflect.apply(s,this,u.data),p=a._def.returns.safeParse(l,o);if(!p.success)throw new dt([i(l,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:sn.create(e).rest(Dn.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||sn.create([]).rest(Dn.create()),returns:t||Dn.create(),typeName:T.ZodFunction,...Q(r)})}},Br=class extends te{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Br.create=(n,e)=>new Br({getter:n,typeName:T.ZodLazy,...Q(e)});var Vr=class extends te{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return I(t,{received:t.data,code:S.invalid_literal,expected:this._def.value}),z}return{status:\"valid\",value:e.data}}get value(){return this._def.value}};Vr.create=(n,e)=>new Vr({value:n,typeName:T.ZodLiteral,...Q(e)});function ef(n,e){return new Ur({values:n,typeName:T.ZodEnum,...Q(e)})}var Ur=class n extends te{_parse(e){if(typeof e.data!=\"string\"){let t=this._getOrReturnCtx(e),r=this._def.values;return I(t,{expected:ce.joinValues(r),received:t.parsedType,code:S.invalid_type}),z}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return I(t,{received:t.data,code:S.invalid_enum_value,options:r}),z}return Ge(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return n.create(e,{...this._def,...t})}exclude(e,t=this._def){return n.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};Ur.create=ef;var zr=class extends te{_parse(e){let t=ce.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==O.string&&r.parsedType!==O.number){let i=ce.objectValues(t);return I(r,{expected:ce.joinValues(i),received:r.parsedType,code:S.invalid_type}),z}if(this._cache||(this._cache=new Set(ce.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ce.objectValues(t);return I(r,{received:r.data,code:S.invalid_enum_value,options:i}),z}return Ge(e.data)}get enum(){return this._def.values}};zr.create=(n,e)=>new zr({values:n,typeName:T.ZodNativeEnum,...Q(e)});var Jn=class extends te{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.promise&&t.common.async===!1)return I(t,{code:S.invalid_type,expected:O.promise,received:t.parsedType}),z;let r=t.parsedType===O.promise?t.data:Promise.resolve(t.data);return Ge(r.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Jn.create=(n,e)=>new Jn({type:n,typeName:T.ZodPromise,...Q(e)});var Nt=class extends te{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===T.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{I(r,s),s.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type===\"preprocess\"){let s=i.transform(r.data,o);if(r.common.async)return Promise.resolve(s).then(async a=>{if(t.value===\"aborted\")return z;let c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status===\"aborted\"?z:c.status===\"dirty\"?Ir(c.value):t.value===\"dirty\"?Ir(c.value):c});{if(t.value===\"aborted\")return z;let a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status===\"aborted\"?z:a.status===\"dirty\"?Ir(a.value):t.value===\"dirty\"?Ir(a.value):a}}if(i.type===\"refinement\"){let s=a=>{let c=i.refinement(a,o);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error(\"Async refinement encountered during synchronous parse operation. Use .parseAsync instead.\");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status===\"aborted\"?z:(a.status===\"dirty\"&&t.dirty(),s(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status===\"aborted\"?z:(a.status===\"dirty\"&&t.dirty(),s(a.value).then(()=>({status:t.value,value:a.value}))))}if(i.type===\"transform\")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Hn(s))return z;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error(\"Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.\");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Hn(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:t.value,value:a})):z);ce.assertNever(i)}};Nt.create=(n,e,t)=>new Nt({schema:n,typeName:T.ZodEffects,effect:e,...Q(t)});Nt.createWithPreprocess=(n,e,t)=>new Nt({schema:e,effect:{type:\"preprocess\",transform:n},typeName:T.ZodEffects,...Q(t)});var Rt=class extends te{_parse(e){return this._getType(e)===O.undefined?Ge(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Rt.create=(n,e)=>new Rt({innerType:n,typeName:T.ZodOptional,...Q(e)});var an=class extends te{_parse(e){return this._getType(e)===O.null?Ge(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};an.create=(n,e)=>new an({innerType:n,typeName:T.ZodNullable,...Q(e)});var qr=class extends te{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===O.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};qr.create=(n,e)=>new qr({innerType:n,typeName:T.ZodDefault,defaultValue:typeof e.default==\"function\"?e.default:()=>e.default,...Q(e)});var Zr=class extends te{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Pi(i)?i.then(o=>({status:\"valid\",value:o.status===\"valid\"?o.value:this._def.catchValue({get error(){return new dt(r.common.issues)},input:r.data})})):{status:\"valid\",value:i.status===\"valid\"?i.value:this._def.catchValue({get error(){return new dt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Zr.create=(n,e)=>new Zr({innerType:n,typeName:T.ZodCatch,catchValue:typeof e.catch==\"function\"?e.catch:()=>e.catch,...Q(e)});var qi=class extends te{_parse(e){if(this._getType(e)!==O.nan){let r=this._getOrReturnCtx(e);return I(r,{code:S.invalid_type,expected:O.nan,received:r.parsedType}),z}return{status:\"valid\",value:e.data}}};qi.create=n=>new qi({typeName:T.ZodNaN,...Q(n)});var Kv=Symbol(\"zod_brand\"),Mo=class extends te{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},jo=class n extends te{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status===\"aborted\"?z:o.status===\"dirty\"?(t.dirty(),Ir(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status===\"aborted\"?z:i.status===\"dirty\"?(t.dirty(),{status:\"dirty\",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:T.ZodPipeline})}},Wr=class extends te{_parse(e){let t=this._def.innerType._parse(e),r=i=>(Hn(i)&&(i.value=Object.freeze(i.value)),i);return Pi(t)?t.then(i=>r(i)):r(t)}unwrap(){return this._def.innerType}};Wr.create=(n,e)=>new Wr({innerType:n,typeName:T.ZodReadonly,...Q(e)});function Jd(n,e){let t=typeof n==\"function\"?n(e):typeof n==\"string\"?{message:n}:n;return typeof t==\"string\"?{message:t}:t}function tf(n,e={},t){return n?Kn.create().superRefine((r,i)=>{let o=n(r);if(o instanceof Promise)return o.then(s=>{if(!s){let a=Jd(e,r),c=a.fatal??t??!0;i.addIssue({code:\"custom\",...a,fatal:c})}});if(!o){let s=Jd(e,r),a=s.fatal??t??!0;i.addIssue({code:\"custom\",...s,fatal:a})}}):Kn.create()}var Jv={object:ft.lazycreate},T;(function(n){n.ZodString=\"ZodString\",n.ZodNumber=\"ZodNumber\",n.ZodNaN=\"ZodNaN\",n.ZodBigInt=\"ZodBigInt\",n.ZodBoolean=\"ZodBoolean\",n.ZodDate=\"ZodDate\",n.ZodSymbol=\"ZodSymbol\",n.ZodUndefined=\"ZodUndefined\",n.ZodNull=\"ZodNull\",n.ZodAny=\"ZodAny\",n.ZodUnknown=\"ZodUnknown\",n.ZodNever=\"ZodNever\",n.ZodVoid=\"ZodVoid\",n.ZodArray=\"ZodArray\",n.ZodObject=\"ZodObject\",n.ZodUnion=\"ZodUnion\",n.ZodDiscriminatedUnion=\"ZodDiscriminatedUnion\",n.ZodIntersection=\"ZodIntersection\",n.ZodTuple=\"ZodTuple\",n.ZodRecord=\"ZodRecord\",n.ZodMap=\"ZodMap\",n.ZodSet=\"ZodSet\",n.ZodFunction=\"ZodFunction\",n.ZodLazy=\"ZodLazy\",n.ZodLiteral=\"ZodLiteral\",n.ZodEnum=\"ZodEnum\",n.ZodEffects=\"ZodEffects\",n.ZodNativeEnum=\"ZodNativeEnum\",n.ZodOptional=\"ZodOptional\",n.ZodNullable=\"ZodNullable\",n.ZodDefault=\"ZodDefault\",n.ZodCatch=\"ZodCatch\",n.ZodPromise=\"ZodPromise\",n.ZodBranded=\"ZodBranded\",n.ZodPipeline=\"ZodPipeline\",n.ZodReadonly=\"ZodReadonly\"})(T||(T={}));var Yv=(n,e={message:`Input not instance of ${n.name}`})=>tf(t=>t instanceof n,e),nf=Gn.create,rf=Fr.create,Xv=qi.create,Qv=Rr.create,of=Or.create,e0=Nr.create,t0=Bi.create,n0=Mr.create,r0=jr.create,i0=Kn.create,o0=Dn.create,s0=zt.create,a0=Vi.create,c0=wn.create,u0=ft.create,l0=ft.strictCreate,d0=Pr.create,f0=Ks.create,p0=Lr.create,h0=sn.create,m0=Js.create,g0=Ui.create,y0=zi.create,b0=Ys.create,v0=Br.create,_0=Vr.create,x0=Ur.create,A0=zr.create,C0=Jn.create,D0=Nt.create,w0=Rt.create,E0=an.create,S0=Nt.createWithPreprocess,T0=jo.create,k0=()=>nf().optional(),$0=()=>rf().optional(),I0=()=>of().optional(),F0={string:(n=>Gn.create({...n,coerce:!0})),number:(n=>Fr.create({...n,coerce:!0})),boolean:(n=>Or.create({...n,coerce:!0})),bigint:(n=>Rr.create({...n,coerce:!0})),date:(n=>Nr.create({...n,coerce:!0}))};var R0=z;var Yn=class extends Error{constructor(e,t=\"UNKNOWN_ERROR\"){super(e),this.name=this.constructor.name,this.code=t,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},U=class extends Yn{constructor(e,t,r=\"VALIDATION_ERROR\"){super(e,r),this.details=t}},nt=class extends Yn{constructor(e,t){super(e,\"DATA_ERROR\"),this.path=t}},de=class extends Yn{constructor(e,t,r){super(e,\"EXPRESSION_ERROR\"),this.expression=t,this.details=r}},Xn=class extends Yn{constructor(e){super(e,\"STATE_ERROR\")}},Fe=class extends Yn{constructor(e,t=\"CATALOG_ERROR\"){super(e,t)}},qt=class extends U{constructor(e,t,r=\"INTEGRITY_ERROR\"){super(e,t,r),this.name=\"A2uiIntegrityError\"}},cn=class extends U{constructor(e,t,r=\"RECURSION_ERROR\"){super(e,t,r),this.name=\"A2uiRecursionError\"}},we;(function(n){n.INVALID_FUNCTION_CALL=\"INVALID_FUNCTION_CALL\",n.EXECUTION_ERROR=\"EXECUTION_ERROR\",n.UNKNOWN_FUNCTION=\"UNKNOWN_FUNCTION\",n.UNKNOWN_ERROR=\"UNKNOWN_ERROR\",n.TIMEOUT=\"TIMEOUT\",n.CANCELLED=\"CANCELLED\",n.DISPOSED=\"DISPOSED\",n.DUPLICATE=\"DUPLICATE\",n.NO_LISTENER=\"NO_LISTENER\"})(we||(we={}));var Zt=class extends Yn{constructor(e,t=we.UNKNOWN_ERROR,r,i){let o=t||we.UNKNOWN_ERROR;super(`[${o}] ${e}`,o),this.functionCallId=r,this.details=i,this.name=\"A2uiRpcError\"}};var O0=/^[vV]?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:\\.(0|[1-9]\\d*))?(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/;function En(n){if(!n||typeof n!=\"string\")return\"\";let e=n.trim().replace(/^[vV]/,\"\"),t=e.indexOf(\"-\"),r=e.indexOf(\"+\"),i=e.length;return t!==-1&&r!==-1?i=Math.min(t,r):t!==-1?i=t:r!==-1&&(i=r),`${e.slice(0,i).replace(/_/g,\".\")}${e.slice(i)}`}function N0(n){if(!n||typeof n!=\"string\")return null;let e=n.trim().match(O0);return e?{major:parseInt(e[1],10),minor:parseInt(e[2],10),patch:e[3]!==void 0?parseInt(e[3],10):0,prerelease:e[4]?e[4].split(\".\"):[],build:e[5]?e[5].split(\".\"):[]}:null}function Qn(n){if(!n)return null;if(typeof n==\"object\"){let e=n;return typeof e.major!=\"number\"||!Number.isInteger(e.major)||e.major<0||typeof e.minor==\"number\"&&(!Number.isInteger(e.minor)||e.minor<0)||typeof e.patch==\"number\"&&(!Number.isInteger(e.patch)||e.patch<0)?null:{major:e.major,minor:typeof e.minor==\"number\"?e.minor:0,patch:typeof e.patch==\"number\"?e.patch:0,prerelease:Array.isArray(e.prerelease)?e.prerelease:[],build:Array.isArray(e.build)?e.build:[]}}return N0(En(n))}function ke(n){if(!n)return null;let e=Qn(n);if(!e)return null;if(e.patch===0&&e.prerelease.length===0&&e.build.length===0)return`${e.major}.${e.minor}`;let t=e.prerelease.length>0?`-${e.prerelease.join(\".\")}`:\"\",r=e.build.length>0?`+${e.build.join(\".\")}`:\"\";return`${e.major}.${e.minor}.${e.patch}${t}${r}`}function M0(n,e){let t=/^\\d+$/.test(n),r=/^\\d+$/.test(e);return t&&r?n.length!==e.length?n.length-e.length:n<e?-1:n>e?1:0:t?-1:r?1:n<e?-1:n>e?1:0}function j0(n,e){if(n.length===0&&e.length===0)return 0;if(n.length===0)return 1;if(e.length===0)return-1;let t=Math.min(n.length,e.length);for(let r=0;r<t;r++){let i=M0(n[r],e[r]);if(i!==0)return i}return n.length-e.length}function tu(n,e){let t=Qn(n),r=Qn(e);return!t&&!r?0:t?r?t.major!==r.major?t.major-r.major:t.minor!==r.minor?t.minor-r.minor:t.patch!==r.patch?t.patch-r.patch:j0(t.prerelease,r.prerelease):1:-1}function ge(n,e){if(!n)return!1;let t=Qn(n),r=Qn(e);return!t||!r?!1:tu(t,r)>=0}var Hr;(function(n){n.V0_8=\"v0.8\",n.V0_9=\"v0.9\",n.V0_9_1=\"v0.9.1\",n.V1_0=\"v1.0\"})(Hr||(Hr={}));function Sn(n,e){return n._def.a2uiChildRef=e,n}function er(n){return n?._def?.a2uiChildRef}var Tn=Sn(d.string().describe(\"REF:common_types.json#/$defs/ComponentId|The unique identifier for a component, used for both definitions and references within the same surface.\"),\"component-id\"),kn=d.object({path:d.string().describe(\"A JSON Pointer path to a value in the data model.\").optional(),\"@path\":d.string().describe(\"A JSON Pointer path to a value in the data model.\").optional()}).refine(n=>n[\"@path\"]!==void 0||n.path!==void 0,{message:\"Either '@path' or 'path' must be provided.\"}).describe(\"REF:common_types.json#/$defs/DataBinding\"),Wt=d.object({call:d.string().describe(\"The name of the function to call.\").optional(),\"@call\":d.string().describe(\"The name of the function to call.\").optional(),args:d.record(d.string(),d.unknown()).describe(\"Arguments passed to the function.\").optional(),returnType:d.enum([\"string\",\"number\",\"boolean\",\"array\",\"object\",\"any\",\"void\"]).describe(\"The expected return type of the function call.\").optional(),catalogId:d.string().describe(\"The catalog ID for this function, overriding any surface-level default catalogId.\").optional()}).refine(n=>n[\"@call\"]!==void 0||n.call!==void 0,{message:\"Either '@call' or 'call' must be provided.\"}).describe(\"REF:common_types.json#/$defs/FunctionCall|Invokes a named function, combining common function properties with the catalog function definition.\"),Zi=d.union([d.string(),kn,Wt]).describe(\"REF:common_types.json#/$defs/DynamicString|Represents a string\"),Po=d.union([d.boolean(),kn,Wt]).describe(\"REF:common_types.json#/$defs/DynamicBoolean|A boolean value that can be a literal, a path, or a function call returning a boolean or a validation result object (coerced to its \\\\'valid\\\\' boolean).\"),tr=d.object({label:Zi.optional(),description:Zi.optional(),live:d.enum([\"off\",\"polite\",\"assertive\"]).default(\"off\").describe(\"Controls screen reader announcements for dynamic updates (WAI-ARIA aria-live). 'polite' waits for user pause; 'assertive' interrupts immediately for alerts.\").optional(),hidden:Po.optional()}).describe(\"REF:common_types.json#/$defs/AccessibilityAttributes|Attributes to enhance accessibility when using assistive technologies like screen readers or model understanding.\"),sf=d.record(d.string(),d.unknown()).superRefine((n,e)=>{for(let t in n)t.match(/^[\\p{XID_Start}_][\\p{XID_Continue}]*$/u)||e.addIssue({path:[t],code:d.ZodIssueCode.custom,message:`Invalid extension key \"${t}\": Keys MUST be Unicode identifiers (UAX #31).`})}).describe(\"REF:#/$defs/Extensions|Optional extension metadata. Keys MUST be Unicode identifiers (UAX #31). Keys starting with 'a2ui_' are reserved for official extensions.\"),Lo=d.object({id:Tn,accessibility:tr.optional(),catalogId:d.string().describe(\"The catalog ID for this component, overriding any surface-level default catalogId.\").optional(),metadata:d.object({extensions:sf.optional()}).strict().describe(\"Optional component-level metadata for vendor extensions.\").optional()}).describe(\"REF:common_types.json#/$defs/ComponentCommon\"),Xs=Sn(d.union([d.array(Tn).describe(\"A static list of child component IDs.\"),d.object({componentId:Tn,path:d.string().describe(\"The path to the list of component property objects in the data model.\")}).describe(\"A template for generating a dynamic list of children.\")]).describe(\"REF:common_types.json#/$defs/ChildList\"),\"child-list\"),nu=d.union([d.string(),d.number(),d.boolean(),d.array(d.unknown()),kn,Wt,d.record(d.string(),d.unknown()).refine(n=>!n||!(\"@path\"in n)&&!(\"path\"in n)&&!(\"@call\"in n)&&!(\"call\"in n))]).describe(\"REF:common_types.json#/$defs/DynamicValue|A value that can be a literal, a path, or a function call returning any type.\"),Qs=d.union([d.number(),kn,Wt]).describe(\"REF:common_types.json#/$defs/DynamicNumber|Represents a value that can be either a literal number, a path to a number in the data model, or a function call returning a number.\"),ru=d.union([d.array(d.string()),kn,Wt]).describe(\"REF:common_types.json#/$defs/DynamicStringList|Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array.\"),ea=d.object({condition:d.union([Po,kn,Wt]).describe(\"Path or function call evaluating to a structured validation result object or a boolean.\"),message:d.string().describe(\"Optional fallback error message.\").optional()}).describe(\"REF:common_types.json#/$defs/CheckRule|A single validation check rule applied to an input component. The condition function or path evaluates to a structured validation result object or a boolean (which is coerced to a validation result object).\"),iu=d.object({checks:d.array(ea).describe(\"A list of validation check rules to perform on the component.\").optional()}).describe(\"REF:common_types.json#/$defs/Checkable|Properties for components that support renderer-side checks.\"),ou=d.union([d.object({event:d.object({name:d.string().describe(\"The name of the action to be dispatched to the server.\"),context:d.record(d.string(),d.unknown()).describe(\"A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.\").optional()}).strict().describe(\"The event to dispatch to the server.\")}).strict().describe(\"Triggers a server-side event.\"),d.object({functionCall:Wt}).strict().describe(\"Executes a local client-side function.\"),d.object({event:d.object({name:d.string().describe(\"The name of the action to be dispatched to the agent.\"),userMessage:Zi.optional(),context:d.record(d.string(),d.unknown()).describe(\"A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.\").optional()}).strict().describe(\"The event to dispatch to the agent.\")}).strict().describe(\"Triggers an agent-side event.\"),d.object({functionCall:Wt}).strict().describe(\"Executes a renderer or agent-side function.\")]).describe(\"REF:common_types.json#/$defs/Action|Defines an interaction handler that can either trigger an agent-side event or execute a local renderer-side function.\"),af=d.string().describe(\"REF:common_types.json#/$defs/CallId|The unique identifier for a function call.\"),su=Tn,P0=d.object({call:d.string().describe(\"The name of the function to call.\").optional(),\"@call\":d.string().describe(\"The name of the function to call.\").optional(),catalogId:d.string().describe(\"The catalog ID for this function, overriding any surface-level default catalogId.\").optional()}).refine(n=>n[\"@call\"]!==void 0||n.call!==void 0,{message:\"Either '@call' or 'call' must be provided.\"}).describe(\"REF:common_types.json#/$defs/FunctionCommon|Baseline envelope properties common to all function calls. Function-specific argument schemas ('args') are defined individually by each function in the active catalog.\"),L0=d.object({call:d.literal(\"@index\").optional(),\"@call\":d.literal(\"@index\").optional(),args:d.object({offset:Qs.optional()}).optional()}).refine(n=>n[\"@call\"]!==void 0||n.call!==void 0,{message:\"Either '@call' or 'call' must be '@index'.\"}).describe(\"REF:common_types.json#/$defs/IndexSystemFunction|Returns the 0-based index of the current item when rendering a dynamic list from a template. This function MUST ONLY be available when evaluating template items within a list context.\"),B0=d.object({component:d.literal(\"Surface\").optional(),child:d.literal(\"root\").optional()}).strict().describe(\"REF:common_types.json#/$defs/Surface|The reserved canonical container component representing an A2UI surface. The Surface component is immutable and always has \\\\'child\\\\': \\\\'root\\\\'.\"),V0=d.object({functionCallId:af,value:d.unknown().describe(\"The return value of the function.\").optional(),error:d.object({code:d.string(),message:d.string()}).strict().describe(\"An error object indicating failure of the function execution.\").optional()}).strict().describe(\"REF:common_types.json#/$defs/FunctionResponse|The return response matching a callAgentFunction or callRendererFunction invocation.\"),cf={ComponentId:Tn,DataBinding:kn,FunctionCall:Wt,DynamicString:Zi,DynamicBoolean:Po,AccessibilityAttributes:tr,Extensions:sf,ComponentCommon:Lo,ChildList:Xs,DynamicValue:nu,DynamicNumber:Qs,DynamicStringList:ru,CheckRule:ea,Checkable:iu,Action:ou,CallId:af,Child:su,FunctionCommon:P0,IndexSystemFunction:L0,Surface:B0,FunctionResponse:V0};var Bo=new WeakMap;function Uo(n){return Bo.get(n)}function df(n,e){for(let[t,r]of Object.entries(e)){let i=!1,o;Object.defineProperty(n,t,{enumerable:!0,get(){return i||(o=r(),i=!0),o}})}}function uf(n){return typeof n==\"object\"&&n!==null&&!Array.isArray(n)}function lf(n){return Array.isArray(n)?n.filter(e=>typeof e==\"string\"):void 0}var ta=class{constructor(e,t,r){this.name=e,Bo.set(this,t),df(this,{schema:()=>r(t),allowedParents:()=>lf(t.allowedParents),allowedChildren:()=>lf(t.allowedChildren)}),Object.freeze(this)}get jsonSchema(){return Bo.get(this)}},Vo=class{constructor(e,t,r){this.name=e,Bo.set(this,t);let i=uf(t.properties)?t.properties:void 0,o=s=>{let a=i?.[s];return uf(a)?a.const:void 0};df(this,{schema:()=>r(t),returnType:()=>{let s=t.returnType??o(\"returnType\");return typeof s==\"string\"?s:\"any\"},description:()=>typeof t.description==\"string\"?t.description:void 0,allowedCallers:()=>t.allowedCallers??o(\"allowedCallers\"),requiresUserActivation:()=>t.requiresUserActivation??o(\"requiresUserActivation\")}),Object.freeze(this)}get jsonSchema(){return Bo.get(this)}};var pf=Symbol(\"Let zodToJsonSchema decide on which parser to use\");var ff={name:void 0,$refStrategy:\"root\",basePath:[\"#\"],effectStrategy:\"input\",pipeStrategy:\"all\",dateStrategy:\"format:date-time\",mapStrategy:\"entries\",removeAdditionalStrategy:\"passthrough\",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:\"definitions\",target:\"jsonSchema7\",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:\"escape\",applyRegexFlags:!1,emailStrategy:\"format:email\",base64Strategy:\"contentEncoding:base64\",nameStrategy:\"ref\",openAiAnyTypeName:\"OpenAiAnyType\"},hf=n=>typeof n==\"string\"?{...ff,name:n}:{...ff,...n};var mf=n=>{let e=hf(n),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}};function au(n,e,t,r){r?.errorMessages&&t&&(n.errorMessage={...n.errorMessage,[e]:t})}function le(n,e,t,r,i){n[e]=t,au(n,e,r,i)}var na=(n,e)=>{let t=0;for(;t<n.length&&t<e.length&&n[t]===e[t];t++);return[(n.length-t).toString(),...e.slice(t)].join(\"/\")};function ve(n){if(n.target!==\"openAi\")return{};let e=[...n.basePath,n.definitionPath,n.openAiAnyTypeName];return n.flags.hasReferencedOpenAiAnyType=!0,{$ref:n.$refStrategy===\"relative\"?na(e,n.currentPath):e.join(\"/\")}}function gf(n,e){let t={type:\"array\"};return n.type?._def&&n.type?._def?.typeName!==T.ZodAny&&(t.items=W(n.type._def,{...e,currentPath:[...e.currentPath,\"items\"]})),n.minLength&&le(t,\"minItems\",n.minLength.value,n.minLength.message,e),n.maxLength&&le(t,\"maxItems\",n.maxLength.value,n.maxLength.message,e),n.exactLength&&(le(t,\"minItems\",n.exactLength.value,n.exactLength.message,e),le(t,\"maxItems\",n.exactLength.value,n.exactLength.message,e)),t}function yf(n,e){let t={type:\"integer\",format:\"int64\"};if(!n.checks)return t;for(let r of n.checks)switch(r.kind){case\"min\":e.target===\"jsonSchema7\"?r.inclusive?le(t,\"minimum\",r.value,r.message,e):le(t,\"exclusiveMinimum\",r.value,r.message,e):(r.inclusive||(t.exclusiveMinimum=!0),le(t,\"minimum\",r.value,r.message,e));break;case\"max\":e.target===\"jsonSchema7\"?r.inclusive?le(t,\"maximum\",r.value,r.message,e):le(t,\"exclusiveMaximum\",r.value,r.message,e):(r.inclusive||(t.exclusiveMaximum=!0),le(t,\"maximum\",r.value,r.message,e));break;case\"multipleOf\":le(t,\"multipleOf\",r.value,r.message,e);break}return t}function bf(){return{type:\"boolean\"}}function ra(n,e){return W(n.type._def,e)}var vf=(n,e)=>W(n.innerType._def,e);function cu(n,e,t){let r=t??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((i,o)=>cu(n,e,i))};switch(r){case\"string\":case\"format:date-time\":return{type:\"string\",format:\"date-time\"};case\"format:date\":return{type:\"string\",format:\"date\"};case\"integer\":return U0(n,e)}}var U0=(n,e)=>{let t={type:\"integer\",format:\"unix-time\"};if(e.target===\"openApi3\")return t;for(let r of n.checks)switch(r.kind){case\"min\":le(t,\"minimum\",r.value,r.message,e);break;case\"max\":le(t,\"maximum\",r.value,r.message,e);break}return t};function _f(n,e){return{...W(n.innerType._def,e),default:n.defaultValue()}}function xf(n,e){return e.effectStrategy===\"input\"?W(n.schema._def,e):ve(e)}function Af(n){return{type:\"string\",enum:Array.from(n.values)}}var z0=n=>\"type\"in n&&n.type===\"string\"?!1:\"allOf\"in n;function Cf(n,e){let t=[W(n.left._def,{...e,currentPath:[...e.currentPath,\"allOf\",\"0\"]}),W(n.right._def,{...e,currentPath:[...e.currentPath,\"allOf\",\"1\"]})].filter(o=>!!o),r=e.target===\"jsonSchema2019-09\"?{unevaluatedProperties:!1}:void 0,i=[];return t.forEach(o=>{if(z0(o))i.push(...o.allOf),o.unevaluatedProperties===void 0&&(r=void 0);else{let s=o;if(\"additionalProperties\"in o&&o.additionalProperties===!1){let{additionalProperties:a,...c}=o;s=c}else r=void 0;i.push(s)}}),i.length?{allOf:i,...r}:void 0}function Df(n,e){let t=typeof n.value;return t!==\"bigint\"&&t!==\"number\"&&t!==\"boolean\"&&t!==\"string\"?{type:Array.isArray(n.value)?\"array\":\"object\"}:e.target===\"openApi3\"?{type:t===\"bigint\"?\"integer\":t,enum:[n.value]}:{type:t===\"bigint\"?\"integer\":t,const:n.value}}var uu,Ht={cuid:/^[cC][^\\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_'+\\-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$/,emoji:()=>(uu===void 0&&(uu=RegExp(\"^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$\",\"u\")),uu),uuid:/^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/};function ia(n,e){let t={type:\"string\"};if(n.checks)for(let r of n.checks)switch(r.kind){case\"min\":le(t,\"minLength\",typeof t.minLength==\"number\"?Math.max(t.minLength,r.value):r.value,r.message,e);break;case\"max\":le(t,\"maxLength\",typeof t.maxLength==\"number\"?Math.min(t.maxLength,r.value):r.value,r.message,e);break;case\"email\":switch(e.emailStrategy){case\"format:email\":Gt(t,\"email\",r.message,e);break;case\"format:idn-email\":Gt(t,\"idn-email\",r.message,e);break;case\"pattern:zod\":rt(t,Ht.email,r.message,e);break}break;case\"url\":Gt(t,\"uri\",r.message,e);break;case\"uuid\":Gt(t,\"uuid\",r.message,e);break;case\"regex\":rt(t,r.regex,r.message,e);break;case\"cuid\":rt(t,Ht.cuid,r.message,e);break;case\"cuid2\":rt(t,Ht.cuid2,r.message,e);break;case\"startsWith\":rt(t,RegExp(`^${lu(r.value,e)}`),r.message,e);break;case\"endsWith\":rt(t,RegExp(`${lu(r.value,e)}$`),r.message,e);break;case\"datetime\":Gt(t,\"date-time\",r.message,e);break;case\"date\":Gt(t,\"date\",r.message,e);break;case\"time\":Gt(t,\"time\",r.message,e);break;case\"duration\":Gt(t,\"duration\",r.message,e);break;case\"length\":le(t,\"minLength\",typeof t.minLength==\"number\"?Math.max(t.minLength,r.value):r.value,r.message,e),le(t,\"maxLength\",typeof t.maxLength==\"number\"?Math.min(t.maxLength,r.value):r.value,r.message,e);break;case\"includes\":{rt(t,RegExp(lu(r.value,e)),r.message,e);break}case\"ip\":{r.version!==\"v6\"&&Gt(t,\"ipv4\",r.message,e),r.version!==\"v4\"&&Gt(t,\"ipv6\",r.message,e);break}case\"base64url\":rt(t,Ht.base64url,r.message,e);break;case\"jwt\":rt(t,Ht.jwt,r.message,e);break;case\"cidr\":{r.version!==\"v6\"&&rt(t,Ht.ipv4Cidr,r.message,e),r.version!==\"v4\"&&rt(t,Ht.ipv6Cidr,r.message,e);break}case\"emoji\":rt(t,Ht.emoji(),r.message,e);break;case\"ulid\":{rt(t,Ht.ulid,r.message,e);break}case\"base64\":{switch(e.base64Strategy){case\"format:binary\":{Gt(t,\"binary\",r.message,e);break}case\"contentEncoding:base64\":{le(t,\"contentEncoding\",\"base64\",r.message,e);break}case\"pattern:zod\":{rt(t,Ht.base64,r.message,e);break}}break}case\"nanoid\":rt(t,Ht.nanoid,r.message,e);case\"toLowerCase\":case\"toUpperCase\":case\"trim\":break;default:}return t}function lu(n,e){return e.patternStrategy===\"escape\"?Z0(n):n}var q0=new Set(\"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789\");function Z0(n){let e=\"\";for(let t=0;t<n.length;t++)q0.has(n[t])||(e+=\"\\\\\"),e+=n[t];return e}function Gt(n,e,t,r){n.format||n.anyOf?.some(i=>i.format)?(n.anyOf||(n.anyOf=[]),n.format&&(n.anyOf.push({format:n.format,...n.errorMessage&&r.errorMessages&&{errorMessage:{format:n.errorMessage.format}}}),delete n.format,n.errorMessage&&(delete n.errorMessage.format,Object.keys(n.errorMessage).length===0&&delete n.errorMessage)),n.anyOf.push({format:e,...t&&r.errorMessages&&{errorMessage:{format:t}}})):le(n,\"format\",e,t,r)}function rt(n,e,t,r){n.pattern||n.allOf?.some(i=>i.pattern)?(n.allOf||(n.allOf=[]),n.pattern&&(n.allOf.push({pattern:n.pattern,...n.errorMessage&&r.errorMessages&&{errorMessage:{pattern:n.errorMessage.pattern}}}),delete n.pattern,n.errorMessage&&(delete n.errorMessage.pattern,Object.keys(n.errorMessage).length===0&&delete n.errorMessage)),n.allOf.push({pattern:wf(e,r),...t&&r.errorMessages&&{errorMessage:{pattern:t}}})):le(n,\"pattern\",wf(e,r),t,r)}function wf(n,e){if(!e.applyRegexFlags||!n.flags)return n.source;let t={i:n.flags.includes(\"i\"),m:n.flags.includes(\"m\"),s:n.flags.includes(\"s\")},r=t.i?n.source.toLowerCase():n.source,i=\"\",o=!1,s=!1,a=!1;for(let c=0;c<r.length;c++){if(o){i+=r[c],o=!1;continue}if(t.i){if(s){if(r[c].match(/[a-z]/)){a?(i+=r[c],i+=`${r[c-2]}-${r[c]}`.toUpperCase(),a=!1):r[c+1]===\"-\"&&r[c+2]?.match(/[a-z]/)?(i+=r[c],a=!0):i+=`${r[c]}${r[c].toUpperCase()}`;continue}}else if(r[c].match(/[a-z]/)){i+=`[${r[c]}${r[c].toUpperCase()}]`;continue}}if(t.m){if(r[c]===\"^\"){i+=`(^|(?<=[\\r\n]))`;continue}else if(r[c]===\"$\"){i+=`($|(?=[\\r\n]))`;continue}}if(t.s&&r[c]===\".\"){i+=s?`${r[c]}\\r\n`:`[${r[c]}\\r\n]`;continue}i+=r[c],r[c]===\"\\\\\"?o=!0:s&&r[c]===\"]\"?s=!1:!s&&r[c]===\"[\"&&(s=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join(\"/\")} to a flag-independent form! Falling back to the flag-ignorant source`),n.source}return i}function oa(n,e){if(e.target===\"openAi\"&&console.warn(\"Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.\"),e.target===\"openApi3\"&&n.keyType?._def.typeName===T.ZodEnum)return{type:\"object\",required:n.keyType._def.values,properties:n.keyType._def.values.reduce((r,i)=>({...r,[i]:W(n.valueType._def,{...e,currentPath:[...e.currentPath,\"properties\",i]})??ve(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:\"object\",additionalProperties:W(n.valueType._def,{...e,currentPath:[...e.currentPath,\"additionalProperties\"]})??e.allowedAdditionalProperties};if(e.target===\"openApi3\")return t;if(n.keyType?._def.typeName===T.ZodString&&n.keyType._def.checks?.length){let{type:r,...i}=ia(n.keyType._def,e);return{...t,propertyNames:i}}else{if(n.keyType?._def.typeName===T.ZodEnum)return{...t,propertyNames:{enum:n.keyType._def.values}};if(n.keyType?._def.typeName===T.ZodBranded&&n.keyType._def.type._def.typeName===T.ZodString&&n.keyType._def.type._def.checks?.length){let{type:r,...i}=ra(n.keyType._def,e);return{...t,propertyNames:i}}}return t}function Ef(n,e){if(e.mapStrategy===\"record\")return oa(n,e);let t=W(n.keyType._def,{...e,currentPath:[...e.currentPath,\"items\",\"items\",\"0\"]})||ve(e),r=W(n.valueType._def,{...e,currentPath:[...e.currentPath,\"items\",\"items\",\"1\"]})||ve(e);return{type:\"array\",maxItems:125,items:{type:\"array\",items:[t,r],minItems:2,maxItems:2}}}function Sf(n){let e=n.values,r=Object.keys(n.values).filter(o=>typeof e[e[o]]!=\"number\").map(o=>e[o]),i=Array.from(new Set(r.map(o=>typeof o)));return{type:i.length===1?i[0]===\"string\"?\"string\":\"number\":[\"string\",\"number\"],enum:r}}function Tf(n){return n.target===\"openAi\"?void 0:{not:ve({...n,currentPath:[...n.currentPath,\"not\"]})}}function kf(n){return n.target===\"openApi3\"?{enum:[\"null\"],nullable:!0}:{type:\"null\"}}var zo={ZodString:\"string\",ZodNumber:\"number\",ZodBigInt:\"integer\",ZodBoolean:\"boolean\",ZodNull:\"null\"};function If(n,e){if(e.target===\"openApi3\")return $f(n,e);let t=n.options instanceof Map?Array.from(n.options.values()):n.options;if(t.every(r=>r._def.typeName in zo&&(!r._def.checks||!r._def.checks.length))){let r=t.reduce((i,o)=>{let s=zo[o._def.typeName];return s&&!i.includes(s)?[...i,s]:i},[]);return{type:r.length>1?r:r[0]}}else if(t.every(r=>r._def.typeName===\"ZodLiteral\"&&!r.description)){let r=t.reduce((i,o)=>{let s=typeof o._def.value;switch(s){case\"string\":case\"number\":case\"boolean\":return[...i,s];case\"bigint\":return[...i,\"integer\"];case\"object\":if(o._def.value===null)return[...i,\"null\"];default:return i}},[]);if(r.length===t.length){let i=r.filter((o,s,a)=>a.indexOf(o)===s);return{type:i.length>1?i:i[0],enum:t.reduce((o,s)=>o.includes(s._def.value)?o:[...o,s._def.value],[])}}}else if(t.every(r=>r._def.typeName===\"ZodEnum\"))return{type:\"string\",enum:t.reduce((r,i)=>[...r,...i._def.values.filter(o=>!r.includes(o))],[])};return $f(n,e)}var $f=(n,e)=>{let t=(n.options instanceof Map?Array.from(n.options.values()):n.options).map((r,i)=>W(r._def,{...e,currentPath:[...e.currentPath,\"anyOf\",`${i}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r==\"object\"&&Object.keys(r).length>0));return t.length?{anyOf:t}:void 0};function Ff(n,e){if([\"ZodString\",\"ZodNumber\",\"ZodBigInt\",\"ZodBoolean\",\"ZodNull\"].includes(n.innerType._def.typeName)&&(!n.innerType._def.checks||!n.innerType._def.checks.length))return e.target===\"openApi3\"?{type:zo[n.innerType._def.typeName],nullable:!0}:{type:[zo[n.innerType._def.typeName],\"null\"]};if(e.target===\"openApi3\"){let r=W(n.innerType._def,{...e,currentPath:[...e.currentPath]});return r&&\"$ref\"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}let t=W(n.innerType._def,{...e,currentPath:[...e.currentPath,\"anyOf\",\"0\"]});return t&&{anyOf:[t,{type:\"null\"}]}}function Rf(n,e){let t={type:\"number\"};if(!n.checks)return t;for(let r of n.checks)switch(r.kind){case\"int\":t.type=\"integer\",au(t,\"type\",r.message,e);break;case\"min\":e.target===\"jsonSchema7\"?r.inclusive?le(t,\"minimum\",r.value,r.message,e):le(t,\"exclusiveMinimum\",r.value,r.message,e):(r.inclusive||(t.exclusiveMinimum=!0),le(t,\"minimum\",r.value,r.message,e));break;case\"max\":e.target===\"jsonSchema7\"?r.inclusive?le(t,\"maximum\",r.value,r.message,e):le(t,\"exclusiveMaximum\",r.value,r.message,e):(r.inclusive||(t.exclusiveMaximum=!0),le(t,\"maximum\",r.value,r.message,e));break;case\"multipleOf\":le(t,\"multipleOf\",r.value,r.message,e);break}return t}function Of(n,e){let t=e.target===\"openAi\",r={type:\"object\",properties:{}},i=[],o=n.shape();for(let a in o){let c=o[a];if(c===void 0||c._def===void 0)continue;let u=H0(c);u&&t&&(c._def.typeName===\"ZodOptional\"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=W(c._def,{...e,currentPath:[...e.currentPath,\"properties\",a],propertyPath:[...e.currentPath,\"properties\",a]});l!==void 0&&(r.properties[a]=l,u||i.push(a))}i.length&&(r.required=i);let s=W0(n,e);return s!==void 0&&(r.additionalProperties=s),r}function W0(n,e){if(n.catchall._def.typeName!==\"ZodNever\")return W(n.catchall._def,{...e,currentPath:[...e.currentPath,\"additionalProperties\"]});switch(n.unknownKeys){case\"passthrough\":return e.allowedAdditionalProperties;case\"strict\":return e.rejectedAdditionalProperties;case\"strip\":return e.removeAdditionalStrategy===\"strict\"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function H0(n){try{return n.isOptional()}catch{return!0}}var Nf=(n,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return W(n.innerType._def,e);let t=W(n.innerType._def,{...e,currentPath:[...e.currentPath,\"anyOf\",\"1\"]});return t?{anyOf:[{not:ve(e)},t]}:ve(e)};var Mf=(n,e)=>{if(e.pipeStrategy===\"input\")return W(n.in._def,e);if(e.pipeStrategy===\"output\")return W(n.out._def,e);let t=W(n.in._def,{...e,currentPath:[...e.currentPath,\"allOf\",\"0\"]}),r=W(n.out._def,{...e,currentPath:[...e.currentPath,\"allOf\",t?\"1\":\"0\"]});return{allOf:[t,r].filter(i=>i!==void 0)}};function jf(n,e){return W(n.type._def,e)}function Pf(n,e){let r={type:\"array\",uniqueItems:!0,items:W(n.valueType._def,{...e,currentPath:[...e.currentPath,\"items\"]})};return n.minSize&&le(r,\"minItems\",n.minSize.value,n.minSize.message,e),n.maxSize&&le(r,\"maxItems\",n.maxSize.value,n.maxSize.message,e),r}function Lf(n,e){return n.rest?{type:\"array\",minItems:n.items.length,items:n.items.map((t,r)=>W(t._def,{...e,currentPath:[...e.currentPath,\"items\",`${r}`]})).reduce((t,r)=>r===void 0?t:[...t,r],[]),additionalItems:W(n.rest._def,{...e,currentPath:[...e.currentPath,\"additionalItems\"]})}:{type:\"array\",minItems:n.items.length,maxItems:n.items.length,items:n.items.map((t,r)=>W(t._def,{...e,currentPath:[...e.currentPath,\"items\",`${r}`]})).reduce((t,r)=>r===void 0?t:[...t,r],[])}}function Bf(n){return{not:ve(n)}}function Vf(n){return ve(n)}var Uf=(n,e)=>W(n.innerType._def,e);var zf=(n,e,t)=>{switch(e){case T.ZodString:return ia(n,t);case T.ZodNumber:return Rf(n,t);case T.ZodObject:return Of(n,t);case T.ZodBigInt:return yf(n,t);case T.ZodBoolean:return bf();case T.ZodDate:return cu(n,t);case T.ZodUndefined:return Bf(t);case T.ZodNull:return kf(t);case T.ZodArray:return gf(n,t);case T.ZodUnion:case T.ZodDiscriminatedUnion:return If(n,t);case T.ZodIntersection:return Cf(n,t);case T.ZodTuple:return Lf(n,t);case T.ZodRecord:return oa(n,t);case T.ZodLiteral:return Df(n,t);case T.ZodEnum:return Af(n);case T.ZodNativeEnum:return Sf(n);case T.ZodNullable:return Ff(n,t);case T.ZodOptional:return Nf(n,t);case T.ZodMap:return Ef(n,t);case T.ZodSet:return Pf(n,t);case T.ZodLazy:return()=>n.getter()._def;case T.ZodPromise:return jf(n,t);case T.ZodNaN:case T.ZodNever:return Tf(t);case T.ZodEffects:return xf(n,t);case T.ZodAny:return ve(t);case T.ZodUnknown:return Vf(t);case T.ZodDefault:return _f(n,t);case T.ZodBranded:return ra(n,t);case T.ZodReadonly:return Uf(n,t);case T.ZodCatch:return vf(n,t);case T.ZodPipeline:return Mf(n,t);case T.ZodFunction:case T.ZodVoid:case T.ZodSymbol:return;default:return(r=>{})(e)}};function W(n,e,t=!1){let r=e.seen.get(n);if(e.override){let a=e.override?.(n,e,r,t);if(a!==pf)return a}if(r&&!t){let a=G0(r,e);if(a!==void 0)return a}let i={def:n,path:e.currentPath,jsonSchema:void 0};e.seen.set(n,i);let o=zf(n,n.typeName,e),s=typeof o==\"function\"?W(o(),e):o;if(s&&K0(n,e,s),e.postProcess){let a=e.postProcess(s,n,e);return i.jsonSchema=s,a}return i.jsonSchema=s,s}var G0=(n,e)=>{switch(e.$refStrategy){case\"root\":return{$ref:n.path.join(\"/\")};case\"relative\":return{$ref:na(e.currentPath,n.path)};case\"none\":case\"seen\":return n.path.length<e.currentPath.length&&n.path.every((t,r)=>e.currentPath[r]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join(\"/\")}! Defaulting to any`),ve(e)):e.$refStrategy===\"seen\"?ve(e):void 0}},K0=(n,e,t)=>(n.description&&(t.description=n.description,e.markdownDescription&&(t.markdownDescription=n.description)),t);var _t=(n,e)=>{let t=mf(e),r=typeof e==\"object\"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:W(l._def,{...t,currentPath:[...t.basePath,t.definitionPath,u]},!0)??ve(t)}),{}):void 0,i=typeof e==\"string\"?e:e?.nameStrategy===\"title\"?void 0:e?.name,o=W(n._def,i===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,i]},!1)??ve(t),s=typeof e==\"object\"&&e.name!==void 0&&e.nameStrategy===\"title\"?e.name:void 0;s!==void 0&&(o.title=s),t.flags.hasReferencedOpenAiAnyType&&(r||(r={}),r[t.openAiAnyTypeName]||(r[t.openAiAnyTypeName]={type:[\"string\",\"number\",\"integer\",\"boolean\",\"array\",\"null\"],items:{$ref:t.$refStrategy===\"relative\"?\"1\":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join(\"/\")}}));let a=i===void 0?r?{...o,[t.definitionPath]:r}:o:{$ref:[...t.$refStrategy===\"relative\"?[]:t.basePath,t.definitionPath,i].join(\"/\"),[t.definitionPath]:{...r,[i]:o}};return t.target===\"jsonSchema7\"?a.$schema=\"http://json-schema.org/draft-07/schema#\":(t.target===\"jsonSchema2019-09\"||t.target===\"openAi\")&&(a.$schema=\"https://json-schema.org/draft/2019-09/schema#\"),t.target===\"openAi\"&&(\"anyOf\"in a||\"oneOf\"in a||\"allOf\"in a||\"type\"in a&&Array.isArray(a.type))&&console.warn(\"Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.\"),a};var du=new WeakMap;function X(n,e){let t=n.describe(n.description);return du.set(t,{...du.get(n),...e}),t}function fu(n,e,t={}){return X(e,{...t,defName:n})}function qo(n){return typeof n==\"object\"&&n!==null?du.get(n):void 0}var qf={ComponentId:{description:\"The unique identifier for a component, used for both definitions and references within the same surface.\",type:\"string\"},TextItem:{additionalProperties:!1,description:\"The value of the text field. This can be a literal string or a reference to a value in the data model ('path', e.g. '/user/name').\",properties:{literalString:{type:\"string\"},path:{type:\"string\"}},type:\"object\"},UrlItem:{additionalProperties:!1,description:\"The URL of the audio to be played. This can be a literal string ('literal') or a reference to a value in the data model ('path', e.g. '/song/url').\",properties:{literalString:{type:\"string\"},path:{type:\"string\"}},type:\"object\"},AltTextItem:{additionalProperties:!1,description:\"The alt text for the image. This can be a literal string ('literal') or a reference to a value in the data model ('path', e.g. '/thumbnail/altText').\",properties:{literalString:{type:\"string\"},path:{type:\"string\"}},type:\"object\"},NameItem:{additionalProperties:!1,description:\"The name of the icon to display. This can be a literal string or a reference to a value in the data model ('path', e.g. '/form/submit').\",properties:{literalString:{enum:[\"accountCircle\",\"add\",\"arrowBack\",\"arrowForward\",\"attachFile\",\"calendarToday\",\"call\",\"camera\",\"check\",\"close\",\"delete\",\"download\",\"edit\",\"event\",\"error\",\"favorite\",\"favoriteOff\",\"folder\",\"help\",\"home\",\"info\",\"locationOn\",\"lock\",\"lockOpen\",\"mail\",\"menu\",\"moreVert\",\"moreHoriz\",\"notificationsOff\",\"notifications\",\"payment\",\"person\",\"phone\",\"photo\",\"print\",\"refresh\",\"search\",\"send\",\"settings\",\"share\",\"shoppingCart\",\"star\",\"starHalf\",\"starOff\",\"upload\",\"visibility\",\"visibilityOff\",\"warning\"],type:\"string\"},path:{type:\"string\"}},type:\"object\"},DescriptionItem:{additionalProperties:!1,description:\"A description of the audio, such as a title or summary. This can be a literal string or a reference to a value in the data model ('path', e.g. '/song/title').\",properties:{literalString:{type:\"string\"},path:{type:\"string\"}},type:\"object\"},ChildrenItem:{additionalProperties:!1,description:\"Defines the children. Use 'explicitList' for a fixed set of children, or 'template' to generate children from a data list.\",properties:{explicitList:{items:{type:\"string\"},type:\"array\"},template:{$ref:\"#/$defs/TemplateItem\",description:\"A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.\"}},type:\"object\"},TemplateItem:{additionalProperties:!1,description:\"A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.\",properties:{componentId:{type:\"string\"},dataBinding:{type:\"string\"}},required:[\"componentId\",\"dataBinding\"],type:\"object\"},TabItemItem:{additionalProperties:!1,properties:{child:{type:\"string\"},title:{$ref:\"#/$defs/TitleItem\"}},required:[\"title\",\"child\"],type:\"object\"},TitleItem:{additionalProperties:!1,description:\"The tab title. Defines the value as either a literal value or a path to data model value (e.g. '/options/title').\",properties:{literalString:{type:\"string\"},path:{type:\"string\"}},type:\"object\"},ActionItem:{additionalProperties:!1,description:\"The client-side action to be dispatched when the button is clicked. It includes the action's name and an optional context payload.\",properties:{context:{items:{$ref:\"#/$defs/ContextItem\"},type:\"array\"},name:{type:\"string\"}},required:[\"name\"],type:\"object\"},ContextItem:{additionalProperties:!1,properties:{key:{type:\"string\"},value:{$ref:\"#/$defs/ValueItem\",description:\"Defines the value to be included in the context as either a literal value or a path to a data model value (e.g. '/user/name').\"}},required:[\"key\",\"value\"],type:\"object\"},ValueItem:{additionalProperties:!1,description:\"The current value of the slider. This can be a literal number ('literalNumber') or a reference to a value in the data model ('path', e.g. '/restaurant/cost').\",properties:{literalNumber:{type:\"number\"},path:{type:\"string\"}},type:\"object\"},LabelItem:{additionalProperties:!1,description:\"The label for the slider. This can be a literal string or a reference to a value in the data model ('path').\",properties:{literalString:{type:\"string\"},path:{type:\"string\"}},type:\"object\"},OptionItem:{additionalProperties:!1,properties:{label:{$ref:\"#/$defs/LabelItem\",description:\"The text to display for this option. This can be a literal string or a reference to a value in the data model (e.g. '/option/label').\"},value:{description:\"The value to be associated with this option when selected.\",type:\"string\"}},required:[\"label\",\"value\"],type:\"object\"},SelectionItem:{additionalProperties:!1,description:\"The currently selected values for the component. This can be a literal array of strings or a path to an array in the data model('path', e.g. '/hotel/options').\",properties:{literalArray:{items:{type:\"string\"},type:\"array\"},path:{type:\"string\"}},type:\"object\"}};var Zf={childRefNames:new Set([\"ComponentId\",\"Child\",\"ChildComponentId\"]),childListRefNames:new Set([\"ChildList\",\"TemplateChildList\",\"ChildrenItem\",\"TemplateItem\"])},sa={ComponentId:{type:\"string\",description:\"The unique identifier for a component, used for both definitions and references within the same surface.\"},AccessibilityAttributes:{type:\"object\",description:\"Attributes to enhance accessibility when using assistive technologies like screen readers.\",properties:{label:{$ref:\"#/$defs/DynamicString\",description:\"A short string, typically 1 to 3 words, used by assistive technologies to convey the purpose or intent of an element. For example, an input field might have an accessible label of 'User ID' or a button might be labeled 'Submit'.\"},description:{$ref:\"#/$defs/DynamicString\",description:\"Additional information provided by assistive technologies about an element such as instructions, format requirements, or result of an action. For example, a mute button might have a label of 'Mute' and a description of 'Silences notifications about this conversation'.\"}}},ComponentCommon:{type:\"object\",properties:{id:{$ref:\"#/$defs/ComponentId\"},accessibility:{$ref:\"#/$defs/AccessibilityAttributes\"}},required:[\"id\"]},ChildList:{oneOf:[{type:\"array\",description:\"A static list of child component IDs.\",items:{$ref:\"#/$defs/ComponentId\"}},{type:\"object\",description:\"A template for generating a dynamic list of children from a data model list. The `componentId` is the component to use as a template.\",properties:{componentId:{$ref:\"#/$defs/ComponentId\"},path:{type:\"string\",description:\"The path to the list of component property objects in the data model.\"}},required:[\"componentId\",\"path\"],additionalProperties:!1}]},DataBinding:{type:\"object\",properties:{path:{type:\"string\",description:\"A JSON Pointer path to a value in the data model.\"}},required:[\"path\"],additionalProperties:!1},DynamicValue:{description:\"A value that can be a literal, a path, or a function call returning any type.\",oneOf:[{type:\"string\"},{type:\"number\"},{type:\"boolean\"},{type:\"array\"},{$ref:\"#/$defs/DataBinding\"},{$ref:\"#/$defs/FunctionCall\"}]},DynamicString:{description:\"Represents a string\",oneOf:[{type:\"string\"},{$ref:\"#/$defs/DataBinding\"},{allOf:[{$ref:\"#/$defs/FunctionCall\"},{properties:{returnType:{const:\"string\"}}}]}]},DynamicNumber:{description:\"Represents a value that can be either a literal number, a path to a number in the data model, or a function call returning a number.\",oneOf:[{type:\"number\"},{$ref:\"#/$defs/DataBinding\"},{allOf:[{$ref:\"#/$defs/FunctionCall\"},{properties:{returnType:{const:\"number\"}}}]}]},DynamicBoolean:{description:\"A boolean value that can be a literal, a path, or a function call returning a boolean.\",oneOf:[{type:\"boolean\"},{$ref:\"#/$defs/DataBinding\"},{allOf:[{$ref:\"#/$defs/FunctionCall\"},{properties:{returnType:{const:\"boolean\"}}}]}]},DynamicStringList:{description:\"Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array.\",oneOf:[{type:\"array\",items:{type:\"string\"}},{$ref:\"#/$defs/DataBinding\"},{allOf:[{$ref:\"#/$defs/FunctionCall\"},{properties:{returnType:{const:\"array\"}}}]}]},FunctionCall:{type:\"object\",description:\"Invokes a named function on the client.\",properties:{call:{type:\"string\",description:\"The name of the function to call.\"},args:{type:\"object\",description:\"Arguments passed to the function.\",additionalProperties:{anyOf:[{$ref:\"#/$defs/DynamicValue\"},{type:\"object\",description:\"A literal object argument (e.g. configuration).\"}]}},returnType:{type:\"string\",description:\"The expected return type of the function call.\",enum:[\"string\",\"number\",\"boolean\",\"array\",\"object\",\"any\",\"void\"],default:\"boolean\"}},required:[\"call\"],oneOf:[{$ref:\"catalog.json#/$defs/anyFunction\"}]},CheckRule:{type:\"object\",description:\"A single validation rule applied to an input component.\",properties:{condition:{$ref:\"#/$defs/DynamicBoolean\"},message:{type:\"string\",description:\"The error message to display if the check fails.\"}},required:[\"condition\",\"message\"],additionalProperties:!1},Checkable:{type:\"object\",description:\"Properties for components that support client-side checks.\",properties:{checks:{type:\"array\",description:\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\",items:{$ref:\"#/$defs/CheckRule\"}}}},Action:{description:\"Defines an interaction handler that can either trigger a server-side event or execute a local client-side function.\",oneOf:[{type:\"object\",description:\"Triggers a server-side event.\",properties:{event:{type:\"object\",description:\"The event to dispatch to the server.\",properties:{name:{type:\"string\",description:\"The name of the action to be dispatched to the server.\"},context:{type:\"object\",description:\"A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.\",additionalProperties:{$ref:\"#/$defs/DynamicValue\"}}},required:[\"name\"],additionalProperties:!1}},required:[\"event\"],additionalProperties:!1},{type:\"object\",description:\"Executes a local client-side function.\",properties:{functionCall:{$ref:\"#/$defs/FunctionCall\"}},required:[\"functionCall\"],additionalProperties:!1}]}};var pu={ComponentId:{type:\"string\",description:\"The unique identifier for a component, used for both definitions and references within the same surface.\"},CallId:{type:\"string\",description:\"The unique identifier for a function call.\"},AccessibilityAttributes:{type:\"object\",description:\"Attributes to enhance accessibility when using assistive technologies like screen readers or model understanding.\",properties:{label:{$ref:\"#/$defs/DynamicString\",description:\"A short string, typically 1 to 3 words, used by assistive technologies to convey the purpose or intent of an element. For example, an input field might have an accessible label of 'User ID' or a button might be labeled 'Submit'.\"},description:{$ref:\"#/$defs/DynamicString\",description:\"Additional information provided by assistive technologies about an element such as instructions, format requirements, or result of an action. For example, a mute button might have a label of 'Mute' and a description of 'Silences notifications about this conversation'.\"},live:{type:\"string\",description:\"Controls screen reader announcements for dynamic updates (WAI-ARIA aria-live). 'polite' waits for user pause; 'assertive' interrupts immediately for alerts.\",enum:[\"off\",\"polite\",\"assertive\"],default:\"off\"},hidden:{$ref:\"#/$defs/DynamicBoolean\",description:\"Hides the element and its children from assistive technologies when true. Default is false.\"}},additionalProperties:!1},Extensions:{type:\"object\",description:\"Optional extension metadata. Keys MUST be Unicode identifiers (UAX #31). Keys starting with 'a2ui_' are reserved for official extensions.\",patternProperties:{\"^[\\\\p{XID_Start}_][\\\\p{XID_Continue}]*$\":{}},additionalProperties:!1},ComponentCommon:{type:\"object\",properties:{id:{$ref:\"#/$defs/ComponentId\"},catalogId:{type:\"string\",description:\"The catalog ID for this component, overriding any surface-level default catalogId.\"},accessibility:{$ref:\"#/$defs/AccessibilityAttributes\"},metadata:{type:\"object\",description:\"Optional component-level metadata for vendor extensions.\",properties:{extensions:{$ref:\"#/$defs/Extensions\"}},additionalProperties:!1}},required:[\"id\"]},Child:{$ref:\"#/$defs/ComponentId\",description:\"A reference to a single child component ID.\"},ChildList:{oneOf:[{type:\"array\",description:\"A static list of child component IDs.\",items:{$ref:\"#/$defs/ComponentId\"}},{type:\"object\",description:\"A template for generating a dynamic list of children from a data model list. The `componentId` is the component to use as a template.\",properties:{componentId:{$ref:\"#/$defs/ComponentId\"},path:{type:\"string\",description:\"The path to the list of component property objects in the data model.\"}},required:[\"componentId\",\"path\"],additionalProperties:!1}]},DataBinding:{type:\"object\",properties:{\"@path\":{type:\"string\",description:\"A JSON Pointer path to a value in the data model.\"}},required:[\"@path\"],additionalProperties:!1},DynamicValue:{description:\"A value that can be a literal, a path, or a function call returning any type.\",oneOf:[{type:\"string\"},{type:\"number\"},{type:\"boolean\"},{type:\"array\"},{type:\"object\",propertyNames:{not:{pattern:\"^@([^@]|$)\"}},not:{anyOf:[{required:[\"@path\"]},{required:[\"@call\"]}]}},{$ref:\"#/$defs/DataBinding\"},{$ref:\"#/$defs/FunctionCall\"}]},DynamicString:{description:\"Represents a string\",oneOf:[{type:\"string\"},{$ref:\"#/$defs/DataBinding\"},{$ref:\"#/$defs/FunctionCall\"}]},DynamicNumber:{description:\"Represents a value that can be either a literal number, a path to a number in the data model, or a function call returning a number.\",oneOf:[{type:\"number\"},{$ref:\"#/$defs/DataBinding\"},{$ref:\"#/$defs/FunctionCall\"}]},DynamicBoolean:{description:\"A boolean value that can be a literal, a path, or a function call returning a boolean or a validation result object (coerced to its 'valid' boolean).\",oneOf:[{type:\"boolean\"},{$ref:\"#/$defs/DataBinding\"},{$ref:\"#/$defs/FunctionCall\"}]},DynamicStringList:{description:\"Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array.\",oneOf:[{type:\"array\",items:{type:\"string\"}},{$ref:\"#/$defs/DataBinding\"},{$ref:\"#/$defs/FunctionCall\"}]},FunctionCommon:{type:\"object\",description:\"Baseline envelope properties common to all function calls. Function-specific argument schemas ('args') are defined individually by each function in the active catalog.\",properties:{\"@call\":{type:\"string\",description:\"The name of the function to call.\"},catalogId:{type:\"string\",description:\"The catalog ID for this function, overriding any surface-level default catalogId.\"}},required:[\"@call\"]},IndexSystemFunction:{type:\"object\",description:\"Returns the 0-based index of the current item when rendering a dynamic list from a template. This function MUST ONLY be available when evaluating template items within a list context.\",properties:{\"@call\":{const:\"@index\"},args:{type:\"object\",properties:{offset:{$ref:\"#/$defs/DynamicNumber\",description:\"Optional. An offset to add to the 0-based index (e.g., 1 for 1-based indexing). Defaults to 0.\",default:0}},unevaluatedProperties:!1}},required:[\"@call\"],unevaluatedProperties:!1},FunctionCall:{type:\"object\",description:\"Invokes a named function, combining common function properties with the catalog function definition.\",allOf:[{$ref:\"#/$defs/FunctionCommon\"},{oneOf:[{$ref:\"catalog.json#/$defs/anyFunction\"},{$ref:\"#/$defs/IndexSystemFunction\"}]}],unevaluatedProperties:!1},CheckRule:{type:\"object\",description:\"A single validation check rule applied to an input component. The condition function or path evaluates to a structured validation result object or a boolean (which is coerced to a validation result object).\",properties:{condition:{description:\"Path or function call evaluating to a structured validation result object or a boolean.\",oneOf:[{$ref:\"#/$defs/DataBinding\"},{$ref:\"#/$defs/FunctionCall\"}]},message:{type:\"string\",description:\"Optional fallback error message.\"}},required:[\"condition\"],additionalProperties:!1},Checkable:{type:\"object\",description:\"Properties for components that support renderer-side checks.\",properties:{checks:{type:\"array\",description:\"A list of validation check rules to perform on the component.\",items:{$ref:\"#/$defs/CheckRule\"}}}},Action:{description:\"Defines an interaction handler that can either trigger an agent-side event or execute a local renderer-side function.\",oneOf:[{type:\"object\",description:\"Triggers an agent-side event.\",properties:{event:{type:\"object\",description:\"The event to dispatch to the agent.\",properties:{name:{type:\"string\",description:\"The name of the action to be dispatched to the agent.\"},userMessage:{$ref:\"#/$defs/DynamicString\",description:\"An optional human-readable message describing the action performed by the user, resolved by the renderer and included in the outbound action message.\"},context:{type:\"object\",description:\"A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.\",additionalProperties:{$ref:\"#/$defs/DynamicValue\"}}},required:[\"name\"],additionalProperties:!1}},required:[\"event\"],additionalProperties:!1},{type:\"object\",description:\"Executes a renderer or agent-side function.\",properties:{functionCall:{$ref:\"#/$defs/FunctionCall\"}},required:[\"functionCall\"],additionalProperties:!1}]},Surface:{title:\"Surface Container Component\",description:\"The reserved canonical container component representing an A2UI surface. The Surface component is immutable and always has 'child': 'root'.\",type:\"object\",allowedParents:[],properties:{component:{const:\"Surface\"},child:{const:\"root\"}},additionalProperties:!1},FunctionResponse:{type:\"object\",description:\"The return response matching a callAgentFunction or callRendererFunction invocation.\",properties:{functionCallId:{$ref:\"#/$defs/CallId\",description:\"The unique ID matching the initiating function call.\"},value:{description:\"The return value of the function.\"},error:{type:\"object\",description:\"An error object indicating failure of the function execution.\",properties:{code:{type:\"string\"},message:{type:\"string\"}},required:[\"code\",\"message\"],additionalProperties:!1}},required:[\"functionCallId\"],oneOf:[{required:[\"value\"]},{required:[\"error\"]}],additionalProperties:!1}};var nr=\"common_types.json\",Wf={\"0.8\":qf,\"0.9\":sa,\"0.9.1\":sa,\"1.0\":pu};function gu(n){if(n){let e=ke(n)??En(n);if(e in Wf)return Wf[e];if(ge(n,\"1.0\"))return pu}return sa}function Hf(n){return JSON.parse(JSON.stringify(n))}function aa(n){return typeof n==\"object\"&&n!==null&&!Array.isArray(n)}function Gr(n){return n._def}var hu=new Set([\"id\",\"component\"]);function Kf(n){return Zo(n).mixins!==void 0}function Jf(n){return Object.keys(Zo(n)).length>0}function Zo(n){let e=[],t=n;for(;t&&typeof t==\"object\"&&\"_def\"in t;){let r=qo(t);r&&e.push(r);let i=Wo(t);if(!i)break;t=i}return e.reduceRight((r,i)=>({...r,...i}),{})}function Wo(n){let e=Gr(n);switch(e.typeName){case\"ZodOptional\":case\"ZodDefault\":case\"ZodCatch\":case\"ZodReadonly\":return e.innerType;case\"ZodEffects\":return e.schema;case\"ZodBranded\":return e.type;default:return}}var Ho=class{constructor(e,t=nr){this.commonTypesUri=t,this.isV08=!ge(e,\"0.9\"),this.isV10=ge(e,\"1.0\"),this.standardDefs=gu(e)}componentSchema(e,t,r,i){let o=new Map,s;if(this.isV08){s=this.toJson(t);let a=s.properties;if(aa(a))for(let c of hu)delete a[c];if(Array.isArray(s.required)){let c=s.required.filter(u=>!hu.has(u));c.length>0?s.required=c:delete s.required}}else{let a=Zo(t),c=a.mixins??[],u=new Set(hu),l=[];for(let v of c){l.push({$ref:this.mixinRef(v,o)});for(let x of this.mixinProperties(v))u.add(x)}let p=mu(t),f=J0(t),m=this.objectSchema(p,a,v=>!u.has(v)),g={component:{const:e},...m.properties},h=[\"component\",...m.required??[]],y={type:\"object\"};f!==void 0&&!this.isV10&&(y.description=f),y.properties=g,y.required=h,s={type:\"object\"},this.isV10?(f!==void 0&&(s.description=f),l.length>0?s.allOf=[...l,y]:(s.properties=g,s.required=h)):(s.allOf=[...l,y],s.unevaluatedProperties=!1)}return r&&r.length>0&&(s.allowedParents=[...r]),i&&i.length>0&&(s.allowedChildren=[...i]),{schema:s,catalogDefs:o}}functionSchema(e,t){let r=this.toJson(t.schema),i=Array.isArray(r.required)&&r.required.length>0,o={type:\"object\"};return t.description&&(o.description=t.description),this.isV10?(o.returnType=t.returnType,t.allowedCallers&&(o.allowedCallers=t.allowedCallers),t.requiresUserActivation&&(o.requiresUserActivation=!0),o.properties={\"@call\":{const:e},args:r},o.required=i?[\"@call\",\"args\"]:[\"@call\"],o):(t.allowedCallers&&(o.allowedCallers=t.allowedCallers),t.requiresUserActivation&&(o.requiresUserActivation=!0),o.properties={call:{const:e},args:r,returnType:{const:t.returnType}},o.required=i?[\"call\",\"args\"]:[\"call\"],o.unevaluatedProperties=!1,o)}defSchema(e){return this.toJson(e)}mixinRef(e,t){if(typeof e==\"string\")return`${this.commonTypesUri}#/$defs/${e}`;let r=Zo(e).defName;if(r===void 0)throw new Error(\"A component mixin model must be named with specDef().\");return t.set(r,e),`#/$defs/${r}`}mixinProperties(e){if(typeof e!=\"string\"){let i=mu(e);return Gr(i).typeName===\"ZodObject\"?Object.keys(i.shape):[]}let t=[],r=(i,o)=>{if(!(!aa(i)||o.has(i))){o.add(i),aa(i.properties)&&t.push(...Object.keys(i.properties));for(let s of Array.isArray(i.allOf)?i.allOf:[]){let a=aa(s)?s.$ref:void 0,c=typeof a==\"string\"&&a.startsWith(\"#/$defs/\")?this.standardDefs[a.substring(8)]:s;r(c,o)}}};return r(this.standardDefs[e],new Set),t}toJson(e){let t=Zo(e),r=Yf(e),i=Y0(e),o,s=r;if(r!==void 0&&r.startsWith(\"REF:\")){let c=r.substring(4),u=c.indexOf(\"|\"),l=u===-1?c:c.substring(0,u);s=u===-1?void 0:c.substring(u+1),o={$ref:this.refTarget(l)}}else o=this.coreJson(mu(e),t);t.keywords&&Object.assign(o,Hf(t.keywords));let a=t.allOf?{allOf:[o,...t.allOf.map(c=>Hf(c))]}:o;return s&&(a.description=s),i!==void 0&&(a.default=i),a}refTarget(e){return e.startsWith(\"#/$defs/\")?`${this.commonTypesUri}${e}`:e}coreJson(e,t){let r=Gr(e);switch(r.typeName){case\"ZodObject\":return this.objectSchema(e,t,()=>!0);case\"ZodString\":return X0(r);case\"ZodNumber\":return Q0(r);case\"ZodBoolean\":return{type:\"boolean\"};case\"ZodNull\":return{type:\"null\"};case\"ZodEnum\":return{type:\"string\",enum:[...r.values]};case\"ZodLiteral\":return{const:r.value};case\"ZodAny\":case\"ZodUnknown\":return{};case\"ZodNever\":return{not:{}};case\"ZodArray\":{let i={type:\"array\",items:this.toJson(r.type)},o=r.minLength,s=r.maxLength;return o&&(i.minItems=o.value),s&&(i.maxItems=s.value),i}case\"ZodUnion\":case\"ZodDiscriminatedUnion\":return{oneOf:[...r.options].map(o=>this.toJson(o))};case\"ZodRecord\":return{type:\"object\",additionalProperties:this.toJson(r.valueType)};case\"ZodLazy\":return this.toJson(r.getter());default:return e_(e)}}objectSchema(e,t,r){let i=Gr(e);if(i.typeName!==\"ZodObject\")return this.toJson(e);let o=e.shape,s={},a=[];for(let[g,h]of Object.entries(o))r(g)&&(s[g]=this.toJson(h),h.isOptional()||a.push(g));let c={type:\"object\",properties:s},u=t.required?.filter(g=>a.includes(g)),l=a.filter(g=>!u?.includes(g));a.length>0&&(c.required=u?[...u,...l]:a);let p=i.unknownKeys,f=i.catchall,m=t.closure??(p===\"strict\"?\"additionalProperties\":\"none\");return f&&Gr(f).typeName!==\"ZodNever\"?c[m===\"none\"?\"additionalProperties\":m]=this.toJson(f):m!==\"none\"&&(c[m]=p===\"passthrough\"),c}};function mu(n){let e=n;for(let t=Wo(e);t;t=Wo(e))e=t;return e}function Yf(n){for(let e=n;e;e=Wo(e)){let t=Gr(e).description;if(typeof t==\"string\")return t}}function J0(n){let e=Yf(n);return e!==void 0&&!e.startsWith(\"REF:\")?e:void 0}function Y0(n){for(let e=n;e;e=Wo(e)){let t=Gr(e);if(t.typeName===\"ZodDefault\")return t.defaultValue()}}var Gf={email:\"email\",url:\"uri\",uuid:\"uuid\",datetime:\"date-time\",date:\"date\",time:\"time\"};function X0(n){let e={type:\"string\"};for(let t of n.checks??[])t.kind===\"regex\"?e.pattern=t.regex.source:t.kind===\"min\"?e.minLength=t.value:t.kind===\"max\"?e.maxLength=t.value:t.kind in Gf&&(e.format=Gf[t.kind]);return e}function Q0(n){let e=n.checks??[],t={type:e.some(r=>r.kind===\"int\")?\"integer\":\"number\"};for(let r of e)r.kind===\"min\"?t[r.inclusive?\"minimum\":\"exclusiveMinimum\"]=r.value:r.kind===\"max\"&&(t[r.inclusive?\"maximum\":\"exclusiveMaximum\"]=r.value);return t}function e_(n){let e=_t(n,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});return delete e.$schema,delete e.definitions,delete e.$defs,e}var t_=new Set([\"anyComponent\",\"anyFunction\"]),_u=[\"theme\",\"themeSchema\",\"styles\"];function Re(n){return n===void 0?n:JSON.parse(JSON.stringify(n))}function rr(n){if(typeof n==\"object\"&&n!==null&&!Object.isFrozen(n)){Object.freeze(n);for(let e of Object.values(n))rr(e)}return n}function xu(n){return typeof n!=\"object\"||n===null||Object.isFrozen(n)?n:rr(Re(n))}function un(n){return typeof n==\"object\"&&n!==null&&!Array.isArray(n)}function ca(n,e){if(Array.isArray(n)){for(let r of n)ca(r,e);return}if(!un(n))return;let t=n.$ref;typeof t==\"string\"&&t.startsWith(\"#/$defs/\")&&e.add(t.slice(8).split(\"/\")[0].replace(/~1/g,\"/\").replace(/~0/g,\"~\"));for(let r of Object.values(n))ca(r,e)}function yu(n,e){let t=new Set,r=new Set;for(let i of n)ca(i,r);for(;r.size>0;){let[i]=r;r.delete(i),!t.has(i)&&(t.add(i),i in e&&ca(e[i],r))}return t}function bu(n,e){let t=Uo(n);if(!un(t))return;let r=e??{};for(let i of yu([t],r))if(!(i in r)&&!t_.has(i))return;return t}function Xf(n){return typeof n.name==\"string\"&&!(\"properties\"in n)}function tp(n,e,t,r){if(!n)return n;let i=l=>l.map(p=>bu(p,n)).filter(p=>p!==void 0),o=yu(i(e),n),s=Object.keys(n).filter(l=>!o.has(l)),a=yu([...i(t),r,...s.map(l=>n[l])],n),c={},u=!1;for(let[l,p]of Object.entries(n))!o.has(l)||a.has(l)?c[l]=p:u=!0;return u?c:n}function vu(n,e,t=nr){if(Array.isArray(n)){for(let r of n)vu(r,e,t);return}if(un(n)){if(typeof n.description==\"string\"&&n.description.startsWith(\"REF:\")){let r=n.description.substring(4),i=r.indexOf(\"|\"),o=i===-1?r:r.substring(0,i),s=i===-1?\"\":r.substring(i+1),a=n.default;for(let l of Object.keys(n))delete n[l];let c=o.split(/#\\/(?:\\$defs|definitions)\\//)[1],u=c?.split(\"/\")[0];n.$ref=u===void 0||o.startsWith(\"#\")&&e.has(u)?o:`${t}#/$defs/${c}`,a!==void 0&&(n.default=a),s&&(n.description=s);return}Array.isArray(n.anyOf)&&(n.oneOf=n.anyOf,delete n.anyOf);for(let r of[\"additionalProperties\",\"unevaluatedProperties\"]){let i=n[r];un(i)&&Object.keys(i).length===0&&(n[r]=!0)}delete n.$schema;for(let r of Object.values(n))vu(r,e,t)}}function Au(n,e,t=nr){if(!n||typeof n!=\"object\"||!(\"safeParse\"in n))return{type:\"object\",properties:{}};let r=_t(n,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});return delete r.definitions,delete r.$defs,vu(r,e,t),r}function n_(n){if(n.type!==\"object\")return;let e=n.unevaluatedProperties??n.additionalProperties;delete n.additionalProperties,n.unevaluatedProperties=typeof e==\"boolean\"||un(e)?e:!1}function r_(n,e,t,r=nr){let i=Au(e.schema,t,r),{component:o,id:s,...a}=un(i.properties)?i.properties:{},c=Array.isArray(i.required)?i.required.filter(p=>p!==\"component\"&&p!==\"id\"):[],u=i.unevaluatedProperties??i.additionalProperties,l={type:\"object\",properties:{component:{const:n},...a},required:[\"component\",...c],unevaluatedProperties:typeof u==\"boolean\"||un(u)?u:!1};return e.allowedParents&&e.allowedParents.length>0&&(l.allowedParents=[...e.allowedParents]),e.allowedChildren&&e.allowedChildren.length>0&&(l.allowedChildren=[...e.allowedChildren]),l}function Qf(n,e,t,r,i,o=nr){let s=Au(e.schema,t,o);if(i)return{name:n,...e.description?{description:e.description}:{},returnType:e.returnType,parameters:s,...e.allowedCallers?{allowedCallers:e.allowedCallers}:{},...e.requiresUserActivation!==void 0?{requiresUserActivation:e.requiresUserActivation}:{}};n_(s);let a=Array.isArray(s.required)&&s.required.length>0,c={type:\"object\"};return e.description&&(c.description=e.description),r?(c.returnType=e.returnType,e.allowedCallers&&(c.allowedCallers=e.allowedCallers),e.requiresUserActivation!==void 0&&(c.requiresUserActivation=e.requiresUserActivation),c.properties={\"@call\":{const:n},args:s},c.required=a?[\"@call\",\"args\"]:[\"@call\"],c):(e.allowedCallers&&(c.allowedCallers=e.allowedCallers),e.requiresUserActivation!==void 0&&(c.requiresUserActivation=e.requiresUserActivation),c.properties={call:{const:n},args:s,returnType:{const:e.returnType}},c.required=a?[\"call\",\"args\"]:[\"call\"],c.unevaluatedProperties=!1,c)}function i_(n,e,t=nr){let r=Au(n,e,t);return{type:\"object\",properties:un(r.properties)?r.properties:{},...Array.isArray(r.required)&&r.required.length>0?{required:r.required}:{},additionalProperties:r.additionalProperties!==void 0?r.additionalProperties:!0}}var np={not:{}};function Cu(n){let e=[...n].map(t=>({$ref:`#/components/${rp(t)}`}));return e.length===0?{...np}:{oneOf:e,discriminator:{propertyName:\"component\"}}}function Du(n){let e=[...n].map(t=>({$ref:`#/functions/${rp(t)}`}));return e.length===0?{...np}:{oneOf:e}}function rp(n){return n.replace(/~/g,\"~0\").replace(/\\//g,\"~1\")}var ep=new WeakMap;function wu(n){let e=ep.get(n);return e||(e=o_(n),ep.set(n,e)),e}function o_(n){let e=new Ho(n.protocolVersion,n.commonTypesUri),t=new Map,r=new Map;for(let[c,u]of n.components){if(Uo(u)||!Kf(u.schema))continue;let{schema:l,catalogDefs:p}=e.componentSchema(c,u.schema,u.allowedParents,u.allowedChildren);r.set(c,rr(l));for(let[f,m]of p)t.set(f,m)}for(let c of n.defModels??[]){let u=qo(c)?.defName;if(u===void 0)throw new Error(\"A catalog definition model must be named with specDef().\");t.set(u,c)}let i={...n.defs};for(let[c,u]of t)c in i||(i[c]=e.defSchema(u));let o={...n.extensionFields};if(n.themeLocation===\"styles\"&&n.themeSchema&&!ip(n)){let c=e.defSchema(n.themeSchema);o.styles=un(c.properties)?c.properties:{}}let s=new Map;for(let[c,u]of n.components)s.set(c,r.get(c)??bu(u,i));let a=new Map;for(let[c,u]of n.functions){let l=bu(u,i);a.set(c,l??(!Uo(u)&&Jf(u.schema)?rr(e.functionSchema(c,u)):void 0))}return{components:s,functions:a,defs:rr(i),extensionFields:rr(o)}}function ip(n){return un(n.defs?.theme)||_u.some(e=>n.extensionFields?.[e]!==void 0)}function op(n){let e=ge(n.protocolVersion,\"1.0\"),t=wu(n),r=new Set(Object.keys(t.defs)),i={};n.schemaUri!==void 0&&(i.$schema=n.schemaUri),n.schemaId!==void 0&&(i.$id=n.schemaId),typeof n.declaredProtocolVersion==\"string\"?i.protocolVersion=n.declaredProtocolVersion:n.declaredProtocolVersion===void 0&&(i.protocolVersion=ke(n.protocolVersion)??n.protocolVersion),n.title!==void 0&&(i.title=n.title),n.description!==void 0&&(i.description=n.description),n.declaresCatalogId!==!1&&(i.catalogId=n.id),n.instructions!==void 0&&(i.instructions=n.instructions);let o=n.commonTypesUri??nr;if(n.declaresComponents!==!1||n.components.size>0){let p={};for(let[f,m]of n.components){let g=t.components.get(f);p[f]=g?Re(g):r_(f,m,r,o)}i.components=p}let s=[...n.functions].filter(([p,f])=>Uo(f)!==void 0||!p.startsWith(\"@\")),a=s.map(([p])=>p);if(n.functionsLayout===\"list\")i.functions=s.map(([p,f])=>{let m=t.functions.get(p);return m&&Xf(m)?Re(m):Qf(p,f,r,e,!0,o)});else if(n.functionsLayout===\"map\"||s.length>0){let p={};for(let[f,m]of s){let g=t.functions.get(f);p[f]=g&&!Xf(g)?Re(g):Qf(f,m,r,e,!1,o)}i.functions=p}for(let[p,f]of Object.entries(t.extensionFields))p in i||(i[p]=Re(f));let c=Re({...t.defs});(n.themeLocation??(e?void 0:\"defs\"))===\"defs\"&&n.themeSchema&&!ip(t)&&(c.theme=qo(n.themeSchema)?new Ho(n.protocolVersion,n.commonTypesUri).defSchema(n.themeSchema):i_(n.themeSchema,r,o));let l=n.unions??{anyComponent:e||n.components.size>0,anyFunction:e||a.length>0};if(l.anyComponent&&!(\"anyComponent\"in c)){let p=c.anyFunction;p!==void 0&&delete c.anyFunction,c.anyComponent=Cu(n.components.keys()),p!==void 0&&(c.anyFunction=p)}return l.anyFunction&&!(\"anyFunction\"in c)&&(c.anyFunction=Du(a)),(n.defs!==void 0||Object.keys(c).length>0)&&(i.$defs=c),i}var s_=/^[\\p{XID_Start}_][\\p{XID_Continue}]*$/u;function Eu(n,e=!1){if(!n)return!1;let t=e&&n.startsWith(\"@\")?n.slice(1):n;return s_.test(t)}function Go(n,e,t=!1){if(!Eu(n,t))throw new Fe(`Invalid UAX #31 ${e}`)}var a_=\"0.9\",yp={DynamicString:Zi,DynamicNumber:Qs,DynamicBoolean:Po,DynamicStringList:ru,DynamicValue:nu,ComponentId:Tn,Child:su,ChildList:Xs,Action:ou,CheckRule:ea,Checkable:iu,AccessibilityAttributes:tr,DataBinding:kn,FunctionCall:Wt},bp=\"common_types.json\",Su=\"catalog.json\";function vp(n,e){return n===e||n.endsWith(`/${e}`)}function sp(n){return n.slice(n.lastIndexOf(\"/\")+1)}function Tu(n){let e=n.indexOf(\"#\");return e<0?{doc:n,fragment:\"\"}:{doc:n.slice(0,e),fragment:n.slice(e)}}function _p(n){return typeof n.toJson==\"function\"}function ap(n){if(_p(n))return{id:n.id,schemaId:n.schemaId};let e=n.catalogId,t=n.$id;return{id:typeof e==\"string\"?e:void 0,schemaId:typeof t==\"string\"?t:void 0}}function cp(n,e){if(!n)return{kind:\"self\"};if(vp(n,bp))return{kind:\"commonTypes\"};if(n===Su)return{kind:\"self\"};for(let r of e){let{id:i,schemaId:o}=ap(r);for(let s of[i,o])if(s&&(n===s||s.endsWith(`/${n}`)||n.endsWith(`/${s}`)))return{kind:\"peer\",peer:r}}if(n.endsWith(`/${Su}`))return{kind:\"self\"};let t=sp(n);for(let r of e){let{id:i,schemaId:o}=ap(r);for(let s of[o,i])if(s&&sp(s)===t)return{kind:\"peer\",peer:r}}return{kind:\"unresolved\"}}function fa(n){if(Array.isArray(n))return n.some(fa);if(!n||typeof n!=\"object\")return!1;for(let[e,t]of Object.entries(n))if(e===\"$ref\"&&typeof t==\"string\"){let{doc:r}=Tu(t);if(r&&r!==Su&&!vp(r,bp))return!0}else if(fa(t))return!0;return!1}var up=new WeakMap,c_=0;function u_(n){let e=up.get(n);return e===void 0&&(e=c_++,up.set(n,e)),e}var pa=class{constructor(e=[]){this.peers=e,this.documents=new Map}documentOf(e){if(!_p(e))return e;let t=this.documents.get(e);return t||(t=e.toJson(),this.documents.set(e,t)),t}resolve(e,t){let{doc:r,fragment:i}=Tu(e);if(!i.startsWith(\"#/\"))return;let o=cp(r,this.peers);if(o.kind===\"self\")return{doc:t,pointer:i,key:`${u_(t)}:${i}`,isPeer:!1};if(o.kind===\"peer\")return{doc:this.documentOf(o.peer),pointer:i,key:e,isPeer:!0}}assertResolvable(e){cp(Tu(e).doc,this.peers).kind===\"unresolved\"&&ga(e)}};function ga(n){throw new Fe(`Unresolvable schema reference: '${n}'`)}var $n=class extends Map{constructor(e=[]){super(),this.scope=new pa(e)}},ha=new WeakMap;function ku(n,e){let t=ha.get(n);return t?t(e):n}function xp(n){let e={};for(let[t,r]of Object.entries(n))t===\"unevaluatedProperties\"||t===\"additionalProperties\"||t===\"title\"||(e[t]=r);if(e.properties&&typeof e.properties==\"object\"&&!Array.isArray(e.properties)){let t={};for(let[r,i]of Object.entries(e.properties))ma(r)||(t[r]=i);e.properties=t}if(Array.isArray(e.required)&&(e.required=e.required.filter(t=>typeof t==\"string\"&&!ma(t))),Array.isArray(e.allOf)){let t=[],r=[];for(let i of e.allOf)if(i&&typeof i==\"object\"&&!Array.isArray(i)){let o=i,s=o.properties,a=!!s&&typeof s==\"object\"&&!Array.isArray(s)&&\"component\"in s,c=xp(o);a?t.push(c):r.push(c)}else r.push(i);e.allOf=[...t,...r]}return e}function Ap(n,e){return!e.startsWith(\"#/components/\")||e.slice(2).split(\"/\").length!==2?n:xp(n)}function $u(n){let e=n.doc,t=Hi(e,n.pointer);return t?{doc:e,target:Ap(t,n.pointer)}:void 0}function Yo(n,e,t=[],r={}){return Ko(n,e,new pa(t),r.inlineLocalDefs??!0,r.visited??new Set)}function Ko(n,e,t,r,i){if(Array.isArray(n))return n.map(a=>Ko(a,e,t,r,i));if(!n||typeof n!=\"object\")return n;let o=n;if(typeof o.$ref==\"string\"){let a=t.resolve(o.$ref,e);if(a&&!a.isPeer){let c=a.pointer.split(\"/\").pop()??\"\";(a.pointer.startsWith(\"#/$defs/\")&&(c in yp||c===\"ComponentCommon\")||!r&&a.pointer.startsWith(\"#/$defs/\"))&&(a=void 0)}if(a&&!i.has(a.key)){let c=Hi(a.doc,a.pointer);if(c){let u=new Set(i);u.add(a.key);let l=Ko(c,a.doc,t,a.isPeer?!0:r,u);if(l&&typeof l==\"object\"&&!Array.isArray(l)){let f={...Ap(l,a.pointer)};for(let[m,g]of Object.entries(o)){if(m===\"$ref\")continue;let h=Ko(g,e,t,r,i);if(m in f&&f[m]&&typeof f[m]==\"object\"&&!Array.isArray(f[m])&&h&&typeof h==\"object\"&&!Array.isArray(h))f[m]={...f[m],...h};else if(Array.isArray(f[m])&&Array.isArray(h)){let y=f[m];f[m]=[...y,...h.filter(v=>!y.includes(v))]}else f[m]=h}return f}return l}}}let s={};for(let[a,c]of Object.entries(o))s[a]=Ko(c,e,t,r,i);return s}function Hi(n,e){if(!e.startsWith(\"#/\"))return;let t=e.slice(2).split(\"/\").map(i=>i.replace(/~1/g,\"/\").replace(/~0/g,\"~\")),r=n;for(let i of t)if(r&&typeof r==\"object\"&&i in r)r=r[i];else return;return typeof r==\"object\"&&r!==null?r:void 0}function Cp(n){let e=n.split(/#\\/(?:\\$defs|definitions)\\//)[1];return e?yp[e]:void 0}function l_(n){return n.length===0?d.unknown():n.every(e=>typeof e==\"string\")?d.enum(n):n.length===1?d.literal(n[0]):d.union(n.map(e=>d.literal(e)))}function Jo(n){return n===null||typeof n!=\"object\"?JSON.stringify(n):Array.isArray(n)?`[${n.map(Jo).join(\",\")}]`:`{${Object.keys(n).sort().map(r=>`${JSON.stringify(r)}:${Jo(n[r])}`).join(\",\")}}`}function ir(n,e,t,r,i){let o=n;if(e.not&&typeof e.not==\"object\"){let s=Wi(e.not,t,new Set(r),i);o=o.refine(a=>!s.safeParse(a).success,{message:'Value matched prohibited \"not\" schema'})}return e.default!==void 0&&(o=o.default(e.default)),typeof e.description==\"string\"&&(o=o.describe(e.description)),o}function d_(n,e,t,r,i){let o=Cp(n);if(o){let f=n.split(/#\\/(?:\\$defs|definitions)\\//)[1],m=typeof e.description==\"string\"?`REF:common_types.json#/$defs/${f}|${e.description}`:o.description;return m?o.describe(m):o}if(!t)return;let s=i.scope.resolve(n,t);if(!s){i.scope.assertResolvable(n);return}let a,c;if(s.isPeer){let f=$u(s);f||ga(n),{doc:a,target:c}=f}else if(a=t,c=Hi(t,s.pointer),!c)return n.startsWith(\"#\")?d.unknown().superRefine((f,m)=>{m.addIssue({code:d.ZodIssueCode.custom,message:`Unresolvable schema reference: '${n}'`})}):void 0;let u=s.key,l=c;if(r.has(u)){let f=i.get(u);return d.lazy(()=>(f||(f=i.get(u)??Wi(l,a,new Set([u]),i),i.set(u,f)),f))}let p=i.get(u);if(!p){let f=new Set(r);f.add(u),p=Wi(l,a,f,i),i.set(u,p)}return typeof e.description==\"string\"&&(p=p.describe(e.description)),p}function f_(n,e,t,r){let i=Array.isArray(n.oneOf),s=(n.oneOf||n.anyOf).filter(f=>typeof f==\"object\"&&f!==null);if(s.length===0)return;let a=s.find(f=>Array.isArray(f.enum)),c=s.some(f=>typeof f.$ref==\"string\"&&f.$ref.includes(\"DataBinding\")),u=s.map(f=>Wi(f,e,new Set(t),r)),l;if(u.length===1)l=u[0];else{let f=d.union([u[0],u[1],...u.slice(2)]);l=i?d.any().superRefine((m,g)=>{let h=0;for(let y of u)if(y.safeParse(m).success&&++h>1){g.addIssue({code:d.ZodIssueCode.custom,message:\"Value matched more than one schema in oneOf\"});return}}).pipe(f):f}n.default!==void 0&&(l=l.default(n.default));let p=(typeof n.description==\"string\"?n.description:void 0)||(a&&c?\"REF:common_types.json#/$defs/DynamicString\":void 0);return p?l.describe(p):l}function Wi(n,e,t=new Set,r=new $n){if(!n||typeof n!=\"object\")return d.unknown();if(n instanceof d.ZodType)return n;if(n.$ref&&typeof n.$ref==\"string\"){let i=d_(n.$ref,n,e,t,r);if(i)return i}if(Array.isArray(n.oneOf)||Array.isArray(n.anyOf)){let i=f_(n,e,t,r);if(i)return i}if(n.const!==void 0){let i=d.literal(n.const);return ir(i,n,e,t,r)}if(Array.isArray(n.enum)&&n.enum.length>0){let i=l_(n.enum);return ir(i,n,e,t,r)}if(n.type===\"array\"){let i=n.items&&typeof n.items==\"object\"?Wi(n.items,e,new Set(t),r):d.unknown(),o=d.array(i);return typeof n.minItems==\"number\"&&(o=o.min(n.minItems)),typeof n.maxItems==\"number\"&&(o=o.max(n.maxItems)),n.uniqueItems===!0&&(o=o.refine(s=>new Set(s.map(Jo)).size===s.length,{message:\"Array items must be unique\"})),ir(o,n,e,t,r)}switch(n.type){case\"string\":{let i=d.string();if(typeof n.minLength==\"number\"&&(i=i.min(n.minLength)),typeof n.maxLength==\"number\"&&(i=i.max(n.maxLength)),typeof n.pattern==\"string\")try{i=i.regex(new RegExp(n.pattern,\"u\"))}catch{}return ir(i,n,e,t,r)}case\"integer\":case\"number\":{let i=n.type===\"integer\"?d.number().int():d.number();return typeof n.minimum==\"number\"&&(i=i.min(n.minimum)),typeof n.maximum==\"number\"&&(i=i.max(n.maximum)),typeof n.exclusiveMinimum==\"number\"&&(i=i.gt(n.exclusiveMinimum)),typeof n.exclusiveMaximum==\"number\"&&(i=i.lt(n.exclusiveMaximum)),typeof n.multipleOf==\"number\"&&(i=i.multipleOf(n.multipleOf)),ir(i,n,e,t,r)}case\"boolean\":return ir(d.boolean(),n,e,t,r);case\"object\":{let i=n.properties,o;if(typeof i==\"object\"&&i!==null){let s=Array.isArray(n.required)?new Set(n.required.filter(u=>typeof u==\"string\")):new Set,a=d.object(Iu(i,s,!1,e,t,r));o=n.additionalProperties===!1||n.unevaluatedProperties===!1?a.strict():a.passthrough()}else o=d.record(d.unknown());return ir(o,n,e,t,r)}default:return ir(d.unknown(),n,e,t,r)}}function ma(n){return n===\"id\"||n===\"component\"||n===\"catalogId\"}function Iu(n,e,t=!1,r,i,o=new $n){let s={};for(let[a,c]of Object.entries(n)){if(t&&ma(a))continue;let u=Wi(typeof c==\"object\"&&c!==null?c:{},r,i?new Set(i):new Set,o);e.has(a)?u.safeParse(void 0).success?s[a]=u.refine(l=>l!==void 0,{message:\"Required\"}):s[a]=u:s[a]=u.optional()}return s}function la(n,e,t,r=new Set,i=!1){if(!n||typeof n!=\"object\")return[];let o=[],s=[],a=[];if(Array.isArray(n.allOf)){for(let u of n.allOf)if(!(!u||typeof u!=\"object\"))if(typeof u.$ref==\"string\"){let l=u.$ref;if(l.includes(\"common_types.json\")&&l.includes(\"ComponentCommon\")){let{accessibility:p,metadata:f}=Lo.shape;o.push({kind:\"zod\",properties:i?{accessibility:p,metadata:f}:{accessibility:p}})}else{let p=l.startsWith(\"#/\")?void 0:Cp(l),f=p instanceof d.ZodObject?void 0:t.resolve(l,e);if(p instanceof d.ZodObject)o.push({kind:\"zod\",properties:{...p.shape}});else if(!f)t.assertResolvable(l);else if(f.isPeer){if(!r.has(f.key)){let m=$u(f);m||ga(l);let g=new Set(r).add(f.key);s.push(...la(m.target,m.doc,t,g,i))}}else if(!r.has(f.key)){r.add(f.key);let m=Hi(e,f.pointer);m&&s.push(...la(m,e,t,r,i))}}}else a.push(...la(u,e,t,r,i))}let c=[...o,...s,...a];return n.properties&&c.push({kind:\"json\",schema:n,rootDoc:e}),c}function Dp(n,e,t=!0,r=new $n,i=!1){let o={},s=la(n,e,r.scope,void 0,i),a=new Set;for(let l of s)l.kind===\"json\"&&Array.isArray(l.schema.required)&&l.schema.required.forEach(p=>{typeof p==\"string\"&&a.add(p)});for(let l of s){if(l.kind===\"zod\"){for(let[f,m]of Object.entries(l.properties))t&&ma(f)||(o[f]=m);continue}let p=Iu(l.schema.properties||{},a,t,l.rootDoc,void 0,r);Object.assign(o,p)}let c=d.object(o);return n.unevaluatedProperties===!0||typeof n.unevaluatedProperties==\"object\"&&n.unevaluatedProperties!==null||n.additionalProperties===!0||typeof n.additionalProperties==\"object\"&&n.additionalProperties!==null?c.passthrough():c.strict()}function Fu(n){if(!n||typeof n!=\"object\"||Array.isArray(n))return!1;let e=n;return Object.keys(e).length>0&&e.properties===void 0&&typeof e.type!=\"string\"&&!(\"$ref\"in e)&&!(\"allOf\"in e)&&!(\"oneOf\"in e)&&!(\"anyOf\"in e)&&!(\"not\"in e)&&Object.values(e).every(t=>t!==null&&(typeof t==\"object\"||typeof t==\"boolean\"))}function lp(n){return n.unevaluatedProperties===!0||typeof n.unevaluatedProperties==\"object\"&&n.unevaluatedProperties!==null||n.additionalProperties===!0||typeof n.additionalProperties==\"object\"&&n.additionalProperties!==null}function da(n,e,t,r=new Set){let i={schemas:[],hasUnresolvable:!1};if(!n||typeof n!=\"object\"||Array.isArray(n))return i;if(Fu(n))return i.schemas.push({schema:{type:\"object\",properties:n},doc:e}),i;let o=s=>{i.schemas.push(...s.schemas),s.hasUnresolvable&&(i.hasUnresolvable=!0)};if(typeof n.$ref==\"string\"){let s=n.$ref,a=e?t.resolve(s,e):void 0;if(!a||!e)e&&t.assertResolvable(s),i.hasUnresolvable=!0;else if(a.isPeer){if(!r.has(a.key)){let c=$u(a);c||ga(s);let u=new Set(r).add(a.key);o(da(c.target,c.doc,t,u))}}else if(!r.has(a.key)){r.add(a.key);let c=Hi(e,a.pointer);c?o(da(c,e,t,r)):i.hasUnresolvable=!0}}if(Array.isArray(n.allOf))for(let s of n.allOf)s&&typeof s==\"object\"&&!Array.isArray(s)&&o(da(s,e,t,r));return(Array.isArray(n.anyOf)||Array.isArray(n.oneOf))&&(i.hasUnresolvable=!0),(n.properties||n.required||n.additionalProperties!==void 0||n.unevaluatedProperties!==void 0)&&i.schemas.push({schema:n,doc:e}),i}function dp(n,e,t=new $n){let r=da(n,e,t.scope),i=new Set;for(let{schema:c}of r.schemas)if(Array.isArray(c.required))for(let u of c.required)typeof u==\"string\"&&i.add(u);let o={};for(let{schema:c,doc:u}of r.schemas)if(c.properties&&typeof c.properties==\"object\"&&!Array.isArray(c.properties)){let l=Iu(c.properties,i,!1,u,void 0,t);Object.assign(o,l)}let s=d.object(o);return r.hasUnresolvable||r.schemas.some(({schema:c})=>lp(c))||lp(n)?s.passthrough():s.strict()}function fp(n,e){if(!n||typeof n!=\"object\"||Array.isArray(n))return[];let t=n,r=[],i=new Set,o=s=>{if(!s||typeof s!=\"object\"||Array.isArray(s))return;let a=s;if(typeof a.$ref==\"string\"&&e&&a.$ref.startsWith(\"#/\")&&!i.has(a.$ref)){i.add(a.$ref);let c=Hi(e,a.$ref);c&&o(c)}if(a.properties&&typeof a.properties==\"object\"&&a.properties!==null&&!Array.isArray(a.properties)&&r.push(...Object.keys(a.properties)),Array.isArray(a.allOf))for(let c of a.allOf)o(c)};return t.properties&&typeof t.properties==\"object\"&&t.properties!==null&&!Array.isArray(t.properties)||Array.isArray(t.allOf)||typeof t.$ref==\"string\"?(o(t),r):Fu(t)?Object.keys(t):[]}function p_(n,e,t,r=!1){let i=[];if(!n)return i;let o=(s,a)=>{if(r){Go(s,`function identifier: '${s}'`);for(let c of a)Go(c,`argument identifier: '${c}' in function '${s}'`)}};if(Array.isArray(n)){for(let s of n)if(s&&typeof s==\"object\"&&typeof s.name==\"string\"){let a=fp(s.parameters,e);if(o(s.name,a),t&&!t.has(s.name))continue;let c=u=>{let l=new Vo(s.name,s,p=>p.parameters&&typeof p.parameters==\"object\"?dp(p.parameters,e,new $n(u)):d.record(d.unknown()));return ha.set(l,c),l};i.push(c([]))}return i}if(typeof n==\"object\"&&n!==null)for(let[s,a]of Object.entries(n)){let u=pp(a&&typeof a==\"object\"?a:{}),l=fp(u,e);if(o(s,l),t&&!t.has(s)||!a||typeof a!=\"object\")continue;let p=f=>{let m=new Vo(s,a,g=>{let h=pp(g);return h?dp(h,e,new $n(f)):d.record(d.unknown())});return ha.set(m,p),m};i.push(p([]))}return i}function pp(n){let e=n.properties&&typeof n.properties==\"object\"&&n.properties!==null&&!Array.isArray(n.properties)?n.properties:void 0,t=e?.args??n.args??n.parameters;return!t&&e&&!(\"call\"in e)&&!(\"@call\"in e)&&!(\"function\"in e)?t=n:Fu(t)&&(t={type:\"object\",properties:t,required:n.required,additionalProperties:n.additionalProperties}),t&&typeof t==\"object\"&&!Array.isArray(t)?t:void 0}function hp(n,e){if(!Array.isArray(n))return;let t=new Set;for(let r of n)if(typeof r?.$ref==\"string\"&&r.$ref.startsWith(e)){let o=r.$ref.slice(e.length).replace(/~([01])/g,(s,a)=>a===\"1\"?\"/\":\"~\");t.add(o)}return t}function h_(n,e,t,r){let i=[];for(let[o,s]of Object.entries(n)){let a=s||{};if(t){Go(o,`component identifier: '${o}'`);let u=a.properties;if(u&&typeof u==\"object\")for(let l of Object.keys(u))Go(l,`property identifier: '${l}' in component '${o}'`)}if(r&&!r.has(o))continue;let c=u=>{let l=new ta(o,a,p=>Dp(p,e,!0,new $n(u),t));return ha.set(l,c),l};i.push(c([]))}return i}function m_(n,e){let t=n.theme??n.themeSchema??n.styles??e?.theme;if(t&&typeof t==\"object\"){let r=t,i=\"properties\"in r||\"allOf\"in r||r.type===\"object\"?r:{type:\"object\",properties:r},o=Dp(i,n,!1);return i.additionalProperties===!1||i.unevaluatedProperties===!1?o:o.passthrough()}}function wp(n,e,t){let r=Re(n),i=t??r.catalogId??r.$id??r.id;if(!i||typeof i!=\"string\")throw new Error(\"Catalog ID must be specified via catalog metadata ('catalogId' or '$id').\");let o=r.$defs,s=o?.anyComponent,a=hp(s?.oneOf,\"#/components/\"),c=e??r.protocolVersion??a_,u=ge(c,\"1.0\"),l=r.components??{},p=h_(l,r,u,a),f=o?.anyFunction,m=hp(f?.oneOf,\"#/functions/\"),g=p_(r.functions,r,m,u),h=m_(r,o);return rr(r),{id:i,protocolVersion:c,components:p,functions:g,themeSchema:h,...y_(r,p,g)}}var mp={$schema:\"schemaUri\",$id:\"schemaId\",title:\"title\",description:\"description\",instructions:\"instructions\"},g_=new Set([\"protocolVersion\",\"catalogId\",\"components\"]);function ua(n){return typeof n==\"object\"&&n!==null&&!Array.isArray(n)}function gp(n,e){return Jo(n)===Jo(e)}function y_(n,e,t){let r={},i={};for(let[o,s]of Object.entries(n))if(o in mp&&typeof s==\"string\")r[mp[o]]=s;else if(o===\"protocolVersion\"&&typeof s==\"string\")r.declaredProtocolVersion=s;else if(o===\"functions\"&&(Array.isArray(s)||ua(s)))r.functionsLayout=Array.isArray(s)?\"list\":\"map\";else if(o===\"$defs\"&&ua(s)){let a=gp(s.anyComponent,Cu(e.map(l=>l.name))),c=gp(s.anyFunction,Du(t.map(l=>l.name)));r.unions={anyComponent:a,anyFunction:c};let u={};for(let[l,p]of Object.entries(s))l===\"anyComponent\"&&a||l===\"anyFunction\"&&c||(u[l]=p);r.defs=Object.freeze(u)}else(!g_.has(o)||o===\"components\"&&!ua(s))&&(i[o]=s);return r.declaredProtocolVersion??=null,r.declaresCatalogId=typeof n.catalogId==\"string\",r.declaresComponents=ua(n.components),r.unions??={anyComponent:!1,anyFunction:!1},Object.keys(i).length>0&&(r.extensionFields=Object.freeze(i)),r}function b_(n,e){return e?.standardDefs?e.standardDefs:gu(e?.protocolVersion??n.protocolVersion)}var Nu=/^[^#]+#\\/(?:\\$defs|definitions)\\/([^/]+)(\\/.*)?$/;function Sp(n){let e=Nu.exec(n);return e?`#/$defs/${e[1]}${e[2]??\"\"}`:`#/$defs/${n.split(\"/\").pop()}`}function v_(n){if(n.startsWith(\"#/$defs/\"))return n.substring(8).split(\"/\")[0].replace(/~1/g,\"/\").replace(/~0/g,\"~\")}function __(n){if(typeof n.description!=\"string\"||!n.description.startsWith(\"REF:\"))return!1;let e=n.description.substring(4),t=e.indexOf(\"|\"),r=t===-1?e:e.substring(0,t),i=t===-1?\"\":e.substring(t+1),o=n.default;for(let s of Object.keys(n))delete n[s];return n.$ref=r.startsWith(\"#\")?r:Sp(r),o!==void 0&&(n.default=o),i&&(n.description=i),!0}function x_(n,e={}){if(Array.isArray(n.allOf)){let t=n.allOf.filter(i=>!(typeof i==\"object\"&&i!==null&&Object.keys(i).length===0)),r=t.length===1?t[0]:void 0;typeof r==\"object\"&&r!==null&&!Array.isArray(r)&&Object.keys(r).every(i=>!(i in n)||i===\"allOf\")?(delete n.allOf,Object.assign(n,r)):t.length===0?delete n.allOf:n.allOf=t}Array.isArray(n.anyOf)&&(n.oneOf=n.anyOf,delete n.anyOf),e.stripAdditionalProperties?(delete n.additionalProperties,delete n.unevaluatedProperties):(n.additionalProperties&&typeof n.additionalProperties==\"object\"&&Object.keys(n.additionalProperties).length===0&&(n.additionalProperties=!0),n.unevaluatedProperties&&typeof n.unevaluatedProperties==\"object\"&&Object.keys(n.unevaluatedProperties).length===0&&(n.unevaluatedProperties=!0)),\"$schema\"in n&&delete n.$schema}function In(n,e=new Set,t={}){if(typeof n!=\"object\"||n===null||e.has(n))return;if(e.add(n),Array.isArray(n)){for(let i of n)In(i,e,t);return}let r=n;if(!__(r)){x_(r,t);for(let i of Object.keys(r))In(r[i],e,t)}}function it(n){return typeof n==\"object\"&&n!==null&&!Array.isArray(n)}var A_=new Set([\"description\",\"title\",\"default\",\"deprecated\",\"readOnly\",\"writeOnly\",\"examples\"]),Ep=new Set([\"id\",\"component\",\"catalogId\"]),C_=new Set([\"anyComponent\",\"anyFunction\",\"theme\"]),D_=/^(?:([^#]*common_types\\.json))?#\\/\\$defs\\/([^/]+)(\\/.*)?$/,w_=/\\/(ComponentCommon|Checkable)$/;function Ru(n,e,t,r=\"\"){if(n.$ref=`#/$defs/${e}${r}`,r||n.description!==void 0)return;let i=t[e];it(i)&&typeof i.description==\"string\"&&(n.description=i.description)}function Xo(n,e,t){if(Array.isArray(n)){for(let o of n)Xo(o,e,t);return}if(!it(n))return;let r=n.$ref,i=typeof r==\"string\"?D_.exec(r):null;if(i){let[,o,s,a]=i;if(o!==void 0||s in e){if(t){for(let c of Object.keys(n))c!==\"$ref\"&&!A_.has(c)&&delete n[c];Ru(n,s,e,a);return}Ru(n,s,e,a)}}for(let o of Object.values(n))Xo(o,e,t)}function E_(n,e){if(!e.startsWith(\"#/\"))return;let t=n;for(let r of e.substring(2).split(\"/\")){let i=r.replace(/~([01])/g,(o,s)=>s===\"1\"?\"/\":\"~\");if(!it(t)||!(i in t))return;t=t[i]}return t}function ya(n,e,t){let r=[],i=[],o=[];for(let a of Array.isArray(n.allOf)?n.allOf:[]){if(!it(a))continue;let c=a.$ref;if(typeof c!=\"string\"){r.push(...ya(a,e,t));continue}let u=w_.exec(c)?.[1],l=c.startsWith(\"#/\")?E_(e.rootDoc,c):void 0;if(u===void 0&&it(l)){t.has(c)||(t.add(c),i.push(...ya(l,e,t)));continue}if(u===void 0&&!c.startsWith(\"#/\")&&e.peers.length>0&&!t.has(c)){let g=Yo(a,e.rootDoc,e.peers,{inlineLocalDefs:!1,visited:t});if(it(g)&&g.$ref!==c){let h=new Set(t);h.add(c),i.push(...ya(g,e,h));continue}}let p=Nu.exec(c),f=u??(p&&!p[2]?p[1]:void 0),m=f!==void 0?e.standardDefs[f]:void 0;it(m)&&it(m.properties)&&o.push({properties:Re(m.properties),...Array.isArray(m.required)?{required:m.required}:{}})}let s=[...o,...i,...r];return(\"properties\"in n||\"description\"in n)&&s.push(n),s}function S_(n,e){let t=ya(n,e,new Set),r,i={},o=new Set;for(let a of t)if(typeof a.description==\"string\"&&(r=a.description),it(a.properties)&&Object.assign(i,a.properties),Array.isArray(a.required))for(let c of a.required)typeof c==\"string\"&&o.add(c);let s={};for(let[a,c]of Object.entries(i)){if(Ep.has(a))continue;let u=Yo(Re(c),e.rootDoc,e.peers,{inlineLocalDefs:!1});Xo(u,e.standardDefs,!0),s[a]=u}return{props:s,required:[...o].filter(a=>!Ep.has(a)).sort(),...r!==void 0?{description:r}:{}}}function T_(n,e){let t=e.model.functions.get(n);if(!t)return;let r=it(t.properties)?t.properties:void 0,i=r?.args??t.args??t.parameters;if(i!==void 0)return it(i)?Object.keys(i).length>0&&!(\"properties\"in i)&&!(\"type\"in i)?{type:\"object\",properties:i,...t.required!==void 0?{required:t.required}:{},...t.additionalProperties!==void 0?{additionalProperties:t.additionalProperties}:{}}:i:{};let o=r&&(\"call\"in r||\"@call\"in r||\"function\"in r);if(!r||o)return{};let{description:s,title:a,name:c,returnType:u,allowedCallers:l,requiresUserActivation:p,...f}=t;return f}function k_(n){let e=_u.map(t=>n.extensionFields[t]).find(t=>t!==void 0)??n.defs.theme;if(it(e))return\"properties\"in e||\"allOf\"in e||e.type===\"object\"?e:{type:\"object\",properties:e}}function $_(n){return(ke(n.protocolVersion)??n.protocolVersion)===\"0.8\"||n.id.includes(\"v0_8\")||n.id.includes(\"v0.8\")}function I_(n,e,t,r){if(!n.themeSchema)return;let i=$_(n),o=k_(r.model);if(o){let u=Re({...o});!i&&u.additionalProperties===void 0&&u.unevaluatedProperties===void 0&&(u.additionalProperties=!0),e.theme=u;return}let s=_t(n.themeSchema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});In(s),Mu(s,e,t);let a=s.additionalProperties===!1,c={type:\"object\",...typeof s.description==\"string\"&&!s.description.startsWith(\"REF:\")?{description:s.description}:{},properties:s.properties||{},...Array.isArray(s.required)&&s.required.length>0?{required:s.required}:{},...a?{additionalProperties:!1}:i?{}:{additionalProperties:s.additionalProperties!==void 0?s.additionalProperties:!0}};t.push(c),e.theme=c}function Mu(n,e,t){let r=it(n.definitions)?n.definitions:it(n.$defs)?n.$defs:void 0;delete n.definitions,delete n.$defs,r&&(Object.assign(e,r),t.push(r))}function F_(n,e,t){if(!n.schema||typeof n.schema!=\"object\"||!(\"safeParse\"in n.schema))return{props:{},reqList:[],additionalProps:void 0};let r=_t(n.schema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});In(r),Mu(r,e,t);let i=r.properties||{},o=Array.isArray(r.required)?r.required.filter(c=>c!==\"component\"&&c!==\"id\"):[],s=r.unevaluatedProperties??r.additionalProperties,a=typeof s==\"boolean\"||it(s)?s:void 0;return{props:i,reqList:o,additionalProps:a}}function R_(n){let e=n.schema?.description;return typeof e==\"string\"&&!e.startsWith(\"REF:\")?e:void 0}function O_(n){return n.unevaluatedProperties??n.additionalProperties}function N_(n,e,t,r,i,o){let s,a,c,u,l=i.model.components.get(n);if(l)({props:s,required:a,description:c}=S_(l,i)),u=O_(l)??(i.isV10?void 0:!1);else{let y=F_(e,t,r),{component:v,id:x,...$}=y.props;r.push($),s=$,a=y.reqList,c=R_(e),u=i.isV10?void 0:y.additionalProps??!1}let p={};Ru(p,\"ComponentId\",i.standardDefs);let f={id:p,...s,component:{const:n}},m=[\"id\",...a,\"component\"],g=u!==void 0?{unevaluatedProperties:u}:{},h;return o?.componentEnvelopeRef?h={...c!==void 0?{description:c}:{},allOf:[{$ref:o.componentEnvelopeRef},{type:\"object\",properties:f,required:m}],...g}:h={type:\"object\",...c!==void 0?{description:c}:{},properties:f,required:m,...g},e.allowedParents&&e.allowedParents.length>0&&(h.allowedParents=e.allowedParents),e.allowedChildren&&e.allowedChildren.length>0&&(h.allowedChildren=e.allowedChildren),h}function M_(n,e,t,r,i,o){if(n.components.size===0){e.components={};return}let s={};for(let[a,c]of n.components.entries())s[a]=N_(a,c,t,r,i,o);e.components=s,t.anyComponent={oneOf:Array.from(n.components.keys()).map(a=>({$ref:`#/components/${a}`})),discriminator:{propertyName:\"component\"}}}function j_(n,e,t,r,i){let o,s=T_(n,i);if(s)o=Yo(Re(s),i.rootDoc,i.peers,{inlineLocalDefs:!1}),Xo(o,i.standardDefs,!1);else if(e.schema&&typeof e.schema==\"object\"&&\"safeParse\"in e.schema){let a=_t(e.schema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});In(a),Mu(a,t,r),r.push(a),o=a}else o={type:\"object\",properties:{}};if(o.type===\"object\"){let a=o.additionalProperties;delete o.additionalProperties,o.unevaluatedProperties=o.unevaluatedProperties??a??!1}return o}function P_(n,e,t,r,i){let o=j_(n,e,t,r,i),s=Array.isArray(o.required)&&o.required.length>0,a=i.isV10?\"@call\":\"call\",c=s?[a,\"args\"]:[a];return i.isV10?{type:\"object\",...e.description?{description:e.description}:{},returnType:e.returnType,...e.allowedCallers!==void 0?{allowedCallers:e.allowedCallers}:{},...e.requiresUserActivation!==void 0?{requiresUserActivation:e.requiresUserActivation}:{},properties:{\"@call\":{const:n},args:o},required:c}:{type:\"object\",...e.description?{description:e.description}:{},properties:{call:{const:n},args:o,returnType:{const:e.returnType}},required:c,unevaluatedProperties:!1}}function L_(n,e,t,r,i){let o=Array.from(n.functions.keys()).filter(a=>!a.startsWith(\"@\"));if(o.length===0)return;let s={};for(let a of o)s[a]=P_(a,n.functions.get(a),t,r,i);e.functions=s,t.anyFunction={oneOf:o.map(a=>({$ref:`#/functions/${a}`}))}}var B_=new Map(Object.values(cf).flatMap(n=>{let e=n.description;if(typeof e!=\"string\"||!e.startsWith(\"REF:\"))return[];let t=e.substring(4),r=t.indexOf(\"|\");return r===-1?[]:[[t.substring(0,r).split(\"/\").pop(),t.substring(r+1)]]}));function Gi(n,e,t=new Set){if(typeof n!=\"object\"||n===null||t.has(n))return;if(t.add(n),Array.isArray(n)){for(let o of n)Gi(o,e,t);return}let r=n,i=r.$ref;if(typeof i==\"string\"&&!i.startsWith(\"#\")&&i!==e){if(!Nu.test(i))throw new Error(`Cannot bundle the external schema reference '${i}'.`);r.$ref=Sp(i)}for(let o of Object.values(r))Gi(o,e,t)}function Ou(n,e,t=new Set){if(typeof n!=\"object\"||n===null||t.has(n))return;if(t.add(n),Array.isArray(n)){for(let o of n)Ou(o,e,t);return}let r=n,i=r.$ref;if(typeof i==\"string\"&&i.startsWith(\"#/$defs/\")){let o=i.substring(8),s=o.includes(\"/\")?void 0:e[o],a=r.description===void 0||r.description===B_.get(o);s&&a&&(typeof s.description==\"string\"?r.description=s.description:delete r.description)}for(let o of Object.values(r))Ou(o,e,t)}function ba(n,e,t=new Set){if(!(typeof n!=\"object\"||n===null)&&!t.has(n)){if(t.add(n),typeof n.$ref==\"string\"){let r=v_(n.$ref);r!==void 0&&e.add(r)}if(Array.isArray(n))for(let r of n)ba(r,e,t);else for(let r of Object.values(n))ba(r,e,t)}}function Tp(n,e){let t={$schema:\"https://json-schema.org/draft/2020-12/schema\",...typeof n.declaredProtocolVersion==\"string\"?{protocolVersion:n.declaredProtocolVersion.trim().replace(/^[vV](?=\\d)/,\"\")}:{},catalogId:n.id};n.instructions&&(t.instructions=n.instructions);let r=b_(n,e),i=e?.protocolVersion??n.protocolVersion,o=wu(n),s=o.defs,a={standardDefs:r,model:o,defs:s,rootDoc:{$defs:s,components:Object.fromEntries(o.components),functions:Object.fromEntries(o.functions)},peers:n.peerCatalogs??[],isV10:!!i&&ge(i,\"1.0\")},c={},u=[];I_(n,c,u,a),M_(n,t,c,u,a,e),L_(n,t,c,u,a),Gi(t,e?.componentEnvelopeRef),Gi(c);for(let p of u)Ou(p,r);let l;do{l=Object.keys(c).length;let p=new Set;ba(t,p),ba(c,p),(p.has(\"DynamicString\")||p.has(\"DynamicNumber\")||p.has(\"DynamicBoolean\")||p.has(\"DynamicValue\"))&&(p.add(\"DataBinding\"),p.add(\"FunctionCall\"));for(let f of p)if(!(f in c)){if(f in r){let m=Re(r[f]);Gi(m),c[f]=m}else if(!C_.has(f)&&f in s){let m=Re(s[f]);Xo(m,r,!1),Gi(m),c[f]=m}}p.has(\"anyFunction\")&&!(\"anyFunction\"in c)&&(c.anyFunction={not:{}})}while(Object.keys(c).length>l);return Object.keys(c).length>0&&(t.$defs=c),t}function Kr(n){if(!n)return\"\";let e=n.lastIndexOf(\"#\");return(e!==-1?n.slice(e+1):n).split(\"/\").filter(Boolean).pop()??\"\"}function kp(n,e){if(!n?._def)return null;if(e){if(e.has(n))return null;e.add(n)}switch(n._def.typeName){case\"ZodOptional\":case\"ZodNullable\":case\"ZodDefault\":case\"ZodReadonly\":return n._def.innerType;case\"ZodBranded\":return n._def.type;case\"ZodEffects\":return n._def.schema;case\"ZodLazy\":return n._def.getter();default:return null}}function V_(n){let e=[],t=new Set,r=n;for(;r;){r.description&&e.push(r.description),r._def?.description&&e.push(r._def.description);let i=kp(r,t);if(!i)break;r=i}return e}function Jr(n){let e=new Set,t=n;for(;t;){let r=kp(t,e);if(!r)break;t=r}return t}function U_(n,e){if(!n)return null;let t=Kr(n),r=e.childListRefNames,i=e.childRefNames;return r.has(t)?{isChild:!1,isChildList:!0}:i.has(t)?{isChild:!0,isChildList:!1}:null}function z_(n,e){let t=!1;for(let r of n){if(typeof r!=\"object\"||r===null)continue;let i=ju(r,e);if(i.isChildList)return{isChild:!1,isChildList:!0};i.isChild&&(t=!0)}return t?{isChild:!0,isChildList:!1}:null}function q_(n,e){let t=!1;for(let r of[\"oneOf\",\"anyOf\",\"allOf\"]){let i=n[r];if(!Array.isArray(i))continue;let o=z_(i,e);if(o?.isChildList)return o;o?.isChild&&(t=!0)}return t?{isChild:!0,isChildList:!1}:null}function ju(n,e){let t=typeof n.$ref==\"string\"?n.$ref:\"\",r=U_(t,e);if(r)return r;if(n.type===\"array\"&&n.items){let o=ju(n.items,e);if(o.isChild||o.isChildList)return{isChild:!1,isChildList:!0}}let i=q_(n,e);return i||(n.type===\"object\"&&n.properties&&(\"componentId\"in n.properties&&(\"path\"in n.properties||\"dataBinding\"in n.properties)||\"explicitList\"in n.properties||\"template\"in n.properties)?{isChild:!1,isChildList:!0}:{isChild:!1,isChildList:!1})}function Z_(n){if(n?._def?.typeName===\"ZodObject\"&&typeof n._def.shape==\"function\"){let e=n._def.shape();return!!(e.componentId&&(e.path||e.dataBinding)||e.explicitList||e.template)}return!1}function W_(n,e){if(n?._def?.typeName===\"ZodArray\"){let t=Jr(n._def.type);return Yr(t,e).isChild}return!1}function H_(n,e){let t=!1,r=!1,i=!1;for(let o of n){let s=Jr(o);Z_(s)&&(t=!0),W_(s,e)&&(r=!0);let a=Yr(s,e);if(a.isChildList)return{isChild:!1,isChildList:!0};a.isChild&&(i=!0)}return t||r?{isChild:!1,isChildList:!0}:i?{isChild:!0,isChildList:!1}:{isChild:!1,isChildList:!1}}function G_(n,e){if(!n)return!1;if(n.startsWith(\"REF:\")){let i=Kr(n.substring(4).split(\"|\")[0]);if(e.has(i))return!0}let t=Kr(n.split(\"|\")[0]);if(t&&e.has(t))return!0;let r=n.trim();return!!e.has(r)}function K_(n,e){if(!n)return!1;if(n.startsWith(\"REF:\")){let i=Kr(n.substring(4).split(\"|\")[0]);if(e.has(i))return!0}let t=Kr(n.split(\"|\")[0]);if(t&&e.has(t))return!0;let r=n.trim();return!!e.has(r)}function J_(n,e){let t=e.childListRefNames,r=e.childRefNames;for(let i of n){if(G_(i,t))return{isChild:!1,isChildList:!0};if(K_(i,r))return{isChild:!0,isChildList:!1}}return null}function Y_(n,e){let t=Yr(n,e);return t.isChild||t.isChildList?{isChild:!1,isChildList:!0}:{isChild:!1,isChildList:!1}}function Yr(n,e){if(!n||typeof n!=\"object\")return{isChild:!1,isChildList:!1};let t=er(n);if(t===\"component-id\")return{isChild:!0,isChildList:!1};if(t===\"child-list\")return{isChild:!1,isChildList:!0};let r=J_(V_(n),e);if(r)return r;let i=Jr(n);if(!i?._def)return ju(n,e);let o=er(i);if(o===\"component-id\")return{isChild:!0,isChildList:!1};if(o===\"child-list\")return{isChild:!1,isChildList:!0};let s=i._def.typeName;if(s===\"ZodArray\"){let a=Jr(i._def.type);return Y_(a,e)}if(s===\"ZodUnion\"){let a=i._def.options??[];return H_(a,e)}if(s===\"ZodObject\"&&typeof i._def.shape==\"function\"){let a=i._def.shape();if(a.componentId&&(a.path||a.dataBinding)||a.explicitList||a.template)return{isChild:!1,isChildList:!0}}return{isChild:!1,isChildList:!1}}function $p(n,e,t){let r=n.nestedRefs[e];if(r){r.add(t);return}n.nestedRefs[e]=new Set([t])}function X_(n,e,t,r){let i=Yr(e,r);if(i.isChildList){t.listRefs.add(n);return}if(i.isChild){t.singleRefs.add(n);return}let o=Jr(e);if(o?._def?.typeName!==\"ZodArray\")return;let s=Jr(o._def.type);if(s?._def?.typeName!==\"ZodObject\"||typeof s._def.shape!=\"function\")return;let a=s._def.shape();for(let[c,u]of Object.entries(a)){let l=Yr(u,r);(l.isChild||l.isChildList)&&(t.listRefs.add(n),$p(t,n,c))}}function Q_(n){if(typeof n!=\"object\"||n===null)return null;let e=n;if(e.type!==\"array\"&&!(\"items\"in e))return null;let t=e.items;if(typeof t!=\"object\"||t===null)return null;let r=t.properties;return typeof r!=\"object\"||r===null?null:r}function ex(n,e,t){for(let[r,i]of Object.entries(n)){let o=Yr(i,t);if(o.isChildList){e.listRefs.add(r);continue}if(o.isChild){e.singleRefs.add(r);continue}let s=Q_(i);if(s)for(let[a,c]of Object.entries(s)){let u=Yr(c,t);(u.isChild||u.isChildList)&&(e.listRefs.add(r),$p(e,r,a))}}}function tx(n,e,t){if(!n)return;let r=Jr(n);if(r?._def?.typeName===\"ZodObject\"&&typeof r._def.shape==\"function\"){let i=r._def.shape();for(let[o,s]of Object.entries(i))X_(o,s,e,t);return}if(typeof n==\"object\"&&n!==null&&\"properties\"in n){let i=n.properties;typeof i==\"object\"&&i!==null&&ex(i,e,t)}}function Ip(n,e){let t={},r=typeof n?.components?.values==\"function\"?Array.from(n.components.values()):Array.isArray(n)?n:Array.from(n.values());for(let i of r){let o={singleRefs:new Set,listRefs:new Set,nestedRefs:{}};tx(i.schema,o,e),t[i.name]={singleRefs:o.singleRefs,listRefs:o.listRefs,nestedRefs:o.nestedRefs}}return t}var nx=Symbol.for(\"preact-signals\");function Aa(){if(Fn>1)Fn--;else{var n,e=!1;for((function(){var i=_a;for(_a=void 0;i!==void 0;){var o=i.S;if(o.v===i.v)for(var s=o.t;s!==void 0;s=s.x)s.i===i.i&&(s.i=o.i);i=i.o}})();es!==void 0;){var t=es;for(es=void 0,va++;t!==void 0;){var r=t.u;if(t.u=void 0,t.f&=-3,!(8&t.f)&&Np(t))try{t.c()}catch(i){e||(n=i,e=!0)}t=r}}if(va=0,Fn--,e)throw n}}function Fp(n){if(Fn>0)return n();Pu=++rx,Fn++;try{return n()}finally{Aa()}}var Qo,_e=void 0;function Ca(n){var e=_e,t=Qo;_e=void 0,Qo=void 0;try{return n()}finally{_e=e,Qo=t}}var es=void 0,Fn=0,va=0,rx=0,Pu=0,_a=void 0,xa=0;function Rp(n){if(_e!==void 0){var e=n.n;if(e===void 0||e.t!==_e)return e={i:0,S:n,p:_e.s,n:void 0,t:_e,e:void 0,x:void 0,r:e},_e.s!==void 0&&(_e.s.n=e),_e.s=e,n.n=e,32&_e.f&&n.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=_e.s,e.n=void 0,_e.s.n=e,_e.s=e),e}}function ot(n,e){this.v=n,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}ot.prototype.brand=nx;ot.prototype.h=function(){return!0};ot.prototype.S=function(n){var e=this,t=this.t;t!==n&&n.e===void 0&&(n.x=t,this.t=n,t!==void 0?t.e=n:Ca(function(){var r;(r=e.W)==null||r.call(e)}))};ot.prototype.U=function(n){var e=this;if(this.t!==void 0){var t=n.e,r=n.x;t!==void 0&&(t.x=r,n.e=void 0),r!==void 0&&(r.e=t,n.x=void 0),n===this.t&&(this.t=r,r===void 0&&Ca(function(){var i;(i=e.Z)==null||i.call(e)}))}};ot.prototype.subscribe=function(n){var e=this;return Bu(function(){var t=e.value;Ca(function(){return n(t)})},{name:\"sub\"})};ot.prototype.valueOf=function(){return this.value};ot.prototype.toString=function(){return this.value+\"\"};ot.prototype.toJSON=function(){return this.value};ot.prototype.peek=function(){var n=this;return Ca(function(){return n.value})};Object.defineProperty(ot.prototype,\"value\",{get:function(){var n=Rp(this);return n!==void 0&&(n.i=this.i),this.v},set:function(n){if(n!==this.v){if(va>100)throw new Error(\"Cycle detected\");(function(t){Fn!==0&&va===0&&t.l!==Pu&&(t.l=Pu,_a={S:t,v:t.v,i:t.i,o:_a})})(this),this.v=n,this.i++,xa++,Fn++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Aa()}}}});function Op(n,e){return new ot(n,e)}function Np(n){for(var e=n.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function Mp(n){for(var e=n.s;e!==void 0;e=e.n){var t=e.S.n;if(t!==void 0&&(e.r=t),e.S.n=e,e.i=-1,e.n===void 0){n.s=e;break}}}function jp(n){for(var e=n.s,t=void 0;e!==void 0;){var r=e.p;e.i===-1?(e.S.U(e),r!==void 0&&(r.n=e.n),e.n!==void 0&&(e.n.p=r)):t=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=r}n.s=t}function Rn(n,e){ot.call(this,void 0,e),this.x=n,this.s=void 0,this.g=xa-1,this.f=4}Rn.prototype=new ot;Rn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===xa))return!0;if(this.g=xa,this.f|=1,this.i>0&&!Np(this))return this.f&=-2,!0;var n=_e;try{Mp(this),_e=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return _e=n,jp(this),this.f&=-2,!0};Rn.prototype.S=function(n){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}ot.prototype.S.call(this,n)};Rn.prototype.U=function(n){if(this.t!==void 0&&(ot.prototype.U.call(this,n),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};Rn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var n=this.t;n!==void 0;n=n.x)n.t.N()}};Object.defineProperty(Rn.prototype,\"value\",{get:function(){if(1&this.f)throw new Error(\"Cycle detected\");var n=Rp(this);if(this.h(),n!==void 0&&(n.i=this.i),16&this.f)throw this.v;return this.v}});function Pp(n,e){return new Rn(n,e)}function Lp(n){var e=n.j;if(n.j=void 0,typeof e==\"function\"){Fn++;var t=_e;_e=void 0;try{e()}catch(r){throw n.f&=-2,n.f|=8,Lu(n),r}finally{_e=t,Aa()}}}function Lu(n){for(var e=n.s;e!==void 0;e=e.n)e.S.U(e);n.x=void 0,n.s=void 0,Lp(n)}function ix(n){if(_e!==this)throw new Error(\"Out-of-order effect\");jp(this),_e=n,this.f&=-2;try{8&this.f&&Lu(this)}finally{Aa()}}function Ki(n,e){this.x=n,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=e?.name,Qo&&Qo.push(this)}Ki.prototype.c=function(){var n=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e==\"function\"&&(this.j=e)}finally{n()}};Ki.prototype.S=function(){if(1&this.f)throw new Error(\"Cycle detected\");this.f|=1,this.f&=-9,Lp(this),Mp(this),Fn++;var n=_e;return _e=this,ix.bind(this,n)};Ki.prototype.N=function(){2&this.f||(this.f|=2,this.u=es,es=this)};Ki.prototype.d=function(){this.f|=8,1&this.f||Lu(this)};Ki.prototype.dispose=function(){this.d()};function Bu(n,e){var t=new Ki(n,e);try{t.c()}catch(i){throw t.d(),i}var r=t.d.bind(t);return r[Symbol.dispose]=r,r}var Bp,Vp,Up,zp,qp,Zp,Wp,Hp,Gp={signal:Op,computed:Pp,effect:Bu,batchWrite:Fp,isSignal:n=>!!n&&typeof n==\"object\"&&\"value\"in n&&\"peek\"in n,getValue:n=>n.value,setValue:(n,e)=>{n instanceof Rn||(n.value=e)},peekValue:n=>n.peek()};Kp(Gp);function Kp(n){Bp=n.signal,Vp=n.computed,Up=n.effect,zp=n.batchWrite,qp=n.isSignal,Zp=n.getValue,Wp=n.setValue,Hp=n.peekValue}function Ke(n){return Bp(n)}function Xr(n){return Vp(n)}function ln(n){return Up(n)}function Da(n){return zp(n)}function On(n){return qp(n)}function Be(n){return Zp(n)}function Je(n,e){Wp(n,e)}function Ye(n){return Hp(n)}function ts(n){return/^(0|[1-9]\\d*)$/.test(n)}var or=1e4,ox=new Set([\"__proto__\",\"constructor\",\"prototype\"]),sr=class{constructor(e={}){this.data={},this.signals=new Map,this.subscriptions=new Set,this.data=e}getSignal(e){let t=this.normalizePath(e);return this.signals.has(t)||this.signals.set(t,Ke(this.get(t))),this.signals.get(t)}set(e,t){if(e==null)throw new nt(\"Path cannot be null or undefined.\");let r=this.parsePath(e);if(r.length===0)return this.data=t??{},this.notifyAllSignals(),this;let i=r.pop();if(t==null&&this.get(e)===void 0)return this;if(this.data===void 0||this.data===null)this.data={};else if(typeof this.data!=\"object\")throw new nt(`Cannot set path '${e}': the data model root is a primitive value.`,e);let o=this.data;for(let s=0;s<r.length;s++){let a=r[s];if(Array.isArray(o)){if(!ts(a))throw new nt(`Cannot use non-numeric segment '${a}' on an array in path '${e}'.`,e);let c=parseInt(a,10);if(c>or)throw new nt(`Cannot set path '${e}': array index '${a}' exceeds maximum supported index (${or}).`,e);let u=o[c];if(u!=null&&typeof u!=\"object\")throw new nt(`Cannot set path '${e}': segment '${a}' is a primitive value.`,e);if(u==null){let l=s<r.length-1?r[s+1]:i;if(ts(l)){if(parseInt(l,10)>or)throw new nt(`Cannot set path '${e}': array index '${l}' exceeds maximum supported index (${or}).`,e);o[c]=[]}else o[c]={}}}else{let c=Object.prototype.hasOwnProperty.call(o,a);if(c){let u=o[a];if(u!=null&&typeof u!=\"object\")throw new nt(`Cannot set path '${e}': segment '${a}' is a primitive value.`,e)}if(!c||o[a]===void 0||o[a]===null){let u=s<r.length-1?r[s+1]:i;if(ts(u)){if(parseInt(u,10)>or)throw new nt(`Cannot set path '${e}': array index '${u}' exceeds maximum supported index (${or}).`,e);o[a]=[]}else o[a]={}}}o=o[a]}if(Array.isArray(o)){if(!ts(i))throw new nt(`Cannot use non-numeric segment '${i}' on an array in path '${e}'.`,e);if(parseInt(i,10)>or)throw new nt(`Cannot set path '${e}': array index '${i}' exceeds maximum supported index (${or}).`,e)}if(t==null)if(Array.isArray(o)){let s=parseInt(i,10);s<o.length&&(o[s]=void 0)}else delete o[i];else o[i]=t;return this.notifySignals(e),this}delete(e){return this.set(e,void 0)}static resolvePath(e,t){return e.startsWith(\"/\")?e:t?`${t.endsWith(\"/\")?t:`${t}/`}${e}`:`/${e}`}get(e){if(e==null)throw new nt(\"Path cannot be null or undefined.\");if(e===\"/\"||e===\"\")return this.data;let t=this.parsePath(e),r=this.data;for(let i of t){if(r==null||typeof r!=\"object\")return;if(Array.isArray(r)){if(!ts(i))return;let o=parseInt(i,10);if(o<0||o>=r.length)return;r=r[o]}else{if(!Object.prototype.hasOwnProperty.call(r,i))return;r=r[i]}}return r}hasPath(e){return e==null?!1:this.get(e)!==void 0}subscribe(e,t){let r=this.getSignal(e),i=!0,o=Ye(r),s=ln(()=>{let a=Be(r);o=a,i||t(a)});return i=!1,this.subscriptions.add(s),{get value(){return o},unsubscribe:()=>{s(),this.subscriptions.delete(s)}}}dispose(){for(let e of this.subscriptions)e();this.subscriptions.clear(),this.signals.clear()}normalizePath(e){let t=e.split(\"/\").filter(r=>r.length>0);return t.length===0?\"/\":`/${t.join(\"/\")}`}parsePath(e){return e.split(\"/\").filter(t=>t.length>0).map(t=>{let r=t.replace(/~([01])/g,(i,o)=>o===\"1\"?\"/\":\"~\");if(ox.has(r))throw new nt(`Forbidden path segment '${r}' in path '${e}'.`,e);return r})}notifySignals(e){let t=this.normalizePath(e);Da(()=>{this.updateSignal(t);let r=t;for(;r!==\"/\"&&r!==\"\";)r=r.substring(0,r.lastIndexOf(\"/\"))||\"/\",this.updateSignal(r);for(let i of this.signals.keys())this.isDescendant(i,t)&&this.updateSignal(i)})}updateSignal(e){let t=this.signals.get(e);if(t){let r=this.get(e);Array.isArray(r)?Je(t,r.slice()):typeof r==\"object\"&&r!==null?Je(t,{...r}):Je(t,r)}}notifyAllSignals(){Da(()=>{for(let e of this.signals.keys())this.updateSignal(e)})}isDescendant(e,t){return t===\"/\"||t===\"\"?e!==\"/\":e.startsWith(t+\"/\")}};var Ji=1e3;var Q1=d.object({component:d.string().describe(\"The type name of the component.\"),id:d.lazy(()=>Tn).optional(),weight:d.number().optional()}).passthrough().describe(\"A generic A2UI component definition.\");function ns(n,e,t){if(e!==void 0){let r=n.availableCatalogs?.get(e);if(!r)throw new Fe(`Catalog not found: ${e}`);return r}if(!n.defaultCatalog)throw new Fe(`${t} names no catalogId and surface '${n.id}' has no default catalogId.`);return n.defaultCatalog}var Vu=new WeakMap,sx=\"a2ui:system-functions\",Jp;function ax(){return Jp??=new jt(sx,Hr.V1_0,[],eh),Jp}function Xi(n){if(Vu.has(n))return Vu.get(n);let e=(()=>{let t=n;for(;t;){if(t instanceof d.ZodObject||t._def?.typeName===\"ZodObject\"){if(t._def?.unknownKeys===\"passthrough\")return null;let r=typeof t.shape==\"function\"?t.shape():t.shape;return r&&typeof r==\"object\"?new Set(Object.keys(r)):null}if(t instanceof d.ZodEffects||t._def?.typeName===\"ZodEffects\"){t=t._def.schema;continue}if(t instanceof d.ZodOptional||t instanceof d.ZodNullable||t._def?.typeName===\"ZodOptional\"||t._def?.typeName===\"ZodNullable\"){t=t._def.innerType;continue}if(t instanceof d.ZodDefault||t._def?.typeName===\"ZodDefault\"){t=t._def.innerType;continue}if(t instanceof d.ZodCatch||t._def?.typeName===\"ZodCatch\"){t=t._def.innerType;continue}if(t instanceof d.ZodIntersection||t._def?.typeName===\"ZodIntersection\"){let r=Xi(t._def.left),i=Xi(t._def.right);return!r||!i?null:new Set([...r,...i])}if(t instanceof d.ZodUnion||t._def?.typeName===\"ZodUnion\"){let r=t._def.options,i=new Set;for(let o of r){let s=Xi(o);if(!s)return null;for(let a of s)i.add(a)}return i}return null}return null})();return Vu.set(n,e),e}function Yp(n,e,t){if(!e||typeof e!=\"object\"||Array.isArray(e))return;let r=Object.keys(e);if(r.length>Ji)throw new de(`Function call '${n}' exceeds maximum allowed arguments count (${Ji})`,n);let i=t?.functions?.get?.(n)??(n===\"@index\"&&t?.protocolVersion&&ge(t.protocolVersion,Hr.V1_0)?Qi:void 0);if(!i?.schema)return;let o=Xi(i.schema);if(o){for(let s of r)if(!o.has(s))throw new de(`Unknown argument '${s}' passed to function '${n}'`,n);if(r.length>o.size)throw new de(`Too many arguments for function '${n}': expected at most ${o.size}, received ${r.length}`,n)}}function cx(n){return n.startsWith(\"@\")&&!n.startsWith(\"@@\")}function Xp(n){return n.startsWith(\"@@\")?n.slice(1):n}var Qp=new Set([\"@path\",\"@call\"]);function wa(n,e){if(ge(e,\"1.0\")){for(let t of n)if(cx(t)&&!Qp.has(t))throw new U(`Unrecognized reserved protocol directive '${t}' in v1.0 dynamic object. Reserved keys must be in ${Array.from(Qp).join(\", \")}, or escaped with prefix doubling (e.g. '@${t}').`,void 0,\"INVALID_RESERVED_KEY\")}}function Uu(n){let e=n;for(;e;){if(e.explicitIndex!==void 0&&Number.isFinite(e.explicitIndex))return e.explicitIndex;if(!(e instanceof Mt)&&typeof e.getIndex==\"function\"){let t=e.getIndex();if(t!==void 0&&Number.isFinite(t))return t}if(!(e instanceof Mt)&&typeof e.index==\"number\"&&Number.isFinite(e.index))return e.index;if(typeof e.path==\"string\"){let t=e.path.split(\"/\").filter(Boolean);if(t.length>0&&/^\\d+$/.test(t[t.length-1]))return parseInt(t[t.length-1],10)}e=e.parent}}var Yi=1e3,Mt=class n{constructor(e,t,r,i){this.path=t,this._isUserActivated=!1,this._isPassiveEvaluation=!1,e instanceof sr?(this.surface=void 0,this.dataModel=e,this.functionInvoker=()=>{}):(this.surface=e,this.dataModel=e.dataModel,this.functionInvoker=e.defaultCatalog?.invoker??((o,...s)=>ns(e,void 0,`Function call '${o}'`).invoker(o,...s))),this.explicitIndex=r,this.parent=i,this.warnedPaths=i?i.warnedPaths:new Set}get isUserActivated(){return this._isUserActivated||!!this.parent?.isUserActivated}get isPassiveEvaluation(){return this._isPassiveEvaluation||!!this.parent?.isPassiveEvaluation}getIndex(){return Uu(this)}get index(){return this.getIndex()}set(e,t){let r=this.resolvePath(e);this.dataModel.set(r,t)}get surfaceProtocolVersion(){return this.surface?.protocolVersion??this.surface?.defaultCatalog?.protocolVersion}get atLeastV10(){return this._cachedAtLeastV10===void 0&&(this._cachedAtLeastV10=ge(this.surfaceProtocolVersion,\"1.0\")),this._cachedAtLeastV10}isDataBindingObject(e){return(this.atLeastV10?\"@path\"in e&&typeof e[\"@path\"]==\"string\":\"path\"in e&&typeof e.path==\"string\")&&!(\"componentId\"in e)}isFunctionCallObject(e){return this.atLeastV10?\"@call\"in e&&typeof e[\"@call\"]==\"string\":\"call\"in e&&typeof e.call==\"string\"}containsDynamicValue(e){if(e===null||typeof e!=\"object\")return!1;if(Array.isArray(e))return e.some(r=>this.containsDynamicValue(r));let t=e;if(this.isDataBindingObject(t)||this.isFunctionCallObject(t))return!0;if(this.atLeastV10){for(let r of Object.keys(t))if(r.startsWith(\"@\"))return!0}return Object.values(t).some(r=>this.containsDynamicValue(r))}emitMissingDataBindingWarning(e){typeof this.dataModel?.hasPath==\"function\"&&!this.dataModel.hasPath(e)&&!this.warnedPaths.has(e)&&(this.warnedPaths.add(e),this.surface?.dispatchWarning?.({code:\"MISSING_DATA_BINDING\",path:e,message:`Preflight DataBinding Warning: The bound JSON Pointer '${e}' does not physically exist in the active DataModel. Evaluating to None.`}))}resolveDynamicValue(e,t=0,r=!1){if(t>Yi){let o=new de(`Maximum dynamic value nesting depth exceeded (${Yi})`);this.dispatchExpressionError(o,\"DynamicValue\");return}if(e===null||typeof e!=\"object\")return e;if(Array.isArray(e))return this.containsDynamicValue(e)?e.map(o=>this.resolveDynamicValue(o,t+1,r)):e;let i=e;if(this.isDataBindingObject(i)){let o=i[\"@path\"]??i.path,s=this.resolvePath(o),a=this.dataModel.get(s);return a===void 0&&this.emitMissingDataBindingWarning(s),a}return this.isFunctionCallObject(i)?this.resolveFunctionCallValue(i,t,r):this.resolvePlainObjectValue(i,t)}resolveFunctionCallValue(e,t=0,r=!1){let i=e[\"@call\"]??e.call,o=this.resolveCallCatalog(i,e);if(!o)return;try{Yp(i,e.args,o)}catch(l){this.dispatchExpressionError(l,i);return}let s={};for(let[l,p]of Object.entries(e.args??{}))s[l]=this.resolveDynamicValue(p,t+1,r);let a=new AbortController,c=this._isUserActivated;this._isUserActivated=c||r;let u;try{u=this.evaluateFunctionReactive(i,s,o.invoker,a.signal)}finally{this._isUserActivated=c}if(u!==void 0)return On(u)?Ye(u):u}resolvePlainObjectValue(e,t=0){if(this.atLeastV10&&wa(Object.keys(e),this.surfaceProtocolVersion),!this.containsDynamicValue(e))return e;let r={};for(let[i,o]of Object.entries(e)){let s=this.atLeastV10?Xp(i):i;r[s]=this.resolveDynamicValue(o,t+1)}return r}subscribeDynamicValue(e,t){let r=this.resolveSignal(e),i=!0,o=Ye(r),s=ln(()=>{let a=Be(r);o=a,i||t(a)});return i=!1,{get value(){return o},unsubscribe:()=>{s(),r.unsubscribe?.()}}}resolveSignal(e,t=0){if(t>Yi){let a=new de(`Maximum dynamic value nesting depth exceeded (${Yi})`);return this.dispatchExpressionError(a,typeof e==\"object\"&&e&&(\"@call\"in e||\"call\"in e)?e[\"@call\"]??e.call:\"DynamicValue\"),Ke(void 0)}if(typeof e!=\"object\"||e===null)return Ke(e);if(Array.isArray(e)){if(!this.containsDynamicValue(e))return Ke(e);let a=e.map(u=>this.resolveSignal(u,t+1)),c=Xr(()=>a.map(u=>Be(u)));return c.unsubscribe=()=>{for(let u of a)u.unsubscribe?.()},c}let r=e;if(this.isDataBindingObject(r)){let a=r[\"@path\"]??r.path,c=this.resolvePath(a);return this.emitMissingDataBindingWarning(c),this.dataModel.getSignal(c)}if(this.isFunctionCallObject(r)){let a=r,c=a[\"@call\"]??a.call,u=this.resolveCallCatalog(c,a);if(!u)return Ke(void 0);try{Yp(c,a.args,u)}catch(v){return this.dispatchExpressionError(v,c),Ke(void 0)}let l={};for(let[v,x]of Object.entries(a.args??{}))l[v]=this.resolveSignal(x,t+1);if(Object.keys(l).length===0){let v=new AbortController,x=this.evaluateFunctionPassive({name:c,args:{},abortSignal:v.signal,invoker:u.invoker}),$=On(x)?x:Ke(x);return $.unsubscribe=()=>v.abort(),$}let p=Object.keys(l),f=Ke(void 0),m,g,h=Xr(()=>{let v={};for(let x=0;x<p.length;x++)v[p[x]]=Be(l[p[x]]);return v}),y=ln(()=>{try{let v=Be(h);m&&m.abort(),g&&(g(),g=void 0),m=new AbortController;let x=this.evaluateFunctionPassive({name:c,args:v,abortSignal:m.signal,invoker:u.invoker});On(x)?g=ln(()=>{Je(f,Be(x))}):Je(f,x)}catch(v){this.dispatchExpressionError(v,c),Je(f,void 0)}});return f.unsubscribe=()=>{y(),g&&g(),m&&m.abort();for(let v=0;v<p.length;v++)l[p[v]].unsubscribe?.()},f}if(this.atLeastV10&&wa(Object.keys(r),this.surfaceProtocolVersion),!this.containsDynamicValue(r))return Ke(e);let i=Object.entries(r).map(([a,c])=>[this.atLeastV10?Xp(a):a,this.resolveSignal(c,t+1)]),o=Xr(()=>{let a={};for(let[c,u]of i)a[c]=Be(u);return a}),s=o.unsubscribe?.bind(o);return o.unsubscribe=()=>{s?.();for(let[,a]of i)a.unsubscribe?.()},o}resolveAction(e){if(\"event\"in e&&typeof e.event==\"object\"&&e.event!==null){let t={},r=e.event;if(r.context&&typeof r.context==\"object\"&&!Array.isArray(r.context))for(let[o,s]of Object.entries(r.context))t[o]=this.resolveDynamicValue(s);let i={...r,context:t};return r.userMessage!==void 0&&(i.userMessage=this.resolveDynamicValue(r.userMessage)),{...e,event:i}}if(\"name\"in e){let t=e,r={};if(t.context&&typeof t.context==\"object\"&&!Array.isArray(t.context))for(let[o,s]of Object.entries(t.context))r[o]=this.resolveDynamicValue(s);let i={...t,context:r};return t.userMessage!==void 0&&(i.userMessage=this.resolveDynamicValue(t.userMessage)),i}return\"functionCall\"in e?this.resolveDynamicValue(e.functionCall,0,!0):\"call\"in e?this.resolveDynamicValue(e,0,!0):e}resolveFunctionCatalog(e,t,r){if(this.atLeastV10&&e.startsWith(\"@\")){if(r)throw new de(`System function '${e}' belongs to no catalog and must not name a catalogId.`,e);return ax()}if(!this.surface)throw new Fe(`No surface available to resolve catalog: ${t??\"default\"}`);return ns(this.surface,this.atLeastV10?t:void 0,`Function call '${e}'`)}resolveCallCatalog(e,t){try{return this.resolveFunctionCatalog(e,t.catalogId,\"catalogId\"in t)}catch(r){r instanceof Fe&&this.surface?this.surface.dispatchError({code:\"CATALOG_ERROR\",message:r.message,expression:e}):this.dispatchExpressionError(r,e);return}}evaluateFunctionPassive(e){let{name:t,args:r,invoker:i,abortSignal:o}=e,s=this._isPassiveEvaluation;this._isPassiveEvaluation=!0;try{return this.evaluateFunctionReactive(t,r,i,o)}finally{this._isPassiveEvaluation=s}}evaluateFunctionReactive(e,t,r,i){try{return r(e,t,this,i)}catch(o){this.dispatchExpressionError(o,e);return}}dispatchExpressionError(e,t){if(this.surface)if(e instanceof d.ZodError||typeof e==\"object\"&&e!==null&&e.name===\"ZodError\"){let r=e,i=new de(`Validation failed for function '${t}': ${r.message}`,t,r.errors??r.issues);this.surface.dispatchError({code:\"EXPRESSION_ERROR\",message:i.message,expression:t,details:i.details})}else if(e instanceof de)this.surface.dispatchError({code:\"EXPRESSION_ERROR\",message:e.message,expression:e.expression,details:e.details});else{let r=typeof e==\"object\"&&e!==null?e:{};this.surface.dispatchError({code:\"EXPRESSION_ERROR\",message:r.message??`An unexpected error occurred in function ${t}.`,expression:t})}}nested(e,t){let r=this.resolvePath(e);return new n(this.surface??this.dataModel,r,t,this)}resolvePath(e){if(e.startsWith(\"/\"))return e;let t=this.path;return t.endsWith(\"/\")&&t.length>1&&(t=t.slice(0,-1)),e===\"\"||e===\".\"?t||\"/\":(t===\"/\"&&(t=\"\"),`${t}/${e}`)}};var rs=Sn(d.string().describe(\"REF:#/$defs/ComponentId|The unique identifier for a component, used for both definitions and references within the same surface.\"),\"component-id\"),zu=d.string().describe(\"REF:#/$defs/CallId|The unique identifier for a function call.\"),ar=d.object({\"@path\":d.string().describe(\"A JSON Pointer path to a value in the data model.\").optional(),path:d.string().describe(\"A JSON Pointer path to a value in the data model.\").optional()}).refine(n=>n[\"@path\"]!==void 0||n.path!==void 0,{message:\"Either '@path' or 'path' must be provided.\"}).describe(\"REF:#/$defs/DataBinding\"),ux=d.object({\"@call\":d.string().describe(\"The name of the function to call.\").optional(),call:d.string().describe(\"The name of the function to call.\").optional(),catalogId:d.string().describe(\"The catalog ID for this function, overriding any surface-level default catalogId.\").optional()}).refine(n=>n[\"@call\"]!==void 0||n.call!==void 0,{message:\"Either '@call' or 'call' must be provided.\"}).describe(\"REF:#/$defs/FunctionCommon|Baseline envelope properties common to all function calls. Function-specific argument schemas ('args') are defined individually by each function in the active catalog.\"),Kt=d.record(d.string(),d.any()).and(d.intersection(ux,d.any())).describe(\"REF:#/$defs/FunctionCall|Invokes a named function, combining common function properties with the catalog function definition.\"),Ea=d.union([d.string(),ar,Kt]).describe(\"REF:#/$defs/DynamicString|Represents a string\"),th=d.union([d.boolean(),ar,Kt]).describe(\"REF:#/$defs/DynamicBoolean|A boolean value that can be a literal, a path, or a function call returning a boolean or a validation result object (coerced to its 'valid' boolean).\"),lx=d.object({label:Ea.optional(),description:Ea.optional(),live:d.enum([\"off\",\"polite\",\"assertive\"]).describe(\"Controls screen reader announcements for dynamic updates (WAI-ARIA aria-live). 'polite' waits for user pause; 'assertive' interrupts immediately for alerts.\").default(\"off\"),hidden:th.optional()}).strict().describe(\"REF:#/$defs/AccessibilityAttributes|Attributes to enhance accessibility when using assistive technologies like screen readers or model understanding.\"),qu=d.record(d.string(),d.unknown()).superRefine((n,e)=>{for(let t in n)t.match(/^[\\p{XID_Start}_][\\p{XID_Continue}:-]*$/u)||e.addIssue({path:[t],code:d.ZodIssueCode.custom,message:`Invalid extension key \"${t}\": Keys MUST be Unicode identifiers (UAX #31).`})}).describe(\"REF:#/$defs/Extensions|Optional extension metadata. Keys MUST be Unicode identifiers (UAX #31). Keys starting with 'a2ui_' are reserved for official extensions.\"),nh=d.object({id:rs,catalogId:d.string().describe(\"The catalog ID for this component, overriding any surface-level default catalogId.\").optional(),accessibility:lx.optional(),metadata:d.object({extensions:qu.optional()}).strict().describe(\"Optional component-level metadata for vendor extensions.\").optional()}).describe(\"REF:#/$defs/ComponentCommon\");var dx=Sn(d.union([d.array(rs).describe(\"A static list of child component IDs.\"),d.object({componentId:rs,path:d.string().describe(\"The path to the list of component property objects in the data model.\")}).strict().describe(\"A template for generating a dynamic list of children from a data model list. The `componentId` is the component to use as a template.\")]).describe(\"REF:#/$defs/ChildList\"),\"child-list\"),rh=d.union([d.string(),d.number(),d.boolean(),d.array(d.any()),d.record(d.string(),d.unknown()).refine(n=>!n||!(\"@path\"in n)&&!(\"path\"in n)&&!(\"@call\"in n)&&!(\"call\"in n)),ar,Kt]).describe(\"REF:#/$defs/DynamicValue|A value that can be a literal, a path, or a function call returning any type.\"),ih=d.union([d.number(),ar,Kt]).describe(\"REF:#/$defs/DynamicNumber|Represents a value that can be either a literal number, a path to a number in the data model, or a function call returning a number.\"),fx=d.union([d.array(d.string()),ar,Kt]).describe(\"REF:#/$defs/DynamicStringList|Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array.\"),g$=d.object({\"@call\":d.literal(\"@index\").optional(),call:d.literal(\"@index\").optional(),args:d.object({offset:ih.optional()}).optional()}).refine(n=>n[\"@call\"]!==void 0||n.call!==void 0,{message:\"Either '@call' or 'call' must be '@index'.\"}).describe(\"REF:#/$defs/IndexSystemFunction\"),px=d.object({condition:d.union([ar,Kt]).describe(\"Path or function call evaluating to a structured validation result object or a boolean.\"),message:d.string().describe(\"Optional fallback error message.\").optional()}).strict().describe(\"REF:#/$defs/CheckRule|A single validation check rule applied to an input component. The condition function or path evaluates to a structured validation result object or a boolean (which is coerced to a validation result object).\"),y$=d.object({checks:d.array(px).describe(\"A list of validation check rules to perform on the component.\").optional()}).describe(\"REF:#/$defs/Checkable|Properties for components that support renderer-side checks.\"),b$=d.union([d.object({event:d.object({name:d.string().describe(\"The name of the action to be dispatched to the agent.\"),userMessage:Ea.optional(),context:d.record(d.string(),rh).describe(\"A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.\").optional()}).strict().describe(\"The event to dispatch to the agent.\")}).strict().describe(\"Triggers an agent-side event.\"),d.object({functionCall:Kt}).strict().describe(\"Executes a renderer or agent-side function.\")]).describe(\"REF:#/$defs/Action|Defines an interaction handler that can either trigger an agent-side event or execute a local renderer-side function.\"),v$=d.object({component:d.literal(\"Surface\").optional(),child:d.literal(\"root\").optional()}).strict().describe(\"REF:#/$defs/Surface|The reserved canonical container component representing an A2UI surface. The Surface component is immutable and always has 'child': 'root'.\"),oh=d.object({functionCallId:zu,value:d.any().describe(\"The return value of the function.\").optional(),error:d.object({code:d.string(),message:d.string()}).strict().describe(\"An error object indicating failure of the function execution.\").optional()}).strict().superRefine((n,e)=>{let t=\"value\"in n,r=\"error\"in n;(t&&r||!t&&!r)&&e.addIssue({code:d.ZodIssueCode.custom,message:'FunctionResponse must have either \"value\" or \"error\", but not both or neither.'})}).describe(\"REF:#/$defs/FunctionResponse|The return response matching a callAgentFunction or callRendererFunction invocation.\");var Qi={name:\"@index\",returnType:\"number\",allowedCallers:\"rendererOnly\",schema:d.object({offset:d.union([ar,Kt,d.coerce.number()]).optional()})},Zu=Ae(Qi,(n,e)=>{let t=typeof n.offset==\"number\"&&Number.isFinite(n.offset)?n.offset:0,r=Uu(e);if(r===void 0||!Number.isFinite(r))throw new U(\"@index function can only be evaluated inside a collection template iteration scope.\");return r+t}),eh=[Zu];function Ae(n,e){return{name:n.name,returnType:n.returnType,schema:n.schema,allowedCallers:n.allowedCallers,requiresUserActivation:n.requiresUserActivation,description:n.description,execute:e}}var jt=class n{get peerCatalogs(){return this._peerCatalogs}withPeerCatalogs(e){let t=Sa(this),r=new Set([t]),i=[],o=u=>{if(!u)return;let l=Sa(u);r.has(l)||(r.add(l),i.push(l))};for(let u of this._peerCatalogs)o(u);for(let u of e)o(u._sourceCatalog),o(u);if(i.length===this._peerCatalogs.length&&i.every((u,l)=>u===this._peerCatalogs[l]))return this;let s=new Map;for(let[u,l]of this.components)s.set(u,ku(l,i));let a=new Map;for(let[u,l]of this.functions)a.set(u,ku(l,i));let c=Object.create(Object.getPrototypeOf(this));return Object.assign(c,this,{components:s,functions:a,invoker:ah(this.id,this.protocolVersion,a),cachedValidationSchema:void 0,_componentRefMap:void 0,_peerCatalogs:Object.freeze(i),_linkedFrom:t}),c}get validationSchema(){return this.cachedValidationSchema||(this.cachedValidationSchema=Tp(this)),Re(this.cachedValidationSchema)}get catalogSchema(){return this.validationSchema}toJson(){return this.cachedDocument||(this.cachedDocument=op(this)),Re(this.cachedDocument)}withEntries(e,t){let r=e.length!==this.components.size||e.some(c=>this.components.get(c.name)!==c),i=t.length!==this.functions.size||t.some(c=>this.functions.get(c.name)!==c),o=this.defs;if(o&&(r||i)){let c={...o};r&&delete c.anyComponent,i&&delete c.anyFunction,o=c}let s=this.unions?{anyComponent:this.unions.anyComponent||r,anyFunction:this.unions.anyFunction||i}:void 0,a=new n(this.id,this.protocolVersion,e,t,{themeSchema:this.themeSchema,instructions:this.instructions,schemaUri:this.schemaUri,schemaId:this.schemaId,title:this.title,description:this.description,declaredProtocolVersion:this.declaredProtocolVersion,declaresCatalogId:this.declaresCatalogId,declaresComponents:this.declaresComponents,functionsLayout:this.functionsLayout,unions:s,defs:tp(o,[...this.components.values(),...this.functions.values()],[...e,...t],this.extensionFields),extensionFields:this.extensionFields,commonTypesUri:this.commonTypesUri,themeLocation:this.themeLocation,defModels:this.defModels});return a._sourceCatalog=this._sourceCatalog??Sa(this),this._peerCatalogs.length>0?a.withPeerCatalogs(this._peerCatalogs):a}get componentRefMap(){return this._componentRefMap||(this._componentRefMap=Ip(this,Zf)),this._componentRefMap}constructor(e,t,r=[],i=[],o,s){if(this._peerCatalogs=[],!t)throw new Fe(\"protocolVersion must be provided.\");this.id=e,this.protocolVersion=t;let a=new Map;for(let l of r)a.set(l.name,l);this.components=a;let c=new Map;for(let l of i)c.set(l.name,l);this.functions=c;let u=mx(o)?{themeSchema:o}:o??{};this.themeSchema=u.themeSchema,this.instructions=u.instructions??s,this.schemaUri=u.schemaUri,this.schemaId=u.schemaId,this.title=u.title,this.description=u.description,this.declaredProtocolVersion=u.declaredProtocolVersion,this.declaresCatalogId=u.declaresCatalogId??!0,this.declaresComponents=u.declaresComponents??!0,this.functionsLayout=u.functionsLayout,this.unions=u.unions?Object.freeze({...u.unions}):void 0,this.defs=xu(u.defs),this.extensionFields=xu(u.extensionFields),this.commonTypesUri=u.commonTypesUri,this.themeLocation=u.themeLocation,this.defModels=u.defModels?Object.freeze([...u.defModels]):void 0,this.invoker=ah(this.id,this.protocolVersion,this.functions)}static fromJson(e,t,r){let{id:i,protocolVersion:o,components:s,functions:a,...c}=wp(e,t,r);return new n(i,o,s,a,c)}static fromSchema(e,t){return n.fromJson(e,t)}};function Sa(n){return n._linkedFrom??n}var sh=new WeakMap;function hx(n){let e=Sa(n),t=sh.get(e);return t===void 0&&(t=fa(e.toJson()),sh.set(e,t)),t}function ch(n,e=[]){let t=Array.from(n),r=Array.from(e);return t.length+r.length<2?t:t.map((i,o)=>{if(typeof i.withPeerCatalogs!=\"function\"||!hx(i))return i;let s=[...r,...t.filter((a,c)=>c!==o&&a!==i)];return i.withPeerCatalogs(s)})}function mx(n){return typeof n==\"object\"&&n!==null&&typeof n.safeParse==\"function\"}function ah(n,e,t){return(r,i,o,s)=>{let a=t.get(r)??(ge(e,Hr.V1_0)&&r===\"@index\"?Zu:void 0);if(!a)throw new de(`Function not found in catalog '${n}': ${r}`,r);gx(a,o);let c=a.execute;if(typeof c!=\"function\")throw new de(`Function '${r}' in catalog '${n}' is schema-only and has no implementation.`,r);try{let u=a.schema.parse(i);return c.call(a,u,o,s)}catch(u){throw u?.name===\"ZodError\"||u instanceof d.ZodError?new de(`Validation failed for function '${r}': ${u.message}`,r,u.errors??u.issues):u}}}function gx(n,e){if(!n.requiresUserActivation)return;let t=!!e?.isPassiveEvaluation,i=!!!e?.isUserActivated&&typeof navigator<\"u\"&&!(navigator.userActivation?.isActive??!0);if(t||i)throw new de(`Function '${n.name}' requires user activation and cannot be evaluated without an active user gesture.`,n.name)}var Ve=class{constructor(){this.listeners=new Set}subscribe(e){return this.listeners.add(e),{unsubscribe:()=>this.listeners.delete(e)}}async emit(e){for(let t of this.listeners)try{await t(e)}catch(r){console.error(\"EventEmitter error:\",r)}}dispose(){this.listeners.clear()}};var $a=50,Ta=5,yx=/^(?:(?:\\/(?:[^~/]|~[01])*)*|(?:[^~/]|~[01])+(?:\\/(?:[^~/]|~[01])*)*)$/;function*ka(n,e,t){if(typeof n==\"string\")yield[n,e];else if(Array.isArray(n))for(let r=0;r<n.length;r++){let i=n[r],o=`${e}[${r}]`;yield*ka(i,o,t)}else if(typeof n==\"object\"&&n!==null){let r=n;if(\"componentId\"in r&&typeof r.componentId==\"string\"&&(\"path\"in r||\"dataBinding\"in r))yield[r.componentId,`${e}.componentId`];else if(t?.size)for(let i of t)i in r&&(yield*ka(r[i],`${e}.${i}`));else for(let[i,o]of Object.entries(r))yield*ka(o,`${e}.${i}`)}}function bx(n){return n.componentRefMap}function*Ia(n,e){if(!n||typeof n!=\"object\")return;let t=e instanceof jt?bx(e):e,r=n.component,i=\"\",o=n;if(typeof r==\"string\")i=r;else if(typeof r==\"object\"&&r!==null){let l=r;i=Object.keys(l)[0]??\"\",o=l[i]??{}}if(!i||typeof o!=\"object\"||o===null)return;let s=t[i],a=s?s.singleRefs:new Set,c=s?s.listRefs:new Set,u=s?.nestedRefs;for(let[l,p]of Object.entries(o))(a.has(l)||c.has(l))&&(yield*ka(p,l,u?.[l]))}var vx=Object.freeze({allowOrphanComponents:!1,allowDanglingReferences:!1,allowMissingRoot:!1,allowUnknownElements:!1}),_x=Object.freeze({allowOrphanComponents:!0,allowDanglingReferences:!0,allowMissingRoot:!0,allowUnknownElements:!0});function Qr(n,e,t){if(e>$a)throw new cn(`Global recursion limit exceeded: Depth > ${$a}`);if(Array.isArray(n)){for(let r of n)Qr(r,e+1,t);return}if(typeof n==\"object\"&&n!==null){let r=n;for(let s of[r.path,r[\"@path\"]])if(typeof s==\"string\"&&!yx.test(s))throw new U(`Invalid path syntax: '${s}'`);let i=\"functionCall\"in r&&typeof r.functionCall==\"object\"&&r.functionCall!==null,o=(\"call\"in r||\"@call\"in r)&&\"args\"in r;if(i){if(t>=Ta)throw new cn(`Recursion limit exceeded: functionCall depth > ${Ta}`);for(let[s,a]of Object.entries(r))s===\"functionCall\"?Qr(a,e+1,t+1):Qr(a,e+1,t)}else if(o){if(t>=Ta)throw new cn(`Recursion limit exceeded: functionCall depth > ${Ta}`);for(let[s,a]of Object.entries(r))s===\"args\"?Qr(a,e+1,t+1):Qr(a,e+1,t)}else for(let s of Object.values(r))Qr(s,e+1,t)}}function uh(n){Qr(n,0,0)}var eo=class{constructor(e){this.components=new Map,this._onCreated=new Ve,this._onDeleted=new Ve,this.onCreated=this._onCreated,this.onDeleted=this._onDeleted,e&&this.setCatalog(e)}setCatalog(e){this.refMap=e instanceof jt?e.componentRefMap:e}get(e){return this.components.get(e)}getAll(){return new Map(this.components)}has(e){return this.components.has(e)}get entries(){return this.components.entries()}get keys(){return this.components.keys()}get values(){return this.components.values()}get size(){return this.components.size}get componentsMap(){return this.components}addComponent(e){if(this.components.has(e.id))throw new Xn(`Component with id '${e.id}' already exists.`);this.components.set(e.id,e),this._onCreated.emit(e)}removeComponent(e){let t=this.components.get(e);t&&(this.components.delete(e),t.dispose(),this._onDeleted.emit(e))}getChildReferences(e){let t=this.components.get(e);if(!t)return[];let r=t.catalog.components.size?t.catalog.componentRefMap:this.refMap??t.catalog.componentRefMap;return Array.from(Ia(t.componentTree,r))}getChildIds(e){return this.getChildReferences(e).map(([t])=>t)}detectCycles(e={}){let t=e.rootId??\"root\",r=e.maxDepth??$a,i=e.allowMissingRoot??!1;for(let c of this.components.values())for(let[u,l]of this.getChildReferences(c.id))if(u===c.id)throw new cn(`Circular reference detected: Component '${c.id}' references itself in field '${l}' (Self-reference detected)`);let o=new Set,s=new Set,a=(c,u)=>{if(u>r)throw new cn(`Global recursion limit exceeded: logical depth > ${r}`);o.add(c),s.add(c);let l=this.getChildIds(c);for(let p of l)if(this.components.has(p)){if(!o.has(p))a(p,u+1);else if(s.has(p))throw new cn(`Circular reference detected involving component '${p}'`)}s.delete(c)};if(i){let c=Array.from(this.components.keys()).sort();for(let u of c)o.has(u)||a(u,0)}else this.components.has(t)&&a(t,0);return o}validateTopology(e={}){if(this.components.size===0)return;let t=e.rootId??\"root\",r=e.allowMissingRoot??!1,i=e.allowDanglingReferences??!1,o=e.allowOrphanComponents??!1;if(!r&&!this.components.has(t))throw new qt(`Missing root component: No component has id='${t}'`);if(!i){for(let a of this.components.values())for(let[c,u]of this.getChildReferences(a.id))if(!this.components.has(c))throw new qt(`Component '${a.id}' references non-existent component '${c}' in field '${u}' (Dangling reference '${c}' in component '${a.id}')`)}let s=this.detectCycles({rootId:t,allowMissingRoot:r,maxDepth:e.maxDepth});if(!o&&!r&&s.size<this.components.size){let a=Array.from(this.components.keys()).filter(c=>!s.has(c)).sort();if(a.length>0)throw new qt(`Component '${a[0]}' is not reachable from '${t}' (Orphaned component '${a[0]}' is not reachable from root)`)}}validateReferences(e={}){let t=[];try{this.validateTopology(e)}catch(r){r instanceof U?t.push(r):r instanceof Error&&t.push(new U(r.message))}return t}dispose(){for(let e of this.components.values())e.dispose();this.components.clear(),this._onCreated.dispose(),this._onDeleted.dispose()}};function xx(n){if(!n)return;let e=ke(n);return e?`v${e}`:n}var ei=class{constructor(e,t,r=new Map,i={},o=!1,s,a=\"root\",c,u){if(this.id=e,this.defaultCatalog=t,this.theme=i,this.sendDataModel=o,this.rootId=a,this.metadata=c,this._onAction=new Ve,this._onError=new Ve,this._onWarning=new Ve,this.onAction=this._onAction,this.onError=this._onError,this.onWarning=this._onWarning,this.protocolVersion=xx(u??t?.protocolVersion),r!=null&&!(r instanceof Map))throw new TypeError(\"availableCatalogs must be a Map, or undefined/null. Note that availableCatalogs is now the 3rd argument to SurfaceModel and theme is the 4th argument.\");let l=new Map(r??[]);t?.id&&!l.has(t.id)&&l.set(t.id,t),this.availableCatalogs=l,this.dataModel=s??new sr({}),this.componentsModel=new eo(t)}get catalog(){return this.defaultCatalog}resolveCatalog(e,t=\"Item\"){return ns(this,e,t)}async dispatchAction(e,t){if(!e||typeof e!=\"object\")return;let r=Ax(e);if(!r)return;let i=r.name;if(!i||typeof i!=\"string\")return;let o=r.context,s=o&&typeof o==\"object\"&&!Array.isArray(o)?o:{},a={name:i,surfaceId:this.id,sourceComponentId:t,timestamp:new Date().toISOString(),context:s},c=r.catalogId??e.catalogId;typeof c==\"string\"&&c&&(a.catalogId=c),typeof r.userMessage==\"string\"&&r.userMessage.length>0&&(a.userMessage=r.userMessage),await this._onAction.emit(a)}async dispatchError(e){await this._onError.emit({...e,surfaceId:this.id})}async dispatchWarning(e){await this._onWarning.emit({...e,surfaceId:this.id})}dispose(){this.dataModel.dispose(),this.componentsModel.dispose(),this._onAction.dispose(),this._onError.dispose(),this._onWarning.dispose()}};function Ax(n){return\"event\"in n&&n.event&&typeof n.event==\"object\"?n.event:\"name\"in n&&typeof n.name==\"string\"?n:null}var Fa=class{constructor(){this.surfaces=new Map,this.surfaceUnsubscribers=new Map,this._onSurfaceCreated=new Ve,this._onSurfaceDeleted=new Ve,this._onAction=new Ve,this.onSurfaceCreated=this._onSurfaceCreated,this.onSurfaceDeleted=this._onSurfaceDeleted,this.onAction=this._onAction}addSurface(e){if(this.surfaces.has(e.id)){console.warn(`Surface ${e.id} already exists. Ignoring.`);return}this.surfaces.set(e.id,e);let t=e.onAction.subscribe(r=>this._onAction.emit(r));this.surfaceUnsubscribers.set(e.id,t),this._onSurfaceCreated.emit(e)}deleteSurface(e){let t=this.surfaces.get(e);if(t){let r=this.surfaceUnsubscribers.get(e);r&&(r.unsubscribe(),this.surfaceUnsubscribers.delete(e)),this.surfaces.delete(e),t.dispose(),this._onSurfaceDeleted.emit(e)}}getSurface(e){return this.surfaces.get(e)}get surfacesMap(){return this.surfaces}dispose(){for(let e of Array.from(this.surfaces.keys()))this.deleteSurface(e);this._onSurfaceCreated.dispose(),this._onSurfaceDeleted.dispose(),this._onAction.dispose()}};var cr=class{constructor(e,t,r,i,o){this.id=e,this.type=t,this.catalog=i,this.metadata=o,this._onUpdated=new Ve,this.onUpdated=this._onUpdated,this._properties=r}get properties(){return this._properties}set properties(e){this._properties=e,this._onUpdated.emit(this)}dispose(){this._onUpdated.dispose()}get componentTree(){return{...this._properties,id:this.id,component:this.type,...this.metadata!==void 0?{metadata:this.metadata}:{}}}};function Nn(n){let e=n.path.join(\".\")||\"root\";switch(n.code){case d.ZodIssueCode.invalid_union:{let t=n.unionErrors?.flatMap(r=>r.issues);return t&&t.length>0?t.map(Nn).join(\"; \"):`${e}: Invalid union`}case d.ZodIssueCode.unrecognized_keys:{let t=n.keys.map(r=>`'${r}'`).join(\", \");return`${e}: Unrecognized key(s) in object: ${t}`}case d.ZodIssueCode.invalid_enum_value:{let t=n,r=t.options.map(i=>String(i)).join(\" | \");return`${e}: Invalid enum value. Expected ${r}, received '${String(t.received)}'`}case d.ZodIssueCode.invalid_type:{let t=n;return`${e}: Expected ${t.expected}, received ${t.received}`}case d.ZodIssueCode.custom:return`${e}: ${n.message}`;default:return n.message?`${e}: ${n.message}`:`${e}: Validation error (${n.code})`}}var Cx={\"0.8\":new Set([\"0.8\"]),\"0.9\":new Set([\"0.9\",\"0.9.1\"]),\"0.9.1\":new Set([\"0.9.1\",\"0.9\"]),\"1.0\":new Set([\"1.0\"])};function dn(n,e,t=Cx){if(!n||!e)return!1;let r=ke(n),i=ke(e);if(r&&i){if(r===i)return!0;let a=t[i];if(a&&a.has(r))return!0;let c=Qn(n),u=Qn(e);return!!(c&&u&&c.major>=1&&c.major===u.major)}if(typeof n!=\"string\"||typeof e!=\"string\")return!1;let o=En(n),s=En(e);return o.length>0&&o===s}var Wu;function lh(n){Wu=n}function Dx(n,e){for(let t of e){let r=n[t];if(r&&typeof r==\"object\"){let i=r;if(\"surfaceId\"in i&&i.surfaceId!==void 0&&typeof i.surfaceId!=\"string\")throw new U(\"surfaceId must be a string\")}}}var ur=class{get compatibleCatalogVersions(){let e=ke(this.version);return e?new Set([e]):new Set}get validActions(){return new Set(this.getNativeActionKeys())}isCatalogCompatible(e){return e?dn(e,this.version):!1}extractOperations(e){if(!e||typeof e!=\"object\")return[];if(Array.isArray(e))return e.flatMap(a=>this.extractOperations(a));let t=e;if(Array.isArray(t.messages))return this.extractOperations(t.messages);let r=this.getNativeActionKeys();Dx(t,r);let i=r.filter(a=>a in t).sort();if(i.length>1)throw new U(`Message contains multiple conflicting update actions: ${i.join(\", \")}.`);if(i.length===0){let a=Wu?Wu():new Set(r),c=Object.keys(t).find(l=>a.has(l)&&!r.includes(l)),u=r.slice().sort().join(\", \");throw c?new U(`Invalid ${this.version} message: action '${c}' is not supported in protocol version ${this.version}. Allowed actions: ${u}.`):new U(`Invalid ${this.version} message: message must contain exactly one update action: ${u}.`)}let o=this.preparePayloadForValidation(t),s=this.schema.safeParse(o);if(!s.success){let a=s.error.errors.map(Nn).join(\"; \");throw new U(`Invalid ${this.version} message: ${a}`,s.error)}return this.extractOperationsFromObject(t)}preparePayloadForValidation(e){return\"version\"in e?e:{version:this.version,...e}}};var fn=(n,e)=>{let t=Object.keys(n).filter(r=>n[r]!==void 0);t.length!==1&&e.addIssue({code:d.ZodIssueCode.custom,message:`Must define exactly one property, found ${t.length} (${t.join(\", \")}).`})},Pt=d.object({path:d.string().optional(),literalString:d.string().optional(),literal:d.string().optional()}).strict().superRefine(fn),dh=d.lazy(()=>d.object({key:d.string(),valueString:d.string().optional(),valueNumber:d.number().optional(),valueBoolean:d.boolean().optional(),valueMap:d.array(dh).optional()}).strict().superRefine((n,e)=>{let t=0;n.valueString!==void 0&&t++,n.valueNumber!==void 0&&t++,n.valueBoolean!==void 0&&t++,n.valueMap!==void 0&&t++,t!==1&&e.addIssue({code:d.ZodIssueCode.custom,message:`Value map item must have exactly one value property (valueString, valueNumber, valueBoolean, valueMap), found ${t}.`})}));function wx(n={}){let e=n.maxDepth??5;return dh.superRefine((t,r)=>{let i=(o,s)=>{if(s>e){r.addIssue({code:d.ZodIssueCode.custom,message:`valueMap recursion exceeded maximum depth of ${e}.`});return}if(o.valueMap&&Array.isArray(o.valueMap))for(let a of o.valueMap)i(a,s+1)};i(t,1)})}var fh=wx(),lI=d.object({path:d.string().optional(),literalNumber:d.number().optional(),literal:d.number().optional()}).strict().superRefine(fn),dI=d.object({path:d.string().optional(),literalBoolean:d.boolean().optional(),literal:d.boolean().optional()}).strict().superRefine(fn),Ex=d.object({name:d.string().describe(\"A unique name identifying the action (e.g., 'submitForm').\"),context:d.array(d.object({key:d.string(),value:d.object({path:d.string().describe(\"A data binding reference to a location in the data model (e.g., '/user/name').\").optional(),literalString:d.string().describe(\"A fixed, hardcoded string value.\").optional(),literalNumber:d.number().optional(),literalBoolean:d.boolean().optional()}).describe(\"The dynamic value. Define EXACTLY ONE of the nested properties.\").strict().superRefine(fn)})).describe(\"A key-value map of data bindings to be resolved when the action is triggered.\").optional()}),fI=d.object({text:Pt,usageHint:d.enum([\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"caption\",\"body\"]).optional()}),pI=d.object({url:Pt,usageHint:d.enum([\"icon\",\"avatar\",\"smallFeature\",\"mediumFeature\",\"largeFeature\",\"header\"]).optional(),fit:d.enum([\"contain\",\"cover\",\"fill\",\"none\",\"scale-down\"]).optional(),altText:Pt.optional()}),hI=d.object({name:Pt}),mI=d.object({url:Pt}),gI=d.object({url:Pt,description:Pt.optional().describe(\"A label, title, or placeholder text.\")}),yI=d.object({tabItems:d.array(d.object({title:d.object({path:d.string().describe(\"A data binding reference to a location in the data model (e.g., '/user/name').\").optional(),literalString:d.string().describe(\"A fixed, hardcoded string value.\").optional()}),child:d.string().describe(\"A reference to a component instance by its unique ID.\")}).strict().superRefine((n,e)=>{n.title||e.addIssue({code:d.ZodIssueCode.custom,message:\"Tab item is missing 'title'.\"}),n.child||e.addIssue({code:d.ZodIssueCode.custom,message:\"Tab item is missing 'child'.\"}),n.title&&fn(n.title,e)})).describe(\"A list of tabs, each with a title and a child component ID.\")}),bI=d.object({axis:d.enum([\"horizontal\",\"vertical\"]).optional().describe(\"The orientation.\"),color:d.string().optional().describe(\"The color of the divider (e.g., hex code or semantic name).\"),thickness:d.number().optional().describe(\"The thickness of the divider.\")}),vI=d.object({entryPointChild:d.string().describe(\"The ID of the component (e.g., a button) that triggers the modal.\"),contentChild:d.string().describe(\"The ID of the component to display as the modal's content.\")}),_I=d.object({child:d.string().describe(\"The ID of the component to display as the button's content.\"),action:Ex.describe(\"Represents a user-initiated action.\"),primary:d.boolean().optional().describe(\"Indicates if this button should be styled as the primary action.\")}),xI=d.object({label:Pt,value:d.object({path:d.string().describe(\"A data binding reference to a location in the data model (e.g., '/user/name').\").optional(),literalBoolean:d.boolean().optional()}).strict().superRefine(fn)}),AI=d.object({text:Pt.optional(),label:Pt.describe(\"A label, title, or placeholder text.\"),textFieldType:d.enum([\"shortText\",\"number\",\"date\",\"longText\",\"obscured\"]).optional(),validationRegexp:d.string().optional().describe(\"A regex string to validate the input.\")}),CI=d.object({value:Pt,enableDate:d.boolean().optional(),enableTime:d.boolean().optional(),outputFormat:d.string().optional().describe(\"The string format for the output (e.g., 'YYYY-MM-DD').\")}),DI=d.object({selections:d.object({path:d.string().describe(\"A data binding reference to a location in the data model (e.g., '/user/name').\").optional(),literalArray:d.array(d.string()).optional()}).strict().superRefine(fn),options:d.array(d.object({label:d.object({path:d.string().describe(\"A data binding reference to a location in the data model (e.g., '/user/name').\").optional(),literalString:d.string().describe(\"A fixed, hardcoded string value.\").optional()}).strict().superRefine(fn),value:d.string()})).optional(),maxAllowedSelections:d.number().optional(),type:d.enum([\"checkbox\",\"chips\"]).optional(),filterable:d.boolean().optional()}),wI=d.object({value:d.object({path:d.string().describe(\"A data binding reference to a location in the data model (e.g., '/user/name').\").optional(),literalNumber:d.number().optional()}).strict().superRefine(fn),minValue:d.number().optional(),maxValue:d.number().optional(),label:Pt.optional()}),Sx=d.object({componentId:d.string(),dataBinding:d.string()}),Hu=d.object({explicitList:d.array(d.string()).optional(),template:Sx.describe(\"A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.\").optional()}).strict().superRefine(fn),EI=d.object({children:Hu,distribution:d.enum([\"start\",\"center\",\"end\",\"spaceBetween\",\"spaceAround\",\"spaceEvenly\"]).optional(),alignment:d.enum([\"start\",\"center\",\"end\",\"stretch\"]).optional()}),SI=d.object({children:Hu,distribution:d.enum([\"start\",\"center\",\"end\",\"spaceBetween\",\"spaceAround\",\"spaceEvenly\"]).optional(),alignment:d.enum([\"start\",\"center\",\"end\",\"stretch\"]).optional()}),TI=d.object({children:Hu,direction:d.enum([\"vertical\",\"horizontal\"]).optional(),alignment:d.enum([\"start\",\"center\",\"end\",\"stretch\"]).optional()}),kI=d.object({child:d.string().describe(\"The ID of the component to be rendered inside the card.\")});var Tx=fh.describe(\"A single data entry. Exactly one 'value*' property should be provided alongside the key.\"),kx=d.record(d.any()).refine(n=>Object.keys(n).length===1,\"A wrapper object that MUST contain exactly one key, which is the name of the component type (e.g., 'Heading').\");var $x=d.object({id:d.string().describe(\"The unique identifier for this component.\"),weight:d.number().optional().describe(\"The relative weight of this component within a Row or Column. This corresponds to the CSS 'flex-grow' property. Note: this may ONLY be set when the component is a direct descendant of a Row or Column.\"),component:kx.describe(\"A wrapper object that MUST contain exactly one key, which is the name of the component type (e.g., 'Heading'). The value is an object containing the properties for that specific component.\")}).strict().describe(\"Represents a *single* component in a UI widget tree. This component could be one of many supported types.\"),Ix=d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be rendered.\"),catalogId:d.string().optional().describe(\"The identifier of the component catalog to use for this surface. If omitted, the client MUST default to the standard catalog for this A2UI version (https://a2ui.org/specification/v0_8/standard_catalog_definition.json).\"),root:d.string().describe(\"The ID of the root component to render.\"),styles:d.object({font:d.string().optional().describe(\"The primary font for the UI.\"),primaryColor:d.string().regex(/^#[0-9a-fA-F]{6}$/).optional().describe(\"The primary UI color as a hexadecimal code (e.g., '#00BFFF').\")}).strict().optional().describe(\"Styling information for the UI.\")}).strict().describe(\"Signals the client to begin rendering a surface with a root component and specific styles.\"),Fx=d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be updated. If you are adding a new surface this *must* be a new, unique identified that has never been used for any existing surfaces shown.\"),components:d.array($x).min(1).describe(\"A list containing all UI components for the surface.\")}).strict().superRefine((n,e)=>{let t=new Set;for(let i of n.components)i.id&&(t.has(i.id)&&e.addIssue({code:d.ZodIssueCode.custom,message:`Duplicate component ID found: ${i.id}`,path:[\"components\"]}),t.add(i.id));let r=(i,o)=>{for(let s of i)s&&!t.has(s)&&e.addIssue({code:d.ZodIssueCode.custom,message:`Component '${o}' references non-existent component ID '${s}'.`,path:[\"components\"]})};for(let i of n.components){if(!i.id||!i.component)continue;let o=Object.keys(i.component);if(o.length!==1)continue;let s=o[0],a=i.component[s];switch(s){case\"Row\":case\"Column\":case\"List\":if(a.children&&!Array.isArray(a.children)){let c=!!a.children.explicitList,u=!!a.children.template;(c&&u||!c&&!u)&&e.addIssue({code:d.ZodIssueCode.custom,message:`Component '${i.id}' must have either 'explicitList' or 'template' in children, but not both or neither.`}),c&&r(a.children.explicitList,i.id),u&&r([a.children.template?.componentId],i.id)}break;case\"Card\":a.child&&r([a.child],i.id);break;case\"Tabs\":a.tabItems&&Array.isArray(a.tabItems)&&a.tabItems.forEach(c=>{c.child&&r([c.child],i.id)});break;case\"Modal\":r([a.entryPointChild,a.contentChild],i.id);break;case\"Button\":a.child&&r([a.child],i.id);break}}}).describe(\"Updates a surface with a new set of components.\"),Rx=d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface this data model update applies to.\"),path:d.string().optional().describe(\"An optional path to a location within the data model (e.g., '/user/name'). If omitted, or set to '/', the entire data model will be replaced.\"),contents:d.array(Tx).describe(\"An array of data entries. Each entry must contain a 'key' and exactly one corresponding typed 'value*' property.\")}).strict().describe(\"Updates the data model for a surface.\"),Ox=d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be deleted.\")}).strict().describe(\"Signals the client to delete the surface identified by 'surfaceId'.\"),ph=d.object({beginRendering:Ix.optional(),surfaceUpdate:Fx.optional(),dataModelUpdate:Rx.optional(),deleteSurface:Ox.optional()}).strict().superRefine((n,e)=>{Object.keys(n).filter(r=>[\"beginRendering\",\"surfaceUpdate\",\"dataModelUpdate\",\"deleteSurface\"].includes(r)).length!==1&&e.addIssue({code:d.ZodIssueCode.custom,message:\"A2UI Protocol message must have exactly one of: surfaceUpdate, dataModelUpdate, beginRendering, deleteSurface.\"})}).describe(\"Describes a JSON payload for an A2UI (Agent to UI) message, which is used to dynamically construct and update user interfaces. A message MUST contain exactly ONE of the action properties: 'beginRendering', 'surfaceUpdate', 'dataModelUpdate', or 'deleteSurface'.\");function hh(n){if(!n||typeof n!=\"object\")return{id:\"\",component:\"\"};let e=n,t=typeof e.component==\"string\"?e.component:\"\",r={};for(let[i,o]of Object.entries(e))i!==\"component\"&&i!==\"id\"&&(r[i]=o);if(e.component&&typeof e.component==\"object\"){let i=e.component,o=Object.keys(i);if(o.length>0){t=o[0];let s=i[o[0]];s&&typeof s==\"object\"&&s!==null&&!Array.isArray(s)&&Object.assign(r,s)}}return{...r,id:String(e.id??\"\"),component:t}}var Ra=class extends ur{constructor(){super(...arguments),this.version=\"v0.8\",this.schema=ph}getNativeActionKeys(){return[\"beginRendering\",\"surfaceUpdate\",\"dataModelUpdate\",\"deleteSurface\"]}preparePayloadForValidation(e){let t={...e};return delete t.version,t}extractOperationsFromObject(e){let t=[];if(\"beginRendering\"in e){let r=e.beginRendering;t.push({type:\"createSurface\",surfaceId:String(r?.surfaceId??\"\"),catalogId:typeof r?.catalogId==\"string\"?r.catalogId:void 0,theme:r?.theme??r?.styles,sendDataModel:!!r?.sendDataModel,components:Array.isArray(r?.components)?r.components.map(hh):void 0,dataModel:r?.dataModel&&typeof r.dataModel==\"object\"&&!Array.isArray(r.dataModel)?r.dataModel:void 0,version:typeof e.version==\"string\"?e.version:this.version,rootId:typeof r?.root==\"string\"&&r.root?r.root:void 0})}if(\"surfaceUpdate\"in e){let r=e.surfaceUpdate;t.push({type:\"updateComponents\",surfaceId:String(r?.surfaceId??\"\"),components:Array.isArray(r?.components)?r.components.map(hh):[]})}if(\"dataModelUpdate\"in e){let r=e.dataModelUpdate,i=String(r?.surfaceId??\"\"),o=typeof r?.path==\"string\"?r.path.trim():\"\",s=o&&o!==\"/\"?(o.startsWith(\"/\")?o:`/${o}`).replace(/\\/+$/,\"\"):\"\",a=c=>{if(\"valueNumber\"in c)return c.valueNumber;if(\"valueString\"in c)return c.valueString;if(\"valueBoolean\"in c)return c.valueBoolean;if(\"valueObject\"in c)return c.valueObject;if(\"valueArray\"in c)return c.valueArray;if(Array.isArray(c.valueMap)){let u={};for(let l of c.valueMap)l&&typeof l==\"object\"&&typeof l.key==\"string\"&&(u[l.key]=a(l));return u}return c.value};if(Array.isArray(r?.contents)){for(let c of r.contents)if(c&&typeof c==\"object\"&&typeof c.key==\"string\"){let u=a(c),l=c.key.replace(/^\\/+/,\"\"),p=l===\".\"||l===\"\"?s||\"/\":`${s}/${l}`;t.push({type:\"updateDataModel\",surfaceId:i,path:p,value:u})}}else t.push({type:\"updateDataModel\",surfaceId:i,path:typeof r?.path==\"string\"?r.path:void 0,value:r?.value})}if(\"deleteSurface\"in e){let r=e.deleteSurface;t.push({type:\"deleteSurface\",surfaceId:String(r?.surfaceId??\"\")})}return t}};var Nx=d.object({version:d.enum([\"v0.9\",\"v0.9.1\"]),createSurface:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be rendered.\"),catalogId:d.string().describe(\"A string that uniquely identifies this catalog. It is recommended to prefix this with an internet domain that you own, to avoid conflicts e.g. mycompany.com:somecatalog'.\"),theme:d.any().optional(),sendDataModel:d.boolean().describe(\"If true, the client will send the full data model of this surface in the metadata of every A2A message sent to the server that created the surface. Defaults to false.\").optional()}).strict().describe(\"Signals the client to create a new surface and begin rendering it. It is an error to send 'createSurface' for a surfaceId that already exists without first deleting it. When this message is sent, the client will expect 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId that define the component tree.\")}).strict(),Mx=d.object({version:d.enum([\"v0.9\",\"v0.9.1\"]),updateComponents:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be updated.\"),components:d.array(d.record(d.string(),d.any())).min(1).describe(\"A list containing all UI components for the surface.\")}).strict().describe(\"Updates a surface with a new set of components. This message can be sent multiple times to update the component tree of an existing surface. One of the components in one of the components lists MUST have an 'id' of 'root' to serve as the root of the component tree. A createSurface message MUST have been previously sent for the 'surfaceId' in this message; the surface's catalog is the one specified by that createSurface.\")}).strict(),jx=d.object({version:d.enum([\"v0.9\",\"v0.9.1\"]),updateDataModel:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface this data model update applies to.\"),path:d.string().describe(\"An optional path to a location within the data model (e.g., '/user/name'). If omitted, or set to '/', refers to the entire data model.\").optional(),value:d.any().describe(\"The data to be updated in the data model. If present, the value at 'path' is replaced (or created). If omitted, the key at 'path' is removed.\").optional()}).strict().describe(\"Updates the data model for an existing surface. This message can be sent multiple times to update the data model. A createSurface message MUST have been previously sent for the 'surfaceId' in this message; the surface's catalog is the one specified by that createSurface.\")}).strict(),Px=d.object({version:d.enum([\"v0.9\",\"v0.9.1\"]),deleteSurface:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be deleted.\")}).strict().describe(\"Signals the client to delete the surface identified by 'surfaceId'. A createSurface message MUST have been previously sent for the 'surfaceId' in this message; the surface's catalog is the one specified by that createSurface.\")}).strict(),Gu=d.union([Nx,Mx,jx,Px]),Lx=d.array(Gu).describe(\"A list of messages.\"),PI=d.object({messages:Lx}).strict().describe(\"An object wrapping a list of messages.\");var is=class extends ur{constructor(){super(...arguments),this.version=\"v0.9\",this.schema=Gu}get compatibleCatalogVersions(){return new Set([\"0.9\",\"0.9.1\"])}getNativeActionKeys(){return[\"createSurface\",\"updateComponents\",\"updateDataModel\",\"deleteSurface\"]}extractOperationsFromObject(e){let t=[];if(\"createSurface\"in e){let r=e.createSurface;t.push({type:\"createSurface\",surfaceId:String(r?.surfaceId||\"\"),catalogId:typeof r?.catalogId==\"string\"?r.catalogId:void 0,theme:r?.theme,sendDataModel:!!r?.sendDataModel,components:Array.isArray(r?.components)?r.components:void 0,dataModel:r?.dataModel&&typeof r.dataModel==\"object\"&&!Array.isArray(r.dataModel)?r.dataModel:void 0,version:typeof e.version==\"string\"?e.version:this.version})}if(\"updateComponents\"in e){let r=e.updateComponents;t.push({type:\"updateComponents\",surfaceId:String(r?.surfaceId||\"\"),components:Array.isArray(r?.components)?r.components:[]})}if(\"updateDataModel\"in e){let r=e.updateDataModel;t.push({type:\"updateDataModel\",surfaceId:String(r?.surfaceId||\"\"),path:typeof r?.path==\"string\"?r.path:void 0,value:r?.value})}if(\"deleteSurface\"in e){let r=e.deleteSurface;t.push({type:\"deleteSurface\",surfaceId:String(r?.surfaceId||\"\")})}return t}};var Ku=[\"createSurface\",\"updateComponents\",\"updateDataModel\",\"deleteSurface\",\"callRendererFunction\",\"agentFunctionResponse\"];function mh(n){return typeof n==\"object\"&&n!==null&&\"type\"in n&&typeof n.type==\"string\"&&Ku.includes(n.type)}var WI=d.object({componentId:d.lazy(()=>rs),path:d.string().describe(\"The path to the list of component property objects in the data model.\")}).strict().describe(\"REF:#/$defs/TemplateChildList|A template for generating a dynamic list of children from a data model list. The `componentId` is the component to use as a template.\");var Bx=d.lazy(()=>nh.extend({component:d.string()}).passthrough().refine(n=>n.component!==\"Surface\",{message:'Component type cannot be \"Surface\". \"Surface\" is a top-level protocol container defined in createSurface, not a child component.'})),Ju=d.array(Bx).min(1),HI=d.record(d.string(),d.any());var Vx=d.object({version:d.literal(\"v1.0\"),createSurface:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be rendered. It must be globally unique for the renderer's lifetime.\"),catalogId:d.string().describe(\"A string that uniquely identifies the default catalog for this surface. It is recommended to prefix this with an internet domain that you own, to avoid conflicts e.g. 'mycompany.com:somecatalog'. Components and function calls that do not explicitly specify a catalogId will use this surface-level default catalogId.\").optional(),sendDataModel:d.boolean().describe(\"If true, the renderer will send the full data model of this surface in the metadata of every A2A message sent to the agent that created the surface. Defaults to false.\").optional(),components:Ju.optional(),dataModel:d.record(d.string(),d.any()).describe(\"The initial root data model object for the surface.\").optional(),metadata:d.object({extensions:qu.optional()}).strict().describe(\"Optional surface-level metadata.\").optional()}).strict().describe(\"Signals the renderer to create a new surface and begin rendering it. Creating a surface implicitly instantiates the canonical 'Surface' container component ('common_types.json#/$defs/Surface') with 'child': 'root'. It is an error to try to create a surface with an existing ID without first deleting it; surfaceId MUST be globally unique for the renderer's lifetime. When this message is sent, the renderer expects 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId to define the component tree.\")}).strict(),Ux=d.object({version:d.literal(\"v1.0\"),updateComponents:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be updated. It must be globally unique for the renderer's lifetime.\"),components:Ju}).strict().describe(\"Updates a surface with a new set of components. This message can be sent multiple times to update the component tree of an existing surface. One of the components in one of the components lists MUST have an 'id' of 'root' to serve as the root of the component tree. The createSurface message MUST have been previously sent for this surfaceId.\")}).strict(),zx=d.object({version:d.literal(\"v1.0\"),updateDataModel:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface this data model update applies to. It must be globally unique for the renderer's lifetime.\"),path:d.string().describe(\"An optional path to a location within the data model (e.g., '/user/name'). If omitted, or set to '/', refers to the entire data model.\").optional(),value:d.any().describe(\"The data to be updated in the data model. To delete the key/value at 'path', set 'value' explicitly to null.\")}).strict().describe(\"Updates the data model for an existing surface. This message can be sent multiple times to update the data model. The createSurface message MUST have been previously sent for this surfaceId.\")}).strict(),qx=d.object({version:d.literal(\"v1.0\"),deleteSurface:d.object({surfaceId:d.string().describe(\"The unique identifier for the UI surface to be deleted. It must be globally unique for the renderer's lifetime.\")}).strict().describe(\"Signals the renderer to delete the surface identified by 'surfaceId'. The createSurface message MUST have been previously sent for this surfaceId.\")}).strict(),Zx=d.object({version:d.literal(\"v1.0\"),callRendererFunction:d.object({surfaceId:d.string().describe(\"Optional ID of the surface whose data model provides the evaluation context for this call. If omitted, the function executes in a surface-independent root context with an empty data model.\").optional(),functionCallId:zu,callFunction:d.intersection(Kt,d.object({catalogId:d.string()}).passthrough())}).strict().describe(\"Signals the renderer to execute a function locally on behalf of the agent.\")}).strict(),Wx=d.object({version:d.literal(\"v1.0\"),agentFunctionResponse:oh}).strict(),gh=d.union([Vx,Ux,zx,qx,Zx,Wx]);var Oa=class extends ur{constructor(){super(...arguments),this.version=\"v1.0\",this.schema=gh}getNativeActionKeys(){return[...Ku]}extractOperationsFromObject(e){let t=[];if(\"createSurface\"in e){let r=e.createSurface;t.push({type:\"createSurface\",surfaceId:String(r?.surfaceId||\"\"),catalogId:typeof r?.catalogId==\"string\"?r.catalogId:void 0,theme:r?.theme,sendDataModel:!!r?.sendDataModel,components:Array.isArray(r?.components)?r.components:void 0,dataModel:r?.dataModel&&typeof r.dataModel==\"object\"&&!Array.isArray(r.dataModel)?r.dataModel:void 0,version:typeof e.version==\"string\"?e.version:this.version,metadata:r?.metadata&&typeof r.metadata==\"object\"&&!Array.isArray(r.metadata)?r.metadata:void 0})}if(\"updateComponents\"in e){let r=e.updateComponents;t.push({type:\"updateComponents\",surfaceId:String(r?.surfaceId||\"\"),components:Array.isArray(r?.components)?r.components:[]})}if(\"updateDataModel\"in e){let r=e.updateDataModel;t.push({type:\"updateDataModel\",surfaceId:String(r?.surfaceId||\"\"),path:typeof r?.path==\"string\"?r.path:void 0,value:r?.value})}if(\"deleteSurface\"in e){let r=e.deleteSurface;t.push({type:\"deleteSurface\",surfaceId:String(r?.surfaceId||\"\")})}if(\"callRendererFunction\"in e){let r=e.callRendererFunction,i=r?.callFunction||{};t.push({type:\"callRendererFunction\",surfaceId:typeof r?.surfaceId==\"string\"?r.surfaceId:void 0,functionCallId:String(r?.functionCallId||\"\"),call:String(i?.[\"@call\"]||i?.call||\"\"),version:this.version,catalogId:typeof i?.catalogId==\"string\"?i.catalogId:void 0,args:i?.args&&typeof i.args==\"object\"&&!Array.isArray(i.args)?i.args:{}})}if(\"agentFunctionResponse\"in e){let r=e.agentFunctionResponse;t.push({type:\"agentFunctionResponse\",functionCallId:String(r?.functionCallId||\"\"),version:this.version,value:r?.value,error:r?.error&&typeof r.error==\"object\"?r.error:void 0})}return t}};var Yu=class{constructor(){this.adapters=new Map([[\"0.8\",new Ra],[\"0.9\",new is],[\"0.9.1\",new is],[\"1.0\",new Oa]])}getAllKnownActions(){let e=new Set;for(let t of this.adapters.values())if(t.validActions)for(let r of t.validActions)e.add(r);return e}registerAdapter(e){let t=ke(e.version)??En(e.version);this.adapters.set(t,e)}getAdapter(e){let t=ke(e)??En(e),r=this.adapters.get(t);if(!r){let i=Array.from(new Set(Array.from(this.adapters.keys()).map(o=>o.startsWith(\"v\")?o:`v${o}`))).sort().join(\", \");throw new U(`[VersionAdapterFactory] Unsupported protocol version '${e}'. Supported versions: ${i}.`)}return r}resolveFromPayload(e){let t=Array.isArray(e)?e[0]:e;if(typeof t==\"object\"&&t!==null){if(\"messages\"in t&&Array.isArray(t.messages))return this.resolveFromPayload(t.messages);if(\"version\"in t){let r=t.version;if(typeof r!=\"string\")throw new U(`[VersionAdapterFactory] Message payload is missing a valid 'version' string: 'version' property must be a string, got ${typeof r}.`);return this.getAdapter(r)}if(\"beginRendering\"in t||\"surfaceUpdate\"in t||\"dataModelUpdate\"in t||\"deleteSurface\"in t)return this.getAdapter(\"v0.8\")}throw new U(\"[VersionAdapterFactory] Message payload is missing a valid 'version' string.\")}static registerAdapter(e){ti.registerAdapter(e)}static getAdapter(e){return ti.getAdapter(e)}static resolveFromPayload(e){return ti.resolveFromPayload(e)}static getAllKnownActions(){return ti.getAllKnownActions()}},ti=new Yu;lh(()=>ti.getAllKnownActions());var Hx=[\"id\",\"component\",\"catalogId\",\"metadata\"];function Gx(n){return n===Qi.name?Qi:void 0}function Kx(n,e){if(e.catalogId!==void 0)throw new U(`System function '${n}' belongs to no catalog and must not name a catalogId.`)}function Xu(n){return`Function call '${n}' has a non-string 'catalogId'.`}function Qu(n,e,{catalogIsDefault:t}){return n===void 0?t:n===e}var lr=class{constructor(e,t){this.catalog=e,this.config=t,this.enforceIdentifiers=ge(e.protocolVersion,\"1.0\")}get allowUnknown(){return this.config?this.config.allowUnknownElements??!1:!0}validateComponent(e,t){let r=e.id;if(typeof r!=\"string\"||!r)throw new U(`Component '${e.component}' is missing an 'id'; entries require a valid string 'id'.`);this.assertIdentifier(r,`Component id '${r}' must be a valid UAX #31 identifier`);let i=e.component,o=typeof i==\"string\"?i:t;if(!o)throw new U(`Cannot create component ${r} without a type.`);let s=e.catalogId,a=typeof s==\"string\"?s:void 0,c=Jx(e),u=this.catalog.components.get(o);if(!u){if(!this.allowUnknown)throw new U(`Unknown component type '${o}' not found in catalog '${this.catalog.id}'.`);this.validateNestedFunctions(c,a);return}let l=Xi(u.schema);this.validateCommonEnvelopeFields(c,l,o,r,a);let p=u.schema.safeParse(c);if(!p.success){let f=p.error.errors.map(Nn).join(\", \");throw new U(`Validation failed for component '${o}' (${r}): ${f}`,p.error.issues)}this.validateNestedFunctions(c,a)}validateCommonEnvelopeFields(e,t,r,i,o){if(\"accessibility\"in e&&!t?.has(\"accessibility\")){let s=e.accessibility;delete e.accessibility;let a=tr.optional().safeParse(s);if(!a.success){let c=a.error.errors.map(Nn).join(\", \");throw new U(`Validation failed for component '${r}' (${i}): ${c}`,a.error.issues)}this.validateNestedFunctions(s,o)}if(\"metadata\"in e&&!t?.has(\"metadata\")){let s=e.metadata;delete e.metadata;let a=Lo.shape.metadata.safeParse(s);if(!a.success){let c=a.error.errors.map(Nn).join(\", \");throw new U(`Validation failed for component '${r}' (${i}): ${c}`,a.error.issues)}}}assertFunctionIdentifiers(e,t){if(this.assertIdentifier(e,`Function name '${e}' must be a valid UAX #31 identifier`,!0),this.enforceIdentifiers&&t!==void 0&&t!==null&&(typeof t!=\"object\"||Array.isArray(t)))throw new U(`Validation failed for function '${e}': Expected object, received ${Array.isArray(t)?\"array\":typeof t}`);if(t&&typeof t==\"object\"&&!Array.isArray(t)){let r=Object.keys(t);if(r.length>Ji)throw new U(`Function call '${e}' exceeds maximum allowed arguments count (${Ji})`);for(let i of r)this.assertIdentifier(i,`Function argument '${i}' in function '${e}' must be a valid UAX #31 identifier`)}}validateNestedFunctions(e,t){if(Array.isArray(e)){for(let o of e)this.validateNestedFunctions(o,t);return}if(typeof e!=\"object\"||e===null)return;let r=e;this.enforceIdentifiers&&wa(Object.keys(r),this.catalog.protocolVersion);let i=this.enforceIdentifiers?r[\"@call\"]:r.call??r.function;if(typeof i==\"string\"&&(this.enforceIdentifiers||i.length>0)){let o=r.args,s=o!==void 0?o:{};if(!this.enforceIdentifiers)this.validateFunction(i,s);else if(i.startsWith(\"@\"))Kx(i,r),this.validateFunction(i,s);else{let a=r.catalogId;if(a!==void 0&&typeof a!=\"string\")throw new U(Xu(i));Qu(a,this.catalog.id,{catalogIsDefault:t===void 0})?this.validateFunction(i,s):this.assertFunctionIdentifiers(i,s)}}for(let o of Object.values(r))this.validateNestedFunctions(o,t)}validateFunction(e,t){this.assertFunctionIdentifiers(e,t);let r=this.enforceIdentifiers&&e.startsWith(\"@\")?Gx(e):this.catalog.functions.get(e);if(!r){if(!this.allowUnknown)throw new U(`Unrecognized function '${e}'`);return t??{}}if(!r.schema){if(t!==void 0&&(typeof t!=\"object\"||t===null||Array.isArray(t)))throw new U(`Validation failed for function '${e}': Expected object, received ${Array.isArray(t)?\"array\":typeof t}`);return t??{}}let i=r.schema.safeParse(t??{});if(!i.success){let o=i.error.errors.map(Nn).join(\", \");throw new U(`Validation failed for function '${e}': ${o}`,i.error.issues)}return i.data}validateTheme(e){let t=this.catalog.themeSchema;if(!t)return e;let r=t.safeParse(e);if(!r.success){let i=r.error.errors.map(Nn).join(\", \");throw new U(`Validation failed for theme: ${i}`,r.error.issues)}return r.data}assertIdentifier(e,t,r=!1){if(this.enforceIdentifiers&&!Eu(e,r))throw new U(t)}};function Jx(n){let e={};for(let[t,r]of Object.entries(n))Hx.includes(t)||(e[t]=r);return e}var Na=class{constructor(e,t){if(this.pendingAgentCalls=new Map,this.isDisposed=!1,Array.isArray(e))this.catalogs=e,this.outboundListener=t,this.defaultTimeoutMs=3e4;else{let r=e??{};this.catalogs=r.catalogs??[],this.outboundListener=r.outboundListener,this.defaultTimeoutMs=r.defaultTimeoutMs??3e4}}get disposed(){return this.isDisposed}async handleCallRendererFunction(e,t,r=!1){let i=this.validateInboundMessage(e);if(i)return await this.emitOutboundResponse(i),i;let{version:o,callRendererFunction:s}=e,{surfaceId:a,functionCallId:c,callFunction:u}=s;if(a!==void 0&&t?.surface?.id!==a){let $=this.createResponseError(c,we.INVALID_FUNCTION_CALL,`Surface not found: ${a}`,o);return await this.emitOutboundResponse($),$}let l=u[\"@call\"]??u.call,{catalogId:p,args:f}=u,m=this.resolveFunctionImplementation(p,l,t,o);if(\"error\"in m){let $=this.createResponseError(c,we.INVALID_FUNCTION_CALL,m.error,o);return await this.emitOutboundResponse($),$}let g=this.checkExecutionPermissions(m.funcImpl,l,r);if(g){let $=this.createResponseError(c,we.INVALID_FUNCTION_CALL,g,o);return await this.emitOutboundResponse($),$}let h=this.ensureDataContext(t,m.catalog,c),y=this.resolveDynamicArguments(f,h,r);if(\"error\"in y){let $=this.createResponseError(c,we.EXECUTION_ERROR,y.error,o);return await this.emitOutboundResponse($),$}let v=this.parseArguments(m.catalog,m.funcImpl,y.args,l);if(\"error\"in v){let $=this.createResponseError(c,we.INVALID_FUNCTION_CALL,v.error,o);return await this.emitOutboundResponse($),$}let x=await this.executeFunctionSafely(m.funcImpl,v.args,h,c,o);return await this.emitOutboundResponse(x),x}handleAgentFunctionResponse(e){if(!e||!e.agentFunctionResponse)return;let{functionCallId:t,value:r,error:i}=e.agentFunctionResponse,o=this.pendingAgentCalls.get(t);if(o)if(this.pendingAgentCalls.delete(t),i){let s=i.code??we.UNKNOWN_ERROR,a=i.message??\"Agent function execution failed\";o.reject(new Zt(a,s,t,i))}else o.resolve(r)}callAgentFunction(e,t,r){if(this.isDisposed)return Promise.reject(new Zt(\"RpcHandler has been disposed.\",we.DISPOSED));if(!this.outboundListener)return Promise.reject(new Zt(\"Cannot call agent function without outboundListener configured.\",we.NO_LISTENER));let i=t?.[\"@call\"]??t?.call;if(!t||!i)return Promise.reject(new Zt(\"Missing or invalid function call name.\",we.INVALID_FUNCTION_CALL));let o=r??{},s=o.functionCallId??this.generateFunctionCallId(),a=o.timeoutMs??this.defaultTimeoutMs;if(this.pendingAgentCalls.has(s))return Promise.reject(new Zt(`A call with functionCallId '${s}' is already pending.`,we.DUPLICATE,s));let c={functionCallId:s,call:t,effectiveTimeoutMs:a,version:o.version};return this.dispatchAgentCall(e,c)}dispose(){if(!this.isDisposed){this.isDisposed=!0;for(let[e,t]of this.pendingAgentCalls.entries())t.reject(new Zt(`RpcHandler disposed while call '${e}' was pending.`,we.CANCELLED,e));this.pendingAgentCalls.clear()}}async emitOutboundResponse(e){if(this.outboundListener)try{let t=this.outboundListener(e);t&&typeof t.catch==\"function\"&&await t}catch{}}validateInboundMessage(e){if(!e)return this.createResponseError(\"unknown\",we.INVALID_FUNCTION_CALL,\"Inbound message is null or undefined.\",\"unknown\");let t=e.version;return this.isDisposed?this.createResponseError(e.callRendererFunction?.functionCallId??\"unknown\",we.DISPOSED,\"RpcHandler has been disposed.\",t):e.callRendererFunction?.callFunction?null:this.createResponseError(e.callRendererFunction?.functionCallId??\"unknown\",we.INVALID_FUNCTION_CALL,\"Malformed message: missing callRendererFunction or callFunction.\",t)}resolveFunctionImplementation(e,t,r,i){let o;if(e&&(o=r?.surface?.availableCatalogs?.get(e)??this.catalogs.find(a=>a.id===e),!o))return{error:`Catalog not found: ${e}`};if(!o)return{error:\"No catalog available for function resolution.\"};if(o.protocolVersion&&i&&!dn(o.protocolVersion,i))return{error:`Catalog '${o.id}' specification version (${o.protocolVersion}) does not match message protocol version (${i}).`};let s=o.functions?.get(t);return s?{funcImpl:s,catalog:o}:{error:`Function not found: ${t}`}}ensureDataContext(e,t,r){if(e instanceof Mt&&e.surface)return e;let i=new Map;for(let s of this.catalogs)t.protocolVersion&&s.protocolVersion&&dn(t.protocolVersion,s.protocolVersion)&&i.set(s.id,s);i.set(t.id,t);let o=new ei(`_rpc_fallback_${r||\"default\"}`,t,i);return new Mt(o,\"/\")}resolveDynamicArguments(e,t,r){if(e===void 0||typeof e!=\"object\"||e===null||Array.isArray(e))return{args:e};let i={},o,s=t.surface?.onError.subscribe(a=>{!o&&a?.code===\"EXPRESSION_ERROR\"&&(o=a.message||\"An error occurred during function execution.\")});try{for(let[a,c]of Object.entries(e))i[a]=t.resolveDynamicValue(c,0,r)}catch(a){o=this.extractErrorMessage(a)||\"An error occurred during function execution.\"}finally{s?.unsubscribe()}return o?{error:o}:{args:i}}checkExecutionPermissions(e,t,r){let i=e.allowedCallers??\"rendererOnly\";return i===\"rendererOrAgent\"||i===\"agentOnly\"?e.requiresUserActivation&&!r?`Function '${t}' requires user activation context to execute.`:null:`Function '${t}' cannot be called by agent (allowedCallers is ${i}).`}parseArguments(e,t,r,i){try{return{args:new lr(e,{allowUnknownElements:!1}).validateFunction(i,r)}}catch(o){let s=this.extractErrorMessage(o);return{error:`Invalid function arguments for '${i}': ${s}`}}}async executeFunctionSafely(e,t,r,i,o){let s=o||\"v1.0\";try{let a=await Promise.resolve(e.execute(t,r)),c=On(a)?Be(a):a;return{version:s,rendererFunctionResponse:{functionCallId:i,value:c!==void 0?c:null}}}catch(a){let c=this.extractErrorMessage(a);return{version:s,rendererFunctionResponse:{functionCallId:i,error:{code:we.EXECUTION_ERROR,message:c||\"An error occurred during function execution.\"}}}}}generateFunctionCallId(){if(typeof globalThis.crypto?.randomUUID==\"function\")return globalThis.crypto.randomUUID();let e=Math.random().toString(36).substring(2,15).padEnd(13,\"0\");return`call-${Date.now()}-${e}`}dispatchAgentCall(e,t){let{functionCallId:r,call:i,effectiveTimeoutMs:o,version:s}=t;return new Promise((a,c)=>{let u,l=()=>{u&&(clearTimeout(u),u=void 0),this.pendingAgentCalls.delete(r)},p=(i[\"@call\"]??i.call)||\"unknown\";u=this.createTimeoutTimer(r,p,o,l,c),this.pendingAgentCalls.set(r,{resolve:f=>{l(),a(f)},reject:f=>{l(),c(f)}}),this.sendOutboundMessage(e,r,i,s,l,c)})}createTimeoutTimer(e,t,r,i,o){if(!(r<=0))return setTimeout(()=>{this.pendingAgentCalls.delete(e)&&(i(),o(new Zt(`Agent function call '${t}' timed out after ${r}ms.`,we.TIMEOUT,e)))},r)}sendOutboundMessage(e,t,r,i,o,s){let a={version:i||\"v1.0\",callAgentFunction:{surfaceId:e,functionCallId:t,callFunction:r}};try{let c=this.outboundListener(a);c&&typeof c.catch==\"function\"&&c.catch(u=>{o(),s(u)})}catch(c){o(),s(c)}}extractErrorMessage(e){return e instanceof Error?e.message:String(e)}createResponseError(e,t,r,i){return{version:i||\"v1.0\",rendererFunctionResponse:{functionCallId:e,error:{code:t,message:r}}}}};var Ma=class{constructor(e,t,r){this.actionHandler=t,this.catalogs=ch(e),this.model=new Fa,this.adapterRegistry=r?.adapterRegistry??ti,this.rpc=new Na({catalogs:this.catalogs,outboundListener:r?.outboundListener,defaultTimeoutMs:r?.defaultTimeoutMs}),r?.validationConfig?this.validationConfig={allowOrphanComponents:!1,allowDanglingReferences:!1,allowMissingRoot:!1,allowUnknownElements:!1,...r.validationConfig}:this.validationConfig=void 0,this.actionHandler&&this.model.onAction.subscribe(this.actionHandler)}callAgentFunction(e,t,r){return this.rpc.callAgentFunction(e,t,r)}dispose(){this.rpc.dispose()}getRendererCapabilities(e){if(!e?.versions||e.versions.length===0)throw new U(\"At least one protocol version must be provided in CapabilitiesOptions to generate renderer capabilities.\");let t=e.versions,r={};for(let i of t){let o={supportedCatalogIds:this.catalogs.map(a=>a.id)},s=e?.includeInlineCatalogs?this.catalogs.map(a=>tu(i,\"1.0\")>=0?this.generateInlineCatalog(a):this.generateLegacyInlineCatalog(a,e?.componentEnvelopeRef??\"common_types.json#/$defs/ComponentCommon\")):void 0;s&&(o.inlineCatalogs=s),r[i]=o}return r}getClientCapabilities(e){return this.getRendererCapabilities(e)}generateInlineCatalog(e){let t=e.toJson();t.catalogId=e.id;let r=typeof t.protocolVersion==\"string\"?t.protocolVersion:ke(e.protocolVersion)??e.protocolVersion;return t.protocolVersion=r.trim().replace(/^[vV](?=\\d)/,\"\"),t}generateLegacyInlineCatalog(e,t=\"common_types.json#/$defs/ComponentCommon\"){let r={};for(let[s,a]of e.components.entries()){let c={},u=[];if(a.schema&&typeof a.schema==\"object\"&&\"safeParse\"in a.schema){let m=_t(a.schema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});In(m,void 0,{stripAdditionalProperties:!0}),c=m.properties||{},u=Array.isArray(m.required)?m.required.filter(g=>g!==\"component\"&&g!==\"id\"):[]}let{component:l,id:p,...f}=c;r[s]={allOf:[{$ref:t},{properties:{component:{const:s},...f},required:[\"component\",...u]}]}}let i=[];for(let s of e.functions.values()){let a={type:\"object\",properties:{}};if(s.schema&&typeof s.schema==\"object\"&&\"safeParse\"in s.schema){let c=_t(s.schema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});In(c,void 0,{stripAdditionalProperties:!0}),a=c}i.push({name:s.name,...s.description?{description:s.description}:{},returnType:s.returnType,parameters:a})}let o;if(e.themeSchema){let s=_t(e.themeSchema,{target:\"jsonSchema2019-09\",$refStrategy:\"none\"});In(s,void 0,{stripAdditionalProperties:!0}),o=s.properties||void 0}return{catalogId:e.id,...Object.keys(r).length>0?{components:r}:{},...i.length>0?{functions:i}:{},...o?{theme:o}:{}}}getRendererDataModel(e){let t=Array.from(this.model.surfacesMap.values()).filter(s=>s.sendDataModel);if(t.length===0)return;if(e!==void 0){let s={};for(let a of t){let c=a.protocolVersion;(!c||dn(c,e))&&(s[a.id]=a.dataModel.get(\"/\"))}return Object.keys(s).length===0?void 0:{version:e,surfaces:s}}let r=new Set;for(let s of t)if(s.protocolVersion){let a=ke(s.protocolVersion),c=a?`v${a}`:s.protocolVersion;r.add(c)}if(r.size>1)throw new U(`Multiple protocol versions detected among active surfaces: ${Array.from(r).sort().join(\", \")}. Specify a target protocol version in getRendererDataModel(version).`);let i=r.size===1?r.values().next().value:\"v1.0\",o={};for(let s of t)o[s.id]=s.dataModel.get(\"/\");return{version:i,surfaces:o}}getClientDataModel(e){return this.getRendererDataModel(e)}resolvePath(e,t){return sr.resolvePath(e,t)}getSurfaces(){return this.model.surfacesMap}getSurface(e){return this.model.getSurface(e)}onSurfaceCreated(e){return this.model.onSurfaceCreated.subscribe(e)}onSurfaceDeleted(e){return this.model.onSurfaceDeleted.subscribe(e)}processMessages(e,t){let r=this.prepareOperations(e);for(let i of r)this.processOperation(i,t)}async processMessagesAsync(e,t){let r=this.prepareOperations(e),i=[];for(let o of r){let s=await this.processOperationAsync(o,t);s&&i.push(s)}return i}prepareOperations(e){return!e||Array.isArray(e)&&e.length===0?[]:(this.validationConfig&&uh(e),this.validationConfig?.targetVersion&&this.validateTargetVersion(e),mh(e)?[e]:this.adapterRegistry.resolveFromPayload(e).extractOperations(e))}validateTargetVersion(e){let t=this.validationConfig?.targetVersion;if(!t)return;let r=i=>{if(typeof i==\"object\"&&i!==null&&\"version\"in i){let o=i.version;if(o){let s=ke(o)??o,a=ke(t)??t;if(s!==a)throw new U(`Message version '${o}' does not match expected target version '${t}'`)}}};if(Array.isArray(e))for(let i of e)r(i);else r(e)}applyStateOperation(e){if(this.validationConfig?.allowedMessages&&!this.validationConfig.allowedMessages.includes(e.type))throw new U(`Operation '${e.type}' is not permitted by ValidationConfig.allowedMessages`);switch(e.type){case\"createSurface\":this.processCreateSurfaceOp(e);break;case\"deleteSurface\":this.processDeleteSurfaceOp(e);break;case\"updateComponents\":this.processUpdateComponentsOp(e);break;case\"updateDataModel\":this.processUpdateDataModelOp(e);break;case\"agentFunctionResponse\":this.rpc.handleAgentFunctionResponse({version:e.version??\"v1.0\",agentFunctionResponse:{functionCallId:e.functionCallId,value:e.value,error:e.error}});break;case\"callRendererFunction\":break}}resolveRpcDataContext(e){if(e.surfaceId!==void 0){let o=this.model.surfacesMap.get(e.surfaceId);return o?new Mt(o,\"/\"):void 0}let t=e.catalogId?this.catalogs.find(o=>o.id===e.catalogId):void 0;if(!t)return;let r=`_rpc_fallback_${e.functionCallId||\"default\"}`,i=new Map;for(let o of this.catalogs)t?.protocolVersion&&o.protocolVersion&&dn(t.protocolVersion,o.protocolVersion)&&i.set(o.id,o);return t&&i.set(t.id,t),new Mt(new ei(r,t,i),\"/\")}processOperation(e,t){if(e.type===\"callRendererFunction\"){let r=this.resolveRpcDataContext(e),i=t?.isUserActivated??e.isUserActivated??!1,o={version:e.version??\"v1.0\",callRendererFunction:{...e.surfaceId!==void 0?{surfaceId:e.surfaceId}:{},functionCallId:e.functionCallId,callFunction:{call:e.call,catalogId:e.catalogId,args:e.args}}};this.rpc.handleCallRendererFunction(o,r,i).catch(s=>{console.error(`Unhandled error in callRendererFunction (${e.call}):`,s)});return}this.applyStateOperation(e)}async processOperationAsync(e,t){if(e.type===\"callRendererFunction\"){let r=this.resolveRpcDataContext(e),i=t?.isUserActivated??e.isUserActivated??!1,o={version:e.version??\"v1.0\",callRendererFunction:{...e.surfaceId!==void 0?{surfaceId:e.surfaceId}:{},functionCallId:e.functionCallId,callFunction:{call:e.call,catalogId:e.catalogId,args:e.args}}};return await this.rpc.handleCallRendererFunction(o,r,i)}return this.applyStateOperation(e),null}processCreateSurfaceOp(e){let{surfaceId:t,catalogId:r,theme:i,sendDataModel:o,components:s,dataModel:a}=e,c=e.version,u=r===void 0&&c!==void 0&&ge(c,\"1.0\"),l=u?void 0:Xx(this.catalogs,r,c);if(!l&&!u)throw r!==void 0?new Fe(`Catalog not found: ${r}`):new Fe(`No default catalog available for surface '${t}'.`);if(l?.protocolVersion&&c&&!dn(l.protocolVersion,c))throw new U(`Surface '${t}' catalog '${r??l.id}' specification version (${l.protocolVersion}) does not match message protocol version (${c}).`);if(this.model.getSurface(t))throw new qt(`Surface ${t} already exists.`);let p=i;if(i&&l?.themeSchema)try{p=new lr(l,this.validationConfig).validateTheme(i)}catch(h){throw h instanceof U?new U(h.message.replace(/^Validation failed for theme:/,`Validation failed for theme on surface '${t}':`),h.details):h}let f=l?.protocolVersion??c,m=new Map(this.catalogs.filter(h=>dn(h.protocolVersion,f)).map(h=>[h.id,h])),g=new ei(t,l,m,p,o??!1,void 0,e.rootId??\"root\",e.metadata,f);this.model.addSurface(g),a&&g.dataModel.set(\"/\",a),s&&s.length>0&&this.processUpdateComponentsOp({type:\"updateComponents\",surfaceId:t,components:s})}processDeleteSurfaceOp(e){e.surfaceId&&this.model.deleteSurface(e.surfaceId)}validateComponentProperties(e,t){let{id:r,component:i}=e;if(typeof r!=\"string\"||!r)throw new U(`Component '${i}' is missing an 'id'; entries require a valid string 'id'.`);let o=this.resolveComponentCatalog(e,t),s=t.componentsModel.get(r);new lr(o,this.validationConfig).validateComponent(this.componentPayloadForValidation(e,t,o),s?.type),this.validateNestedFunctionCalls(e,t,o)}componentPayloadForValidation(e,t,r){let{catalogId:i,...o}=e;return ge(t.protocolVersion,\"1.0\")&&r!==t.defaultCatalog&&(o.catalogId=r.id),o}resolveComponentCatalog(e,t){let{id:r,component:i,catalogId:o}=e,s=`Component '${r}'`,a=ge(t.protocolVersion,\"1.0\");if(typeof o==\"string\"&&(o||a))return this.resolveSurfaceItemCatalog(t,o,s);if(!a){let c=typeof r==\"string\"?t.componentsModel.get(r):void 0;if(c&&(typeof i!=\"string\"||!i||i===c.type))return c.catalog}return this.resolveSurfaceItemCatalog(t,void 0,s)}validateNestedFunctionCalls(e,t,r){if(!ge(t.protocolVersion,\"1.0\"))return;let i=o=>{if(Array.isArray(o)){o.forEach(i);return}if(typeof o!=\"object\"||o===null)return;let s=o,a=s[\"@call\"];if(typeof a==\"string\"&&!a.startsWith(\"@\")){let c=s.catalogId;if(c!==void 0&&typeof c!=\"string\")throw new U(Xu(a));let u=c,l=this.resolveSurfaceItemCatalog(t,u,`Function call '${a}'`);if(!Qu(u,r.id,{catalogIsDefault:r===t.defaultCatalog})){let f=s.args;new lr(l,this.validationConfig).validateFunction(a,f??{})}}Object.values(s).forEach(i)};for(let[o,s]of Object.entries(e))o===\"id\"||o===\"component\"||o===\"catalogId\"||o===\"metadata\"||i(s)}resolveSurfaceItemCatalog(e,t,r){if(t!==void 0&&!e.availableCatalogs.has(t)){let i=this.catalogs.find(o=>o.id===t);if(i)throw new Fe(`${r} names catalog '${t}', whose specification version (${i.protocolVersion}) does not match surface '${e.id}' version (${e.protocolVersion}).`)}return e.resolveCatalog(t,r)}applyComponentUpdate(e,t){let{id:r,component:i,catalogId:o,metadata:s,...a}=e;if(typeof r!=\"string\")return;let c=Yx(s),u=this.resolveComponentCatalog(e,t),l=t.componentsModel.get(r);if(l){let p=typeof i==\"string\"?i:l.type;if(p!==l.type||l.catalog.id!==u.id){t.componentsModel.removeComponent(r);let f=new cr(r,p,a,u,c);t.componentsModel.addComponent(f)}else l.metadata=c,l.properties=a}else{if(typeof i!=\"string\"||!i)throw new U(`Cannot create component ${r} without a type.`);let p=new cr(r,i,a,u,c);t.componentsModel.addComponent(p)}}processUpdateComponentsOp(e){if(!e.surfaceId)return;let t=this.model.getSurface(e.surfaceId);if(!t)throw new qt(`Surface not found for message: ${e.surfaceId}`);let r=new Set;for(let i of e.components){if(i&&typeof i==\"object\"&&typeof i.id==\"string\"){if(r.has(i.id))throw new qt(`Duplicate component ID: '${i.id}'`,[i.id]);r.add(i.id)}this.validateComponentProperties(i,t)}this.validateCompositionConstraints(t,e.components),this.validateCandidateTopology(t,e.components);for(let i of e.components)this.applyComponentUpdate(i,t)}processUpdateDataModelOp(e){if(!e.surfaceId)return;let t=this.model.getSurface(e.surfaceId);if(!t)throw new qt(`Surface not found for message: ${e.surfaceId}`);let r=e.path||\"/\",i=e.value;t.dataModel.set(r,i)}validateParentConstraints(e,t,r,i){if(!i||i.length===0){if((e===\"root\"||this.validationConfig&&this.validationConfig.allowOrphanComponents===!1)&&!r.includes(\"Surface\"))throw new U(`Component '${e}' (${t}) cannot be placed under parent 'Surface' (Surface). Allowed parents: ${JSON.stringify(r)}.`,void 0,\"UNALLOWED_PARENT\");return}for(let o of i)if(!r.includes(o.parentType))throw new U(`Component '${e}' (${t}) cannot be placed under parent '${o.parentId}' (${o.parentType||\"unknown\"}). Allowed parents: ${JSON.stringify(r)}.`,void 0,\"UNALLOWED_PARENT\")}validateChildConstraints(e,t,r,i,o){for(let s of i){let a=o.get(s);if(a&&!r.includes(a))throw new U(`Container '${e}' (${t}) cannot contain child '${s}' (${a}). Allowed children: ${JSON.stringify(r)}.`,void 0,\"UNALLOWED_CHILD\")}}buildCompositionTopology(e,t){let r=new Map,i=new Map,o=new Map;for(let[a,c]of e.componentsModel.entries){r.set(a,c.type),i.set(a,c.catalog);let u=e.componentsModel.getChildIds(a);u.length>0&&o.set(a,u)}for(let a of t){let{id:c,component:u,...l}=a;if(typeof c!=\"string\")continue;let p=this.resolveComponentCatalog(a,e);i.set(c,p);let f=e.componentsModel.get(c),m=(typeof u==\"string\"?u:f?.type)??\"\";m&&r.set(c,m);let g={id:c,component:m,...l},h=Array.from(Ia(g,p)).map(([y])=>y);h.length>0?o.set(c,h):o.delete(c)}let s=new Map;for(let[a,c]of o.entries()){let u=r.get(a)||\"Unknown\";for(let l of c){let p=s.get(l)??[];p.push({parentId:a,parentType:u}),s.set(l,p)}}return{typeMap:r,compCatalogMap:i,childMap:o,parentMap:s}}validateCompositionConstraints(e,t){let{typeMap:r,compCatalogMap:i,childMap:o,parentMap:s}=this.buildCompositionTopology(e,t);for(let[a,c]of r.entries()){let l=i.get(a)?.components.get(c);l&&(l.allowedParents&&l.allowedParents.length>0&&this.validateParentConstraints(a,c,l.allowedParents,s.get(a)),l.allowedChildren&&l.allowedChildren.length>0&&this.validateChildConstraints(a,c,l.allowedChildren,o.get(a)||[],r))}}validateCandidateTopology(e,t){if(!this.validationConfig)return;let r=new eo(e.defaultCatalog);for(let[i,o]of e.componentsModel.entries)r.addComponent(new cr(i,o.type,o.properties,o.catalog));for(let i of t){let{id:o,component:s,...a}=i;if(typeof o!=\"string\"||!o)continue;let c=this.resolveComponentCatalog(i,e);delete a.catalogId,delete a.metadata;let u=r.get(o),l=(typeof s==\"string\"?s:u?.type)||\"\";l&&(u?l!==u.type||u.catalog.id!==c.id?(r.removeComponent(o),r.addComponent(new cr(o,l,a,c))):u.properties=a:r.addComponent(new cr(o,l,a,c)))}r.validateTopology({...this.validationConfig,rootId:this.validationConfig.rootId??e.rootId})}};function Yx(n){if(n&&typeof n==\"object\"&&!Array.isArray(n))return n}function Xx(n,e,t){return e!==void 0?n.find(r=>r.id===e):n.find(r=>t?dn(r.protocolVersion,t):!0)??n[0]}var to=class{constructor(e,t,r=\"/\",i,o){let s=e.componentsModel.get(t);if(!s)throw new Xn(`Component not found: ${t}`);this.componentModel=s,this.surfaceComponents=e.componentsModel,this.theme=e.theme,this.dataContext=new Mt(e,r,o,i),this._actionDispatcher=a=>e.dispatchAction(a,this.componentModel.id)}dispatchAction(e){return this._actionDispatcher(e)}};var yh=new WeakMap;function tl(n){let e=yh.get(n);if(e)return e;let t=ja(n),r=t.type===\"OBJECT\"&&t.shape&&!(\"accessibility\"in t.shape)?{...t,shape:{...t.shape,accessibility:ja(tr)}}:t;return yh.set(n,r),r}function os(n){let e=n;for(;e;){let t=e._def?.typeName;if(t===\"ZodOptional\"||t===\"ZodNullable\"||t===\"ZodDefault\"||t===\"ZodReadonly\")e=e._def.innerType;else if(t===\"ZodEffects\")e=e._def.schema;else if(t===\"ZodBranded\")e=e._def.type;else if(t===\"ZodLazy\")e=e._def.getter();else break}return e}function dr(n){let e=n,t=\"\";for(;e&&(t=e.description??e._def?.description??\"\",!t);){let i=e._def?.typeName;if(i===\"ZodOptional\"||i===\"ZodNullable\"||i===\"ZodDefault\"||i===\"ZodReadonly\")e=e._def.innerType;else if(i===\"ZodEffects\")e=e._def.schema;else if(i===\"ZodBranded\")e=e._def.type;else if(i===\"ZodLazy\")e=e._def.getter();else break}if(!t||!t.startsWith(\"REF:\"))return\"\";let r=t.slice(4);return Kr(r.split(\"|\")[0])}function Qx(n){let e=dr(n);if(e===\"Checkable\"||e===\"CheckRule\")return!0;let t=os(n);if(t?._def?.typeName===\"ZodArray\"){let r=t._def.type;if(dr(r)===\"CheckRule\")return!0}return!1}function eA(n){if(dr(n)===\"Action\")return!0;let t=os(n)._def;return t?.typeName===\"ZodObject\"&&!!t.shape?.().event}function tA(n){let e=dr(n);if(e===\"DataBinding\"||e===\"FunctionCall\"||e.startsWith(\"Dynamic\"))return!0;let r=os(n)._def;if(r?.typeName!==\"ZodObject\")return!1;let i=r.shape?.()||{},o=Object.values(i).some(s=>dr(s)===\"ComponentId\");return(!!i[\"@path\"]||!!i.path||!!i[\"@call\"]||!!i.call)&&!o}function nA(n){if(er(n)===\"child-list\"||dr(n)===\"ChildList\")return!0;let t=os(n)._def;if(t?.typeName!==\"ZodObject\")return!1;let r=t.shape?.()||{};return Object.values(r).some(i=>dr(i)===\"ComponentId\")}function rA(n,e){return(n===\"DataBinding\"||n===\"FunctionCall\"||n.startsWith(\"Dynamic\"))&&e!==\"ZodObject\"&&e!==\"ZodArray\"}function iA(n){if(n.some(eA))return{type:\"ACTION\"};if(n.some(tA))return{type:\"DYNAMIC\"};if(n.some(nA))return{type:\"STRUCTURAL\"}}function oA(n){let e={};for(let[t,r]of Object.entries(n))e[t]=ja(r);return e}function ja(n){let e=dr(n);if(Qx(n))return{type:\"CHECKABLE\"};if(e===\"Action\")return{type:\"ACTION\"};let t=os(n);if(er(t)===\"child-list\"||e===\"ChildList\")return{type:\"STRUCTURAL\"};if(rA(e,t._def?.typeName))return{type:\"DYNAMIC\"};if(t._def.typeName===\"ZodUnion\"){let r=iA(t._def.options);if(r)return r}return t._def.typeName===\"ZodArray\"?{type:\"ARRAY\",element:ja(t._def.type)}:t._def.typeName===\"ZodObject\"?{type:\"OBJECT\",shape:oA(t._def.shape())}:{type:\"STATIC\"}}var bh=1e4;function nl(n){return Array.isArray(n)?n.length>bh?n.slice(0,bh):n:[]}var Mn=class{constructor(e,t){this.dataListeners=[],this.propsListeners=[],this.currentProps={},this.isConnected=!1,this.actionClosures=new Map,this.context=e,this.behaviorTree=tl(t),this.behaviorTree.type!==\"OBJECT\"&&(this.behaviorTree={type:\"OBJECT\",shape:{}}),this.resolveInitialProps()}resolveInitialProps(){let e=this.context.componentModel.properties,t=this.resolveAndBind(e,this.behaviorTree,[],!0);this.currentProps={...this.currentProps,...t||{}}}connect(){if(this.isConnected)return;this.isConnected=!0;let e=this.context.componentModel.onUpdated.subscribe(()=>{this.rebuildAllBindings()});this.compUnsub=()=>e.unsubscribe(),this.rebuildAllBindings()}rebuildAllBindings(){this.dataListeners.forEach(r=>r()),this.dataListeners=[];let e=this.context.componentModel.properties,t=this.resolveAndBind(e,this.behaviorTree,[],!1);this.currentProps={...this.currentProps,...t||{}},this.notify()}bindDynamicValue(e,t,r){let i=this.context.dataContext.subscribeDynamicValue(e,o=>{this.updateDeepValue(t,o),this.notify()});return r?i.unsubscribe():this.dataListeners.push(()=>i.unsubscribe()),i.value}resolveDeepSync(e,t=0){if(typeof e!=\"object\"||e===null)return e;if(t>Yi)return;if(\"path\"in e||\"call\"in e||\"@path\"in e||\"@call\"in e)return this.context.dataContext.resolveDynamicValue(e,t);if(Array.isArray(e))return e.map(i=>this.resolveDeepSync(i,t+1));let r={};for(let[i,o]of Object.entries(e))r[i]=this.resolveDeepSync(o,t+1);return r}resolveActionContext(e){if(typeof e!=\"object\"||e===null||Array.isArray(e))return;let t={};for(let[r,i]of Object.entries(e))t[r]=this.resolveDeepSync(i,1);return t}resolveEventAction(e){if(typeof e!=\"object\"||e===null)return e;let t=e;if(\"event\"in t&&typeof t.event==\"object\"&&t.event!==null){let r=t.event,i={...r,context:r.context?this.resolveActionContext(r.context):void 0};return r.userMessage!==void 0&&(i.userMessage=this.resolveDeepSync(r.userMessage,1)),{...t,event:i}}if(\"name\"in t){let r={...t,context:t.context?this.resolveActionContext(t.context):void 0};return t.userMessage!==void 0&&(r.userMessage=this.resolveDeepSync(t.userMessage,1)),r}return this.resolveDeepSync(e,0)}bindAction(e,t){let r=t.join(\"/\"),i=this.actionClosures.get(r);if(i&&el(i.raw,e))return i.closure;let o=async()=>{if(e&&typeof e==\"object\"){let s=e,a=!!(s.functionCall&&typeof s.functionCall==\"object\"),c=a?s.functionCall:s,u=c[\"@call\"]??c.call;if(typeof u==\"string\"){let l=a&&!(\"@call\"in c)?{\"@call\":u,...c}:c;await this.context.dataContext.resolveDynamicValue(l,0,!0);return}}return this.context.dispatchAction(this.resolveEventAction(e))};return this.actionClosures.set(r,{raw:e,closure:o}),o}mapTemplateChildren(e,t,r){let i=nl(e),o=this.context.dataContext.nested(r);return i.map((s,a)=>({id:t,basePath:o.nested(String(a)).path}))}bindStructuralTemplate(e,t,r){if(!e||typeof e!=\"object\"||Array.isArray(e))return e;let i=e,o=typeof i.path==\"string\"?i.path:void 0,s=typeof i.componentId==\"string\"?i.componentId:void 0;if(!o||!s)return e;let c=ge(this.context.dataContext.surface?.protocolVersion??this.context.dataContext.surface?.defaultCatalog?.protocolVersion,\"1.0\")?{\"@path\":o}:{path:o},u=this.context.dataContext.subscribeDynamicValue(c,l=>{let p=this.mapTemplateChildren(l,s,o);this.updateDeepValue(t,p),this.notify()});return r?u.unsubscribe():this.dataListeners.push(()=>u.unsubscribe()),this.mapTemplateChildren(u.value,s,o)}extractValidationResult(e,t){if(typeof e==\"object\"&&e!==null&&\"valid\"in e){let r=e,i=r.message,o=r.severity===\"warning\"||r.severity===\"info\"?r.severity:\"error\",s=typeof r.code==\"string\"?r.code:void 0;return{valid:!!r.valid,message:i!=null?String(i):t,...s!==void 0?{code:s}:{},severity:o}}return{valid:!!e,message:t,severity:\"error\"}}bindCheckable(e,t,r){let i=Array.isArray(e)?e:[],o=i.map(()=>({valid:!0,message:\"\",severity:\"error\"})),s=t.slice(0,-1),a=()=>{let u=o.filter(p=>!p.valid&&p.severity===\"error\").map(p=>p.message),l=o.filter(p=>!p.valid);this.updateDeepValue([...s,\"isValid\"],u.length===0),this.updateDeepValue([...s,\"validationErrors\"],u),this.updateDeepValue([...s,\"validationResults\"],l)},c=()=>{a(),this.notify()};return i.forEach((u,l)=>{let p=typeof u==\"object\"&&u!==null?u:void 0,f=p&&p.condition!==void 0?p.condition:u,m=typeof p?.message==\"string\"?p.message:\"Validation failed\";o[l].message=m;let g=this.context.dataContext.subscribeDynamicValue(f,h=>{o[l]=this.extractValidationResult(h,m),c()});r?g.unsubscribe():this.dataListeners.push(()=>g.unsubscribe()),o[l]=this.extractValidationResult(g.value,m)}),a(),e}bindObject(e,t,r,i){let o={};for(let[s,a]of Object.entries(e)){let c=t[s]||{type:\"STATIC\"};o[s]=this.resolveAndBind(a,c,[...r,s],i)}for(let[s,a]of Object.entries(t))if(a.type===\"DYNAMIC\"){let c=`set${s.charAt(0).toUpperCase()+s.slice(1)}`,u=e[s];o[c]=l=>{if(u&&typeof u==\"object\"){let p=u,f=this.context.dataContext.atLeastV10?\"@path\":\"path\",m=p[f];typeof m==\"string\"&&(this.context.dataContext.atLeastV10||!(\"componentId\"in p))&&this.context.dataContext.set(m,l)}}}return o}resolveAndBind(e,t,r,i){if(e==null)return e;switch(t.type){case\"DYNAMIC\":return this.bindDynamicValue(e,r,i);case\"ACTION\":return this.bindAction(e,r);case\"STRUCTURAL\":return this.bindStructuralTemplate(e,r,i);case\"CHECKABLE\":return this.bindCheckable(e,r,i);case\"STATIC\":return e;case\"ARRAY\":return Array.isArray(e)?e.map((o,s)=>this.resolveAndBind(o,t.element,[...r,s.toString()],i)):e;case\"OBJECT\":return typeof e!=\"object\"?e:this.bindObject(e,t.shape,r,i)}}updateDeepValue(e,t){this.currentProps=this.cloneAndUpdate(this.currentProps,e,t)}cloneAndUpdate(e,t,r){if(t.length===0)return r;let[i,...o]=t;if(Array.isArray(e)){let s=[...e];return s[Number(i)]=this.cloneAndUpdate(s[Number(i)],o,r),s}else{let s=typeof e==\"object\"&&e!==null?e:{};return{...s,[i]:this.cloneAndUpdate(s[i],o,r)}}}dispose(){this.isConnected&&(this.isConnected=!1,this.dataListeners.forEach(e=>e()),this.dataListeners=[],this.compUnsub&&(this.compUnsub(),this.compUnsub=void 0))}notify(){this.propsListeners.forEach(e=>e(this.currentProps))}subscribe(e){return this.propsListeners.length===0&&this.connect(),this.propsListeners.push(e),{unsubscribe:()=>{this.propsListeners=this.propsListeners.filter(t=>t!==e),this.propsListeners.length===0&&this.dispose()}}}get snapshot(){return this.currentProps}};function el(n,e){if(Object.is(n,e))return!0;if(typeof n!=\"object\"||typeof e!=\"object\"||n===null||e===null)return!1;if(Array.isArray(n)||Array.isArray(e))return!Array.isArray(n)||!Array.isArray(e)||n.length!==e.length?!1:n.every((i,o)=>el(i,e[o]));let t=Object.keys(n),r=Object.keys(e);return t.length!==r.length?!1:t.every(i=>Object.prototype.hasOwnProperty.call(e,i)&&el(n[i],e[i]))}var st=class{constructor(e){this.value=e}},ss=class extends st{constructor(e,t,r){super(e),this.set=t,this.path=r}};function no(n){return n instanceof ss}function _h(n,e){return no(n)!==no(e)||no(n)&&no(e)&&n.path!==e.path?!1:rl(n.value,e.value)}function rl(n,e){if(Object.is(n,e))return!0;if(Array.isArray(n)&&Array.isArray(e))return n.length===e.length&&n.every((t,r)=>rl(t,e[r]));if(vh(n)&&vh(e)){let t=Object.keys(n),r=Object.keys(e);return t.length===r.length&&t.every(i=>i in e&&rl(n[i],e[i]))}return!1}function vh(n){if(typeof n!=\"object\"||n===null)return!1;let e=Object.getPrototypeOf(n);return e===Object.prototype||e===null}var xh=Symbol.for(\"a2ui.nodeId\");function Ah(){let n=globalThis,e=(n[xh]??0)+1;return n[xh]=e,`a2ui-n${e}`}var La=\"Placeholder\";function xt(n){return n instanceof fr}var fr=class{constructor(e,t,r,i,o,s,a,c=\"resolved\"){this.id=Ah(),this._onDestroyed=new Ve,this.onDestroyed=this._onDestroyed,this.cleanups=[],this._disposed=!1,this.instanceId=e,this.componentId=t,this.type=r,this.dataPath=i,this.props=Ke(o),this.impl=s,this.context=a,this.state=c}get disposed(){return this._disposed}get isPlaceholder(){return this.state!==\"resolved\"}addCleanup(e){this.cleanups.push(e)}toJSON(){if(this.isPlaceholder)return{id:this.componentId,type:this.type,state:this.state};let e={id:this.componentId,type:this.type},t=Ye(this.props);for(let[r,i]of Object.entries(t))e[r]=Pa(i);return e}setProps(e){if(this._disposed)return;let t=Ye(this.props);sA(t,e)||Je(this.props,e)}dispose(){if(!this._disposed){this._disposed=!0;for(let e of this.cleanups)try{e()}catch(t){console.error(`ComponentNode cleanup error (${this.instanceId}):`,t)}this.cleanups=[],this._onDestroyed.emit(),this._onDestroyed.dispose()}}};function Pa(n){if(xt(n))return n.toJSON();if(n instanceof st)return Pa(n.value);if(typeof n==\"function\")return\"<Action>\";if(Array.isArray(n))return n.map(Pa);if(n&&typeof n==\"object\"){let e={};for(let[t,r]of Object.entries(n))e[t]=Pa(r);return e}return n}function sA(n,e){if(Object.is(n,e))return!0;let t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;for(let i of t)if(!Object.is(n[i],e[i]))return!1;return!0}var aA=\"REF:common_types.json#/$defs/ComponentId\",cA=\"REF:common_types.json#/$defs/ChildList\",Ch=new Map,il=new WeakMap;function Dh(n){let e=il.get(n);if(e)return e;let t=Ba(n);if(t.schema._def.typeName!==\"ZodObject\")return il.set(n,Ch),Ch;let r=new Map,i=t.schema.shape;for(let[s,a]of Object.entries(i)){let c=Ba(a);if(uA(c)||lA(c.schema)){r.set(s,{kind:\"list\"});continue}if(ol(c)){r.set(s,{kind:\"single\"});continue}if(c.schema._def.typeName===\"ZodArray\"){let u=Ba(c.schema._def.type);if(ol(u)){r.set(s,{kind:\"list\"});continue}if(u.schema._def.typeName===\"ZodObject\"){let l=new Set,p=u.schema.shape;for(let[f,m]of Object.entries(p))ol(Ba(m))&&l.add(f);l.size>0&&r.set(s,{kind:\"nested\",keys:l})}}}let o=r;return il.set(n,o),o}function Ba(n){let e=[],t=new Set,r=n;for(;;){r.description&&e.push(r.description);let i=er(r);i&&t.add(i);let o=r._def.typeName;if(o===\"ZodOptional\"||o===\"ZodNullable\"||o===\"ZodDefault\")r=r._def.innerType;else if(o===\"ZodEffects\")r=r._def.schema;else return{schema:r,descriptions:e,refs:t}}}function ol(n){return n.refs.has(\"component-id\")||wh(n.descriptions,aA)}function uA(n){return n.refs.has(\"child-list\")||wh(n.descriptions,cA)}function wh(n,e){return n.some(t=>t.startsWith(e))}function lA(n){return n._def.typeName!==\"ZodUnion\"?!1:n._def.options.some(t=>{if(t._def.typeName!==\"ZodObject\")return!1;let r=t.shape;return r.componentId&&r.path})}var dA=\"root\",al=\"/\",sl=new Map,Ua=class{constructor(e,t=e.defaultCatalog){if(this.records=new Map,this.nodesByEdge=new Map,this.nodesByComponentId=new Map,this.pendingParents=new Map,this.dispatchedErrors=new Map,this.modelSubs=[],this._disposed=!1,t!==e.defaultCatalog)throw new Xn(\"NodeResolver requires the same catalog instance its surface was constructed with.\");this.surface=e,this.rootId=e.rootId??dA,this.rootNode=Ke(void 0),this.modelSubs.push(e.componentsModel.onCreated.subscribe(r=>this.onComponentCreated(r))),this.modelSubs.push(e.componentsModel.onDeleted.subscribe(r=>this.onComponentDeleted(r))),e.componentsModel.get(this.rootId)&&this.buildRoot()}dispatchOnce(e,t,r,i){let o=this.dispatchedErrors.get(t);o||(o=new Map,this.dispatchedErrors.set(t,o));let s=o.get(r);s||(s=new Set,o.set(r,s)),!s.has(e)&&(s.add(e),this.surface.dispatchError({code:e,message:i}))}clearDispatched(e,t){let r=this.dispatchedErrors.get(e);r?.delete(t)&&r.size===0&&this.dispatchedErrors.delete(e)}get activeNodeCount(){return this.records.size}get disposed(){return this._disposed}dispose(){if(!this._disposed){this._disposed=!0;for(let e of this.modelSubs)e.unsubscribe();this.modelSubs.length=0;for(let e of[...this.records.keys()])this.disposeNode(e);this.pendingParents.clear(),this.dispatchedErrors.clear(),this.rootRecord=void 0,Je(this.rootNode,void 0)}}buildRoot(){if(this.rootRecord)return;let e=`>${At(this.rootId)}>${At(this.rootId)}@/`,t=this.createNode(this.rootId,al,e,void 0);this.rootRecord=this.records.get(t),Je(this.rootNode,t)}onComponentCreated(e){if(this._disposed)return;if(e.id===this.rootId){let r=this.surface.componentsModel.get(this.rootId);this.rootRecord&&this.rootRecord.componentModel!==r&&(this.disposeNode(this.rootRecord.node),this.rootRecord=void 0,r||Je(this.rootNode,void 0)),r&&this.buildRoot()}let t=this.pendingParents.get(e.id);if(t){this.pendingParents.delete(e.id);for(let r of t){let i=this.records.get(r);i&&!r.disposed&&this.materialize(i)}}}onComponentDeleted(e){if(this._disposed)return;this.dispatchedErrors.delete(e);let t=this.surface.componentsModel.get(e),r=this.nodesByComponentId.get(e);if(!r)return;let i=new Set,o=!1;for(let s of[...r]){let a=this.records.get(s);a&&(a.parent?i.add(a.parent):o=!0)}o&&this.rootRecord&&(t?this.rootRecord.componentModel!==t&&(this.disposeNode(this.rootRecord.node),this.rootRecord=void 0,this.buildRoot()):(this.disposeNode(this.rootRecord.node),this.rootRecord=void 0,Je(this.rootNode,void 0)));for(let s of i){let a=this.records.get(s);a&&!s.disposed&&this.materialize(a)}}createNode(e,t,r,i,o=1){let s=this.surface.componentsModel.get(e);if(!s){let f=this.registerNode(new fr(Va(e,t,o),e,La,t,{},void 0,void 0,\"pending\"),{edgeKey:r,parent:i,occurrence:o,refFields:sl});return i&&this.registerPendingParent(e,i),f.node}let a=this.catalogFor(s),c=a.components.get(s.type);if(!c)return this.dispatchOnce(\"UNKNOWN_COMPONENT_TYPE\",e,t,`Component '${e}' has type '${s.type}', which is not in catalog '${a.id}'.`),this.registerNode(new fr(Va(e,t,o),e,s.type,t,{},void 0,void 0,\"unknown-type\"),{edgeKey:r,parent:i,occurrence:o,refFields:sl,componentModel:s}).node;this.clearDispatched(e,t);let u=new to(this.surface,e,t,i?.context?.dataContext),l=new Mn(u,c.schema),p=this.registerNode(new fr(Va(e,t,o),e,s.type,t,{},c,u),{edgeKey:r,parent:i,occurrence:o,refFields:Dh(c.schema),behavior:tl(c.schema),componentModel:s,binder:l});return p.binderSub=l.subscribe(f=>{p.lastBinderProps=f,this.materialize(p)}),p.lastBinderProps=l.snapshot,this.materialize(p),p.node}catalogFor(e){return e.catalog}registerNode(e,t){let r={node:e,edgeKey:t.edgeKey,parent:t.parent,occurrence:t.occurrence,refFields:t.refFields,behavior:t.behavior,componentModel:t.componentModel,binder:t.binder,childEdges:new Map};this.records.set(e,r),this.nodesByEdge.set(t.edgeKey,e);let i=this.nodesByComponentId.get(e.componentId);return i||(i=new Set,this.nodesByComponentId.set(e.componentId,i)),i.add(e),r}childNode(e,t,r,i,o=1){let s=this.nodesByEdge.get(r);if(this.isCyclic(e,t,i))return s&&!s.disposed&&s.isPlaceholder&&this.records.get(s)?.occurrence===o?s:(s&&!s.disposed&&this.disposeNode(s),this.dispatchOnce(\"CYCLIC_REFERENCE\",e,t,`Component '${e}' at '${t}' is referenced by one of its own descendants; rendering a placeholder instead.`),this.registerNode(new fr(Va(e,t,o),e,La,t,{},void 0,void 0,\"cyclic\"),{edgeKey:r,parent:i,occurrence:o,refFields:sl}).node);if(s&&!s.disposed){let a=this.surface.componentsModel.get(e),c=a?this.catalogFor(a).components.get(a.type):void 0,u=this.records.get(s);if(s.componentId===e&&s.dataPath===t&&u?.occurrence===o&&(s.isPlaceholder?a===void 0&&s.state===\"pending\"||a!==void 0&&c===void 0&&s.state===\"unknown-type\"&&u?.componentModel===a:a!==void 0&&s.type===a.type&&u?.componentModel===a))return s.state===\"pending\"&&this.registerPendingParent(e,i),s;this.disposeNode(s)}return this.createNode(e,t,r,i,o)}registerPendingParent(e,t){let r=this.pendingParents.get(e);r||(r=new Set,this.pendingParents.set(e,r)),r.add(t)}isCyclic(e,t,r){for(let i=r;i;i=this.records.get(i)?.parent)if(i.componentId===e&&i.dataPath===t)return!0;return!1}materialize(e){if(e.node.disposed)return;let r={...e.lastBinderProps??e.binder?.snapshot??{}},i=new Map,o=e.componentModel?.properties;if(o)for(let l of e.refFields.keys())l in r&&!(l in o)&&delete r[l];let s=new Map,a=(l,p,f)=>{let m=`${At(p)}@${At(f)}`,g=(s.get(m)??0)+1;s.set(m,g);let h=`${e.edgeKey}>${l}>${m}`,y=this.childNode(p,f,h,e.node,g);return i.set(h,y),y};for(let[l,p]of e.refFields)switch(p.kind){case\"single\":{let f=r[l];typeof f==\"string\"&&f&&(r[l]=a(At(l),f,e.node.dataPath));break}case\"list\":{let f=r[l];if(!Array.isArray(f))break;let m=nl(f);r[l]=m.map((g,h)=>{if(typeof g==\"string\"&&g)return a(`${At(l)}[${h}]`,g,e.node.dataPath);if(g&&typeof g==\"object\"&&!Array.isArray(g)){let y=g;if(typeof y.id==\"string\"&&typeof y.basePath==\"string\")return a(`${At(l)}[${h}]`,y.id,y.basePath);if(typeof y.componentId==\"string\"&&y.componentId)return a(`${At(l)}[${h}]`,y.componentId,e.node.dataPath)}return g});break}case\"nested\":{let f=r[l];if(!Array.isArray(f))break;r[l]=f.map((m,g)=>{if(!m||typeof m!=\"object\"||Array.isArray(m))return m;let h={...m},y=!1;for(let v of p.keys){let x=h[v];typeof x==\"string\"&&x&&(h[v]=a(`${At(l)}[${g}].${At(v)}`,x,e.node.dataPath),y=!0)}return y?h:m});break}}for(let[l,p]of e.childEdges)if(!i.has(l)&&(this.disposeNode(p),p.isPlaceholder&&![...i.values()].some(m=>m.isPlaceholder&&m.componentId===p.componentId))){let m=this.pendingParents.get(p.componentId);m&&(m.delete(e.node),m.size===0&&this.pendingParents.delete(p.componentId))}e.childEdges=i;let c=e.behavior&&e.node.context?cl(r,e.behavior,o??{},e.node.context.dataContext):r,u=Ye(e.node.props);for(let l of Object.keys(c))c[l]=ul(u[l],c[l]);e.node.setProps(c)}disposeNode(e){if(e.disposed)return;let t=this.records.get(e);if(t){for(let i of t.childEdges.values())this.disposeNode(i);t.childEdges.clear(),t.binderSub?.unsubscribe(),t.binderSub=void 0,this.nodesByEdge.get(t.edgeKey)===e&&this.nodesByEdge.delete(t.edgeKey),this.records.delete(e)}let r=this.nodesByComponentId.get(e.componentId);r&&(r.delete(e),r.size===0&&this.nodesByComponentId.delete(e.componentId));for(let[i,o]of this.pendingParents)o.delete(e),o.size===0&&this.pendingParents.delete(i);e.state===\"cyclic\"&&this.clearDispatched(e.componentId,e.dataPath),e.dispose()}},fA={\"~\":\"~0\",\"#\":\"~1\",\"[\":\"~2\",\"]\":\"~3\",\">\":\"~4\",\"@\":\"~5\"};function At(n){return n.replace(/[~#[\\]>@]/g,e=>fA[e])}function Va(n,e,t){let r=e.replace(/\\/+$/,\"\")||al,i=e===al?At(n):`${At(n)}-[${At(r)}]`;return t>1?`${i}#${t}`:i}function cl(n,e,t,r){switch(e.type){case\"DYNAMIC\":{let i=r.atLeastV10?\"@path\":\"path\",o=t&&typeof t==\"object\"&&!Array.isArray(t)?t:void 0,s=o&&typeof o[i]==\"string\"&&!(\"componentId\"in o)?o[i]:void 0;return s===void 0?new st(n):new ss(n,a=>r.set(s,a),s)}case\"ARRAY\":{if(!Array.isArray(n))return n;let i=Array.isArray(t)?t:[];return n.map((o,s)=>cl(o,e.element,i[s],r))}case\"OBJECT\":{if(!n||typeof n!=\"object\"||Array.isArray(n))return n;let i=new Set;for(let[a,c]of Object.entries(e.shape))c.type===\"DYNAMIC\"&&i.add(`set${a.charAt(0).toUpperCase()}${a.slice(1)}`);let o=t&&typeof t==\"object\"&&!Array.isArray(t)?t:{},s={};for(let[a,c]of Object.entries(n))i.has(a)||(s[a]=cl(c,e.shape[a]??{type:\"STATIC\"},o[a],r));for(let[a,c]of Object.entries(e.shape))c.type===\"DYNAMIC\"&&!(a in s)&&(s[a]=new st(void 0));return s}default:return n}}function ul(n,e){if(Object.is(n,e))return e;if(n instanceof st&&e instanceof st)return _h(n,e)?n:e;if(xt(n)||xt(e))return e;if(Array.isArray(n)&&Array.isArray(e)&&n.length===e.length){let t=!0,r=e.map((i,o)=>{let s=ul(n[o],i);return Object.is(s,n[o])||(t=!1),s});return t?n:r}if(Eh(n)&&Eh(e)){let t=Object.keys(n),r=Object.keys(e);if(t.length===r.length){let i=!0,o={};for(let s of r){let a=ul(n[s],e[s]);o[s]=a,(!(s in n)||!Object.is(a,n[s]))&&(i=!1)}return i?n:o}}return e}function Eh(n){if(!n||typeof n!=\"object\"||Array.isArray(n)||xt(n))return!1;let e=Object.getPrototypeOf(n);return e===Object.prototype||e===null}var pn=Sn(d.string().describe(\"REF:#/$defs/ComponentId|The unique identifier for a component, used for both definitions and references within the same surface.\"),\"component-id\"),pr=d.object({path:d.string().describe(\"A JSON Pointer path to a value in the data model.\")}).strict().describe(\"REF:#/$defs/DataBinding\"),as=d.union([d.string(),d.number(),d.boolean(),d.array(d.any()),pr,d.lazy(()=>ni)]).describe(\"REF:#/$defs/DynamicValue|A value that can be a literal, a path, or a function call returning any type.\"),ni=d.object({call:d.string().describe(\"The name of the function to call.\"),args:d.record(d.string(),d.union([as,d.record(d.string(),d.any()).describe(\"A literal object argument (e.g. configuration).\")])).describe(\"Arguments passed to the function.\").optional(),returnType:d.enum([\"string\",\"number\",\"boolean\",\"array\",\"object\",\"any\",\"void\"]).describe(\"The expected return type of the function call.\").default(\"boolean\")}).describe(\"REF:#/$defs/FunctionCall|Invokes a named function on the client.\"),fe=d.union([d.string(),pr,ni]).describe(\"REF:#/$defs/DynamicString|Represents a string\"),Se=d.object({label:fe.optional(),description:fe.optional()}).describe(\"REF:#/$defs/AccessibilityAttributes|Attributes to enhance accessibility when using assistive technologies like screen readers.\"),pA=d.object({id:pn,accessibility:Se.optional()}).describe(\"REF:#/$defs/ComponentCommon\"),cs=Sn(d.union([d.array(pn).describe(\"A static list of child component IDs.\"),d.object({componentId:pn,path:d.string().describe(\"The path to the list of component property objects in the data model.\")}).strict().describe(\"A template for generating a dynamic list of children from a data model list. The `componentId` is the component to use as a template.\")]).describe(\"REF:#/$defs/ChildList\"),\"child-list\"),hn=d.union([d.number(),pr,ni]).describe(\"REF:#/$defs/DynamicNumber|Represents a value that can be either a literal number, a path to a number in the data model, or a function call returning a number.\"),mn=d.union([d.boolean(),pr,ni]).describe(\"REF:#/$defs/DynamicBoolean|A boolean value that can be a literal, a path, or a function call returning a boolean.\"),ll=d.union([d.array(d.string()),pr,ni]).describe(\"REF:#/$defs/DynamicStringList|Represents a value that can be either a literal array of strings, a path to a string array in the data model, or a function call returning a string array.\"),jn=d.object({condition:mn,message:d.string().describe(\"The error message to display if the check fails.\")}).strict().describe(\"REF:#/$defs/CheckRule|A single validation rule applied to an input component.\"),hA=d.object({checks:d.array(jn).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional()}).describe(\"REF:#/$defs/Checkable|Properties for components that support client-side checks.\"),dl=d.union([d.object({event:d.object({name:d.string().describe(\"The name of the action to be dispatched to the server.\"),context:d.record(d.string(),as).describe(\"A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.\").optional()}).strict().describe(\"The event to dispatch to the server.\")}).strict().describe(\"Triggers a server-side event.\"),d.object({functionCall:ni}).strict().describe(\"Executes a local client-side function.\")]).describe(\"REF:#/$defs/Action|Defines an interaction handler that can either trigger a server-side event or execute a local client-side function.\"),pt={ComponentId:pn,DataBinding:pr,DynamicValue:as,FunctionCall:ni,DynamicString:fe,AccessibilityAttributes:Se,ComponentCommon:pA,ChildList:cs,DynamicNumber:hn,DynamicBoolean:mn,DynamicStringList:ll,CheckRule:jn,Checkable:hA,Action:dl};function $e(n,e){return{...e,tagName:n.tagName,element:n}}var za=globalThis,qa=za.ShadowRoot&&(za.ShadyCSS===void 0||za.ShadyCSS.nativeShadow)&&\"adoptedStyleSheets\"in Document.prototype&&\"replace\"in CSSStyleSheet.prototype,fl=Symbol(),Sh=new WeakMap,us=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==fl)throw Error(\"CSSResult is not constructable. Use `unsafeCSS` or `css` instead.\");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(qa&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Sh.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Sh.set(t,e))}return e}toString(){return this.cssText}},Th=n=>new us(typeof n==\"string\"?n:n+\"\",void 0,fl),re=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s==\"number\")return s;throw Error(\"Value passed to 'css' function must be a 'css' function result: \"+s+\". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.\")})(i)+n[o+1],n[0]);return new us(t,n,fl)},kh=(n,e)=>{if(qa)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement(\"style\"),i=za.litNonce;i!==void 0&&r.setAttribute(\"nonce\",i),r.textContent=t.cssText,n.appendChild(r)}},pl=qa?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t=\"\";for(let r of e.cssRules)t+=r.cssText;return Th(t)})(n):n;var{is:mA,defineProperty:gA,getOwnPropertyDescriptor:yA,getOwnPropertyNames:bA,getOwnPropertySymbols:vA,getPrototypeOf:_A}=Object,Za=globalThis,$h=Za.trustedTypes,xA=$h?$h.emptyScript:\"\",AA=Za.reactiveElementPolyfillSupport,ls=(n,e)=>n,ds={toAttribute(n,e){switch(e){case Boolean:n=n?xA:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},Wa=(n,e)=>!mA(n,e),Ih={attribute:!0,type:String,converter:ds,reflect:!1,useDefault:!1,hasChanged:Wa};Symbol.metadata??=Symbol(\"metadata\"),Za.litPropertyMetadata??=new WeakMap;var Pn=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ih){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&gA(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=yA(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ih}static _$Ei(){if(this.hasOwnProperty(ls(\"elementProperties\")))return;let e=_A(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ls(\"finalized\")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ls(\"properties\"))){let t=this.properties,r=[...bA(t),...vA(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(pl(i))}else e!==void 0&&t.push(pl(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r==\"string\"?r:typeof e==\"string\"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return kh(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:ds).toAttribute(t,r.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){let r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),s=typeof o.converter==\"function\"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ds;this._$Em=i;let a=s.fromAttribute(t,o.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,r,i=!1,o){if(e!==void 0){let s=this.constructor;if(i===!1&&(o=this[e]),r??=s.getPropertyOptions(e),!((r.hasChanged??Wa)(o,t)||r.useDefault&&r.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:o},s){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),o!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r){let{wrapped:s}=o,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,o,a)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};Pn.elementStyles=[],Pn.shadowRootOptions={mode:\"open\"},Pn[ls(\"elementProperties\")]=new Map,Pn[ls(\"finalized\")]=new Map,AA?.({ReactiveElement:Pn}),(Za.reactiveElementVersions??=[]).push(\"2.1.2\");var ml=globalThis,Fh=n=>n,Ha=ml.trustedTypes,Rh=Ha?Ha.createPolicy(\"lit-html\",{createHTML:n=>n}):void 0,gl=\"$lit$\",Ln=`lit$${Math.random().toFixed(9).slice(2)}$`,yl=\"?\"+Ln,CA=`<${yl}>`,oi=document,ps=()=>oi.createComment(\"\"),hs=n=>n===null||typeof n!=\"object\"&&typeof n!=\"function\",bl=Array.isArray,Lh=n=>bl(n)||typeof n?.[Symbol.iterator]==\"function\",hl=`[ \t\n\\f\\r]`,fs=/<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g,Oh=/-->/g,Nh=/>/g,ri=RegExp(`>|${hl}(?:([^\\\\s\"'>=/]+)(${hl}*=${hl}*(?:[^ \t\n\\f\\r\"'\\`<>=]|(\"|')|))|$)`,\"g\"),Mh=/'/g,jh=/\"/g,Bh=/^(?:script|style|textarea|title)$/i,vl=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),R=vl(1),RF=vl(2),OF=vl(3),Ue=Symbol.for(\"lit-noChange\"),k=Symbol.for(\"lit-nothing\"),Ph=new WeakMap,ii=oi.createTreeWalker(oi,129);function Vh(n,e){if(!bl(n)||!n.hasOwnProperty(\"raw\"))throw Error(\"invalid template strings array\");return Rh!==void 0?Rh.createHTML(e):e}var Uh=(n,e)=>{let t=n.length-1,r=[],i,o=e===2?\"<svg>\":e===3?\"<math>\":\"\",s=fs;for(let a=0;a<t;a++){let c=n[a],u,l,p=-1,f=0;for(;f<c.length&&(s.lastIndex=f,l=s.exec(c),l!==null);)f=s.lastIndex,s===fs?l[1]===\"!--\"?s=Oh:l[1]!==void 0?s=Nh:l[2]!==void 0?(Bh.test(l[2])&&(i=RegExp(\"</\"+l[2],\"g\")),s=ri):l[3]!==void 0&&(s=ri):s===ri?l[0]===\">\"?(s=i??fs,p=-1):l[1]===void 0?p=-2:(p=s.lastIndex-l[2].length,u=l[1],s=l[3]===void 0?ri:l[3]==='\"'?jh:Mh):s===jh||s===Mh?s=ri:s===Oh||s===Nh?s=fs:(s=ri,i=void 0);let m=s===ri&&n[a+1].startsWith(\"/>\")?\" \":\"\";o+=s===fs?c+CA:p>=0?(r.push(u),c.slice(0,p)+gl+c.slice(p)+Ln+m):c+Ln+(p===-2?a:m)}return[Vh(n,o+(n[t]||\"<?>\")+(e===2?\"</svg>\":e===3?\"</math>\":\"\")),r]},ms=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,c=this.parts,[u,l]=Uh(e,t);if(this.el=n.createElement(u,r),ii.currentNode=this.el.content,t===2||t===3){let p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=ii.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let p of i.getAttributeNames())if(p.endsWith(gl)){let f=l[s++],m=i.getAttribute(p).split(Ln),g=/([.?@])?(.*)/.exec(f);c.push({type:1,index:o,name:g[2],strings:m,ctor:g[1]===\".\"?Ka:g[1]===\"?\"?Ja:g[1]===\"@\"?Ya:ai}),i.removeAttribute(p)}else p.startsWith(Ln)&&(c.push({type:6,index:o}),i.removeAttribute(p));if(Bh.test(i.tagName)){let p=i.textContent.split(Ln),f=p.length-1;if(f>0){i.textContent=Ha?Ha.emptyScript:\"\";for(let m=0;m<f;m++)i.append(p[m],ps()),ii.nextNode(),c.push({type:2,index:++o});i.append(p[f],ps())}}}else if(i.nodeType===8)if(i.data===yl)c.push({type:2,index:o});else{let p=-1;for(;(p=i.data.indexOf(Ln,p+1))!==-1;)c.push({type:7,index:o}),p+=Ln.length-1}o++}}static createElement(e,t){let r=oi.createElement(\"template\");return r.innerHTML=e,r}};function si(n,e,t=n,r){if(e===Ue)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,o=hs(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=si(n,i._$AS(n,e.values),i,r)),e}var Ga=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??oi).importNode(t,!0);ii.currentNode=i;let o=ii.nextNode(),s=0,a=0,c=r[0];for(;c!==void 0;){if(s===c.index){let u;c.type===2?u=new ro(o,o.nextSibling,this,e):c.type===1?u=new c.ctor(o,c.name,c.strings,this,e):c.type===6&&(u=new Xa(o,this,e)),this._$AV.push(u),c=r[++a]}s!==c?.index&&(o=ii.nextNode(),s++)}return ii.currentNode=oi,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},ro=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=si(this,e,t),hs(e)?e===k||e==null||e===\"\"?(this._$AH!==k&&this._$AR(),this._$AH=k):e!==this._$AH&&e!==Ue&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Lh(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==k&&hs(this._$AH)?this._$AA.nextSibling.data=e:this.T(oi.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r==\"number\"?this._$AC(e):(r.el===void 0&&(r.el=ms.createElement(Vh(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new Ga(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=Ph.get(e.strings);return t===void 0&&Ph.set(e.strings,t=new ms(e)),t}k(e){bl(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let o of e)i===t.length?t.push(r=new n(this.O(ps()),this.O(ps()),this,this.options)):r=t[i],r._$AI(o),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=Fh(e).nextSibling;Fh(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ai=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,o){this.type=1,this._$AH=k,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,r.length>2||r[0]!==\"\"||r[1]!==\"\"?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=k}_$AI(e,t=this,r,i){let o=this.strings,s=!1;if(o===void 0)e=si(this,e,t,0),s=!hs(e)||e!==this._$AH&&e!==Ue,s&&(this._$AH=e);else{let a=e,c,u;for(e=o[0],c=0;c<o.length-1;c++)u=si(this,a[r+c],t,c),u===Ue&&(u=this._$AH[c]),s||=!hs(u)||u!==this._$AH[c],u===k?e=k:e!==k&&(e+=(u??\"\")+o[c+1]),this._$AH[c]=u}s&&!i&&this.j(e)}j(e){e===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??\"\")}},Ka=class extends ai{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===k?void 0:e}},Ja=class extends ai{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==k)}},Ya=class extends ai{constructor(e,t,r,i,o){super(e,t,r,i,o),this.type=5}_$AI(e,t=this){if((e=si(this,e,t,0)??k)===Ue)return;let r=this._$AH,i=e===k&&r!==k||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,o=e!==k&&(r===k||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==\"function\"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Xa=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){si(this,e)}},zh={M:gl,P:Ln,A:yl,C:1,L:Uh,R:Ga,D:Lh,V:si,I:ro,H:ai,N:Ja,U:Ya,B:Ka,F:Xa},DA=ml.litHtmlPolyfillSupport;DA?.(ms,ro),(ml.litHtmlVersions??=[]).push(\"3.3.3\");var qh=(n,e,t)=>{let r=t?.renderBefore??e,i=r._$litPart$;if(i===void 0){let o=t?.renderBefore??null;r._$litPart$=i=new ro(e.insertBefore(ps(),o),o,void 0,t??{})}return i._$AI(n),i};var _l=globalThis,hr=class extends Pn{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=qh(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ue}};hr._$litElement$=!0,hr.finalized=!0,_l.litElementHydrateSupport?.({LitElement:hr});var wA=_l.litElementPolyfillSupport;wA?.({LitElement:hr});(_l.litElementVersions??=[]).push(\"4.2.2\");var EA={attribute:!0,type:String,converter:ds,reflect:!1,hasChanged:Wa},SA=(n=EA,e,t)=>{let{kind:r,metadata:i}=t,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),r===\"setter\"&&((n=Object.create(n)).wrapped=!0),o.set(t.name,n),r===\"accessor\"){let{name:s}=t;return{set(a){let c=e.get.call(this);e.set.call(this,a),this.requestUpdate(s,c,n,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,n,a),a}}}if(r===\"setter\"){let{name:s}=t;return function(a){let c=this[s];e.call(this,a),this.requestUpdate(s,c,n,!0,a)}}throw Error(\"Unsupported decorator location: \"+r)};function gs(n){return(e,t)=>typeof t==\"object\"?SA(n,e,t):((r,i,o)=>{let s=i.hasOwnProperty(o);return i.constructor.createProperty(o,r),s?Object.getOwnPropertyDescriptor(i,o):void 0})(n,e,t)}function io(n){return gs({...n,state:!0,attribute:!1})}var gn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ct=n=>(...e)=>({_$litDirective$:n,values:e}),ht=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};function mr(n){return typeof n==\"object\"&&n!==null&&\"tagName\"in n&&typeof n.tagName==\"string\"&&\"element\"in n&&typeof n.element==\"function\"}var Zh=!1;function oo(n){if(typeof customElements>\"u\"){Zh||(Zh=!0,console.error(`Cannot register \"${n.tagName}\": \\`customElements\\` is not available in this environment, so universal components will not render.`));return}let e=customElements.get(n.tagName);if(!e){customElements.define(n.tagName,n.element);return}if(e!==n.element)throw new Error(`Custom element tag name collision for \"${n.tagName}\": attempted to register ${n.element.name||\"anonymous constructor\"}, but tag name is already registered with ${e.name||\"another constructor\"}.`)}var xl=class extends ht{render(e,t,r){return(!this.element||this.tagName!==e)&&(this.tagName=e,this.element=document.createElement(e)),this.element.node=r,this.element.context=t,this.element}},Wh=Ct(xl);function Al(n,e){if(xt(n))return TA(n);let t=n.componentModel.type,r=e?.components.get(t);return!r||!r.tagName?(console.warn(`Component implementation not found or missing tagName for type: ${t}`),k):(mr(r)&&typeof customElements<\"u\"&&!customElements.get(r.tagName)&&oo(r),Wh(r.tagName,n))}function TA(n){if(n.isPlaceholder||n.disposed||!n.context)return k;let e=n.impl;return e?.tagName?(mr(e)&&oo(e),Wh(e.tagName,n.context,n)):(console.warn(`Component implementation not found or missing tagName for type: ${n.type}`),k)}var ec=class{get props(){return this._props}constructor(e,t){this.host=e,this.binder=new Mn(this.host.context,t.schema),this._props=this.binder.snapshot,this.host.addController(this),this.host.isConnected&&this.hostConnected()}hostConnected(){this.subscription||(this.subscription=this.binder.subscribe(e=>{this._props=e,this.host.requestUpdate()})),this.componentsSubscription||(this.componentsSubscription=this.host.context.dataContext.surface?.componentsModel?.onCreated.subscribe(()=>{this.host.requestUpdate()}))}hostDisconnected(){this.subscription?.unsubscribe(),this.subscription=void 0,this.componentsSubscription?.unsubscribe(),this.componentsSubscription=void 0}dispose(){this.hostDisconnected(),this.binder.dispose()}};var Hh=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect==\"object\"&&typeof Reflect.decorate==\"function\")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ci=class extends hr{get controller(){return this._controller}adoptLightDomStyles(){if(typeof document>\"u\")return;let e=this.getRootNode(),t=this.constructor,r=t.styles;if(!r)return;let i=this.tagName.toLowerCase();if(!t._processedSheet&&t._processedCss===void 0){let c=(Array.isArray(r)?r:[r]).map(l=>l&&typeof l==\"object\"&&\"cssText\"in l?String(l.cssText):String(l)).join(`\n`).replace(/:where\\(:host\\)/g,`:where(${i})`).replace(/:host\\(([^)]+)\\)/g,`${i}$1`).replace(/:host/g,i),u=c;try{let l=new CSSStyleSheet;l.replaceSync(c);let p=m=>{if(typeof CSSStyleRule<\"u\"&&m instanceof CSSStyleRule)return`${m.selectorText.split(\",\").map(h=>(h=h.trim(),h===i||h.startsWith(i+\" \")||h.startsWith(i+\".\")||h.startsWith(i+\":\")||h.startsWith(i+\"[\")||h.startsWith(`:where(${i}`)||h.startsWith(`:is(${i}`)?h:`${i} ${h}`)).join(\", \")} { ${m.style.cssText} }`;if(typeof CSSMediaRule<\"u\"&&m instanceof CSSMediaRule){let g=Array.from(m.cssRules).map(p).join(`\n`);return`@media ${m.conditionText} {\n${g}\n}`}return m.cssText};u=Array.from(l.cssRules).map(p).join(`\n`);let f=new CSSStyleSheet;f.replaceSync(u),t._processedSheet=f}catch{}t._processedCss=u,t._processedStyle=re([u]),t._adoptedRoots=new WeakSet}let o=typeof ShadowRoot<\"u\"&&e instanceof ShadowRoot?e:typeof document<\"u\"?document:void 0;o&&(t._adoptedRoots||(t._adoptedRoots=new WeakSet),t._adoptedRoots.has(o)||(t._adoptedRoots.add(o),t._processedSheet&&o.adoptedStyleSheets&&(o.adoptedStyleSheets=[...o.adoptedStyleSheets,t._processedSheet])))}connectedCallback(){super.connectedCallback(),this.adoptLightDomStyles()}createController(){let e=this.api??this.findCatalogApi();if(!e)throw new Error(`[A2uiLitElement] Either define 'protected readonly api = ...' on ${this.constructor.name} or override 'createController()'.`);return new ec(this,e)}findCatalogApi(){if(this.node?.impl)return this.node.impl;let e=this.context?.componentModel;return e?e.catalog.components.get(e.type):void 0}renderNode(e,t){if(!e||!this.context?.dataContext)return k;let{surface:r,path:i}=this.context.dataContext;if(!r)return k;if(!!!r.componentsModel?.get(this.context.componentModel.id))return k;let s,a=t;if(typeof e==\"object\"?(s=e.id||e.componentId,a=a??e.basePath??e.path):s=e,!s||!r.componentsModel?.get(s))return k;if(a=a??i,this.node){let l=$A(this.node,s,a);if(l)return Al(l)}let c=new to(r,s,a),u=c.componentModel.catalog;return Al(c,u)}willUpdate(e){super.willUpdate(e);let t=e.has(\"context\");if(e.has(\"node\")&&this.node?.context&&this.node.context!==this.context&&(this.context=this.node.context,t=!0),t&&this.context){if(this._controller&&kA(this._controllerContext,this.context)){this._controllerContext=this.context;return}this._controller&&(this.removeController(this._controller),this._controller.dispose()),this._controller=this.createController(),this._controllerContext=this.context}}update(e){this._controller&&super.update(e)}};Hh([gs({type:Object})],ci.prototype,\"context\",void 0);Hh([gs({type:Object})],ci.prototype,\"node\",void 0);function kA(n,e){return n===e?!0:!n?.componentModel||!e?.componentModel||!n.dataContext||!e.dataContext?!1:n.componentModel===e.componentModel&&n.surfaceComponents===e.surfaceComponents&&n.theme===e.theme&&n.dataContext.surface===e.dataContext.surface&&n.dataContext.dataModel===e.dataContext.dataModel&&n.dataContext.path===e.dataContext.path&&n.dataContext.explicitIndex===e.dataContext.explicitIndex&&n.dataContext.parent===e.dataContext.parent}function $A(n,e,t){let r=i=>{if(xt(i))return i.componentId===e&&i.dataPath===t?i:void 0;if(i instanceof st)return r(i.value);if(Array.isArray(i)){for(let o of i){let s=r(o);if(s)return s}return}if(i&&typeof i==\"object\"&&Object.getPrototypeOf(i)===Object.prototype)for(let o of Object.values(i)){let s=r(o);if(s)return s}};return r(Ye(n.props))}var IA=`\n :where(:root) {\n color-scheme: light dark;\n }\n\n :where(.a2ui-dark) {\n color-scheme: dark;\n }\n\n :where(.a2ui-light) {\n color-scheme: light;\n }\n\n :where(:root), :where(.a2ui-dark), :where(.a2ui-light) {\n --a2ui-color-background: light-dark(#eee, #111);\n --a2ui-color-on-background: light-dark(#333, #eee);\n\n --a2ui-color-surface: light-dark(\n color-mix(in oklab, var(--a2ui-color-background) 85%, white),\n color-mix(in oklab, var(--a2ui-color-background) 95%, white)\n );\n --a2ui-color-on-surface: light-dark(#333, #eee);\n\n --a2ui-color-primary: #17e;\n --a2ui-color-primary-light: ${yn(\"light\",{colorVar:\"--a2ui-color-primary\"})};\n --a2ui-color-primary-dark: ${yn(\"dark\",{colorVar:\"--a2ui-color-primary\"})};\n --a2ui-color-primary-hover: ${yn(\"hover\",{darkVar:\"--a2ui-color-primary-dark\",lightVar:\"--a2ui-color-primary-light\"})};\n --a2ui-color-on-primary: #fff;\n\n --a2ui-color-secondary: light-dark(#ddd, #333);\n --a2ui-color-secondary-light: ${yn(\"light\",{colorVar:\"--a2ui-color-secondary\"})};\n --a2ui-color-secondary-dark: ${yn(\"dark\",{colorVar:\"--a2ui-color-secondary\",percentage:95})};\n --a2ui-color-secondary-hover: ${yn(\"hover\",{darkVar:\"--a2ui-color-secondary-dark\",lightVar:\"--a2ui-color-secondary-light\"})};\n --a2ui-color-on-secondary: light-dark(#333, #eee);\n\n --a2ui-border-radius: 0.25rem;\n --a2ui-color-border: light-dark(#ccc, #444);\n --a2ui-border-width: 1px;\n --a2ui-border: 1px solid var(--a2ui-color-border, #ccc);\n\n --a2ui-font-family-title: inherit;\n --a2ui-font-family-monospace: monospace;\n --a2ui-color-input: light-dark(#fff, #2a2a2a);\n --a2ui-color-on-input: light-dark(#333, #eee);\n\n --a2ui-grid-base: 0.5rem;\n --a2ui-spacing-xs: calc(var(--a2ui-spacing-s) / 2);\n --a2ui-spacing-s: calc(var(--a2ui-spacing-m) / 2);\n --a2ui-spacing-m: var(--a2ui-grid-base);\n --a2ui-spacing-l: calc(var(--a2ui-spacing-m) * 2);\n --a2ui-spacing-xl: calc(var(--a2ui-spacing-l) * 2);\n\n --a2ui-font-size: 1rem;\n --a2ui-font-scale: 1.2;\n --a2ui-font-size-xs: calc(var(--a2ui-font-size-s) / var(--a2ui-font-scale));\n --a2ui-font-size-s: calc(var(--a2ui-font-size-m) / var(--a2ui-font-scale));\n --a2ui-font-size-m: var(--a2ui-font-size);\n --a2ui-font-size-l: calc(var(--a2ui-font-size-m) * var(--a2ui-font-scale));\n --a2ui-font-size-xl: calc(var(--a2ui-font-size-l) * var(--a2ui-font-scale));\n --a2ui-font-size-2xl: calc(var(--a2ui-font-size-xl) * var(--a2ui-font-scale));\n\n --a2ui-line-height-headings: 1.2;\n --a2ui-line-height-body: 1.5;\n }\n`,tc;function FA(){return tc||(tc=new CSSStyleSheet,tc.replaceSync(IA)),tc}function Gh(n){if(typeof document>\"u\")return;let e=FA(),t=typeof document<\"u\"?document.adoptedStyleSheets:null;if(t&&typeof t.includes==\"function\"&&!t.includes(e))try{document.adoptedStyleSheets=[...t,e]}catch{}if(n&&n!==document){let r=n.adoptedStyleSheets;if(r&&typeof r.includes==\"function\"&&!r.includes(e))try{n.adoptedStyleSheets=[...r,e]}catch{}}}function yn(n,e){switch(n){case\"light\":{let t=e;return`color-mix(in oklab, var(${t.colorVar}) ${t.percentage??85}%, ${t.mixColor??\"white\"})`}case\"dark\":{let t=e;return`color-mix(in oklab, var(${t.colorVar}) ${t.percentage??85}%, ${t.mixColor??\"black\"})`}case\"hover\":{let t=e;return`light-dark(var(${t.darkVar}), var(${t.lightVar}))`}}}var nc=Id(Jh(),1);var RA=/^var\\(\\s*--[a-zA-Z0-9_-]+(?:\\s*,\\s*[^)]+)?\\s*\\)$/;function Cl(n){if(typeof n!=\"string\"||!n.trim())return!1;let e=n.trim();if(RA.test(e))return!0;if(typeof CSS<\"u\"&&typeof CSS.supports==\"function\")return CSS.supports(\"color\",e);let t=typeof nc.default==\"function\"?nc.default:nc.default?.default;return typeof t==\"function\"?t(e):!1}var Yh=d.object({primaryColor:d.string().refine(n=>Cl(n),\"primaryColor must be a valid CSS color (e.g. '#00BFFF', '#17e', 'red', 'rgb(255, 0, 0)')\").optional().describe(\"The primary brand color used for highlights (e.g., primary buttons, active borders). Renderers may generate variants of this color for different contexts. Format: Hexadecimal code, named color, or functional notation (e.g., '#00BFFF', 'red', 'rgb(255, 0, 0)').\"),iconUrl:d.string().optional().describe(\"A URL for an image that identifies the agent or tool associated with the surface.\"),agentDisplayName:d.string().optional().describe(\"Text to be displayed next to the surface to identify the agent or tool that created it.\")}).passthrough();var oe=class extends ci{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Gh()}willUpdate(e){super.willUpdate(e);let t=this.controller?.props;t&&t.weight!==void 0?this.style.flex=String(t.weight):this.style.removeProperty(\"flex\");let r=this.context?.theme?.primaryColor;typeof r==\"string\"&&Cl(r)?(this.style.setProperty(\"--a2ui-color-primary\",r),this.style.setProperty(\"--a2ui-color-primary-light\",yn(\"light\",{colorVar:\"--a2ui-color-primary\"})),this.style.setProperty(\"--a2ui-color-primary-dark\",yn(\"dark\",{colorVar:\"--a2ui-color-primary\"})),this.style.setProperty(\"--a2ui-color-primary-hover\",yn(\"hover\",{darkVar:\"--a2ui-color-primary-dark\",lightVar:\"--a2ui-color-primary-light\"}))):(this.style.removeProperty(\"--a2ui-color-primary\"),this.style.removeProperty(\"--a2ui-color-primary-light\"),this.style.removeProperty(\"--a2ui-color-primary-dark\"),this.style.removeProperty(\"--a2ui-color-primary-hover\")),this.applyAccessibilityAttributes(t?.accessibility)}renderValidationErrors(e){return e?.isValid===!1&&e.validationErrors?.length?e.validationErrors.map(t=>R`<div class=\"a2ui-error-message\">${t}</div>`):k}applyAccessibilityAttributes(e){this.setOrRemoveAttribute(\"aria-label\",e?.label),this.setOrRemoveAttribute(\"aria-description\",e?.description),this.setOrRemoveAttribute(\"aria-live\",e?.live),typeof e?.hidden==\"boolean\"?this.setAttribute(\"aria-hidden\",String(e.hidden)):this.removeAttribute(\"aria-hidden\")}setOrRemoveAttribute(e,t){t!=null&&t!==\"\"?this.setAttribute(e,String(t)):this.removeAttribute(e)}};var ui=class extends oe{render(){let e=this.controller.props;return e?R`\n <div class=\"a2ui-audio-player\">\n ${e.description?R`<div class=\"a2ui-audio-description\">${e.description}</div>`:k}\n <audio src=${e.url||k} controls class=\"a2ui-audio\">\n Your browser does not support the audio tag.\n </audio>\n </div>\n `:k}};ui.tagName=\"a2ui-audioplayer\";ui.styles=re`\n .a2ui-audio-player {\n display: flex;\n flex-direction: column;\n gap: var(--a2ui-spacing-xs, 0.25rem);\n background: var(--a2ui-audioplayer-background, transparent);\n border-radius: var(--a2ui-audioplayer-border-radius, 0);\n padding: var(--a2ui-audioplayer-padding, 0);\n width: 100%;\n }\n .a2ui-audio-description {\n font-size: var(--a2ui-font-size-s, 0.875rem);\n color: var(\n --a2ui-audioplayer-description-color,\n var(--a2ui-text-caption-color, light-dark(#666, #aaa))\n );\n }\n .a2ui-audio {\n width: 100%;\n }\n `;var at=Ct(class extends ht{constructor(n){if(super(n),n.type!==gn.ATTRIBUTE||n.name!==\"class\"||n.strings?.length>2)throw Error(\"`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.\")}render(n){return\" \"+Object.keys(n).filter(e=>n[e]).join(\" \")+\" \"}update(n,[e]){if(this.st===void 0){this.st=new Set,n.strings!==void 0&&(this.nt=new Set(n.strings.join(\" \").split(/\\s/).filter(r=>r!==\"\")));for(let r in e)e[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(e)}let t=n.element.classList;for(let r of this.st)r in e||(t.remove(r),this.st.delete(r));for(let r in e){let i=!!e[r];i===this.st.has(r)||this.nt?.has(r)||(i?(t.add(r),this.st.add(r)):(t.remove(r),this.st.delete(r)))}return Ue}});var li=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.isValid===!1,i={\"a2ui-button\":!0,[\"a2ui-button-\"+(e.variant??\"default\")]:!0};return R`\n <button\n type=\"button\"\n class=${at(i)}\n @click=${()=>{t||e.action?.()}}\n ?disabled=${t}\n >\n ${e.child?R`${this.renderNode(e.child)}`:k}\n </button>\n `}};li.tagName=\"a2ui-basic-button\";li.styles=re`\n .a2ui-button {\n padding: var(\n --a2ui-button-padding,\n var(--a2ui-spacing-m, 0.5rem) var(--a2ui-spacing-l, 1rem)\n );\n border-radius: var(--a2ui-button-border-radius, var(--a2ui-spacing-s, 0.25rem));\n border: var(\n --a2ui-button-border,\n var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)\n );\n cursor: pointer;\n margin: var(--a2ui-button-margin, var(--a2ui-spacing-m, 0.5rem));\n background: var(--a2ui-button-background, var(--a2ui-color-surface, #fff));\n box-shadow: var(--a2ui-button-box-shadow, none);\n font-weight: var(--a2ui-button-font-weight, normal);\n --_a2ui-text-margin: 0;\n --_a2ui-text-color: var(--a2ui-color-on-secondary, #333);\n color: var(--_a2ui-text-color);\n }\n .a2ui-button:hover {\n background-color: var(--a2ui-color-secondary-hover, #ddd);\n }\n .a2ui-button.a2ui-button-primary {\n background: var(--a2ui-color-primary, #17e);\n --_a2ui-text-color: var(--a2ui-color-on-primary, #fff);\n color: var(--_a2ui-text-color);\n border: none;\n }\n .a2ui-button.a2ui-button-primary:hover {\n background-color: var(--a2ui-color-primary-hover, #fbd);\n }\n .a2ui-button.a2ui-button-borderless {\n background: none;\n border: none;\n padding: 0;\n color: var(--a2ui-color-primary, #17e);\n }\n .a2ui-button:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n `;var di=class extends oe{render(){let e=this.controller.props;return e?R`\n <div class=\"a2ui-card\">${e.child?this.renderNode(e.child):k}</div>\n `:k}};di.tagName=\"a2ui-card\";di.styles=re`\n .a2ui-card {\n padding: var(--a2ui-card-padding, var(--a2ui-spacing-m, 16px));\n border-radius: var(--a2ui-card-border-radius, var(--a2ui-border-radius, 8px));\n box-shadow: var(--a2ui-card-box-shadow, 0 2px 4px rgba(0, 0, 0, 0.1));\n background: var(--a2ui-card-background, var(--a2ui-color-surface, #fff));\n color: var(--a2ui-color-on-surface, #333);\n border: var(\n --a2ui-card-border,\n var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)\n );\n margin: var(--a2ui-card-margin, var(--a2ui-spacing-m, 16px));\n }\n `;var fi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.isValid===!1,r={\"a2ui-checkbox\":!0,\"a2ui-invalid\":t},i={\"a2ui-invalid\":t};return R`\n <div class=\"a2ui-checkbox-container\">\n <label class=${at(r)}>\n <input\n type=\"checkbox\"\n class=${at(i)}\n .checked=${e.value||!1}\n @change=${o=>e.setValue?.(o.target.checked)}\n />\n <span class=\"a2ui-check-box-text\">${e.label}</span>\n </label>\n ${this.renderValidationErrors(e)}\n </div>\n `}};fi.tagName=\"a2ui-checkbox\";fi.styles=re`\n :host,\n a2ui-checkbox {\n display: block;\n }\n .a2ui-checkbox-container {\n display: flex;\n flex-direction: column;\n margin: var(--a2ui-checkbox-margin, var(--a2ui-spacing-m));\n }\n label.a2ui-checkbox {\n display: inline-flex;\n align-items: center;\n gap: var(--a2ui-checkbox-gap, var(--a2ui-spacing-s, 0.5rem));\n font-size: var(\n --a2ui-checkbox-label-font-size,\n var(--a2ui-label-font-size, var(--a2ui-font-size-s))\n );\n font-weight: var(--a2ui-checkbox-label-font-weight, var(--a2ui-label-font-weight, bold));\n cursor: pointer;\n }\n label.a2ui-invalid {\n color: var(--a2ui-checkbox-color-error, red);\n }\n input {\n width: var(--a2ui-checkbox-size, 1rem);\n height: var(--a2ui-checkbox-size, 1rem);\n background: var(--a2ui-checkbox-background, inherit);\n border: var(--a2ui-checkbox-border, var(--a2ui-border));\n border-radius: var(--a2ui-checkbox-border-radius, 4px);\n }\n input.a2ui-invalid {\n outline: 1px solid var(--a2ui-checkbox-color-error, red);\n }\n .a2ui-error-message {\n color: var(--a2ui-checkbox-color-error, red);\n font-size: var(--a2ui-font-size-xs, 0.75rem);\n margin-top: 4px;\n }\n `;var OA=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect==\"object\"&&typeof Reflect.decorate==\"function\")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},gr=class extends oe{constructor(){super(...arguments),this.filter=\"\"}render(){let e=this.controller?.props;if(!e)return k;let t=e.value,r=Array.isArray(t)?t:typeof t==\"string\"?[t]:[],i=e.variant===\"multipleSelection\",o=e.displayStyle===\"chips\",s=m=>{let g=e.setValue;typeof g==\"function\"&&(i?r.includes(m)?g(r.filter(h=>h!==m)):g([...r,m]):g([m]))},a=(e.options||[]).filter(m=>!e.filterable||this.filter===\"\"||String(m.label).toLowerCase().includes(this.filter.toLowerCase())),c=this.context?.dataContext?.surface?.id||\"default\",u=this.context?.componentModel?.id||\"choice-picker\",p=(this.context?.dataContext?.path||\"/\").replace(/[^a-zA-Z0-9-]/g,\"_\"),f=`a2ui-choice-${c}-${u}-${p}`;return R`\n ${e.label?R`<label>${e.label}</label>`:k}\n ${e.filterable?R`\n <input\n type=\"text\"\n class=\"a2ui-filter-input\"\n placeholder=\"Filter options...\"\n aria-label=\"Filter options\"\n .value=${this.filter}\n @input=${m=>this.filter=m.target.value}\n />\n `:k}\n <div\n class=${at({\"a2ui-choice-picker\":!0,\"a2ui-options-group\":!o,\"a2ui-chips-group\":o})}\n >\n ${a.map(m=>o?R`\n <button\n type=\"button\"\n class=${at({\"a2ui-chip\":!0,\"a2ui-chip-selected\":r.includes(m.value)})}\n aria-pressed=${r.includes(m.value)}\n @click=${()=>s(m.value)}\n >\n ${m.label}\n </button>\n `:R`\n <label class=\"a2ui-option-label\">\n <input\n type=${i?\"checkbox\":\"radio\"}\n name=${i?k:f}\n value=${m.value}\n .checked=${r.includes(m.value)}\n @change=${()=>s(m.value)}\n class=\"a2ui-option-input\"\n />\n <span class=\"a2ui-option-text\">${m.label}</span>\n </label>\n `)}\n </div>\n ${this.renderValidationErrors(e)}\n `}};gr.tagName=\"a2ui-choicepicker\";gr.styles=re`\n :host,\n .a2ui-choice-picker {\n display: flex;\n flex-direction: column;\n width: 100%;\n gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));\n padding: var(--a2ui-choicepicker-padding, 0);\n }\n .a2ui-options-group {\n display: flex;\n flex-direction: column;\n gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));\n }\n label,\n .a2ui-option-label {\n display: flex;\n align-items: center;\n gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));\n cursor: pointer;\n color: var(--a2ui-text-color-text, var(--a2ui-choicepicker-label-color, inherit));\n font-size: var(--a2ui-choicepicker-label-font-size, inherit);\n }\n :host,\n a2ui-choicepicker > label {\n font-size: var(\n --a2ui-choicepicker-label-font-size,\n var(--a2ui-label-font-size, var(--a2ui-font-size-s))\n );\n font-weight: var(--a2ui-choicepicker-label-font-weight, var(--a2ui-label-font-weight, bold));\n }\n .a2ui-filter-input {\n background-color: var(--a2ui-color-input, #fff);\n color: var(--a2ui-color-on-input, #333);\n border: var(\n --a2ui-textfield-border,\n var(--a2ui-border, 1px solid var(--a2ui-color-border, #ccc))\n );\n border-radius: var(--a2ui-textfield-border-radius, var(--a2ui-spacing-m, 4px));\n padding: var(\n --a2ui-choicepicker-filter-padding,\n var(--a2ui-spacing-xs, 4px) var(--a2ui-spacing-s, 8px)\n );\n margin-bottom: var(--a2ui-choicepicker-filter-margin-bottom, var(--a2ui-spacing-s, 0.25rem));\n font-family: inherit;\n }\n .a2ui-filter-input:focus {\n outline: none;\n border-color: var(--a2ui-textfield-color-border-focus, var(--a2ui-color-primary, #17e));\n }\n .a2ui-option-input {\n width: var(--a2ui-choicepicker-checkbox-size, 1rem);\n height: var(--a2ui-choicepicker-checkbox-size, 1rem);\n }\n .a2ui-chips-group {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: var(--a2ui-choicepicker-gap, var(--a2ui-spacing-xs, 0.25rem));\n }\n .a2ui-chip {\n padding: var(\n --a2ui-choicepicker-chip-padding,\n var(--a2ui-spacing-s, 4px) var(--a2ui-spacing-m, 8px)\n );\n border-radius: var(--a2ui-choicepicker-chip-border-radius, 999px);\n border: var(--a2ui-choicepicker-chip-border, 1px solid var(--a2ui-color-border, #ccc));\n background-color: var(--a2ui-choicepicker-chip-background, var(--a2ui-color-surface, #fff));\n color: var(--a2ui-color-on-surface, inherit);\n cursor: pointer;\n font-size: var(--a2ui-choicepicker-chip-font-size, var(--a2ui-font-size-xs, 0.75rem));\n font-family: inherit;\n font-weight: var(--a2ui-choicepicker-chip-font-weight, normal);\n transition: all 0.2s;\n }\n .a2ui-chip.a2ui-chip-selected {\n background-color: var(\n --a2ui-choicepicker-chip-background-selected,\n var(--a2ui-color-primary, #007bff)\n );\n color: var(--a2ui-color-on-primary, #fff);\n border-color: var(\n --a2ui-choicepicker-chip-background-selected,\n var(--a2ui-color-primary, #007bff)\n );\n }\n .a2ui-error-message {\n color: var(--a2ui-choicepicker-color-error, red);\n font-size: var(--a2ui-font-size-xs, 0.75rem);\n }\n `;OA([io()],gr.prototype,\"filter\",void 0);var{I:NA}=zh,Xh=n=>n;var em=n=>n.strings===void 0,Qh=()=>document.createComment(\"\"),so=(n,e,t)=>{let r=n._$AA.parentNode,i=e===void 0?n._$AB:e._$AA;if(t===void 0){let o=r.insertBefore(Qh(),i),s=r.insertBefore(Qh(),i);t=new NA(o,s,n,n.options)}else{let o=t._$AB.nextSibling,s=t._$AM,a=s!==n;if(a){let c;t._$AQ?.(n),t._$AM=n,t._$AP!==void 0&&(c=n._$AU)!==s._$AU&&t._$AP(c)}if(o!==i||a){let c=t._$AA;for(;c!==o;){let u=Xh(c).nextSibling;Xh(r).insertBefore(c,i),c=u}}}return t},yr=(n,e,t=n)=>(n._$AI(e,t),n),MA={},tm=(n,e=MA)=>n._$AH=e,nm=n=>n._$AH,rc=n=>{n._$AR(),n._$AA.remove()};var rm=(n,e,t)=>{let r=new Map;for(let i=e;i<=t;i++)r.set(n[i],i);return r},br=Ct(class extends ht{constructor(n){if(super(n),n.type!==gn.CHILD)throw Error(\"repeat() can only be used in text expressions\")}dt(n,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);let i=[],o=[],s=0;for(let a of n)i[s]=r?r(a,s):s,o[s]=t(a,s),s++;return{values:o,keys:i}}render(n,e,t){return this.dt(n,e,t).values}update(n,[e,t,r]){let i=nm(n),{values:o,keys:s}=this.dt(e,t,r);if(!Array.isArray(i))return this.ut=s,o;let a=this.ut??=[],c=[],u,l,p=0,f=i.length-1,m=0,g=o.length-1;for(;p<=f&&m<=g;)if(i[p]===null)p++;else if(i[f]===null)f--;else if(a[p]===s[m])c[m]=yr(i[p],o[m]),p++,m++;else if(a[f]===s[g])c[g]=yr(i[f],o[g]),f--,g--;else if(a[p]===s[g])c[g]=yr(i[p],o[g]),so(n,c[g+1],i[p]),p++,g--;else if(a[f]===s[m])c[m]=yr(i[f],o[m]),so(n,i[p],i[f]),f--,m++;else if(u===void 0&&(u=rm(s,m,g),l=rm(a,p,f)),u.has(a[p]))if(u.has(a[f])){let h=l.get(s[m]),y=h!==void 0?i[h]:null;if(y===null){let v=so(n,i[p]);yr(v,o[m]),c[m]=v}else c[m]=yr(y,o[m]),so(n,i[p],y),i[h]=null;m++}else rc(i[f]),f--;else rc(i[p]),p++;for(;m<=g;){let h=so(n,c[g+1]);yr(h,o[m]),c[m++]=h}for(;p<=f;){let h=i[p++];h!==null&&rc(h)}return this.ut=s,tm(n,c),Ue}});var jA={start:\"flex-start\",center:\"center\",end:\"flex-end\",spaceBetween:\"space-between\",spaceAround:\"space-around\",spaceEvenly:\"space-evenly\",stretch:\"stretch\"},PA={start:\"flex-start\",center:\"center\",end:\"flex-end\",stretch:\"stretch\",baseline:\"baseline\"};function LA(n){return typeof n==\"object\"&&n!==null?`${n.basePath??\"\"}/${n.id}`:String(n)}var pi=class extends oe{updated(e){super.updated(e);let t=this.controller.props;t&&(t.justify?this.style.justifyContent=jA[t.justify]??\"flex-start\":this.style.removeProperty(\"justify-content\"),t.align?this.style.alignItems=PA[t.align]??\"stretch\":this.style.removeProperty(\"align-items\"))}render(){let e=this.controller.props;if(!e)return k;let t=Array.isArray(e.children)?e.children:[];return R` ${br(t,LA,r=>R`${this.renderNode(r)}`)} `}};pi.tagName=\"a2ui-basic-column\";pi.styles=re`\n :host,\n a2ui-basic-column {\n display: flex;\n flex-direction: column;\n width: var(--a2ui-column-width, 100%);\n gap: var(--a2ui-column-gap, var(--a2ui-spacing-m));\n }\n `;function BA(){let n=new Date,e=n.getFullYear(),t=String(n.getMonth()+1).padStart(2,\"0\"),r=String(n.getDate()).padStart(2,\"0\");return`${e}-${t}-${r}`}function ao(n,e){if(!n)return\"\";if(n.includes(\"T\")){let[r,i]=n.split(\"T\");switch(e){case\"date\":return r?.substring(0,10)??\"\";case\"time\":return i?.substring(0,5)??\"\";case\"datetime-local\":return`${r?.substring(0,10)??\"\"}T${i?.substring(0,5)??\"\"}`}}return e===\"date\"?n.includes(\"-\")?n.substring(0,10):\"\":e===\"time\"&&n.includes(\":\")?n.substring(0,5):\"\"}var hi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.enableTime??!1,r=e.enableDate??!t,i=typeof e.value==\"string\"?e.value:e.value?String(e.value):\"\",o=typeof e.min==\"string\"?e.min:e.min?String(e.min):\"\",s=typeof e.max==\"string\"?e.max:e.max?String(e.max):\"\",a=ao(i,\"date\"),c=ao(i,\"time\"),u=ao(o,\"date\"),l=ao(s,\"date\"),p=ao(o,\"time\"),f=ao(s,\"time\"),m=h=>{let y=h.target.value;if(t){let v=i.includes(\"T\")?i.split(\"T\")[1]:i.includes(\":\")?i:\"00:00:00\";e.setValue?.(`${y}T${v}`)}else e.setValue?.(y)},g=h=>{let y=h.target.value;if(r){let v=i.includes(\"T\")?i.split(\"T\")[0]:i.includes(\"-\")?i:BA();e.setValue?.(`${v}T${y}:00`)}else e.setValue?.(y)};return R`\n <div class=\"a2ui-date-time-container\">\n ${e.label?R`<label class=\"a2ui-date-time-label\">${e.label}</label>`:k}\n <div class=\"a2ui-date-time-inputs\">\n ${r?R`\n <input\n type=\"date\"\n min=${u||k}\n max=${l||k}\n .value=${a}\n @change=${m}\n class=\"a2ui-date-time-input\"\n />\n `:k}\n ${t?R`\n <input\n type=\"time\"\n min=${p||k}\n max=${f||k}\n .value=${c}\n @change=${g}\n class=\"a2ui-date-time-input\"\n />\n `:k}\n </div>\n ${this.renderValidationErrors(e)}\n </div>\n `}};hi.tagName=\"a2ui-datetimeinput\";hi.styles=re`\n .a2ui-date-time-container {\n display: flex;\n flex-direction: column;\n gap: var(--a2ui-spacing-xs, 4px);\n width: var(--a2ui-datetimeinput-width, 100%);\n }\n input {\n box-sizing: border-box;\n width: 100%;\n }\n .a2ui-date-time-label {\n font-size: var(\n --a2ui-datetimeinput-label-font-size,\n var(--a2ui-label-font-size, var(--a2ui-font-size-s, 14px))\n );\n font-weight: var(--a2ui-datetimeinput-label-font-weight, bold);\n color: var(--a2ui-text-color-text, var(--a2ui-color-on-background, #333));\n }\n .a2ui-date-time-inputs {\n display: flex;\n gap: var(--a2ui-spacing-s, 8px);\n width: 100%;\n }\n .a2ui-date-time-input {\n padding: var(--a2ui-datetimeinput-padding, 8px);\n border-radius: var(--a2ui-datetimeinput-border-radius, 4px);\n border: var(--a2ui-datetimeinput-border, 1px solid var(--a2ui-color-border, #ccc));\n background-color: var(--a2ui-datetimeinput-background, var(--a2ui-color-input, #fff));\n color: var(--a2ui-datetimeinput-color, var(--a2ui-color-on-input, #333));\n font-family: inherit;\n flex: 1;\n }\n .a2ui-date-time-input::-webkit-datetime-edit,\n .a2ui-date-time-input::-webkit-datetime-edit-fields-wrapper {\n color: var(--a2ui-datetimeinput-color, var(--a2ui-color-on-input, #333));\n }\n .a2ui-error-message {\n color: var(--a2ui-datetimeinput-color-error, red);\n font-size: var(--a2ui-font-size-xs, 0.75rem);\n }\n `;var mi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let r={\"a2ui-divider\":!0,[\"a2ui-divider-\"+(e.axis??\"horizontal\")]:!0};return R`<hr class=${at(r)} />`}};mi.tagName=\"a2ui-divider\";mi.styles=re`\n .a2ui-divider {\n border: 0;\n border-top: var(\n --a2ui-divider-border,\n var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)\n );\n margin: var(--a2ui-divider-spacing, var(--a2ui-spacing-m, 16px)) 0;\n width: 100%;\n }\n .a2ui-divider.a2ui-divider-vertical {\n width: var(--a2ui-border-width, 1px);\n height: 100%;\n margin: 0 var(--a2ui-divider-spacing, var(--a2ui-spacing-m, 16px));\n border-top: 0;\n border-left: var(\n --a2ui-divider-border,\n var(--a2ui-border-width, 1px) solid var(--a2ui-color-border, #ccc)\n );\n }\n `;var im={play:\"play_arrow\",rewind:\"fast_rewind\",favoriteOff:\"favorite_border\",starOff:\"star_border\"};function VA(n){return im[n]?im[n]:n.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}var gi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.name;if(typeof t==\"object\"&&t!==null&&\"svgPath\"in t){let o=t.svgPath;return R`\n <svg class=\"a2ui-icon a2ui-icon-svg\" viewBox=\"0 0 24 24\">\n <path d=${o}></path>\n </svg>\n `}let i=typeof t==\"string\"?VA(t):\"\";return R`<i class=\"material-icons a2ui-icon\">${i}</i>`}};gi.tagName=\"a2ui-icon\";gi.styles=re`\n .a2ui-icon {\n display: inline-block;\n width: var(--a2ui-icon-size, 24px);\n height: var(--a2ui-icon-size, 24px);\n font-size: var(--a2ui-icon-size, 24px);\n font-style: normal;\n font-weight: normal;\n font-family: var(--a2ui-icon-font-family, 'Material Icons', 'Material Symbols Outlined');\n color: var(\n --a2ui-icon-color,\n var(--a2ui-text-color-text, var(--a2ui-color-on-background, #333))\n );\n font-variation-settings: var(--a2ui-icon-font-variation-settings, 'FILL' 1);\n line-height: 1;\n text-transform: none;\n letter-spacing: normal;\n word-wrap: normal;\n white-space: nowrap;\n direction: ltr;\n -webkit-font-smoothing: antialiased;\n text-rendering: optimizeLegibility;\n -moz-osx-font-smoothing: grayscale;\n font-feature-settings: 'liga';\n vertical-align: middle;\n }\n .a2ui-icon.a2ui-icon-svg {\n fill: currentColor;\n }\n `;var om=\"important\",UA=\" !\"+om,ic=Ct(class extends ht{constructor(n){if(super(n),n.type!==gn.ATTRIBUTE||n.name!==\"style\"||n.strings?.length>2)throw Error(\"The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.\")}render(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];return r==null?e:e+`${t=t.includes(\"-\")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,\"-$&\").toLowerCase()}:${r};`},\"\")}update(n,[e]){let{style:t}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let r of this.ft)e[r]==null&&(this.ft.delete(r),r.includes(\"-\")?t.removeProperty(r):t[r]=null);for(let r in e){let i=e[r];if(i!=null){this.ft.add(r);let o=typeof i==\"string\"&&i.endsWith(UA);r.includes(\"-\")||o?t.setProperty(r,o?i.slice(0,-11):i,o?om:\"\"):t[r]=i}}return Ue}});var zA={contain:\"contain\",cover:\"cover\",fill:\"fill\",none:\"none\",scaleDown:\"scale-down\"},yi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.variant||\"default\",r=e.fit||\"cover\",i=zA[r]??r;return R`<img\n src=${e.url}\n alt=${e.description||\"\"}\n style=${ic({objectFit:i})}\n class=\"a2ui-image a2ui-image-${t}\"\n />`}};yi.tagName=\"a2ui-image\";yi.styles=re`\n .a2ui-image {\n display: block;\n max-width: 100%;\n height: auto;\n border-radius: var(--a2ui-image-border-radius, 0);\n }\n .a2ui-image.a2ui-image-icon {\n width: var(--a2ui-image-icon-size, 24px);\n height: var(--a2ui-image-icon-size, 24px);\n }\n .a2ui-image.a2ui-image-avatar {\n width: var(--a2ui-image-avatar-size, 40px);\n height: var(--a2ui-image-avatar-size, 40px);\n border-radius: 50%;\n }\n .a2ui-image.a2ui-image-smallFeature {\n max-width: var(--a2ui-image-small-feature-size, 100px);\n }\n .a2ui-image.a2ui-image-largeFeature {\n max-height: var(--a2ui-image-large-feature-size, 400px);\n }\n .a2ui-image.a2ui-image-header {\n height: var(--a2ui-image-header-size, 200px);\n }\n `;var qA={start:\"flex-start\",center:\"center\",end:\"flex-end\",stretch:\"stretch\",baseline:\"baseline\"};function Dl(n){return typeof n==\"object\"&&n!==null?`${n.basePath??\"\"}/${n.id}`:String(n)}var bi=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=Array.isArray(e.children)?e.children:[],r=e.listStyle,i=e.direction||\"vertical\",o=e.align?qA[e.align]??\"stretch\":void 0,s=o?ic({alignItems:o}):k;return r===\"ordered\"?R`\n <ol class=\"a2ui-list a2ui-list-${i}\" style=${s}>\n ${br(t,Dl,a=>R`<li>${this.renderNode(a)}</li>`)}\n </ol>\n `:r===\"unordered\"?R`\n <ul class=\"a2ui-list a2ui-list-${i}\" style=${s}>\n ${br(t,Dl,a=>R`<li>${this.renderNode(a)}</li>`)}\n </ul>\n `:R`\n <div class=\"a2ui-list a2ui-list-${i}\" style=${s}>\n ${br(t,Dl,a=>R`<div class=\"a2ui-list-item-none\">${this.renderNode(a)}</div>`)}\n </div>\n `}};bi.tagName=\"a2ui-list\";bi.styles=re`\n .a2ui-list {\n display: flex;\n padding-inline-start: var(--a2ui-list-padding, var(--a2ui-spacing-l, 24px));\n margin: 0;\n }\n .a2ui-list.a2ui-list-vertical {\n flex-direction: column;\n gap: var(--a2ui-list-gap, var(--a2ui-spacing-s, 8px));\n }\n .a2ui-list.a2ui-list-horizontal {\n flex-direction: row;\n gap: var(--a2ui-list-gap, var(--a2ui-spacing-m, 16px));\n list-style-position: inside;\n }\n .a2ui-list-item-none {\n display: block;\n }\n .a2ui-list-horizontal .a2ui-list-item-none {\n display: inline-block;\n }\n `;var ZA=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect==\"object\"&&typeof Reflect.decorate==\"function\")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},vr=class extends oe{constructor(){super(...arguments),this.isOpen=!1}openModal(){this.isOpen=!0}closeModal(){this.isOpen=!1}render(){let e=this.controller.props;return e?R`\n <div class=\"a2ui-modal-wrapper\">\n <div @click=${()=>this.openModal()} class=\"a2ui-modal-trigger\">\n ${e.trigger?R`${this.renderNode(e.trigger)}`:k}\n </div>\n ${this.isOpen?R`\n <div class=\"a2ui-modal-overlay\" @click=${()=>this.closeModal()}>\n <div\n class=\"a2ui-modal-content\"\n role=\"dialog\"\n aria-modal=\"true\"\n @click=${t=>t.stopPropagation()}\n >\n <button\n type=\"button\"\n class=\"a2ui-modal-close\"\n aria-label=\"Close\"\n @click=${()=>this.closeModal()}\n >\n ×\n </button>\n ${e.content?R`${this.renderNode(e.content)}`:k}\n </div>\n </div>\n `:k}\n </div>\n `:k}};vr.tagName=\"a2ui-modal\";vr.styles=re`\n :host,\n a2ui-modal {\n display: inline-block;\n }\n .a2ui-modal-wrapper {\n display: inline-block;\n }\n .a2ui-modal-trigger {\n cursor: pointer;\n }\n .a2ui-modal-overlay {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: var(--a2ui-modal-backdrop-bg, rgba(0, 0, 0, 0.5));\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1000;\n }\n .a2ui-modal-content {\n background: var(--a2ui-modal-background, var(--a2ui-color-surface, #fff));\n padding: var(--a2ui-modal-padding, var(--a2ui-spacing-xl, 32px));\n border-radius: var(--a2ui-modal-border-radius, var(--a2ui-border-radius, 8px));\n position: relative;\n min-width: 300px;\n max-width: 80%;\n max-height: 80%;\n overflow-y: auto;\n box-shadow: var(--a2ui-modal-box-shadow, 0 10px 25px rgba(0, 0, 0, 0.2));\n }\n .a2ui-modal-close {\n position: absolute;\n top: 10px;\n right: 15px;\n border: none;\n background: none;\n font-size: 24px;\n cursor: pointer;\n color: var(--a2ui-text-caption-color, #999);\n }\n .a2ui-modal-close:hover {\n color: var(--a2ui-text-color, #333);\n }\n `;ZA([io()],vr.prototype,\"isOpen\",void 0);var WA={start:\"flex-start\",center:\"center\",end:\"flex-end\",spaceBetween:\"space-between\",spaceAround:\"space-around\",spaceEvenly:\"space-evenly\",stretch:\"stretch\"},HA={start:\"flex-start\",center:\"center\",end:\"flex-end\",stretch:\"stretch\",baseline:\"baseline\"};function GA(n){return typeof n==\"object\"&&n!==null?`${n.basePath??\"\"}/${n.id}`:String(n)}var vi=class extends oe{updated(e){super.updated(e);let t=this.controller.props;t&&(t.justify?this.style.justifyContent=WA[t.justify]??\"flex-start\":this.style.removeProperty(\"justify-content\"),t.align?this.style.alignItems=HA[t.align]??\"stretch\":this.style.removeProperty(\"align-items\"))}render(){let e=this.controller.props;if(!e)return k;let t=Array.isArray(e.children)?e.children:[];return R` ${br(t,GA,r=>R`${this.renderNode(r)}`)} `}};vi.tagName=\"a2ui-basic-row\";vi.styles=re`\n :host,\n a2ui-basic-row {\n display: flex;\n flex-direction: row;\n gap: var(--a2ui-row-gap, var(--a2ui-spacing-m));\n }\n `;var _i=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.min??0,r=e.max??100,i=\"steps\"in e?e.steps:void 0,o=typeof i==\"number\"&&i>0&&r>t?(r-t)/i:k;return R`\n <div class=\"a2ui-slider-container\">\n <div class=\"a2ui-slider-header\">\n <span class=\"a2ui-slider-label\">${e.label}</span>\n <span class=\"a2ui-slider-value\">${e.value}</span>\n </div>\n <input\n type=\"range\"\n min=${t}\n max=${r}\n step=${o}\n .value=${e.value?.toString()||\"0\"}\n @input=${s=>e.setValue?.(Number(s.target.value))}\n class=\"a2ui-slider\"\n />\n ${this.renderValidationErrors(e)}\n </div>\n `}};_i.tagName=\"a2ui-slider\";_i.styles=re`\n .a2ui-slider-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: var(--a2ui-spacing-xs, 4px);\n margin: var(--a2ui-slider-margin, var(--a2ui-spacing-m, 16px));\n }\n .a2ui-slider-header {\n display: flex;\n justify-content: space-between;\n font-size: var(\n --a2ui-slider-label-font-size,\n var(--a2ui-label-font-size, var(--a2ui-font-size-s, 14px))\n );\n font-weight: var(--a2ui-slider-label-font-weight, bold);\n color: var(--a2ui-text-color-text, var(--a2ui-color-on-background, #333));\n }\n .a2ui-slider {\n width: 100%;\n cursor: pointer;\n accent-color: var(--a2ui-slider-thumb-color, var(--a2ui-color-primary, #007bff));\n background: var(--a2ui-slider-track-color, var(--a2ui-color-secondary, #e9ecef));\n }\n .a2ui-error-message {\n color: var(--a2ui-slider-color-error, red);\n font-size: var(--a2ui-font-size-xs, 0.75rem);\n }\n `;var KA=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect==\"object\"&&typeof Reflect.decorate==\"function\")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},_r=class extends oe{constructor(){super(...arguments),this.activeIndex=0}willUpdate(e){super.willUpdate(e);let t=this.controller?.props;t?.tabs&&this.activeIndex>=t.tabs.length&&(this.activeIndex=0)}render(){let e=this.controller?.props;return!e||!e.tabs?k:R`\n <div class=\"a2ui-tabs\">\n <div class=\"a2ui-tab-bar\">\n ${e.tabs?.map((t,r)=>R`\n <button\n class=${at({\"a2ui-tab-button\":!0,\"a2ui-tab-button-active\":r===this.activeIndex})}\n @click=${()=>this.activeIndex=r}\n >\n ${t.title}\n </button>\n `)}\n </div>\n <div class=\"a2ui-tab-content\">\n ${e.tabs[this.activeIndex]?R`${this.renderNode(e.tabs[this.activeIndex].child)}`:k}\n </div>\n </div>\n `}};_r.tagName=\"a2ui-tabs\";_r.styles=re`\n .a2ui-tabs {\n display: flex;\n flex-direction: column;\n width: 100%;\n }\n .a2ui-tab-bar {\n display: flex;\n border-bottom: var(--a2ui-tabs-border, 2px solid var(--a2ui-color-border, #eee));\n gap: var(--a2ui-spacing-m, 16px);\n }\n .a2ui-tab-button {\n padding: var(--a2ui-spacing-s, 8px) var(--a2ui-spacing-m, 16px);\n border: none;\n background: var(--a2ui-tabs-header-background, transparent);\n cursor: pointer;\n font-weight: 500;\n color: var(--a2ui-tabs-header-color, var(--a2ui-text-caption-color, #666));\n border-bottom: 2px solid transparent;\n margin-bottom: -2px;\n }\n .a2ui-tab-button.a2ui-tab-button-active {\n background: var(--a2ui-tabs-header-background-active, transparent);\n color: var(--a2ui-tabs-header-color-active, var(--a2ui-color-primary, #007bff));\n border-bottom: 2px solid var(--a2ui-color-primary, #007bff);\n }\n .a2ui-tab-content {\n padding: var(--a2ui-tabs-content-padding, var(--a2ui-spacing-m, 16px) 0);\n }\n `;KA([io()],_r.prototype,\"activeIndex\",void 0);var xi=class extends Event{constructor(e,t,r,i){super(\"context-request\",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=r,this.subscribe=i??!1}};var co=class{constructor(e,t,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,s)),this.unsubscribe=s},this.host=e,t.context!==void 0){let o=t;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??!1}else this.context=t,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new xi(this.context,this.host,this.t,this.subscribe))}};function wl({context:n,subscribe:e}){return(t,r)=>{typeof r==\"object\"?r.addInitializer((function(){new co(this,{context:n,callback:i=>{t.set.call(this,i)},subscribe:e})})):t.constructor.addInitializer((i=>{new co(i,{context:n,callback:o=>{i[r]=o},subscribe:e})}))}}var sm=Symbol.for(\"A2UIMarkdown\");var am={markdown:sm};var ys=(n,e)=>{let t=n._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),ys(r,e);return!0},oc=n=>{let e,t;do{if((e=n._$AM)===void 0)break;t=e._$AN,t.delete(n),n=e}while(t?.size===0)},cm=n=>{for(let e;e=n._$AM;n=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(n))break;t.add(n),eC(e)}};function XA(n){this._$AN!==void 0?(oc(this),this._$AM=n,cm(this)):this._$AM=n}function QA(n,e=!1,t=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let o=t;o<r.length;o++)ys(r[o],!1),oc(r[o]);else r!=null&&(ys(r,!1),oc(r));else ys(this,n)}var eC=n=>{n.type==gn.CHILD&&(n._$AP??=QA,n._$AQ??=XA)},sc=class extends ht{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),cm(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(ys(this,e),oc(this))}setValue(e){if(em(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var bs=class extends ht{constructor(e){if(super(e),this.it=k,e.type!==gn.CHILD)throw Error(this.constructor.directiveName+\"() can only be used in child bindings\")}render(e){if(e===k||e==null)return this._t=void 0,this.it=e;if(e===Ue)return e;if(typeof e!=\"string\")throw Error(this.constructor.directiveName+\"() called with a non-string value\");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};bs.directiveName=\"unsafeHTML\",bs.resultType=1;var um=Ct(bs);var El;function Sl(n){El=n}var ac=class n extends sc{constructor(){super(...arguments),this.renderToken=0,this.lastValue=null,this.lastRenderer=void 0,this.lastTagClassMap=null}static resetWarningForTesting(){n.defaultMarkdownWarningLogged=!1}update(e,[t,r,i]){let o=r??El,s=JSON.stringify(i?.tagClassMap);return this.lastValue===t&&this.lastRenderer===o&&s===this.lastTagClassMap?Ue:(this.lastValue=t,this.lastRenderer=o,this.lastTagClassMap=s,this.render(t,o,i))}render(e,t,r){let i=t??El;if(i){let o=++this.renderToken;try{Promise.resolve(i(e,r)).then(s=>{this.isConnected&&o===this.renderToken&&this.setValue(um(s))}).catch(s=>{console.error(\"[MarkdownDirective] Error rendering markdown:\",s)})}catch(s){console.error(\"[MarkdownDirective] Synchronous error rendering markdown:\",s)}return R`<span class=\"no-markdown-renderer\">${e}</span>`}return n.defaultMarkdownWarningLogged||(console.warn(\"[MarkdownDirective]\",`can't render markdown because no markdown renderer is configured.\n`,\"Use `@a2ui/markdown-it`, or your own markdown renderer.\"),n.defaultMarkdownWarningLogged=!0),R`<span class=\"no-markdown-renderer\">${e}</span>`}};ac.defaultMarkdownWarningLogged=!1;var Tl=Ct(ac);var tC=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect==\"object\"&&typeof Reflect.decorate==\"function\")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},nC=new Set([\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"caption\"]),xr=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.variant||\"body\",r=typeof e.text==\"string\"?e.text:String(e.text??\"\"),i=typeof e.weight==\"number\"?`flex: ${e.weight};`:k;if(nC.has(t)){let s=R`${r}`;switch(t){case\"h1\":s=R`<h1>${r}</h1>`;break;case\"h2\":s=R`<h2>${r}</h2>`;break;case\"h3\":s=R`<h3>${r}</h3>`;break;case\"h4\":s=R`<h4>${r}</h4>`;break;case\"h5\":s=R`<h5>${r}</h5>`;break;case\"caption\":s=R`<em>${r}</em>`;break}return R`<span class=\"a2ui-text a2ui-text-${t}\" style=${i}\n >${s}</span\n >`}let o=Tl(r,this.markdownRenderer);return R`<span class=\"a2ui-text a2ui-text-${t}\" style=${i}\n >${o}</span\n >`}};xr.tagName=\"a2ui-basic-text\";xr.styles=re`\n :host {\n display: contents;\n }\n .a2ui-text p,\n .a2ui-text h1,\n .a2ui-text h2,\n .a2ui-text h3,\n .a2ui-text h4,\n .a2ui-text h5,\n .a2ui-text h6,\n .a2ui-text ol,\n .a2ui-text ul,\n .a2ui-text li,\n .a2ui-text blockquote,\n .a2ui-text pre {\n margin: var(--_a2ui-text-margin, 0);\n }\n .a2ui-text {\n color: var(--_a2ui-text-color, var(--a2ui-text-color-text, var(--a2ui-color-on-background)));\n }\n .a2ui-text h1,\n .a2ui-text h2,\n .a2ui-text h3,\n .a2ui-text h4,\n .a2ui-text h5,\n .a2ui-text h6 {\n font-family: var(--a2ui-font-family-title, inherit);\n line-height: var(--a2ui-line-height-headings, 1.2);\n }\n .a2ui-text h1 {\n font-size: var(--a2ui-font-size-2xl);\n }\n .a2ui-text h2 {\n font-size: var(--a2ui-font-size-xl);\n }\n .a2ui-text h3 {\n font-size: var(--a2ui-font-size-l);\n }\n .a2ui-text p,\n .a2ui-text h4 {\n font-size: var(--a2ui-font-size-m);\n }\n .a2ui-text h5 {\n font-size: var(--a2ui-font-size-s);\n }\n .a2ui-text p {\n line-height: var(--a2ui-line-height-body, 1.5);\n }\n .a2ui-text.a2ui-text-caption {\n font-size: var(--a2ui-font-size-xs);\n color: var(--a2ui-text-caption-color, light-dark(#666, #aaa));\n }\n .a2ui-text a {\n color: var(--a2ui-text-a-color, inherit);\n font-weight: var(--a2ui-text-a-font-weight, inherit);\n }\n `;tC([wl({context:am.markdown,subscribe:!0})],xr.prototype,\"markdownRenderer\",void 0);var Ai=class extends oe{render(){let e=this.controller.props;if(!e)return k;let t=e.isValid===!1,r=a=>e.setValue?.(a.target.value),i=\"text\";e.variant===\"number\"&&(i=\"number\"),e.variant===\"obscured\"&&(i=\"password\");let o={\"a2ui-textfield\":!0,\"a2ui-invalid\":t},s=\"placeholder\"in e&&e.placeholder||k;return R`\n ${e.label?R`<label>${e.label}</label>`:k}\n ${e.variant===\"longText\"?R`<textarea\n class=${at(o)}\n placeholder=${s}\n .value=${e.value||\"\"}\n @input=${r}\n ></textarea>`:R`<input\n type=${i}\n class=${at(o)}\n placeholder=${s}\n .value=${e.value||\"\"}\n @input=${r}\n />`}\n ${this.renderValidationErrors(e)}\n `}};Ai.tagName=\"a2ui-basic-textfield\";Ai.styles=re`\n :host,\n a2ui-basic-textfield {\n display: flex;\n flex-direction: column;\n width: var(--a2ui-textfield-width, 100%);\n gap: var(--a2ui-spacing-xs, 0.25rem);\n }\n .a2ui-textfield {\n box-sizing: border-box;\n width: 100%;\n background-color: var(--a2ui-color-input, #fff);\n color: var(--a2ui-color-on-input, #333);\n border: var(--a2ui-textfield-border, var(--a2ui-border));\n border-radius: var(--a2ui-textfield-border-radius, var(--a2ui-spacing-m));\n padding: var(--a2ui-textfield-padding, var(--a2ui-spacing-m));\n font-family: inherit;\n }\n .a2ui-textfield:focus {\n outline: none;\n border-color: var(--a2ui-textfield-color-border-focus, var(--a2ui-color-primary, #17e));\n }\n .a2ui-textfield.a2ui-invalid {\n border-color: var(--a2ui-textfield-color-error, red);\n }\n label {\n font-size: var(\n --a2ui-textfield-label-font-size,\n var(--a2ui-label-font-size, var(--a2ui-font-size-s))\n );\n font-weight: var(--a2ui-textfield-label-font-weight, var(--a2ui-label-font-weight, bold));\n }\n .a2ui-error-message {\n color: var(--a2ui-textfield-color-error, red);\n font-size: var(--a2ui-font-size-xs, 0.75rem);\n }\n `;var Ci=class extends oe{render(){let e=this.controller.props;return e?R`\n <div class=\"a2ui-video-container\">\n <video\n src=${e.url||k}\n poster=${\"posterUrl\"in e&&e.posterUrl||k}\n controls\n class=\"a2ui-video\"\n >\n Your browser does not support the video tag.\n </video>\n </div>\n `:k}};Ci.tagName=\"a2ui-video\";Ci.styles=re`\n .a2ui-video-container {\n width: 100%;\n max-width: 100%;\n }\n .a2ui-video {\n width: 100%;\n height: auto;\n display: block;\n border-radius: var(--a2ui-video-border-radius, 0);\n }\n `;var ue=fu(\"CatalogComponentCommon\",d.object({weight:d.number().describe(\"The relative weight of this component within a Row or Column. This is similar to the CSS 'flex-grow' property. Note: this may ONLY be set when the component is a direct descendant of a Row or Column.\").optional()})),rC=fu(\"theme\",d.object({primaryColor:d.string().regex(new RegExp(\"^#[0-9a-fA-F]{6}$\")).describe(\"The primary brand color used for highlights (e.g., primary buttons, active borders). Renderers may generate variants of this color for different contexts. Format: Hexadecimal code (e.g., '#00BFFF').\").optional(),iconUrl:X(d.string().describe(\"A URL for an image that identifies the agent or tool associated with the surface.\"),{keywords:{format:\"uri\"}}).optional(),agentDisplayName:d.string().describe(\"Text to be displayed next to the surface to identify the agent or tool that created it.\").optional()}),{keywords:{additionalProperties:!0}}),lm={name:\"Text\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),text:fe.describe(\"REF:#/$defs/DynamicString|The text content to display. While simple Markdown formatting is supported (i.e. without HTML, images, or links), utilizing dedicated UI components is generally preferred for a richer and more structured presentation.\"),variant:d.enum([\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"caption\",\"body\"]).default(\"body\").describe(\"A hint for the base text style.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue]})},dm={name:\"Image\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),url:fe.describe(\"REF:#/$defs/DynamicString|The URL of the image to display.\"),description:fe.describe(\"REF:#/$defs/DynamicString|Accessibility text for the image.\").optional(),fit:d.enum([\"contain\",\"cover\",\"fill\",\"none\",\"scaleDown\"]).default(\"fill\").describe(\"Specifies how the image should be resized to fit its container. This corresponds to the CSS 'object-fit' property.\").optional(),variant:d.enum([\"icon\",\"avatar\",\"smallFeature\",\"mediumFeature\",\"largeFeature\",\"header\"]).default(\"mediumFeature\").describe(\"A hint for the image size and style.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue]})},fm={name:\"Icon\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),name:d.union([d.enum([\"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\"]),X(d.object({svgPath:d.string()}),{closure:\"additionalProperties\"}),pr.describe(\"REF:#/$defs/DataBinding\")]).describe(\"The name of the icon to display.\")}).strict(),{mixins:[\"ComponentCommon\",ue]})},pm={name:\"Video\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),url:fe.describe(\"REF:#/$defs/DynamicString|The URL of the video to display.\")}).strict(),{mixins:[\"ComponentCommon\",ue]})},hm={name:\"AudioPlayer\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),url:fe.describe(\"REF:#/$defs/DynamicString|The URL of the audio to be played.\"),description:fe.describe(\"REF:#/$defs/DynamicString|A description of the audio, such as a title or summary.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue]})},mm={name:\"Row\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),children:cs.describe(\"REF:#/$defs/ChildList|Defines the children. Use an array of strings for a fixed set of children, or a template object to generate children from a data list. Children cannot be defined inline, they must be referred to by ID.\"),justify:d.enum([\"center\",\"end\",\"spaceAround\",\"spaceBetween\",\"spaceEvenly\",\"start\",\"stretch\"]).default(\"start\").describe(\"Defines the arrangement of children along the main axis (horizontally). Use 'spaceBetween' to push items to the edges, or 'start'/'end'/'center' to pack them together.\").optional(),align:d.enum([\"start\",\"center\",\"end\",\"stretch\"]).default(\"stretch\").describe(\"Defines the alignment of children along the cross axis (vertically). This is similar to the CSS 'align-items' property, but uses camelCase values (e.g., 'start').\").optional()}).describe(\"A layout component that arranges its children horizontally. To create a grid layout, nest Columns within this Row.\").strict(),{mixins:[\"ComponentCommon\",ue]})},gm={name:\"Column\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),children:cs.describe(\"REF:#/$defs/ChildList|Defines the children. Use an array of strings for a fixed set of children, or a template object to generate children from a data list. Children cannot be defined inline, they must be referred to by ID.\"),justify:d.enum([\"start\",\"center\",\"end\",\"spaceBetween\",\"spaceAround\",\"spaceEvenly\",\"stretch\"]).default(\"start\").describe(\"Defines the arrangement of children along the main axis (vertically). Use 'spaceBetween' to push items to the edges (e.g. header at top, footer at bottom), or 'start'/'end'/'center' to pack them together.\").optional(),align:d.enum([\"center\",\"end\",\"start\",\"stretch\"]).default(\"stretch\").describe(\"Defines the alignment of children along the cross axis (horizontally). This is similar to the CSS 'align-items' property.\").optional()}).describe(\"A layout component that arranges its children vertically. To create a grid layout, nest Rows within this Column.\").strict(),{mixins:[\"ComponentCommon\",ue]})},ym={name:\"List\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),children:cs.describe(\"REF:#/$defs/ChildList|Defines the children. Use an array of strings for a fixed set of children, or a template object to generate children from a data list.\"),direction:d.enum([\"vertical\",\"horizontal\"]).default(\"vertical\").describe(\"The direction in which the list items are laid out.\").optional(),align:d.enum([\"start\",\"center\",\"end\",\"stretch\"]).default(\"stretch\").describe(\"Defines the alignment of children along the cross axis.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue]})},bm={name:\"Card\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),child:pn.describe(\"REF:#/$defs/ComponentId|The ID of the single child component to be rendered inside the card. To display multiple elements, you MUST wrap them in a layout component (like Column or Row) and pass that container's ID here. Do NOT pass multiple IDs or a non-existent ID.\")}).strict(),{mixins:[\"ComponentCommon\",ue]})},vm={name:\"Tabs\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),tabs:d.array(X(d.object({title:fe.describe(\"REF:#/$defs/DynamicString|The tab title.\"),child:pn.describe(\"REF:#/$defs/ComponentId|The ID of the child component.\")}),{closure:\"additionalProperties\"})).min(1).describe(\"An array of objects, where each object defines a tab with a title and a child component.\")}).strict(),{mixins:[\"ComponentCommon\",ue]})},_m={name:\"Modal\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),trigger:pn.describe(\"REF:#/$defs/ComponentId|The ID of the component that opens the modal when interacted with (e.g., a button).\"),content:pn.describe(\"REF:#/$defs/ComponentId|The ID of the component to be displayed inside the modal.\")}).strict(),{mixins:[\"ComponentCommon\",ue]})},xm={name:\"Divider\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),axis:d.enum([\"horizontal\",\"vertical\"]).default(\"horizontal\").describe(\"The orientation of the divider.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue]})},Am={name:\"Button\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(jn.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),child:pn.describe(\"REF:#/$defs/ComponentId|The ID of the child component. Use a 'Text' component for a labeled button. Only use an 'Icon' if the requirements explicitly ask for an icon-only button.\"),variant:d.enum([\"default\",\"primary\",\"borderless\"]).default(\"default\").describe(\"A hint for the button style. If omitted, a default button style is used. 'primary' indicates this is the main call-to-action button. 'borderless' means the button has no visual border or background, making its child content appear like a clickable link.\").optional(),action:dl.describe(\"REF:#/$defs/Action\")}).strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"]})},Cm={name:\"TextField\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(jn.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),label:fe.describe(\"REF:#/$defs/DynamicString|The text label for the input field.\"),value:fe.describe(\"REF:#/$defs/DynamicString|The value of the text field.\").optional(),variant:d.enum([\"longText\",\"number\",\"shortText\",\"obscured\"]).default(\"shortText\").describe(\"The type of input field to display.\").optional(),validationRegexp:d.string().describe(\"A regular expression used for client-side validation of the input.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"]})},Dm={name:\"CheckBox\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(jn.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),label:fe.describe(\"REF:#/$defs/DynamicString|The text to display next to the checkbox.\"),value:mn.describe(\"REF:#/$defs/DynamicBoolean|The current state of the checkbox (true for checked, false for unchecked).\")}).strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"]})},wm={name:\"ChoicePicker\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(jn.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),label:fe.describe(\"REF:#/$defs/DynamicString|The label for the group of options.\").optional(),variant:d.enum([\"multipleSelection\",\"mutuallyExclusive\"]).default(\"mutuallyExclusive\").describe(\"A hint for how the choice picker should be displayed and behave.\").optional(),options:d.array(X(d.object({label:fe.describe(\"REF:#/$defs/DynamicString|The text to display for this option.\"),value:d.string().describe(\"The stable value associated with this option.\")}),{closure:\"additionalProperties\"})).describe(\"The list of available options to choose from.\"),value:ll.describe(\"REF:#/$defs/DynamicStringList|The list of currently selected values. This should be bound to a string array in the data model.\"),displayStyle:d.enum([\"checkbox\",\"chips\"]).default(\"checkbox\").describe(\"The display style of the component.\").optional(),filterable:d.boolean().default(!1).describe(\"If true, displays a search input to filter the options.\").optional()}).describe(\"A component that allows selecting one or more options from a list.\").strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"]})},Em={name:\"Slider\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(jn.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),label:fe.describe(\"REF:#/$defs/DynamicString|The label for the slider.\").optional(),min:d.number().default(0).describe(\"The minimum value of the slider.\").optional(),max:d.number().describe(\"The maximum value of the slider.\"),value:hn.describe(\"REF:#/$defs/DynamicNumber|The current value of the slider.\")}).strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"],required:[\"value\",\"max\"]})},Sm={name:\"DateTimeInput\",schema:X(d.object({...ue.shape,accessibility:Se.describe(\"REF:#/$defs/AccessibilityAttributes\").optional(),checks:d.array(jn.describe(\"REF:#/$defs/CheckRule\")).describe(\"A list of checks to perform. These are function calls that must return a boolean indicating validity.\").optional(),value:fe.describe(\"REF:#/$defs/DynamicString|The selected date and/or time value in ISO 8601 format. If not yet set, initialize with an empty string.\"),enableDate:d.boolean().default(!1).describe(\"If true, allows the user to select a date.\").optional(),enableTime:d.boolean().default(!1).describe(\"If true, allows the user to select a time.\").optional(),min:X(fe.describe(\"REF:#/$defs/DynamicString|The minimum allowed date/time in ISO 8601 format.\"),{allOf:[{if:{type:\"string\"},then:{oneOf:[{format:\"date\"},{format:\"time\"},{format:\"date-time\"}]}}]}).optional(),max:X(fe.describe(\"REF:#/$defs/DynamicString|The maximum allowed date/time in ISO 8601 format.\"),{allOf:[{if:{type:\"string\"},then:{oneOf:[{format:\"date\"},{format:\"time\"},{format:\"date-time\"}]}}]}).optional(),label:fe.describe(\"REF:#/$defs/DynamicString|The text label for the input field.\").optional()}).strict(),{mixins:[\"ComponentCommon\",ue,\"Checkable\"]})};var Tm={schemaUri:\"https://json-schema.org/draft/2020-12/schema\",schemaId:\"https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json\",title:\"A2UI Basic Catalog\",description:\"Unified catalog of basic A2UI components and functions.\",declaredProtocolVersion:null,commonTypesUri:\"https://a2ui.org/specification/v0_9/common_types.json\",defModels:[rC]};var km=$e(ui,hm),$m=$e(li,Am),Im=$e(di,bm),Fm=$e(fi,Dm),Rm=$e(gr,wm),Om=$e(pi,gm),Nm=$e(hi,Sm),Mm=$e(mi,xm),jm=$e(gi,fm),Pm=$e(yi,dm),Lm=$e(bi,ym),Bm=$e(vr,_m),Vm=$e(vi,mm),Um=$e(_i,Em),zm=$e(_r,vm),qm=$e(xr,lm),Zm=$e(Ai,Cm),Wm=$e(Ci,pm);var Hm={name:\"required\",returnType:\"boolean\",description:\"Checks that the value is not null, undefined, or empty.\",schema:X(d.object({value:d.any().refine(n=>n!==void 0,\"Required\").describe(\"The value to check.\")}),{closure:\"additionalProperties\"})},Gm={name:\"regex\",returnType:\"boolean\",description:\"Checks that the value matches a regular expression string.\",schema:X(d.object({value:fe.describe(\"REF:#/$defs/DynamicString\"),pattern:d.string().describe(\"The regex pattern to match against.\")}),{closure:\"unevaluatedProperties\"})},Km={name:\"length\",returnType:\"boolean\",description:\"Checks string length constraints.\",schema:X(d.object({value:fe.describe(\"REF:#/$defs/DynamicString\"),min:X(d.number().int().describe(\"The minimum allowed length.\"),{keywords:{minimum:0}}).optional(),max:X(d.number().int().describe(\"The maximum allowed length.\"),{keywords:{minimum:0}}).optional()}),{closure:\"unevaluatedProperties\",keywords:{anyOf:[{required:[\"min\"]},{required:[\"max\"]}]}})},Jm={name:\"numeric\",returnType:\"boolean\",description:\"Checks numeric range constraints.\",schema:X(d.object({value:hn.describe(\"REF:#/$defs/DynamicNumber\"),min:d.number().describe(\"The minimum allowed value.\").optional(),max:d.number().describe(\"The maximum allowed value.\").optional()}),{closure:\"unevaluatedProperties\",keywords:{anyOf:[{required:[\"min\"]},{required:[\"max\"]}]}})},Ym={name:\"email\",returnType:\"boolean\",description:\"Checks that the value is a valid email address.\",schema:X(d.object({value:fe.describe(\"REF:#/$defs/DynamicString\")}),{closure:\"unevaluatedProperties\"})},Xm={name:\"formatString\",returnType:\"string\",description:\"Performs string interpolation of data model values and other functions in the catalog functions list and returns the resulting string. The value string can contain interpolated expressions in the `${expression}` format. Supported expression types include: JSON Pointer paths to the data model (e.g., `${/absolute/path}` or `${relative/path}`), and client-side function calls (e.g., `${now()}`). Function arguments must be named (e.g., `${formatDate(value:${/currentDate}, format:'MM-dd')}`). To include a literal `${` sequence, escape it as `\\\\${`.\",schema:X(d.object({value:fe.describe(\"REF:#/$defs/DynamicString\")}),{closure:\"unevaluatedProperties\"})},Qm={name:\"formatNumber\",returnType:\"string\",description:\"Formats a number with the specified grouping and decimal precision.\",schema:X(d.object({value:hn.describe(\"REF:#/$defs/DynamicNumber|The number to format.\"),decimals:hn.describe(\"REF:#/$defs/DynamicNumber|Optional. The number of decimal places to show. Defaults to 0 or 2 depending on locale.\").optional(),grouping:mn.describe(\"REF:#/$defs/DynamicBoolean|Optional. If true, uses locale-specific grouping separators (e.g. '1,000'). If false, returns raw digits (e.g. '1000'). Defaults to true.\").optional()}),{closure:\"unevaluatedProperties\"})},eg={name:\"formatCurrency\",returnType:\"string\",description:\"Formats a number as a currency string.\",schema:X(d.object({value:hn.describe(\"REF:#/$defs/DynamicNumber|The monetary amount.\"),currency:fe.describe(\"REF:#/$defs/DynamicString|The ISO 4217 currency code (e.g., 'USD', 'EUR').\"),decimals:hn.describe(\"REF:#/$defs/DynamicNumber|Optional. The number of decimal places to show. Defaults to 0 or 2 depending on locale.\").optional(),grouping:mn.describe(\"REF:#/$defs/DynamicBoolean|Optional. If true, uses locale-specific grouping separators (e.g. '1,000'). If false, returns raw digits (e.g. '1000'). Defaults to true.\").optional()}),{required:[\"currency\",\"value\"],closure:\"unevaluatedProperties\"})},tg={name:\"formatDate\",returnType:\"string\",description:\"Formats a timestamp into a string using a pattern.\",schema:X(d.object({value:as.describe(\"REF:#/$defs/DynamicValue|The date to format.\"),format:fe.describe(`REF:#/$defs/DynamicString|A Unicode TR35 date pattern string.\n\nToken Reference:\n- Year: 'yy' (26), 'yyyy' (2026)\n- Month: 'M' (1), 'MM' (01), 'MMM' (Jan), 'MMMM' (January)\n- Day: 'd' (1), 'dd' (01), 'E' (Tue), 'EEEE' (Tuesday)\n- Hour (12h): 'h' (1-12), 'hh' (01-12) - requires 'a' for AM/PM\n- Hour (24h): 'H' (0-23), 'HH' (00-23) - Military Time\n- Minute: 'mm' (00-59)\n- Second: 'ss' (00-59)\n- Period: 'a' (AM/PM)\n\nExamples:\n- 'MMM dd, yyyy' -> 'Jan 16, 2026'\n- 'HH:mm' -> '14:30' (Military)\n- 'h:mm a' -> '2:30 PM'\n- 'EEEE, d MMMM' -> 'Friday, 16 January'`)}),{required:[\"format\",\"value\"],closure:\"unevaluatedProperties\"})},ng={name:\"pluralize\",returnType:\"string\",description:\"Returns a localized string based on the Common Locale Data Repository (CLDR) plural category of the count (zero, one, two, few, many, other). Requires an 'other' fallback. For English, just use 'one' and 'other'.\",schema:X(d.object({value:hn.describe(\"REF:#/$defs/DynamicNumber|The numeric value used to determine the plural category.\"),zero:fe.describe(\"REF:#/$defs/DynamicString|String for the 'zero' category (e.g., 0 items).\").optional(),one:fe.describe(\"REF:#/$defs/DynamicString|String for the 'one' category (e.g., 1 item).\").optional(),two:fe.describe(\"REF:#/$defs/DynamicString|String for the 'two' category (used in Arabic, Welsh, etc.).\").optional(),few:fe.describe(\"REF:#/$defs/DynamicString|String for the 'few' category (e.g., small groups in Slavic languages).\").optional(),many:fe.describe(\"REF:#/$defs/DynamicString|String for the 'many' category (e.g., large groups in various languages).\").optional(),other:fe.describe(\"REF:#/$defs/DynamicString|The default/fallback string (used for general plural cases).\")}),{closure:\"unevaluatedProperties\"})},rg={name:\"openUrl\",returnType:\"void\",description:\"Opens the specified URL in a browser or handler. This function has no return value.\",schema:X(d.object({url:X(d.string().describe(\"The URL to open.\"),{keywords:{format:\"uri\"}})}),{closure:\"additionalProperties\"})},ig={name:\"and\",returnType:\"boolean\",description:\"Performs a logical AND operation on a list of boolean values.\",schema:X(d.object({values:d.array(mn.describe(\"REF:#/$defs/DynamicBoolean\")).min(2).describe(\"The list of boolean values to evaluate.\")}),{closure:\"unevaluatedProperties\"})},og={name:\"or\",returnType:\"boolean\",description:\"Performs a logical OR operation on a list of boolean values.\",schema:X(d.object({values:d.array(mn.describe(\"REF:#/$defs/DynamicBoolean\")).min(2).describe(\"The list of boolean values to evaluate.\")}),{closure:\"unevaluatedProperties\"})},sg={name:\"not\",returnType:\"boolean\",description:\"Performs a logical NOT operation on a boolean value.\",schema:X(d.object({value:mn.describe(\"REF:#/$defs/DynamicBoolean|The boolean value to negate.\")}),{closure:\"unevaluatedProperties\"})};var ag=1e4,cg=1e3,iC=/^[+-]?(?:[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,vs=class n{parse(e,t=0){if(t>n.MAX_DEPTH)throw new de(\"Max recursion depth reached in parse\");if(e&&e.length>ag)throw new de(`Expression template length (${e.length}) exceeds maximum limit (${ag})`);if(!e)return[];if(!e.includes(\"${\"))return[e];let r=[],i=new cc(e);for(;!i.isAtEnd();){if(r.length>=cg)throw new de(`Expression parts count exceeds maximum limit (${cg})`);if(i.matches(\"${\")){i.advance(2);let o=this.extractInterpolationContent(i),s=this.parseExpression(o,t+1);s!==null&&r.push(s)}else if(i.peek()===\"\\\\\"&&i.peek(1)===\"$\"&&i.peek(2)===\"{\")i.advance(),r.push(\"${\"),i.advance(2);else{let o=i.pos;for(;!i.isAtEnd()&&!(i.matches(\"${\")||i.peek()===\"\\\\\"&&i.peek(1)===\"$\"&&i.peek(2)===\"{\");)i.advance();r.push(i.input.substring(o,i.pos))}}return r.filter(o=>o!==null&&o!==\"\")}extractInterpolationContent(e){let t=e.pos,r=1;for(;!e.isAtEnd()&&r>0;){let i=e.advance();if(i===\"{\")r++;else if(i===\"}\")r--;else if(i===\"'\"||i==='\"'){let o=i;for(;!e.isAtEnd();){let s=e.advance();if(s===\"\\\\\")e.advance();else if(s===o)break}}}if(r>0)throw new de(\"Unclosed interpolation: missing '}'\");return e.input.substring(t,e.pos-1)}parseExpression(e,t=0){if(e=e.trim(),!e)return\"\";let r=new cc(e),i=this.parseExpressionInternal(r,t);if(!r.isAtEnd())throw new de(`Unexpected characters at end of expression: '${r.input.substring(r.pos)}'`);return i}parseExpressionInternal(e,t){if(t>n.MAX_DEPTH)throw new de(\"Max recursion depth reached in parse\");if(e.skipWhitespace(),e.isAtEnd())return\"\";if(e.matches(\"${\")){e.advance(2);let i=this.extractInterpolationContent(e);return this.parseExpression(i,t+1)}if(e.matchesString(\"'\")||e.matchesString('\"'))return this.parseStringLiteral(e);if(this.isNumberStart(e))return this.parseNumberLiteral(e);if(e.matchesKeyword(\"true\"))return!0;if(e.matchesKeyword(\"false\"))return!1;if(e.matchesKeyword(\"null\"))return\"\";let r=this.scanPathOrIdentifier(e);return e.skipWhitespace(),e.peek()===\"(\"?this.parseFunctionCall(r,e,t):r?{path:r}:\"\"}scanPathOrIdentifier(e){let t=e.pos;for(;!e.isAtEnd();){let r=e.peek();if(kl(r)||r===\"/\"||r===\".\"||r===\"-\")e.advance();else break}return e.input.substring(t,e.pos)}parseFunctionCall(e,t,r){t.match(\"(\"),t.skipWhitespace();let i={};for(;!t.isAtEnd()&&t.peek()!==\")\";){let o=this.scanIdentifier(t);if(t.skipWhitespace(),!t.match(\":\"))throw new de(`Expected ':' after argument name '${o}' in function '${e}'`);t.skipWhitespace(),i[o]=this.parseExpressionInternal(t,r+1),t.skipWhitespace(),t.peek()===\",\"&&(t.advance(),t.skipWhitespace())}if(!t.match(\")\"))throw new de(`Expected ')' after function arguments for '${e}'`);return{call:e,args:i,returnType:\"any\"}}scanIdentifier(e){let t=e.pos;for(;!e.isAtEnd()&&kl(e.peek());)e.advance();return e.input.substring(t,e.pos)}parseStringLiteral(e){let t=e.advance(),r=\"\";for(;!e.isAtEnd();){let i=e.advance();if(i===\"\\\\\"){let o=e.advance();o===\"n\"?r+=`\n`:o===\"t\"?r+=\"\t\":o===\"r\"?r+=\"\\r\":r+=o}else{if(i===t)break;r+=i}}return r}isNumberStart(e){let t=0;return(e.peek()===\"-\"||e.peek()===\"+\")&&(t=1),this.isDigit(e.peek(t))?!0:e.peek(t)===\".\"&&this.isDigit(e.peek(t+1))}parseNumberLiteral(e){let t=e.pos;for((e.peek()===\"-\"||e.peek()===\"+\")&&e.advance();!e.isAtEnd()&&(this.isDigit(e.peek())||e.peek()===\".\");)e.advance();this.skipExponent(e);let r=e.input.substring(t,e.pos);if(!iC.test(r))throw new de(`Invalid number literal: '${r}'`);let i=Number(r);if(!Number.isFinite(i))throw new de(`Number literal is out of range: '${r}'`);return i===0?0:i}skipExponent(e){if(!(e.isAtEnd()||e.peek()!==\"e\"&&e.peek()!==\"E\"))for(e.advance(),!e.isAtEnd()&&(e.peek()===\"+\"||e.peek()===\"-\")&&e.advance();!e.isAtEnd()&&this.isDigit(e.peek());)e.advance()}isDigit(e){return e>=\"0\"&&e<=\"9\"}};vs.MAX_DEPTH=100;var oC=/^\\p{XID_Continue}$/u;function kl(n){return Array.from(n).length!==1?!1:oC.test(n)}var cc=class{constructor(e){this.input=e,this.pos=0}isAtEnd(){return this.pos>=this.input.length}peek(e=0){let t=this.pos+e;if(t>=this.input.length)return\"\\0\";let r=this.input.codePointAt(t);return r===void 0?\"\\0\":String.fromCodePoint(r)}advance(e){let t=e??(this.peek()===\"\\0\"?1:this.peek().length),r=this.input.substring(this.pos,this.pos+t);return this.pos+=t,r}match(e){return this.peek()===e?(this.advance(),!0):!1}matches(e){return!!this.input.startsWith(e,this.pos)}matchesString(e){return this.peek()===e}matchesKeyword(e){if(this.input.startsWith(e,this.pos)){let t=this.peek(e.length);if(!kl(t))return this.advance(e.length),!0}return!1}skipWhitespace(){for(;!this.isAtEnd()&&/\\s/.test(this.peek());)this.advance()}};var Oe=function(){return Oe=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Oe.apply(this,arguments)};function xe(n,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s=Object.create((typeof Iterator==\"function\"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol==\"function\"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(r)throw new TypeError(\"Generator is already executing.\");for(;s&&(s=0,u[0]&&(t=0)),t;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1],o=u;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(u);break}o[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(n,t)}catch(l){u=[6,l],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function ze(n){var e=typeof Symbol==\"function\"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length==\"number\")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?\"Object is not iterable.\":\"Symbol.iterator is not defined.\")}function q(n,e){var t=typeof Symbol==\"function\"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(s)throw s.error}}return o}function B(n,e,t){if(t||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return n.concat(o||Array.prototype.slice.call(e))}var bg={exports:{}};(function(n){(function(){var e=String.fromCodePoint||(function(){var i=String.fromCharCode,o=Math.floor;return function(){var a=16384,c=[],u,l,p=-1,f=arguments.length;if(!f)return\"\";for(var m=\"\";++p<f;){var g=Number(arguments[p]);if(!isFinite(g)||g<0||g>1114111||o(g)!=g)throw RangeError(\"Invalid code point: \"+g);g<=65535?c.push(g):(g-=65536,u=(g>>10)+55296,l=g%1024+56320,c.push(u,l)),(p+1==f||c.length>a)&&(m+=i.apply(null,c),c.length=0)}return m}})();function t(i,o,s){s||(s={});function a(b,_){return b.range[0]=_,b.raw=i.substring(_,b.range[1]),b}function c(b,_){return{type:\"anchor\",kind:b,range:[E-_,E],raw:i.substring(E-_,E)}}function u(b,_,A,C){return{type:\"value\",kind:b,codePoint:_,range:[A,C],raw:i.substring(A,C)}}function l(b,_,A,C){return C=C||0,u(b,_,E-(A.length+C),E)}function p(b){var _=b[0],A=_.charCodeAt(0);if(Ee){var C;if(_.length===1&&A>=55296&&A<=56319&&(C=Z().charCodeAt(0),C>=56320&&C<=57343))return E++,u(\"symbol\",(A-55296)*1024+C-56320+65536,E-2,E)}return u(\"symbol\",A,E-1,E)}function f(b,_,A){return{type:\"disjunction\",body:b,range:[_,A],raw:i.substring(_,A)}}function m(){return{type:\"dot\",range:[E-1,E],raw:\".\"}}function g(b){return{type:\"characterClassEscape\",value:b,range:[E-2,E],raw:i.substring(E-2,E)}}function h(b){var _=E-1-b.length;return{type:\"reference\",matchIndex:parseInt(b,10),range:[_,E],raw:i.substring(_,E)}}function y(b){var _=b.range[0]-3;return{type:\"reference\",name:b,range:[_,E],raw:i.substring(_,E)}}function v(b,_,A,C){return{type:\"group\",behavior:b,body:_,range:[A,C],raw:i.substring(A,C)}}function x(b,_,A,C,G){return C==null&&(A=E-1,C=E),{type:\"quantifier\",min:b,max:_,greedy:!0,body:null,symbol:G,range:[A,C],raw:i.substring(A,C)}}function $(b,_,A){return{type:\"alternative\",body:b,range:[_,A],raw:i.substring(_,A)}}function P(b,_,A,C){return{type:\"characterClass\",kind:b.kind,body:b.body,negative:_,range:[A,C],raw:i.substring(A,C)}}function D(b,_,A,C){return b.codePoint>_.codePoint&&ie(\"invalid range in character class\",b.raw+\"-\"+_.raw,A,C),{type:\"characterClassRange\",min:b,max:_,range:[A,C],raw:i.substring(A,C)}}function F(b,_,A){return{type:\"classStrings\",strings:b,range:[_,A],raw:i.substring(_,A)}}function M(b,_,A){return{type:\"classString\",characters:b,range:[_,A],raw:i.substring(_,A)}}function V(b){return b.type===\"alternative\"?b.body:[b]}function N(b){b=b||1,E+=b}function J(b){var _=i.substring(E,E+=b);return _}function Y(b){se(b)||ie(\"character\",b)}function se(b){var _=b.length;if(i.substring(E,E+_)===b)return N(_),b}function ae(b){if(i[E]===b)return E++,b}function Z(){return i[E]}function ne(b){return i[E]===b}function yt(b){var _=b.length;return i.substring(E,E+_)===b}function je(b){return i[E+1]===b}function pe(b){var _=i.substring(E),A=_.match(b);return A&&(E+=A[0].length),A}function ct(){var b=[],_=E;for(b.push(We());ae(\"|\");)b.push(We());return b.length===1?b[0]:f(b,_,E)}function We(){for(var b=[],_=E,A;A=ut();)b.push(A);return b.length===1?b[0]:$(b,_,E)}function ut(){if(E>=i.length||ne(\"|\")||ne(\")\"))return null;var b=_n(),_;if(b){var A=E;if(_=Lt()||!1,_){if(!Ee&&b.type===\"group\")return _.body=V(b),a(_,b.range[0]),_;E=A,ie(\"Expected atom\")}return b}var C=Qe();if(C||(A=E,_=Lt()||!1,_&&(E=A,ie(\"Expected atom\")),!Ee&&ae(\"{\")?C=p(\"{\"):ie(\"Expected atom\")),_=Lt()||!1,_){var G=C.type,he=C.behavior;return G===\"group\"&&(he===\"negativeLookbehind\"||he===\"lookbehind\")&&ie(\"Invalid quantifier\",\"\",_.range[0],_.range[1]),_.body=V(C),a(_,C.range[0]),_}return C}function St(b,_,A,C){var G=null,he=E;if(se(b))G=_;else if(se(A))G=C;else return!1;return me(G,he)}function me(b,_){var A=ct();A||ie(\"Expected disjunction\"),Y(\")\");var C=v(b,V(A),_,E);return b==\"normal\"&&Mi&&zn++,C}function _n(){switch(Z()){case\"^\":return N(),c(\"start\",1);case\"$\":return N(),c(\"end\",1);case\"\\\\\":{if(je(\"b\"))return N(2),c(\"boundary\",2);if(je(\"B\"))return N(2),c(\"not-boundary\",2);break}case\"(\":return St(\"(?=\",\"lookahead\",\"(?!\",\"negativeLookahead\");default:return}}function Lt(){var b,_=E,A,C,G;switch(Z()){case\"*\":N(),A=x(0,void 0,void 0,void 0,\"*\");break;case\"+\":N(),A=x(1,void 0,void 0,void 0,\"+\");break;case\"?\":N(),A=x(0,1,void 0,void 0,\"?\");break;case\"{\":(b=pe(/^\\{(\\d+)\\}/))?(C=parseInt(b[1],10),A=x(C,C,_,E)):(b=pe(/^\\{(\\d+),\\}/))?(C=parseInt(b[1],10),A=x(C,void 0,_,E)):(b=pe(/^\\{(\\d+),(\\d+)\\}/))&&(C=parseInt(b[1],10),G=parseInt(b[2],10),C>G&&ie(\"numbers out of order in {} quantifier\",\"\",_,E),A=x(C,G,_,E)),(C&&!Number.isSafeInteger(C)||G&&!Number.isSafeInteger(G))&&ie(\"iterations outside JS safe integer range in quantifier\",\"\",_,E)}return A&&ae(\"?\")&&(A.greedy=!1,A.range[1]+=1),A}function Qe(){var b;switch(b=Z()){case\".\":return N(),m();case\"\\\\\":{if(N(),b=xn(),!b){if(!Ee&&Z()==\"c\")return u(\"symbol\",92,E-1,E);ie(\"atomEscape\")}return b}case\"[\":return Bt();case\"(\":{if(s.lookbehind&&(b=St(\"(?<=\",\"lookbehind\",\"(?<!\",\"negativeLookbehind\")))return b;if(s.namedGroups&&se(\"(?<\")){var _=Te();Y(\">\");var A=me(\"normal\",_.range[0]-3);return A.name=_,A}else return s.modifiers&&yt(\"(?\")&&i[E+2]!=\":\"?Xt():St(\"(?:\",\"ignore\",\"(\",\"normal\")}case\"]\":case\"}\":if(!Ee)return N(),p(b);break;case\"^\":case\"$\":case\"*\":case\"+\":case\"?\":case\"{\":case\")\":case\"|\":break;default:return N(),p(b)}}function Xt(){function b(tt){for(var Ut=0;Ut<tt.length;){if(tt.indexOf(tt[Ut],Ut+1)!=-1)return!0;Ut++}return!1}var _=E;N(2);var A=pe(/^[sim]+/),C;ae(\"-\")&&Z()!==\":\"?(C=pe(/^[sim]+/),C||ie(\"Invalid flags for modifiers group\")):A||ie(\"Invalid flags for modifiers group\"),A=A?A[0]:\"\",C=C?C[0]:\"\";var G=A+C;(G.length>3||b(G))&&ie(\"flags cannot be duplicated for modifiers group\"),ae(\":\")||ie(\"Invalid flags for modifiers group\");var he=me(\"ignore\",_);return he.modifierFlags={enabling:A,disabling:C},he}function lt(b,_){if(_){var A,C;if(b.kind==\"unicodeEscape\"&&(A=b.codePoint)>=55296&&A<=56319&&ne(\"\\\\\")&&je(\"u\")){var G=E;E++;var he=et();he.kind==\"unicodeEscape\"&&(C=he.codePoint)>=56320&&C<=57343?(b.kind=\"unicodeCodePointEscape\",b.codePoint=(A-55296)*1024+C-56320+65536,b.range[1]=E,b.raw=i.substring(b.range[0],E)):E=G}}return b}function et(){return xn(!0)}function xn(b){var _,A=E,C;switch(C=Z()){case\"0\":case\"1\":case\"2\":case\"3\":case\"4\":case\"5\":case\"6\":case\"7\":case\"8\":case\"9\":return Qt(b);case\"B\":if(b){ie(\"\\\\B not possible inside of CharacterClass\",\"\",A);break}else return $t();case\"b\":return b?(N(),l(\"singleEscape\",8,\"\\\\b\")):$t();case\"c\":{if(b){if(!Ee&&(_=pe(/^c(\\d)/)))return l(\"controlLetter\",_[1]+16,_[1],2);if(!Ee&&se(\"c_\"))return l(\"controlLetter\",31,\"_\",2)}return Tt()}case\"d\":case\"D\":case\"w\":case\"W\":case\"s\":case\"S\":return N(),g(C);case\"k\":return Er()||$t();case\"p\":case\"P\":return en()||$t();case\"-\":return b&&Ee?(N(),l(\"singleEscape\",45,\"\\\\-\")):$t();default:return Tt()}}function Qt(b){var _,A,C=E;if(_=pe(/^(?!0)\\d+/)){A=_[0];var G=parseInt(_[0],10);if(G<=zn&&!b)return h(_[0]);if(ko.push(G),Mi?Sr=!0:He(C,E),N(-_[0].length),_=pe(/^[0-7]{1,3}/))return l(\"octal\",parseInt(_[0],8),_[0],1);var he=E;return _=p(pe(/^[89]/)),a(_,he-1)}else if(_=pe(/^[0-7]{1,3}/))return A=_[0],A!==\"0\"&&He(C,E),/^0{1,3}$/.test(A)?l(\"null\",0,\"0\",A.length):l(\"octal\",parseInt(A,8),A,1);return!1}function He(b,_){Ee&&ie(\"Invalid decimal escape in unicode mode\",null,b,_)}function en(){var b,_=E;return s.unicodePropertyEscape&&Ee&&(b=pe(/^([pP])\\{([^}]+)\\}/))?{type:\"unicodePropertyEscape\",negative:b[1]===\"P\",value:b[2],range:[_-1,E],raw:i.substring(_-1,E)}:!1}function Er(){if(s.namedGroups&&pe(/^k<(?=.*?>)/)){var b=Te();return Y(\">\"),y(b)}}function tn(b){var _;if(_=pe(/^u([0-9a-fA-F]{4})/))return lt(l(\"unicodeEscape\",parseInt(_[1],16),_[1],2),b);if(b&&(_=pe(/^u\\{([0-9a-fA-F]+)\\}/)))return l(\"unicodeCodePointEscape\",parseInt(_[1],16),_[1],4)}function Tt(){var b,_=E;switch(Z()){case\"t\":return N(),l(\"singleEscape\",9,\"\\\\t\");case\"n\":return N(),l(\"singleEscape\",10,\"\\\\n\");case\"v\":return N(),l(\"singleEscape\",11,\"\\\\v\");case\"f\":return N(),l(\"singleEscape\",12,\"\\\\f\");case\"r\":return N(),l(\"singleEscape\",13,\"\\\\r\");case\"c\":if(b=pe(/^c([a-zA-Z])/))return l(\"controlLetter\",b[1].charCodeAt(0)%32,b[1],2);break;case\"x\":if(b=pe(/^x([0-9a-fA-F]{2})/))return l(\"hexadecimalEscape\",parseInt(b[1],16),b[1],2);break;case\"u\":if(b=tn(Ee))return(!b||b.codePoint>1114111)&&ie(\"Invalid escape sequence\",null,_,E),b;break}return $t()}function bt(b){var _=Z(),A=E;if(_===\"\\\\\"){N();var C=tn(!0);return(!C||!b(C.codePoint))&&ie(\"Invalid escape sequence\",null,A,E),e(C.codePoint)}var G=_.charCodeAt(0);if(G>=55296&&G<=56319){_+=i[E+1];var he=_.charCodeAt(1);he>=56320&&he<=57343&&(G=(G-55296)*1024+he-56320+65536)}if(b(G))return N(),G>65535&&N(),_}function Te(){var b=E,_=bt(De);_||ie(\"Invalid identifier\");for(var A;A=bt(kt);)_+=A;return{type:\"identifier\",value:_,range:[b,E],raw:i.substring(b,E)}}function De(b){var _=/[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088F\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5C\\u0C5D\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDC-\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C8A\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2118-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309B-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7DC\\uA7F1-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]|\\uD800[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDD40-\\uDD74\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDF00-\\uDF1F\\uDF2D-\\uDF4A\\uDF50-\\uDF75\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF\\uDFD1-\\uDFD5]|\\uD801[\\uDC00-\\uDC9D\\uDCB0-\\uDCD3\\uDCD8-\\uDCFB\\uDD00-\\uDD27\\uDD30-\\uDD63\\uDD70-\\uDD7A\\uDD7C-\\uDD8A\\uDD8C-\\uDD92\\uDD94\\uDD95\\uDD97-\\uDDA1\\uDDA3-\\uDDB1\\uDDB3-\\uDDB9\\uDDBB\\uDDBC\\uDDC0-\\uDDF3\\uDE00-\\uDF36\\uDF40-\\uDF55\\uDF60-\\uDF67\\uDF80-\\uDF85\\uDF87-\\uDFB0\\uDFB2-\\uDFBA]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC60-\\uDC76\\uDC80-\\uDC9E\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDD40-\\uDD59\\uDD80-\\uDDB7\\uDDBE\\uDDBF\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE35\\uDE60-\\uDE7C\\uDE80-\\uDE9C\\uDEC0-\\uDEC7\\uDEC9-\\uDEE4\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72\\uDF80-\\uDF91]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2\\uDD00-\\uDD23\\uDD4A-\\uDD65\\uDD6F-\\uDD85\\uDE80-\\uDEA9\\uDEB0\\uDEB1\\uDEC2-\\uDEC7\\uDF00-\\uDF1C\\uDF27\\uDF30-\\uDF45\\uDF70-\\uDF81\\uDFB0-\\uDFC4\\uDFE0-\\uDFF6]|\\uD804[\\uDC03-\\uDC37\\uDC71\\uDC72\\uDC75\\uDC83-\\uDCAF\\uDCD0-\\uDCE8\\uDD03-\\uDD26\\uDD44\\uDD47\\uDD50-\\uDD72\\uDD76\\uDD83-\\uDDB2\\uDDC1-\\uDDC4\\uDDDA\\uDDDC\\uDE00-\\uDE11\\uDE13-\\uDE2B\\uDE3F\\uDE40\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61\\uDF80-\\uDF89\\uDF8B\\uDF8E\\uDF90-\\uDFB5\\uDFB7\\uDFD1\\uDFD3]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC5F-\\uDC61\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDEB8\\uDF00-\\uDF1A\\uDF40-\\uDF46]|\\uD806[\\uDC00-\\uDC2B\\uDCA0-\\uDCDF\\uDCFF-\\uDD06\\uDD09\\uDD0C-\\uDD13\\uDD15\\uDD16\\uDD18-\\uDD2F\\uDD3F\\uDD41\\uDDA0-\\uDDA7\\uDDAA-\\uDDD0\\uDDE1\\uDDE3\\uDE00\\uDE0B-\\uDE32\\uDE3A\\uDE50\\uDE5C-\\uDE89\\uDE9D\\uDEB0-\\uDEF8\\uDFC0-\\uDFE0]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F\\uDD00-\\uDD06\\uDD08\\uDD09\\uDD0B-\\uDD30\\uDD46\\uDD60-\\uDD65\\uDD67\\uDD68\\uDD6A-\\uDD89\\uDD98\\uDDB0-\\uDDDB\\uDEE0-\\uDEF2\\uDF02\\uDF04-\\uDF10\\uDF12-\\uDF33\\uDFB0]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC00-\\uDC6E\\uDC80-\\uDD43]|\\uD80B[\\uDF90-\\uDFF0]|[\\uD80C\\uD80E\\uD80F\\uD81C-\\uD822\\uD840-\\uD868\\uD86A-\\uD86D\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD88C][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2F\\uDC41-\\uDC46\\uDC60-\\uDFFF]|\\uD810[\\uDC00-\\uDFFA]|\\uD811[\\uDC00-\\uDE46]|\\uD818[\\uDD00-\\uDD1D]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDE70-\\uDEBE\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF40-\\uDF43\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDD40-\\uDD6C\\uDE40-\\uDE7F\\uDEA0-\\uDEB8\\uDEBB-\\uDED3\\uDF00-\\uDF4A\\uDF50\\uDF93-\\uDF9F\\uDFE0\\uDFE1\\uDFE3\\uDFF2-\\uDFF6]|\\uD823[\\uDC00-\\uDCD5\\uDCFF-\\uDD1E\\uDD80-\\uDDF2]|\\uD82B[\\uDFF0-\\uDFF3\\uDFF5-\\uDFFB\\uDFFD\\uDFFE]|\\uD82C[\\uDC00-\\uDD22\\uDD32\\uDD50-\\uDD52\\uDD55\\uDD64-\\uDD67\\uDD70-\\uDEFB]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD1E-\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD52-\\uDEA5\\uDEA8-\\uDEC0\\uDEC2-\\uDEDA\\uDEDC-\\uDEFA\\uDEFC-\\uDF14\\uDF16-\\uDF34\\uDF36-\\uDF4E\\uDF50-\\uDF6E\\uDF70-\\uDF88\\uDF8A-\\uDFA8\\uDFAA-\\uDFC2\\uDFC4-\\uDFCB]|\\uD837[\\uDF00-\\uDF1E\\uDF25-\\uDF2A]|\\uD838[\\uDC30-\\uDC6D\\uDD00-\\uDD2C\\uDD37-\\uDD3D\\uDD4E\\uDE90-\\uDEAD\\uDEC0-\\uDEEB]|\\uD839[\\uDCD0-\\uDCEB\\uDDD0-\\uDDED\\uDDF0\\uDEC0-\\uDEDE\\uDEE0-\\uDEE2\\uDEE4\\uDEE5\\uDEE7-\\uDEED\\uDEF0-\\uDEF4\\uDEFE\\uDEFF\\uDFE0-\\uDFE6\\uDFE8-\\uDFEB\\uDFED\\uDFEE\\uDFF0-\\uDFFE]|\\uD83A[\\uDC00-\\uDCC4\\uDD00-\\uDD43\\uDD4B]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEAD\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0\\uDFF0-\\uDFFF]|\\uD87B[\\uDC00-\\uDE5D]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD88D[\\uDC00-\\uDC79]/;return b===36||b===95||b>=65&&b<=90||b>=97&&b<=122||b>=128&&_.test(e(b))}function kt(b){var _=/[\\xB7\\u0300-\\u036F\\u0387\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u0669\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u06F0-\\u06F9\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07C0-\\u07C9\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u0897-\\u089F\\u08CA-\\u08E1\\u08E3-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962\\u0963\\u0966-\\u096F\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u09E6-\\u09EF\\u09FE\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A66-\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2\\u0AE3\\u0AE6-\\u0AEF\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B55-\\u0B57\\u0B62\\u0B63\\u0B66-\\u0B6F\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C04\\u0C3C\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0CE6-\\u0CEF\\u0CF3\\u0D00-\\u0D03\\u0D3B\\u0D3C\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4D\\u0D57\\u0D62\\u0D63\\u0D66-\\u0D6F\\u0D81-\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0E50-\\u0E59\\u0EB1\\u0EB4-\\u0EBC\\u0EC8-\\u0ECE\\u0ED0-\\u0ED9\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102B-\\u103E\\u1040-\\u1049\\u1056-\\u1059\\u105E-\\u1060\\u1062-\\u1064\\u1067-\\u106D\\u1071-\\u1074\\u1082-\\u108D\\u108F-\\u109D\\u135D-\\u135F\\u1369-\\u1371\\u1712-\\u1715\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4-\\u17D3\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u180F-\\u1819\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u194F\\u19D0-\\u19DA\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AB0-\\u1ABD\\u1ABF-\\u1ADD\\u1AE0-\\u1AEB\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BB0-\\u1BB9\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1C40-\\u1C49\\u1C50-\\u1C59\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF4\\u1CF7-\\u1CF9\\u1DC0-\\u1DFF\\u200C\\u200D\\u203F\\u2040\\u2054\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\u30FB\\uA620-\\uA629\\uA66F\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA82C\\uA880\\uA881\\uA8B4-\\uA8C5\\uA8D0-\\uA8D9\\uA8E0-\\uA8F1\\uA8FF-\\uA909\\uA926-\\uA92D\\uA947-\\uA953\\uA980-\\uA983\\uA9B3-\\uA9C0\\uA9D0-\\uA9D9\\uA9E5\\uA9F0-\\uA9F9\\uAA29-\\uAA36\\uAA43\\uAA4C\\uAA4D\\uAA50-\\uAA59\\uAA7B-\\uAA7D\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5\\uAAF6\\uABE3-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF10-\\uFF19\\uFF3F\\uFF65]|\\uD800[\\uDDFD\\uDEE0\\uDF76-\\uDF7A]|\\uD801[\\uDCA0-\\uDCA9]|\\uD802[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F\\uDEE5\\uDEE6]|\\uD803[\\uDD24-\\uDD27\\uDD30-\\uDD39\\uDD40-\\uDD49\\uDD69-\\uDD6D\\uDEAB\\uDEAC\\uDEFA-\\uDEFF\\uDF46-\\uDF50\\uDF82-\\uDF85]|\\uD804[\\uDC00-\\uDC02\\uDC38-\\uDC46\\uDC66-\\uDC70\\uDC73\\uDC74\\uDC7F-\\uDC82\\uDCB0-\\uDCBA\\uDCC2\\uDCF0-\\uDCF9\\uDD00-\\uDD02\\uDD27-\\uDD34\\uDD36-\\uDD3F\\uDD45\\uDD46\\uDD73\\uDD80-\\uDD82\\uDDB3-\\uDDC0\\uDDC9-\\uDDCC\\uDDCE-\\uDDD9\\uDE2C-\\uDE37\\uDE3E\\uDE41\\uDEDF-\\uDEEA\\uDEF0-\\uDEF9\\uDF00-\\uDF03\\uDF3B\\uDF3C\\uDF3E-\\uDF44\\uDF47\\uDF48\\uDF4B-\\uDF4D\\uDF57\\uDF62\\uDF63\\uDF66-\\uDF6C\\uDF70-\\uDF74\\uDFB8-\\uDFC0\\uDFC2\\uDFC5\\uDFC7-\\uDFCA\\uDFCC-\\uDFD0\\uDFD2\\uDFE1\\uDFE2]|\\uD805[\\uDC35-\\uDC46\\uDC50-\\uDC59\\uDC5E\\uDCB0-\\uDCC3\\uDCD0-\\uDCD9\\uDDAF-\\uDDB5\\uDDB8-\\uDDC0\\uDDDC\\uDDDD\\uDE30-\\uDE40\\uDE50-\\uDE59\\uDEAB-\\uDEB7\\uDEC0-\\uDEC9\\uDED0-\\uDEE3\\uDF1D-\\uDF2B\\uDF30-\\uDF39]|\\uD806[\\uDC2C-\\uDC3A\\uDCE0-\\uDCE9\\uDD30-\\uDD35\\uDD37\\uDD38\\uDD3B-\\uDD3E\\uDD40\\uDD42\\uDD43\\uDD50-\\uDD59\\uDDD1-\\uDDD7\\uDDDA-\\uDDE0\\uDDE4\\uDE01-\\uDE0A\\uDE33-\\uDE39\\uDE3B-\\uDE3E\\uDE47\\uDE51-\\uDE5B\\uDE8A-\\uDE99\\uDF60-\\uDF67\\uDFF0-\\uDFF9]|\\uD807[\\uDC2F-\\uDC36\\uDC38-\\uDC3F\\uDC50-\\uDC59\\uDC92-\\uDCA7\\uDCA9-\\uDCB6\\uDD31-\\uDD36\\uDD3A\\uDD3C\\uDD3D\\uDD3F-\\uDD45\\uDD47\\uDD50-\\uDD59\\uDD8A-\\uDD8E\\uDD90\\uDD91\\uDD93-\\uDD97\\uDDA0-\\uDDA9\\uDDE0-\\uDDE9\\uDEF3-\\uDEF6\\uDF00\\uDF01\\uDF03\\uDF34-\\uDF3A\\uDF3E-\\uDF42\\uDF50-\\uDF5A]|\\uD80D[\\uDC40\\uDC47-\\uDC55]|\\uD818[\\uDD1E-\\uDD39]|\\uD81A[\\uDE60-\\uDE69\\uDEC0-\\uDEC9\\uDEF0-\\uDEF4\\uDF30-\\uDF36\\uDF50-\\uDF59]|\\uD81B[\\uDD70-\\uDD79\\uDF4F\\uDF51-\\uDF87\\uDF8F-\\uDF92\\uDFE4\\uDFF0\\uDFF1]|\\uD82F[\\uDC9D\\uDC9E]|\\uD833[\\uDCF0-\\uDCF9\\uDF00-\\uDF2D\\uDF30-\\uDF46]|\\uD834[\\uDD65-\\uDD69\\uDD6D-\\uDD72\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44]|\\uD835[\\uDFCE-\\uDFFF]|\\uD836[\\uDE00-\\uDE36\\uDE3B-\\uDE6C\\uDE75\\uDE84\\uDE9B-\\uDE9F\\uDEA1-\\uDEAF]|\\uD838[\\uDC00-\\uDC06\\uDC08-\\uDC18\\uDC1B-\\uDC21\\uDC23\\uDC24\\uDC26-\\uDC2A\\uDC8F\\uDD30-\\uDD36\\uDD40-\\uDD49\\uDEAE\\uDEEC-\\uDEF9]|\\uD839[\\uDCEC-\\uDCF9\\uDDEE\\uDDEF\\uDDF1-\\uDDFA\\uDEE3\\uDEE6\\uDEEE\\uDEEF\\uDEF5]|\\uD83A[\\uDCD0-\\uDCD6\\uDD44-\\uDD4A\\uDD50-\\uDD59]|\\uD83E[\\uDFF0-\\uDFF9]|\\uDB40[\\uDD00-\\uDDEF]/;return De(b)||b>=48&&b<=57||b>=128&&_.test(e(b))}function $t(){var b,_=Z();return Ee&&/[\\^$.*+?()\\\\[\\]{}|/]/.test(_)||!Ee&&_!==\"c\"?_===\"k\"&&s.lookbehind?null:(b=J(1),l(\"identifier\",b.charCodeAt(0),b,1)):null}function Bt(){var b,_=E;return(b=se(\"[^\"))?(b=It(),Y(\"]\"),P(b,!0,_,E)):ae(\"[\")?(b=It(),Y(\"]\"),P(b,!1,_,E)):null}function It(){var b;return ne(\"]\")?{kind:\"union\",body:[]}:kr?Ls():(b=Ms(),b||ie(\"nonEmptyClassRanges\"),{kind:\"union\",body:b})}function Pe(b){var _,A,C,G,he;if(ne(\"-\")&&!je(\"]\")){_=b.range[0],N(),he=p(\"-\"),G=Vt(),G||ie(\"classAtom\"),A=E;var tt=It();return tt||ie(\"classContents\"),!(\"codePoint\"in b)||!(\"codePoint\"in G)?Ee?ie(\"invalid character class\"):C=[b,he,G]:C=[D(b,G,_,A)],tt.type===\"empty\"?C:C.concat(tt.body)}return C=js(),C||ie(\"nonEmptyClassRangesNoDash\"),[b].concat(C)}function Ms(){var b=Vt();return b||ie(\"classAtom\"),ne(\"]\")?[b]:Pe(b)}function js(){var b=Vt();return b||ie(\"classAtom\"),ne(\"]\")?b:Pe(b)}function Vt(){return ae(\"-\")?p(\"-\"):Ps()}function Ps(){var b;switch(b=Z()){case\"\\\\\":{if(N(),b=et(),!b){if(!Ee&&Z()==\"c\")return p(\"\\\\\");ie(\"classEscape\")}return lt(b,Ee)}case\"]\":case\"-\":break;default:return N(),p(b)}}function Ls(){var b=[],_,A=Fi(!0);for(b.push(A),A.type===\"classRange\"?_=\"union\":ne(\"&\")?_=\"intersection\":ne(\"-\")?_=\"subtraction\":_=\"union\";!ne(\"]\");)_===\"intersection\"?(Y(\"&\"),Y(\"&\"),ne(\"&\")&&ie(\"&& cannot be followed by &. Wrap it in brackets: &&[&].\")):_===\"subtraction\"&&(Y(\"-\"),Y(\"-\")),A=Fi(_===\"union\"),b.push(A);return{kind:_,body:b}}function Fi(b){var _=E,A,C;if(ae(\"\\\\\")){if(se(\"q{\"))return Bs();if(C=et())A=C;else{if(C=To())return C;ie(\"Invalid escape\",\"\\\\\"+Z(),_)}}else if(C=Oi())A=C;else{if(C=Bt())return C;ie(\"Invalid character\",Z())}if(b&&ne(\"-\")&&!je(\"-\")){if(N(),C=Ri())return D(A,C,_,E);ie(\"Invalid range end\",Z())}return A}function Ri(){if(ae(\"\\\\\")){var b,_=E;if(b=To())return b;ie(\"Invalid escape\",\"\\\\\"+Z(),_)}return Oi()}function Oi(){var b;if(pe(/^(?:&&|!!|##|\\$\\$|%%|\\*\\*|\\+\\+|,,|\\.\\.|::|;;|<<|==|>>|\\?\\?|@@|\\^\\^|``|~~)/)&&ie(\"Invalid set operation in character class\"),b=pe(/^[^()[\\]{}/\\-\\\\|]/))return p(b)}function To(){var b;if(ae(\"b\"))return l(\"singleEscape\",8,\"\\\\b\");if(ae(\"B\"))ie(\"\\\\B not possible inside of ClassContents\",\"\",E-2);else return(b=pe(/^[&\\-!#%,:;<=>@`~]/))?l(\"identifier\",b[0].codePointAt(0),b[0]):(b=Tt())?b:null}function Bs(){var b=E-3,_=[];do _.push(Ni());while(ae(\"|\"));return Y(\"}\"),F(_,b,E)}function Ni(){for(var b=[],_=E,A;A=Ri();)b.push(A);return M(b,_,E)}function ie(b,_,A,C){A=A??E,C=C??A;var G=Math.max(0,A-10),he=Math.min(C+10,i.length),tt=\" \"+i.substring(G,he),Ut=\" \"+new Array(A-G+1).join(\" \")+\"^\";throw SyntaxError(b+\" at position \"+A+(_?\": \"+_:\"\")+`\n`+tt+`\n`+Ut)}var ko=[],zn=0,Mi=!0,Sr=!1,Tr=(o||\"\").indexOf(\"u\")!==-1,kr=(o||\"\").indexOf(\"v\")!==-1,Ee=Tr||kr,E=0;if(kr&&!s.unicodeSet)throw new Error('The \"v\" flag is only supported when the .unicodeSet option is enabled.');if(Tr&&kr)throw new Error('The \"u\" and \"v\" flags are mutually exclusive.');i=String(i),i===\"\"&&(i=\"(?:)\");var qn=ct();return qn.range[1]!==i.length&&ie(\"Could not parse entire input - got stuck\",\"\",qn.range[1]),Sr=Sr||ko.some(function(b){return b<=zn}),Sr?(E=0,Mi=!1,ct()):qn}var r={parse:t};n.exports?n.exports=r:window.regjsparser=r})()})(bg);var sC=bg.exports;function vg(n,e){var t=sC.parse(n,e?\"u\":\"\",{lookbehind:!0,unicodePropertyEscape:!0});return t}function $l(n){var e=n.length;return e?n[e-1]:null}function _g(n,e){var t;for(t=0;t<n.length&&t<e.length&&n[t]===e[t];t++);return{a:n.slice(t),b:e.slice(t)}}var ug=[\"lookahead\",\"lookbehind\",\"negativeLookahead\",\"negativeLookbehind\"];function aC(n,e,t,r){return\"\".concat(n.slice(0,t)).concat(e).concat(n.slice(r))}function lg(n){var e=n.after,t=n.offsets,r=n.shiftAmount;return new Set(B([],q(t),!1).map(function(i){return i>e?i+r:i}))}function cC(n){return n.symbol?\"\".concat(n.symbol).concat(n.greedy?\"\":\"?\"):n.min===n.max?\"{\".concat(n.min,\"}\"):\"{\".concat(n.min,\",\").concat(n.max||\"\",\"}\").concat(n.greedy?\"\":\"?\")}function xg(n){if(n.type!==\"alternative\")return!1;var e=n.body;if(e.length<1)return!1;var t=q(e,1),r=t[0];if(r.type!==\"quantifier\"||r.min!==0||r.max!==void 0||r.greedy)return!1;var i=r.body[0];return!(i.type!==\"characterClass\"||(i.kind,i.body.length!==0)||!i.negative)}function uC(n){if(xg(n))return!1;var e=function(t){var r,i;if(t.type===\"anchor\")return t.kind===\"start\"?\"anchor\":null;if(t.type===\"quantifier\"&&t.max===0)return null;if(t.type===\"alternative\"||t.type===\"group\"||t.type===\"quantifier\"){var o=t.type===\"quantifier\"&&t.min===0;try{for(var s=ze(t.body),a=s.next();!a.done;a=s.next()){var c=a.value,u=e(c);if(u===\"consumingNode\")return\"consumingNode\";if(u===\"anchor\")return o?null:\"anchor\"}}catch(l){r={error:l}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return null}if(t.type===\"disjunction\"){var u=t.body.map(function(p){return e(p)});return u.some(function(p){return p===\"consumingNode\"})?\"consumingNode\":u.every(function(p){return p===\"anchor\"})?\"anchor\":null}return\"consumingNode\"};return e(n)===\"consumingNode\"}function lC(n){var e=new Map,t=function(i,o){var s=function(c,u){var l=\"\";return c.forEach(function(p){l+=t(p,u+l.length)}),l};switch(i.type){case\"anchor\":case\"characterClass\":case\"characterClassEscape\":case\"unicodePropertyEscape\":case\"value\":case\"dot\":return i.raw;case\"reference\":return e.set(i,o),i.raw;case\"group\":switch(i.behavior){case\"normal\":return\"(?:\".concat(s(i.body,o+3),\")\");case\"ignore\":return\"(?:\".concat(s(i.body,o+3),\")\");case\"lookahead\":case\"lookbehind\":case\"negativeLookahead\":case\"negativeLookbehind\":return\"\"}case\"disjunction\":{var a=\"\";return i.body.forEach(function(c,u){u>0&&(a+=\"|\"),a+=t(c,o+a.length)}),a}case\"alternative\":return s(i.body,o);case\"quantifier\":return\"\".concat(t(i.body[0],o)).concat(cC(i))}},r=t(n,0);return{referencesWithOffset:e,result:r}}function dC(n){for(var e=n.pattern,t=n.unicode,r=function(c){var u=vg(c.pattern,t),l=[],p=!1,f=u.type===\"disjunction\",m=new Map,g=new Set,h=1,y=function(F,M){if(F.body.length!==1)return!1;var V=F.body[0];return V===M},v=function(F){var M=F.nodeStack,V=F.nodes,N=F.passedStartAnchor,J=F.serial,Y=null;V.forEach(function(se){J?(x({immediatelyPrecedingLookahead:Y,node:se,nodeStack:M,passedStartAnchor:N}),Y=se.type===\"group\"&&se.behavior===\"lookahead\"?se:null):x({immediatelyPrecedingLookahead:Y,node:se,nodeStack:M,passedStartAnchor:Oe({},N)})})},x=function(F){var M=F.immediatelyPrecedingLookahead,V=F.node,N=F.nodeStack,J=F.passedStartAnchor,Y=function(){J.value||(p=!0)};switch(V.type){case\"characterClass\":case\"characterClassEscape\":case\"unicodePropertyEscape\":case\"value\":case\"dot\":Y();return;case\"anchor\":{V.kind===\"start\"&&(J.value=!0);return}case\"group\":{var se=null;V.behavior===\"normal\"&&(se=h,h++),v({nodeStack:B(B([],q(N),!1),[V],!1),nodes:V.body,passedStartAnchor:J,serial:!0}),se!==null&&V.behavior===\"normal\"&&m.set(se,{group:V,stack:B([],q(N),!1)});return}case\"disjunction\":{v({nodeStack:B(B([],q(N),!1),[V],!1),nodes:V.body,passedStartAnchor:J,serial:!1});return}case\"alternative\":{v({nodeStack:B(B([],q(N),!1),[V],!1),nodes:V.body,passedStartAnchor:J,serial:!0});return}case\"quantifier\":{V.max!==0&&(V.max===void 0&&B([],q(N),!1).reverse().some(function(me){if(me.type===\"group\"){if(ug.indexOf(me.behavior)>=0)return!0;g.add(me)}return!1}),v({nodeStack:B(B([],q(N),!1),[V],!1),nodes:V.body,passedStartAnchor:V.min===0?Oe({},J):J,serial:!0}));return}case\"reference\":{Y();var ae=m.get(V.matchIndex);if(ae){var Z=ae.group,ne=ae.stack,yt=_g(ne,N).a,je=yt.flatMap(function(me){return me.type===\"group\"&&ug.indexOf(me.behavior)>=0?[me]:[]}),pe=yt.some(function(me){return me.type===\"disjunction\"||me.type===\"quantifier\"&&me.min===0}),ct=je.length>0,We=je.every(function(me){return me.behavior!==\"negativeLookahead\"&&me.behavior!==\"negativeLookbehind\"});if(We&&(ct||g.has(Z))){var ut=!!M&&y(M,Z),St=ct&&pe;l.push({atomicOrOptional:ut?\"atomic\":St?\"optional\":null,group:Z,reference:V})}}return}}};x({immediatelyPrecedingLookahead:null,node:u,nodeStack:[],passedStartAnchor:{value:!1}});var $=c.pattern,P=new Set(c.atomicGroupOffsets),D=!1;return B([],q(l),!1).sort(function(F,M){return M.reference.range[0]-F.reference.range[0]}).forEach(function(F){var M=F.atomicOrOptional,V=F.group,N=q(F.reference.range,2),J=N[0],Y=N[1],se=lC(V),ae=se.result,Z=se.referencesWithOffset;Z.size>0&&(D=!0);var ne=M===\"optional\"?\"(?:\".concat(ae,\"?)\"):ae;$=aC($,ne,J,Y);var yt=ne.length-(Y-J);P=lg({after:J,offsets:P,shiftAmount:yt}),M===\"atomic\"&&P.add(J),l.forEach(function(je){var pe=je.atomicOrOptional,ct=je.reference;if(pe===\"atomic\"){var We=Z.get(ct);We!==void 0&&P.add(J+We)}})}),p&&!xg(u)&&(f&&($=\"(?:\".concat($,\")\")),$=\"[^]*?\".concat($),P=lg({after:-1,offsets:P,shiftAmount:f?8:5})),{needToRerun:D,result:{atomicGroupOffsets:P,pattern:$}}},i={atomicGroupOffsets:new Set,pattern:e};;){var o=r(i),s=o.result,a=o.needToRerun;if(i=s,!a)break}return i}function fC(n){return new FinalizationRegistry(n)}var Rl=Symbol(\"fork\"),uc=Symbol(\"pendingResults\");function pC(n){var e=new Set,t=fC(function(o){e.delete(o)}),r=function(){var o=n.next();e.forEach(function(s){return s(o)})},i=function(o){var s,a=(s={},s[Rl]=function(){return i(this[uc])},s[uc]=o.slice(0),s.next=function(l){if(l!==void 0)throw new Error(\"`ForkableIterator` `next()` cannot take a value\");var p=this[uc];return p.length||r(),p.shift()},s),c=new WeakRef(a),u=function(l){var p=c.deref();p?.[uc].push(l)};return t.register(a,u),e.add(u),a};return i([])}function lc(n){if(!n||!n[Rl])throw new Error(\"The provided value was not a `ForkableIterator` from `buildForkableIterator()`\");return n[Rl]()}function hC(){return xe(this,function(n){return[2]})}function fo(n){return pC(n)}function mC(n){var e,t,r,i,o,s,a;return xe(this,function(c){switch(c.label){case 0:c.trys.push([0,6,7,8]),e=ze(n),t=e.next(),c.label=1;case 1:if(t.done)return[3,5];r=t.value,i=void 0,c.label=2;case 2:return(i=r.next()).done?[3,4]:[4,i.value];case 3:return c.sent(),[3,2];case 4:return t=e.next(),[3,1];case 5:return[3,8];case 6:return o=c.sent(),s={error:o},[3,8];case 7:try{t&&!t.done&&(a=e.return)&&a.call(e)}finally{if(s)throw s.error}return[7];case 8:return[2]}})}function As(n){return xe(this,function(e){switch(e.label){case 0:return[5,ze(n)];case 1:return e.sent(),[2]}})}function dg(n,e){var t=[];return n[0]<e[0]&&t.push([n[0],Math.min(e[0]-1,n[1])]),n[1]>e[1]&&t.push([Math.max(e[1]+1,n[0]),n[1]]),t}function gC(n,e){var t=Math.max(n[0],e[0]),r=Math.min(n[1],e[1]);return t>r?null:[t,r]}function yC(n){for(var e=B([],q(n),!1).sort(function(c,u){return c-u}),t=[],r=0,i=0;i<e.length;i++){var o=e[r],s=e[i],a=i+1<e.length?e[i+1]:null;(a===null||a-o!==i-r+1)&&(t.push([o,s]),r=i+1)}return t}function Pl(n){for(var e=[],t=0;t<n.length+1;t++){var r=t-1>=0?n[t-1]:null,i=t<n.length?n[t]:null,o=r?r[1]+1:-1/0,s=i?i[0]-1:1/0;if(o-s!==1){if(o>s)throw new Error(\"Internal error: invalid ranges input\");e.push([o,s])}}return e}function Ll(n){return!n.rangesNegated&&!n.ranges.length&&!n.unicodePropertyEscapes.size}function Bl(n,e){var t,r,i,o,s,a;n.rangesNegated?e.rangesNegated?(a=!0,s=B(B([],q(n.ranges),!1),q(e.ranges),!1)):(a=!1,s=B([],q(e.ranges),!1),n.ranges.forEach(function(h){var y=[];s.forEach(function(v){y.push.apply(y,B([],q(dg(v,h)),!1))}),s=y})):e.rangesNegated?(a=!1,s=B([],q(n.ranges),!1),e.ranges.forEach(function(h){var y=[];s.forEach(function(v){y.push.apply(y,B([],q(dg(v,h)),!1))}),s=y})):(a=!1,s=[],n.ranges.forEach(function(h){e.ranges.forEach(function(y){var v=gC(h,y);v&&s.push(v)})}));var c=new Set(B(B([],q(n.unicodePropertyEscapes.keys()),!1),q(e.unicodePropertyEscapes.keys()),!1)),u=new Map;try{for(var l=ze(c),p=l.next();!p.done;p=l.next()){var f=p.value,m=(i=n.unicodePropertyEscapes.get(f))!==null&&i!==void 0?i:null,g=(o=e.unicodePropertyEscapes.get(f))!==null&&o!==void 0?o:null;m!==null&&g===null?u.set(f,m):m===null&&g!==null?u.set(f,g):m!==null&&g!==null&&m===g&&u.set(f,m)}}catch(h){t={error:h}}finally{try{p&&!p.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return{ranges:s,rangesNegated:a,unicodePropertyEscapes:u}}function bC(n){return xe(this,function(e){switch(e.label){case 0:return[4,{bounded:!1,offset:n,stack:[],subType:\"end\",type:Dt}];case 1:throw e.sent(),new Error(\"Internal error: should not be reading after end\")}})}function Ag(n,e){var t=function(r,i,o){var s,a,c,u,l,p;return o===void 0&&(o=0),xe(this,function(f){switch(f.label){case 0:s=0,f.label=1;case 1:return a=r(s,o),a!==\"stop\"?[3,2]:[2];case 2:return a!==\"fork\"?[3,4]:[4,{reader:function(){return hC()},subType:null,type:Ar}];case 3:f.sent(),f.label=4;case 4:c=!1,u=i(s),l=void 0,p=function(){var m,g,h,y;return xe(this,function(v){switch(v.label){case 0:switch(m=l.value,g=m.type,g){case Ar:return[3,1];case Dt:return[3,3]}return[3,5];case 1:return h=s,y=o,[4,{reader:function(){return t(function(x,$){return x===0?\"continue\":r(x+h,$)},function(x){return x===0?m.reader():i(x+h)},y)},subType:m.subType,type:Ar}];case 2:return v.sent(),[3,5];case 3:return m.subType!==\"null\"&&m.subType!==\"start\"&&m.subType!==\"end\"&&(c=!0),[4,m];case 4:return v.sent(),[3,5];case 5:return[2]}})},f.label=5;case 5:return(l=u.next()).done?[3,7]:[5,p()];case 6:return f.sent(),[3,5];case 7:o=c?0:o+1,f.label=8;case 8:return s++,[3,1];case 9:return[2]}})};return t(n,e)}function dc(n){var e=n.length;return Ag(function(t){return t<e?\"continue\":\"stop\"},function(t){return n[t]()})}function Ol(n){var e=n.caseInsensitive,t=n.dotAll,r=n.nodes;return dc(r.map(function(i){return function(){return xs({caseInsensitive:e,dotAll:t,node:i})}}))}function Nl(n,e){var t=function(r){var i,o;return xe(this,function(s){switch(s.label){case 0:o=function(){var a,c;return xe(this,function(u){switch(u.label){case 0:switch(a=i.value,c=a.type,c){case Ar:return[3,1];case Dt:return[3,3]}return[3,5];case 1:return[4,{reader:function(){return t(a.reader())},subType:a.subType,type:Ar}];case 2:return u.sent(),[3,5];case 3:return[4,e(a)];case 4:return u.sent(),[3,5];case 5:return[2]}})},s.label=1;case 1:return(i=r.next()).done?[3,3]:[5,o()];case 2:return s.sent(),[3,1];case 3:return[2]}})};return t(n)}function vC(n){return new Set(n.flatMap(function(e){return e.type===\"group\"?[e.group]:[]}))}function _C(n){var e,t,r=[];try{for(var i=ze(n),o=i.next();!o.done;o=i.next()){var s=o.value;if(s.type===\"group\"){var a=s.group,c=a.behavior;(c===\"lookbehind\"||c===\"negativeLookbehind\"||c===\"negativeLookahead\"||c===\"lookahead\")&&r.push(a)}}}catch(u){e={error:u}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return r}function xC(n){var e=n.caseInsensitive,t=n.dotAll,r=n.node;switch(r.behavior){case\"lookbehind\":case\"negativeLookbehind\":case\"lookahead\":case\"negativeLookahead\":return As([{reader:function(){return dc([function(){return Nl(Ol({caseInsensitive:e,dotAll:t,nodes:r.body}),function(i){return Oe(Oe({},i),{stack:B([{group:r,type:\"group\"}],q(i.stack),!1)})})},function(){return bC(r.range[1])}])},subType:r.behavior,type:Ar}]);case\"ignore\":case\"normal\":return Nl(Ol({caseInsensitive:e,dotAll:t,nodes:r.body}),function(i){return Oe(Oe({},i),{stack:B([{group:r,type:\"group\"}],q(i.stack),!1)})})}}function fg(n){return xe(this,function(e){switch(e.label){case 0:return[4,{offset:n,stack:[],subType:\"null\",type:Dt}];case 1:return e.sent(),[2]}})}function _s(n,e){if(!n.has(e))throw new Error(\"Internal error: map missing key\");return n.get(e)}function AC(n,e){var t=n.some(function(r){if(r.type!==\"group\"||r.group.behavior!==\"normal\")return!1;var i=_s(e.capturingGroupToIndex,r.group),o=e.reachableReferences.some(function(s){return s.matchIndex===i});return o});return t?new Set:new Set(n.flatMap(function(r){return r.type===\"quantifier\"?[r]:[]}).filter(function(r){var i=r.iteration,o=r.quantifier;return i>=1&&i>=o.min}).map(function(r){var i=r.quantifier;return i}))}function CC(n){var e=new Map;return n.flatMap(function(t){return t.type===\"quantifier\"?[t]:[]}).forEach(function(t){var r=t.iteration,i=t.quantifier;return e.set(i,r)}),e}function DC(n){var e=n.caseInsensitive,t=n.dotAll,r=n.node,i=r.min,o=r.max,s=o===void 0?1/0:o;return dc([function(){return fg(r.body[0].range[0])},function(){return Ag(function(a,c){return c>1||a>=s?\"stop\":a>=i?\"fork\":\"continue\"},function(a){return Nl(dc(B(B([],q(a>0?[function(){return fg(r.body[0].range[0])}]:[]),!1),[function(){return xs({caseInsensitive:e,dotAll:t,node:r.body[0]})}],!1)),function(c){return Oe(Oe({},c),{stack:B([{iteration:a,quantifier:r,type:\"quantifier\"}],q(c.stack),!1)})})})}])}function wC(n){var e;return xe(this,function(t){switch(t.label){case 0:switch(e=n.kind,e){case\"end\":return[3,1];case\"start\":return[3,3];case\"boundary\":return[3,5];case\"not-boundary\":return[3,5]}return[3,6];case 1:return[4,{bounded:!0,offset:n.range[0],stack:[],subType:\"end\",type:Dt}];case 2:throw t.sent(),new Error(\"Internal error: should not be reading after end\");case 3:return[4,{offset:n.range[0],stack:[],subType:\"start\",type:Dt}];case 4:return t.sent(),[3,6];case 5:return[3,6];case 6:return[2]}})}var Cg=[[48,57]],EC=Pl(Cg),Dg=[[48,57],[65,90],[95,95],[97,122]],SC=Pl(Dg),wg=[[9,9],[10,10],[11,11],[12,12],[13,13],[32,32],[160,160],[5760,5760],[8192,8202],[8232,8233],[8239,8239],[8287,8287],[12288,12288],[65279,65279]],TC=Pl(wg);function Eg(n){switch(n){case\"d\":case\"D\":return n===\"d\"?Cg:EC;case\"w\":case\"W\":return n===\"w\"?Dg:SC;case\"s\":case\"S\":return n===\"s\"?wg:TC}}function kC(n){var e,t;return xe(this,function(r){switch(r.label){case 0:return e=n.value,t=Eg(e),[4,{characterGroups:{ranges:t,rangesNegated:!1,unicodePropertyEscapes:new Map},node:n,stack:[],subType:\"groups\",type:Dt}];case 1:return r.sent(),[2]}})}function $C(n){if(n.length>1)return null;var e=n.codePointAt(0);if(!e)throw new Error(\"Internal error: expected codepoint\");return e}function Sg(n){var e=String.fromCodePoint(n).toUpperCase(),t=$C(e);return t!==null?t:n}function IC(n){var e=n.caseInsensitive,t=n.highCodePoint,r=n.lowCodePoint;if(!e)return[[r,t]];for(var i=new Set,o=r;o<=t;o++)i.add(Sg(o));return yC(i)}function Tg(n){var e=n.caseInsensitive,t=n.value,r=t.codePoint;return e?Sg(r):r}function FC(n){var e=n.caseInsensitive,t=n.node,r=Tg({caseInsensitive:e,value:t});return As([{characterGroups:{ranges:[[r,r]],rangesNegated:!1,unicodePropertyEscapes:new Map},node:t,stack:[],subType:\"groups\",type:Dt}])}function RC(n){var e,t,r=n.caseInsensitive,i=n.node,o=[],s=new Map,a=!1;try{e:for(var c=ze(i.body),u=c.next();!u.done;u=c.next()){var l=u.value;switch(l.type){case\"value\":{var p=Tg({caseInsensitive:r,value:l});o.push([p,p]);break}case\"characterClassRange\":{o.push.apply(o,B([],q(IC({caseInsensitive:r,highCodePoint:l.max.codePoint,lowCodePoint:l.min.codePoint})),!1));break}case\"characterClassEscape\":{var f=l.value;o.push.apply(o,B([],q(Eg(f)),!1));break}case\"unicodePropertyEscape\":{var m=l.negative!==i.negative;if(s.get(l.value)===!m){a=!0;break e}s.set(l.value,m);break}}}}catch(g){e={error:g}}finally{try{u&&!u.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}return As([{characterGroups:a?{ranges:[],rangesNegated:!0,unicodePropertyEscapes:new Map}:{ranges:o,rangesNegated:i.negative,unicodePropertyEscapes:s},node:i,stack:[],subType:\"groups\",type:Dt}])}function OC(n){var e=n.caseInsensitive,t=n.dotAll,r=n.node;return mC([As(r.body.slice(0,-1).map(function(i){return{reader:function(){return xs({caseInsensitive:e,dotAll:t,node:i})},subType:null,type:Ar}})),xs({caseInsensitive:e,dotAll:t,node:r.body[r.body.length-1]})])}function NC(n){var e=n.dotAll,t=n.node;return xe(this,function(r){switch(r.label){case 0:return[4,{characterGroups:{ranges:e?[]:[[10,10],[13,13],[8232,8233]],rangesNegated:!0,unicodePropertyEscapes:new Map},node:t,stack:[],subType:\"groups\",type:Dt}];case 1:return r.sent(),[2]}})}function MC(n){return xe(this,function(e){switch(e.label){case 0:return[4,{node:n,referenceIndex:n.matchIndex,stack:[],subType:\"reference\",type:Dt}];case 1:return e.sent(),[2]}})}function jC(n){return As([{characterGroups:{ranges:[],rangesNegated:!1,unicodePropertyEscapes:new Map([[n.value,n.negative]])},node:n,stack:[],subType:\"groups\",type:Dt}])}var Dt=Symbol(\"characterReaderTypeCharacterEntry\"),Ar=Symbol(\"characterReaderTypeSplit\");function xs(n){var e=n.caseInsensitive,t=n.dotAll,r=n.node;switch(r.type){case\"anchor\":return wC(r);case\"characterClass\":return RC({caseInsensitive:e,node:r});case\"characterClassEscape\":return kC(r);case\"unicodePropertyEscape\":return jC(r);case\"reference\":return MC(r);case\"value\":return FC({caseInsensitive:e,node:r});case\"dot\":return NC({dotAll:t,node:r});case\"alternative\":return Ol({caseInsensitive:e,dotAll:t,nodes:r.body});case\"disjunction\":return OC({caseInsensitive:e,dotAll:t,node:r});case\"group\":return xC({caseInsensitive:e,dotAll:t,node:r});case\"quantifier\":return DC({caseInsensitive:e,dotAll:t,node:r})}}var kg=Symbol(\"characterReaderLevel2TypeSplit\"),Ml=Symbol(\"characterReaderLevel1TypeEntry\");function PC(n){var e=n.caseInsensitive,t=n.dotAll,r=n.node,i=function(o,s){var a,c,u;return xe(this,function(l){switch(l.label){case 0:c=function(){var p,f,m,g;return xe(this,function(h){switch(h.label){case 0:switch(p=a.value.type,p){case Dt:return[3,1];case Ar:return[3,10]}return[3,12];case 1:switch(f=a.value.subType,f){case\"groups\":return[3,2];case\"reference\":return[3,4];case\"end\":return[3,6];case\"null\":return[3,7];case\"start\":return[3,8]}return[3,9];case 2:return[4,{characterGroups:a.value.characterGroups,node:a.value.node,precedingZeroWidthEntries:s,stack:a.value.stack,subType:\"groups\",type:Ml}];case 3:return h.sent(),s=[],[3,9];case 4:return[4,{node:a.value.node,precedingZeroWidthEntries:s,referenceIndex:a.value.referenceIndex,stack:a.value.stack,subType:a.value.subType,type:Ml}];case 5:return h.sent(),s=[],[3,9];case 6:return[2,{value:{bounded:a.value.bounded,precedingZeroWidthEntries:s}}];case 7:return s=B(B([],q(s),!1),[{offset:a.value.offset,stack:a.value.stack,type:\"null\"}],!1),[3,9];case 8:return s=B(B([],q(s),!1),[{offset:a.value.offset,stack:a.value.stack,type:\"start\"}],!1),[3,9];case 9:return[3,12];case 10:return m=a.value,g=s,[4,{reader:function(){return i(m.reader(),g)},subType:m.subType,type:kg}];case 11:return h.sent(),[3,12];case 12:return[2]}})},l.label=1;case 1:return(a=o.next()).done?[3,3]:[5,c()];case 2:return u=l.sent(),typeof u==\"object\"?[2,u.value]:[3,1];case 3:return[2,{bounded:!1,precedingZeroWidthEntries:s}]}})};return i(xs({caseInsensitive:e,dotAll:t,node:r}),[])}var Vl=Symbol(\"characterReaderLevel2TypeSplit\"),fc=Symbol(\"characterReaderLevel2TypeEntry\"),$g=Symbol(\"internalReaderTypeSplit\"),Ul=Symbol(\"internalReaderTypeEntry\");function Ig(n){var e,t;return xe(this,function(r){switch(r.label){case 0:t=function(){var i,o;return xe(this,function(s){switch(s.label){case 0:switch(i=e.value,o=i.type,o){case kg:return[3,1];case Ml:return[3,3]}return[3,5];case 1:return[4,{reader:function(){return Ig(i.reader())},subType:i.subType,type:$g}];case 2:return s.sent(),[3,5];case 3:return[4,Oe(Oe({},i),{type:Ul})];case 4:return s.sent(),[3,5];case 5:return[2]}})},r.label=1;case 1:return(e=n.next()).done?[3,3]:[5,t()];case 2:return r.sent(),[3,1];case 3:return[2,e.value]}})}function LC(n,e){var t,r;try{for(var i=ze(e),o=i.next();!o.done;o=i.next()){var s=q(o.value,2),a=s[0],c=s[1],u=n.get(a)||0;if(c-u>1)return!0}}catch(l){t={error:l}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return!1}function BC(n){var e,t,r,i,o,s,a,c,u,l=n.groupContentsStore,p=n.groups,f=n.groupsWithInfiniteSize,m=n.nodeExtra,g=n.value;return xe(this,function(h){switch(h.label){case 0:if(e=_s(m.indexToCapturingGroup,g.referenceIndex),t=l.get(g.referenceIndex)||{contents:[],group:e},r=_g(_s(m.nodeToLookaheadStack,t.group),_s(m.nodeToLookaheadStack,g.node)).a,r.length){if(r.some(function(y){var v=y.behavior;return v===\"negativeLookahead\"||v===\"negativeLookbehind\"}))return[2,{bounded:!1,precedingZeroWidthEntries:[]}];throw new Error(\"Unsupported reference (\".concat(g.referenceIndex,\" at position \").concat(g.node.range[0],\"). Pattern needs downgrading. See the `downgradePattern` option.\"))}if(p.has(t.group))return[2,{bounded:!1,precedingZeroWidthEntries:[]}];if(f.has(g.referenceIndex))throw new Error(\"Unsupported reference to group \".concat(g.referenceIndex,\" as group is not a finite size. Pattern needs downgrading. See the `downgradePattern` option.\"));h.label=1;case 1:h.trys.push([1,6,7,8]),i=ze(t.contents),o=i.next(),h.label=2;case 2:return o.done?[3,5]:(s=o.value,[4,{characterGroups:s.characterGroups,node:s.node,precedingZeroWidthEntries:s.precedingZeroWidthEntries,stack:B(B(B([],q(s.stack),!1),[{reference:g.node,type:\"reference\"}],!1),q(g.stack),!1),subType:\"groups\",type:Ul}]);case 3:h.sent(),h.label=4;case 4:return o=i.next(),[3,2];case 5:return[3,8];case 6:return a=h.sent(),c={error:a},[3,8];case 7:try{o&&!o.done&&(u=i.return)&&u.call(i)}finally{if(c)throw c.error}return[7];case 8:return[2,{bounded:!1,precedingZeroWidthEntries:[]}]}})}function pg(n){var e=n.caseInsensitive,t=n.dotAll,r=n.node,i=n.nodeExtra,o=function(s){var a,c;return xe(this,function(u){switch(u.label){case 0:a=function(){var l,p,f,m,g,h,y,v,x,$,P,D,F,M,V,N,J,Y,se,ae,Z,ne,yt,je,pe,ct,We,ut,St,me,_n,Lt,Qe,Xt,lt,et,xn,Qt,He,en,Er,tn,Tt;return xe(this,function(bt){switch(bt.label){case 0:if(l=s.precedingZeroWidthEntries,p=s.groupsWithInfiniteSize,f=s.groupContentsStore,m=s.quantifierIterationsAtLastGroup,g=s.characterReader,h=s.referenceCharacterReaderWithReference,y=h?.reader||g,v=y.next(),v.done){if(h){if(v.value.bounded)throw new Error(\"Internal error: end of reference reader cannot be bounded\");return s={characterReader:g,groupContentsStore:f,groupsWithInfiniteSize:p,precedingZeroWidthEntries:B(B([],q(l),!1),q(v.value.precedingZeroWidthEntries),!1),quantifierIterationsAtLastGroup:m,referenceCharacterReaderWithReference:null},[2,\"continue-outer\"]}return[2,{value:{bounded:v.value.bounded,precedingZeroWidthEntries:B(B([],q(l),!1),q(v.value.precedingZeroWidthEntries),!1),type:\"end\"}}]}switch(x=v.value,$=x.type,$){case $g:return[3,1];case Ul:return[3,3]}return[3,7];case 1:if(h)throw new Error(\"Internal error: should not be seeing a split from a reference reader\");return P=f,D=m,F=p,M=l,[4,{reader:function(){return o({characterReader:fo(x.reader()),groupContentsStore:P,groupsWithInfiniteSize:F,precedingZeroWidthEntries:M,quantifierIterationsAtLastGroup:D,referenceCharacterReaderWithReference:h})},subType:x.subType,type:Vl}];case 2:return bt.sent(),[3,7];case 3:switch(l=B(B([],q(l),!1),q(x.precedingZeroWidthEntries),!1),V=CC(x.stack),N=_C(x.stack),J=vC(x.stack),Y=x.subType,Y){case\"reference\":return[3,4];case\"groups\":return[3,5]}return[3,7];case 4:{if(h)throw new Error(\"Internal error: should not be seeing a reference from a reference reader\");return LC(m,V)?[2,{value:{type:\"abort\"}}]:(se=fo(BC({groupContentsStore:f,groups:J,groupsWithInfiniteSize:p,nodeExtra:i,value:x})),s={characterReader:g,groupContentsStore:f,groupsWithInfiniteSize:p,precedingZeroWidthEntries:l,quantifierIterationsAtLastGroup:m,referenceCharacterReaderWithReference:{reader:se,reference:x.node}},[3,7])}case 5:if(ae=new Map(f),!h)try{for(Z=(Qt=void 0,ze(f)),ne=Z.next();!ne.done;ne=Z.next()){yt=q(ne.value,2),je=yt[0],pe=yt[1].group,ct=B(B([],q(l.map(function(Te){var De=Te.offset;return De})),!1),[x.node.range[0]],!1);try{for(We=(en=void 0,ze(ct)),ut=We.next();!ut.done;ut=We.next())if(St=ut.value,pe.range[0]>=St){ae.delete(je);break}}catch(Te){en={error:Te}}finally{try{ut&&!ut.done&&(Er=We.return)&&Er.call(We)}finally{if(en)throw en.error}}}}catch(Te){Qt={error:Te}}finally{try{ne&&!ne.done&&(He=Z.return)&&He.call(Z)}finally{if(Qt)throw Qt.error}}me=!1,_n=B([],q(x.stack),!1).reverse(),Lt=_n.findIndex(function(Te){var De=Te.type;return De===\"reference\"}),Qe=_n.slice(0,Lt>=0?Lt:x.stack.length),Xt=function(Te){if(Te.type===\"quantifier\"&&Te.quantifier.max===void 0)return me=!0,\"continue\";if(Te.type!==\"group\")return\"continue\";var De=Te.group;if(De.behavior===\"lookbehind\"||De.behavior===\"negativeLookbehind\"||De.behavior===\"negativeLookahead\"||De.behavior===\"lookahead\")return me=!1,\"continue\";if(De.behavior!==\"normal\")return\"continue\";var kt=_s(i.capturingGroupToIndex,De);if(me){var $t=new Set(p);$t.add(kt),p=$t}var Bt=ae.get(kt)||{contents:[],group:De};ae.set(kt,Oe(Oe({},Bt),{contents:B(B([],q(Bt.contents),!1),[Oe(Oe({},x),{precedingZeroWidthEntries:l.filter(function(It){var Pe=It.offset;return Pe>=De.range[0]&&Pe<=De.range[1]})})],!1)}))};try{for(lt=(tn=void 0,ze(Qe)),et=lt.next();!et.done;et=lt.next())xn=et.value,Xt(xn)}catch(Te){tn={error:Te}}finally{try{et&&!et.done&&(Tt=lt.return)&&Tt.call(lt)}finally{if(tn)throw tn.error}}return f=ae,m=V,[4,{characterGroups:x.characterGroups,groups:J,lookaheadStack:N,node:x.node,precedingZeroWidthEntries:l,stack:x.stack,type:fc}];case 6:return bt.sent(),l=[],s={characterReader:g,groupContentsStore:f,groupsWithInfiniteSize:p,precedingZeroWidthEntries:l,quantifierIterationsAtLastGroup:m,referenceCharacterReaderWithReference:h},[3,7];case 7:return[2]}})},u.label=1;case 1:return[5,a()];case 2:if(c=u.sent(),typeof c==\"object\")return[2,c.value];if(c===\"continue-outer\")return[3,3];u.label=3;case 3:return[3,1];case 4:return[2]}})};return o({characterReader:fo(Ig(PC({caseInsensitive:e,dotAll:t,node:r}))),groupContentsStore:new Map,groupsWithInfiniteSize:new Set,precedingZeroWidthEntries:[],quantifierIterationsAtLastGroup:new Map,referenceCharacterReaderWithReference:null})}var VC=(function(){function n(e,t){this._history=[],this._isEqual=e,t&&(this._history=B([],q(t.getHistory()),!1))}return n.prototype._isEntryEqual=function(e,t){return this._isEqual(e.left,t.left)&&this._isEqual(e.right,t.right)},n.prototype.append=function(e){this._history.push(e)},n.prototype.clone=function(){return new n(this._isEqual,this)},n.prototype.getHistory=function(){return B([],q(this._history),!1)},n.prototype.getRepeatingEntries=function(){var e=this._history.length;e:for(var t=1;t<=e/2;t++){for(var r=e-t*2,i=0;i<t;i++)if(!this._isEntryEqual(this._history[r+i],this._history[r+t+i]))continue e;return this._history.slice(r,r+t)}return null},n})();function bn(n){var e=!1,t;return function(){return e||(e=!0,t=n()),t}}var jl=Symbol(\"isUnboundedReaderTypeStep\"),UC={ranges:[[10,10],[13,13],[8232,8233]],rangesNegated:!0,unicodePropertyEscapes:new Map};function hg(n){var e,t,r,i,o=n.multiLine,s=n.reader;return xe(this,function(a){switch(a.label){case 0:e=lc(s),t=[{get:bn(function(){return e.next()}),reader:e}],r=function(){var c,u,l,p,f;return xe(this,function(m){switch(m.label){case 0:return c=t.pop(),c?[4,{type:jl}]:[2,\"break\"];case 1:if(m.sent(),u=c.get(),u.done){if(u.value.type===\"end\"&&!u.value.bounded)return[2,{value:!0}]}else switch(u.value.type){case Vl:{l=u.value,t.push({get:bn(function(){return c.reader.next()}),reader:c.reader}),l.subType===null&&(p=l.reader(),t.push({get:bn(function(){return p.next()}),reader:p}));break}case fc:{o&&(f=Ll(Bl(UC,u.value.characterGroups)),f&&t.push({get:bn(function(){return c.reader.next()}),reader:c.reader}));break}}return[2]}})},a.label=1;case 1:return[5,r()];case 2:if(i=a.sent(),typeof i==\"object\")return[2,i.value];if(i===\"break\")return[3,4];a.label=3;case 3:return[3,1];case 4:return[2,!1]}})}function zC(n,e){return new Set(B(B([],q(n),!1),q(e),!1))}function qC(n,e){return n.size===e.size&&zC(n,e).size===n.size}var Fg=Symbol(\"checkerReaderTypeTrail\");function ZC(n,e){return n===e}function lo(n,e){return n.map(function(t){switch(t.type){case\"quantifier\":return\"q:\".concat(t.quantifier.range[0],\":\").concat(e&&t.quantifier.max===void 0&&t.iteration>=t.quantifier.min?\"*\":\"\".concat(t.iteration));case\"reference\":return\"r:\".concat(t.reference.range[0]);case\"group\":return\"g:\".concat(t.group.range[0])}}).filter(Boolean).join(\",\")}function Il(n,e){for(var t=new Set,r=0;r<n.length;r++){var i=n[r];i.type===\"group\"&&e.has(i.group.range[0])&&t.add(lo(n.slice(0,r+1),!1))}return t}function WC(n){return[n.type,n.offset,lo(n.stack,!1)].join(\":\")}function mg(n,e){return B(B([],q(n.precedingZeroWidthEntries.map(function(t){return{hash:[\"zw\",WC(t)].join(\":\"),stack:t.stack}})),!1),[{hash:[\"s\",e].join(\":\"),stack:n.stack}],!1)}function uo(n,e){return n.hash===e.hash}function HC(n){var e,t,r,i,o,s,a,c,u,l,p,f,m,g,h,y,v,x;return xe(this,function($){switch($.label){case 0:e=new Set,t=new Set,r=new Map,i=0,o=Date.now()+n.timeout,s=!1,a=!1,c=fo(n.leftStreamReader),u=fo(n.rightStreamReader),l=[{infiniteLoopTracker:new VC(ZC),streamReadersWithGetters:[{get:bn(function(){return c.next()}),reader:c},{get:bn(function(){return u.next()}),reader:u}],trail:[]}],p=function(){var P,D,F,M,V,N,He,J,Y,se,ae,Z,ne,yt,je,pe,ct,We,ut,St,me,_n,Lt,Qe,Xt,lt,et,xn,Qt,He,en,Er,tn,Tt,bt,Pe,Te,De,kt,Pe,$t,Bt,It,Pe,Ms,js,Vt,Ps,Ls,Fi,Ri,Oi,To,Bs,Ni,ie,ko,zn,Mi,Sr,Tr,kr,Ee,E,qn,b;return xe(this,function(_){switch(_.label){case 0:if(s=Date.now()>o,s||i>n.maxSteps)return[2,\"break\"];if(P=l.pop(),!P)return[2,\"break\"];for(D=P.streamReadersWithGetters,F=P.infiniteLoopTracker,M=P.trail,V=[],N=function(A){i+=.5;var C=D[A].get();if(!C.done&&C.value.type===Vl){var G=C.value;l.push({infiniteLoopTracker:F,streamReadersWithGetters:D.map(function(tt,Ut){var Vs=tt.reader,Bc=tt.get;return{get:Ut===A?bn(function(){return Vs.next()}):Bc,reader:Vs}}),trail:M});var he=D.map(function(tt,Ut){var Vs=tt.reader,Bc=tt.get,kd=Ut===A?fo(G.reader()):lc(Vs);return{get:Ut<A?Bc:bn(function(){return kd.next()}),reader:kd}});return l.push({infiniteLoopTracker:F.clone(),streamReadersWithGetters:he,trail:M}),\"continue-outer\"}else V.push(C)},He=0;He<D.length;He++)if(J=N(He),J===\"continue-outer\")return[2,J];if(Y=q(V,2),se=Y[0],ae=Y[1],i>n.maxSteps||se.done||ae.done)return[2,\"continue\"];if(se.value.type!==fc||ae.value.type!==fc)throw new Error(\"Internal error: impossible leftValue/rightValue type\");if(Z=se.value,ne=ae.value,yt=Z.precedingZeroWidthEntries.some(function(A){var C=A.type;return C===\"start\"}),je=ne.precedingZeroWidthEntries.some(function(A){var C=A.type;return C===\"start\"}),pe=yt||je,M.length>0&&pe)return[2,\"continue\"];if(ct=$l(Z.lookaheadStack),We=$l(ne.lookaheadStack),ct!==We)return[2,\"continue\"];if(ut=Bl(Z.characterGroups,ne.characterGroups),Ll(ut))return[2,\"continue\"];if(St=lo(Z.stack,!1),me=lo(ne.stack,!1),_n=[Z.node.range[0],St].join(\":\"),Lt=[ne.node.range[0],me].join(\":\"),Qe=$l(M),Xt=new Set(Qe?.left.atomicGroupsEnteredTogether),lt=new Set(Qe?.right.atomicGroupsEnteredTogether),et=!!Qe?.diverged,!et)for(xn=mg(Z,_n),Qt=mg(ne,Lt),He=0;He<Math.min(xn.length,Qt.length);He++){if(en=xn[He],Er=Qt[He],en.hash!==Er.hash){et=!0;break}tn=Il(en.stack,n.atomicGroupOffsets);try{for(Tt=(Tr=void 0,ze(tn)),bt=Tt.next();!bt.done;bt=Tt.next())Pe=bt.value,Xt.add(Pe),lt.add(Pe)}catch(A){Tr={error:A}}finally{try{bt&&!bt.done&&(kr=Tt.return)&&kr.call(Tt)}finally{if(Tr)throw Tr.error}}}Te=Il(Z.stack,n.atomicGroupOffsets);try{for(De=(Ee=void 0,ze(Xt)),kt=De.next();!kt.done;kt=De.next())Pe=kt.value,Te.has(Pe)||Xt.delete(Pe)}catch(A){Ee={error:A}}finally{try{kt&&!kt.done&&(E=De.return)&&E.call(De)}finally{if(Ee)throw Ee.error}}$t=Il(ne.stack,n.atomicGroupOffsets);try{for(Bt=(qn=void 0,ze(lt)),It=Bt.next();!It.done;It=Bt.next())Pe=It.value,$t.has(Pe)||lt.delete(Pe)}catch(A){qn={error:A}}finally{try{It&&!It.done&&(b=Bt.return)&&b.call(Bt)}finally{if(qn)throw qn.error}}if(Ms={atomicGroupsEnteredTogether:Xt,characterGroups:Z.characterGroups,contextTrail:St,hash:_n,node:Z.node,stack:Z.stack},js={atomicGroupsEnteredTogether:lt,characterGroups:ne.characterGroups,contextTrail:me,hash:Lt,node:ne.node,stack:ne.stack},Vt={diverged:et,intersection:ut,left:Ms,right:js},M=B(B([],q(M),!1),[Vt],!1),Ps=AC(Z.stack,n.nodeExtra),Ps.size>0&&(Ls=M.every(function(A){var C=A.left,G=A.right;return uo(C,G)}),Ls))return[2,\"continue\"];if(Fi={left:[Z.node.range[0],lo(Z.stack,!0)].join(\":\"),right:[ne.node.range[0],lo(Z.stack,!0)].join(\":\")},r.set(Fi,Vt),F.append(Fi),Ri=F.getRepeatingEntries(),Ri){if(Oi=r.get(Ri[0]),!Oi)throw new Error(\"Internal error: missing entry at start of loop\");return t.add(Oi),[2,\"continue\"]}if(!qC(Vt.left.atomicGroupsEnteredTogether,Vt.right.atomicGroupsEnteredTogether))return[2,\"continue-outer\"];if(To=uo(Vt.left,Vt.right),To)return[3,2];{for(Bs=hg({multiLine:n.multiLine,reader:lc(D[0].reader)}),Ni=void 0;!(Ni=Bs.next()).done;)switch(Ni.value.type){case jl:{if(i+=.5,i>n.maxSteps)return[2,\"break-outer\"];break}}if(ie=Ni.value,ie)return[2,\"continue\"]}{for(ko=hg({multiLine:n.multiLine,reader:lc(D[1].reader)}),zn=void 0;!(zn=ko.next()).done;)switch(zn.value.type){case jl:{if(i+=.5,i>n.maxSteps)return[2,\"break-outer\"];break}}if(Mi=zn.value,Mi)return[2,\"continue\"]}return Sr=function(){var A=B([],q(e),!1).some(function(C){return C.length!==M.length?!1:C.every(function(G,he){return uo(G.left,M[he].left)&&uo(G.right,M[he].right)})||C.every(function(G,he){return uo(G.left,M[he].right)&&uo(G.right,M[he].left)})});return!A},Sr()?(e.add(M),[4,{trail:M,type:Fg}]):[3,2];case 1:_.sent(),_.label=2;case 2:return l.push({infiniteLoopTracker:F,streamReadersWithGetters:D.map(function(A){var C=A.reader;return{get:bn(function(){return C.next()}),reader:C}}),trail:M}),[2]}})},$.label=1;case 1:return[5,p()];case 2:if(f=$.sent(),f===\"break\")return[3,4];switch(f){case\"break-outer\":return[3,4];case\"continue-outer\":return[3,3]}$.label=3;case 3:return[3,1];case 4:if(t.size>0)try{for(m=ze(e),g=m.next();!g.done;g=m.next())if(h=g.value,h.some(function(P){return t.has(P)})){a=!0;break}}catch(P){v={error:P}}finally{try{g&&!g.done&&(x=m.return)&&x.call(m)}finally{if(v)throw v.error}}return y=i>n.maxSteps?\"hitMaxSteps\":s?\"timedOut\":null,[2,y?{error:y}:{error:null,infinite:a}]}})}var GC=[\"lookahead\",\"lookbehind\",\"negativeLookahead\",\"negativeLookbehind\"];function KC(n){var e=new Map,t=new Map,r=new Map,i=[],o=function(s,a,c){switch(s.type){case\"anchor\":case\"characterClass\":case\"characterClassEscape\":case\"characterClassRange\":case\"unicodePropertyEscape\":case\"value\":case\"dot\":return;case\"reference\":{r.set(s,a),c&&i.push(s);break}case\"alternative\":case\"disjunction\":{s.body.forEach(function(p){return o(p,a,c)});return}case\"group\":{if(s.behavior===\"normal\"){var u=e.size+1;e.set(s,u),t.set(u,s),r.set(s,a)}var l=B([],q(a),!1);s.behavior!==\"normal\"&&GC.indexOf(s.behavior)>=0&&l.push(s),s.body.forEach(function(p){return o(p,l,c)});return}case\"quantifier\":{s.body.forEach(function(p){return o(p,a,c&&s.max!==0)});return}}};return o(n,[],!0),{capturingGroupToIndex:e,indexToCapturingGroup:t,nodeToLookaheadStack:r,reachableReferences:i}}var JC=(function(){function n(){this._cache=new Map}return n.prototype.addResult=function(e,t,r){var i=this._cache.get(e)||new Map;i.set(t,r),this._cache.set(e,i);var o=this._cache.get(t)||new Map;o.set(e,r),this._cache.set(t,o)},n.prototype.getResult=function(e,t){var r;return(r=this._cache.get(e))===null||r===void 0?void 0:r.get(t)},n})(),Rg=(function(){function n(e){this.decode=e,this.root=new Map,this.results=new Map,this._items=function(){return[]}}return n.prototype.add=function(e){var t=this.decode(e);if(t.length!==0){for(var r=this.results,i={children:this.root},o=t.length,s=0;s<o;s++){var a=t[s],c=s===o-1,u=i.children.get(a);if(u)i=u,c||r.delete(u);else{var l={children:new Map,value:a};i.children.set(a,l),i=l,c&&r.set(l,e)}}this._items=bn(function(){return Array.from(r.values())})}},Object.defineProperty(n.prototype,\"items\",{get:function(){return this._items()},enumerable:!1,configurable:!0}),n})(),Fl=25e3,YC=(function(){function n(e,t){this.trail=e,this.isEmptyCache=t,this.tree=new Rg(function(r){return r.map(function(i){var o=i.hash;return o})}),this.inputStringSchema=e.map(function(r){var i=r.intersection;return i}),this.length=e.length,this.onNewTrail(this)}return Object.defineProperty(n.prototype,\"matches\",{get:function(){return this.tree.items},enumerable:!1,configurable:!0}),n.prototype.getLongestMatch=function(e,t){var r=this;if(t.length>e.length)throw new Error(\"Internal error: trail should be <= than input string schema\");var i=t.findIndex(function(o,s){var a=r.isEmptyCache.getResult(o.characterGroups,e[s]);if(a!==void 0)return a;var c=Ll(Bl(o.characterGroups,e[s]));return r.isEmptyCache.addResult(o.characterGroups,e[s],c),c});return i===-1?t:t.slice(0,i)},n.prototype.onNewTrail=function(e){var t,r,i=[],o=[];try{for(var s=ze(e.trail),a=s.next();!a.done;a=s.next()){var c=a.value;i.push(c.left),o.push(c.right)}}catch(p){t={error:p}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}var u=this.getLongestMatch(this.inputStringSchema,i);u.length===this.length&&this.tree.add(u);var l=this.getLongestMatch(this.inputStringSchema,o);l.length===this.length&&this.tree.add(l)},n})();function XC(n){var e,t,r=n.atomicGroupOffsets,i=n.node,o=n.maxScore,s=n.maxSteps,a=n.multiLine,c=n.timeout,u=n.caseInsensitive,l=n.dotAll,p=new JC,f=KC(i),m={caseInsensitive:u,dotAll:l,node:i,nodeExtra:f},g=pg(m),h=pg(m),y=HC({atomicGroupOffsets:r,leftStreamReader:g,maxSteps:s,multiLine:a,nodeExtra:f,rightStreamReader:h,timeout:c}),v=new Rg(function(Y){var se=Y.trail;return se}),x=1,$=0,P;e:for(;!(P=y.next()).done;)switch(P.value.type){case Fg:{var D=new YC(P.value.trail,p),F=function(Y){var se=Y.matches,ae=se.length;ae>x&&(x=ae)};if($<Fl){try{for(var M=(e=void 0,ze(v.items)),V=M.next();!V.done;V=M.next()){var N=V.value;if(N.length===D.length){if($+=D.length,$>=Fl)break;D.onNewTrail(N),N.onNewTrail(D),F(N)}}}catch(Y){e={error:Y}}finally{try{V&&!V.done&&(t=M.return)&&t.call(M)}finally{if(e)throw e.error}}F(D)}if($>=Fl&&(x+=1),v.add(D),x>o)break e;break}}var J=null;return P.done?P.value.error?(x=1/0,J=P.value.error):P.value.infinite&&(x=1/0,J=\"hitMaxScore\"):(x=1/0,J=\"hitMaxScore\"),{error:J,score:x,trails:v.items.map(function(Y){var se=Y.trail;return se})}}var QC=1/0,eD=200,tD=2e4,nD=!1,rD=!1,iD=!1,oD=!1;function pc(n){return{end:{offset:n.range[1]},source:n.raw,start:{offset:n.range[0]}}}function gg(n){return n.flatMap(function(e){return e.type===\"reference\"?[e.reference]:[]}).reverse().map(function(e){return{index:e.matchIndex,node:pc(e)}})}function yg(n){var e=B([],q(n),!1).reverse(),t=e.findIndex(function(i){var o=i.type;return o===\"reference\"}),r=e.slice(0,t>=0?t:n.length).reverse();return r.flatMap(function(i){return i.type===\"quantifier\"?[i]:[]}).map(function(i){var o=i.quantifier,s=i.iteration;return{iteration:s,node:pc(o)}})}function zl(n,e){var t=e===void 0?{}:e,r=t.atomicGroupOffsets,i=t.maxScore,o=i===void 0?eD:i,s=t.maxSteps,a=s===void 0?tD:s,c=t.multiLine,u=c===void 0?nD:c,l=t.timeout,p=l===void 0?QC:l,f=t.caseInsensitive,m=f===void 0?iD:f,g=t.dotAll,h=g===void 0?oD:g,y=t.unicode,v=y===void 0?rD:y,x=t.downgradePattern,$=x===void 0?!0:x;if(m&&v)throw new Error(\"`caseInsensitive` cannot be used with `unicode`.\");if($&&r)throw new Error(\"`atomicGroupOffsets` cannot be used with `downgradePattern: true`.\");if(p<=0)throw new Error(\"`timeout` must be a positive number.\");if(o<0)throw new Error(\"`maxScore` must be a positive number or 0.\");if(a<=0)throw new Error(\"`maxSteps` must be a positive number.\");var P=$?dC({pattern:n,unicode:v}):{atomicGroupOffsets:new Set(r||[]),pattern:n},D=P.pattern,F=P.atomicGroupOffsets,M=$&&n!==D,V=vg(D,v);if(!$&&uC(V))throw new Error(\"Pattern is not bounded at the start and needs downgrading. See the `downgradePattern` option.\");var N=XC({atomicGroupOffsets:F,caseInsensitive:m,dotAll:h,maxScore:o,maxSteps:a,multiLine:u,node:V,timeout:p});return Oe(Oe({},N.error?{error:N.error,safe:!1}:{error:null,safe:!0}),{pattern:D,patternDowngraded:M,score:N.score===1/0?{infinite:!0}:{infinite:!1,value:N.score},trails:N.trails.map(function(J){var Y={trail:J.map(function(se){var ae=se.left,Z=se.right,ne={a:{backreferenceStack:gg(Z.stack),node:pc(Z.node),quantifierIterations:yg(Z.stack)},b:{backreferenceStack:gg(ae.stack),node:pc(ae.node),quantifierIterations:yg(ae.stack)}};return ne})};return Y})})}function Og(n,e={}){if(n==null||typeof n!=\"string\"||n.length===0)return!0;let t=e.maxPatternLength??256;if(n.length>t)return!1;try{return new RegExp(n),zl(n).safe&&zl(`^(?:${n})$`).safe}catch{return!1}}var Di=\"en-US\";function hc(n){if(!n)return Di;try{return Intl.NumberFormat.supportedLocalesOf(n).length>0?n:Di}catch{return Di}}function sD(n){if(n==null)return\"\";if(typeof n==\"object\")try{return JSON.stringify(n)??String(n)}catch{return String(n)}return String(n)}function Bg(n){let e=!0;return(n==null||typeof n==\"string\"&&n===\"\"||Array.isArray(n)&&n.length===0)&&(e=!1),{valid:e,...e?{}:{message:\"This field is required.\"}}}function Vg(n,e){if(!Og(e))throw new de(`Unsafe regex pattern (catastrophic backtracking risk): ${e}`,\"regex\");try{let t=new RegExp(e).test(String(n??\"\"));return{valid:t,...t?{}:{message:\"Value does not match required pattern.\"}}}catch(t){throw new de(`Invalid regex pattern: ${e}`,\"regex\",t)}}function Ug(n,e,t){let r=0;(typeof n==\"string\"||Array.isArray(n))&&(r=n.length);let i=!0,o;return e!==void 0&&!isNaN(e)&&r<e?(i=!1,o=`Minimum length is ${e}.`):t!==void 0&&!isNaN(t)&&r>t&&(i=!1,o=`Maximum length is ${t}.`),{valid:i,...o?{message:o}:{}}}function zg(n,e,t){let r=Number(n);if(isNaN(r))return{valid:!1,message:\"Value must be a valid number.\"};let i=!0,o;return e!==void 0&&!isNaN(e)&&r<e?(i=!1,o=`Minimum value is ${e}.`):t!==void 0&&!isNaN(t)&&r>t&&(i=!1,o=`Maximum value is ${t}.`),{valid:i,...o?{message:o}:{}}}var aD=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/;function qg(n){let e=typeof n==\"string\"&&aD.test(n);return{valid:e,...e?{}:{message:\"Must be a valid email address.\"}}}var Ng=new Map;function cD(n,e,t){let r=`${n}:${e??\"undef\"}:${t??\"true\"}`,i=Ng.get(r);return i||(i=new Intl.NumberFormat(n,{minimumFractionDigits:e,maximumFractionDigits:e,useGrouping:t}),Ng.set(r,i)),i}var Mg=new Map;function uD(n,e,t,r){let i=`${n}:${e}:${t??\"undef\"}:${r??\"true\"}`,o=Mg.get(i);return o||(o=new Intl.NumberFormat(n,{style:\"currency\",currency:e,minimumFractionDigits:t,maximumFractionDigits:t,useGrouping:r}),Mg.set(i,o)),o}var lD=\"USD\",jg=new Map;function dD(n,e,t){let r=`${n}:${e??\"undef\"}:${t??\"true\"}`,i=jg.get(r);return i||(i=new Intl.NumberFormat(n,{style:\"currency\",currency:lD,currencyDisplay:\"code\",minimumFractionDigits:e,maximumFractionDigits:e,useGrouping:t}),jg.set(r,i)),i}var Pg=new Map;function fD(n){let e=Pg.get(n);if(!e){let t=(o,s)=>{let a=new Intl.DateTimeFormat(n,{...o,timeZone:\"UTC\"});return s.map(c=>a.format(c))},r=Array.from({length:12},(o,s)=>new Date(Date.UTC(2021,s,15))),i=Array.from({length:7},(o,s)=>new Date(Date.UTC(2021,2,1+s)));e={monthsLong:t({month:\"long\"},r),monthsShort:t({month:\"short\"},r),weekdaysLong:t({weekday:\"long\"},i),weekdaysShort:t({weekday:\"short\"},i)},Pg.set(n,e)}return e}var pD=/yyyy|yy|MMMM|MMM|MM|M|EEEE|E|dd|d|HH|H|hh|h|mm|ss|a/g,hD=/(?:Z|[+-]\\d{2}:?\\d{2})$/,mD=/^([+-]?\\d{4,6})-(\\d{2})-(\\d{2})(?:[T ](\\d{2})(?::(\\d{2})(?::(\\d{2}))?)?)?/;function gD(n){let e=hD.test(n),t=new Date(e?n:`${n}Z`);if(isNaN(t.getTime()))return null;let r=0,i=/([+-])(\\d{2}):?(\\d{2})$/.exec(n);i&&(r=(i[1]===\"-\"?-1:1)*(Number(i[2])*60+Number(i[3])));let o=new Date(t.getTime()+r*6e4);return yD(n,o)?{shifted:o,instant:t}:null}function yD(n,e){let t=mD.exec(n);if(!t)return!1;let r=i=>t[i]===void 0?void 0:Number(t[i]);return r(1)===e.getUTCFullYear()&&r(2)===e.getUTCMonth()+1&&r(3)===e.getUTCDate()&&(r(4)??e.getUTCHours())===e.getUTCHours()&&(r(5)??e.getUTCMinutes())===e.getUTCMinutes()&&(r(6)??e.getUTCSeconds())===e.getUTCSeconds()}var Lg=new Map;function bD(n){let e=Lg.get(n);return e||(e=new Intl.PluralRules(n),Lg.set(n,e)),e}var po=n=>!!n;function vD(n,e=po){if(!Array.isArray(n)||n.length<2)throw new de(\"and requires at least 2 values\",\"and\");return n.every(e)}function _D(n,e=po){if(!Array.isArray(n)||n.length<2)throw new de(\"or requires at least 2 values\",\"or\");return n.some(e)}function xD(n,e=po){return!e(n)}function Zg(n){if(typeof n!=\"object\"||n===null||Array.isArray(n))return n;if(\"path\"in n&&typeof n.path==\"string\"&&!(\"@path\"in n))return{\"@path\":n.path};if(\"call\"in n&&typeof n.call==\"string\"&&!(\"@call\"in n)){let e={};if(n.args&&typeof n.args==\"object\")for(let[t,r]of Object.entries(n.args))e[t]=Zg(r);return{\"@call\":n.call,args:e,returnType:n.returnType}}return n}function AD(n,e){let r=new vs().parse(n);if(r.length===0)return\"\";let i=ge(e.surface?.protocolVersion??e.surface?.defaultCatalog?.protocolVersion,\"1.0\"),o=r.map(s=>{if(typeof s!=\"object\"||s===null||Array.isArray(s))return s;let a=i?Zg(s):s;return e.resolveSignal(a)});return Xr(()=>o.map(s=>sD(On(s)?Be(s):s)).join(\"\"))}function CD(n,e,t,r=Di){return isNaN(n)?\"\":cD(r,e,t).format(n)}function DD(n,e,t=2,r,i=Di){if(isNaN(n))return\"\";let o=String(e).toUpperCase();try{return uD(i,o,t,r).format(n)}catch{return dD(i,t,r).formatToParts(n).map(s=>s.type===\"currency\"?o:s.value).join(\"\")}}function wD(n,e=\"yyyy-MM-dd\",t=Di){if(!n)return\"\";let r=gD(String(n));if(!r)return\"\";let{shifted:i,instant:o}=r,s=e||\"yyyy-MM-dd\";if(s===\"ISO\")return o.toISOString();let a=fD(t),c=(i.getUTCDay()+6)%7,u=i.getUTCHours(),l=u%12||12;return s.replace(pD,p=>{switch(p){case\"yyyy\":return String(i.getUTCFullYear());case\"yy\":return String(i.getUTCFullYear()).slice(-2);case\"MMMM\":return a.monthsLong[i.getUTCMonth()];case\"MMM\":return a.monthsShort[i.getUTCMonth()];case\"MM\":return String(i.getUTCMonth()+1).padStart(2,\"0\");case\"M\":return String(i.getUTCMonth()+1);case\"EEEE\":return a.weekdaysLong[c];case\"E\":return a.weekdaysShort[c];case\"dd\":return String(i.getUTCDate()).padStart(2,\"0\");case\"d\":return String(i.getUTCDate());case\"HH\":return String(u).padStart(2,\"0\");case\"H\":return String(u);case\"hh\":return String(l).padStart(2,\"0\");case\"h\":return String(l);case\"mm\":return String(i.getUTCMinutes()).padStart(2,\"0\");case\"ss\":return String(i.getUTCSeconds()).padStart(2,\"0\");case\"a\":return u<12?\"AM\":\"PM\";default:return p}})}function ED(n,e,t=Di){let r;return n===0&&e.zero!==void 0?r=\"zero\":n===1&&e.one!==void 0?r=\"one\":n===2&&e.two!==void 0?r=\"two\":r=bD(t).select(n),String(e[r]??e.other??\"\")}function SD(n){let e=typeof n==\"string\"?n:void 0;if(!e||typeof window>\"u\"||typeof window.open!=\"function\")return;let t=typeof window<\"u\"&&typeof window.location<\"u\"&&window.location.href?window.location.href:void 0,r;try{r=t?new URL(e,t):new URL(e)}catch(i){throw new de(`Invalid URL specified: ${e}`,\"openUrl\",i)}if(r.protocol!==\"https:\"&&r.protocol!==\"http:\"&&r.protocol!==\"mailto:\"&&r.protocol!==\"tel:\")throw new de(`Unsupported URL scheme: ${r.protocol}`,\"openUrl\");window.open(r.href,\"_blank\",\"noopener,noreferrer\")}function Wg(n,{truthy:e=po}={}){return Ae(n,t=>vD(t.values,e))}function Hg(n,{truthy:e=po}={}){return Ae(n,t=>_D(t.values,e))}function Gg(n,{truthy:e=po}={}){return Ae(n,t=>xD(t.value,e))}function Kg(n){return Ae(n,(e,t)=>AD(e.value,t))}function Jg(n,e){let t=hc(e);return Ae(n,r=>CD(r.value,r.decimals,r.grouping,t))}function Yg(n,e){let t=hc(e);return Ae(n,r=>DD(r.value,r.currency,r.decimals??2,r.grouping,t))}function Xg(n,e){let t=hc(e);return Ae(n,r=>wD(r.value,r.format,t))}function Qg(n,e){let t=hc(e);return Ae(n,r=>ED(r.value,r,t))}function ey(n){return Ae(n,e=>SD(e.url))}var TD=Wg(ig),kD=Hg(og),$D=Gg(sg),ID=Ae(Hm,n=>Bg(n.value).valid),FD=Ae(Gm,n=>Vg(n.value,n.pattern).valid),RD=Ae(Km,n=>Ug(n.value,n.min,n.max).valid),OD=Ae(Jm,n=>zg(n.value,n.min,n.max).valid),ND=Ae(Ym,n=>qg(n.value).valid),MD=Kg(Xm);function ty(n){return Jg(Qm,n)}var Aj=ty();function ny(n){return Yg(eg,n)}var Cj=ny();function ry(n){return Xg(tg,n)}var Dj=ry();function iy(n){return Qg(ng,n)}var wj=iy(),jD=ey(rg);function PD(n){let e=n?.locale;return[ID,FD,RD,OD,ND,MD,ty(e),ny(e),ry(e),iy(e),jD,TD,kD,$D]}var oy=PD();var ho=new jt(\"https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json\",\"0.9\",[qm,Pm,jm,Wm,km,Vm,Om,Lm,Im,zm,Bm,Mm,$m,Zm,Fm,Rm,Um,Nm],oy,{themeSchema:Yh,...Tm});var Cr,be,ql,sy,mo=0,hy=[],Ce=K,ay=Ce.__b,cy=Ce.__r,uy=Ce.diffed,ly=Ce.__c,dy=Ce.unmount,fy=Ce.__;function go(n,e){Ce.__h&&Ce.__h(be,n,mo||e),mo=0;var t=be.__H||(be.__H={__:[],__h:[]});return n>=t.__.length&&t.__.push({}),t.__[n]}function gc(n){return mo=1,yc(my,n)}function yc(n,e,t){var r=go(Cr++,2);if(r.t=n,!r.__c&&(r.__=[t?t(e):my(void 0,e),function(a){var c=r.__N?r.__N[0]:r.__[0],u=r.t(c,a);c!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=be,!be.__f)){var i=function(a,c,u){if(!r.__c.__H)return!0;var l=!1,p=r.__c.props!==a;if(r.__c.__H.__.some(function(m){if(m.__N){l=!0;var g=m.__[0];m.__=m.__N,m.__N=void 0,g!==m.__[0]&&(p=!0)}}),o){var f=o.call(this,a,c,u);return l?f||p:f}return!l||p};be.__f=!0;var o=be.shouldComponentUpdate,s=be.componentWillUpdate;be.componentWillUpdate=function(a,c,u){if(this.__e){var l=o;o=void 0,i(a,c,u),o=l}s&&s.call(this,a,c,u)},be.shouldComponentUpdate=i}return r.__N||r.__}function wt(n,e){var t=go(Cr++,3);!Ce.__s&&Kl(t.__H,e)&&(t.__=n,t.u=e,be.__H.__h.push(t))}function Dr(n,e){var t=go(Cr++,4);!Ce.__s&&Kl(t.__H,e)&&(t.__=n,t.u=e,be.__h.push(t))}function mt(n){return mo=5,Bn(function(){return{current:n}},[])}function Wl(n,e,t){mo=6,Dr(function(){if(typeof n==\"function\"){var r=n(e());return function(){n(null),r&&typeof r==\"function\"&&r()}}if(n)return n.current=e(),function(){return n.current=null}},t==null?t:t.concat(n))}function Bn(n,e){var t=go(Cr++,7);return Kl(t.__H,e)&&(t.__=n(),t.__H=e,t.__h=n),t.__}function Xe(n,e){return mo=8,Bn(function(){return n},e)}function Cs(n){var e=be.context[n.__c],t=go(Cr++,9);return t.c=n,e?(t.__==null&&(t.__=!0,e.sub(be)),e.props.value):n.__}function Hl(n,e){Ce.useDebugValue&&Ce.useDebugValue(e?e(n):n)}function Gl(){var n=go(Cr++,11);if(!n.__){for(var e=be.__v;e!==null&&!e.__m&&e.__!==null;)e=e.__;var t=e.__m||(e.__m=[0,0]);n.__=\"P\"+t[0]+\"-\"+t[1]++}return n.__}function LD(){for(var n;n=hy.shift();){var e=n.__H;if(n.__P&&e)try{e.__h.some(mc),e.__h.some(Zl),e.__h=[]}catch(t){e.__h=[],Ce.__e(t,n.__v)}}}Ce.__b=function(n){be=null,ay&&ay(n)},Ce.__=function(n,e){n&&e.__k&&e.__k.__m&&(n.__m=e.__k.__m),fy&&fy(n,e)},Ce.__r=function(n){cy&&cy(n),Cr=0;var e=(be=n.__c).__H;e&&(ql===be?(e.__h=[],be.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.some(mc),e.__h.some(Zl),e.__h=[],Cr=0)),ql=be},Ce.diffed=function(n){uy&&uy(n);var e=n.__c;e&&e.__H&&(e.__H.__h.length&&(hy.push(e)!==1&&sy===Ce.requestAnimationFrame||((sy=Ce.requestAnimationFrame)||BD)(LD)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),ql=be=null},Ce.__c=function(n,e){e.some(function(t){try{t.__h.some(mc),t.__h=t.__h.filter(function(r){return!r.__||Zl(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],Ce.__e(r,t.__v)}}),ly&&ly(n,e)},Ce.unmount=function(n){dy&&dy(n);var e,t=n.__c;t&&t.__H&&(t.__H.__.some(function(r){try{mc(r)}catch(i){e=i}}),t.__H=void 0,e&&Ce.__e(e,t.__v))};var py=typeof requestAnimationFrame==\"function\";function BD(n){var e,t=function(){clearTimeout(r),py&&cancelAnimationFrame(e),setTimeout(n)},r=setTimeout(t,35);py&&(e=requestAnimationFrame(t))}function mc(n){var e=be,t=n.__c;typeof t==\"function\"&&(n.__c=void 0,t()),be=e}function Zl(n){var e=be;n.__c=n.__(),be=e}function Kl(n,e){return!n||n.length!==e.length||e.some(function(t,r){return t!==n[r]})}function my(n,e){return typeof e==\"function\"?e(n):e}function Dy(n,e){for(var t in e)n[t]=e[t];return n}function Yl(n,e){for(var t in n)if(t!==\"__source\"&&!(t in e))return!0;for(var r in e)if(r!==\"__source\"&&n[r]!==e[r])return!0;return!1}function wi(n,e){var t=e(),r=gc({t:{__:t,u:e}}),i=r[0].t,o=r[1];return Dr(function(){i.__=t,i.u=e,Jl(i)&&o({t:i})},[n,t,e]),wt(function(){return Jl(i)&&o({t:i}),n(function(){Jl(i)&&o({t:i})})},[n]),t}function Jl(n){try{return!((e=n.__)===(t=n.u())&&(e!==0||1/e==1/t)||e!=e&&t!=t)}catch{return!0}var e,t}function wy(n){n()}function Ey(n){return n}function Sy(){return[!1,wy]}var Ty=Dr;function Xl(n,e){this.props=n,this.context=e}function yo(n,e){function t(i){var o=this.props.ref;return o!=i.ref&&o&&(typeof o==\"function\"?o(null):o.current=null),e?!e(this.props,i)||o!=i.ref:Yl(this.props,i)}function r(i){return this.shouldComponentUpdate=t,vt(n,i)}return r.displayName=\"Memo(\"+(n.displayName||n.name)+\")\",r.__f=r.prototype.isReactComponent=!0,r.type=n,r}(Xl.prototype=new Ft).isPureReactComponent=!0,Xl.prototype.shouldComponentUpdate=function(n,e){return Yl(this.props,n)||Yl(this.state,e)};var gy=K.__b;K.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),gy&&gy(n)};var VD=typeof Symbol<\"u\"&&Symbol.for&&Symbol.for(\"react.forward_ref\")||3911;function UD(n){function e(t){var r=Dy({},t);return delete r.ref,n(r,t.ref||null)}return e.$$typeof=VD,e.render=n,e.prototype.isReactComponent=e.__f=!0,e.displayName=\"ForwardRef(\"+(n.displayName||n.name)+\")\",e}var yy=function(n,e){return n==null?null:rn(rn(n).map(e))},zD={map:yy,forEach:yy,count:function(n){return n?rn(n).length:0},only:function(n){var e=rn(n);if(e.length!==1)throw\"Children.only\";return e[0]},toArray:rn},qD=K.__e;K.__e=function(n,e,t,r){if(n.then){for(var i,o=e;o=o.__;)if((i=o.__c)&&i.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k||[]),i.__c(n,e)}qD(n,e,t,r)};var by=K.unmount;function ky(n,e,t){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(r){typeof r.__c==\"function\"&&r.__c()}),n.__c.__H=null),(n=Dy({},n)).__c!=null&&(n.__c.__P===t&&(n.__c.__P=e),n.__c.__e=!0,n.__c=null),n.__k=n.__k&&n.__k.map(function(r){return ky(r,e,t)})),n}function $y(n,e,t){return n&&t&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(r){return $y(r,e,t)}),n.__c&&n.__c.__P===e&&(n.__e&&t.appendChild(n.__e),n.__c.__e=!0,n.__c.__P=t)),n}function bc(){this.__u=0,this.o=null,this.__b=null}function Iy(n){var e=n.__&&n.__.__c;return e&&e.__a&&e.__a(n)}function ZD(n){var e,t,r,i=null;function o(s){if(e||(e=n()).then(function(a){a&&(i=a.default||a),r=!0},function(a){t=a,r=!0}),t)throw t;if(!r)throw e;return i?vt(i,s):null}return o.displayName=\"Lazy\",o.__f=!0,o}function Ds(){this.i=null,this.l=null}K.unmount=function(n){var e=n.__c;e&&(e.__z=!0),e&&e.__R&&e.__R(),e&&32&n.__u&&(n.type=null),by&&by(n)},(bc.prototype=new Ft).__c=function(n,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var i=Iy(r.__v),o=!1,s=function(){o||r.__z||(o=!0,t.__R=null,i?i(c):c())};t.__R=s;var a=t.__P;t.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var u=r.state.__a;r.__v.__k[0]=$y(u,u.__c.__P,u.__c.__O)}var l;for(r.setState({__a:r.__b=null});l=r.o.pop();)l.__P=a,l.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(s,s)},bc.prototype.componentWillUnmount=function(){this.o=[]},bc.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var t=document.createElement(\"div\"),r=this.__v.__k[0].__c;this.__v.__k[0]=ky(this.__b,t,r.__O=r.__P)}this.__b=null}var i=e.__a&&vt(Ie,null,n.fallback);return i&&(i.__u&=-33),[vt(Ie,null,e.__a?null:n.children),i]};var vy=function(n,e,t){if(++t[1]===t[0]&&n.l.delete(e),n.props.revealOrder&&(n.props.revealOrder[0]!==\"t\"||!n.l.size))for(t=n.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;n.i=t=t[2]}};function WD(n){return this.getChildContext=function(){return n.context},n.children}function HD(n){var e=this,t=n.h;if(e.componentWillUnmount=function(){Wn(null,e.v),e.v=null,e.h=null},e.h&&e.h!==t&&e.componentWillUnmount(),!e.v){for(var r=e.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;e.h=t,e.v={nodeType:1,parentNode:t,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:t.namespaceURI,insertBefore:function(i,o){this.childNodes.push(i),e.h.insertBefore(i,o)},removeChild:function(i){this.childNodes.splice(this.childNodes.indexOf(i)>>>1,1),e.h.removeChild(i)}}}Wn(vt(WD,{context:e.context},n.__v),e.v)}function Ql(n,e){var t=vt(HD,{__v:n,h:e});return t.containerInfo=e,t}(Ds.prototype=new Ft).__a=function(n){var e=this,t=Iy(e.__v),r=e.l.get(n);return r[0]++,function(i){var o=function(){e.props.revealOrder?(r.push(i),vy(e,n,r)):i()};t?t(o):o()}},Ds.prototype.render=function(n){this.i=null,this.l=new Map;var e=rn(n.children);n.revealOrder&&n.revealOrder[0]===\"b\"&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return n.children},Ds.prototype.componentDidUpdate=Ds.prototype.componentDidMount=function(){var n=this;this.l.forEach(function(e,t){vy(n,t,e)})};var Fy=typeof Symbol<\"u\"&&Symbol.for&&Symbol.for(\"react.element\")||60103,GD=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,KD=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,JD=/[A-Z0-9]/g,YD=typeof document<\"u\",XD=function(n){return(typeof Symbol<\"u\"&&typeof Symbol()==\"symbol\"?/fil|che|rad/:/fil|che|ra/).test(n)};function QD(n,e,t){return e.__k==null&&(e.textContent=\"\"),Wn(n,e),typeof t==\"function\"&&t(),n?n.__c:null}function ew(n,e,t){return Yc(n,e),typeof t==\"function\"&&t(),n?n.__c:null}Ft.prototype.isReactComponent=!0,[\"componentWillMount\",\"componentWillReceiveProps\",\"componentWillUpdate\"].forEach(function(n){Object.defineProperty(Ft.prototype,n,{configurable:!0,get:function(){return this[\"UNSAFE_\"+n]},set:function(e){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:e})}})});var _y=K.event;K.event=function(n){return _y&&(n=_y(n)),n.persist=function(){},n.isPropagationStopped=function(){return this.cancelBubble},n.isDefaultPrevented=function(){return this.defaultPrevented},n.nativeEvent=n};var ed,tw={configurable:!0,get:function(){return this.class}},xy=K.vnode;K.vnode=function(n){typeof n.type==\"string\"&&(function(e){var t=e.props,r=e.type,i={},o=r.indexOf(\"-\")==-1;for(var s in t){var a=t[s];if(!(s===\"value\"&&\"defaultValue\"in t&&a==null||YD&&s===\"children\"&&r===\"noscript\"||s===\"class\"||s===\"className\")){var c=s.toLowerCase();s===\"defaultValue\"&&\"value\"in t&&t.value==null?s=\"value\":s===\"download\"&&a===!0?a=\"\":c===\"translate\"&&a===\"no\"?a=!1:c[0]===\"o\"&&c[1]===\"n\"?c===\"ondoubleclick\"?s=\"ondblclick\":c!==\"onchange\"||r!==\"input\"&&r!==\"textarea\"||XD(t.type)?c===\"onfocus\"?s=\"onfocusin\":c===\"onblur\"?s=\"onfocusout\":KD.test(s)&&(s=c):c=s=\"oninput\":o&&GD.test(s)?s=s.replace(JD,\"-$&\").toLowerCase():a===null&&(a=void 0),c===\"oninput\"&&i[s=c]&&(s=\"oninputCapture\"),i[s]=a}}r==\"select\"&&(i.multiple&&Array.isArray(i.value)&&(i.value=rn(t.children).forEach(function(u){u.props.selected=i.value.indexOf(u.props.value)!=-1})),i.defaultValue!=null&&(i.value=rn(t.children).forEach(function(u){u.props.selected=i.multiple?i.defaultValue.indexOf(u.props.value)!=-1:i.defaultValue==u.props.value}))),t.class&&!t.className?(i.class=t.class,Object.defineProperty(i,\"className\",tw)):t.className&&(i.class=i.className=t.className),e.props=i})(n),n.$$typeof=Fy,xy&&xy(n)};var Ay=K.__r;K.__r=function(n){Ay&&Ay(n),ed=n.__c};var Cy=K.diffed;K.diffed=function(n){Cy&&Cy(n);var e=n.props,t=n.__e;t!=null&&n.type===\"textarea\"&&\"value\"in e&&e.value!==t.value&&(t.value=e.value==null?\"\":e.value),ed=null};var nw={ReactCurrentDispatcher:{current:{readContext:function(n){return ed.__n[n.__c].props.value},useCallback:Xe,useContext:Cs,useDebugValue:Hl,useDeferredValue:Ey,useEffect:wt,useId:Gl,useImperativeHandle:Wl,useInsertionEffect:Ty,useLayoutEffect:Dr,useMemo:Bn,useReducer:yc,useRef:mt,useState:gc,useSyncExternalStore:wi,useTransition:Sy}}};function rw(n){return vt.bind(null,n)}function vc(n){return!!n&&n.$$typeof===Fy}function iw(n){return vc(n)&&n.type===Ie}function ow(n){return!!n&&typeof n.displayName==\"string\"&&n.displayName.indexOf(\"Memo(\")==0}function sw(n){return vc(n)?Hd.apply(null,arguments):n}function aw(n){return!!n.__k&&(Wn(null,n),!0)}function cw(n){return n&&(n.base||n.nodeType===1&&n)||null}var uw=function(n,e){return n(e)},lw=function(n,e){var t,r=K.debounceRendering;K.debounceRendering=function(o){t=o};try{var i=n(e);return t&&t(),i}finally{K.debounceRendering=r}},dw=vc,Ry={useState:gc,useId:Gl,useReducer:yc,useEffect:wt,useLayoutEffect:Dr,useInsertionEffect:Ty,useTransition:Sy,useDeferredValue:Ey,useSyncExternalStore:wi,startTransition:wy,useRef:mt,useImperativeHandle:Wl,useMemo:Bn,useCallback:Xe,useContext:Cs,useDebugValue:Hl,version:\"18.3.1\",Children:zD,render:QD,hydrate:ew,unmountComponentAtNode:aw,createPortal:Ql,createElement:vt,createContext:Oo,createFactory:rw,cloneElement:sw,createRef:Gc,Fragment:Ie,isValidElement:vc,isElement:dw,isFragment:iw,isMemo:ow,findDOMNode:cw,Component:Ft,PureComponent:Xl,memo:yo,forwardRef:UD,flushSync:lw,unstable_batchedUpdates:uw,StrictMode:Ie,Suspense:bc,SuspenseList:Ds,lazy:ZD,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:nw};var fw=0;function ee(n,e,t,r,i,o){e||(e={});var s,a,c=e;if(\"ref\"in c)for(a in c={},e)a==\"ref\"?s=e[a]:c[a]=e[a];var u={type:n,props:c,key:t,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--fw,__i:-1,__u:0,__source:i,__self:o};if(typeof n==\"function\"&&(s=n.defaultProps))for(a in s)c[a]===void 0&&(c[a]=s[a]);return K.vnode&&K.vnode(u),u}var pw=class{},nd=new WeakMap;function hw(n,e){nd.set(n,e)}function mw(n){return nd.has(n)}function gw(n){let e=n.parentNode;for(;e;){let t=e instanceof Element?nd.get(e):void 0;if(t)return t;e=e instanceof ShadowRoot?e.host:e.parentNode}return null}var By=class _c{static registries=new WeakMap;static forSurface(e){let t=_c.registries.get(e);return t||(t=new _c,_c.registries.set(e,t)),t}hosts=new Map;snapshots=new Map;listeners=new Map;add(e,t,r){let i=this.hosts.get(e);i&&i.entry.node===t&&i.owner===r||(this.hosts.set(e,{entry:{host:e,node:t},owner:r}),i&&i.owner!==r&&this.publish(i.owner),this.publish(r))}delete(e){let t=this.hosts.get(e);t&&(this.hosts.delete(e),this.publish(t.owner))}has(e){return this.hosts.has(e)}entries(){return[...this.hosts.values()].map(({entry:e})=>e)}subscribe(e,t){let r=this.listeners.get(e);return r||(r=new Set,this.listeners.set(e,r)),r.add(t),()=>{r.delete(t)}}getSnapshot(e){let t=this.snapshots.get(e);return t||(t=this.compute(e),this.snapshots.set(e,t)),t}compute(e){let t=[];for(let{entry:r,owner:i}of this.hosts.values())i===e&&t.push(r);return t}publish(e){this.snapshots.set(e,this.compute(e));for(let t of this.listeners.get(e)??[])t()}},yw=class extends HTMLElement{context;_node;registry;connectedCallback(){this.style.display=\"contents\",this.register()}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||(this.registry?.delete(this),this.registry=void 0)})}set node(n){this._node=n,this.context=n?.context,this.register()}get node(){return this._node}register(){let n=this._node,e=n?.context?.dataContext.surface;if(!this.isConnected||!n||!e||mw(this))return;let t=By.forSurface(e);this.registry!==t&&(this.registry?.delete(this),this.registry=t),t.add(this,n,gw(this))}},Oy=new WeakMap,Ny=new Map;function bw(n){let e=`a2ui-react-${n.toLowerCase()}`,t=(Ny.get(e)??0)+1;return Ny.set(e,t),t===1?e:`${e}-${t}`}function vw(n){if(mr(n))return n;let e=Oy.get(n);if(e)return e;let t={...n,tagName:bw(n.name),element:class extends yw{}};return Oy.set(n,t),t}var My=new WeakSet;function jy(n){if(My.has(n))return;My.add(n);let e=n.components;for(let[t,r]of e)mr(r)||e.set(t,vw(r))}function _w(n){n.defaultCatalog&&jy(n.defaultCatalog);for(let e of n.availableCatalogs.values())jy(e)}function Py(n,e){n.context=e.context,n.node=e}var td=yo(({node:n,owner:e,children:t})=>{let r=n.impl;if(!mr(r))throw new Error(`A2UI catalog entry '${n.type}' has no element. A2uiSurface prepares the surface's default and available catalogs; this entry came from another catalog.`);oo(r);let i=mt(null),o=mt(n);o.current=n;let s=Xe(a=>{i.current=a,a&&(e&&hw(a,e),Py(a,o.current))},[e]);return wt(()=>{i.current&&Py(i.current,n)},[n]),Ry.createElement(r.tagName,{ref:s},t)});td.displayName=\"WebComponentNode\";function Vy(n){if(!n.context)throw new Error(`A2UI views render only resolved nodes; '${n.componentId}' has no context.`);return n.context}var Uy=({componentId:n})=>ee(\"div\",{style:{color:\"gray\",padding:\"4px\"},children:[\"[Loading \",n,\"...]\"]}),Ly=new WeakMap,zy=({surface:n,id:e,requestedPath:t,detail:r})=>{let i=`Unresolved child reference '${e}' at '${t}': ${r}`;return wt(()=>{let o=Ly.get(n);o||(o=new Set,Ly.set(n,o));let s=JSON.stringify([e,t]);o.has(s)||(o.add(s),n.dispatchError({code:\"UNRESOLVED_CHILD_REFERENCE\",message:i}))},[n,e,t,i]),ee(\"div\",{style:{color:\"red\"},children:i})};function qy(n){let e=Xe(r=>ln(()=>{Be(n),r()}),[n]),t=Xe(()=>Ye(n),[n]);return wi(e,t)}function xw(n,e){return n.set(e.id,e),e.id}function xc(n,e,t){if(xt(e)){let r=xw(t,e);return e.dataPath!==n.dataPath?{id:r,basePath:e.dataPath}:r}return e instanceof st?xc(n,e.value,t):Array.isArray(e)?e.map(r=>xc(n,r,t)):Aw(e)?Zy(n,e,t):e}function Aw(n){if(!n||typeof n!=\"object\")return!1;let e=Object.getPrototypeOf(n);return e===Object.prototype||e===null}function Zy(n,e,t){let r={};for(let[i,o]of Object.entries(e))o instanceof st?(r[i]=xc(n,o.value,t),r[`set${i.charAt(0).toUpperCase()}${i.slice(1)}`]=no(o)?o.set:()=>{}):r[i]=xc(n,o,t);return r}function Wy(n,e){let t=Vy(n),r=t.dataContext.surface,i=qy(n.props),{viewProps:o,childIndex:s}=Bn(()=>{let u=new Map;return{viewProps:Zy(n,i,u),childIndex:u}},[n,i]),a=Xe((u,l)=>{let p=l??n.dataPath,f=[...s.values()].filter(h=>h.componentId===u),m=f.find(h=>h.dataPath===p);if(m)return e(m,l);let g=[...new Set(f.map(h=>h.dataPath))];return g.length>0?ee(zy,{surface:r,id:u,requestedPath:p,detail:`instances exist at ${g.join(\", \")}. Instances are created only at the data paths the payload implies; buildChild selects among them.`},JSON.stringify([u,p])):e(u,l)},[e,n,r,s]),c=Xe((u,l)=>{let p=s.get(u);return p?e(p,l):a(u,l)},[e,a,s]);return{viewProps:o,context:t,viewBuildChild:c,rawBuildChild:a}}var Cw=({node:n,impl:e,buildChild:t})=>{let{context:r,rawBuildChild:i}=Wy(n,t),o=e.render;return ee(o,{context:r,buildChild:i})},rd=yo(({node:n})=>{let e=Bn(()=>new pw,[]);if(n.state===\"unknown-type\")return ee(\"div\",{style:{color:\"red\"},children:[\"Unknown component type: \",n.type]});if(n.isPlaceholder||!n.impl||!n.context)return ee(Uy,{componentId:n.componentId});if(\"render\"in n.impl)return ee(td,{node:n,owner:e,children:ee(id,{node:n})});let t=n.context.dataContext.surface;return ee(Ie,{children:[ee(td,{node:n,owner:e}),ee(Hy,{surface:t,owner:e})]})});rd.displayName=\"ChildElement\";var Hy=({surface:n,owner:e})=>{let t=By.forSurface(n),r=Xe(s=>t.subscribe(e,s),[t,e]),i=Xe(()=>t.getSnapshot(e),[t,e]),o=wi(r,i);return ee(Ie,{children:o.map(({host:s,node:a})=>Ql(ee(id,{node:a}),s,a.id))})},id=yo(({node:n})=>{let e=Vy(n).dataContext.surface,t=Xe((o,s)=>{if(xt(o))return ee(rd,{node:o},o.id);let a=s??n.dataPath,c=e.componentsModel.get(o)?\"the component exists, but the catalog schema does not mark the referencing property as a component id. Use componentId() or childList() from @a2ui/web_core.\":\"no component with this id exists on the surface.\";return ee(zy,{surface:e,id:o,requestedPath:a,detail:c},JSON.stringify([o,a]))},[e,n]),r=n.impl;if(n.disposed||!r||!(\"render\"in r))return null;let i=r.view;return i?ee(i,{node:n,buildChild:t}):ee(Cw,{node:n,impl:r,buildChild:t})});id.displayName=\"NodeContent\";var Gy=Oo(void 0),Ky=()=>Cs(Gy),od=({surface:n})=>{let e=Ky();Dr(()=>{e&&Sl(e)},[e]);let t=Bn(()=>({resolver:void 0}),[n]),r=Xe(s=>{_w(n);let a=new Ua(n,n.defaultCatalog);t.resolver=a;let c=ln(()=>{Be(a.rootNode),s()});return()=>{c(),a.dispose(),t.resolver===a&&(t.resolver=void 0)}},[n,t]),i=Xe(()=>t.resolver?Ye(t.resolver.rootNode):void 0,[t]),o=wi(r,i);return o?ee(Ie,{children:[ee(rd,{node:o}),ee(Hy,{surface:n,owner:null})]}):ee(Uy,{componentId:\"root\"})};function Ei(n,e){let t=yo(e,(o,s)=>!(o.props!==s.props||o.buildChild!==s.buildChild||o.context.componentModel.id!==s.context.componentModel.id||o.context.dataContext.path!==s.context.dataContext.path)),r=({context:o,buildChild:s})=>{let a=mt(null);a.current?a.current.context!==o&&(a.current.dispose(),a.current=new Mn(o,n.schema)):a.current=new Mn(o,n.schema);let c=a.current,u=Xe(f=>{let m=c.subscribe(f);return()=>m.unsubscribe()},[c]),l=Xe(()=>c.snapshot,[c]),p=wi(u,l);return wt(()=>()=>c.dispose(),[c]),ee(t,{props:p||{},buildChild:s,context:o})},i=({node:o,buildChild:s})=>{let{viewProps:a,context:c,viewBuildChild:u}=Wy(o,s);return ee(t,{props:a,buildChild:u,context:c})};return i.displayName=`${n.name}.view`,{name:n.name,schema:n.schema,render:r,view:i}}var bo=class extends Error{#e;#t;#r;#i;constructor({name:e,code:t,message:r,node:i,cause:o,range:s}){super(r,o?{cause:o}:void 0),this.name=e,this.#t=t,this.#i=r,this.#e=i,this.#r=s&&sd(s)||sd(i),i?.input&&(this.message=Jy(this.#i,i,this.#r))}get node(){return this.#e}get code(){return this.#t}get range(){return this.#r}get summary(){return this.#i}withAst(e){return this.#e||!e?.input?this:(this.#e=e,this.#r??=sd(e),this.message=Jy(this.#i,e,this.#r),this)}};function ad(n,e,t,r,i){if(typeof t==\"string\")return{name:n,code:e,message:t,node:r,cause:i};let o=t;if(typeof o!=\"object\")throw new Error(\"First param to error must be a string or object\");return{name:n,code:o.code||e,message:o.message,node:o.node,cause:o.cause,range:o.range}}var ws=class extends bo{constructor(e,t,r){super(ad(\"ParseError\",\"parse_error\",e,t,r))}},Si=class extends bo{constructor(e,t,r){super(ad(\"EvaluationError\",\"evaluation_error\",e,t,r))}},Es=class extends bo{constructor(e,t,r){super(ad(\"TypeError\",\"type_error\",e,t,r))}};function qe(n,e,t){return typeof n==\"object\"?new ws(n):new ws({code:n,message:e,node:t})}function H(n,e,t){return typeof n==\"object\"?new Si(n):new Si({code:n,message:e,node:t})}function Yy(n,e,t){return typeof n==\"object\"?new Es(n):new Es({code:n,message:e,node:t})}function sd(n){let e=n?.pos??n?.start;if(typeof e!=\"number\")return;let t=typeof n.end==\"number\"?n.end:e;return{start:e,end:t}}function Jy(n,e,t){let r=e.pos??t?.start;if(typeof r!=\"number\")return n;let i=e.input,o=1,s=0,a=0;for(;s<r;)i[s]===`\n`?(o++,a=0):a++,s++;let c=r,u=r;for(;c>0&&i[c-1]!==`\n`;)c--;for(;u<i.length&&i[u]!==`\n`;)u++;let l=i.slice(c,u),p=`> ${`${o}`.padStart(4,\" \")} | ${l}\n${\" \".repeat(9+a)}^`;return`${n}\n\n${p}`}function Ss(n,e){return n instanceof bo?n.withAst(e):n}var Et=class n{#e;constructor(e){this.#e=e}static of(e){return e===void 0?Ts:new n(e)}static none(){return Ts}hasValue(){return this.#e!==void 0}value(){if(this.#e===void 0)throw H(\"optional_value_missing\",\"Optional value is not present\");return this.#e}or(e){if(this.#e!==void 0)return this;if(e instanceof n)return e;throw H(\"invalid_optional_argument\",\"Optional.or must be called with an Optional argument\")}orValue(e){return this.#e===void 0?e:this.#e}get[Symbol.toStringTag](){return\"optional\"}[Symbol.for(\"nodejs.util.inspect.custom\")](){return this.#e===void 0?\"Optional { none }\":`Optional { value: ${JSON.stringify(this.#e)} }`}},Ts=Object.freeze(new Et),Ac=class{},Xy=new Ac;function Qy(n,e){let t=e?Xy:void 0;n.deleteVariable(\"optional\"),n.registerConstant(\"optional\",\"OptionalNamespace\",t)}function eb(n){let e={async:!1},t=(f,m)=>n.registerFunctionOverload(f,m,e),r=n.enableOptionalTypes?Xy:void 0;n.registerType(\"OptionalNamespace\",Ac),n.registerConstant(\"optional\",\"OptionalNamespace\",r),t(\"optional.hasValue(): bool\",f=>f.hasValue()),t(\"optional<A>.value(): A\",f=>f.value()),n.registerFunctionOverload(\"OptionalNamespace.none(): optional<T>\",()=>Et.none()),t(\"OptionalNamespace.of(A): optional<A>\",(f,m)=>Et.of(m));function i(f,m,g){if(f instanceof Et)return f;throw H(\"optional_expected\",`${g} must be optional`,m)}function o(f,m,g){let h=f.run(m.receiver,g);return h instanceof Promise?h.then(y=>s(y,f,m,g)):s(h,f,m,g)}function s(f,m,g,h){let y=i(f,g.receiver,`${g.functionDesc} receiver`);return y.hasValue()?g.onHasValue(y):g.onEmpty(m,g,h)}function a(f,m,g,h){let y=f.check(m,g);if(y.kind===\"optional\")return y;if(y.kind===\"dyn\")return f.getType(\"optional\");throw f.createError(\"optional_expected\",`${h} must be optional, got '${y}'`,m)}function c({functionDesc:f,evaluate:m,typeCheck:g,onHasValue:h,onEmpty:y}){return({ast:v,args:x,receiver:$})=>({ast:v,functionDesc:f,receiver:$,arg:x[0],evaluate:m,typeCheck:g,onHasValue:h,onEmpty:y})}let u=\"optional.orValue() receiver\",l=\"optional.or(optional) receiver\",p=\"optional.or(optional) argument\";n.registerFunctionOverload(\"optional.or(ast): optional<dyn>\",c({functionDesc:\"optional.or(optional)\",evaluate:o,typeCheck(f,m,g){let h=a(f,m.receiver,g,l),y=a(f,m.arg,g,p);m.receiver.maybeAsync||m.arg.maybeAsync||m.ast.setMeta(\"async\",!1);let v=h.unify(f.registry,y);if(v)return v;throw f.createError(\"incompatible_argument_type\",`${m.functionDesc} argument must be compatible type, got '${h}' and '${y}'`,m.arg)},onHasValue:f=>f,onEmpty(f,m,g){let h=m.arg,y=f.run(h,g);return y instanceof Promise?y.then(v=>i(v,h,p)):i(y,h,p)}})),n.registerFunctionOverload(\"optional.orValue(ast): dyn\",c({functionDesc:\"optional.orValue(value)\",onHasValue:f=>f.value(),onEmpty(f,m,g){return f.run(m.arg,g)},evaluate:o,typeCheck(f,m,g){let h=a(f,m.receiver,g,u).valueType,y=f.check(m.arg,g);m.receiver.maybeAsync||m.arg.maybeAsync||m.ast.setMeta(\"async\",!1);let v=h.unify(f.registry,y);if(v)return v;throw f.createError(\"incompatible_argument_type\",`${m.functionDesc} argument must be compatible type, got '${h}' and '${y}'`,m.arg)}}))}var vo=Object.hasOwn,Ze=Object.keys,Jt=Object.freeze,tb=Object.entries,Ti=Array.isArray,cd=Array.from,ki=0n,nb=18446744073709551615n,Cc=9223372036854775807n,Dc=-9223372036854775808n;function ks(n,e){return n?.[Symbol.toStringTag]===\"AsyncFunction\"?!0:typeof e==\"boolean\"?e:!0}var _o=new Set([\"as\",\"break\",\"const\",\"continue\",\"else\",\"for\",\"function\",\"if\",\"import\",\"let\",\"loop\",\"package\",\"namespace\",\"return\",\"var\",\"void\",\"while\",\"__proto__\",\"prototype\"]);var Ne=class{#e;constructor(e){this.verify(typeof e==\"bigint\"?e:BigInt(e))}get value(){return this.#e}valueOf(){return this.#e}toString(){return`${this.#e}`}verify(e){if(e<ki||e>nb)throw H(\"numeric_overflow\",\"Unsigned integer overflow\");this.#e=e}get[Symbol.toStringTag](){return`value = ${this.#e}`}[Symbol.for(\"nodejs.util.inspect.custom\")](){return`UnsignedInteger { value: ${this.#e} }`}},xo=1e9,Ao=1000000000n,Dw={h:3600000000000n,m:60000000000n,s:Ao,ms:1000000n,us:1000n,\u00B5s:1000n,ns:1n},wr=class n{#e;#t;constructor(e,t=0){this.#e=BigInt(e),this.#t=t}get seconds(){return this.#e}get nanos(){return this.#t}valueOf(){return Number(this.#e)*1e3+this.#t/1e6}static fromMilliseconds(e){let t=BigInt(Math.trunc(e*1e6)),r=t/Ao,i=Number(t%Ao);return new n(r,i)}addDuration(e){let t=this.#t+e.nanos;return new n(this.#e+e.seconds+BigInt(Math.floor(t/xo)),t%xo)}subtractDuration(e){let t=this.#t-e.nanos;return new n(this.#e-e.seconds+BigInt(Math.floor(t/xo)),(t+xo)%xo)}extendTimestamp(e){return new Date(e.getTime()+Number(this.#e)*1e3+Math.floor(this.#t/1e6))}subtractTimestamp(e){return new Date(e.getTime()-Number(this.#e)*1e3-Math.floor(this.#t/1e6))}toString(){let e=this.#t?(this.#t/xo).toLocaleString(\"en-US\",{useGrouping:!1,maximumFractionDigits:9}).slice(1):\"\";return`${this.#e}${e}s`}getHours(){return this.#e/3600n}getMinutes(){return this.#e/60n}getSeconds(){return this.#e}getMilliseconds(){return this.#e*1000n+BigInt(Math.floor(this.#t/1e6))}get[Symbol.toStringTag](){return\"google.protobuf.Duration\"}[Symbol.for(\"nodejs.util.inspect.custom\")](){return`google.protobuf.Duration { seconds: ${this.#e}, nanos: ${this.#t} }`}};function ib(n){let e={async:!1},t=(h,y)=>n.registerFunctionOverload(h,y,e),r=h=>h;t(\"dyn(dyn): dyn\",r);for(let h in Vn){let y=Vn[h];y instanceof Me&&t(`type(${y.name}): type`,()=>y)}t(\"bool(bool): bool\",r),t(\"bool(string): bool\",h=>{switch(h){case\"1\":case\"t\":case\"true\":case\"TRUE\":case\"True\":return!0;case\"0\":case\"f\":case\"false\":case\"FALSE\":case\"False\":return!1;default:throw H(\"bool_conversion_error\",`bool() conversion error: invalid string value \"${h}\"`)}}),t(\"size(string): int\",h=>BigInt(rb(h))),t(\"size(bytes): int\",h=>BigInt(h.length)),t(\"size(list): int\",h=>BigInt(h.length??h.size)),t(\"size(map): int\",h=>BigInt(h instanceof Map?h.size:Ze(h).length)),t(\"string.size(): int\",h=>BigInt(rb(h))),t(\"bytes.size(): int\",h=>BigInt(h.length)),t(\"list.size(): int\",h=>BigInt(h.length??h.size)),t(\"map.size(): int\",h=>BigInt(h instanceof Map?h.size:Ze(h).length)),t(\"bytes(string): bytes\",h=>s.fromString(h)),t(\"bytes(bytes): bytes\",r),t(\"double(double): double\",r),t(\"double(int): double\",h=>Number(h)),t(\"double(uint): double\",h=>Number(h)),t(\"double(string): double\",h=>{if(!h||h!==h.trim())throw H(\"double_conversion_error\",\"double() type error: cannot convert to double\");switch(h.toLowerCase()){case\"inf\":case\"+inf\":case\"infinity\":case\"+infinity\":return Number.POSITIVE_INFINITY;case\"-inf\":case\"-infinity\":return Number.NEGATIVE_INFINITY;case\"nan\":return Number.NaN;default:{let v=Number(h);if(!Number.isNaN(v))return v;throw H(\"double_conversion_error\",\"double() type error: cannot convert to double\")}}}),t(\"int(int): int\",r),t(\"int(double): int\",h=>{if(Number.isFinite(h))return BigInt(Math.trunc(h));throw H(\"numeric_overflow\",\"int() type error: integer overflow\")}),t(\"int(string): int\",h=>{if(h!==h.trim()||h.length>20||h.includes(\"0x\"))throw H(\"int_conversion_error\",\"int() type error: cannot convert to int\");try{let y=BigInt(h);if(y<=Cc&&y>=Dc)return y}catch{}throw H(\"int_conversion_error\",\"int() type error: cannot convert to int\")}),t(\"uint(uint): uint\",r),t(\"uint(int): uint\",h=>{try{return new Ne(h)}catch{throw H(\"uint_conversion_error\",\"uint() type error: cannot convert to uint\")}}),t(\"uint(double): uint\",h=>{try{return new Ne(Math.trunc(h))}catch{throw H(\"numeric_overflow\",\"uint() type error: unsigned integer overflow\")}}),t(\"uint(string): uint\",h=>{if(h!==h.trim()||h.length>20||h.includes(\"0x\"))throw H(\"uint_conversion_error\",\"uint() type error: cannot convert to uint\");try{return new Ne(h)}catch{throw H(\"uint_conversion_error\",\"uint() type error: cannot convert to uint\")}}),t(\"string(string): string\",r),t(\"string(bool): string\",h=>`${h}`),t(\"string(int): string\",h=>`${h}`),t(\"string(uint): string\",h=>`${h}`),t(\"string(bytes): string\",h=>s.toUtf8(h)),t(\"string(double): string\",h=>h===1/0?\"+Inf\":h===-1/0?\"-Inf\":`${h}`),t(\"string.startsWith(string): bool\",(h,y)=>h.startsWith(y)),t(\"string.endsWith(string): bool\",(h,y)=>h.endsWith(y)),t(\"string.contains(string): bool\",(h,y)=>h.includes(y)),t(\"string.lowerAscii(): string\",h=>h.toLowerCase()),t(\"string.upperAscii(): string\",h=>h.toUpperCase()),t(\"string.trim(): string\",h=>h.trim()),t(\"string.indexOf(string): int\",(h,y)=>BigInt(h.indexOf(y))),t(\"string.indexOf(string, int): int\",(h,y,v)=>{if(y===\"\")return v;if(v=Number(v),v<0||v>=h.length)throw H(\"index_out_of_range\",\"string.indexOf(search, fromIndex): fromIndex out of range\");return BigInt(h.indexOf(y,v))}),t(\"string.lastIndexOf(string): int\",(h,y)=>BigInt(h.lastIndexOf(y))),t(\"string.lastIndexOf(string, int): int\",(h,y,v)=>{if(y===\"\")return v;if(v=Number(v),v<0||v>=h.length)throw H(\"index_out_of_range\",\"string.lastIndexOf(search, fromIndex): fromIndex out of range\");return BigInt(h.lastIndexOf(y,v))}),t(\"string.substring(int): string\",(h,y)=>{if(y=Number(y),y<0||y>h.length)throw H(\"index_out_of_range\",\"string.substring(start, end): start index out of range\");return h.substring(y)}),t(\"string.substring(int, int): string\",(h,y,v)=>{if(y=Number(y),y<0||y>h.length)throw H(\"index_out_of_range\",\"string.substring(start, end): start index out of range\");if(v=Number(v),v<y||v>h.length)throw H(\"index_out_of_range\",\"string.substring(start, end): end index out of range\");return h.substring(y,v)}),t(\"string.matches(string): bool\",(h,y)=>{try{return new RegExp(y).test(h)}catch{throw H(\"invalid_regular_expression\",`Invalid regular expression: ${y}`)}}),t(\"string.split(string): list<string>\",(h,y)=>h.split(y)),t(\"string.split(string, int): list<string>\",(h,y,v)=>{if(v=Number(v),v===0)return[];let x=h.split(y);if(v<0||x.length<=v)return x;let $=x.slice(0,v-1);return $.push(x.slice(v-1).join(y)),$}),t(\"list<string>.join(): string\",h=>{for(let y=0;y<h.length;y++)if(typeof h[y]!=\"string\")throw H(\"invalid_list_element_type\",\"string.join(): list must contain only strings\");return h.join(\"\")}),t(\"list<string>.join(string): string\",(h,y)=>{for(let v=0;v<h.length;v++)if(typeof h[v]!=\"string\")throw H(\"invalid_list_element_type\",\"string.join(separator): list must contain only strings\");return h.join(y)});let i=new TextEncoder(\"utf8\"),o=new TextDecoder(\"utf8\"),s=typeof Buffer<\"u\"?{byteLength:h=>Buffer.byteLength(h),fromString:h=>Buffer.from(h,\"utf8\"),toHex:h=>Buffer.prototype.hexSlice.call(h,0,h.length),toBase64:h=>Buffer.prototype.base64Slice.call(h,0,h.length),toUtf8:h=>Buffer.prototype.utf8Slice.call(h,0,h.length),jsonParse:h=>JSON.parse(h)}:{textEncoder:new TextEncoder(\"utf8\"),byteLength:h=>i.encode(h).length,fromString:h=>i.encode(h),toHex:Uint8Array.prototype.toHex?h=>h.toHex():h=>cd(h,y=>y.toString(16).padStart(2,\"0\")).join(\"\"),toBase64:Uint8Array.prototype.toBase64?h=>h.toBase64():h=>btoa(cd(h,y=>String.fromCodePoint(y)).join(\"\")),toUtf8:h=>o.decode(h),jsonParse:h=>JSON.parse(i.decode(h))};t(\"bytes.json(): map\",s.jsonParse),t(\"bytes.hex(): string\",s.toHex),t(\"bytes.string(): string\",s.toUtf8),t(\"bytes.base64(): string\",s.toBase64),t(\"bytes.at(int): int\",(h,y)=>{if(y<0||y>=h.length)throw H(\"index_out_of_range\",\"Bytes index out of range\");return BigInt(h[y])});let a=\"google.protobuf.Timestamp\",c=\"google.protobuf.Duration\",u=n.registerType(a,Date).typeType,l=n.registerType(c,wr).typeType;n.registerConstant(\"google\",\"map<string, map<string, type>>\",{protobuf:{Duration:l,Timestamp:u}});function p(h,y){return new Date(h.toLocaleString(\"en-US\",{timeZone:y}))}function f(h,y){let v=y?p(h,y):new Date(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate()),x=new Date(v.getFullYear(),0,0);return BigInt(Math.floor((v-x)/864e5)-1)}t(`timestamp(string): ${a}`,h=>{if(h.length<20||h.length>30)throw H(\"invalid_timestamp\",\"timestamp() requires a string in ISO 8601 format\");let y=new Date(h);if(y<=0xe677d21fdbff&&y>=-621355968e5)return y;throw H(\"invalid_timestamp\",\"timestamp() requires a string in ISO 8601 format\")}),t(`timestamp(int): ${a}`,h=>{if(h=Number(h)*1e3,h<=0xe677d21fdbff&&h>=-621355968e5)return new Date(h);throw H(\"invalid_timestamp\",\"timestamp() requires a valid integer unix timestamp\")}),t(`${a}.getDate(): int`,h=>BigInt(h.getUTCDate())),t(`${a}.getDate(string): int`,(h,y)=>BigInt(p(h,y).getDate())),t(`${a}.getDayOfMonth(): int`,h=>BigInt(h.getUTCDate()-1)),t(`${a}.getDayOfMonth(string): int`,(h,y)=>BigInt(p(h,y).getDate()-1)),t(`${a}.getDayOfWeek(): int`,h=>BigInt(h.getUTCDay())),t(`${a}.getDayOfWeek(string): int`,(h,y)=>BigInt(p(h,y).getDay())),t(`${a}.getDayOfYear(): int`,f),t(`${a}.getDayOfYear(string): int`,f),t(`${a}.getFullYear(): int`,h=>BigInt(h.getUTCFullYear())),t(`${a}.getFullYear(string): int`,(h,y)=>BigInt(p(h,y).getFullYear())),t(`${a}.getHours(): int`,h=>BigInt(h.getUTCHours())),t(`${a}.getHours(string): int`,(h,y)=>BigInt(p(h,y).getHours())),t(`${a}.getMilliseconds(): int`,h=>BigInt(h.getUTCMilliseconds())),t(`${a}.getMilliseconds(string): int`,h=>BigInt(h.getUTCMilliseconds())),t(`${a}.getMinutes(): int`,h=>BigInt(h.getUTCMinutes())),t(`${a}.getMinutes(string): int`,(h,y)=>BigInt(p(h,y).getMinutes())),t(`${a}.getMonth(): int`,h=>BigInt(h.getUTCMonth())),t(`${a}.getMonth(string): int`,(h,y)=>BigInt(p(h,y).getMonth())),t(`${a}.getSeconds(): int`,h=>BigInt(h.getUTCSeconds())),t(`${a}.getSeconds(string): int`,(h,y)=>BigInt(p(h,y).getSeconds()));let m=/(\\d*\\.?\\d*)(ns|us|\u00B5s|ms|s|m|h)/;function g(h){if(!h)throw H(\"invalid_duration\",\"Invalid duration string: ''\");let y=h[0]===\"-\";(h[0]===\"-\"||h[0]===\"+\")&&(h=h.slice(1));let v=BigInt(0);for(;;){let P=m.exec(h);if(!P)throw H(\"invalid_duration\",`Invalid duration string: ${h}`);if(P.index!==0)throw H(\"invalid_duration\",`Invalid duration string: ${h}`);h=h.slice(P[0].length);let D=Dw[P[2]],[F=\"0\",M=\"\"]=P[1].split(\".\"),V=BigInt(F)*D,N=M?BigInt(M.slice(0,13).padEnd(13,\"0\"))*D/10000000000000n:0n;if(v+=V+N,h===\"\")break}let x=v>=Ao?v/Ao:0n,$=Number(v%Ao);return y?new wr(-x,-$):new wr(x,$)}t(\"duration(string): google.protobuf.Duration\",h=>g(h)),t(\"google.protobuf.Duration.getHours(): int\",h=>h.getHours()),t(\"google.protobuf.Duration.getMinutes(): int\",h=>h.getMinutes()),t(\"google.protobuf.Duration.getSeconds(): int\",h=>h.getSeconds()),t(\"google.protobuf.Duration.getMilliseconds(): int\",h=>h.getMilliseconds()),eb(n)}function rb(n){let e=0;for(let t of n)e++;return e}var Me=class{#e;constructor(e){this.#e=e,Jt(this)}get name(){return this.#e}get[Symbol.toStringTag](){return`Type<${this.#e}>`}toString(){return`Type<${this.#e}>`}},Vn={string:new Me(\"string\"),bool:new Me(\"bool\"),int:new Me(\"int\"),uint:new Me(\"uint\"),double:new Me(\"double\"),map:new Me(\"map\"),list:new Me(\"list\"),bytes:new Me(\"bytes\"),null_type:new Me(\"null\"),type:new Me(\"type\")},ww=new Me(\"optional\"),Sc={dyn(n,e){switch(typeof n){case\"string\":case\"bigint\":case\"number\":case\"boolean\":return!0;case\"object\":switch(n&&n.constructor){case null:case void 0:case Object:case Map:case Array:case Set:return!0;default:if(e.objectTypesByConstructor.get(n.constructor))return!0}}return!!e.debugType(n)},string(n){return typeof n==\"string\"},int(n){return typeof n==\"bigint\"},double(n){return typeof n==\"number\"},bool(n){return typeof n==\"boolean\"},null(n){return n===null},bytes(n){return n instanceof Uint8Array},uint(n){return n instanceof Ne},type(n){return n instanceof Me},list(n){switch(n?.constructor){case Array:case Set:return!0;default:return!1}},map(n){switch(typeof n==\"object\"&&n?n.constructor:null){case void 0:case Object:case Map:return!0;default:return!1}},optional(n){return n instanceof Et},message(n,e){return this===e.debugType(n)}};Sc.param=Sc.dyn;var Yt=class{#e=new WeakMap;constructor({kind:e,type:t,name:r,keyType:i,valueType:o}){this.kind=e,this.type=t,this.name=r,this.keyType=i,this.valueType=o,this.unwrappedType=e===\"dyn\"&&o?o.unwrappedType:this,this.wrappedType=e===\"dyn\"?this:ub(this.unwrappedType),this.hasDynType=this.kind===\"dyn\"||this.valueType?.hasDynType||this.keyType?.hasDynType||!1,this.hasPlaceholderType=this.kind===\"param\"||this.keyType?.hasPlaceholderType||this.valueType?.hasPlaceholderType||!1,e===\"list\"?this.fieldLazy=this.#s:e===\"map\"?this.fieldLazy=this.#i:e===\"message\"?this.fieldLazy=this.#r:e===\"optional\"&&(this.fieldLazy=this.#t),this.matchesValueType=Sc[r]||Sc[e],Jt(this)}isDynOrBool(){return this.type===\"bool\"||this.kind===\"dyn\"}isEmpty(){return this.valueType&&this.valueType.kind===\"param\"}unify(e,t){let r=this;if(r===t||r.kind===\"dyn\"||t.kind===\"param\")return r;if(t.kind===\"dyn\"||r.kind===\"param\")return t;if(r.kind!==t.kind||!(r.hasPlaceholderType||t.hasPlaceholderType||r.hasDynType||t.hasDynType))return null;let i=r.valueType.unify(e,t.valueType);if(!i)return null;switch(r.kind){case\"optional\":return e.getOptionalType(i);case\"list\":return e.getListType(i);case\"map\":let o=r.keyType.unify(e,t.keyType);return o?e.getMapType(o,i):null}}templated(e,t){if(!this.hasPlaceholderType)return this;switch(this.kind){case\"dyn\":return this.valueType.templated(e,t);case\"param\":return t?.get(this.name)||this;case\"map\":return e.getMapType(this.keyType.templated(e,t),this.valueType.templated(e,t));case\"list\":return e.getListType(this.valueType.templated(e,t));case\"optional\":return e.getOptionalType(this.valueType.templated(e,t));default:return this}}toString(){return this.name}#t(e,t,r,i){if(e=e instanceof Et?e.orValue():e,e===void 0)return Ts;let o=i.debugType(e);try{return Et.of(o.fieldLazy(e,t,r,i))}catch(s){if(s instanceof Si)return Ts;throw s}}#r(e,t,r,i){let o=e?i.objectTypesByConstructor.get(e.constructor):void 0;if(!o)return;let s=o.fields?o.fields[t]:gt;if(!s)return;let a=e instanceof Map?e.get(t):e[t];if(a!==void 0){if(s.matchesValueType(a,i))return a;throw H(\"field_type_mismatch\",`Field '${t}' is not of type '${s}', got '${i.debugType(a)}'`,r)}}#i(e,t,r,i){let o=e instanceof Map?e.get(t):e&&vo(e,t)?e[t]:void 0;if(o!==void 0){if(this.valueType.matchesValueType(o,i))return o;throw H(\"field_type_mismatch\",`Field '${t}' is not of type '${this.valueType}', got '${i.debugType(o)}'`,r)}}#o(e,t){switch(e?.constructor){case Array:return e[t];case Set:{let r=0;for(let i of e)if(r++===t)return i}}}#s(e,t,r,i){if(typeof t==\"bigint\")t=Number(t);else if(typeof t!=\"number\")return;let o=this.#o(e,t);if(o===void 0){if(!e)return;throw H(\"index_out_of_bounds\",`No such key: index out of bounds, index ${t} ${t<0?\"< 0\":`>= size ${e.length||e.size}`}`,r)}if(this.valueType.matchesValueType(o,i))return o;throw H(\"list_item_type_mismatch\",`List item with index '${t}' is not of type '${this.valueType}', got '${i.debugType(o)}'`,r)}fieldLazy(){}field(e,t,r,i){let o=this.fieldLazy(e,t,r,i);if(o!==void 0)return o;throw H(\"no_such_key\",`No such key: ${t}`,r)}matchesBoth(e){return this.matches(e)&&e.matches(this)}matches(e){let t=this.unwrappedType;return e=e.unwrappedType,t===e||t.kind===\"dyn\"||e.kind===\"dyn\"||e.kind===\"param\"?!0:this.#e.get(e)??this.#e.set(e,this.#n(t,e)).get(e)}#n(e,t){switch(e.kind){case\"dyn\":case\"param\":return!0;case\"list\":return t.kind===\"list\"&&e.valueType.matches(t.valueType);case\"map\":return t.kind===\"map\"&&e.keyType.matches(t.keyType)&&e.valueType.matches(t.valueType);case\"optional\":return t.kind===\"optional\"&&e.valueType.matches(t.valueType);default:return e.name===t.name}}},Ew=\"have a .callAst property or .evaluate(checker, macro, ctx) method.\",Sw=\"have a .callAst property or .typeCheck(checker, macro, ctx) method.\";function Tw(n,e){let t=`Macro '${n}' must`;return function(i){let o=e(i);if(!o||typeof o!=\"object\")throw new Error(`${t} return an object.`);if(o.callAst)return o;if(!o.evaluate)throw new Error(`${t} ${Ew}`);if(!o.typeCheck)throw new Error(`${t} ${Sw}`);return o}}var $s=class{constructor(e,t,r,i){this.name=e,this.type=t,this.description=r??null,this.constant=i!==void 0,this.value=i,Jt(this)}},ld=class{constructor({name:e,receiverType:t,returnType:r,handler:i,description:o,params:s,async:a}){if(typeof e!=\"string\")throw new Error(\"name must be a string\");if(typeof i!=\"function\")throw new Error(\"handler must be a function\");this.name=e,this.async=ks(i,a),this.receiverType=t??null,this.returnType=r,this.description=o??null,this.params=s,this.argTypes=s.map(u=>u.type),this.macro=this.argTypes.includes(db);let c=t?`${t}.`:\"\";this.signature=`${c}${e}(${this.argTypes.join(\", \")}): ${r}`,this.handler=this.macro?Tw(this.signature,i):i,this.partitionKey=`${t?\"rcall\":\"call\"}:${e}:${s.length}`,this.hasPlaceholderType=this.returnType.hasPlaceholderType||this.receiverType?.hasPlaceholderType||this.argTypes.some(u=>u.hasPlaceholderType)||!1,Jt(this)}matchesArgs(e){return e.length===this.argTypes.length&&this.argTypes.every((t,r)=>t.matches(e[r]))?this:null}},$i=class{constructor({op:e,leftType:t,rightType:r,handler:i,returnType:o,async:s}){this.operator=e,this.leftType=t,this.rightType=r||null,this.handler=i,this.async=ks(i,s),this.returnType=o,r?this.signature=`${t} ${e} ${r}: ${o}`:this.signature=`${e}${t}: ${o}`,this.hasPlaceholderType=this.leftType.hasPlaceholderType||this.rightType?.hasPlaceholderType||!1,Jt(this)}equals(e){return this.operator===e.operator&&this.leftType===e.leftType&&this.rightType===e.rightType}};function hd(n){return new Yt({kind:\"list\",name:`list<${n}>`,type:\"list\",valueType:n})}function Un(n){return new Yt({kind:\"primitive\",name:n,type:n})}function kw(n){return new Yt({kind:\"message\",name:n,type:n})}function ub(n){let e=n?`dyn<${n}>`:\"dyn\";return new Yt({kind:\"dyn\",name:e,type:e,valueType:n})}function lb(n){let e=`optional<${n}>`;return new Yt({kind:\"optional\",name:e,type:\"optional\",valueType:n})}function md(n,e){return new Yt({kind:\"map\",name:`map<${n}, ${e}>`,type:\"map\",keyType:n,valueType:e})}function $w(n){return new Yt({kind:\"param\",name:n,type:n})}var gt=ub(),db=Un(\"ast\"),ob=hd(gt),sb=md(gt,gt),ye={string:Un(\"string\"),bool:Un(\"bool\"),int:Un(\"int\"),uint:Un(\"uint\"),double:Un(\"double\"),bytes:Un(\"bytes\"),dyn:gt,null:Un(\"null\"),type:Un(\"type\"),optional:lb(gt),list:ob,\"list<dyn>\":ob,map:sb,\"map<dyn, dyn>\":sb};for(let n of[ye.string,ye.double,ye.int]){let e=hd(n),t=md(ye.string,n);ye[e.name]=e,ye[t.name]=t}Object.freeze(ye);var dd=class{returnType=null;async=!1;macro=!1;#e=null;#t=null;declarations=[];constructor(e){this.registry=e}[Symbol.iterator](){return this.declarations[Symbol.iterator]()}add(e){this.returnType=(this.returnType||e.returnType).unify(this.registry,e.returnType)||gt,e.macro&&(this.macro=e),e.async&&!this.async&&(this.async=!0),this.declarations.push(e),this.#e?.clear(),this.#t?.clear()}findFunction(e,t=null){for(let r=0;r<this.declarations.length;r++){let i=this.#a(this.declarations[r],e,t);if(i)return i}return null}findUnaryOverload(e){let t=(this.#e??=new Map).get(e);if(t!==void 0)return t;let r=!1;for(let i of this.declarations)if(i.leftType===e){r=i;break}return this.#e.set(e,r),r}findBinaryOverload(e,t){return e.kind===\"dyn\"&&e.valueType?t=t.wrappedType:t.kind===\"dyn\"&&t.valueType&&(e=e.wrappedType),(this.#e??=new Map).get(e)?.get(t)??this.#r(this.#e,e,t,this.#i(e,t))}checkBinaryOverload(e,t){return(this.#t??=new Map).get(e)?.get(t)??this.#r(this.#t,e,t,this.#o(e,t))}#r(e,t,r,i){return(e.get(t)||e.set(t,new Map).get(t)).set(r,i),i}#i(e,t){let r=this.#s(e,t);if(r.length===0)return!1;if(r.length===1)return r[0];throw new Error(`Operator overload '${r[0].signature}' overlaps with '${r[1].signature}'.`)}#o(e,t){let r=this.#s(e,t);if(r.length===0)return!1;let i=r[0].returnType;for(let o=1;o<r.length;o++)i=i.unify(this.registry,r[o].returnType)||gt;return i}#s(e,t){let r=[];for(let i of this.declarations){if(i.leftType===e&&i.rightType===t)return[i];let o=this.#n(i,e,t);o&&r.push(o)}if(r.length===0){let i=this.declarations[0]?.operator;if((i===\"==\"||i===\"!=\")&&e.kind===\"dyn\")return Rw[i]}return r}#n(e,t,r){let i=e.hasPlaceholderType?new Map:null,o=this.#u(e.leftType,t,i);if(!o)return;let s=this.#u(e.rightType,r,i);if(s)return(e.operator===\"==\"||e.operator===\"!=\")&&e.leftType.kind===\"dyn\"&&e.leftType.valueType&&t.kind!==\"dyn\"&&r.kind!==\"dyn\"?!1:e.hasPlaceholderType?{async:e.async,signature:e.signature,handler:e.handler,leftType:o,rightType:s,returnType:e.returnType.templated(this.registry,i)}:e}#a(e,t,r){if(e.hasPlaceholderType)return this.#d(e,t,r);if(!(r&&e.receiverType&&!r.matches(e.receiverType)))return e.matchesArgs(t)}#d(e,t,r){let i=new Map;if(r&&e.receiverType&&!this.#u(e.receiverType,r,i))return null;for(let o=0;o<t.length;o++)if(!this.#u(e.argTypes[o],t[o],i))return null;return{async:e.async,handler:e.handler,signature:e.signature,returnType:e.returnType.templated(this.registry,i)}}#u(e,t,r){if(!e.hasPlaceholderType)return t.matches(e)?t:null;let i=t.kind===\"dyn\";return this.#l(e,t,r,i)&&(i||t.matches(e.templated(this.registry,r)))?t:null}#l(e,t,r,i=!1){if(!e.hasPlaceholderType)return!0;if(!t)return!1;let o=i||t.kind===\"dyn\";switch(t=t.unwrappedType,e.kind){case\"param\":{let s=o?gt:t,a=r.get(e.name);return a?a.kind===\"dyn\"||s.kind===\"dyn\"?!0:a.matchesBoth(s):r.set(e.name,s)&&!0}case\"list\":return t.name===\"dyn\"&&(t=e),t.kind!==\"list\"?!1:this.#l(e.valueType,t.valueType,r,o);case\"map\":return t.name===\"dyn\"&&(t=e),t.kind!==\"map\"?!1:this.#l(e.keyType,t.keyType,r,o)&&this.#l(e.valueType,t.valueType,r,o);case\"optional\":return t.name===\"dyn\"&&(t=e),t.kind!==\"optional\"?!1:this.#l(e.valueType,t.valueType,r,o)}return!0}};function ab(n){let e=[],t=\"\",r=0;for(let i of n){if(i===\"<\")r++;else if(i===\">\")r--;else if(i===\",\"&&r===0){e.push(t.trim()),t=\"\";continue}t+=i}return t&&e.push(t.trim()),e}var fb=[[Ne,\"uint\",Vn.uint,ye.uint],[Me,\"type\",Vn.type,ye.type],[Et,\"optional\",ww,ye.optional],[Uint8Array,\"bytes\",Vn.bytes,ye.bytes],...typeof Buffer<\"u\"?[[Buffer,\"bytes\",Vn.bytes,ye.bytes]]:[]].map(([n,e,t,r])=>Object.freeze({name:e,typeType:t,type:r,ctor:n})),Iw=fb.map(n=>[n.name,n]),Fw=fb.map(n=>[n.ctor,n]),wc=n=>new Error(`Invalid variable declaration: ${n}`),Ec=n=>new Error(`Invalid type declaration: ${n}`),Rw={\"==\":[{handler:(n,e)=>n===e,returnType:ye.bool}],\"!=\":[{handler:(n,e)=>n!==e,returnType:ye.bool}]},fd=class n{#e=null;#t;#r=!0;#i=null;#o=null;#s=null;#n=null;#a=null;#d=null;#u=null;#l=null;#f=!1;constructor(e={}){this.enableOptionalTypes=e.enableOptionalTypes??!1,this.unlistedVariablesAreDyn=e.unlistedVariablesAreDyn??!1;let t=e.parent instanceof n?e.parent:null;if(t){this.#e=t;let r=t;for(;r&&!r.#i;)r=r.#e;let i=t;for(;i&&!i.#o;)i=i.#e;this.#s=t.#s,this.#n=t.#n,this.#l={operators:r.#i,functions:i.#o},this.objectTypes=new Map(t.objectTypes),this.objectTypesByConstructor=new Map(t.objectTypesByConstructor),this.variables=t.variables,this.#r=!1,this.#t=t.#t,this.#a=t.#a,this.#d=t.#d,this.#u=t.#u,(this.enableOptionalTypes!==t.enableOptionalTypes||this.unlistedVariablesAreDyn!==t.unlistedVariablesAreDyn)&&Qy(this,this.enableOptionalTypes)}else{this.#i=[],this.#o=[],this.objectTypes=new Map(Iw),this.objectTypesByConstructor=new Map(Fw),this.#t=new Map(tb(ye)),this.#a=new Map,this.#d=new Map,this.#u=new Map,this.variables=new Map,this.variables.dyn=this.unlistedVariablesAreDyn;for(let r in Vn)this.registerConstant(r,\"type\",Vn[r])}}#v(){this.#r||(this.variables=new Map(this.variables),this.variables.dyn=this.unlistedVariablesAreDyn,this.#r=!0)}deleteVariable(e){this.#v(),this.variables.delete(e)}#g(e){this.#i||(this.#s=null),this.operatorCandidates(e.operator).add(e),this.#i.push(e)}#A(e){this.#o||(this.#n=null),this.#y(e.partitionKey).add(e),this.#o.push(e)}#p(e,t){return e.get(t)||e.set(t,new dd(this)).get(t)}#C(){return this.#i?this.#i:this.#i=[...this.#l.operators]}#_(){return this.#o?this.#o:this.#o=[...this.#l.functions]}operatorCandidates(e){if(this.#s)return this.#p(this.#s,e);let t=this.#s=new Map;for(let r of this.#C())this.#p(t,r.operator).add(r);return this.#p(t,e)}functionCandidates(e,t,r){return this.#y(`${e?\"rcall\":\"call\"}:${t}:${r}`)}#y(e){if(this.#n)return this.#p(this.#n,e);let t=this.#n=new Map;for(let r of this.#_())this.#p(t,r.partitionKey).add(r);return this.#p(t,e)}registerVariable(e,t,r){if(this.#f)throw new Error(\"Cannot modify frozen registry\");let i=r?.description,o;if(typeof e==\"string\"&&typeof t==\"object\"&&!(t instanceof Yt)?(i=t.description,o=t.value,t.schema?t=this.registerType({name:`$${e}`,schema:t.schema}).type:t=t.type):typeof e==\"object\"&&(e.schema?t=this.registerType({name:`$${e.name}`,schema:e.schema}).type:t=e.type,i=e.description,o=e.value,e=e.name),typeof e!=\"string\"||!e)throw wc(\"name must be a string\");if(_o.has(e))throw wc(`'${e}' is a reserved name`);if(this.variables.get(e)!==void 0)throw wc(`'${e}' is already registered`);if(typeof t==\"string\")t=this.getType(t);else if(!(t instanceof Yt))throw wc(\"type is required\");return this.#v(),this.variables.set(e,new $s(e,t,i,o)),this}#D(e,t){let r=Object.create(null);for(let i of Ze(t)){let o=t[i];if(typeof o==\"object\"&&o)r[i]=this.registerType({name:`${e}.${i}`,schema:o}).type.name;else if(typeof o==\"string\")r[i]=o;else throw new Error(`Invalid field definition for '${e}.${i}'`)}return r}registerConstant(e,t,r){return typeof e==\"object\"?this.registerVariable(e):this.registerVariable({name:e,type:t,value:r}),this}getType(e){return this.#c(e,!0)}getListType(e){return this.#a.get(e)||this.#a.set(e,this.#c(`list<${e}>`,!0)).get(e)}getMapType(e,t){return this.#d.get(e)?.get(t)||(this.#d.get(e)||this.#d.set(e,new Map).get(e)).set(t,this.#c(`map<${e}, ${t}>`,!0)).get(t)}getOptionalType(e){return this.#u.get(e)||this.#u.set(e,this.#c(`optional<${e}>`,!0)).get(e)}assertType(e,t,r){try{return this.#c(e,!0)}catch(i){throw i.message=`Invalid ${t} '${i.unknownType||e}' in '${r}'`,i}}getFunctionType(e){if(e===\"ast\")return db;let t=this.#c(e,!0);if(t.kind===\"dyn\"&&t.valueType)throw new Error(`type '${t.name}' is not supported`);return t}registerType(e,t){if(this.#f)throw new Error(\"Cannot modify frozen registry\");if(typeof e==\"object\"&&(t=e,e=t.fullName||t.name||t.ctor?.name),typeof e==\"string\"&&e[0]===\".\"&&(e=e.slice(1)),typeof e!=\"string\"||e.length<2||_o.has(e))throw Ec(`name '${e}' is not valid`);if(this.objectTypes.has(e))throw Ec(`type '${e}' already registered`);let r=this.#c(e,!1);if(r.kind!==\"message\")throw Ec(`type '${e}' is not valid`);let i={name:e,typeType:new Me(e),type:r,ctor:typeof t==\"function\"?t:t?.ctor,convert:typeof t==\"function\"?void 0:t?.convert,fields:typeof t?.schema==\"object\"?this.#x(e,this.#D(e,t.schema)):this.#x(e,typeof t==\"function\"?void 0:t?.fields)};if(typeof i.ctor!=\"function\"){if(!i.fields)throw Ec(`type '${e}' requires a constructor or fields`);Object.assign(i,this.#S(e,i.fields))}return this.objectTypes.set(e,Object.freeze(i)),this.objectTypesByConstructor.set(i.ctor,i),this.registerFunctionOverload(`type(${e}): type`,()=>i.typeType,{async:!1}),i}#c(e,t=!0){let r=this.#t.get(e);if(r)return r;if(typeof e!=\"string\"||!e.length)throw new Error(\"Invalid type: must be a string\");if(r=e.match(/^[A-Z]$/),r)return this.#h($w,e,e);if(r=e.match(/^(dyn|list|map|optional)<(.+)>$/),!r){if(t){let s=new Error(`Unknown type: ${e}`);throw s.unknownType=e,s}return this.#h(kw,e,e)}let i=r[1],o=r[2].trim();switch(i){case\"dyn\":{let s=this.#c(o,t).wrappedType;return this.#t.set(s.name,s),s}case\"list\":{let s=this.#c(o,t);return this.#h(hd,`list<${s}>`,s)}case\"map\":{let s=ab(o);if(s.length!==2)throw new Error(`Invalid map type: ${e}`);let a=this.#c(s[0],t),c=this.#c(s[1],t);return this.#h(md,`map<${a}, ${c}>`,a,c)}case\"optional\":{let s=this.#c(o,t);return this.#h(lb,`optional<${s}>`,s)}}}#h(e,t,...r){return this.#t.get(t)||this.#t.set(t,e(...r)).get(t)}findMacro(e,t,r){return this.functionCandidates(t,e,r).macro}findUnaryOverload(e,t){return this.operatorCandidates(e).findUnaryOverload(t)}findBinaryOverload(e,t,r){return this.operatorCandidates(e).findBinaryOverload(t,r)}#w(e){return typeof e==\"string\"?{type:e}:e.id?Ow(e):e}#E(e,t,r,i=!1){try{let o=this.#w(t[r]);if(typeof o?.type!=\"string\")throw new Error(\"unsupported declaration\");return this.#c(o.type,i)}catch(o){throw o.message=`Field '${r}' in type '${e}' has unsupported declaration: ${JSON.stringify(t[r])}`,o}}#x(e,t){if(!t)return;let r=Object.create(null);for(let i of Ze(t))r[i]=this.#E(e,t,i);return r}#S(e,t){let r=Ze(t),i=Object.create(null);for(let s of r){let a=t[s],c=a.kind===\"message\"&&this.objectTypes.get(a.name);c===!1?i[s]=!1:i[s]=c.convert?c:!1}let o={[e]:class extends Map{#m;constructor(s){super(),this.#m=s}[Symbol.iterator](){if(this.size!==r.length)for(let s of r)this.get(s);return super[Symbol.iterator]()}get(s){let a=super.get(s);if(a!==void 0||this.has(s))return a;let c=i[s];if(c!==void 0){if(a=this.#m instanceof Map?this.#m.get(s):this.#m?.[s],c&&a&&typeof a==\"object\")switch(a.constructor){case void 0:case Object:case Map:a=c.convert(a)}return super.set(s,a),a}}}}[e];return{ctor:o,convert(s){if(s)return s.constructor===o?s:new o(s)}}}clone(e){return this.#f=!0,new n({parent:this,unlistedVariablesAreDyn:e.unlistedVariablesAreDyn,enableOptionalTypes:e.enableOptionalTypes})}getDefinitions(){let e=[],t=[];for(let[,r]of this.variables)r&&e.push({name:r.name,description:r.description||null,type:r.type.name});for(let r of this.#_())t.push({signature:r.signature,name:r.name,description:r.description,receiverType:r.receiverType?r.receiverType.name:null,returnType:r.returnType.name,params:r.params.map(i=>({name:i.name,type:i.type.name,description:i.description}))});return{variables:e,functions:t}}#T(e){if(typeof e!=\"string\")throw new Error(\"Invalid signature: must be a string\");let t=e.match(/^(?:([a-zA-Z0-9.<>]+)\\.)?(\\w+)\\(([^)]*)\\):(.*)$/);if(!t)throw new Error(`Invalid signature: ${e}`);let r=t[4].trim();if(!r)throw new Error(`Invalid signature: ${e}`);return{receiverType:t[1]||null,name:t[2],argTypes:ab(t[3]),returnType:r}}#k(e,t){return e.name!==t.name||e.argTypes.length!==t.argTypes.length||(e.receiverType||t.receiverType)&&(!e.receiverType||!t.receiverType)?!1:!(e.receiverType!==t.receiverType&&e.receiverType!==gt&&t.receiverType!==gt)&&(t.macro||e.macro||t.argTypes.every((i,o)=>{let s=e.argTypes[o];return i===s||i===gt||s===gt}))}#$(e){for(let t of this.#y(e.partitionKey))if(this.#k(t,e))throw new Error(`Function signature '${e.signature}' overlaps with existing overload '${t.signature}'.`)}#I(e,t,r){if(!r)return{type:this.getFunctionType(t),name:`arg${e}`,description:null};let i=r.type||t;if(!i)throw new Error(`params[${e}].type is required`);if(t&&i!==t)throw new Error(`params[${e}].type not equal to signature type`);return{name:r.name||`arg${e}`,type:this.getFunctionType(i),description:r.description??null}}registerFunctionOverload(e,t,r){if(this.#f)throw new Error(\"Cannot modify frozen registry\");typeof e==\"object\"?r=e:typeof t==\"object\"?r=t:r||(r={});let i=typeof e==\"string\"?e:r.signature??void 0,o=i!==void 0?this.#T(i):void 0,s=o?.name||r.name,a=o?.receiverType||r.receiverType,c=o?.argTypes,u=o?.returnType||r.returnType,l=r.params;t=typeof t==\"function\"?t:r.handler;let p;try{if(!s)throw new Error(\"signature or name are required\");if(!u)throw new Error(\"must have a returnType\");if(l){if(c&&l.length!==c.length)throw new Error(\"mismatched length in params and args in signature\")}else if(!c)throw new Error(\"signature or params are required\");p=new ld({name:s,async:r?.async,receiverType:a?this.getType(a):null,returnType:this.getType(u),handler:t,description:r.description,params:(c||l).map((f,m)=>this.#I(m,c?.[m],l?.[m]))})}catch(f){throw typeof i==\"string\"?f.message=`Invalid function declaration '${i}': ${f.message}`:s?f.message=`Invalid function declaration '${s}': ${f.message}`:f.message=`Invalid function declaration: ${f.message}`,f}this.#$(p),this.#A(p)}registerOperatorOverload(e,t,r){let i=e.match(/^([-!])([\\w.<>]+)(?::\\s*([\\w.<>]+))?$/);if(i){let[,l,p,f]=i;return this.unaryOverload(l,p,t,f,r?.async)}let o=e.match(/^([\\w.<>]+) ([-+*%/]|==|!=|<|<=|>|>=|in) ([\\w.<>]+)(?::\\s*([\\w.<>]+))?$/);if(!o)throw new Error(`Operator overload invalid: ${e}`);let[,s,a,c,u]=o;return this.binaryOverload(s,a,c,t,u)}unaryOverload(e,t,r,i,o){if(this.#f)throw new Error(\"Cannot modify frozen registry\");let s=this.assertType(t,\"type\",`${e}${t}`),a=this.assertType(i||t,\"return type\",`${e}${t}: ${i||t}`),c=new $i({op:`${e}_`,leftType:s,returnType:a,handler:r,async:o});this.#g(this.#b(c))}#F(e){for(let t of this.operatorCandidates(e.operator))if(e.equals(t))return!0;return!1}#b(e){if(!this.#F(e))return e;throw new Error(`Operator overload already registered: ${e.signature}`)}binaryOverload(e,t,r,i,o,s){if(this.#f)throw new Error(\"Cannot modify frozen registry\");o??=cb.has(t)?\"bool\":e;let a=`${e} ${t} ${r}: ${o}`,c=this.assertType(e,\"left type\",a),u=this.assertType(r,\"right type\",a),l=this.assertType(o,\"return type\",a);if(c.kind===\"dyn\"&&c.valueType?u=u.wrappedType:u.kind===\"dyn\"&&u.valueType&&(c=c.wrappedType),cb.has(t)&&l.type!==\"bool\")throw new Error(`Comparison operator '${t}' must return 'bool', got '${l.type}'`);let p=new $i({op:t,leftType:c,rightType:u,returnType:l,handler:i,async:s});if(p.hasPlaceholderType&&!(u.hasPlaceholderType&&c.hasPlaceholderType))throw new Error(`Operator overload with placeholders must use them in both left and right types: ${a}`);if(this.#b(p),t===\"==\"){let f=[new $i({op:\"!=\",leftType:c,rightType:u,handler(m,g,h,y){return!i(m,g,h,y)},returnType:l,async:s})];c!==u&&f.push(new $i({op:\"==\",leftType:u,rightType:c,handler(m,g,h,y){return i(g,m,h,y)},returnType:l,async:s}),new $i({op:\"!=\",leftType:u,rightType:c,handler(m,g,h,y){return!i(g,m,h,y)},returnType:l,async:s}));for(let m of f)this.#b(m);for(let m of f)this.#g(m)}this.#g(p)}},cb=new Set([\"<\",\"<=\",\">\",\">=\",\"==\",\"!=\",\"in\"]);function pb(n){return new fd(n)}var Co=class{#e;#t;#r;#i;constructor(e,t){if(this.#e=e.variables,t!=null){if(typeof t!=\"object\")throw H(\"invalid_context\",\"Context must be an object\");t instanceof Map?this.#r=t:this.#t=t}}getValue(e){return this.#i?.get(e)||(this.#t?this.#t[e]:this.#r?.get(e))}getVariable(e){return this.#e.get(e)??(this.#e.dyn&&!_o.has(e)?new $s(e,gt):void 0)}getCheckedValue(e,t){let r=this.getValue(t.args);if(r===void 0)throw e.createError(\"unknown_variable\",`Unknown variable: ${t.args}`,t);if(t.checkedType.matchesValueType(r,e))return r;let i=t.checkedType,o=e.debugType(r);if(i.kind===\"message\"&&o.kind===\"map\"){let s=e.objectTypes.get(i.name)?.convert?.(r);if(s)return(this.#i??=new Map).set(t.args,s),s}throw e.createError(\"variable_type_mismatch\",`Variable '${t.args}' is not of type '${i}', got '${o}'`,t)}forkWithVariable(e,t){return new pd(this,e,t)}},pd=class n{#e;accuType;accuValue;iterValue;constructor(e,t,r){this.#e=e,this.iterVar=t,this.iterType=r}forkWithVariable(e,t){return new n(this,e,t)}reuse(e){if(!this.async)return this.#e=e,this;let t=new n(e,this.iterVar,this.iterType);return t.accuType=this.accuType,t}setIterValue(e,t){if(this.iterType.matchesValueType(e,t))return this.iterValue=e,this;let r=this.iterType,i=t.debugType(e);if(r.kind===\"message\"&&i.kind===\"map\"){let o=t.objectTypes.get(r.name)?.convert?.(e);if(o)return this.iterValue=o,this}throw t.createError(\"variable_type_mismatch\",`Variable '${this.iterVar}' is not of type '${r}', got '${i}'`)}setAccuType(e){return this.accuType=e,this}setAccuValue(e){return this.accuValue=e,this}getValue(e){return this.iterVar===e?this.iterValue:this.#e.getValue(e)}getCheckedValue(e,t){return this.iterVar===t.args?this.iterValue:this.#e.getCheckedValue(e,t)}getVariable(e){return this.iterVar===e?new $s(e,this.iterType):this.#e.getVariable(e)}};function Ow(n){let e;if(n.map){let t=ud(n.keyType,n.resolvedKeyType),r=ud(n.type,n.resolvedType);e=`map<${t}, ${r}>`}else e=ud(n.type,n.resolvedType);return{type:n.repeated?`list<${e}>`:e}}function ud(n,e){switch(n){case\"string\":return\"string\";case\"bytes\":return\"bytes\";case\"bool\":return\"bool\";case\"double\":case\"float\":case\"int32\":case\"int64\":case\"sint32\":case\"sint64\":case\"sfixed32\":case\"sfixed64\":case\"uint32\":case\"uint64\":case\"fixed32\":case\"fixed64\":return\"double\";default:switch(e?.constructor.name){case\"Type\":return e.fullName.slice(1);case\"Enum\":return\"int\"}return n?.includes(\".\")?n:\"dyn\"}}var Db=ye.dyn,wo=class{dynType=ye.dyn;optionalType=ye.optional;stringType=ye.string;intType=ye.int;doubleType=ye.double;boolType=ye.bool;nullType=ye.null;listType=ye.list;mapType=ye.map;constructor(e){this.opts=e.opts,this.registry=e.registry,this.objectTypes=this.registry.objectTypes,this.objectTypesByConstructor=this.registry.objectTypesByConstructor}getType(e){return this.registry.getType(e)}debugType(e){switch(typeof e){case\"string\":return this.stringType;case\"bigint\":return this.intType;case\"number\":return this.doubleType;case\"boolean\":return this.boolType;case\"object\":if(e===null)return this.nullType;switch(e.constructor){case void 0:case Object:case Map:return this.mapType;case Array:case Set:return this.listType;default:return this.objectTypesByConstructor.get(e.constructor)?.type||yd(this,e.constructor?.name||typeof e)}default:yd(this,typeof e)}}};function yd(n,e){throw n.createError(\"unsupported_type\",`Unsupported type: ${e}`)}var hb=n=>Array.isArray(n)?n.some(e=>e.maybeAsync):!1;function vn(n,e,t){return e===!0||e&&(e?.maybeAsync||hb(e))?Nw(t):n===!0||n&&(n?.maybeAsync||hb(n))?Mw(t):t}function Nw(n){return n.__asyncBoth??=function(t,r,i,o){return t instanceof Promise||r instanceof Promise?r instanceof Promise?t instanceof Promise?Promise.all([t,r]).then(s=>n(s[0],s[1],i,o)):r.then(s=>n(t,s,i,o)):t.then(s=>n(s,r,i,o)):n(t,r,i,o)}}function Mw(n){return n.__asyncFirst??=function(t,r,i,o){return t instanceof Promise?t.then(s=>n(s,r,i,o)):n(t,r,i,o)}}function mb(n,e,t){e.right=e.args[1];let r=n.check(e.left=e.args[0],t);return e.op===\"[]\"&&n.check(e.right,t),e.handle=vn(e.left,e.op===\"[]\"?e.right:!1,r!==Db?Xw:eE),r.kind!==\"optional\"?n.checkAccessOnType(e,t,r):n.registry.getOptionalType(n.checkAccessOnType(e,t,r.valueType,!0))}function gb(n,e,t){e.right=e.args[1];let r=n.check(e.left=e.args[0],t);e.op===\"[?]\"&&n.check(e.right,t),e.handle=vn(e.left,e.op===\"[?]\"?e.right:!1,Yw);let i=r.kind===\"optional\"?r.valueType:r;return n.registry.getOptionalType(n.checkAccessOnType(e,t,i,!0))}var jw={heterogeneous_list_element:\"List elements must have the same type,\",heterogeneous_map_key:\"Map key uses wrong type,\",heterogeneous_map_value:\"Map value uses wrong type,\"};function yb(n,e,t,r,i){let o=n.check(r,e);if(o===t||t.isEmpty())return o;if(o.isEmpty())return t;throw n.createError(i,`${jw[i]} expected type '${n.formatType(t)}' but found '${n.formatType(o)}'`,r)}function bb(n,e,t,r){return t.unify(n.registry,n.check(r,e))||Db}function Pw(n,e,t){let r=n.debugRuntimeType(e);return n.createError(\"invalid_condition_type\",`${t.meta.label||\"Ternary condition must be bool\"}, got '${r}'`,t)}function Lw(n,e,t,r){if(n===!0)return e.run(t.left,r);if(n===!1)return e.run(t.right,r);throw Pw(e,n,t.condition)}function vd(n,e,t){let r=n.debugRuntimeType(e);return n.createError(\"invalid_logical_operand\",`Logical operator requires bool operands, got '${r}'`,t)}function wb(n,e,t){return e instanceof Error?e:vd(n,e,t)}function Do(n,e,t,r,i){if(i===n)return n;if(i===!n){if(r===i)return i;throw wb(e,r,t.left)}if(i instanceof Promise)return i.then(o=>Bw(n,e,t,r,o));throw vd(e,i,t.left)}function Bw(n,e,t,r,i){if(i===n)return n;if(typeof i!=\"boolean\")throw vd(e,i,t.right);if(typeof r!=\"boolean\")throw wb(e,r,t.left);return!n}function vb(n,e,t){let r=n.check(e.left=e.args[0],t),i=n.check(e.right=e.args[1],t);if(!r.isDynOrBool())throw n.createError(\"invalid_logical_operand\",`Logical operator requires bool operands, got '${n.formatType(r)}'`,e);if(!i.isDynOrBool())throw n.createError(\"invalid_logical_operand\",`Logical operator requires bool operands, got '${n.formatType(i)}'`,e);return n.boolType}function _b(n,e,t){let r=e.op,i=n.check(e.args,t);if(e.candidates=n.registry.operatorCandidates(r),i.kind===\"dyn\")return e.handle=vn(e.args,!1,Vw),e.candidates.returnType;let o=e.candidates.findUnaryOverload(i);if(!o)throw n.createError(\"no_such_overload\",`no such overload: ${r[0]}${n.formatType(i)}`,e);return e.handle=vn(e.args,!1,o.handler),o.returnType}function Vw(n,e,t){let r=t.debugRuntimeType(n,e.args.checkedType),i=e.candidates.findUnaryOverload(r);if(i)return i.handler(n);throw t.createError(\"no_such_overload\",`no such overload: ${e.op[0]}${r}`,e)}function xb(n,e,t){return e.handle(n.run(e.args,t),e,n)}function Uw(n,e,t){let r=e.op,i=n.check(e.left=e.args[0],t),o=n.check(e.right=e.args[1],t);e.candidates=n.registry.operatorCandidates(r);let s=i.hasDynType||o.hasDynType?void 0:e.candidates.findBinaryOverload(i,o);if(e.handle=vn(e.left,e.right,s?.handler||zw),s)return s.returnType;let a=e.candidates.checkBinaryOverload(i,o);if(i.hasDynType||(e.leftStaticType=i),o.hasDynType||(e.rightStaticType=o),a)return a;throw n.createError(\"no_such_overload\",`no such overload: ${n.formatType(i)} ${r} ${n.formatType(o)}`,e)}function bd(n,e,t){return e.handle(n.run(e.left,t),n.run(e.right,t),e,n)}function Ab(n,e,t){return e.handle(n.run(e.left,t),e.right,e,n)}function zw(n,e,t,r){let i=t.leftStaticType||r.debugTypeDeep(n).wrappedType,o=t.rightStaticType||r.debugTypeDeep(e).wrappedType,s=t.candidates.findBinaryOverload(i,o);if(s)return s.handler(n,e,t,r);throw r.createError(\"no_such_overload\",`no such overload: ${i} ${t.op} ${o}`,t)}function Tc(n,e,t,r){try{let i=n.apply(e,t);return i instanceof Promise?i.catch(o=>{throw Ss(o,r)}):i}catch(i){throw Ss(i,r)}}function qw(n,e,t){let r=e.args[1],i=e.argTypes,o=r.length;for(;o--;)i[o]=t.debugRuntimeType(n[o],r[o].checkedType);let s=e.candidates.findFunction(i);if(s)return Tc(s.handler,t,n,e);throw t.createError(\"no_matching_overload\",`found no matching overload for '${e.args[0]}(${i.map(a=>a.unwrappedType).join(\", \")})'`,e)}function Zw(n,e,t){let[,r,i]=t.args,o=t.argTypes;for(let c=0;c<o.length;c++)o[c]=e.debugRuntimeType(n[c+1],i[c].checkedType);let s=e.debugRuntimeType(n[0],r.checkedType),a=t.candidates.findFunction(o,s);if(a)return Tc(a.handler,e,n,t);throw e.createError(\"no_matching_overload\",`found no matching overload for '${s.type}.${t.args[0]}(${o.map(c=>c.unwrappedType).join(\", \")})'`,t)}function gd(n,e,t,r=e.length){if(r===0)return[];let i,o=new Array(r);for(;r--;)(o[r]=n.run(e[r],t))instanceof Promise&&(i??=!0);return i?Promise.all(o):o}function Cb(n){let e={};for(let t=0;t<n.length;t++){let[r,i]=n[t];r===\"__proto__\"||r===\"constructor\"||r===\"prototype\"||(e[r]=i)}return e}function Ww(n,e,t){let r=n.check(e,t);if(r.kind===\"dyn\")return r;if(r.kind===\"list\")return r.valueType;if(r.kind===\"map\")return r.keyType;throw n.createError(\"invalid_comprehension_range\",`Expression of type '${n.formatType(r)}' cannot be range of a comprehension (must be list, map, or dynamic).`,e)}function Eb(n,e,t){if(t instanceof Set)return[...t];if(t instanceof Map)return[...t.keys()];if(t&&typeof t==\"object\")return Ze(t);throw n.createError(\"invalid_comprehension_range\",`Expression of type '${n.debugType(t)}' cannot be range of a comprehension (must be list, map, or dynamic).`,e.iterable)}function Hw(n,e,t,r){Ti(n)||(n=Eb(t,e,n));let i=t.run(e.init,r=e.iterCtx.reuse(r));return r.accuValue=i,r===e.iterCtx?Jw(t,r,e,n,i,0):Tb(t,r,e,n,i,0)}function Gw(n,e,t,r){Ti(n)||(n=Eb(t,e,n));let i=t.run(e.init,r=e.iterCtx.reuse(r));return r.accuValue=i,r===e.iterCtx?Kw(t,r,e,n,i,0):Sb(t,r,e,n,i,0)}function Kw(n,e,t,r,i,o){let s=t.condition,a=t.step,c=r.length;for(;o<c&&!(s&&!s(i));)if(i=n.run(a,e.setIterValue(r[o++],n)),i instanceof Promise)return Sb(n,e,t,r,i,o);return t.result(i)}async function Sb(n,e,t,r,i,o){e===t.iterCtx&&(e.async=!0);let s=t.condition,a=t.step,c=r.length;for(i=await i;o<c;){if(s&&!s(i))return t.result(i);i=n.run(a,e.setIterValue(r[o++],n)),i instanceof Promise&&(i=await i)}return t.result(i)}function Jw(n,e,t,r,i,o,s,a){let c=t.condition,u=t.step,l=r.length;for(;o<l;){if(!c(i))return t.result(i);if(a=n.tryEval(u,e.setIterValue(r[o++],n)),a instanceof Promise)return Tb(n,e,t,r,i,o,s,a);a instanceof Error&&(s??=a)||(i=a)}if(s&&c(i))throw s;return t.result(i)}async function Tb(n,e,t,r,i,o,s,a){e===t.iterCtx&&(e.async=!0);let c=t.condition,u=t.step,l=r.length;for(a=await a,a instanceof Error?s??=a:i=a;o<l;){if(!c(i))return t.result(i);a=n.tryEval(u,e.setIterValue(r[o++],n)),a instanceof Promise&&(a=await a),!(a instanceof Error&&(s??=a))&&(i=a)}if(s&&c(i))throw s;return t.result(i)}function Yw(n,e,t,r){return r.optionalType.field(n,e,t,r)}function Xw(n,e,t,r){return t.left.checkedType.field(n,e,t,r)}var Qw=Object.create(null);function eE(n,e,t,r){switch(n?.constructor){case void 0:case Object:{let o=vo(n||Qw,e)?n[e]:void 0;if(o!==void 0)return r.debugType(o),o;break}case Map:{let o=n.get(e);if(o!==void 0)return r.debugType(o),o;break}case Array:case Set:return r.listType.field(n,e,t,r);default:let i=r.objectTypesByConstructor.get(n.constructor);if(i)return i.type.field(n,e,t,r);typeof n==\"object\"&&yd(r,n.constructor.name)}throw r.createError(\"no_such_key\",`No such key: ${e}`,t)}var tE=()=>[],nE=()=>({}),j={value:{check(n,e){return n.debugType(e.args)},evaluate(n,e){return e.args}},id:{check(n,e,t){let r=t.getVariable(e.args);if(!r)throw n.createError(\"unknown_variable\",`Unknown variable: ${e.args}`,e);if(r.constant){let i=e.clone(j.value,r.value);return e.setMeta(\"alternate\",i),n.check(i,t)}return r.type},evaluate(n,e,t){return t.getCheckedValue(n,e)}},\".\":{alias:\"fieldAccess\",check:mb,evaluate:Ab},\".?\":{alias:\"optionalFieldAccess\",check:gb,evaluate:Ab},\"[]\":{alias:\"bracketAccess\",check:mb,evaluate:bd},\"[?]\":{alias:\"optionalBracketAccess\",check:gb,evaluate:bd},call:{check(n,e,t){let[r,i]=e.args,o=e.candidates=n.registry.functionCandidates(!1,r,i.length),s=e.argTypes=i.map(u=>n.check(u,t)),a=o.findFunction(s);if(!a)throw n.createError(\"no_matching_overload\",`found no matching overload for '${r}(${n.formatTypeList(s)})'`,e);let c=s.some(u=>u.hasDynType)?qw:a.handler.__handle??=(u,l,p)=>Tc(a.handler,p,u,l);return e.handle=vn(i,!1,c),a.returnType},evaluate(n,e,t){return e.handle(gd(n,e.args[1],t),e,n)}},rcall:{check(n,e,t){let[r,i,o]=e.args,s=n.check(i,t),a=e.candidates=n.registry.functionCandidates(!0,r,o.length),c=e.argTypes=o.map(l=>n.check(l,t));if(e.receiverWithArgs=[i,...o],e.handle=vn(e.receiverWithArgs,!1,Zw),s.kind===\"dyn\"&&a.returnType)return a.returnType;let u=a.findFunction(c,s);if(!u)throw n.createError(\"no_matching_overload\",`found no matching overload for '${s.type}.${r}(${n.formatTypeList(c)})'`,e);if(!s.hasPlaceholderType&&!c.some(l=>l.hasDynType)){let l=u.handler,p=l.__handle??=(f,m,g)=>Tc(l,m,f,g);e.handle=vn(e.receiverWithArgs,!1,p)}return u.returnType},evaluate(n,e,t){return e.handle(gd(n,e.receiverWithArgs,t),n,e)}},list:{check(n,e,t){let r=e.args,i=r.length;if(i===0)return e.setMeta(\"evaluate\",tE)&&n.getType(\"list<T>\");let o=n.check(r[0],t),s=n.opts.homogeneousAggregateLiterals?yb:bb;for(let a=1;a<i;a++)o=s(n,t,o,r[a],\"heterogeneous_list_element\");return n.registry.getListType(o)},evaluate(n,e,t){return gd(n,e.args,t)}},map:{check(n,e,t){let r=e.args,i=r.length;if(i===0)return e.setMeta(\"evaluate\",nE)&&n.getType(\"map<K, V>\");let o=n.opts.homogeneousAggregateLiterals?yb:bb,s=n.check(r[0][0],t),a=n.check(r[0][1],t);for(let c=1;c<i;c++){let u=r[c];s=o(n,t,s,u[0],\"heterogeneous_map_key\"),a=o(n,t,a,u[1],\"heterogeneous_map_value\")}return n.registry.getMapType(s,a)},evaluate(n,e,t){let r=e.args,i=r.length,o=new Array(i),s;for(let a=0;a<i;a++){let c=r[a],u=n.run(c[0],t),l=n.run(c[1],t);u instanceof Promise||l instanceof Promise?(o[a]=Promise.all([u,l]),s??=!0):o[a]=[u,l]}return s?Promise.all(o).then(Cb):Cb(o)}},comprehension:{check(n,e,t){let r=e.args;r.iterCtx=t.forkWithVariable(r.iterVarName,Ww(n,r.iterable,t)).setAccuType(n.check(r.init,t));let i=n.check(r.step,r.iterCtx),o=r.errorsAreFatal?Gw:Hw;return e.handle=vn(r.iterable,!1,o),r.kind===\"quantifier\"?n.boolType:i},evaluate(n,e,t){return e.handle(n.run(e.args.iterable,t),e.args,n,t)}},accuValue:{check(n,e,t){return t.accuType},evaluate(n,e,t){return t.accuValue}},accuInc:{check(n,e,t){return t.accuType},evaluate(n,e,t){return t.accuValue+=1}},accuPush:{check(n,e,t){let r=t.accuType,i=n.check(e.args,t);return e.args.maybeAsync||e.setMeta(\"evaluate\",j.accuPush.evaluateSync),r.kind===\"list\"&&r.valueType.kind!==\"param\"?r:n.registry.getListType(i)},evaluateSync(n,e,t){return t.accuValue.push(n.run(e.args,t)),t.accuValue},evaluate(n,e,t){let r=t.accuValue,i=n.run(e.args,t);return i instanceof Promise?i.then(o=>r.push(o)&&r):(r.push(i),r)}},\"?:\":{alias:\"ternary\",check(n,e,t){let r=e.condition=e.args[0],i=e.left=e.args[1],o=e.right=e.args[2],s=n.check(r,t);if(!s.isDynOrBool())throw n.createError(\"invalid_condition_type\",`${r.meta.label||\"Ternary condition must be bool\"}, got '${n.formatType(s)}'`,r);let a=n.check(i,t),c=n.check(o,t),u=a.unify(n.registry,c);if(e.handle=vn(r,!1,Lw),u)return u;throw n.createError(\"incompatible_ternary_branches\",`Ternary branches must have the same type, got '${n.formatType(a)}' and '${n.formatType(c)}'`,e)},evaluate(n,e,t){return e.handle(n.run(e.condition,t),n,e,t)}},\"||\":{check:vb,evaluate(n,e,t){let r=n.tryEval(e.left,t);if(r===!0)return!0;if(r===!1){let i=n.run(e.right,t);return typeof i==\"boolean\"?i:Do(!0,n,e,r,i)}return r instanceof Promise?r.then(i=>i===!0?i:Do(!0,n,e,i,n.run(e.right,t))):Do(!0,n,e,r,n.run(e.right,t))}},\"&&\":{check:vb,evaluate(n,e,t){let r=n.tryEval(e.left,t);if(r===!1)return!1;if(r===!0){let i=n.run(e.right,t);return typeof i==\"boolean\"?i:Do(!1,n,e,r,i)}return r instanceof Promise?r.then(i=>i===!1?i:Do(!1,n,e,i,n.run(e.right,t))):Do(!1,n,e,r,n.run(e.right,t))}},\"!_\":{alias:\"unaryNot\",check:_b,evaluate:xb},\"-_\":{alias:\"unaryMinus\",check:_b,evaluate:xb}},rE=[\"!=\",\"==\",\"in\",\"+\",\"-\",\"*\",\"/\",\"%\",\"<\",\"<=\",\">\",\">=\"];for(let n of rE)j[n]={check:Uw,evaluate:bd};for(let n of Ze(j)){let e=j[n];e.name=n,e.alias&&(j[e.alias]=e)}var kc=n=>n;function $c(n,e){if(n.op===\"id\")return n.args;throw qe(\"invalid_macro_argument\",e,n)}function kb(n){let e=n?\"map(var, filter, transform)\":\"map(var, transform)\",t=`${e} invalid predicate iteration variable`,r=`${e} filter predicate must return bool`;return({args:i,receiver:o,ast:s})=>{let[a,c,u]=n?i:[i[0],null,i[1]],l=u.clone(j.accuPush,u);if(c){let p=c.clone(j.accuValue);l=c.clone(j.ternary,[c.setMeta(\"label\",r),l,p])}return{callAst:s.clone(j.comprehension,{errorsAreFatal:!0,iterable:o,iterVarName:$c(a,t),init:s.clone(j.list,[]),step:l,result:kc})}}}function iE(){let n=\"filter(var, predicate)\",e=`${n} invalid predicate iteration variable`,t=`${n} predicate must return bool`;return({args:r,receiver:i,ast:o})=>{let s=$c(r[0],e),a=o.clone(j.accuValue),c=r[1].setMeta(\"label\",t),u=o.clone(j.accuPush,o.clone(j.id,s)),l=c.clone(j.ternary,[c,u,a]);return{callAst:o.clone(j.comprehension,{errorsAreFatal:!0,iterable:i,iterVarName:s,init:o.clone(j.list,[]),step:l,result:kc})}}}function _d(n){let e=`${n.name}(var, predicate) invalid predicate iteration variable`,t=`${n.name}(var, predicate) predicate must return bool`;return({args:r,receiver:i,ast:o})=>{let s=r[1].setMeta(\"label\",t),a=n.transform({args:r,ast:o,predicate:s,opts:n});return{callAst:o.clone(j.comprehension,{kind:\"quantifier\",errorsAreFatal:n.errorsAreFatal||!1,iterable:i,iterVarName:$c(r[0],e),init:a.init,condition:a.condition,step:a.step,result:a.result||kc})}}}function oE(){let n=\"has() invalid argument\";function e(r,i,o){let s=i.macroHasProps,a=s.length,c=r.run(s[--a],o),u;for(;a--;){let l=s[a];if(l.op===\".?\"&&(u??=!0),c=r.debugType(c).fieldLazy(c,l.args[1],l,r),c===void 0){if(!(!u&&a&&l.op===\".\"))break;throw H(\"no_such_key\",`No such key: ${l.args[1]}`,l)}}return c!==void 0}function t(r,i,o){let s=i.args[0];if(s.op!==\".\")throw r.createError(\"invalid_macro_argument\",n,s);if(!i.macroHasProps){let a=[];for(;s.op===\".\"||s.op===\".?\";)s=a.push(s)&&s.args[0];if(s.op!==\"id\")throw r.createError(\"invalid_macro_argument\",n,s);r.check(s,o),a.push(s),i.macroHasProps=a}return r.getType(\"bool\")}return function({args:r}){return{args:r,evaluate:e,typeCheck:t,async:!1}}}function $b(n){let e=(c,u)=>n.registerFunctionOverload(c,u);e(\"has(ast): bool\",oE()),e(\"list.all(ast, ast): bool\",_d({name:\"all\",transform({ast:c,predicate:u,opts:l}){return{init:c.clone(j.value,!0),condition:kc,step:u.clone(j.ternary,[u,u.clone(j.value,!0),u.clone(j.value,!1)])}}})),e(\"list.exists(ast, ast): bool\",_d({name:\"exists\",condition(c){return!c},transform({ast:c,predicate:u,opts:l}){return{init:c.clone(j.value,!1),condition:l.condition,step:u.clone(j.ternary,[u,u.clone(j.value,!0),u.clone(j.value,!1)])}}})),e(\"list.exists_one(ast, ast): bool\",_d({name:\"exists_one\",errorsAreFatal:!0,result(c){return c===1},transform({ast:c,predicate:u,opts:l}){let p=c.clone(j.accuValue);return{init:c.clone(j.value,0),step:u.clone(j.ternary,[u,c.clone(j.accuInc),p]),result:l.result}}})),e(\"list.map(ast, ast): list<dyn>\",kb(!1)),e(\"list.map(ast, ast, ast): list<dyn>\",kb(!0)),e(\"list.filter(ast, ast): list<dyn>\",iE());class t{}let r=new t;n.registerType(\"CelNamespace\",t),n.registerConstant(\"cel\",\"CelNamespace\",r);function i(c,u,l){u.bindCtx=l.forkWithVariable(u.var,c.check(u.val,l));let p=c.check(u.exp,u.bindCtx);return u.val.maybeAsync||u.exp.maybeAsync||(u.ast.setMeta(\"async\",!1),u.evaluate=a),p}function o(c,u,l,p,f){let m=c.run(u,p=l.reuse(p).setIterValue(f,c));return m instanceof Promise&&p===l&&(p.async=!0),m}function s(c,{val:u,exp:l,bindCtx:p},f){let m=c.run(u,f);return m instanceof Promise?m.then(g=>o(c,l,p,f,g)):o(c,l,p,f,m)}function a(c,{val:u,exp:l,bindCtx:p},f){return c.run(l,p.reuse(f).setIterValue(c.run(u,f),c))}e(\"CelNamespace.bind(ast, dyn, ast): dyn\",({ast:c,args:u})=>({ast:c,var:$c(u[0],\"invalid variable argument\"),val:u[1],exp:u[2],bindCtx:void 0,typeCheck:i,evaluate:s}))}function Ib(n){let e=(p,f,m,g)=>n.unaryOverload(p,f,m,g,!1),t=(p,f,m,g,h)=>n.binaryOverload(p,f,m,g,h,!1);function r(p,f){if(p<=Cc&&p>=Dc)return p;throw H(\"numeric_overflow\",`integer overflow: ${p}`,f)}function i(p){throw H(\"division_by_zero\",\"division by zero\",p)}function o(p){throw H(\"modulo_by_zero\",\"modulo by zero\",p)}e(\"!\",\"bool\",p=>!p),e(\"-\",\"int\",p=>-p),t(\"dyn<int>\",\"==\",\"double\",(p,f)=>p==f),t(\"dyn<int>\",\"==\",\"uint\",(p,f)=>p==f.valueOf()),t(\"int\",\"*\",\"int\",(p,f,m)=>r(p*f,m)),t(\"int\",\"+\",\"int\",(p,f,m)=>r(p+f,m)),t(\"int\",\"-\",\"int\",(p,f,m)=>r(p-f,m)),t(\"int\",\"/\",\"int\",(p,f,m)=>f===ki?i(m):p/f),t(\"int\",\"%\",\"int\",(p,f,m)=>f===ki?o(m):p%f),e(\"-\",\"double\",p=>-p),t(\"double\",\"*\",\"double\",(p,f)=>p*f),t(\"double\",\"+\",\"double\",(p,f)=>p+f),t(\"double\",\"-\",\"double\",(p,f)=>p-f),t(\"double\",\"/\",\"double\",(p,f)=>p/f),t(\"string\",\"+\",\"string\",(p,f)=>p+f),t(\"list<V>\",\"+\",\"list<V>\",(p,f)=>[...p,...f]),t(\"bytes\",\"+\",\"bytes\",(p,f)=>{if(!p.length)return f;if(!f.length)return p;let m=new Uint8Array(p.length+f.length);return m.set(p,0),m.set(f,p.length),m});let s=\"google.protobuf.Duration\";t(s,\"+\",s,(p,f)=>p.addDuration(f)),t(s,\"-\",s,(p,f)=>p.subtractDuration(f)),t(s,\"==\",s,(p,f)=>p.seconds===f.seconds&&p.nanos===f.nanos);let a=\"google.protobuf.Timestamp\";t(a,\"==\",a,(p,f)=>p.getTime()===f.getTime()),t(a,\"-\",a,(p,f)=>wr.fromMilliseconds(p.getTime()-f.getTime()),s),t(a,\"-\",s,(p,f)=>f.subtractTimestamp(p)),t(a,\"+\",s,(p,f)=>f.extendTimestamp(p)),t(s,\"+\",a,(p,f)=>p.extendTimestamp(f));function c(p,f,m,g){if(f instanceof Set&&f.has(p))return!0;for(let h of f)if(Is(p,h,m,g))return!0;return!1}function u(p,f){return f instanceof Map?f.get(p)!==void 0:vo(f,p)?f[p]!==void 0:!1}function l(p,f,m,g){return c(p,f,m,g)}t(\"V\",\"in\",\"list<V>\",l),t(\"K\",\"in\",\"map<K, V>\",u);for(let p of[\"type\",\"null\",\"bool\",\"string\",\"int\",\"double\"])t(p,\"==\",p,(f,m)=>f===m);t(\"bytes\",\"==\",\"bytes\",(p,f)=>{if(p===f)return!0;let m=p.length;if(m!==f.length)return!1;for(;m--;)if(p[m]!==f[m])return!1;return!0}),t(\"list<V>\",\"==\",\"list<V>\",(p,f,m,g)=>{if(p===f)return!0;if(Ti(p)&&Ti(f)){let v=p.length;if(v!==f.length)return!1;for(let x=0;x<v;x++)if(!Is(p[x],f[x],m,g))return!1;return!0}if(p instanceof Set&&f instanceof Set){if(p.size!==f.size)return!1;for(let v of p)if(!f.has(v))return!1;return!0}let h=p instanceof Set?f:p,y=p instanceof Set?p:f;if(!Ti(h)||h.length!==y?.size)return!1;for(let v=0;v<h.length;v++)if(!y.has(h[v]))return!1;return!0}),t(\"map<K, V>\",\"==\",\"map<K, V>\",(p,f,m,g)=>{if(p===f)return!0;if(p instanceof Map&&f instanceof Map){if(p.size!==f.size)return!1;for(let[v,x]of p)if(!(f.has(v)&&Is(x,f.get(v),m,g)))return!1;return!0}if(p instanceof Map||f instanceof Map){let v=p instanceof Map?f:p,x=p instanceof Map?p:f,$=Ze(v);if(x.size!==$.length)return!1;for(let[P,D]of x)if(!(P in v&&Is(D,v[P],m,g)))return!1;return!0}let h=Ze(p),y=Ze(f);if(h.length!==y.length)return!1;for(let v=0;v<h.length;v++){let x=h[v];if(!(x in f&&Is(p[x],f[x],m,g)))return!1}return!0}),t(\"uint\",\"==\",\"uint\",(p,f)=>p.valueOf()===f.valueOf()),t(\"dyn<uint>\",\"==\",\"double\",(p,f)=>p.valueOf()==f),t(\"uint\",\"+\",\"uint\",(p,f)=>new Ne(p.valueOf()+f.valueOf())),t(\"uint\",\"-\",\"uint\",(p,f)=>new Ne(p.valueOf()-f.valueOf())),t(\"uint\",\"*\",\"uint\",(p,f)=>new Ne(p.valueOf()*f.valueOf())),t(\"uint\",\"/\",\"uint\",(p,f,m)=>f.valueOf()===ki?i(m):new Ne(p.valueOf()/f.valueOf())),t(\"uint\",\"%\",\"uint\",(p,f,m)=>f.valueOf()===ki?o(m):new Ne(p.valueOf()%f.valueOf()));for(let[p,f]of[[\"bool\",\"bool\"],[\"int\",\"int\"],[\"uint\",\"uint\"],[\"double\",\"double\"],[\"string\",\"string\"],[\"google.protobuf.Timestamp\",\"google.protobuf.Timestamp\"],[\"google.protobuf.Duration\",\"google.protobuf.Duration\"],[\"int\",\"uint\"],[\"int\",\"double\"],[\"double\",\"int\"],[\"double\",\"uint\"],[\"uint\",\"int\"],[\"uint\",\"double\"]])t(p,\"<\",f,(m,g)=>m<g),t(p,\"<=\",f,(m,g)=>m<=g),t(p,\">\",f,(m,g)=>m>g),t(p,\">=\",f,(m,g)=>m>=g)}function Is(n,e,t,r){if(n===e)return!0;switch(typeof n){case\"undefined\":case\"string\":case\"boolean\":return!1;case\"bigint\":return typeof e==\"number\"?n==e:!1;case\"number\":return typeof e==\"bigint\"?n==e:!1;case\"object\":if(typeof e!=\"object\")return!1;let i=r.debugType(n),o=r.debugType(e);if(i!==o)return!1;let s=r.registry.findBinaryOverload(\"==\",i,o);return s?s.handler(n,e,t,r):!1}throw H(\"invalid_comparison_type\",`Cannot compare values of type ${typeof n}`,t)}var sE=new Map().set(\"A\",\"dyn\").set(\"T\",\"dyn\").set(\"K\",\"dyn\").set(\"V\",\"dyn\"),Fs=class extends wo{constructor(e,t){super(e),this.createError=t?H:Yy}check(e,t){try{return e.checkedType??=e.check(this,e,t)}catch(r){throw Ss(r,e)}}checkAccessOnType(e,t,r,i=!1){if(r===this.dynType)return r;let o=(e.op===\"[]\"||e.op===\"[?]\"?this.check(e.args[1],t):this.stringType).type;if(r.kind===\"list\"){if(o===\"int\"||o===\"dyn\")return r.valueType;throw this.createError(\"invalid_index_type\",`List index must be int, got '${o}'`,e)}if(r.kind===\"map\")return r.valueType;let s=this.objectTypes.get(r.name);if(s){if(!(o===\"string\"||o===\"dyn\"))throw this.createError(\"invalid_index_type\",`Cannot index type '${r.name}' with type '${o}'`,e);if(s.fields){let a;if(e.op===\".\"||e.op===\".?\"?a=e.args[1]:e.args[1].op===\"value\"&&(a=e.args[1].args),typeof a==\"string\"){let c=s.fields[a];if(c)return c;if(i)return this.dynType;throw this.createError(\"no_such_key\",`No such key: ${a}`,e)}}return this.dynType}throw this.createError(\"cannot_index_type\",`Cannot index type '${this.formatType(r)}'`,e)}formatType(e){return e.hasPlaceholderType?e.templated(this.registry,sE).name:e.name}formatTypeList(e){return e.map(t=>this.formatType(t)).join(\", \")}};var w={EOF:0,NUMBER:1,STRING:2,BOOLEAN:3,NULL:4,IDENTIFIER:5,PLUS:6,MINUS:7,MULTIPLY:8,DIVIDE:9,MODULO:10,EQ:11,NE:12,LT:13,LE:14,GT:15,GE:16,AND:17,OR:18,NOT:19,IN:20,LPAREN:21,RPAREN:22,LBRACKET:23,RBRACKET:24,LBRACE:25,RBRACE:26,DOT:27,COMMA:28,COLON:29,QUESTION:30,BYTES:31},Ic={[w.EQ]:j[\"==\"],[w.PLUS]:j[\"+\"],[w.MINUS]:j[\"-\"],[w.MULTIPLY]:j[\"*\"],[w.DIVIDE]:j[\"/\"],[w.MODULO]:j[\"%\"],[w.LE]:j[\"<=\"],[w.LT]:j[\"<\"],[w.GE]:j[\">=\"],[w.GT]:j[\">\"],[w.NE]:j[\"!=\"],[w.IN]:j.in},Fc={};for(let n in w)Fc[w[n]]=n;var Rb=new Uint8Array(128);for(let n of\"0123456789abcdefABCDEF\")Rb[n.charCodeAt(0)]=1;var aE={bytes_unicode_escape:n=>`\\\\${n} not allowed in bytes literals`,invalid_unicode_escape:n=>`Invalid Unicode escape: \\\\${n}`,invalid_unicode_surrogate:n=>`Invalid Unicode surrogate: \\\\${n}`,invalid_hex_escape:n=>`Invalid hex escape: \\\\${n}`,invalid_octal_escape:()=>\"Octal escape must be 3 digits\",octal_escape_out_of_range:n=>`Octal escape out of range: \\\\${n}`,invalid_escape_sequence:n=>`Invalid escape sequence: \\\\${n}`},Fb={\"\\\\\":\"\\\\\",\"?\":\"?\",'\"':'\"',\"'\":\"'\",\"`\":\"`\",a:\"\\x07\",b:\"\\b\",f:\"\\f\",n:`\n`,r:\"\\r\",t:\"\t\",v:\"\\v\"},xd=class n{#e;#t;constructor(e,t,r,i,o,s){this.#e={check:o.check,evaluate:o.evaluate},this.#t=e,this.op=o.name,this.args=s,this.pos=t,this.start=r,this.end=i}clone(e,t){return new n(this.#t,this.pos,this.start,this.end,e,t)}get meta(){return this.#e}get input(){return this.#t}#r(){let e=this.#e.alternate??this;switch(e.op){case\"value\":case\"id\":case\"accuValue\":case\"accuInc\":return!1;case\"accuPush\":return e.args.maybeAsync;case\"!_\":case\"-_\":return e.candidates?.async!==!1?!0:e.args.maybeAsync;case\"!=\":case\"==\":case\"in\":case\"+\":case\"-\":case\"*\":case\"/\":case\"%\":case\"<\":case\"<=\":case\">\":case\">=\":return e.candidates?.async!==!1?!0:e.args.some(t=>t.maybeAsync);case\"call\":case\"rcall\":return e.candidates?.async!==!1?!0:(e.receiverWithArgs||e.args[1]).some(t=>t.maybeAsync);case\"comprehension\":return e.args.iterable.maybeAsync||e.args.step.maybeAsync;case\".\":case\".?\":return e.args[0].maybeAsync;case\"?:\":case\"list\":case\"[]\":case\"[?]\":return e.args.some(t=>t.maybeAsync);case\"||\":case\"&&\":return e.args.some(t=>t.maybeAsync);case\"map\":return e.args.some(t=>t[0].maybeAsync||t[1].maybeAsync);default:return!0}}get maybeAsync(){return this.#e.async??=this.#r()}check(e,t,r){let i=this.#e;return i.alternate?e.check(i.alternate,r):i.macro?i.macro.typeCheck(e,i.macro,r):i.check(e,t,r)}evaluate(e,t,r){let i=this.#e;return i.alternate?this.evaluate=this.#i:i.macro?this.evaluate=this.#o:this.evaluate=i.evaluate,this.evaluate(e,t,r)}#i(e,t,r){return(t=this.#e.alternate).evaluate(e,t,r)}#o(e,t,r){return(t=this.#e.macro).evaluate(e,t,r)}setMeta(e,t){return this.#e[e]=t,this}get range(){return{start:this.start,end:this.end}}toOldStructure(){let e=Array.isArray(this.args)?this.args:[this.args];return[this.op,...e.map(t=>t instanceof n?t.toOldStructure():t)]}},Ad=class{input;pos;length;tokenPos;tokenType;tokenValue;reset(e){return this.pos=0,this.input=e,this.length=e.length,e}token(e,t,r){return this.tokenPos=e,this.tokenType=t,this.tokenValue=r,this}nextToken(){for(;;){let{pos:e,input:t,length:r}=this;if(e>=r)return this.token(e,w.EOF);let i=t[e];switch(i){case\" \":case\"\t\":case`\n`:case\"\\r\":this.pos++;continue;case\"=\":if(t[e+1]!==\"=\")break;return this.token((this.pos+=2)-2,w.EQ);case\"&\":if(t[e+1]!==\"&\")break;return this.token((this.pos+=2)-2,w.AND);case\"|\":if(t[e+1]!==\"|\")break;return this.token((this.pos+=2)-2,w.OR);case\"+\":return this.token(this.pos++,w.PLUS);case\"-\":return this.token(this.pos++,w.MINUS);case\"*\":return this.token(this.pos++,w.MULTIPLY);case\"/\":if(t[e+1]===\"/\"){for(;this.pos<r&&this.input[this.pos]!==`\n`;)this.pos++;continue}return this.token(this.pos++,w.DIVIDE);case\"%\":return this.token(this.pos++,w.MODULO);case\"<\":return t[e+1]===\"=\"?this.token((this.pos+=2)-2,w.LE):this.token(this.pos++,w.LT);case\">\":return t[e+1]===\"=\"?this.token((this.pos+=2)-2,w.GE):this.token(this.pos++,w.GT);case\"!\":return t[e+1]===\"=\"?this.token((this.pos+=2)-2,w.NE):this.token(this.pos++,w.NOT);case\"(\":return this.token(this.pos++,w.LPAREN);case\")\":return this.token(this.pos++,w.RPAREN);case\"[\":return this.token(this.pos++,w.LBRACKET);case\"]\":return this.token(this.pos++,w.RBRACKET);case\"{\":return this.token(this.pos++,w.LBRACE);case\"}\":return this.token(this.pos++,w.RBRACE);case\".\":return this.token(this.pos++,w.DOT);case\",\":return this.token(this.pos++,w.COMMA);case\":\":return this.token(this.pos++,w.COLON);case\"?\":return this.token(this.pos++,w.QUESTION);case'\"':case\"'\":return this.readString(i);case\"b\":case\"B\":case\"r\":case\"R\":{let o=t[e+1];return o==='\"'||o===\"'\"?++this.pos&&this.readString(o,i):this.readIdentifier()}default:{let o=i.charCodeAt(0);if(o<=57&&o>=48)return this.readNumber();if(this._isIdentifierCharCode(o))return this.readIdentifier()}}throw qe(\"unexpected_character\",`Unexpected character: ${i}`,{pos:e,start:e,end:e+1,input:t})}}_isIdentifierCharCode(e){return e<48||e>122?!1:e>=97||e>=65&&e<=90||e<=57||e===95}_parseAsDouble(e,t){let r=Number(this.input.substring(e,t));if(Number.isFinite(r))return this.token(e,w.NUMBER,r);throw qe(\"invalid_number\",`Invalid number: ${r}`,{pos:e,start:e,end:t,input:this.input})}_parseAsBigInt(e,t,r,i){let o=this.input.substring(e,t);if(i===\"u\"||i===\"U\"){this.pos++;try{return this.token(e,w.NUMBER,new Ne(o))}catch{}}else try{return this.token(e,w.NUMBER,BigInt(o))}catch{}throw qe(r?\"invalid_hex_integer\":\"invalid_integer\",r?`Invalid hex integer: ${o}`:`Invalid integer: ${o}`,{pos:e,start:e,end:this.pos,input:this.input})}_readDigits(e,t,r,i){for(;r<t&&(i=e.charCodeAt(r))&&!(i>57||i<48);)r++;return r}_readExponent(e,t,r){let i=r<t&&e[r];if(i===\"e\"||i===\"E\"){i=++r<t&&e[r],(i===\"-\"||i===\"+\")&&r++;let o=r;if(r=this._readDigits(e,t,r),o===r)throw qe(\"invalid_exponent\",\"Invalid exponent\",{pos:r,start:r,end:Math.min(r+1,e.length),input:e})}return r}readNumber(){let{input:e,length:t,pos:r}=this,i=r;if(e[i]===\"0\"&&(e[i+1]===\"x\"||e[i+1]===\"X\")){for(i+=2;i<t&&Rb[e[i].charCodeAt(0)];)i++;return this._parseAsBigInt(r,this.pos=i,!0,e[i])}if(i=this._readDigits(e,t,i),i+1<t){let o=!1,s=e[i]===\".\"?this._readDigits(e,t,i+1):i+1;if(s!==i+1&&(o=!0)&&(i=s),s=this._readExponent(e,t,i),s!==i&&(o=!0)&&(i=s),o)return this._parseAsDouble(r,this.pos=i)}return this._parseAsBigInt(r,this.pos=i,!1,e[i])}readString(e,t){let{input:r,pos:i}=this;return r[i+1]===e&&r[i+2]===e?this.readTripleQuotedString(e,t):this.readSingleQuotedString(e,t)}_closeQuotedString(e,t,r,i){switch(r){case\"b\":case\"B\":{let o=this.processEscapes(e,t,!0),s=new Uint8Array(o.length);for(let a=0;a<o.length;a++)s[a]=o.charCodeAt(a)&255;return this.token(i-1,w.BYTES,s)}case\"r\":case\"R\":return this.token(i-1,w.STRING,t);default:{let o=this.processEscapes(e,t,!1);return this.token(i,w.STRING,o)}}}readSingleQuotedString(e,t){let{input:r,length:i,pos:o}=this,s,a=this.pos+1;for(;a<i&&(s=r[a]);){switch(s){case e:let c=o+1,u=r.slice(c,a);return this.pos=++a,this._closeQuotedString(c,u,t,o);case`\n`:case\"\\r\":throw qe(\"newline_in_string\",\"Newlines not allowed in single-quoted strings\",{pos:a,start:a,end:a+1,input:r});case\"\\\\\":a++}a++}throw qe(\"unterminated_string\",\"Unterminated string\",{pos:o,start:o,end:r.length,input:r})}readTripleQuotedString(e,t){let{input:r,length:i,pos:o}=this,s,a=this.pos+3;for(;a<i&&(s=r[a]);){switch(s){case e:if(r[a+1]===e&&r[a+2]===e){let c=o+3,u=r.slice(c,a);return this.pos=a+3,this._closeQuotedString(c,u,t,o)}break;case\"\\\\\":a++}a++}throw qe(\"unterminated_triple_quoted_string\",\"Unterminated triple-quoted string\",{pos:o,start:o,end:r.length,input:r})}#e(e,t,r,i,o,s){let a=t+i;return qe(e,aE[e](s),{input:this.input,pos:a,start:a,end:Math.min(a+o,t+r)})}processEscapes(e,t,r){if(!t.includes(\"\\\\\"))return t;let i=t.length,o=\"\",s=0;for(;s<i;){if(t[s]!==\"\\\\\"||s+1>=i){o+=t[s++];continue}let a=t[s+1];if(Fb[a])o+=Fb[a],s+=2;else if(a===\"u\"||a===\"U\"){if(r)throw this.#e(\"bytes_unicode_escape\",e,i,s,2,a);let c=a===\"u\"?4:8,u=t.substring(s+2,s+2+c),l=Number.parseInt(u,16);if(u.length!==c||!/^[0-9a-fA-F]+$/.test(u)||l>1114111)throw this.#e(\"invalid_unicode_escape\",e,i,s,2+c,a+u);if(l>=55296&&l<=57343)throw this.#e(\"invalid_unicode_surrogate\",e,i,s,2+c,a+u);o+=String.fromCodePoint(l),s+=2+c}else if(a===\"x\"||a===\"X\"){let c=t.substring(s+2,s+4);if(!/^[0-9a-fA-F]{2}$/.test(c))throw this.#e(\"invalid_hex_escape\",e,i,s,4,a+c);o+=String.fromCharCode(Number.parseInt(c,16)),s+=4}else if(a>=\"0\"&&a<=\"7\"){let c=t.substring(s+1,s+4);if(!/^[0-7]{3}$/.test(c))throw this.#e(\"invalid_octal_escape\",e,i,s,4);let u=Number.parseInt(c,8);if(u>255)throw this.#e(\"octal_escape_out_of_range\",e,i,s,4,c);o+=String.fromCharCode(u),s+=4}else throw this.#e(\"invalid_escape_sequence\",e,i,s,2,a)}return o}readIdentifier(){let{pos:e,input:t,length:r}=this,i=e;for(;i<r&&this._isIdentifierCharCode(t[i].charCodeAt(0));)i++;let o=t.substring(e,this.pos=i);switch(o){case\"true\":return this.token(e,w.BOOLEAN,!0);case\"false\":return this.token(e,w.BOOLEAN,!1);case\"null\":return this.token(e,w.NULL,null);case\"in\":return this.token(e,w.IN);default:return this.token(e,w.IDENTIFIER,o)}}},cE=new Ad,Rc=class{lexer=cE;input=null;maxDepthRemaining=null;astNodesRemaining=null;type=null;pos=null;constructor(e,t){this.limits=e,this.registry=t}#e(e,t=this.pos){throw qe(\"limit_exceeded\",`Exceeded ${e} (${this.limits[e]})`,{pos:t,start:t,end:t,input:this.input})}#t(e,t,r,i,o=e){let s=new xd(this.input,o,e,t,r,i);return this.astNodesRemaining--||this.#e(\"maxAstNodes\",o),s}#r(e,t,r){return this.#t(t.start,r.end,e,[t,r])}#i(e,t,r){return this.#t(e.start,r.end,j.ternary,[e,t,r])}#o(e,t,r){return this.#t(e,r.end,t,r)}#s(e,t,r,i,o=t.start){return this.#t(t.start,i,e,[t,r],o)}#n(e=this.pos){let t=this.lexer.nextToken();return this.pos=t.tokenPos,this.type=t.tokenType,e}get value(){return this.lexer.tokenValue}consume(e){if(this.type===e)return this.#n();throw qe(\"expected_token\",`Expected ${Fc[e]}, got ${Fc[this.type]}`,{pos:this.pos,start:this.pos,end:this.lexer.pos,input:this.input})}match(e){return this.type===e}parse(e){if(typeof e!=\"string\")throw qe(\"expression_must_be_string\",\"Expression must be a string\");this.input=this.lexer.reset(e),this.#n(),this.maxDepthRemaining=this.limits.maxDepth,this.astNodesRemaining=this.limits.maxAstNodes;let t=this.parseExpression();if(this.match(w.EOF))return t;throw qe(\"unexpected_character\",`Unexpected character: '${this.input[this.lexer.pos-1]}'`,{pos:this.pos,start:this.pos,end:this.lexer.pos,input:this.input})}#a(e,t,r,i){let o=i[0],s=r===j.rcall?i[1]:null,a=r===j.rcall?i[2]:i[1],c=this.registry.findMacro(o,!!s,a.length),u=this.#t(e,t,r,i);if(!c)return u;let l=c.handler({ast:u,args:a,receiver:s,methodName:o,parser:this});return l.callAst?u.setMeta(\"alternate\",l.callAst):u.setMeta(\"macro\",l).setMeta(\"async\",ks(l.evaluate,l.async))}parseExpression(){this.maxDepthRemaining--||this.#e(\"maxDepth\");let e=this.parseLogicalOr();if(!this.match(w.QUESTION))return++this.maxDepthRemaining&&e;this.#n();let t=this.parseExpression();this.consume(w.COLON);let r=this.parseExpression();return this.maxDepthRemaining++,this.#i(e,t,r)}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.match(w.OR);)this.#n(),e=this.#r(j[\"||\"],e,this.parseLogicalAnd());return e}parseLogicalAnd(){let e=this.parseEquality();for(;this.match(w.AND);)this.#n(),e=this.#r(j[\"&&\"],e,this.parseEquality());return e}parseEquality(){let e=this.parseRelational();for(;this.match(w.EQ)||this.match(w.NE);){let t=Ic[this.type];this.#n(),e=this.#r(t,e,this.parseRelational())}return e}parseRelational(){let e=this.parseAdditive();for(;this.match(w.LT)||this.match(w.LE)||this.match(w.GT)||this.match(w.GE)||this.match(w.IN);){let t=Ic[this.type];this.#n(),e=this.#r(t,e,this.parseAdditive())}return e}parseAdditive(){let e=this.parseMultiplicative();for(;this.match(w.PLUS)||this.match(w.MINUS);){let t=Ic[this.type];this.#n(),e=this.#r(t,e,this.parseMultiplicative())}return e}parseMultiplicative(){let e=this.parseUnary();for(;this.match(w.MULTIPLY)||this.match(w.DIVIDE)||this.match(w.MODULO);){let t=Ic[this.type];this.#n(),e=this.#r(t,e,this.parseUnary())}return e}parseUnary(){return this.type===w.NOT?this.#o(this.#n(),j.unaryNot,this.parseUnary()):this.type===w.MINUS?this.#o(this.#n(),j.unaryMinus,this.parseUnary()):this.parsePostfix()}parsePostfix(){let e=this.parsePrimary(),t=this.maxDepthRemaining;for(;;){if(this.match(w.DOT)){let r=this.#n();this.maxDepthRemaining--||this.#e(\"maxDepth\",r);let i=this.match(w.QUESTION)&&this.registry.enableOptionalTypes&&this.#n()?j.optionalFieldAccess:j.fieldAccess,o=this.value,s=this.pos,a=this.lexer.pos;if(this.consume(w.IDENTIFIER),i===j.fieldAccess&&this.match(w.LPAREN)&&this.#n()){let c=this.parseArgumentList(),u=this.lexer.pos;this.consume(w.RPAREN),e=this.#a(e.start,u,j.rcall,[o,e,c])}else e=this.#s(i,e,o,a,s);continue}if(this.match(w.LBRACKET)){let r=this.#n();this.maxDepthRemaining--||this.#e(\"maxDepth\",r);let i=this.match(w.QUESTION)&&this.registry.enableOptionalTypes&&this.#n()?j.optionalBracketAccess:j.bracketAccess,o=this.parseExpression(),s=this.lexer.pos;this.consume(w.RBRACKET),e=this.#s(i,e,o,s);continue}break}return this.maxDepthRemaining=t,e}parsePrimary(){switch(this.type){case w.NUMBER:case w.STRING:case w.BYTES:case w.BOOLEAN:case w.NULL:return this.#d();case w.IDENTIFIER:return this.#u();case w.LPAREN:return this.#l();case w.LBRACKET:return this.parseList();case w.LBRACE:return this.parseMap()}throw qe(\"unexpected_token\",`Unexpected token: ${Fc[this.type]}`,{pos:this.pos,start:this.pos,end:this.lexer.pos,input:this.input})}#d(){return this.#n(this.#t(this.pos,this.lexer.pos,j.value,this.value))}#u(){let e=this.value,t=this.lexer.pos,r=this.consume(w.IDENTIFIER);if(_o.has(e))throw qe(\"reserved_identifier\",`Reserved identifier: ${e}`,{pos:r,start:r,end:t,input:this.input});if(!this.match(w.LPAREN))return this.#t(r,t,j.id,e);this.#n();let i=this.parseArgumentList(),o=this.lexer.pos;return this.consume(w.RPAREN),this.#a(r,o,j.call,[e,i])}#l(){this.consume(w.LPAREN);let e=this.parseExpression();return this.consume(w.RPAREN),e}parseList(){let e=this.consume(w.LBRACKET),t=[],r=this.limits.maxListElements;if(!this.match(w.RBRACKET))for(t.push(this.parseExpression()),r--||this.#e(\"maxListElements\",t.at(-1).pos);this.match(w.COMMA)&&(this.#n(),!this.match(w.RBRACKET));)t.push(this.parseExpression()),r--||this.#e(\"maxListElements\",t.at(-1).pos);let i=this.lexer.pos;return this.consume(w.RBRACKET),this.#t(e,i,j.list,t)}parseMap(){let e=this.consume(w.LBRACE),t=[],r=this.limits.maxMapEntries;if(!this.match(w.RBRACE))for(t.push(this.parseProperty()),r--||this.#e(\"maxMapEntries\",t.at(-1)[0].pos);this.match(w.COMMA)&&(this.#n(),!this.match(w.RBRACE));)t.push(this.parseProperty()),r--||this.#e(\"maxMapEntries\",t.at(-1)[0].pos);let i=this.lexer.pos;return this.consume(w.RBRACE),this.#t(e,i,j.map,t)}parseProperty(){return[this.parseExpression(),(this.consume(w.COLON),this.parseExpression())]}parseArgumentList(){let e=[],t=this.limits.maxCallArguments;if(!this.match(w.RPAREN))for(e.push(this.parseExpression()),t--||this.#e(\"maxCallArguments\",e.at(-1).pos);this.match(w.COMMA)&&(this.#n(),!this.match(w.RPAREN));)e.push(this.parseExpression()),t--||this.#e(\"maxCallArguments\",e.at(-1).pos);return e}};var Dd=Jt({maxAstNodes:1e5,maxDepth:250,maxListElements:1e3,maxMapEntries:1e3,maxCallArguments:32}),uE=new Set(Ze(Dd));function lE(n,e=Dd){let t=n?Ze(n):void 0;if(!t?.length)return e;let r={...e};for(let i of t){if(!uE.has(i))throw new TypeError(`Unknown limits option: ${i}`);let o=n[i];typeof o==\"number\"&&(r[i]=o)}return Jt(r)}var dE=Jt({unlistedVariablesAreDyn:!1,homogeneousAggregateLiterals:!0,enableOptionalTypes:!1,limits:Dd});function Cd(n,e,t){let r=n?.[t]??e?.[t];if(typeof r!=\"boolean\")throw new TypeError(`Invalid option: ${t}`);return r}function Ob(n,e=dE){return n?Jt({unlistedVariablesAreDyn:Cd(n,e,\"unlistedVariablesAreDyn\"),homogeneousAggregateLiterals:Cd(n,e,\"homogeneousAggregateLiterals\"),enableOptionalTypes:Cd(n,e,\"enableOptionalTypes\"),limits:lE(n.limits,e.limits)}):e}var Oc=pb({enableOptionalTypes:!1});ib(Oc);Ib(Oc);$b(Oc);var Eo=class n{#e;#t;#r;#i;#o;constructor(e,t){this.opts=Ob(e,t?.opts),this.#e=(t instanceof n?t.#e:Oc).clone(this.opts);let r={registry:this.#e,opts:this.opts};this.#r=new Fs(r),this.#i=new Fs(r,!0),this.#t=new wd(r),this.#o=new Rc(this.opts.limits,this.#e),Object.freeze(this)}clone(e){return new n(e,this)}registerFunction(e,t,r){return this.#e.registerFunctionOverload(e,t,r),this}registerOperator(e,t,r){return this.#e.registerOperatorOverload(e,t,r),this}registerType(e,t){return this.#e.registerType(e,t),this}registerVariable(e,t,r){return this.#e.registerVariable(e,t,r),this}registerConstant(e,t,r){return this.#e.registerConstant(e,t,r),this}hasVariable(e){return this.#e.variables.has(e)}getDefinitions(){return this.#e.getDefinitions()}check(e){try{return this.#s(this.#o.parse(e))}catch(t){return{valid:!1,error:t}}}#s(e){try{let t=this.#r.check(e,new Co(this.#e));return{valid:!0,type:this.#n(t)}}catch(t){return{valid:!1,error:t}}}#n(e){return e.name===\"list<dyn>\"?\"list\":e.name===\"map<dyn, dyn>\"?\"map\":e.name}parse(e){let t=this.#o.parse(e),r=this.#a.bind(this,t);return r.check=this.#s.bind(this,t),r.ast=t,r}evaluate(e,t){return this.#a(this.#o.parse(e),t)}#a(e,t){return e.checkedType?e.evaluate(this.#t,e,new Co(this.#e,t)):(this.#i.check(e,t=new Co(this.#e,t)),e.evaluate(this.#t,e,t))}},wd=class extends wo{constructor(e){super(e),this.createError=H}#e(e){if(e instanceof Map)return e.entries().next().value;for(let t in e)return[t,e[t]]}debugRuntimeType(e,t){return t?.hasDynType===!1?t:this.debugTypeDeep(e)}debugTypeDeep(e){let t=this.debugType(e);switch(t.kind){case\"list\":{let r=e instanceof Array?e[0]:e.values().next().value;return r===void 0?t:this.registry.getListType(this.debugTypeDeep(r))}case\"map\":{let r=this.#e(e);return r?this.registry.getMapType(t.keyType.hasDynType?this.debugTypeDeep(r[0]):t.keyType,t.valueType.hasDynType?this.debugTypeDeep(r[1]):t.valueType):t}default:return t}}tryEval(e,t){try{let r=this.run(e,t);return r instanceof Promise?r.catch(i=>i):r}catch(r){return r}}run(e,t){return e.evaluate(this,e,t)}},_L=new Eo({unlistedVariablesAreDyn:!0});var fE=Id(Mb(),1);var jb=3660,pE=64,hE=/^(\\d{4})-(\\d{2})-(\\d{2})$/;function Rs(n){return typeof n==\"number\"&&Number.isInteger(n)?BigInt(n):Array.isArray(n)?n.map(Rs):n&&typeof n==\"object\"?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Rs(t)])):n}function Os(n){return typeof n==\"bigint\"?Number(n):Array.isArray(n)?n.map(Os):n instanceof Map?Object.fromEntries([...n].map(([e,t])=>[String(e),Os(t)])):n&&typeof n==\"object\"?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Os(t)])):n}function So(n){let e=hE.exec(n);if(!e)throw new Error(`not a day: ${n}`);let[t,r,i]=[Number(e[1]),Number(e[2]),Number(e[3])],o=Date.UTC(t,r-1,i),s=new Date(o);if(s.getUTCFullYear()!==t||s.getUTCMonth()!==r-1||s.getUTCDate()!==i)throw new Error(`not a day: ${n}`);return o/864e5}var Ed=n=>new Date(n*864e5).toISOString().slice(0,10),Nc={addDays:(n,e)=>Ed(So(n)+Number(e)),daysBetween:(n,e)=>BigInt(So(e)-So(n)),weekStart:n=>{let e=So(n);return Ed(e-(new Date(e*864e5).getUTCDay()+6)%7)},dateRange:(n,e)=>{let[t,r]=[So(n),So(e)];if(r-t>jb)throw new Error(`a range of at most ${jb} days`);let i=[];for(let o=t;o<r;o++)i.push(Ed(o));return i}};var Mc=class{constructor(e){this.logic=e;this.consts=Rs(e.consts);let t=new Eo({unlistedVariablesAreDyn:!0,homogeneousAggregateLiterals:!1});t.registerFunction(\"addDays(string, int): string\",Nc.addDays),t.registerFunction(\"daysBetween(string, string): int\",Nc.daysBetween),t.registerFunction(\"weekStart(string): string\",Nc.weekStart),t.registerFunction(\"dateRange(string, string): list<string>\",Nc.dateRange),t.registerFunction(\"list.sort(): list\",r=>[...r].sort((i,o)=>i<o?-1:i>o?1:0)),t.registerFunction(\"fold(list, dyn, string): dyn\",(r,i,o)=>{if(!(o in e.functions))throw new Error(`fold: no function ${o}`);return r.reduce((s,a)=>this.call(o,[s,a]),i)});for(let[r,i]of Object.entries(e.functions))t.registerFunction(`${r}(${i.params.map(()=>\"dyn\").join(\", \")}): dyn`,(...o)=>this.call(r,o));this.env=t}logic;env;consts;depth=0;call(e,t){let r=this.logic.functions[e];if(++this.depth>pE)throw this.depth=0,new Error(\"calls nest too deep\");try{return this.env.evaluate(r.cel,{...this.consts,...Object.fromEntries(r.params.map((i,o)=>[i,t[o]??null]))})}finally{this.depth--}}evaluate(e,t={}){try{return this.depth=0,Os(this.env.evaluate(e,{...this.consts,...Rs(t)}))}catch{return null}}apply(e,t){try{return this.depth=0,Os(this.call(e,t.map(Rs)))}catch{return null}}parseError(e){try{return this.env.parse(e),null}catch(t){return t.message.split(`\n`)[0]??\"doesn't parse\"}}};var Pb=n=>n===void 0?n:structuredClone(n);function Ns(n,e,t){if(!(typeof e.path!=\"string\"||!e.path.startsWith(\"/\"))){if(e.op===\"set\")n.set(e.path,Pb(e.value));else if(e.op===\"push\"){let r=n.get(e.path);n.set(e.path,[...Array.isArray(r)?r:[],Pb(e.value)])}else if(e.op===\"removeAt\"){let r=n.get(e.path);if(!Array.isArray(r)||t===void 0||t<0||t>=r.length)return;let i=r.slice();i.splice(t,1),n.set(e.path,i)}}}function Lb(n,e,t){for(let r of e)Ns(n,r,t)}function Bb(n,e,t){return Object.keys(e).sort().map(r=>[r,n.evaluate(e[r],t)])}function Vb(n=new Date){let e=t=>String(t).padStart(2,\"0\");return`${n.getFullYear()}-${e(n.getMonth()+1)}-${e(n.getDate())}`}var mE=\"button, input, select, textarea, [role=button], [role=checkbox]\";function Ub(n){for(let e of n.querySelectorAll(\"[aria-label]\")){if(!e.tagName.startsWith(\"A2UI-\"))continue;let t=e.querySelector(mE);if(!t||t.hasAttribute(\"aria-label\")||t.hasAttribute(\"aria-labelledby\"))continue;t.setAttribute(\"aria-label\",e.getAttribute(\"aria-label\"));let r=e.getAttribute(\"aria-description\");r&&!t.hasAttribute(\"aria-description\")&&t.setAttribute(\"aria-description\",r)}}function zb(n){Ub(n),new MutationObserver(()=>Ub(n)).observe(n,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[\"aria-label\"]})}var qb={camera:[\"camera\"],microphone:[\"microphone\"],location:[\"geolocation\"],motion:[\"accelerometer\",\"gyroscope\",\"magnetometer\"],\"screen-awake\":[\"screen-wake-lock\"],gamepad:[\"gamepad\"],voice:[\"microphone\"],contacts:[],nfc:[]},gE=Object.keys(qb),Zb=[\"camera\",\"microphone\"];function Wb(n){let e=new Set(n.map(r=>r.what)),t=new Set;for(let r of gE)if(e.has(r))for(let i of qb[r])t.add(i);return[...t]}var Hb=`(function(){\"use strict\";\nvar bus=window.__ccBus,on={},opts=null,ready=false,begun=false,rate=10,acc=0,seed=1,last;\nvar cv=document.querySelector(\"canvas\"),g=cv.getContext(\"2d\"),W=0,H=0;\nfunction send(m){bus.send(m)}\nfunction fire(n,a,b){(on[n]||[]).forEach(function(f){f(a,b)})}\nfunction fit(){var r=Math.min(window.devicePixelRatio||1,3);W=cv.clientWidth;H=cv.clientHeight;cv.width=Math.round(W*r);cv.height=Math.round(H*r);g.setTransform(r,0,0,r,0,0)}\nfunction report(){if(!game.state||typeof game.state!==\"object\")return;var s;try{s=JSON.stringify(game.state)}catch(e){return}if(s!==undefined&&s!==last){last=s;send({state:JSON.parse(s)})}}\nfunction paint(){if(opts.draw){g.clearRect(0,0,W,H);opts.draw(g,W,H)}}\nfunction begin(){if(begun||!ready||!opts)return;begun=true;fit();if(opts.setup)opts.setup();paint();report()}\nfunction frame(dt){if(!begun||game.paused)return;var each=1000/rate,n=0;acc+=Math.max(0,Math.min(dt,60000));\nwhile(acc>=each&&n<rate*60){acc-=each;n++;if(opts.step)opts.step()}if(acc>=each)acc=0;\npaint();report()}\nvar game={inputs:{},state:null,paused:false,\nstart:function(o){opts=o||{};rate=Math.max(1,Math.min(60,Number(opts.rate)||10));begin()},\non:function(n,f){(on[n]=on[n]||[]).push(f)},\nemit:function(n,d){send({emit:{name:String(n),data:d}})},\nrandom:function(){seed=(seed+0x6D2B79F5)|0;var t=Math.imul(seed^(seed>>>15),1|seed);t=(t+Math.imul(t^(t>>>7),61|t))^t;return((t^(t>>>14))>>>0)/4294967296}};\nwindow.game=game;\nbus.on(function(m){var d=m||{};\nif(d.init){seed=(Number(d.init.seed)|0)||1;game.inputs=d.init.inputs||{};ready=true;begin()}\nif(d.input){game.inputs[d.input.name]=d.input.value;fire(\"input\",d.input.name,d.input.value)}\nif(typeof d.tick===\"number\")frame(d.tick);\nif(typeof d.visible===\"boolean\")game.paused=!d.visible});\naddEventListener(\"resize\",function(){if(begun){fit();paint()}});\nvar x0,y0,t0;\ncv.addEventListener(\"pointerdown\",function(e){x0=e.offsetX;y0=e.offsetY;t0=e.timeStamp});\ncv.addEventListener(\"pointerup\",function(e){if(x0===undefined)return;var dx=e.offsetX-x0,dy=e.offsetY-y0;\nif(Math.abs(dx)<12&&Math.abs(dy)<12){if(e.timeStamp-t0<600)fire(\"tap\",x0,y0)}\nelse fire(\"swipe\",Math.abs(dx)>Math.abs(dy)?(dx>0?\"right\":\"left\"):(dy>0?\"down\":\"up\"));x0=undefined});\nvar KEYS={ArrowUp:\"up\",ArrowDown:\"down\",ArrowLeft:\"left\",ArrowRight:\"right\"};\naddEventListener(\"keydown\",function(e){if(KEYS[e.key]){e.preventDefault();fire(\"swipe\",KEYS[e.key])}else if(e.key===\" \"||e.key===\"Enter\"){e.preventDefault();fire(\"tap\",W/2,H/2)}});\n})();`;function Gb(n,e){return{allow:Wb(e).join(\"; \"),sameOrigin:n.kit===\"page\"&&e.some(t=>Zb.includes(t.what))}}var yE={number:n=>typeof n==\"number\"&&Number.isFinite(n),string:n=>typeof n==\"string\"&&n.length<=1e3,boolean:n=>typeof n==\"boolean\",list:n=>Array.isArray(n),map:n=>!!n&&typeof n==\"object\"&&!Array.isArray(n)};function Kb(n,e,t){if(!Object.hasOwn(n.events,e))return null;let r=n.events[e],i={};if(!t||typeof t!=\"object\")return i;for(let[o,s]of Object.entries(r)){let a=t[o];yE[s](a)&&(i[o]=a)}return i}var bE=8*1024;function Jb(n){if(!n||typeof n!=\"object\"||Array.isArray(n))return null;let e;try{e=JSON.stringify(n)}catch{return null}return e.length<=bE?JSON.parse(e):null}var vE=4*1024*1024,_E=n=>JSON.stringify(n).replace(/</g,\"\\\\u003c\").replace(new RegExp(\"\\u2028\",\"g\"),\"\\\\u2028\").replace(new RegExp(\"\\u2029\",\"g\"),\"\\\\u2029\");function xE(n){return`(function(){\"use strict\";var port=null,out=[],on=[],data={};var stored=${_E(n)};\nfor(var k in stored)if(Object.prototype.hasOwnProperty.call(stored,k)&&typeof stored[k]===\"string\")data[k]=stored[k];\nfunction send(m){if(port)port.postMessage(m);else out.push(m)}\nObject.defineProperty(window,\"__ccBus\",{value:{send:send,on:function(f){on.push(f)}}});\naddEventListener(\"message\",function(e){if(e.data!==\"cc-port\"||port||!e.ports||!e.ports[0])return;port=e.ports[0];\nport.onmessage=function(m){on.forEach(function(f){f(m.data)})};var q=out;out=[];q.forEach(send)});\nvar has=function(k){return Object.prototype.hasOwnProperty.call(data,k)};\nvar store={getItem:function(k){k=String(k);return has(k)?data[k]:null},\nsetItem:function(k,v){k=String(k);v=String(v);data[k]=v;send({store:{set:[k,v]}})},\nremoveItem:function(k){k=String(k);if(has(k)){delete data[k];send({store:{remove:k}})}},\nclear:function(){data={};send({store:{clear:true}})},\nkey:function(i){return Object.keys(data)[i]||null},\nget length(){return Object.keys(data).length}};\ntry{Object.defineProperty(window,\"localStorage\",{value:store,configurable:true})}catch(e){}})();`}function Yb(n,e){if(!e||typeof e!=\"object\")return null;let t=e,r;if(t.clear===!0)r={};else if(typeof t.remove==\"string\")r={...n},delete r[t.remove];else if(Array.isArray(t.set)&&typeof t.set[0]==\"string\"&&typeof t.set[1]==\"string\")r={...n,[t.set[0]]:t.set[1]};else return null;return JSON.stringify(r).length<=vE?r:null}var AE=\"html,body{margin:0;height:100%;overflow:hidden;background:transparent}canvas{display:block;width:100%;height:100%;touch-action:none}\";function Xb(n,e){let t=`<script>${xE(e)}<\\/script>`;return n.kit===\"page\"?t+n.code:`<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><style>${AE}</style>${t}<canvas></canvas><script>${Hb}<\\/script><script>${n.code}<\\/script>`}var CE={name:\"Coded\",schema:d.object({use:d.string(),label:pt.DynamicString,aspect:d.number().optional(),inputs:d.array(d.object({name:d.string(),value:pt.DynamicValue})).optional(),on:d.array(d.object({name:d.string(),action:pt.Action})).optional()})},Ii={components:{},set(){},dataKey:\"app\",uses:[]},ev=n=>`${Ii.dataKey}.coded.${n}`;function DE(n){try{let e=JSON.parse(localStorage.getItem(ev(n))??\"{}\");return!e||typeof e!=\"object\"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,t])=>typeof t==\"string\"))}catch{return{}}}function tv(n){Ii=n}var wE=(n,e,{allow:t,sameOrigin:r})=>{let i=document.createElement(\"div\");i.style.cssText=\"display:block;width:100%;height:100%\";let o=i.attachShadow({mode:\"closed\"}),s=document.createElement(\"iframe\");s.setAttribute(\"sandbox\",r?\"allow-scripts allow-same-origin\":\"allow-scripts\"),t&&s.setAttribute(\"allow\",t),s.setAttribute(\"title\",\"Custom part of this app\"),s.setAttribute(\"style\",\"border:0;display:block;width:100%;height:100%\"),s.setAttribute(\"srcdoc\",e);let a=new MessageChannel;return s.addEventListener(\"load\",()=>s.contentWindow?.postMessage(\"cc-port\",\"*\",[a.port2]),{once:!0}),o.appendChild(s),n.appendChild(i),a.port1},EE=(n,e,t)=>{let r=window.__ccFrame;return typeof r==\"function\"?r(n,e,t):wE(n,e,t)},Qb=n=>Object.fromEntries((n.inputs??[]).map(e=>[e.name,e.value])),nv=Ei(CE,({props:n,context:e})=>{let t=n,r=e.componentModel.id,i=mt(null),o=mt(null),s=mt(t);s.current=t;let a=mt({});return wt(()=>{let u=Ii.components[t.use];if(!u||!i.current)return;let l=`/ui/coded/${r}`,p=DE(t.use),f=EE(i.current,Xb(u,p),Gb(u,Ii.uses));o.current=f;let m=\"\";f.onmessage=P=>{let D=P.data??{};if(\"store\"in D){let F=Yb(p,D.store);if(F)try{localStorage.setItem(ev(t.use),JSON.stringify(F)),p=F}catch{}return}if(\"state\"in D){let F=Jb(D.state),M=F&&JSON.stringify(F);F&&M!==m&&(m=M,Ii.set(`${l}/state`,F))}if(D.emit&&typeof D.emit.name==\"string\"){let F=Kb(u,D.emit.name,D.emit.data);if(!F)return;Ii.set(`${l}/${D.emit.name}`,F),s.current.on?.find(M=>M.name===D.emit.name)?.action()}};let g=Qb(s.current);a.current=Object.fromEntries(Object.entries(g).map(([P,D])=>[P,JSON.stringify(D)])),f.postMessage({init:{seed:Math.floor(Math.random()*2**31),inputs:g}});let h=0,y=null,v=P=>{y!==null&&f.postMessage({tick:P-y}),y=P,h=requestAnimationFrame(v)},x=()=>{f.postMessage({visible:!document.hidden}),cancelAnimationFrame(h),y=null,document.hidden||(h=requestAnimationFrame(v))};document.addEventListener(\"visibilitychange\",x),x();let $=i.current;return()=>{cancelAnimationFrame(h),document.removeEventListener(\"visibilitychange\",x),f.close(),o.current=null,$.replaceChildren()}},[t.use,r]),wt(()=>{if(o.current)for(let[u,l]of Object.entries(Qb(t))){let p=JSON.stringify(l);a.current[u]!==p&&(a.current[u]=p,o.current.postMessage({input:{name:u,value:l}}))}}),Ii.components[t.use]?.kit===\"page\"?ee(\"div\",{class:\"cc-coded cc-page\",ref:i,role:\"group\",\"aria-label\":t.label}):ee(\"div\",{class:\"cc-coded\",ref:i,role:\"group\",\"aria-label\":t.label,style:{aspectRatio:String(t.aspect??1)}})});var SE={name:\"DateStrip\",schema:d.object({days:d.number().int().min(2).max(60).optional(),today:pt.DynamicString,value:pt.DynamicString,statuses:pt.DynamicValue.optional()})},rv=[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],TE=[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],kE={complete:\"var(--a2ui-color-success, #10b981)\",partial:\"var(--a2ui-color-warning, #fbbf24)\",incomplete:\"var(--a2ui-color-error, #ef4444)\",active:\"var(--a2ui-color-primary)\"},iv=n=>{let[e,t,r]=n.split(\"-\").map(Number);return new Date(Date.UTC(e,t-1,r))},ov=n=>n.toISOString().slice(0,10),sv=Ei(SE,({props:n})=>{let e=n,t=mt(null);wt(()=>{t.current&&(t.current.scrollLeft=t.current.scrollWidth)},[]);let r=typeof e.today==\"string\"&&/^\\d{4}-\\d{2}-\\d{2}$/.test(e.today)?e.today:ov(new Date),i=e.days??14,o=iv(r),s=Array.from({length:i},(c,u)=>ov(new Date(o.getTime()-(i-1-u)*864e5))),a=new Map;if(Array.isArray(e.statuses))for(let c of e.statuses)typeof c?.day==\"string\"&&typeof c?.status==\"string\"&&a.set(c.day,c.status);return ee(\"div\",{class:\"cc-datestrip\",ref:t,role:\"group\",\"aria-label\":\"Days\",children:s.map(c=>{let u=iv(c),l=c===e.value,p=c===r,f=a.get(c);return ee(\"button\",{type:\"button\",class:`cc-day${l?\" cc-on\":\"\"}${p?\" cc-today\":\"\"}`,\"aria-pressed\":l,\"aria-label\":`${p?\"Today, \":\"\"}${rv[u.getUTCDay()]} ${u.getUTCDate()} ${TE[u.getUTCMonth()]}${f?`, ${f}`:\"\"}`,onClick:()=>e.setValue?.(c),children:[ee(\"span\",{class:\"cc-wd\",children:p?\"Today\":rv[u.getUTCDay()]}),ee(\"span\",{class:\"cc-n\",children:u.getUTCDate()}),ee(\"span\",{class:\"cc-dot\",style:{background:f?l&&f===\"active\"?\"var(--a2ui-color-on-primary, #fff)\":kE[f]:\"transparent\"}})]},c)})})});var $E=ho.components.get(\"TextField\"),av=Ei($E,({props:n})=>{let e=n,t=e.variant===\"number\"?\"number\":e.variant===\"obscured\"?\"password\":\"text\",r=e.isValid===!1,i=o=>e.setValue?.(o.target.value);return ee(\"label\",{class:`cc-field${r?\" cc-invalid\":\"\"}`,children:[e.label?ee(\"span\",{class:\"cc-field-label\",children:e.label}):null,e.variant===\"longText\"?ee(\"textarea\",{value:e.value??\"\",onInput:i,\"aria-invalid\":r||void 0}):ee(\"input\",{type:t,inputMode:t===\"number\"?\"numeric\":void 0,value:e.value??\"\",onInput:i,\"aria-invalid\":r||void 0}),r&&e.validationErrors?.length?ee(\"span\",{class:\"cc-field-error\",children:e.validationErrors[0]}):null]})});var Sd=n=>!!n&&typeof n==\"object\"&&!Array.isArray(n);function cv(n,e,t){let r=c=>({saved:structuredClone(e.initial),version:e.version,note:c});if(n===null)return r(\"new\");let i;try{i=JSON.parse(n)}catch{return r(\"unreadable\")}if(!Sd(i)||typeof i.v!=\"number\")return r(\"unreadable\");let{v:o,...s}=i;if(o===e.version)return{saved:s,version:o,note:\"loaded\"};if(o>e.version)return{saved:s,version:o,note:\"newer\"};let a=s;for(let c=o;c<e.version;c++){let u=e.migrations.find(p=>p.from===c);if(!u)return r(\"unreadable\");let l=t.evaluate(u.cel,{saved:a});if(!Sd(l))return r(\"unreadable\");a=l}return{saved:a,version:e.version,note:\"migrated\"}}function uv(n,e,t){return e.note===\"newer\"?null:JSON.stringify({v:t.version,...Sd(n)?n:{}})}var IE=n=>n.replace(/~/g,\"~0\").replace(/\\//g,\"~1\"),Td=(n,e)=>JSON.stringify(n)===JSON.stringify(e),jc=n=>n===void 0?n:structuredClone(n);function FE(n,e){return n.replace(/\\$\\{(\\/[^}]*)\\}/g,(t,r)=>IE(String(e.get(r)??\"\")))}var Pc=class{constructor(e){this.views=e}views;last=new Map;sync(e){let t=!1;for(let r of this.views){let i=FE(r.source,e),o=e.get(r.path),s=this.last.get(r.path);if(s!==void 0&&s.source===i&&!Td(o,s.value)){let c=e.get(i);!(c===void 0&&Array.isArray(o)&&o.length===0)&&!Td(c,o)&&(e.set(i,jc(o)),t=!0),this.last.set(r.path,{source:i,value:jc(o)})}else{let c=e.get(i),u=c===void 0?[]:c;Td(o,u)||(e.set(r.path,jc(u)),t=!0),this.last.set(r.path,{source:i,value:jc(u)})}}return t}};var RE=\"https://cloudcrane.ai/catalogs/app/v1.json\",Lc=n=>({get:e=>n.dataModel.get(e),set:(e,t)=>n.dataModel.set(e,t)}),OE=[Ae({name:\"set\",returnType:\"void\",schema:d.object({path:pt.DynamicString,value:pt.DynamicValue}),allowedCallers:\"rendererOnly\"},(n,e)=>Ns(Lc(e),{op:\"set\",path:n.path,value:n.value},void 0)),Ae({name:\"push\",returnType:\"void\",schema:d.object({path:pt.DynamicString,value:pt.DynamicValue}),allowedCallers:\"rendererOnly\"},(n,e)=>Ns(Lc(e),{op:\"push\",path:n.path,value:n.value},void 0)),Ae({name:\"removeAt\",returnType:\"void\",schema:d.object({path:pt.DynamicString}),allowedCallers:\"rendererOnly\"},(n,e)=>{let t=e;Ns(Lc(t),{op:\"removeAt\",path:n.path},t.getIndex())}),Ae({name:\"batch\",returnType:\"void\",schema:d.object({steps:d.array(d.record(d.unknown()))}),allowedCallers:\"rendererOnly\"},(n,e)=>{let t=e,r=n.steps.map(i=>({op:i.op,path:t.resolveDynamicValue(i.target),value:t.resolveDynamicValue(i.value)}));Lb(Lc(t),r,t.getIndex())})];function NE(){let n=JSON.parse(document.getElementById(\"cc-spec\").textContent),e=new Mc(n.logic),t=null;try{t=localStorage.getItem(n.data.key)}catch{t=null}let r=cv(t,n.data,e),i=[...ho.components.values()].filter(x=>x.name!==\"TextField\"),o=new jt(RE,\"v0.9\",[...i,av,sv,nv],[...ho.functions.values(),...OE]),s=new Ma([o]);s.processMessages(n.surface.messages);let a=[...s.model.surfacesMap.values()][0],c=a.dataModel;a.onError.subscribe(x=>console.error(\"[a2ui]\",JSON.stringify(x))),a.onWarning.subscribe(x=>console.warn(\"[a2ui]\",JSON.stringify(x)));let u=n.data.persist;tv({components:n.components??{},set:(x,$)=>c.set(x,$),dataKey:n.data.key,uses:n.uses??[]});let l=window.__ccToday??Vb();c.set(\"/today\",l),(c.get(\"/ui/selected\")??\"\")===\"\"&&c.set(\"/ui/selected\",l),c.set(u,r.saved);let p=new Pc(n.data.views),f={get:x=>c.get(x),set:(x,$)=>c.set(x,$)},m=!1,g=()=>{if(!m){m=!0;try{for(let x=0;x<5&&(p.sync(f)||h());x++);}finally{m=!1}}},h=()=>{let x=!1,$={saved:c.get(u),ui:c.get(\"/ui\"),today:l};for(let[P,D]of Bb(e,n.logic.computed,$))JSON.stringify(c.get(P))!==JSON.stringify(D)&&(c.set(P,D),x=!0);return x},y=()=>{let x=uv(c.get(u),r,n.data);if(x!==null)try{localStorage.setItem(n.data.key,x)}catch{}};g(),c.subscribe(u,()=>{g(),y()}),c.subscribe(\"/ui\",g),r.note===\"migrated\"&&y(),window.appState=()=>({data:c.get(\"/\"),today:l,loaded:r.note});let v=document.getElementById(\"app\");Wn(vt(od,{surface:a}),v),zb(v)}NE();export{RE as CLOUDCRANE_CATALOG_ID};\n";
|