@dabalabs/agent 0.0.2-beta → 0.0.4-beta

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.
Files changed (40) hide show
  1. package/README.md +56 -3
  2. package/dist/chunk-3BQ6LE6X.cjs +222 -0
  3. package/dist/chunk-3BQ6LE6X.cjs.map +1 -0
  4. package/dist/{chunk-CMHPVBEF.js → chunk-ETI4LRM7.js} +841 -100
  5. package/dist/chunk-ETI4LRM7.js.map +1 -0
  6. package/dist/chunk-TYOHYQDK.js +220 -0
  7. package/dist/chunk-TYOHYQDK.js.map +1 -0
  8. package/dist/{chunk-IMPMGYCG.cjs → chunk-VAIC5ACS.cjs} +841 -99
  9. package/dist/chunk-VAIC5ACS.cjs.map +1 -0
  10. package/dist/custom-element.cjs +4 -4
  11. package/dist/custom-element.d.cts +191 -2
  12. package/dist/custom-element.d.ts +191 -2
  13. package/dist/custom-element.js +2 -2
  14. package/dist/daba-agent.cjs +5 -14
  15. package/dist/daba-agent.d.cts +2 -4
  16. package/dist/daba-agent.d.ts +2 -4
  17. package/dist/daba-agent.js +2 -3
  18. package/dist/daba-agent.min.js +141 -36
  19. package/dist/daba-agent.min.js.map +1 -1
  20. package/dist/react.cjs +41 -14
  21. package/dist/react.cjs.map +1 -1
  22. package/dist/react.d.cts +1 -1
  23. package/dist/react.d.ts +1 -1
  24. package/dist/react.js +38 -2
  25. package/dist/react.js.map +1 -1
  26. package/dist/{types-hdR_wQ1B.d.cts → types-BQRgqD4n.d.cts} +70 -4
  27. package/dist/{types-hdR_wQ1B.d.ts → types-BQRgqD4n.d.ts} +70 -4
  28. package/package.json +1 -1
  29. package/dist/chunk-7ENX2QZK.js +0 -193
  30. package/dist/chunk-7ENX2QZK.js.map +0 -1
  31. package/dist/chunk-CMHPVBEF.js.map +0 -1
  32. package/dist/chunk-GCU5OBSZ.js +0 -40
  33. package/dist/chunk-GCU5OBSZ.js.map +0 -1
  34. package/dist/chunk-HJPH4GNS.cjs +0 -196
  35. package/dist/chunk-HJPH4GNS.cjs.map +0 -1
  36. package/dist/chunk-IMPMGYCG.cjs.map +0 -1
  37. package/dist/chunk-JQMJMSFT.cjs +0 -46
  38. package/dist/chunk-JQMJMSFT.cjs.map +0 -1
  39. package/dist/custom-element-BZAUI4Dc.d.cts +0 -121
  40. package/dist/custom-element-PL2IXpG2.d.ts +0 -121
