UNPKG

brave-search-mcp

Version:

MCP Server that uses Brave Search API to search for images, general web search, video, news and points of interest.

9 lines 105 kB
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="color-scheme" content="light dark" /> <title>Brave Web Search</title> <script type="module" crossorigin>!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const n of e)if("childList"===n.type)for(const e of n.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)}).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();var e,t,n,o,r,i,l,a,_,u,s,c={},d=[],f=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,p=Array.isArray;function h(e,t){for(var n in t)e[n]=t[n];return e}function v(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function m(t,n,o){var r,i,l,a={};for(l in n)"key"==l?r=n[l]:"ref"==l?i=n[l]:a[l]=n[l];if(arguments.length>2&&(a.children=arguments.length>3?e.call(arguments,2):o),"function"==typeof t&&null!=t.defaultProps)for(l in t.defaultProps)void 0===a[l]&&(a[l]=t.defaultProps[l]);return y(t,a,r,i,null)}function y(e,o,r,i,l){var a={type:e,props:o,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==l?++n:l,__i:-1,__u:0};return null==l&&null!=t.vnode&&t.vnode(a),a}function g(e){return e.children}function b(e,t){this.props=e,this.context=t}function w(e,t){if(null==t)return e.__?w(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?w(e):null}function C(e){if(e.__P&&e.__d){var n=e.__v,o=n.__e,r=[],i=[],l=h({},n);l.__v=n.__v+1,t.vnode&&t.vnode(l),H(e.__P,l,n,e.__n,e.__P.namespaceURI,32&n.__u?[o]:null,r,null==o?w(n):o,!!(32&n.__u),i),l.__v=n.__v,l.__.__k[l.__i]=l,R(r,l,i),n.__e=n.__=null,l.__e!=o&&N(l)}}function N(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),N(e)}function k(e){(!e.__d&&(e.__d=!0)&&o.push(e)&&!x.__r++||r!=t.debounceRendering)&&((r=t.debounceRendering)||i)(x)}function x(){for(var e,t=1;o.length;)o.length>t&&o.sort(l),e=o.shift(),t=o.length,C(e);x.__r=0}function L(e,t,n,o,r,i,l,a,_,u,s){var f,h,v,m,b,C,N,k=o&&o.__k||d,x=t.length;for(_=function(e,t,n,o,r){var i,l,a,_,u,s=n.length,c=s,d=0;for(e.__k=new Array(r),i=0;i<r;i++)null!=(l=t[i])&&"boolean"!=typeof l&&"function"!=typeof l?("string"==typeof l||"number"==typeof l||"bigint"==typeof l||l.constructor==String?l=e.__k[i]=y(null,l,null,null,null):p(l)?l=e.__k[i]=y(g,{children:l},null,null,null):void 0===l.constructor&&l.__b>0?l=e.__k[i]=y(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):e.__k[i]=l,_=i+d,l.__=e,l.__b=e.__b+1,a=null,-1!=(u=l.__i=S(l,n,_,c))&&(c--,(a=n[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(r>s?d--:r<s&&d++),"function"!=typeof l.type&&(l.__u|=4)):u!=_&&(u==_-1?d--:u==_+1?d++:(u>_?d--:d++,l.__u|=4))):e.__k[i]=null;if(c)for(i=0;i<s;i++)null!=(a=n[i])&&!(2&a.__u)&&(a.__e==o&&(o=w(a)),W(a,a));return o}(n,t,k,_,x),f=0;f<x;f++)null!=(v=n.__k[f])&&(h=-1!=v.__i&&k[v.__i]||c,v.__i=f,C=H(e,v,h,r,i,l,a,_,u,s),m=v.__e,v.ref&&h.ref!=v.ref&&(h.ref&&q(h.ref,null,v),s.push(v.ref,v.__c||m,v)),null==b&&null!=m&&(b=m),(N=!!(4&v.__u))||h.__k===v.__k?_=M(v,_,e,N):"function"==typeof v.type&&void 0!==C?_=C:m&&(_=m.nextSibling),v.__u&=-7);return n.__e=b,_}function M(e,t,n,o){var r,i;if("function"==typeof e.type){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=M(r[i],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=w(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function P(e,t){return t=t||[],null==e||"boolean"==typeof e||(p(e)?e.some(function(e){P(e,t)}):t.push(e)),t}function S(e,t,n,o){var r,i,l,a=e.key,_=e.type,u=t[n],s=null!=u&&!(2&u.__u);if(null===u&&null==a||s&&a==u.key&&_==u.type)return n;if(o>(s?1:0))for(r=n-1,i=n+1;r>=0||i<t.length;)if(null!=(u=t[l=r>=0?r--:i++])&&!(2&u.__u)&&a==u.key&&_==u.type)return l;return-1}function E(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||f.test(t)?n:n+"px"}function T(e,t,n,o,r){var i,l;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||E(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||E(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(a,"$1")),l=t.toLowerCase(),t=l in e||"onFocusOut"==t||"onFocusIn"==t?l.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n.u=o.u:(n.u=_,e.addEventListener(t,i?s:u,i)):e.removeEventListener(t,i?s:u,i);else{if("http://www.w3.org/2000/svg"==r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(c){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function D(e){return function(n){if(this.l){var o=this.l[n.type+e];if(null==n.t)n.t=_++;else if(n.t<o.u)return;return o(t.event?t.event(n):n)}}}function H(n,o,r,i,l,a,_,u,s,f){var m,y,C,N,k,x,M,P,S,E,D,H,R,q,W,B=o.type;if(void 0!==o.constructor)return null;128&r.__u&&(s=!!(32&r.__u),a=[u=o.__e=r.__e]),(m=t.__b)&&m(o);e:if("function"==typeof B)try{if(P=o.props,S="prototype"in B&&B.prototype.render,E=(m=B.contextType)&&i[m.__c],D=m?E?E.props.value:m.__:i,r.__c?M=(y=o.__c=r.__c).__=y.__E:(S?o.__c=y=new B(P,D):(o.__c=y=new b(P,D),y.constructor=B,y.render=I),E&&E.sub(y),y.state||(y.state={}),y.__n=i,C=y.__d=!0,y.__h=[],y._sb=[]),S&&null==y.__s&&(y.__s=y.state),S&&null!=B.getDerivedStateFromProps&&(y.__s==y.state&&(y.__s=h({},y.__s)),h(y.__s,B.getDerivedStateFromProps(P,y.__s))),N=y.props,k=y.state,y.__v=o,C)S&&null==B.getDerivedStateFromProps&&null!=y.componentWillMount&&y.componentWillMount(),S&&null!=y.componentDidMount&&y.__h.push(y.componentDidMount);else{if(S&&null==B.getDerivedStateFromProps&&P!==N&&null!=y.componentWillReceiveProps&&y.componentWillReceiveProps(P,D),o.__v==r.__v||!y.__e&&null!=y.shouldComponentUpdate&&!1===y.shouldComponentUpdate(P,y.__s,D)){o.__v!=r.__v&&(y.props=P,y.state=y.__s,y.__d=!1),o.__e=r.__e,o.__k=r.__k,o.__k.some(function(e){e&&(e.__=o)}),d.push.apply(y.__h,y._sb),y._sb=[],y.__h.length&&_.push(y);break e}null!=y.componentWillUpdate&&y.componentWillUpdate(P,y.__s,D),S&&null!=y.componentDidUpdate&&y.__h.push(function(){y.componentDidUpdate(N,k,x)})}if(y.context=D,y.props=P,y.__P=n,y.__e=!1,H=t.__r,R=0,S)y.state=y.__s,y.__d=!1,H&&H(o),m=y.render(y.props,y.state,y.context),d.push.apply(y.__h,y._sb),y._sb=[];else do{y.__d=!1,H&&H(o),m=y.render(y.props,y.state,y.context),y.state=y.__s}while(y.__d&&++R<25);y.state=y.__s,null!=y.getChildContext&&(i=h(h({},i),y.getChildContext())),S&&!C&&null!=y.getSnapshotBeforeUpdate&&(x=y.getSnapshotBeforeUpdate(N,k)),q=null!=m&&m.type===g&&null==m.key?O(m.props.children):m,u=L(n,p(q)?q:[q],o,r,i,l,a,_,u,s,f),y.base=o.__e,o.__u&=-161,y.__h.length&&_.push(y),M&&(y.__E=y.__=null)}catch(U){if(o.__v=null,s||null!=a)if(U.then){for(o.__u|=s?160:128;u&&8==u.nodeType&&u.nextSibling;)u=u.nextSibling;a[a.indexOf(u)]=null,o.__e=u}else{for(W=a.length;W--;)v(a[W]);A(o)}else o.__e=r.__e,o.__k=r.__k,U.then||A(o);t.__e(U,o,r)}else null==a&&o.__v==r.__v?(o.__k=r.__k,o.__e=r.__e):u=o.__e=function(n,o,r,i,l,a,_,u,s){var d,f,h,m,y,g,b,C=r.props||c,N=o.props,k=o.type;if("svg"==k?l="http://www.w3.org/2000/svg":"math"==k?l="http://www.w3.org/1998/Math/MathML":l||(l="http://www.w3.org/1999/xhtml"),null!=a)for(d=0;d<a.length;d++)if((y=a[d])&&"setAttribute"in y==!!k&&(k?y.localName==k:3==y.nodeType)){n=y,a[d]=null;break}if(null==n){if(null==k)return document.createTextNode(N);n=document.createElementNS(l,k,N.is&&N),u&&(t.__m&&t.__m(o,a),u=!1),a=null}if(null==k)C===N||u&&n.data==N||(n.data=N);else{if(a=a&&e.call(n.childNodes),!u&&null!=a)for(C={},d=0;d<n.attributes.length;d++)C[(y=n.attributes[d]).name]=y.value;for(d in C)y=C[d],"dangerouslySetInnerHTML"==d?h=y:"children"==d||d in N||"value"==d&&"defaultValue"in N||"checked"==d&&"defaultChecked"in N||T(n,d,null,y,l);for(d in N)y=N[d],"children"==d?m=y:"dangerouslySetInnerHTML"==d?f=y:"value"==d?g=y:"checked"==d?b=y:u&&"function"!=typeof y||C[d]===y||T(n,d,y,C[d],l);if(f)u||h&&(f.__html==h.__html||f.__html==n.innerHTML)||(n.innerHTML=f.__html),o.__k=[];else if(h&&(n.innerHTML=""),L("template"==o.type?n.content:n,p(m)?m:[m],o,r,i,"foreignObject"==k?"http://www.w3.org/1999/xhtml":l,a,_,a?a[0]:r.__k&&w(r,0),u,s),null!=a)for(d=a.length;d--;)v(a[d]);u||(d="value","progress"==k&&null==g?n.removeAttribute("value"):null!=g&&(g!==n[d]||"progress"==k&&!g||"option"==k&&g!=C[d])&&T(n,d,g,C[d],l),d="checked",null!=b&&b!=n[d]&&T(n,d,b,C[d],l))}return n}(r.__e,o,r,i,l,a,_,s,f);return(m=t.diffed)&&m(o),128&o.__u?void 0:u}function A(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(A))}function R(e,n,o){for(var r=0;r<o.length;r++)q(o[r],o[++r],o[++r]);t.__c&&t.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(o){t.__e(o,n.__v)}})}function O(e){return"object"!=typeof e||null==e||e.__b>0?e:p(e)?e.map(O):h({},e)}function q(e,n,o){try{if("function"==typeof e){var r="function"==typeof e.__u;r&&e.__u(),r&&null==n||(e.__u=e(n))}else e.current=n}catch(i){t.__e(i,o)}}function W(e,n,o){var r,i;if(t.unmount&&t.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||q(r,null,n)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(l){t.__e(l,n)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&W(r[i],n,o||"function"!=typeof e.type);o||v(e.__e),e.__c=e.__=e.__e=void 0}function I(e,t,n){return this.constructor(e,n)}function B(n,o,r){var i,l,a;o==document&&(o=document.documentElement),t.__&&t.__(n,o),i=o.__k,l=[],a=[],H(o,n=o.__k=m(g,null,[n]),i||c,c,o.namespaceURI,i?null:o.firstChild?e.call(o.childNodes):null,l,i?i.__e:o.firstChild,!1,a),R(l,n,a)}e=d.slice,t={__e:function(e,t,n,o){for(var r,i,l;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&null!=i.getDerivedStateFromError&&(r.setState(i.getDerivedStateFromError(e)),l=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),l=r.__d),l)return r.__E=r}catch(a){e=a}throw e}},n=0,b.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=h({},this.state),"function"==typeof e&&(e=e(h({},n),this.props)),e&&h(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),k(this))},b.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),k(this))},b.prototype.render=g,o=[],i="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,l=function(e,t){return e.__v.__b-t.__v.__b},x.__r=0,a=/(PointerCapture)$|Capture$/i,_=0,u=D(!1),s=D(!0);var U=0;function $(e,n,o,r,i,l){n||(n={});var a,_,u=n;if("ref"in u)for(_ in u={},n)"ref"==_?a=n[_]:u[_]=n[_];var s={type:e,props:u,key:o,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--U,__i:-1,__u:0,__source:i,__self:l};if("function"==typeof e&&(a=e.defaultProps))for(_ in a)void 0===u[_]&&(u[_]=a[_]);return t.vnode&&t.vnode(s),s}var F,Z,j,z,V=0,Q=[],X=t,K=X.__b,G=X.__r,J=X.diffed,Y=X.__c,ee=X.unmount,te=X.__;function ne(e,t){X.__h&&X.__h(Z,e,V||t),V=0;var n=Z.__H||(Z.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function oe(e){return V=1,function(e,t){var n=ne(F++,2);if(n.t=e,!n.__c&&(n.__=[fe(void 0,t),function(e){var t=n.__N?n.__N[0]:n.__[0],o=n.t(t,e);t!==o&&(n.__N=[o,n.__[1]],n.__c.setState({}))}],n.__c=Z,!Z.__f)){var o=function(e,t,o){if(!n.__c.__H)return!0;var i=n.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!r||r.call(this,e,t,o);var l=n.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(l=!0)}}),r&&r.call(this,e,t,o)||l};Z.__f=!0;var r=Z.shouldComponentUpdate,i=Z.componentWillUpdate;Z.componentWillUpdate=function(e,t,n){if(this.__e){var l=r;r=void 0,o(e,t,n),r=l}i&&i.call(this,e,t,n)},Z.shouldComponentUpdate=o}return n.__N||n.__}(fe,e)}function re(e,t){var n=ne(F++,3);!X.__s&&de(n.__H,t)&&(n.__=e,n.u=t,Z.__H.__h.push(n))}function ie(e,t){var n=ne(F++,7);return de(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function le(e,t){return V=8,ie(function(){return e},t)}function ae(){for(var e;e=Q.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(se),t.__h.some(ce),t.__h=[]}catch(n){t.__h=[],X.__e(n,e.__v)}}}X.__b=function(e){Z=null,K&&K(e)},X.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),te&&te(e,t)},X.__r=function(e){G&&G(e),F=0;var t=(Z=e.__c).__H;t&&(j===Z?(t.__h=[],Z.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(se),t.__h.some(ce),t.__h=[],F=0)),j=Z},X.diffed=function(e){J&&J(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Q.push(t)&&z===X.requestAnimationFrame||((z=X.requestAnimationFrame)||ue)(ae)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),j=Z=null},X.__c=function(e,t){t.some(function(e){try{e.__h.some(se),e.__h=e.__h.filter(function(e){return!e.__||ce(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],X.__e(n,e.__v)}}),Y&&Y(e,t)},X.unmount=function(e){ee&&ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{se(e)}catch(n){t=n}}),n.__H=void 0,t&&X.__e(t,n.__v))};var _e="function"==typeof requestAnimationFrame;function ue(e){var t,n=function(){clearTimeout(o),_e&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);_e&&(t=requestAnimationFrame(n))}function se(e){var t=Z,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Z=t}function ce(e){var t=Z;e.__c=e.__(),Z=t}function de(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function fe(e,t){return"function"==typeof t?t(e):t}function pe(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function he(e){try{return!((t=e.__)===(n=e.u())&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(o){return!0}var t,n}function ve(e,t){this.props=e,this.context=t}(ve.prototype=new b).isPureReactComponent=!0,ve.prototype.shouldComponentUpdate=function(e,t){return pe(this.props,e)||pe(this.state,t)};var me=t.__b;t.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),me&&me(e)};var ye=t.__e;t.__e=function(e,t,n,o){if(e.then)for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t);ye(e,t,n,o)};var ge=t.unmount;function be(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=function(e,t){for(var n in t)e[n]=t[n];return e}({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return be(e,t,n)})),e}function we(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return we(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Ce(){this.__u=0,this.o=null,this.__b=null}function Ne(e){if(!e.__)return null;var t=e.__.__c;return t&&t.__a&&t.__a(e)}function ke(){this.i=null,this.l=null}t.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),ge&&ge(e)},(Ce.prototype=new b).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=Ne(o.__v),i=!1,l=function(){i||o.__z||(i=!0,n.__R=null,r?r(_):_())};n.__R=l;var a=n.__P;n.__P=null;var _=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=we(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=a,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(l,l)},Ce.prototype.componentWillUnmount=function(){this.o=[]},Ce.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=be(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&m(g,null,e.fallback);return r&&(r.__u&=-33),[m(g,null,t.__a?null:e.children),r]};var xe=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(ke.prototype=new b).__a=function(e){var t=this,n=Ne(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),xe(t,e,o)):r()};n?n(i):i()}},ke.prototype.render=function(e){this.i=null,this.l=new Map;var t=P(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},ke.prototype.componentDidUpdate=ke.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){xe(e,n,t)})};var Le="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Me=/^(?: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]/,Pe=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Se=/[A-Z0-9]/g,Ee="undefined"!=typeof document,Te=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};b.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(b.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var De=t.event;function He(){}function Ae(){return this.cancelBubble}function Re(){return this.defaultPrevented}t.event=function(e){return De&&(e=De(e)),e.persist=He,e.isPropagationStopped=Ae,e.isDefaultPrevented=Re,e.nativeEvent=e};var Oe={enumerable:!1,configurable:!0,get:function(){return this.class}},qe=t.vnode;t.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},r=-1===n.indexOf("-");for(var i in t){var l=t[i];if(!("value"===i&&"defaultValue"in t&&null==l||Ee&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var a=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===l?l="":"translate"===a&&"no"===l?l=!1:"o"===a[0]&&"n"===a[1]?"ondoubleclick"===a?i="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||Te(t.type)?"onfocus"===a?i="onfocusin":"onblur"===a?i="onfocusout":Pe.test(i)&&(i=a):a=i="oninput":r&&Me.test(i)?i=i.replace(Se,"-$&").toLowerCase():null===l&&(l=void 0),"oninput"===a&&o[i=a]&&(i="oninputCapture"),o[i]=l}}"select"==n&&o.multiple&&Array.isArray(o.value)&&(o.value=P(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),"select"==n&&null!=o.defaultValue&&(o.value=P(t.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value})),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",Oe)):t.className&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=Le,qe&&qe(e)};var We=t.__r;t.__r=function(e){We&&We(e),e.__c};var Ie=t.diffed;t.diffed=function(e){Ie&&Ie(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value)};var Be=g;function Ue(e){const t=document.documentElement;t.setAttribute("data-theme",e),t.style.colorScheme=e}const $e="openai:set_globals";function Fe(e){const t=le(t=>{if("undefined"==typeof window)return()=>{};const n=n=>{const o=n;o.detail?.globals&&e in o.detail.globals&&t()};return window.addEventListener($e,n,{passive:!0}),()=>{window.removeEventListener($e,n)}},[e]),n=le(()=>{if("undefined"!=typeof window)return window.openai?.[e]},[e]);return le(()=>{},[]),o=t,i=(r=n)(),l=oe({t:{__:i,u:r}}),a=l[0].t,_=l[1],function(e,t){var n=ne(F++,4);!X.__s&&de(n.__H,t)&&(n.__=e,n.u=t,Z.__h.push(n))}(function(){a.__=i,a.u=r,he(a)&&_({t:a})},[o,i,r]),re(function(){return he(a)&&_({t:a}),o(function(){he(a)&&_({t:a})})},[o]),i;var o,r,i,l,a,_}const Ze="(prefers-color-scheme: dark)";function je(){const e=Fe("theme");var t;re(()=>{if(t)return void Ue(t);const e=()=>{Ue(window.matchMedia?.(Ze).matches?"dark":"light")};e();const n=window.matchMedia?.(Ze);if(!n)return;const o=()=>e();return n.addEventListener?(n.addEventListener("change",o),()=>{n.removeEventListener("change",o)}):(n.addListener?.(o),()=>{n.removeListener?.(o)})},[t="light"===e||"dark"===e?e:void 0])}const ze=e=>$("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:$("path",{d:"M5.29289 12.7071C4.90237 12.3166 4.90237 11.6834 5.29289 11.2929L10.2929 6.29289C10.6834 5.90237 11.3166 5.90237 11.7071 6.29289C12.0976 6.68342 12.0976 7.31658 11.7071 7.70711L8.41421 11H18C18.5523 11 19 11.4477 19 12C19 12.5523 18.5523 13 18 13H8.41421L11.7071 16.2929C12.0976 16.6834 12.0976 17.3166 11.7071 17.7071C11.3166 18.0976 10.6834 18.0976 10.2929 17.7071L5.29289 12.7071Z",fill:"currentColor"})}),Ve=e=>$("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:$("path",{d:"M18.7071 12.7071C19.0976 12.3166 19.0976 11.6834 18.7071 11.2929L13.7071 6.29289C13.3166 5.90237 12.6834 5.90237 12.2929 6.29289C11.9024 6.68342 11.9024 7.31658 12.2929 7.70711L15.5858 11H6C5.44771 11 5 11.4477 5 12C5 12.5523 5.44771 13 6 13H15.5858L12.2929 16.2929C11.9024 16.6834 11.9024 17.3166 12.2929 17.7071C12.6834 18.0976 13.3166 18.0976 13.7071 17.7071L18.7071 12.7071Z",fill:"currentColor"})}),Qe=e=>$("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:$("path",{fillRule:"evenodd",d:"M18.063 5.674a1 1 0 0 1 .263 1.39l-7.5 11a1 1 0 0 1-1.533.143l-4.5-4.5a1 1 0 1 1 1.414-1.414l3.647 3.647 6.82-10.003a1 1 0 0 1 1.39-.263Z",clipRule:"evenodd"})}),Xe=e=>$("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:$("path",{d:"M13 4a1 1 0 1 1 2 0v3.586l4.293-4.293a1 1 0 1 1 1.414 1.414L16.414 9H20a1 1 0 1 1 0 2h-6a1 1 0 0 1-1-1V4ZM3 14a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v6a1 1 0 1 1-2 0v-3.586l-4.293 4.293a1 1 0 0 1-1.414-1.414L7.586 15H4a1 1 0 0 1-1-1Z"})}),Ke=e=>$("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:$("path",{d:"M13 4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v6a1 1 0 1 1-2 0V6.414l-3.793 3.793a1 1 0 0 1-1.414-1.414L17.586 5H14a1 1 0 0 1-1-1Zm-9 9a1 1 0 0 1 1 1v3.586l3.793-3.793a1 1 0 0 1 1.414 1.414L6.414 19H10a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1Z"})}),Ge=e=>$("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:$("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM11.9851 4.00291C11.9744 4.00615 11.953 4.01416 11.921 4.03356C11.7908 4.11248 11.5742 4.32444 11.325 4.77696C11.0839 5.21453 10.8521 5.8046 10.6514 6.53263C10.3148 7.75315 10.0844 9.29169 10.019 11H13.981C13.9156 9.29169 13.6852 7.75315 13.3486 6.53263C13.1479 5.8046 12.9161 5.21453 12.675 4.77696C12.4258 4.32444 12.2092 4.11248 12.079 4.03356C12.047 4.01416 12.0256 4.00615 12.0149 4.00291C12.0067 4.00046 12.001 4.00006 11.9996 4C11.9982 4.00006 11.9933 4.00046 11.9851 4.00291ZM8.01766 11C8.08396 9.13314 8.33431 7.41167 8.72334 6.00094C8.87366 5.45584 9.04762 4.94639 9.24523 4.48694C6.48462 5.49946 4.43722 7.9901 4.06189 11H8.01766ZM4.06189 13H8.01766C8.09487 15.1737 8.42177 17.1555 8.93 18.6802C9.02641 18.9694 9.13134 19.2483 9.24522 19.5131C6.48461 18.5005 4.43722 16.0099 4.06189 13ZM10.019 13C10.0955 14.9972 10.3973 16.7574 10.8274 18.0477C11.0794 18.8038 11.3575 19.3436 11.6177 19.6737C11.7455 19.8359 11.8494 19.9225 11.9186 19.9649C11.9515 19.9852 11.9736 19.9935 11.9847 19.9969C11.9948 20 11.9999 20 11.9999 20C11.9999 20 12.0049 20.0001 12.0153 19.9969C12.0264 19.9935 12.0485 19.9852 12.0814 19.9649C12.1506 19.9225 12.2545 19.8359 12.3823 19.6737C12.6425 19.3436 12.9206 18.8038 13.1726 18.0477C13.6027 16.7574 13.9045 14.9972 13.981 13H10.019ZM15.9823 13C15.9051 15.1737 15.5782 17.1555 15.07 18.6802C14.9736 18.9694 14.8687 19.2483 14.7548 19.5131C17.5154 18.5005 19.5628 16.0099 19.9381 13H15.9823ZM19.9381 11C19.5628 7.99009 17.5154 5.49946 14.7548 4.48694C14.9524 4.94639 15.1263 5.45584 15.2767 6.00094C15.6657 7.41167 15.916 9.13314 15.9823 11H19.9381Z"})}),Je=e=>$("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:$("path",{fillRule:"evenodd",d:"M12 5a1 1 0 0 1 1 1v5h5a1 1 0 1 1 0 2h-5v5a1 1 0 1 1-2 0v-5H6a1 1 0 1 1 0-2h5V6a1 1 0 0 1 1-1Z",clipRule:"evenodd"})});function Ye({onRequestFullscreen:e,displayMode:t}){const n="fullscreen"===t;return $("button",{className:"fullscreen-btn",onClick:e,title:n?"Exit fullscreen":"Enter fullscreen","aria-label":n?"Exit fullscreen":"Enter fullscreen",children:$(n?Xe:Ke,{width:16,height:16})})}function et({direction:e,className:t,disabled:n,...o}){const r="previous"===e,i=r?"Previous":"Next";return $("button",{type:"button",className:`inline-flex h-8 min-w-[88px] items-center justify-center gap-1.5 rounded-full border border-[var(--color-border-secondary-outline)] bg-transparent px-3 text-[13px] font-medium text-[var(--color-text-secondary-outline)] transition-colors duration-150 ease-out ${n?"cursor-not-allowed border-[var(--color-border-disabled)] text-[var(--color-text-disabled)]":"hover:bg-[var(--color-background-secondary-outline-hover)] hover:text-[var(--color-text-secondary-outline-hover)] active:bg-[var(--color-background-secondary-outline-active)]"}${t?` ${t}`:""}`,disabled:n,...o,children:[r&&$(ze,{width:14,height:14}),i,!r&&$(Ve,{width:14,height:14})]})}function tt({size:e,strokeWidth:t}){return $("span",{className:"inline-block animate-spin rounded-full border-solid border-[var(--grid-line-strong)] border-t-[var(--accent)]",style:{width:e,height:e,borderWidth:t},"aria-hidden":"true"})}function nt({variant:e,brandSub:t,query:n,countLabel:o,isInitialLoading:r,loadingQuery:i,error:l,infoBanner:a,hasData:_,isEmpty:u,emptyTitle:s,emptyDescription:c,noResultsTitle:d="No results",noResultsDescription:f="Try a different query.",children:p,pagination:h,context:v,hostContext:m,displayMode:y,requestDisplayMode:g}){const b=m?.safeAreaInsets,w={paddingTop:b?.top,paddingRight:b?.right,paddingBottom:b?.bottom,paddingLeft:b?.left,marginBottom:b?.bottom},C=h?` · Page ${h.pageNumber}`:"",N=v&&v.count>0?` · ${v.count} in context`:"",k=Boolean(h?.isLoading&&_&&!u),x=Boolean(v?.addAllDisabled||k),L=x?"cursor-not-allowed border-[var(--color-border-disabled)] bg-[var(--color-background-disabled)] text-[var(--color-text-disabled)]":"hover:bg-[var(--color-background-secondary-soft-alpha-hover)] active:bg-[var(--color-background-secondary-soft-alpha-active)]";return $("main",{className:`app ${e}-app`,style:w,"data-display-mode":y,children:[$("header",{className:"header",children:[$("div",{className:"brand",children:[$("span",{className:"brand-mark",children:"Brave"}),$("span",{className:"brand-sub",children:t})]}),$("div",{className:"header-right",children:[$("div",{className:"meta",children:[$("div",{className:"term",children:_?n:r&&i?i:`Run brave_${e}_search to see results`}),$("div",{className:"count",children:[_?o:r?"Searching...":"Awaiting tool output",_&&h&&C,N]})]}),$("div",{className:"header-actions",children:[v&&$("button",{type:"button",className:`inline-flex h-8 items-center justify-center rounded-full border border-transparent bg-[var(--color-background-secondary-soft-alpha)] px-3 text-[13px] font-medium text-[var(--color-text-secondary-soft)] transition-colors duration-150 ease-out ${L}`,onClick:v.onAddAll,disabled:x,children:"Add All"}),g&&$(Ye,{onRequestFullscreen:()=>{g&&g("fullscreen"===y?"inline":"fullscreen")},displayMode:y})]})]})]}),l&&$("div",{className:"error-banner",children:[$("strong",{children:"Error:"})," ",l]}),a&&$("div",{className:"info-banner",children:a}),r&&!_&&$("section",{className:"loading-state",children:[$(tt,{size:32,strokeWidth:3}),$("p",{children:["Searching for"," ",$("strong",{children:i||"..."})]})]}),!_&&!r&&$("section",{className:"empty-state",children:[$("h2",{children:s}),$("p",{children:c})]}),_&&u&&!l&&$("section",{className:"empty-state",children:[$("h2",{children:d}),$("p",{children:f})]}),_&&!u&&$("section",{className:"results-region"+(k?" results-region--loading":""),"aria-busy":k,children:[$("div",{className:"results-content"+(k?" results-content--locked":""),inert:k,children:p}),k?$("div",{className:"results-loading-overlay",role:"status","aria-label":"Loading page results",children:$("div",{className:"results-loading-content",children:[$(tt,{size:28,strokeWidth:3}),$("span",{children:"Loading results..."})]})}):null]}),h&&_&&!u&&$("footer",{className:"app-footer",style:void 0,children:$("nav",{className:"pagination","aria-label":"Pagination",children:[$(et,{direction:"previous",onClick:h.onPrevious,disabled:!h.hasPrevious||h.isLoading,"aria-label":"Previous page"}),$("span",{className:"pagination-info",children:h.isLoading?"Loading...":`Page ${h.pageNumber}`}),$(et,{direction:"next",onClick:h.onNext,disabled:!h.hasNext||h.isLoading,"aria-label":"Next page"})]})})]})}const ot=new Set(["strong","em","b","i","u","mark","span","p","br"]),rt=new Set(["script","style","iframe","object","embed","svg","math","template"]),it={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "};function lt(e){return function(e){return e.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g,(e,t)=>{const n=t.toLowerCase();if(n.startsWith("#x")){const t=Number.parseInt(n.slice(2),16);return Number.isNaN(t)?e:String.fromCodePoint(t)}if(n.startsWith("#")){const t=Number.parseInt(n.slice(1),10);return Number.isNaN(t)?e:String.fromCodePoint(t)}return it[n]??e})}(e.replace(/<[^>]*>/g,""))}function at(e,t){if(e.nodeType===Node.TEXT_NODE)return[t.createTextNode(e.textContent??"")];if(e.nodeType!==Node.ELEMENT_NODE)return[];const n=e,o=n.tagName.toLowerCase();if(rt.has(o))return[];if("br"===o)return[t.createElement("br")];const r=Array.from(n.childNodes).flatMap(e=>at(e,t));if(!ot.has(o))return r;const i=t.createElement(o);for(const l of r)i.appendChild(l);return[i]}function _t(e){return e?"undefined"==typeof DOMParser?lt(e):function(e){return(new DOMParser).parseFromString(e,"text/html").body.textContent??""}(e):""}const ut=new Set(["strong","em","b","i","u","mark","span","p"]),st=function(e){function t(e){var t=this.props.ref,n=t==e.ref;return!n&&t&&(t.call?t(null):t.current=null),pe(this.props,e)}function n(n){return this.shouldComponentUpdate=t,m(e,n)}return n.displayName="Memo("+(e.displayName||e.name)+")",n.prototype.isReactComponent=!0,n.__f=!0,n.type=e,n}(function({item:e,index:t,onOpenLink:n,isInContext:o,onToggleContext:r}){const i=ie(()=>{if(!e.description)return null;if("undefined"==typeof window)return _t(e.description);const t=(n=e.description)?"undefined"==typeof DOMParser?lt(n):function(e){const t=(new DOMParser).parseFromString(e,"text/html"),n=t.implementation.createHTMLDocument(""),o=n.createElement("div");for(const r of Array.from(t.body.childNodes))for(const e of at(r,n))o.appendChild(e);return o.innerHTML}(n):"";var n;if(!t)return null;const o=document.createElement("div");o.innerHTML=t;const r=(e,t)=>{if(e.nodeType===Node.TEXT_NODE)return e.textContent;if(e.nodeType!==Node.ELEMENT_NODE)return null;const n=e,o=n.tagName.toLowerCase();return"br"===o?$("br",{},t):ut.has(o)?$("p"===o?"span":o,{children:Array.from(n.childNodes).map((e,n)=>r(e,`${t}-${n}`))},t):n.textContent};return Array.from(o.childNodes).map((e,t)=>r(e,`desc-${t}`))},[e.description]);return $("article",{className:"web-result-shell",children:[$("button",{type:"button",className:"web-result "+(o?"web-result--in-context":""),onClick:()=>{n(e.url)},style:{animationDelay:40*t+"ms"},children:[$("div",{className:"web-result-url-line",children:[e.favicon?$("img",{src:e.favicon,alt:"",className:"web-result-favicon",width:16,height:16}):$(Ge,{width:16,height:16,className:"web-result-favicon-placeholder"}),$("span",{className:"web-result-domain",children:e.domain}),e.age&&$(g,{children:[$("span",{className:"web-result-dot",children:"•"}),$("span",{className:"web-result-age",children:e.age})]})]}),$("h3",{className:"web-result-title",children:_t(e.title)}),$("div",{className:"web-result-description",children:i})]}),r&&$("button",{type:"button",className:"context-btn "+(o?"context-btn--active":""),onClick:t=>{t.stopPropagation(),r&&r(e)},"aria-label":o?"Remove from context":"Add to context",title:o?"In context":"Add to context",children:$(o?Qe:Je,{width:16,height:16})})]})});st.displayName="WebResultCard";const ct=[],dt=[];function ft({toolResult:e,hostContext:t,openLink:n,sendLog:o,displayMode:r,requestDisplayMode:i,onLoadPage:l,isLoading:a,isInitialLoading:_,loadingQuery:u,contextResults:s=ct,onContextChange:c}){const[d,f]=oe(!1),p=a??d,h=(v=s,V=5,ie(function(){return{current:v}},[]));var v;h.current=s;const m=e?._meta?.structuredContent??e?.structuredContent,y=m?.items??dt,g=m?.error,b=Boolean(m),w=m?.offset??0,C=m?.returnedCount??y.length,N=m?.pageSize??m?.count??y.length,k=w>0,x=w<9&&y.length>0,L=Boolean(l)&&b&&!g,M=ie(()=>new Set(s.map(e=>e.url)),[s]),P=Boolean(c),S=le(async e=>{try{const{isError:t}=await n({url:e});t&&await o({level:"warning",data:`Open link rejected: ${e}`})}catch(t){await o({level:"error",data:`Open link failed: ${t instanceof Error?t.message:String(t)}`})}},[n,o]),E=le(async()=>{if(l&&!p&&k){f(!0);try{await l(w-1)}finally{f(!1)}}},[k,p,l,w]),T=le(async()=>{if(l&&!p&&x){f(!0);try{await l(w+1)}finally{f(!1)}}},[x,p,l,w]),D=le(e=>{if(!c)return;const t=h.current;if(t.some(t=>t.url===e.url))c(t.filter(t=>t.url!==e.url));else{const n={title:e.title,url:e.url,description:e.description,domain:e.domain};c([...t,n])}},[c]),H=le(()=>{if(!c)return;const e=h.current,t=new Set(e.map(e=>e.url)),n=y.filter(e=>!t.has(e.url)).map(e=>({title:e.title,url:e.url,description:e.description,domain:e.domain}));0!==n.length&&c([...e,...n])},[y,c]),A=w+1;return $(nt,{variant:"web",brandSub:"Web Search",query:m?.query,countLabel:`${C}/${N} results`,error:g,isInitialLoading:_,loadingQuery:u,hasData:b,isEmpty:0===y.length,emptyTitle:"Web Search",emptyDescription:"Ask to search the web for any topic.",noResultsTitle:"No results",noResultsDescription:"Try a different query or adjust the parameters.",hostContext:t,displayMode:r,requestDisplayMode:i,pagination:L?{pageNumber:A,hasPrevious:k,hasNext:x,isLoading:p,onPrevious:E,onNext:T}:void 0,context:P&&y.length>0?{count:s.length,onAddAll:H,addAllDisabled:y.every(e=>M.has(e.url))}:void 0,children:$("section",{className:"web-results-list",children:y.map((e,t)=>$(st,{item:e,index:t,onOpenLink:S,isInContext:M.has(e.url),onToggleContext:P?D:void 0},e.url))})})}function pt(){je();const e=Fe("toolInput"),t=Fe("toolOutput"),n=Fe("toolResponseMetadata"),o=n?.structuredContent??t?.structuredContent,[r,i]=oe([]),{displayMode:l,hostContext:a,openLink:_,requestDisplayMode:u,noopLog:s,canCallTool:c,canSetWidgetState:d,callTool:f,setWidgetState:p,currentData:h,isLoading:v,setIsLoading:m,setPagedOutput:y}=function({toolInputQuery:e=null,initialData:t=null}={}){const n=Fe("displayMode"),o=Fe("safeArea"),[r,i]=oe(null),[l,a]=oe(!1),_=ie(()=>{const e=o?.insets;return e?{safeAreaInsets:{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}:null},[o]),u=e??t?.query??null,s=r&&u&&r.query===u?r:t;re(()=>{if(r&&u&&r.query!==u){const e=setTimeout(()=>{i(null),a(!1)},0);return()=>clearTimeout(e)}},[u,r]);const c=le(async({url:e})=>{try{return window.openai?.openExternal&&await window.openai.openExternal({href:e}),{isError:!1}}catch{return{isError:!0}}},[]),d=le(async e=>{if(window.openai?.requestDisplayMode)return await window.openai.requestDisplayMode({mode:e}),e},[]),f=le(async()=>{},[]),p=le(async(e,t)=>window.openai?.callTool?window.openai.callTool(e,t):null,[]),h=le(e=>{window.openai?.setWidgetState?.(e)},[]);return{displayMode:n,hostContext:_,openLink:c,requestDisplayMode:d,noopLog:f,canCallTool:Boolean(window.openai?.callTool),canSetWidgetState:Boolean(window.openai?.setWidgetState),canRequestDisplayMode:Boolean(window.openai?.requestDisplayMode),callTool:p,setWidgetState:h,currentData:s,hostQuery:u,isLoading:l,setIsLoading:a,setPagedOutput:i}}({toolInputQuery:e?.query??null,initialData:o}),g=le(async e=>{if(h){m(!0);try{const t=function(e){if(!e||"object"!=typeof e)return null;const t=e;return t.meta?.structuredContent??t._meta?.structuredContent??t.structuredContent??null}(await f("brave_web_search",{query:h.query,count:h.pageSize??h.count??10,offset:e}));t&&y(t)}catch(t){console.error("Failed to load page:",t)}finally{m(!1)}}},[f,h,m,y]),b=le(e=>{i(e),p({modelContent:{selectedResults:e.map((e,t)=>({index:t+1,title:e.title,domain:e.domain,description:e.description,url:e.url})),count:e.length}})},[p]),w=Boolean(h),C=null!==e&&!w,N=e?.query;return $(ft,{toolInputs:null,toolInputsPartial:null,toolResult:h?{structuredContent:h}:null,hostContext:a,openLink:_,sendLog:s,displayMode:l??"inline",requestDisplayMode:u,onLoadPage:c?g:void 0,isLoading:v,isInitialLoading:C,loadingQuery:N,contextResults:r,onContextChange:d?b:void 0})}var ht;(ht=document.getElementById("root"),{render:function(e){var t,n;t=e,null==(n=ht).__k&&(n.textContent=""),B(t,n),t&&t.__c},unmount:function(){var e;(e=ht).__k&&B(null,e)}}).render($(Be,{children:$(pt,{})}));</script> <style rel="stylesheet" crossorigin>@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-font-weight:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;--font-mono:ui-monospace,"SFMono-Regular","SF Mono","Menlo","Monaco","Consolas","Liberation Mono","DejaVu Sans Mono","Courier New",monospace;--spacing:.25rem;--breakpoint-sm:576px;--breakpoint-md:768px;--breakpoint-lg:1024px;--breakpoint-xl:1280px;--breakpoint-2xl:1536px;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--ease-out:cubic-bezier(0,0,.2,1);--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--breakpoint-xs:380px;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-2xs:.125rem;--radius-xs:.25rem;--radius-sm: calc(.5rem - 4px) ;--radius-md: calc(.5rem - 2px) ;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.25rem;--radius-4xl:1.5rem;--radius-full:9999px}:root,:where([data-theme]){--gray-500:#5d5d5d;--alpha-0:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-0:color-mix(in oklab,var(--alpha-base)0%,transparent)}}:root,:where([data-theme]){--alpha-02:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-02:color-mix(in oklab,var(--alpha-base)2%,transparent)}}:root,:where([data-theme]){--alpha-04:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-04:color-mix(in oklab,var(--alpha-base)4%,transparent)}}:root,:where([data-theme]){--alpha-05:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-05:color-mix(in oklab,var(--alpha-base)5%,transparent)}}:root,:where([data-theme]){--alpha-06:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-06:color-mix(in oklab,var(--alpha-base)6%,transparent)}}:root,:where([data-theme]){--alpha-08:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-08:color-mix(in oklab,var(--alpha-base)8%,transparent)}}:root,:where([data-theme]){--alpha-10:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-10:color-mix(in oklab,var(--alpha-base)10%,transparent)}}:root,:where([data-theme]){--alpha-12:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-12:color-mix(in oklab,var(--alpha-base)12%,transparent)}}:root,:where([data-theme]){--alpha-15:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-15:color-mix(in oklab,var(--alpha-base)15%,transparent)}}:root,:where([data-theme]){--alpha-16:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-16:color-mix(in oklab,var(--alpha-base)16%,transparent)}}:root,:where([data-theme]){--alpha-20:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-20:color-mix(in oklab,var(--alpha-base)20%,transparent)}}:root,:where([data-theme]){--alpha-25:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-25:color-mix(in oklab,var(--alpha-base)25%,transparent)}}:root,:where([data-theme]){--alpha-30:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-30:color-mix(in oklab,var(--alpha-base)30%,transparent)}}:root,:where([data-theme]){--alpha-35:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-35:color-mix(in oklab,var(--alpha-base)35%,transparent)}}:root,:where([data-theme]){--alpha-40:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-40:color-mix(in oklab,var(--alpha-base)40%,transparent)}}:root,:where([data-theme]){--alpha-50:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-50:color-mix(in oklab,var(--alpha-base)50%,transparent)}}:root,:where([data-theme]){--alpha-60:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-60:color-mix(in oklab,var(--alpha-base)60%,transparent)}}:root,:where([data-theme]){--alpha-70:var(--alpha-base)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--alpha-70:color-mix(in oklab,var(--alpha-base)70%,transparent)}}:root,:where([data-theme]){--white:#fff;--black:#000;--green-25:#edfaf2;--green-50:#d9f4e4;--green-75:#b8ebcc;--green-100:#8cdfad;--green-200:#66d492;--green-300:#40c977;--green-400:#04b84c;--green-500:#00a240;--green-600:#008635;--green-700:#00692a;--green-800:#004f1f;--green-900:#003716;--green-950:#011c0b;--green-1000:#001207;--green-a25:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a25:color-mix(in oklab,var(--green-400)8%,transparent)}}:root,:where([data-theme]){--green-a50:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a50:color-mix(in oklab,var(--green-400)15%,transparent)}}:root,:where([data-theme]){--green-a75:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a75:color-mix(in oklab,var(--green-400)29%,transparent)}}:root,:where([data-theme]){--green-a100:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a100:color-mix(in oklab,var(--green-400)45%,transparent)}}:root,:where([data-theme]){--green-a200:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a200:color-mix(in oklab,var(--green-400)60%,transparent)}}:root,:where([data-theme]){--green-a300:var(--green-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--green-a300:color-mix(in oklab,var(--green-400)75%,transparent)}}:root,:where([data-theme]){--red-25:#fff0f0;--red-50:#ffd9d9;--red-75:#ffc6c5;--red-100:#ffa4a2;--red-200:#ff8583;--red-300:#ff6764;--red-400:#fa423e;--red-500:#e02e2a;--red-600:#ba2623;--red-700:#911e1b;--red-800:#6e1615;--red-900:#4d100e;--red-950:#280b0a;--red-1000:#1f0909;--red-a25:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a25:color-mix(in oklab,var(--red-400)8%,transparent)}}:root,:where([data-theme]){--red-a50:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a50:color-mix(in oklab,var(--red-400)16%,transparent)}}:root,:where([data-theme]){--red-a75:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a75:color-mix(in oklab,var(--red-400)30%,transparent)}}:root,:where([data-theme]){--red-a100:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a100:color-mix(in oklab,var(--red-400)48%,transparent)}}:root,:where([data-theme]){--red-a200:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a200:color-mix(in oklab,var(--red-400)64%,transparent)}}:root,:where([data-theme]){--red-a300:var(--red-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--red-a300:color-mix(in oklab,var(--red-400)79%,transparent)}}:root,:where([data-theme]){--pink-25:#fff4f9;--pink-50:#ffe8f3;--pink-75:#ffd4e8;--pink-100:#ffbada;--pink-200:#ffa3ce;--pink-300:#ff8cc1;--pink-400:#ff66ad;--pink-500:#e04c91;--pink-600:#ba437a;--pink-700:#963c67;--pink-800:#6e2c4a;--pink-900:#4d1f34;--pink-950:#29101c;--pink-1000:#1a0a11;--pink-a25:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a25:color-mix(in oklab,var(--pink-400)8%,transparent)}}:root,:where([data-theme]){--pink-a50:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a50:color-mix(in oklab,var(--pink-400)16%,transparent)}}:root,:where([data-theme]){--pink-a75:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a75:color-mix(in oklab,var(--pink-400)28%,transparent)}}:root,:where([data-theme]){--pink-a100:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a100:color-mix(in oklab,var(--pink-400)45%,transparent)}}:root,:where([data-theme]){--pink-a200:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a200:color-mix(in oklab,var(--pink-400)60%,transparent)}}:root,:where([data-theme]){--pink-a300:var(--pink-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--pink-a300:color-mix(in oklab,var(--pink-400)76%,transparent)}}:root,:where([data-theme]){--orange-25:#fff5f0;--orange-50:#ffe7d9;--orange-75:#ffcfb4;--orange-100:#ffb790;--orange-200:#ff9e6c;--orange-300:#ff8549;--orange-400:#fb6a22;--orange-500:#e25507;--orange-600:#b9480d;--orange-700:#923b0f;--orange-800:#6d2e0f;--orange-900:#4a2206;--orange-950:#281105;--orange-1000:#211107;--orange-a25:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a25:color-mix(in oklab,var(--orange-400)7%,transparent)}}:root,:where([data-theme]){--orange-a50:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a50:color-mix(in oklab,var(--orange-400)16%,transparent)}}:root,:where([data-theme]){--orange-a75:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a75:color-mix(in oklab,var(--orange-400)33%,transparent)}}:root,:where([data-theme]){--orange-a100:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a100:color-mix(in oklab,var(--orange-400)48%,transparent)}}:root,:where([data-theme]){--orange-a200:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a200:color-mix(in oklab,var(--orange-400)65%,transparent)}}:root,:where([data-theme]){--orange-a300:var(--orange-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--orange-a300:color-mix(in oklab,var(--orange-400)81%,transparent)}}:root,:where([data-theme]){--yellow-25:#fffbed;--yellow-50:#fff6d9;--yellow-75:#ffeeb8;--yellow-100:#ffe48c;--yellow-200:#ffdb66;--yellow-300:#ffd240;--yellow-400:#ffc300;--yellow-500:#e0ac00;--yellow-600:#ba8e00;--yellow-700:#916f00;--yellow-800:#6e5400;--yellow-900:#4d3b00;--yellow-950:#261d00;--yellow-1000:#1a1400;--yellow-a25:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a25:color-mix(in oklab,var(--yellow-400)8%,transparent)}}:root,:where([data-theme]){--yellow-a50:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a50:color-mix(in oklab,var(--yellow-400)15%,transparent)}}:root,:where([data-theme]){--yellow-a75:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a75:color-mix(in oklab,var(--yellow-400)27%,transparent)}}:root,:where([data-theme]){--yellow-a100:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a100:color-mix(in oklab,var(--yellow-400)45%,transparent)}}:root,:where([data-theme]){--yellow-a200:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a200:color-mix(in oklab,var(--yellow-400)59%,transparent)}}:root,:where([data-theme]){--yellow-a300:var(--yellow-400)}@supports (color:color-mix(in lab,red,red)){:root,:where([data-theme]){--yellow-a300:color-mix(in oklab,var(--yellow-400)74%