@@ -1,10 +1,10 @@
1
- var DabaAgentModule=(function(exports){'use strict';var La=Object.create;var ot=Object.defineProperty;var Aa=Object.getOwnPropertyDescriptor;var Da=Object.getOwnPropertyNames;var Ma=Object.getPrototypeOf,Ia=Object.prototype.hasOwnProperty;var it=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Ha=(t,e,a,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Da(e))!Ia.call(t,r)&&r!==a&&ot(t,r,{get:()=>e[r],enumerable:!(n=Aa(e,r))||n.enumerable});return t};var Ra=(t,e,a)=>(a=t!=null?La(Ma(t)):{},Ha(ot(a,"default",{value:t,enumerable:true}),t));var wa=it(u=>{var de=Symbol.for("react.element"),br=Symbol.for("react.portal"),hr=Symbol.for("react.fragment"),mr=Symbol.for("react.strict_mode"),fr=Symbol.for("react.profiler"),vr=Symbol.for("react.provider"),xr=Symbol.for("react.context"),wr=Symbol.for("react.forward_ref"),yr=Symbol.for("react.suspense"),kr=Symbol.for("react.memo"),_r=Symbol.for("react.lazy"),la=Symbol.iterator;function Cr(t){return t===null||typeof t!="object"?null:(t=la&&t[la]||t["@@iterator"],typeof t=="function"?t:null)}var pa={isMounted:function(){return false},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ua=Object.assign,ba={};function ae(t,e,a){this.props=t,this.context=e,this.refs=ba,this.updater=a||pa;}ae.prototype.isReactComponent={};ae.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState");};ae.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate");};function ha(){}ha.prototype=ae.prototype;function qe(t,e,a){this.props=t,this.context=e,this.refs=ba,this.updater=a||pa;}var Ye=qe.prototype=new ha;Ye.constructor=qe;ua(Ye,ae.prototype);Ye.isPureReactComponent=true;var ca=Array.isArray,ma=Object.prototype.hasOwnProperty,Ze={current:null},fa={key:true,ref:true,__self:true,__source:true};function va(t,e,a){var n,r={},o=null,i=null;if(e!=null)for(n in e.ref!==void 0&&(i=e.ref),e.key!==void 0&&(o=""+e.key),e)ma.call(e,n)&&!fa.hasOwnProperty(n)&&(r[n]=e[n]);var s=arguments.length-2;if(s===1)r.children=a;else if(1<s){for(var d=Array(s),l=0;l<s;l++)d[l]=arguments[l+2];r.children=d;}if(t&&t.defaultProps)for(n in s=t.defaultProps,s)r[n]===void 0&&(r[n]=s[n]);return {$$typeof:de,type:t,key:o,ref:i,props:r,_owner:Ze.current}}function Er(t,e){return {$$typeof:de,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Je(t){return typeof t=="object"&&t!==null&&t.$$typeof===de}function Tr(t){var e={"=":"=0",":":"=2"};return "$"+t.replace(/[=:]/g,function(a){return e[a]})}var ga=/\/+/g;function Ke(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Tr(""+t.key):e.toString(36)}function _e(t,e,a,n,r){var o=typeof t;(o==="undefined"||o==="boolean")&&(t=null);var i=false;if(t===null)i=true;else switch(o){case "string":case "number":i=true;break;case "object":switch(t.$$typeof){case de:case br:i=true;}}if(i)return i=t,r=r(i),t=n===""?"."+Ke(i,0):n,ca(r)?(a="",t!=null&&(a=t.replace(ga,"$&/")+"/"),_e(r,e,a,"",function(l){return l})):r!=null&&(Je(r)&&(r=Er(r,a+(!r.key||i&&i.key===r.key?"":(""+r.key).replace(ga,"$&/")+"/")+t)),e.push(r)),1;if(i=0,n=n===""?".":n+":",ca(t))for(var s=0;s<t.length;s++){o=t[s];var d=n+Ke(o,s);i+=_e(o,e,a,d,r);}else if(d=Cr(t),typeof d=="function")for(t=d.call(t),s=0;!(o=t.next()).done;)o=o.value,d=n+Ke(o,s++),i+=_e(o,e,a,d,r);else if(o==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return i}function ke(t,e,a){if(t==null)return t;var n=[],r=0;return _e(t,n,"","",function(o){return e.call(a,o,r++)}),n}function Sr(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(a){(t._status===0||t._status===-1)&&(t._status=1,t._result=a);},function(a){(t._status===0||t._status===-1)&&(t._status=2,t._result=a);}),t._status===-1&&(t._status=0,t._result=e);}if(t._status===1)return t._result.default;throw t._result}var T={current:null},Ce={transition:null},Lr={ReactCurrentDispatcher:T,ReactCurrentBatchConfig:Ce,ReactCurrentOwner:Ze};function xa(){throw Error("act(...) is not supported in production builds of React.")}u.Children={map:ke,forEach:function(t,e,a){ke(t,function(){e.apply(this,arguments);},a);},count:function(t){var e=0;return ke(t,function(){e++;}),e},toArray:function(t){return ke(t,function(e){return e})||[]},only:function(t){if(!Je(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};u.Component=ae;u.Fragment=hr;u.Profiler=fr;u.PureComponent=qe;u.StrictMode=mr;u.Suspense=yr;u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Lr;u.act=xa;u.cloneElement=function(t,e,a){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=ua({},t.props),r=t.key,o=t.ref,i=t._owner;if(e!=null){if(e.ref!==void 0&&(o=e.ref,i=Ze.current),e.key!==void 0&&(r=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(d in e)ma.call(e,d)&&!fa.hasOwnProperty(d)&&(n[d]=e[d]===void 0&&s!==void 0?s[d]:e[d]);}var d=arguments.length-2;if(d===1)n.children=a;else if(1<d){s=Array(d);for(var l=0;l<d;l++)s[l]=arguments[l+2];n.children=s;}return {$$typeof:de,type:t.type,key:r,ref:o,props:n,_owner:i}};u.createContext=function(t){return t={$$typeof:xr,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:vr,_context:t},t.Consumer=t};u.createElement=va;u.createFactory=function(t){var e=va.bind(null,t);return e.type=t,e};u.createRef=function(){return {current:null}};u.forwardRef=function(t){return {$$typeof:wr,render:t}};u.isValidElement=Je;u.lazy=function(t){return {$$typeof:_r,_payload:{_status:-1,_result:t},_init:Sr}};u.memo=function(t,e){return {$$typeof:kr,type:t,compare:e===void 0?null:e}};u.startTransition=function(t){var e=Ce.transition;Ce.transition={};try{t();}finally{Ce.transition=e;}};u.unstable_act=xa;u.useCallback=function(t,e){return T.current.useCallback(t,e)};u.useContext=function(t){return T.current.useContext(t)};u.useDebugValue=function(){};u.useDeferredValue=function(t){return T.current.useDeferredValue(t)};u.useEffect=function(t,e){return T.current.useEffect(t,e)};u.useId=function(){return T.current.useId()};u.useImperativeHandle=function(t,e,a){return T.current.useImperativeHandle(t,e,a)};u.useInsertionEffect=function(t,e){return T.current.useInsertionEffect(t,e)};u.useLayoutEffect=function(t,e){return T.current.useLayoutEffect(t,e)};u.useMemo=function(t,e){return T.current.useMemo(t,e)};u.useReducer=function(t,e,a){return T.current.useReducer(t,e,a)};u.useRef=function(t){return T.current.useRef(t)};u.useState=function(t){return T.current.useState(t)};u.useSyncExternalStore=function(t,e,a){return T.current.useSyncExternalStore(t,e,a)};u.useTransition=function(){return T.current.useTransition()};u.version="18.3.1";});var ka=it((_o,ya)=>{ya.exports=wa();});var O=class extends Error{constructor(e,a){super(e.message),this.dabaError=e,this.cause=a;}};function pe(){if(typeof window>"u")return false;let t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t==="[::1]"||t.endsWith(".local")||t.endsWith(".test")}function Na(t){return t===401?"invalid_key":t===403?"origin_not_allowed":t===404?"not_found":"network"}function Oa(t,e){if(e&&e!=="Unauthorized"&&e!=="Not Found")return e;switch(t){case 401:return pe()?"Invalid API key (401). Check your apiKey or data-api-key attribute.":"Invalid API key. Please check your agent configuration.";case 403:return pe()?"Origin not allowed for this API key (403). Verify allowed origins in dashboard.":"Origin not allowed for this API key. Verify allowed origins in dashboard.";case 404:return pe()?"Agent project not found (404). Check your projectId or data-project-id attribute.":"Agent project not found. Please check your Project ID.";default:return "Assistant is temporarily unavailable. Please try again or contact support."}}function ue(t){return pe()?`Could not reach gateway at ${t}. Verify network connection and gateway URL.`:"Assistant is temporarily unavailable. Please try again or contact support."}async function be(t){if(!t.ok){let e=await t.json().catch(()=>({error:null})),a={kind:Na(t.status),message:Oa(t.status,e.error)};throw new O(a)}return await t.json()}function Y(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function b(t){if(typeof t!="string")return null;let e=t.trim();return e===""?null:e}function J(t,e,a){let n=b(t);return n!==null&&e.includes(n)?n:a}function Pa(t,e){let a=b(t);return a!==null&&e.includes(a)?a:null}function za(t,e){if(typeof t=="boolean")return t;let a=b(t)?.toLowerCase();return a==="true"?true:a==="false"?false:e}function $a(t){if(!Array.isArray(t))return [];let e=[];for(let a of t){let n=b(a);n!==null&&e.push(n);}return e}var Ua=["voice","chat","hybrid"],Va=["rounded","circle","pill"],Ba=["bottom-right","bottom-left","top-right","top-left"],ja=["auto","light","dark"],Fa=["auto","ltr","rtl"],Ga=["video","image","none"];function Wa(t,e){let a=Y(e),n=Y(a.appearance),r=Y(a.intro),o=Y(a.locale);return {projectId:b(a.project_id)??t,title:b(a.title)??"",greetingMessage:b(a.greeting_message),mode:J(a.mode,Ua,"hybrid"),appearance:{accentColor:b(n.accent_color),accentContrast:b(n.accent_contrast),surfaceColor:b(n.surface_color),textColor:b(n.text_color),radius:b(n.radius),fontFamily:b(n.font_family),logoUrl:b(n.logo_url),launcherIconUrl:b(n.launcher_icon_url),launcherLabel:b(n.launcher_label),launcherShape:J(n.launcher_shape,Va,"rounded"),position:Pa(n.position,Ba),theme:J(n.theme,ja,"auto")},intro:{enabled:za(r.enabled,true),headline:b(r.headline),subheadline:b(r.subheadline),mediaUrl:b(r.media_url),mediaType:J(r.media_type,Ga,"none"),suggestedPrompts:$a(r.suggested_prompts)},locale:{uiLanguage:b(o.ui_language)??"auto",direction:J(o.direction,Fa,"auto")}}}async function st(t,e,a){let n=t.replace(/\/+$/,""),r=`${n}/v1/public/agents/${encodeURIComponent(e)}?key=${encodeURIComponent(a)}`,o;try{o=await fetch(r,{method:"GET"});}catch(s){let d={kind:"network",message:ue(n)};throw new O(d,s)}let i=await be(o);return Wa(e,i)}async function dt(t,e,a,n){let r=t.replace(/\/+$/,""),o=`${r}/v1/public/agents/${encodeURIComponent(e)}/sessions?key=${encodeURIComponent(a)}`,i;try{i=await fetch(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`page_context=${encodeURIComponent(n)}`});}catch(d){let l={kind:"network",message:ue(r)};throw new O(l,d)}let s=await be(i);return {sessionId:s.session_id,wsUrl:s.ws_url}}async function lt(t,e,a,n,r){let o=t.replace(/\/+$/,""),i=`${o}/v1/public/agents/${encodeURIComponent(e)}/live-sessions?key=${encodeURIComponent(a)}`,s=new URLSearchParams({page_context:n,sdp:r}),d;try{d=await fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s.toString()});}catch(f){let v={kind:"network",message:ue(o)};throw new O(v,f)}let l=await be(d);return {sdp:l.sdp,model:l.model}}var Ka=["article","event","news","page","contact","action"];function qa(t){if(!Array.isArray(t))return [];let e=[];for(let a of t){let n=Y(a),r=b(n.label),o=b(n.value);r===null||o===null||e.push({label:r,value:o});}return e}function Ya(t){if(!Array.isArray(t))return [];let e=[];for(let a of t){let n=Y(a),r=b(n.title);r!==null&&e.push({kind:J(n.kind,Ka,"page"),title:r,summary:b(n.summary),date:b(n.date),endDate:b(n.end_date),locationName:b(n.location_name),address:b(n.address),mapUrl:b(n.map_url),url:b(n.url),imageUrl:b(n.image_url),sourcePath:b(n.source_path),meta:qa(n.meta)});}return e}async function ct(t,e,a,n){let r=t.replace(/\/+$/,""),o=`${r}/v1/public/agents/${encodeURIComponent(e)}/chat?key=${encodeURIComponent(a)}`,i=new URLSearchParams;i.set("message",n.message),i.set("conversation_id",n.conversationId),n.pageContext&&i.set("page_context",n.pageContext),n.uiLanguage&&i.set("ui_language",n.uiLanguage),n.reset&&i.set("reset","true");let s;try{s=await fetch(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i});}catch(f){let v={kind:"network",message:ue(r)};throw new O(v,f)}let d=await be(s),l=Y(d);return {reply:b(l.reply)??"",language:b(l.language)??"",cards:Ya(l.cards),suggestions:Array.isArray(l.suggestions)?l.suggestions.filter(f=>typeof f=="string"&&f.trim().length>0).map(f=>f.trim().slice(0,120)).slice(0,4):[],conversationId:b(l.conversation_id)??n.conversationId}}var Za="oai-events",Ja=2e3,he=class{constructor(e){this.options=e;this.pc=null;this.channel=null;this.micStream=null;this.audioEl=null;this.stopped=false;}get isActive(){return this.pc!==null&&!this.stopped}async start(e){if(this.pc)return;this.stopped=false,this.options.handlers.onStatus("connecting");try{this.micStream=await navigator.mediaDevices.getUserMedia({audio:!0});}catch{this.options.handlers.onError({kind:"network",message:"Microphone access was denied or unavailable."});return}let a=new RTCPeerConnection;this.pc=a;for(let r of this.micStream.getAudioTracks())a.addTrack(r,this.micStream);this.audioEl=document.createElement("audio"),this.audioEl.autoplay=true,a.ontrack=r=>{this.audioEl&&(this.audioEl.srcObject=r.streams[0]??null);};let n=a.createDataChannel(Za);this.channel=n,n.onmessage=r=>this.onChannelMessage(r),n.onopen=()=>this.options.handlers.onStatus("listening"),a.onconnectionstatechange=()=>{(a.connectionState==="failed"||a.connectionState==="closed")&&(this.teardown(),this.options.handlers.onClosed());};try{let r=await a.createOffer();await a.setLocalDescription(r),await this.waitForIceGathering(a);let{sdp:o}=await lt(this.options.gatewayUrl,this.options.projectId,this.options.apiKey,e,a.localDescription?.sdp??r.sdp??"");await a.setRemoteDescription({type:"answer",sdp:o});}catch(r){this.teardown();let o=r;this.options.handlers.onError(o?.dabaError??{kind:"network",message:"Failed to start the voice session."}),this.options.handlers.onClosed();}}sendToolResult(e,a){!this.channel||this.channel.readyState!=="open"||(this.send({type:"response.item.create",item:{type:"function_call_output",call_id:e,output:JSON.stringify(a)}}),this.send({type:"response.create"}));}stop(){this.teardown(),this.options.handlers.onClosed();}send(e){!this.channel||this.channel.readyState!=="open"||this.channel.send(JSON.stringify(e));}waitForIceGathering(e){return e.iceGatheringState==="complete"?Promise.resolve():new Promise(a=>{let n=()=>{e.iceGatheringState==="complete"&&(e.removeEventListener("icegatheringstatechange",n),a());};e.addEventListener("icegatheringstatechange",n),window.setTimeout(()=>{e.removeEventListener("icegatheringstatechange",n),a();},Ja);})}onChannelMessage(e){if(typeof e.data!="string")return;let a;try{a=JSON.parse(e.data);}catch{return}let{handlers:n}=this.options;switch(a.type){case "session.input_transcript.delta":this.emitTranscript("user",a,false);break;case "session.input_transcript.done":this.emitTranscript("user",a,true);break;case "session.output_transcript.delta":n.onStatus("speaking"),this.emitTranscript("agent",a,false);break;case "session.output_transcript.done":this.emitTranscript("agent",a,true),n.onStatus("listening");break;case "response.output_item.done":this.emitToolCall(a);break;case "error":{let r=a.error;n.onError({kind:"network",message:r?.message??"Voice session error."});break}}}emitTranscript(e,a,n){let r=a.delta??a.transcript??a.text;!r&&!n||this.options.handlers.onTranscript(e,r??"",n);}emitToolCall(e){let a=e.item;if(!a||a.type!=="function_call")return;let n=a.call_id,r=a.name;!n||!r||this.options.handlers.onToolCall({callId:n,name:r,args:a.arguments??"{}"});}teardown(){this.stopped||(this.stopped=true,this.channel?.close(),this.channel=null,this.micStream?.getTracks().forEach(e=>e.stop()),this.micStream=null,this.audioEl&&(this.audioEl.srcObject=null,this.audioEl=null),this.pc?.close(),this.pc=null);}};var Ie={production:"https://api.dabalabs.com",staging:"https://api-staging.dabalabs.com"};function oe(t,e){if(t)return t;if(e==null||e==="")return Ie.production;let a=String(e).trim().toLowerCase();return a==="staging"?Ie.staging:(a!=="production"&&console.warn(`[daba-agent] unknown env "${e}" \u2014 falling back to production. Use env: "staging" for the staging gateway, or pass an explicit gatewayUrl.`),Ie.production)}function gt(){return typeof document>"u"?false:document.documentElement.hasAttribute("data-daba-agent-restricted")||document.querySelector('meta[name="daba-agent-restricted"]')!==null}function X(t){return t.replace(/\s+/g," ").trim()}var Xa='[data-daba-agent-ignore], input[type="password"], input[type="hidden"], [autocomplete="current-password"], [autocomplete="new-password"], [autocomplete^="cc-"]';function He(t){return t.closest(Xa)!==null}var Qa=[/\bdpk_live_[A-Za-z0-9_-]{10,}/g,/\b(?:sk|pk|rk)_(?:live|test)_[A-Za-z0-9]{10,}/g,/\bsk-[A-Za-z0-9]{10,}/g,/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g,/\b\d[\d -]{11,22}\d\b/g];function en(t){let e=t;for(let a of Qa)e=e.replace(a,"[redacted]");return e}function tn(){let t=document.body;if(!t)return "";let e=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(r){let o=r.parentElement;if(!o)return NodeFilter.FILTER_REJECT;let i=o.tagName;if(i==="SCRIPT"||i==="STYLE"||i==="NOSCRIPT"||He(o))return NodeFilter.FILTER_REJECT;let s=window.getComputedStyle(o);return s.display==="none"||s.visibility==="hidden"?NodeFilter.FILTER_REJECT:r.textContent&&r.textContent.trim()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),a=[],n=0;for(;e.nextNode();){let r=X(e.currentNode.textContent??"");if(r&&(a.push(r),n+=r.length,n>=4e3))break}return en(a.join(" ")).slice(0,4e3)}function an(){let t=Array.from(document.querySelectorAll("a[href]")),e=new Set,a=[],n=[];for(let r of t){if(He(r))continue;let o=X(r.textContent??""),i=r.getAttribute("href")??"";if(!o||!i||i.startsWith("#")||i.startsWith("javascript:"))continue;let s=`${o}|${i}`;if(e.has(s))continue;e.add(s);let d=`"${o}" -> ${i}`;r.closest("nav, header, footer")?n.push(d):a.push(d);}return [...a,...n].slice(0,100)}function nn(t){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(t):t.replace(/[^a-zA-Z0-9_-]/g,"\\$&")}function rn(t){let e=t.getAttribute("id");if(e){let i=document.querySelector(`label[for="${nn(e)}"]`);if(i&&i.textContent)return X(i.textContent)}let a=t.closest("label");if(a&&a.textContent)return X(a.textContent);let n=t.getAttribute("aria-label");if(n)return X(n);let r=t.getAttribute("placeholder");if(r)return X(r);let o=t.getAttribute("name");return o||""}function on(){let t=Array.from(document.querySelectorAll("form input, form textarea, form select")),e=[];for(let a of t){if(He(a))continue;let n=a.type??a.tagName.toLowerCase();if(n==="hidden"||n==="submit"||n==="button")continue;let r=rn(a);if(r&&(e.push(`${r} (${n})`),e.length>=30))break}return e}function ie(){let t=[];t.push(`Page title: ${document.title||"(untitled)"}`),t.push(`URL: ${window.location.href}`);let e=tn();e&&t.push(`Visible text: ${e}`);let a=an();a.length>0&&t.push(`Links on this page:
2
- ${a.join(`
3
- `)}`);let n=on();return n.length>0&&t.push(`Form fields on this page (use fill_form_field with the exact label text shown here):
1
+ var DabaAgentModule=(function(exports){'use strict';var O=class extends Error{constructor(e,t){super(e.message),this.dabaError=e,this.cause=t;}};function Ce(){if(typeof window>"u")return false;let a=window.location.hostname;return a==="localhost"||a==="127.0.0.1"||a==="[::1]"||a.endsWith(".local")||a.endsWith(".test")}function Ra(a){return a===401?"invalid_key":a===403?"origin_not_allowed":a===404?"not_found":"network"}function za(a,e){if(e&&e!=="Unauthorized"&&e!=="Not Found")return e;switch(a){case 401:return Ce()?"Invalid API key (401). Check your apiKey or data-api-key attribute.":"Invalid API key. Please check your agent configuration.";case 403:return Ce()?"Origin not allowed for this API key (403). Verify allowed origins in dashboard.":"Origin not allowed for this API key. Verify allowed origins in dashboard.";case 404:return Ce()?"Agent project not found (404). Check your projectId or data-project-id attribute.":"Agent project not found. Please check your Project ID.";default:return "Assistant is temporarily unavailable. Please try again or contact support."}}function Ee(a){return Ce()?`Could not reach gateway at ${a}. Verify network connection and gateway URL.`:"Assistant is temporarily unavailable. Please try again or contact support."}async function Te(a){if(!a.ok){let e=await a.json().catch(()=>({error:null})),t={kind:Ra(a.status),message:za(a.status,e.error)};throw new O(t)}return await a.json()}function q(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)?a:{}}function u(a){if(typeof a!="string")return null;let e=a.trim();return e===""?null:e}function ae(a,e,t){let n=u(a);return n!==null&&e.includes(n)?n:t}function Ba(a,e){let t=u(a);return t!==null&&e.includes(t)?t:null}function Ua(a,e){if(typeof a=="boolean")return a;let t=u(a)?.toLowerCase();return t==="true"?true:t==="false"?false:e}function $a(a){if(!Array.isArray(a))return [];let e=[];for(let t of a){let n=u(t);n!==null&&e.push(n);}return e}var Va=["voice","chat","hybrid"],ja=["rounded","circle","pill"],Fa=["bottom-right","bottom-left","top-right","top-left"],Ga=["auto","light","dark"],Wa=["auto","ltr","rtl"],Ka=["video","image","none"];function qa(a,e){let t=q(e),n=q(t.appearance),r=q(t.intro),i=q(t.locale);return {projectId:u(t.project_id)??a,title:u(t.title)??"",greetingMessage:u(t.greeting_message),mode:ae(t.mode,Va,"hybrid"),appearance:{accentColor:u(n.accent_color),accentContrast:u(n.accent_contrast),surfaceColor:u(n.surface_color),textColor:u(n.text_color),radius:u(n.radius),fontFamily:u(n.font_family),logoUrl:u(n.logo_url),launcherIconUrl:u(n.launcher_icon_url),launcherLabel:u(n.launcher_label),launcherShape:ae(n.launcher_shape,ja,"rounded"),position:Ba(n.position,Fa),theme:ae(n.theme,Ga,"auto")},intro:{enabled:Ua(r.enabled,true),headline:u(r.headline),subheadline:u(r.subheadline),mediaUrl:u(r.media_url),mediaType:ae(r.media_type,Ka,"none"),suggestedPrompts:$a(r.suggested_prompts)},locale:{uiLanguage:u(i.ui_language)??"auto",direction:ae(i.direction,Wa,"auto")}}}async function wt(a,e,t){let n=a.replace(/\/+$/,""),r=`${n}/v1/public/agents/${encodeURIComponent(e)}?key=${encodeURIComponent(t)}`,i;try{i=await fetch(r,{method:"GET"});}catch(s){let c={kind:"network",message:Ee(n)};throw new O(c,s)}let o=await Te(i);return qa(e,o)}async function kt(a,e,t,n){let r=a.replace(/\/+$/,""),i=`${r}/v1/public/agents/${encodeURIComponent(e)}/sessions?key=${encodeURIComponent(t)}`,o;try{o=await fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`page_context=${encodeURIComponent(n)}`});}catch(c){let d={kind:"network",message:Ee(r)};throw new O(d,c)}let s=await Te(o);return {sessionId:s.session_id,wsUrl:s.ws_url}}async function _t(a,e,t,n,r){let i=a.replace(/\/+$/,""),o=`${i}/v1/public/agents/${encodeURIComponent(e)}/live-sessions?key=${encodeURIComponent(t)}`,s=new URLSearchParams({page_context:n,sdp:r}),c;try{c=await fetch(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s.toString()});}catch(f){let b={kind:"network",message:Ee(i)};throw new O(b,f)}let d=await Te(c);return {sdp:d.sdp,model:d.model}}var Ya=["article","event","news","page","contact","action"];function Za(a){if(!Array.isArray(a))return [];let e=[];for(let t of a){let n=q(t),r=u(n.label),i=u(n.value);r===null||i===null||e.push({label:r,value:i});}return e}function Xa(a){if(!Array.isArray(a))return [];let e=[];for(let t of a){let n=q(t),r=u(n.title);r!==null&&e.push({kind:ae(n.kind,Ya,"page"),title:r,summary:u(n.summary),date:u(n.date),endDate:u(n.end_date),locationName:u(n.location_name),address:u(n.address),mapUrl:u(n.map_url),url:u(n.url),imageUrl:u(n.image_url),sourcePath:u(n.source_path),meta:Za(n.meta)});}return e}async function Ct(a,e,t,n){let r=a.replace(/\/+$/,""),i=`${r}/v1/public/agents/${encodeURIComponent(e)}/chat?key=${encodeURIComponent(t)}`,o=new URLSearchParams;o.set("message",n.message),o.set("conversation_id",n.conversationId),n.pageContext&&o.set("page_context",n.pageContext),n.uiLanguage&&o.set("ui_language",n.uiLanguage),n.reset&&o.set("reset","true");let s;try{s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o});}catch(f){let b={kind:"network",message:Ee(r)};throw new O(b,f)}let c=await Te(s),d=q(c);return {reply:u(d.reply)??"",language:u(d.language)??"",cards:Xa(d.cards),suggestions:Array.isArray(d.suggestions)?d.suggestions.filter(f=>typeof f=="string"&&f.trim().length>0).map(f=>f.trim().slice(0,120)).slice(0,4):[],conversationId:u(d.conversation_id)??n.conversationId}}var Ja="oai-events",Qa=2e3,en=3500,Se=class{constructor(e){this.options=e;this.pc=null;this.channel=null;this.micStream=null;this.audioEl=null;this.stopped=false;this.turnTimers={};this.openTurns=new Set;}get isActive(){return this.pc!==null&&!this.stopped}async start(e){if(this.pc)return;this.stopped=false,this.options.handlers.onStatus("connecting");try{this.micStream=await navigator.mediaDevices.getUserMedia({audio:!0});}catch{this.options.handlers.onError({kind:"network",message:"Microphone access was denied or unavailable."});return}let t=new RTCPeerConnection;this.pc=t;for(let r of this.micStream.getAudioTracks())t.addTrack(r,this.micStream);this.audioEl=document.createElement("audio"),this.audioEl.autoplay=true,t.ontrack=r=>{this.audioEl&&(this.audioEl.srcObject=r.streams[0]??null);};let n=t.createDataChannel(Ja);this.channel=n,n.onmessage=r=>this.onChannelMessage(r),n.onopen=()=>this.options.handlers.onStatus("listening"),t.onconnectionstatechange=()=>{(t.connectionState==="failed"||t.connectionState==="closed")&&(this.teardown(),this.options.handlers.onClosed());};try{let r=await t.createOffer();await t.setLocalDescription(r),await this.waitForIceGathering(t);let{sdp:i}=await _t(this.options.gatewayUrl,this.options.projectId,this.options.apiKey,e,t.localDescription?.sdp??r.sdp??"");await t.setRemoteDescription({type:"answer",sdp:i});}catch(r){this.teardown();let i=r;this.options.handlers.onError(i?.dabaError??{kind:"network",message:"Failed to start the voice session."}),this.options.handlers.onClosed();}}sendToolResult(e,t){!this.channel||this.channel.readyState!=="open"||(this.send({type:"response.item.create",item:{type:"function_call_output",call_id:e,output:JSON.stringify(t)}}),this.send({type:"response.create"}));}stop(){this.teardown(),this.options.handlers.onClosed();}send(e){!this.channel||this.channel.readyState!=="open"||this.channel.send(JSON.stringify(e));}waitForIceGathering(e){return e.iceGatheringState==="complete"?Promise.resolve():new Promise(t=>{let n=()=>{e.iceGatheringState==="complete"&&(e.removeEventListener("icegatheringstatechange",n),t());};e.addEventListener("icegatheringstatechange",n),window.setTimeout(()=>{e.removeEventListener("icegatheringstatechange",n),t();},Qa);})}onChannelMessage(e){if(typeof e.data!="string")return;let t;try{t=JSON.parse(e.data);}catch{return}this.handleEvent(t);}handleEvent(e){if(e.type==="response.event"){let n=e.event;n&&typeof n=="object"&&this.handleEvent(n);return}let{handlers:t}=this.options;switch(e.type){case "session.input_transcript.delta":this.onDelta("user",e);break;case "session.input_transcript.done":this.endTurn("user");break;case "session.output_transcript.delta":t.onStatus("speaking"),this.onDelta("agent",e);break;case "session.output_transcript.done":this.endTurn("agent");break;case "response.output_item.done":this.emitToolCall(e);break;case "error":{let n=e.error;t.onError({kind:"network",message:n?.message??"Voice session error."});break}}}onDelta(e,t){this.endTurn(e==="user"?"agent":"user"),this.emitTranscript(e,t,false),this.openTurns.add(e),window.clearTimeout(this.turnTimers[e]),this.turnTimers[e]=window.setTimeout(()=>this.endTurn(e),en);}endTurn(e){window.clearTimeout(this.turnTimers[e]),this.turnTimers[e]=void 0,this.openTurns.delete(e)&&(this.options.handlers.onTranscript(e,"",true),e==="agent"&&this.options.handlers.onStatus("listening"));}emitTranscript(e,t,n){let r=t.delta??t.transcript??t.text;!r&&!n||this.options.handlers.onTranscript(e,r??"",n);}emitToolCall(e){let t=e.item;if(!t||t.type!=="function_call")return;let n=t.call_id,r=t.name;!n||!r||this.options.handlers.onToolCall({callId:n,name:r,args:t.arguments??"{}"});}teardown(){this.stopped||(this.stopped=true,window.clearTimeout(this.turnTimers.user),window.clearTimeout(this.turnTimers.agent),this.turnTimers={},this.openTurns.clear(),this.channel?.close(),this.channel=null,this.micStream?.getTracks().forEach(e=>e.stop()),this.micStream=null,this.audioEl&&(this.audioEl.srcObject=null,this.audioEl=null),this.pc?.close(),this.pc=null);}};var Xe={production:"https://api.dabalabs.com",staging:"https://api-staging.dabalabs.com"};function ge(a,e){if(a)return a;if(e==null||e==="")return Xe.production;let t=String(e).trim().toLowerCase();return t==="staging"?Xe.staging:(t!=="production"&&console.warn(`[daba-agent] unknown env "${e}" \u2014 falling back to production. Use env: "staging" for the staging gateway, or pass an explicit gatewayUrl.`),Xe.production)}function Et(){return typeof document>"u"?false:document.documentElement.hasAttribute("data-daba-agent-restricted")||document.querySelector('meta[name="daba-agent-restricted"]')!==null}function ne(a){return a.replace(/\s+/g," ").trim()}var tn='[data-daba-agent-ignore], input[type="password"], input[type="hidden"], [autocomplete="current-password"], [autocomplete="new-password"], [autocomplete^="cc-"]';function Je(a){return a.closest(tn)!==null}var an=[/\bdpk_live_[A-Za-z0-9_-]{10,}/g,/\b(?:sk|pk|rk)_(?:live|test)_[A-Za-z0-9]{10,}/g,/\bsk-[A-Za-z0-9]{10,}/g,/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g,/\b\d[\d -]{11,22}\d\b/g];function nn(a){let e=a;for(let t of an)e=e.replace(t,"[redacted]");return e}function rn(){let a=document.body;if(!a)return "";let e=document.createTreeWalker(a,NodeFilter.SHOW_TEXT,{acceptNode(r){let i=r.parentElement;if(!i)return NodeFilter.FILTER_REJECT;let o=i.tagName;if(o==="SCRIPT"||o==="STYLE"||o==="NOSCRIPT"||Je(i))return NodeFilter.FILTER_REJECT;let s=window.getComputedStyle(i);return s.display==="none"||s.visibility==="hidden"?NodeFilter.FILTER_REJECT:r.textContent&&r.textContent.trim()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),t=[],n=0;for(;e.nextNode();){let r=ne(e.currentNode.textContent??"");if(r&&(t.push(r),n+=r.length,n>=4e3))break}return nn(t.join(" ")).slice(0,4e3)}function on(){let a=Array.from(document.querySelectorAll("a[href]")),e=new Set,t=[],n=[];for(let r of a){if(Je(r))continue;let i=ne(r.textContent??""),o=r.getAttribute("href")??"";if(!i||!o||o.startsWith("#")||o.startsWith("javascript:"))continue;let s=`${i}|${o}`;if(e.has(s))continue;e.add(s);let c=`"${i}" -> ${o}`;r.closest("nav, header, footer")?n.push(c):t.push(c);}return [...t,...n].slice(0,100)}function sn(a){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(a):a.replace(/[^a-zA-Z0-9_-]/g,"\\$&")}function dn(a){let e=a.getAttribute("id");if(e){let o=document.querySelector(`label[for="${sn(e)}"]`);if(o&&o.textContent)return ne(o.textContent)}let t=a.closest("label");if(t&&t.textContent)return ne(t.textContent);let n=a.getAttribute("aria-label");if(n)return ne(n);let r=a.getAttribute("placeholder");if(r)return ne(r);let i=a.getAttribute("name");return i||""}function ln(){let a=Array.from(document.querySelectorAll("form input, form textarea, form select")),e=[];for(let t of a){if(Je(t))continue;let n=t.type??t.tagName.toLowerCase();if(n==="hidden"||n==="submit"||n==="button")continue;let r=dn(t);if(r&&(e.push(`${r} (${n})`),e.length>=30))break}return e}function pe(){let a=[];a.push(`Page title: ${document.title||"(untitled)"}`),a.push(`URL: ${window.location.href}`);let e=rn();e&&a.push(`Visible text: ${e}`);let t=on();t.length>0&&a.push(`Links on this page:
2
+ ${t.join(`
3
+ `)}`);let n=ln();return n.length>0&&a.push(`Form fields on this page (use fill_form_field with the exact label text shown here):
4
4
  ${n.join(`
5
- `)}`),t.join(`
5
+ `)}`),a.join(`
6
6
 
7
- `)}function z(t){return t.replace(/\s+/g," ").trim()}function sn(t){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(t):t.replace(/[^a-zA-Z0-9_-]/g,"\\$&")}function Re(t){let e=t.getAttribute("id");if(e){let i=document.querySelector(`label[for="${sn(e)}"]`);if(i&&i.textContent)return z(i.textContent)}let a=t.closest("label");if(a&&a.textContent)return z(a.textContent);let n=t.getAttribute("aria-label");if(n)return z(n);let r=t.getAttribute("placeholder");if(r)return z(r);let o=t.getAttribute("name");return o||""}function ht(t){if(t.hasAttribute("data-daba-agent-ignore")||t.closest("[data-daba-agent-ignore]"))return true;if(t instanceof HTMLInputElement){let n=t.type.toLowerCase();if(n==="password"||n==="hidden")return true;let r=(t.getAttribute("autocomplete")??"").toLowerCase();if(r==="current-password"||r==="new-password"||r.startsWith("cc-"))return true}let e=Re(t).toLowerCase();return ["password","passcode","pin","credit card","card number","cvv","cvc","security code","ssn","social security"].some(n=>e.includes(n))}function dn(t){let e=t.toLowerCase().trim();if(!e)return null;let a=Array.from(document.querySelectorAll("input, textarea, select")),n=null,r=null;for(let o of a){if(ht(o))continue;let i=Re(o).toLowerCase();if(i){if(i===e){n=o;break}!r&&(i.includes(e)||e.includes(i))&&(r=o);}}return n??r}function mt(t,e){let a=dn(t);if(!a)return {ok:false,message:`Could not find form field matching "${t}".`};if(ht(a))return {ok:false,message:`Field matching "${t}" is restricted for security.`};if(a instanceof HTMLSelectElement){let r=e.toLowerCase().trim(),o=Array.from(a.options).find(i=>i.value.toLowerCase()===r||i.text.toLowerCase().trim()===r);if(o||(o=Array.from(a.options).find(i=>i.text.toLowerCase().includes(r)||r.includes(i.text.toLowerCase()))),!o)return {ok:false,message:`No matching option in select field for "${e}".`};a.value=o.value;}else a.value=e;return a.dispatchEvent(new Event("input",{bubbles:true})),a.dispatchEvent(new Event("change",{bubbles:true})),{ok:true,message:`Filled field "${Re(a)||t}" with "${e}".`}}function ft(){let t=document.querySelector("form");if(!t)return {ok:false,message:"No form found on the page to submit."};let e=t.querySelector('button[type="submit"], input[type="submit"]');return e?(e.click(),{ok:true,message:"Form submitted via submit button."}):typeof t.requestSubmit=="function"?(t.requestSubmit(),{ok:true,message:"Form submitted via requestSubmit()."}):(t.submit(),{ok:true,message:"Form submitted."})}var ln=["delete","remove account","close account","log out","sign out","cancel subscription","cancel order","unsubscribe","deactivate"],cn='button, [role="button"], input[type="button"], input[type="submit"], input[type="reset"], label';function gn(t){return t.hasAttribute("data-daba-agent-ignore")||t.closest("[data-daba-agent-ignore]")!==null}function pn(t){let e=t.htmlFor,a=e?document.getElementById(e):t.querySelector("input");return a instanceof HTMLInputElement&&(a.type==="radio"||a.type==="checkbox")?a:null}function pt(t){let e=t.getAttribute("aria-label");return e&&e.trim()?z(e):t instanceof HTMLInputElement?z(t.value||t.getAttribute("value")||""):z(t.textContent??"")}function vt(t){let e=t.toLowerCase().trim();if(!e)return null;let a=Array.from(document.querySelectorAll(cn)).filter(i=>gn(i)?false:i instanceof HTMLLabelElement?pn(i)!==null:true),n=null,r=null;for(let i of a){let s=pt(i).toLowerCase();if(s){if(s===e){n=i;break}!r&&(s.includes(e)||e.includes(s))&&(r=i);}}let o=n??r;return o?{el:o,text:pt(o)}:null}function un(t){let e=t.toLowerCase();return ln.some(a=>e.includes(a))}function xt(t,e){return un(e)?{ok:false,message:`Refusing to click "${e}" \u2014 this looks like a destructive action.`}:(t.click(),{ok:true,message:`Clicked "${e}".`})}function wt(t){let e=t.trim();if(!e)return {ok:false,message:"No destination provided."};let a;try{a=new URL(e,window.location.href);}catch{return {ok:false,message:`Invalid destination URL: ${t}`}}if(a.origin!==window.location.origin)return {ok:false,message:`Navigation to external origin "${a.origin}" is restricted.`};let n=a.pathname+a.search+a.hash,r=Array.from(document.querySelectorAll("a[href]")),o=s=>s.hasAttribute("data-daba-agent-ignore")||s.closest("[data-daba-agent-ignore]")!==null,i=r.find(s=>{if(o(s))return false;let d=s.getAttribute("href")??"";if(d.startsWith("#")||d.startsWith("javascript:"))return false;try{let l=new URL(s.href,window.location.href);return l.pathname+l.search+l.hash===n}catch{return false}});if(!i){let s=e.toLowerCase();i=r.find(d=>{if(o(d))return false;let l=d.getAttribute("href")??"";return l.startsWith("#")||l.startsWith("javascript:")?false:(d.textContent??"").toLowerCase().trim().includes(s)});}return i?{ok:true,message:`Navigating to ${i.href}\u2026`,href:i.href}:{ok:false,message:`No link matching destination "${t}" found on page.`}}function bn(t){return t.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function hn(t){let e=t.toLowerCase().trim();if(!e)return null;let a=Array.from(document.querySelectorAll('a[href^="#"]'));for(let o of a){let i=z(o.textContent??"").toLowerCase();if(i&&(i===e||i.includes(e)||e.includes(i))){let s=(o.getAttribute("href")??"").slice(1),d=s?document.getElementById(s):null;if(d)return d}}let n=Array.from(document.querySelectorAll("h1, h2, h3, h4, h5, h6")),r=null;for(let o of n){let i=z(o.textContent??"").toLowerCase();if(i){if(i===e)return o;!r&&(i.includes(e)||e.includes(i))&&(r=o);}}return r||document.getElementById(bn(e))}function mn(t){let e=window.getComputedStyle(t).overflowY;return (e==="auto"||e==="scroll")&&t.scrollHeight>t.clientHeight+1}function fn(){let t=document.scrollingElement??document.documentElement;if(t.scrollHeight>t.clientHeight+1)return window;let e=Array.from(document.querySelectorAll("*")).filter(mn);return e.length===0?window:e.reduce((a,n)=>n.clientHeight>a.clientHeight?n:a)}function vn(t){return t===window?window.innerHeight:t.clientHeight}function xn(t){return t===window?document.documentElement.scrollHeight:t.scrollHeight}function ut(t,e){t===window?window.scrollBy({top:e,behavior:"smooth"}):t.scrollBy({top:e,behavior:"smooth"});}function bt(t,e){t===window?window.scrollTo({top:e,behavior:"smooth"}):t.scrollTo({top:e,behavior:"smooth"});}function yt(t,e){let a=(e??"").trim();if(a){let o=hn(a);return o?(o.scrollIntoView({behavior:"smooth",block:"start"}),{ok:true,message:`Scrolled to "${a}".`}):{ok:false,message:`Could not find a section matching "${a}" to scroll to.`}}let n=fn(),r=vn(n);switch((t??"").toLowerCase()){case "top":return bt(n,0),{ok:true,message:"Scrolled to the top of the page."};case "bottom":return bt(n,xn(n)),{ok:true,message:"Scrolled to the bottom of the page."};case "up":return ut(n,-Math.round(r*.85)),{ok:true,message:"Scrolled up."};case "down":return ut(n,Math.round(r*.85)),{ok:true,message:"Scrolled down."};default:return {ok:false,message:"No scroll direction or target provided."}}}function wn(t){if(t.length===0)return 0;let e=0;for(let a=0;a<t.length;a++){let n=t[a]/32768;e+=n*n;}return Math.sqrt(e/t.length)}async function kt(t,e){let a=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:24e3,echoCancellation:true,noiseSuppression:true}}),n=t.createMediaStreamSource(a),r=t.createScriptProcessor(4096,1,1);return r.onaudioprocess=o=>{let i=o.inputBuffer.getChannelData(0),s=new Int16Array(i.length);for(let l=0;l<i.length;l++){let f=Math.max(-1,Math.min(1,i[l]));s[l]=f<0?f*32768:f*32767;}let d=wn(s);e(s.buffer,d);},n.connect(r),r.connect(t.destination),{stop:()=>{r.disconnect(),n.disconnect(),a.getTracks().forEach(o=>o.stop());}}}var me=class{constructor(e){this.nextStartTime=0;this.currentSources=[];this.ctx=e;}pushBase64(e){let a=atob(e),n=new Uint8Array(a.length);for(let l=0;l<a.length;l++)n[l]=a.charCodeAt(l);let r=new Int16Array(n.buffer,n.byteOffset,n.byteLength/2),o=new Float32Array(r.length);for(let l=0;l<r.length;l++)o[l]=r[l]/(r[l]<0?32768:32767);let i=this.ctx.createBuffer(1,o.length,24e3);i.getChannelData(0).set(o);let s=this.ctx.createBufferSource();s.buffer=i,s.connect(this.ctx.destination);let d=this.ctx.currentTime;this.nextStartTime<d&&(this.nextStartTime=d),s.start(this.nextStartTime),this.nextStartTime+=i.duration,this.currentSources.push(s),s.onended=()=>{let l=this.currentSources.indexOf(s);l!==-1&&this.currentSources.splice(l,1);};}isPlaying(){return this.currentSources.length>0}clear(){for(let e of this.currentSources)try{e.stop();}catch{}this.currentSources=[],this.nextStartTime=0;}};var Ne="daba-agent:reattach:";function _t(t,e,a){if(typeof sessionStorage>"u")return;let n={sessionId:e,wsUrl:a,timestamp:Date.now(),ts:Date.now()};try{sessionStorage.setItem(Ne+t,JSON.stringify(n));}catch{}}function Ct(t){if(typeof sessionStorage>"u")return null;try{let e=sessionStorage.getItem(Ne+t);if(!e)return null;let a=JSON.parse(e),n=a.ts??a.timestamp??0;return Date.now()-n>3e4?(fe(t),null):a}catch{return null}}function fe(t){if(!(typeof sessionStorage>"u"))try{sessionStorage.removeItem(Ne+t);}catch{}}var yn="daba-agent:transcript:",_n=96*1024;function Oe(t,e){return `${yn}${t}:${e}`}function Et(t,e,a){if(typeof sessionStorage>"u")return;let n=a.slice(-40);try{let r=JSON.stringify(n);for(;r.length>_n&&n.length>1;)n=n.slice(1),r=JSON.stringify(n);sessionStorage.setItem(Oe(t,e),r);}catch{}}function Tt(t,e){if(typeof sessionStorage>"u")return [];try{let a=sessionStorage.getItem(Oe(t,e));if(!a)return [];let n=JSON.parse(a);return Array.isArray(n)?n.filter(r=>!!r&&typeof r=="object"&&typeof r.text=="string"&&["user","agent","system"].includes(r.role)):[]}catch{return []}}function St(t,e){if(!(typeof sessionStorage>"u"))try{sessionStorage.removeItem(Oe(t,e));}catch{}}var Lt="daba-agent-styles",Cn={accentColor:"accent",accentContrast:"accent-contrast",accentSoft:"accent-soft",surfaceColor:"surface",surfaceRaised:"surface-raised",textColor:"text",mutedColor:"muted",borderColor:"border",fontFamily:"font"},En=new Set(["accent","accent-contrast","accent-soft","surface","surface-raised","text","muted","border","radius","shadow","font","font-title","accent-strong","accent-bright","ring","tint","bubble","danger","warn","radius-sm","radius-pill","kind-event","kind-article","kind-news","kind-contact","kind-action","kind-page","inset","gap","badge-size","panel-w","panel-h"]),Tn=/[;{}<>]|url\s*\(|expression\s*\(/i;function Sn(t){if(t.startsWith("--"))return t;let e=Cn[t]??t.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`);return En.has(e)?`--daba-agent-${e}`:null}function ve(t,e){for(let a of Object.keys(e)){let n=e[a];if(n==null)continue;let r=String(n).trim();if(!r||Tn.test(r))continue;let o=Sn(a);o&&t.style.setProperty(o,r);}}var Ln=`
7
+ `)}function z(a){return a.replace(/\s+/g," ").trim()}function cn(a){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(a):a.replace(/[^a-zA-Z0-9_-]/g,"\\$&")}function Qe(a){let e=a.getAttribute("id");if(e){let o=document.querySelector(`label[for="${cn(e)}"]`);if(o&&o.textContent)return z(o.textContent)}let t=a.closest("label");if(t&&t.textContent)return z(t.textContent);let n=a.getAttribute("aria-label");if(n)return z(n);let r=a.getAttribute("placeholder");if(r)return z(r);let i=a.getAttribute("name");return i||""}function At(a){if(a.hasAttribute("data-daba-agent-ignore")||a.closest("[data-daba-agent-ignore]"))return true;if(a instanceof HTMLInputElement){let n=a.type.toLowerCase();if(n==="password"||n==="hidden")return true;let r=(a.getAttribute("autocomplete")??"").toLowerCase();if(r==="current-password"||r==="new-password"||r.startsWith("cc-"))return true}let e=Qe(a).toLowerCase();return ["password","passcode","pin","credit card","card number","cvv","cvc","security code","ssn","social security"].some(n=>e.includes(n))}function gn(a){let e=a.toLowerCase().trim();if(!e)return null;let t=Array.from(document.querySelectorAll("input, textarea, select")),n=null,r=null;for(let i of t){if(At(i))continue;let o=Qe(i).toLowerCase();if(o){if(o===e){n=i;break}!r&&(o.includes(e)||e.includes(o))&&(r=i);}}return n??r}function Mt(a,e){let t=gn(a);if(!t)return {ok:false,message:`Could not find form field matching "${a}".`};if(At(t))return {ok:false,message:`Field matching "${a}" is restricted for security.`};if(t instanceof HTMLSelectElement){let r=e.toLowerCase().trim(),i=Array.from(t.options).find(o=>o.value.toLowerCase()===r||o.text.toLowerCase().trim()===r);if(i||(i=Array.from(t.options).find(o=>o.text.toLowerCase().includes(r)||r.includes(o.text.toLowerCase()))),!i)return {ok:false,message:`No matching option in select field for "${e}".`};t.value=i.value;}else t.value=e;return t.dispatchEvent(new Event("input",{bubbles:true})),t.dispatchEvent(new Event("change",{bubbles:true})),{ok:true,message:`Filled field "${Qe(t)||a}" with "${e}".`}}function Dt(){let a=document.querySelector("form");if(!a)return {ok:false,message:"No form found on the page to submit."};let e=a.querySelector('button[type="submit"], input[type="submit"]');return e?(e.click(),{ok:true,message:"Form submitted via submit button."}):typeof a.requestSubmit=="function"?(a.requestSubmit(),{ok:true,message:"Form submitted via requestSubmit()."}):(a.submit(),{ok:true,message:"Form submitted."})}var pn=["delete","remove account","close account","log out","sign out","cancel subscription","cancel order","unsubscribe","deactivate"],un='button, [role="button"], input[type="button"], input[type="submit"], input[type="reset"], label';function hn(a){return a.hasAttribute("data-daba-agent-ignore")||a.closest("[data-daba-agent-ignore]")!==null}function bn(a){let e=a.htmlFor,t=e?document.getElementById(e):a.querySelector("input");return t instanceof HTMLInputElement&&(t.type==="radio"||t.type==="checkbox")?t:null}function Tt(a){let e=a.getAttribute("aria-label");return e&&e.trim()?z(e):a instanceof HTMLInputElement?z(a.value||a.getAttribute("value")||""):z(a.textContent??"")}function Ht(a){let e=a.toLowerCase().trim();if(!e)return null;let t=Array.from(document.querySelectorAll(un)).filter(o=>hn(o)?false:o instanceof HTMLLabelElement?bn(o)!==null:true),n=null,r=null;for(let o of t){let s=Tt(o).toLowerCase();if(s){if(s===e){n=o;break}!r&&(s.includes(e)||e.includes(s))&&(r=o);}}let i=n??r;return i?{el:i,text:Tt(i)}:null}function mn(a){let e=a.toLowerCase();return pn.some(t=>e.includes(t))}function It(a,e){return mn(e)?{ok:false,message:`Refusing to click "${e}" \u2014 this looks like a destructive action.`}:(a.click(),{ok:true,message:`Clicked "${e}".`})}function Nt(a){let e=a.trim();if(!e)return {ok:false,message:"No destination provided."};let t;try{t=new URL(e,window.location.href);}catch{return {ok:false,message:`Invalid destination URL: ${a}`}}if(t.origin!==window.location.origin)return {ok:false,message:`Navigation to external origin "${t.origin}" is restricted.`};let n=t.pathname+t.search+t.hash,r=Array.from(document.querySelectorAll("a[href]")),i=s=>s.hasAttribute("data-daba-agent-ignore")||s.closest("[data-daba-agent-ignore]")!==null,o=r.find(s=>{if(i(s))return false;let c=s.getAttribute("href")??"";if(c.startsWith("#")||c.startsWith("javascript:"))return false;try{let d=new URL(s.href,window.location.href);return d.pathname+d.search+d.hash===n}catch{return false}});if(!o){let s=e.toLowerCase();o=r.find(c=>{if(i(c))return false;let d=c.getAttribute("href")??"";return d.startsWith("#")||d.startsWith("javascript:")?false:(c.textContent??"").toLowerCase().trim().includes(s)});}return o?{ok:true,message:`Navigating to ${o.href}\u2026`,href:o.href}:{ok:false,message:`No link matching destination "${a}" found on page.`}}function fn(a){return a.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function vn(a){let e=a.toLowerCase().trim();if(!e)return null;let t=Array.from(document.querySelectorAll('a[href^="#"]'));for(let i of t){let o=z(i.textContent??"").toLowerCase();if(o&&(o===e||o.includes(e)||e.includes(o))){let s=(i.getAttribute("href")??"").slice(1),c=s?document.getElementById(s):null;if(c)return c}}let n=Array.from(document.querySelectorAll("h1, h2, h3, h4, h5, h6")),r=null;for(let i of n){let o=z(i.textContent??"").toLowerCase();if(o){if(o===e)return i;!r&&(o.includes(e)||e.includes(o))&&(r=i);}}return r||document.getElementById(fn(e))}function yn(a){let e=window.getComputedStyle(a).overflowY;return (e==="auto"||e==="scroll")&&a.scrollHeight>a.clientHeight+1}function xn(){let a=document.scrollingElement??document.documentElement;if(a.scrollHeight>a.clientHeight+1)return window;let e=Array.from(document.querySelectorAll("*")).filter(yn);return e.length===0?window:e.reduce((t,n)=>n.clientHeight>t.clientHeight?n:t)}function wn(a){return a===window?window.innerHeight:a.clientHeight}function kn(a){return a===window?document.documentElement.scrollHeight:a.scrollHeight}function St(a,e){a===window?window.scrollBy({top:e,behavior:"smooth"}):a.scrollBy({top:e,behavior:"smooth"});}function Lt(a,e){a===window?window.scrollTo({top:e,behavior:"smooth"}):a.scrollTo({top:e,behavior:"smooth"});}function Pt(a,e){let t=(e??"").trim();if(t){let i=vn(t);return i?(i.scrollIntoView({behavior:"smooth",block:"start"}),{ok:true,message:`Scrolled to "${t}".`}):{ok:false,message:`Could not find a section matching "${t}" to scroll to.`}}let n=xn(),r=wn(n);switch((a??"").toLowerCase()){case "top":return Lt(n,0),{ok:true,message:"Scrolled to the top of the page."};case "bottom":return Lt(n,kn(n)),{ok:true,message:"Scrolled to the bottom of the page."};case "up":return St(n,-Math.round(r*.85)),{ok:true,message:"Scrolled up."};case "down":return St(n,Math.round(r*.85)),{ok:true,message:"Scrolled down."};default:return {ok:false,message:"No scroll direction or target provided."}}}function _n(a){if(a.length===0)return 0;let e=0;for(let t=0;t<a.length;t++){let n=a[t]/32768;e+=n*n;}return Math.sqrt(e/a.length)}async function Ot(a,e){let t=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:24e3,echoCancellation:true,noiseSuppression:true}}),n=a.createMediaStreamSource(t),r=a.createScriptProcessor(4096,1,1);return r.onaudioprocess=i=>{let o=i.inputBuffer.getChannelData(0),s=new Int16Array(o.length);for(let d=0;d<o.length;d++){let f=Math.max(-1,Math.min(1,o[d]));s[d]=f<0?f*32768:f*32767;}let c=_n(s);e(s.buffer,c);},n.connect(r),r.connect(a.destination),{stop:()=>{r.disconnect(),n.disconnect(),t.getTracks().forEach(i=>i.stop());}}}var Le=class{constructor(e){this.nextStartTime=0;this.currentSources=[];this.ctx=e;}pushBase64(e){let t=atob(e),n=new Uint8Array(t.length);for(let d=0;d<t.length;d++)n[d]=t.charCodeAt(d);let r=new Int16Array(n.buffer,n.byteOffset,n.byteLength/2),i=new Float32Array(r.length);for(let d=0;d<r.length;d++)i[d]=r[d]/(r[d]<0?32768:32767);let o=this.ctx.createBuffer(1,i.length,24e3);o.getChannelData(0).set(i);let s=this.ctx.createBufferSource();s.buffer=o,s.connect(this.ctx.destination);let c=this.ctx.currentTime;this.nextStartTime<c&&(this.nextStartTime=c),s.start(this.nextStartTime),this.nextStartTime+=o.duration,this.currentSources.push(s),s.onended=()=>{let d=this.currentSources.indexOf(s);d!==-1&&this.currentSources.splice(d,1);};}isPlaying(){return this.currentSources.length>0}clear(){for(let e of this.currentSources)try{e.stop();}catch{}this.currentSources=[],this.nextStartTime=0;}};var et="daba-agent:reattach:";function zt(a,e,t){if(typeof sessionStorage>"u")return;let n={sessionId:e,wsUrl:t,timestamp:Date.now(),ts:Date.now()};try{sessionStorage.setItem(et+a,JSON.stringify(n));}catch{}}function Bt(a){if(typeof sessionStorage>"u")return null;try{let e=sessionStorage.getItem(et+a);if(!e)return null;let t=JSON.parse(e),n=t.ts??t.timestamp??0;return Date.now()-n>3e4?(Ae(a),null):t}catch{return null}}function Ae(a){if(!(typeof sessionStorage>"u"))try{sessionStorage.removeItem(et+a);}catch{}}var Cn="daba-agent:transcript:",Tn=96*1024;function tt(a,e){return `${Cn}${a}:${e}`}function Ut(a){let e=a.slice(-40),t=JSON.stringify(e);for(;t.length>Tn&&e.length>1;)e=e.slice(1),t=JSON.stringify(e);return e}function at(a,e,t){if(!(typeof sessionStorage>"u"))try{sessionStorage.setItem(tt(a,e),JSON.stringify(Ut(t)));}catch{}}function $t(a,e){if(typeof sessionStorage>"u")return [];try{let t=sessionStorage.getItem(tt(a,e));if(!t)return [];let n=JSON.parse(t);return Array.isArray(n)?n.filter(r=>!!r&&typeof r=="object"&&typeof r.text=="string"&&["user","agent","system"].includes(r.role)):[]}catch{return []}}function Vt(a,e){if(!(typeof sessionStorage>"u"))try{sessionStorage.removeItem(tt(a,e));}catch{}}var Sn="daba-agent:history:",Ln="daba-agent:history-body:",An=20,Mn=720*60*60*1e3,Rt=60;function nt(a){return Sn+a}function ue(a,e){return `${Ln}${a}:${e}`}function Dn(a,e){let n=a.find(i=>i.role==="user"&&i.text.trim())?.text.trim().replace(/\s+/g," ")??"";if(!n)return e;let r=[...n];return r.length>Rt?`${r.slice(0,Rt).join("")}\u2026`:n}function Me(a){if(typeof localStorage>"u")return [];try{let e=localStorage.getItem(nt(a));if(!e)return [];let t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>!!n&&typeof n=="object"&&typeof n.id=="string"):[]}catch{return []}}function rt(a,e){if(typeof localStorage>"u")return [];let t=Date.now()-Mn,n=e.filter(i=>i.updatedAt>t).sort((i,o)=>o.updatedAt-i.updatedAt).slice(0,An),r=new Set(n.map(i=>i.id));for(let i of e)if(!r.has(i.id))try{localStorage.removeItem(ue(a,i.id));}catch{}try{localStorage.setItem(nt(a),JSON.stringify(n));}catch{}return n}function jt(a,e,t,n,r){if(typeof localStorage>"u")return;let i=Ut(t);if(!i.length)return;try{localStorage.setItem(ue(a,e),JSON.stringify(i));}catch{return}let o={id:e,title:Dn(i,r),updatedAt:Date.now(),messageCount:i.length,path:n.split("?")[0].split("#")[0]},s=Me(a).filter(c=>c.id!==e);rt(a,[o,...s]);}function Ft(a){return rt(a,Me(a))}function Gt(a,e){if(typeof localStorage>"u")return [];try{let t=localStorage.getItem(ue(a,e));if(!t)return [];let n=JSON.parse(t);return Array.isArray(n)?n:[]}catch{return []}}function Wt(a,e){if(!(typeof localStorage>"u")){try{localStorage.removeItem(ue(a,e));}catch{}rt(a,Me(a).filter(t=>t.id!==e));}}function Kt(a){if(!(typeof localStorage>"u")){for(let e of Me(a))try{localStorage.removeItem(ue(a,e.id));}catch{}try{localStorage.removeItem(nt(a));}catch{}}}var qt="daba-agent-styles",Hn={accentColor:"accent",accentContrast:"accent-contrast",accentSoft:"accent-soft",surfaceColor:"surface",surfaceRaised:"surface-raised",textColor:"text",mutedColor:"muted",borderColor:"border",fontFamily:"font"},In=new Set(["accent","accent-contrast","accent-soft","surface","surface-raised","text","muted","border","radius","shadow","font","font-title","accent-strong","accent-bright","ring","tint","bubble","danger","warn","radius-sm","radius-pill","kind-event","kind-article","kind-news","kind-contact","kind-action","kind-page","inset","gap","badge-size","badge-icon-size","badge-radius","panel-w","panel-h","icon-bg","icon-mark"]),Nn=/[;{}<>]|url\s*\(|expression\s*\(/i;function Pn(a){if(a.startsWith("--"))return a;let e=Hn[a]??a.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);return In.has(e)?`--daba-agent-${e}`:null}function he(a,e){for(let t of Object.keys(e)){let n=e[t];if(n==null)continue;let r=String(n).trim();if(!r||Nn.test(r))continue;let i=Pn(t);i&&a.style.setProperty(i,r);}}var On=`
8
8
  /* ==========================================================================
9
9
  1. Tokens \u2014 the only place a literal colour, radius or font appears.
10
10
  ========================================================================== */
@@ -56,8 +56,10 @@ ${n.join(`
56
56
  --daba-agent-inset: 20px;
57
57
  --daba-agent-gap: 12px;
58
58
  --daba-agent-badge-size: 56px;
59
- --daba-agent-panel-w: 380px;
60
- --daba-agent-panel-h: 560px;
59
+ --daba-agent-badge-icon-size: 100%;
60
+ --daba-agent-badge-radius: 10px;
61
+ --daba-agent-panel-w: 400px;
62
+ --daba-agent-panel-h: 740px;
61
63
  --daba-agent-anchor: flex-end;
62
64
  }
63
65
 
@@ -226,27 +228,34 @@ h1, h2, h3, h4, h5, h6) {
226
228
  }
227
229
 
228
230
  .daba-agent-badge--circle {
229
- border-radius: var(--daba-agent-radius-pill);
231
+ --daba-agent-badge-radius: var(--daba-agent-radius-pill);
230
232
  }
231
233
  .daba-agent-badge--rounded {
232
- border-radius: calc(var(--daba-agent-radius) * 0.95);
234
+ --daba-agent-badge-radius: calc(var(--daba-agent-radius) * 0.95);
233
235
  }
234
236
  .daba-agent-badge--pill {
237
+ --daba-agent-badge-radius: var(--daba-agent-radius-pill);
235
238
  width: auto;
236
239
  height: calc(var(--daba-agent-badge-size) * 0.82);
237
240
  padding-inline: 8px 18px;
238
241
  gap: 10px;
239
- border-radius: var(--daba-agent-radius-pill);
240
242
  }
241
243
 
242
244
  .daba-agent-badge__icon {
243
245
  display: block;
244
- width: 100%;
245
- height: 100%;
246
+ width: var(--daba-agent-badge-icon-size);
247
+ height: var(--daba-agent-badge-icon-size);
248
+ margin: auto;
246
249
  border-radius: inherit;
247
250
  overflow: hidden;
248
251
  line-height: 0;
249
252
  }
253
+ .daba-agent-badge__icon--text {
254
+ display: grid;
255
+ place-items: center;
256
+ font-size: calc(var(--daba-agent-badge-size) * 0.48);
257
+ line-height: 1;
258
+ }
250
259
  .daba-agent-badge--pill .daba-agent-badge__icon {
251
260
  width: calc(var(--daba-agent-badge-size) * 0.55);
252
261
  height: calc(var(--daba-agent-badge-size) * 0.55);
@@ -330,10 +339,6 @@ h1, h2, h3, h4, h5, h6) {
330
339
  .daba-agent-window {
331
340
  display: flex;
332
341
  flex-direction: column;
333
- width: var(--daba-agent-panel-w);
334
- height: min(var(--daba-agent-panel-h), calc(100vh - 140px));
335
- max-width: calc(100vw - 24px);
336
- max-height: calc(100vh - 120px);
337
342
  background: var(--daba-agent-surface);
338
343
  color: var(--daba-agent-text);
339
344
  border: 1px solid var(--daba-agent-border);
@@ -1228,8 +1233,8 @@ h1, h2, h3, h4, h5, h6) {
1228
1233
  --ref-mark: #2b2b2b;
1229
1234
  --ref-user: #f2f2f2;
1230
1235
 
1231
- width: 400px;
1232
- height: 740px;
1236
+ width: var(--daba-agent-panel-w);
1237
+ height: var(--daba-agent-panel-h);
1233
1238
  /* The launcher sits above the panel in the same column, so the panel
1234
1239
  must leave room for it plus the viewport margins \u2014 otherwise on a
1235
1240
  laptop screen the two overlap at the corner. 40px badge + 12px gap
@@ -1653,9 +1658,121 @@ h1, h2, h3, h4, h5, h6) {
1653
1658
  background: #ffffff;
1654
1659
  }
1655
1660
 
1661
+ /* --- history: the same sheet, one level in -------------------------------- */
1662
+ .daba-agent-history {
1663
+ display: flex;
1664
+ flex-direction: column;
1665
+ flex: 1;
1666
+ min-height: 0;
1667
+ background: var(--daba-agent-surface);
1668
+ }
1669
+ .daba-agent-history__head {
1670
+ display: flex;
1671
+ align-items: center;
1672
+ gap: 8px;
1673
+ padding: 10px 12px;
1674
+ border-block-end: 1px solid var(--ref-line);
1675
+ }
1676
+ .daba-agent-history__title {
1677
+ margin: 0;
1678
+ font-size: 14px;
1679
+ font-weight: 600;
1680
+ color: var(--ref-ink);
1681
+ }
1682
+ .daba-agent-history__title:focus-visible {
1683
+ outline: 2px solid var(--daba-agent-accent);
1684
+ outline-offset: 2px;
1685
+ }
1686
+ .daba-agent-history__back {
1687
+ display: grid;
1688
+ place-items: center;
1689
+ width: 28px;
1690
+ height: 28px;
1691
+ border: 0;
1692
+ border-radius: var(--daba-agent-radius-sm);
1693
+ background: transparent;
1694
+ color: var(--ref-muted);
1695
+ cursor: pointer;
1696
+ }
1697
+ .daba-agent-history__back:hover { color: var(--ref-ink); background: var(--ref-user); }
1698
+ .daba-agent-history__list {
1699
+ flex: 1;
1700
+ min-height: 0;
1701
+ overflow-y: auto;
1702
+ padding: 6px;
1703
+ }
1704
+ .daba-agent-history__item {
1705
+ display: flex;
1706
+ align-items: stretch;
1707
+ gap: 2px;
1708
+ border-radius: var(--daba-agent-radius-sm);
1709
+ }
1710
+ .daba-agent-history__item:hover { background: var(--ref-user); }
1711
+ .daba-agent-history__open {
1712
+ flex: 1;
1713
+ min-width: 0;
1714
+ display: flex;
1715
+ flex-direction: column;
1716
+ gap: 2px;
1717
+ padding: 10px;
1718
+ border: 0;
1719
+ background: transparent;
1720
+ font: inherit;
1721
+ text-align: start;
1722
+ cursor: pointer;
1723
+ }
1724
+ .daba-agent-history__name {
1725
+ overflow: hidden;
1726
+ text-overflow: ellipsis;
1727
+ white-space: nowrap;
1728
+ font-size: 13px;
1729
+ color: var(--ref-ink);
1730
+ }
1731
+ .daba-agent-history__meta {
1732
+ font-size: 11px;
1733
+ color: var(--ref-faint);
1734
+ }
1735
+ .daba-agent-history__delete {
1736
+ display: grid;
1737
+ place-items: center;
1738
+ width: 32px;
1739
+ border: 0;
1740
+ border-radius: var(--daba-agent-radius-sm);
1741
+ background: transparent;
1742
+ color: var(--ref-faint);
1743
+ cursor: pointer;
1744
+ /* Revealed on hover: a delete button beside every row turns a list of
1745
+ conversations into a list of ways to lose one. */
1746
+ opacity: 0;
1747
+ }
1748
+ .daba-agent-history__item:hover .daba-agent-history__delete,
1749
+ .daba-agent-history__delete:focus-visible { opacity: 1; }
1750
+ .daba-agent-history__delete:hover { color: var(--daba-agent-danger); }
1751
+ .daba-agent-history__empty {
1752
+ margin: 0;
1753
+ padding: 24px 12px;
1754
+ text-align: center;
1755
+ font-size: 13px;
1756
+ color: var(--ref-muted);
1757
+ }
1758
+ .daba-agent-history__clear {
1759
+ display: block;
1760
+ width: 100%;
1761
+ margin-block-start: 8px;
1762
+ padding: 10px;
1763
+ border: 0;
1764
+ border-radius: var(--daba-agent-radius-sm);
1765
+ background: transparent;
1766
+ font: inherit;
1767
+ font-size: 12px;
1768
+ color: var(--ref-muted);
1769
+ cursor: pointer;
1770
+ }
1771
+ .daba-agent-history__clear:hover { color: var(--daba-agent-danger); }
1772
+
1656
1773
  /* --- launcher: darkens toward black, same hue ----------------------------- */
1657
1774
  .daba-agent-badge {
1658
- border-radius: 10px;
1775
+ border-radius: var(--daba-agent-badge-radius);
1659
1776
  transition: background-color var(--daba-ms) var(--daba-ease);
1660
1777
  }
1661
1778
  .daba-agent-badge:hover { background: color-mix(in srgb, var(--daba-agent-accent) 92%, #000000); }
@@ -1882,24 +1999,12 @@ h1, h2, h3, h4, h5, h6) {
1882
1999
  border-radius: inherit;
1883
2000
  }
1884
2001
 
1885
- `;function At(){if(document.getElementById(Lt))return;let t=document.createElement("style");t.id=Lt,t.textContent=Ln,document.head.appendChild(t);}var j=`<svg viewBox="0 0 469 469" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
2002
+ `;function Yt(){if(document.getElementById(qt))return;let a=document.createElement("style");a.id=qt,a.textContent=On,document.head.appendChild(a);}var V=`<svg viewBox="0 0 469 469" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
1886
2003
  <rect width="469" height="469" rx="70" fill="var(--daba-agent-icon-bg, #0B8458)"/>
1887
2004
  <g transform="translate(94 94) scale(1.905)"><path d="M73.751 0C114.483 0 147.502 33.0194 147.502 73.751C147.502 114.483 114.483 147.502 73.751 147.502C33.0194 147.502 0 114.483 0 73.751C8.24653e-06 33.0194 33.0194 8.2476e-06 73.751 0ZM73.751 116.118C60.7517 116.118 50.2141 120.334 50.2139 125.533C50.2139 130.733 60.7515 134.948 73.751 134.948C86.7504 134.948 97.2881 130.733 97.2881 125.533C97.2878 120.334 86.7502 116.118 73.751 116.118ZM38.9844 31.3828C27.962 31.3828 12.5537 47.8829 12.5537 73.751C12.5538 99.619 27.9621 116.118 38.9844 116.118C51.1171 116.118 56.4902 92.4737 56.4902 73.751C56.4902 55.0282 51.1171 31.3829 38.9844 31.3828ZM108.518 31.3828C96.3849 31.3831 91.0117 55.0283 91.0117 73.751C91.0117 92.4736 96.385 116.118 108.518 116.118C119.54 116.118 134.948 99.619 134.948 73.751C134.948 47.8829 119.54 31.3828 108.518 31.3828Z" fill="var(--daba-agent-icon-mark, #ffffff)"/></g>
1888
- </svg>`;var xe={idle:"Click and talk",connecting:"Connecting\u2026",listening:"Listening\u2026",thinking:"Thinking\u2026",speaking:"Speaking\u2026"};function Dt(t,e,a,n,r){At();let o=document.createElement("button");o.type="button",o.className=`daba-agent-badge daba-agent-badge--idle daba-agent-badge--pos-${t}`,o.setAttribute("aria-label","Click and talk to AI Assistant (Ctrl+Space)"),o.title=xe.idle,a&&o.style.setProperty("--daba-agent-accent",a),n&&o.style.setProperty("--daba-agent-icon-bg",n),r&&o.style.setProperty("--daba-agent-icon-mark",r);let i=document.createElement("span");i.className="daba-agent-badge__icon",i.innerHTML=j,o.appendChild(i);let s=document.createElement("span");s.className="daba-agent-badge__dot",o.appendChild(s);let d=document.createElement("span");return d.className="daba-agent-badge__label daba-agent-badge__label--sr-only",d.textContent=xe.idle,o.appendChild(d),{root:o,label:d}}function Pe(t,e,a,n){t.className=`daba-agent-badge daba-agent-badge--${a} daba-agent-badge--pos-${n}`,t.title=xe[a],e.textContent=xe[a];}function Mt(t,e){let a=t.querySelector(".daba-agent-badge__icon");if(!a)return;if(!e){a.innerHTML=j;return}let n=document.createElement("img");n.className="daba-agent-badge__img",n.alt="",n.decoding="async",n.addEventListener("error",()=>{a.innerHTML=j;}),n.src=e,a.textContent="",a.appendChild(n);}function F(t){return `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${t}</svg>`}var $e={event:F('<rect x="3" y="4" width="18" height="18" rx="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/>'),news:F('<path d="M4 5h12v14a2 2 0 0 0 2 2H5a1 1 0 0 1-1-1z"/><path d="M16 8h4v11a2 2 0 0 1-2 2"/><line x1="7" y1="9" x2="13" y2="9"/><line x1="7" y1="13" x2="13" y2="13"/><line x1="7" y1="17" x2="11" y2="17"/>'),article:F('<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="8" y1="13" x2="16" y2="13"/><line x1="8" y1="17" x2="13" y2="17"/>'),contact:F('<rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 6-10 7L2 6"/>'),action:F('<circle cx="12" cy="12" r="9"/><path d="M9 12h6"/><path d="m13 9 3 3-3 3"/>'),page:F('<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/>')},An=$e.event,It=F('<path d="M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0z"/><circle cx="12" cy="10" r="3"/>'),Dn=F('<path d="M14 3h7v7"/><path d="M21 3 10 14"/><path d="M19 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5"/>'),Mn=/^\d{4}-\d{2}-\d{2}$/,Nt=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}/;function E(t){return typeof t=="string"?t.trim():""}function Ot(t){let e=E(t);return !e||e==="auto"?void 0:e}function Pt(t){let e=Mn.test(t)?new Date(Number(t.slice(0,4)),Number(t.slice(5,7))-1,Number(t.slice(8,10))):new Date(t);return Number.isNaN(e.getTime())?null:e}function we(t,e,a){let n=E(t);if(!n)return "";try{let r=Pt(n);if(!r)return n;let o={year:"numeric",month:"short",day:"numeric"};return a&&Nt.test(n)&&(o.hour="numeric",o.minute="2-digit"),new Intl.DateTimeFormat(Ot(e),o).format(r)}catch{return n}}function In(t,e){let a=E(t);if(!a)return "";try{let n=Pt(a);return n?new Intl.DateTimeFormat(Ot(e),{hour:"numeric",minute:"2-digit"}).format(n):a}catch{return a}}function Hn(t,e){let a=E(t.date)||E(t.endDate);if(!a)return "";let n=we(a,e,true),r=E(t.date)?E(t.endDate):"";if(!r)return n;let o=we(r,e,true);return !o||o===n?n:we(a,e,false)===we(r,e,false)?Nt.test(r)?`${n} \u2013 ${In(r,e)}`:n:`${n} \u2013 ${o}`}function ze(t){let e=E(t);if(!e)return null;try{let a=new URL(e,window.location.href);return a.protocol!=="http:"&&a.protocol!=="https:"?null:e}catch{return null}}function Rn(t){try{return new URL(t,window.location.href).origin!==window.location.origin}catch{return true}}function Ue(t,e,a){let n=document.createElement("span");return n.className=e,a?(n.setAttribute("role","img"),n.setAttribute("aria-label",a)):n.setAttribute("aria-hidden","true"),n.innerHTML=t,n}function Ht(t,e,a,n){let r=document.createElement("div");r.className=`daba-agent-card__row ${n}`,r.appendChild(Ue(t,"daba-agent-card__row-icon",e));let o=document.createElement("span");return o.className="daba-agent-card__row-text",o.textContent=a,r.appendChild(o),r}function Rt(t,e,a,n){let r=document.createElement("a");r.className=`daba-agent-card__action ${n}`,r.href=t,r.rel="noopener noreferrer",Rn(t)&&(r.target="_blank"),r.appendChild(Ue(a,"daba-agent-card__action-icon"));let o=document.createElement("span");return o.textContent=e,r.appendChild(o),r}function Nn(t,e){return t==="article"||t==="news"?e.readMore:e.openLink}function On(t,e,a){let n=t&&$e[t.kind]?t.kind:"page",r=document.createElement("article");r.className=`daba-agent-card daba-agent-card--${n}`;let o=ze(t.imageUrl);if(o){let h=document.createElement("img");h.className="daba-agent-card__image",h.loading="lazy",h.alt="",h.addEventListener("error",()=>h.remove()),h.src=o,r.appendChild(h);}let i=document.createElement("div");i.className="daba-agent-card__body";let s=document.createElement("div");s.className="daba-agent-card__head",s.appendChild(Ue($e[n],"daba-agent-card__icon"));let d=document.createElement("div");d.className="daba-agent-card__title",d.setAttribute("role","heading"),d.setAttribute("aria-level","3"),d.textContent=E(t.title),s.appendChild(d),i.appendChild(s);let l=Hn(t,a);l&&i.appendChild(Ht(An,e.dateLabel,l,"daba-agent-card__row--when"));let f=[E(t.locationName),E(t.address)].filter(Boolean).join(" \xB7 ");f&&i.appendChild(Ht(It,e.locationLabel,f,"daba-agent-card__row--where"));let v=E(t.summary);if(v){let h=document.createElement("p");h.className="daba-agent-card__summary",h.textContent=v,i.appendChild(h);}let I=Array.isArray(t.meta)?t.meta:[];if(I.length){let h=document.createElement("dl");h.className="daba-agent-card__meta";for(let m of I){let k=E(m?.label),C=E(m?.value);if(!k&&!C)continue;let A=document.createElement("dt");A.className="daba-agent-card__meta-label",A.textContent=k;let M=document.createElement("dd");M.className="daba-agent-card__meta-value",M.textContent=C,h.appendChild(A),h.appendChild(M);}h.childElementCount&&i.appendChild(h);}let S=document.createElement("div");S.className="daba-agent-card__actions";let L=ze(t.url);L&&S.appendChild(Rt(L,Nn(n,e),Dn,"daba-agent-card__action--open"));let p=ze(t.mapUrl);return p&&S.appendChild(Rt(p,e.viewOnMap,It,"daba-agent-card__action--map")),S.childElementCount&&i.appendChild(S),r.appendChild(i),r}function zt(t,e,a){if(!Array.isArray(t)||t.length===0)return null;let n=document.createElement("div");n.className="daba-agent-cards",n.setAttribute("role","list"),n.setAttribute("aria-label",e.cardsLabel);for(let r of t){if(!r||!E(r.title))continue;let o=On(r,e,a);o.setAttribute("role","listitem"),n.appendChild(o);}return n.childElementCount?n:null}var Pn=/^(\s*)([-*•])\s+(.*)$/,$t=/^(\s*)(\d+)[.)]\s+(.*)$/,zn=/^#{1,6}\s+(.*)$/,$n=/^>\s?(.*)$/,Un=/^\s*(?:-{3,}|\*{3,}|_{3,})\s*$/,Ut=/^\s*\|(.+)\|\s*$/,Vn=/^\s*\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)*\|?\s*$/,Bn=/(`[^`\n]+`)|(!\[([^\]]*)\]\(([^)\s]+)\))|(\[([^\]]+)\]\(([^)\s]+)\))|(\*\*([^*\n]+?)\*\*)|(\*([^*\s\n](?:[^*\n]*?[^*\s\n])?)\*)/g,jn=/\bhttps?:\/\/[^\s<>()]+[^\s<>().,;:!?'"]/g,Fn=/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,Gn=/\+?\d[\d\s().-]{5,18}\d/g,Wn=/\b(?:call(?:\s+cent(?:er|re))?|phone|dial|tel|hotline)\W{0,4}(\d{3,6})\b(?![\s().-]*\d)/gi,Kn=/(^|[\s(])(\/[A-Za-z][A-Za-z0-9\-._~/]*)/g;function qn(){try{return window.location.host.toLowerCase()}catch{return ""}}function jt(t){let e=t.trim();if(!e||e.length>2e3||e.startsWith("//"))return null;if(e.startsWith("/"))return e;if(/^https?:\/\//i.test(e))try{let a=new URL(e),n=qn();return n&&a.host.toLowerCase()===n?a.href:null}catch{return null}return null}function Q(t,e,a){let n=document.createElement("a");return n.className=`daba-agent-md__link daba-agent-md__link--${a}`,n.href=e,n.textContent=t,n.rel="noopener",n}function Yn(t){let e=t.replace(/[^\d]/g,"");return `tel:${t.trim().startsWith("+")?"+":""}${e}`}function Vt(t,e){let a=[],n=(o,i)=>a.some(s=>o<s.end&&i>s.start);for(let o of e.matchAll(jn)){let i=jt(o[0]);i&&!n(o.index,o.index+o[0].length)&&a.push({start:o.index,end:o.index+o[0].length,node:Q(o[0],i,"site")});}for(let o of e.matchAll(Fn))n(o.index,o.index+o[0].length)||a.push({start:o.index,end:o.index+o[0].length,node:Q(o[0],`mailto:${o[0]}`,"mailto")});for(let o of e.matchAll(Gn))o[0].replace(/\D/g,"").length<7||n(o.index,o.index+o[0].length)||a.push({start:o.index,end:o.index+o[0].length,node:Q(o[0],Yn(o[0]),"tel")});for(let o of e.matchAll(Wn)){let i=o[1],s=o.index+o[0].lastIndexOf(i);n(s,s+i.length)||a.push({start:s,end:s+i.length,node:Q(i,`tel:${i}`,"tel")});}for(let o of e.matchAll(Kn)){let i=o[2].replace(/[.,;:!?)]+$/,""),s=o.index+o[1].length;n(s,s+i.length)||a.push({start:s,end:s+i.length,node:Q(i,i,"site")});}a.sort((o,i)=>o.start-i.start);let r=0;for(let o of a)o.start>r&&t.appendChild(document.createTextNode(e.slice(r,o.start))),t.appendChild(o.node),r=o.end;r<e.length&&t.appendChild(document.createTextNode(e.slice(r)));}function $(t,e){let a=0;for(let n of e.matchAll(Bn)){let r=n.index;if(r>a&&Vt(t,e.slice(a,r)),n[1]){let o=document.createElement("code");o.className="daba-agent-md__code",o.textContent=n[1].slice(1,-1),t.appendChild(o);}else if(n[2])n[3]&&t.appendChild(document.createTextNode(n[3]));else if(n[5]){let o=jt(n[7]);o?t.appendChild(Q(n[6],o,"site")):$(t,n[6]);}else if(n[8]){let o=document.createElement("strong");$(o,n[9]),t.appendChild(o);}else if(n[10]){let o=document.createElement("em");$(o,n[11]),t.appendChild(o);}a=r+n[0].length;}a<e.length&&Vt(t,e.slice(a));}function Bt(t){return t.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(a=>a.trim())}function Ft(t,e){let a=e.replace(/\r\n?/g,`
2005
+ </svg>`;var Rn=["script","foreignobject","iframe","object","embed","animate","set","handler"];function be(a){if(!a)return null;let e=String(a).trim();if(!e.startsWith("<")||typeof DOMParser>"u")return null;let t;try{t=new DOMParser().parseFromString(e,"image/svg+xml");}catch{return null}if(t.querySelector("parsererror"))return null;let n=t.documentElement;if(!n||n.nodeName.toLowerCase()!=="svg")return null;for(let r of Array.from(n.querySelectorAll("*")).concat(n)){if(Rn.includes(r.nodeName.toLowerCase())){r.remove();continue}for(let i of Array.from(r.attributes)){let o=i.name.toLowerCase(),s=i.value.trim(),c=o==="href"||o.endsWith(":href")||o==="src";(o.startsWith("on")||o==="style"||c&&!s.startsWith("#"))&&r.removeAttribute(i.name);}}return n.children.length?(n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),n.outerHTML):null}var Zt={idle:"Click and talk",connecting:"Connecting\u2026",listening:"Listening\u2026",thinking:"Thinking\u2026",speaking:"Speaking\u2026"},Xt={idle:"Click and talk",connecting:"Click to cancel",listening:"Click to end the conversation",thinking:"Click to end the conversation",speaking:"Click to end the conversation"};function Jt(a,e){let t=a==="idle"?"Talk to AI Assistant":"End the conversation with AI Assistant";return e?`${t} (${e})`:t}function Qt(a,e,t,n,r,i){Yt();let o=document.createElement("button");o.type="button",o.className=`daba-agent-badge daba-agent-badge--idle daba-agent-badge--pos-${a}`,o.setAttribute("aria-label",Jt("idle",i)),o.title=Xt.idle,t&&o.style.setProperty("--daba-agent-accent",t),n&&o.style.setProperty("--daba-agent-icon-bg",n),r&&o.style.setProperty("--daba-agent-icon-mark",r);let s=document.createElement("span");s.className="daba-agent-badge__icon",s.innerHTML=V,o.appendChild(s);let c=document.createElement("span");c.className="daba-agent-badge__dot",o.appendChild(c);let d=document.createElement("span");return d.className="daba-agent-badge__label daba-agent-badge__label--sr-only",d.textContent=Zt.idle,o.appendChild(d),{root:o,label:d}}function it(a,e,t,n,r){a.className=`daba-agent-badge daba-agent-badge--${t} daba-agent-badge--pos-${n}`,a.title=Xt[t],a.setAttribute("aria-label",Jt(t,r)),e.textContent=Zt[t];}function ot(a,e){let t=a.querySelector(".daba-agent-badge__icon");if(!t)return;t.textContent="",t.classList.remove("daba-agent-badge__icon--text");let n=be(e.svg);if(n){t.innerHTML=n;return}let r=e.text?.trim();if(r){t.classList.add("daba-agent-badge__icon--text"),t.textContent=r;return}if(e.url){let i=document.createElement("img");i.className="daba-agent-badge__img",i.alt="",i.decoding="async",i.addEventListener("error",()=>{t.innerHTML=V;}),i.src=e.url,t.appendChild(i);return}t.innerHTML=V;}function j(a){return `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${a}</svg>`}var dt={event:j('<rect x="3" y="4" width="18" height="18" rx="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/>'),news:j('<path d="M4 5h12v14a2 2 0 0 0 2 2H5a1 1 0 0 1-1-1z"/><path d="M16 8h4v11a2 2 0 0 1-2 2"/><line x1="7" y1="9" x2="13" y2="9"/><line x1="7" y1="13" x2="13" y2="13"/><line x1="7" y1="17" x2="11" y2="17"/>'),article:j('<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="8" y1="13" x2="16" y2="13"/><line x1="8" y1="17" x2="13" y2="17"/>'),contact:j('<rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 6-10 7L2 6"/>'),action:j('<circle cx="12" cy="12" r="9"/><path d="M9 12h6"/><path d="m13 9 3 3-3 3"/>'),page:j('<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/>')},zn=dt.event,ea=j('<path d="M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0z"/><circle cx="12" cy="10" r="3"/>'),Bn=j('<path d="M14 3h7v7"/><path d="M21 3 10 14"/><path d="M19 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5"/>'),Un=/^\d{4}-\d{2}-\d{2}$/,na=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}/;function D(a){return typeof a=="string"?a.trim():""}function ra(a){let e=D(a);return !e||e==="auto"?void 0:e}function ia(a){let e=Un.test(a)?new Date(Number(a.slice(0,4)),Number(a.slice(5,7))-1,Number(a.slice(8,10))):new Date(a);return Number.isNaN(e.getTime())?null:e}function De(a,e,t){let n=D(a);if(!n)return "";try{let r=ia(n);if(!r)return n;let i={year:"numeric",month:"short",day:"numeric"};return t&&na.test(n)&&(i.hour="numeric",i.minute="2-digit"),new Intl.DateTimeFormat(ra(e),i).format(r)}catch{return n}}function $n(a,e){let t=D(a);if(!t)return "";try{let n=ia(t);return n?new Intl.DateTimeFormat(ra(e),{hour:"numeric",minute:"2-digit"}).format(n):t}catch{return t}}function Vn(a,e){let t=D(a.date)||D(a.endDate);if(!t)return "";let n=De(t,e,true),r=D(a.date)?D(a.endDate):"";if(!r)return n;let i=De(r,e,true);return !i||i===n?n:De(t,e,false)===De(r,e,false)?na.test(r)?`${n} \u2013 ${$n(r,e)}`:n:`${n} \u2013 ${i}`}function st(a){let e=D(a);if(!e)return null;try{let t=new URL(e,window.location.href);return t.protocol!=="http:"&&t.protocol!=="https:"?null:e}catch{return null}}function jn(a){try{return new URL(a,window.location.href).origin!==window.location.origin}catch{return true}}function lt(a,e,t){let n=document.createElement("span");return n.className=e,t?(n.setAttribute("role","img"),n.setAttribute("aria-label",t)):n.setAttribute("aria-hidden","true"),n.innerHTML=a,n}function ta(a,e,t,n){let r=document.createElement("div");r.className=`daba-agent-card__row ${n}`,r.appendChild(lt(a,"daba-agent-card__row-icon",e));let i=document.createElement("span");return i.className="daba-agent-card__row-text",i.textContent=t,r.appendChild(i),r}function aa(a,e,t,n){let r=document.createElement("a");r.className=`daba-agent-card__action ${n}`,r.href=a,r.rel="noopener noreferrer",jn(a)&&(r.target="_blank"),r.appendChild(lt(t,"daba-agent-card__action-icon"));let i=document.createElement("span");return i.textContent=e,r.appendChild(i),r}function Fn(a,e){return a==="article"||a==="news"?e.readMore:e.openLink}function Gn(a,e,t){let n=a&&dt[a.kind]?a.kind:"page",r=document.createElement("article");r.className=`daba-agent-card daba-agent-card--${n}`;let i=st(a.imageUrl);if(i){let h=document.createElement("img");h.className="daba-agent-card__image",h.loading="lazy",h.alt="",h.addEventListener("error",()=>h.remove()),h.src=i,r.appendChild(h);}let o=document.createElement("div");o.className="daba-agent-card__body";let s=document.createElement("div");s.className="daba-agent-card__head",s.appendChild(lt(dt[n],"daba-agent-card__icon"));let c=document.createElement("div");c.className="daba-agent-card__title",c.setAttribute("role","heading"),c.setAttribute("aria-level","3"),c.textContent=D(a.title),s.appendChild(c),o.appendChild(s);let d=Vn(a,t);d&&o.appendChild(ta(zn,e.dateLabel,d,"daba-agent-card__row--when"));let f=[D(a.locationName),D(a.address)].filter(Boolean).join(" \xB7 ");f&&o.appendChild(ta(ea,e.locationLabel,f,"daba-agent-card__row--where"));let b=D(a.summary);if(b){let h=document.createElement("p");h.className="daba-agent-card__summary",h.textContent=b,o.appendChild(h);}let S=Array.isArray(a.meta)?a.meta:[];if(S.length){let h=document.createElement("dl");h.className="daba-agent-card__meta";for(let E of S){let w=D(E?.label),A=D(E?.value);if(!w&&!A)continue;let H=document.createElement("dt");H.className="daba-agent-card__meta-label",H.textContent=w;let k=document.createElement("dd");k.className="daba-agent-card__meta-value",k.textContent=A,h.appendChild(H),h.appendChild(k);}h.childElementCount&&o.appendChild(h);}let _=document.createElement("div");_.className="daba-agent-card__actions";let C=st(a.url);C&&_.appendChild(aa(C,Fn(n,e),Bn,"daba-agent-card__action--open"));let v=st(a.mapUrl);return v&&_.appendChild(aa(v,e.viewOnMap,ea,"daba-agent-card__action--map")),_.childElementCount&&o.appendChild(_),r.appendChild(o),r}function oa(a,e,t){if(!Array.isArray(a)||a.length===0)return null;let n=document.createElement("div");n.className="daba-agent-cards",n.setAttribute("role","list"),n.setAttribute("aria-label",e.cardsLabel);for(let r of a){if(!r||!D(r.title))continue;let i=Gn(r,e,t);i.setAttribute("role","listitem"),n.appendChild(i);}return n.childElementCount?n:null}var Wn=/^(\s*)([-*•])\s+(.*)$/,sa=/^(\s*)(\d+)[.)]\s+(.*)$/,Kn=/^#{1,6}\s+(.*)$/,qn=/^>\s?(.*)$/,Yn=/^\s*(?:-{3,}|\*{3,}|_{3,})\s*$/,da=/^\s*\|(.+)\|\s*$/,Zn=/^\s*\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)*\|?\s*$/,Xn=/(`[^`\n]+`)|(!\[([^\]]*)\]\(([^)\s]+)\))|(\[([^\]]+)\]\(([^)\s]+)\))|(\*\*([^*\n]+?)\*\*)|(\*([^*\s\n](?:[^*\n]*?[^*\s\n])?)\*)/g,Jn=/\bhttps?:\/\/[^\s<>()]+[^\s<>().,;:!?'"]/g,Qn=/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,er=/\+?\d[\d\s().-]{5,18}\d/g,tr=/\b(?:call(?:\s+cent(?:er|re))?|phone|dial|tel|hotline)\W{0,4}(\d{3,6})\b(?![\s().-]*\d)/gi,ar=/(^|[\s(])(\/[A-Za-z][A-Za-z0-9\-._~/]*)/g;function nr(){try{return window.location.host.toLowerCase()}catch{return ""}}function ga(a){let e=a.trim();if(!e||e.length>2e3||e.startsWith("//"))return null;if(e.startsWith("/"))return e;if(/^https?:\/\//i.test(e))try{let t=new URL(e),n=nr();return n&&t.host.toLowerCase()===n?t.href:null}catch{return null}return null}function re(a,e,t){let n=document.createElement("a");return n.className=`daba-agent-md__link daba-agent-md__link--${t}`,n.href=e,n.textContent=a,n.rel="noopener",n}function rr(a){let e=a.replace(/[^\d]/g,"");return `tel:${a.trim().startsWith("+")?"+":""}${e}`}function la(a,e){let t=[],n=(i,o)=>t.some(s=>i<s.end&&o>s.start);for(let i of e.matchAll(Jn)){let o=ga(i[0]);o&&!n(i.index,i.index+i[0].length)&&t.push({start:i.index,end:i.index+i[0].length,node:re(i[0],o,"site")});}for(let i of e.matchAll(Qn))n(i.index,i.index+i[0].length)||t.push({start:i.index,end:i.index+i[0].length,node:re(i[0],`mailto:${i[0]}`,"mailto")});for(let i of e.matchAll(er))i[0].replace(/\D/g,"").length<7||n(i.index,i.index+i[0].length)||t.push({start:i.index,end:i.index+i[0].length,node:re(i[0],rr(i[0]),"tel")});for(let i of e.matchAll(tr)){let o=i[1],s=i.index+i[0].lastIndexOf(o);n(s,s+o.length)||t.push({start:s,end:s+o.length,node:re(o,`tel:${o}`,"tel")});}for(let i of e.matchAll(ar)){let o=i[2].replace(/[.,;:!?)]+$/,""),s=i.index+i[1].length;n(s,s+o.length)||t.push({start:s,end:s+o.length,node:re(o,o,"site")});}t.sort((i,o)=>i.start-o.start);let r=0;for(let i of t)i.start>r&&a.appendChild(document.createTextNode(e.slice(r,i.start))),a.appendChild(i.node),r=i.end;r<e.length&&a.appendChild(document.createTextNode(e.slice(r)));}function B(a,e){let t=0;for(let n of e.matchAll(Xn)){let r=n.index;if(r>t&&la(a,e.slice(t,r)),n[1]){let i=document.createElement("code");i.className="daba-agent-md__code",i.textContent=n[1].slice(1,-1),a.appendChild(i);}else if(n[2])n[3]&&a.appendChild(document.createTextNode(n[3]));else if(n[5]){let i=ga(n[7]);i?a.appendChild(re(n[6],i,"site")):B(a,n[6]);}else if(n[8]){let i=document.createElement("strong");B(i,n[9]),a.appendChild(i);}else if(n[10]){let i=document.createElement("em");B(i,n[11]),a.appendChild(i);}t=r+n[0].length;}t<e.length&&la(a,e.slice(t));}function ca(a){return a.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(t=>t.trim())}function pa(a,e){let t=e.replace(/\r\n?/g,`
1889
2006
  `).split(`
1890
- `),n=[],r=[],o=null,i=()=>{if(!n.length)return;let l=document.createElement("p");l.className="daba-agent-md__p",$(l,n.join(" ")),(o??t).appendChild(l),n=[];},s=(l=-1)=>{for(;r.length&&r[r.length-1].indent>l;)r.pop();},d=()=>{i(),o=null;};for(let l=0;l<a.length;l++){let f=a[l],v=f.replace(/\s+$/,"");if(!v.trim()){i(),s(),d();continue}if(Un.test(v)){i(),s(),d();let p=document.createElement("hr");p.className="daba-agent-md__hr",t.appendChild(p);continue}if(Ut.test(v)&&l+1<a.length&&Vn.test(a[l+1])){i(),s(),d();let p=document.createElement("div");p.className="daba-agent-md__table-wrap";let h=document.createElement("table");h.className="daba-agent-md__table";let m=document.createElement("thead"),k=document.createElement("tr");for(let A of Bt(v)){let M=document.createElement("th");$(M,A),k.appendChild(M);}m.appendChild(k),h.appendChild(m);let C=document.createElement("tbody");for(l+=1;l+1<a.length&&Ut.test(a[l+1]);){l+=1;let A=document.createElement("tr");for(let M of Bt(a[l])){let q=document.createElement("td");$(q,M),A.appendChild(q);}C.appendChild(A);}h.appendChild(C),p.appendChild(h),t.appendChild(p);continue}let I=$n.exec(v);if(I){o||(i(),s(),o=document.createElement("blockquote"),o.className="daba-agent-md__quote",t.appendChild(o)),n.push(I[1].trim());continue}else o&&d();let S=zn.exec(v);if(S){i(),s();let p=document.createElement("p");p.className="daba-agent-md__h",$(p,S[1].trim()),t.appendChild(p);continue}let L=Pn.exec(v)??$t.exec(v);if(L){i();let p=L[1].length,h=$t.test(v);s(p);let m=r[r.length-1];if(!m||m.indent<p){let C=document.createElement(h?"ol":"ul");C.className="daba-agent-md__list",(m?.el.lastElementChild??t).appendChild(C),m={el:C,indent:p},r.push(m);}let k=document.createElement("li");$(k,L[3]),m.el.appendChild(k);continue}if(r.length&&f.startsWith(" ")){let p=r[r.length-1].el.lastElementChild;if(p){p.appendChild(document.createTextNode(" ")),$(p,v.trim());continue}}s(),n.push(v.trim());}return i(),t}var G={mic:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" y1="19" x2="12" y2="22"/></svg>',close:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',refresh:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 0 1 15-6.7L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-15 6.7L3 16"/><path d="M3 21v-5h5"/></svg>',send:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>',search:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>',spark:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M18.4 5.6l-2.8 2.8M8.4 15.6l-2.8 2.8"/></svg>',grid:'<svg viewBox="0 0 24 24" fill="currentColor"><circle cx="5" cy="5" r="1.6"/><circle cx="12" cy="5" r="1.6"/><circle cx="19" cy="5" r="1.6"/><circle cx="5" cy="12" r="1.6"/><circle cx="12" cy="12" r="1.6"/><circle cx="19" cy="12" r="1.6"/><circle cx="5" cy="19" r="1.6"/><circle cx="12" cy="19" r="1.6"/><circle cx="19" cy="19" r="1.6"/></svg>',calendar:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="16" rx="2.5"/><path d="M3 10h18M8 3v4M16 3v4"/></svg>',news:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 5h12a2 2 0 0 1 2 2v11a2 2 0 0 0 2 2H6a2 2 0 0 1-2-2z"/><path d="M8 9h6M8 13h6M8 17h4"/></svg>',ticket:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 9V7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v2a2 2 0 0 0 0 6v2a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-2a2 2 0 0 0 0-6z"/><path d="M12 7v2M12 15v2"/></svg>',clock:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="8.5"/><path d="M12 7.5V12l3 1.8"/></svg>',chevron:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>',keys:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="6" width="18" height="12" rx="2.5"/><path d="M7 10h.01M11 10h.01M15 10h.01M7 14h10"/></svg>',pin:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 21s7-5.7 7-11a7 7 0 1 0-14 0c0 5.3 7 11 7 11z"/><circle cx="12" cy="10" r="2.5"/></svg>'},Gt=[{icon:"calendar",tone:"a"},{icon:"news",tone:"b"},{icon:"ticket",tone:"c"},{icon:"clock",tone:"d"},{icon:"pin",tone:"e"},{icon:"spark",tone:"f"}];function ee(t,e){let a=document.createElement("span");return a.className=e,a.innerHTML=t,a}function se(t,e,a,n){let r=document.createElement("button");return r.type="button",r.className=a,r.setAttribute("aria-label",e),r.title=e,r.innerHTML=t,n&&r.addEventListener("click",n),r}function Wt(t){let{title:e,placeholder:a,strings:n,direction:r,lang:o,mode:i,intro:s,logoUrl:d,hotkeyLabel:l,onSendText:f,onMicClick:v,onCloseClick:I,onNewConversation:S}=t,L=i!=="chat",p=document.createElement("div");p.className="daba-agent-window daba-agent-window--hidden daba-agent-window--intro",p.dir=r,p.lang=o,p.setAttribute("role","dialog"),p.setAttribute("aria-label",e);let h=document.createElement("div");h.className="daba-agent-header";let m=document.createElement("div");m.className="daba-agent-header__left";let k=document.createElement("span");k.className="daba-agent-header__mark-slot",m.appendChild(k);let C=c=>{if(k.textContent="",c){let g=document.createElement("img");g.className="daba-agent-header__logo",g.alt="",g.addEventListener("error",()=>C(null)),g.src=c,k.appendChild(g);}else k.appendChild(ee(j,"daba-agent-header__mark"));};C(d);let A=document.createElement("span");A.className="daba-agent-header__title",A.textContent=e,m.appendChild(A);let M=document.createElement("span");M.className="daba-agent-header__status",m.appendChild(M),h.appendChild(m);let q=document.createElement("div");q.className="daba-agent-header__right";let et=se(G.mic,n.startVoice,"daba-agent-header__btn daba-agent-header__btn--mic",v);et.hidden=true,q.appendChild(se(G.grid,n.newConversation,"daba-agent-header__btn",S)),q.appendChild(se(G.close,n.close,"daba-agent-header__btn",I)),h.appendChild(q),p.appendChild(h);let P=document.createElement("div");P.className="daba-agent-messages",P.setAttribute("role","log"),P.setAttribute("aria-live","polite");let _=null,V=null,Te=null,Se=null,B=null,tt=c=>{if(V)if(V.textContent="",c){let g=document.createElement("img");g.className="daba-agent-intro__mark daba-agent-intro__logo",g.alt="",g.addEventListener("error",()=>tt(null)),g.src=c,V.appendChild(g);}else V.appendChild(ee(j,"daba-agent-intro__mark"));};function at(c){B&&(B.textContent="",c.forEach((g,R)=>{let x=Gt[R%Gt.length],N=document.createElement("button");N.type="button",N.className=`daba-agent-prompt-chip daba-agent-prompt-chip--${x.tone}`,N.appendChild(ee(G[x.icon],"daba-agent-prompt-chip__icon"));let rt=document.createElement("span");rt.textContent=g,N.appendChild(rt),N.addEventListener("click",()=>f(g)),B.appendChild(N);}),B.hidden=c.length===0);}if(s.enabled!==false){if(_=document.createElement("div"),_.className="daba-agent-intro",s.mediaUrl&&s.mediaType==="video"){let x=document.createElement("video");x.className="daba-agent-intro__media",x.src=s.mediaUrl,x.autoplay=true,x.muted=true,x.loop=true,x.playsInline=true,x.addEventListener("error",()=>x.remove()),_.appendChild(x);}else if(s.mediaUrl&&s.mediaType==="image"){let x=document.createElement("img");x.className="daba-agent-intro__media",x.src=s.mediaUrl,x.alt="",x.addEventListener("error",()=>x.remove()),_.appendChild(x);}else V=document.createElement("span"),V.className="daba-agent-intro__mark-slot",V.appendChild(ee(j,"daba-agent-intro__mark")),_.appendChild(V);let c=document.createElement("p");c.className="daba-agent-intro__greeting",c.textContent=n.introGreeting,_.appendChild(c);let g=document.createElement("p");g.className="daba-agent-intro__headline",g.textContent=s.headline||n.introDefaultHeadline,_.appendChild(g);let R=document.createElement("p");R.className="daba-agent-intro__sub",R.textContent=s.subheadline||n.introDefaultSubheadline,_.appendChild(R),B=document.createElement("div"),B.className="daba-agent-intro__prompts",B.setAttribute("aria-label",n.suggestionsLabel),at(s.suggestedPrompts??[]),_.appendChild(B),Te=g,Se=R,P.appendChild(_);}p.appendChild(P);let le=null,Ta=()=>{if(le)return;let c=document.createElement("div");c.className="daba-agent-group daba-agent-group--agent daba-agent-thinking";let g=document.createElement("div");g.className="daba-agent-msg daba-agent-msg--agent daba-agent-skeleton",g.setAttribute("role","status"),g.setAttribute("aria-label",n.thinking);for(let x of ["84%","62%","38%"]){let N=document.createElement("span");N.className="daba-agent-skeleton__line",N.style.width=x,g.appendChild(N);}c.appendChild(g);let R=document.createElement("span");R.className="daba-agent-thinking__label",R.textContent=n.thinking,c.appendChild(R),P.appendChild(c),P.scrollTop=P.scrollHeight,le=c;},Sa=()=>{le?.remove(),le=null;},ce=document.createElement("div");ce.className="daba-agent-composer";let re=document.createElement("form");re.className="daba-agent-input-form";let Z=document.createElement("div");Z.className="daba-agent-field",Z.appendChild(ee(G.search,"daba-agent-field__icon"));let D=document.createElement("input");D.type="text",D.className="daba-agent-input",D.placeholder=a,D.setAttribute("aria-label",a),D.autocomplete="off",Z.appendChild(D);let nt=se(G.send,n.send,"daba-agent-send-btn");nt.type="submit",Z.appendChild(nt);let Le=null;L&&(Le=se(G.mic,n.startVoice,"daba-agent-composer__mic",v),Z.appendChild(Le)),re.appendChild(Z);let Ae=()=>{re.classList.toggle("daba-agent-input-form--ready",D.value.trim().length>0);};D.addEventListener("input",Ae),Ae(),re.addEventListener("submit",c=>{c.preventDefault();let g=D.value.trim();g&&(D.value="",Ae(),f(g));}),ce.appendChild(re);let ge=document.createElement("div");ge.className="daba-agent-footer";let De=document.createElement("span");De.className="daba-agent-footer__brand",De.textContent=n.poweredBy,ge.appendChild(De);let Me=document.createElement("span");if(Me.className="daba-agent-footer__right",L&&l){let c=document.createElement("span");c.className="daba-agent-footer__item",c.appendChild(ee(G.keys,"daba-agent-footer__icon"));let g=document.createElement("span");g.textContent=n.voiceHint.replace("{hotkey}",l),c.appendChild(g),Me.appendChild(c);}return ge.appendChild(Me),ce.appendChild(ge),p.appendChild(ce),{chatWindow:p,messagesContainer:P,inputElement:D,micBtn:et,introEl:_,composerMicBtn:Le,setTyping(c){c?Ta():Sa();},setIntroVisible(c){_&&_.classList.toggle("daba-agent-intro--hidden",!c),p.classList.toggle("daba-agent-window--intro",c&&!!_);},setStatusText(c){M.textContent=c;},applyConfig(c){c.logoUrl!==void 0&&(C(c.logoUrl),tt(c.logoUrl)),c.title&&(A.textContent=c.title,p.setAttribute("aria-label",c.title)),c.placeholder&&!D.value&&(D.placeholder=c.placeholder,D.setAttribute("aria-label",c.placeholder));let g=c.intro;if(!(!g||!_)){if(g.enabled===false){_.remove(),_=null,p.classList.remove("daba-agent-window--intro");return}g.headline&&Te&&(Te.textContent=g.headline),g.subheadline&&Se&&(Se.textContent=g.subheadline),g.suggestedPrompts&&at(g.suggestedPrompts);}}}}function H(t,e,a,n){let r=document.createElement("div");r.className=`daba-agent-group daba-agent-group--${a}`;let o=document.createElement("div");if(o.className=`daba-agent-msg daba-agent-msg--${a}`,a==="agent"?Ft(o,e):o.textContent=e,r.appendChild(o),n?.cards?.length&&n.strings){let i=zt(n.cards,n.strings,n.lang??"en");i&&r.appendChild(i);}if(a==="agent"&&n?.suggestions?.length&&n.onSuggestion){let i=document.createElement("div");i.className="daba-agent-suggestions";for(let s of n.suggestions){let d=document.createElement("button");d.type="button",d.className="daba-agent-suggestion",d.textContent=s,d.addEventListener("click",()=>n.onSuggestion(s)),i.appendChild(d);}r.appendChild(i);}return t.appendChild(r),t.scrollTop=t.scrollHeight,o}var Ve={en:{assistantTitle:"AI Assistant",inputPlaceholder:"Ask a question\u2026",send:"Send",startVoice:"Start voice chat",stopVoice:"Stop voice chat",listening:"Listening\u2026",thinking:"Thinking\u2026",speaking:"Speaking\u2026",connecting:"Connecting\u2026",close:"Close",minimize:"Minimize",newConversation:"New conversation",poweredBy:"Powered by Dabalabs",errorGeneric:"Something went wrong. Please try again.",errorMicDenied:"Microphone access was blocked. Allow it in your browser settings to talk.",errorOffline:"You appear to be offline. Check your connection.",introGreeting:"Hi there,",voiceHint:"{hotkey} to talk",introDefaultHeadline:"How can I help?",introDefaultSubheadline:"Ask me anything about this site.",suggestionsLabel:"Suggested questions",viewOnMap:"View on map",readMore:"Read more",openLink:"Open",dateLabel:"Date",locationLabel:"Location",retry:"Try again",typeOrTalk:"Type, or tap the mic to talk",voiceUnavailable:"Voice is unavailable on this device.",cardsLabel:"Results"},ar:{assistantTitle:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F \u0627\u0644\u0630\u0643\u064A",inputPlaceholder:"\u0627\u0637\u0631\u062D \u0633\u0624\u0627\u0644\u0627\u064B\u2026",send:"\u0625\u0631\u0633\u0627\u0644",startVoice:"\u0628\u062F\u0621 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0627\u0644\u0635\u0648\u062A\u064A\u0629",stopVoice:"\u0625\u064A\u0642\u0627\u0641 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0627\u0644\u0635\u0648\u062A\u064A\u0629",listening:"\u062C\u0627\u0631\u064D \u0627\u0644\u0627\u0633\u062A\u0645\u0627\u0639\u2026",thinking:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0641\u0643\u064A\u0631\u2026",speaking:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u062F\u062B\u2026",connecting:"\u062C\u0627\u0631\u064D \u0627\u0644\u0627\u062A\u0635\u0627\u0644\u2026",close:"\u0625\u063A\u0644\u0627\u0642",minimize:"\u062A\u0635\u063A\u064A\u0631",newConversation:"\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Dabalabs",errorGeneric:"\u062D\u062F\u062B \u062E\u0637\u0623 \u0645\u0627. \u064A\u0631\u062C\u0649 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",errorMicDenied:"\u062A\u0645 \u062D\u0638\u0631 \u0627\u0644\u0648\u0635\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u064A\u0643\u0631\u0648\u0641\u0648\u0646. \u0627\u0633\u0645\u062D \u0628\u0647 \u0645\u0646 \u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0645\u062A\u0635\u0641\u062D \u0644\u0644\u062A\u062D\u062F\u062B.",errorOffline:"\u064A\u0628\u062F\u0648 \u0623\u0646\u0643 \u063A\u064A\u0631 \u0645\u062A\u0635\u0644 \u0628\u0627\u0644\u0625\u0646\u062A\u0631\u0646\u062A. \u062A\u062D\u0642\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643.",introGreeting:"\u0645\u0631\u062D\u0628\u0627\u064B\u060C",voiceHint:"\u0627\u0636\u063A\u0637 {hotkey} \u0644\u0644\u062A\u062D\u062F\u062B",introDefaultHeadline:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u064A \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",introDefaultSubheadline:"\u0627\u0633\u0623\u0644\u0646\u064A \u0639\u0646 \u0623\u064A \u0634\u064A\u0621 \u064A\u062E\u0635 \u0647\u0630\u0627 \u0627\u0644\u0645\u0648\u0642\u0639.",suggestionsLabel:"\u0623\u0633\u0626\u0644\u0629 \u0645\u0642\u062A\u0631\u062D\u0629",viewOnMap:"\u0639\u0631\u0636 \u0639\u0644\u0649 \u0627\u0644\u062E\u0631\u064A\u0637\u0629",readMore:"\u0627\u0642\u0631\u0623 \u0627\u0644\u0645\u0632\u064A\u062F",openLink:"\u0641\u062A\u062D",dateLabel:"\u0627\u0644\u062A\u0627\u0631\u064A\u062E",locationLabel:"\u0627\u0644\u0645\u0648\u0642\u0639",retry:"\u0623\u0639\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",typeOrTalk:"\u0627\u0643\u062A\u0628 \u0623\u0648 \u0627\u0636\u063A\u0637 \u0639\u0644\u0649 \u0627\u0644\u0645\u064A\u0643\u0631\u0648\u0641\u0648\u0646 \u0644\u0644\u062A\u062D\u062F\u062B",voiceUnavailable:"\u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0627\u0644\u0635\u0648\u062A\u064A\u0629 \u063A\u064A\u0631 \u0645\u062A\u0627\u062D\u0629 \u0639\u0644\u0649 \u0647\u0630\u0627 \u0627\u0644\u062C\u0647\u0627\u0632.",cardsLabel:"\u0627\u0644\u0646\u062A\u0627\u0626\u062C"},fr:{assistantTitle:"Assistant IA",inputPlaceholder:"Posez une question\u2026",send:"Envoyer",startVoice:"D\xE9marrer la conversation vocale",stopVoice:"Arr\xEAter la conversation vocale",listening:"\xC0 l'\xE9coute\u2026",thinking:"R\xE9flexion\u2026",speaking:"R\xE9ponse en cours\u2026",connecting:"Connexion\u2026",close:"Fermer",minimize:"R\xE9duire",newConversation:"Nouvelle conversation",poweredBy:"Propuls\xE9 par Dabalabs",errorGeneric:"Une erreur s'est produite. Veuillez r\xE9essayer.",errorMicDenied:"L'acc\xE8s au microphone a \xE9t\xE9 bloqu\xE9. Autorisez-le dans les param\xE8tres du navigateur pour parler.",errorOffline:"Vous semblez \xEAtre hors ligne. V\xE9rifiez votre connexion.",introGreeting:"Bonjour,",voiceHint:"{hotkey} pour parler",introDefaultHeadline:"Comment puis-je vous aider ?",introDefaultSubheadline:"Posez-moi vos questions sur ce site.",suggestionsLabel:"Questions sugg\xE9r\xE9es",viewOnMap:"Voir sur la carte",readMore:"En savoir plus",openLink:"Ouvrir",dateLabel:"Date",locationLabel:"Lieu",retry:"R\xE9essayer",typeOrTalk:"\xC9crivez, ou appuyez sur le micro pour parler",voiceUnavailable:"La voix n'est pas disponible sur cet appareil.",cardsLabel:"R\xE9sultats"},es:{assistantTitle:"Asistente de IA",inputPlaceholder:"Haz una pregunta\u2026",send:"Enviar",startVoice:"Iniciar conversaci\xF3n por voz",stopVoice:"Detener conversaci\xF3n por voz",listening:"Escuchando\u2026",thinking:"Pensando\u2026",speaking:"Hablando\u2026",connecting:"Conectando\u2026",close:"Cerrar",minimize:"Minimizar",newConversation:"Nueva conversaci\xF3n",poweredBy:"Con tecnolog\xEDa de Dabalabs",errorGeneric:"Algo sali\xF3 mal. Int\xE9ntalo de nuevo.",errorMicDenied:"Se bloque\xF3 el acceso al micr\xF3fono. Perm\xEDtelo en la configuraci\xF3n del navegador para hablar.",errorOffline:"Parece que no tienes conexi\xF3n. Comprueba tu red.",introGreeting:"Hola,",voiceHint:"{hotkey} para hablar",introDefaultHeadline:"\xBFEn qu\xE9 puedo ayudarte?",introDefaultSubheadline:"Preg\xFAntame lo que quieras sobre este sitio.",suggestionsLabel:"Preguntas sugeridas",viewOnMap:"Ver en el mapa",readMore:"Leer m\xE1s",openLink:"Abrir",dateLabel:"Fecha",locationLabel:"Ubicaci\xF3n",retry:"Reintentar",typeOrTalk:"Escribe, o toca el micr\xF3fono para hablar",voiceUnavailable:"La voz no est\xE1 disponible en este dispositivo.",cardsLabel:"Resultados"},de:{assistantTitle:"KI-Assistent",inputPlaceholder:"Stellen Sie eine Frage\u2026",send:"Senden",startVoice:"Sprachchat starten",stopVoice:"Sprachchat beenden",listening:"H\xF6rt zu\u2026",thinking:"Denkt nach\u2026",speaking:"Spricht\u2026",connecting:"Verbinden\u2026",close:"Schlie\xDFen",minimize:"Minimieren",newConversation:"Neue Unterhaltung",poweredBy:"Bereitgestellt von Dabalabs",errorGeneric:"Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.",errorMicDenied:"Der Mikrofonzugriff wurde blockiert. Erlauben Sie ihn in den Browsereinstellungen, um zu sprechen.",errorOffline:"Sie scheinen offline zu sein. Pr\xFCfen Sie Ihre Verbindung.",introGreeting:"Hallo,",voiceHint:"{hotkey} zum Sprechen",introDefaultHeadline:"Wie kann ich helfen?",introDefaultSubheadline:"Fragen Sie mich alles \xFCber diese Website.",suggestionsLabel:"Vorgeschlagene Fragen",viewOnMap:"Auf Karte ansehen",readMore:"Mehr lesen",openLink:"\xD6ffnen",dateLabel:"Datum",locationLabel:"Ort",retry:"Erneut versuchen",typeOrTalk:"Schreiben oder aufs Mikrofon tippen, um zu sprechen",voiceUnavailable:"Die Sprachfunktion ist auf diesem Ger\xE4t nicht verf\xFCgbar.",cardsLabel:"Ergebnisse"},ru:{assistantTitle:"\u0418\u0418-\u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043D\u0442",inputPlaceholder:"\u0417\u0430\u0434\u0430\u0439\u0442\u0435 \u0432\u043E\u043F\u0440\u043E\u0441\u2026",send:"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",startVoice:"\u041D\u0430\u0447\u0430\u0442\u044C \u0433\u043E\u043B\u043E\u0441\u043E\u0432\u043E\u0439 \u0447\u0430\u0442",stopVoice:"\u041E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0433\u043E\u043B\u043E\u0441\u043E\u0432\u043E\u0439 \u0447\u0430\u0442",listening:"\u0421\u043B\u0443\u0448\u0430\u044E\u2026",thinking:"\u0414\u0443\u043C\u0430\u044E\u2026",speaking:"\u0413\u043E\u0432\u043E\u0440\u044E\u2026",connecting:"\u041F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435\u2026",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",minimize:"\u0421\u0432\u0435\u0440\u043D\u0443\u0442\u044C",newConversation:"\u041D\u043E\u0432\u044B\u0439 \u0434\u0438\u0430\u043B\u043E\u0433",poweredBy:"\u0420\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u043D\u0430 Dabalabs",errorGeneric:"\u0427\u0442\u043E-\u0442\u043E \u043F\u043E\u0448\u043B\u043E \u043D\u0435 \u0442\u0430\u043A. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437.",errorMicDenied:"\u0414\u043E\u0441\u0442\u0443\u043F \u043A \u043C\u0438\u043A\u0440\u043E\u0444\u043E\u043D\u0443 \u0437\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u043D. \u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u0435 \u0435\u0433\u043E \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u0445 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, \u0447\u0442\u043E\u0431\u044B \u0433\u043E\u0432\u043E\u0440\u0438\u0442\u044C.",errorOffline:"\u041F\u043E\u0445\u043E\u0436\u0435, \u0432\u044B \u043D\u0435 \u0432 \u0441\u0435\u0442\u0438. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435.",introGreeting:"\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435,",voiceHint:"{hotkey} \u2014 \u0433\u043E\u0432\u043E\u0440\u0438\u0442\u044C",introDefaultHeadline:"\u0427\u0435\u043C \u044F \u043C\u043E\u0433\u0443 \u043F\u043E\u043C\u043E\u0447\u044C?",introDefaultSubheadline:"\u0421\u043F\u0440\u043E\u0441\u0438\u0442\u0435 \u043C\u0435\u043D\u044F \u043E \u0447\u0451\u043C \u0443\u0433\u043E\u0434\u043D\u043E \u043D\u0430 \u044D\u0442\u043E\u043C \u0441\u0430\u0439\u0442\u0435.",suggestionsLabel:"\u041F\u0440\u0435\u0434\u043B\u0430\u0433\u0430\u0435\u043C\u044B\u0435 \u0432\u043E\u043F\u0440\u043E\u0441\u044B",viewOnMap:"\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u043D\u0430 \u043A\u0430\u0440\u0442\u0435",readMore:"\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u0435\u0435",openLink:"\u041E\u0442\u043A\u0440\u044B\u0442\u044C",dateLabel:"\u0414\u0430\u0442\u0430",locationLabel:"\u041C\u0435\u0441\u0442\u043E",retry:"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C",typeOrTalk:"\u041D\u0430\u043F\u0438\u0448\u0438\u0442\u0435 \u0438\u043B\u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \u043D\u0430 \u043C\u0438\u043A\u0440\u043E\u0444\u043E\u043D, \u0447\u0442\u043E\u0431\u044B \u0433\u043E\u0432\u043E\u0440\u0438\u0442\u044C",voiceUnavailable:"\u0413\u043E\u043B\u043E\u0441\u043E\u0432\u043E\u0439 \u0440\u0435\u0436\u0438\u043C \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u043D\u0430 \u044D\u0442\u043E\u043C \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0435.",cardsLabel:"\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B"},tr:{assistantTitle:"Yapay Zek\xE2 Asistan\u0131",inputPlaceholder:"Bir soru sorun\u2026",send:"G\xF6nder",startVoice:"Sesli sohbeti ba\u015Flat",stopVoice:"Sesli sohbeti durdur",listening:"Dinliyor\u2026",thinking:"D\xFC\u015F\xFCn\xFCyor\u2026",speaking:"Konu\u015Fuyor\u2026",connecting:"Ba\u011Flan\u0131yor\u2026",close:"Kapat",minimize:"K\xFC\xE7\xFClt",newConversation:"Yeni sohbet",poweredBy:"Dabalabs taraf\u0131ndan sa\u011Flan\u0131r",errorGeneric:"Bir \u015Feyler ters gitti. L\xFCtfen tekrar deneyin.",errorMicDenied:"Mikrofon eri\u015Fimi engellendi. Konu\u015Fmak i\xE7in taray\u0131c\u0131 ayarlar\u0131ndan izin verin.",errorOffline:"\xC7evrimd\u0131\u015F\u0131 g\xF6r\xFCn\xFCyorsunuz. Ba\u011Flant\u0131n\u0131z\u0131 kontrol edin.",introGreeting:"Merhaba,",voiceHint:"Konu\u015Fmak i\xE7in {hotkey}",introDefaultHeadline:"Nas\u0131l yard\u0131mc\u0131 olabilirim?",introDefaultSubheadline:"Bu site hakk\u0131nda bana her \u015Feyi sorabilirsiniz.",suggestionsLabel:"\xD6nerilen sorular",viewOnMap:"Haritada g\xF6ster",readMore:"Devam\u0131n\u0131 oku",openLink:"A\xE7",dateLabel:"Tarih",locationLabel:"Konum",retry:"Tekrar dene",typeOrTalk:"Yaz\u0131n veya konu\u015Fmak i\xE7in mikrofona dokunun",voiceUnavailable:"Sesli g\xF6r\xFC\u015Fme bu cihazda kullan\u0131lam\u0131yor.",cardsLabel:"Sonu\xE7lar"},ur:{assistantTitle:"\u0627\u06D2 \u0622\u0626\u06CC \u0627\u0633\u0633\u0679\u0646\u0679",inputPlaceholder:"\u06A9\u0648\u0626\u06CC \u0633\u0648\u0627\u0644 \u067E\u0648\u0686\u06BE\u06CC\u06BA\u2026",send:"\u0628\u06BE\u06CC\u062C\u06CC\u06BA",startVoice:"\u0635\u0648\u062A\u06CC \u06AF\u0641\u062A\u06AF\u0648 \u0634\u0631\u0648\u0639 \u06A9\u0631\u06CC\u06BA",stopVoice:"\u0635\u0648\u062A\u06CC \u06AF\u0641\u062A\u06AF\u0648 \u0628\u0646\u062F \u06A9\u0631\u06CC\u06BA",listening:"\u0633\u0646 \u0631\u06C1\u0627 \u06C1\u06D2\u2026",thinking:"\u0633\u0648\u0686 \u0631\u06C1\u0627 \u06C1\u06D2\u2026",speaking:"\u0628\u0648\u0644 \u0631\u06C1\u0627 \u06C1\u06D2\u2026",connecting:"\u0645\u0646\u0633\u0644\u06A9 \u06C1\u0648 \u0631\u06C1\u0627 \u06C1\u06D2\u2026",close:"\u0628\u0646\u062F \u06A9\u0631\u06CC\u06BA",minimize:"\u0686\u06BE\u0648\u0679\u0627 \u06A9\u0631\u06CC\u06BA",newConversation:"\u0646\u0626\u06CC \u06AF\u0641\u062A\u06AF\u0648",poweredBy:"Dabalabs \u06A9\u06D2 \u062A\u0639\u0627\u0648\u0646 \u0633\u06D2",errorGeneric:"\u06A9\u0686\u06BE \u063A\u0644\u0637 \u06C1\u0648 \u06AF\u06CC\u0627\u06D4 \u0628\u0631\u0627\u06C1 \u06A9\u0631\u0645 \u062F\u0648\u0628\u0627\u0631\u06C1 \u06A9\u0648\u0634\u0634 \u06A9\u0631\u06CC\u06BA\u06D4",errorMicDenied:"\u0645\u0627\u0626\u06CC\u06A9\u0631\u0648\u0641\u0648\u0646 \u062A\u06A9 \u0631\u0633\u0627\u0626\u06CC \u0628\u0644\u0627\u06A9 \u06A9\u0631 \u062F\u06CC \u06AF\u0626\u06CC \u06C1\u06D2\u06D4 \u0628\u0627\u062A \u06A9\u0631\u0646\u06D2 \u06A9\u06D2 \u0644\u06CC\u06D2 \u0628\u0631\u0627\u0624\u0632\u0631 \u06A9\u06CC \u062A\u0631\u062A\u06CC\u0628\u0627\u062A \u0645\u06CC\u06BA \u0627\u062C\u0627\u0632\u062A \u062F\u06CC\u06BA\u06D4",errorOffline:"\u0644\u06AF\u062A\u0627 \u06C1\u06D2 \u0622\u067E \u0622\u0641 \u0644\u0627\u0626\u0646 \u06C1\u06CC\u06BA\u06D4 \u0627\u067E\u0646\u0627 \u06A9\u0646\u06A9\u0634\u0646 \u0686\u06CC\u06A9 \u06A9\u0631\u06CC\u06BA\u06D4",introGreeting:"\u062E\u0648\u0634 \u0622\u0645\u062F\u06CC\u062F\u060C",voiceHint:"\u0628\u0648\u0644\u0646\u06D2 \u06A9\u06D2 \u0644\u06CC\u06D2 {hotkey}",introDefaultHeadline:"\u0645\u06CC\u06BA \u0622\u067E \u06A9\u06CC \u06A9\u06CC\u0627 \u0645\u062F\u062F \u06A9\u0631 \u0633\u06A9\u062A\u0627 \u06C1\u0648\u06BA\u061F",introDefaultSubheadline:"\u0627\u0633 \u0633\u0627\u0626\u0679 \u06A9\u06D2 \u0628\u0627\u0631\u06D2 \u0645\u06CC\u06BA \u0645\u062C\u06BE \u0633\u06D2 \u06A9\u0686\u06BE \u0628\u06BE\u06CC \u067E\u0648\u0686\u06BE\u06CC\u06BA\u06D4",suggestionsLabel:"\u062A\u062C\u0648\u06CC\u0632 \u06A9\u0631\u062F\u06C1 \u0633\u0648\u0627\u0644\u0627\u062A",viewOnMap:"\u0646\u0642\u0634\u06D2 \u067E\u0631 \u062F\u06CC\u06A9\u06BE\u06CC\u06BA",readMore:"\u0645\u0632\u06CC\u062F \u067E\u0691\u06BE\u06CC\u06BA",openLink:"\u06A9\u06BE\u0648\u0644\u06CC\u06BA",dateLabel:"\u062A\u0627\u0631\u06CC\u062E",locationLabel:"\u0645\u0642\u0627\u0645",retry:"\u062F\u0648\u0628\u0627\u0631\u06C1 \u06A9\u0648\u0634\u0634 \u06A9\u0631\u06CC\u06BA",typeOrTalk:"\u0644\u06A9\u06BE\u06CC\u06BA \u06CC\u0627 \u0628\u0627\u062A \u06A9\u0631\u0646\u06D2 \u06A9\u06D2 \u0644\u06CC\u06D2 \u0645\u0627\u0626\u06CC\u06A9\u0631\u0648\u0641\u0648\u0646 \u062F\u0628\u0627\u0626\u06CC\u06BA",voiceUnavailable:"\u0627\u0633 \u0688\u06CC\u0648\u0627\u0626\u0633 \u067E\u0631 \u0635\u0648\u062A\u06CC \u06AF\u0641\u062A\u06AF\u0648 \u062F\u0633\u062A\u06CC\u0627\u0628 \u0646\u06C1\u06CC\u06BA \u06C1\u06D2\u06D4",cardsLabel:"\u0646\u062A\u0627\u0626\u062C"},hi:{assistantTitle:"\u090F\u0906\u0908 \u0938\u0939\u093E\u092F\u0915",inputPlaceholder:"\u0915\u094B\u0908 \u0938\u0935\u093E\u0932 \u092A\u0942\u091B\u0947\u0902\u2026",send:"\u092D\u0947\u091C\u0947\u0902",startVoice:"\u0935\u0949\u0907\u0938 \u091A\u0948\u091F \u0936\u0941\u0930\u0942 \u0915\u0930\u0947\u0902",stopVoice:"\u0935\u0949\u0907\u0938 \u091A\u0948\u091F \u092C\u0902\u0926 \u0915\u0930\u0947\u0902",listening:"\u0938\u0941\u0928 \u0930\u0939\u093E \u0939\u0948\u2026",thinking:"\u0938\u094B\u091A \u0930\u0939\u093E \u0939\u0948\u2026",speaking:"\u092C\u094B\u0932 \u0930\u0939\u093E \u0939\u0948\u2026",connecting:"\u0915\u0928\u0947\u0915\u094D\u091F \u0939\u094B \u0930\u0939\u093E \u0939\u0948\u2026",close:"\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",minimize:"\u091B\u094B\u091F\u093E \u0915\u0930\u0947\u0902",newConversation:"\u0928\u0908 \u092C\u093E\u0924\u091A\u0940\u0924",poweredBy:"Dabalabs \u0926\u094D\u0935\u093E\u0930\u093E \u0938\u0902\u091A\u093E\u0932\u093F\u0924",errorGeneric:"\u0915\u0941\u091B \u0917\u0921\u093C\u092C\u0921\u093C \u0939\u094B \u0917\u0908\u0964 \u0915\u0943\u092A\u092F\u093E \u092B\u093F\u0930 \u0938\u0947 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0947\u0902\u0964",errorMicDenied:"\u092E\u093E\u0907\u0915\u094D\u0930\u094B\u092B\u093C\u094B\u0928 \u0915\u0940 \u0905\u0928\u0941\u092E\u0924\u093F \u0930\u094B\u0915 \u0926\u0940 \u0917\u0908 \u0939\u0948\u0964 \u092C\u093E\u0924 \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F \u092C\u094D\u0930\u093E\u0909\u091C\u093C\u0930 \u0938\u0947\u091F\u093F\u0902\u0917\u094D\u0938 \u092E\u0947\u0902 \u0907\u0938\u0947 \u0905\u0928\u0941\u092E\u0924\u093F \u0926\u0947\u0902\u0964",errorOffline:"\u0906\u092A \u0911\u092B\u093C\u0932\u093E\u0907\u0928 \u0932\u0917 \u0930\u0939\u0947 \u0939\u0948\u0902\u0964 \u0905\u092A\u0928\u093E \u0915\u0928\u0947\u0915\u094D\u0936\u0928 \u091C\u093E\u0901\u091A\u0947\u0902\u0964",introGreeting:"\u0928\u092E\u0938\u094D\u0924\u0947,",voiceHint:"\u092C\u094B\u0932\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F {hotkey}",introDefaultHeadline:"\u092E\u0948\u0902 \u0906\u092A\u0915\u0940 \u0915\u0948\u0938\u0947 \u092E\u0926\u0926 \u0915\u0930 \u0938\u0915\u0924\u093E \u0939\u0942\u0901?",introDefaultSubheadline:"\u0907\u0938 \u0938\u093E\u0907\u091F \u0915\u0947 \u092C\u093E\u0930\u0947 \u092E\u0947\u0902 \u092E\u0941\u091D\u0938\u0947 \u0915\u0941\u091B \u092D\u0940 \u092A\u0942\u091B\u0947\u0902\u0964",suggestionsLabel:"\u0938\u0941\u091D\u093E\u090F \u0917\u090F \u0938\u0935\u093E\u0932",viewOnMap:"\u092E\u093E\u0928\u091A\u093F\u0924\u094D\u0930 \u092A\u0930 \u0926\u0947\u0916\u0947\u0902",readMore:"\u0914\u0930 \u092A\u0922\u093C\u0947\u0902",openLink:"\u0916\u094B\u0932\u0947\u0902",dateLabel:"\u0924\u093E\u0930\u0940\u0916\u093C",locationLabel:"\u0938\u094D\u0925\u093E\u0928",retry:"\u092B\u093F\u0930 \u0938\u0947 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0947\u0902",typeOrTalk:"\u0932\u093F\u0916\u0947\u0902 \u092F\u093E \u092C\u093E\u0924 \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F \u092E\u093E\u0907\u0915\u094D\u0930\u094B\u092B\u093C\u094B\u0928 \u0926\u092C\u093E\u090F\u0901",voiceUnavailable:"\u0907\u0938 \u0921\u093F\u0935\u093E\u0907\u0938 \u092A\u0930 \u0935\u0949\u0907\u0938 \u0909\u092A\u0932\u092C\u094D\u0927 \u0928\u0939\u0940\u0902 \u0939\u0948\u0964",cardsLabel:"\u092A\u0930\u093F\u0923\u093E\u092E"},zh:{assistantTitle:"AI \u52A9\u624B",inputPlaceholder:"\u8F93\u5165\u4F60\u7684\u95EE\u9898\u2026",send:"\u53D1\u9001",startVoice:"\u5F00\u59CB\u8BED\u97F3\u5BF9\u8BDD",stopVoice:"\u7ED3\u675F\u8BED\u97F3\u5BF9\u8BDD",listening:"\u6B63\u5728\u8046\u542C\u2026",thinking:"\u6B63\u5728\u601D\u8003\u2026",speaking:"\u6B63\u5728\u56DE\u7B54\u2026",connecting:"\u6B63\u5728\u8FDE\u63A5\u2026",close:"\u5173\u95ED",minimize:"\u6700\u5C0F\u5316",newConversation:"\u65B0\u5BF9\u8BDD",poweredBy:"\u7531 Dabalabs \u63D0\u4F9B\u652F\u6301",errorGeneric:"\u51FA\u4E86\u70B9\u95EE\u9898\uFF0C\u8BF7\u91CD\u8BD5\u3002",errorMicDenied:"\u9EA6\u514B\u98CE\u6743\u9650\u88AB\u62D2\u7EDD\u3002\u8BF7\u5728\u6D4F\u89C8\u5668\u8BBE\u7F6E\u4E2D\u5141\u8BB8\u540E\u518D\u4F7F\u7528\u8BED\u97F3\u3002",errorOffline:"\u4F60\u4F3C\u4E4E\u5DF2\u79BB\u7EBF\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u3002",introGreeting:"\u60A8\u597D\uFF0C",voiceHint:"\u6309 {hotkey} \u8BF4\u8BDD",introDefaultHeadline:"\u6709\u4EC0\u4E48\u53EF\u4EE5\u5E2E\u4F60\uFF1F",introDefaultSubheadline:"\u5173\u4E8E\u672C\u7F51\u7AD9\uFF0C\u4F60\u53EF\u4EE5\u95EE\u6211\u4EFB\u4F55\u95EE\u9898\u3002",suggestionsLabel:"\u63A8\u8350\u95EE\u9898",viewOnMap:"\u5728\u5730\u56FE\u4E2D\u67E5\u770B",readMore:"\u9605\u8BFB\u66F4\u591A",openLink:"\u6253\u5F00",dateLabel:"\u65E5\u671F",locationLabel:"\u5730\u70B9",retry:"\u91CD\u8BD5",typeOrTalk:"\u8F93\u5165\u95EE\u9898\uFF0C\u6216\u70B9\u51FB\u9EA6\u514B\u98CE\u8BF4\u8BDD",voiceUnavailable:"\u6B64\u8BBE\u5907\u4E0D\u652F\u6301\u8BED\u97F3\u529F\u80FD\u3002",cardsLabel:"\u7ED3\u679C"},pt:{assistantTitle:"Assistente de IA",inputPlaceholder:"Fa\xE7a uma pergunta\u2026",send:"Enviar",startVoice:"Iniciar conversa por voz",stopVoice:"Parar conversa por voz",listening:"Ouvindo\u2026",thinking:"Pensando\u2026",speaking:"Falando\u2026",connecting:"Conectando\u2026",close:"Fechar",minimize:"Minimizar",newConversation:"Nova conversa",poweredBy:"Com tecnologia da Dabalabs",errorGeneric:"Algo deu errado. Tente novamente.",errorMicDenied:"O acesso ao microfone foi bloqueado. Permita-o nas configura\xE7\xF5es do navegador para falar.",errorOffline:"Parece que voc\xEA est\xE1 offline. Verifique sua conex\xE3o.",introGreeting:"Ol\xE1,",voiceHint:"{hotkey} para falar",introDefaultHeadline:"Como posso ajudar?",introDefaultSubheadline:"Pergunte-me qualquer coisa sobre este site.",suggestionsLabel:"Perguntas sugeridas",viewOnMap:"Ver no mapa",readMore:"Leia mais",openLink:"Abrir",dateLabel:"Data",locationLabel:"Local",retry:"Tentar novamente",typeOrTalk:"Escreva, ou toque no microfone para falar",voiceUnavailable:"A voz n\xE3o est\xE1 dispon\xEDvel neste dispositivo.",cardsLabel:"Resultados"},id:{assistantTitle:"Asisten AI",inputPlaceholder:"Ajukan pertanyaan\u2026",send:"Kirim",startVoice:"Mulai obrolan suara",stopVoice:"Hentikan obrolan suara",listening:"Mendengarkan\u2026",thinking:"Berpikir\u2026",speaking:"Berbicara\u2026",connecting:"Menghubungkan\u2026",close:"Tutup",minimize:"Perkecil",newConversation:"Percakapan baru",poweredBy:"Didukung oleh Dabalabs",errorGeneric:"Terjadi kesalahan. Silakan coba lagi.",errorMicDenied:"Akses mikrofon diblokir. Izinkan di pengaturan browser untuk berbicara.",errorOffline:"Sepertinya Anda sedang offline. Periksa koneksi Anda.",introGreeting:"Halo,",voiceHint:"{hotkey} untuk bicara",introDefaultHeadline:"Ada yang bisa saya bantu?",introDefaultSubheadline:"Tanyakan apa saja tentang situs ini.",suggestionsLabel:"Pertanyaan yang disarankan",viewOnMap:"Lihat di peta",readMore:"Baca selengkapnya",openLink:"Buka",dateLabel:"Tanggal",locationLabel:"Lokasi",retry:"Coba lagi",typeOrTalk:"Ketik, atau ketuk mikrofon untuk berbicara",voiceUnavailable:"Suara tidak tersedia di perangkat ini.",cardsLabel:"Hasil"}},Zn=new Set(["ar","arc","ckb","dv","fa","he","iw","ku","prs","ps","sd","ug","ur","yi","ji"]),Jn=new Set(["arab","hebr","thaa","syrc","nkoo","adlm"]),Xn={in:"id",iw:"he",ji:"yi"};function W(t){return typeof t!="string"?"":t.trim().toLowerCase().replace(/_/g,"-")}function qt(t){let e=W(t).split("-")[0]??"";return Xn[e]??e}function Kt(t){if(t)return Object.prototype.hasOwnProperty.call(Ve,t)?Ve[t]:void 0}function Yt(t){let e=W(t);if(e&&e!=="auto")return e;if(typeof document<"u"&&document.documentElement){let a=W(document.documentElement.getAttribute("lang"));if(a&&a!=="auto")return a}if(typeof navigator<"u"){let a=W(navigator.language);if(a)return a}return "en"}function Qn(t){let e=W(t);if(!e)return false;let a=e.split("-");return Zn.has(qt(e))?true:a.slice(1).some(n=>Jn.has(n))}function Zt(t,e){let a=W(e);return a==="rtl"||a==="ltr"?a:Qn(t)||typeof document<"u"&&document.documentElement&&W(document.documentElement.getAttribute("dir"))==="rtl"?"rtl":"ltr"}function Jt(t){let e=W(t);return Kt(e)??Kt(qt(e))??Ve.en}function Be(t){let e=t.toLowerCase().split("+").map(a=>a.trim());return {ctrl:e.includes("ctrl")||e.includes("control"),alt:e.includes("alt"),shift:e.includes("shift"),meta:e.includes("cmd")||e.includes("meta"),key:e.find(a=>!["ctrl","control","alt","shift","cmd","meta"].includes(a))??""}}function Xt(t,e){let a=t.key.toLowerCase();return (e.key==="space"?a===" "||t.code==="Space":a===e.key)&&t.ctrlKey===e.ctrl&&t.altKey===e.alt&&t.shiftKey===e.shift&&t.metaKey===e.meta}function Qt(t){if(!(t instanceof HTMLElement))return false;let e=t.tagName;return e==="INPUT"||e==="TEXTAREA"||t.isContentEditable}function ea(){if(typeof navigator>"u")return false;let e=navigator.userAgentData?.platform??navigator.platform??"";return /mac|iphone|ipad|ipod/i.test(e)}function je(){return ea()?"alt+space":"ctrl+space"}function ta(t){let e=Be(t),a=e.key==="space"?"Space":e.key.length===1?e.key.toUpperCase():e.key;return ea()?[...[e.ctrl&&"\u2303",e.alt&&"\u2325",e.shift&&"\u21E7",e.meta&&"\u2318"].filter(Boolean),a].join(" "):[...[e.ctrl&&"Ctrl",e.alt&&"Alt",e.shift&&"Shift",e.meta&&"Win"].filter(Boolean),a].join("+")}var aa="bottom-right",er=["bottom-right","bottom-left","top-right","top-left"],tr=.02,ar=3,nr=4e3,na=600,ra=["click","keydown","touchstart"];function rr(t){let e=()=>{ra.forEach(a=>document.removeEventListener(a,e,true)),t.state!=="running"&&t.resume();};ra.forEach(a=>document.addEventListener(a,e,{once:true,capture:true}));}var oa="daba-agent-conv:";function ia(){let t=globalThis.crypto?.randomUUID?.();return t?t.replace(/-/g,""):`c${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`}function Fe(t,e){try{window.sessionStorage.setItem(oa+t,e);}catch{}}function or(t){try{let a=window.sessionStorage.getItem(oa+t);if(a&&/^[A-Za-z0-9_-]{1,64}$/.test(a))return a}catch{}let e=ia();return Fe(t,e),e}var U=class{constructor(e){this.keydownHandler=e=>this.handleKeydown(e);this.status="idle";this.isOpen=false;this.destroyed=false;this.ws=null;this.audioContext=null;this.mic=null;this.player=null;this.bargeInStreak=0;this.isReattaching=false;this.messages=[];this.currentStreamBubble=null;this.currentStreamRole=null;this.chatInFlight=false;this.remoteConfig=null;this.live=null;this.options=e;let a=e.position,n=aa;if(a&&(er.includes(a)?n=a:console.error(`daba-agent: invalid data-position "${a}". Falling back to "${aa}".`)),this.position=n,this.mode=e.mode??"hybrid",this.uiLang=Yt(e.uiLanguage),this.strings=Jt(this.uiLang),this.conversationId=or(e.projectId),this.restricted=gt(),this.restricted){console.warn("daba-agent: this page has data-daba-agent-restricted set \u2014 the assistant will not read this page or start a session here."),this.badge=document.createElement("button"),this.badgeLabel=document.createElement("span"),this.chatWindow=document.createElement("div"),this.messagesContainer=document.createElement("div"),this.inputElement=document.createElement("input"),this.micBtn=document.createElement("button"),this.ui={chatWindow:this.chatWindow,messagesContainer:this.messagesContainer,inputElement:this.inputElement,micBtn:this.micBtn,introEl:null,composerMicBtn:null,setTyping:()=>{},setIntroVisible:()=>{},setStatusText:()=>{},applyConfig:()=>{}};return}let r=typeof e.container=="string"?document.querySelector(e.container):e.container,o=document.createElement("div");o.className=`daba-agent-wrapper daba-agent-wrapper--pos-${this.position}`;let i=Dt(this.position,this.mode,e.accentColor,e.iconBackgroundColor,e.iconMarkColor);this.badge=i.root,this.badgeLabel=i.label,this.badge.addEventListener("click",()=>{this.mode==="voice"?this.toggleVoice():this.toggleChat();}),o.appendChild(this.badge);let s=Zt(this.uiLang,e.direction);o.dir=s,o.lang=this.uiLang,e.theme?.theme&&e.theme.theme!=="auto"&&o.setAttribute("data-daba-theme",e.theme.theme),e.theme&&ve(o,e.theme),e.accentColor&&ve(o,{accent:e.accentColor});let d=Wt({title:e.title??this.strings.assistantTitle,placeholder:e.placeholder??(this.mode==="chat"?this.strings.inputPlaceholder:this.strings.typeOrTalk),strings:this.strings,direction:s,lang:this.uiLang,mode:this.mode,intro:e.intro??{},logoUrl:e.logoUrl,hotkeyLabel:e.hotkey===null?null:ta(e.hotkey??je()),onSendText:l=>{this.sendText(l);},onMicClick:()=>{this.toggleVoice();},onCloseClick:()=>this.closeChat(),onNewConversation:()=>this.resetConversation()});this.ui=d,this.chatWindow=d.chatWindow,this.messagesContainer=d.messagesContainer,this.inputElement=d.inputElement,this.micBtn=d.micBtn,o.appendChild(this.chatWindow),(r??document.body).appendChild(o),(e.initialOpen||this.mode==="chat")&&this.openChat(),e.hotkey!==null&&document.addEventListener("keydown",this.keydownHandler),this.restoreTranscript(),this.tryReattach(),this.loadRemoteConfig();}restoreTranscript(){let e=Tt(this.options.projectId,this.conversationId);if(e.length){for(let a of e){let n=Array.isArray(a.cards)?a.cards:[];this.messages.push({id:`restored-${a.ts}`,role:a.role,text:a.text,timestamp:a.ts,isFinal:true,cards:n}),H(this.messagesContainer,a.text,a.role,{cards:n,strings:this.strings,lang:a.lang??this.uiLang,suggestions:Array.isArray(a.suggestions)?a.suggestions:[],onSuggestion:r=>{this.sendText(r);}});}this.ui.setIntroVisible(false);}}saveTranscript(){Fe(this.options.projectId,this.conversationId),Et(this.options.projectId,this.conversationId,this.messages.filter(e=>e.role!=="system").map(e=>({role:e.role,text:e.text,cards:e.cards,suggestions:e.suggestions,ts:e.timestamp})));}async loadRemoteConfig(){if(this.destroyed||this.restricted)return;let e=oe(this.options.gatewayUrl,this.options.env),a;try{a=await st(e,this.options.projectId,this.options.apiKey);}catch{return}if(this.destroyed)return;this.remoteConfig=a;let n=this.chatWindow.parentElement;if(!n)return;let r=a.appearance;ve(n,{accent:this.options.accentColor??this.options.theme?.accentColor??r.accentColor,"accent-contrast":this.options.theme?.accentContrast??r.accentContrast,surface:this.options.theme?.surfaceColor??r.surfaceColor,text:this.options.theme?.textColor??r.textColor,radius:this.options.theme?.radius??r.radius,font:this.options.theme?.fontFamily??r.fontFamily});let o=this.options.theme?.theme??r.theme;o&&o!=="auto"&&n.setAttribute("data-daba-theme",o),!this.options.mode&&a.mode&&a.mode!==this.mode&&(this.mode=a.mode,this.applyMode());let i=this.options.launcher?.iconUrl??r.launcherIconUrl;i&&Mt(this.badge,i),this.ui.applyConfig({logoUrl:this.options.logoUrl??r.logoUrl,title:this.options.title??a.title,placeholder:this.options.placeholder??(this.mode==="chat"?this.strings.inputPlaceholder:this.strings.typeOrTalk),intro:{enabled:this.options.intro?.enabled??a.intro.enabled,headline:this.options.intro?.headline??a.intro.headline,subheadline:this.options.intro?.subheadline??a.intro.subheadline,mediaUrl:this.options.intro?.mediaUrl??a.intro.mediaUrl,mediaType:this.options.intro?.mediaType??a.intro.mediaType,suggestedPrompts:this.options.intro?.suggestedPrompts??a.intro.suggestedPrompts}});}applyMode(){let e=this.mode!=="chat";this.micBtn.hidden=!e,this.ui.composerMicBtn&&(this.ui.composerMicBtn.hidden=!e);}handleKeydown(e){if(this.destroyed||this.restricted||Qt(e.target)&&e.target!==this.inputElement||e.repeat)return;let a=Be(this.options.hotkey??je());Xt(e,a)&&(e.preventDefault(),this.toggle());}setStatus(e){this.status=e,Pe(this.badge,this.badgeLabel,e,this.position),this.options.onStatusChange?.(e),e==="listening"||e==="speaking"?this.micBtn.classList.add("daba-agent-header__btn--active"):this.micBtn.classList.remove("daba-agent-header__btn--active");}emitError(e){this.options.onError?.(e),this.setStatus("idle"),H(this.messagesContainer,`Error: ${e.message}`,"system");}get currentStatus(){return this.status}get isActive(){return this.status!=="idle"}get isChatOpen(){return this.isOpen}openChat(){this.isOpen||this.restricted||(this.isOpen=true,this.chatWindow.classList.remove("daba-agent-window--hidden"),this.chatWindow.parentElement?.classList.add("daba-agent-wrapper--open"),this.inputElement.focus(),this.options.onChatToggle?.(true));}closeChat(){this.isOpen&&(this.isOpen=false,this.chatWindow.classList.add("daba-agent-window--hidden"),this.chatWindow.parentElement?.classList.remove("daba-agent-wrapper--open"),this.options.onChatToggle?.(false));}toggleChat(){this.isOpen?this.closeChat():this.openChat();}async sendText(e){let a=e.trim();if(this.restricted||!a||this.chatInFlight)return;this.isOpen||this.openChat(),this.ui.setIntroVisible(false);let n={id:`user-${Date.now()}`,role:"user",text:a,timestamp:Date.now(),isFinal:true};if(this.messages.push(n),H(this.messagesContainer,a,"user"),this.saveTranscript(),this.options.onTranscript?.("user",a,true),this.isActive&&this.ws&&this.ws.readyState===WebSocket.OPEN){this.ws.send(JSON.stringify({type:"conversation.item.create",item:{type:"message",role:"user",content:[{type:"input_text",text:a}]}})),this.ws.send(JSON.stringify({type:"response.create"})),this.setStatus("thinking");return}await this.sendChatMessage(a);}async sendChatMessage(e){this.chatInFlight=true,this.ui.setTyping(true),this.ui.setStatusText(this.strings.thinking);let a=oe(this.options.gatewayUrl,this.options.env);try{let n=await ct(a,this.options.projectId,this.options.apiKey,{message:e,conversationId:this.conversationId,pageContext:ie(),uiLanguage:this.uiLang}),r=n.cards??[],o=n.suggestions??[];this.messages.push({id:`agent-${Date.now()}`,role:"agent",text:n.reply,timestamp:Date.now(),isFinal:!0,cards:r,suggestions:o}),H(this.messagesContainer,n.reply,"agent",{cards:r,strings:this.strings,lang:n.language||this.uiLang,suggestions:o,onSuggestion:i=>{this.sendText(i);}}),this.saveTranscript(),this.options.onTranscript?.("agent",n.reply,!0),r.length&&this.options.onCards?.(r);}catch(n){let r=n instanceof O?n.dabaError:{kind:"network",message:this.strings.errorGeneric};this.options.onError?.(r),H(this.messagesContainer,r.message,"system");}finally{this.chatInFlight=false,this.ui.setTyping(false),this.ui.setStatusText("");}}resetConversation(){if(!this.restricted){St(this.options.projectId,this.conversationId),this.messages=[],this.conversationId=ia(),Fe(this.options.projectId,this.conversationId);for(let e of Array.from(this.messagesContainer.children))e!==this.ui.introEl&&e.remove();this.ui.setIntroVisible(true),this.ui.setTyping(false);}}async toggleVoice(){this.mode!=="chat"&&await this.toggle();}handleTranscriptDelta(e,a,n){(this.currentStreamRole!==e||!this.currentStreamBubble)&&(this.currentStreamBubble=H(this.messagesContainer,"",e),this.currentStreamRole=e),this.currentStreamBubble&&(this.currentStreamBubble.textContent+=a,this.messagesContainer.scrollTop=this.messagesContainer.scrollHeight),n&&(this.currentStreamBubble=null,this.currentStreamRole=null);}async toggle(){if(this.mode==="chat"&&!this.restricted){this.toggleChat();return}if(this.restricted){this.emitError({kind:"restricted",message:"This page is marked as protected \u2014 the assistant can't run here."});return}this.isActive?this.stopSession():await this.startSession();}get usesLiveEngine(){return (this.options.voiceEngine??this.remoteConfig?.voiceEngine??"realtime")==="live"}async startLiveSession(){let e=oe(this.options.gatewayUrl,this.options.env);this.live=new he({gatewayUrl:e,projectId:this.options.projectId,apiKey:this.options.apiKey,handlers:{onStatus:a=>this.setStatus(a),onTranscript:(a,n,r)=>{this.handleTranscriptDelta(a,r?"":n,r),this.options.onTranscript?.(a,n,r);},onToolCall:a=>this.runVoiceTool(a),onError:a=>this.emitError(a),onClosed:()=>{this.live=null,this.cleanupAfterClose();}}}),await this.live.start(ie());}runVoiceTool(e){let{output:a,navigateHref:n}=this.executeTool(e.name,e.args);this.live?.sendToolResult(e.callId,a),n&&window.setTimeout(()=>{window.location.href=n;},na);}async startSession(){if(this.destroyed||this.isActive||this.restricted)return;if(this.setStatus("connecting"),this.usesLiveEngine){await this.startLiveSession();return}let e=oe(this.options.gatewayUrl,this.options.env);try{let a=ie(),{sessionId:n,wsUrl:r}=await dt(e,this.options.projectId,this.options.apiKey,a);_t(this.options.projectId,n,r),this.attachWebSocket(r,!1);}catch(a){let n=a instanceof O?a.dabaError:{kind:"network",message:"Failed to start the agent session."};this.emitError(n);}}async tryReattach(){if(this.destroyed||this.isActive||this.restricted)return;let e=Ct(this.options.projectId);e&&(fe(this.options.projectId),this.isReattaching=true,this.setStatus("connecting"),this.attachWebSocket(e.wsUrl,true));}attachWebSocket(e,a){let n=`${e}${e.includes("?")?"&":"?"}key=${encodeURIComponent(this.options.apiKey)}`,r=new WebSocket(n);r.binaryType="arraybuffer",this.ws=r,r.onopen=()=>{this.onSocketOpen(a);},r.onmessage=o=>this.onSocketMessage(o),r.onerror=()=>{this.emitError({kind:"network",message:"Connection to the voice agent failed."});},r.onclose=o=>this.handleSocketClose(o);}async onSocketOpen(e){if(!(this.destroyed||!this.ws))try{let a=new AudioContext({sampleRate:24e3});this.audioContext=a,a.state!=="running"&&(a.resume(),rr(a)),this.player=new me(a),this.mic=await kt(a,(n,r)=>this.onMicFrame(n,r)),e&&this.ws.send(JSON.stringify({type:"page_context",context:ie()})),this.isReattaching=!1,this.setStatus("listening");}catch{let a=this.isReattaching;this.isReattaching=false,this.ws?.close(),a?(this.cleanupAfterClose(),this.startSession()):this.emitError({kind:"network",message:"Microphone access was denied or unavailable."});}}onMicFrame(e,a){this.destroyed||!this.ws||this.ws.readyState!==WebSocket.OPEN||(this.player?.isPlaying()&&(a>tr?(this.bargeInStreak++,this.bargeInStreak>=ar&&(this.bargeInStreak=0,this.player?.clear(),this.ws.send(JSON.stringify({type:"cancel"})),this.setStatus("listening"))):this.bargeInStreak=0),this.ws.send(e));}onSocketMessage(e){if(typeof e.data!="string")return;let a;try{a=JSON.parse(e.data);}catch{return}switch(a.type){case "response.output_audio.delta":{let n=a.delta;n&&this.player&&(this.setStatus("speaking"),this.player.pushBase64(n));break}case "conversation.item.input_audio_transcription.delta":{let n=a.delta;n&&(this.handleTranscriptDelta("user",n,false),this.options.onTranscript?.("user",n,false));break}case "conversation.item.input_audio_transcription.completed":{let n=a.transcript;n&&(this.handleTranscriptDelta("user","",true),this.options.onTranscript?.("user",n,true));break}case "response.output_audio_transcript.delta":{let n=a.delta;n&&(this.handleTranscriptDelta("agent",n,false),this.options.onTranscript?.("agent",n,false));break}case "response.output_audio_transcript.done":{let n=a.transcript;n&&(this.handleTranscriptDelta("agent","",true),this.options.onTranscript?.("agent",n,true)),this.status==="speaking"&&this.setStatus("listening");break}case "tool_call":this.handleToolCall(a);break;case "error":{let n=a.error;this.options.onError?.({kind:"network",message:n?.message??"Realtime session error."});break}}}executeTool(e,a){let n={};try{n=JSON.parse(a||"{}");}catch{n={};}switch(e){case "fill_form_field":{let r=mt(String(n.label??""),String(n.value??""));return H(this.messagesContainer,`Filled field: ${n.label}`,"system"),{output:r}}case "submit_form":{let r=ft();return H(this.messagesContainer,"Form submission confirmed.","system"),{output:r}}case "navigate":{let r=wt(String(n.destination??""));return H(this.messagesContainer,`Navigating to ${n.destination}\u2026`,"system"),{output:{ok:r.ok,message:r.message},navigateHref:r.href}}case "click_element":{let r=String(n.description??""),o=vt(r);if(!o)return {output:{ok:false,message:`Could not find anything matching "${r}" to click.`}};if(!window.confirm(`Daba Agent wants to click: "${o.text}"
1891
-
1892
- Allow this?`))return {output:{ok:false,message:`Visitor declined to click "${o.text}".`}};let s=xt(o.el,o.text);return H(this.messagesContainer,`Clicked: ${o.text}`,"system"),{output:s}}case "scroll_page":{let r=n.direction!==void 0?String(n.direction):void 0,o=n.target!==void 0?String(n.target):void 0;return {output:yt(r,o)}}default:return {output:{ok:false,message:`Unknown tool "${e}".`}}}}handleToolCall(e){if(!this.ws)return;let{output:a,navigateHref:n}=this.executeTool(e.name,e.arguments);this.ws.send(JSON.stringify({type:"tool_result",call_id:e.call_id,output:JSON.stringify(a)})),n&&window.setTimeout(()=>{window.location.href=n;},na);}stopSession(){this.ws?.close(nr,"user_stopped"),fe(this.options.projectId),this.cleanupAfterClose();}handleSocketClose(e){let a=this.status!=="idle",n=this.isReattaching;if(this.isReattaching=false,this.cleanupAfterClose(),!(!a&&!n)){if(n){this.startSession();return}e.code!==1e3&&e.code!==1005&&(this.options.onError?.({kind:"network",message:e.reason||"The voice connection closed unexpectedly."}),this.flashBadgeError());}}flashBadgeError(){this.badge.classList.add("daba-agent-badge--error"),this.badgeLabel.textContent="Unavailable \u2014 try again",window.setTimeout(()=>{this.badge.classList.remove("daba-agent-badge--error"),this.status==="idle"&&Pe(this.badge,this.badgeLabel,"idle",this.position);},4e3);}cleanupAfterClose(){this.mic?.stop(),this.mic=null,this.player=null,this.audioContext&&(this.audioContext.close(),this.audioContext=null),this.ws=null,this.bargeInStreak=0,this.destroyed||this.setStatus("idle");}destroy(){this.destroyed=true,document.removeEventListener("keydown",this.keydownHandler),this.stopSession(),this.badge.parentElement?.remove(),this.badge.remove();}};var ir=["bottom-right","bottom-left","top-right","top-left"],sr=["voice","chat","hybrid"],dr=["auto","ltr","rtl"],lr=["auto","light","dark"],cr=["rounded","circle","pill"],gr=["video","image","none"],pr="|";function We(t,e){for(let a of [e,`data-${e}`]){let n=t.getAttribute(a);if(n===null)continue;let r=n.trim();if(r!=="")return {attr:a,value:r}}}function w(t,e){return We(t,e)?.value}function te(t,e,a){let n=We(t,e);if(n){if(a.includes(n.value))return n.value;console.error(`daba-agent: invalid ${n.attr} "${n.value}" on <daba-agent>. Expected one of ${a.join(", ")} \u2014 ignoring it.`,t);}}function sa(t,e){for(let a of [e,`data-${e}`]){let n=t.getAttribute(a);if(n===null)continue;let r=n.trim().toLowerCase();return r!=="false"&&r!=="0"&&r!=="no"}}function ur(t,e){let a=We(t,e);if(!a)return;let n=a.value.split(pr).map(r=>r.trim()).filter(r=>r!=="");return n.length>0?n:void 0}function Ge(t){return Object.values(t).some(e=>e!==void 0)?t:void 0}var ye=class extends HTMLElement{constructor(){super(...arguments);this.agent=null;}connectedCallback(){if(this.agent)return;let a=w(this,"project-id"),n=w(this,"api-key");if(!a||!n){console.error("daba-agent: <daba-agent> custom element requires project-id and api-key attributes.",this);return}let r=te(this,"position",ir),o=w(this,"accent-color"),i=te(this,"mode",sr),s=w(this,"title"),d=w(this,"placeholder"),l=sa(this,"initial-open"),f=w(this,"hotkey"),v=w(this,"gateway-url"),I=w(this,"env"),S=Ge({accentColor:o,accentContrast:w(this,"accent-contrast"),surfaceColor:w(this,"surface-color"),textColor:w(this,"text-color"),radius:w(this,"radius"),fontFamily:w(this,"font-family"),theme:te(this,"theme",lr)}),L=sa(this,"intro-disabled"),p=Ge({enabled:L===void 0?void 0:!L,headline:w(this,"intro-headline"),subheadline:w(this,"intro-subheadline"),mediaUrl:w(this,"intro-media-url"),mediaType:te(this,"intro-media-type",gr),suggestedPrompts:ur(this,"suggested-prompts")}),h=Ge({shape:te(this,"launcher-shape",cr),iconUrl:w(this,"launcher-icon-url"),label:w(this,"launcher-label")});this.agent=new U({container:this,projectId:a,apiKey:n,position:r,accentColor:o,mode:i,title:s,placeholder:d,initialOpen:l,hotkey:f,gatewayUrl:v,env:I,theme:S,intro:p,launcher:h,logoUrl:w(this,"logo-url"),uiLanguage:w(this,"ui-language"),direction:te(this,"direction",dr),onStatusChange:m=>{this.dispatchEvent(new CustomEvent("daba-status-change",{detail:{status:m},bubbles:true,composed:true}));},onTranscript:(m,k,C)=>{this.dispatchEvent(new CustomEvent("daba-transcript",{detail:{role:m,text:k,isFinal:C},bubbles:true,composed:true}));},onError:m=>{this.dispatchEvent(new CustomEvent("daba-error",{detail:{error:m},bubbles:true,composed:true}));},onChatToggle:m=>{this.dispatchEvent(new CustomEvent("daba-chat-toggle",{detail:{isOpen:m},bubbles:true,composed:true}));},onCards:m=>{this.dispatchEvent(new CustomEvent("daba-cards",{detail:{cards:m},bubbles:true,composed:true}));}});}disconnectedCallback(){this.agent&&(this.agent.destroy(),this.agent=null);}get dabaAgent(){return this.agent}sendText(a){return this.agent?.sendText(a)}openChat(){this.agent?.openChat();}closeChat(){this.agent?.closeChat();}toggleChat(){this.agent?.toggleChat();}};function da(t="daba-agent"){typeof window<"u"&&typeof customElements<"u"&&(customElements.get(t)||customElements.define(t,ye));}da();var K=Ra(ka());function _a(t){let e=(0, K.useRef)(null),a=(0, K.useRef)(null),n=(0, K.useRef)(t);n.current=t;let r=JSON.stringify(t,(o,i)=>typeof i=="function"?void 0:i);return (0, K.useEffect)(()=>{if(!e.current)return;let o=new U({...n.current,container:e.current,onStatusChange:i=>n.current.onStatusChange?.(i),onTranscript:(i,s,d)=>n.current.onTranscript?.(i,s,d),onChatToggle:i=>n.current.onChatToggle?.(i),onCards:i=>n.current.onCards?.(i),onError:i=>n.current.onError?.(i)});return a.current=o,()=>{o.destroy(),a.current=null;}},[r]),K.default.createElement("div",{ref:e,style:{display:"contents"},"data-daba-agent-react-container":"true"})}var Ar=["bottom-right","bottom-left","top-right","top-left"],Dr=["voice","chat","hybrid"],Mr=["auto","ltr","rtl"],Ir=["auto","light","dark"],Hr=["rounded","circle","pill"],Rr=["video","image","none"],Nr="|";function Qe(t,e){for(let a of [`data-daba-${e}`,`data-${e}`]){let n=t.getAttribute(a);if(n===null)continue;let r=n.trim();if(r!=="")return {attr:a,value:r}}}function y(t,e){return Qe(t,e)?.value}function ne(t,e,a){let n=Qe(t,e);if(n){if(a.includes(n.value))return n.value;console.error(`daba-agent auto-init: invalid ${n.attr} "${n.value}". Expected one of ${a.join(", ")} \u2014 ignoring it.`,t);}}function Ca(t,e){for(let a of [`data-daba-${e}`,`data-${e}`]){let n=t.getAttribute(a);if(n===null)continue;let r=n.trim().toLowerCase();return r!=="false"&&r!=="0"&&r!=="no"}}function Or(t,e){let a=Qe(t,e);if(!a)return;let n=a.value.split(Nr).map(r=>r.trim()).filter(r=>r!=="");return n.length>0?n:void 0}function Xe(t){return Object.values(t).some(e=>e!==void 0)?t:void 0}function Ee(){if(typeof document>"u")return [];let t=Array.from(document.querySelectorAll("[data-daba-agent], [data-daba-project-id]")),e=[];for(let a of t){if(a.dataset.dabaAgentInitialized==="true")continue;let n=y(a,"project-id"),r=y(a,"api-key");if(!n||!r){console.warn("daba-agent auto-init: element found but missing data-daba-project-id or data-daba-api-key.",a);continue}let o=ne(a,"position",Ar),i=y(a,"accent-color"),s=ne(a,"mode",Dr),d=y(a,"title"),l=y(a,"placeholder"),f=Ca(a,"initial-open"),v=y(a,"hotkey"),I=y(a,"gateway-url"),S=y(a,"env"),L=Xe({accentColor:i,accentContrast:y(a,"accent-contrast"),surfaceColor:y(a,"surface-color"),textColor:y(a,"text-color"),radius:y(a,"radius"),fontFamily:y(a,"font-family"),theme:ne(a,"theme",Ir)}),p=Ca(a,"intro-disabled"),h=Xe({enabled:p===void 0?void 0:!p,headline:y(a,"intro-headline"),subheadline:y(a,"intro-subheadline"),mediaUrl:y(a,"intro-media-url"),mediaType:ne(a,"intro-media-type",Rr),suggestedPrompts:Or(a,"suggested-prompts")}),m=Xe({shape:ne(a,"launcher-shape",Hr),iconUrl:y(a,"launcher-icon-url"),label:y(a,"launcher-label")}),k=new U({container:a,projectId:n,apiKey:r,position:o,accentColor:i,mode:s,title:d,placeholder:l,initialOpen:f,hotkey:v,gatewayUrl:I,env:S,theme:L,intro:h,launcher:m,logoUrl:y(a,"logo-url"),uiLanguage:y(a,"ui-language"),direction:ne(a,"direction",Mr)});a.dataset.dabaAgentInitialized="true",e.push(k);}return e}typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>Ee()):Ee());function Ea(){Ee();}typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ea,{once:true}):Ea());/*! Bundled license information:
1893
-
1894
- react/cjs/react.production.min.js:
1895
- (**
1896
- * @license React
1897
- * react.production.min.js
1898
- *
1899
- * Copyright (c) Facebook, Inc. and its affiliates.
1900
- *
1901
- * This source code is licensed under the MIT license found in the
1902
- * LICENSE file in the root directory of this source tree.
1903
- *)
1904
- */exports.DabaAgent=U;exports.DabaAgentComponent=_a;exports.DabaAgentElement=ye;exports.DabaAgentReact=_a;exports.defineDabaAgentElement=da;return exports;})({});//# sourceMappingURL=daba-agent.min.js.map
2007
+ `),n=[],r=[],i=null,o=()=>{if(!n.length)return;let d=document.createElement("p");d.className="daba-agent-md__p",B(d,n.join(" ")),(i??a).appendChild(d),n=[];},s=(d=-1)=>{for(;r.length&&r[r.length-1].indent>d;)r.pop();},c=()=>{o(),i=null;};for(let d=0;d<t.length;d++){let f=t[d],b=f.replace(/\s+$/,"");if(!b.trim()){o(),s(),c();continue}if(Yn.test(b)){o(),s(),c();let v=document.createElement("hr");v.className="daba-agent-md__hr",a.appendChild(v);continue}if(da.test(b)&&d+1<t.length&&Zn.test(t[d+1])){o(),s(),c();let v=document.createElement("div");v.className="daba-agent-md__table-wrap";let h=document.createElement("table");h.className="daba-agent-md__table";let E=document.createElement("thead"),w=document.createElement("tr");for(let H of ca(b)){let k=document.createElement("th");B(k,H),w.appendChild(k);}E.appendChild(w),h.appendChild(E);let A=document.createElement("tbody");for(d+=1;d+1<t.length&&da.test(t[d+1]);){d+=1;let H=document.createElement("tr");for(let k of ca(t[d])){let K=document.createElement("td");B(K,k),H.appendChild(K);}A.appendChild(H);}h.appendChild(A),v.appendChild(h),a.appendChild(v);continue}let S=qn.exec(b);if(S){i||(o(),s(),i=document.createElement("blockquote"),i.className="daba-agent-md__quote",a.appendChild(i)),n.push(S[1].trim());continue}else i&&c();let _=Kn.exec(b);if(_){o(),s();let v=document.createElement("p");v.className="daba-agent-md__h",B(v,_[1].trim()),a.appendChild(v);continue}let C=Wn.exec(b)??sa.exec(b);if(C){o();let v=C[1].length,h=sa.test(b);s(v);let E=r[r.length-1];if(!E||E.indent<v){let A=document.createElement(h?"ol":"ul");A.className="daba-agent-md__list",(E?.el.lastElementChild??a).appendChild(A),E={el:A,indent:v},r.push(E);}let w=document.createElement("li");B(w,C[3]),E.el.appendChild(w);continue}if(r.length&&f.startsWith(" ")){let v=r[r.length-1].el.lastElementChild;if(v){v.appendChild(document.createTextNode(" ")),B(v,b.trim());continue}}s(),n.push(b.trim());}return o(),a}var N={mic:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" y1="19" x2="12" y2="22"/></svg>',close:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',refresh:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 0 1 15-6.7L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-15 6.7L3 16"/><path d="M3 21v-5h5"/></svg>',send:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>',search:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>',spark:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M18.4 5.6l-2.8 2.8M8.4 15.6l-2.8 2.8"/></svg>',grid:'<svg viewBox="0 0 24 24" fill="currentColor"><circle cx="5" cy="5" r="1.6"/><circle cx="12" cy="5" r="1.6"/><circle cx="19" cy="5" r="1.6"/><circle cx="5" cy="12" r="1.6"/><circle cx="12" cy="12" r="1.6"/><circle cx="19" cy="12" r="1.6"/><circle cx="5" cy="19" r="1.6"/><circle cx="12" cy="19" r="1.6"/><circle cx="19" cy="19" r="1.6"/></svg>',calendar:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="16" rx="2.5"/><path d="M3 10h18M8 3v4M16 3v4"/></svg>',news:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 5h12a2 2 0 0 1 2 2v11a2 2 0 0 0 2 2H6a2 2 0 0 1-2-2z"/><path d="M8 9h6M8 13h6M8 17h4"/></svg>',ticket:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 9V7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v2a2 2 0 0 0 0 6v2a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-2a2 2 0 0 0 0-6z"/><path d="M12 7v2M12 15v2"/></svg>',clock:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="8.5"/><path d="M12 7.5V12l3 1.8"/></svg>',chevron:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>',history:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 4v4h4"/><path d="M12 8v4l3 2"/></svg>',back:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M15 5l-7 7 7 7"/></svg>',trash:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 12h10l1-12"/></svg>',keys:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="6" width="18" height="12" rx="2.5"/><path d="M7 10h.01M11 10h.01M15 10h.01M7 14h10"/></svg>',pin:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 21s7-5.7 7-11a7 7 0 1 0-14 0c0 5.3 7 11 7 11z"/><circle cx="12" cy="10" r="2.5"/></svg>'},ua=[{icon:"calendar",tone:"a"},{icon:"news",tone:"b"},{icon:"ticket",tone:"c"},{icon:"clock",tone:"d"},{icon:"pin",tone:"e"},{icon:"spark",tone:"f"}];function F(a,e){let t=document.createElement("span");return t.className=e,t.innerHTML=a,t}function G(a,e,t,n){let r=document.createElement("button");return r.type="button",r.className=t,r.setAttribute("aria-label",e),r.title=e,r.innerHTML=a,n&&r.addEventListener("click",n),r}function ha(a){let{title:e,placeholder:t,strings:n,direction:r,lang:i,mode:o,intro:s,logoUrl:c,logoSvg:d,hotkeyLabel:f,historyEnabled:b,onSendText:S,onMicClick:_,onCloseClick:C,onNewConversation:v,onListHistory:h,onOpenConversation:E,onDeleteConversation:w,onClearHistory:A}=a,H=o!=="chat",k=document.createElement("div");k.className="daba-agent-window daba-agent-window--hidden daba-agent-window--intro",k.dir=r,k.lang=i,k.setAttribute("role","dialog"),k.setAttribute("aria-label",e);let K=document.createElement("div");K.className="daba-agent-header";let se=document.createElement("div");se.className="daba-agent-header__left";let Z=document.createElement("span");Z.className="daba-agent-header__mark-slot",se.appendChild(Z);let Ve=l=>{Z.textContent="";let g=be(d);if(g)Z.appendChild(F(g,"daba-agent-header__mark"));else if(l){let p=document.createElement("img");p.className="daba-agent-header__logo",p.alt="",p.addEventListener("error",()=>Ve(null)),p.src=l,Z.appendChild(p);}else Z.appendChild(F(V,"daba-agent-header__mark"));};Ve(c);let me=document.createElement("span");me.className="daba-agent-header__title",me.textContent=e,se.appendChild(me);let je=document.createElement("span");je.className="daba-agent-header__status",se.appendChild(je),K.appendChild(se);let de=document.createElement("div");de.className="daba-agent-header__right";let mt=G(N.mic,n.startVoice,"daba-agent-header__btn daba-agent-header__btn--mic",_);mt.hidden=true;let fe=G(N.history,n.history,"daba-agent-header__btn",()=>ke(!xe));fe.hidden=true,b&&de.appendChild(fe),de.appendChild(G(N.grid,n.newConversation,"daba-agent-header__btn",v)),de.appendChild(G(N.close,n.close,"daba-agent-header__btn",C)),K.appendChild(de),k.appendChild(K);let I=document.createElement("div");I.className="daba-agent-messages",I.setAttribute("role","log"),I.setAttribute("aria-live","polite");let T=null,R=null,Fe=null,Ge=null,$=null,ft=l=>{if(!R)return;R.textContent="";let g=be(d);if(g)R.appendChild(F(g,"daba-agent-intro__mark"));else if(l){let p=document.createElement("img");p.className="daba-agent-intro__mark daba-agent-intro__logo",p.alt="",p.addEventListener("error",()=>ft(null)),p.src=l,R.appendChild(p);}else R.appendChild(F(V,"daba-agent-intro__mark"));};function vt(l){$&&($.textContent="",l.forEach((g,p)=>{let m=ua[p%ua.length],L=document.createElement("button");L.type="button",L.className=`daba-agent-prompt-chip daba-agent-prompt-chip--${m.tone}`,L.appendChild(F(N[m.icon],"daba-agent-prompt-chip__icon"));let te=document.createElement("span");te.textContent=g,L.appendChild(te),L.addEventListener("click",()=>S(g)),$.appendChild(L);}),$.hidden=l.length===0);}if(s.enabled!==false){if(T=document.createElement("div"),T.className="daba-agent-intro",s.mediaUrl&&s.mediaType==="video"){let m=document.createElement("video");m.className="daba-agent-intro__media",m.src=s.mediaUrl,m.autoplay=true,m.muted=true,m.loop=true,m.playsInline=true,m.addEventListener("error",()=>m.remove()),T.appendChild(m);}else if(s.mediaUrl&&s.mediaType==="image"){let m=document.createElement("img");m.className="daba-agent-intro__media",m.src=s.mediaUrl,m.alt="",m.addEventListener("error",()=>m.remove()),T.appendChild(m);}else R=document.createElement("span"),R.className="daba-agent-intro__mark-slot",R.appendChild(F(V,"daba-agent-intro__mark")),T.appendChild(R);let l=document.createElement("p");l.className="daba-agent-intro__greeting",l.textContent=n.introGreeting,T.appendChild(l);let g=document.createElement("p");g.className="daba-agent-intro__headline",g.textContent=s.headline||n.introDefaultHeadline,T.appendChild(g);let p=document.createElement("p");p.className="daba-agent-intro__sub",p.textContent=s.subheadline||n.introDefaultSubheadline,T.appendChild(p),$=document.createElement("div"),$.className="daba-agent-intro__prompts",$.setAttribute("aria-label",n.suggestionsLabel),vt(s.suggestedPrompts??[]),T.appendChild($),Fe=g,Ge=p,I.appendChild(T);}k.appendChild(I);let ve=null,Ha=()=>{if(ve)return;let l=document.createElement("div");l.className="daba-agent-group daba-agent-group--agent daba-agent-thinking";let g=document.createElement("div");g.className="daba-agent-msg daba-agent-msg--agent daba-agent-skeleton",g.setAttribute("role","status"),g.setAttribute("aria-label",n.thinking);for(let m of ["84%","62%","38%"]){let L=document.createElement("span");L.className="daba-agent-skeleton__line",L.style.width=m,g.appendChild(L);}l.appendChild(g);let p=document.createElement("span");p.className="daba-agent-thinking__label",p.textContent=n.thinking,l.appendChild(p),I.appendChild(l),I.scrollTop=I.scrollHeight,ve=l;},Ia=()=>{ve?.remove(),ve=null;},X=document.createElement("div");X.className="daba-agent-history",X.hidden=true;let ye=document.createElement("div");ye.className="daba-agent-history__head";let Na=G(N.back,n.historyBack,"daba-agent-history__back",()=>ke(false));ye.appendChild(Na);let le=document.createElement("h2");le.className="daba-agent-history__title",le.textContent=n.history,le.tabIndex=-1,ye.appendChild(le),X.appendChild(ye);let J=document.createElement("div");J.className="daba-agent-history__list",X.appendChild(J);let xe=false,Pa=l=>{let p=Date.now()-l;try{let m=new Intl.RelativeTimeFormat(i,{numeric:"auto"});return p<3600*1e3?m.format(-Math.round(p/(60*1e3))||0,"minute"):p<864e5?m.format(-Math.round(p/(3600*1e3)),"hour"):p<7*864e5?m.format(-Math.round(p/864e5),"day"):new Intl.DateTimeFormat(i,{month:"short",day:"numeric"}).format(l)}catch{return new Date(l).toLocaleDateString()}},we=()=>{let l=h?.()??[];if(J.textContent="",!l.length){let p=document.createElement("p");return p.className="daba-agent-history__empty",p.textContent=n.historyEmpty,J.appendChild(p),l}for(let p of l){let m=document.createElement("div");m.className="daba-agent-history__item";let L=document.createElement("button");L.type="button",L.className="daba-agent-history__open";let te=document.createElement("span");te.className="daba-agent-history__name",te.textContent=p.title;let Ze=document.createElement("span");Ze.className="daba-agent-history__meta",Ze.textContent=Pa(p.updatedAt),L.append(te,Ze),L.addEventListener("click",()=>{E?.(p.id),ke(false);}),m.appendChild(L);let Oa=G(N.trash,n.historyDelete,"daba-agent-history__delete",()=>{w?.(p.id),we();});m.appendChild(Oa),J.appendChild(m);}let g=document.createElement("button");return g.type="button",g.className="daba-agent-history__clear",g.textContent=n.historyClear,g.addEventListener("click",()=>{A?.(),we(),yt();}),J.appendChild(g),l},ke=l=>{b&&(xe=l,l&&we(),X.hidden=!l,I.hidden=l,Q.hidden=l,fe.setAttribute("aria-expanded",String(l)),l?le.focus():M.focus());},yt=()=>{b&&(fe.hidden=(h?.()??[]).length===0,xe&&we());},Q=document.createElement("div");Q.className="daba-agent-composer";let ce=document.createElement("form");ce.className="daba-agent-input-form";let ee=document.createElement("div");ee.className="daba-agent-field",ee.appendChild(F(N.search,"daba-agent-field__icon"));let M=document.createElement("input");M.type="text",M.className="daba-agent-input",M.placeholder=t,M.setAttribute("aria-label",t),M.autocomplete="off",ee.appendChild(M);let xt=G(N.send,n.send,"daba-agent-send-btn");xt.type="submit",ee.appendChild(xt);let We=null;H&&(We=G(N.mic,n.startVoice,"daba-agent-composer__mic",_),ee.appendChild(We)),ce.appendChild(ee);let Ke=()=>{ce.classList.toggle("daba-agent-input-form--ready",M.value.trim().length>0);};M.addEventListener("input",Ke),Ke(),ce.addEventListener("submit",l=>{l.preventDefault();let g=M.value.trim();g&&(M.value="",Ke(),S(g));}),Q.appendChild(ce);let _e=document.createElement("div");_e.className="daba-agent-footer";let qe=document.createElement("span");qe.className="daba-agent-footer__brand",qe.textContent=n.poweredBy,_e.appendChild(qe);let Ye=document.createElement("span");if(Ye.className="daba-agent-footer__right",H&&f){let l=document.createElement("span");l.className="daba-agent-footer__item",l.appendChild(F(N.keys,"daba-agent-footer__icon"));let g=document.createElement("span");g.textContent=n.voiceHint.replace("{hotkey}",f),l.appendChild(g),Ye.appendChild(l);}return _e.appendChild(Ye),Q.appendChild(_e),k.appendChild(Q),b&&k.insertBefore(X,Q),{chatWindow:k,messagesContainer:I,inputElement:M,micBtn:mt,introEl:T,composerMicBtn:We,setTyping(l){l?Ha():Ia();},setIntroVisible(l){T&&T.classList.toggle("daba-agent-intro--hidden",!l),k.classList.toggle("daba-agent-window--intro",l&&!!T);},setStatusText(l){je.textContent=l;},clearMessages(){for(let l of Array.from(I.children))l!==T&&l.remove();},setHistoryVisible:ke,isHistoryVisible:()=>xe,refreshHistory:yt,applyConfig(l){l.logoUrl!==void 0&&(Ve(l.logoUrl),ft(l.logoUrl)),l.title&&(me.textContent=l.title,k.setAttribute("aria-label",l.title)),l.placeholder&&!M.value&&(M.placeholder=l.placeholder,M.setAttribute("aria-label",l.placeholder));let g=l.intro;if(!(!g||!T)){if(g.enabled===false){T.remove(),T=null,k.classList.remove("daba-agent-window--intro");return}g.headline&&Fe&&(Fe.textContent=g.headline),g.subheadline&&Ge&&(Ge.textContent=g.subheadline),g.suggestedPrompts&&vt(g.suggestedPrompts);}}}}function P(a,e,t,n){let r=document.createElement("div");r.className=`daba-agent-group daba-agent-group--${t}`;let i=document.createElement("div");if(i.className=`daba-agent-msg daba-agent-msg--${t}`,t==="agent"?pa(i,e):i.textContent=e,r.appendChild(i),n?.cards?.length&&n.strings){let o=oa(n.cards,n.strings,n.lang??"en");o&&r.appendChild(o);}if(t==="agent"&&n?.suggestions?.length&&n.onSuggestion){let o=document.createElement("div");o.className="daba-agent-suggestions";for(let s of n.suggestions){let c=document.createElement("button");c.type="button",c.className="daba-agent-suggestion",c.textContent=s,c.addEventListener("click",()=>n.onSuggestion(s)),o.appendChild(c);}r.appendChild(o);}return a.appendChild(r),a.scrollTop=a.scrollHeight,i}var ir=/^-?(?:\d+\.?\d*|\.\d+)(?:px|rem|em|%|vh|vw|dvh|dvw|svh|lvh|ch|pt|cm|mm|in)$/i,or=/^-?(?:\d+\.?\d*|\.\d+)$/,sr=/^(?:calc|min|max|clamp)\((?:[^;{}()]|\([^;{}()]*\))*\)$/i;function U(a,e=true){if(a==null)return null;let t=String(a).trim();return t?or.test(t)?`${t}px`:ir.test(t)||e&&sr.test(t)?t:null:null}var ct={en:{assistantTitle:"AI Assistant",inputPlaceholder:"Ask a question\u2026",send:"Send",startVoice:"Start voice chat",stopVoice:"Stop voice chat",listening:"Listening\u2026",thinking:"Thinking\u2026",speaking:"Speaking\u2026",connecting:"Connecting\u2026",close:"Close",minimize:"Minimize",newConversation:"New conversation",poweredBy:"Powered by DabaLabs",errorGeneric:"Something went wrong. Please try again.",errorMicDenied:"Microphone access was blocked. Allow it in your browser settings to talk.",errorOffline:"You appear to be offline. Check your connection.",introGreeting:"Hi there,",voiceHint:"{hotkey} to talk",introDefaultHeadline:"How can I help?",introDefaultSubheadline:"Ask me anything about this site.",suggestionsLabel:"Suggested questions",viewOnMap:"View on map",readMore:"Read more",openLink:"Open",dateLabel:"Date",locationLabel:"Location",retry:"Try again",typeOrTalk:"Type, or tap the mic to talk",voiceUnavailable:"Voice is unavailable on this device.",cardsLabel:"Results",history:"History",historyBack:"Back",historyEmpty:"No past conversations yet.",historyDelete:"Delete",historyClear:"Clear all",untitledConversation:"Untitled conversation"},ar:{assistantTitle:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F \u0627\u0644\u0630\u0643\u064A",inputPlaceholder:"\u0627\u0637\u0631\u062D \u0633\u0624\u0627\u0644\u0627\u064B\u2026",send:"\u0625\u0631\u0633\u0627\u0644",startVoice:"\u0628\u062F\u0621 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0627\u0644\u0635\u0648\u062A\u064A\u0629",stopVoice:"\u0625\u064A\u0642\u0627\u0641 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0627\u0644\u0635\u0648\u062A\u064A\u0629",listening:"\u062C\u0627\u0631\u064D \u0627\u0644\u0627\u0633\u062A\u0645\u0627\u0639\u2026",thinking:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0641\u0643\u064A\u0631\u2026",speaking:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u062F\u062B\u2026",connecting:"\u062C\u0627\u0631\u064D \u0627\u0644\u0627\u062A\u0635\u0627\u0644\u2026",close:"\u0625\u063A\u0644\u0627\u0642",minimize:"\u062A\u0635\u063A\u064A\u0631",newConversation:"\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 DabaLabs",errorGeneric:"\u062D\u062F\u062B \u062E\u0637\u0623 \u0645\u0627. \u064A\u0631\u062C\u0649 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",errorMicDenied:"\u062A\u0645 \u062D\u0638\u0631 \u0627\u0644\u0648\u0635\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u064A\u0643\u0631\u0648\u0641\u0648\u0646. \u0627\u0633\u0645\u062D \u0628\u0647 \u0645\u0646 \u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0645\u062A\u0635\u0641\u062D \u0644\u0644\u062A\u062D\u062F\u062B.",errorOffline:"\u064A\u0628\u062F\u0648 \u0623\u0646\u0643 \u063A\u064A\u0631 \u0645\u062A\u0635\u0644 \u0628\u0627\u0644\u0625\u0646\u062A\u0631\u0646\u062A. \u062A\u062D\u0642\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643.",introGreeting:"\u0645\u0631\u062D\u0628\u0627\u064B\u060C",voiceHint:"\u0627\u0636\u063A\u0637 {hotkey} \u0644\u0644\u062A\u062D\u062F\u062B",introDefaultHeadline:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u064A \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",introDefaultSubheadline:"\u0627\u0633\u0623\u0644\u0646\u064A \u0639\u0646 \u0623\u064A \u0634\u064A\u0621 \u064A\u062E\u0635 \u0647\u0630\u0627 \u0627\u0644\u0645\u0648\u0642\u0639.",suggestionsLabel:"\u0623\u0633\u0626\u0644\u0629 \u0645\u0642\u062A\u0631\u062D\u0629",viewOnMap:"\u0639\u0631\u0636 \u0639\u0644\u0649 \u0627\u0644\u062E\u0631\u064A\u0637\u0629",readMore:"\u0627\u0642\u0631\u0623 \u0627\u0644\u0645\u0632\u064A\u062F",openLink:"\u0641\u062A\u062D",dateLabel:"\u0627\u0644\u062A\u0627\u0631\u064A\u062E",locationLabel:"\u0627\u0644\u0645\u0648\u0642\u0639",retry:"\u0623\u0639\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",typeOrTalk:"\u0627\u0643\u062A\u0628 \u0623\u0648 \u0627\u0636\u063A\u0637 \u0639\u0644\u0649 \u0627\u0644\u0645\u064A\u0643\u0631\u0648\u0641\u0648\u0646 \u0644\u0644\u062A\u062D\u062F\u062B",voiceUnavailable:"\u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0627\u0644\u0635\u0648\u062A\u064A\u0629 \u063A\u064A\u0631 \u0645\u062A\u0627\u062D\u0629 \u0639\u0644\u0649 \u0647\u0630\u0627 \u0627\u0644\u062C\u0647\u0627\u0632.",cardsLabel:"\u0627\u0644\u0646\u062A\u0627\u0626\u062C",history:"\u0627\u0644\u0633\u062C\u0644",historyBack:"\u0631\u062C\u0648\u0639",historyEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u062D\u0627\u062F\u062B\u0627\u062A \u0633\u0627\u0628\u0642\u0629 \u0628\u0639\u062F.",historyDelete:"\u062D\u0630\u0641",historyClear:"\u0645\u0633\u062D \u0627\u0644\u0643\u0644",untitledConversation:"\u0645\u062D\u0627\u062F\u062B\u0629 \u0628\u062F\u0648\u0646 \u0639\u0646\u0648\u0627\u0646"},fr:{assistantTitle:"Assistant IA",inputPlaceholder:"Posez une question\u2026",send:"Envoyer",startVoice:"D\xE9marrer la conversation vocale",stopVoice:"Arr\xEAter la conversation vocale",listening:"\xC0 l'\xE9coute\u2026",thinking:"R\xE9flexion\u2026",speaking:"R\xE9ponse en cours\u2026",connecting:"Connexion\u2026",close:"Fermer",minimize:"R\xE9duire",newConversation:"Nouvelle conversation",poweredBy:"Propuls\xE9 par DabaLabs",errorGeneric:"Une erreur s'est produite. Veuillez r\xE9essayer.",errorMicDenied:"L'acc\xE8s au microphone a \xE9t\xE9 bloqu\xE9. Autorisez-le dans les param\xE8tres du navigateur pour parler.",errorOffline:"Vous semblez \xEAtre hors ligne. V\xE9rifiez votre connexion.",introGreeting:"Bonjour,",voiceHint:"{hotkey} pour parler",introDefaultHeadline:"Comment puis-je vous aider ?",introDefaultSubheadline:"Posez-moi vos questions sur ce site.",suggestionsLabel:"Questions sugg\xE9r\xE9es",viewOnMap:"Voir sur la carte",readMore:"En savoir plus",openLink:"Ouvrir",dateLabel:"Date",locationLabel:"Lieu",retry:"R\xE9essayer",typeOrTalk:"\xC9crivez, ou appuyez sur le micro pour parler",voiceUnavailable:"La voix n'est pas disponible sur cet appareil.",cardsLabel:"R\xE9sultats",history:"Historique",historyBack:"Retour",historyEmpty:"Aucune conversation pass\xE9e pour l'instant.",historyDelete:"Supprimer",historyClear:"Tout effacer",untitledConversation:"Conversation sans titre"},es:{assistantTitle:"Asistente de IA",inputPlaceholder:"Haz una pregunta\u2026",send:"Enviar",startVoice:"Iniciar conversaci\xF3n por voz",stopVoice:"Detener conversaci\xF3n por voz",listening:"Escuchando\u2026",thinking:"Pensando\u2026",speaking:"Hablando\u2026",connecting:"Conectando\u2026",close:"Cerrar",minimize:"Minimizar",newConversation:"Nueva conversaci\xF3n",poweredBy:"Con tecnolog\xEDa de DabaLabs",errorGeneric:"Algo sali\xF3 mal. Int\xE9ntalo de nuevo.",errorMicDenied:"Se bloque\xF3 el acceso al micr\xF3fono. Perm\xEDtelo en la configuraci\xF3n del navegador para hablar.",errorOffline:"Parece que no tienes conexi\xF3n. Comprueba tu red.",introGreeting:"Hola,",voiceHint:"{hotkey} para hablar",introDefaultHeadline:"\xBFEn qu\xE9 puedo ayudarte?",introDefaultSubheadline:"Preg\xFAntame lo que quieras sobre este sitio.",suggestionsLabel:"Preguntas sugeridas",viewOnMap:"Ver en el mapa",readMore:"Leer m\xE1s",openLink:"Abrir",dateLabel:"Fecha",locationLabel:"Ubicaci\xF3n",retry:"Reintentar",typeOrTalk:"Escribe, o toca el micr\xF3fono para hablar",voiceUnavailable:"La voz no est\xE1 disponible en este dispositivo.",cardsLabel:"Resultados",history:"Historial",historyBack:"Atr\xE1s",historyEmpty:"A\xFAn no hay conversaciones anteriores.",historyDelete:"Eliminar",historyClear:"Borrar todo",untitledConversation:"Conversaci\xF3n sin t\xEDtulo"},de:{assistantTitle:"KI-Assistent",inputPlaceholder:"Stellen Sie eine Frage\u2026",send:"Senden",startVoice:"Sprachchat starten",stopVoice:"Sprachchat beenden",listening:"H\xF6rt zu\u2026",thinking:"Denkt nach\u2026",speaking:"Spricht\u2026",connecting:"Verbinden\u2026",close:"Schlie\xDFen",minimize:"Minimieren",newConversation:"Neue Unterhaltung",poweredBy:"Bereitgestellt von DabaLabs",errorGeneric:"Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.",errorMicDenied:"Der Mikrofonzugriff wurde blockiert. Erlauben Sie ihn in den Browsereinstellungen, um zu sprechen.",errorOffline:"Sie scheinen offline zu sein. Pr\xFCfen Sie Ihre Verbindung.",introGreeting:"Hallo,",voiceHint:"{hotkey} zum Sprechen",introDefaultHeadline:"Wie kann ich helfen?",introDefaultSubheadline:"Fragen Sie mich alles \xFCber diese Website.",suggestionsLabel:"Vorgeschlagene Fragen",viewOnMap:"Auf Karte ansehen",readMore:"Mehr lesen",openLink:"\xD6ffnen",dateLabel:"Datum",locationLabel:"Ort",retry:"Erneut versuchen",typeOrTalk:"Schreiben oder aufs Mikrofon tippen, um zu sprechen",voiceUnavailable:"Die Sprachfunktion ist auf diesem Ger\xE4t nicht verf\xFCgbar.",cardsLabel:"Ergebnisse",history:"Verlauf",historyBack:"Zur\xFCck",historyEmpty:"Noch keine fr\xFCheren Unterhaltungen.",historyDelete:"L\xF6schen",historyClear:"Alle l\xF6schen",untitledConversation:"Unbenannte Unterhaltung"},ru:{assistantTitle:"\u0418\u0418-\u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043D\u0442",inputPlaceholder:"\u0417\u0430\u0434\u0430\u0439\u0442\u0435 \u0432\u043E\u043F\u0440\u043E\u0441\u2026",send:"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",startVoice:"\u041D\u0430\u0447\u0430\u0442\u044C \u0433\u043E\u043B\u043E\u0441\u043E\u0432\u043E\u0439 \u0447\u0430\u0442",stopVoice:"\u041E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0433\u043E\u043B\u043E\u0441\u043E\u0432\u043E\u0439 \u0447\u0430\u0442",listening:"\u0421\u043B\u0443\u0448\u0430\u044E\u2026",thinking:"\u0414\u0443\u043C\u0430\u044E\u2026",speaking:"\u0413\u043E\u0432\u043E\u0440\u044E\u2026",connecting:"\u041F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435\u2026",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",minimize:"\u0421\u0432\u0435\u0440\u043D\u0443\u0442\u044C",newConversation:"\u041D\u043E\u0432\u044B\u0439 \u0434\u0438\u0430\u043B\u043E\u0433",poweredBy:"\u0420\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u043D\u0430 DabaLabs",errorGeneric:"\u0427\u0442\u043E-\u0442\u043E \u043F\u043E\u0448\u043B\u043E \u043D\u0435 \u0442\u0430\u043A. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437.",errorMicDenied:"\u0414\u043E\u0441\u0442\u0443\u043F \u043A \u043C\u0438\u043A\u0440\u043E\u0444\u043E\u043D\u0443 \u0437\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u043D. \u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u0435 \u0435\u0433\u043E \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u0445 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, \u0447\u0442\u043E\u0431\u044B \u0433\u043E\u0432\u043E\u0440\u0438\u0442\u044C.",errorOffline:"\u041F\u043E\u0445\u043E\u0436\u0435, \u0432\u044B \u043D\u0435 \u0432 \u0441\u0435\u0442\u0438. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435.",introGreeting:"\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435,",voiceHint:"{hotkey} \u2014 \u0433\u043E\u0432\u043E\u0440\u0438\u0442\u044C",introDefaultHeadline:"\u0427\u0435\u043C \u044F \u043C\u043E\u0433\u0443 \u043F\u043E\u043C\u043E\u0447\u044C?",introDefaultSubheadline:"\u0421\u043F\u0440\u043E\u0441\u0438\u0442\u0435 \u043C\u0435\u043D\u044F \u043E \u0447\u0451\u043C \u0443\u0433\u043E\u0434\u043D\u043E \u043D\u0430 \u044D\u0442\u043E\u043C \u0441\u0430\u0439\u0442\u0435.",suggestionsLabel:"\u041F\u0440\u0435\u0434\u043B\u0430\u0433\u0430\u0435\u043C\u044B\u0435 \u0432\u043E\u043F\u0440\u043E\u0441\u044B",viewOnMap:"\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u043D\u0430 \u043A\u0430\u0440\u0442\u0435",readMore:"\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u0435\u0435",openLink:"\u041E\u0442\u043A\u0440\u044B\u0442\u044C",dateLabel:"\u0414\u0430\u0442\u0430",locationLabel:"\u041C\u0435\u0441\u0442\u043E",retry:"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C",typeOrTalk:"\u041D\u0430\u043F\u0438\u0448\u0438\u0442\u0435 \u0438\u043B\u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \u043D\u0430 \u043C\u0438\u043A\u0440\u043E\u0444\u043E\u043D, \u0447\u0442\u043E\u0431\u044B \u0433\u043E\u0432\u043E\u0440\u0438\u0442\u044C",voiceUnavailable:"\u0413\u043E\u043B\u043E\u0441\u043E\u0432\u043E\u0439 \u0440\u0435\u0436\u0438\u043C \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u043D\u0430 \u044D\u0442\u043E\u043C \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0435.",cardsLabel:"\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B",history:"\u0418\u0441\u0442\u043E\u0440\u0438\u044F",historyBack:"\u041D\u0430\u0437\u0430\u0434",historyEmpty:"\u041F\u0440\u043E\u0448\u043B\u044B\u0445 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u043E\u0432 \u043F\u043E\u043A\u0430 \u043D\u0435\u0442.",historyDelete:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C",historyClear:"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0432\u0441\u0435",untitledConversation:"\u0420\u0430\u0437\u0433\u043E\u0432\u043E\u0440 \u0431\u0435\u0437 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u044F"},tr:{assistantTitle:"Yapay Zek\xE2 Asistan\u0131",inputPlaceholder:"Bir soru sorun\u2026",send:"G\xF6nder",startVoice:"Sesli sohbeti ba\u015Flat",stopVoice:"Sesli sohbeti durdur",listening:"Dinliyor\u2026",thinking:"D\xFC\u015F\xFCn\xFCyor\u2026",speaking:"Konu\u015Fuyor\u2026",connecting:"Ba\u011Flan\u0131yor\u2026",close:"Kapat",minimize:"K\xFC\xE7\xFClt",newConversation:"Yeni sohbet",poweredBy:"DabaLabs taraf\u0131ndan sa\u011Flan\u0131r",errorGeneric:"Bir \u015Feyler ters gitti. L\xFCtfen tekrar deneyin.",errorMicDenied:"Mikrofon eri\u015Fimi engellendi. Konu\u015Fmak i\xE7in taray\u0131c\u0131 ayarlar\u0131ndan izin verin.",errorOffline:"\xC7evrimd\u0131\u015F\u0131 g\xF6r\xFCn\xFCyorsunuz. Ba\u011Flant\u0131n\u0131z\u0131 kontrol edin.",introGreeting:"Merhaba,",voiceHint:"Konu\u015Fmak i\xE7in {hotkey}",introDefaultHeadline:"Nas\u0131l yard\u0131mc\u0131 olabilirim?",introDefaultSubheadline:"Bu site hakk\u0131nda bana her \u015Feyi sorabilirsiniz.",suggestionsLabel:"\xD6nerilen sorular",viewOnMap:"Haritada g\xF6ster",readMore:"Devam\u0131n\u0131 oku",openLink:"A\xE7",dateLabel:"Tarih",locationLabel:"Konum",retry:"Tekrar dene",typeOrTalk:"Yaz\u0131n veya konu\u015Fmak i\xE7in mikrofona dokunun",voiceUnavailable:"Sesli g\xF6r\xFC\u015Fme bu cihazda kullan\u0131lam\u0131yor.",cardsLabel:"Sonu\xE7lar",history:"Ge\xE7mi\u015F",historyBack:"Geri",historyEmpty:"Hen\xFCz ge\xE7mi\u015F sohbet yok.",historyDelete:"Sil",historyClear:"T\xFCm\xFCn\xFC temizle",untitledConversation:"Ads\u0131z sohbet"},ur:{assistantTitle:"\u0627\u06D2 \u0622\u0626\u06CC \u0627\u0633\u0633\u0679\u0646\u0679",inputPlaceholder:"\u06A9\u0648\u0626\u06CC \u0633\u0648\u0627\u0644 \u067E\u0648\u0686\u06BE\u06CC\u06BA\u2026",send:"\u0628\u06BE\u06CC\u062C\u06CC\u06BA",startVoice:"\u0635\u0648\u062A\u06CC \u06AF\u0641\u062A\u06AF\u0648 \u0634\u0631\u0648\u0639 \u06A9\u0631\u06CC\u06BA",stopVoice:"\u0635\u0648\u062A\u06CC \u06AF\u0641\u062A\u06AF\u0648 \u0628\u0646\u062F \u06A9\u0631\u06CC\u06BA",listening:"\u0633\u0646 \u0631\u06C1\u0627 \u06C1\u06D2\u2026",thinking:"\u0633\u0648\u0686 \u0631\u06C1\u0627 \u06C1\u06D2\u2026",speaking:"\u0628\u0648\u0644 \u0631\u06C1\u0627 \u06C1\u06D2\u2026",connecting:"\u0645\u0646\u0633\u0644\u06A9 \u06C1\u0648 \u0631\u06C1\u0627 \u06C1\u06D2\u2026",close:"\u0628\u0646\u062F \u06A9\u0631\u06CC\u06BA",minimize:"\u0686\u06BE\u0648\u0679\u0627 \u06A9\u0631\u06CC\u06BA",newConversation:"\u0646\u0626\u06CC \u06AF\u0641\u062A\u06AF\u0648",poweredBy:"DabaLabs \u06A9\u06D2 \u062A\u0639\u0627\u0648\u0646 \u0633\u06D2",errorGeneric:"\u06A9\u0686\u06BE \u063A\u0644\u0637 \u06C1\u0648 \u06AF\u06CC\u0627\u06D4 \u0628\u0631\u0627\u06C1 \u06A9\u0631\u0645 \u062F\u0648\u0628\u0627\u0631\u06C1 \u06A9\u0648\u0634\u0634 \u06A9\u0631\u06CC\u06BA\u06D4",errorMicDenied:"\u0645\u0627\u0626\u06CC\u06A9\u0631\u0648\u0641\u0648\u0646 \u062A\u06A9 \u0631\u0633\u0627\u0626\u06CC \u0628\u0644\u0627\u06A9 \u06A9\u0631 \u062F\u06CC \u06AF\u0626\u06CC \u06C1\u06D2\u06D4 \u0628\u0627\u062A \u06A9\u0631\u0646\u06D2 \u06A9\u06D2 \u0644\u06CC\u06D2 \u0628\u0631\u0627\u0624\u0632\u0631 \u06A9\u06CC \u062A\u0631\u062A\u06CC\u0628\u0627\u062A \u0645\u06CC\u06BA \u0627\u062C\u0627\u0632\u062A \u062F\u06CC\u06BA\u06D4",errorOffline:"\u0644\u06AF\u062A\u0627 \u06C1\u06D2 \u0622\u067E \u0622\u0641 \u0644\u0627\u0626\u0646 \u06C1\u06CC\u06BA\u06D4 \u0627\u067E\u0646\u0627 \u06A9\u0646\u06A9\u0634\u0646 \u0686\u06CC\u06A9 \u06A9\u0631\u06CC\u06BA\u06D4",introGreeting:"\u062E\u0648\u0634 \u0622\u0645\u062F\u06CC\u062F\u060C",voiceHint:"\u0628\u0648\u0644\u0646\u06D2 \u06A9\u06D2 \u0644\u06CC\u06D2 {hotkey}",introDefaultHeadline:"\u0645\u06CC\u06BA \u0622\u067E \u06A9\u06CC \u06A9\u06CC\u0627 \u0645\u062F\u062F \u06A9\u0631 \u0633\u06A9\u062A\u0627 \u06C1\u0648\u06BA\u061F",introDefaultSubheadline:"\u0627\u0633 \u0633\u0627\u0626\u0679 \u06A9\u06D2 \u0628\u0627\u0631\u06D2 \u0645\u06CC\u06BA \u0645\u062C\u06BE \u0633\u06D2 \u06A9\u0686\u06BE \u0628\u06BE\u06CC \u067E\u0648\u0686\u06BE\u06CC\u06BA\u06D4",suggestionsLabel:"\u062A\u062C\u0648\u06CC\u0632 \u06A9\u0631\u062F\u06C1 \u0633\u0648\u0627\u0644\u0627\u062A",viewOnMap:"\u0646\u0642\u0634\u06D2 \u067E\u0631 \u062F\u06CC\u06A9\u06BE\u06CC\u06BA",readMore:"\u0645\u0632\u06CC\u062F \u067E\u0691\u06BE\u06CC\u06BA",openLink:"\u06A9\u06BE\u0648\u0644\u06CC\u06BA",dateLabel:"\u062A\u0627\u0631\u06CC\u062E",locationLabel:"\u0645\u0642\u0627\u0645",retry:"\u062F\u0648\u0628\u0627\u0631\u06C1 \u06A9\u0648\u0634\u0634 \u06A9\u0631\u06CC\u06BA",typeOrTalk:"\u0644\u06A9\u06BE\u06CC\u06BA \u06CC\u0627 \u0628\u0627\u062A \u06A9\u0631\u0646\u06D2 \u06A9\u06D2 \u0644\u06CC\u06D2 \u0645\u0627\u0626\u06CC\u06A9\u0631\u0648\u0641\u0648\u0646 \u062F\u0628\u0627\u0626\u06CC\u06BA",voiceUnavailable:"\u0627\u0633 \u0688\u06CC\u0648\u0627\u0626\u0633 \u067E\u0631 \u0635\u0648\u062A\u06CC \u06AF\u0641\u062A\u06AF\u0648 \u062F\u0633\u062A\u06CC\u0627\u0628 \u0646\u06C1\u06CC\u06BA \u06C1\u06D2\u06D4",cardsLabel:"\u0646\u062A\u0627\u0626\u062C",history:"\u062A\u0627\u0631\u06CC\u062E",historyBack:"\u0648\u0627\u067E\u0633",historyEmpty:"\u0627\u0628\u06BE\u06CC \u062A\u06A9 \u06A9\u0648\u0626\u06CC \u067E\u0686\u06BE\u0644\u06CC \u06AF\u0641\u062A\u06AF\u0648 \u0646\u06C1\u06CC\u06BA\u06D4",historyDelete:"\u062D\u0630\u0641 \u06A9\u0631\u06CC\u06BA",historyClear:"\u0633\u0628 \u0635\u0627\u0641 \u06A9\u0631\u06CC\u06BA",untitledConversation:"\u0628\u0644\u0627 \u0639\u0646\u0648\u0627\u0646 \u06AF\u0641\u062A\u06AF\u0648"},hi:{assistantTitle:"\u090F\u0906\u0908 \u0938\u0939\u093E\u092F\u0915",inputPlaceholder:"\u0915\u094B\u0908 \u0938\u0935\u093E\u0932 \u092A\u0942\u091B\u0947\u0902\u2026",send:"\u092D\u0947\u091C\u0947\u0902",startVoice:"\u0935\u0949\u0907\u0938 \u091A\u0948\u091F \u0936\u0941\u0930\u0942 \u0915\u0930\u0947\u0902",stopVoice:"\u0935\u0949\u0907\u0938 \u091A\u0948\u091F \u092C\u0902\u0926 \u0915\u0930\u0947\u0902",listening:"\u0938\u0941\u0928 \u0930\u0939\u093E \u0939\u0948\u2026",thinking:"\u0938\u094B\u091A \u0930\u0939\u093E \u0939\u0948\u2026",speaking:"\u092C\u094B\u0932 \u0930\u0939\u093E \u0939\u0948\u2026",connecting:"\u0915\u0928\u0947\u0915\u094D\u091F \u0939\u094B \u0930\u0939\u093E \u0939\u0948\u2026",close:"\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",minimize:"\u091B\u094B\u091F\u093E \u0915\u0930\u0947\u0902",newConversation:"\u0928\u0908 \u092C\u093E\u0924\u091A\u0940\u0924",poweredBy:"DabaLabs \u0926\u094D\u0935\u093E\u0930\u093E \u0938\u0902\u091A\u093E\u0932\u093F\u0924",errorGeneric:"\u0915\u0941\u091B \u0917\u0921\u093C\u092C\u0921\u093C \u0939\u094B \u0917\u0908\u0964 \u0915\u0943\u092A\u092F\u093E \u092B\u093F\u0930 \u0938\u0947 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0947\u0902\u0964",errorMicDenied:"\u092E\u093E\u0907\u0915\u094D\u0930\u094B\u092B\u093C\u094B\u0928 \u0915\u0940 \u0905\u0928\u0941\u092E\u0924\u093F \u0930\u094B\u0915 \u0926\u0940 \u0917\u0908 \u0939\u0948\u0964 \u092C\u093E\u0924 \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F \u092C\u094D\u0930\u093E\u0909\u091C\u093C\u0930 \u0938\u0947\u091F\u093F\u0902\u0917\u094D\u0938 \u092E\u0947\u0902 \u0907\u0938\u0947 \u0905\u0928\u0941\u092E\u0924\u093F \u0926\u0947\u0902\u0964",errorOffline:"\u0906\u092A \u0911\u092B\u093C\u0932\u093E\u0907\u0928 \u0932\u0917 \u0930\u0939\u0947 \u0939\u0948\u0902\u0964 \u0905\u092A\u0928\u093E \u0915\u0928\u0947\u0915\u094D\u0936\u0928 \u091C\u093E\u0901\u091A\u0947\u0902\u0964",introGreeting:"\u0928\u092E\u0938\u094D\u0924\u0947,",voiceHint:"\u092C\u094B\u0932\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F {hotkey}",introDefaultHeadline:"\u092E\u0948\u0902 \u0906\u092A\u0915\u0940 \u0915\u0948\u0938\u0947 \u092E\u0926\u0926 \u0915\u0930 \u0938\u0915\u0924\u093E \u0939\u0942\u0901?",introDefaultSubheadline:"\u0907\u0938 \u0938\u093E\u0907\u091F \u0915\u0947 \u092C\u093E\u0930\u0947 \u092E\u0947\u0902 \u092E\u0941\u091D\u0938\u0947 \u0915\u0941\u091B \u092D\u0940 \u092A\u0942\u091B\u0947\u0902\u0964",suggestionsLabel:"\u0938\u0941\u091D\u093E\u090F \u0917\u090F \u0938\u0935\u093E\u0932",viewOnMap:"\u092E\u093E\u0928\u091A\u093F\u0924\u094D\u0930 \u092A\u0930 \u0926\u0947\u0916\u0947\u0902",readMore:"\u0914\u0930 \u092A\u0922\u093C\u0947\u0902",openLink:"\u0916\u094B\u0932\u0947\u0902",dateLabel:"\u0924\u093E\u0930\u0940\u0916\u093C",locationLabel:"\u0938\u094D\u0925\u093E\u0928",retry:"\u092B\u093F\u0930 \u0938\u0947 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0947\u0902",typeOrTalk:"\u0932\u093F\u0916\u0947\u0902 \u092F\u093E \u092C\u093E\u0924 \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F \u092E\u093E\u0907\u0915\u094D\u0930\u094B\u092B\u093C\u094B\u0928 \u0926\u092C\u093E\u090F\u0901",voiceUnavailable:"\u0907\u0938 \u0921\u093F\u0935\u093E\u0907\u0938 \u092A\u0930 \u0935\u0949\u0907\u0938 \u0909\u092A\u0932\u092C\u094D\u0927 \u0928\u0939\u0940\u0902 \u0939\u0948\u0964",cardsLabel:"\u092A\u0930\u093F\u0923\u093E\u092E",history:"\u0907\u0924\u093F\u0939\u093E\u0938",historyBack:"\u0935\u093E\u092A\u0938",historyEmpty:"\u0905\u092D\u0940 \u0924\u0915 \u0915\u094B\u0908 \u092A\u093F\u091B\u0932\u0940 \u092C\u093E\u0924\u091A\u0940\u0924 \u0928\u0939\u0940\u0902\u0964",historyDelete:"\u0939\u091F\u093E\u090F\u0901",historyClear:"\u0938\u092D\u0940 \u0938\u093E\u092B\u093C \u0915\u0930\u0947\u0902",untitledConversation:"\u092C\u093F\u0928\u093E \u0936\u0940\u0930\u094D\u0937\u0915 \u092C\u093E\u0924\u091A\u0940\u0924"},zh:{assistantTitle:"AI \u52A9\u624B",inputPlaceholder:"\u8F93\u5165\u4F60\u7684\u95EE\u9898\u2026",send:"\u53D1\u9001",startVoice:"\u5F00\u59CB\u8BED\u97F3\u5BF9\u8BDD",stopVoice:"\u7ED3\u675F\u8BED\u97F3\u5BF9\u8BDD",listening:"\u6B63\u5728\u8046\u542C\u2026",thinking:"\u6B63\u5728\u601D\u8003\u2026",speaking:"\u6B63\u5728\u56DE\u7B54\u2026",connecting:"\u6B63\u5728\u8FDE\u63A5\u2026",close:"\u5173\u95ED",minimize:"\u6700\u5C0F\u5316",newConversation:"\u65B0\u5BF9\u8BDD",poweredBy:"\u7531 DabaLabs \u63D0\u4F9B\u652F\u6301",errorGeneric:"\u51FA\u4E86\u70B9\u95EE\u9898\uFF0C\u8BF7\u91CD\u8BD5\u3002",errorMicDenied:"\u9EA6\u514B\u98CE\u6743\u9650\u88AB\u62D2\u7EDD\u3002\u8BF7\u5728\u6D4F\u89C8\u5668\u8BBE\u7F6E\u4E2D\u5141\u8BB8\u540E\u518D\u4F7F\u7528\u8BED\u97F3\u3002",errorOffline:"\u4F60\u4F3C\u4E4E\u5DF2\u79BB\u7EBF\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u3002",introGreeting:"\u60A8\u597D\uFF0C",voiceHint:"\u6309 {hotkey} \u8BF4\u8BDD",introDefaultHeadline:"\u6709\u4EC0\u4E48\u53EF\u4EE5\u5E2E\u4F60\uFF1F",introDefaultSubheadline:"\u5173\u4E8E\u672C\u7F51\u7AD9\uFF0C\u4F60\u53EF\u4EE5\u95EE\u6211\u4EFB\u4F55\u95EE\u9898\u3002",suggestionsLabel:"\u63A8\u8350\u95EE\u9898",viewOnMap:"\u5728\u5730\u56FE\u4E2D\u67E5\u770B",readMore:"\u9605\u8BFB\u66F4\u591A",openLink:"\u6253\u5F00",dateLabel:"\u65E5\u671F",locationLabel:"\u5730\u70B9",retry:"\u91CD\u8BD5",typeOrTalk:"\u8F93\u5165\u95EE\u9898\uFF0C\u6216\u70B9\u51FB\u9EA6\u514B\u98CE\u8BF4\u8BDD",voiceUnavailable:"\u6B64\u8BBE\u5907\u4E0D\u652F\u6301\u8BED\u97F3\u529F\u80FD\u3002",cardsLabel:"\u7ED3\u679C",history:"\u5386\u53F2\u8BB0\u5F55",historyBack:"\u8FD4\u56DE",historyEmpty:"\u8FD8\u6CA1\u6709\u5386\u53F2\u5BF9\u8BDD\u3002",historyDelete:"\u5220\u9664",historyClear:"\u5168\u90E8\u6E05\u9664",untitledConversation:"\u672A\u547D\u540D\u5BF9\u8BDD"},pt:{assistantTitle:"Assistente de IA",inputPlaceholder:"Fa\xE7a uma pergunta\u2026",send:"Enviar",startVoice:"Iniciar conversa por voz",stopVoice:"Parar conversa por voz",listening:"Ouvindo\u2026",thinking:"Pensando\u2026",speaking:"Falando\u2026",connecting:"Conectando\u2026",close:"Fechar",minimize:"Minimizar",newConversation:"Nova conversa",poweredBy:"Com tecnologia da DabaLabs",errorGeneric:"Algo deu errado. Tente novamente.",errorMicDenied:"O acesso ao microfone foi bloqueado. Permita-o nas configura\xE7\xF5es do navegador para falar.",errorOffline:"Parece que voc\xEA est\xE1 offline. Verifique sua conex\xE3o.",introGreeting:"Ol\xE1,",voiceHint:"{hotkey} para falar",introDefaultHeadline:"Como posso ajudar?",introDefaultSubheadline:"Pergunte-me qualquer coisa sobre este site.",suggestionsLabel:"Perguntas sugeridas",viewOnMap:"Ver no mapa",readMore:"Leia mais",openLink:"Abrir",dateLabel:"Data",locationLabel:"Local",retry:"Tentar novamente",typeOrTalk:"Escreva, ou toque no microfone para falar",voiceUnavailable:"A voz n\xE3o est\xE1 dispon\xEDvel neste dispositivo.",cardsLabel:"Resultados",history:"Hist\xF3rico",historyBack:"Voltar",historyEmpty:"Ainda n\xE3o h\xE1 conversas anteriores.",historyDelete:"Excluir",historyClear:"Limpar tudo",untitledConversation:"Conversa sem t\xEDtulo"},id:{assistantTitle:"Asisten AI",inputPlaceholder:"Ajukan pertanyaan\u2026",send:"Kirim",startVoice:"Mulai obrolan suara",stopVoice:"Hentikan obrolan suara",listening:"Mendengarkan\u2026",thinking:"Berpikir\u2026",speaking:"Berbicara\u2026",connecting:"Menghubungkan\u2026",close:"Tutup",minimize:"Perkecil",newConversation:"Percakapan baru",poweredBy:"Didukung oleh DabaLabs",errorGeneric:"Terjadi kesalahan. Silakan coba lagi.",errorMicDenied:"Akses mikrofon diblokir. Izinkan di pengaturan browser untuk berbicara.",errorOffline:"Sepertinya Anda sedang offline. Periksa koneksi Anda.",introGreeting:"Halo,",voiceHint:"{hotkey} untuk bicara",introDefaultHeadline:"Ada yang bisa saya bantu?",introDefaultSubheadline:"Tanyakan apa saja tentang situs ini.",suggestionsLabel:"Pertanyaan yang disarankan",viewOnMap:"Lihat di peta",readMore:"Baca selengkapnya",openLink:"Buka",dateLabel:"Tanggal",locationLabel:"Lokasi",retry:"Coba lagi",typeOrTalk:"Ketik, atau ketuk mikrofon untuk berbicara",voiceUnavailable:"Suara tidak tersedia di perangkat ini.",cardsLabel:"Hasil",history:"Riwayat",historyBack:"Kembali",historyEmpty:"Belum ada percakapan sebelumnya.",historyDelete:"Hapus",historyClear:"Hapus semua",untitledConversation:"Percakapan tanpa judul"}},dr=new Set(["ar","arc","ckb","dv","fa","he","iw","ku","prs","ps","sd","ug","ur","yi","ji"]),lr=new Set(["arab","hebr","thaa","syrc","nkoo","adlm"]),cr={in:"id",iw:"he",ji:"yi"};function W(a){return typeof a!="string"?"":a.trim().toLowerCase().replace(/_/g,"-")}function ma(a){let e=W(a).split("-")[0]??"";return cr[e]??e}function ba(a){if(a)return Object.prototype.hasOwnProperty.call(ct,a)?ct[a]:void 0}function fa(a){let e=W(a);if(e&&e!=="auto")return e;if(typeof document<"u"&&document.documentElement){let t=W(document.documentElement.getAttribute("lang"));if(t&&t!=="auto")return t}if(typeof navigator<"u"){let t=W(navigator.language);if(t)return t}return "en"}function gr(a){let e=W(a);if(!e)return false;let t=e.split("-");return dr.has(ma(e))?true:t.slice(1).some(n=>lr.has(n))}function va(a,e){let t=W(e);return t==="rtl"||t==="ltr"?t:gr(a)||typeof document<"u"&&document.documentElement&&W(document.documentElement.getAttribute("dir"))==="rtl"?"rtl":"ltr"}function ya(a){let e=W(a);return ba(e)??ba(ma(e))??ct.en}var pr={ctrl:["Control"],alt:["Alt"],shift:["Shift"],meta:["Meta","OS"]};function pt(a){return a.hold?a.ctrl?"ctrl":a.alt?"alt":a.shift?"shift":a.meta?"meta":null:null}function xa(a){let e=He(a);if(!e.hold)return null;if(e.key!=="")return `"hold:" waits on a modifier held by itself, so it cannot also carry the key "${e.key}"`;let t=[e.ctrl,e.alt,e.shift,e.meta].filter(Boolean).length;return t===0?'"hold:" needs one of ctrl, alt, shift or cmd after it':t>1?'"hold:" waits on a single modifier, not a combination':null}function ut(a,e){return pr[e].includes(a.key)}function He(a){let e=a.toLowerCase().trim(),t=e.startsWith("hold:"),n=(t?e.slice(5):e).split("+").map(r=>r.trim());return {hold:t,ctrl:n.includes("ctrl")||n.includes("control"),alt:n.includes("alt"),shift:n.includes("shift"),meta:n.includes("cmd")||n.includes("meta"),key:n.find(r=>!["ctrl","control","alt","shift","cmd","meta"].includes(r))??""}}function wa(a,e){let t=a.key.toLowerCase();return (e.key==="space"?t===" "||a.code==="Space":t===e.key)&&a.ctrlKey===e.ctrl&&a.altKey===e.alt&&a.shiftKey===e.shift&&a.metaKey===e.meta}function ka(a){if(!(a instanceof HTMLElement))return false;let e=a.tagName;return e==="INPUT"||e==="TEXTAREA"||a.isContentEditable}function gt(){if(typeof navigator>"u")return false;let e=navigator.userAgentData?.platform??navigator.platform??"";return /mac|iphone|ipad|ipod/i.test(e)}function Ie(){return gt()?"alt+space":"ctrl+space"}function _a(a){let e=He(a),t=pt(e);if(t)return `Hold ${gt()?{ctrl:"\u2303",alt:"\u2325",shift:"\u21E7",meta:"\u2318"}[t]:{ctrl:"Ctrl",alt:"Alt",shift:"Shift",meta:"Win"}[t]}`;let n=e.key==="space"?"Space":e.key.length===1?e.key.toUpperCase():e.key;return gt()?[...[e.ctrl&&"\u2303",e.alt&&"\u2325",e.shift&&"\u21E7",e.meta&&"\u2318"].filter(Boolean),n].join(" "):[...[e.ctrl&&"Ctrl",e.alt&&"Alt",e.shift&&"Shift",e.meta&&"Win"].filter(Boolean),n].join("+")}var Ca="bottom-right",hr=["bottom-right","bottom-left","top-right","top-left"],br=.02,mr=3,fr=4e3,Ea=600,Ta=["click","keydown","touchstart"];function vr(a){let e=()=>{Ta.forEach(t=>document.removeEventListener(t,e,true)),a.state!=="running"&&a.resume();};Ta.forEach(t=>document.addEventListener(t,e,{once:true,capture:true}));}var Sa="daba-agent-conv:";function La(){let a=globalThis.crypto?.randomUUID?.();return a?a.replace(/-/g,""):`c${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`}function Ne(a,e){try{window.sessionStorage.setItem(Sa+a,e);}catch{}}function yr(a){try{let t=window.sessionStorage.getItem(Sa+a);if(t&&/^[A-Za-z0-9_-]{1,64}$/.test(t))return t}catch{}let e=La();return Ne(a,e),e}var Y=class{constructor(e){this.keydownHandler=e=>this.handleKeydown(e);this.keyupHandler=e=>this.handleKeyup(e);this.blurHandler=()=>this.cancelHold();this.holdTimer=null;this.holdFired=false;this.status="idle";this.isOpen=false;this.destroyed=false;this.ws=null;this.audioContext=null;this.mic=null;this.player=null;this.bargeInStreak=0;this.isReattaching=false;this.messages=[];this.currentStreamBubble=null;this.currentStreamRole=null;this.currentStreamText="";this.chatInFlight=false;this.remoteConfig=null;this.live=null;this.options=e;let t=e.position,n=Ca;t&&(hr.includes(t)?n=t:console.error(`daba-agent: invalid data-position "${t}". Falling back to "${Ca}".`)),this.position=n,this.mode=e.mode??"hybrid",this.uiLang=fa(e.uiLanguage),this.strings=ya(this.uiLang),this.conversationId=yr(e.projectId),this.restricted=Et();let r=e.hotkey??Ie(),i=e.hotkey===null?null:xa(r);i&&console.error(`daba-agent: ignoring hotkey "${r}" \u2014 ${i}. Falling back to ${Ie()}.`);let o=i?Ie():r;this.parsedHotkey=e.hotkey===null?null:He(o),this.heldModifier=this.parsedHotkey?pt(this.parsedHotkey):null;let s=typeof window.matchMedia=="function"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches;if(this.hotkeyText=this.parsedHotkey&&!s?_a(o):null,this.restricted){console.warn("daba-agent: this page has data-daba-agent-restricted set \u2014 the assistant will not read this page or start a session here."),this.badge=document.createElement("button"),this.badgeLabel=document.createElement("span"),this.chatWindow=document.createElement("div"),this.messagesContainer=document.createElement("div"),this.inputElement=document.createElement("input"),this.micBtn=document.createElement("button"),this.ui={chatWindow:this.chatWindow,messagesContainer:this.messagesContainer,inputElement:this.inputElement,micBtn:this.micBtn,introEl:null,composerMicBtn:null,setTyping:()=>{},setIntroVisible:()=>{},setStatusText:()=>{},clearMessages:()=>{},setHistoryVisible:()=>{},isHistoryVisible:()=>false,refreshHistory:()=>{},applyConfig:()=>{}};return}let c=typeof e.container=="string"?document.querySelector(e.container):e.container,d=document.createElement("div");d.className=`daba-agent-wrapper daba-agent-wrapper--pos-${this.position}`;let f=Qt(this.position,this.mode,e.accentColor,e.iconBackgroundColor,e.iconMarkColor,this.hotkeyText);this.badge=f.root,this.badgeLabel=f.label,this.badge.addEventListener("click",()=>{this.mode==="voice"?this.toggleVoice():this.toggleChat();}),d.appendChild(this.badge);let b=va(this.uiLang,e.direction);d.dir=b,d.lang=this.uiLang,e.theme?.theme&&e.theme.theme!=="auto"&&d.setAttribute("data-daba-theme",e.theme.theme),e.theme&&he(d,e.theme),e.accentColor&&he(d,{accent:e.accentColor}),he(d,{"icon-bg":e.iconBackgroundColor,"icon-mark":e.iconMarkColor,"badge-size":U(e.launcher?.size),"badge-icon-size":U(e.launcher?.iconSize),"panel-w":U(e.panel?.width),"panel-h":U(e.panel?.height)});let S={svg:e.launcher?.iconSvg,text:e.launcher?.iconText,url:e.launcher?.iconUrl};(S.svg||S.text||S.url)&&ot(this.badge,S);let _=ha({title:e.title??this.strings.assistantTitle,placeholder:e.placeholder??(this.mode==="chat"?this.strings.inputPlaceholder:this.strings.typeOrTalk),strings:this.strings,direction:b,lang:this.uiLang,mode:this.mode,intro:e.intro??{},logoUrl:e.logoUrl,logoSvg:e.logoSvg,hotkeyLabel:this.hotkeyText,onSendText:C=>{this.sendText(C);},onMicClick:()=>{this.toggleVoice();},onCloseClick:()=>this.closeChat(),historyEnabled:e.historyEnabled===true,onNewConversation:()=>this.resetConversation(),onListHistory:()=>this.listConversations(),onOpenConversation:C=>this.openConversation(C),onDeleteConversation:C=>this.deleteConversation(C),onClearHistory:()=>this.clearHistory()});this.ui=_,this.chatWindow=_.chatWindow,this.messagesContainer=_.messagesContainer,this.inputElement=_.inputElement,this.micBtn=_.micBtn,d.appendChild(this.chatWindow),(c??document.body).appendChild(d),(e.initialOpen||this.mode==="chat")&&this.openChat(),e.hotkey!==null&&(document.addEventListener("keydown",this.keydownHandler),document.addEventListener("keyup",this.keyupHandler),window.addEventListener("blur",this.blurHandler),document.addEventListener("pointerdown",this.blurHandler,true),document.addEventListener("visibilitychange",this.blurHandler)),this.restoreTranscript(),this.ui.refreshHistory(),this.tryReattach(),this.loadRemoteConfig();}restoreTranscript(){this.renderMessages($t(this.options.projectId,this.conversationId));}renderMessages(e){if(e.length){for(let t of e){let n=Array.isArray(t.cards)?t.cards:[];this.messages.push({id:`restored-${t.ts}`,role:t.role,text:t.text,timestamp:t.ts,isFinal:true,cards:n}),P(this.messagesContainer,t.text,t.role,{cards:n,strings:this.strings,lang:t.lang??this.uiLang,suggestions:Array.isArray(t.suggestions)?t.suggestions:[],onSuggestion:r=>{this.sendText(r);}});}this.ui.setIntroVisible(false);}}saveTranscript(){Ne(this.options.projectId,this.conversationId);let e=this.messages.filter(t=>t.role!=="system").map(t=>({role:t.role,text:t.text,cards:t.cards,suggestions:t.suggestions,ts:t.timestamp}));at(this.options.projectId,this.conversationId,e),this.options.historyEnabled&&(jt(this.options.projectId,this.conversationId,e,window.location.pathname,this.strings.untitledConversation),this.ui.refreshHistory());}listConversations(){return !this.options.historyEnabled||this.restricted?[]:Ft(this.options.projectId)}openConversation(e){if(!this.options.historyEnabled||this.restricted)return;let t=Gt(this.options.projectId,e);t.length&&(this.messages=[],this.ui.clearMessages(),this.conversationId=e,Ne(this.options.projectId,e),at(this.options.projectId,e,t),this.renderMessages(t));}deleteConversation(e){this.options.historyEnabled&&(Wt(this.options.projectId,e),e===this.conversationId&&this.resetConversation(),this.ui.refreshHistory());}clearHistory(){this.options.historyEnabled&&(Kt(this.options.projectId),this.ui.refreshHistory());}async loadRemoteConfig(){if(this.destroyed||this.restricted)return;let e=ge(this.options.gatewayUrl,this.options.env),t;try{t=await wt(e,this.options.projectId,this.options.apiKey);}catch{return}if(this.destroyed)return;this.remoteConfig=t;let n=this.chatWindow.parentElement;if(!n)return;let r=t.appearance;he(n,{accent:this.options.accentColor??this.options.theme?.accentColor??r.accentColor,"accent-contrast":this.options.theme?.accentContrast??r.accentContrast,surface:this.options.theme?.surfaceColor??r.surfaceColor,text:this.options.theme?.textColor??r.textColor,radius:this.options.theme?.radius??r.radius,font:this.options.theme?.fontFamily??r.fontFamily});let i=this.options.theme?.theme??r.theme;i&&i!=="auto"&&n.setAttribute("data-daba-theme",i),!this.options.mode&&t.mode&&t.mode!==this.mode&&(this.mode=t.mode,this.applyMode()),ot(this.badge,{svg:this.options.launcher?.iconSvg,text:this.options.launcher?.iconText,url:this.options.launcher?.iconUrl??r.launcherIconUrl}),this.ui.applyConfig({logoUrl:this.options.logoUrl??r.logoUrl,title:this.options.title??t.title,placeholder:this.options.placeholder??(this.mode==="chat"?this.strings.inputPlaceholder:this.strings.typeOrTalk),intro:{enabled:this.options.intro?.enabled??t.intro.enabled,headline:this.options.intro?.headline??t.intro.headline,subheadline:this.options.intro?.subheadline??t.intro.subheadline,mediaUrl:this.options.intro?.mediaUrl??t.intro.mediaUrl,mediaType:this.options.intro?.mediaType??t.intro.mediaType,suggestedPrompts:this.options.intro?.suggestedPrompts??t.intro.suggestedPrompts}});}applyMode(){let e=this.mode!=="chat";this.micBtn.hidden=!e,this.ui.composerMicBtn&&(this.ui.composerMicBtn.hidden=!e);}handleKeydown(e){if(!(this.destroyed||this.restricted||!this.parsedHotkey)){if(this.heldModifier){if(!ut(e,this.heldModifier)){this.cancelHold();return}if(e.repeat||this.holdTimer!==null||this.holdFired)return;this.holdTimer=window.setTimeout(()=>{this.holdTimer=null,this.holdFired=true,this.activate();},600);return}ka(e.target)&&e.target!==this.inputElement||e.repeat||wa(e,this.parsedHotkey)&&(e.preventDefault(),this.toggle());}}handleKeyup(e){!this.heldModifier||!ut(e,this.heldModifier)||(this.cancelHold(),this.holdFired=false);}async activate(){if(!(this.destroyed||this.restricted)){if(this.mode==="chat"){this.openChat();return}this.isActive||await this.startSession();}}cancelHold(){this.holdTimer!==null&&(window.clearTimeout(this.holdTimer),this.holdTimer=null);}setStatus(e){this.status=e,it(this.badge,this.badgeLabel,e,this.position,this.hotkeyText),this.options.onStatusChange?.(e),e==="listening"||e==="speaking"?this.micBtn.classList.add("daba-agent-header__btn--active"):this.micBtn.classList.remove("daba-agent-header__btn--active");}emitError(e){this.options.onError?.(e),this.setStatus("idle"),P(this.messagesContainer,`Error: ${e.message}`,"system");}get currentStatus(){return this.status}get isActive(){return this.status!=="idle"}get isChatOpen(){return this.isOpen}openChat(){this.isOpen||this.restricted||(this.isOpen=true,this.chatWindow.classList.remove("daba-agent-window--hidden"),this.chatWindow.parentElement?.classList.add("daba-agent-wrapper--open"),this.inputElement.focus(),this.options.onChatToggle?.(true));}closeChat(){this.isOpen&&(this.isOpen=false,this.chatWindow.classList.add("daba-agent-window--hidden"),this.chatWindow.parentElement?.classList.remove("daba-agent-wrapper--open"),this.options.onChatToggle?.(false));}toggleChat(){this.isOpen?this.closeChat():this.openChat();}async sendText(e){let t=e.trim();if(this.restricted||!t||this.chatInFlight)return;this.isOpen||this.openChat(),this.ui.setIntroVisible(false);let n={id:`user-${Date.now()}`,role:"user",text:t,timestamp:Date.now(),isFinal:true};if(this.messages.push(n),P(this.messagesContainer,t,"user"),this.saveTranscript(),this.options.onTranscript?.("user",t,true),this.isActive&&this.ws&&this.ws.readyState===WebSocket.OPEN){this.ws.send(JSON.stringify({type:"conversation.item.create",item:{type:"message",role:"user",content:[{type:"input_text",text:t}]}})),this.ws.send(JSON.stringify({type:"response.create"})),this.setStatus("thinking");return}await this.sendChatMessage(t);}async sendChatMessage(e){this.chatInFlight=true,this.ui.setTyping(true),this.ui.setStatusText(this.strings.thinking);let t=ge(this.options.gatewayUrl,this.options.env);try{let n=await Ct(t,this.options.projectId,this.options.apiKey,{message:e,conversationId:this.conversationId,pageContext:pe(),uiLanguage:this.uiLang}),r=n.cards??[],i=n.suggestions??[];this.messages.push({id:`agent-${Date.now()}`,role:"agent",text:n.reply,timestamp:Date.now(),isFinal:!0,cards:r,suggestions:i}),P(this.messagesContainer,n.reply,"agent",{cards:r,strings:this.strings,lang:n.language||this.uiLang,suggestions:i,onSuggestion:o=>{this.sendText(o);}}),this.saveTranscript(),this.options.onTranscript?.("agent",n.reply,!0),r.length&&this.options.onCards?.(r);}catch(n){let r=n instanceof O?n.dabaError:{kind:"network",message:this.strings.errorGeneric};this.options.onError?.(r),P(this.messagesContainer,r.message,"system");}finally{this.chatInFlight=false,this.ui.setTyping(false),this.ui.setStatusText("");}}resetConversation(){this.restricted||(Vt(this.options.projectId,this.conversationId),this.messages=[],this.conversationId=La(),Ne(this.options.projectId,this.conversationId),this.ui.clearMessages(),this.ui.setIntroVisible(true),this.ui.setTyping(false),this.ui.refreshHistory());}async toggleVoice(){this.mode!=="chat"&&await this.toggle();}handleTranscriptDelta(e,t,n){if((this.currentStreamRole!==e||!this.currentStreamBubble)&&(this.currentStreamBubble=P(this.messagesContainer,"",e),this.currentStreamRole=e,this.currentStreamText=""),this.currentStreamBubble&&(this.currentStreamText+=t,this.currentStreamBubble.textContent+=t,this.messagesContainer.scrollTop=this.messagesContainer.scrollHeight),n){let r=this.currentStreamText.trim();r&&(this.messages.push({id:`${e}-${this.messages.length}-${Date.now()}`,role:e,text:r,timestamp:Date.now(),isFinal:true}),this.saveTranscript()),this.currentStreamBubble=null,this.currentStreamRole=null,this.currentStreamText="";}}async toggle(){if(this.mode==="chat"&&!this.restricted){this.toggleChat();return}if(this.restricted){this.emitError({kind:"restricted",message:"This page is marked as protected \u2014 the assistant can't run here."});return}this.isActive?this.stopSession():await this.startSession();}get usesLiveEngine(){return (this.options.voiceEngine??this.remoteConfig?.voiceEngine??"realtime")==="live"}async startLiveSession(){let e=ge(this.options.gatewayUrl,this.options.env);this.live=new Se({gatewayUrl:e,projectId:this.options.projectId,apiKey:this.options.apiKey,handlers:{onStatus:t=>this.setStatus(t),onTranscript:(t,n,r)=>{this.handleTranscriptDelta(t,r?"":n,r),this.options.onTranscript?.(t,n,r);},onToolCall:t=>this.runVoiceTool(t),onError:t=>this.emitError(t),onClosed:()=>{this.live=null,this.cleanupAfterClose();}}}),await this.live.start(pe());}runVoiceTool(e){let{output:t,navigateHref:n}=this.executeTool(e.name,e.args);this.live?.sendToolResult(e.callId,t),n&&window.setTimeout(()=>{window.location.href=n;},Ea);}async startSession(){if(this.destroyed||this.isActive||this.restricted)return;if(this.setStatus("connecting"),this.usesLiveEngine){await this.startLiveSession();return}let e=ge(this.options.gatewayUrl,this.options.env);try{let t=pe(),{sessionId:n,wsUrl:r}=await kt(e,this.options.projectId,this.options.apiKey,t);zt(this.options.projectId,n,r),this.attachWebSocket(r,!1);}catch(t){let n=t instanceof O?t.dabaError:{kind:"network",message:"Failed to start the agent session."};this.emitError(n);}}async tryReattach(){if(this.destroyed||this.isActive||this.restricted)return;let e=Bt(this.options.projectId);e&&(Ae(this.options.projectId),this.isReattaching=true,this.setStatus("connecting"),this.attachWebSocket(e.wsUrl,true));}attachWebSocket(e,t){let n=`${e}${e.includes("?")?"&":"?"}key=${encodeURIComponent(this.options.apiKey)}`,r=new WebSocket(n);r.binaryType="arraybuffer",this.ws=r,r.onopen=()=>{this.onSocketOpen(t);},r.onmessage=i=>this.onSocketMessage(i),r.onerror=()=>{this.emitError({kind:"network",message:"Connection to the voice agent failed."});},r.onclose=i=>this.handleSocketClose(i);}async onSocketOpen(e){if(!(this.destroyed||!this.ws))try{let t=new AudioContext({sampleRate:24e3});this.audioContext=t,t.state!=="running"&&(t.resume(),vr(t)),this.player=new Le(t),this.mic=await Ot(t,(n,r)=>this.onMicFrame(n,r)),e&&this.ws.send(JSON.stringify({type:"page_context",context:pe()})),this.isReattaching=!1,this.setStatus("listening");}catch{let t=this.isReattaching;this.isReattaching=false,this.ws?.close(),t?(this.cleanupAfterClose(),this.startSession()):this.emitError({kind:"network",message:"Microphone access was denied or unavailable."});}}onMicFrame(e,t){this.destroyed||!this.ws||this.ws.readyState!==WebSocket.OPEN||(this.player?.isPlaying()&&(t>br?(this.bargeInStreak++,this.bargeInStreak>=mr&&(this.bargeInStreak=0,this.player?.clear(),this.ws.send(JSON.stringify({type:"cancel"})),this.setStatus("listening"))):this.bargeInStreak=0),this.ws.send(e));}onSocketMessage(e){if(typeof e.data!="string")return;let t;try{t=JSON.parse(e.data);}catch{return}switch(t.type){case "response.output_audio.delta":{let n=t.delta;n&&this.player&&(this.setStatus("speaking"),this.player.pushBase64(n));break}case "conversation.item.input_audio_transcription.delta":{let n=t.delta;n&&(this.handleTranscriptDelta("user",n,false),this.options.onTranscript?.("user",n,false));break}case "conversation.item.input_audio_transcription.completed":{let n=t.transcript;n&&(this.handleTranscriptDelta("user","",true),this.options.onTranscript?.("user",n,true));break}case "response.output_audio_transcript.delta":{let n=t.delta;n&&(this.handleTranscriptDelta("agent",n,false),this.options.onTranscript?.("agent",n,false));break}case "response.output_audio_transcript.done":{let n=t.transcript;n&&(this.handleTranscriptDelta("agent","",true),this.options.onTranscript?.("agent",n,true)),this.status==="speaking"&&this.setStatus("listening");break}case "tool_call":this.handleToolCall(t);break;case "error":{let n=t.error;this.options.onError?.({kind:"network",message:n?.message??"Realtime session error."});break}}}executeTool(e,t){let n={};try{n=JSON.parse(t||"{}");}catch{n={};}switch(e){case "fill_form_field":{let r=Mt(String(n.label??""),String(n.value??""));return P(this.messagesContainer,`Filled field: ${n.label}`,"system"),{output:r}}case "submit_form":{let r=Dt();return P(this.messagesContainer,"Form submission confirmed.","system"),{output:r}}case "navigate":{let r=Nt(String(n.destination??""));return P(this.messagesContainer,`Navigating to ${n.destination}\u2026`,"system"),{output:{ok:r.ok,message:r.message},navigateHref:r.href}}case "click_element":{let r=String(n.description??""),i=Ht(r);if(!i)return {output:{ok:false,message:`Could not find anything matching "${r}" to click.`}};if(!window.confirm(`Daba Agent wants to click: "${i.text}"
2008
+
2009
+ Allow this?`))return {output:{ok:false,message:`Visitor declined to click "${i.text}".`}};let s=It(i.el,i.text);return P(this.messagesContainer,`Clicked: ${i.text}`,"system"),{output:s}}case "scroll_page":{let r=n.direction!==void 0?String(n.direction):void 0,i=n.target!==void 0?String(n.target):void 0;return {output:Pt(r,i)}}default:return {output:{ok:false,message:`Unknown tool "${e}".`}}}}handleToolCall(e){if(!this.ws)return;let{output:t,navigateHref:n}=this.executeTool(e.name,e.arguments);this.ws.send(JSON.stringify({type:"tool_result",call_id:e.call_id,output:JSON.stringify(t)})),n&&window.setTimeout(()=>{window.location.href=n;},Ea);}stopSession(){let e=this.live;this.live=null,e?.stop(),this.ws?.close(fr,"user_stopped"),Ae(this.options.projectId),this.cleanupAfterClose();}handleSocketClose(e){let t=this.status!=="idle",n=this.isReattaching;if(this.isReattaching=false,this.cleanupAfterClose(),!(!t&&!n)){if(n){this.startSession();return}e.code!==1e3&&e.code!==1005&&(this.options.onError?.({kind:"network",message:e.reason||"The voice connection closed unexpectedly."}),this.flashBadgeError());}}flashBadgeError(){this.badge.classList.add("daba-agent-badge--error"),this.badgeLabel.textContent="Unavailable \u2014 try again",window.setTimeout(()=>{this.badge.classList.remove("daba-agent-badge--error"),this.status==="idle"&&it(this.badge,this.badgeLabel,"idle",this.position,this.hotkeyText);},4e3);}cleanupAfterClose(){this.mic?.stop(),this.mic=null,this.player=null,this.audioContext&&(this.audioContext.close(),this.audioContext=null),this.ws=null,this.bargeInStreak=0,this.destroyed||this.setStatus("idle");}destroy(){this.destroyed=true,document.removeEventListener("keydown",this.keydownHandler),document.removeEventListener("keyup",this.keyupHandler),window.removeEventListener("blur",this.blurHandler),document.removeEventListener("pointerdown",this.blurHandler,true),document.removeEventListener("visibilitychange",this.blurHandler),this.cancelHold(),(this.isActive||this.ws||this.live)&&this.stopSession(),this.badge.parentElement?.remove(),this.badge.remove();}};var xr=["bottom-right","bottom-left","top-right","top-left"],wr=["voice","chat","hybrid"],kr=["auto","ltr","rtl"],_r=["auto","light","dark"],Cr=["rounded","circle","pill"],Er=["video","image","none"],Tr="|";function Re(a,e){for(let t of [e,`data-${e}`]){let n=a.getAttribute(t);if(n===null)continue;let r=n.trim();if(r!=="")return {attr:t,value:r}}}function y(a,e){return Re(a,e)?.value}function ie(a,e,t){let n=Re(a,e);if(n){if(t.includes(n.value))return n.value;console.error(`daba-agent: invalid ${n.attr} "${n.value}" on <daba-agent>. Expected one of ${t.join(", ")} \u2014 ignoring it.`,a);}}function ht(a,e){for(let t of [e,`data-${e}`]){let n=a.getAttribute(t);if(n===null)continue;let r=n.trim().toLowerCase();return r!=="false"&&r!=="0"&&r!=="no"}}function Sr(a,e){let t=Re(a,e);if(!t)return;let n=t.value.split(Tr).map(r=>r.trim()).filter(r=>r!=="");return n.length>0?n:void 0}function Pe(a,e){let t=Re(a,e);if(!t)return;let n=U(t.value,false);if(n)return n;console.error(`daba-agent: invalid ${t.attr} "${t.value}" on <daba-agent>. Expected a CSS length such as "400px", "28rem" or "90%".`,a);}function Oe(a){return Object.values(a).some(e=>e!==void 0)?a:void 0}function Lr(){return class extends HTMLElement{constructor(){super(...arguments);this.agent=null;}connectedCallback(){if(this.agent)return;let t=y(this,"project-id"),n=y(this,"api-key");if(!t||!n){console.error("daba-agent: <daba-agent> custom element requires project-id and api-key attributes.",this);return}let r=ie(this,"position",xr),i=y(this,"accent-color"),o=ie(this,"mode",wr),s=y(this,"title"),c=y(this,"placeholder"),d=ht(this,"initial-open"),f=y(this,"hotkey"),b=y(this,"gateway-url"),S=y(this,"env"),_=Oe({accentColor:i,accentContrast:y(this,"accent-contrast"),surfaceColor:y(this,"surface-color"),textColor:y(this,"text-color"),radius:y(this,"radius"),fontFamily:y(this,"font-family"),theme:ie(this,"theme",_r)}),C=ht(this,"intro-disabled"),v=Oe({enabled:C===void 0?void 0:!C,headline:y(this,"intro-headline"),subheadline:y(this,"intro-subheadline"),mediaUrl:y(this,"intro-media-url"),mediaType:ie(this,"intro-media-type",Er),suggestedPrompts:Sr(this,"suggested-prompts")}),h=Oe({shape:ie(this,"launcher-shape",Cr),iconUrl:y(this,"launcher-icon-url"),iconSvg:y(this,"launcher-icon-svg"),iconText:y(this,"launcher-icon-text"),label:y(this,"launcher-label"),size:Pe(this,"launcher-size"),iconSize:Pe(this,"launcher-icon-size")}),E=Oe({width:Pe(this,"panel-width"),height:Pe(this,"panel-height")});this.agent=new Y({container:this,projectId:t,apiKey:n,position:r,accentColor:i,mode:o,title:s,placeholder:c,initialOpen:d,historyEnabled:ht(this,"history-enabled"),hotkey:f,gatewayUrl:b,env:S,theme:_,intro:v,launcher:h,panel:E,logoUrl:y(this,"logo-url"),logoSvg:y(this,"logo-svg"),iconBackgroundColor:y(this,"icon-background-color"),iconMarkColor:y(this,"icon-mark-color"),uiLanguage:y(this,"ui-language"),direction:ie(this,"direction",kr),onStatusChange:w=>{this.dispatchEvent(new CustomEvent("daba-status-change",{detail:{status:w},bubbles:true,composed:true}));},onTranscript:(w,A,H)=>{this.dispatchEvent(new CustomEvent("daba-transcript",{detail:{role:w,text:A,isFinal:H},bubbles:true,composed:true}));},onError:w=>{this.dispatchEvent(new CustomEvent("daba-error",{detail:{error:w},bubbles:true,composed:true}));},onChatToggle:w=>{this.dispatchEvent(new CustomEvent("daba-chat-toggle",{detail:{isOpen:w},bubbles:true,composed:true}));},onCards:w=>{this.dispatchEvent(new CustomEvent("daba-cards",{detail:{cards:w},bubbles:true,composed:true}));}});}disconnectedCallback(){this.agent&&(this.agent.destroy(),this.agent=null);}get dabaAgent(){return this.agent}sendText(t){return this.agent?.sendText(t)}openChat(){this.agent?.openChat();}closeChat(){this.agent?.closeChat();}toggleChat(){this.agent?.toggleChat();}}}exports.DabaAgentElement=void 0;function Ma(a="daba-agent"){if(typeof window>"u"||typeof customElements>"u"||customElements.get(a))return;let e=Lr();customElements.define(a,e),exports.DabaAgentElement??(exports.DabaAgentElement=e);}Ma();var Ar=["bottom-right","bottom-left","top-right","top-left"],Mr=["voice","chat","hybrid"],Dr=["auto","ltr","rtl"],Hr=["auto","light","dark"],Ir=["rounded","circle","pill"],Nr=["video","image","none"],Pr="|";function $e(a,e){for(let t of [`data-daba-${e}`,`data-${e}`]){let n=a.getAttribute(t);if(n===null)continue;let r=n.trim();if(r!=="")return {attr:t,value:r}}}function x(a,e){return $e(a,e)?.value}function oe(a,e,t){let n=$e(a,e);if(n){if(t.includes(n.value))return n.value;console.error(`daba-agent auto-init: invalid ${n.attr} "${n.value}". Expected one of ${t.join(", ")} \u2014 ignoring it.`,a);}}function bt(a,e){for(let t of [`data-daba-${e}`,`data-${e}`]){let n=a.getAttribute(t);if(n===null)continue;let r=n.trim().toLowerCase();return r!=="false"&&r!=="0"&&r!=="no"}}function Or(a,e){let t=$e(a,e);if(!t)return;let n=t.value.split(Pr).map(r=>r.trim()).filter(r=>r!=="");return n.length>0?n:void 0}function ze(a,e){let t=$e(a,e);if(!t)return;let n=U(t.value,false);if(n)return n;console.error(`daba-agent auto-init: invalid ${t.attr} "${t.value}". Expected a CSS length such as "400px", "28rem" or "90%".`,a);}function Be(a){return Object.values(a).some(e=>e!==void 0)?a:void 0}function Ue(){if(typeof document>"u")return [];let a=Array.from(document.querySelectorAll("[data-daba-agent], [data-daba-project-id]")),e=[];for(let t of a){if(t.dataset.dabaAgentInitialized==="true")continue;let n=x(t,"project-id"),r=x(t,"api-key");if(!n||!r){console.warn("daba-agent auto-init: element found but missing data-daba-project-id or data-daba-api-key.",t);continue}let i=oe(t,"position",Ar),o=x(t,"accent-color"),s=oe(t,"mode",Mr),c=x(t,"title"),d=x(t,"placeholder"),f=bt(t,"initial-open"),b=x(t,"hotkey"),S=x(t,"gateway-url"),_=x(t,"env"),C=Be({accentColor:o,accentContrast:x(t,"accent-contrast"),surfaceColor:x(t,"surface-color"),textColor:x(t,"text-color"),radius:x(t,"radius"),fontFamily:x(t,"font-family"),theme:oe(t,"theme",Hr)}),v=bt(t,"intro-disabled"),h=Be({enabled:v===void 0?void 0:!v,headline:x(t,"intro-headline"),subheadline:x(t,"intro-subheadline"),mediaUrl:x(t,"intro-media-url"),mediaType:oe(t,"intro-media-type",Nr),suggestedPrompts:Or(t,"suggested-prompts")}),E=Be({shape:oe(t,"launcher-shape",Ir),iconUrl:x(t,"launcher-icon-url"),iconSvg:x(t,"launcher-icon-svg"),iconText:x(t,"launcher-icon-text"),label:x(t,"launcher-label"),size:ze(t,"launcher-size"),iconSize:ze(t,"launcher-icon-size")}),w=Be({width:ze(t,"panel-width"),height:ze(t,"panel-height")}),A=new Y({container:t,projectId:n,apiKey:r,position:i,accentColor:o,mode:s,title:c,placeholder:d,initialOpen:f,historyEnabled:bt(t,"history-enabled"),hotkey:b,gatewayUrl:S,env:_,theme:C,intro:h,launcher:E,panel:w,logoSvg:x(t,"logo-svg"),iconBackgroundColor:x(t,"icon-background-color"),iconMarkColor:x(t,"icon-mark-color"),logoUrl:x(t,"logo-url"),uiLanguage:x(t,"ui-language"),direction:oe(t,"direction",Dr)});t.dataset.dabaAgentInitialized="true",e.push(A);}return e}typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>Ue()):Ue());function Da(){Ue();}typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Da,{once:true}):Da());exports.DabaAgent=Y;exports.defineDabaAgentElement=Ma;return exports;})({});//# sourceMappingURL=daba-agent.min.js.map
1905
2010
  //# sourceMappingURL=daba-agent.min.js.map