Files
sisvietnamvn_01/BV_DHYD_HCM/Khoa Cấp cứu_files/main.js.download
T

453 lines
914 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(function(jt){typeof define=="function"&&define.amd?define(jt):jt()})(function(){"use strict";var KK=Object.defineProperty;var n0=jt=>{throw TypeError(jt)};var QK=(jt,tt,nn)=>tt in jt?KK(jt,tt,{enumerable:!0,configurable:!0,writable:!0,value:nn}):jt[tt]=nn;var $t=(jt,tt,nn)=>QK(jt,typeof tt!="symbol"?tt+"":tt,nn),JK=(jt,tt,nn)=>tt.has(jt)||n0("Cannot "+nn);var s0=(jt,tt,nn)=>tt.has(jt)?n0("Cannot add the same private member more than once"):tt instanceof WeakSet?tt.add(jt):tt.set(jt,nn);var yc=(jt,tt,nn)=>(JK(jt,tt,"access private method"),nn);/**
* @vue/shared v3.4.21
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/var Rr,zd,o0;function jt(e,t){const n=new Set(e.split(","));return s=>n.has(s)}const tt={},nn=[],En=()=>{},a0=()=>!1,Bi=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),bc=e=>e.startsWith("onUpdate:"),Xt=Object.assign,_c=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},l0=Object.prototype.hasOwnProperty,ut=(e,t)=>l0.call(e,t),Ue=Array.isArray,qr=e=>Br(e)==="[object Map]",zr=e=>Br(e)==="[object Set]",Bd=e=>Br(e)==="[object Date]",c0=e=>Br(e)==="[object RegExp]",Ye=e=>typeof e=="function",At=e=>typeof e=="string",Ls=e=>typeof e=="symbol",_t=e=>e!==null&&typeof e=="object",Ud=e=>(_t(e)||Ye(e))&&Ye(e.then)&&Ye(e.catch),Vd=Object.prototype.toString,Br=e=>Vd.call(e),u0=e=>Br(e).slice(8,-1),Hd=e=>Br(e)==="[object Object]",xc=e=>At(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Po=jt(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ui=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},d0=/-(\w)/g,In=Ui(e=>e.replace(d0,(t,n)=>n?n.toUpperCase():"")),f0=/\B([A-Z])/g,Rs=Ui(e=>e.replace(f0,"-$1").toLowerCase()),Vi=Ui(e=>e.charAt(0).toUpperCase()+e.slice(1)),Hi=Ui(e=>e?`on${Vi(e)}`:""),cs=(e,t)=>!Object.is(e,t),Ur=(e,t)=>{for(let n=0;n<e.length;n++)e[n](t)},Wi=(e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},Mo=e=>{const t=parseFloat(e);return isNaN(t)?e:t},h0=e=>{const t=At(e)?Number(e):NaN;return isNaN(t)?e:t};let Wd;const Gd=()=>Wd||(Wd=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ht(e){if(Ue(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],r=At(s)?v0(s):ht(s);if(r)for(const o in r)t[o]=r[o]}return t}else if(At(e)||_t(e))return e}const p0=/;(?![^(]*\))/g,m0=/:([^]+)/,g0=/\/\*[^]*?\*\//g;function v0(e){const t={};return e.replace(g0,"").split(p0).forEach(n=>{if(n){const s=n.split(m0);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function ne(e){let t="";if(At(e))t=e;else if(Ue(e))for(let n=0;n<e.length;n++){const s=ne(e[n]);s&&(t+=s+" ")}else if(_t(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function Gi(e){if(!e)return null;let{class:t,style:n}=e;return t&&!At(t)&&(e.class=ne(t)),n&&(e.style=ht(n)),e}const y0=jt("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function Kd(e){return!!e||e===""}function b0(e,t){if(e.length!==t.length)return!1;let n=!0;for(let s=0;n&&s<e.length;s++)n=or(e[s],t[s]);return n}function or(e,t){if(e===t)return!0;let n=Bd(e),s=Bd(t);if(n||s)return n&&s?e.getTime()===t.getTime():!1;if(n=Ls(e),s=Ls(t),n||s)return e===t;if(n=Ue(e),s=Ue(t),n||s)return n&&s?b0(e,t):!1;if(n=_t(e),s=_t(t),n||s){if(!n||!s)return!1;const r=Object.keys(e).length,o=Object.keys(t).length;if(r!==o)return!1;for(const i in e){const a=e.hasOwnProperty(i),c=t.hasOwnProperty(i);if(a&&!c||!a&&c||!or(e[i],t[i]))return!1}}return String(e)===String(t)}function wc(e,t){return e.findIndex(n=>or(n,t))}const j=e=>At(e)?e:e==null?"":Ue(e)||_t(e)&&(e.toString===Vd||!Ye(e.toString))?JSON.stringify(e,Qd,2):String(e),Qd=(e,t)=>t&&t.__v_isRef?Qd(e,t.value):qr(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[s,r],o)=>(n[kc(s,o)+" =>"]=r,n),{})}:zr(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>kc(n))}:Ls(t)?kc(t):_t(t)&&!Ue(t)&&!Hd(t)?String(t):t,kc=(e,t="")=>{var n;return Ls(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};let Pn;class Jd{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=Pn,!t&&Pn&&(this.index=(Pn.scopes||(Pn.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const n=Pn;try{return Pn=this,t()}finally{Pn=n}}}on(){Pn=this}off(){Pn=this.parent}stop(t){if(this._active){let n,s;for(n=0,s=this.effects.length;n<s;n++)this.effects[n].stop();for(n=0,s=this.cleanups.length;n<s;n++)this.cleanups[n]();if(this.scopes)for(n=0,s=this.scopes.length;n<s;n++)this.scopes[n].stop(!0);if(!this.detached&&this.parent&&!t){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0,this._active=!1}}}function _0(e){return new Jd(e)}function x0(e,t=Pn){t&&t.active&&t.effects.push(e)}function Xd(){return Pn}function w0(e){Pn&&Pn.cleanups.push(e)}let ir;class Sc{constructor(t,n,s,r){this.fn=t,this.trigger=n,this.scheduler=s,this.active=!0,this.deps=[],this._dirtyLevel=4,this._trackId=0,this._runnings=0,this._shouldSchedule=!1,this._depsLength=0,x0(this,r)}get dirty(){if(this._dirtyLevel===2||this._dirtyLevel===3){this._dirtyLevel=1,js();for(let t=0;t<this._depsLength;t++){const n=this.deps[t];if(n.computed&&(k0(n.computed),this._dirtyLevel>=4))break}this._dirtyLevel===1&&(this._dirtyLevel=0),Ns()}return this._dirtyLevel>=4}set dirty(t){this._dirtyLevel=t?4:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let t=Ds,n=ir;try{return Ds=!0,ir=this,this._runnings++,Zd(this),this.fn()}finally{Yd(this),this._runnings--,ir=n,Ds=t}}stop(){var t;this.active&&(Zd(this),Yd(this),(t=this.onStop)==null||t.call(this),this.active=!1)}}function k0(e){return e.value}function Zd(e){e._trackId++,e._depsLength=0}function Yd(e){if(e.deps.length>e._depsLength){for(let t=e._depsLength;t<e.deps.length;t++)ef(e.deps[t],e);e.deps.length=e._depsLength}}function ef(e,t){const n=e.get(t);n!==void 0&&t._trackId!==n&&(e.delete(t),e.size===0&&e.cleanup())}let Ds=!0,Cc=0;const tf=[];function js(){tf.push(Ds),Ds=!1}function Ns(){const e=tf.pop();Ds=e===void 0?!0:e}function $c(){Cc++}function Tc(){for(Cc--;!Cc&&Ac.length;)Ac.shift()()}function nf(e,t,n){if(t.get(e)!==e._trackId){t.set(e,e._trackId);const s=e.deps[e._depsLength];s!==t?(s&&ef(s,e),e.deps[e._depsLength++]=t):e._depsLength++}}const Ac=[];function sf(e,t,n){$c();for(const s of e.keys()){let r;s._dirtyLevel<t&&(r??(r=e.get(s)===s._trackId))&&(s._shouldSchedule||(s._shouldSchedule=s._dirtyLevel===0),s._dirtyLevel=t),s._shouldSchedule&&(r??(r=e.get(s)===s._trackId))&&(s.trigger(),(!s._runnings||s.allowRecurse)&&s._dirtyLevel!==2&&(s._shouldSchedule=!1,s.scheduler&&Ac.push(s.scheduler)))}Tc()}const rf=(e,t)=>{const n=new Map;return n.cleanup=e,n.computed=t,n},Ki=new WeakMap,ar=Symbol(""),Ec=Symbol("");function xn(e,t,n){if(Ds&&ir){let s=Ki.get(e);s||Ki.set(e,s=new Map);let r=s.get(n);r||s.set(n,r=rf(()=>s.delete(n))),nf(ir,r)}}function xs(e,t,n,s,r,o){const i=Ki.get(e);if(!i)return;let a=[];if(t==="clear")a=[...i.values()];else if(n==="length"&&Ue(e)){const c=Number(s);i.forEach((u,d)=>{(d==="length"||!Ls(d)&&d>=c)&&a.push(u)})}else switch(n!==void 0&&a.push(i.get(n)),t){case"add":Ue(e)?xc(n)&&a.push(i.get("length")):(a.push(i.get(ar)),qr(e)&&a.push(i.get(Ec)));break;case"delete":Ue(e)||(a.push(i.get(ar)),qr(e)&&a.push(i.get(Ec)));break;case"set":qr(e)&&a.push(i.get(ar));break}$c();for(const c of a)c&&sf(c,4);Tc()}function S0(e,t){var n;return(n=Ki.get(e))==null?void 0:n.get(t)}const C0=jt("__proto__,__v_isRef,__isVue"),of=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Ls)),af=$0();function $0(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){const s=lt(this);for(let o=0,i=this.length;o<i;o++)xn(s,"get",o+"");const r=s[t](...n);return r===-1||r===!1?s[t](...n.map(lt)):r}}),["push","pop","shift","unshift","splice"].forEach(t=>{e[t]=function(...n){js(),$c();const s=lt(this)[t].apply(this,n);return Tc(),Ns(),s}}),e}function T0(e){const t=lt(this);return xn(t,"has",e),t.hasOwnProperty(e)}class lf{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,s){const r=this._isReadonly,o=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return o;if(n==="__v_raw")return s===(r?o?q0:gf:o?mf:pf).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const i=Ue(t);if(!r){if(i&&ut(af,n))return Reflect.get(af,n,s);if(n==="hasOwnProperty")return T0}const a=Reflect.get(t,n,s);return(Ls(n)?of.has(n):C0(n))||(r||xn(t,"get",n),o)?a:Ft(a)?i&&xc(n)?a:a.value:_t(a)?r?Vr(a):dt(a):a}}class cf extends lf{constructor(t=!1){super(!1,t)}set(t,n,s,r){let o=t[n];if(!this._isShallow){const c=Wr(o);if(!ta(s)&&!Wr(s)&&(o=lt(o),s=lt(s)),!Ue(t)&&Ft(o)&&!Ft(s))return c?!1:(o.value=s,!0)}const i=Ue(t)&&xc(n)?Number(n)<t.length:ut(t,n),a=Reflect.set(t,n,s,r);return t===lt(r)&&(i?cs(s,o)&&xs(t,"set",n,s):xs(t,"add",n,s)),a}deleteProperty(t,n){const s=ut(t,n);t[n];const r=Reflect.deleteProperty(t,n);return r&&s&&xs(t,"delete",n,void 0),r}has(t,n){const s=Reflect.has(t,n);return(!Ls(n)||!of.has(n))&&xn(t,"has",n),s}ownKeys(t){return xn(t,"iterate",Ue(t)?"length":ar),Reflect.ownKeys(t)}}class A0 extends lf{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const E0=new cf,I0=new A0,P0=new cf(!0),Ic=e=>e,Qi=e=>Reflect.getPrototypeOf(e);function Ji(e,t,n=!1,s=!1){e=e.__v_raw;const r=lt(e),o=lt(t);n||(cs(t,o)&&xn(r,"get",t),xn(r,"get",o));const{has:i}=Qi(r),a=s?Ic:n?Oc:Oo;if(i.call(r,t))return a(e.get(t));if(i.call(r,o))return a(e.get(o));e!==r&&e.get(t)}function Xi(e,t=!1){const n=this.__v_raw,s=lt(n),r=lt(e);return t||(cs(e,r)&&xn(s,"has",e),xn(s,"has",r)),e===r?n.has(e):n.has(e)||n.has(r)}function Zi(e,t=!1){return e=e.__v_raw,!t&&xn(lt(e),"iterate",ar),Reflect.get(e,"size",e)}function uf(e){e=lt(e);const t=lt(this);return Qi(t).has.call(t,e)||(t.add(e),xs(t,"add",e,e)),this}function df(e,t){t=lt(t);const n=lt(this),{has:s,get:r}=Qi(n);let o=s.call(n,e);o||(e=lt(e),o=s.call(n,e));const i=r.call(n,e);return n.set(e,t),o?cs(t,i)&&xs(n,"set",e,t):xs(n,"add",e,t),this}function ff(e){const t=lt(this),{has:n,get:s}=Qi(t);let r=n.call(t,e);r||(e=lt(e),r=n.call(t,e)),s&&s.call(t,e);const o=t.delete(e);return r&&xs(t,"delete",e,void 0),o}function hf(){const e=lt(this),t=e.size!==0,n=e.clear();return t&&xs(e,"clear",void 0,void 0),n}function Yi(e,t){return function(s,r){const o=this,i=o.__v_raw,a=lt(i),c=t?Ic:e?Oc:Oo;return!e&&xn(a,"iterate",ar),i.forEach((u,d)=>s.call(r,c(u),c(d),o))}}function ea(e,t,n){return function(...s){const r=this.__v_raw,o=lt(r),i=qr(o),a=e==="entries"||e===Symbol.iterator&&i,c=e==="keys"&&i,u=r[e](...s),d=n?Ic:t?Oc:Oo;return!t&&xn(o,"iterate",c?Ec:ar),{next(){const{value:f,done:h}=u.next();return h?{value:f,done:h}:{value:a?[d(f[0]),d(f[1])]:d(f),done:h}},[Symbol.iterator](){return this}}}}function Fs(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function M0(){const e={get(o){return Ji(this,o)},get size(){return Zi(this)},has:Xi,add:uf,set:df,delete:ff,clear:hf,forEach:Yi(!1,!1)},t={get(o){return Ji(this,o,!1,!0)},get size(){return Zi(this)},has:Xi,add:uf,set:df,delete:ff,clear:hf,forEach:Yi(!1,!0)},n={get(o){return Ji(this,o,!0)},get size(){return Zi(this,!0)},has(o){return Xi.call(this,o,!0)},add:Fs("add"),set:Fs("set"),delete:Fs("delete"),clear:Fs("clear"),forEach:Yi(!0,!1)},s={get(o){return Ji(this,o,!0,!0)},get size(){return Zi(this,!0)},has(o){return Xi.call(this,o,!0)},add:Fs("add"),set:Fs("set"),delete:Fs("delete"),clear:Fs("clear"),forEach:Yi(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(o=>{e[o]=ea(o,!1,!1),n[o]=ea(o,!0,!1),t[o]=ea(o,!1,!0),s[o]=ea(o,!0,!0)}),[e,n,t,s]}const[O0,L0,R0,D0]=M0();function Pc(e,t){const n=t?e?D0:R0:e?L0:O0;return(s,r,o)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?s:Reflect.get(ut(n,r)&&r in s?n:s,r,o)}const j0={get:Pc(!1,!1)},N0={get:Pc(!1,!0)},F0={get:Pc(!0,!1)},pf=new WeakMap,mf=new WeakMap,gf=new WeakMap,q0=new WeakMap;function z0(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function B0(e){return e.__v_skip||!Object.isExtensible(e)?0:z0(u0(e))}function dt(e){return Wr(e)?e:Mc(e,!1,E0,j0,pf)}function U0(e){return Mc(e,!1,P0,N0,mf)}function Vr(e){return Mc(e,!0,I0,F0,gf)}function Mc(e,t,n,s,r){if(!_t(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=r.get(e);if(o)return o;const i=B0(e);if(i===0)return e;const a=new Proxy(e,i===2?s:n);return r.set(e,a),a}function Hr(e){return Wr(e)?Hr(e.__v_raw):!!(e&&e.__v_isReactive)}function Wr(e){return!!(e&&e.__v_isReadonly)}function ta(e){return!!(e&&e.__v_isShallow)}function vf(e){return Hr(e)||Wr(e)}function lt(e){const t=e&&e.__v_raw;return t?lt(t):e}function yf(e){return Object.isExtensible(e)&&Wi(e,"__v_skip",!0),e}const Oo=e=>_t(e)?dt(e):e,Oc=e=>_t(e)?Vr(e):e;class bf{constructor(t,n,s,r){this.getter=t,this._setter=n,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new Sc(()=>t(this._value),()=>Lo(this,this.effect._dirtyLevel===2?2:3)),this.effect.computed=this,this.effect.active=this._cacheable=!r,this.__v_isReadonly=s}get value(){const t=lt(this);return(!t._cacheable||t.effect.dirty)&&cs(t._value,t._value=t.effect.run())&&Lo(t,4),Lc(t),t.effect._dirtyLevel>=2&&Lo(t,2),t._value}set value(t){this._setter(t)}get _dirty(){return this.effect.dirty}set _dirty(t){this.effect.dirty=t}}function V0(e,t,n=!1){let s,r;const o=Ye(e);return o?(s=e,r=En):(s=e.get,r=e.set),new bf(s,r,o||!r,n)}function Lc(e){var t;Ds&&ir&&(e=lt(e),nf(ir,(t=e.dep)!=null?t:e.dep=rf(()=>e.dep=void 0,e instanceof bf?e:void 0)))}function Lo(e,t=4,n){e=lt(e);const s=e.dep;s&&sf(s,t)}function Ft(e){return!!(e&&e.__v_isRef===!0)}function R(e){return xf(e,!1)}function _f(e){return xf(e,!0)}function xf(e,t){return Ft(e)?e:new H0(e,t)}class H0{constructor(t,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?t:lt(t),this._value=n?t:Oo(t)}get value(){return Lc(this),this._value}set value(t){const n=this.__v_isShallow||ta(t)||Wr(t);t=n?t:lt(t),cs(t,this._rawValue)&&(this._rawValue=t,this._value=n?t:Oo(t),Lo(this,4))}}function y(e){return Ft(e)?e.value:e}const W0={get:(e,t,n)=>y(Reflect.get(e,t,n)),set:(e,t,n,s)=>{const r=e[t];return Ft(r)&&!Ft(n)?(r.value=n,!0):Reflect.set(e,t,n,s)}};function wf(e){return Hr(e)?e:new Proxy(e,W0)}class G0{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:n,set:s}=t(()=>Lc(this),()=>Lo(this));this._get=n,this._set=s}get value(){return this._get()}set value(t){this._set(t)}}function K0(e){return new G0(e)}function Et(e){const t=Ue(e)?new Array(e.length):{};for(const n in e)t[n]=kf(e,n);return t}class Q0{constructor(t,n,s){this._object=t,this._key=n,this._defaultValue=s,this.__v_isRef=!0}get value(){const t=this._object[this._key];return t===void 0?this._defaultValue:t}set value(t){this._object[this._key]=t}get dep(){return S0(lt(this._object),this._key)}}class J0{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function X0(e,t,n){return Ft(e)?e:Ye(e)?new J0(e):_t(e)&&arguments.length>1?kf(e,t,n):R(e)}function kf(e,t,n){const s=e[t];return Ft(s)?s:new Q0(e,t,n)}var Ro={FORGE_RELEASE_DIRECTORY:"/home/forge/widget.geteasy.ai/releases/73962932",FORGE_SITE_BRANCH:"main",USER:"forge",SSH_CLIENT:"159.203.150.232 44588 22",npm_config_user_agent:"pnpm/10.2.1 npm/? node/v18.20.8 linux x64",FORGE_CUSTOM_DEPLOY:"1",XDG_SESSION_TYPE:"tty",npm_node_execpath:"/home/forge/.nvm/versions/node/v18.20.8/bin/node",SHLVL:"1",MOTD_SHOWN:"pam",HOME:"/home/forge",OLDPWD:"/home/forge",FORGE_DEPLOY_MESSAGE:"Enhance survey components with localization support (#937)",NVM_BIN:"/home/forge/.nvm/versions/node/v18.20.8/bin",NVM_INC:"/home/forge/.nvm/versions/node/v18.20.8/include/node",FORGE_SITE_USER:"forge",DBUS_SESSION_BUS_ADDRESS:"unix:path=/run/user/1000/bus",FORGE_SITE_ROOT:"/home/forge/widget.geteasy.ai",NVM_DIR:"/home/forge/.nvm",FORGE_MANUAL_DEPLOY:"0",FORGE_REDEPLOY:"0",LOGNAME:"forge",_:"/home/forge/.nvm/versions/node/v18.20.8/bin/pnpm",LARAVEL_FORGE:"1",XDG_SESSION_CLASS:"user",FORGE_DEPLOYMENT_ID:"73962932",npm_config_registry:"https://registry.npmjs.org/",FORGE_COMPOSER:"php8.4 /usr/local/bin/composer",XDG_SESSION_ID:"127200",npm_config_node_gyp:"/home/forge/.local/share/pnpm/.tools/pnpm/10.2.1/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js",PATH:"/home/forge/widget.geteasy.ai/node_modules/.bin:/home/forge/.local/share/pnpm/.tools/pnpm/10.2.1/node_modules/pnpm/dist/node-gyp-bin:/home/forge/.local/share/pnpm/.tools/pnpm/10.2.1/bin:/home/forge/.nvm/versions/node/v18.20.8/bin:/tmp/site-2755124:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",npm_package_name:"jam-easychatgpt-widget",NODE:"/home/forge/.nvm/versions/node/v18.20.8/bin/node",XDG_RUNTIME_DIR:"/run/user/1000",npm_config_frozen_lockfile:"",LANG:"C.UTF-8",FORGE_PHP:"php8.4",FORGE_DEPLOY_COMMIT:"ddc6f137a19bc9c992acf784d8c88121fe89acbe",FORGE_SITE_ID:"2755124",npm_lifecycle_script:"vite build --config vite.config.widget.js --mode production",SHELL:"/bin/bash",FORGE_QUICK_DEPLOY:"1",FORGE_ROLLBACK:"0",npm_package_version:"0.0.0",npm_lifecycle_event:"build-widget",npm_config_verify_deps_before_run:"false",NODE_PATH:"/home/forge/widget.geteasy.ai/node_modules/.pnpm/vite@5.4.20_sass@1.93.2/node_modules/vite/bin/node_modules:/home/forge/widget.geteasy.ai/node_modules/.pnpm/vite@5.4.20_sass@1.93.2/node_modules/vite/node_modules:/home/forge/widget.geteasy.ai/node_modules/.pnpm/vite@5.4.20_sass@1.93.2/node_modules:/home/forge/widget.geteasy.ai/node_modules/.pnpm/node_modules",FORGE_SITE_PATH:"/home/forge/widget.geteasy.ai",FORGE_SERVER_ID:"925163",PWD:"/home/forge/widget.geteasy.ai",npm_execpath:"/home/forge/.local/share/pnpm/.tools/pnpm/10.2.1/node_modules/pnpm/bin/pnpm.cjs",FORGE_PHP_FPM:"php8.4-fpm",SSH_CONNECTION:"159.203.150.232 44588 192.168.0.40 22",NVM_CD_FLAGS:"",FORGE_DEPLOY_AUTHOR:"Do Vu Thanh Nhan",npm_command:"run-script",PNPM_SCRIPT_SRC_DIR:"/home/forge/widget.geteasy.ai",INIT_CWD:"/home/forge/widget.geteasy.ai",NODE_ENV:"production"};const Do=[];function Z0(e,...t){js();const n=Do.length?Do[Do.length-1].component:null,s=n&&n.appContext.config.warnHandler,r=Y0();if(s)ws(s,n,11,[e+t.map(o=>{var i,a;return(a=(i=o.toString)==null?void 0:i.call(o))!=null?a:JSON.stringify(o)}).join(""),n&&n.proxy,r.map(({vnode:o})=>`at <${_h(n,o.type)}>`).join(`
`),r]);else{const o=[`[Vue warn]: ${e}`,...t];r.length&&o.push(`
`,...ey(r)),console.warn(...o)}Ns()}function Y0(){let e=Do[Do.length-1];if(!e)return[];const t=[];for(;e;){const n=t[0];n&&n.vnode===e?n.recurseCount++:t.push({vnode:e,recurseCount:0});const s=e.component&&e.component.parent;e=s&&s.vnode}return t}function ey(e){const t=[];return e.forEach((n,s)=>{t.push(...s===0?[]:[`
`],...ty(n))}),t}function ty({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",s=e.component?e.component.parent==null:!1,r=` at <${_h(e.component,e.type,s)}`,o=">"+n;return e.props?[r,...ny(e.props),o]:[r+o]}function ny(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(s=>{t.push(...Sf(s,e[s]))}),n.length>3&&t.push(" ..."),t}function Sf(e,t,n){return At(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):typeof t=="number"||typeof t=="boolean"||t==null?n?t:[`${e}=${t}`]:Ft(t)?(t=Sf(e,lt(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):Ye(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=lt(t),n?t:[`${e}=`,t])}function ws(e,t,n,s){try{return s?e(...s):e()}catch(r){jo(r,t,n)}}function Nn(e,t,n,s){if(Ye(e)){const o=ws(e,t,n,s);return o&&Ud(o)&&o.catch(i=>{jo(i,t,n)}),o}const r=[];for(let o=0;o<e.length;o++)r.push(Nn(e[o],t,n,s));return r}function jo(e,t,n,s=!0){const r=t?t.vnode:null;if(t){let o=t.parent;const i=t.proxy,a=`https://vuejs.org/error-reference/#runtime-${n}`;for(;o;){const u=o.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](e,i,a)===!1)return}o=o.parent}const c=t.appContext.config.errorHandler;if(c){ws(c,null,10,[e,i,a]);return}}sy(e,n,r,s)}function sy(e,t,n,s=!0){console.error(e)}let No=!1,Rc=!1;const fn=[];let us=0;const Gr=[];let qs=null,lr=0;const Cf=Promise.resolve();let Dc=null;function kt(e){const t=Dc||Cf;return e?t.then(this?e.bind(this):e):t}function ry(e){let t=us+1,n=fn.length;for(;t<n;){const s=t+n>>>1,r=fn[s],o=Fo(r);o<e||o===e&&r.pre?t=s+1:n=s}return t}function na(e){(!fn.length||!fn.includes(e,No&&e.allowRecurse?us+1:us))&&(e.id==null?fn.push(e):fn.splice(ry(e.id),0,e),$f())}function $f(){!No&&!Rc&&(Rc=!0,Dc=Cf.then(Ef))}function oy(e){const t=fn.indexOf(e);t>us&&fn.splice(t,1)}function iy(e){Ue(e)?Gr.push(...e):(!qs||!qs.includes(e,e.allowRecurse?lr+1:lr))&&Gr.push(e),$f()}function Tf(e,t,n=No?us+1:0){for(;n<fn.length;n++){const s=fn[n];if(s&&s.pre){if(e&&s.id!==e.uid)continue;fn.splice(n,1),n--,s()}}}function Af(e){if(Gr.length){const t=[...new Set(Gr)].sort((n,s)=>Fo(n)-Fo(s));if(Gr.length=0,qs){qs.push(...t);return}for(qs=t,lr=0;lr<qs.length;lr++)qs[lr]();qs=null,lr=0}}const Fo=e=>e.id==null?1/0:e.id,ay=(e,t)=>{const n=Fo(e)-Fo(t);if(n===0){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function Ef(e){Rc=!1,No=!0,fn.sort(ay);const t=En;try{for(us=0;us<fn.length;us++){const n=fn[us];n&&n.active!==!1&&(Ro.NODE_ENV!=="production"&&t(n),ws(n,null,14))}}finally{us=0,fn.length=0,Af(),No=!1,Dc=null,(fn.length||Gr.length)&&Ef()}}function ly(e,t,...n){if(e.isUnmounted)return;const s=e.vnode.props||tt;let r=n;const o=t.startsWith("update:"),i=o&&t.slice(7);if(i&&i in s){const d=`${i==="modelValue"?"model":i}Modifiers`,{number:f,trim:h}=s[d]||tt;h&&(r=n.map(g=>At(g)?g.trim():g)),f&&(r=n.map(Mo))}let a,c=s[a=Hi(t)]||s[a=Hi(In(t))];!c&&o&&(c=s[a=Hi(Rs(t))]),c&&Nn(c,e,6,r);const u=s[a+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Nn(u,e,6,r)}}function If(e,t,n=!1){const s=t.emitsCache,r=s.get(e);if(r!==void 0)return r;const o=e.emits;let i={},a=!1;if(!Ye(e)){const c=u=>{const d=If(u,t,!0);d&&(a=!0,Xt(i,d))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!o&&!a?(_t(e)&&s.set(e,null),null):(Ue(o)?o.forEach(c=>i[c]=null):Xt(i,o),_t(e)&&s.set(e,i),i)}function sa(e,t){return!e||!Bi(t)?!1:(t=t.slice(2).replace(/Once$/,""),ut(e,t[0].toLowerCase()+t.slice(1))||ut(e,Rs(t))||ut(e,t))}let Ht=null,ra=null;function oa(e){const t=Ht;return Ht=e,ra=e&&e.type.__scopeId||null,t}function mn(e){ra=e}function gn(){ra=null}function Se(e,t=Ht,n){if(!t||e._n)return e;const s=(...r)=>{s._d&&fh(-1);const o=oa(t);let i;try{i=e(...r)}finally{oa(o),s._d&&fh(1)}return i};return s._n=!0,s._c=!0,s._d=!0,s}function ZK(){}function Pf(e){const{type:t,vnode:n,proxy:s,withProxy:r,props:o,propsOptions:[i],slots:a,attrs:c,emit:u,render:d,renderCache:f,data:h,setupState:g,ctx:p,inheritAttrs:v}=e;let _,w;const k=oa(e);try{if(n.shapeFlag&4){const E=r||s,O=Ro.NODE_ENV!=="production"&&g.__isScriptSetup?new Proxy(E,{get(I,P,M){return Z0(`Property '${String(P)}' was accessed via 'this'. Avoid using 'this' in templates.`),Reflect.get(I,P,M)}}):E;_=fs(d.call(O,E,f,o,g,h,p)),w=c}else{const E=t;Ro.NODE_ENV,_=fs(E.length>1?E(o,Ro.NODE_ENV!=="production"?{get attrs(){return c},slots:a,emit:u}:{attrs:c,slots:a,emit:u}):E(o,null)),w=t.props?c:cy(c)}}catch(E){Go.length=0,jo(E,e,1),_=G(Mn)}let S=_;if(w&&v!==!1){const E=Object.keys(w),{shapeFlag:O}=S;E.length&&O&7&&(i&&E.some(bc)&&(w=uy(w,i)),S=ds(S,w))}return n.dirs&&(S=ds(S),S.dirs=S.dirs?S.dirs.concat(n.dirs):n.dirs),n.transition&&(S.transition=n.transition),_=S,oa(k),_}const cy=e=>{let t;for(const n in e)(n==="class"||n==="style"||Bi(n))&&((t||(t={}))[n]=e[n]);return t},uy=(e,t)=>{const n={};for(const s in e)(!bc(s)||!(s.slice(9)in t))&&(n[s]=e[s]);return n};function dy(e,t,n){const{props:s,children:r,component:o}=e,{props:i,children:a,patchFlag:c}=t,u=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return s?Mf(s,i,u):!!i;if(c&8){const d=t.dynamicProps;for(let f=0;f<d.length;f++){const h=d[f];if(i[h]!==s[h]&&!sa(u,h))return!0}}}else return(r||a)&&(!a||!a.$stable)?!0:s===i?!1:s?i?Mf(s,i,u):!0:!!i;return!1}function Mf(e,t,n){const s=Object.keys(t);if(s.length!==Object.keys(e).length)return!0;for(let r=0;r<s.length;r++){const o=s[r];if(t[o]!==e[o]&&!sa(n,o))return!0}return!1}function fy({vnode:e,parent:t},n){for(;t;){const s=t.subTree;if(s.suspense&&s.suspense.activeBranch===e&&(s.el=e.el),s===e)(e=t.vnode).el=n,t=t.parent;else break}}const hy="components",Of=Symbol.for("v-ndc");function Nt(e){return At(e)?py(hy,e,!1)||e:e||Of}function py(e,t,n=!0,s=!1){const r=Ht||zt;if(r){const o=r.type;{const a=wa(o,!1);if(a&&(a===t||a===In(t)||a===Vi(In(t))))return o}const i=Lf(r[e]||o[e],t)||Lf(r.appContext[e],t);return!i&&s?o:i}}function Lf(e,t){return e&&(e[t]||e[In(t)]||e[Vi(In(t))])}const Rf=e=>e.__isSuspense;function my(e,t){t&&t.pendingBranch?Ue(e)?t.effects.push(...e):t.effects.push(e):iy(e)}const gy=Symbol.for("v-scx"),vy=()=>Jr(gy);function ks(e,t){return aa(e,null,t)}function yy(e,t){return aa(e,null,{flush:"sync"})}const ia={};function Pe(e,t,n){return aa(e,t,n)}function aa(e,t,{immediate:n,deep:s,flush:r,once:o,onTrack:i,onTrigger:a}=tt){if(t&&o){const I=t;t=(...P)=>{I(...P),O()}}const c=zt,u=I=>s===!0?I:cr(I,s===!1?1:void 0);let d,f=!1,h=!1;if(Ft(e)?(d=()=>e.value,f=ta(e)):Hr(e)?(d=()=>u(e),f=!0):Ue(e)?(h=!0,f=e.some(I=>Hr(I)||ta(I)),d=()=>e.map(I=>{if(Ft(I))return I.value;if(Hr(I))return u(I);if(Ye(I))return ws(I,c,2)})):Ye(e)?t?d=()=>ws(e,c,2):d=()=>(g&&g(),Nn(e,c,3,[p])):d=En,t&&s){const I=d;d=()=>cr(I())}let g,p=I=>{g=S.onStop=()=>{ws(I,c,4),g=S.onStop=void 0}},v;if(Xo)if(p=En,t?n&&Nn(t,c,3,[d(),h?[]:void 0,p]):d(),r==="sync"){const I=vy();v=I.__watcherHandles||(I.__watcherHandles=[])}else return En;let _=h?new Array(e.length).fill(ia):ia;const w=()=>{if(!(!S.active||!S.dirty))if(t){const I=S.run();(s||f||(h?I.some((P,M)=>cs(P,_[M])):cs(I,_)))&&(g&&g(),Nn(t,c,3,[I,_===ia?void 0:h&&_[0]===ia?[]:_,p]),_=I)}else S.run()};w.allowRecurse=!!t;let k;r==="sync"?k=w:r==="post"?k=()=>sn(w,c&&c.suspense):(w.pre=!0,c&&(w.id=c.uid),k=()=>na(w));const S=new Sc(d,En,k),E=Xd(),O=()=>{S.stop(),E&&_c(E.effects,S)};return t?n?w():_=S.run():r==="post"?sn(S.run.bind(S),c&&c.suspense):S.run(),v&&v.push(O),O}function by(e,t,n){const s=this.proxy,r=At(e)?e.includes(".")?Df(s,e):()=>s[e]:e.bind(s,s);let o;Ye(t)?o=t:(o=t.handler,n=t);const i=Jo(this),a=aa(r,o.bind(s),n);return i(),a}function Df(e,t){const n=t.split(".");return()=>{let s=e;for(let r=0;r<n.length&&s;r++)s=s[n[r]];return s}}function cr(e,t,n=0,s){if(!_t(e)||e.__v_skip)return e;if(t&&t>0){if(n>=t)return e;n++}if(s=s||new Set,s.has(e))return e;if(s.add(e),Ft(e))cr(e.value,t,n,s);else if(Ue(e))for(let r=0;r<e.length;r++)cr(e[r],t,n,s);else if(zr(e)||qr(e))e.forEach(r=>{cr(r,t,n,s)});else if(Hd(e))for(const r in e)cr(e[r],t,n,s);return e}function Lt(e,t){if(Ht===null)return e;const n=xa(Ht)||Ht.proxy,s=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[o,i,a,c=tt]=t[r];o&&(Ye(o)&&(o={mounted:o,updated:o}),o.deep&&cr(i),s.push({dir:o,instance:n,value:i,oldValue:void 0,arg:a,modifiers:c}))}return e}function ur(e,t,n,s){const r=e.dirs,o=t&&t.dirs;for(let i=0;i<r.length;i++){const a=r[i];o&&(a.oldValue=o[i].value);let c=a.dir[s];c&&(js(),Nn(c,n,8,[e.el,a,e,t]),Ns())}}const zs=Symbol("_leaveCb"),la=Symbol("_enterCb");function _y(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Je(()=>{e.isMounted=!0}),Zn(()=>{e.isUnmounting=!0}),e}const Fn=[Function,Array],jf={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Fn,onEnter:Fn,onAfterEnter:Fn,onEnterCancelled:Fn,onBeforeLeave:Fn,onLeave:Fn,onAfterLeave:Fn,onLeaveCancelled:Fn,onBeforeAppear:Fn,onAppear:Fn,onAfterAppear:Fn,onAppearCancelled:Fn},xy={name:"BaseTransition",props:jf,setup(e,{slots:t}){const n=es(),s=_y();return()=>{const r=t.default&&qf(t.default(),!0);if(!r||!r.length)return;let o=r[0];if(r.length>1){for(const h of r)if(h.type!==Mn){o=h;break}}const i=lt(e),{mode:a}=i;if(s.isLeaving)return Nc(o);const c=Ff(o);if(!c)return Nc(o);const u=jc(c,i,s,n);ca(c,u);const d=n.subTree,f=d&&Ff(d);if(f&&f.type!==Mn&&!Bs(c,f)){const h=jc(f,i,s,n);if(ca(f,h),a==="out-in")return s.isLeaving=!0,h.afterLeave=()=>{s.isLeaving=!1,n.update.active!==!1&&(n.effect.dirty=!0,n.update())},Nc(o);a==="in-out"&&c.type!==Mn&&(h.delayLeave=(g,p,v)=>{const _=Nf(s,f);_[String(f.key)]=f,g[zs]=()=>{p(),g[zs]=void 0,delete u.delayedLeave},u.delayedLeave=v})}return o}}};function Nf(e,t){const{leavingVNodes:n}=e;let s=n.get(t.type);return s||(s=Object.create(null),n.set(t.type,s)),s}function jc(e,t,n,s){const{appear:r,mode:o,persisted:i=!1,onBeforeEnter:a,onEnter:c,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:f,onLeave:h,onAfterLeave:g,onLeaveCancelled:p,onBeforeAppear:v,onAppear:_,onAfterAppear:w,onAppearCancelled:k}=t,S=String(e.key),E=Nf(n,e),O=(M,q)=>{M&&Nn(M,s,9,q)},I=(M,q)=>{const B=q[1];O(M,q),Ue(M)?M.every(T=>T.length<=1)&&B():M.length<=1&&B()},P={mode:o,persisted:i,beforeEnter(M){let q=a;if(!n.isMounted)if(r)q=v||a;else return;M[zs]&&M[zs](!0);const B=E[S];B&&Bs(e,B)&&B.el[zs]&&B.el[zs](),O(q,[M])},enter(M){let q=c,B=u,T=d;if(!n.isMounted)if(r)q=_||c,B=w||u,T=k||d;else return;let A=!1;const D=M[la]=Q=>{A||(A=!0,Q?O(T,[M]):O(B,[M]),P.delayedLeave&&P.delayedLeave(),M[la]=void 0)};q?I(q,[M,D]):D()},leave(M,q){const B=String(e.key);if(M[la]&&M[la](!0),n.isUnmounting)return q();O(f,[M]);let T=!1;const A=M[zs]=D=>{T||(T=!0,q(),D?O(p,[M]):O(g,[M]),M[zs]=void 0,E[B]===e&&delete E[B])};E[B]=e,h?I(h,[M,A]):A()},clone(M){return jc(M,t,n,s)}};return P}function Nc(e){if(qo(e))return e=ds(e),e.children=null,e}function Ff(e){return qo(e)?e.children?e.children[0]:void 0:e}function ca(e,t){e.shapeFlag&6&&e.component?ca(e.component.subTree,t):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function qf(e,t=!1,n){let s=[],r=0;for(let o=0;o<e.length;o++){let i=e[o];const a=n==null?i.key:String(n)+String(i.key!=null?i.key:o);i.type===_e?(i.patchFlag&128&&r++,s=s.concat(qf(i.children,t,a))):(t||i.type!==Mn)&&s.push(a!=null?ds(i,{key:a}):i)}if(r>1)for(let o=0;o<s.length;o++)s[o].patchFlag=-2;return s}/*! #__NO_SIDE_EFFECTS__ */function Zt(e,t){return Ye(e)?Xt({name:e.name},t,{setup:e}):e}const Kr=e=>!!e.type.__asyncLoader;/*! #__NO_SIDE_EFFECTS__ */function Wt(e){Ye(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:s,delay:r=200,timeout:o,suspensible:i=!0,onError:a}=e;let c=null,u,d=0;const f=()=>(d++,c=null,h()),h=()=>{let g;return c||(g=c=t().catch(p=>{if(p=p instanceof Error?p:new Error(String(p)),a)return new Promise((v,_)=>{a(p,()=>v(f()),()=>_(p),d+1)});throw p}).then(p=>g!==c&&c?c:(p&&(p.__esModule||p[Symbol.toStringTag]==="Module")&&(p=p.default),u=p,p)))};return Zt({name:"AsyncComponentWrapper",__asyncLoader:h,get __asyncResolved(){return u},setup(){const g=zt;if(u)return()=>Fc(u,g);const p=k=>{c=null,jo(k,g,13,!s)};if(i&&g.suspense||Xo)return h().then(k=>()=>Fc(k,g)).catch(k=>(p(k),()=>s?G(s,{error:k}):null));const v=R(!1),_=R(),w=R(!!r);return r&&setTimeout(()=>{w.value=!1},r),o!=null&&setTimeout(()=>{if(!v.value&&!_.value){const k=new Error(`Async component timed out after ${o}ms.`);p(k),_.value=k}},o),h().then(()=>{v.value=!0,g.parent&&qo(g.parent.vnode)&&(g.parent.effect.dirty=!0,na(g.parent.update))}).catch(k=>{p(k),_.value=k}),()=>{if(v.value&&u)return Fc(u,g);if(_.value&&s)return G(s,{error:_.value});if(n&&!w.value)return G(n)}}})}function Fc(e,t){const{ref:n,props:s,children:r,ce:o}=t.vnode,i=G(e,s,r);return i.ref=n,i.ce=o,delete t.vnode.ce,i}const qo=e=>e.type.__isKeepAlive,zo={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=es(),s=n.ctx;if(!s.renderer)return()=>{const k=t.default&&t.default();return k&&k.length===1?k[0]:k};const r=new Map,o=new Set;let i=null;const a=n.suspense,{renderer:{p:c,m:u,um:d,o:{createElement:f}}}=s,h=f("div");s.activate=(k,S,E,O,I)=>{const P=k.component;u(k,S,E,0,a),c(P.vnode,k,S,E,P,a,O,k.slotScopeIds,I),sn(()=>{P.isDeactivated=!1,P.a&&Ur(P.a);const M=k.props&&k.props.onVnodeMounted;M&&qn(M,P.parent,k)},a)},s.deactivate=k=>{const S=k.component;u(k,h,null,1,a),sn(()=>{S.da&&Ur(S.da);const E=k.props&&k.props.onVnodeUnmounted;E&&qn(E,S.parent,k),S.isDeactivated=!0},a)};function g(k){qc(k),d(k,n,a,!0)}function p(k){r.forEach((S,E)=>{const O=wa(S.type);O&&(!k||!k(O))&&v(E)})}function v(k){const S=r.get(k);!i||!Bs(S,i)?g(S):i&&qc(i),r.delete(k),o.delete(k)}Pe(()=>[e.include,e.exclude],([k,S])=>{k&&p(E=>Bo(k,E)),S&&p(E=>!Bo(S,E))},{flush:"post",deep:!0});let _=null;const w=()=>{_!=null&&r.set(_,zc(n.subTree))};return Je(w),Uf(w),Zn(()=>{r.forEach(k=>{const{subTree:S,suspense:E}=n,O=zc(S);if(k.type===O.type&&k.key===O.key){qc(O);const I=O.component.da;I&&sn(I,E);return}g(k)})}),()=>{if(_=null,!t.default)return null;const k=t.default(),S=k[0];if(k.length>1)return i=null,k;if(!Qo(S)||!(S.shapeFlag&4)&&!(S.shapeFlag&128))return i=null,S;let E=zc(S);const O=E.type,I=wa(Kr(E)?E.type.__asyncResolved||{}:O),{include:P,exclude:M,max:q}=e;if(P&&(!I||!Bo(P,I))||M&&I&&Bo(M,I))return i=E,S;const B=E.key==null?O:E.key,T=r.get(B);return E.el&&(E=ds(E),S.shapeFlag&128&&(S.ssContent=E)),_=B,T?(E.el=T.el,E.component=T.component,E.transition&&ca(E,E.transition),E.shapeFlag|=512,o.delete(B),o.add(B)):(o.add(B),q&&o.size>parseInt(q,10)&&v(o.values().next().value)),E.shapeFlag|=256,i=E,Rf(S.type)?S:E}}};function Bo(e,t){return Ue(e)?e.some(n=>Bo(n,t)):At(e)?e.split(",").includes(t):c0(e)?e.test(t):!1}function zf(e,t){Bf(e,"a",t)}function wy(e,t){Bf(e,"da",t)}function Bf(e,t,n=zt){const s=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(ua(t,s,n),n){let r=n.parent;for(;r&&r.parent;)qo(r.parent.vnode)&&ky(s,t,n,r),r=r.parent}}function ky(e,t,n,s){const r=ua(t,e,s,!0);Rt(()=>{_c(s[t],r)},n)}function qc(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function zc(e){return e.shapeFlag&128?e.ssContent:e}function ua(e,t,n=zt,s=!1){if(n){const r=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{if(n.isUnmounted)return;js();const a=Jo(n),c=Nn(t,n,e,i);return a(),Ns(),c});return s?r.unshift(o):r.push(o),o}}const Ss=e=>(t,n=zt)=>(!Xo||e==="sp")&&ua(e,(...s)=>t(...s),n),Sy=Ss("bm"),Je=Ss("m"),Cy=Ss("bu"),Uf=Ss("u"),Zn=Ss("bum"),Rt=Ss("um"),$y=Ss("sp"),Ty=Ss("rtg"),Ay=Ss("rtc");function Ey(e,t=zt){ua("ec",e,t)}function Me(e,t,n,s){let r;const o=n;if(Ue(e)||At(e)){r=new Array(e.length);for(let i=0,a=e.length;i<a;i++)r[i]=t(e[i],i,void 0,o)}else if(typeof e=="number"){r=new Array(e);for(let i=0;i<e;i++)r[i]=t(i+1,i,void 0,o)}else if(_t(e))if(e[Symbol.iterator])r=Array.from(e,(i,a)=>t(i,a,void 0,o));else{const i=Object.keys(e);r=new Array(i.length);for(let a=0,c=i.length;a<c;a++){const u=i[a];r[a]=t(e[u],u,a,o)}}else r=[];return r}function It(e,t,n={},s,r){if(Ht.isCE||Ht.parent&&Kr(Ht.parent)&&Ht.parent.isCE)return t!=="default"&&(n.name=t),G("slot",n,s&&s());let o=e[t];o&&o._c&&(o._d=!1),m();const i=o&&Vf(o(n)),a=oe(_e,{key:n.key||i&&i.key||`_${t}`},i||(s?s():[]),i&&e._===1?64:-2);return a.scopeId&&(a.slotScopeIds=[a.scopeId+"-s"]),o&&o._c&&(o._d=!0),a}function Vf(e){return e.some(t=>Qo(t)?!(t.type===Mn||t.type===_e&&!Vf(t.children)):!0)?e:null}const Bc=e=>e?gh(e)?xa(e)||e.proxy:Bc(e.parent):null,Uo=Xt(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Bc(e.parent),$root:e=>Bc(e.root),$emit:e=>e.emit,$options:e=>Qf(e),$forceUpdate:e=>e.f||(e.f=()=>{e.effect.dirty=!0,na(e.update)}),$nextTick:e=>e.n||(e.n=kt.bind(e.proxy)),$watch:e=>by.bind(e)}),Uc=(e,t)=>e!==tt&&!e.__isScriptSetup&&ut(e,t),Iy={get({_:e},t){const{ctx:n,setupState:s,data:r,props:o,accessCache:i,type:a,appContext:c}=e;let u;if(t[0]!=="$"){const g=i[t];if(g!==void 0)switch(g){case 1:return s[t];case 2:return r[t];case 4:return n[t];case 3:return o[t]}else{if(Uc(s,t))return i[t]=1,s[t];if(r!==tt&&ut(r,t))return i[t]=2,r[t];if((u=e.propsOptions[0])&&ut(u,t))return i[t]=3,o[t];if(n!==tt&&ut(n,t))return i[t]=4,n[t];Vc&&(i[t]=0)}}const d=Uo[t];let f,h;if(d)return t==="$attrs"&&xn(e,"get",t),d(e);if((f=a.__cssModules)&&(f=f[t]))return f;if(n!==tt&&ut(n,t))return i[t]=4,n[t];if(h=c.config.globalProperties,ut(h,t))return h[t]},set({_:e},t,n){const{data:s,setupState:r,ctx:o}=e;return Uc(r,t)?(r[t]=n,!0):s!==tt&&ut(s,t)?(s[t]=n,!0):ut(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:s,appContext:r,propsOptions:o}},i){let a;return!!n[i]||e!==tt&&ut(e,i)||Uc(t,i)||(a=o[0])&&ut(a,i)||ut(s,i)||ut(Uo,i)||ut(r.config.globalProperties,i)},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:ut(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Hf(){return Wf().slots}function Py(){return Wf().attrs}function Wf(){const e=es();return e.setupContext||(e.setupContext=bh(e))}function da(e){return Ue(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function Qr(e,t){return!e||!t?e||t:Ue(e)&&Ue(t)?e.concat(t):Xt({},da(e),da(t))}let Vc=!0;function My(e){const t=Qf(e),n=e.proxy,s=e.ctx;Vc=!1,t.beforeCreate&&Gf(t.beforeCreate,e,"bc");const{data:r,computed:o,methods:i,watch:a,provide:c,inject:u,created:d,beforeMount:f,mounted:h,beforeUpdate:g,updated:p,activated:v,deactivated:_,beforeDestroy:w,beforeUnmount:k,destroyed:S,unmounted:E,render:O,renderTracked:I,renderTriggered:P,errorCaptured:M,serverPrefetch:q,expose:B,inheritAttrs:T,components:A,directives:D,filters:Q}=t;if(u&&Oy(u,s,null),i)for(const K in i){const J=i[K];Ye(J)&&(s[K]=J.bind(n))}if(r){const K=r.call(n,n);_t(K)&&(e.data=dt(K))}if(Vc=!0,o)for(const K in o){const J=o[K],te=Ye(J)?J.bind(n,n):Ye(J.get)?J.get.bind(n,n):En,ge=!Ye(J)&&Ye(J.set)?J.set.bind(n):En,ue=Z({get:te,set:ge});Object.defineProperty(s,K,{enumerable:!0,configurable:!0,get:()=>ue.value,set:we=>ue.value=we})}if(a)for(const K in a)Kf(a[K],s,n,K);if(c){const K=Ye(c)?c.call(n):c;Reflect.ownKeys(K).forEach(J=>{Wc(J,K[J])})}d&&Gf(d,e,"c");function H(K,J){Ue(J)?J.forEach(te=>K(te.bind(n))):J&&K(J.bind(n))}if(H(Sy,f),H(Je,h),H(Cy,g),H(Uf,p),H(zf,v),H(wy,_),H(Ey,M),H(Ay,I),H(Ty,P),H(Zn,k),H(Rt,E),H($y,q),Ue(B))if(B.length){const K=e.exposed||(e.exposed={});B.forEach(J=>{Object.defineProperty(K,J,{get:()=>n[J],set:te=>n[J]=te})})}else e.exposed||(e.exposed={});O&&e.render===En&&(e.render=O),T!=null&&(e.inheritAttrs=T),A&&(e.components=A),D&&(e.directives=D)}function Oy(e,t,n=En){Ue(e)&&(e=Hc(e));for(const s in e){const r=e[s];let o;_t(r)?"default"in r?o=Jr(r.from||s,r.default,!0):o=Jr(r.from||s):o=Jr(r),Ft(o)?Object.defineProperty(t,s,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[s]=o}}function Gf(e,t,n){Nn(Ue(e)?e.map(s=>s.bind(t.proxy)):e.bind(t.proxy),t,n)}function Kf(e,t,n,s){const r=s.includes(".")?Df(n,s):()=>n[s];if(At(e)){const o=t[e];Ye(o)&&Pe(r,o)}else if(Ye(e))Pe(r,e.bind(n));else if(_t(e))if(Ue(e))e.forEach(o=>Kf(o,t,n,s));else{const o=Ye(e.handler)?e.handler.bind(n):t[e.handler];Ye(o)&&Pe(r,o,e)}}function Qf(e){const t=e.type,{mixins:n,extends:s}=t,{mixins:r,optionsCache:o,config:{optionMergeStrategies:i}}=e.appContext,a=o.get(t);let c;return a?c=a:!r.length&&!n&&!s?c=t:(c={},r.length&&r.forEach(u=>fa(c,u,i,!0)),fa(c,t,i)),_t(t)&&o.set(t,c),c}function fa(e,t,n,s=!1){const{mixins:r,extends:o}=t;o&&fa(e,o,n,!0),r&&r.forEach(i=>fa(e,i,n,!0));for(const i in t)if(!(s&&i==="expose")){const a=Ly[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const Ly={data:Jf,props:Xf,emits:Xf,methods:Vo,computed:Vo,beforeCreate:vn,created:vn,beforeMount:vn,mounted:vn,beforeUpdate:vn,updated:vn,beforeDestroy:vn,beforeUnmount:vn,destroyed:vn,unmounted:vn,activated:vn,deactivated:vn,errorCaptured:vn,serverPrefetch:vn,components:Vo,directives:Vo,watch:Dy,provide:Jf,inject:Ry};function Jf(e,t){return t?e?function(){return Xt(Ye(e)?e.call(this,this):e,Ye(t)?t.call(this,this):t)}:t:e}function Ry(e,t){return Vo(Hc(e),Hc(t))}function Hc(e){if(Ue(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function vn(e,t){return e?[...new Set([].concat(e,t))]:t}function Vo(e,t){return e?Xt(Object.create(null),e,t):t}function Xf(e,t){return e?Ue(e)&&Ue(t)?[...new Set([...e,...t])]:Xt(Object.create(null),da(e),da(t??{})):t}function Dy(e,t){if(!e)return t;if(!t)return e;const n=Xt(Object.create(null),e);for(const s in t)n[s]=vn(e[s],t[s]);return n}function Zf(){return{app:null,config:{isNativeTag:a0,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let jy=0;function Ny(e,t){return function(s,r=null){Ye(s)||(s=Xt({},s)),r!=null&&!_t(r)&&(r=null);const o=Zf(),i=new WeakSet;let a=!1;const c=o.app={_uid:jy++,_component:s,_props:r,_container:null,_context:o,_instance:null,version:l1,get config(){return o.config},set config(u){},use(u,...d){return i.has(u)||(u&&Ye(u.install)?(i.add(u),u.install(c,...d)):Ye(u)&&(i.add(u),u(c,...d))),c},mixin(u){return o.mixins.includes(u)||o.mixins.push(u),c},component(u,d){return d?(o.components[u]=d,c):o.components[u]},directive(u,d){return d?(o.directives[u]=d,c):o.directives[u]},mount(u,d,f){if(!a){const h=G(s,r);return h.appContext=o,f===!0?f="svg":f===!1&&(f=void 0),e(h,u,f),a=!0,c._container=u,u.__vue_app__=c,xa(h.component)||h.component.proxy}},unmount(){a&&(e(null,c._container),delete c._container.__vue_app__)},provide(u,d){return o.provides[u]=d,c},runWithContext(u){const d=Ho;Ho=c;try{return u()}finally{Ho=d}}};return c}}let Ho=null;function Wc(e,t){if(zt){let n=zt.provides;const s=zt.parent&&zt.parent.provides;s===n&&(n=zt.provides=Object.create(s)),n[e]=t}}function Jr(e,t,n=!1){const s=zt||Ht;if(s||Ho){const r=s?s.parent==null?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:Ho._context.provides;if(r&&e in r)return r[e];if(arguments.length>1)return n&&Ye(t)?t.call(s&&s.proxy):t}}function Fy(e,t,n,s=!1){const r={},o={};Wi(o,ga,1),e.propsDefaults=Object.create(null),Yf(e,t,r,o);for(const i in e.propsOptions[0])i in r||(r[i]=void 0);n?e.props=s?r:U0(r):e.type.props?e.props=r:e.props=o,e.attrs=o}function qy(e,t,n,s){const{props:r,attrs:o,vnode:{patchFlag:i}}=e,a=lt(r),[c]=e.propsOptions;let u=!1;if((s||i>0)&&!(i&16)){if(i&8){const d=e.vnode.dynamicProps;for(let f=0;f<d.length;f++){let h=d[f];if(sa(e.emitsOptions,h))continue;const g=t[h];if(c)if(ut(o,h))g!==o[h]&&(o[h]=g,u=!0);else{const p=In(h);r[p]=Gc(c,a,p,g,e,!1)}else g!==o[h]&&(o[h]=g,u=!0)}}}else{Yf(e,t,r,o)&&(u=!0);let d;for(const f in a)(!t||!ut(t,f)&&((d=Rs(f))===f||!ut(t,d)))&&(c?n&&(n[f]!==void 0||n[d]!==void 0)&&(r[f]=Gc(c,a,f,void 0,e,!0)):delete r[f]);if(o!==a)for(const f in o)(!t||!ut(t,f))&&(delete o[f],u=!0)}u&&xs(e,"set","$attrs")}function Yf(e,t,n,s){const[r,o]=e.propsOptions;let i=!1,a;if(t)for(let c in t){if(Po(c))continue;const u=t[c];let d;r&&ut(r,d=In(c))?!o||!o.includes(d)?n[d]=u:(a||(a={}))[d]=u:sa(e.emitsOptions,c)||(!(c in s)||u!==s[c])&&(s[c]=u,i=!0)}if(o){const c=lt(n),u=a||tt;for(let d=0;d<o.length;d++){const f=o[d];n[f]=Gc(r,c,f,u[f],e,!ut(u,f))}}return i}function Gc(e,t,n,s,r,o){const i=e[n];if(i!=null){const a=ut(i,"default");if(a&&s===void 0){const c=i.default;if(i.type!==Function&&!i.skipFactory&&Ye(c)){const{propsDefaults:u}=r;if(n in u)s=u[n];else{const d=Jo(r);s=u[n]=c.call(null,t),d()}}else s=c}i[0]&&(o&&!a?s=!1:i[1]&&(s===""||s===Rs(n))&&(s=!0))}return s}function eh(e,t,n=!1){const s=t.propsCache,r=s.get(e);if(r)return r;const o=e.props,i={},a=[];let c=!1;if(!Ye(e)){const d=f=>{c=!0;const[h,g]=eh(f,t,!0);Xt(i,h),g&&a.push(...g)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!o&&!c)return _t(e)&&s.set(e,nn),nn;if(Ue(o))for(let d=0;d<o.length;d++){const f=In(o[d]);th(f)&&(i[f]=tt)}else if(o)for(const d in o){const f=In(d);if(th(f)){const h=o[d],g=i[f]=Ue(h)||Ye(h)?{type:h}:Xt({},h);if(g){const p=rh(Boolean,g.type),v=rh(String,g.type);g[0]=p>-1,g[1]=v<0||p<v,(p>-1||ut(g,"default"))&&a.push(f)}}}const u=[i,a];return _t(e)&&s.set(e,u),u}function th(e){return e[0]!=="$"&&!Po(e)}function nh(e){return e===null?"null":typeof e=="function"?e.name||"":typeof e=="object"&&e.constructor&&e.constructor.name||""}function sh(e,t){return nh(e)===nh(t)}function rh(e,t){return Ue(t)?t.findIndex(n=>sh(n,e)):Ye(t)&&sh(t,e)?0:-1}const oh=e=>e[0]==="_"||e==="$stable",Kc=e=>Ue(e)?e.map(fs):[fs(e)],zy=(e,t,n)=>{if(t._n)return t;const s=Se((...r)=>(Ro.NODE_ENV!=="production"&&zt&&(!n||(n.root,zt.root)),Kc(t(...r))),n);return s._c=!1,s},ih=(e,t,n)=>{const s=e._ctx;for(const r in e){if(oh(r))continue;const o=e[r];if(Ye(o))t[r]=zy(r,o,s);else if(o!=null){const i=Kc(o);t[r]=()=>i}}},ah=(e,t)=>{const n=Kc(t);e.slots.default=()=>n},By=(e,t)=>{if(e.vnode.shapeFlag&32){const n=t._;n?(e.slots=lt(t),Wi(t,"_",n)):ih(t,e.slots={})}else e.slots={},t&&ah(e,t);Wi(e.slots,ga,1)},Uy=(e,t,n)=>{const{vnode:s,slots:r}=e;let o=!0,i=tt;if(s.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:(Xt(r,t),!n&&a===1&&delete r._):(o=!t.$stable,ih(t,r)),i=t}else t&&(ah(e,t),i={default:1});if(o)for(const a in r)!oh(a)&&i[a]==null&&delete r[a]};function Qc(e,t,n,s,r=!1){if(Ue(e)){e.forEach((h,g)=>Qc(h,t&&(Ue(t)?t[g]:t),n,s,r));return}if(Kr(s)&&!r)return;const o=s.shapeFlag&4?xa(s.component)||s.component.proxy:s.el,i=r?null:o,{i:a,r:c}=e,u=t&&t.r,d=a.refs===tt?a.refs={}:a.refs,f=a.setupState;if(u!=null&&u!==c&&(At(u)?(d[u]=null,ut(f,u)&&(f[u]=null)):Ft(u)&&(u.value=null)),Ye(c))ws(c,a,12,[i,d]);else{const h=At(c),g=Ft(c);if(h||g){const p=()=>{if(e.f){const v=h?ut(f,c)?f[c]:d[c]:c.value;r?Ue(v)&&_c(v,o):Ue(v)?v.includes(o)||v.push(o):h?(d[c]=[o],ut(f,c)&&(f[c]=d[c])):(c.value=[o],e.k&&(d[e.k]=c.value))}else h?(d[c]=i,ut(f,c)&&(f[c]=i)):g&&(c.value=i,e.k&&(d[e.k]=i))};i?(p.id=-1,sn(p,n)):p()}}}const sn=my;function Vy(e){return Hy(e)}function Hy(e,t){const n=Gd();n.__VUE__=!0;const{insert:s,remove:r,patchProp:o,createElement:i,createText:a,createComment:c,setText:u,setElementText:d,parentNode:f,nextSibling:h,setScopeId:g=En,insertStaticContent:p}=e,v=(N,ee,Y,L=null,V=null,ie=null,me=void 0,de=null,ve=!!ee.dynamicChildren)=>{if(N===ee)return;N&&!Bs(N,ee)&&(L=$e(N),we(N,V,ie,!0),N=null),ee.patchFlag===-2&&(ve=!1,ee.dynamicChildren=null);const{type:he,ref:Te,shapeFlag:je}=ee;switch(he){case pa:_(N,ee,Y,L);break;case Mn:w(N,ee,Y,L);break;case ma:N==null&&k(ee,Y,L,me);break;case _e:A(N,ee,Y,L,V,ie,me,de,ve);break;default:je&1?O(N,ee,Y,L,V,ie,me,de,ve):je&6?D(N,ee,Y,L,V,ie,me,de,ve):(je&64||je&128)&&he.process(N,ee,Y,L,V,ie,me,de,ve,Oe)}Te!=null&&V&&Qc(Te,N&&N.ref,ie,ee||N,!ee)},_=(N,ee,Y,L)=>{if(N==null)s(ee.el=a(ee.children),Y,L);else{const V=ee.el=N.el;ee.children!==N.children&&u(V,ee.children)}},w=(N,ee,Y,L)=>{N==null?s(ee.el=c(ee.children||""),Y,L):ee.el=N.el},k=(N,ee,Y,L)=>{[N.el,N.anchor]=p(N.children,ee,Y,L,N.el,N.anchor)},S=({el:N,anchor:ee},Y,L)=>{let V;for(;N&&N!==ee;)V=h(N),s(N,Y,L),N=V;s(ee,Y,L)},E=({el:N,anchor:ee})=>{let Y;for(;N&&N!==ee;)Y=h(N),r(N),N=Y;r(ee)},O=(N,ee,Y,L,V,ie,me,de,ve)=>{ee.type==="svg"?me="svg":ee.type==="math"&&(me="mathml"),N==null?I(ee,Y,L,V,ie,me,de,ve):q(N,ee,V,ie,me,de,ve)},I=(N,ee,Y,L,V,ie,me,de)=>{let ve,he;const{props:Te,shapeFlag:je,transition:De,dirs:Ie}=N;if(ve=N.el=i(N.type,ie,Te&&Te.is,Te),je&8?d(ve,N.children):je&16&&M(N.children,ve,null,L,V,Jc(N,ie),me,de),Ie&&ur(N,null,L,"created"),P(ve,N,N.scopeId,me,L),Te){for(const ot in Te)ot!=="value"&&!Po(ot)&&o(ve,ot,null,Te[ot],ie,N.children,L,V,fe);"value"in Te&&o(ve,"value",null,Te.value,ie),(he=Te.onVnodeBeforeMount)&&qn(he,L,N)}Ie&&ur(N,null,L,"beforeMount");const He=Wy(V,De);He&&De.beforeEnter(ve),s(ve,ee,Y),((he=Te&&Te.onVnodeMounted)||He||Ie)&&sn(()=>{he&&qn(he,L,N),He&&De.enter(ve),Ie&&ur(N,null,L,"mounted")},V)},P=(N,ee,Y,L,V)=>{if(Y&&g(N,Y),L)for(let ie=0;ie<L.length;ie++)g(N,L[ie]);if(V){let ie=V.subTree;if(ee===ie){const me=V.vnode;P(N,me,me.scopeId,me.slotScopeIds,V.parent)}}},M=(N,ee,Y,L,V,ie,me,de,ve=0)=>{for(let he=ve;he<N.length;he++){const Te=N[he]=de?Us(N[he]):fs(N[he]);v(null,Te,ee,Y,L,V,ie,me,de)}},q=(N,ee,Y,L,V,ie,me)=>{const de=ee.el=N.el;let{patchFlag:ve,dynamicChildren:he,dirs:Te}=ee;ve|=N.patchFlag&16;const je=N.props||tt,De=ee.props||tt;let Ie;if(Y&&dr(Y,!1),(Ie=De.onVnodeBeforeUpdate)&&qn(Ie,Y,ee,N),Te&&ur(ee,N,Y,"beforeUpdate"),Y&&dr(Y,!0),he?B(N.dynamicChildren,he,de,Y,L,Jc(ee,V),ie):me||J(N,ee,de,null,Y,L,Jc(ee,V),ie,!1),ve>0){if(ve&16)T(de,ee,je,De,Y,L,V);else if(ve&2&&je.class!==De.class&&o(de,"class",null,De.class,V),ve&4&&o(de,"style",je.style,De.style,V),ve&8){const He=ee.dynamicProps;for(let ot=0;ot<He.length;ot++){const it=He[ot],pt=je[it],yt=De[it];(yt!==pt||it==="value")&&o(de,it,pt,yt,V,N.children,Y,L,fe)}}ve&1&&N.children!==ee.children&&d(de,ee.children)}else!me&&he==null&&T(de,ee,je,De,Y,L,V);((Ie=De.onVnodeUpdated)||Te)&&sn(()=>{Ie&&qn(Ie,Y,ee,N),Te&&ur(ee,N,Y,"updated")},L)},B=(N,ee,Y,L,V,ie,me)=>{for(let de=0;de<ee.length;de++){const ve=N[de],he=ee[de],Te=ve.el&&(ve.type===_e||!Bs(ve,he)||ve.shapeFlag&70)?f(ve.el):Y;v(ve,he,Te,null,L,V,ie,me,!0)}},T=(N,ee,Y,L,V,ie,me)=>{if(Y!==L){if(Y!==tt)for(const de in Y)!Po(de)&&!(de in L)&&o(N,de,Y[de],null,me,ee.children,V,ie,fe);for(const de in L){if(Po(de))continue;const ve=L[de],he=Y[de];ve!==he&&de!=="value"&&o(N,de,he,ve,me,ee.children,V,ie,fe)}"value"in L&&o(N,"value",Y.value,L.value,me)}},A=(N,ee,Y,L,V,ie,me,de,ve)=>{const he=ee.el=N?N.el:a(""),Te=ee.anchor=N?N.anchor:a("");let{patchFlag:je,dynamicChildren:De,slotScopeIds:Ie}=ee;Ie&&(de=de?de.concat(Ie):Ie),N==null?(s(he,Y,L),s(Te,Y,L),M(ee.children||[],Y,Te,V,ie,me,de,ve)):je>0&&je&64&&De&&N.dynamicChildren?(B(N.dynamicChildren,De,Y,V,ie,me,de),(ee.key!=null||V&&ee===V.subTree)&&Xc(N,ee,!0)):J(N,ee,Y,Te,V,ie,me,de,ve)},D=(N,ee,Y,L,V,ie,me,de,ve)=>{ee.slotScopeIds=de,N==null?ee.shapeFlag&512?V.ctx.activate(ee,Y,L,me,ve):Q(ee,Y,L,V,ie,me,ve):W(N,ee,ve)},Q=(N,ee,Y,L,V,ie,me)=>{const de=N.component=t1(N,L,V);if(qo(N)&&(de.ctx.renderer=Oe),n1(de),de.asyncDep){if(V&&V.registerDep(de,H),!N.el){const ve=de.subTree=G(Mn);w(null,ve,ee,Y)}}else H(de,N,ee,Y,V,ie,me)},W=(N,ee,Y)=>{const L=ee.component=N.component;if(dy(N,ee,Y))if(L.asyncDep&&!L.asyncResolved){K(L,ee,Y);return}else L.next=ee,oy(L.update),L.effect.dirty=!0,L.update();else ee.el=N.el,L.vnode=ee},H=(N,ee,Y,L,V,ie,me)=>{const de=()=>{if(N.isMounted){let{next:Te,bu:je,u:De,parent:Ie,vnode:He}=N;{const Ot=lh(N);if(Ot){Te&&(Te.el=He.el,K(N,Te,me)),Ot.asyncDep.then(()=>{N.isUnmounted||de()});return}}let ot=Te,it;dr(N,!1),Te?(Te.el=He.el,K(N,Te,me)):Te=He,je&&Ur(je),(it=Te.props&&Te.props.onVnodeBeforeUpdate)&&qn(it,Ie,Te,He),dr(N,!0);const pt=Pf(N),yt=N.subTree;N.subTree=pt,v(yt,pt,f(yt.el),$e(yt),N,V,ie),Te.el=pt.el,ot===null&&fy(N,pt.el),De&&sn(De,V),(it=Te.props&&Te.props.onVnodeUpdated)&&sn(()=>qn(it,Ie,Te,He),V)}else{let Te;const{el:je,props:De}=ee,{bm:Ie,m:He,parent:ot}=N,it=Kr(ee);dr(N,!1),Ie&&Ur(Ie),!it&&(Te=De&&De.onVnodeBeforeMount)&&qn(Te,ot,ee),dr(N,!0);{const pt=N.subTree=Pf(N);v(null,pt,Y,L,N,V,ie),ee.el=pt.el}if(He&&sn(He,V),!it&&(Te=De&&De.onVnodeMounted)){const pt=ee;sn(()=>qn(Te,ot,pt),V)}(ee.shapeFlag&256||ot&&Kr(ot.vnode)&&ot.vnode.shapeFlag&256)&&N.a&&sn(N.a,V),N.isMounted=!0,ee=Y=L=null}},ve=N.effect=new Sc(de,En,()=>na(he),N.scope),he=N.update=()=>{ve.dirty&&ve.run()};he.id=N.uid,dr(N,!0),he()},K=(N,ee,Y)=>{ee.component=N;const L=N.vnode.props;N.vnode=ee,N.next=null,qy(N,ee.props,L,Y),Uy(N,ee.children,Y),js(),Tf(N),Ns()},J=(N,ee,Y,L,V,ie,me,de,ve=!1)=>{const he=N&&N.children,Te=N?N.shapeFlag:0,je=ee.children,{patchFlag:De,shapeFlag:Ie}=ee;if(De>0){if(De&128){ge(he,je,Y,L,V,ie,me,de,ve);return}else if(De&256){te(he,je,Y,L,V,ie,me,de,ve);return}}Ie&8?(Te&16&&fe(he,V,ie),je!==he&&d(Y,je)):Te&16?Ie&16?ge(he,je,Y,L,V,ie,me,de,ve):fe(he,V,ie,!0):(Te&8&&d(Y,""),Ie&16&&M(je,Y,L,V,ie,me,de,ve))},te=(N,ee,Y,L,V,ie,me,de,ve)=>{N=N||nn,ee=ee||nn;const he=N.length,Te=ee.length,je=Math.min(he,Te);let De;for(De=0;De<je;De++){const Ie=ee[De]=ve?Us(ee[De]):fs(ee[De]);v(N[De],Ie,Y,null,V,ie,me,de,ve)}he>Te?fe(N,V,ie,!0,!1,je):M(ee,Y,L,V,ie,me,de,ve,je)},ge=(N,ee,Y,L,V,ie,me,de,ve)=>{let he=0;const Te=ee.length;let je=N.length-1,De=Te-1;for(;he<=je&&he<=De;){const Ie=N[he],He=ee[he]=ve?Us(ee[he]):fs(ee[he]);if(Bs(Ie,He))v(Ie,He,Y,null,V,ie,me,de,ve);else break;he++}for(;he<=je&&he<=De;){const Ie=N[je],He=ee[De]=ve?Us(ee[De]):fs(ee[De]);if(Bs(Ie,He))v(Ie,He,Y,null,V,ie,me,de,ve);else break;je--,De--}if(he>je){if(he<=De){const Ie=De+1,He=Ie<Te?ee[Ie].el:L;for(;he<=De;)v(null,ee[he]=ve?Us(ee[he]):fs(ee[he]),Y,He,V,ie,me,de,ve),he++}}else if(he>De)for(;he<=je;)we(N[he],V,ie,!0),he++;else{const Ie=he,He=he,ot=new Map;for(he=He;he<=De;he++){const se=ee[he]=ve?Us(ee[he]):fs(ee[he]);se.key!=null&&ot.set(se.key,he)}let it,pt=0;const yt=De-He+1;let Ot=!1,cn=0;const qt=new Array(yt);for(he=0;he<yt;he++)qt[he]=0;for(he=Ie;he<=je;he++){const se=N[he];if(pt>=yt){we(se,V,ie,!0);continue}let be;if(se.key!=null)be=ot.get(se.key);else for(it=He;it<=De;it++)if(qt[it-He]===0&&Bs(se,ee[it])){be=it;break}be===void 0?we(se,V,ie,!0):(qt[be-He]=he+1,be>=cn?cn=be:Ot=!0,v(se,ee[be],Y,null,V,ie,me,de,ve),pt++)}const Dn=Ot?Gy(qt):nn;for(it=Dn.length-1,he=yt-1;he>=0;he--){const se=He+he,be=ee[se],qe=se+1<Te?ee[se+1].el:L;qt[he]===0?v(null,be,Y,qe,V,ie,me,de,ve):Ot&&(it<0||he!==Dn[it]?ue(be,Y,qe,2):it--)}}},ue=(N,ee,Y,L,V=null)=>{const{el:ie,type:me,transition:de,children:ve,shapeFlag:he}=N;if(he&6){ue(N.component.subTree,ee,Y,L);return}if(he&128){N.suspense.move(ee,Y,L);return}if(he&64){me.move(N,ee,Y,Oe);return}if(me===_e){s(ie,ee,Y);for(let je=0;je<ve.length;je++)ue(ve[je],ee,Y,L);s(N.anchor,ee,Y);return}if(me===ma){S(N,ee,Y);return}if(L!==2&&he&1&&de)if(L===0)de.beforeEnter(ie),s(ie,ee,Y),sn(()=>de.enter(ie),V);else{const{leave:je,delayLeave:De,afterLeave:Ie}=de,He=()=>s(ie,ee,Y),ot=()=>{je(ie,()=>{He(),Ie&&Ie()})};De?De(ie,He,ot):ot()}else s(ie,ee,Y)},we=(N,ee,Y,L=!1,V=!1)=>{const{type:ie,props:me,ref:de,children:ve,dynamicChildren:he,shapeFlag:Te,patchFlag:je,dirs:De}=N;if(de!=null&&Qc(de,null,Y,N,!0),Te&256){ee.ctx.deactivate(N);return}const Ie=Te&1&&De,He=!Kr(N);let ot;if(He&&(ot=me&&me.onVnodeBeforeUnmount)&&qn(ot,ee,N),Te&6)pe(N.component,Y,L);else{if(Te&128){N.suspense.unmount(Y,L);return}Ie&&ur(N,null,ee,"beforeUnmount"),Te&64?N.type.remove(N,ee,Y,V,Oe,L):he&&(ie!==_e||je>0&&je&64)?fe(he,ee,Y,!1,!0):(ie===_e&&je&384||!V&&Te&16)&&fe(ve,ee,Y),L&&Ee(N)}(He&&(ot=me&&me.onVnodeUnmounted)||Ie)&&sn(()=>{ot&&qn(ot,ee,N),Ie&&ur(N,null,ee,"unmounted")},Y)},Ee=N=>{const{type:ee,el:Y,anchor:L,transition:V}=N;if(ee===_e){re(Y,L);return}if(ee===ma){E(N);return}const ie=()=>{r(Y),V&&!V.persisted&&V.afterLeave&&V.afterLeave()};if(N.shapeFlag&1&&V&&!V.persisted){const{leave:me,delayLeave:de}=V,ve=()=>me(Y,ie);de?de(N.el,ie,ve):ve()}else ie()},re=(N,ee)=>{let Y;for(;N!==ee;)Y=h(N),r(N),N=Y;r(ee)},pe=(N,ee,Y)=>{const{bum:L,scope:V,update:ie,subTree:me,um:de}=N;L&&Ur(L),V.stop(),ie&&(ie.active=!1,we(me,N,ee,Y)),de&&sn(de,ee),sn(()=>{N.isUnmounted=!0},ee),ee&&ee.pendingBranch&&!ee.isUnmounted&&N.asyncDep&&!N.asyncResolved&&N.suspenseId===ee.pendingId&&(ee.deps--,ee.deps===0&&ee.resolve())},fe=(N,ee,Y,L=!1,V=!1,ie=0)=>{for(let me=ie;me<N.length;me++)we(N[me],ee,Y,L,V)},$e=N=>N.shapeFlag&6?$e(N.component.subTree):N.shapeFlag&128?N.suspense.next():h(N.anchor||N.el);let Re=!1;const Le=(N,ee,Y)=>{N==null?ee._vnode&&we(ee._vnode,null,null,!0):v(ee._vnode||null,N,ee,null,null,null,Y),Re||(Re=!0,Tf(),Af(),Re=!1),ee._vnode=N},Oe={p:v,um:we,m:ue,r:Ee,mt:Q,mc:M,pc:J,pbc:B,n:$e,o:e};return{render:Le,hydrate:void 0,createApp:Ny(Le)}}function Jc({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function dr({effect:e,update:t},n){e.allowRecurse=t.allowRecurse=n}function Wy(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Xc(e,t,n=!1){const s=e.children,r=t.children;if(Ue(s)&&Ue(r))for(let o=0;o<s.length;o++){const i=s[o];let a=r[o];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=r[o]=Us(r[o]),a.el=i.el),n||Xc(i,a)),a.type===pa&&(a.el=i.el)}}function Gy(e){const t=e.slice(),n=[0];let s,r,o,i,a;const c=e.length;for(s=0;s<c;s++){const u=e[s];if(u!==0){if(r=n[n.length-1],e[r]<u){t[s]=r,n.push(s);continue}for(o=0,i=n.length-1;o<i;)a=o+i>>1,e[n[a]]<u?o=a+1:i=a;u<e[n[o]]&&(o>0&&(t[s]=n[o-1]),n[o]=s)}}for(o=n.length,i=n[o-1];o-- >0;)n[o]=i,i=t[i];return n}function lh(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:lh(t)}const Ky=e=>e.__isTeleport,Wo=e=>e&&(e.disabled||e.disabled===""),ch=e=>typeof SVGElement<"u"&&e instanceof SVGElement,uh=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Zc=(e,t)=>{const n=e&&e.to;return At(n)?t?t(n):null:n},Qy={name:"Teleport",__isTeleport:!0,process(e,t,n,s,r,o,i,a,c,u){const{mc:d,pc:f,pbc:h,o:{insert:g,querySelector:p,createText:v,createComment:_}}=u,w=Wo(t.props);let{shapeFlag:k,children:S,dynamicChildren:E}=t;if(e==null){const O=t.el=v(""),I=t.anchor=v("");g(O,n,s),g(I,n,s);const P=t.target=Zc(t.props,p),M=t.targetAnchor=v("");P&&(g(M,P),i==="svg"||ch(P)?i="svg":(i==="mathml"||uh(P))&&(i="mathml"));const q=(B,T)=>{k&16&&d(S,B,T,r,o,i,a,c)};w?q(n,I):P&&q(P,M)}else{t.el=e.el;const O=t.anchor=e.anchor,I=t.target=e.target,P=t.targetAnchor=e.targetAnchor,M=Wo(e.props),q=M?n:I,B=M?O:P;if(i==="svg"||ch(I)?i="svg":(i==="mathml"||uh(I))&&(i="mathml"),E?(h(e.dynamicChildren,E,q,r,o,i,a),Xc(e,t,!0)):c||f(e,t,q,B,r,o,i,a,!1),w)M?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):ha(t,n,O,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const T=t.target=Zc(t.props,p);T&&ha(t,T,null,u,0)}else M&&ha(t,I,P,u,1)}dh(t)},remove(e,t,n,s,{um:r,o:{remove:o}},i){const{shapeFlag:a,children:c,anchor:u,targetAnchor:d,target:f,props:h}=e;if(f&&o(d),i&&o(u),a&16){const g=i||!Wo(h);for(let p=0;p<c.length;p++){const v=c[p];r(v,t,n,g,!!v.dynamicChildren)}}},move:ha,hydrate:Jy};function ha(e,t,n,{o:{insert:s},m:r},o=2){o===0&&s(e.targetAnchor,t,n);const{el:i,anchor:a,shapeFlag:c,children:u,props:d}=e,f=o===2;if(f&&s(i,t,n),(!f||Wo(d))&&c&16)for(let h=0;h<u.length;h++)r(u[h],t,n,2);f&&s(a,t,n)}function Jy(e,t,n,s,r,o,{o:{nextSibling:i,parentNode:a,querySelector:c}},u){const d=t.target=Zc(t.props,c);if(d){const f=d._lpa||d.firstChild;if(t.shapeFlag&16)if(Wo(t.props))t.anchor=u(i(e),t,a(e),n,s,r,o),t.targetAnchor=f;else{t.anchor=i(e);let h=f;for(;h;)if(h=i(h),h&&h.nodeType===8&&h.data==="teleport anchor"){t.targetAnchor=h,d._lpa=t.targetAnchor&&i(t.targetAnchor);break}u(f,t,d,n,s,r,o)}dh(t)}return t.anchor&&i(t.anchor)}const Yc=Qy;function dh(e){const t=e.ctx;if(t&&t.ut){let n=e.children[0].el;for(;n&&n!==e.targetAnchor;)n.nodeType===1&&n.setAttribute("data-v-owner",t.uid),n=n.nextSibling;t.ut()}}const _e=Symbol.for("v-fgt"),pa=Symbol.for("v-txt"),Mn=Symbol.for("v-cmt"),ma=Symbol.for("v-stc"),Go=[];let Yn=null;function m(e=!1){Go.push(Yn=e?null:[])}function Xy(){Go.pop(),Yn=Go[Go.length-1]||null}let Ko=1;function fh(e){Ko+=e}function hh(e){return e.dynamicChildren=Ko>0?Yn||nn:null,Xy(),Ko>0&&Yn&&Yn.push(e),e}function x(e,t,n,s,r,o){return hh(l(e,t,n,s,r,o,!0))}function oe(e,t,n,s,r){return hh(G(e,t,n,s,r,!0))}function Qo(e){return e?e.__v_isVNode===!0:!1}function Bs(e,t){return e.type===t.type&&e.key===t.key}const ga="__vInternal",ph=({key:e})=>e??null,va=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?At(e)||Ft(e)||Ye(e)?{i:Ht,r:e,k:t,f:!!n}:e:null);function l(e,t=null,n=null,s=0,r=null,o=e===_e?0:1,i=!1,a=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&ph(t),ref:t&&va(t),scopeId:ra,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:s,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:Ht};return a?(eu(c,n),o&128&&e.normalize(c)):n&&(c.shapeFlag|=At(n)?8:16),Ko>0&&!i&&Yn&&(c.patchFlag>0||o&6)&&c.patchFlag!==32&&Yn.push(c),c}const G=Zy;function Zy(e,t=null,n=null,s=0,r=null,o=!1){if((!e||e===Of)&&(e=Mn),Qo(e)){const a=ds(e,t,!0);return n&&eu(a,n),Ko>0&&!o&&Yn&&(a.shapeFlag&6?Yn[Yn.indexOf(e)]=a:Yn.push(a)),a.patchFlag|=-2,a}if(a1(e)&&(e=e.__vccOpts),t){t=ya(t);let{class:a,style:c}=t;a&&!At(a)&&(t.class=ne(a)),_t(c)&&(vf(c)&&!Ue(c)&&(c=Xt({},c)),t.style=ht(c))}const i=At(e)?1:Rf(e)?128:Ky(e)?64:_t(e)?4:Ye(e)?2:0;return l(e,t,n,s,r,i,o,!0)}function ya(e){return e?vf(e)||ga in e?Xt({},e):e:null}function ds(e,t,n=!1){const{props:s,ref:r,patchFlag:o,children:i}=e,a=t?wn(s||{},t):s;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:a,key:a&&ph(a),ref:t&&t.ref?n&&r?Ue(r)?r.concat(va(t)):[r,va(t)]:va(t):r,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:i,target:e.target,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==_e?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:e.transition,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ds(e.ssContent),ssFallback:e.ssFallback&&ds(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce}}function We(e=" ",t=0){return G(pa,null,e,t)}function ba(e,t){const n=G(ma,null,e);return n.staticCount=t,n}function z(e="",t=!1){return t?(m(),oe(Mn,null,e)):G(Mn,null,e)}function fs(e){return e==null||typeof e=="boolean"?G(Mn):Ue(e)?G(_e,null,e.slice()):typeof e=="object"?Us(e):G(pa,null,String(e))}function Us(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ds(e)}function eu(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(Ue(t))n=16;else if(typeof t=="object")if(s&65){const r=t.default;r&&(r._c&&(r._d=!1),eu(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!(ga in t)?t._ctx=Ht:r===3&&Ht&&(Ht.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Ye(t)?(t={default:t,_ctx:Ht},n=32):(t=String(t),s&64?(n=16,t=[We(t)]):n=8);e.children=t,e.shapeFlag|=n}function wn(...e){const t={};for(let n=0;n<e.length;n++){const s=e[n];for(const r in s)if(r==="class")t.class!==s.class&&(t.class=ne([t.class,s.class]));else if(r==="style")t.style=ht([t.style,s.style]);else if(Bi(r)){const o=t[r],i=s[r];i&&o!==i&&!(Ue(o)&&o.includes(i))&&(t[r]=o?[].concat(o,i):i)}else r!==""&&(t[r]=s[r])}return t}function qn(e,t,n,s=null){Nn(e,t,7,[n,s])}const Yy=Zf();let e1=0;function t1(e,t,n){const s=e.type,r=(t?t.appContext:e.appContext)||Yy,o={uid:e1++,vnode:e,type:s,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,scope:new Jd(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(r.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:eh(s,r),emitsOptions:If(s,r),emit:null,emitted:null,propsDefaults:tt,inheritAttrs:s.inheritAttrs,ctx:tt,data:tt,props:tt,attrs:tt,slots:tt,refs:tt,setupState:tt,setupContext:null,attrsProxy:null,slotsProxy:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return o.ctx={_:o},o.root=t?t.root:o,o.emit=ly.bind(null,o),e.ce&&e.ce(o),o}let zt=null;const es=()=>zt||Ht;let _a,tu;{const e=Gd(),t=(n,s)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(s),o=>{r.length>1?r.forEach(i=>i(o)):r[0](o)}};_a=t("__VUE_INSTANCE_SETTERS__",n=>zt=n),tu=t("__VUE_SSR_SETTERS__",n=>Xo=n)}const Jo=e=>{const t=zt;return _a(e),e.scope.on(),()=>{e.scope.off(),_a(t)}},mh=()=>{zt&&zt.scope.off(),_a(null)};function gh(e){return e.vnode.shapeFlag&4}let Xo=!1;function n1(e,t=!1){t&&tu(t);const{props:n,children:s}=e.vnode,r=gh(e);Fy(e,n,r,t),By(e,s);const o=r?s1(e,t):void 0;return t&&tu(!1),o}function s1(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=yf(new Proxy(e.ctx,Iy));const{setup:s}=n;if(s){const r=e.setupContext=s.length>1?bh(e):null,o=Jo(e);js();const i=ws(s,e,0,[e.props,r]);if(Ns(),o(),Ud(i)){if(i.then(mh,mh),t)return i.then(a=>{vh(e,a)}).catch(a=>{jo(a,e,0)});e.asyncDep=i}else vh(e,i)}else yh(e)}function vh(e,t,n){Ye(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:_t(t)&&(e.setupState=wf(t)),yh(e)}function yh(e,t,n){const s=e.type;e.render||(e.render=s.render||En);{const r=Jo(e);js();try{My(e)}finally{Ns(),r()}}}function r1(e){return e.attrsProxy||(e.attrsProxy=new Proxy(e.attrs,{get(t,n){return xn(e,"get","$attrs"),t[n]}}))}function bh(e){const t=n=>{e.exposed=n||{}};return{get attrs(){return r1(e)},slots:e.slots,emit:e.emit,expose:t}}function xa(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(wf(yf(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Uo)return Uo[n](e)},has(t,n){return n in t||n in Uo}}))}const o1=/(?:^|[-_])(\w)/g,i1=e=>e.replace(o1,t=>t.toUpperCase()).replace(/[-_]/g,"");function wa(e,t=!0){return Ye(e)?e.displayName||e.name:e.name||t&&e.__name}function _h(e,t,n=!1){let s=wa(t);if(!s&&t.__file){const r=t.__file.match(/([^/\\]+)\.\w+$/);r&&(s=r[1])}if(!s&&e&&e.parent){const r=o=>{for(const i in o)if(o[i]===t)return i};s=r(e.components||e.parent.type.components)||r(e.appContext.components)}return s?i1(s):n?"App":"Anonymous"}function a1(e){return Ye(e)&&"__vccOpts"in e}const Z=(e,t)=>V0(e,t,Xo);function fr(e,t,n=tt){const s=es(),r=In(t),o=Rs(t),i=K0((c,u)=>{let d;return yy(()=>{const f=e[t];cs(d,f)&&(d=f,u())}),{get(){return c(),n.get?n.get(d):d},set(f){const h=s.vnode.props;!(h&&(t in h||r in h||o in h)&&(`onUpdate:${t}`in h||`onUpdate:${r}`in h||`onUpdate:${o}`in h))&&cs(f,d)&&(d=f,u()),s.emit(`update:${t}`,n.set?n.set(f):f)}}}),a=t==="modelValue"?"modelModifiers":`${t}Modifiers`;return i[Symbol.iterator]=()=>{let c=0;return{next(){return c<2?{value:c++?e[a]||{}:i,done:!1}:{done:!0}}}},i}function hr(e,t,n){const s=arguments.length;return s===2?_t(t)&&!Ue(t)?Qo(t)?G(e,null,[t]):G(e,t):G(e,null,t):(s>3?n=Array.prototype.slice.call(arguments,2):s===3&&Qo(n)&&(n=[n]),G(e,t,n))}const l1="3.4.21",c1="http://www.w3.org/2000/svg",u1="http://www.w3.org/1998/Math/MathML",Vs=typeof document<"u"?document:null,xh=Vs&&Vs.createElement("template"),d1={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const r=t==="svg"?Vs.createElementNS(c1,e):t==="mathml"?Vs.createElementNS(u1,e):Vs.createElement(e,n?{is:n}:void 0);return e==="select"&&s&&s.multiple!=null&&r.setAttribute("multiple",s.multiple),r},createText:e=>Vs.createTextNode(e),createComment:e=>Vs.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Vs.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,r,o){const i=n?n.previousSibling:t.lastChild;if(r&&(r===o||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===o||!(r=r.nextSibling)););else{xh.innerHTML=s==="svg"?`<svg>${e}</svg>`:s==="mathml"?`<math>${e}</math>`:e;const a=xh.content;if(s==="svg"||s==="mathml"){const c=a.firstChild;for(;c.firstChild;)a.appendChild(c.firstChild);a.removeChild(c)}t.insertBefore(a,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Hs="transition",Zo="animation",Yo=Symbol("_vtc"),Yt=(e,{slots:t})=>hr(xy,f1(e),t);Yt.displayName="Transition";const wh={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};Yt.props=Xt({},jf,wh);const pr=(e,t=[])=>{Ue(e)?e.forEach(n=>n(...t)):e&&e(...t)},kh=e=>e?Ue(e)?e.some(t=>t.length>1):e.length>1:!1;function f1(e){const t={};for(const A in e)A in wh||(t[A]=e[A]);if(e.css===!1)return t;const{name:n="v",type:s,duration:r,enterFromClass:o=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:c=o,appearActiveClass:u=i,appearToClass:d=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:h=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,p=h1(r),v=p&&p[0],_=p&&p[1],{onBeforeEnter:w,onEnter:k,onEnterCancelled:S,onLeave:E,onLeaveCancelled:O,onBeforeAppear:I=w,onAppear:P=k,onAppearCancelled:M=S}=t,q=(A,D,Q)=>{mr(A,D?d:a),mr(A,D?u:i),Q&&Q()},B=(A,D)=>{A._isLeaving=!1,mr(A,f),mr(A,g),mr(A,h),D&&D()},T=A=>(D,Q)=>{const W=A?P:k,H=()=>q(D,A,Q);pr(W,[D,H]),Sh(()=>{mr(D,A?c:o),Ws(D,A?d:a),kh(W)||Ch(D,s,v,H)})};return Xt(t,{onBeforeEnter(A){pr(w,[A]),Ws(A,o),Ws(A,i)},onBeforeAppear(A){pr(I,[A]),Ws(A,c),Ws(A,u)},onEnter:T(!1),onAppear:T(!0),onLeave(A,D){A._isLeaving=!0;const Q=()=>B(A,D);Ws(A,f),g1(),Ws(A,h),Sh(()=>{A._isLeaving&&(mr(A,f),Ws(A,g),kh(E)||Ch(A,s,_,Q))}),pr(E,[A,Q])},onEnterCancelled(A){q(A,!1),pr(S,[A])},onAppearCancelled(A){q(A,!0),pr(M,[A])},onLeaveCancelled(A){B(A),pr(O,[A])}})}function h1(e){if(e==null)return null;if(_t(e))return[nu(e.enter),nu(e.leave)];{const t=nu(e);return[t,t]}}function nu(e){return h0(e)}function Ws(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Yo]||(e[Yo]=new Set)).add(t)}function mr(e,t){t.split(/\s+/).forEach(s=>s&&e.classList.remove(s));const n=e[Yo];n&&(n.delete(t),n.size||(e[Yo]=void 0))}function Sh(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let p1=0;function Ch(e,t,n,s){const r=e._endId=++p1,o=()=>{r===e._endId&&s()};if(n)return setTimeout(o,n);const{type:i,timeout:a,propCount:c}=m1(e,t);if(!i)return s();const u=i+"end";let d=0;const f=()=>{e.removeEventListener(u,h),o()},h=g=>{g.target===e&&++d>=c&&f()};setTimeout(()=>{d<c&&f()},a+1),e.addEventListener(u,h)}function m1(e,t){const n=window.getComputedStyle(e),s=p=>(n[p]||"").split(", "),r=s(`${Hs}Delay`),o=s(`${Hs}Duration`),i=$h(r,o),a=s(`${Zo}Delay`),c=s(`${Zo}Duration`),u=$h(a,c);let d=null,f=0,h=0;t===Hs?i>0&&(d=Hs,f=i,h=o.length):t===Zo?u>0&&(d=Zo,f=u,h=c.length):(f=Math.max(i,u),d=f>0?i>u?Hs:Zo:null,h=d?d===Hs?o.length:c.length:0);const g=d===Hs&&/\b(transform|all)(,|$)/.test(s(`${Hs}Property`).toString());return{type:d,timeout:f,propCount:h,hasTransform:g}}function $h(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,s)=>Th(n)+Th(e[s])))}function Th(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function g1(){return document.body.offsetHeight}function v1(e,t,n){const s=e[Yo];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const ka=Symbol("_vod"),Ah=Symbol("_vsh"),ei={beforeMount(e,{value:t},{transition:n}){e[ka]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):ti(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:s}){!t!=!n&&(s?t?(s.beforeEnter(e),ti(e,!0),s.enter(e)):s.leave(e,()=>{ti(e,!1)}):ti(e,t))},beforeUnmount(e,{value:t}){ti(e,t)}};function ti(e,t){e.style.display=t?e[ka]:"none",e[Ah]=!t}const y1=Symbol(""),b1=/(^|;)\s*display\s*:/;function _1(e,t,n){const s=e.style,r=At(n);let o=!1;if(n&&!r){if(t)if(At(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&Sa(s,a,"")}else for(const i in t)n[i]==null&&Sa(s,i,"");for(const i in n)i==="display"&&(o=!0),Sa(s,i,n[i])}else if(r){if(t!==n){const i=s[y1];i&&(n+=";"+i),s.cssText=n,o=b1.test(n)}}else t&&e.removeAttribute("style");ka in e&&(e[ka]=o?s.display:"",e[Ah]&&(s.display="none"))}const Eh=/\s*!important$/;function Sa(e,t,n){if(Ue(n))n.forEach(s=>Sa(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const s=x1(e,t);Eh.test(n)?e.setProperty(Rs(s),n.replace(Eh,""),"important"):e[s]=n}}const Ih=["Webkit","Moz","ms"],su={};function x1(e,t){const n=su[t];if(n)return n;let s=In(t);if(s!=="filter"&&s in e)return su[t]=s;s=Vi(s);for(let r=0;r<Ih.length;r++){const o=Ih[r]+s;if(o in e)return su[t]=o}return t}const Ph="http://www.w3.org/1999/xlink";function w1(e,t,n,s,r){if(s&&t.startsWith("xlink:"))n==null?e.removeAttributeNS(Ph,t.slice(6,t.length)):e.setAttributeNS(Ph,t,n);else{const o=y0(t);n==null||o&&!Kd(n)?e.removeAttribute(t):e.setAttribute(t,o?"":n)}}function k1(e,t,n,s,r,o,i){if(t==="innerHTML"||t==="textContent"){s&&i(s,r,o),e[t]=n??"";return}const a=e.tagName;if(t==="value"&&a!=="PROGRESS"&&!a.includes("-")){const u=a==="OPTION"?e.getAttribute("value")||"":e.value,d=n??"";(u!==d||!("_value"in e))&&(e.value=d),n==null&&e.removeAttribute(t),e._value=n;return}let c=!1;if(n===""||n==null){const u=typeof e[t];u==="boolean"?n=Kd(n):n==null&&u==="string"?(n="",c=!0):u==="number"&&(n=0,c=!0)}try{e[t]=n}catch{}c&&e.removeAttribute(t)}function Cs(e,t,n,s){e.addEventListener(t,n,s)}function S1(e,t,n,s){e.removeEventListener(t,n,s)}const Mh=Symbol("_vei");function C1(e,t,n,s,r=null){const o=e[Mh]||(e[Mh]={}),i=o[t];if(s&&i)i.value=s;else{const[a,c]=$1(t);if(s){const u=o[t]=E1(s,r);Cs(e,a,u,c)}else i&&(S1(e,a,i,c),o[t]=void 0)}}const Oh=/(?:Once|Passive|Capture)$/;function $1(e){let t;if(Oh.test(e)){t={};let s;for(;s=e.match(Oh);)e=e.slice(0,e.length-s[0].length),t[s[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Rs(e.slice(2)),t]}let ru=0;const T1=Promise.resolve(),A1=()=>ru||(T1.then(()=>ru=0),ru=Date.now());function E1(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;Nn(I1(s,n.value),t,5,[s])};return n.value=e,n.attached=A1(),n}function I1(e,t){if(Ue(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(s=>r=>!r._stopped&&s&&s(r))}else return t}const Lh=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,P1=(e,t,n,s,r,o,i,a,c)=>{const u=r==="svg";t==="class"?v1(e,s,u):t==="style"?_1(e,n,s):Bi(t)?bc(t)||C1(e,t,n,s,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):M1(e,t,s,u))?k1(e,t,s,o,i,a,c):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),w1(e,t,s,u))};function M1(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&Lh(t)&&Ye(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return Lh(t)&&At(n)?!1:t in e}const Gs=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Ue(t)?n=>Ur(t,n):t};function O1(e){e.target.composing=!0}function Rh(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const zn=Symbol("_assign"),rn={created(e,{modifiers:{lazy:t,trim:n,number:s}},r){e[zn]=Gs(r);const o=s||r.props&&r.props.type==="number";Cs(e,t?"change":"input",i=>{if(i.target.composing)return;let a=e.value;n&&(a=a.trim()),o&&(a=Mo(a)),e[zn](a)}),n&&Cs(e,"change",()=>{e.value=e.value.trim()}),t||(Cs(e,"compositionstart",O1),Cs(e,"compositionend",Rh),Cs(e,"change",Rh))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,modifiers:{lazy:n,trim:s,number:r}},o){if(e[zn]=Gs(o),e.composing)return;const i=r||e.type==="number"?Mo(e.value):e.value,a=t??"";i!==a&&(document.activeElement===e&&e.type!=="range"&&(n||s&&e.value.trim()===a)||(e.value=a))}},L1={deep:!0,created(e,t,n){e[zn]=Gs(n),Cs(e,"change",()=>{const s=e._modelValue,r=Xr(e),o=e.checked,i=e[zn];if(Ue(s)){const a=wc(s,r),c=a!==-1;if(o&&!c)i(s.concat(r));else if(!o&&c){const u=[...s];u.splice(a,1),i(u)}}else if(zr(s)){const a=new Set(s);o?a.add(r):a.delete(r),i(a)}else i(qh(e,o))})},mounted:Dh,beforeUpdate(e,t,n){e[zn]=Gs(n),Dh(e,t,n)}};function Dh(e,{value:t,oldValue:n},s){e._modelValue=t,Ue(t)?e.checked=wc(t,s.props.value)>-1:zr(t)?e.checked=t.has(s.props.value):t!==n&&(e.checked=or(t,qh(e,!0)))}const jh={created(e,{value:t},n){e.checked=or(t,n.props.value),e[zn]=Gs(n),Cs(e,"change",()=>{e[zn](Xr(e))})},beforeUpdate(e,{value:t,oldValue:n},s){e[zn]=Gs(s),t!==n&&(e.checked=or(t,s.props.value))}},Nh={deep:!0,created(e,{value:t,modifiers:{number:n}},s){const r=zr(t);Cs(e,"change",()=>{const o=Array.prototype.filter.call(e.options,i=>i.selected).map(i=>n?Mo(Xr(i)):Xr(i));e[zn](e.multiple?r?new Set(o):o:o[0]),e._assigning=!0,kt(()=>{e._assigning=!1})}),e[zn]=Gs(s)},mounted(e,{value:t,modifiers:{number:n}}){Fh(e,t,n)},beforeUpdate(e,t,n){e[zn]=Gs(n)},updated(e,{value:t,modifiers:{number:n}}){e._assigning||Fh(e,t,n)}};function Fh(e,t,n){const s=e.multiple,r=Ue(t);if(!(s&&!r&&!zr(t))){for(let o=0,i=e.options.length;o<i;o++){const a=e.options[o],c=Xr(a);if(s)if(r){const u=typeof c;u==="string"||u==="number"?a.selected=t.includes(n?Mo(c):c):a.selected=wc(t,c)>-1}else a.selected=t.has(c);else if(or(Xr(a),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!s&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Xr(e){return"_value"in e?e._value:e.value}function qh(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const R1={created(e,t,n){Ca(e,t,n,null,"created")},mounted(e,t,n){Ca(e,t,n,null,"mounted")},beforeUpdate(e,t,n,s){Ca(e,t,n,s,"beforeUpdate")},updated(e,t,n,s){Ca(e,t,n,s,"updated")}};function D1(e,t){switch(e){case"SELECT":return Nh;case"TEXTAREA":return rn;default:switch(t){case"checkbox":return L1;case"radio":return jh;default:return rn}}}function Ca(e,t,n,s,r){const i=D1(e.tagName,n.props&&n.props.type)[r];i&&i(e,t,n,s)}const j1=["ctrl","shift","alt","meta"],N1={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>j1.some(n=>e[`${n}Key`]&&!t.includes(n))},Gt=(e,t)=>{const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=(r,...o)=>{for(let i=0;i<t.length;i++){const a=N1[t[i]];if(a&&a(r,t))return}return e(r,...o)})},F1={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},gr=(e,t)=>{const n=e._withKeys||(e._withKeys={}),s=t.join(".");return n[s]||(n[s]=r=>{if(!("key"in r))return;const o=Rs(r.key);if(t.some(i=>i===o||F1[i]===o))return e(r)})},q1=Xt({patchProp:P1},d1);let zh;function z1(){return zh||(zh=Vy(q1))}const Zr=(...e)=>{const t=z1().createApp(...e),{mount:n}=t;return t.mount=s=>{const r=U1(s);if(!r)return;const o=t._component;!Ye(o)&&!o.render&&!o.template&&(o.template=r.innerHTML),r.innerHTML="";const i=n(r,!1,B1(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),i},t};function B1(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function U1(e){return At(e)?document.querySelector(e):e}function Bh(e,t){return function(){return e.apply(t,arguments)}}const{toString:V1}=Object.prototype,{getPrototypeOf:ou}=Object,{iterator:$a,toStringTag:Uh}=Symbol,Ta=(e=>t=>{const n=V1.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ts=e=>(e=e.toLowerCase(),t=>Ta(t)===e),Aa=e=>t=>typeof t===e,{isArray:Yr}=Array,eo=Aa("undefined");function ni(e){return e!==null&&!eo(e)&&e.constructor!==null&&!eo(e.constructor)&&kn(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Vh=ts("ArrayBuffer");function H1(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Vh(e.buffer),t}const W1=Aa("string"),kn=Aa("function"),Hh=Aa("number"),si=e=>e!==null&&typeof e=="object",G1=e=>e===!0||e===!1,Ea=e=>{if(Ta(e)!=="object")return!1;const t=ou(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Uh in e)&&!($a in e)},K1=e=>{if(!si(e)||ni(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Q1=ts("Date"),J1=ts("File"),X1=ts("Blob"),Z1=ts("FileList"),Y1=e=>si(e)&&kn(e.pipe),eb=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||kn(e.append)&&((t=Ta(e))==="formdata"||t==="object"&&kn(e.toString)&&e.toString()==="[object FormData]"))},tb=ts("URLSearchParams"),[nb,sb,rb,ob]=["ReadableStream","Request","Response","Headers"].map(ts),ib=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ri(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,r;if(typeof e!="object"&&(e=[e]),Yr(e))for(s=0,r=e.length;s<r;s++)t.call(null,e[s],s,e);else{if(ni(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let a;for(s=0;s<i;s++)a=o[s],t.call(null,e[a],a,e)}}function Wh(e,t){if(ni(e))return null;t=t.toLowerCase();const n=Object.keys(e);let s=n.length,r;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Gh=e=>!eo(e)&&e!==vr;function iu(){const{caseless:e,skipUndefined:t}=Gh(this)&&this||{},n={},s=(r,o)=>{const i=e&&Wh(n,o)||o;Ea(n[i])&&Ea(r)?n[i]=iu(n[i],r):Ea(r)?n[i]=iu({},r):Yr(r)?n[i]=r.slice():(!t||!eo(r))&&(n[i]=r)};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&ri(arguments[r],s);return n}const ab=(e,t,n,{allOwnKeys:s}={})=>(ri(t,(r,o)=>{n&&kn(r)?e[o]=Bh(r,n):e[o]=r},{allOwnKeys:s}),e),lb=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),cb=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},ub=(e,t,n,s)=>{let r,o,i;const a={};if(t=t||{},e==null)return t;do{for(r=Object.getOwnPropertyNames(e),o=r.length;o-- >0;)i=r[o],(!s||s(i,e,t))&&!a[i]&&(t[i]=e[i],a[i]=!0);e=n!==!1&&ou(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},db=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},fb=e=>{if(!e)return null;if(Yr(e))return e;let t=e.length;if(!Hh(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},hb=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ou(Uint8Array)),pb=(e,t)=>{const s=(e&&e[$a]).call(e);let r;for(;(r=s.next())&&!r.done;){const o=r.value;t.call(e,o[0],o[1])}},mb=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},gb=ts("HTMLFormElement"),vb=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,r){return s.toUpperCase()+r}),Kh=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),yb=ts("RegExp"),Qh=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};ri(n,(r,o)=>{let i;(i=t(r,o,e))!==!1&&(s[o]=i||r)}),Object.defineProperties(e,s)},bb=e=>{Qh(e,(t,n)=>{if(kn(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(kn(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},_b=(e,t)=>{const n={},s=r=>{r.forEach(o=>{n[o]=!0})};return Yr(e)?s(e):s(String(e).split(t)),n},xb=()=>{},wb=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function kb(e){return!!(e&&kn(e.append)&&e[Uh]==="FormData"&&e[$a])}const Sb=e=>{const t=new Array(10),n=(s,r)=>{if(si(s)){if(t.indexOf(s)>=0)return;if(ni(s))return s;if(!("toJSON"in s)){t[r]=s;const o=Yr(s)?[]:{};return ri(s,(i,a)=>{const c=n(i,r+1);!eo(c)&&(o[a]=c)}),t[r]=void 0,o}}return s};return n(e,0)},Cb=ts("AsyncFunction"),$b=e=>e&&(si(e)||kn(e))&&kn(e.then)&&kn(e.catch),Jh=((e,t)=>e?setImmediate:t?((n,s)=>(vr.addEventListener("message",({source:r,data:o})=>{r===vr&&o===n&&s.length&&s.shift()()},!1),r=>{s.push(r),vr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",kn(vr.postMessage)),Tb=typeof queueMicrotask<"u"?queueMicrotask.bind(vr):typeof process<"u"&&process.nextTick||Jh,ce={isArray:Yr,isArrayBuffer:Vh,isBuffer:ni,isFormData:eb,isArrayBufferView:H1,isString:W1,isNumber:Hh,isBoolean:G1,isObject:si,isPlainObject:Ea,isEmptyObject:K1,isReadableStream:nb,isRequest:sb,isResponse:rb,isHeaders:ob,isUndefined:eo,isDate:Q1,isFile:J1,isBlob:X1,isRegExp:yb,isFunction:kn,isStream:Y1,isURLSearchParams:tb,isTypedArray:hb,isFileList:Z1,forEach:ri,merge:iu,extend:ab,trim:ib,stripBOM:lb,inherits:cb,toFlatObject:ub,kindOf:Ta,kindOfTest:ts,endsWith:db,toArray:fb,forEachEntry:pb,matchAll:mb,isHTMLForm:gb,hasOwnProperty:Kh,hasOwnProp:Kh,reduceDescriptors:Qh,freezeMethods:bb,toObjectSet:_b,toCamelCase:vb,noop:xb,toFiniteNumber:wb,findKey:Wh,global:vr,isContextDefined:Gh,isSpecCompliantForm:kb,toJSONObject:Sb,isAsyncFn:Cb,isThenable:$b,setImmediate:Jh,asap:Tb,isIterable:e=>e!=null&&kn(e[$a])};function st(e,t,n,s,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),s&&(this.request=s),r&&(this.response=r,this.status=r.status?r.status:null)}ce.inherits(st,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ce.toJSONObject(this.config),code:this.code,status:this.status}}});const Xh=st.prototype,Zh={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Zh[e]={value:e}}),Object.defineProperties(st,Zh),Object.defineProperty(Xh,"isAxiosError",{value:!0}),st.from=(e,t,n,s,r,o)=>{const i=Object.create(Xh);ce.toFlatObject(e,i,function(d){return d!==Error.prototype},u=>u!=="isAxiosError");const a=e&&e.message?e.message:"Error",c=t==null&&e?e.code:t;return st.call(i,a,c,n,s,r),e&&i.cause==null&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};const Ab=null;function au(e){return ce.isPlainObject(e)||ce.isArray(e)}function Yh(e){return ce.endsWith(e,"[]")?e.slice(0,-2):e}function ep(e,t,n){return e?e.concat(t).map(function(r,o){return r=Yh(r),!n&&o?"["+r+"]":r}).join(n?".":""):t}function Eb(e){return ce.isArray(e)&&!e.some(au)}const Ib=ce.toFlatObject(ce,{},null,function(t){return/^is[A-Z]/.test(t)});function Ia(e,t,n){if(!ce.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=ce.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,_){return!ce.isUndefined(_[v])});const s=n.metaTokens,r=n.visitor||d,o=n.dots,i=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&ce.isSpecCompliantForm(t);if(!ce.isFunction(r))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(ce.isDate(p))return p.toISOString();if(ce.isBoolean(p))return p.toString();if(!c&&ce.isBlob(p))throw new st("Blob is not supported. Use a Buffer instead.");return ce.isArrayBuffer(p)||ce.isTypedArray(p)?c&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function d(p,v,_){let w=p;if(p&&!_&&typeof p=="object"){if(ce.endsWith(v,"{}"))v=s?v:v.slice(0,-2),p=JSON.stringify(p);else if(ce.isArray(p)&&Eb(p)||(ce.isFileList(p)||ce.endsWith(v,"[]"))&&(w=ce.toArray(p)))return v=Yh(v),w.forEach(function(S,E){!(ce.isUndefined(S)||S===null)&&t.append(i===!0?ep([v],E,o):i===null?v:v+"[]",u(S))}),!1}return au(p)?!0:(t.append(ep(_,v,o),u(p)),!1)}const f=[],h=Object.assign(Ib,{defaultVisitor:d,convertValue:u,isVisitable:au});function g(p,v){if(!ce.isUndefined(p)){if(f.indexOf(p)!==-1)throw Error("Circular reference detected in "+v.join("."));f.push(p),ce.forEach(p,function(w,k){(!(ce.isUndefined(w)||w===null)&&r.call(t,w,ce.isString(k)?k.trim():k,v,h))===!0&&g(w,v?v.concat(k):[k])}),f.pop()}}if(!ce.isObject(e))throw new TypeError("data must be an object");return g(e),t}function tp(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function lu(e,t){this._pairs=[],e&&Ia(e,this,t)}const np=lu.prototype;np.append=function(t,n){this._pairs.push([t,n])},np.toString=function(t){const n=t?function(s){return t.call(this,s,tp)}:tp;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function Pb(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function sp(e,t,n){if(!t)return e;const s=n&&n.encode||Pb;ce.isFunction(n)&&(n={serialize:n});const r=n&&n.serialize;let o;if(r?o=r(t,n):o=ce.isURLSearchParams(t)?t.toString():new lu(t,n).toString(s),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class rp{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ce.forEach(this.handlers,function(s){s!==null&&t(s)})}}const op={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Mb={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:lu,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},cu=typeof window<"u"&&typeof document<"u",uu=typeof navigator=="object"&&navigator||void 0,Ob=cu&&(!uu||["ReactNative","NativeScript","NS"].indexOf(uu.product)<0),Lb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Rb=cu&&window.location.href||"http://localhost",hn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cu,hasStandardBrowserEnv:Ob,hasStandardBrowserWebWorkerEnv:Lb,navigator:uu,origin:Rb},Symbol.toStringTag,{value:"Module"})),...Mb};function Db(e,t){return Ia(e,new hn.classes.URLSearchParams,{visitor:function(n,s,r,o){return hn.isNode&&ce.isBuffer(n)?(this.append(s,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function jb(e){return ce.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Nb(e){const t={},n=Object.keys(e);let s;const r=n.length;let o;for(s=0;s<r;s++)o=n[s],t[o]=e[o];return t}function ip(e){function t(n,s,r,o){let i=n[o++];if(i==="__proto__")return!0;const a=Number.isFinite(+i),c=o>=n.length;return i=!i&&ce.isArray(r)?r.length:i,c?(ce.hasOwnProp(r,i)?r[i]=[r[i],s]:r[i]=s,!a):((!r[i]||!ce.isObject(r[i]))&&(r[i]=[]),t(n,s,r[i],o)&&ce.isArray(r[i])&&(r[i]=Nb(r[i])),!a)}if(ce.isFormData(e)&&ce.isFunction(e.entries)){const n={};return ce.forEachEntry(e,(s,r)=>{t(jb(s),r,n,0)}),n}return null}function Fb(e,t,n){if(ce.isString(e))try{return(t||JSON.parse)(e),ce.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const oi={transitional:op,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",r=s.indexOf("application/json")>-1,o=ce.isObject(t);if(o&&ce.isHTMLForm(t)&&(t=new FormData(t)),ce.isFormData(t))return r?JSON.stringify(ip(t)):t;if(ce.isArrayBuffer(t)||ce.isBuffer(t)||ce.isStream(t)||ce.isFile(t)||ce.isBlob(t)||ce.isReadableStream(t))return t;if(ce.isArrayBufferView(t))return t.buffer;if(ce.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Db(t,this.formSerializer).toString();if((a=ce.isFileList(t))||s.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Ia(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||r?(n.setContentType("application/json",!1),Fb(t)):t}],transformResponse:[function(t){const n=this.transitional||oi.transitional,s=n&&n.forcedJSONParsing,r=this.responseType==="json";if(ce.isResponse(t)||ce.isReadableStream(t))return t;if(t&&ce.isString(t)&&(s&&!this.responseType||r)){const i=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(t,this.parseReviver)}catch(a){if(i)throw a.name==="SyntaxError"?st.from(a,st.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:hn.classes.FormData,Blob:hn.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ce.forEach(["delete","get","head","post","put","patch"],e=>{oi.headers[e]={}});const qb=ce.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),zb=e=>{const t={};let n,s,r;return e&&e.split(`
`).forEach(function(i){r=i.indexOf(":"),n=i.substring(0,r).trim().toLowerCase(),s=i.substring(r+1).trim(),!(!n||t[n]&&qb[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t},ap=Symbol("internals");function ii(e){return e&&String(e).trim().toLowerCase()}function Pa(e){return e===!1||e==null?e:ce.isArray(e)?e.map(Pa):String(e)}function Bb(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(e);)t[s[1]]=s[2];return t}const Ub=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function du(e,t,n,s,r){if(ce.isFunction(s))return s.call(this,t,n);if(r&&(t=n),!!ce.isString(t)){if(ce.isString(s))return t.indexOf(s)!==-1;if(ce.isRegExp(s))return s.test(t)}}function Vb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function Hb(e,t){const n=ce.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+n,{value:function(r,o,i){return this[s].call(this,t,r,o,i)},configurable:!0})})}let Sn=class{constructor(t){t&&this.set(t)}set(t,n,s){const r=this;function o(a,c,u){const d=ii(c);if(!d)throw new Error("header name must be a non-empty string");const f=ce.findKey(r,d);(!f||r[f]===void 0||u===!0||u===void 0&&r[f]!==!1)&&(r[f||c]=Pa(a))}const i=(a,c)=>ce.forEach(a,(u,d)=>o(u,d,c));if(ce.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(ce.isString(t)&&(t=t.trim())&&!Ub(t))i(zb(t),n);else if(ce.isObject(t)&&ce.isIterable(t)){let a={},c,u;for(const d of t){if(!ce.isArray(d))throw TypeError("Object iterator must return a key-value pair");a[u=d[0]]=(c=a[u])?ce.isArray(c)?[...c,d[1]]:[c,d[1]]:d[1]}i(a,n)}else t!=null&&o(n,t,s);return this}get(t,n){if(t=ii(t),t){const s=ce.findKey(this,t);if(s){const r=this[s];if(!n)return r;if(n===!0)return Bb(r);if(ce.isFunction(n))return n.call(this,r,s);if(ce.isRegExp(n))return n.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=ii(t),t){const s=ce.findKey(this,t);return!!(s&&this[s]!==void 0&&(!n||du(this,this[s],s,n)))}return!1}delete(t,n){const s=this;let r=!1;function o(i){if(i=ii(i),i){const a=ce.findKey(s,i);a&&(!n||du(s,s[a],a,n))&&(delete s[a],r=!0)}}return ce.isArray(t)?t.forEach(o):o(t),r}clear(t){const n=Object.keys(this);let s=n.length,r=!1;for(;s--;){const o=n[s];(!t||du(this,this[o],o,t,!0))&&(delete this[o],r=!0)}return r}normalize(t){const n=this,s={};return ce.forEach(this,(r,o)=>{const i=ce.findKey(s,o);if(i){n[i]=Pa(r),delete n[o];return}const a=t?Vb(o):String(o).trim();a!==o&&delete n[o],n[a]=Pa(r),s[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return ce.forEach(this,(s,r)=>{s!=null&&s!==!1&&(n[r]=t&&ce.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const s=new this(t);return n.forEach(r=>s.set(r)),s}static accessor(t){const s=(this[ap]=this[ap]={accessors:{}}).accessors,r=this.prototype;function o(i){const a=ii(i);s[a]||(Hb(r,i),s[a]=!0)}return ce.isArray(t)?t.forEach(o):o(t),this}};Sn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ce.reduceDescriptors(Sn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}}),ce.freezeMethods(Sn);function fu(e,t){const n=this||oi,s=t||n,r=Sn.from(s.headers);let o=s.data;return ce.forEach(e,function(a){o=a.call(n,o,r.normalize(),t?t.status:void 0)}),r.normalize(),o}function lp(e){return!!(e&&e.__CANCEL__)}function to(e,t,n){st.call(this,e??"canceled",st.ERR_CANCELED,t,n),this.name="CanceledError"}ce.inherits(to,st,{__CANCEL__:!0});function cp(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new st("Request failed with status code "+n.status,[st.ERR_BAD_REQUEST,st.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Wb(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Gb(e,t){e=e||10;const n=new Array(e),s=new Array(e);let r=0,o=0,i;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=s[o];i||(i=u),n[r]=c,s[r]=u;let f=o,h=0;for(;f!==r;)h+=n[f++],f=f%e;if(r=(r+1)%e,r===o&&(o=(o+1)%e),u-i<t)return;const g=d&&u-d;return g?Math.round(h*1e3/g):void 0}}function Kb(e,t){let n=0,s=1e3/t,r,o;const i=(u,d=Date.now())=>{n=d,r=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=s?i(u,d):(r=u,o||(o=setTimeout(()=>{o=null,i(r)},s-f)))},()=>r&&i(r)]}const Ma=(e,t,n=3)=>{let s=0;const r=Gb(50,250);return Kb(o=>{const i=o.loaded,a=o.lengthComputable?o.total:void 0,c=i-s,u=r(c),d=i<=a;s=i;const f={loaded:i,total:a,progress:a?i/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a&&d?(a-i)/u:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},n)},up=(e,t)=>{const n=e!=null;return[s=>t[0]({lengthComputable:n,total:e,loaded:s}),t[1]]},dp=e=>(...t)=>ce.asap(()=>e(...t)),Qb=hn.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,hn.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(hn.origin),hn.navigator&&/(msie|trident)/i.test(hn.navigator.userAgent)):()=>!0,Jb=hn.hasStandardBrowserEnv?{write(e,t,n,s,r,o){const i=[e+"="+encodeURIComponent(t)];ce.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),ce.isString(s)&&i.push("path="+s),ce.isString(r)&&i.push("domain="+r),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Xb(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Zb(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function fp(e,t,n){let s=!Xb(t);return e&&(s||n==!1)?Zb(e,t):t}const hp=e=>e instanceof Sn?{...e}:e;function yr(e,t){t=t||{};const n={};function s(u,d,f,h){return ce.isPlainObject(u)&&ce.isPlainObject(d)?ce.merge.call({caseless:h},u,d):ce.isPlainObject(d)?ce.merge({},d):ce.isArray(d)?d.slice():d}function r(u,d,f,h){if(ce.isUndefined(d)){if(!ce.isUndefined(u))return s(void 0,u,f,h)}else return s(u,d,f,h)}function o(u,d){if(!ce.isUndefined(d))return s(void 0,d)}function i(u,d){if(ce.isUndefined(d)){if(!ce.isUndefined(u))return s(void 0,u)}else return s(void 0,d)}function a(u,d,f){if(f in t)return s(u,d);if(f in e)return s(void 0,u)}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(u,d,f)=>r(hp(u),hp(d),f,!0)};return ce.forEach(Object.keys({...e,...t}),function(d){const f=c[d]||r,h=f(e[d],t[d],d);ce.isUndefined(h)&&f!==a||(n[d]=h)}),n}const pp=e=>{const t=yr({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:r,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=Sn.from(i),t.url=sp(fp(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),ce.isFormData(n)){if(hn.hasStandardBrowserEnv||hn.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(ce.isFunction(n.getHeaders)){const c=n.getHeaders(),u=["content-type","content-length"];Object.entries(c).forEach(([d,f])=>{u.includes(d.toLowerCase())&&i.set(d,f)})}}if(hn.hasStandardBrowserEnv&&(s&&ce.isFunction(s)&&(s=s(t)),s||s!==!1&&Qb(t.url))){const c=r&&o&&Jb.read(o);c&&i.set(r,c)}return t},Yb=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,s){const r=pp(e);let o=r.data;const i=Sn.from(r.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=r,d,f,h,g,p;function v(){g&&g(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(d),r.signal&&r.signal.removeEventListener("abort",d)}let _=new XMLHttpRequest;_.open(r.method.toUpperCase(),r.url,!0),_.timeout=r.timeout;function w(){if(!_)return;const S=Sn.from("getAllResponseHeaders"in _&&_.getAllResponseHeaders()),O={data:!a||a==="text"||a==="json"?_.responseText:_.response,status:_.status,statusText:_.statusText,headers:S,config:e,request:_};cp(function(P){n(P),v()},function(P){s(P),v()},O),_=null}"onloadend"in _?_.onloadend=w:_.onreadystatechange=function(){!_||_.readyState!==4||_.status===0&&!(_.responseURL&&_.responseURL.indexOf("file:")===0)||setTimeout(w)},_.onabort=function(){_&&(s(new st("Request aborted",st.ECONNABORTED,e,_)),_=null)},_.onerror=function(E){const O=E&&E.message?E.message:"Network Error",I=new st(O,st.ERR_NETWORK,e,_);I.event=E||null,s(I),_=null},_.ontimeout=function(){let E=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const O=r.transitional||op;r.timeoutErrorMessage&&(E=r.timeoutErrorMessage),s(new st(E,O.clarifyTimeoutError?st.ETIMEDOUT:st.ECONNABORTED,e,_)),_=null},o===void 0&&i.setContentType(null),"setRequestHeader"in _&&ce.forEach(i.toJSON(),function(E,O){_.setRequestHeader(O,E)}),ce.isUndefined(r.withCredentials)||(_.withCredentials=!!r.withCredentials),a&&a!=="json"&&(_.responseType=r.responseType),u&&([h,p]=Ma(u,!0),_.addEventListener("progress",h)),c&&_.upload&&([f,g]=Ma(c),_.upload.addEventListener("progress",f),_.upload.addEventListener("loadend",g)),(r.cancelToken||r.signal)&&(d=S=>{_&&(s(!S||S.type?new to(null,e,_):S),_.abort(),_=null)},r.cancelToken&&r.cancelToken.subscribe(d),r.signal&&(r.signal.aborted?d():r.signal.addEventListener("abort",d)));const k=Wb(r.url);if(k&&hn.protocols.indexOf(k)===-1){s(new st("Unsupported protocol "+k+":",st.ERR_BAD_REQUEST,e));return}_.send(o||null)})},e_=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let s=new AbortController,r;const o=function(u){if(!r){r=!0,a();const d=u instanceof Error?u:this.reason;s.abort(d instanceof st?d:new to(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,o(new st(`timeout ${t} of ms exceeded`,st.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:c}=s;return c.unsubscribe=()=>ce.asap(a),c}},t_=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let s=0,r;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},n_=async function*(e,t){for await(const n of s_(e))yield*t_(n,t)},s_=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:s}=await t.read();if(n)break;yield s}}finally{await t.cancel()}},mp=(e,t,n,s)=>{const r=n_(e,t);let o=0,i,a=c=>{i||(i=!0,s&&s(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await r.next();if(u){a(),c.close();return}let f=d.byteLength;if(n){let h=o+=f;n(h)}c.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(c){return a(c),r.return()}},{highWaterMark:2})},gp=64*1024,{isFunction:Oa}=ce,r_=(({Request:e,Response:t})=>({Request:e,Response:t}))(ce.global),{ReadableStream:vp,TextEncoder:yp}=ce.global,bp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},o_=e=>{e=ce.merge.call({skipUndefined:!0},r_,e);const{fetch:t,Request:n,Response:s}=e,r=t?Oa(t):typeof fetch=="function",o=Oa(n),i=Oa(s);if(!r)return!1;const a=r&&Oa(vp),c=r&&(typeof yp=="function"?(p=>v=>p.encode(v))(new yp):async p=>new Uint8Array(await new n(p).arrayBuffer())),u=o&&a&&bp(()=>{let p=!1;const v=new n(hn.origin,{body:new vp,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!v}),d=i&&a&&bp(()=>ce.isReadableStream(new s("").body)),f={stream:d&&(p=>p.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!f[p]&&(f[p]=(v,_)=>{let w=v&&v[p];if(w)return w.call(v);throw new st(`Response type '${p}' is not supported`,st.ERR_NOT_SUPPORT,_)})});const h=async p=>{if(p==null)return 0;if(ce.isBlob(p))return p.size;if(ce.isSpecCompliantForm(p))return(await new n(hn.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(ce.isArrayBufferView(p)||ce.isArrayBuffer(p))return p.byteLength;if(ce.isURLSearchParams(p)&&(p=p+""),ce.isString(p))return(await c(p)).byteLength},g=async(p,v)=>{const _=ce.toFiniteNumber(p.getContentLength());return _??h(v)};return async p=>{let{url:v,method:_,data:w,signal:k,cancelToken:S,timeout:E,onDownloadProgress:O,onUploadProgress:I,responseType:P,headers:M,withCredentials:q="same-origin",fetchOptions:B}=pp(p),T=t||fetch;P=P?(P+"").toLowerCase():"text";let A=e_([k,S&&S.toAbortSignal()],E),D=null;const Q=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let W;try{if(I&&u&&_!=="get"&&_!=="head"&&(W=await g(M,w))!==0){let ue=new n(v,{method:"POST",body:w,duplex:"half"}),we;if(ce.isFormData(w)&&(we=ue.headers.get("content-type"))&&M.setContentType(we),ue.body){const[Ee,re]=up(W,Ma(dp(I)));w=mp(ue.body,gp,Ee,re)}}ce.isString(q)||(q=q?"include":"omit");const H=o&&"credentials"in n.prototype,K={...B,signal:A,method:_.toUpperCase(),headers:M.normalize().toJSON(),body:w,duplex:"half",credentials:H?q:void 0};D=o&&new n(v,K);let J=await(o?T(D,B):T(v,K));const te=d&&(P==="stream"||P==="response");if(d&&(O||te&&Q)){const ue={};["status","statusText","headers"].forEach(pe=>{ue[pe]=J[pe]});const we=ce.toFiniteNumber(J.headers.get("content-length")),[Ee,re]=O&&up(we,Ma(dp(O),!0))||[];J=new s(mp(J.body,gp,Ee,()=>{re&&re(),Q&&Q()}),ue)}P=P||"text";let ge=await f[ce.findKey(f,P)||"text"](J,p);return!te&&Q&&Q(),await new Promise((ue,we)=>{cp(ue,we,{data:ge,headers:Sn.from(J.headers),status:J.status,statusText:J.statusText,config:p,request:D})})}catch(H){throw Q&&Q(),H&&H.name==="TypeError"&&/Load failed|fetch/i.test(H.message)?Object.assign(new st("Network Error",st.ERR_NETWORK,p,D),{cause:H.cause||H}):st.from(H,H&&H.code,p,D)}}},i_=new Map,_p=e=>{let t=e?e.env:{};const{fetch:n,Request:s,Response:r}=t,o=[s,r,n];let i=o.length,a=i,c,u,d=i_;for(;a--;)c=o[a],u=d.get(c),u===void 0&&d.set(c,u=a?new Map:o_(t)),d=u;return u};_p();const hu={http:Ab,xhr:Yb,fetch:{get:_p}};ce.forEach(hu,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const xp=e=>`- ${e}`,a_=e=>ce.isFunction(e)||e===null||e===!1,wp={getAdapter:(e,t)=>{e=ce.isArray(e)?e:[e];const{length:n}=e;let s,r;const o={};for(let i=0;i<n;i++){s=e[i];let a;if(r=s,!a_(s)&&(r=hu[(a=String(s)).toLowerCase()],r===void 0))throw new st(`Unknown adapter '${a}'`);if(r&&(ce.isFunction(r)||(r=r.get(t))))break;o[a||"#"+i]=r}if(!r){const i=Object.entries(o).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=n?i.length>1?`since :
`+i.map(xp).join(`
`):" "+xp(i[0]):"as no adapter specified";throw new st("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:hu};function pu(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new to(null,e)}function kp(e){return pu(e),e.headers=Sn.from(e.headers),e.data=fu.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),wp.getAdapter(e.adapter||oi.adapter,e)(e).then(function(s){return pu(e),s.data=fu.call(e,e.transformResponse,s),s.headers=Sn.from(s.headers),s},function(s){return lp(s)||(pu(e),s&&s.response&&(s.response.data=fu.call(e,e.transformResponse,s.response),s.response.headers=Sn.from(s.response.headers))),Promise.reject(s)})}const Sp="1.12.2",La={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{La[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const Cp={};La.transitional=function(t,n,s){function r(o,i){return"[Axios v"+Sp+"] Transitional option '"+o+"'"+i+(s?". "+s:"")}return(o,i,a)=>{if(t===!1)throw new st(r(i," has been removed"+(n?" in "+n:"")),st.ERR_DEPRECATED);return n&&!Cp[i]&&(Cp[i]=!0,console.warn(r(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,a):!0}},La.spelling=function(t){return(n,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function l_(e,t,n){if(typeof e!="object")throw new st("options must be an object",st.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let r=s.length;for(;r-- >0;){const o=s[r],i=t[o];if(i){const a=e[o],c=a===void 0||i(a,o,e);if(c!==!0)throw new st("option "+o+" must be "+c,st.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new st("Unknown option "+o,st.ERR_BAD_OPTION)}}const Ra={assertOptions:l_,validators:La},hs=Ra.validators;let br=class{constructor(t){this.defaults=t||{},this.interceptors={request:new rp,response:new rp}}async request(t,n){try{return await this._request(t,n)}catch(s){if(s instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const o=r.stack?r.stack.replace(/^.+\n/,""):"";try{s.stack?o&&!String(s.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(s.stack+=`
`+o):s.stack=o}catch{}}throw s}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=yr(this.defaults,n);const{transitional:s,paramsSerializer:r,headers:o}=n;s!==void 0&&Ra.assertOptions(s,{silentJSONParsing:hs.transitional(hs.boolean),forcedJSONParsing:hs.transitional(hs.boolean),clarifyTimeoutError:hs.transitional(hs.boolean)},!1),r!=null&&(ce.isFunction(r)?n.paramsSerializer={serialize:r}:Ra.assertOptions(r,{encode:hs.function,serialize:hs.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ra.assertOptions(n,{baseUrl:hs.spelling("baseURL"),withXsrfToken:hs.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&ce.merge(o.common,o[n.method]);o&&ce.forEach(["delete","get","head","post","put","patch","common"],p=>{delete o[p]}),n.headers=Sn.concat(i,o);const a=[];let c=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(c=c&&v.synchronous,a.unshift(v.fulfilled,v.rejected))});const u=[];this.interceptors.response.forEach(function(v){u.push(v.fulfilled,v.rejected)});let d,f=0,h;if(!c){const p=[kp.bind(this),void 0];for(p.unshift(...a),p.push(...u),h=p.length,d=Promise.resolve(n);f<h;)d=d.then(p[f++],p[f++]);return d}h=a.length;let g=n;for(;f<h;){const p=a[f++],v=a[f++];try{g=p(g)}catch(_){v.call(this,_);break}}try{d=kp.call(this,g)}catch(p){return Promise.reject(p)}for(f=0,h=u.length;f<h;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=yr(this.defaults,t);const n=fp(t.baseURL,t.url,t.allowAbsoluteUrls);return sp(n,t.params,t.paramsSerializer)}};ce.forEach(["delete","get","head","options"],function(t){br.prototype[t]=function(n,s){return this.request(yr(s||{},{method:t,url:n,data:(s||{}).data}))}}),ce.forEach(["post","put","patch"],function(t){function n(s){return function(o,i,a){return this.request(yr(a||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}br.prototype[t]=n(),br.prototype[t+"Form"]=n(!0)});let c_=class r0{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const s=this;this.promise.then(r=>{if(!s._listeners)return;let o=s._listeners.length;for(;o-- >0;)s._listeners[o](r);s._listeners=null}),this.promise.then=r=>{let o;const i=new Promise(a=>{s.subscribe(a),o=a}).then(r);return i.cancel=function(){s.unsubscribe(o)},i},t(function(o,i,a){s.reason||(s.reason=new to(o,i,a),n(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=s=>{t.abort(s)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new r0(function(r){t=r}),cancel:t}}};function u_(e){return function(n){return e.apply(null,n)}}function d_(e){return ce.isObject(e)&&e.isAxiosError===!0}const mu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(mu).forEach(([e,t])=>{mu[t]=e});function $p(e){const t=new br(e),n=Bh(br.prototype.request,t);return ce.extend(n,br.prototype,t,{allOwnKeys:!0}),ce.extend(n,t,null,{allOwnKeys:!0}),n.create=function(r){return $p(yr(e,r))},n}const St=$p(oi);St.Axios=br,St.CanceledError=to,St.CancelToken=c_,St.isCancel=lp,St.VERSION=Sp,St.toFormData=Ia,St.AxiosError=st,St.Cancel=St.CanceledError,St.all=function(t){return Promise.all(t)},St.spread=u_,St.isAxiosError=d_,St.mergeConfig=yr,St.AxiosHeaders=Sn,St.formToJSON=e=>ip(ce.isHTMLForm(e)?new FormData(e):e),St.getAdapter=wp.getAdapter,St.HttpStatusCode=mu,St.default=St;const{Axios:aQ,AxiosError:lQ,CanceledError:cQ,isCancel:uQ,CancelToken:dQ,VERSION:fQ,all:hQ,Cancel:pQ,isAxiosError:mQ,spread:gQ,toFormData:vQ,AxiosHeaders:yQ,HttpStatusCode:bQ,formToJSON:_Q,getAdapter:xQ,mergeConfig:wQ}=St,on=[];for(let e=0;e<256;++e)on.push((e+256).toString(16).slice(1));function f_(e,t=0){return(on[e[t+0]]+on[e[t+1]]+on[e[t+2]]+on[e[t+3]]+"-"+on[e[t+4]]+on[e[t+5]]+"-"+on[e[t+6]]+on[e[t+7]]+"-"+on[e[t+8]]+on[e[t+9]]+"-"+on[e[t+10]]+on[e[t+11]]+on[e[t+12]]+on[e[t+13]]+on[e[t+14]]+on[e[t+15]]).toLowerCase()}let gu;const h_=new Uint8Array(16);function p_(){if(!gu){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");gu=crypto.getRandomValues.bind(crypto)}return gu(h_)}const Tp={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ps(e,t,n){var r;if(Tp.randomUUID&&!e)return Tp.randomUUID();e=e||{};const s=e.random??((r=e.rng)==null?void 0:r.call(e))??p_();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,f_(s)}function Ks(){return{getStorage:function(s,r){try{if(localStorage.getItem(s)&&r)return JSON.parse(localStorage.getItem(s))[r]||null;if(localStorage.getItem(s))return JSON.parse(localStorage.getItem(s))}catch{if(localStorage.getItem(s))return localStorage.getItem(s)}return null},saveStorage:function(s,r){localStorage.setItem(s,JSON.stringify(r))},clearStorage:function(s="false"){s?localStorage.removeItem(s):localStorage.clear()}}}const Ap="eac_uuid",Da="eac-user-id",m_="rybbit-user-id",Qs=()=>{var o;const{getStorage:e,saveStorage:t,clearStorage:n}=Ks();let s=e(Da),r=e(m_);if(r)return r;if(!s){const i=e(Ap);i&&(s=i,t(Da,i),n(Ap))}return s||(s=ps(),t(Da,s)),(o=window.rybbit)==null||o.identify(s),s};async function g_(e){return e}const v_=async(e,t)=>e,y_=(e,t,n)=>async function(s){if(!s)throw new Error("userId is required");try{let r=await t(s);return r||(r=ps(),await n(s,r)),e(r),r}catch(r){console.error("Enhanced identify failed:",r)}},b_=()=>{const e=window.rybbit.identify;window.rybbit.identify=y_(e,g_,v_)},__=()=>{const e=window.rybbit.clearUserId;window.rybbit.clearUserId=()=>{e(),localStorage.removeItem(Da)}},x_=()=>{b_(),__()};function ns(e){return new Promise(t=>setTimeout(t,e))}function et(e,t={}){let{currency:n}=t;n=n??"VND";const s=n==="VND"?"vi-VN":"en-US";return new Intl.NumberFormat(s,{style:"currency",currency:n}).format(e)}function ja(e,t="DD/MM/YYYY"){const n=new Date(e),s=String(n.getDate()).padStart(2,"0"),r=String(n.getMonth()+1).padStart(2,"0"),o=n.getFullYear(),i={"DD/MM/YYYY":`${s}/${r}/${o}`,"MM/DD/YYYY":`${r}/${s}/${o}`,"YYYY/MM/DD":`${o}/${r}/${s}`};return i[t]||i["DD/MM/YYYY"]}const no={default:{product:[{id:1,name:"👍 Tóm tắt ưu nhược điểm",message:"Tóm tắt ưu nhược điểm của {title}"},{id:2,name:"🆚 So sánh các mẫu tương đương",message:"So sánh các mẫu tương đương với {title}"},{id:3,name:"{logo} Tại sao nên mua tại {brand}",message:"Tại sao nên mua {title} tại {brand}"}],category:[{id:1,name:"🏆 Top bán chạy",message:"Top {title} bán chạy"},{id:2,name:"💰 Top theo phân khúc giá",message:"Top {title} theo phân khúc giá"},{id:3,name:"🔥 Khuyến mãi hot nhất",message:"Khuyến mãi {title} hot nhất"},{id:4,name:"🔄 So sánh các hãng",message:"So sánh các hãng {title}"}]}},vu="EASYCHATGPT_WIDGET_CLOSE_MESSAGE",yu="easychatgpt-form",ss="ecg_auth_token",Kt="easychatgpt_conversations",so="easychatgpt_group_conversations",On="rangdongstorevn-zll",Bn="wwwdienmayxanhcom-urk",Un="wwwthegioididongcom-rtx",ai="easychatgptio-ujc",w_="consoleeasyaichatapp-pwg",_r="dienmaycholoncom",li="mediamartvn",xr="picovn-drr",ro="eco-martvn-a3r",wr="eradovn-fyw",ci="wwwdragontourvn",ui="gaothuannguyencom",di="truemotocarecom",$s="laptop88vn",fi="noithatgiaphongvn",Cn="bvdaihoccomvn-7n5",rs="wwwphucanhvn",kr="viettelstorevn",k_=["bepantoanvn-upq","easyaiagentsapp","viettelstorevn","khaphanspace","consoleeasyaichatapp-pwg"],Na={SPA:["rangdongstorevn-zll"],SSR:["eradovn-fyw"]};function Ep(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bu={exports:{}},Pt={},_u={exports:{}},Sr={};function Ip(){var e={};return e["align-content"]=!1,e["align-items"]=!1,e["align-self"]=!1,e["alignment-adjust"]=!1,e["alignment-baseline"]=!1,e.all=!1,e["anchor-point"]=!1,e.animation=!1,e["animation-delay"]=!1,e["animation-direction"]=!1,e["animation-duration"]=!1,e["animation-fill-mode"]=!1,e["animation-iteration-count"]=!1,e["animation-name"]=!1,e["animation-play-state"]=!1,e["animation-timing-function"]=!1,e.azimuth=!1,e["backface-visibility"]=!1,e.background=!0,e["background-attachment"]=!0,e["background-clip"]=!0,e["background-color"]=!0,e["background-image"]=!0,e["background-origin"]=!0,e["background-position"]=!0,e["background-repeat"]=!0,e["background-size"]=!0,e["baseline-shift"]=!1,e.binding=!1,e.bleed=!1,e["bookmark-label"]=!1,e["bookmark-level"]=!1,e["bookmark-state"]=!1,e.border=!0,e["border-bottom"]=!0,e["border-bottom-color"]=!0,e["border-bottom-left-radius"]=!0,e["border-bottom-right-radius"]=!0,e["border-bottom-style"]=!0,e["border-bottom-width"]=!0,e["border-collapse"]=!0,e["border-color"]=!0,e["border-image"]=!0,e["border-image-outset"]=!0,e["border-image-repeat"]=!0,e["border-image-slice"]=!0,e["border-image-source"]=!0,e["border-image-width"]=!0,e["border-left"]=!0,e["border-left-color"]=!0,e["border-left-style"]=!0,e["border-left-width"]=!0,e["border-radius"]=!0,e["border-right"]=!0,e["border-right-color"]=!0,e["border-right-style"]=!0,e["border-right-width"]=!0,e["border-spacing"]=!0,e["border-style"]=!0,e["border-top"]=!0,e["border-top-color"]=!0,e["border-top-left-radius"]=!0,e["border-top-right-radius"]=!0,e["border-top-style"]=!0,e["border-top-width"]=!0,e["border-width"]=!0,e.bottom=!1,e["box-decoration-break"]=!0,e["box-shadow"]=!0,e["box-sizing"]=!0,e["box-snap"]=!0,e["box-suppress"]=!0,e["break-after"]=!0,e["break-before"]=!0,e["break-inside"]=!0,e["caption-side"]=!1,e.chains=!1,e.clear=!0,e.clip=!1,e["clip-path"]=!1,e["clip-rule"]=!1,e.color=!0,e["color-interpolation-filters"]=!0,e["column-count"]=!1,e["column-fill"]=!1,e["column-gap"]=!1,e["column-rule"]=!1,e["column-rule-color"]=!1,e["column-rule-style"]=!1,e["column-rule-width"]=!1,e["column-span"]=!1,e["column-width"]=!1,e.columns=!1,e.contain=!1,e.content=!1,e["counter-increment"]=!1,e["counter-reset"]=!1,e["counter-set"]=!1,e.crop=!1,e.cue=!1,e["cue-after"]=!1,e["cue-before"]=!1,e.cursor=!1,e.direction=!1,e.display=!0,e["display-inside"]=!0,e["display-list"]=!0,e["display-outside"]=!0,e["dominant-baseline"]=!1,e.elevation=!1,e["empty-cells"]=!1,e.filter=!1,e.flex=!1,e["flex-basis"]=!1,e["flex-direction"]=!1,e["flex-flow"]=!1,e["flex-grow"]=!1,e["flex-shrink"]=!1,e["flex-wrap"]=!1,e.float=!1,e["float-offset"]=!1,e["flood-color"]=!1,e["flood-opacity"]=!1,e["flow-from"]=!1,e["flow-into"]=!1,e.font=!0,e["font-family"]=!0,e["font-feature-settings"]=!0,e["font-kerning"]=!0,e["font-language-override"]=!0,e["font-size"]=!0,e["font-size-adjust"]=!0,e["font-stretch"]=!0,e["font-style"]=!0,e["font-synthesis"]=!0,e["font-variant"]=!0,e["font-variant-alternates"]=!0,e["font-variant-caps"]=!0,e["font-variant-east-asian"]=!0,e["font-variant-ligatures"]=!0,e["font-variant-numeric"]=!0,e["font-variant-position"]=!0,e["font-weight"]=!0,e.grid=!1,e["grid-area"]=!1,e["grid-auto-columns"]=!1,e["grid-auto-flow"]=!1,e["grid-auto-rows"]=!1,e["grid-column"]=!1,e["grid-column-end"]=!1,e["grid-column-start"]=!1,e["grid-row"]=!1,e["grid-row-end"]=!1,e["grid-row-start"]=!1,e["grid-template"]=!1,e["grid-template-areas"]=!1,e["grid-template-columns"]=!1,e["grid-template-rows"]=!1,e["hanging-punctuation"]=!1,e.height=!0,e.hyphens=!1,e.icon=!1,e["image-orientation"]=!1,e["image-resolution"]=!1,e["ime-mode"]=!1,e["initial-letters"]=!1,e["inline-box-align"]=!1,e["justify-content"]=!1,e["justify-items"]=!1,e["justify-self"]=!1,e.left=!1,e["letter-spacing"]=!0,e["lighting-color"]=!0,e["line-box-contain"]=!1,e["line-break"]=!1,e["line-grid"]=!1,e["line-height"]=!1,e["line-snap"]=!1,e["line-stacking"]=!1,e["line-stacking-ruby"]=!1,e["line-stacking-shift"]=!1,e["line-stacking-strategy"]=!1,e["list-style"]=!0,e["list-style-image"]=!0,e["list-style-position"]=!0,e["list-style-type"]=!0,e.margin=!0,e["margin-bottom"]=!0,e["margin-left"]=!0,e["margin-right"]=!0,e["margin-top"]=!0,e["marker-offset"]=!1,e["marker-side"]=!1,e.marks=!1,e.mask=!1,e["mask-box"]=!1,e["mask-box-outset"]=!1,e["mask-box-repeat"]=!1,e["mask-box-slice"]=!1,e["mask-box-source"]=!1,e["mask-box-width"]=!1,e["mask-clip"]=!1,e["mask-image"]=!1,e["mask-origin"]=!1,e["mask-position"]=!1,e["mask-repeat"]=!1,e["mask-size"]=!1,e["mask-source-type"]=!1,e["mask-type"]=!1,e["max-height"]=!0,e["max-lines"]=!1,e["max-width"]=!0,e["min-height"]=!0,e["min-width"]=!0,e["move-to"]=!1,e["nav-down"]=!1,e["nav-index"]=!1,e["nav-left"]=!1,e["nav-right"]=!1,e["nav-up"]=!1,e["object-fit"]=!1,e["object-position"]=!1,e.opacity=!1,e.order=!1,e.orphans=!1,e.outline=!1,e["outline-color"]=!1,e["outline-offset"]=!1,e["outline-style"]=!1,e["outline-width"]=!1,e.overflow=!1,e["overflow-wrap"]=!1,e["overflow-x"]=!1,e["overflow-y"]=!1,e.padding=!0,e["padding-bottom"]=!0,e["padding-left"]=!0,e["padding-right"]=!0,e["padding-top"]=!0,e.page=!1,e["page-break-after"]=!1,e["page-break-before"]=!1,e["page-break-inside"]=!1,e["page-policy"]=!1,e.pause=!1,e["pause-after"]=!1,e["pause-before"]=!1,e.perspective=!1,e["perspective-origin"]=!1,e.pitch=!1,e["pitch-range"]=!1,e["play-during"]=!1,e.position=!1,e["presentation-level"]=!1,e.quotes=!1,e["region-fragment"]=!1,e.resize=!1,e.rest=!1,e["rest-after"]=!1,e["rest-before"]=!1,e.richness=!1,e.right=!1,e.rotation=!1,e["rotation-point"]=!1,e["ruby-align"]=!1,e["ruby-merge"]=!1,e["ruby-position"]=!1,e["shape-image-threshold"]=!1,e["shape-outside"]=!1,e["shape-margin"]=!1,e.size=!1,e.speak=!1,e["speak-as"]=!1,e["speak-header"]=!1,e["speak-numeral"]=!1,e["speak-punctuation"]=!1,e["speech-rate"]=!1,e.stress=!1,e["string-set"]=!1,e["tab-size"]=!1,e["table-layout"]=!1,e["text-align"]=!0,e["text-align-last"]=!0,e["text-combine-upright"]=!0,e["text-decoration"]=!0,e["text-decoration-color"]=!0,e["text-decoration-line"]=!0,e["text-decoration-skip"]=!0,e["text-decoration-style"]=!0,e["text-emphasis"]=!0,e["text-emphasis-color"]=!0,e["text-emphasis-position"]=!0,e["text-emphasis-style"]=!0,e["text-height"]=!0,e["text-indent"]=!0,e["text-justify"]=!0,e["text-orientation"]=!0,e["text-overflow"]=!0,e["text-shadow"]=!0,e["text-space-collapse"]=!0,e["text-transform"]=!0,e["text-underline-position"]=!0,e["text-wrap"]=!0,e.top=!1,e.transform=!1,e["transform-origin"]=!1,e["transform-style"]=!1,e.transition=!1,e["transition-delay"]=!1,e["transition-duration"]=!1,e["transition-property"]=!1,e["transition-timing-function"]=!1,e["unicode-bidi"]=!1,e["vertical-align"]=!1,e.visibility=!1,e["voice-balance"]=!1,e["voice-duration"]=!1,e["voice-family"]=!1,e["voice-pitch"]=!1,e["voice-range"]=!1,e["voice-rate"]=!1,e["voice-stress"]=!1,e["voice-volume"]=!1,e.volume=!1,e["white-space"]=!1,e.widows=!1,e.width=!0,e["will-change"]=!1,e["word-break"]=!0,e["word-spacing"]=!0,e["word-wrap"]=!0,e["wrap-flow"]=!1,e["wrap-through"]=!1,e["writing-mode"]=!1,e["z-index"]=!1,e}function S_(e,t,n){}function C_(e,t,n){}var $_=/javascript\s*\:/img;function T_(e,t){return $_.test(t)?"":t}Sr.whiteList=Ip(),Sr.getDefaultWhiteList=Ip,Sr.onAttr=S_,Sr.onIgnoreAttr=C_,Sr.safeAttrValue=T_;var A_={indexOf:function(e,t){var n,s;if(Array.prototype.indexOf)return e.indexOf(t);for(n=0,s=e.length;n<s;n++)if(e[n]===t)return n;return-1},forEach:function(e,t,n){var s,r;if(Array.prototype.forEach)return e.forEach(t,n);for(s=0,r=e.length;s<r;s++)t.call(n,e[s],s,e)},trim:function(e){return String.prototype.trim?e.trim():e.replace(/(^\s*)|(\s*$)/g,"")},trimRight:function(e){return String.prototype.trimRight?e.trimRight():e.replace(/(\s*$)/g,"")}},hi=A_;function E_(e,t){e=hi.trimRight(e),e[e.length-1]!==";"&&(e+=";");var n=e.length,s=!1,r=0,o=0,i="";function a(){if(!s){var d=hi.trim(e.slice(r,o)),f=d.indexOf(":");if(f!==-1){var h=hi.trim(d.slice(0,f)),g=hi.trim(d.slice(f+1));if(h){var p=t(r,i.length,h,g,d);p&&(i+=p+"; ")}}}r=o+1}for(;o<n;o++){var c=e[o];if(c==="/"&&e[o+1]==="*"){var u=e.indexOf("*/",o+2);if(u===-1)break;o=u+1,r=o+1,s=!1}else c==="("?s=!0:c===")"?s=!1:c===";"?s||a():c===`
`&&a()}return hi.trim(i)}var I_=E_,Fa=Sr,P_=I_;function Pp(e){return e==null}function M_(e){var t={};for(var n in e)t[n]=e[n];return t}function Mp(e){e=M_(e||{}),e.whiteList=e.whiteList||Fa.whiteList,e.onAttr=e.onAttr||Fa.onAttr,e.onIgnoreAttr=e.onIgnoreAttr||Fa.onIgnoreAttr,e.safeAttrValue=e.safeAttrValue||Fa.safeAttrValue,this.options=e}Mp.prototype.process=function(e){if(e=e||"",e=e.toString(),!e)return"";var t=this,n=t.options,s=n.whiteList,r=n.onAttr,o=n.onIgnoreAttr,i=n.safeAttrValue,a=P_(e,function(c,u,d,f,h){var g=s[d],p=!1;if(g===!0?p=g:typeof g=="function"?p=g(f):g instanceof RegExp&&(p=g.test(f)),p!==!0&&(p=!1),f=i(d,f),!!f){var v={position:u,sourcePosition:c,source:h,isWhite:p};if(p){var _=r(d,f,v);return Pp(_)?d+":"+f:_}else{var _=o(d,f,v);if(!Pp(_))return _}}});return a};var O_=Mp;(function(e,t){var n=Sr,s=O_;function r(i,a){var c=new s(a);return c.process(i)}t=e.exports=r,t.FilterCSS=s;for(var o in n)t[o]=n[o];typeof window<"u"&&(window.filterCSS=e.exports)})(_u,_u.exports);var xu=_u.exports,wu={indexOf:function(e,t){var n,s;if(Array.prototype.indexOf)return e.indexOf(t);for(n=0,s=e.length;n<s;n++)if(e[n]===t)return n;return-1},forEach:function(e,t,n){var s,r;if(Array.prototype.forEach)return e.forEach(t,n);for(s=0,r=e.length;s<r;s++)t.call(n,e[s],s,e)},trim:function(e){return String.prototype.trim?e.trim():e.replace(/(^\s*)|(\s*$)/g,"")},spaceIndex:function(e){var t=/\s|\n|\t/,n=t.exec(e);return n?n.index:-1}},L_=xu.FilterCSS,R_=xu.getDefaultWhiteList,qa=wu;function Op(){return{a:["target","href","title"],abbr:["title"],address:[],area:["shape","coords","href","alt"],article:[],aside:[],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:[],dl:[],dt:[],em:[],figcaption:[],figure:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["src","alt","title","width","height","loading"],ins:["datetime"],kbd:[],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],summary:[],sup:[],strong:[],strike:[],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],video:["autoplay","controls","crossorigin","loop","muted","playsinline","poster","preload","src","height","width"]}}var Lp=new L_;function D_(e,t,n){}function j_(e,t,n){}function N_(e,t,n){}function F_(e,t,n){}function Rp(e){return e.replace(z_,"&lt;").replace(B_,"&gt;")}function q_(e,t,n,s){if(n=Up(n),t==="href"||t==="src"){if(n=qa.trim(n),n==="#")return"#";if(!(n.substr(0,7)==="http://"||n.substr(0,8)==="https://"||n.substr(0,7)==="mailto:"||n.substr(0,4)==="tel:"||n.substr(0,11)==="data:image/"||n.substr(0,6)==="ftp://"||n.substr(0,2)==="./"||n.substr(0,3)==="../"||n[0]==="#"||n[0]==="/"))return""}else if(t==="background"){if(za.lastIndex=0,za.test(n))return""}else if(t==="style"){if(Dp.lastIndex=0,Dp.test(n)||(jp.lastIndex=0,jp.test(n)&&(za.lastIndex=0,za.test(n))))return"";s!==!1&&(s=s||Lp,n=s.process(n))}return n=Vp(n),n}var z_=/</g,B_=/>/g,U_=/"/g,V_=/&quot;/g,H_=/&#([a-zA-Z0-9]*);?/gim,W_=/&colon;?/gim,G_=/&newline;?/gim,za=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,Dp=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,jp=/u\s*r\s*l\s*\(.*/gi;function Np(e){return e.replace(U_,"&quot;")}function Fp(e){return e.replace(V_,'"')}function qp(e){return e.replace(H_,function(n,s){return s[0]==="x"||s[0]==="X"?String.fromCharCode(parseInt(s.substr(1),16)):String.fromCharCode(parseInt(s,10))})}function zp(e){return e.replace(W_,":").replace(G_," ")}function Bp(e){for(var t="",n=0,s=e.length;n<s;n++)t+=e.charCodeAt(n)<32?" ":e.charAt(n);return qa.trim(t)}function Up(e){return e=Fp(e),e=qp(e),e=zp(e),e=Bp(e),e}function Vp(e){return e=Np(e),e=Rp(e),e}function K_(){return""}function Q_(e,t){typeof t!="function"&&(t=function(){});var n=!Array.isArray(e);function s(i){return n?!0:qa.indexOf(e,i)!==-1}var r=[],o=!1;return{onIgnoreTag:function(i,a,c){if(s(i))if(c.isClosing){var u="[/removed]",d=c.position+u.length;return r.push([o!==!1?o:c.position,d]),o=!1,u}else return o||(o=c.position),"[removed]";else return t(i,a,c)},remove:function(i){var a="",c=0;return qa.forEach(r,function(u){a+=i.slice(c,u[0]),c=u[1]}),a+=i.slice(c),a}}}function J_(e){for(var t="",n=0;n<e.length;){var s=e.indexOf("<!--",n);if(s===-1){t+=e.slice(n);break}t+=e.slice(n,s);var r=e.indexOf("-->",s);if(r===-1)break;n=r+3}return t}function X_(e){var t=e.split("");return t=t.filter(function(n){var s=n.charCodeAt(0);return s===127?!1:s<=31?s===10||s===13:!0}),t.join("")}Pt.whiteList=Op(),Pt.getDefaultWhiteList=Op,Pt.onTag=D_,Pt.onIgnoreTag=j_,Pt.onTagAttr=N_,Pt.onIgnoreTagAttr=F_,Pt.safeAttrValue=q_,Pt.escapeHtml=Rp,Pt.escapeQuote=Np,Pt.unescapeQuote=Fp,Pt.escapeHtmlEntities=qp,Pt.escapeDangerHtml5Entities=zp,Pt.clearNonPrintableCharacter=Bp,Pt.friendlyAttrValue=Up,Pt.escapeAttrValue=Vp,Pt.onIgnoreTagStripAll=K_,Pt.StripTagBody=Q_,Pt.stripCommentTag=J_,Pt.stripBlankChar=X_,Pt.attributeWrapSign='"',Pt.cssFilter=Lp,Pt.getDefaultCSSWhiteList=R_;var Ba={},Js=wu;function Z_(e){var t=Js.spaceIndex(e),n;return t===-1?n=e.slice(1,-1):n=e.slice(1,t+1),n=Js.trim(n).toLowerCase(),n.slice(0,1)==="/"&&(n=n.slice(1)),n.slice(-1)==="/"&&(n=n.slice(0,-1)),n}function Y_(e){return e.slice(0,2)==="</"}function ex(e,t,n){var s="",r=0,o=!1,i=!1,a=0,c=e.length,u="",d="";e:for(a=0;a<c;a++){var f=e.charAt(a);if(o===!1){if(f==="<"){o=a;continue}}else if(i===!1){if(f==="<"){s+=n(e.slice(r,a)),o=a,r=a;continue}if(f===">"||a===c-1){s+=n(e.slice(r,o)),d=e.slice(o,a+1),u=Z_(d),s+=t(o,s.length,u,d,Y_(d)),r=a+1,o=!1;continue}if(f==='"'||f==="'")for(var h=1,g=e.charAt(a-h);g.trim()===""||g==="=";){if(g==="="){i=f;continue e}g=e.charAt(a-++h)}}else if(f===i){i=!1;continue}}return r<c&&(s+=n(e.substr(r))),s}var tx=/[^a-zA-Z0-9\\_:.-]/gim;function nx(e,t){var n=0,s=0,r=[],o=!1,i=e.length;function a(h,g){if(h=Js.trim(h),h=h.replace(tx,"").toLowerCase(),!(h.length<1)){var p=t(h,g||"");p&&r.push(p)}}for(var c=0;c<i;c++){var u=e.charAt(c),d,f;if(o===!1&&u==="="){o=e.slice(n,c),n=c+1,s=e.charAt(n)==='"'||e.charAt(n)==="'"?n:rx(e,c+1);continue}if(o!==!1&&c===s){if(f=e.indexOf(u,c+1),f===-1)break;d=Js.trim(e.slice(s+1,f)),a(o,d),o=!1,c=f,n=c+1;continue}if(/\s|\n|\t/.test(u))if(e=e.replace(/\s|\n|\t/g," "),o===!1)if(f=sx(e,c),f===-1){d=Js.trim(e.slice(n,c)),a(d),o=!1,n=c+1;continue}else{c=f-1;continue}else if(f=ox(e,c-1),f===-1){d=Js.trim(e.slice(n,c)),d=Hp(d),a(o,d),o=!1,n=c+1;continue}else continue}return n<e.length&&(o===!1?a(e.slice(n)):a(o,Hp(Js.trim(e.slice(n))))),Js.trim(r.join(" "))}function sx(e,t){for(;t<e.length;t++){var n=e[t];if(n!==" ")return n==="="?t:-1}}function rx(e,t){for(;t<e.length;t++){var n=e[t];if(n!==" ")return n==="'"||n==='"'?t:-1}}function ox(e,t){for(;t>0;t--){var n=e[t];if(n!==" ")return n==="="?t:-1}}function ix(e){return e[0]==='"'&&e[e.length-1]==='"'||e[0]==="'"&&e[e.length-1]==="'"}function Hp(e){return ix(e)?e.substr(1,e.length-2):e}Ba.parseTag=ex,Ba.parseAttr=nx;var ax=xu.FilterCSS,Vn=Pt,Wp=Ba,lx=Wp.parseTag,cx=Wp.parseAttr,Ua=wu;function Va(e){return e==null}function ux(e){var t=Ua.spaceIndex(e);if(t===-1)return{html:"",closing:e[e.length-2]==="/"};e=Ua.trim(e.slice(t+1,-1));var n=e[e.length-1]==="/";return n&&(e=Ua.trim(e.slice(0,-1))),{html:e,closing:n}}function dx(e){var t={};for(var n in e)t[n]=e[n];return t}function fx(e){var t={};for(var n in e)Array.isArray(e[n])?t[n.toLowerCase()]=e[n].map(function(s){return s.toLowerCase()}):t[n.toLowerCase()]=e[n];return t}function Gp(e){e=dx(e||{}),e.stripIgnoreTag&&(e.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),e.onIgnoreTag=Vn.onIgnoreTagStripAll),e.whiteList||e.allowList?e.whiteList=fx(e.whiteList||e.allowList):e.whiteList=Vn.whiteList,this.attributeWrapSign=e.singleQuotedAttributeValue===!0?"'":Vn.attributeWrapSign,e.onTag=e.onTag||Vn.onTag,e.onTagAttr=e.onTagAttr||Vn.onTagAttr,e.onIgnoreTag=e.onIgnoreTag||Vn.onIgnoreTag,e.onIgnoreTagAttr=e.onIgnoreTagAttr||Vn.onIgnoreTagAttr,e.safeAttrValue=e.safeAttrValue||Vn.safeAttrValue,e.escapeHtml=e.escapeHtml||Vn.escapeHtml,this.options=e,e.css===!1?this.cssFilter=!1:(e.css=e.css||{},this.cssFilter=new ax(e.css))}Gp.prototype.process=function(e){if(e=e||"",e=e.toString(),!e)return"";var t=this,n=t.options,s=n.whiteList,r=n.onTag,o=n.onIgnoreTag,i=n.onTagAttr,a=n.onIgnoreTagAttr,c=n.safeAttrValue,u=n.escapeHtml,d=t.attributeWrapSign,f=t.cssFilter;n.stripBlankChar&&(e=Vn.stripBlankChar(e)),n.allowCommentTag||(e=Vn.stripCommentTag(e));var h=!1;n.stripIgnoreTagBody&&(h=Vn.StripTagBody(n.stripIgnoreTagBody,o),o=h.onIgnoreTag);var g=lx(e,function(p,v,_,w,k){var S={sourcePosition:p,position:v,isClosing:k,isWhite:Object.prototype.hasOwnProperty.call(s,_)},E=r(_,w,S);if(!Va(E))return E;if(S.isWhite){if(S.isClosing)return"</"+_+">";var O=ux(w),I=s[_],P=cx(O.html,function(M,q){var B=Ua.indexOf(I,M)!==-1,T=i(_,M,q,B);return Va(T)?B?(q=c(_,M,q,f),q?M+"="+d+q+d:M):(T=a(_,M,q,B),Va(T)?void 0:T):T});return w="<"+_,P&&(w+=" "+P),O.closing&&(w+=" /"),w+=">",w}else return E=o(_,w,S),Va(E)?u(w):E},u);return h&&(g=h.remove(g)),g};var hx=Gp;(function(e,t){var n=Pt,s=Ba,r=hx;function o(a,c){var u=new r(c);return u.process(a)}t=e.exports=o,t.filterXSS=o,t.FilterXSS=r,function(){for(var a in n)t[a]=n[a];for(var c in s)t[c]=s[c]}(),typeof window<"u"&&(window.filterXSS=e.exports);function i(){return typeof self<"u"&&typeof DedicatedWorkerGlobalScope<"u"&&self instanceof DedicatedWorkerGlobalScope}i()&&(self.filterXSS=e.exports)})(bu,bu.exports);var Kp=bu.exports;const px=[/<script[\s\S]*?(<\/script>|$)/i,/javascript\s*:/i,/vbscript\s*:/i,/data\s*:\s*text\s*\/\s*html/i,/on\w+\s*=/i,/expression\s*\(/i,/url\s*\(\s*['"]?\s*javascript\s*:/i,/srcdoc\s*=.*<script/i,/\{\{.*\}\}|\$\{.*\}|v-on:|ng-\w+=/,/@\w+\s*=\s*["'][^"']*["']/],Qp=[/expression\s*\(/i,/javascript\s*:/i,/vbscript\s*:/i,/data\s*:\s*(?!image\/)/i,/@import/i,/behavior\s*:/i,/-moz-binding/i],Jp=e=>{if(!e||typeof e!="string")return!1;if(px.some(t=>t.test(e)))return!0;if(/&[a-zA-Z]+;|&#\d+;|&#x[0-9a-fA-F]+;/.test(e)){const t=e.replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#39;/gi,"'").replace(/&amp;/gi,"&").replace(/&#x3C;/gi,"<").replace(/&#x3E;/gi,">").replace(/&#60;/gi,"<").replace(/&#62;/gi,">").replace(/&#x22;/gi,'"').replace(/&#x27;/gi,"'");if(t!==e)return Jp(t)}return!1},mx=e=>{if(!e||typeof e!="string")return"";let t=e.replace(/\/\*[\s\S]*?\*\//g,"").trim();if(Qp.some(r=>r.test(t)))return console.warn("Blocked dangerous CSS:",e),"";const n=t.split(";").filter(r=>r.trim()),s=[];return n.forEach(r=>{const o=r.indexOf(":");if(o===-1)return;const i=r.substring(0,o).trim(),a=r.substring(o+1).trim();Qp.some(c=>c.test(a))||s.push(`${i}: ${a}`)}),s.join("; ")},Xp={whiteList:{a:["alt","class","href","id","title","target","rel"],b:["class","id"],blockquote:["class","id"],br:[],code:["class","id"],div:["class","id","style"],em:["class","id"],h1:["class","id"],h2:["class","id"],h3:["class","id"],h4:["class","id"],h5:["class","id"],h6:["class","id"],hr:["class","id"],i:["class","id"],p:["class","id","style"],pre:["class","id"],span:["class","id","style"],strong:["class","id"],li:["class","id"],ol:["class","id","start"],ul:["class","id"],table:["class","id"],tbody:["class","id"],td:["class","id","colspan","rowspan"],th:["class","id","colspan","rowspan"],thead:["class","id"],tr:["class","id"],img:["alt","class","id","src","title"],math:["class","id","mathvariant","displaystyle"],mrow:["class","id"],mi:["class","id","mathvariant"],mo:["class","id"],mn:["class","id"],msup:["class","id"],msub:["class","id"],mfrac:["class","id"],msqrt:["class","id"]},stripIgnoreTag:!0,stripIgnoreTagBody:["script","style"],onTagAttr:(e,t,n,s)=>{if(t.toLowerCase().startsWith("on"))return"";if(t==="style"){const r=mx(n);return r?`style="${r}"`:""}if(t==="href"||t==="src"){const r=yx(n);return r!==n?`${t}="${r}"`:null}return s?null:""},onIgnoreTagAttr:(e,t,n,s)=>""},gx=new Kp.FilterXSS(Xp),vx=(e,t={})=>{if(!e||typeof e!="string")return"";const n={...Xp,...t};return(t&&Object.keys(t).length>0?new Kp.FilterXSS(n):gx).process(e)},yx=e=>{if(!e||typeof e!="string")return"#";const t=e.trim().toLowerCase();return t.startsWith("javascript:")||t.startsWith("vbscript:")||t.startsWith("data:")&&!t.startsWith("data:image/")?"#blocked":e},Zp=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),bx=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Yp=e=>typeof e=="string"&&bx.test(e);function oo(e){return(JSON.parse(localStorage.getItem(Kt))||{})[e]}function em(){const e=new URLSearchParams(window.location.search).get("conversation_id");return e&&Yp(e)?e:null}const io={lpnasamarketcom:{category:/(.*)-pc(\d+)\.html$/,product:/(.*)-p(\d+)\.html$/},"picovn-drr":{category:/^\/[^\/]+\.c$/}};function os(e){var r;const t=document.querySelectorAll('body script[type="application/ld+json"]'),n=document.querySelectorAll('head script[type="application/ld+json"]'),s=[...t,...n];for(const o of s)try{const a=o.textContent.replace(/[\x00-\x1F]+/g," "),c=JSON.parse(a);if((r=c["@context"])!=null&&r.includes("https://schema.org")&&c["@type"]===e)return c}catch(i){console.warn("⚠️ Skipped invalid JSON schema:",i.message);continue}return null}function ms(){const e=document.querySelector('meta[property="og:image"]');return e?e.getAttribute("content"):null}function _x(){const e=document.querySelector('link[rel="canonical"]');return e&&e.href?e.href:window.location.origin+window.location.pathname}function xx(e){if(!io[e])return null;const t=_x(),n=new URL(t).pathname;if(n==="/")return null;let s=!1,r=!1;return io[e].category&&(s=n.match(io[e].category)),io[e].product&&(r=n.match(io[e].product)),s?"category":r?"product":null}function Ts(){try{const e={type:null,title:null,description:null,image:null,url:null,price_amount:null,price_currency:null};return[{key:"title",property:"og:title"},{key:"description",property:"og:description"},{key:"image",property:"og:image"},{key:"url",property:"og:url"},{key:"price_amount",property:"product:price:amount"},{key:"price_currency",property:"product:price:currency"}].forEach(({key:n,property:s})=>{let r=`meta[property="${s}"]`;n==="title"&&(r+=':not([itemprop="headline"])');const o=document.querySelector(r);o&&(e[n]=o.getAttribute("content"))}),e}catch{return null}}function wx({handle:e}){if(!io[e])return null;try{const t=xx(e);if(t)return t;const n=document.querySelector('meta[property="og:type"]');return n&&["product","category"].includes(n.content)?n.content:null}catch{return null}}function kx(e,t="-"){return e&&e.toLowerCase().replace(/\t/g,"").replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g,"a").replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g,"e").replace(/ì|í|ị|ỉ|ĩ/g,"i").replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g,"o").replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g,"u").replace(/ỳ|ý|ỵ|ỷ|ỹ/g,"y").replace(/đ/g,"d").replace(/\s+/g,t).replace(/[^A-Za-z0-9_-]/g,"").replace(/-+/g,t)}function ku(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Cr=ku();function tm(e){Cr=e}const nm=/[&<>"']/,Sx=new RegExp(nm.source,"g"),sm=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Cx=new RegExp(sm.source,"g"),$x={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},rm=e=>$x[e];function Ln(e,t){if(t){if(nm.test(e))return e.replace(Sx,rm)}else if(sm.test(e))return e.replace(Cx,rm);return e}const Tx=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Ax(e){return e.replace(Tx,(t,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const Ex=/(^|[^\[])\^/g;function xt(e,t){let n=typeof e=="string"?e:e.source;t=t||"";const s={replace:(r,o)=>{let i=typeof o=="string"?o:o.source;return i=i.replace(Ex,"$1"),n=n.replace(r,i),s},getRegex:()=>new RegExp(n,t)};return s}function om(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}const pi={exec:()=>null};function im(e,t){const n=e.replace(/\|/g,(o,i,a)=>{let c=!1,u=i;for(;--u>=0&&a[u]==="\\";)c=!c;return c?"|":" |"}),s=n.split(/ \|/);let r=0;if(s[0].trim()||s.shift(),s.length>0&&!s[s.length-1].trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace(/\\\|/g,"|");return s}function Ha(e,t,n){const s=e.length;if(s===0)return"";let r=0;for(;r<s&&e.charAt(s-r-1)===t;)r++;return e.slice(0,s-r)}function Ix(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return-1}function am(e,t,n,s){const r=t.href,o=t.title?Ln(t.title):null,i=e[1].replace(/\\([\[\]])/g,"$1");if(e[0].charAt(0)!=="!"){s.state.inLink=!0;const a={type:"link",raw:n,href:r,title:o,text:i,tokens:s.inlineTokens(i)};return s.state.inLink=!1,a}return{type:"image",raw:n,href:r,title:o,text:Ln(i)}}function Px(e,t){const n=e.match(/^(\s+)(?:```)/);if(n===null)return t;const s=n[1];return t.split(`
`).map(r=>{const o=r.match(/^\s+/);if(o===null)return r;const[i]=o;return i.length>=s.length?r.slice(s.length):r}).join(`
`)}class Wa{constructor(t){$t(this,"options");$t(this,"rules");$t(this,"lexer");this.options=t||Cr}space(t){const n=this.rules.block.newline.exec(t);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(t){const n=this.rules.block.code.exec(t);if(n){const s=n[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?s:Ha(s,`
`)}}}fences(t){const n=this.rules.block.fences.exec(t);if(n){const s=n[0],r=Px(s,n[3]||"");return{type:"code",raw:s,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:r}}}heading(t){const n=this.rules.block.heading.exec(t);if(n){let s=n[2].trim();if(/#$/.test(s)){const r=Ha(s,"#");(this.options.pedantic||!r||/ $/.test(r))&&(s=r.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(t){const n=this.rules.block.hr.exec(t);if(n)return{type:"hr",raw:n[0]}}blockquote(t){const n=this.rules.block.blockquote.exec(t);if(n){let s=n[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
$1`);s=Ha(s.replace(/^ *>[ \t]?/gm,""),`
`);const r=this.lexer.state.top;this.lexer.state.top=!0;const o=this.lexer.blockTokens(s);return this.lexer.state.top=r,{type:"blockquote",raw:n[0],tokens:o,text:s}}}list(t){let n=this.rules.block.list.exec(t);if(n){let s=n[1].trim();const r=s.length>1,o={type:"list",raw:"",ordered:r,start:r?+s.slice(0,-1):"",loose:!1,items:[]};s=r?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=r?s:"[*+-]");const i=new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`);let a="",c="",u=!1;for(;t;){let d=!1;if(!(n=i.exec(t))||this.rules.block.hr.test(t))break;a=n[0],t=t.substring(a.length);let f=n[2].split(`
`,1)[0].replace(/^\t+/,w=>" ".repeat(3*w.length)),h=t.split(`
`,1)[0],g=0;this.options.pedantic?(g=2,c=f.trimStart()):(g=n[2].search(/[^ ]/),g=g>4?1:g,c=f.slice(g),g+=n[1].length);let p=!1;if(!f&&/^ *$/.test(h)&&(a+=h+`
`,t=t.substring(h.length+1),d=!0),!d){const w=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),k=new RegExp(`^ {0,${Math.min(3,g-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),S=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:\`\`\`|~~~)`),E=new RegExp(`^ {0,${Math.min(3,g-1)}}#`);for(;t;){const O=t.split(`
`,1)[0];if(h=O,this.options.pedantic&&(h=h.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),S.test(h)||E.test(h)||w.test(h)||k.test(t))break;if(h.search(/[^ ]/)>=g||!h.trim())c+=`
`+h.slice(g);else{if(p||f.search(/[^ ]/)>=4||S.test(f)||E.test(f)||k.test(f))break;c+=`
`+h}!p&&!h.trim()&&(p=!0),a+=O+`
`,t=t.substring(O.length+1),f=h.slice(g)}}o.loose||(u?o.loose=!0:/\n *\n *$/.test(a)&&(u=!0));let v=null,_;this.options.gfm&&(v=/^\[[ xX]\] /.exec(c),v&&(_=v[0]!=="[ ] ",c=c.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:a,task:!!v,checked:_,loose:!1,text:c,tokens:[]}),o.raw+=a}o.items[o.items.length-1].raw=a.trimEnd(),o.items[o.items.length-1].text=c.trimEnd(),o.raw=o.raw.trimEnd();for(let d=0;d<o.items.length;d++)if(this.lexer.state.top=!1,o.items[d].tokens=this.lexer.blockTokens(o.items[d].text,[]),!o.loose){const f=o.items[d].tokens.filter(g=>g.type==="space"),h=f.length>0&&f.some(g=>/\n.*\n/.test(g.raw));o.loose=h}if(o.loose)for(let d=0;d<o.items.length;d++)o.items[d].loose=!0;return o}}html(t){const n=this.rules.block.html.exec(t);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(t){const n=this.rules.block.def.exec(t);if(n){const s=n[1].toLowerCase().replace(/\s+/g," "),r=n[2]?n[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:s,raw:n[0],href:r,title:o}}}table(t){const n=this.rules.block.table.exec(t);if(!n||!/[:|]/.test(n[2]))return;const s=im(n[1]),r=n[2].replace(/^\||\| *$/g,"").split("|"),o=n[3]&&n[3].trim()?n[3].replace(/\n[ \t]*$/,"").split(`
`):[],i={type:"table",raw:n[0],header:[],align:[],rows:[]};if(s.length===r.length){for(const a of r)/^ *-+: *$/.test(a)?i.align.push("right"):/^ *:-+: *$/.test(a)?i.align.push("center"):/^ *:-+ *$/.test(a)?i.align.push("left"):i.align.push(null);for(const a of s)i.header.push({text:a,tokens:this.lexer.inline(a)});for(const a of o)i.rows.push(im(a,i.header.length).map(c=>({text:c,tokens:this.lexer.inline(c)})));return i}}lheading(t){const n=this.rules.block.lheading.exec(t);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(t){const n=this.rules.block.paragraph.exec(t);if(n){const s=n[1].charAt(n[1].length-1)===`
`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:s,tokens:this.lexer.inline(s)}}}text(t){const n=this.rules.block.text.exec(t);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(t){const n=this.rules.inline.escape.exec(t);if(n)return{type:"escape",raw:n[0],text:Ln(n[1])}}tag(t){const n=this.rules.inline.tag.exec(t);if(n)return!this.lexer.state.inLink&&/^<a /i.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(t){const n=this.rules.inline.link.exec(t);if(n){const s=n[2].trim();if(!this.options.pedantic&&/^</.test(s)){if(!/>$/.test(s))return;const i=Ha(s.slice(0,-1),"\\");if((s.length-i.length)%2===0)return}else{const i=Ix(n[2],"()");if(i>-1){const c=(n[0].indexOf("!")===0?5:4)+n[1].length+i;n[2]=n[2].substring(0,i),n[0]=n[0].substring(0,c).trim(),n[3]=""}}let r=n[2],o="";if(this.options.pedantic){const i=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r);i&&(r=i[1],o=i[3])}else o=n[3]?n[3].slice(1,-1):"";return r=r.trim(),/^</.test(r)&&(this.options.pedantic&&!/>$/.test(s)?r=r.slice(1):r=r.slice(1,-1)),am(n,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer)}}reflink(t,n){let s;if((s=this.rules.inline.reflink.exec(t))||(s=this.rules.inline.nolink.exec(t))){const r=(s[2]||s[1]).replace(/\s+/g," "),o=n[r.toLowerCase()];if(!o){const i=s[0].charAt(0);return{type:"text",raw:i,text:i}}return am(s,o,s[0],this.lexer)}}emStrong(t,n,s=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!r||r[3]&&s.match(/[\p{L}\p{N}]/u))return;if(!(r[1]||r[2]||"")||!s||this.rules.inline.punctuation.exec(s)){const i=[...r[0]].length-1;let a,c,u=i,d=0;const f=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,n=n.slice(-1*t.length+i);(r=f.exec(n))!=null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(c=[...a].length,r[3]||r[4]){u+=c;continue}else if((r[5]||r[6])&&i%3&&!((i+c)%3)){d+=c;continue}if(u-=c,u>0)continue;c=Math.min(c,c+u+d);const h=[...r[0]][0].length,g=t.slice(0,i+r.index+h+c);if(Math.min(i,c)%2){const v=g.slice(1,-1);return{type:"em",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}const p=g.slice(2,-2);return{type:"strong",raw:g,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(t){const n=this.rules.inline.code.exec(t);if(n){let s=n[2].replace(/\n/g," ");const r=/[^ ]/.test(s),o=/^ /.test(s)&&/ $/.test(s);return r&&o&&(s=s.substring(1,s.length-1)),s=Ln(s,!0),{type:"codespan",raw:n[0],text:s}}}br(t){const n=this.rules.inline.br.exec(t);if(n)return{type:"br",raw:n[0]}}del(t){const n=this.rules.inline.del.exec(t);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(t){const n=this.rules.inline.autolink.exec(t);if(n){let s,r;return n[2]==="@"?(s=Ln(n[1]),r="mailto:"+s):(s=Ln(n[1]),r=s),{type:"link",raw:n[0],text:s,href:r,tokens:[{type:"text",raw:s,text:s}]}}}url(t){var s;let n;if(n=this.rules.inline.url.exec(t)){let r,o;if(n[2]==="@")r=Ln(n[0]),o="mailto:"+r;else{let i;do i=n[0],n[0]=((s=this.rules.inline._backpedal.exec(n[0]))==null?void 0:s[0])??"";while(i!==n[0]);r=Ln(n[0]),n[1]==="www."?o="http://"+n[0]:o=n[0]}return{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){const n=this.rules.inline.text.exec(t);if(n){let s;return this.lexer.state.inRawBlock?s=n[0]:s=Ln(n[0]),{type:"text",raw:n[0],text:s}}}}const Mx=/^(?: *(?:\n|$))+/,Ox=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Lx=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,mi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Rx=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,lm=/(?:[*+-]|\d{1,9}[.)])/,cm=xt(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,lm).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),Su=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Dx=/^[^\n]+/,Cu=/(?!\s*\])(?:\\.|[^\[\]\\])+/,jx=xt(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",Cu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Nx=xt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,lm).getRegex(),Ga="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",$u=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Fx=xt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",$u).replace("tag",Ga).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),um=xt(Su).replace("hr",mi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ga).getRegex(),Tu={blockquote:xt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",um).getRegex(),code:Ox,def:jx,fences:Lx,heading:Rx,hr:mi,html:Fx,lheading:cm,list:Nx,newline:Mx,paragraph:um,table:pi,text:Dx},dm=xt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",mi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ga).getRegex(),qx={...Tu,table:dm,paragraph:xt(Su).replace("hr",mi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",dm).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ga).getRegex()},zx={...Tu,html:xt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",$u).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:pi,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:xt(Su).replace("hr",mi).replace("heading",` *#{1,6} *[^
]`).replace("lheading",cm).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},fm=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Bx=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,hm=/^( {2,}|\\)\n(?!\s*$)/,Ux=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,gi="\\p{P}\\p{S}",Vx=xt(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,gi).getRegex(),Hx=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Wx=xt(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,gi).getRegex(),Gx=xt("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,gi).getRegex(),Kx=xt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,gi).getRegex(),Qx=xt(/\\([punct])/,"gu").replace(/punct/g,gi).getRegex(),Jx=xt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Xx=xt($u).replace("(?:-->|$)","-->").getRegex(),Zx=xt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Xx).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ka=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Yx=xt(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Ka).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),pm=xt(/^!?\[(label)\]\[(ref)\]/).replace("label",Ka).replace("ref",Cu).getRegex(),mm=xt(/^!?\[(ref)\](?:\[\])?/).replace("ref",Cu).getRegex(),ew=xt("reflink|nolink(?!\\()","g").replace("reflink",pm).replace("nolink",mm).getRegex(),Au={_backpedal:pi,anyPunctuation:Qx,autolink:Jx,blockSkip:Hx,br:hm,code:Bx,del:pi,emStrongLDelim:Wx,emStrongRDelimAst:Gx,emStrongRDelimUnd:Kx,escape:fm,link:Yx,nolink:mm,punctuation:Vx,reflink:pm,reflinkSearch:ew,tag:Zx,text:Ux,url:pi},tw={...Au,link:xt(/^!?\[(label)\]\((.*?)\)/).replace("label",Ka).getRegex(),reflink:xt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ka).getRegex()},Eu={...Au,escape:xt(fm).replace("])","~|])").getRegex(),url:xt(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},nw={...Eu,br:xt(hm).replace("{2,}","*").getRegex(),text:xt(Eu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Qa={normal:Tu,gfm:qx,pedantic:zx},vi={normal:Au,gfm:Eu,breaks:nw,pedantic:tw};class gs{constructor(t){$t(this,"tokens");$t(this,"options");$t(this,"state");$t(this,"tokenizer");$t(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Cr,this.options.tokenizer=this.options.tokenizer||new Wa,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={block:Qa.normal,inline:vi.normal};this.options.pedantic?(n.block=Qa.pedantic,n.inline=vi.pedantic):this.options.gfm&&(n.block=Qa.gfm,this.options.breaks?n.inline=vi.breaks:n.inline=vi.gfm),this.tokenizer.rules=n}static get rules(){return{block:Qa,inline:vi}}static lex(t,n){return new gs(n).lex(t)}static lexInline(t,n){return new gs(n).inlineTokens(t)}lex(t){t=t.replace(/\r\n|\r/g,`
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[]){this.options.pedantic?t=t.replace(/\t/g," ").replace(/^ +$/gm,""):t=t.replace(/^( *)(\t+)/gm,(a,c,u)=>c+" ".repeat(u.length));let s,r,o,i;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(a=>(s=a.call({lexer:this},t,n))?(t=t.substring(s.raw.length),n.push(s),!0):!1))){if(s=this.tokenizer.space(t)){t=t.substring(s.raw.length),s.raw.length===1&&n.length>0?n[n.length-1].raw+=`
`:n.push(s);continue}if(s=this.tokenizer.code(t)){t=t.substring(s.raw.length),r=n[n.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
`+s.raw,r.text+=`
`+s.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text):n.push(s);continue}if(s=this.tokenizer.fences(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.heading(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.hr(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.blockquote(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.list(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.html(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.def(t)){t=t.substring(s.raw.length),r=n[n.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
`+s.raw,r.text+=`
`+s.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.lheading(t)){t=t.substring(s.raw.length),n.push(s);continue}if(o=t,this.options.extensions&&this.options.extensions.startBlock){let a=1/0;const c=t.slice(1);let u;this.options.extensions.startBlock.forEach(d=>{u=d.call({lexer:this},c),typeof u=="number"&&u>=0&&(a=Math.min(a,u))}),a<1/0&&a>=0&&(o=t.substring(0,a+1))}if(this.state.top&&(s=this.tokenizer.paragraph(o))){r=n[n.length-1],i&&r.type==="paragraph"?(r.raw+=`
`+s.raw,r.text+=`
`+s.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):n.push(s),i=o.length!==t.length,t=t.substring(s.raw.length);continue}if(s=this.tokenizer.text(t)){t=t.substring(s.raw.length),r=n[n.length-1],r&&r.type==="text"?(r.raw+=`
`+s.raw,r.text+=`
`+s.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):n.push(s);continue}if(t){const a="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let s,r,o,i=t,a,c,u;if(this.tokens.links){const d=Object.keys(this.tokens.links);if(d.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)d.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)i=i.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,a.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(c||(u=""),c=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(d=>(s=d.call({lexer:this},t,n))?(t=t.substring(s.raw.length),n.push(s),!0):!1))){if(s=this.tokenizer.escape(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.tag(t)){t=t.substring(s.raw.length),r=n[n.length-1],r&&s.type==="text"&&r.type==="text"?(r.raw+=s.raw,r.text+=s.text):n.push(s);continue}if(s=this.tokenizer.link(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(s.raw.length),r=n[n.length-1],r&&s.type==="text"&&r.type==="text"?(r.raw+=s.raw,r.text+=s.text):n.push(s);continue}if(s=this.tokenizer.emStrong(t,i,u)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.codespan(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.br(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.del(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.autolink(t)){t=t.substring(s.raw.length),n.push(s);continue}if(!this.state.inLink&&(s=this.tokenizer.url(t))){t=t.substring(s.raw.length),n.push(s);continue}if(o=t,this.options.extensions&&this.options.extensions.startInline){let d=1/0;const f=t.slice(1);let h;this.options.extensions.startInline.forEach(g=>{h=g.call({lexer:this},f),typeof h=="number"&&h>=0&&(d=Math.min(d,h))}),d<1/0&&d>=0&&(o=t.substring(0,d+1))}if(s=this.tokenizer.inlineText(o)){t=t.substring(s.raw.length),s.raw.slice(-1)!=="_"&&(u=s.raw.slice(-1)),c=!0,r=n[n.length-1],r&&r.type==="text"?(r.raw+=s.raw,r.text+=s.text):n.push(s);continue}if(t){const d="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return n}}class Ja{constructor(t){$t(this,"options");this.options=t||Cr}code(t,n,s){var o;const r=(o=(n||"").match(/^\S*/))==null?void 0:o[0];return t=t.replace(/\n$/,"")+`
`,r?'<pre><code class="language-'+Ln(r)+'">'+(s?t:Ln(t,!0))+`</code></pre>
`:"<pre><code>"+(s?t:Ln(t,!0))+`</code></pre>
`}blockquote(t){return`<blockquote>
${t}</blockquote>
`}html(t,n){return t}heading(t,n,s){return`<h${n}>${t}</h${n}>
`}hr(){return`<hr>
`}list(t,n,s){const r=n?"ol":"ul",o=n&&s!==1?' start="'+s+'"':"";return"<"+r+o+`>
`+t+"</"+r+`>
`}listitem(t,n,s){return`<li>${t}</li>
`}checkbox(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(t){return`<p>${t}</p>
`}table(t,n){return n&&(n=`<tbody>${n}</tbody>`),`<table>
<thead>
`+t+`</thead>
`+n+`</table>
`}tablerow(t){return`<tr>
${t}</tr>
`}tablecell(t,n){const s=n.header?"th":"td";return(n.align?`<${s} align="${n.align}">`:`<${s}>`)+t+`</${s}>
`}strong(t){return`<strong>${t}</strong>`}em(t){return`<em>${t}</em>`}codespan(t){return`<code>${t}</code>`}br(){return"<br>"}del(t){return`<del>${t}</del>`}link(t,n,s){const r=om(t);if(r===null)return s;t=r;let o='<a href="'+t+'"';return n&&(o+=' title="'+n+'"'),o+=">"+s+"</a>",o}image(t,n,s){const r=om(t);if(r===null)return s;t=r;let o=`<img src="${t}" alt="${s}"`;return n&&(o+=` title="${n}"`),o+=">",o}text(t){return t}}class Iu{strong(t){return t}em(t){return t}codespan(t){return t}del(t){return t}html(t){return t}text(t){return t}link(t,n,s){return""+s}image(t,n,s){return""+s}br(){return""}}class vs{constructor(t){$t(this,"options");$t(this,"renderer");$t(this,"textRenderer");this.options=t||Cr,this.options.renderer=this.options.renderer||new Ja,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Iu}static parse(t,n){return new vs(n).parse(t)}static parseInline(t,n){return new vs(n).parseInline(t)}parse(t,n=!0){let s="";for(let r=0;r<t.length;r++){const o=t[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const i=o,a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(i.type)){s+=a||"";continue}}switch(o.type){case"space":continue;case"hr":{s+=this.renderer.hr();continue}case"heading":{const i=o;s+=this.renderer.heading(this.parseInline(i.tokens),i.depth,Ax(this.parseInline(i.tokens,this.textRenderer)));continue}case"code":{const i=o;s+=this.renderer.code(i.text,i.lang,!!i.escaped);continue}case"table":{const i=o;let a="",c="";for(let d=0;d<i.header.length;d++)c+=this.renderer.tablecell(this.parseInline(i.header[d].tokens),{header:!0,align:i.align[d]});a+=this.renderer.tablerow(c);let u="";for(let d=0;d<i.rows.length;d++){const f=i.rows[d];c="";for(let h=0;h<f.length;h++)c+=this.renderer.tablecell(this.parseInline(f[h].tokens),{header:!1,align:i.align[h]});u+=this.renderer.tablerow(c)}s+=this.renderer.table(a,u);continue}case"blockquote":{const i=o,a=this.parse(i.tokens);s+=this.renderer.blockquote(a);continue}case"list":{const i=o,a=i.ordered,c=i.start,u=i.loose;let d="";for(let f=0;f<i.items.length;f++){const h=i.items[f],g=h.checked,p=h.task;let v="";if(h.task){const _=this.renderer.checkbox(!!g);u?h.tokens.length>0&&h.tokens[0].type==="paragraph"?(h.tokens[0].text=_+" "+h.tokens[0].text,h.tokens[0].tokens&&h.tokens[0].tokens.length>0&&h.tokens[0].tokens[0].type==="text"&&(h.tokens[0].tokens[0].text=_+" "+h.tokens[0].tokens[0].text)):h.tokens.unshift({type:"text",text:_+" "}):v+=_+" "}v+=this.parse(h.tokens,u),d+=this.renderer.listitem(v,p,!!g)}s+=this.renderer.list(d,a,c);continue}case"html":{const i=o;s+=this.renderer.html(i.text,i.block);continue}case"paragraph":{const i=o;s+=this.renderer.paragraph(this.parseInline(i.tokens));continue}case"text":{let i=o,a=i.tokens?this.parseInline(i.tokens):i.text;for(;r+1<t.length&&t[r+1].type==="text";)i=t[++r],a+=`
`+(i.tokens?this.parseInline(i.tokens):i.text);s+=n?this.renderer.paragraph(a):a;continue}default:{const i='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return s}parseInline(t,n){n=n||this.renderer;let s="";for(let r=0;r<t.length;r++){const o=t[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const i=this.options.extensions.renderers[o.type].call({parser:this},o);if(i!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){s+=i||"";continue}}switch(o.type){case"escape":{const i=o;s+=n.text(i.text);break}case"html":{const i=o;s+=n.html(i.text);break}case"link":{const i=o;s+=n.link(i.href,i.title,this.parseInline(i.tokens,n));break}case"image":{const i=o;s+=n.image(i.href,i.title,i.text);break}case"strong":{const i=o;s+=n.strong(this.parseInline(i.tokens,n));break}case"em":{const i=o;s+=n.em(this.parseInline(i.tokens,n));break}case"codespan":{const i=o;s+=n.codespan(i.text);break}case"br":{s+=n.br();break}case"del":{const i=o;s+=n.del(this.parseInline(i.tokens,n));break}case"text":{const i=o;s+=n.text(i.text);break}default:{const i='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return s}}class yi{constructor(t){$t(this,"options");this.options=t||Cr}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}}$t(yi,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class sw{constructor(...t){s0(this,Rr);$t(this,"defaults",ku());$t(this,"options",this.setOptions);$t(this,"parse",yc(this,Rr,zd).call(this,gs.lex,vs.parse));$t(this,"parseInline",yc(this,Rr,zd).call(this,gs.lexInline,vs.parseInline));$t(this,"Parser",vs);$t(this,"Renderer",Ja);$t(this,"TextRenderer",Iu);$t(this,"Lexer",gs);$t(this,"Tokenizer",Wa);$t(this,"Hooks",yi);this.use(...t)}walkTokens(t,n){var r,o;let s=[];for(const i of t)switch(s=s.concat(n.call(this,i)),i.type){case"table":{const a=i;for(const c of a.header)s=s.concat(this.walkTokens(c.tokens,n));for(const c of a.rows)for(const u of c)s=s.concat(this.walkTokens(u.tokens,n));break}case"list":{const a=i;s=s.concat(this.walkTokens(a.items,n));break}default:{const a=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(c=>{const u=a[c].flat(1/0);s=s.concat(this.walkTokens(u,n))}):a.tokens&&(s=s.concat(this.walkTokens(a.tokens,n)))}}return s}use(...t){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(s=>{const r={...s};if(r.async=this.defaults.async||r.async||!1,s.extensions&&(s.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const i=n.renderers[o.name];i?n.renderers[o.name]=function(...a){let c=o.renderer.apply(this,a);return c===!1&&(c=i.apply(this,a)),c}:n.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=n[o.level];i?i.unshift(o.tokenizer):n[o.level]=[o.tokenizer],o.start&&(o.level==="block"?n.startBlock?n.startBlock.push(o.start):n.startBlock=[o.start]:o.level==="inline"&&(n.startInline?n.startInline.push(o.start):n.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(n.childTokens[o.name]=o.childTokens)}),r.extensions=n),s.renderer){const o=this.defaults.renderer||new Ja(this.defaults);for(const i in s.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(i==="options")continue;const a=i,c=s.renderer[a],u=o[a];o[a]=(...d)=>{let f=c.apply(o,d);return f===!1&&(f=u.apply(o,d)),f||""}}r.renderer=o}if(s.tokenizer){const o=this.defaults.tokenizer||new Wa(this.defaults);for(const i in s.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const a=i,c=s.tokenizer[a],u=o[a];o[a]=(...d)=>{let f=c.apply(o,d);return f===!1&&(f=u.apply(o,d)),f}}r.tokenizer=o}if(s.hooks){const o=this.defaults.hooks||new yi;for(const i in s.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(i==="options")continue;const a=i,c=s.hooks[a],u=o[a];yi.passThroughHooks.has(i)?o[a]=d=>{if(this.defaults.async)return Promise.resolve(c.call(o,d)).then(h=>u.call(o,h));const f=c.call(o,d);return u.call(o,f)}:o[a]=(...d)=>{let f=c.apply(o,d);return f===!1&&(f=u.apply(o,d)),f}}r.hooks=o}if(s.walkTokens){const o=this.defaults.walkTokens,i=s.walkTokens;r.walkTokens=function(a){let c=[];return c.push(i.call(this,a)),o&&(c=c.concat(o.call(this,a))),c}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return gs.lex(t,n??this.defaults)}parser(t,n){return vs.parse(t,n??this.defaults)}}Rr=new WeakSet,zd=function(t,n){return(s,r)=>{const o={...r},i={...this.defaults,...o};this.defaults.async===!0&&o.async===!1&&(i.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),i.async=!0);const a=yc(this,Rr,o0).call(this,!!i.silent,!!i.async);if(typeof s>"u"||s===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(i.hooks&&(i.hooks.options=i),i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(s):s).then(c=>t(c,i)).then(c=>i.hooks?i.hooks.processAllTokens(c):c).then(c=>i.walkTokens?Promise.all(this.walkTokens(c,i.walkTokens)).then(()=>c):c).then(c=>n(c,i)).then(c=>i.hooks?i.hooks.postprocess(c):c).catch(a);try{i.hooks&&(s=i.hooks.preprocess(s));let c=t(s,i);i.hooks&&(c=i.hooks.processAllTokens(c)),i.walkTokens&&this.walkTokens(c,i.walkTokens);let u=n(c,i);return i.hooks&&(u=i.hooks.postprocess(u)),u}catch(c){return a(c)}}},o0=function(t,n){return s=>{if(s.message+=`
Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An error occurred:</p><pre>"+Ln(s.message+"",!0)+"</pre>";return n?Promise.resolve(r):r}if(n)return Promise.reject(s);throw s}};const $r=new sw;function mt(e,t){return $r.parse(e,t)}mt.options=mt.setOptions=function(e){return $r.setOptions(e),mt.defaults=$r.defaults,tm(mt.defaults),mt},mt.getDefaults=ku,mt.defaults=Cr,mt.use=function(...e){return $r.use(...e),mt.defaults=$r.defaults,tm(mt.defaults),mt},mt.walkTokens=function(e,t){return $r.walkTokens(e,t)},mt.parseInline=$r.parseInline,mt.Parser=vs,mt.parser=vs.parse,mt.Renderer=Ja,mt.TextRenderer=Iu,mt.Lexer=gs,mt.lexer=gs.lex,mt.Tokenizer=Wa,mt.Hooks=yi,mt.parse=mt,mt.options,mt.setOptions,mt.use,mt.walkTokens,mt.parseInline,vs.parse,gs.lex;const rw=e=>{let t=e.replace(/\r\n/g,`
`).replace(/\r/g,`
`);const n=/\\{1,2}\[\s*([\s\S]*?)\s*\\{1,2}\]/g;t=t.replace(n,(r,o)=>`<div class="math-block"><code>${o.trim().replace(/\n\s*/g," ").replace(/\s+/g," ")}</code></div>`);const s=/\\{1,2}\(\s*(.*?)\s*\\{1,2}\)/g;return t=t.replace(s,(r,o)=>`<code class="math-inline">${o.trim()}</code>`),t},ow=e=>{const t=e.trim();return/^\d+\.$/.test(t)};mt.setOptions({gfm:!0,breaks:!0,sanitize:!1});const Xa=(e,{separate:t=!0}={})=>{if(typeof e=="string"){const n=e.trim();if(ow(n))return[`<p>${n}</p>`];if(Jp(e))return[`<p class="js-blocked-content">${Zp(e)}</p>`];try{let s=rw(e);s=s.replace(/\[([^\]]*\|[^\]]*)\]/g,(c,u)=>`[${u.replace(/\|/g,"/")}]`);const r=mt(s),o=vx(r);if(!t)return[o];const i=/\n<p>/gi,a=o.split(i).filter(c=>c.trim().length>0).map((c,u)=>u!==0&&!c.startsWith("<p>")?`<p>${c.trim()}`:c);return a.length===2&&a[0].includes("<h")?[a[0]+`
`+a[1]]:a}catch(s){return console.error("Error processing markdown:",s),[`<p class="processing-error">${Zp(e)}</p>`]}}return[]};async function Tr(e){const t=async()=>new Promise((n,s)=>{const r=new Image;r.onload=()=>{n({status:!0,message:"Hình ảnh hợp lệ",width:r.width,height:r.height})},r.onerror=()=>{s({status:!1,message:"URL hình ảnh không hợp lệ hoặc không thể tải được"})},r.src=e});try{return await t(e)}catch{return{status:!1,message:"URL hình ảnh không hợp lệ hoặc không thể tải được"}}}const ao=e=>typeof e=="function",Za=e=>{try{return JSON.parse(e),typeof e=="string"}catch{return!1}};function gm(e,t={}){const{title:n="",logo:s="",brand:r=""}=t;if(!e)return null;const o=JSON.parse(JSON.stringify(e)),i=a=>a.includes("{logo}")?(a=a.split("{logo}"),a=a.map(c=>c===""?`<img src='${s}'/>`:`<span>${c}</span>`),a.join("").replace(/{title}/g,n).replace(/{brand}/g,r).replace(/{category}/g,n).replace(/{product}/g,n)):a.replace(/{title}/g,n).replace(/{brand}/g,r).replace(/{category}/g,n).replace(/{product}/g,n);return o.product&&(o.product=o.product.map(a=>({...a,name:i(a.name),message:i(a.message)}))),o.category&&(o.category=o.category.map(a=>({...a,name:i(a.name),message:i(a.message)}))),o}function As(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function bi(e,t=!1){const n=history.pushState,s=history.replaceState,r=()=>{document.readyState==="complete"?e(window.location.href):window.addEventListener("load",()=>e(window.location.href),{once:!0})};history.pushState=function(){n.apply(this,arguments),r()},history.replaceState=function(){s.apply(this,arguments),r()},window.addEventListener("popstate",r),t&&r()}function Ya(e){const t=new URL(e),n={};for(const[s,r]of t.searchParams)n[s]=r;return n}function iw(e,t){try{const n=new URL(e);return Object.entries(t).forEach(([s,r])=>{r!=null&&(n.searchParams.has(s)||n.searchParams.append(s,r))}),n.toString()}catch(n){return console.error("Invalid URL:",n),e}}const vm=(e,t="vi-VN")=>new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0,useGrouping:!0}).format(e),Pu=e=>e!==null&&typeof e=="object";function yn(e){if(typeof e=="string")try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null)return t}catch{return e}return e}function el(e){const t=new Date;t.setDate(t.getDate()+e);const n=s=>String(s).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function aw(e=typeof window<"u"?window.location.search:""){if(!e)return null;const t=new URLSearchParams(e.startsWith("?")?e:`?${e}`);return t.get("locale")||t.get("lang")||null}function lw(e=typeof window<"u"?window.location.pathname:""){return/^\/embed\//.test(e)}function cw(e=typeof window<"u"?window.location.pathname:""){const t=e.split("/").filter(n=>n!=="");return t.length===1||t.length===2&&t[1]==="widget"}function uw(e=typeof window<"u"?window.location.pathname:""){return lw(e)||cw(e)}const ym=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),bm=(e,t="",n=null)=>{if(n||(n=document.getElementById("easychatgpt-widget")),!n){console.warn("⚠️ applyAllStyles: Root element not found");return}Object.keys(e).forEach(s=>{const r=e[s],o=`--${t}${ym(s)}`;typeof r=="object"&&!Array.isArray(r)&&r!==null?bm(r,`${t}${ym(s)}-`,n):n.style.setProperty(o,r)})},_m=(e,t)=>(Object.keys(t).forEach(n=>{const s=e[n],r=t[n];typeof s=="object"&&s&&typeof r=="object"&&r&&!Array.isArray(s)&&!Array.isArray(r)?e[n]=_m({...s},r):e[n]=r}),e);function lo(e){return e===null||typeof e!="object"?e:JSON.parse(JSON.stringify(e))}function co({title:e,image:t,source:n,isImageValid:s,cartUrl:r="/cart",hideCheckout:o=!1}){const i=o?"":`<a class="checkout-link" href="${window.location.origin+r}"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" size="18" class="lucide lucide-shopping-bag-icon mr-1"><path d="M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z"></path><path d="M3 6h18"></path><path d="M16 10a4 4 0 0 1-8 0"></path></svg>Thanh toán ngay</a>`;return`<div class="ecg-cart-success"><a class="product-image" href="${n}"><img src="${t}" alt="${e}" class="${s?"thumbnail":"thumbnail error"}" /></a><div><div class="notify-success"><div>Đã thêm vào giỏ hàng</div></div><a class="product-title" href="${n}">${e}</a>${i}</div></div>`}function dw(e=[],t){const n=lo(e);return n.sort((s,r)=>s.sender_type===t&&r.sender_type===t?(parseInt(s.id)||0)-(parseInt(r.id)||0):0),n}function ys(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.sender_type==="assistant"){let s=t+1;if(s<e.length){const r=e[s];r.sender_type==="user"?n.is_last_assistant_message=!0:r.sender_type==="assistant"&&(r.content_type==="cards"||r.content_type==="product_cards"?(n.is_last_assistant_message=!0,r.is_last_assistant_message=!0):n.is_last_assistant_message=!1)}else n.is_last_assistant_message=!0}}return e}function _i(e){if(!e||e.length===0)return[];const t=r=>/^[-*•]\s/.test(r.trim()),n=[];let s=0;for(;s<e.length;)if(t(e[s])){let r=[e[s]];for(s++;s<e.length&&t(e[s]);)r.push(e[s]),s++;n.push(r.join(`
`))}else{let r=[e[s]];if(s++,s<e.length&&t(e[s]))for(;s<e.length&&t(e[s]);)r.push(e[s]),s++;n.push(r.join(`
`))}return n}function fw({name:e,phone:t,email:n,address:s,items:r,shopName:o}){const i=(r||[]).map(c=>{const u=c.source;let d="";if(u){const g=u.includes("?")?"&":"?";d=`${u}${g}utm_source=easyai`}const f=c.price?et(c.price,{currency:c.currency}):"",h=[f?`Giá: ${f}`:"",`Số lượng: ${c.quantity||1}`].filter(Boolean).join(" - ");return`<div class="eai-order-item">${c.image?`<div class="eai-order-item-img"><img src="${c.image}" alt="${c.title}" /></div>`:""}<div class="eai-order-item-info"><div class="eai-order-item-name">${d?`<a href="${d}" target="_blank">${c.title}</a>`:c.title}</div><div class="eai-order-item-meta">${h}</div></div></div>`}).join(""),a=[];return e&&a.push(`<div><span>Họ tên:</span> <strong>${e}</strong></div>`),t&&a.push(`<div><span>SĐT:</span> <strong>${t}</strong></div>`),n&&a.push(`<div><span>Email:</span> <strong class="eai-order-email">${n}</strong></div>`),s&&a.push(`<div><span>Địa chỉ:</span> <strong class="eai-order-address">${s}</strong></div>`),`<div class="eai-order-summary"><div class="eai-order-summary-inner"><h3 class="eai-order-title">🎉 Đặt hàng thành công!</h3><p class="eai-order-desc">Đơn hàng của bạn đang được hệ thống xử lý và sẽ sớm có nhân viên liên hệ xác nhận.</p><div class="eai-order-section"><div class="eai-order-section-title">Thông tin đặt hàng</div><div class="eai-order-info">${a.join("")}</div></div><div class="eai-order-section"><div class="eai-order-section-title">Đơn hàng</div><div class="eai-order-list">${i}</div></div></div></div>`}const hw="https://console.easyaichat.app",pw=async(e,t={})=>{try{const n=t.apiHost||hw,s=!!t.preview,r=t.workspaceUuid||null,o=window.location.host,i={preview:s,domain:o};e?i.handle=e:r&&(i.workspaceUuid=r);const{data:a}=await St.get(`${n}/api/workspaces/widget`,{params:i,headers:{"X-Easy-Ai-User-Id":Qs()}});!e&&(a!=null&&a.handle)&&(e=a.handle);const c=a.config,u=_m(c,t);return bm(u.ui,"ui-"),a.config=u,a}catch(n){console.error(n)}},U=dt({bot:null,handle:null,conversationId:null,apiDomain:"https://console.easyaichat.app",appDomain:"https://widget.geteasy.ai",forms:{},isOpenForm:!1,isSuccessForm:!1,totalFormItems:0,selectedForm:null,localStorageFormOrder:null,isOpenFormContact:!1,isSuccessFormContact:!1,cart:null,user:null,token:null});Pe(()=>U.selectedForm,e=>{var t;if(((t=e==null?void 0:e.items)==null?void 0:t.length)>0){let n=0;e.items.forEach(s=>{n=n+Number(s.quantity)}),U.totalFormItems=n}else U.totalFormItems=0},{immediate:!0}),Pe(()=>U.handle,()=>{const e=JSON.parse(localStorage.getItem("easychatgpt_conversations"))||{};Object.values(e).length>0&&(U.conversationId=Object.values(e)[0])});const xm={vi:{chat:{placeholder:"Nhập tin nhắn...",typing:"Đang soạn tin nhắn...",typingWithAgent:"{name} đang soạn tin nhắn...",scrollToBottom:"Cuộn xuống cuối",quickPrompts:"Gợi ý nhanh",quickReplyPlaceholder:"Viết tin nhắn...",quickReplyDefault:"Bạn cần hỗ trợ nhanh? 💬 Gõ ngay câu hỏi vào đây nhé!",quickReplyCta:"Tư vấn ngay",reply_to_message:"Trả lời",replying_to:"Đang trả lời",cancel_reply:"Hủy trả lời",original_message_unavailable:"Tin nhắn gốc không còn khả dụng",reply_context:{you_replied_to_yourself:"Bạn đã trả lời chính mình",you_replied_to:"Bạn đã phản hồi",replied_to_themselves:"đã phản hồi chính mình",replied_to_you:"đã phản hồi bạn"},quote_media:{image:"Hình ảnh",gif:"GIF",video:"Video",audio:"Âm thanh",file:"Tệp",sticker:"Sticker",attachment:"Tệp"}},menu:{home:"Trang chủ",messages:"Nhắn tin",help:"Trợ giúp",orders:"Đơn hàng"},help:{title:"Trợ giúp",faq:"Câu hỏi thường gặp",documents:"Tài liệu hữu ích"},survey:{rate:"Đánh giá",closeRate:"Đóng đánh giá",thanksTitle:"Cảm ơn bạn đã phản hồi",thanksBody:"Chúng tôi sẽ xem xét và cải thiện dịch vụ <br /> dựa trên góp ý của bạn",detailPlaceholder:"Mô tả chi tiết (tối đa 300 ký tự)",submit:"Gửi phản hồi",ratingVeryBad:"Rất tệ",ratingBad:"Tệ",ratingAverage:"Bình thường",ratingGood:"Tốt",ratingExcellent:"Rất tốt",website:{title:"Đánh giá trải nghiệm website",description:"Phản hồi của bạn rất quan trọng giúp chúng tôi <br /> cải thiện trang web.",meetingTitle:"Đánh giá trải nghiệm <br /> Trợ lý Tóm tắt cuộc họp",meetingDescription:"Phản hồi của bạn rất quan trọng giúp chúng tôi <br /> cải thiện sản phẩm.",issues:{websiteSpeed:"Tốc độ website",accountLogin:"Đăng nhập tài khoản",productSearch:"Tìm kiếm sản phẩm",addToCart:"Cho hàng vào giỏ hàng",productPrice:"Giá sản phẩm",customerService:"Dịch vụ khách hàng",other:"Khác",createChatbot:"Tạo AI chatbot",trainChatbot:"Huấn luyện AI chatbot",serviceSearch:"Tìm kiếm dịch vụ",servicePrice:"Giá dịch vụ",integration:"Khả năng tích hợp",ui:"Giao diện người dùng",transcriptAccuracy:"Độ chính xác của bản ghi (transcript)",summaryQuality:"Chất lượng bản tóm tắt",websiteUi:"Giao diện website",orderFlow:"Thao tác đặt hàng",userAccount:"Tài khoản người dùng"}},order:{title:"Đánh giá trải nghiệm mua hàng",description:"Phản hồi của bạn rất quan trọng giúp chúng tôi <br /> cải thiện trang web.",likeQuestion:"Bạn thích điều gì khi đặt hàng",difficultyQuestion:"Bạn gặp khó khăn gì khi đặt hàng",expectationQuestion:"Bạn mong đợi gì từ đơn hàng này",suggestionPlaceholder:"Đề xuất dành cho chúng tôi (tối đa 300 ký tự)",positive:{productPrice:"Giá sản phẩm",manyOffers:"Nhiều ưu đãi",easyPayment:"Thanh toán dễ dàng"},negative:{pageSpeed:"Tốc độ tải trang",findProduct:"Tìm sản phẩm",purchaseFlow:"Thao tác mua hàng",promoCode:"Mã khuyến mãi",paymentMethod:"Phương thức thanh toán",deliveryAddress:"Địa chỉ giao nhận"},expectations:{fastDelivery:"Giao nhanh",asDescribed:"Sản phẩm đúng mô tả",nicePackaging:"Đóng gói đẹp"}}},common:{back:"Quay lại",close:"Đóng",send:"Gửi",sent:"Đã gửi",received:"Đã nhận"},home:{sendMessage:"Gửi tin nhắn",quickLinks:"Liên kết nhanh",defaultWelcome:"👋 Xin chào! Em có thể giúp gì cho anh/chị?",newMessage:"Tin nhắn mới"},form:{placeholder:"Nhập ...",submitting:"Đang gửi...",submitRequest:"Gửi yêu cầu",submitSuccess:"Đã gửi thành công",submitSuccessCelebration:"Đã gửi thành công 🎉",submitSuccessInfo:"Gửi thông tin thành công",submitSuccessThanks:"Cảm ơn bạn! Thông tin của bạn đã được gửi đi.",bookingSuccess:"Đặt lịch thành công",validation:{required:"{label} là bắt buộc",email:"{label} không hợp lệ",phone:"{label} không hợp lệ",min:"{label} phải có ít nhất {value} ký tự",max:"{label} không được vượt quá {value} ký tự"}},auth:{login:"Đăng nhập",continue:"Tiếp tục",verify:"Xác minh",logout:"Đăng xuất",account:"Tài khoản",orders:"Đơn hàng",phonePlaceholder:"Nhập số điện thoại",otpHint:"Mã xác thực (OTP) sẽ được gửi đến số điện thoại này để xác minh số điện thoại này là của bạn",requiredField:"Thông tin bắt buộc. Vui lòng nhập chính xác.",genericError:"Có lỗi xảy ra.",otpMaintenance:"OTP đang bảo trì. Vui lòng quay lại sau.",invalidPhone:"Số điện thoại không hợp lệ. Vui lòng thử lại.",personalInfo:"Thông tin cá nhân",fullName:"Họ và tên",birthday:"Ngày sinh",gender:"Giới tính",phone:"Số điện thoại",email:"Địa chỉ email"},product:{contact:"Liên hệ",chatZalo:"Chat zalo",contactHotline:"Liên hệ hotline",addToCart:"Thêm vào giỏ"},widget:{poweredBy:"Powered by",easyAi:"Easy AI",download:"Tải xuống",aiSuggestion:"AI đề xuất",feedbackSubmit:"Gửi phản hồi"},rcm:{youMayLike:"Có thể bạn sẽ thích",mayInterest:"Có thể bạn quan tâm",bundleProducts:"Sản phẩm mua kèm",offer:"Ưu đãi",claimOffer:"Nhận ưu đãi",freeShippingReward:"Bạn đã được thưởng",freeShipping:"Miễn phí vận chuyển",addMore:"Chọn thêm",comboTitle:"Ưu đãi mua kèm dành cho bạn",originalTotal:"Tổng tiền gốc:",saved:"Tiết kiệm:",total:"Tổng tiền:",flashSaleEnded:"Chương trình đã kết thúc",registerGoodPrice:"Đăng ký nhận giá tốt",fewSlotsLeft:"Còn vài suất",customersViewingPrefix:"Có ",customersViewingSuffix:"khách đang xem.",customer:"Khách hàng",time:"Thời gian",hour:"Giờ",minute:"Phút",second:"Giây"},voice:{live:"Đang phát trực tiếp",voiceMessage:"Tin nhắn thoại",listening:"Đang nghe ...",delete:"Xóa",sendMessage:"Gửi tin nhắn",edit:"Chỉnh sửa"},marketplace:{askPlaceholder:"Nhập câu hỏi ✨",aiProcessing:"AI đang xử lý ...",aiRating:"AI đánh giá",aiSummary:"AI tóm tắt",summaryFromReviews:"tổng hợp từ các đánh giá mới nhất",productSummary:"tóm tắt sản phẩm"},message:{reactions:{love:"Yêu thích",like:"Thích",haha:"Haha",wow:"Wow",cry:"Buồn",dislike:"Không thích"}},order:{confirmFailed:"Xác nhận đơn thất bại, vui lòng thử lại."},cart:{addSuccess:"Thêm vào giỏ hàng thành công",addUnavailable:"Sản phẩm hiện không thể thêm vào giỏ hàng",genericError:"Có lỗi xảy ra, vui lòng thử lại sau"}},en:{chat:{placeholder:"Type a message...",typing:"Typing...",typingWithAgent:"{name} is typing...",scrollToBottom:"Scroll to bottom",quickPrompts:"Quick prompts",quickReplyPlaceholder:"Write a message...",quickReplyDefault:"Need quick help? 💬 Type your question here!",quickReplyCta:"Get advice now",reply_to_message:"Reply",replying_to:"Replying to",cancel_reply:"Cancel reply",original_message_unavailable:"Original message is no longer available",reply_context:{you_replied_to_yourself:"You replied to yourself",you_replied_to:"You replied to",replied_to_themselves:"replied to themselves",replied_to_you:"replied to you"},quote_media:{image:"Image",gif:"GIF",video:"Video",audio:"Audio",file:"File",sticker:"Sticker",attachment:"File"}},menu:{home:"Home",messages:"Messages",help:"Help",orders:"Orders"},help:{title:"Help",faq:"Frequently asked questions",documents:"Useful documents"},survey:{rate:"Rate",closeRate:"Close rating",thanksTitle:"Thank you for your feedback",thanksBody:"We will review and improve our service <br /> based on your feedback",detailPlaceholder:"Describe in detail (max 300 characters)",submit:"Send feedback",ratingVeryBad:"Very bad",ratingBad:"Bad",ratingAverage:"Average",ratingGood:"Good",ratingExcellent:"Excellent",website:{title:"Rate your website experience",description:"Your feedback helps us <br /> improve the website.",meetingTitle:"Rate your experience with <br /> the Meeting Summary Assistant",meetingDescription:"Your feedback helps us <br /> improve the product.",issues:{websiteSpeed:"Website speed",accountLogin:"Account login",productSearch:"Product search",addToCart:"Adding to cart",productPrice:"Product pricing",customerService:"Customer service",other:"Other",createChatbot:"Creating an AI chatbot",trainChatbot:"Training an AI chatbot",serviceSearch:"Service search",servicePrice:"Service pricing",integration:"Integration capability",ui:"User interface",transcriptAccuracy:"Transcript accuracy",summaryQuality:"Summary quality",websiteUi:"Website interface",orderFlow:"Checkout experience",userAccount:"User account"}},order:{title:"Rate your shopping experience",description:"Your feedback helps us <br /> improve the website.",likeQuestion:"What did you like about ordering?",difficultyQuestion:"What difficulties did you face when ordering?",expectationQuestion:"What do you expect from this order?",suggestionPlaceholder:"Suggestions for us (max 300 characters)",positive:{productPrice:"Product pricing",manyOffers:"Many offers",easyPayment:"Easy payment"},negative:{pageSpeed:"Page load speed",findProduct:"Finding products",purchaseFlow:"Purchase flow",promoCode:"Promo codes",paymentMethod:"Payment methods",deliveryAddress:"Delivery address"},expectations:{fastDelivery:"Fast delivery",asDescribed:"Product as described",nicePackaging:"Nice packaging"}}},common:{back:"Back",close:"Close",send:"Send",sent:"Sent",received:"Received"},home:{sendMessage:"Send message",quickLinks:"Quick links",defaultWelcome:"👋 Hello! How can I help you?",newMessage:"New message"},form:{placeholder:"Enter ...",submitting:"Sending...",submitRequest:"Submit request",submitSuccess:"Sent successfully",submitSuccessCelebration:"Sent successfully 🎉",submitSuccessInfo:"Submitted successfully",submitSuccessThanks:"Thank you! Your information has been sent.",bookingSuccess:"Booking confirmed",validation:{required:"{label} is required",email:"Invalid {label}",phone:"Invalid {label}",min:"{label} must be at least {value} characters",max:"{label} must not exceed {value} characters"}},auth:{login:"Sign in",continue:"Continue",verify:"Verify",logout:"Sign out",account:"Account",orders:"Orders",phonePlaceholder:"Enter phone number",otpHint:"A verification code (OTP) will be sent to this number to confirm it belongs to you",requiredField:"Required information. Please enter correctly.",genericError:"Something went wrong.",otpMaintenance:"OTP is under maintenance. Please try again later.",invalidPhone:"Invalid phone number. Please try again.",personalInfo:"Personal information",fullName:"Full name",birthday:"Date of birth",gender:"Gender",phone:"Phone number",email:"Email address"},product:{contact:"Contact",chatZalo:"Chat on Zalo",contactHotline:"Contact hotline",addToCart:"Add to cart"},widget:{poweredBy:"Powered by",easyAi:"Easy AI",download:"Download",aiSuggestion:"AI suggestion",feedbackSubmit:"Send feedback"},rcm:{youMayLike:"You may also like",mayInterest:"You may be interested in",bundleProducts:"Frequently bought together",offer:"Offer",claimOffer:"Claim offer",freeShippingReward:"You earned",freeShipping:"Free shipping",addMore:"Add more",comboTitle:"Bundle offer for you",originalTotal:"Original total:",saved:"Saved:",total:"Total:",flashSaleEnded:"This promotion has ended",registerGoodPrice:"Register for a good price",fewSlotsLeft:"Only a few slots left",customersViewingPrefix:"",customersViewingSuffix:"customers are viewing.",customer:"Customer",time:"Time",hour:"Hour",minute:"Min",second:"Sec"},voice:{live:"Live now",voiceMessage:"Voice message",listening:"Listening ...",delete:"Delete",sendMessage:"Send message",edit:"Edit"},marketplace:{askPlaceholder:"Ask a question ✨",aiProcessing:"AI is processing ...",aiRating:"AI review",aiSummary:"AI summary",summaryFromReviews:"summary from latest reviews",productSummary:"product summary"},message:{reactions:{love:"Love",like:"Like",haha:"Haha",wow:"Wow",cry:"Sad",dislike:"Dislike"}},order:{confirmFailed:"Could not confirm order. Please try again."},cart:{addSuccess:"Added to cart",addUnavailable:"This product cannot be added to cart",genericError:"Something went wrong. Please try again later"}}},xi="vi";function uo(e){return!e||typeof e!="string"?xi:e.trim().toLowerCase().split("-")[0]==="en"?"en":xi}function mw({isEmbed:e=!1,queryLang:t=null,botLanguage:n=null,forceEnFromPath:s=!1}={}){return s?"en":uo(e&&t?t:n??xi)}function fo(e,t){const n=uo(t);return e&&typeof e=="object"&&!Array.isArray(e)&&("en"in e||"vi"in e)&&Object.values(e).every(s=>s==null||typeof s=="string")?e[n]??e.en??e.vi??"":e}function gw(e,t){return t.split(".").reduce((n,s)=>n==null?void 0:n[s],e)}function vw(e,t={}){return!t||typeof e!="string"?e:e.replace(/\{(\w+)\}/g,(n,s)=>t[s]!==void 0?String(t[s]):`{${s}}`)}function wm(e){const t=uo(e),n=xm[t]||xm[xi];return function(r,o){const i=gw(n,r);return typeof i!="string"?r:vw(i,o)}}const km=dt({locale:"vi"});let Sm=wm("vi");const Xs={state:km,actions:{setLocale(e){const t=uo(e);km.locale=t,Sm=wm(t)},t(e,t){return Sm(e,t)}},getters:{}},yw={ui:{signature:{en:"Leading AI implementation partner for businesses"}},page:{home:{title:{en:"Hello 👋"},description:{en:"I'm Easy AI's assistant. How can I help you today? 😊"},quick_contact:[{type:"facebook",title:{en:"Facebook"},description:{en:"24/7 Support"}},{type:"zalo",title:{en:"Message on Zalo"},description:{en:"24/7 Support"}},{type:"linkedin",title:{en:"LinkedIn"},description:{en:null}},{type:"messenger",title:{en:"Message on Messenger"},description:{en:null}},{type:"hotline",title:{en:"Call us"},description:{en:"0977 62 60 65"}},{type:"email",title:{en:"Email us"},description:{en:"hello@geteasy.ai"}},{type:"youtube",title:{en:"YouTube"},description:{en:null}},{type:"tiktok",title:{en:"TikTok"},description:{en:null}},{type:"instagram",title:{en:"Instagram"},description:{en:null}}]},help_center:{faqs:[{question:{en:"Can the chatbot automatically answer customer questions?"},answer:{en:"Yes. It can answer customer questions automatically, flag issues like complaints, and summarize conversations so your team can follow up effectively."}},{question:{en:"Does the chatbot understand Vietnamese? Can it recommend products?"},answer:{en:"Yes. It understands and replies naturally in Vietnamese. It can also summarize product details and compare options to support purchase decisions."}},{question:{en:"Can the chatbot fully replace your support team?"},answer:{en:"Not entirely. It handles most requests, but human agents are still needed for complex cases or when customers ask to speak with a person."}},{question:{en:"Do you offer setup support?"},answer:{en:"Yes. We typically complete setup within about seven days and stay available whenever your team needs help."}}],documents:[{title:{en:"Affiliate Marketing Policy"}},{title:{en:"Terms of Service"}},{title:{en:"Privacy Policy"}},{title:{en:"Book a 1:1 consultation"}}]}},quickPrompt:{messages:[{content:{en:"Book a meeting"}},{content:{en:"Explore our plans"}},{content:{en:"Get a price quote"}},{content:{en:"View job openings"}}]},initialMessage:{messages:[{content:{en:"Hello! I'm Easy AI's assistant 👋"}},{content:{en:"How can I help you today? 😊"}}]},widgets:[{type:"contact",name:{en:"Contact"},fields:[{name:"full_name",label:{en:"Full name"},placeholder:{en:"Enter full name"}},{name:"phone",label:{en:"Phone number"},placeholder:{en:"Enter phone number"}},{name:"email",label:{en:"Email"},placeholder:{en:"Enter email"}},{name:"nganh_hang",label:{en:"Industry"},placeholder:{en:"Select industry"},options:{en:["Retail","Healthcare","Technology","Travel","Furniture","Transportation & Logistics","Other"]}},{name:"demand",label:{en:"Request type"},placeholder:{en:"Select request type"},options:{en:["Consultation","Request a quote","Become a partner","Complaint","Technical support","Other"]}},{name:"note",label:{en:"Message"},placeholder:{en:"Enter your message"}}]},{type:"widget_form_render_pre_send",name:{en:"Collect information"},formHeaderTitle:{en:"Please enter your phone number to continue"},fields:[{name:"full_name",label:{en:"Full name"},placeholder:{en:"Enter full name"}},{name:"phone",label:{en:"Phone number"},placeholder:{en:"Enter phone number"}},{name:"confirm",label:{en:'I understand and agree that personal data, location, and conversations are used to improve services in accordance with the current <a href="https://geteasy.ai/chinh-sach-quyen-rieng-tu" target="_blank">privacy policy</a>.'}}]}]},bw={page:{home:{title:{en:"Hi 👋 Easy AI assistant"},description:{en:"Ask how to get started, train your AI, connect channels, or use LiveChat — I'll guide you from the official docs."}},help_center:{faqs:[{question:{en:"I'm new — what should I do first?"},answer:{en:"Log in to the Easy AI Admin, then complete 5 steps: (1) AI Agent → + Add AI Agent — create your first assistant. (2) Data sources — add your website, documents, or Q&A pairs. (3) Sandbox — test chat and refine answers before going live. (4) Settings → Channel integrations — connect Website, Messenger, Instagram, or Zalo and assign an AI Agent. (5) Inbox and Dashboard — monitor conversations and measure performance. It does not need to be perfect at first: go live with basic data, then add Q&A based on real customer questions."}},{question:{en:"Where do I train the AI Agent?"},answer:{en:"Open the agent's Data sources. You get Statistics (quality overview) and three knowledge sources: Links (crawl website URLs/sitemap), Sample Q&A (manual pairs or bulk import — most accurate), Documents (PDF, DOCX, etc.). Each item moves through statuses: Pending → Training → Trained (ready for the AI); No content or Failed means retrain after fixing the source. Link count and document storage limits depend on your plan. After training, test in Sandbox before trusting answers on live channels."}},{question:{en:"How do I connect Website, Messenger, or Zalo?"},answer:{en:"Go to Settings → Channel integrations (filter Chat channels / E-commerce / Apps). Typical flow: (1) Connect the channel — sign in to Facebook for Messenger/Instagram; connect Zalo OA or scan QR for Zalo; for Website, add allowed domains then paste the embed code (the widget only works on listed domains). (2) Assign one AI Agent to the chat channel so that agent replies. (3) Turn on active mode when ready for real customers (off = trial). Whether the AI auto-replies also depends on the agent's Conversation settings."}},{question:{en:"What is LiveChat (Inbox) for?"},answer:{en:"Inbox brings omnichannel conversations into one place. The AI Agent replies first; agents take over (LiveChat) in the same window when needed. Three columns: left — filters All / Open / Resolved / Closed and the Tickets area; center — read/reply, Join conversation to take over, toggle Auto-reply off to stop the AI for that thread; right — CSAT, labels, orders (you can create orders in chat), linked CDP profile. In trial mode, the AI only handles registered testers (send Hi AI). On Messenger, you can reply within 24 hours of the customer's last message; after that, wait for them to message again or continue on Meta Business."}},{question:{en:"How are Tickets different from chat?"},answer:{en:"A normal chat is a quick question answered in the thread. A Ticket is a tracked support request with status — use it when you need multiple steps, multiple people, or tracking until resolution (complaints, warranty, order issues). Tickets live in Inbox, in the Tickets area on the left. Filters: All, Mine, Open, Pending, Resolved. Each ticket has an ID, priority, assignee, linked conversation, labels, and internal notes (customers cannot see them). Create tickets only when you must track an issue to completion — keep the queue clean."}},{question:{en:"What does CRM / CDP do?"},answer:{en:"The CDP (Customer Data Platform) unifies customer interactions across channels into 360° profiles: contact info, chat history, orders, custom attributes, journey stage, and owner. Four main areas: Customer profiles, Segments (static / automated / RFM / AI-suggested), Collection forms, and Configuration (data collection, auto-assign owner, journeys). Data comes from Inbox, widget forms, in-chat orders, marketplace sync, and collection settings. Value flow: data → segment the right groups → campaigns / Marketing Workflows."}},{question:{en:"Where do I start with Marketing Automation?"},answer:{en:"Marketing Automation sends messages and follows up at the right time on Email, ZNS, Zalo, Messenger, Instagram, and Website — targeting CDP Segments or events (messages, forms, status changes). Five main areas: Workflow (drag-and-drop journeys), Message templates, Categories (organize workflows), ZNS (Zalo), and Subscribers (Marketing opt-in — not your full customer list; profiles stay in CDP). Suggested order: (1) prepare segments / Messenger subscribers, (2) create channel-specific templates (ZNS needs OA and Zalo-approved templates), (3) categories if needed, (4) build a Workflow and test on a small group, (5) review Run history. Messenger Marketing Messages may wait 24+ hours for Meta — do not duplicate runs just because sending is delayed."}}],documents:[{title:{en:"Create an AI Agent — add an assistant, crawl your site, and train"},link:{en:"https://console.geteasy.ai/user-guide/ai-agent-livechat/create-an-ai-agent"}},{title:{en:"Training the AI Agent — Links, Sample Q&A, Documents, and statuses"},link:{en:"https://console.geteasy.ai/user-guide/ai-agent-livechat/training-the-ai-agent"}},{title:{en:"Sandbox & Live demo — test chat and preview the customer widget"},link:{en:"https://console.geteasy.ai/user-guide/ai-agent-livechat/sandbox-live-demo"}},{title:{en:"LiveChat — Inbox — omnichannel conversations and agent handoff"},link:{en:"https://console.geteasy.ai/user-guide/ai-agent-livechat/livechat-inbox"}},{title:{en:"Channels & Integrations overview — chat, ecommerce, and apps"},link:{en:"https://console.geteasy.ai/user-guide/channels/overview"}},{title:{en:"Website widget — allowed domains and embed code for your site"},link:{en:"https://console.geteasy.ai/user-guide/channels/website-widget"}},{title:{en:"What is a Ticket? — tracked support cases with assignee and priority"},link:{en:"https://console.geteasy.ai/user-guide/ticket/overview"}},{title:{en:"What is CRM / CDP — 360° profiles, segments, forms, and settings"},link:{en:"https://console.geteasy.ai/user-guide/crm-cdp/what-is-cdp"}},{title:{en:"Marketing Automation overview — Workflows, templates, ZNS, subscribers"},link:{en:"https://console.geteasy.ai/user-guide/marketing-automation/overview"}},{title:{en:"Analytics overview — stats, conversion funnel, and customer journeys"},link:{en:"https://console.geteasy.ai/user-guide/analytics/overview"}}]}},quickPrompt:{messages:[{content:{en:"How do I get started with Easy AI?"}},{content:{en:"How do I create an AI Agent?"}},{content:{en:"How do I train with website & Q&A?"}},{content:{en:"How do I use Sandbox / Live demo?"}},{content:{en:"How do I connect Website / Messenger / Zalo?"}},{content:{en:"How do I use LiveChat (Inbox)?"}},{content:{en:"How are Tickets different from chat?"}},{content:{en:"Where do I start with CRM / CDP and Marketing?"}}]},initialMessage:{messages:[{content:{en:"Hi! I'm the Easy AI support assistant."}},{content:{en:"Pick a quick prompt below, or type your question."}}]}},_w={[ai]:yw,[w_]:bw};function tl(e){return e&&typeof e=="object"&&!Array.isArray(e)&&("en"in e||"vi"in e)&&Object.values(e).every(t=>t==null||typeof t=="string")}function xw(e){return e&&typeof e=="object"&&!Array.isArray(e)&&("en"in e||"vi"in e)&&Object.values(e).every(t=>t==null||Array.isArray(t))}function Mu(e,t="en"){if(tl(e))return e[t]??e.en??null;if(Array.isArray(e))return e.map(n=>Mu(n,t));if(e&&typeof e=="object"){const n={};for(const s of Object.keys(e))n[s]=Mu(e[s],t);return n}return e}function Ou(e,t){if(!(e==null||t==null)){if(Array.isArray(e)&&Array.isArray(t)){t.forEach((n,s)=>{e[s]!=null&&(n&&typeof n=="object"&&typeof e[s]=="object"?Ou(e[s],n):e[s]=n)});return}if(typeof e=="object"&&!Array.isArray(e)&&typeof t=="object"&&!Array.isArray(t))for(const n of Object.keys(t)){const s=t[n];n in e&&(e[n]!=null&&typeof e[n]=="object"&&s!=null&&typeof s=="object"?Ou(e[n],s):e[n]=s)}}}function Hn(e,t,n,s){if(t[n]){if(tl(t[n])){const r=t[n][s]??t[n].en;e[n]&&typeof e[n]=="object"&&!Array.isArray(e[n])?e[n][s]=r:e[n]=r;return}if(xw(t[n])){const r=t[n][s]??t[n].en;(!e[n]||typeof e[n]!="object")&&(e[n]={}),e[n][s]=r}}}function ww(e,t,n="en"){!Array.isArray(e)||!Array.isArray(t)||t.forEach((s,r)=>{e[r]&&(Hn(e[r],s,"title",n),Hn(e[r],s,"link",n))})}function kw(e,t,n="en"){!Array.isArray(e)||!Array.isArray(t)||t.forEach((s,r)=>{e[r]&&(Hn(e[r],s,"question",n),Hn(e[r],s,"answer",n))})}function Sw(e,t,n="en"){if(!(!Array.isArray(e)||!Array.isArray(t)))for(const s of t){const r=e.find(o=>o.type===s.type);if(r&&(s.name&&(r.name=tl(s.name)?s.name[n]??s.name.en:s.name),s.formHeaderTitle&&(r.formHeaderTitle=tl(s.formHeaderTitle)?s.formHeaderTitle[n]??s.formHeaderTitle.en:s.formHeaderTitle),!(!Array.isArray(s.fields)||!Array.isArray(r.fields))))for(const o of s.fields){const i=r.fields.find(a=>a.name===o.name);i&&(Hn(i,o,"label",n),Hn(i,o,"placeholder",n),Hn(i,o,"hint",n),Hn(i,o,"options",n))}}}function Cw(e,t){var i,a;if(!(e!=null&&e.config)||t!=="en")return;const n=_w[e.handle];if(!n)return;const{widgets:s,page:r,...o}=n;if(Ou(e.config,Mu(o,"en")),r!=null&&r.home&&((i=e.config.page)!=null&&i.home)){Hn(e.config.page.home,r.home,"title","en"),Hn(e.config.page.home,r.home,"description","en");const c=e.config.page.home.quick_contact,u=r.home.quick_contact;Array.isArray(c)&&Array.isArray(u)&&u.forEach((d,f)=>{c[f]&&(Hn(c[f],d,"title","en"),Hn(c[f],d,"description","en"))})}r!=null&&r.help_center&&((a=e.config.page)!=null&&a.help_center)&&(kw(e.config.page.help_center.faqs,r.help_center.faqs,"en"),ww(e.config.page.help_center.documents,r.help_center.documents,"en")),Sw(e.widgets,s,"en")}const $w=()=>/^\/(en|ja)(\/|$)/.test(window.location.pathname),Tw="https://widget.geteasy.ai"+"/public/cs-avatar.png",Aw=["home","conversations","helps","order_tracking"],Ke=dt({bot:null,handle:null,groupConversationId:null,isOpenLeadForm:!1,dropdownLockCount:0,chatContainerRef:null,rootMarketplaceRef:null,chatState:{isOpen:!1,visitor:null,viewTab:"conversations",unreadMessageCount:0,lastAssistantMessageId:null,lastUnreadMessage:null,lastMessageAgent:null,assistantProcessing:!1,shouldOpenChatScreen:!1},interactionState:{activeNotification:null,payload:null,demoSenderMode:"agent"},agent:{name:"Thành Nhân",avatar:Tw,isOnline:!0},isCheckInit:!1,isSurveyHidden:!1}),Ew={lockDropdown(){Ke.dropdownLockCount++},unlockDropdown(){Ke.dropdownLockCount=Math.max(0,Ke.dropdownLockCount-1)},showNotification(e,t={}){Ke.interactionState.activeNotification=e,Ke.interactionState.payload=t},hideNotification(){Ke.interactionState.activeNotification=null,Ke.interactionState.payload=null},setBot(e){var n;Ke.bot=e,this.setHandle(e.handle);const t=mw({isEmbed:uw(),queryLang:aw(),botLanguage:(n=e==null?void 0:e.config)==null?void 0:n.language,forceEnFromPath:(e==null?void 0:e.handle)===ai&&$w()});Xs.actions.setLocale(t),Cw(e,Xs.state.locale),U.bot=e,U.handle=e.handle},setHandle(e){Ke.handle=e},setGroupConversationId(e){Ke.groupConversationId=e||null},incrementUnreadMessageCount(){Ke.chatState.unreadMessageCount+=1,this.saveChatState()},resetUnreadMessageCount(){Ke.chatState.unreadMessageCount=0,Ke.chatState.lastUnreadMessage=null,Ke.chatState.lastMessageAgent=null,this.saveChatState()},resetChatState(){Ke.chatState.unreadMessageCount=0,Ke.chatState.lastUnreadMessage=null,Ke.chatState.lastAssistantMessageId=null,Ke.chatState.lastMessageAgent=null,this.saveChatState()},updateLastUnreadMessage(e){if(Ke.chatState.unreadMessageCount===0){Ke.chatState.lastUnreadMessage=null,this.saveChatState();return}if(!e||!Array.isArray(e)||e.length===0)return;const t=e.filter(s=>s.sender_type==="assistant"&&!s.is_welcome_message);if(t.length===0)return;const n=t[t.length-1];Ke.chatState.lastUnreadMessage={id:n.id,content_type:n.content_type,content:n.content,created_at:n.created_at},this.saveChatState()},setLastAssistantMessageId(e){e<10||(Ke.chatState.lastAssistantMessageId=e,this.saveChatState())},updateLastAssistantMessageIdFromMessages(e){if(e&&e.length>0){const t=[...e].reverse().find(n=>n.sender_type==="assistant");t&&t.id&&(Ke.chatState.lastAssistantMessageId=t.id,this.saveChatState())}},setLastMessageAgent(e){!e||e.sender_type!=="assistant"||!e.is_admin_reply||!e.sender||(Ke.chatState.lastMessageAgent={id:e.id,content:e.content,content_type:e.content_type,created_at:e.created_at,sender:e.sender},this.saveChatState())},resetLastMessageAgent(){Ke.chatState.lastMessageAgent=null,this.saveChatState()},handleMetricSubmit(e){try{const{handle:t,submission_id:n,source:s}=e.detail;t&&n&&window.rybbit.event("chatbot_widget_contact",{handle:t,submission_id:n,source:s})}catch(t){console.error("Error handling metric submit:",t)}},handleDispatchEvent(){window.addEventListener("metric-submit",this.handleMetricSubmit)},handleEventMessage(){window.addEventListener("message",e=>{var t;try{const n=e.data;if(!n||typeof n!="object")return;n.type==="submit-metric"&&n.submission_id&&(console.log("handleEventMessage submit-metric 01",n,window.rybbit),(t=window.rybbit)==null||t.event("chatbot_widget_contact",{handle:Ke.handle,submission_id:n.submission_id,source:n.source??"chatbot"}))}catch(n){console.error("Error handling message event:",n)}}),this.handleDispatchEvent()},async loadScriptTracking(){var i,a,c,u;const e=(a=(i=Ke.bot)==null?void 0:i.config)==null?void 0:a.metric_domains,t=window.location.hostname.replace(/^www\./,""),n=(e==null?void 0:e[t])||((u=(c=Ke.bot)==null?void 0:c.config)==null?void 0:u.easy_ai_metric_site_id);if(!n||document.querySelector(`script[data-site-id="${n}"]`))return;const r=document.createElement("script");r.src="https://metric.geteasy.ai/api/script.js",r.setAttribute("data-site-id",n),r.defer=!0,document.head.appendChild(r);async function o(){try{const{initMetricWebsiteFactory:d}=await Promise.resolve().then(()=>oM);window.rybbit&&(Qs(),x_(),await d())}catch(d){console.error("Failed to load metrics:",d)}}r.onload=d=>{setTimeout(()=>{o()},2e3)}},setSurveyHidden(){Ke.isSurveyHidden=!0,typeof localStorage<"u"&&localStorage.setItem(`survey_hidden_${Ke.handle}`,"true")},checkSurveyHidden(){typeof localStorage<"u"&&(Ke.isSurveyHidden=localStorage.getItem(`survey_hidden_${Ke.handle}`)==="true")},checkChatStateInit(){const t=localStorage.getItem("eac_chat_state");if(t)try{const n=JSON.parse(t);Ke.chatState={isOpen:As()?!1:n.isOpen||!1,visitor:n.visitor||null,viewTab:n.viewTab||"conversations",unreadMessageCount:n.unreadMessageCount||0,lastAssistantMessageId:n.lastAssistantMessageId||null,lastUnreadMessage:n.lastUnreadMessage||null,lastMessageAgent:n.lastMessageAgent||null,assistantProcessing:n.assistantProcessing||!1}}catch(n){console.error("Error parsing chat state from localStorage:",n),this.saveChatState()}else this.saveChatState();Ke.isCheckInit=!0,this.checkSurveyHidden()},saveChatState(){if(!Ke.isCheckInit)return;const e="eac_chat_state",t={...Ke.chatState};As()&&(t.isOpen=!1),localStorage.setItem(e,JSON.stringify(t))},updateChatState(e){var t,n;Ke.isCheckInit&&(Ke.chatState={...Ke.chatState,...e},Aw.includes(Ke.chatState.viewTab)||(Ke.chatState.viewTab="conversations"),Ke.chatState.isOpen&&Ke.chatState.unreadMessageCount>0&&(!((n=(t=Ke.bot)==null?void 0:t.config)!=null&&n.page&&Object.values(Ke.bot.config.page).some(o=>o&&o.enabled===!0))||Ke.chatState.viewTab==="conversations")&&(Ke.chatState.unreadMessageCount=0,Ke.chatState.lastUnreadMessage=null),Ke.chatState.shouldOpenChatScreen&&(Ke.chatState.shouldOpenChatScreen=!1),this.saveChatState())},async fetchBotInit(e,t={},n={}){const s=n.workspaceUuid||null;if(!e&&!s)return console.warn("Missing data: handle or workspaceUuid is required"),null;e&&this.setHandle(e);try{const r=await pw(e,{...t,workspaceUuid:s,...n});return r?(this.setBot(r),n.website&&![Bn,Un].includes(r.handle)&&this.loadScriptTracking(),this.checkChatStateInit(),r):void 0}catch(r){return console.error("Error fetch bot in store = ",r),null}}},Iw={handle:Z(()=>{var e;return(e=Ke.bot)==null?void 0:e.handle}),isAgentEnabled:Z(()=>{var e;return((e=Ke.bot)==null?void 0:e.agent_enabled)===!0})},ae={state:Ke,actions:Ew,getters:Iw},Pw=dt({user:null,token:null});Vr(Pw);const Cm=dt({selectedProduct:null,isOpenPanelVariants:!1}),$m={actions:{toggleOpenPanelVariants(e){Cm.isOpenPanelVariants=e},setSelectedProduct(e){Cm.selectedProduct=e}}},Rn=dt({message:null,type:null}),pn={state:Rn,actions:{success({message:e,duration:t=3e3}){Rn.message=e,Rn.type="success",setTimeout(()=>{Rn.message=null,Rn.type=null},t)},error({message:e,duration:t=3e3}){Rn.message=e,Rn.type="error",setTimeout(()=>{Rn.message=null,Rn.type=null},t)},warning({message:e,duration:t=3e3}){Rn.message=e,Rn.type="warning",setTimeout(()=>{Rn.message=null,Rn.type=null},t)}},getters:{}},Lu="https://widget.geteasy.ai",nl={ai_product_insight:()=>Promise.resolve().then(()=>lR),ai_summary_page_content:()=>Promise.resolve().then(()=>bR),ai_ask:()=>Promise.resolve().then(()=>lv),eac_image_gallery:()=>Promise.resolve().then(()=>qR),rcm_product_flash_sale:()=>Promise.resolve().then(()=>RD),rcm_product_recommendation:()=>Promise.resolve().then(()=>XD),rcm_flash_sale_register:()=>Promise.resolve().then(()=>Oj),rcm_combo:()=>Promise.resolve().then(()=>AN),rcm_combo_horizontal:()=>Promise.resolve().then(()=>GF),rcm_customer_list_modal:()=>Promise.resolve().then(()=>rq)};function Mw(e){return e?typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${n}`).join("; "):""}function wi(e,t,n={}){const s=document.querySelector(e);if(!s)return console.error(`Widget: Target element not found: ${e}`),null;if(!(t!=null&&t.type)||!nl[t.type])return console.error(`Widget: Invalid widget type: ${t.type}`),null;const r={shadowMode:"open",position:"top",props:{},...n},o=`eac-widget-${t.type.toLowerCase().replace(/_/g,"-")}`;if(document.getElementById(o))return null;if((r.position==="before"||r.position==="after")&&!s.parentNode)return console.error(`Widget: Cannot insert ${r.position} target element - no parent node found`),null;const i=document.createElement("div");switch(i.id=o,i.style.cssText=`background: transparent; ${Mw(n.style)}`,r.position){case"top":s.firstChild?s.insertBefore(i,s.firstChild):s.appendChild(i);break;case"bottom":s.appendChild(i);break;case"before":s.parentNode.insertBefore(i,s);break;case"after":s.nextSibling?s.parentNode.insertBefore(i,s.nextSibling):s.parentNode.appendChild(i);break;default:s.appendChild(i)}const a=i.attachShadow({mode:r.shadowMode}),c=document.createElement("div");c.className="eac-widget-mount",a.appendChild(c);const u=Wt({loader:nl[t.type],delay:0,timeout:5e3,onError:(v,_,w)=>{console.error("Widget: Failed to load component:",v),w()}}),d={widget:t,...r.props},f=Zr(u,d);let h=!1;const g=document.createElement("link");g.rel="stylesheet",g.href=`${Lu}/dist/widget/main.css`;const p=()=>{try{f.mount(c),h=!0}catch(v){console.error("Widget: Mount failed:",v)}};return g.onload=()=>{p()},g.onerror=()=>{p()},a.appendChild(g),{update(v,_={}){if(!h)return this;try{f.unmount();const w={widget:v,...r.props,..._},k=Zr(u,w);k.mount(c),this.app=k}catch(w){console.error("Widget: Update error:",w)}return this},remove(){try{h&&f.unmount(),i.remove()}catch(v){console.error("Widget: Remove error:",v)}}}}function Ow(e,t=0,n=null){const s="eac-image-gallery",r=document.getElementById(s);r&&r.remove();const o=document.createElement("div");o.id=s,o.style.cssText=`
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 99999999999;
background: transparent;
`,document.body.appendChild(o);const i=o.attachShadow({mode:"open"}),a=document.createElement("div");a.className="eac-gallery-mount",i.appendChild(a);const c=document.createElement("link");c.rel="stylesheet",c.href=`${Lu}/dist/widget/main.css`,i.appendChild(c);const u=Wt({loader:nl.eac_image_gallery,delay:0,timeout:5e3,onError:g=>{console.error("ImageGallery: Failed to load component:",g)}}),d=()=>{n&&n();try{f.unmount()}catch(g){console.error("ImageGallery: Unmount failed:",g)}o.remove()},f=Zr(u,{media:e,initialIndex:t,onRemove:d}),h=()=>{try{f.mount(a)}catch(g){console.error("ImageGallery: Mount failed:",g)}};return c.onload=h,c.onerror=h,{remove:d}}function Lw(e=[],t=null){const n="eac-customer-list-modal",s=document.getElementById(n);s&&s.remove();const r=document.createElement("div");r.id=n,r.style.cssText=`
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 99999999999;
background: transparent;
`,document.body.appendChild(r);const o=r.attachShadow({mode:"open"}),i=document.createElement("div");i.className="eac-modal-mount",o.appendChild(i);const a=document.createElement("link");a.rel="stylesheet",a.href=`${Lu}/dist/widget/main.css`,o.appendChild(a);const c=Wt({loader:nl.rcm_customer_list_modal,delay:0,timeout:5e3,onError:h=>{console.error("CustomerListModal: Failed to load component:",h)}}),u=()=>{t&&t();try{d.unmount()}catch(h){console.error("CustomerListModal: Unmount failed:",h)}r.remove()},d=Zr(c,{customers:e,onRemove:u}),f=()=>{try{d.mount(i)}catch(h){console.error("CustomerListModal: Mount failed:",h)}};return a.onload=f,a.onerror=f,{remove:u}}class Tm{constructor(t={}){$t(this,"executeCallbacks",(t,n)=>{t!==n&&this.callbacks.forEach(s=>{try{document.readyState==="complete"?s(t,n):document.addEventListener("DOMContentLoaded",()=>s(t,n),{once:!0})}catch(r){console.error("[URLChangeListener] Callback error:",r)}})});$t(this,"handleChange",(t=window.location.href)=>{const n=this.normalizeUrl(t),s=this.currentUrl;n!==s&&(this.currentUrl=n,this.executeCallbacks(n,s))});this.options={watchPath:!0,watchQuery:!1,ignoreParams:[],...t},this.callbacks=new Set,this.currentUrl=this.normalizeUrl(window.location.href),this.isActive=!1,this.originalPushState=null,this.originalReplaceState=null}normalizeUrl(t){try{const n=new URL(t,window.location.origin);let s="";if(this.options.watchPath&&(s+=n.pathname),this.options.watchQuery){const r=new URLSearchParams(n.search);this.options.ignoreParams.forEach(i=>r.delete(i));const o=r.toString();o&&(s+="?"+o)}return s}catch{return t}}start(){return this.isActive?this:(this.originalPushState=history.pushState,this.originalReplaceState=history.replaceState,history.pushState=(...t)=>{this.originalPushState.apply(history,t),this.handleChange(t[2]?new URL(t[2],window.location.origin).href:window.location.href)},history.replaceState=(...t)=>{this.originalReplaceState.apply(history,t),this.handleChange(t[2]?new URL(t[2],window.location.origin).href:window.location.href)},window.addEventListener("popstate",this.handleChange),this.isActive=!0,this)}stop(){return this.isActive?(this.originalPushState&&(history.pushState=this.originalPushState),this.originalReplaceState&&(history.replaceState=this.originalReplaceState),window.removeEventListener("popstate",this.handleChange),this.isActive=!1,this.originalPushState=null,this.originalReplaceState=null,this):this}on(t){if(typeof t!="function")throw new Error("Callback must be a function");return this.callbacks.add(t),this}off(t){return this.callbacks.delete(t),this}trigger(){return this.callbacks.forEach(t=>{try{t(this.currentUrl,null)}catch(n){console.error("[URLChangeListener] Trigger callback error:",n)}}),this}destroy(){return this.stop(),this.callbacks.clear(),this}get active(){return this.isActive}get current(){return this.currentUrl}get listenerCount(){return this.callbacks.size}}function Am(e,t=!1){const n=new Tm({watchPath:!0,watchQuery:!1}).on(e).start();return t&&setTimeout(()=>e(n.current,null),0),n}function ki(e,t=!1){const n=new Tm({watchPath:!0,watchQuery:!0}).on(e).start();return t&&setTimeout(()=>e(n.current,null),1e3),n}const Em="https://widget.geteasy.ai",Ct=dt({isInitialized:!1,isTestMode:!1,pageType:null,flash_sales:null,hot_sales:null,recently_viewed:null,also_bought:null,source_product:null,you_may_like:null,bought_together:null,signals:{viewing_now:0,views_7d:0,carts_today:0}}),Im=e=>{if(!e)return e;try{const t=new URL(e);return`${t.origin}${t.pathname}`}catch{return e.split("?")[0]}},Rw=e=>e&&`${Im(e)}?utm_source=easyai`,Dw="https://engine.geteasy.ai/api/recommendations",jw={"31c91fbc-38e2-4e84-868e-da29623b9505":e=>((e.properties??e).image??"").includes("media-new.laptop88.vn")},Ru=e=>{const t=e.properties??e,n=e.signals??{};return{id:t.id,name:t.name,image:t.image,link:Rw(t.url),sku:t.sku||null,price:Number(t.price)>0?et(Number(t.price)):"Liên hệ",originalPrice:Number(t.originalPrice)>0?et(Number(t.originalPrice)):null,discount:t.discount||null,sale_ends_at:n.sale_ends_at||null,stock_remaining:n.stock_remaining??null,stock_total:n.stock_total??null,viewing_now:n.viewing_now??0,sale_badge:n.sale_badge||null,ordered_count:n.ordered_count??0,ordered_by:n.ordered_by??[]}},Nw=async(e,{include:t,itemUrl:n,userId:s})=>{const r=new URLSearchParams({include:t.join(","),workspace_uuid:e});n&&r.set("item_url",Im(n)),s&&r.set("identified_user_id",s),t.includes("flash_sale")&&r.set("hide_sold_out","true");const o=await fetch(`${Dw}?${r}`,{headers:{"X-API-Key":"test"}});if(!o.ok)throw new Error(`[EAI RCM] HTTP ${o.status}`);return o.json()},Fw={"31c91fbc-38e2-4e84-868e-da29623b9505":{homepage:()=>window.location.pathname==="/"||!!document.querySelector(".home-page"),product:()=>!!document.querySelector(".product-detail"),cart:()=>/^\/cart/.test(window.location.pathname)||!!document.querySelector(".view-cart"),checkout:()=>/^\/checkout/.test(window.location.pathname)},"18193462-6eba-4fc1-8da9-536e1424ce51":{homepage:()=>window.location.pathname==="/"||window.location.pathname==="/chuyen-dung",product:()=>/^\/[a-z0-9-]+-p-\d+$/.test(window.location.pathname),category:()=>/^\/[a-z0-9-]+-c-\d+\/?$/.test(window.location.pathname),checkout:()=>/^\/don-hang\/?$/.test(window.location.pathname)},"74af8f88-1745-4f44-9726-e7082e53e321":{homepage:()=>window.location.pathname==="/"||window.location.pathname==="/chuyen-dung",product:()=>/^\/[a-z0-9-]+-p-\d+$/.test(window.location.pathname),category:()=>/^\/[a-z0-9-]+-c-\d+\/?$/.test(window.location.pathname),checkout:()=>/^\/don-hang\/?$/.test(window.location.pathname)}},Pm={homepage:{include:["flash_sale","recently_viewed"],rcm_product_flash_sale:{selector:[".eai-homepage-flashsale"],position:"top",props:{phoneNumber:"19002098",brandLogo:Em+"/logo_rangdong.webp",ctaKey:"contact"},dataKey:"flash_sales",style:{margin:"0px auto",padding:"6px 0px 32px 0px",width:"100%",maxWidth:"1224px",backgroundColor:"transparent"}},rcm_product_recommendation:{selector:[".eai-homepage-recommendation"],position:"top",props:{titleKey:"rcm.mayInterest",breakpoints:{768:{slidesPerView:2.5},1024:{slidesPerView:3.2},1280:{slidesPerView:4}}},dataKey:"recently_viewed",style:{margin:"0px auto",padding:"6px 0px 32px 0px",width:"100%",maxWidth:"1224px",backgroundColor:"transparent"}}},product:{include:["flash_sale"],rcm_flash_sale_register:{selector:[".eai-product-flashsale"],position:"top",dataKey:"flash_sales",style:{width:"100%",maxWidth:"1224px",margin:"12px auto 20px"}},rcm_product_recommendation:{selector:[".eai-product-recommendation"],position:"top",props:{titleKey:"rcm.bundleProducts",breakpoints:{768:{slidesPerView:1.5},1024:{slidesPerView:1.5},1280:{slidesPerView:1.5}}},dataKey:"also_bought",style:{width:"100%",maxWidth:"1224px",margin:"0px auto",padding:"16px"}}}},sl={"31c91fbc-38e2-4e84-868e-da29623b9505":{homepage:{include:["flash_sale","hot_sale","recently_viewed"],rcm_product_flash_sale:{selector:[".banner-sale"],position:"after",props:{phoneNumber:"02471069999",brandLogo:Em+"/logo_lt88.png",ctaKey:"available"},dataKey:"flash_sales",style:{margin:"32px auto",padding:"0px",width:"100%",maxWidth:"1200px",backgroundColor:"transparent"}},rcm_product_recommendation:{selector:[".banner-sale"],position:"before",props:{titleKey:"rcm.mayInterest",breakpoints:{768:{slidesPerView:2.5},1024:{slidesPerView:3.2},1280:{slidesPerView:4}}},dataKey:"recently_viewed",style:{margin:"32px auto",padding:"0px 6px",width:"100%",maxWidth:"1200px",backgroundColor:"transparent"}}},product:{include:["flash_sale","also_bought"],rcm_flash_sale_register:{selector:[".product-combo-config"],position:"before",dataKey:"flash_sales",style:{width:"100%",margin:"8px auto"}},rcm_combo:{selector:[".btn-add-cart"],position:"after",dataKey:"also_bought",style:{width:"100%",margin:"24px auto 16px auto"}},rcm_combo_horizontal:{selector:[".content-desc-detail"],position:"before",dataKey:"also_bought",style:{width:"100%",margin:"24px auto"}}}},"74af8f88-1745-4f44-9726-e7082e53e321":Pm,"18193462-6eba-4fc1-8da9-536e1424ce51":Pm},Mm={"74af8f88-1745-4f44-9726-e7082e53e321":{delay:500},"18193462-6eba-4fc1-8da9-536e1424ce51":{delay:500}};let rl=[],Om=null;const qw=()=>{rl.forEach(e=>{try{e.remove()}catch{}}),rl=[]},ol="easy_ai_test_mode",zw=["rcm_combo"],il=["re_qua_troi","khong_dau_re_hon","re_nhat_roi","gia_re_giat_minh","khong_dau_re_bang","re_nhat_thi_truong"],Bw=e=>e.map((t,n)=>({...t,badge:il[n%il.length]})),Lm=e=>e.map((t,n)=>({...t,badge:il[n%il.length],endDate:t.sale_ends_at||el(1),flashSaleFrom:el(-1),flashSaleTo:t.sale_ends_at||el(1)})),an={state:Ct,actions:{checkTestMode(){const e=new URLSearchParams(window.location.search).get(ol);e==="true"&&localStorage.setItem(ol,"true"),e==="false"&&localStorage.removeItem(ol),Ct.isTestMode=localStorage.getItem(ol)==="true"},detectPageType(e){const t=Fw[e];if(!t)return null;for(const[n,s]of Object.entries(t))try{if(s())return n}catch{}return null},async fetchAndStore(e,t,n){var c,u,d,f,h,g,p;const s=t||Qs(),r=Ct.pageType,o=sl[e];if(!o)return;const i=o[r],a=(i==null?void 0:i.include)||(r==="homepage"?["flash_sale","hot_sale","recently_viewed"]:["flash_sale","also_bought"]);try{const v={include:a,userId:s};r==="product"&&(v.itemUrl=n||window.location.href);const _=await Nw(e,v),w=jw[e]??(()=>!0);Ct.flash_sales=(c=_.flash_sale)!=null&&c.length?Lm(_.flash_sale.filter(w).map(Ru)):null,Ct.hot_sales=(u=_.hot_sale)!=null&&u.length?Lm(_.hot_sale.filter(w).map(Ru)):null,Ct.recently_viewed=(d=_.recently_viewed)!=null&&d.length?Bw(_.recently_viewed.filter(w).map(Ru)):null,Ct.also_bought=(f=_.also_bought)!=null&&f.length?_.also_bought.filter(w):null,Ct.source_product=_.source_product??null,((p=(g=(h=_.flash_sale)==null?void 0:h[0])==null?void 0:g.signals)==null?void 0:p.viewing_now)!=null&&(Ct.signals.viewing_now=_.flash_sale[0].signals.viewing_now)}catch(v){console.error("[EAI RCM] ❌ fetchAndStore:",v)}},injectWidgets(e){var t,n;try{const s=sl[e];if(!s)return;const r=Ct.pageType||Object.keys(s)[0],o=s[r];if(!o)return;for(const[i,a]of Object.entries(o)){if(i==="include"||e==="31c91fbc-38e2-4e84-868e-da29623b9505"&&r==="product"&&i==="rcm_combo_horizontal"&&document.getElementById("comboset")||zw.includes(i)&&!Ct.isTestMode)continue;const c=a.selector.find(f=>document.querySelector(f))||null;if(!c)continue;if(i==="rcm_flash_sale_register"){const f=window.location.pathname;if(!((t=Ct.flash_sales)==null?void 0:t.some(p=>{if(!p.link)return!1;try{return new URL(p.link,window.location.origin).pathname===f}catch{return p.link.includes(f)}})))continue;const g=wi(c,{type:i},{position:a.position,style:a.style??{}});g&&rl.push(g);continue}if(!(((n=Ct[a.dataKey])==null?void 0:n.length)>0))continue;const d=wi(c,{type:i},{position:a.position,props:{...a.props,dataKey:a.dataKey},style:a.style??{}});d&&rl.push(d)}}catch(s){console.error("[EAI RCM] ❌ injectWidgets:",s)}},async init(e){const t=["31c91fbc-38e2-4e84-868e-da29623b9505","74af8f88-1745-4f44-9726-e7082e53e321"];if(this.checkTestMode(),!(!Ct.isTestMode&&!t.includes(e)||Ct.isInitialized||(Ct.isInitialized=!0,!sl[e]))&&(Ct.pageType=this.detectPageType(e),!(!Ct.pageType&&!Ct.isTestMode)&&(await this.fetchAndStore(e),this.injectWidgets(e),Mm[e]&&!Om))){const{delay:s}=Mm[e],r=this;Om=Am(async()=>{qw(),await new Promise(o=>setTimeout(o,s)),Ct.flash_sales=null,Ct.hot_sales=null,Ct.recently_viewed=null,Ct.also_bought=null,Ct.source_product=null,Ct.pageType=r.detectPageType(e),Ct.pageType&&(await r.fetchAndStore(e),r.injectWidgets(e))})}},async demoFetch(e,t,n={}){const s=sl[e];s&&(Ct.pageType=n.page_type||this.detectPageType(e)||Object.keys(s)[0],await this.fetchAndStore(e,t,n.item_url))}}},Rm=!1,Uw=e=>({getList(){return e.get(`/bots/${U.handle}/addresses`,{params:{mock:Rm}})},create(t){return e.post(`/bots/${U.handle}/addresses`,t,{params:{mock:Rm}})}}),ho=!1,Vw=e=>({getUser(){return e.get(`/bots/${U.handle}/profile`,{params:{mock:ho}})},updateUser(t){return e.put(`/bots/${U.handle}/profile`,t,{params:{mock:ho}})},login({type:t,identifier:n}){return e.post(`/bots/${U.handle}/auth/login`,{type:t,identifier:n},{params:{mock:ho}})},verifyOtp({code:t,identifier:n}){return e.post(`/bots/${U.handle}/auth/otp/verify`,{code:t,identifier:n},{params:{mock:ho}})},requestOtp({type:t,identifier:n}){return e.post(`/bots/${U.handle}/auth/otp/request`,{type:t,identifier:n},{params:{mock:ho}})},logout(){return e.post(`/bots/${U.handle}/auth/logout`,{},{params:{mock:ho}})}}),Ar=!1,Hw=e=>({getList(){return e.get(`/bots/${U.handle}/cart`,{params:{mock:Ar}})},add(t){return e.post(`/bots/${U.handle}/cart/items`,t,{params:{mock:Ar}})},update(t,n){return e.patch(`/bots/${U.handle}/cart/items/${t}`,n,{params:{mock:Ar}})},remove(t){return e.delete(`/bots/${U.handle}/cart/items/${t}`,{params:{mock:Ar}})},coupons(){return e.get(`/bots/${U.handle}/coupons`,{params:{mock:Ar}})},applyCoupon(t){return e.post(`/bots/${U.handle}/cart/coupon`,t,{params:{mock:Ar}})},removeCoupon(t={}){return e.delete(`/bots/${U.handle}/cart/coupon`,{...t,params:{mock:Ar}})}});var Dm={exports:{}};(function(e,t){(function(){var n={expires:"1d",path:"; path=/",domain:"",secure:"",sameSite:"; SameSite=Lax",partitioned:""},s={install:function(r,o){o&&this.config(o.expires,o.path,o.domain,o.secure,o.sameSite,o.partitioned);const i=r.config&&r.config.globalProperties;i&&(r.config.globalProperties.$cookies=this,r.provide&&r.provide("$cookies",this)),(!i||r.prototype)&&(r.prototype.$cookies=this),r.$cookies=this},config:function(r,o,i,a,c,u){n.expires=r||"1d",n.path=o?"; path="+o:"; path=/",n.domain=i?"; domain="+i:"",n.secure=a?"; Secure":"",n.sameSite=c?"; SameSite="+c:"; SameSite=Lax",n.partitioned=u?"; Partitioned":""},get:function(r){var o=decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(r).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null;if(o&&(o.substring(0,1)==="{"&&o.substring(o.length-1,o.length)==="}"||o.substring(0,1)==="["&&o.substring(o.length-1,o.length)==="]"))try{o=JSON.parse(o)}catch{return o}return o},set:function(r,o,i,a,c,u,d,f){if(r){if(/^(?:expires|max\-age|path|domain|secure|SameSite)$/i.test(r))throw new Error('Cookie name illegality. Cannot be set to ["expires","max-age","path","domain","secure","SameSite"] current key name: '+r)}else throw new Error("Cookie name is not found in the first argument.");o&&typeof o=="object"&&(o=JSON.stringify(o));var h="";if(i=i===void 0?n.expires:i,i&&i!==0)switch(i.constructor){case Number:i===1/0||i===-1?h="; expires=Fri, 31 Dec 9999 23:59:59 GMT":h="; max-age="+i;break;case String:if(/^(?:\d+(y|m|d|h|min|s))$/i.test(i)){var g=i.replace(/^(\d+)(?:y|m|d|h|min|s)$/i,"$1");switch(i.replace(/^(?:\d+)(y|m|d|h|min|s)$/i,"$1").toLowerCase()){case"m":h="; max-age="+ +g*2592e3;break;case"d":h="; max-age="+ +g*86400;break;case"h":h="; max-age="+ +g*3600;break;case"min":h="; max-age="+ +g*60;break;case"s":h="; max-age="+g;break;case"y":h="; max-age="+ +g*31104e3;break}}else h="; expires="+i;break;case Date:h="; expires="+i.toUTCString();break}return document.cookie=encodeURIComponent(r)+"="+encodeURIComponent(o)+h+(c?"; domain="+c:n.domain)+(a?"; path="+a:n.path)+(u===void 0?n.secure:u?"; Secure":"")+(d===void 0?n.sameSite:d?"; SameSite="+d:"")+(f===void 0?n.partitioned:f?"; Partitioned":""),this},remove:function(r,o,i){return!r||!this.isKey(r)?!1:(document.cookie=encodeURIComponent(r)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(i?"; domain="+i:n.domain)+(o?"; path="+o:n.path)+"; SameSite=Lax",!0)},isKey:function(r){return new RegExp("(?:^|;\\s*)"+encodeURIComponent(r).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie)},keys:function(){if(!document.cookie)return[];for(var r=document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:\=[^;]*)?;\s*/),o=0;o<r.length;o++)r[o]=decodeURIComponent(r[o]);return r}};e.exports=s,typeof window<"u"&&(window.$cookies=s)})()})(Dm);var Ww=Dm.exports;const Tt=Ep(Ww),po={RECEIVED:"received",START:"start",DELTA:"delta",MESSAGES:"messages",AUDIO:"audio",DONE:"done"},Gw="mp3",Kw=e=>({getConversations({handle:t,conversationId:n,token:s}){const r={"Content-Type":"application/json"};return s&&(r.Authorization=`Bearer ${s}`),e.get(`/bots/${t}/conversations/${n}`,{headers:r})},async sendMessage(t,n,{isFormData:s=!1,onReceived:r=null,onStart:o=null,onDelta:i=null,onMessages:a=null,onAudioChunk:c=null,onComplete:u=null}={}){if(t.mode==="voice")return this._sendVoiceMessage(t,n,{onAudioChunk:c,onStart:o,onComplete:u});if(t.stream===!0)return this._sendStreamMessage(t,n,{onReceived:r,onStart:o,onDelta:i,onMessages:a,onComplete:u});const d={"Content-Type":s?"multipart/form-data":"application/json"};return n&&(d.Authorization=`Bearer ${n}`),e.post("/chat",t,{headers:d})},async sendAgentMessage(t,n){var o,i;const s={"Content-Type":"application/json"};n&&(s.Authorization=`Bearer ${n}`);const r={};for(const[a,c]of Object.entries(t||{}))c!=null&&(r[a]=c);try{const a=await e.post("/agent/chat",r,{headers:s});return a.status===202?{status:"merged",conversation_id:(o=a.data)==null?void 0:o.conversation_id}:{status:"ok",...a.data}}catch(a){if(((i=a==null?void 0:a.response)==null?void 0:i.status)===429)return{status:"busy"};throw a}},async _sendVoiceMessage(t,n,{onAudioChunk:s,onStart:r,onComplete:o}){const i=await this._createVoiceRequest(t,n);return await this._processSSEStream(i,{onAudioChunk:s,onStart:r,onComplete:o,fallbackConversationId:t.conversation_id})},async _sendStreamMessage(t,n,{onReceived:s,onStart:r,onDelta:o,onMessages:i,onComplete:a}){const c=await this._createStreamRequest(t,n);return await this._processSSEStream(c,{onReceived:s,onStart:r,onDelta:o,onMessages:i,onComplete:a,fallbackConversationId:t.conversation_id})},async _createVoiceRequest(t,n){const s="https://console.easyaichat.app",r=this._buildVoiceHeaders(n),o=await fetch(`${s}/api/chat`,{method:"POST",headers:r,body:JSON.stringify(t),credentials:"include"});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o},async _createStreamRequest(t,n){const s="https://console.easyaichat.app",r=this._buildStreamHeaders(n),o=await fetch(`${s}/api/chat`,{method:"POST",headers:r,body:JSON.stringify(t),credentials:"include"});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o},_buildVoiceHeaders(t){const n=Qs(),s=t||Tt.get(ss),r={"Content-Type":"application/json",Accept:"text/event-stream","X-Easy-Ai-User-Id":n};return s&&(r.Authorization=`Bearer ${s}`),r},_buildStreamHeaders(t){const n=Qs(),s=t||Tt.get(ss),r={"Content-Type":"application/json",Accept:"text/event-stream","X-Easy-Ai-User-Id":n};return s&&(r.Authorization=`Bearer ${s}`),r},async _processSSEStream(t,{onReceived:n,onStart:s,onDelta:r,onMessages:o,onAudioChunk:i,onComplete:a,fallbackConversationId:c}){const u=t.body.getReader(),d=new TextDecoder;let f="",h=null,g=c;for(;;){const{done:p,value:v}=await u.read();if(p)break;f+=d.decode(v,{stream:!0});const _=f.split(`
`);f=_.pop()||"";for(const w of _)if(!(!w.trim()||w.startsWith(":"))){if(w.startsWith("event:")){h=w.substring(6).trim();continue}if(w.startsWith("data:")&&h){const k=this._parseEventData(w);if(k){const S=this._handleSSEEvent(h,k,{onReceived:n,onStart:s,onDelta:r,onMessages:o,onAudioChunk:i,onComplete:a});S&&(g=S)}h=null}}}return{data:{messages:[],conversation_id:g,code:0,msg:"success"}}},_parseEventData(t){try{const n=t.substring(5).trim();return JSON.parse(n)}catch(n){return console.error("Error parsing SSE data:",n),null}},_handleSSEEvent(t,n,{onReceived:s,onStart:r,onDelta:o,onMessages:i,onAudioChunk:a,onComplete:c}){switch(t){case po.RECEIVED:s&&s(n);break;case po.START:r&&r(n);break;case po.DELTA:return o&&o({content:n.content||"",content_type:n.content_type||"text",conversation_id:n.conversation_id}),n.conversation_id;case po.MESSAGES:return i&&i({messages:n.messages||[],conversation_id:n.conversation_id}),n.conversation_id;case po.AUDIO:if(a){const u=n.format||Gw;a(n.content,n.sentence_index,n.text,u)}break;case po.DONE:c&&c(n);break}return null}}),Qw=e=>({initConnection(t){return e.post("/live-chat/init",t)}}),Du=!1,Jw=e=>({provinces(){return e.get(`/bots/${U.handle}/locations/provinces`,{params:{mock:Du}})},districts(t){return e.get(`/bots/${U.handle}/locations/provinces/${t}/districts`,{params:{mock:Du}})},wards(t){return e.get(`/bots/${U.handle}/locations/districts/${t}/wards`,{params:{mock:Du}})}}),Si=!1,Xw=e=>({checkout(t){return e.post(`/bots/${U.handle}/checkout`,t,{params:{mock:Si}})},checkShipping(t){return e.post(`/bots/${U.handle}/cart/shipping-address`,t,{params:{mock:Si}})},getList(t={}){return e.get(`/bots/${U.handle}/orders`,{params:{mock:Si,...t}})},getOne(t){return e.get(`/bots/${U.handle}/orders/${t}`,{params:{mock:Si}})},getStatuses(){return e.get(`/bots/${U.handle}/orders/statuses`,{params:{mock:Si}})},confirm(t,n){return e.post(`/widget/orders/${t}/confirm`,n)}}),Zw=e=>({update({conversationId:t,messageId:n,form:s={reaction:"love"}}){return e.post(`/bots/${U.handle}/conversations/${t}/messages/${n}/reaction`,s)},removeAll({conversationId:t,messageId:n}){return e.post(`/bots/${U.handle}/conversations/${t}/messages/${n}/reset-all-reaction`)}}),Yw=e=>({add({formId:t,formData:n}){return e.post(`/bots/${U.handle}/widgets/${t}/submission`,n)},submitWidget({widgetId:t,formData:n}){return e.post(`/bots/${U.handle}/widgets/${t}/submission`,n)}}),e2=e=>({getSummary(t){return e.post("/widgets/summary",t)},getComparisonSummary(t){return e.post("/widgets/compare",t)}}),t2=e=>({showWidget({handle:t,workspaceUuid:n,domain:s,preview:r=!1}){return e.get("/workspaces/widget",{params:{...t?{handle:t}:{},...n?{workspaceUuid:n}:{},domain:s,preview:r}})},submitForm({widgetId:t,handle:n,formData:s}){return e.post(`/bots/${n}/widgets/${t}/submission`,s)},updateAll({handle:t,token:n,expires:s,widgets:r}){return e.put(`/bots/${t}/widgets?expires=${s}&signature=${n}`,{widgets:r})}}),Wn=St.create({baseURL:"https://console.easyaichat.app"+"/api",withCredentials:!0,headers:{"Content-Type":"application/json",Accept:"application/json"}});Wn.interceptors.request.use(e=>{const t=Qs(),n=Tt.get(ss);return e.headers["X-Easy-Ai-User-Id"]=t,n&&(e.headers.Authorization=`Bearer ${n}`),e},e=>Promise.reject(e));const Xe={address:Uw(Wn),auth:Vw(Wn),cart:Hw(Wn),chat:Kw(Wn),liveChat:Qw(Wn),location:Jw(Wn),order:Xw(Wn),reaction:Zw(Wn),submission:Yw(Wn),summary:e2(Wn),widget:t2(Wn)},vt={track:(e,t)=>{var n;(n=window.rybbit)==null||n.event(e,t)},identify:e=>{var t;(t=window.rybbit)==null||t.identify(e)},clearUserId:()=>{var e;(e=window.rybbit)==null||e.clearUserId()},getUserId:()=>{var e;return(e=window.rybbit)==null?void 0:e.getUserId()}},Qt={conversationStart:e=>{vt.track("chatbot_conversation_start",e)},conversationReset:e=>{vt.track("chatbot_conversation_reset",e)},quickPromptClick:e=>{vt.track("chatbot_quick_prompt_click",e)},messageSend:e=>{vt.track("chatbot_message_send",e)},linkClick:e=>{vt.track("chatbot_link_click",e)},ctaClick:e=>{vt.track("chatbot_cta_click",e)},interaction:e=>{vt.track("chatbot_interaction",e)},widgetVoice:e=>{vt.track("chatbot_widget_voice",e)},widgetFollowUpQuestions:e=>{vt.track("chatbot_widget_follow_up_questions",e)},widgetContact:e=>{vt.track("chatbot_widget_contact",e)}},n2=dt({isPlaying:!1,currentSentenceIndex:null});function s2(){const{isPlaying:e,currentSentenceIndex:t}=Et(n2),n=R(null),s=R(null),r=R(0),o=R([]),i=R(!1),a=R(!1),c=()=>{const _=window.AudioContext||window.webkitAudioContext;return n.value||(n.value=new _({sampleRate:48e3}),s.value=n.value.createGain(),s.value.gain.value=1,s.value.connect(n.value.destination)),n.value},u=async()=>{if(n.value||c(),n.value.state==="suspended")try{await n.value.resume()}catch(_){throw _}},d=async()=>{if(n.value||c(),n.value.state==="suspended")try{await n.value.resume()}catch{}if(!(i.value&&a.value))try{const _=n.value.createBufferSource();_.buffer=n.value.createBuffer(1,1,n.value.sampleRate),_.connect(s.value),_.start(0),i.value=!0,a.value=!0,r.value=n.value.currentTime}catch(_){throw _}},f=_=>{const w=atob(_);return Uint8Array.from(w,S=>S.charCodeAt(0)).buffer},h=async(_,w,k="mp3")=>{try{await u(),e.value=!0,t.value=w;const S=f(_),E=await n.value.decodeAudioData(S),O=n.value.createBufferSource();O.buffer=E,O.connect(s.value);const I=n.value.currentTime,P=Math.max(I+.01,r.value);O.start(P),r.value=P+E.duration,o.value.push(O),O.onended=()=>{const M=o.value.indexOf(O);M>-1&&o.value.splice(M,1),o.value.length===0&&(e.value=!1,t.value=null,r.value=n.value.currentTime)}}catch{n.value&&(r.value=n.value.currentTime)}},g=()=>{o.value.forEach(_=>{try{_.stop(),_.disconnect()}catch{}}),o.value=[],n.value&&(r.value=n.value.currentTime),e.value=!1,t.value=null},p=()=>{g()},v=()=>{g(),i.value=!1,a.value=!1,r.value=0};return Rt(()=>{g(),s.value&&(s.value.disconnect(),s.value=null),n.value&&(n.value.close(),n.value=null)}),{isPlaying:e,currentSentenceIndex:t,unlockAudio:d,queueAudioChunk:h,stopAudio:g,clearQueue:p,reset:v}}const r2=dt({conversationId:null,messages:[],assistantProcessing:!1,newMessageStatus:"unread",storageConversations:{},messagesContainerRef:null});function jm(){const{getStorage:e,saveStorage:t}=Ks(),{conversationId:n,messages:s,assistantProcessing:r,newMessageStatus:o,storageConversations:i,messagesContainerRef:a}=Et(r2),c=Z(()=>{var E;return(E=ae.state.bot)==null?void 0:E.handle}),u=s2(),d=async()=>{try{const{data:E}=await Xe.cart.getList();E.success&&(U.cart=E.data,ECG.sync.emit("cart",{source:"easy-ai-chat",data:E.data}))}catch(E){console.log("error: ",E)}},f=()=>{s.value.find(O=>O.content_type==="attachment")&&d()};(()=>{i.value=e(Kt)??{};const E=em();if(E){n.value=E;return}c.value&&(n.value=i.value[c.value]??null)})();const g=()=>{var M,q,B,T,A;s.value=[];const E=((B=(q=(M=U.bot)==null?void 0:M.config)==null?void 0:q.initialMessage)==null?void 0:B.messages)??[],O=Object.values(E).map(D=>D.content);_i(O).forEach(D=>{s.value.push({content:D,content_type:"text",sender_type:"assistant",is_welcome_message:!0})});const P=(A=(T=U.bot)==null?void 0:T.config)==null?void 0:A.introductionMessage;P&&typeof P=="string"&&s.value.push({content:P,content_type:"text",sender_type:"assistant",is_welcome_message:!0,is_introduction_message:!0}),s.value=ys(s.value)},p=()=>{const E=e(Kt);delete E[c.value],t(Kt,E)};function v(){var M,q,B,T,A;const E=((B=(q=(M=U.bot)==null?void 0:M.config)==null?void 0:q.initialMessage)==null?void 0:B.messages)??[],O=(A=(T=U.bot)==null?void 0:T.config)==null?void 0:A.introductionMessage,I=Object.values(E).map(D=>D.content);let P=_i(I).length;if(O&&typeof O=="string"&&(P+=1),P>0)for(let D=0;D<P;D++)s.value[D]&&(s.value[D].is_welcome_message=!0);s.value=ys(s.value)}return{handle:c,messages:s,conversationId:n,assistantProcessing:r,newMessageStatus:o,storageConversations:i,messagesContainerRef:a,send:async({message:E,files:O,onSuccess:I,mode:P,onError:M,onFinish:q,content_type:B,replyTarget:T}={})=>{var J,te,ge,ue,we,Ee;if(!E&&(!O||O.length===0)||r.value)return;r.value=!0;const A=(O==null?void 0:O.map(re=>re.file_id))??[],D=E||"";if(s.value.forEach(re=>{re.sender_type==="user"&&delete re.is_last_message}),A.length>0&&s.value.push({content:O,content_type:"attachment",sender_type:"user",timestamp:new Date().toISOString(),is_last_message:!D}),D){const re={content:D,content_type:B||"text",sender_type:"user",audio_url:P==="voice"?!0:void 0,timestamp:new Date().toISOString(),is_last_message:!0};T&&(re.reply_to_message_id=T.id,re.quoted_message={id:T.id,content:T.content,content_type:T.content_type,sender_type:T.sender_type,sender_name:T.sender_name}),s.value.push(re)}let Q=!1;((te=(J=U.bot)==null?void 0:J.config)==null?void 0:te.livechat)===!0?Q=!1:Q=((ue=(ge=U.bot)==null?void 0:ge.config)==null?void 0:ue.stream)===!0;let W={handle:c.value,query:D,stream:Q,conversation_id:n.value,attachments:A??[],content_type:B||"text"};P&&(W.mode=P),T!=null&&T.id&&(W.reply_to_message_id=T.id),n.value||Qt.conversationStart({handle:c.value});const H=((we=s.value.filter(re=>re.sender_type==="user"))==null?void 0:we.length)||1;Qt.messageSend({mode:P==="voice"?"voice":"text",content:D,conversation_id:n.value,message_user_order:H}),(async()=>(await ns(1200),o.value="sent",await ns(2e3),o.value==="sent"&&(o.value="received"),await ns(1e3),o.value==="received"&&(o.value="read")))();let K=null;try{const re=(Ee=U.cart)==null?void 0:Ee.token,pe=P==="voice"?{onAudioChunk:($e,Re,Le,Oe)=>{u.queueAudioChunk($e,Re,Le,Oe)},onStart:$e=>{},onComplete:$e=>{}}:{onReceived:$e=>{},onStart:$e=>{r.value=!0},onDelta:$e=>{$e.conversation_id&&!n.value&&(n.value=$e.conversation_id,i.value[c.value]=$e.conversation_id,t(Kt,i.value));const Re=$e.content_type||"text";K&&K.content_type!==Re&&(delete K.is_streaming,s.value=ys(s.value),K={content:"",content_type:Re,sender_type:"assistant",is_streaming:!0},s.value.push(K)),K||(K={content:"",content_type:Re,sender_type:"assistant",is_streaming:!0},s.value.push(K)),K.content+=$e.content},onMessages:$e=>{if($e.messages&&$e.messages.length>0){K=null,s.value=ys($e.messages);for(let Re=s.value.length-1;Re>=0;Re--)if(s.value[Re].sender_type==="user"){s.value[Re].is_last_message=!0;break}}$e.conversation_id&&!n.value&&(n.value=$e.conversation_id,i.value[c.value]=$e.conversation_id,t(Kt,i.value))},onComplete:$e=>{}},{data:fe}=await Xe.chat.sendMessage(W,re,pe);if(o.value="unread",!Q&&(fe!=null&&fe.messages)&&fe.messages.length>0){s.value=ys(fe.messages);for(let $e=s.value.length-1;$e>=0;$e--)if(s.value[$e].sender_type==="user"){s.value[$e].is_last_message=!0;break}}c.value==="rangdongstorevn-zll"&&f(),fe!=null&&fe.conversation_id&&!n.value&&(n.value=fe.conversation_id,i.value[c.value]=fe.conversation_id,t(Kt,i.value)),ao(I)&&I(fe)}catch(re){ao(M)&&M(re)}finally{r.value=!1,ao(q)&&q(),v()}},fetchMessages:async({onSuccess:E,onError:O,onFinish:I}={})=>{var M;if(s.value.length>0)return;const P=(M=U==null?void 0:U.cart)==null?void 0:M.token;if(n.value){r.value=!0;try{const{data:q}=await Xe.chat.getConversations({handle:c.value,conversationId:n.value,token:P});q&&(s.value=ys(q.data),ao(E)&&E(q))}catch(q){g(),p(),ao(O)&&O(q)}finally{r.value=!1,ao(I)&&I()}}else g()},initializeMessages:g,refreshConversation:async()=>{r.value||(u.reset(),s.value=[],n.value=null,delete i.value[c.value],localStorage.setItem(Kt,JSON.stringify(i.value)),g(),Qt.conversationReset())},clickQuickPrompt:E=>{Qt.quickPromptClick({handle:c.value,quick_prompt:E}),ae.state.chatState.shouldOpenChatScreen=!0},voiceAudio:u}}class ju{constructor(){this.notificationCreatedEvent=".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated"}listenForWhisper(t,n){return this.listen(".client-"+t,n)}notification(t){return this.listen(this.notificationCreatedEvent,t)}stopListeningForNotification(t){return this.stopListening(this.notificationCreatedEvent,t)}stopListeningForWhisper(t,n){return this.stopListening(".client-"+t,n)}}class Nm{constructor(t){this.namespace=t}format(t){return[".","\\"].includes(t.charAt(0))?t.substring(1):(this.namespace&&(t=this.namespace+"."+t),t.replace(/\./g,"\\"))}setNamespace(t){this.namespace=t}}function o2(e){try{new e}catch(t){if(t instanceof Error&&t.message.includes("is not a constructor"))return!1}return!0}class Nu extends ju{constructor(t,n,s){super(),this.name=n,this.pusher=t,this.options=s,this.eventFormatter=new Nm(this.options.namespace),this.subscribe()}subscribe(){this.subscription=this.pusher.subscribe(this.name)}unsubscribe(){this.pusher.unsubscribe(this.name)}listen(t,n){return this.on(this.eventFormatter.format(t),n),this}listenToAll(t){return this.subscription.bind_global((n,s)=>{if(n.startsWith("pusher:"))return;let r=String(this.options.namespace??"").replace(/\./g,"\\"),o=n.startsWith(r)?n.substring(r.length+1):"."+n;t(o,s)}),this}stopListening(t,n){return n?this.subscription.unbind(this.eventFormatter.format(t),n):this.subscription.unbind(this.eventFormatter.format(t)),this}stopListeningToAll(t){return t?this.subscription.unbind_global(t):this.subscription.unbind_global(),this}subscribed(t){return this.on("pusher:subscription_succeeded",()=>{t()}),this}error(t){return this.on("pusher:subscription_error",n=>{t(n)}),this}on(t,n){return this.subscription.bind(t,n),this}}class Fm extends Nu{whisper(t,n){return this.pusher.channels.channels[this.name].trigger(`client-${t}`,n),this}}class i2 extends Nu{whisper(t,n){return this.pusher.channels.channels[this.name].trigger(`client-${t}`,n),this}}class a2 extends Fm{here(t){return this.on("pusher:subscription_succeeded",n=>{t(Object.keys(n.members).map(s=>n.members[s]))}),this}joining(t){return this.on("pusher:member_added",n=>{t(n.info)}),this}whisper(t,n){return this.pusher.channels.channels[this.name].trigger(`client-${t}`,n),this}leaving(t){return this.on("pusher:member_removed",n=>{t(n.info)}),this}}class qm extends ju{constructor(t,n,s){super(),this.events={},this.listeners={},this.name=n,this.socket=t,this.options=s,this.eventFormatter=new Nm(this.options.namespace),this.subscribe()}subscribe(){this.socket.emit("subscribe",{channel:this.name,auth:this.options.auth||{}})}unsubscribe(){this.unbind(),this.socket.emit("unsubscribe",{channel:this.name,auth:this.options.auth||{}})}listen(t,n){return this.on(this.eventFormatter.format(t),n),this}stopListening(t,n){return this.unbindEvent(this.eventFormatter.format(t),n),this}subscribed(t){return this.on("connect",n=>{t(n)}),this}error(t){return this}on(t,n){return this.listeners[t]=this.listeners[t]||[],this.events[t]||(this.events[t]=(s,r)=>{this.name===s&&this.listeners[t]&&this.listeners[t].forEach(o=>o(r))},this.socket.on(t,this.events[t])),this.listeners[t].push(n),this}unbind(){Object.keys(this.events).forEach(t=>{this.unbindEvent(t)})}unbindEvent(t,n){this.listeners[t]=this.listeners[t]||[],n&&(this.listeners[t]=this.listeners[t].filter(s=>s!==n)),(!n||this.listeners[t].length===0)&&(this.events[t]&&(this.socket.removeListener(t,this.events[t]),delete this.events[t]),delete this.listeners[t])}}class zm extends qm{whisper(t,n){return this.socket.emit("client event",{channel:this.name,event:`client-${t}`,data:n}),this}}class l2 extends zm{here(t){return this.on("presence:subscribed",n=>{t(n.map(s=>s.user_info))}),this}joining(t){return this.on("presence:joining",n=>t(n.user_info)),this}whisper(t,n){return this.socket.emit("client event",{channel:this.name,event:`client-${t}`,data:n}),this}leaving(t){return this.on("presence:leaving",n=>t(n.user_info)),this}}class al extends ju{subscribe(){}unsubscribe(){}listen(t,n){return this}listenToAll(t){return this}stopListening(t,n){return this}subscribed(t){return this}error(t){return this}on(t,n){return this}}class Bm extends al{whisper(t,n){return this}}class c2 extends al{whisper(t,n){return this}}class u2 extends Bm{here(t){return this}joining(t){return this}whisper(t,n){return this}leaving(t){return this}}const Um=class i0{constructor(t){this.setOptions(t),this.connect()}setOptions(t){this.options={...i0._defaultOptions,...t,broadcaster:t.broadcaster};let n=this.csrfToken();n&&(this.options.auth.headers["X-CSRF-TOKEN"]=n,this.options.userAuthentication.headers["X-CSRF-TOKEN"]=n),n=this.options.bearerToken,n&&(this.options.auth.headers.Authorization="Bearer "+n,this.options.userAuthentication.headers.Authorization="Bearer "+n)}csrfToken(){var t,n;return typeof window<"u"&&(t=window.Laravel)!=null&&t.csrfToken?window.Laravel.csrfToken:this.options.csrfToken?this.options.csrfToken:typeof document<"u"&&typeof document.querySelector=="function"?((n=document.querySelector('meta[name="csrf-token"]'))==null?void 0:n.getAttribute("content"))??null:null}};Um._defaultOptions={auth:{headers:{}},authEndpoint:"/broadcasting/auth",userAuthentication:{endpoint:"/broadcasting/user-auth",headers:{}},csrfToken:null,bearerToken:null,host:null,key:null,namespace:"App.Events"};let Fu=Um;class ll extends Fu{constructor(){super(...arguments),this.channels={}}connect(){if(typeof this.options.client<"u")this.pusher=this.options.client;else if(this.options.Pusher)this.pusher=new this.options.Pusher(this.options.key,this.options);else if(typeof window<"u"&&typeof window.Pusher<"u")this.pusher=new window.Pusher(this.options.key,this.options);else throw new Error("Pusher client not found. Should be globally available or passed via options.client")}signin(){this.pusher.signin()}listen(t,n,s){return this.channel(t).listen(n,s)}channel(t){return this.channels[t]||(this.channels[t]=new Nu(this.pusher,t,this.options)),this.channels[t]}privateChannel(t){return this.channels["private-"+t]||(this.channels["private-"+t]=new Fm(this.pusher,"private-"+t,this.options)),this.channels["private-"+t]}encryptedPrivateChannel(t){return this.channels["private-encrypted-"+t]||(this.channels["private-encrypted-"+t]=new i2(this.pusher,"private-encrypted-"+t,this.options)),this.channels["private-encrypted-"+t]}presenceChannel(t){return this.channels["presence-"+t]||(this.channels["presence-"+t]=new a2(this.pusher,"presence-"+t,this.options)),this.channels["presence-"+t]}leave(t){[t,"private-"+t,"private-encrypted-"+t,"presence-"+t].forEach(n=>{this.leaveChannel(n)})}leaveChannel(t){this.channels[t]&&(this.channels[t].unsubscribe(),delete this.channels[t])}socketId(){return this.pusher.connection.socket_id}disconnect(){this.pusher.disconnect()}}class d2 extends Fu{constructor(){super(...arguments),this.channels={}}connect(){let t=this.getSocketIO();this.socket=t(this.options.host??void 0,this.options),this.socket.io.on("reconnect",()=>{Object.values(this.channels).forEach(n=>{n.subscribe()})})}getSocketIO(){if(typeof this.options.client<"u")return this.options.client;if(typeof window<"u"&&typeof window.io<"u")return window.io;throw new Error("Socket.io client not found. Should be globally available or passed via options.client")}listen(t,n,s){return this.channel(t).listen(n,s)}channel(t){return this.channels[t]||(this.channels[t]=new qm(this.socket,t,this.options)),this.channels[t]}privateChannel(t){return this.channels["private-"+t]||(this.channels["private-"+t]=new zm(this.socket,"private-"+t,this.options)),this.channels["private-"+t]}presenceChannel(t){return this.channels["presence-"+t]||(this.channels["presence-"+t]=new l2(this.socket,"presence-"+t,this.options)),this.channels["presence-"+t]}leave(t){[t,"private-"+t,"presence-"+t].forEach(n=>{this.leaveChannel(n)})}leaveChannel(t){this.channels[t]&&(this.channels[t].unsubscribe(),delete this.channels[t])}socketId(){return this.socket.id}disconnect(){this.socket.disconnect()}}class Vm extends Fu{constructor(){super(...arguments),this.channels={}}connect(){}listen(t,n,s){return new al}channel(t){return new al}privateChannel(t){return new Bm}encryptedPrivateChannel(t){return new c2}presenceChannel(t){return new u2}leave(t){}leaveChannel(t){}socketId(){return"fake-socket-id"}disconnect(){}}class f2{constructor(t){this.options=t,this.connect(),this.options.withoutInterceptors||this.registerInterceptors()}channel(t){return this.connector.channel(t)}connect(){if(this.options.broadcaster==="reverb")this.connector=new ll({...this.options,cluster:""});else if(this.options.broadcaster==="pusher")this.connector=new ll(this.options);else if(this.options.broadcaster==="ably")this.connector=new ll({...this.options,cluster:"",broadcaster:"pusher"});else if(this.options.broadcaster==="socket.io")this.connector=new d2(this.options);else if(this.options.broadcaster==="null")this.connector=new Vm(this.options);else if(typeof this.options.broadcaster=="function"&&o2(this.options.broadcaster))this.connector=new this.options.broadcaster(this.options);else throw new Error(`Broadcaster ${typeof this.options.broadcaster} ${String(this.options.broadcaster)} is not supported.`)}disconnect(){this.connector.disconnect()}join(t){return this.connector.presenceChannel(t)}leave(t){this.connector.leave(t)}leaveChannel(t){this.connector.leaveChannel(t)}leaveAllChannels(){for(const t in this.connector.channels)this.leaveChannel(t)}listen(t,n,s){return this.connector.listen(t,n,s)}private(t){return this.connector.privateChannel(t)}encryptedPrivate(t){if(this.connectorSupportsEncryptedPrivateChannels(this.connector))return this.connector.encryptedPrivateChannel(t);throw new Error(`Broadcaster ${typeof this.options.broadcaster} ${String(this.options.broadcaster)} does not support encrypted private channels.`)}connectorSupportsEncryptedPrivateChannels(t){return t instanceof ll||t instanceof Vm}socketId(){return this.connector.socketId()}registerInterceptors(){typeof Vue<"u"&&Vue!=null&&Vue.http&&this.registerVueRequestInterceptor(),typeof axios=="function"&&this.registerAxiosRequestInterceptor(),typeof jQuery=="function"&&this.registerjQueryAjaxSetup(),typeof Turbo=="object"&&this.registerTurboRequestInterceptor()}registerVueRequestInterceptor(){Vue.http.interceptors.push((t,n)=>{this.socketId()&&t.headers.set("X-Socket-ID",this.socketId()),n()})}registerAxiosRequestInterceptor(){axios.interceptors.request.use(t=>(this.socketId()&&(t.headers["X-Socket-Id"]=this.socketId()),t))}registerjQueryAjaxSetup(){typeof jQuery.ajax<"u"&&jQuery.ajaxPrefilter((t,n,s)=>{this.socketId()&&s.setRequestHeader("X-Socket-Id",this.socketId())})}registerTurboRequestInterceptor(){document.addEventListener("turbo:before-fetch-request",t=>{t.detail.fetchOptions.headers["X-Socket-Id"]=this.socketId()})}}var Hm={exports:{}};/*!
* Pusher JavaScript Library v8.4.0
* https://pusher.com/
*
* Copyright 2020, Pusher
* Released under the MIT licence.
*/(function(e,t){(function(s,r){e.exports=r()})(window,function(){return function(n){var s={};function r(o){if(s[o])return s[o].exports;var i=s[o]={i:o,l:!1,exports:{}};return n[o].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=n,r.c=s,r.d=function(o,i,a){r.o(o,i)||Object.defineProperty(o,i,{enumerable:!0,get:a})},r.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},r.t=function(o,i){if(i&1&&(o=r(o)),i&8||i&4&&typeof o=="object"&&o&&o.__esModule)return o;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:o}),i&2&&typeof o!="string")for(var c in o)r.d(a,c,(function(u){return o[u]}).bind(null,c));return a},r.n=function(o){var i=o&&o.__esModule?function(){return o.default}:function(){return o};return r.d(i,"a",i),i},r.o=function(o,i){return Object.prototype.hasOwnProperty.call(o,i)},r.p="",r(r.s=2)}([function(n,s,r){var o=this&&this.__extends||function(){var v=function(_,w){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(k,S){k.__proto__=S}||function(k,S){for(var E in S)S.hasOwnProperty(E)&&(k[E]=S[E])},v(_,w)};return function(_,w){v(_,w);function k(){this.constructor=_}_.prototype=w===null?Object.create(w):(k.prototype=w.prototype,new k)}}();Object.defineProperty(s,"__esModule",{value:!0});var i=256,a=function(){function v(_){_===void 0&&(_="="),this._paddingCharacter=_}return v.prototype.encodedLength=function(_){return this._paddingCharacter?(_+2)/3*4|0:(_*8+5)/6|0},v.prototype.encode=function(_){for(var w="",k=0;k<_.length-2;k+=3){var S=_[k]<<16|_[k+1]<<8|_[k+2];w+=this._encodeByte(S>>>3*6&63),w+=this._encodeByte(S>>>2*6&63),w+=this._encodeByte(S>>>1*6&63),w+=this._encodeByte(S>>>0*6&63)}var E=_.length-k;if(E>0){var S=_[k]<<16|(E===2?_[k+1]<<8:0);w+=this._encodeByte(S>>>3*6&63),w+=this._encodeByte(S>>>2*6&63),E===2?w+=this._encodeByte(S>>>1*6&63):w+=this._paddingCharacter||"",w+=this._paddingCharacter||""}return w},v.prototype.maxDecodedLength=function(_){return this._paddingCharacter?_/4*3|0:(_*6+7)/8|0},v.prototype.decodedLength=function(_){return this.maxDecodedLength(_.length-this._getPaddingLength(_))},v.prototype.decode=function(_){if(_.length===0)return new Uint8Array(0);for(var w=this._getPaddingLength(_),k=_.length-w,S=new Uint8Array(this.maxDecodedLength(k)),E=0,O=0,I=0,P=0,M=0,q=0,B=0;O<k-4;O+=4)P=this._decodeChar(_.charCodeAt(O+0)),M=this._decodeChar(_.charCodeAt(O+1)),q=this._decodeChar(_.charCodeAt(O+2)),B=this._decodeChar(_.charCodeAt(O+3)),S[E++]=P<<2|M>>>4,S[E++]=M<<4|q>>>2,S[E++]=q<<6|B,I|=P&i,I|=M&i,I|=q&i,I|=B&i;if(O<k-1&&(P=this._decodeChar(_.charCodeAt(O)),M=this._decodeChar(_.charCodeAt(O+1)),S[E++]=P<<2|M>>>4,I|=P&i,I|=M&i),O<k-2&&(q=this._decodeChar(_.charCodeAt(O+2)),S[E++]=M<<4|q>>>2,I|=q&i),O<k-3&&(B=this._decodeChar(_.charCodeAt(O+3)),S[E++]=q<<6|B,I|=B&i),I!==0)throw new Error("Base64Coder: incorrect characters for decoding");return S},v.prototype._encodeByte=function(_){var w=_;return w+=65,w+=25-_>>>8&6,w+=51-_>>>8&-75,w+=61-_>>>8&-15,w+=62-_>>>8&3,String.fromCharCode(w)},v.prototype._decodeChar=function(_){var w=i;return w+=(42-_&_-44)>>>8&-i+_-43+62,w+=(46-_&_-48)>>>8&-i+_-47+63,w+=(47-_&_-58)>>>8&-i+_-48+52,w+=(64-_&_-91)>>>8&-i+_-65+0,w+=(96-_&_-123)>>>8&-i+_-97+26,w},v.prototype._getPaddingLength=function(_){var w=0;if(this._paddingCharacter){for(var k=_.length-1;k>=0&&_[k]===this._paddingCharacter;k--)w++;if(_.length<4||w>2)throw new Error("Base64Coder: incorrect padding")}return w},v}();s.Coder=a;var c=new a;function u(v){return c.encode(v)}s.encode=u;function d(v){return c.decode(v)}s.decode=d;var f=function(v){o(_,v);function _(){return v!==null&&v.apply(this,arguments)||this}return _.prototype._encodeByte=function(w){var k=w;return k+=65,k+=25-w>>>8&6,k+=51-w>>>8&-75,k+=61-w>>>8&-13,k+=62-w>>>8&49,String.fromCharCode(k)},_.prototype._decodeChar=function(w){var k=i;return k+=(44-w&w-46)>>>8&-i+w-45+62,k+=(94-w&w-96)>>>8&-i+w-95+63,k+=(47-w&w-58)>>>8&-i+w-48+52,k+=(64-w&w-91)>>>8&-i+w-65+0,k+=(96-w&w-123)>>>8&-i+w-97+26,k},_}(a);s.URLSafeCoder=f;var h=new f;function g(v){return h.encode(v)}s.encodeURLSafe=g;function p(v){return h.decode(v)}s.decodeURLSafe=p,s.encodedLength=function(v){return c.encodedLength(v)},s.maxDecodedLength=function(v){return c.maxDecodedLength(v)},s.decodedLength=function(v){return c.decodedLength(v)}},function(n,s,r){Object.defineProperty(s,"__esModule",{value:!0});var o="utf8: invalid string",i="utf8: invalid source encoding";function a(d){for(var f=new Uint8Array(c(d)),h=0,g=0;g<d.length;g++){var p=d.charCodeAt(g);p<128?f[h++]=p:p<2048?(f[h++]=192|p>>6,f[h++]=128|p&63):p<55296?(f[h++]=224|p>>12,f[h++]=128|p>>6&63,f[h++]=128|p&63):(g++,p=(p&1023)<<10,p|=d.charCodeAt(g)&1023,p+=65536,f[h++]=240|p>>18,f[h++]=128|p>>12&63,f[h++]=128|p>>6&63,f[h++]=128|p&63)}return f}s.encode=a;function c(d){for(var f=0,h=0;h<d.length;h++){var g=d.charCodeAt(h);if(g<128)f+=1;else if(g<2048)f+=2;else if(g<55296)f+=3;else if(g<=57343){if(h>=d.length-1)throw new Error(o);h++,f+=4}else throw new Error(o)}return f}s.encodedLength=c;function u(d){for(var f=[],h=0;h<d.length;h++){var g=d[h];if(g&128){var p=void 0;if(g<224){if(h>=d.length)throw new Error(i);var v=d[++h];if((v&192)!==128)throw new Error(i);g=(g&31)<<6|v&63,p=128}else if(g<240){if(h>=d.length-1)throw new Error(i);var v=d[++h],_=d[++h];if((v&192)!==128||(_&192)!==128)throw new Error(i);g=(g&15)<<12|(v&63)<<6|_&63,p=2048}else if(g<248){if(h>=d.length-2)throw new Error(i);var v=d[++h],_=d[++h],w=d[++h];if((v&192)!==128||(_&192)!==128||(w&192)!==128)throw new Error(i);g=(g&15)<<18|(v&63)<<12|(_&63)<<6|w&63,p=65536}else throw new Error(i);if(g<p||g>=55296&&g<=57343)throw new Error(i);if(g>=65536){if(g>1114111)throw new Error(i);g-=65536,f.push(String.fromCharCode(55296|g>>10)),g=56320|g&1023}}f.push(String.fromCharCode(g))}return f.join("")}s.decode=u},function(n,s,r){n.exports=r(3).default},function(n,s,r){r.r(s);class o{constructor(b,C){this.lastId=0,this.prefix=b,this.name=C}create(b){this.lastId++;var C=this.lastId,F=this.prefix+C,X=this.name+"["+C+"]",ye=!1,Ae=function(){ye||(b.apply(null,arguments),ye=!0)};return this[C]=Ae,{number:C,id:F,name:X,callback:Ae}}remove(b){delete this[b.number]}}var i=new o("_pusher_script_","Pusher.ScriptReceivers"),a={VERSION:"8.4.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""},c=a;class u{constructor(b){this.options=b,this.receivers=b.receivers||i,this.loading={}}load(b,C,F){var X=this;if(X.loading[b]&&X.loading[b].length>0)X.loading[b].push(F);else{X.loading[b]=[F];var ye=rt.createScriptRequest(X.getPath(b,C)),Ae=X.receivers.create(function(Be){if(X.receivers.remove(Ae),X.loading[b]){var nt=X.loading[b];delete X.loading[b];for(var ft=function(Vt){Vt||ye.cleanup()},bt=0;bt<nt.length;bt++)nt[bt](Be,ft)}});ye.send(Ae)}}getRoot(b){var C,F=rt.getDocument().location.protocol;return b&&b.useTLS||F==="https:"?C=this.options.cdn_https:C=this.options.cdn_http,C.replace(/\/*$/,"")+"/"+this.options.version}getPath(b,C){return this.getRoot(C)+"/"+b+this.options.suffix+".js"}}var d=new o("_pusher_dependencies","Pusher.DependenciesReceivers"),f=new u({cdn_http:c.cdn_http,cdn_https:c.cdn_https,version:c.VERSION,suffix:c.dependency_suffix,receivers:d});const h={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}};var p={buildLogSuffix:function($){const b="See:",C=h.urls[$];if(!C)return"";let F;return C.fullUrl?F=C.fullUrl:C.path&&(F=h.baseUrl+C.path),F?`${b} ${F}`:""}},v;(function($){$.UserAuthentication="user-authentication",$.ChannelAuthorization="channel-authorization"})(v||(v={}));class _ extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class w extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class k extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class S extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class E extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class O extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class I extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class P extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(b,C){super(C),this.status=b,Object.setPrototypeOf(this,new.target.prototype)}}var B=function($,b,C,F,X){const ye=rt.createXHR();ye.open("POST",C.endpoint,!0),ye.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var Ae in C.headers)ye.setRequestHeader(Ae,C.headers[Ae]);if(C.headersProvider!=null){let Be=C.headersProvider();for(var Ae in Be)ye.setRequestHeader(Ae,Be[Ae])}return ye.onreadystatechange=function(){if(ye.readyState===4)if(ye.status===200){let Be,nt=!1;try{Be=JSON.parse(ye.responseText),nt=!0}catch{X(new M(200,`JSON returned from ${F.toString()} endpoint was invalid, yet status code was 200. Data was: ${ye.responseText}`),null)}nt&&X(null,Be)}else{let Be="";switch(F){case v.UserAuthentication:Be=p.buildLogSuffix("authenticationEndpoint");break;case v.ChannelAuthorization:Be=`Clients must be authorized to join private or presence channels. ${p.buildLogSuffix("authorizationEndpoint")}`;break}X(new M(ye.status,`Unable to retrieve auth string from ${F.toString()} endpoint - received status: ${ye.status} from ${C.endpoint}. ${Be}`),null)}},ye.send(b),ye};function T($){return K(W($))}var A=String.fromCharCode,D="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Q=function($){var b=$.charCodeAt(0);return b<128?$:b<2048?A(192|b>>>6)+A(128|b&63):A(224|b>>>12&15)+A(128|b>>>6&63)+A(128|b&63)},W=function($){return $.replace(/[^\x00-\x7F]/g,Q)},H=function($){var b=[0,2,1][$.length%3],C=$.charCodeAt(0)<<16|($.length>1?$.charCodeAt(1):0)<<8|($.length>2?$.charCodeAt(2):0),F=[D.charAt(C>>>18),D.charAt(C>>>12&63),b>=2?"=":D.charAt(C>>>6&63),b>=1?"=":D.charAt(C&63)];return F.join("")},K=window.btoa||function($){return $.replace(/[\s\S]{1,3}/g,H)};class J{constructor(b,C,F,X){this.clear=C,this.timer=b(()=>{this.timer&&(this.timer=X(this.timer))},F)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var te=J;function ge($){window.clearTimeout($)}function ue($){window.clearInterval($)}class we extends te{constructor(b,C){super(setTimeout,ge,b,function(F){return C(),null})}}class Ee extends te{constructor(b,C){super(setInterval,ue,b,function(F){return C(),F})}}var re={now(){return Date.now?Date.now():new Date().valueOf()},defer($){return new we(0,$)},method($,...b){var C=Array.prototype.slice.call(arguments,1);return function(F){return F[$].apply(F,C.concat(arguments))}}},pe=re;function fe($,...b){for(var C=0;C<b.length;C++){var F=b[C];for(var X in F)F[X]&&F[X].constructor&&F[X].constructor===Object?$[X]=fe($[X]||{},F[X]):$[X]=F[X]}return $}function $e(){for(var $=["Pusher"],b=0;b<arguments.length;b++)typeof arguments[b]=="string"?$.push(arguments[b]):$.push(je(arguments[b]));return $.join(" : ")}function Re($,b){var C=Array.prototype.indexOf;if($===null)return-1;if(C&&$.indexOf===C)return $.indexOf(b);for(var F=0,X=$.length;F<X;F++)if($[F]===b)return F;return-1}function Le($,b){for(var C in $)Object.prototype.hasOwnProperty.call($,C)&&b($[C],C,$)}function Oe($){var b=[];return Le($,function(C,F){b.push(F)}),b}function Ve($){var b=[];return Le($,function(C){b.push(C)}),b}function N($,b,C){for(var F=0;F<$.length;F++)b.call(C||window,$[F],F,$)}function ee($,b){for(var C=[],F=0;F<$.length;F++)C.push(b($[F],F,$,C));return C}function Y($,b){var C={};return Le($,function(F,X){C[X]=b(F)}),C}function L($,b){b=b||function(X){return!!X};for(var C=[],F=0;F<$.length;F++)b($[F],F,$,C)&&C.push($[F]);return C}function V($,b){var C={};return Le($,function(F,X){(b&&b(F,X,$,C)||F)&&(C[X]=F)}),C}function ie($){var b=[];return Le($,function(C,F){b.push([F,C])}),b}function me($,b){for(var C=0;C<$.length;C++)if(b($[C],C,$))return!0;return!1}function de($,b){for(var C=0;C<$.length;C++)if(!b($[C],C,$))return!1;return!0}function ve($){return Y($,function(b){return typeof b=="object"&&(b=je(b)),encodeURIComponent(T(b.toString()))})}function he($){var b=V($,function(F){return F!==void 0}),C=ee(ie(ve(b)),pe.method("join","=")).join("&");return C}function Te($){var b=[],C=[];return function F(X,ye){var Ae,Be,nt;switch(typeof X){case"object":if(!X)return null;for(Ae=0;Ae<b.length;Ae+=1)if(b[Ae]===X)return{$ref:C[Ae]};if(b.push(X),C.push(ye),Object.prototype.toString.apply(X)==="[object Array]")for(nt=[],Ae=0;Ae<X.length;Ae+=1)nt[Ae]=F(X[Ae],ye+"["+Ae+"]");else{nt={};for(Be in X)Object.prototype.hasOwnProperty.call(X,Be)&&(nt[Be]=F(X[Be],ye+"["+JSON.stringify(Be)+"]"))}return nt;case"number":case"string":case"boolean":return X}}($,"$")}function je($){try{return JSON.stringify($)}catch{return JSON.stringify(Te($))}}class De{constructor(){this.globalLog=b=>{window.console&&window.console.log&&window.console.log(b)}}debug(...b){this.log(this.globalLog,b)}warn(...b){this.log(this.globalLogWarn,b)}error(...b){this.log(this.globalLogError,b)}globalLogWarn(b){window.console&&window.console.warn?window.console.warn(b):this.globalLog(b)}globalLogError(b){window.console&&window.console.error?window.console.error(b):this.globalLogWarn(b)}log(b,...C){var F=$e.apply(this,arguments);Nd.log?Nd.log(F):Nd.logToConsole&&b.bind(this)(F)}}var Ie=new De,He=function($,b,C,F,X){(C.headers!==void 0||C.headersProvider!=null)&&Ie.warn(`To send headers with the ${F.toString()} request, you must use AJAX, rather than JSONP.`);var ye=$.nextAuthCallbackID.toString();$.nextAuthCallbackID++;var Ae=$.getDocument(),Be=Ae.createElement("script");$.auth_callbacks[ye]=function(bt){X(null,bt)};var nt="Pusher.auth_callbacks['"+ye+"']";Be.src=C.endpoint+"?callback="+encodeURIComponent(nt)+"&"+b;var ft=Ae.getElementsByTagName("head")[0]||Ae.documentElement;ft.insertBefore(Be,ft.firstChild)},ot=He;class it{constructor(b){this.src=b}send(b){var C=this,F="Error loading "+C.src;C.script=document.createElement("script"),C.script.id=b.id,C.script.src=C.src,C.script.type="text/javascript",C.script.charset="UTF-8",C.script.addEventListener?(C.script.onerror=function(){b.callback(F)},C.script.onload=function(){b.callback(null)}):C.script.onreadystatechange=function(){(C.script.readyState==="loaded"||C.script.readyState==="complete")&&b.callback(null)},C.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(C.errorScript=document.createElement("script"),C.errorScript.id=b.id+"_error",C.errorScript.text=b.name+"('"+F+"');",C.script.async=C.errorScript.async=!1):C.script.async=!0;var X=document.getElementsByTagName("head")[0];X.insertBefore(C.script,X.firstChild),C.errorScript&&X.insertBefore(C.errorScript,C.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class pt{constructor(b,C){this.url=b,this.data=C}send(b){if(!this.request){var C=he(this.data),F=this.url+"/"+b.number+"?"+C;this.request=rt.createScriptRequest(F),this.request.send(b)}}cleanup(){this.request&&this.request.cleanup()}}var yt=function($,b){return function(C,F){var X="http"+(b?"s":"")+"://",ye=X+($.host||$.options.host)+$.options.path,Ae=rt.createJSONPRequest(ye,C),Be=rt.ScriptReceivers.create(function(nt,ft){i.remove(Be),Ae.cleanup(),ft&&ft.host&&($.host=ft.host),F&&F(nt,ft)});Ae.send(Be)}},Ot={name:"jsonp",getAgent:yt},cn=Ot;function qt($,b,C){var F=$+(b.useTLS?"s":""),X=b.useTLS?b.hostTLS:b.hostNonTLS;return F+"://"+X+C}function Dn($,b){var C="/app/"+$,F="?protocol="+c.PROTOCOL+"&client=js&version="+c.VERSION+(b?"&"+b:"");return C+F}var se={getInitial:function($,b){var C=(b.httpPath||"")+Dn($,"flash=false");return qt("ws",b,C)}},be={getInitial:function($,b){var C=(b.httpPath||"/pusher")+Dn($);return qt("http",b,C)}},qe={getInitial:function($,b){return qt("http",b,b.httpPath||"/pusher")},getPath:function($,b){return Dn($)}};class ze{constructor(){this._callbacks={}}get(b){return this._callbacks[le(b)]}add(b,C,F){var X=le(b);this._callbacks[X]=this._callbacks[X]||[],this._callbacks[X].push({fn:C,context:F})}remove(b,C,F){if(!b&&!C&&!F){this._callbacks={};return}var X=b?[le(b)]:Oe(this._callbacks);C||F?this.removeCallback(X,C,F):this.removeAllCallbacks(X)}removeCallback(b,C,F){N(b,function(X){this._callbacks[X]=L(this._callbacks[X]||[],function(ye){return C&&C!==ye.fn||F&&F!==ye.context}),this._callbacks[X].length===0&&delete this._callbacks[X]},this)}removeAllCallbacks(b){N(b,function(C){delete this._callbacks[C]},this)}}function le($){return"_"+$}class xe{constructor(b){this.callbacks=new ze,this.global_callbacks=[],this.failThrough=b}bind(b,C,F){return this.callbacks.add(b,C,F),this}bind_global(b){return this.global_callbacks.push(b),this}unbind(b,C,F){return this.callbacks.remove(b,C,F),this}unbind_global(b){return b?(this.global_callbacks=L(this.global_callbacks||[],C=>C!==b),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(b,C,F){for(var X=0;X<this.global_callbacks.length;X++)this.global_callbacks[X](b,C);var ye=this.callbacks.get(b),Ae=[];if(F?Ae.push(C,F):C&&Ae.push(C),ye&&ye.length>0)for(var X=0;X<ye.length;X++)ye[X].fn.apply(ye[X].context||window,Ae);else this.failThrough&&this.failThrough(b,C);return this}}class Ge extends xe{constructor(b,C,F,X,ye){super(),this.initialize=rt.transportConnectionInitializer,this.hooks=b,this.name=C,this.priority=F,this.key=X,this.options=ye,this.state="new",this.timeline=ye.timeline,this.activityTimeout=ye.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var b=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(b,this.options)}catch(C){return pe.defer(()=>{this.onError(C),this.changeState("closed")}),!1}return this.bindListeners(),Ie.debug("Connecting",{transport:this.name,url:b}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(b){return this.state==="open"?(pe.defer(()=>{this.socket&&this.socket.send(b)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(b){this.emit("error",{type:"WebSocketError",error:b}),this.timeline.error(this.buildTimelineMessage({error:b.toString()}))}onClose(b){b?this.changeState("closed",{code:b.code,reason:b.reason,wasClean:b.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(b){this.emit("message",b)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=b=>{this.onError(b)},this.socket.onclose=b=>{this.onClose(b)},this.socket.onmessage=b=>{this.onMessage(b)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(b,C){this.state=b,this.timeline.info(this.buildTimelineMessage({state:b,params:C})),this.emit(b,C)}buildTimelineMessage(b){return fe({cid:this.id},b)}}class at{constructor(b){this.hooks=b}isSupported(b){return this.hooks.isSupported(b)}createConnection(b,C,F,X){return new Ge(this.hooks,b,C,F,X)}}var gt=new at({urls:se,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!rt.getWebSocketAPI()},isSupported:function(){return!!rt.getWebSocketAPI()},getSocket:function($){return rt.createWebSocket($)}}),_n={urls:be,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},jn=fe({getSocket:function($){return rt.HTTPFactory.createStreamingSocket($)}},_n),Qn=fe({getSocket:function($){return rt.HTTPFactory.createPollingSocket($)}},_n),Tn={isSupported:function(){return rt.isXHRSupported()}},Jt=new at(fe({},jn,Tn)),Bl=new at(fe({},Qn,Tn)),Ul={ws:gt,xhr_streaming:Jt,xhr_polling:Bl},Dr=Ul,ke=new at({file:"sockjs",urls:qe,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function($,b){return new window.SockJS($,null,{js_path:f.getPath("sockjs",{useTLS:b.useTLS}),ignore_null_origin:b.ignoreNullOrigin})},beforeOpen:function($,b){$.send(JSON.stringify({path:b}))}}),ls={isSupported:function($){var b=rt.isXDRSupported($.useTLS);return b}},Co=new at(fe({},jn,ls)),Vl=new at(fe({},Qn,ls));Dr.xdr_streaming=Co,Dr.xdr_polling=Vl,Dr.sockjs=ke;var Hl=Dr;class Wl extends xe{constructor(){super();var b=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){b.emit("online")},!1),window.addEventListener("offline",function(){b.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Gl=new Wl;class Kl{constructor(b,C,F){this.manager=b,this.transport=C,this.minPingDelay=F.minPingDelay,this.maxPingDelay=F.maxPingDelay,this.pingDelay=void 0}createConnection(b,C,F,X){X=fe({},X,{activityTimeout:this.pingDelay});var ye=this.transport.createConnection(b,C,F,X),Ae=null,Be=function(){ye.unbind("open",Be),ye.bind("closed",nt),Ae=pe.now()},nt=ft=>{if(ye.unbind("closed",nt),ft.code===1002||ft.code===1003)this.manager.reportDeath();else if(!ft.wasClean&&Ae){var bt=pe.now()-Ae;bt<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(bt/2,this.minPingDelay))}};return ye.bind("open",Be),ye}isSupported(b){return this.manager.isAlive()&&this.transport.isSupported(b)}}const Fi={decodeMessage:function($){try{var b=JSON.parse($.data),C=b.data;if(typeof C=="string")try{C=JSON.parse(b.data)}catch{}var F={event:b.event,channel:b.channel,data:C};return b.user_id&&(F.user_id=b.user_id),F}catch(X){throw{type:"MessageParseError",error:X,data:$.data}}},encodeMessage:function($){return JSON.stringify($)},processHandshake:function($){var b=Fi.decodeMessage($);if(b.event==="pusher:connection_established"){if(!b.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:b.data.socket_id,activityTimeout:b.data.activity_timeout*1e3}}else{if(b.event==="pusher:error")return{action:this.getCloseAction(b.data),error:this.getCloseError(b.data)};throw"Invalid handshake"}},getCloseAction:function($){return $.code<4e3?$.code>=1002&&$.code<=1004?"backoff":null:$.code===4e3?"tls_only":$.code<4100?"refused":$.code<4200?"backoff":$.code<4300?"retry":"refused"},getCloseError:function($){return $.code!==1e3&&$.code!==1001?{type:"PusherError",data:{code:$.code,message:$.reason||$.message}}:null}};var bs=Fi;class Ql extends xe{constructor(b,C){super(),this.id=b,this.transport=C,this.activityTimeout=C.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(b){return this.transport.send(b)}send_event(b,C,F){var X={event:b,data:C};return F&&(X.channel=F),Ie.debug("Event sent",X),this.send(bs.encodeMessage(X))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var b={message:F=>{var X;try{X=bs.decodeMessage(F)}catch(ye){this.emit("error",{type:"MessageParseError",error:ye,data:F.data})}if(X!==void 0){switch(Ie.debug("Event recd",X),X.event){case"pusher:error":this.emit("error",{type:"PusherError",data:X.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",X)}},activity:()=>{this.emit("activity")},error:F=>{this.emit("error",F)},closed:F=>{C(),F&&F.code&&this.handleCloseEvent(F),this.transport=null,this.emit("closed")}},C=()=>{Le(b,(F,X)=>{this.transport.unbind(X,F)})};Le(b,(F,X)=>{this.transport.bind(X,F)})}handleCloseEvent(b){var C=bs.getCloseAction(b),F=bs.getCloseError(b);F&&this.emit("error",F),C&&this.emit(C,{action:C,error:F})}}class Jl{constructor(b,C){this.transport=b,this.callback=C,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=b=>{this.unbindListeners();var C;try{C=bs.processHandshake(b)}catch(F){this.finish("error",{error:F}),this.transport.close();return}C.action==="connected"?this.finish("connected",{connection:new Ql(C.id,this.transport),activityTimeout:C.activityTimeout}):(this.finish(C.action,{error:C.error}),this.transport.close())},this.onClosed=b=>{this.unbindListeners();var C=bs.getCloseAction(b)||"backoff",F=bs.getCloseError(b);this.finish(C,{error:F})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(b,C){this.callback(fe({transport:this.transport,action:b},C))}}class Xl{constructor(b,C){this.timeline=b,this.options=C||{}}send(b,C){this.timeline.isEmpty()||this.timeline.send(rt.TimelineTransport.getAgent(this,b),C)}}class $o extends xe{constructor(b,C){super(function(F,X){Ie.debug("No callbacks on "+b+" for "+F)}),this.name=b,this.pusher=C,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(b,C){return C(null,{auth:""})}trigger(b,C){if(b.indexOf("client-")!==0)throw new _("Event '"+b+"' does not start with 'client-'");if(!this.subscribed){var F=p.buildLogSuffix("triggeringClientEvents");Ie.warn(`Client event triggered before channel 'subscription_succeeded' event . ${F}`)}return this.pusher.send_event(b,C,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(b){var C=b.event,F=b.data;if(C==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(b);else if(C==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(b);else if(C.indexOf("pusher_internal:")!==0){var X={};this.emit(C,F,X)}}handleSubscriptionSucceededEvent(b){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",b.data)}handleSubscriptionCountEvent(b){b.data.subscription_count&&(this.subscriptionCount=b.data.subscription_count),this.emit("pusher:subscription_count",b.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(b,C)=>{b?(this.subscriptionPending=!1,Ie.error(b.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:b.message},b instanceof M?{status:b.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:C.auth,channel_data:C.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class To extends $o{authorize(b,C){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:b},C)}}class Zl{constructor(){this.reset()}get(b){return Object.prototype.hasOwnProperty.call(this.members,b)?{id:b,info:this.members[b]}:null}each(b){Le(this.members,(C,F)=>{b(this.get(F))})}setMyID(b){this.myID=b}onSubscription(b){this.members=b.presence.hash,this.count=b.presence.count,this.me=this.get(this.myID)}addMember(b){return this.get(b.user_id)===null&&this.count++,this.members[b.user_id]=b.user_info,this.get(b.user_id)}removeMember(b){var C=this.get(b.user_id);return C&&(delete this.members[b.user_id],this.count--),C}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Yl=function($,b,C,F){function X(ye){return ye instanceof C?ye:new C(function(Ae){Ae(ye)})}return new(C||(C=Promise))(function(ye,Ae){function Be(bt){try{ft(F.next(bt))}catch(Vt){Ae(Vt)}}function nt(bt){try{ft(F.throw(bt))}catch(Vt){Ae(Vt)}}function ft(bt){bt.done?ye(bt.value):X(bt.value).then(Be,nt)}ft((F=F.apply($,b||[])).next())})};class ec extends To{constructor(b,C){super(b,C),this.members=new Zl}authorize(b,C){super.authorize(b,(F,X)=>Yl(this,void 0,void 0,function*(){if(!F)if(X=X,X.channel_data!=null){var ye=JSON.parse(X.channel_data);this.members.setMyID(ye.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let Ae=p.buildLogSuffix("authorizationEndpoint");Ie.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${Ae}, or the user should be signed in.`),C("Invalid auth response");return}C(F,X)}))}handleEvent(b){var C=b.event;if(C.indexOf("pusher_internal:")===0)this.handleInternalEvent(b);else{var F=b.data,X={};b.user_id&&(X.user_id=b.user_id),this.emit(C,F,X)}}handleInternalEvent(b){var C=b.event,F=b.data;switch(C){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(b);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(b);break;case"pusher_internal:member_added":var X=this.members.addMember(F);this.emit("pusher:member_added",X);break;case"pusher_internal:member_removed":var ye=this.members.removeMember(F);ye&&this.emit("pusher:member_removed",ye);break}}handleSubscriptionSucceededEvent(b){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(b.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var tc=r(1),Ao=r(0);class nc extends To{constructor(b,C,F){super(b,C),this.key=null,this.nacl=F}authorize(b,C){super.authorize(b,(F,X)=>{if(F){C(F,X);return}let ye=X.shared_secret;if(!ye){C(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(Ao.decode)(ye),delete X.shared_secret,C(null,X)})}trigger(b,C){throw new O("Client events are not currently supported for encrypted channels")}handleEvent(b){var C=b.event,F=b.data;if(C.indexOf("pusher_internal:")===0||C.indexOf("pusher:")===0){super.handleEvent(b);return}this.handleEncryptedEvent(C,F)}handleEncryptedEvent(b,C){if(!this.key){Ie.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!C.ciphertext||!C.nonce){Ie.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+C);return}let F=Object(Ao.decode)(C.ciphertext);if(F.length<this.nacl.secretbox.overheadLength){Ie.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${F.length}`);return}let X=Object(Ao.decode)(C.nonce);if(X.length<this.nacl.secretbox.nonceLength){Ie.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${X.length}`);return}let ye=this.nacl.secretbox.open(F,X,this.key);if(ye===null){Ie.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(Ae,Be)=>{if(Ae){Ie.error(`Failed to make a request to the authEndpoint: ${Be}. Unable to fetch new key, so dropping encrypted event`);return}if(ye=this.nacl.secretbox.open(F,X,this.key),ye===null){Ie.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(b,this.getDataToEmit(ye))});return}this.emit(b,this.getDataToEmit(ye))}getDataToEmit(b){let C=Object(tc.decode)(b);try{return JSON.parse(C)}catch{return C}}}class sc extends xe{constructor(b,C){super(),this.state="initialized",this.connection=null,this.key=b,this.options=C,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var F=rt.getNetwork();F.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),F.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(b){return this.connection?this.connection.send(b):!1}send_event(b,C,F){return this.connection?this.connection.send_event(b,C,F):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var b=(C,F)=>{C?this.runner=this.strategy.connect(0,b):F.action==="error"?(this.emit("error",{type:"HandshakeError",error:F.error}),this.timeline.error({handshakeError:F.error})):(this.abortConnecting(),this.handshakeCallbacks[F.action](F))};this.runner=this.strategy.connect(0,b)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var b=this.abandonConnection();b.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(b){this.timeline.info({action:"retry",delay:b}),b>0&&this.emit("connecting_in",Math.round(b/1e3)),this.retryTimer=new we(b||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new we(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new we(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new we(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(b){return fe({},b,{message:C=>{this.resetActivityCheck(),this.emit("message",C)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:C=>{this.emit("error",C)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(b){return fe({},b,{connected:C=>{this.activityTimeout=Math.min(this.options.activityTimeout,C.activityTimeout,C.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(C.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let b=C=>F=>{F.error&&this.emit("error",{type:"WebSocketError",error:F.error}),C(F)};return{tls_only:b(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:b(()=>{this.disconnect()}),backoff:b(()=>{this.retryIn(1e3)}),retry:b(()=>{this.retryIn(0)})}}setConnection(b){this.connection=b;for(var C in this.connectionCallbacks)this.connection.bind(C,this.connectionCallbacks[C]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var b in this.connectionCallbacks)this.connection.unbind(b,this.connectionCallbacks[b]);var C=this.connection;return this.connection=null,C}}updateState(b,C){var F=this.state;if(this.state=b,F!==b){var X=b;X==="connected"&&(X+=" with new socket ID "+C.socket_id),Ie.debug("State changed",F+" -> "+X),this.timeline.info({state:b,params:C}),this.emit("state_change",{previous:F,current:b}),this.emit(b,C)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class rc{constructor(){this.channels={}}add(b,C){return this.channels[b]||(this.channels[b]=oc(b,C)),this.channels[b]}all(){return Ve(this.channels)}find(b){return this.channels[b]}remove(b){var C=this.channels[b];return delete this.channels[b],C}disconnect(){Le(this.channels,function(b){b.disconnect()})}}function oc($,b){if($.indexOf("private-encrypted-")===0){if(b.config.nacl)return Jn.createEncryptedChannel($,b,b.config.nacl);let C="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",F=p.buildLogSuffix("encryptedChannelSupport");throw new O(`${C}. ${F}`)}else{if($.indexOf("private-")===0)return Jn.createPrivateChannel($,b);if($.indexOf("presence-")===0)return Jn.createPresenceChannel($,b);if($.indexOf("#")===0)throw new w('Cannot create a channel with name "'+$+'".');return Jn.createChannel($,b)}}var ic={createChannels(){return new rc},createConnectionManager($,b){return new sc($,b)},createChannel($,b){return new $o($,b)},createPrivateChannel($,b){return new To($,b)},createPresenceChannel($,b){return new ec($,b)},createEncryptedChannel($,b,C){return new nc($,b,C)},createTimelineSender($,b){return new Xl($,b)},createHandshake($,b){return new Jl($,b)},createAssistantToTheTransportManager($,b,C){return new Kl($,b,C)}},Jn=ic;class qi{constructor(b){this.options=b||{},this.livesLeft=this.options.lives||1/0}getAssistant(b){return Jn.createAssistantToTheTransportManager(this,b,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class _s{constructor(b,C){this.strategies=b,this.loop=!!C.loop,this.failFast=!!C.failFast,this.timeout=C.timeout,this.timeoutLimit=C.timeoutLimit}isSupported(){return me(this.strategies,pe.method("isSupported"))}connect(b,C){var F=this.strategies,X=0,ye=this.timeout,Ae=null,Be=(nt,ft)=>{ft?C(null,ft):(X=X+1,this.loop&&(X=X%F.length),X<F.length?(ye&&(ye=ye*2,this.timeoutLimit&&(ye=Math.min(ye,this.timeoutLimit))),Ae=this.tryStrategy(F[X],b,{timeout:ye,failFast:this.failFast},Be)):C(!0))};return Ae=this.tryStrategy(F[X],b,{timeout:ye,failFast:this.failFast},Be),{abort:function(){Ae.abort()},forceMinPriority:function(nt){b=nt,Ae&&Ae.forceMinPriority(nt)}}}tryStrategy(b,C,F,X){var ye=null,Ae=null;return F.timeout>0&&(ye=new we(F.timeout,function(){Ae.abort(),X(!0)})),Ae=b.connect(C,function(Be,nt){Be&&ye&&ye.isRunning()&&!F.failFast||(ye&&ye.ensureAborted(),X(Be,nt))}),{abort:function(){ye&&ye.ensureAborted(),Ae.abort()},forceMinPriority:function(Be){Ae.forceMinPriority(Be)}}}}class Eo{constructor(b){this.strategies=b}isSupported(){return me(this.strategies,pe.method("isSupported"))}connect(b,C){return ac(this.strategies,b,function(F,X){return function(ye,Ae){if(X[F].error=ye,ye){lc(X)&&C(!0);return}N(X,function(Be){Be.forceMinPriority(Ae.transport.priority)}),C(null,Ae)}})}}function ac($,b,C){var F=ee($,function(X,ye,Ae,Be){return X.connect(b,C(ye,Be))});return{abort:function(){N(F,cc)},forceMinPriority:function(X){N(F,function(ye){ye.forceMinPriority(X)})}}}function lc($){return de($,function(b){return!!b.error})}function cc($){!$.error&&!$.aborted&&($.abort(),$.aborted=!0)}class uc{constructor(b,C,F){this.strategy=b,this.transports=C,this.ttl=F.ttl||1800*1e3,this.usingTLS=F.useTLS,this.timeline=F.timeline}isSupported(){return this.strategy.isSupported()}connect(b,C){var F=this.usingTLS,X=dc(F),ye=X&&X.cacheSkipCount?X.cacheSkipCount:0,Ae=[this.strategy];if(X&&X.timestamp+this.ttl>=pe.now()){var Be=this.transports[X.transport];Be&&(["ws","wss"].includes(X.transport)||ye>3?(this.timeline.info({cached:!0,transport:X.transport,latency:X.latency}),Ae.push(new _s([Be],{timeout:X.latency*2+1e3,failFast:!0}))):ye++)}var nt=pe.now(),ft=Ae.pop().connect(b,function bt(Vt,vc){Vt?(zi(F),Ae.length>0?(nt=pe.now(),ft=Ae.pop().connect(b,bt)):C(Vt)):(fc(F,vc.transport.name,pe.now()-nt,ye),C(null,vc))});return{abort:function(){ft.abort()},forceMinPriority:function(bt){b=bt,ft&&ft.forceMinPriority(bt)}}}}function Io($){return"pusherTransport"+($?"TLS":"NonTLS")}function dc($){var b=rt.getLocalStorage();if(b)try{var C=b[Io($)];if(C)return JSON.parse(C)}catch{zi($)}return null}function fc($,b,C,F){var X=rt.getLocalStorage();if(X)try{X[Io($)]=je({timestamp:pe.now(),transport:b,latency:C,cacheSkipCount:F})}catch{}}function zi($){var b=rt.getLocalStorage();if(b)try{delete b[Io($)]}catch{}}class jr{constructor(b,{delay:C}){this.strategy=b,this.options={delay:C}}isSupported(){return this.strategy.isSupported()}connect(b,C){var F=this.strategy,X,ye=new we(this.options.delay,function(){X=F.connect(b,C)});return{abort:function(){ye.ensureAborted(),X&&X.abort()},forceMinPriority:function(Ae){b=Ae,X&&X.forceMinPriority(Ae)}}}}class un{constructor(b,C,F){this.test=b,this.trueBranch=C,this.falseBranch=F}isSupported(){var b=this.test()?this.trueBranch:this.falseBranch;return b.isSupported()}connect(b,C){var F=this.test()?this.trueBranch:this.falseBranch;return F.connect(b,C)}}class Nr{constructor(b){this.strategy=b}isSupported(){return this.strategy.isSupported()}connect(b,C){var F=this.strategy.connect(b,function(X,ye){ye&&F.abort(),C(X,ye)});return F}}function An($){return function(){return $.isSupported()}}var Os=function($,b,C){var F={};function X(e0,VK,HK,WK,GK){var t0=C($,e0,VK,HK,WK,GK);return F[e0]=t0,t0}var ye=Object.assign({},b,{hostNonTLS:$.wsHost+":"+$.wsPort,hostTLS:$.wsHost+":"+$.wssPort,httpPath:$.wsPath}),Ae=Object.assign({},ye,{useTLS:!0}),Be=Object.assign({},b,{hostNonTLS:$.httpHost+":"+$.httpPort,hostTLS:$.httpHost+":"+$.httpsPort,httpPath:$.httpPath}),nt={loop:!0,timeout:15e3,timeoutLimit:6e4},ft=new qi({minPingDelay:1e4,maxPingDelay:$.activityTimeout}),bt=new qi({lives:2,minPingDelay:1e4,maxPingDelay:$.activityTimeout}),Vt=X("ws","ws",3,ye,ft),vc=X("wss","ws",3,Ae,ft),FK=X("sockjs","sockjs",1,Be),Kv=X("xhr_streaming","xhr_streaming",1,Be,bt),qK=X("xdr_streaming","xdr_streaming",1,Be,bt),Qv=X("xhr_polling","xhr_polling",1,Be),zK=X("xdr_polling","xdr_polling",1,Be),Jv=new _s([Vt],nt),BK=new _s([vc],nt),UK=new _s([FK],nt),Xv=new _s([new un(An(Kv),Kv,qK)],nt),Zv=new _s([new un(An(Qv),Qv,zK)],nt),Yv=new _s([new un(An(Xv),new Eo([Xv,new jr(Zv,{delay:4e3})]),Zv)],nt),Fd=new un(An(Yv),Yv,UK),qd;return b.useTLS?qd=new Eo([Jv,new jr(Fd,{delay:2e3})]):qd=new Eo([Jv,new jr(BK,{delay:2e3}),new jr(Fd,{delay:5e3})]),new uc(new Nr(new un(An(Vt),qd,Fd)),F,{ttl:18e5,timeline:b.timeline,useTLS:b.useTLS})},Xn=Os,hc=function(){var $=this;$.timeline.info($.buildTimelineMessage({transport:$.name+($.options.useTLS?"s":"")})),$.hooks.isInitialized()?$.changeState("initialized"):$.hooks.file?($.changeState("initializing"),f.load($.hooks.file,{useTLS:$.options.useTLS},function(b,C){$.hooks.isInitialized()?($.changeState("initialized"),C(!0)):(b&&$.onError(b),$.onClose(),C(!1))})):$.onClose()},pc={getRequest:function($){var b=new window.XDomainRequest;return b.ontimeout=function(){$.emit("error",new k),$.close()},b.onerror=function(C){$.emit("error",C),$.close()},b.onprogress=function(){b.responseText&&b.responseText.length>0&&$.onChunk(200,b.responseText)},b.onload=function(){b.responseText&&b.responseText.length>0&&$.onChunk(200,b.responseText),$.emit("finished",200),$.close()},b},abortRequest:function($){$.ontimeout=$.onerror=$.onprogress=$.onload=null,$.abort()}},mc=pc;const Uv=256*1024;class XG extends xe{constructor(b,C,F){super(),this.hooks=b,this.method=C,this.url=F}start(b){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},rt.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(b)}close(){this.unloader&&(rt.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(b,C){for(;;){var F=this.advanceBuffer(C);if(F)this.emit("chunk",{status:b,data:F});else break}this.isBufferTooLong(C)&&this.emit("buffer_too_long")}advanceBuffer(b){var C=b.slice(this.position),F=C.indexOf(`
`);return F!==-1?(this.position+=F+1,C.slice(0,F)):null}isBufferTooLong(b){return this.position===b.length&&b.length>Uv}}var Dd;(function($){$[$.CONNECTING=0]="CONNECTING",$[$.OPEN=1]="OPEN",$[$.CLOSED=3]="CLOSED"})(Dd||(Dd={}));var Fr=Dd,ZG=1;class YG{constructor(b,C){this.hooks=b,this.session=Hv(1e3)+"/"+sK(8),this.location=eK(C),this.readyState=Fr.CONNECTING,this.openStream()}send(b){return this.sendRaw(JSON.stringify([b]))}ping(){this.hooks.sendHeartbeat(this)}close(b,C){this.onClose(b,C,!0)}sendRaw(b){if(this.readyState===Fr.OPEN)try{return rt.createSocketRequest("POST",Vv(tK(this.location,this.session))).start(b),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(b,C,F){this.closeStream(),this.readyState=Fr.CLOSED,this.onclose&&this.onclose({code:b,reason:C,wasClean:F})}onChunk(b){if(b.status===200){this.readyState===Fr.OPEN&&this.onActivity();var C,F=b.data.slice(0,1);switch(F){case"o":C=JSON.parse(b.data.slice(1)||"{}"),this.onOpen(C);break;case"a":C=JSON.parse(b.data.slice(1)||"[]");for(var X=0;X<C.length;X++)this.onEvent(C[X]);break;case"m":C=JSON.parse(b.data.slice(1)||"null"),this.onEvent(C);break;case"h":this.hooks.onHeartbeat(this);break;case"c":C=JSON.parse(b.data.slice(1)||"[]"),this.onClose(C[0],C[1],!0);break}}}onOpen(b){this.readyState===Fr.CONNECTING?(b&&b.hostname&&(this.location.base=nK(this.location.base,b.hostname)),this.readyState=Fr.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(b){this.readyState===Fr.OPEN&&this.onmessage&&this.onmessage({data:b})}onActivity(){this.onactivity&&this.onactivity()}onError(b){this.onerror&&this.onerror(b)}openStream(){this.stream=rt.createSocketRequest("POST",Vv(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",b=>{this.onChunk(b)}),this.stream.bind("finished",b=>{this.hooks.onFinished(this,b)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(b){pe.defer(()=>{this.onError(b),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function eK($){var b=/([^\?]*)\/*(\??.*)/.exec($);return{base:b[1],queryString:b[2]}}function tK($,b){return $.base+"/"+b+"/xhr_send"}function Vv($){var b=$.indexOf("?")===-1?"?":"&";return $+b+"t="+ +new Date+"&n="+ZG++}function nK($,b){var C=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec($);return C[1]+b+C[3]}function Hv($){return rt.randomInt($)}function sK($){for(var b=[],C=0;C<$;C++)b.push(Hv(32).toString(32));return b.join("")}var rK=YG,oK={getReceiveURL:function($,b){return $.base+"/"+b+"/xhr_streaming"+$.queryString},onHeartbeat:function($){$.sendRaw("[]")},sendHeartbeat:function($){$.sendRaw("[]")},onFinished:function($,b){$.onClose(1006,"Connection interrupted ("+b+")",!1)}},iK=oK,aK={getReceiveURL:function($,b){return $.base+"/"+b+"/xhr"+$.queryString},onHeartbeat:function(){},sendHeartbeat:function($){$.sendRaw("[]")},onFinished:function($,b){b===200?$.reconnect():$.onClose(1006,"Connection interrupted ("+b+")",!1)}},lK=aK,cK={getRequest:function($){var b=rt.getXHRAPI(),C=new b;return C.onreadystatechange=C.onprogress=function(){switch(C.readyState){case 3:C.responseText&&C.responseText.length>0&&$.onChunk(C.status,C.responseText);break;case 4:C.responseText&&C.responseText.length>0&&$.onChunk(C.status,C.responseText),$.emit("finished",C.status),$.close();break}},C},abortRequest:function($){$.onreadystatechange=null,$.abort()}},uK=cK,dK={createStreamingSocket($){return this.createSocket(iK,$)},createPollingSocket($){return this.createSocket(lK,$)},createSocket($,b){return new rK($,b)},createXHR($,b){return this.createRequest(uK,$,b)},createRequest($,b,C){return new XG($,b,C)}},Wv=dK;Wv.createXDR=function($,b){return this.createRequest(mc,$,b)};var fK=Wv,hK={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:i,DependenciesReceivers:d,getDefaultStrategy:Xn,Transports:Hl,transportConnectionInitializer:hc,HTTPFactory:fK,TimelineTransport:cn,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup($){window.Pusher=$;var b=()=>{this.onDocumentBody($.ready)};window.JSON?b():f.load("json2",{},b)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:B,jsonp:ot}},onDocumentBody($){document.body?$():setTimeout(()=>{this.onDocumentBody($)},0)},createJSONPRequest($,b){return new pt($,b)},createScriptRequest($){return new it($)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var $=this.getXHRAPI();return new $},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Gl},createWebSocket($){var b=this.getWebSocketAPI();return new b($)},createSocketRequest($,b){if(this.isXHRSupported())return this.HTTPFactory.createXHR($,b);if(this.isXDRSupported(b.indexOf("https:")===0))return this.HTTPFactory.createXDR($,b);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var $=this.getXHRAPI();return!!$&&new $().withCredentials!==void 0},isXDRSupported($){var b=$?"https:":"http:",C=this.getProtocol();return!!window.XDomainRequest&&C===b},addUnloadListener($){window.addEventListener!==void 0?window.addEventListener("unload",$,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",$)},removeUnloadListener($){window.addEventListener!==void 0?window.removeEventListener("unload",$,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",$)},randomInt($){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*$)}},rt=hK,jd;(function($){$[$.ERROR=3]="ERROR",$[$.INFO=6]="INFO",$[$.DEBUG=7]="DEBUG"})(jd||(jd={}));var gc=jd;class pK{constructor(b,C,F){this.key=b,this.session=C,this.events=[],this.options=F||{},this.sent=0,this.uniqueID=0}log(b,C){b<=this.options.level&&(this.events.push(fe({},C,{timestamp:pe.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(b){this.log(gc.ERROR,b)}info(b){this.log(gc.INFO,b)}debug(b){this.log(gc.DEBUG,b)}isEmpty(){return this.events.length===0}send(b,C){var F=fe({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],b(F,(X,ye)=>{X||this.sent++,C&&C(X,ye)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class mK{constructor(b,C,F,X){this.name=b,this.priority=C,this.transport=F,this.options=X||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(b,C){if(this.isSupported()){if(this.priority<b)return Gv(new S,C)}else return Gv(new P,C);var F=!1,X=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),ye=null,Ae=function(){X.unbind("initialized",Ae),X.connect()},Be=function(){ye=Jn.createHandshake(X,function(Vt){F=!0,bt(),C(null,Vt)})},nt=function(Vt){bt(),C(Vt)},ft=function(){bt();var Vt;Vt=je(X),C(new E(Vt))},bt=function(){X.unbind("initialized",Ae),X.unbind("open",Be),X.unbind("error",nt),X.unbind("closed",ft)};return X.bind("initialized",Ae),X.bind("open",Be),X.bind("error",nt),X.bind("closed",ft),X.initialize(),{abort:()=>{F||(bt(),ye?ye.close():X.close())},forceMinPriority:Vt=>{F||this.priority<Vt&&(ye?ye.close():X.close())}}}}function Gv($,b){return pe.defer(function(){b($)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:gK}=rt;var vK=function($,b,C,F,X,ye){var Ae=gK[C];if(!Ae)throw new I(C);var Be=(!$.enabledTransports||Re($.enabledTransports,b)!==-1)&&(!$.disabledTransports||Re($.disabledTransports,b)===-1),nt;return Be?(X=Object.assign({ignoreNullOrigin:$.ignoreNullOrigin},X),nt=new mK(b,F,ye?ye.getAssistant(Ae):Ae,X)):nt=yK,nt},yK={isSupported:function(){return!1},connect:function($,b){var C=pe.defer(function(){b(new P)});return{abort:function(){C.ensureAborted()},forceMinPriority:function(){}}}};function bK($){if($==null)throw"You must pass an options object";if($.cluster==null)throw"Options object must provide a cluster";"disableStats"in $&&Ie.warn("The disableStats option is deprecated in favor of enableStats")}const _K=($,b)=>{var C="socket_id="+encodeURIComponent($.socketId);for(var F in b.params)C+="&"+encodeURIComponent(F)+"="+encodeURIComponent(b.params[F]);if(b.paramsProvider!=null){let X=b.paramsProvider();for(var F in X)C+="&"+encodeURIComponent(F)+"="+encodeURIComponent(X[F])}return C};var xK=$=>{if(typeof rt.getAuthorizers()[$.transport]>"u")throw`'${$.transport}' is not a recognized auth transport`;return(b,C)=>{const F=_K(b,$);rt.getAuthorizers()[$.transport](rt,F,$,v.UserAuthentication,C)}};const wK=($,b)=>{var C="socket_id="+encodeURIComponent($.socketId);C+="&channel_name="+encodeURIComponent($.channelName);for(var F in b.params)C+="&"+encodeURIComponent(F)+"="+encodeURIComponent(b.params[F]);if(b.paramsProvider!=null){let X=b.paramsProvider();for(var F in X)C+="&"+encodeURIComponent(F)+"="+encodeURIComponent(X[F])}return C};var kK=$=>{if(typeof rt.getAuthorizers()[$.transport]>"u")throw`'${$.transport}' is not a recognized auth transport`;return(b,C)=>{const F=wK(b,$);rt.getAuthorizers()[$.transport](rt,F,$,v.ChannelAuthorization,C)}};const SK=($,b,C)=>{const F={authTransport:b.transport,authEndpoint:b.endpoint,auth:{params:b.params,headers:b.headers}};return(X,ye)=>{const Ae=$.channel(X.channelName);C(Ae,F).authorize(X.socketId,ye)}};function CK($,b){let C={activityTimeout:$.activityTimeout||c.activityTimeout,cluster:$.cluster,httpPath:$.httpPath||c.httpPath,httpPort:$.httpPort||c.httpPort,httpsPort:$.httpsPort||c.httpsPort,pongTimeout:$.pongTimeout||c.pongTimeout,statsHost:$.statsHost||c.stats_host,unavailableTimeout:$.unavailableTimeout||c.unavailableTimeout,wsPath:$.wsPath||c.wsPath,wsPort:$.wsPort||c.wsPort,wssPort:$.wssPort||c.wssPort,enableStats:IK($),httpHost:$K($),useTLS:EK($),wsHost:TK($),userAuthenticator:PK($),channelAuthorizer:OK($,b)};return"disabledTransports"in $&&(C.disabledTransports=$.disabledTransports),"enabledTransports"in $&&(C.enabledTransports=$.enabledTransports),"ignoreNullOrigin"in $&&(C.ignoreNullOrigin=$.ignoreNullOrigin),"timelineParams"in $&&(C.timelineParams=$.timelineParams),"nacl"in $&&(C.nacl=$.nacl),C}function $K($){return $.httpHost?$.httpHost:$.cluster?`sockjs-${$.cluster}.pusher.com`:c.httpHost}function TK($){return $.wsHost?$.wsHost:AK($.cluster)}function AK($){return`ws-${$}.pusher.com`}function EK($){return rt.getProtocol()==="https:"?!0:$.forceTLS!==!1}function IK($){return"enableStats"in $?$.enableStats:"disableStats"in $?!$.disableStats:!1}function PK($){const b=Object.assign(Object.assign({},c.userAuthentication),$.userAuthentication);return"customHandler"in b&&b.customHandler!=null?b.customHandler:xK(b)}function MK($,b){let C;return"channelAuthorization"in $?C=Object.assign(Object.assign({},c.channelAuthorization),$.channelAuthorization):(C={transport:$.authTransport||c.authTransport,endpoint:$.authEndpoint||c.authEndpoint},"auth"in $&&("params"in $.auth&&(C.params=$.auth.params),"headers"in $.auth&&(C.headers=$.auth.headers)),"authorizer"in $&&(C.customHandler=SK(b,C,$.authorizer))),C}function OK($,b){const C=MK($,b);return"customHandler"in C&&C.customHandler!=null?C.customHandler:kK(C)}class LK extends xe{constructor(b){super(function(C,F){Ie.debug(`No callbacks on watchlist events for ${C}`)}),this.pusher=b,this.bindWatchlistInternalEvent()}handleEvent(b){b.data.events.forEach(C=>{this.emit(C.name,C)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",b=>{var C=b.event;C==="pusher_internal:watchlist_events"&&this.handleEvent(b)})}}function RK(){let $,b;return{promise:new Promise((F,X)=>{$=F,b=X}),resolve:$,reject:b}}var DK=RK;class jK extends xe{constructor(b){super(function(C,F){Ie.debug("No callbacks on user for "+C)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(C,F)=>{if(C){Ie.warn(`Error during signin: ${C}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:F.auth,user_data:F.user_data})},this.pusher=b,this.pusher.connection.bind("state_change",({previous:C,current:F})=>{C!=="connected"&&F==="connected"&&this._signin(),C==="connected"&&F!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new LK(b),this.pusher.connection.bind("message",C=>{var F=C.event;F==="pusher:signin_success"&&this._onSigninSuccess(C.data),this.serverToUserChannel&&this.serverToUserChannel.name===C.channel&&this.serverToUserChannel.handleEvent(C)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(b){try{this.user_data=JSON.parse(b.user_data)}catch{Ie.error(`Failed parsing user data after signin: ${b.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){Ie.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const b=C=>{C.subscriptionPending&&C.subscriptionCancelled?C.reinstateSubscription():!C.subscriptionPending&&this.pusher.connection.state==="connected"&&C.subscribe()};this.serverToUserChannel=new $o(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((C,F)=>{C.indexOf("pusher_internal:")===0||C.indexOf("pusher:")===0||this.emit(C,F)}),b(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:b,resolve:C}=DK();b.done=!1;const F=()=>{b.done=!0};b.then(F).catch(F),this.signinDonePromise=b,this._signinDoneResolve=C}}class dn{static ready(){dn.isReady=!0;for(var b=0,C=dn.instances.length;b<C;b++)dn.instances[b].connect()}static getClientFeatures(){return Oe(V({ws:rt.Transports.ws},function(b){return b.isSupported({})}))}constructor(b,C){NK(b),bK(C),this.key=b,this.config=CK(C,this),this.channels=Jn.createChannels(),this.global_emitter=new xe,this.sessionID=rt.randomInt(1e9),this.timeline=new pK(this.key,this.sessionID,{cluster:this.config.cluster,features:dn.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:gc.INFO,version:c.VERSION}),this.config.enableStats&&(this.timelineSender=Jn.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+rt.TimelineTransport.name}));var F=X=>rt.getDefaultStrategy(this.config,X,vK);this.connection=Jn.createConnectionManager(this.key,{getStrategy:F,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",X=>{var ye=X.event,Ae=ye.indexOf("pusher_internal:")===0;if(X.channel){var Be=this.channel(X.channel);Be&&Be.handleEvent(X)}Ae||this.global_emitter.emit(X.event,X.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",X=>{Ie.warn(X)}),dn.instances.push(this),this.timeline.info({instances:dn.instances.length}),this.user=new jK(this),dn.isReady&&this.connect()}channel(b){return this.channels.find(b)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var b=this.connection.isUsingTLS(),C=this.timelineSender;this.timelineSenderTimer=new Ee(6e4,function(){C.send(b)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(b,C,F){return this.global_emitter.bind(b,C,F),this}unbind(b,C,F){return this.global_emitter.unbind(b,C,F),this}bind_global(b){return this.global_emitter.bind_global(b),this}unbind_global(b){return this.global_emitter.unbind_global(b),this}unbind_all(b){return this.global_emitter.unbind_all(),this}subscribeAll(){var b;for(b in this.channels.channels)this.channels.channels.hasOwnProperty(b)&&this.subscribe(b)}subscribe(b){var C=this.channels.add(b,this);return C.subscriptionPending&&C.subscriptionCancelled?C.reinstateSubscription():!C.subscriptionPending&&this.connection.state==="connected"&&C.subscribe(),C}unsubscribe(b){var C=this.channels.find(b);C&&C.subscriptionPending?C.cancelSubscription():(C=this.channels.remove(b),C&&C.subscribed&&C.unsubscribe())}send_event(b,C,F){return this.connection.send_event(b,C,F)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}dn.instances=[],dn.isReady=!1,dn.logToConsole=!1,dn.Runtime=rt,dn.ScriptReceivers=rt.ScriptReceivers,dn.DependenciesReceivers=rt.DependenciesReceivers,dn.auth_callbacks=rt.auth_callbacks;var Nd=s.default=dn;function NK($){if($==null)throw"You must pass your app key when you instantiate Pusher."}rt.setup(dn)}])})})(Hm);var h2=Hm.exports;const p2=Ep(h2);window.Pusher=p2;let Er=null;const m2=e=>{const t=e.channel.bind(e);e.channel=function(n){const s=t(n);return s.whisper||(s.whisper=function(r,o){if(this.subscription&&this.subscription.trigger)return this.subscription.trigger(`client-${r}`,o);if(this.pusher&&this.pusher.trigger)return this.pusher.trigger(this.name,`client-${r}`,o);throw new Error("Unable to send whisper event")}),s}},Wm=()=>Er||(Er=new f2({broadcaster:"pusher",key:"8N4y8QSdfIB3nh2D",wsHost:"websocket.geteasy.ai",wsPort:"443",wssPort:"443",forceTLS:!0,cluster:"mt1",encrypted:!0,enabledTransports:["ws","wss"],disableStats:!0,auth:{headers:{}},pusherOptions:{enableStats:!1,encrypted:!0,enabledTransports:["ws","wss"],clientEvents:{enabled:!0}}}),m2(Er),window.Echo=Er,Er),Gm=()=>Er,g2="https://widget.geteasy.ai",v2=dt({isMobile:!1}),Ci=(e={})=>{const{openInit:t=!1,milliseconds:n}=e,s=768,{isMobile:r}=Et(v2),o=Z({get:()=>ae.state.chatState.isOpen,set:f=>ae.actions.updateChatState({isOpen:f})}),i=()=>{const f=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),h=window.innerWidth<=s,g="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;return[f,h,g].filter(Boolean).length>=2},a=()=>{r.value=i()},c=()=>{n&&!o.value&&setTimeout(()=>o.value=!0,n)};Pe(o,f=>{r.value&&(document.body.style.overflow=f?"hidden":"")});const u=()=>{o.value=!o.value};return(()=>{r.value=i(),!r.value&&(window.location.origin===g2?c():ae.state.chatState.isOpen||(o.value=t,c()),window.addEventListener("resize",a))})(),{isOpen:o,toggleChatbot:u}},y2=100,qu={MESSAGE_SEND:"push.message.send",USER_LEFT:"push.user.left",USER_STATUS:"push.user.status"},Bt={CONVERSATION_PROCESSED:".pull.conversation.processed",MESSAGE_RECEIVED:".pull.message.received",MESSAGE_PROCESSED:".pull.message.processed",STREAM_START:".pull.stream.start",STREAM_DELTA:".pull.stream.delta",STREAM_DONE:".pull.stream.done",STREAM_CANCELLED:".pull.stream.cancelled",STREAM_MESSAGE_PROCESSED:".pull.stream.message.processed",ADMIN_TYPING:".client-push.admin.message.typing",ADMIN_VIEWED:".client-push.admin.conversation.viewed"};let zu=null;function b2(){const{getStorage:e,saveStorage:t}=Ks(),{isOpen:n}=Ci();if(zu)return zu;const s=R(null),r=R(null),o=R([]),i=R(null),a=R(null),c=R(null),u=R(null),d=R(!1),f=R(!1),h=R(null),g=R(!1),p=R(!1),v=Qs(),_=R("unread"),w=R(null),k=R(!1),S=R(null),E=R(0),O=R(!1),I=Z(()=>{var se,be,qe;return((qe=(be=(se=ae==null?void 0:ae.state)==null?void 0:se.bot)==null?void 0:be.config)==null?void 0:qe.livechat)===!0}),P=Z(()=>{var se,be,qe;return((qe=(be=(se=ae==null?void 0:ae.state)==null?void 0:se.bot)==null?void 0:be.config)==null?void 0:qe.stream)===!0}),M=Z(()=>{var se,be,qe,ze;return!!((ze=(qe=(be=(se=ae==null?void 0:ae.state)==null?void 0:se.bot)==null?void 0:be.config)==null?void 0:qe.delay_response)!=null&&ze.active)}),q=async()=>{if(!w.value)return;await kt(),await ns(y2);const se=w.value;se.scrollTo({top:se.scrollHeight,behavior:"smooth"})},B=()=>{const be=new URLSearchParams(window.location.search).get("conversation_id");return be&&!Yp(be)?null:be};(()=>{var se;try{i.value=e(Kt)??{},a.value=e(so)??{};const be=B();if(be){c.value=be;return}ae.state.handle&&(c.value=i.value[ae.state.handle]??null,u.value=a.value[ae.state.handle]??null,u.value&&((se=ae.actions)==null||se.setGroupConversationId(u.value)))}catch{}})();const A=(se={})=>({user_id:v,handle:ae.state.handle,...se}),D=()=>{s.value&&(P.value&&(s.value.listen(Bt.STREAM_START,je),s.value.listen(Bt.STREAM_DELTA,De),s.value.listen(Bt.STREAM_DONE,Ie),s.value.listen(Bt.STREAM_CANCELLED,He),s.value.listen(Bt.STREAM_MESSAGE_PROCESSED,ot)),s.value.listen(Bt.CONVERSATION_PROCESSED,it),s.value.listen(Bt.MESSAGE_RECEIVED,pt),s.value.listen(Bt.MESSAGE_PROCESSED,Ot),s.value.listen(Bt.ADMIN_TYPING,cn),s.value.listen(Bt.ADMIN_VIEWED,qt))},Q=()=>{s.value&&(s.value.stopListening(Bt.MESSAGE_RECEIVED),s.value.stopListening(Bt.CONVERSATION_PROCESSED),s.value.stopListening(Bt.MESSAGE_PROCESSED),P.value&&(s.value.stopListening(Bt.STREAM_START),s.value.stopListening(Bt.STREAM_DELTA),s.value.stopListening(Bt.STREAM_DONE),s.value.stopListening(Bt.STREAM_CANCELLED),s.value.stopListening(Bt.STREAM_MESSAGE_PROCESSED)),s.value.stopListening(Bt.ADMIN_TYPING),s.value.stopListening(Bt.ADMIN_VIEWED))},W=()=>{const se=Gm();if(!se){console.warn("Echo not initialized for connection tracking");return}const be=se.connector.pusher.connection;d.value=be.state==="connected",be.bind("connected",()=>{d.value=!0}),be.bind("disconnected",()=>{d.value=!1})},H=()=>{var xe,Ge,at,gt,_n,jn,Qn;let se=((gt=(at=(Ge=(xe=ae==null?void 0:ae.state)==null?void 0:xe.bot)==null?void 0:Ge.config)==null?void 0:at.initialMessage)==null?void 0:gt.messages)??[];se=Object.values(se),Array.isArray(se)||(se=[]);const be=se.map(Tn=>Tn.content),ze=_i(be).map((Tn,Jt)=>({id:Jt,content_type:"text",sender_type:"assistant",content:Tn,is_welcome_message:!0})),le=(Qn=(jn=(_n=ae==null?void 0:ae.state)==null?void 0:_n.bot)==null?void 0:jn.config)==null?void 0:Qn.introductionMessage;return le&&typeof le=="string"&&ze.push({id:ze.length,content_type:"text",sender_type:"assistant",content:le,is_welcome_message:!0,is_introduction_message:!0}),ze},K=()=>{o.value=[];const se=H();o.value=ys(se)},J=(se=[])=>{let be=se.filter(ze=>!ze.is_welcome_message);if(!(be!=null&&be.length))return;if(!ae.state.chatState.lastAssistantMessageId){const ze=[...be].reverse().find(le=>le.sender_type==="assistant");ze!=null&&ze.id&&ae.actions.setLastAssistantMessageId(ze.id);return}const qe=be.findIndex(ze=>ze.id===ae.state.chatState.lastAssistantMessageId);if(qe!==-1){const ze=be.slice(qe+1).filter(le=>le.sender_type==="assistant"&&!le.is_welcome_message);if(ze.length>0){const le=ae.state.chatState.unreadMessageCount||0;ae.state.chatState.unreadMessageCount=le+ze.length;const xe=ze[ze.length-1];xe!=null&&xe.id&&(ae.state.chatState.lastAssistantMessageId=xe.id),ae.actions.saveChatState();const{isOpen:Ge}=Ci();Ge.value||ae.actions.updateLastUnreadMessage(be)}}},te=se=>{if(!se.length)return[];const be=se.reduce((ze,le)=>{const xe=ze.find(Ge=>Ge.type===le.type);return xe?(xe.files.push(le),xe.ids.push(le.file_id)):ze.push({type:le.type,message_id:ps(),files:[le],ids:[le.file_id]}),ze},[]),qe=["image","video","audio","file"];return[...be.filter(ze=>qe.includes(ze.type)).sort((ze,le)=>qe.indexOf(ze.type)-qe.indexOf(le.type)),...be.filter(ze=>!qe.includes(ze.type))]},ge=()=>new Promise((se,be)=>{const qe=Gm();if(!qe){be(new Error("Echo not initialized"));return}const ze=qe.connector.pusher.connection;if(ze.state==="connected"){se();return}const le=setTimeout(()=>{ze.unbind("connected",xe),be(new Error("Connection timeout"))},1e4),xe=()=>{clearTimeout(le),se()};ze.bind("connected",xe)}),ue=async()=>{if(I.value&&!(g.value||d.value&&s.value)){await pe(ae.state.handle);try{g.value=!0,h.value=null;const se=Wm();if(!se)throw new Error("Failed to initialize Echo");const be=fe();if(!be){g.value=!1;return}const qe=`chat.${be}`;s.value=se.channel(qe),D(),W(),await ge()}catch(se){throw h.value=se.message,se}finally{g.value=!1}}},we=async se=>{var be,qe,ze;if(!(p.value||!I.value))try{p.value=!0,h.value=null,a.value||(a.value=e(so)??{}),c.value||(c.value=e(Kt,se)),u.value||(u.value=e(so,se),u.value&&((be=ae.actions)==null||be.setGroupConversationId(u.value)));const{data:le}=await Xe.liveChat.initConnection({handle:se,conversation_id:c.value,group_conversation_id:u.value});if(le!=null&&le.group_conversation_id?(u.value=le.group_conversation_id,a.value||(a.value={}),a.value[ae.state.handle]=u.value,t(so,a.value),(qe=ae.actions)==null||qe.setGroupConversationId(u.value)):le!=null&&le.conversation_id&&u.value,le!=null&&le.conversation_id&&(c.value=le.conversation_id,i.value||(i.value={}),i.value[ae.state.handle]=c.value,t(Kt,i.value)),((ze=le.messages)==null?void 0:ze.length)>0)if(o.value=ys(le.messages),ae.state.chatState.assistantProcessing){if(!ae.state.chatState.isOpen){const xe=[...le.messages].reverse().find(Ge=>Ge.sender_type==="assistant");xe&&(ae.actions.incrementUnreadMessageCount(),ae.actions.setLastAssistantMessageId(xe.id),ae.actions.updateLastUnreadMessage(le.messages))}ae.state.chatState.assistantProcessing=!1,ae.actions.saveChatState()}else J(le.messages);else K();le.conversation&&(r.value=le.conversation,await ue())}catch(le){throw h.value=le.message,le}finally{p.value=!1}},Ee=async()=>{let se=0;for(;p.value&&se<50;)await ns(100),se+=1},re=se=>{var be;if(se){if(!u.value){const qe=ae.state.groupConversationId||e(so,se);qe&&(u.value=qe,(be=ae.actions)==null||be.setGroupConversationId(qe))}if(!c.value){const qe=e(Kt,se);qe&&(c.value=qe)}}},pe=async se=>{if(!se)throw new Error("Missing bot handle");if(re(se),!(u.value||c.value)&&(await Ee(),re(se),!(u.value||c.value)&&(await we(se),re(se),!u.value&&!c.value)))throw new Error("Missing conversation id")},fe=()=>u.value||c.value||null,$e=async(se={})=>{var Ge,at;const{message:be,files:qe=[],content_type:ze,replyTarget:le}=se,xe=be?be.trim():"";if(!(!xe&&qe.length===0)&&!(!M.value&&f.value))try{(r.value&&((Ge=r.value)==null?void 0:Ge.response_mode)==="auto"||!r.value)&&(f.value=!0,ae.state.chatState.assistantProcessing=!0,ae.actions.saveChatState()),o.value.forEach(Jt=>{Jt.sender_type==="user"&&delete Jt.is_last_message});const gt={message:xe,message_id:ps()},_n=te(qe);if(_n.forEach(Jt=>{o.value.push({content:Jt.files,content_type:Jt.type,sender_type:"user",message_id:Jt.message_id,is_last_message:!xe})}),xe){const Jt={content:gt.message,message_id:gt.message_id,content_type:ze||"text",sender_type:"user",status:"sending",timestamp:new Date().toISOString(),is_last_message:!0};le&&(Jt.reply_to_message_id=le.id,Jt.quoted_message={id:le.id,content:le.content,content_type:le.content_type,sender_type:le.sender_type,sender_name:le.sender_name}),o.value.push(Jt)}const jn=((at=o.value.filter(Jt=>Jt.sender_type==="user"))==null?void 0:at.length)||1;if(Qt.messageSend({content:gt.message,message_user_order:jn,conversation_id:c.value}),_.value="unread",(async()=>(await ns(1e3),_.value==="unread"&&(_.value="sent",await ns(1500),_.value==="sent"&&(_.value="received",await ns(2e3),_.value==="received"&&(_.value="read")))))(),await pe(ae.state.handle),!fe())throw f.value=!1,new Error("Missing conversation id");if((!r.value||!s.value)&&await ue(),!s.value)throw f.value=!1,new Error("Channel not ready");const Tn={conversation_id:c.value,group_conversation_id:u.value,content:gt,attachments:_n,content_type:ze||"text",stream:P.value};le!=null&&le.id&&(Tn.reply_to_message_id=le.id),s.value.whisper(qu.MESSAGE_SEND,A(Tn))}catch(gt){throw f.value=!1,_.value="unread",gt}},Re=()=>{s.value&&(fe()&&`${fe()}`,s.value.whisper(qu.USER_LEFT,A()),Q(),s.value.unsubscribe()),s.value=null,d.value=!1},Le=async()=>{var se;Re(),(se=ae==null?void 0:ae.state)!=null&&se.handle&&(await pe(ae.state.handle),await ue())},Oe=async()=>{var qe;if(f.value)return;const se=o.value.filter(ze=>!ze.is_welcome_message).length>0,be=c.value!==null||u.value!==null;!se||!be||(Re(),o.value=[],c.value=null,u.value=null,r.value=null,delete i.value[ae.state.handle],delete a.value[ae.state.handle],localStorage.setItem(Kt,JSON.stringify(i.value)),localStorage.setItem(so,JSON.stringify(a.value)),ae.actions.resetChatState(),(qe=ae==null?void 0:ae.state)!=null&&qe.handle&&await we(ae.state.handle),Qt.conversationReset())},Ve=(se,be)=>{if(typeof se=="string"&&typeof be=="string")return se.trim()===be.trim();try{return JSON.stringify(se)===JSON.stringify(be)}catch{return!1}},N=(se,be)=>{if(typeof se!="string"||!new Set(["product_cards","cards","address","iframe","follow_up","image","video","file","gif","sticker","business_card","attachment"]).has(be))return se;try{return JSON.parse(se)}catch{return se}},ee=(se,be)=>{const qe=se.content_type||"text";if(qe==="text"&&/widget\.easyaichat\.app\/embed\//.test(se.content))return null;let ze=N(se.content,qe);return new Set(["image","video","file","gif","sticker","business_card","attachment"]).has(qe)&&!Array.isArray(ze)&&(ze=[ze]),{id:be,message_id:se.message_id,sender_type:se.sender_type||"assistant",conversation_id:se.conversation_id,timestamp:se.timestamp,is_streaming:!0,content:ze,content_type:qe,...se.audio_url?{audio_url:se.audio_url}:{}}},Y=se=>{const be=o.value.filter(le=>le.is_streaming===!0);if(!be.length)return null;const qe=be.find(le=>le.content_type===se.content_type&&Ve(le.content,se.content));if(qe)return qe;const ze=be.filter(le=>le.message_id===se.message_id);return ze.length===1?ze[0]:null},L=se=>{const be=Y(se);if(be){Object.assign(be,{...se,is_streaming:!1}),yt(se);return}if(se.content_type==="product_cards"){const ze=o.value.map((le,xe)=>le.is_streaming&&le.content_type==="product_cards"?xe:-1).filter(le=>le!==-1);if(ze.length>0){const[le,...xe]=ze;Object.assign(o.value[le],{...se,is_streaming:!1}),xe.sort((Ge,at)=>at-Ge).forEach(Ge=>o.value.splice(Ge,1)),yt(se);return}}o.value.some(ze=>ze.content_type===se.content_type&&Ve(ze.content,se.content))||(o.value.push({...se,is_streaming:!1}),yt(se))},V=()=>{f.value=!1,ae.state.chatState.assistantProcessing=!1,ae.actions.saveChatState(),_.value="unread"},ie=se=>o.value.findIndex(be=>be.message_id===se&&be.status==="sending"),me=se=>o.value.findIndex(be=>be.message_id===se&&be.status==="received"),de=se=>{const be=me(se);return be!==-1?be:ie(se)},ve=(se,be)=>{se!==-1&&(o.value[se]={...o.value[se],...be})},he=se=>o.value.find(be=>se.message_id&&be.message_id===se.message_id?be.sender_type===se.sender_type&&be.content_type===se.content_type:!1),Te=se=>{he(se)||o.value.push(se)},je=se=>{const be=oo(ae.state.handle);if(se!=null&&se.conversation_id&&se.conversation_id!==be){O.value=!1;return}O.value=!0,f.value=!0,E.value=0},De=se=>{if(O.value)try{const be=`delta-${E.value}`;E.value++;const qe=ee(se,be);if(!qe)return;o.value.push(qe),f.value=!1,_.value="unread",q()}catch{}},Ie=se=>{O.value&&(se.conversation&&(r.value=se.conversation),V(),E.value=0,O.value=!1)},He=se=>{O.value&&(E.value=0,V(),O.value=!1)},ot=se=>{var be;(be=se.message)!=null&&be.message_id&&L(se.message),se.conversation&&(r.value=se.conversation,se.conversation.response_mode==="manual"&&V())},it=se=>{se.conversation&&(r.value=se.conversation)},pt=se=>{const be=oo(ae.state.handle);se.conversation_id&&se.conversation_id!==be&&(c.value=se.conversation_id,i.value||(i.value={}),i.value[ae.state.handle]=se.conversation_id,t(Kt,i.value));let qe=ie(se.message_id);qe!==-1&&ve(qe,{status:"received"})},yt=se=>{if(!(se!=null&&se.id)||se.sender_type!=="assistant")return;ae.actions.setLastAssistantMessageId(se.id);const{isOpen:be}=Ci();be.value||(ae.actions.incrementUnreadMessageCount(),ae.actions.updateLastUnreadMessage(o.value))},Ot=se=>{if(se.message){const be=de(se.message.message_id);be!==-1?ve(be,{...se.message,status:"processed"}):he(se.message)||Te(se.message),yt(se.message),se.message.sender_type==="assistant"&&(!P.value||!O.value)&&(V(),q())}se.conversation&&(r.value=se.conversation)},cn=se=>{se.toggle_typing!==void 0&&(S.value=se.sender,k.value=se.toggle_typing,q())},qt=se=>{var be;if(s.value){const qe=(be=r.value)==null?void 0:be.response_mode;s.value.whisper(qu.USER_STATUS,A({is_processing:qe==="manual"?!1:f.value,response_mode:qe}))}};Pe(n,async se=>{var be;se&&((be=o.value)==null?void 0:be.length)>0&&ae.actions.updateLastAssistantMessageIdFromMessages(o.value)});const Dn={conversation:r,messages:o,conversationId:c,groupConversationId:u,isConnected:d,isProcessing:f,connectionError:h,newMessageStatus:_,messagesContainerRef:w,agentTyping:k,currentAgent:S,fetchInit:we,connect:ue,sendMessage:$e,disconnect:Re,reconnect:Le,refreshConversation:Oe};return zu=Dn,Dn}const Zs={TYPING:".agent.typing",BUBBLE:".agent.bubble",EXTRAS:".agent.extras",REACTION:".agent.react"},_2=2,x2=1200,w2={love:"❤️",like:"👍",haha:"🤣",wow:"😮",cry:"😭",dislike:"👎"},k2=e=>{if(!e||typeof e!="object")return null;const t=Object.keys(e)[0];return t?w2[t]??null:null},Bu=["image","gif","video","audio","file"],S2=e=>Bu.includes(e==null?void 0:e.type)?e.type:"file",C2=e=>{const t=ps();return{id:t,message_id:t,content:[e],content_type:S2(e),sender_type:"user",status:"sending",created_at:new Date().toISOString()}},$2=e=>{var n;const t=(n=e==null?void 0:e.metadata)==null?void 0:n.agent_media;return t!=null&&t.url?{...e,content_type:Bu.includes(t.kind)?t.kind:"file",content:[{file_id:e.message_id??e.id,url:t.url,filename:t.filename??"",mime_type:t.mime??null,size:0}]}:Bu.includes(e.content_type)&&!Array.isArray(e.content)?{...e,content_type:"text"}:e};let Uu=null;function T2(){if(Uu)return Uu;const{getStorage:e,saveStorage:t}=Ks(),n=R(null),s=R(null),r=R([]),o=R(!1),i=R(!1),a=R(null);let c=null,u=0;const d=()=>new Date().toISOString(),f=re=>typeof re=="string"?re:JSON.stringify(re),h=()=>{r.value=ys(r.value.slice())},g=re=>{if(re.message_id!=null)return r.value.some(fe=>fe.message_id!=null&&String(fe.message_id)===String(re.message_id)&&fe.sender_type===re.sender_type||fe.id!=null&&String(fe.id)===String(re.message_id));const pe=f(re.content);return r.value.some(fe=>fe.message_id==null&&fe.content_type===re.content_type&&fe.sender_type===re.sender_type&&f(fe.content)===pe)},p=()=>{u<=0&&!o.value&&(i.value=!1)},v=re=>{if(!n.value)return;const pe=e(Kt)??{};pe[n.value]=re,t(Kt,pe)},_=()=>{s.value||(s.value=ps(),v(s.value),J())},w=re=>{!re||re===s.value||(s.value=re,v(re),J())},k=()=>{if(!n.value)return;const re=e(Kt)??{};delete re[n.value],t(Kt,re)},S=()=>{var $e,Re,Le,Oe,Ve;r.value=[];const re=((Le=(Re=($e=U.bot)==null?void 0:$e.config)==null?void 0:Re.initialMessage)==null?void 0:Le.messages)??[],pe=Object.values(re).map(N=>N.content);_i(pe).forEach(N=>{r.value.push({content:N,content_type:"text",sender_type:"assistant",is_welcome_message:!0})});const fe=(Ve=(Oe=U.bot)==null?void 0:Oe.config)==null?void 0:Ve.introductionMessage;fe&&typeof fe=="string"&&r.value.push({content:fe,content_type:"text",sender_type:"assistant",is_welcome_message:!0,is_introduction_message:!0}),h()},E=()=>{te(),s.value=null,k(),S()},O=async()=>{try{const{data:re}=await Xe.chat.getConversations({handle:n.value,conversationId:s.value});re!=null&&re.data&&(r.value=re.data.map(pe=>{const fe=$2(pe);if(fe.sender_type==="user"&&fe.reactions){const $e=k2(fe.reactions);$e&&(fe.bot_reaction=$e)}return fe}),h())}catch{k(),s.value=null,te(),S()}},I=re=>{if(!(re!=null&&re.message_id))return null;const pe=r.value.find(fe=>fe.id!=null&&String(fe.id)===String(re.message_id)||fe.message_id!=null&&String(fe.message_id)===String(re.message_id));return pe?{id:pe.id,content:pe.content,content_type:pe.content_type,sender_type:pe.sender_type,sender_name:pe.sender_name||null}:{id:re.message_id,content:re.preview||"",content_type:"text",sender_type:"user"}},P=({content:re,message_id:pe,quote:fe})=>{const $e={id:pe??ps(),message_id:pe??null,conversation_id:s.value,content:re,content_type:"text",sender_type:"assistant",status:"processed",created_at:d(),quoted_message:I(fe)};g($e)||(r.value.push($e),h())},M=re=>{if(!re||typeof re!="object")return null;if(re.type==="sources"){const pe=Array.isArray(re.sources)?re.sources:[];if(pe.length===0)return null;const fe=pe.map($e=>({title:$e.title,link:$e.url}));return{id:ps(),content_type:"citations",content:JSON.stringify({elements:fe}),sender_type:"assistant",status:"processed",created_at:d()}}if(re.type==="iframe"){const pe=re.iframe??{};return pe.src?{id:ps(),content_type:"iframe",content:JSON.stringify({iframe:{src:pe.src,width:pe.width??"100%",height:pe.height??"600px"}}),sender_type:"assistant",status:"processed",created_at:d()}:null}return null},q=re=>{const pe=M(re);!pe||g(pe)||(r.value.push(pe),h())},B=re=>{Array.isArray(re)&&re.forEach(pe=>P({content:pe.content,message_id:pe.message_id,quote:pe.quote}))},T=re=>{Array.isArray(re)&&re.forEach(pe=>q(pe))},A=re=>!(re!=null&&re.conversation_id)||re.conversation_id===s.value,D=re=>{A(re)&&(o.value=(re==null?void 0:re.typing)===!0,o.value?i.value=!0:p())},Q=re=>{A(re)&&P({content:re.content,message_id:re.message_id,quote:re.quote})},W=re=>{A(re)&&T(re.extras)},H=re=>{if(!A(re))return;const pe=re==null?void 0:re.emoji;if(!pe)return;const $e=(re.message_id!=null?r.value.find(Re=>String(Re.id)===String(re.message_id)||String(Re.message_id)===String(re.message_id)):null)??[...r.value].reverse().find(Re=>Re.sender_type==="user");$e&&($e.bot_reaction=pe,h())},K=()=>{a.value&&(a.value.stopListening(Zs.TYPING),a.value.stopListening(Zs.BUBBLE),a.value.stopListening(Zs.EXTRAS),a.value.stopListening(Zs.REACTION),a.value.unsubscribe(),a.value=null,c=null)},J=()=>{if(!s.value)return;const re=Wm();if(!re)return;const pe=`chat.${s.value}`;a.value&&c===pe||(a.value&&K(),a.value=re.channel(pe),c=pe,a.value.listen(Zs.TYPING,D),a.value.listen(Zs.BUBBLE,Q),a.value.listen(Zs.EXTRAS,W),a.value.listen(Zs.REACTION,H))},te=()=>{K()},ge=async re=>{n.value=re??null;const pe=em()??(n.value?e(Kt,n.value):null);if(!pe){S();return}s.value=pe,J(),await O()},ue=async re=>{let pe=0;for(;;){const fe=await Xe.chat.sendAgentMessage(re);if(fe.status!=="busy"||pe>=_2)return fe;pe+=1,await ns(x2*pe)}},Ee={onInit:ge,send:async({message:re,files:pe,replyTarget:fe}={})=>{const $e=typeof re=="string"?re.trim():"",Re=(fe==null?void 0:fe.id)!=null&&/^\d+$/.test(String(fe.id))?Number(fe.id):null,Le=Array.isArray(pe)?pe.filter(L=>L==null?void 0:L.file_id):[],Oe=Le.map(L=>L.file_id);if(!$e&&Oe.length===0)return;i.value=!0,r.value.forEach(L=>{L.sender_type==="user"&&delete L.is_last_message});const Ve=Le.map(C2);Ve.forEach(L=>r.value.push(L));let N=null;if($e){const L=ps();N={id:L,message_id:L,content:$e,content_type:"text",sender_type:"user",status:"sending",created_at:d()},r.value.push(N)}const ee=N??Ve[Ve.length-1];ee&&(ee.is_last_message=!0),Re&&ee&&(ee.reply_to_message_id=Re,ee.quoted_message={id:fe.id,content:fe.content,content_type:fe.content_type,sender_type:fe.sender_type,sender_name:fe.sender_name||null}),h(),_();const Y=L=>{Ve.forEach(V=>V.status=L),N&&(N.status=L)};u+=1;try{const L=await ue({handle:n.value,query:$e||void 0,conversation_id:s.value,reply_to_message_id:Re??void 0,attachments:Oe.length>0?Oe:void 0});if(L.status==="busy"){Y("failed");return}L.conversation_id&&w(L.conversation_id),Y("sent"),L.status==="ok"&&(B(L.bubbles),T(L.extras),(L.extras??[]).forEach(V=>{(V==null?void 0:V.type)==="react"&&H({...V,conversation_id:s.value})}))}catch{Y("failed")}finally{u-=1,p()}},refreshConversation:E,messages:r,conversationId:s,agentTyping:o,isProcessing:i,connect:J,disconnect:te};return Uu=Ee,Ee}const A2=dt({widgets:{},selectedWidgetEmbed:null,widgetSettingType:null});function Ys(){const{widgetSettingType:e,widgets:t,selectedWidgetEmbed:n}=Et(A2),{bot:s}=Et(ae.state),r=(d,f)=>(d.name==="demand"&&!d.options&&(d.options=["Tư vấn","Yêu cầu báo giá","Trở thành đối tác","Khiếu nại","Hỗ trợ kỹ thuật","Khác"]),{...d,label:typeof d.label=="object"&&d.label!==null?d.label[f]:d.label,placeholder:typeof d.placeholder=="object"&&d.placeholder!==null?d.placeholder[f]:d.placeholder,hint:typeof d.hint=="object"&&d.hint!==null?d.hint[f]:d.hint,options:Array.isArray(d.options)?d.options:typeof d.options=="object"&&d.options!==null?d.options[f]:d.options}),o=()=>{const d=window.location.href,f=/\/embed\/([^\/]+)\/([a-f0-9-]+)(\?(.+))?/,h=d.match(f);if(h){const g=h[1],p=h[2],v=h[4]||"",_=v?v.split("&").reduce((w,k)=>{const[S,E]=k.split("=");return S&&E&&(w[S]=decodeURIComponent(E)),w},{}):{};return{widgetId:p,queryObject:_,handle:g}}else return console.error("URL does not match expected format"),{widgetId:null,queryObject:{},handle:null}},i=async(d=[])=>{const f=Xs.state.locale;if(d.length===0)return;const h=d.reduce((g,p)=>{if(!p.active)return g;const v=lo(p);return v.name=fo(v.name,f),v.formHeaderTitle=fo(v.formHeaderTitle,f),v.description=fo(v.description,f),v.successTitle=fo(v.successTitle,f),v.successDescription=fo(v.successDescription,f),v.buttonText=fo(v.buttonText,f),v.fields&&Array.isArray(v.fields)&&(v.fields=v.fields.map(_=>r(_,f))),{...g,[v.type]:v}},{});t.value=h},a=(d=[])=>{const{widgetId:f,handle:h}=o(),g=Object.values(t.value).find(v=>(v==null?void 0:v.id)===f);if(g){n.value=g;return}const p=d.find(v=>v.id===f);if(p){n.value=t.value[p.type]??p;return}n.value=h===On?null:t.value.contact??d.find(v=>v.type==="contact")};function c(d){try{const h=new URL(window.location.href).searchParams.get(d);return h?decodeURIComponent(h):null}catch(f){return console.error(`Error extracting ${d}:`,f),null}}const u=async d=>{var f,h;try{if(!d||!((f=U.bot.widgets)!=null&&f.length))return;const g=lo(U.bot.widgets),p=g.findIndex(S=>S.id===d.id);if(p===-1)return;g[p]=d;const v=(h=U.bot)==null?void 0:h.handle,_=c("temp_token"),w=c("expires");if(!v||!_)throw new Error("Missing data: handle or token is required");const k=await Xe.widget.updateAll({handle:v,token:_,widgets:g,expires:w});console.log("Response update bot widgets = ",k)}catch(g){throw new Error(g)}};return Je(()=>{const d=new URLSearchParams(window.location.search);e.value=d.get("widget_setting_type")}),Pe(s,()=>{var d;(d=s.value)!=null&&d.widgets&&i(s.value.widgets)},{immediate:!0}),Pe(()=>Xs.state.locale,()=>{var d,f;(f=(d=s.value)==null?void 0:d.widgets)!=null&&f.length&&(i(s.value.widgets),a(s.value.widgets))}),{widgets:t,selectedWidgetEmbed:n,getWidgetsActive:i,getSelectedWidgetByEmbedLink:a,updateBotWidgets:u,widgetSettingType:e}}const E2={SCROLL_BOTTOM_DELAY:100},I2=dt({pendingMessage:null,currentMessage:""});function Ir(e={}){const{pendingMessage:t,currentMessage:n}=Et(I2),{widgets:s}=Ys(),r=Z(()=>{var k,S,E;return((E=(S=(k=ae==null?void 0:ae.state)==null?void 0:k.bot)==null?void 0:S.config)==null?void 0:E.livechat)===!0}),o=ae.getters.isAgentEnabled,i=Z(()=>o.value?"agent":r.value?"livechat":"http"),a=b2(),c=jm(),u=T2(),d=R(!1),f=R(null),h=R(null);Pe(()=>a.currentAgent.value,async k=>{var E,O,I,P;const S=(P=(I=(O=(E=ae==null?void 0:ae.state)==null?void 0:E.bot)==null?void 0:O.config)==null?void 0:I.ui)==null?void 0:P.logo;if(!k||!k.avatar){h.value=S;return}try{(await Tr(k.avatar)).status?h.value=k.avatar:h.value=S}catch{h.value=S}},{immediate:!0}),Pe(f,k=>{k&&(c.messagesContainerRef.value=k,a.messagesContainerRef.value=k)},{deep:!0}),Je(async()=>{var S,E;const k=(E=(S=ae==null?void 0:ae.state)==null?void 0:S.bot)==null?void 0:E.handle;k&&(o.value?await u.onInit(k):r.value&&await a.fetchInit(k))});const g=async()=>{await ns(1200);const k=ae.state.chatState.visitor,S=s.value.widget_form_render_pre_send,E=parseInt(S==null?void 0:S.maximumMessageCount)||1,I=(r.value?a.messages:c.messages).value.filter(P=>P.sender_type==="user").length;S&&!k&&I>=E&&(ae.state.isOpenLeadForm=!0)},p=async k=>{g(),ae.actions.updateChatState({viewTab:"conversations"});const S=o.value?u.send(k):r.value?a.sendMessage(k):c.send(k);return w(),await S},v=async(k={})=>{if(!(o.value||r.value))return await c.fetchMessages(k)},_=async()=>o.value?u.refreshConversation():r.value?await a.refreshConversation():await c.refreshConversation();async function w(k={}){var E;if(!f.value)return;await kt(),await ns(k.delay||E2.SCROLL_BOTTOM_DELAY);const S=((E=f.value)==null?void 0:E.scrollHeight)||0;f.value.scrollTo({top:k.top||S,behavior:k.behavior||"smooth"})}return{isLiveChatEnabled:r,isAgentEnabled:o,chatService:i,pendingMessage:t,currentMessage:n,messages:o.value?u.messages:r.value?a.messages:c.messages,conversationId:o.value?u.conversationId:r.value?a.conversationId:c.conversationId,conversation:r.value?a.conversation:null,assistantProcessing:o.value?d:r.value?a.isProcessing:c.assistantProcessing,newMessageStatus:r.value?a.newMessageStatus:c.newMessageStatus,storageConversations:c.storageConversations,send:p,fetchMessages:v,refreshConversation:_,initializeMessages:c.initializeMessages,clickQuickPrompt:c.clickQuickPrompt,messagesContainerRef:f,scrollToBottom:w,isConnected:a.isConnected,connectionError:a.connectionError,agentTyping:o.value?u.agentTyping:a.agentTyping,currentAgent:a.currentAgent,validatedAgentAvatar:h}}/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var cl={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const P2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ne=(e,t)=>({size:n,strokeWidth:s=2,absoluteStrokeWidth:r,color:o,class:i,...a},{attrs:c,slots:u})=>hr("svg",{...cl,width:n||cl.width,height:n||cl.height,stroke:o||cl.stroke,"stroke-width":r?Number(s)*24/Number(n):s,...c,class:["lucide",`lucide-${P2(e)}`],...a},[...t.map(d=>hr(...d)),...u.default?[u.default()]:[]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Km=Ne("ArrowRightIcon",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vu=Ne("AudioLinesIcon",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const M2=Ne("BookOpenTextIcon",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}],["path",{d:"M6 8h2",key:"30oboj"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M16 12h2",key:"7q9ll5"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const O2=Ne("BookOpenIcon",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qm=Ne("CalendarDaysIcon",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ul=Ne("CheckIcon",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const mo=Ne("ChevronDownIcon",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const go=Ne("ChevronLeftIcon",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Pr=Ne("ChevronRightIcon",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Jm=Ne("ChevronUpIcon",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xm=Ne("CircleAlertIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const L2=Ne("CircleCheckBigIcon",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const dl=Ne("CircleCheckIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Zm=Ne("CircleHelpIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const R2=Ne("CirclePlusIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const D2=Ne("CircleXIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Hu=Ne("ClipboardCheckIcon",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const j2=Ne("ClockIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ym=Ne("DownloadIcon",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const N2=Ne("EyeIcon",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const F2=Ne("FileSpreadsheetIcon",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const er=Ne("FileTextIcon",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const q2=Ne("FileTypeIcon",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const z2=Ne("GiftIcon",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const B2=Ne("GlobeIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const U2=Ne("HandCoinsIcon",[["path",{d:"M11 15h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 17",key:"geh8rc"}],["path",{d:"m7 21 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"1fto5m"}],["path",{d:"m2 16 6 6",key:"1pfhp9"}],["circle",{cx:"16",cy:"9",r:"2.9",key:"1n0dlu"}],["circle",{cx:"6",cy:"5",r:"3",key:"151irh"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const eg=Ne("HeadsetIcon",[["path",{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z",key:"12oyoe"}],["path",{d:"M21 16v2a4 4 0 0 1-4 4h-5",key:"1x7m43"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const V2=Ne("HeartIcon",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const H2=Ne("HomeIcon",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const W2=Ne("InfoIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const G2=Ne("LoaderCircleIcon",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const K2=Ne("LoaderIcon",[["line",{x1:"12",x2:"12",y1:"2",y2:"6",key:"gza1u7"}],["line",{x1:"12",x2:"12",y1:"18",y2:"22",key:"1qhbu9"}],["line",{x1:"4.93",x2:"7.76",y1:"4.93",y2:"7.76",key:"xae44r"}],["line",{x1:"16.24",x2:"19.07",y1:"16.24",y2:"19.07",key:"bxnmvf"}],["line",{x1:"2",x2:"6",y1:"12",y2:"12",key:"89khin"}],["line",{x1:"18",x2:"22",y1:"12",y2:"12",key:"pb8tfm"}],["line",{x1:"4.93",x2:"7.76",y1:"19.07",y2:"16.24",key:"1uxjnu"}],["line",{x1:"16.24",x2:"19.07",y1:"7.76",y2:"4.93",key:"6duxfx"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Q2=Ne("MailIcon",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const J2=Ne("MapPinIcon",[["path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",key:"2oe9fu"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const X2=Ne("MenuIcon",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Z2=Ne("MessageCircleMoreIcon",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Y2=Ne("MessageCircleQuestionIcon",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tg=Ne("MessageCircleIcon",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ek=Ne("MicOffIcon",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ng=Ne("MicIcon",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fl=Ne("MinusIcon",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sg=Ne("MusicIcon",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wu=Ne("PackageIcon",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Gu=Ne("PaperclipIcon",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tk=Ne("PauseIcon",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nk=Ne("PenLineIcon",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sk=Ne("PencilLineIcon",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hl=Ne("PhoneCallIcon",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}],["path",{d:"M14.05 2a9 9 0 0 1 8 7.94",key:"vmijpz"}],["path",{d:"M14.05 6A5 5 0 0 1 18 10",key:"13nbpp"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rg=Ne("PhoneIcon",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const og=Ne("PlayIcon",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ig=Ne("PlusIcon",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rk=Ne("QuoteIcon",[["path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z",key:"4rm80e"}],["path",{d:"M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z",key:"10za9r"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ok=Ne("RefreshCcwIcon",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pl=Ne("SearchIcon",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ag=Ne("SendHorizontalIcon",[["path",{d:"m3 3 3 9-3 9 19-9Z",key:"1aobqy"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ku=Ne("SendIcon",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ln=Ne("ShoppingBagIcon",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ik=Ne("SquarePenIcon",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ml=Ne("StarIcon",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const lg=Ne("TicketPercentIcon",[["path",{d:"M2 9a3 3 0 1 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 1 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"1l48ns"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const cg=Ne("Trash2Icon",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ak=Ne("TriangleAlertIcon",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const lk=Ne("TruckIcon",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ug=Ne("UserRoundIcon",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const dg=Ne("VideoIcon",[["path",{d:"m22 8-6 4 6 4V8Z",key:"50v9me"}],["rect",{width:"14",height:"12",x:"2",y:"6",rx:"2",ry:"2",key:"1rqjg6"}]]);/**
* @license lucide-vue-next v0.358.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Es=Ne("XIcon",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Qe=(e,t)=>{const n=e.__vccOpts||e;for(const[s,r]of t)n[s]=r;return n},ck=e=>(mn("data-v-76058769"),e=e(),gn(),e),uk={class:"relative reaction-container"},dk={key:0,class:"select-none selected-reactions mr-2 flex items-center gap-1 bg-white/90 px-2 py-0.5 h-[24px] border border-gray-100 shadow-sm rounded-full transition-transform duration-150 ease-in-out hover:scale-105 will-change-transform-opacity"},fk={class:"text-xs font-medium leading-[100%] tracking-tight text-gray-700"},hk={key:0,class:"leading-[100%]"},pk={class:"flex justify-center items-center px-2 py-0.5 rounded-3xl select-none bg-white/90",style:{"box-shadow":`rgba(0, 0, 0, 0.1) 0px 1px 3px 0px,
rgba(0, 0, 0, 0.06) 0px 1px 2px 0px`}},mk=["onClick"],gk={class:"custom-tooltip absolute -top-[25px] left-1/2 -translate-x-1/2 scale-[0.8] bg-black/75 text-white text-[10px] px-1.5 py-0.5 rounded whitespace-nowrap opacity-0 pointer-events-none transition-[opacity,transform] duration-200 ease-in-out z-[60] hidden hover-hover:group-hover/emoji:opacity-100 hover-hover:group-hover/emoji:scale-100 after:content-[''] after:absolute after:top-full after:left-1/2 after:-ml-1 after:border-4 after:border-solid after:border-t-black/75 after:border-x-transparent after:border-b-transparent"},vk=ck(()=>l("div",{class:"custom-tooltip absolute -top-[25px] left-1/2 -translate-x-1/2 scale-[0.8] bg-black/75 text-white text-[10px] px-1.5 py-0.5 rounded whitespace-nowrap opacity-0 pointer-events-none transition-[opacity,transform] duration-200 ease-in-out z-[60] hidden hover-hover:group-hover/close:opacity-100 hover-hover:group-hover/close:scale-100 after:content-[''] after:absolute after:top-full after:left-1/2 after:-ml-1 after:border-4 after:border-solid after:border-t-black/75 after:border-x-transparent after:border-b-transparent"}," Xóa ",-1)),yk={key:0,class:"absolute top-0 left-0 w-full h-full pointer-events-none z-50 overflow-visible"},bk=350,_k=Qe({__name:"MessageReactions",props:{messageId:{type:[String,Number]},conversationId:{type:[String,Number]},position:{type:String,default:"left"},messageReactions:{type:Object,default:()=>({})},chatViewRef:{type:Object,default:null}},emits:["update:messageReactions"],setup(e,{expose:t,emit:n}){const s=e,r=n,o=R(!1),i=R([]),a=R(!1),c=R(s.messageReactions),u=R(null),d={love:"❤️",like:"👍",haha:"🤣",wow:"😮",cry:"😭",dislike:"👎"},f=[{id:"love",emoji:"❤️",label:"Yêu thích"},{id:"like",emoji:"👍",label:"Thích"},{id:"haha",emoji:"🤣",label:"Haha"},{id:"wow",emoji:"😮",label:"Wow"},{id:"cry",emoji:"😭",label:"Buồn"},{id:"dislike",emoji:"👎",label:"Không thích"}],h=()=>{const Q=Math.random()*Math.PI*2,W=30+Math.random()*60,H=Math.cos(Q)*W,K=Math.sin(Q)*W,J=.4+Math.random()*.3,te=Math.random()*.15,ge=12+Math.random()*8,ue=.6+Math.random()*.4;return{"--x":`${H}px`,"--y":`${K}px`,"--duration":`${J}s`,"--delay":`${te}s`,"--size":`${ge}px`,"--opacity":ue}};let g;const p=()=>{a.value=!1,setTimeout(()=>{a.value=!0,g&&clearTimeout(g),g=setTimeout(()=>{a.value=!1},800)},10)},v=Z(()=>Object.keys(c.value||{}).slice(0,3).map(W=>({ui:d[W],id:W}))),_=Z(()=>Object.values(c.value||{}).reduce((Q,W)=>Q+W,0)),w=Q=>{u.value=Q,i.value=[Q],o.value=!1,T(),p(),Qt.interaction({type:"reaction",conversationId:s.conversationId,...Q})},k=()=>{if(u.value){T(),p(),Qt.interaction({type:"reaction",conversationId:s.conversationId,...u.value});return}const Q=f.find(W=>W.id==="love");if(Q){u.value=Q,i.value=[Q],c.value||(c.value={});const W={...c.value};W[Q.id]&&delete W[Q.id],c.value={[Q.id]:(c.value[Q.id]||0)+1,...W},T(),p()}},S=()=>{u.value=null,i.value=[],o.value=!1,A()};Rt(()=>{g&&clearTimeout(g)});const E=()=>{document.dispatchEvent(new CustomEvent("close-all-emoji-pickers",{detail:{except:s.messageId}})),o.value=!0},O=Q=>{const W=document.querySelector(".emoji-picker");W&&!W.contains(Q.target)&&(o.value=!1)};let I,P;Je(()=>{if(document.addEventListener("click",O,{passive:!0}),s.chatViewRef&&(I=Q=>{if(!As()||!o.value)return;const W=s.chatViewRef.querySelector(".emoji-picker.show-emoji");if(!W)return;const H=Q.target.closest(".reaction-container"),K=W.closest(".reaction-container");K&&H!==K&&(o.value=!1)},s.chatViewRef.addEventListener("touchstart",I,{passive:!0}),P=Q=>{var H;((H=Q.detail)==null?void 0:H.except)!==s.messageId&&(o.value=!1)},s.chatViewRef.addEventListener("close-all-emoji-pickers",P)),c.value&&Object.keys(c.value).length>0){const Q=Object.keys(c.value)[0],W=f.find(H=>H.id===Q);W&&(u.value=W,i.value=[W])}}),Rt(()=>{document.removeEventListener("click",O),s.chatViewRef&&(I&&s.chatViewRef.removeEventListener("touchstart",I),P&&s.chatViewRef.removeEventListener("close-all-emoji-pickers",P)),g&&clearTimeout(g)});let M;const q=()=>{As()&&(M=setTimeout(()=>{E()},bk))},B=()=>{As()&&M&&clearTimeout(M)},T=async()=>{try{if(!D.value){console.error("Missing required props: messageId or conversationId");return}if(!u.value)return;const{data:Q}=await Xe.reaction.update({conversationId:s.conversationId,messageId:s.messageId,form:{reaction:u.value.id}});if(Q.success){const W=Q.data.reactions;if(r("update:messageReactions",Q.data.reactions),u.value&&W[u.value.id]){const H=u.value.id,K={[H]:W[H]};Object.keys(W).forEach(J=>{J!==H&&(K[J]=W[J])}),c.value=K}else c.value=W}}catch(Q){console.error("Error saving reaction to message:",Q)}},A=async()=>{try{if(!D.value){console.error("Missing required props: messageId or conversationId");return}const{data:Q}=await Xe.reaction.removeAll({conversationId:s.conversationId,messageId:s.messageId});Q.success&&(c.value={},u.value=null,i.value=[],r("update:messageReactions",{}))}catch(Q){console.error("Error removing reactions from message:",Q)}};t({selectedReactions:i,showEmojis:o,openEmojis:E});const D=Z(()=>!!s.messageId&&!!s.conversationId);return(Q,W)=>{var H;return m(),x("div",uk,[l("div",{class:"flex items-center group-reactions",onTouchstartPassive:W[0]||(W[0]=K=>q()),onTouchend:W[1]||(W[1]=K=>B())},[_.value>1?(m(),x("div",dk,[(m(!0),x(_e,null,Me(v.value,K=>(m(),x("div",{key:K.id,class:"text-center"},[l("div",{class:ne(["content-center",["love","dislike","like"].includes(K.id)?"text-sm sm:text-xs translate-y-[1px]":"text-sm"])},j(K.ui),3)]))),128)),l("div",fk,j(_.value),1)])):z("",!0),l("button",{onClick:k,class:ne(["reaction-button flex items-center justify-center size-[26px] border border-gray-100 shadow-sm rounded-full bg-white select-none transition-[transform,filter,background-color] duration-[150ms,200ms,200ms] ease-[cubic-bezier(0.175,0.885,0.32,1.275),ease,ease] hover:scale-110 active:scale-95 will-change-transform-opacity",[u.value?"grayscale-0":"grayscale",["love","dislike","like"].includes((H=u.value)==null?void 0:H.id)?"text-sm sm:text-xs":"text-sm"]])},[u.value?(m(),x("div",hk,j(u.value.emoji),1)):(m(),oe(y(V2),{key:1,size:"14",class:"text-gray-500"}))],2)],32),l("div",{class:ne(["absolute -top-2 z-10 -translate-y-full emoji-picker sm:top-0 origin-center-bottom will-change-[transform,opacity]",[e.position==="center"?"translate-x-[46%] right-0":"translate-x-0 -right-0 sm:-right-3",{"show-emoji":o.value}]])},[l("div",pk,[(m(),x(_e,null,Me(f,(K,J)=>l("button",{key:K.id,class:"emoji-btn bg-transparent border-none cursor-pointer flex items-center justify-center size-[28px] sm:size-[26px] rounded-3xl hover:bg-gray-100 hover:scale-115 relative transition-[transform,background-color] duration-150 ease-in-out will-change-transform",style:ht({"--delay":`${J*.03}s`}),onClick:te=>w(K)},[l("span",{class:ne(["leading-[100%]",["love","dislike","like"].includes(K.id)?"text-base sm:text-sm translate-y-[1px]":"text-lg sm:text-base"])},j(K.emoji),3),l("div",gk,j(K.label),1)],12,mk)),64)),i.value.length>0?(m(),x("button",{key:0,class:"relative ml-0.5 text-gray-500 bg-transparent border-none cursor-pointer emoji-btn-close hover:text-red-500 group/close",style:{"--delay":`${6*.03}s`},onClick:S},[G(y(Es),{size:"16","stroke-width":"2"}),vk])):z("",!0)])],2),a.value?(m(),x("div",yk,[(m(),x(_e,null,Me(15,K=>{var J;return l("div",{key:K,class:"firework-particle absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 will-change-[transform,opacity]",style:ht(h())},j(((J=u.value)==null?void 0:J.emoji)||"✨"),5)}),64))])):z("",!0)])}}},[["__scopeId","data-v-76058769"]]);function en(){const e=Z(()=>Xs.state.locale);function t(n,s){return e.value,Xs.actions.t(n,s)}return{t,locale:e}}const xk={},wk={viewBox:"0 0 16 16",width:"12",height:"12",fill:"currentColor","aria-hidden":"true"},kk=[l("path",{d:"M6.497 1.035C7.593-.088 9.5.688 9.5 2.257V4.54c1.923.215 3.49 1.246 4.593 2.672C15.328 8.808 16 10.91 16 13v.305c0 .632-.465 1.017-.893 1.127-.422.11-.99.005-1.318-.493-.59-.894-1.2-1.482-1.951-1.859-.611-.307-1.359-.496-2.338-.558v2.23c0 1.57-1.908 2.346-3.003 1.222L.893 9.223a1.75 1.75 0 0 1 .001-2.444l5.603-5.744z"},null,-1)];function Sk(e,t){return m(),x("svg",wk,kk)}const fg=Qe(xk,[["render",Sk]]),Ck={class:"text-xs truncate m-0 mb-0.5 text-gray-600 font-light"},$k={class:"font-medium inline-block max-w-[200px] truncate align-bottom"},Tk={class:"font-medium inline-block max-w-[200px] truncate align-bottom"},Ak={key:0,class:"text-xs italic opacity-60 m-0"},Ek={key:1,class:"flex items-center gap-2 min-w-0"},Ik={class:"flex-shrink-0 size-9 rounded-lg overflow-hidden bg-gray-200 flex items-center justify-center"},Pk=["src"],Mk={class:"min-w-0 flex flex-col gap-0.5"},Ok={class:"text-xs m-0 font-medium text-gray-700 truncate"},Lk={class:"text-xs m-0 text-gray-500 truncate"},Rk={key:0},Dk={key:2,class:"text-xs line-clamp-1 m-0 whitespace-pre-wrap break-words text-gray-500"},jk=1500,Nk={__name:"ChatBubbleQuote",props:{quotedMessage:{type:Object,required:!0},isUser:{type:Boolean,default:!1}},setup(e){const{t}=en(),{bot:n}=Et(ae.state),s=e,r=R(null),o=Z(()=>{var I,P,M;return((M=(P=(I=n.value)==null?void 0:I.config)==null?void 0:P.ui)==null?void 0:M.name)||""}),i=Z(()=>{var I;return!!((I=s.quotedMessage)!=null&&I.unavailable)}),a=Z(()=>{var I;return!i.value&&!!((I=s.quotedMessage)!=null&&I.id)}),c=(I,P)=>{var q,B;let M=I==null?void 0:I.parentElement;for(;M&&M!==P&&M!==document.body;){const A=getComputedStyle(M).overflowY;if((A==="auto"||A==="scroll"||A==="overlay")&&M.scrollHeight>M.clientHeight)return M;M=M.parentElement}return((q=P==null?void 0:P.querySelector)==null?void 0:q.call(P,".messages-wrapper"))||((B=I==null?void 0:I.closest)==null?void 0:B.call(I,".messages-wrapper"))||null},u=()=>{var B,T,A,D;if(!a.value)return;const I=((T=(B=r.value)==null?void 0:B.getRootNode)==null?void 0:T.call(B))||document,P=s.quotedMessage.id,M=((A=I.getElementById)==null?void 0:A.call(I,`message-${P}`))||((D=I.querySelector)==null?void 0:D.call(I,`[id="message-${P}"]`));if(!M)return;const q=c(M,I);if(q){const Q=q.getBoundingClientRect(),W=M.getBoundingClientRect(),H=W.top-Q.top-q.clientHeight/2+W.height/2;q.scrollTo({top:Math.max(0,q.scrollTop+H),behavior:"smooth"})}else M.scrollIntoView({behavior:"smooth",block:"center"});M.classList.add("quote-target-focus"),setTimeout(()=>{M.classList.remove("quote-target-focus")},jk)},d=Z(()=>{var I;return s.quotedMessage&&(((I=s.quotedMessage.sender)==null?void 0:I.name)||s.quotedMessage.sender_name)||""}),f=Z(()=>{var P;const I=(P=s.quotedMessage)==null?void 0:P.sender_type;return I?s.isUser?I==="user":I!=="user":!1}),h=["image","gif","video","audio","file","sticker","attachment"],g=I=>{const P=document.createElement("div");return P.innerHTML=I,(P.textContent||P.innerText||"").replace(/\s+/g," ").trim()},p=Z(()=>{var I;return((I=s.quotedMessage)==null?void 0:I.content_type)||""}),v=Z(()=>h.includes(p.value)),_=Z(()=>{var P;const I=(P=s.quotedMessage)==null?void 0:P.content;if(Array.isArray(I))return I;if(typeof I=="string")try{const M=JSON.parse(I);return Array.isArray(M)?M:[]}catch{return[]}return[]}),w=Z(()=>{var I;return["image","gif","sticker"].includes(p.value)&&((I=_.value[0])==null?void 0:I.url)||null}),k=Z(()=>({file:er,attachment:Gu,video:dg,audio:sg})[p.value]||er),S=Z(()=>{const I=p.value;return t(`chat.quote_media.${I==="attachment"?"file":I}`)}),E=Z(()=>{const I=_.value[0];return!I||typeof I!="object"?"":I.filename||I.name||I.title||""}),O=Z(()=>{if(!s.quotedMessage)return"";const I=s.quotedMessage.content;return typeof I=="string"?g(I):""});return(I,P)=>(m(),x("div",{ref_key:"quoteRef",ref:r,class:ne(["reply-quote relative hover:bg-gray-200 rounded-2xl bg-gray-50 px-3 translate-y-[18px] pt-2.5 pb-5 mb-1 select-none",[e.isUser?"ml-auto max-w-[70%] w-fit":"mr-auto",a.value?"cursor-pointer":"cursor-default"]]),onClick:u},[l("div",{class:ne(["absolute top-0 -translate-y-full flex items-center gap-1 text-gray-700",e.isUser?"right-0":"left-0"])},[G(fg,{class:"text-gray-500"}),l("p",Ck,[e.isUser?(m(),x(_e,{key:0},[f.value?(m(),x(_e,{key:0},[We(j(y(t)("chat.reply_context.you_replied_to_yourself")),1)],64)):(m(),x(_e,{key:1},[We(j(y(t)("chat.reply_context.you_replied_to"))+" ",1),l("span",$k,j(d.value||o.value),1)],64))],64)):(m(),x(_e,{key:1},[l("span",Tk,j(d.value||o.value),1),We(" "+j(f.value?y(t)("chat.reply_context.replied_to_themselves"):y(t)("chat.reply_context.replied_to_you")),1)],64))])],2),i.value?(m(),x("p",Ak,j(y(t)("chat.original_message_unavailable")),1)):v.value?(m(),x("div",Ek,[l("div",Ik,[w.value?(m(),x("img",{key:0,src:w.value,alt:"",class:"size-full object-cover"},null,8,Pk)):(m(),oe(Nt(k.value),{key:1,class:"size-4 text-gray-500"}))]),l("div",Mk,[l("p",Ok,j(d.value||o.value),1),l("p",Lk,[l("span",null,"["+j(S.value)+"] ",1),E.value?(m(),x("span",Rk,j(E.value),1)):z("",!0)])])])):(m(),x("p",Dk,j(O.value),1))],2))}},Qu="(?:\\p{Extended_Pictographic}(?:\\uFE0F|\\uFE0E)?(?:\\u200D\\p{Extended_Pictographic}(?:\\uFE0F|\\uFE0E)?)*)|(?:\\p{Regional_Indicator}{2})";function Fk(e){return typeof e!="string"?"":e.replace(/<[^>]*>/g,"").replace(/&nbsp;/gi," ").replace(/\s+/g," ").trim()}function qk(e,t={}){const n=t.maxEmoji??6,s=Fk(e);if(!s||!new RegExp(Qu,"u").test(s))return!1;const o=s.match(new RegExp(Qu,"gu"))??[];return o.length===0||o.length>n?!1:s.replace(new RegExp(Qu,"gu"),"").replace(/[\uFE0F\uFE0E\u200D\p{Emoji_Modifier}]/gu,"").replace(/\s+/g,"")===""}const zk=["id"],Bk=["innerHTML"],Uk=["aria-label","title"],Vk={key:0,class:"text-xs text-gray-500 absolute right-1 -bottom-1 translate-y-full message-user-status"},Hk={key:0},Wk={key:1},Gk={key:1,class:"absolute right-1.5 -bottom-3 z-10"},Kk={class:"flex items-center justify-center size-[24px] text-sm leading-none bg-white border border-gray-100 rounded-full shadow-sm select-none"},gl="chatbot-message-table",Qk=500,hg={__name:"ChatBubble",props:{message:Object,isUser:Boolean,anchorId:{type:Boolean,default:!1},chatViewRef:{type:Object,default:null},newMessageStatus:{type:String},isLatestUserMessage:{type:Boolean,default:!1},logo:{type:String}},emits:["reply"],setup(e,{emit:t}){const{t:n}=en(),s=e,r=Z(()=>{const O=s.message;return!(!O||!/^\d+$/.test(String(O.id??""))||O.is_streaming||O.sender_type!=="assistant"&&O.sender_type!=="user")}),o=R(!1),i=R(null),a=new Map,c=O=>I=>{Qt.linkClick({type:"page",url:O})};function u(O){return/<table[^>]*>[\s\S]*?<\/table>/i.test(O)}function d(O){return u(O)?O.replace(/(<table[\s\S]*?<\/table>)/g,`<div class="${gl}">$1</div>`):O}const f=R(null),h=Z(()=>{const O=s.message.content;return d(O)}),g=Z(()=>{var O;return qk(((O=s.message)==null?void 0:O.content)??"")}),p=Z(()=>s.message.content.includes("ecg-cart-success")),v=Z(()=>s.message.content.includes("eai-order-summary"));Je(()=>{kt(()=>{var I;const O=(I=f.value)==null?void 0:I.querySelectorAll("a");O==null||O.forEach(P=>{const M=P.getAttribute("href"),q=M.includes(window.location.origin),B=M.includes("dienmayxanh"),T=q||B?"_self":"_blank";P.setAttribute("target",T);const A=c(M);a.set(P,A),P.addEventListener("click",A)})}),o.value=s.message.reactions&&Object.keys(s.message.reactions).length>0}),Zn(()=>{a.forEach((O,I)=>{I.removeEventListener("click",O)}),a.clear()});let _;const w=R(!1),k=()=>{As()&&(w.value=!0,_=setTimeout(()=>{i.value.openEmojis(),_=null,o.value=!0},Qk))},S=()=>{As()&&(w.value=!1,_&&(clearTimeout(_),_=null))},E=O=>{o.value=Object.keys(O).length>0};return(O,I)=>{var P;return m(),x("div",{id:e.anchorId&&((P=e.message)!=null&&P.id)?`message-${e.message.id}`:void 0,class:ne(["relative flex-1 group",[e.isUser?"w-full":h.value.includes(gl)||p.value||v.value?"max-w-full":"w-fit max-w-[92%]"]])},[e.message.quoted_message?(m(),oe(Nk,{key:0,quotedMessage:e.message.quoted_message,isUser:e.isUser},null,8,["quotedMessage","isUser"])):z("",!0),l("div",{class:ne(["relative w-full",[e.isUser?"ml-auto":"mr-auto"]])},[l("div",{class:ne(["message",[e.isUser?"message-user":"message-assistant",v.value?"!w-full":""]]),onTouchstart:I[1]||(I[1]=M=>i.value?k():null),onTouchend:I[2]||(I[2]=M=>i.value?S():null)},[l("div",{class:ne(["relative max-w-full",[e.isUser?"ml-auto":"",p.value||v.value||h.value.includes(gl)?"w-full":"w-fit"]])},[l("div",{ref_key:"messageContentRef",ref:f,class:ne(["relative px-4 py-3.5 min-w-11 bg-gray-100 rounded-xl prose-sm prose max-sm:select-none",{"bg-primary text-white":e.isUser,"cart-success":p.value,"order-summary":v.value,"has-table":h.value.includes(gl),"emoji-only":g.value}]),innerHTML:h.value},null,10,Bk),r.value?(m(),x("button",{key:0,type:"button",onClick:I[0]||(I[0]=M=>O.$emit("reply",e.message)),"aria-label":y(n)("chat.reply_to_message"),title:y(n)("chat.reply_to_message"),class:ne(["reply-btn opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity duration-200 flex items-center justify-center size-6 rounded-full bg-gray-50 shadow-sm text-gray-500 hover:bg-gray-100 hover:text-gray-600 absolute top-1/2 -translate-y-1/2",e.isUser?"-left-7":"-right-7"])},[G(y(rk),{class:"size-3"})],10,Uk)):z("",!0),e.isUser?z("",!0):(m(),x("div",{key:1,class:ne(["absolute right-1.5 -bottom-3",e.message.is_last_assistant_message||o.value?"opacity-100":"opacity-0 md:group-hover:opacity-100 transition-opacity duration-300"])},[G(_k,{ref_key:"messageReactionsRef",ref:i,chatViewRef:e.chatViewRef,messageId:e.message.id,messageReactions:e.message.reactions,conversationId:e.message.chat_conversation_id,position:e.isUser||f.value&&f.value.offsetWidth>260?"left":f.value?"center":"left","onUpdate:messageReactions":E},null,8,["chatViewRef","messageId","messageReactions","conversationId","position"])],2))],2),e.isUser&&e.isLatestUserMessage&&e.newMessageStatus!=="unread"?(m(),x("div",Vk,[e.newMessageStatus==="sent"?(m(),x("span",Hk,j(y(n)("common.sent")),1)):e.newMessageStatus==="received"?(m(),x("span",Wk,j(y(n)("common.received")),1)):z("",!0)])):z("",!0)],34)],2),e.isUser&&e.message.bot_reaction?(m(),x("div",Gk,[l("div",Kk,j(e.message.bot_reaction),1)])):z("",!0)],10,zk)}}},Jk={class:"flex items-center gap-2 px-3 py-1.5 pb-2s bg-gray-50 rounded-t-2xl mb-1 overflow-hidden"},Xk={key:0,class:"flex-shrink-0 size-8 rounded-lg overflow-hidden bg-gray-200 flex items-center justify-center"},Zk=["src"],Yk={class:"flex-1 min-w-0"},eS={class:"flex items-center gap-1 mb-0.5"},tS={class:"text-xs font-light text-gray-900 truncate m-0"},nS={class:"font-medium"},sS={key:0,class:"text-xs text-gray-500 truncate m-0"},rS={key:0},oS={key:1,class:"text-xs text-gray-500 truncate m-0"},iS=["aria-label"],aS={__name:"ReplyComposerPreview",props:{replyTarget:{type:Object,required:!0}},emits:["cancel"],setup(e){const{t}=en(),{bot:n}=Et(ae.state),s=e,r=Z(()=>{var v,_,w;return((w=(_=(v=n.value)==null?void 0:v.config)==null?void 0:_.ui)==null?void 0:w.name)||""}),o=["image","gif","video","audio","file","sticker","attachment"],i=v=>{const _=document.createElement("div");return _.innerHTML=v,(_.textContent||_.innerText||"").replace(/\s+/g," ").trim()},a=Z(()=>{var v;return((v=s.replyTarget)==null?void 0:v.content_type)||""}),c=Z(()=>o.includes(a.value)),u=Z(()=>{var _;const v=(_=s.replyTarget)==null?void 0:_.content;if(Array.isArray(v))return v;if(typeof v=="string")try{const w=JSON.parse(v);return Array.isArray(w)?w:[]}catch{return[]}return[]}),d=Z(()=>{var v;return["image","gif","sticker"].includes(a.value)&&((v=u.value[0])==null?void 0:v.url)||null}),f=Z(()=>({file:er,attachment:Gu,video:dg,audio:sg})[a.value]||er),h=Z(()=>{const v=a.value;return t(`chat.quote_media.${v==="attachment"?"file":v}`)}),g=Z(()=>{const v=u.value[0];return!v||typeof v!="object"?"":v.filename||v.name||v.title||""}),p=Z(()=>{if(!s.replyTarget)return"";const v=s.replyTarget.content;return typeof v=="string"?i(v):""});return(v,_)=>(m(),x("div",Jk,[c.value?(m(),x("div",Xk,[d.value?(m(),x("img",{key:0,src:d.value,alt:"",class:"size-full object-cover"},null,8,Zk)):(m(),oe(Nt(f.value),{key:1,class:"size-4 text-gray-500"}))])):z("",!0),l("div",Yk,[l("div",eS,[G(fg,{class:"text-gray-500"}),l("p",tS,[We(j(y(t)("chat.replying_to"))+" ",1),l("span",nS,j(e.replyTarget.sender_name||r.value),1)])]),c.value?(m(),x("p",sS,[l("span",null,"["+j(h.value)+"]",1),g.value?(m(),x("span",rS,j(g.value),1)):z("",!0)])):(m(),x("p",oS,j(p.value),1))]),l("button",{type:"button",onClick:_[0]||(_[0]=w=>v.$emit("cancel")),"aria-label":y(t)("chat.cancel_reply"),class:"flex-shrink-0 flex items-center justify-center size-5 rounded-full hover:bg-gray-200 text-gray-400 transition-colors"},[G(y(Es),{class:"size-4"})],8,iS)]))}};function lS(e){return Object.prototype.toString.call(e)==="[object Object]"}function pg(e){return lS(e)||Array.isArray(e)}function cS(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function Ju(e,t){const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;const r=JSON.stringify(Object.keys(e.breakpoints||{})),o=JSON.stringify(Object.keys(t.breakpoints||{}));return r!==o?!1:n.every(i=>{const a=e[i],c=t[i];return typeof a=="function"?`${a}`==`${c}`:!pg(a)||!pg(c)?a===c:Ju(a,c)})}function mg(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function uS(e,t){if(e.length!==t.length)return!1;const n=mg(e),s=mg(t);return n.every((r,o)=>{const i=s[o];return Ju(r,i)})}function Xu(e){return typeof e=="number"}function Zu(e){return typeof e=="string"}function vl(e){return typeof e=="boolean"}function gg(e){return Object.prototype.toString.call(e)==="[object Object]"}function Dt(e){return Math.abs(e)}function Yu(e){return Math.sign(e)}function $i(e,t){return Dt(e-t)}function dS(e,t){if(e===0||t===0||Dt(e)<=Dt(t))return 0;const n=$i(Dt(e),Dt(t));return Dt(n/e)}function fS(e){return Math.round(e*100)/100}function Ti(e){return Ei(e).map(Number)}function is(e){return e[Ai(e)]}function Ai(e){return Math.max(0,e.length-1)}function ed(e,t){return t===Ai(e)}function vg(e,t=0){return Array.from(Array(e),(n,s)=>t+s)}function Ei(e){return Object.keys(e)}function yg(e,t){return[e,t].reduce((n,s)=>(Ei(s).forEach(r=>{const o=n[r],i=s[r],a=gg(o)&&gg(i);n[r]=a?yg(o,i):i}),n),{})}function td(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function hS(e,t){const n={start:s,center:r,end:o};function s(){return 0}function r(c){return o(c)/2}function o(c){return t-c}function i(c,u){return Zu(e)?n[e](c):e(t,c,u)}return{measure:i}}function Ii(){let e=[];function t(r,o,i,a={passive:!0}){let c;if("addEventListener"in r)r.addEventListener(o,i,a),c=()=>r.removeEventListener(o,i,a);else{const u=r;u.addListener(i),c=()=>u.removeListener(i)}return e.push(c),s}function n(){e=e.filter(r=>r())}const s={add:t,clear:n};return s}function pS(e,t,n,s){const r=Ii(),o=1e3/60;let i=null,a=0,c=0;function u(){r.add(e,"visibilitychange",()=>{e.hidden&&p()})}function d(){g(),r.clear()}function f(_){if(!c)return;i||(i=_,n(),n());const w=_-i;for(i=_,a+=w;a>=o;)n(),a-=o;const k=a/o;s(k),c&&(c=t.requestAnimationFrame(f))}function h(){c||(c=t.requestAnimationFrame(f))}function g(){t.cancelAnimationFrame(c),i=null,a=0,c=0}function p(){i=null,a=0}return{init:u,destroy:d,start:h,stop:g,update:n,render:s}}function mS(e,t){const n=t==="rtl",s=e==="y",r=s?"y":"x",o=s?"x":"y",i=!s&&n?-1:1,a=d(),c=f();function u(p){const{height:v,width:_}=p;return s?v:_}function d(){return s?"top":n?"right":"left"}function f(){return s?"bottom":n?"left":"right"}function h(p){return p*i}return{scroll:r,cross:o,startEdge:a,endEdge:c,measureSize:u,direction:h}}function Mr(e=0,t=0){const n=Dt(e-t);function s(u){return u<e}function r(u){return u>t}function o(u){return s(u)||r(u)}function i(u){return o(u)?s(u)?e:t:u}function a(u){return n?u-n*Math.ceil((u-t)/n):u}return{length:n,max:t,min:e,constrain:i,reachedAny:o,reachedMax:r,reachedMin:s,removeOffset:a}}function bg(e,t,n){const{constrain:s}=Mr(0,e),r=e+1;let o=i(t);function i(h){return n?Dt((r+h)%r):s(h)}function a(){return o}function c(h){return o=i(h),f}function u(h){return d().set(a()+h)}function d(){return bg(e,a(),n)}const f={get:a,set:c,add:u,clone:d};return f}function gS(e,t,n,s,r,o,i,a,c,u,d,f,h,g,p,v,_,w,k){const{cross:S,direction:E}=e,O=["INPUT","SELECT","TEXTAREA"],I={passive:!1},P=Ii(),M=Ii(),q=Mr(50,225).constrain(g.measure(20)),B={mouse:300,touch:400},T={mouse:500,touch:600},A=p?43:25;let D=!1,Q=0,W=0,H=!1,K=!1,J=!1,te=!1;function ge(N){if(!k)return;function ee(L){(vl(k)||k(N,L))&&fe(L)}const Y=t;P.add(Y,"dragstart",L=>L.preventDefault(),I).add(Y,"touchmove",()=>{},I).add(Y,"touchend",()=>{}).add(Y,"touchstart",ee).add(Y,"mousedown",ee).add(Y,"touchcancel",Re).add(Y,"contextmenu",Re).add(Y,"click",Le,!0)}function ue(){P.clear(),M.clear()}function we(){const N=te?n:t;M.add(N,"touchmove",$e,I).add(N,"touchend",Re).add(N,"mousemove",$e,I).add(N,"mouseup",Re)}function Ee(N){const ee=N.nodeName||"";return O.includes(ee)}function re(){return(p?T:B)[te?"mouse":"touch"]}function pe(N,ee){const Y=f.add(Yu(N)*-1),L=d.byDistance(N,!p).distance;return p||Dt(N)<q?L:_&&ee?L*.5:d.byIndex(Y.get(),0).distance}function fe(N){const ee=td(N,s);te=ee,J=p&&ee&&!N.buttons&&D,D=$i(r.get(),i.get())>=2,!(ee&&N.button!==0)&&(Ee(N.target)||(H=!0,o.pointerDown(N),u.useFriction(0).useDuration(0),r.set(i),we(),Q=o.readPoint(N),W=o.readPoint(N,S),h.emit("pointerDown")))}function $e(N){if(!td(N,s)&&N.touches.length>=2)return Re(N);const Y=o.readPoint(N),L=o.readPoint(N,S),V=$i(Y,Q),ie=$i(L,W);if(!K&&!te&&(!N.cancelable||(K=V>ie,!K)))return Re(N);const me=o.pointerMove(N);V>v&&(J=!0),u.useFriction(.3).useDuration(.75),a.start(),r.add(E(me)),N.preventDefault()}function Re(N){const Y=d.byDistance(0,!1).index!==f.get(),L=o.pointerUp(N)*re(),V=pe(E(L),Y),ie=dS(L,V),me=A-10*ie,de=w+ie/50;K=!1,H=!1,M.clear(),u.useDuration(me).useFriction(de),c.distance(V,!p),te=!1,h.emit("pointerUp")}function Le(N){J&&(N.stopPropagation(),N.preventDefault(),J=!1)}function Oe(){return H}return{init:ge,destroy:ue,pointerDown:Oe}}function vS(e,t){let s,r;function o(f){return f.timeStamp}function i(f,h){const p=`client${(h||e.scroll)==="x"?"X":"Y"}`;return(td(f,t)?f:f.touches[0])[p]}function a(f){return s=f,r=f,i(f)}function c(f){const h=i(f)-i(r),g=o(f)-o(s)>170;return r=f,g&&(s=f),h}function u(f){if(!s||!r)return 0;const h=i(r)-i(s),g=o(f)-o(s),p=o(f)-o(r)>170,v=h/g;return g&&!p&&Dt(v)>.1?v:0}return{pointerDown:a,pointerMove:c,pointerUp:u,readPoint:i}}function yS(){function e(n){const{offsetTop:s,offsetLeft:r,offsetWidth:o,offsetHeight:i}=n;return{top:s,right:r+o,bottom:s+i,left:r,width:o,height:i}}return{measure:e}}function bS(e){function t(s){return e*(s/100)}return{measure:t}}function _S(e,t,n,s,r,o,i){const a=[e].concat(s);let c,u,d=[],f=!1;function h(_){return r.measureSize(i.measure(_))}function g(_){if(!o)return;u=h(e),d=s.map(h);function w(k){for(const S of k){if(f)return;const E=S.target===e,O=s.indexOf(S.target),I=E?u:d[O],P=h(E?e:s[O]);if(Dt(P-I)>=.5){_.reInit(),t.emit("resize");break}}}c=new ResizeObserver(k=>{(vl(o)||o(_,k))&&w(k)}),n.requestAnimationFrame(()=>{a.forEach(k=>c.observe(k))})}function p(){f=!0,c&&c.disconnect()}return{init:g,destroy:p}}function xS(e,t,n,s,r,o){let i=0,a=0,c=r,u=o,d=e.get(),f=0;function h(){const I=s.get()-e.get(),P=!c;let M=0;return P?(i=0,n.set(s),e.set(s),M=I):(n.set(e),i+=I/c,i*=u,d+=i,e.add(i),M=d-f),a=Yu(M),f=d,O}function g(){const I=s.get()-t.get();return Dt(I)<.001}function p(){return c}function v(){return a}function _(){return i}function w(){return S(r)}function k(){return E(o)}function S(I){return c=I,O}function E(I){return u=I,O}const O={direction:v,duration:p,velocity:_,seek:h,settled:g,useBaseFriction:k,useBaseDuration:w,useFriction:E,useDuration:S};return O}function wS(e,t,n,s,r){const o=r.measure(10),i=r.measure(50),a=Mr(.1,.99);let c=!1;function u(){return!(c||!e.reachedAny(n.get())||!e.reachedAny(t.get()))}function d(g){if(!u())return;const p=e.reachedMin(t.get())?"min":"max",v=Dt(e[p]-t.get()),_=n.get()-t.get(),w=a.constrain(v/i);n.subtract(_*w),!g&&Dt(_)<o&&(n.set(e.constrain(n.get())),s.useDuration(25).useBaseFriction())}function f(g){c=!g}return{shouldConstrain:u,constrain:d,toggleActive:f}}function kS(e,t,n,s,r){const o=Mr(-t+e,0),i=f(),a=d(),c=h();function u(p,v){return $i(p,v)<=1}function d(){const p=i[0],v=is(i),_=i.lastIndexOf(p),w=i.indexOf(v)+1;return Mr(_,w)}function f(){return n.map((p,v)=>{const{min:_,max:w}=o,k=o.constrain(p),S=!v,E=ed(n,v);return S?w:E||u(_,k)?_:u(w,k)?w:k}).map(p=>parseFloat(p.toFixed(3)))}function h(){if(t<=e+r)return[o.max];if(s==="keepSnaps")return i;const{min:p,max:v}=a;return i.slice(p,v)}return{snapsContained:c,scrollContainLimit:a}}function SS(e,t,n){const s=t[0],r=n?s-e:is(t);return{limit:Mr(r,s)}}function CS(e,t,n,s){const o=t.min+.1,i=t.max+.1,{reachedMin:a,reachedMax:c}=Mr(o,i);function u(h){return h===1?c(n.get()):h===-1?a(n.get()):!1}function d(h){if(!u(h))return;const g=e*(h*-1);s.forEach(p=>p.add(g))}return{loop:d}}function $S(e){const{max:t,length:n}=e;function s(o){const i=o-t;return n?i/-n:0}return{get:s}}function TS(e,t,n,s,r){const{startEdge:o,endEdge:i}=e,{groupSlides:a}=r,c=f().map(t.measure),u=h(),d=g();function f(){return a(s).map(v=>is(v)[i]-v[0][o]).map(Dt)}function h(){return s.map(v=>n[o]-v[o]).map(v=>-Dt(v))}function g(){return a(u).map(v=>v[0]).map((v,_)=>v+c[_])}return{snaps:u,snapsAligned:d}}function AS(e,t,n,s,r,o){const{groupSlides:i}=r,{min:a,max:c}=s,u=d();function d(){const h=i(o),g=!e||t==="keepSnaps";return n.length===1?[o]:g?h:h.slice(a,c).map((p,v,_)=>{const w=!v,k=ed(_,v);if(w){const S=is(_[0])+1;return vg(S)}if(k){const S=Ai(o)-is(_)[0]+1;return vg(S,is(_)[0])}return p})}return{slideRegistry:u}}function ES(e,t,n,s,r){const{reachedAny:o,removeOffset:i,constrain:a}=s;function c(p){return p.concat().sort((v,_)=>Dt(v)-Dt(_))[0]}function u(p){const v=e?i(p):a(p),_=t.map((k,S)=>({diff:d(k-v,0),index:S})).sort((k,S)=>Dt(k.diff)-Dt(S.diff)),{index:w}=_[0];return{index:w,distance:v}}function d(p,v){const _=[p,p+n,p-n];if(!e)return p;if(!v)return c(_);const w=_.filter(k=>Yu(k)===v);return w.length?c(w):is(_)-n}function f(p,v){const _=t[p]-r.get(),w=d(_,v);return{index:p,distance:w}}function h(p,v){const _=r.get()+p,{index:w,distance:k}=u(_),S=!e&&o(_);if(!v||S)return{index:w,distance:p};const E=t[w]-k,O=p+d(E,0);return{index:w,distance:O}}return{byDistance:h,byIndex:f,shortcut:d}}function IS(e,t,n,s,r,o,i){function a(f){const h=f.distance,g=f.index!==t.get();o.add(h),h&&(s.duration()?e.start():(e.update(),e.render(1),e.update())),g&&(n.set(t.get()),t.set(f.index),i.emit("select"))}function c(f,h){const g=r.byDistance(f,h);a(g)}function u(f,h){const g=t.clone().set(f),p=r.byIndex(g.get(),h);a(p)}return{distance:c,index:u}}function PS(e,t,n,s,r,o,i,a){const c={passive:!0,capture:!0};let u=0;function d(g){if(!a)return;function p(v){if(new Date().getTime()-u>10)return;i.emit("slideFocusStart"),e.scrollLeft=0;const k=n.findIndex(S=>S.includes(v));Xu(k)&&(r.useDuration(0),s.index(k,0),i.emit("slideFocus"))}o.add(document,"keydown",f,!1),t.forEach((v,_)=>{o.add(v,"focus",w=>{(vl(a)||a(g,w))&&p(_)},c)})}function f(g){g.code==="Tab"&&(u=new Date().getTime())}return{init:d}}function Pi(e){let t=e;function n(){return t}function s(c){t=i(c)}function r(c){t+=i(c)}function o(c){t-=i(c)}function i(c){return Xu(c)?c:c.get()}return{get:n,set:s,add:r,subtract:o}}function _g(e,t){const n=e.scroll==="x"?i:a,s=t.style;let r=null,o=!1;function i(h){return`translate3d(${h}px,0px,0px)`}function a(h){return`translate3d(0px,${h}px,0px)`}function c(h){if(o)return;const g=fS(e.direction(h));g!==r&&(s.transform=n(g),r=g)}function u(h){o=!h}function d(){o||(s.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:d,to:c,toggleActive:u}}function MS(e,t,n,s,r,o,i,a,c){const d=Ti(r),f=Ti(r).reverse(),h=w().concat(k());function g(P,M){return P.reduce((q,B)=>q-r[B],M)}function p(P,M){return P.reduce((q,B)=>g(q,M)>0?q.concat([B]):q,[])}function v(P){return o.map((M,q)=>({start:M-s[q]+.5+P,end:M+t-.5+P}))}function _(P,M,q){const B=v(M);return P.map(T=>{const A=q?0:-n,D=q?n:0,Q=q?"end":"start",W=B[T][Q];return{index:T,loopPoint:W,slideLocation:Pi(-1),translate:_g(e,c[T]),target:()=>a.get()>W?A:D}})}function w(){const P=i[0],M=p(f,P);return _(M,n,!1)}function k(){const P=t-i[0]-1,M=p(d,P);return _(M,-n,!0)}function S(){return h.every(({index:P})=>{const M=d.filter(q=>q!==P);return g(M,t)<=.1})}function E(){h.forEach(P=>{const{target:M,translate:q,slideLocation:B}=P,T=M();T!==B.get()&&(q.to(T),B.set(T))})}function O(){h.forEach(P=>P.translate.clear())}return{canLoop:S,clear:O,loop:E,loopPoints:h}}function OS(e,t,n){let s,r=!1;function o(c){if(!n)return;function u(d){for(const f of d)if(f.type==="childList"){c.reInit(),t.emit("slidesChanged");break}}s=new MutationObserver(d=>{r||(vl(n)||n(c,d))&&u(d)}),s.observe(e,{childList:!0})}function i(){s&&s.disconnect(),r=!0}return{init:o,destroy:i}}function LS(e,t,n,s){const r={};let o=null,i=null,a,c=!1;function u(){a=new IntersectionObserver(p=>{c||(p.forEach(v=>{const _=t.indexOf(v.target);r[_]=v}),o=null,i=null,n.emit("slidesInView"))},{root:e.parentElement,threshold:s}),t.forEach(p=>a.observe(p))}function d(){a&&a.disconnect(),c=!0}function f(p){return Ei(r).reduce((v,_)=>{const w=parseInt(_),{isIntersecting:k}=r[w];return(p&&k||!p&&!k)&&v.push(w),v},[])}function h(p=!0){if(p&&o)return o;if(!p&&i)return i;const v=f(p);return p&&(o=v),p||(i=v),v}return{init:u,destroy:d,get:h}}function RS(e,t,n,s,r,o){const{measureSize:i,startEdge:a,endEdge:c}=e,u=n[0]&&r,d=p(),f=v(),h=n.map(i),g=_();function p(){if(!u)return 0;const k=n[0];return Dt(t[a]-k[a])}function v(){if(!u)return 0;const k=o.getComputedStyle(is(s));return parseFloat(k.getPropertyValue(`margin-${c}`))}function _(){return n.map((k,S,E)=>{const O=!S,I=ed(E,S);return O?h[S]+d:I?h[S]+f:E[S+1][a]-k[a]}).map(Dt)}return{slideSizes:h,slideSizesWithGaps:g,startGap:d,endGap:f}}function DS(e,t,n,s,r,o,i,a,c){const{startEdge:u,endEdge:d,direction:f}=e,h=Xu(n);function g(w,k){return Ti(w).filter(S=>S%k===0).map(S=>w.slice(S,S+k))}function p(w){return w.length?Ti(w).reduce((k,S,E)=>{const O=is(k)||0,I=O===0,P=S===Ai(w),M=r[u]-o[O][u],q=r[u]-o[S][d],B=!s&&I?f(i):0,T=!s&&P?f(a):0,A=Dt(q-T-(M+B));return E&&A>t+c&&k.push(S),P&&k.push(w.length),k},[]).map((k,S,E)=>{const O=Math.max(E[S-1]||0);return w.slice(O,k)}):[]}function v(w){return h?g(w,n):p(w)}return{groupSlides:v}}function jS(e,t,n,s,r,o,i){const{align:a,axis:c,direction:u,startIndex:d,loop:f,duration:h,dragFree:g,dragThreshold:p,inViewThreshold:v,slidesToScroll:_,skipSnaps:w,containScroll:k,watchResize:S,watchSlides:E,watchDrag:O,watchFocus:I}=o,P=2,M=yS(),q=M.measure(t),B=n.map(M.measure),T=mS(c,u),A=T.measureSize(q),D=bS(A),Q=hS(a,A),W=!f&&!!k,H=f||!!k,{slideSizes:K,slideSizesWithGaps:J,startGap:te,endGap:ge}=RS(T,q,B,n,H,r),ue=DS(T,A,_,f,q,B,te,ge,P),{snaps:we,snapsAligned:Ee}=TS(T,Q,q,B,ue),re=-is(we)+is(J),{snapsContained:pe,scrollContainLimit:fe}=kS(A,re,Ee,k,P),$e=W?pe:Ee,{limit:Re}=SS(re,$e,f),Le=bg(Ai($e),d,f),Oe=Le.clone(),Ve=Ti(n),N=({dragHandler:yt,scrollBody:Ot,scrollBounds:cn,options:{loop:qt}})=>{qt||cn.constrain(yt.pointerDown()),Ot.seek()},ee=({scrollBody:yt,translate:Ot,location:cn,offsetLocation:qt,previousLocation:Dn,scrollLooper:se,slideLooper:be,dragHandler:qe,animation:ze,eventHandler:le,scrollBounds:xe,options:{loop:Ge}},at)=>{const gt=yt.settled(),_n=!xe.shouldConstrain(),jn=Ge?gt:gt&&_n,Qn=jn&&!qe.pointerDown();Qn&&ze.stop();const Tn=cn.get()*at+Dn.get()*(1-at);qt.set(Tn),Ge&&(se.loop(yt.direction()),be.loop()),Ot.to(qt.get()),Qn&&le.emit("settle"),jn||le.emit("scroll")},Y=pS(s,r,()=>N(pt),yt=>ee(pt,yt)),L=.68,V=$e[Le.get()],ie=Pi(V),me=Pi(V),de=Pi(V),ve=Pi(V),he=xS(ie,de,me,ve,h,L),Te=ES(f,$e,re,Re,ve),je=IS(Y,Le,Oe,he,Te,ve,i),De=$S(Re),Ie=Ii(),He=LS(t,n,i,v),{slideRegistry:ot}=AS(W,k,$e,fe,ue,Ve),it=PS(e,n,ot,je,he,Ie,i,I),pt={ownerDocument:s,ownerWindow:r,eventHandler:i,containerRect:q,slideRects:B,animation:Y,axis:T,dragHandler:gS(T,e,s,r,ve,vS(T,r),ie,Y,je,he,Te,Le,i,D,g,p,w,L,O),eventStore:Ie,percentOfView:D,index:Le,indexPrevious:Oe,limit:Re,location:ie,offsetLocation:de,previousLocation:me,options:o,resizeHandler:_S(t,i,r,n,T,S,M),scrollBody:he,scrollBounds:wS(Re,de,ve,he,D),scrollLooper:CS(re,Re,de,[ie,de,me,ve]),scrollProgress:De,scrollSnapList:$e.map(De.get),scrollSnaps:$e,scrollTarget:Te,scrollTo:je,slideLooper:MS(T,A,re,K,J,we,$e,de,n),slideFocus:it,slidesHandler:OS(t,i,E),slidesInView:He,slideIndexes:Ve,slideRegistry:ot,slidesToScroll:ue,target:ve,translate:_g(T,t)};return pt}function NS(){let e={},t;function n(u){t=u}function s(u){return e[u]||[]}function r(u){return s(u).forEach(d=>d(t,u)),c}function o(u,d){return e[u]=s(u).concat([d]),c}function i(u,d){return e[u]=s(u).filter(f=>f!==d),c}function a(){e={}}const c={init:n,emit:r,off:i,on:o,clear:a};return c}const FS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function qS(e){function t(o,i){return yg(o,i||{})}function n(o){const i=o.breakpoints||{},a=Ei(i).filter(c=>e.matchMedia(c).matches).map(c=>i[c]).reduce((c,u)=>t(c,u),{});return t(o,a)}function s(o){return o.map(i=>Ei(i.breakpoints||{})).reduce((i,a)=>i.concat(a),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:n,optionsMediaQueries:s}}function zS(e){let t=[];function n(o,i){return t=i.filter(({options:a})=>e.optionsAtMedia(a).active!==!1),t.forEach(a=>a.init(o,e)),i.reduce((a,c)=>Object.assign(a,{[c.name]:c}),{})}function s(){t=t.filter(o=>o.destroy())}return{init:n,destroy:s}}function yl(e,t,n){const s=e.ownerDocument,r=s.defaultView,o=qS(r),i=zS(o),a=Ii(),c=NS(),{mergeOptions:u,optionsAtMedia:d,optionsMediaQueries:f}=o,{on:h,off:g,emit:p}=c,v=T;let _=!1,w,k=u(FS,yl.globalOptions),S=u(k),E=[],O,I,P;function M(){const{container:Ve,slides:N}=S;I=(Zu(Ve)?e.querySelector(Ve):Ve)||e.children[0];const Y=Zu(N)?I.querySelectorAll(N):N;P=[].slice.call(Y||I.children)}function q(Ve){const N=jS(e,I,P,s,r,Ve,c);if(Ve.loop&&!N.slideLooper.canLoop()){const ee=Object.assign({},Ve,{loop:!1});return q(ee)}return N}function B(Ve,N){_||(k=u(k,Ve),S=d(k),E=N||E,M(),w=q(S),f([k,...E.map(({options:ee})=>ee)]).forEach(ee=>a.add(ee,"change",T)),S.active&&(w.translate.to(w.location.get()),w.animation.init(),w.slidesInView.init(),w.slideFocus.init(Oe),w.eventHandler.init(Oe),w.resizeHandler.init(Oe),w.slidesHandler.init(Oe),w.options.loop&&w.slideLooper.loop(),I.offsetParent&&P.length&&w.dragHandler.init(Oe),O=i.init(Oe,E)))}function T(Ve,N){const ee=ue();A(),B(u({startIndex:ee},Ve),N),c.emit("reInit")}function A(){w.dragHandler.destroy(),w.eventStore.clear(),w.translate.clear(),w.slideLooper.clear(),w.resizeHandler.destroy(),w.slidesHandler.destroy(),w.slidesInView.destroy(),w.animation.destroy(),i.destroy(),a.clear()}function D(){_||(_=!0,a.clear(),A(),c.emit("destroy"),c.clear())}function Q(Ve,N,ee){!S.active||_||(w.scrollBody.useBaseFriction().useDuration(N===!0?0:S.duration),w.scrollTo.index(Ve,ee||0))}function W(Ve){const N=w.index.add(1).get();Q(N,Ve,-1)}function H(Ve){const N=w.index.add(-1).get();Q(N,Ve,1)}function K(){return w.index.add(1).get()!==ue()}function J(){return w.index.add(-1).get()!==ue()}function te(){return w.scrollSnapList}function ge(){return w.scrollProgress.get(w.offsetLocation.get())}function ue(){return w.index.get()}function we(){return w.indexPrevious.get()}function Ee(){return w.slidesInView.get()}function re(){return w.slidesInView.get(!1)}function pe(){return O}function fe(){return w}function $e(){return e}function Re(){return I}function Le(){return P}const Oe={canScrollNext:K,canScrollPrev:J,containerNode:Re,internalEngine:fe,destroy:D,off:g,on:h,emit:p,plugins:pe,previousScrollSnap:we,reInit:v,rootNode:$e,scrollNext:W,scrollPrev:H,scrollProgress:ge,scrollSnapList:te,scrollTo:Q,selectedScrollSnap:ue,slideNodes:Le,slidesInView:Ee,slidesNotInView:re};return B(t,n),setTimeout(()=>c.emit("init"),0),Oe}yl.globalOptions=void 0;function nd(e={},t=[]){const n=Ft(e),s=Ft(t);let r=n?e.value:e,o=s?t.value:t;const i=_f(),a=_f();function c(){a.value&&a.value.reInit(r,o)}return Je(()=>{!cS()||!i.value||(yl.globalOptions=nd.globalOptions,a.value=yl(i.value,r,o))}),Zn(()=>{a.value&&a.value.destroy()}),n&&Pe(e,u=>{Ju(r,u)||(r=u,c())}),s&&Pe(t,u=>{uS(o,u)||(o=u,c())}),[i,a]}nd.globalOptions=void 0;const BS={},US={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},VS=[l("path",{d:"m15 18-6-6 6-6"},null,-1)];function HS(e,t){return m(),x("svg",US,VS)}const WS=Qe(BS,[["render",HS]]),GS={},KS={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},QS=[l("path",{d:"m9 18 6-6-6-6"},null,-1)];function JS(e,t){return m(),x("svg",KS,QS)}const xg=Qe(GS,[["render",JS]]),XS={class:"embla__container"},ZS={key:0,class:"embla__controls hidden md:flex"},YS={key:0,class:"embla__buttons"},eC={key:1,class:"embla__dots"},tC=["onClick"],Mi={__name:"Slider",props:{autoplay:{type:Boolean,default:!1},pagination:{type:Boolean,default:!1},showArrows:{type:Boolean,default:!0},loop:{type:Boolean,default:!1},duration:{type:Number,default:25},slidesPerView:{type:Number,default:null},spaceBetween:{type:Number,default:0},breakpoints:{type:Object,default:null},slidesPerViewMobile:{type:Number,default:null},slidesPerViewTablet:{type:Number,default:null},sizeArrow:{type:String,default:"md",validator:e=>["md","lg","xl"].includes(e)},allowOverflow:{type:Boolean,default:!1}},emits:["change","slideChange","init"],setup(e,{expose:t,emit:n}){const s=n,r=e,[o,i]=nd({duration:r.duration,loop:r.loop,align:"start",slidesToScroll:1}),a=R([]),c=R(0),u=R(!1),d=R(!0);let f=null;function h(){if(r.breakpoints)return r.breakpoints;const D={};return r.slidesPerViewTablet!=null&&(D[768]={slidesPerView:r.slidesPerViewTablet}),r.slidesPerView!=null&&(r.slidesPerViewTablet!=null||r.slidesPerViewMobile!=null)&&(D[1280]={slidesPerView:r.slidesPerView}),D}const g=R(r.slidesPerViewMobile??r.slidesPerView??null),p=R(r.spaceBetween??0);function v(){if(!r.slidesPerView&&!r.breakpoints)return;const D=window.innerWidth,Q=h(),W=Object.keys(Q).map(Number).sort((K,J)=>K-J);let H={slidesPerView:r.slidesPerViewMobile??r.slidesPerView??1,spaceBetween:r.spaceBetween??0};for(const K of W)if(D>=K)H={...H,...Q[K]};else break;g.value=H.slidesPerView,p.value=H.spaceBetween}const _=Z(()=>!!(r.slidesPerView||r.breakpoints)),w=Z(()=>_.value?{"--slides-per-view":g.value,"--space-between":`${p.value}px`}:{}),k=Z(()=>{switch(r.sizeArrow){case"xl":return"size-14";case"lg":return"size-10";default:return"size-8"}}),S=Z(()=>{switch(r.sizeArrow){case"xl":return"w-6";case"lg":return"w-5";default:return"w-4"}});Je(()=>{v(),window.addEventListener("resize",v),i.value&&(a.value=i.value.slideNodes(),i.value.on("select",B),q(),E(),s("init",i.value))}),Rt(()=>{window.removeEventListener("resize",v),O()}),Pe(()=>r.autoplay,D=>{D?E():O()});function E(){r.autoplay&&a.value.length>1&&(f=setInterval(()=>{var D;(D=i.value)==null||D.scrollNext()},3e3))}function O(){f&&(clearInterval(f),f=null)}function I(D){var Q;(Q=i.value)==null||Q.scrollTo(D)}function P(){var D;(D=i.value)==null||D.scrollPrev()}function M(){var D;(D=i.value)==null||D.scrollNext()}function q(){i.value&&(u.value=i.value.canScrollPrev(),d.value=i.value.canScrollNext())}function B(){c.value=i.value.selectedScrollSnap(),q();const D={currentIndex:c.value,activeSlide:a.value[c.value],totalSlides:a.value.length};s("change",D),s("slideChange",D)}const T=()=>{r.autoplay&&O()},A=()=>{r.autoplay&&E()};return t({scrollTo:I,scrollPrev:P,scrollNext:M,emblaApi:i,currentSlidesPerView:g}),(D,Q)=>(m(),x("div",{class:"embla-wrapper",onMouseenter:T,onMouseleave:A},[l("div",{class:ne(["embla",{"embla--per-view":_.value,"embla--allow-overflow":e.allowOverflow}]),style:ht(w.value),ref_key:"emblaRef",ref:o},[l("div",XS,[It(D.$slots,"default",Gi(ya({selectedIndex:c.value,scrollTo:I})))])],6),a.value&&a.value.length>1?(m(),x("div",ZS,[e.showArrows?(m(),x("div",YS,[Lt(l("button",{class:ne(["embla__button embla__button--prev",k.value]),onClick:Q[0]||(Q[0]=W=>{var H;return(H=y(i))==null?void 0:H.scrollPrev()})},[G(WS,{class:ne(S.value)},null,8,["class"])],2),[[ei,u.value]]),Lt(l("button",{class:ne(["embla__button embla__button--next",k.value]),onClick:Q[1]||(Q[1]=W=>{var H;return(H=y(i))==null?void 0:H.scrollNext()})},[G(xg,{class:ne(S.value)},null,8,["class"])],2),[[ei,d.value]])])):z("",!0),e.pagination?(m(),x("div",eC,[(m(!0),x(_e,null,Me(a.value,(W,H)=>(m(),x("button",{key:H,class:ne(["embla__dot",{"is-selected":H===c.value}]),onClick:K=>I(H)},null,10,tC))),128))])):z("",!0)])):z("",!0)],32))}},nC={},sC={class:"embla__slide"};function rC(e,t){return m(),x("div",sC,[It(e.$slots,"default")])}const bl=Qe(nC,[["render",rC]]),oC={class:"flex flex-col px-2.5 pt-2.5 pb-3 h-full rounded-2xl border border-gray-200 duration-500 group hover:border-primary"},iC=["href"],aC=["src"],lC={key:1,class:"w-full flex items-center justify-center h-full min-h-[118px]"},cC=["src"],uC=["href","innerHTML"],dC=["innerHTML"],fC={__name:"CardPreview",props:["item","logo"],setup(e){const n="https://widget.geteasy.ai"+"/link.png";function s(r,o={}){["product","page"].includes(r)&&Qt.linkClick({type:r,...o})}return(r,o)=>(m(),x("div",oC,[l("a",{target:"_blank",href:e.item.source,onClick:o[2]||(o[2]=i=>s("page",{url:e.item.source})),class:"flex overflow-hidden flex-1 justify-center items-center rounded-xl border border-gray-200 max-h-48"},[e.item.image?(m(),x("img",{key:0,src:e.item.image,class:"object-cover w-full h-full",onError:o[0]||(o[0]=i=>(i.target.src=n,i.target.className="max-w-7"))},null,40,aC)):(m(),x("div",lC,[l("img",{src:e.logo,class:"object-cover w-9 h-9 rounded-full",onError:o[1]||(o[1]=i=>i.target.src=n)},null,40,cC)]))],8,iC),e.item.title?(m(),x("a",{key:0,target:"_blank",href:e.item.source,onClick:o[3]||(o[3]=i=>s("page",{url:e.item.source})),class:"font-semibold text-gray-700 mt-2 text-sm group-hover:text-primary line-clamp-1 duration-500 break-words min-h-[20px]",innerHTML:e.item.title},null,8,uC)):z("",!0),e.item.description||e.item.source?(m(),x("p",{key:1,class:"text-sm text-gray-500 mt-1 line-clamp-2 break-words min-h-[40px]",innerHTML:e.item.description||e.item.source},null,8,dC)):z("",!0)]))}},hC={class:"rounded-lg flex p-2 group border border-gray-200 hover:border-primary duration-500 w-[96%] max-w-xl"},pC={class:"w-[138px] h-[90px] flex-shrink-0 mr-2"},mC=["href"],gC=["src"],vC={key:1,class:"min-h-[84px] w-full flex items-center justify-center"},yC=["src"],bC={class:"overflow-hidden space-y-1"},_C=["href","innerHTML"],xC=["innerHTML"],wC={__name:"CardPreviewHorizontal",props:["item","logo"],setup(e){function t(n,s={}){["product","page"].includes(n)&&Qt.linkClick({type:n,...s})}return(n,s)=>(m(),x("div",hC,[l("div",pC,[l("a",{target:"_blank",href:e.item.source,class:ne(["flex overflow-hidden justify-center items-center h-full border border-gray-100 rounded",!e.item.image&&"h-full"]),onClick:s[2]||(s[2]=r=>t("page",{url:e.item.source}))},[e.item.image?(m(),x("img",{key:0,src:e.item.image,class:"object-contain w-full h-full",onError:s[0]||(s[0]=r=>(r.target.src=e.logo,r.target.className="max-w-8"))},null,40,gC)):(m(),x("div",vC,[l("img",{src:e.logo,class:"object-cover overflow-hidden w-8 h-8 rounded-full",onError:s[1]||(s[1]=r=>r.target.src=e.logo)},null,40,yC)]))],10,mC)]),l("div",bC,[e.item.title?(m(),x("a",{key:0,target:"_blank",href:e.item.source,onClick:s[3]||(s[3]=r=>t("page",{url:e.item.source})),class:"text-sm font-semibold text-gray-700 duration-500 group-hover:text-primary line-clamp-2",innerHTML:e.item.title},null,8,_C)):z("",!0),e.item.description||e.item.source?(m(),x("p",{key:1,class:"text-sm text-gray-500 line-clamp-2 break-words leading-[120%]",innerHTML:e.item.description||e.item.source},null,8,xC)):z("",!0)])]))}};function kC(){var r;const e=((r=U.bot)==null?void 0:r.config.apiHost)||U.apiDomain,t=St.create({baseURL:`${e}/api/bots/${U.handle}/forms`});return{submit:async({formData:o,type:i})=>{const a=U.forms&&U.forms[i]&&U.forms[i].id;if(!a||!o)throw new Error("Missing data: formId or formData is required");const{submission_data:c,id:u}=await t.post(`/${a}/submission`,o).then(d=>d.data);return c?{success:!0,data:c,submissionId:u}:{success:!1,data:null,submissionId:null}},getForms:async()=>{const o=JSON.parse(JSON.stringify(U.bot.widgets??[]));if(o.length==0)return;const i=o.reduce((a,c)=>c.active?{...a,[c.type]:c}:a,{});U.forms=i}}}const SC={class:"messages-group w-full"},CC={class:"relative flex size-8 overflow-hidden rounded-full shrink-0 bg-white message-avatar"},$C=["src","alt"],TC={key:0,class:"rounded-2xl bg-white w-full overflow-hidden max-w-[540px]"},AC={class:"flex items-center justify-between pl-4 pr-2.5 h-12 bg-primary"},EC={class:"font-semibold text-base text-white"},IC={class:"font-medium"},PC={key:1,class:"flex items-center justify-center mr-1"},MC={key:0,"aria-label":"form-submitted",class:"flex items-center space-x-1 text-sm text-primary bg-white rounded-md px-2 py-1"},OC={class:"font-medium"},LC={class:"pl-4 pr-3 py-2 border border-primary border-b-2 border-b-primary rounded-b-2xl"},RC={key:0,class:"w-full"},DC={class:"text-sm text-gray-700 border-b border-b-gray-200 last:border-b-0"},jC={class:"text-gray-500 p-2 pl-0 min-w-[114px] content-start"},NC={class:"py-1"},FC={key:0,class:"flex items-center px-2 py-1.5 rounded-md"},qC={class:"font-medium text-gray-700 whitespace-pre-wrap"},zC={key:1,class:"px-2"},BC={key:1,class:"w-full"},UC={class:"text-sm text-gray-700 border-b border-b-gray-200 last:border-b-0"},VC={class:"text-gray-500 p-2 pl-0 min-w-[114px] content-start"},HC={class:"py-1"},WC={class:"font-medium text-gray-700 whitespace-pre-wrap"},GC={key:1},KC={key:0,class:"px-2"},QC=[l("div",{class:"text-sm font-normal text-blue-400 underline underline-offset-2 text-left"}," Nhập thông tin ",-1)],wg={__name:"CardFormContact",props:{message:{type:Object}},setup(e){const{t}=en(),n=e,{widgets:s}=Ys(),{getStorage:r}=Ks(),o=R(!1),i=R({}),a=Z(()=>{var g,p;return s.value.contact.is_finish||s.value.contact.submission_data||((p=(g=n.message.content)==null?void 0:g.submission)==null?void 0:p.submission_data)}),c=()=>{U.isOpenFormContact=!0},u=()=>{var g,p;s.value.contact.is_finish=0,s.value.contact.submission_data=null,i.value=((p=(g=n.message.content)==null?void 0:g.submission)==null?void 0:p.submission_data)??{}};Pe(()=>{var g;return(g=s.value.contact)==null?void 0:g.fields},g=>{var p,v;a.value||(v=(p=n.message.content)==null?void 0:p.submission)!=null&&v.submission_data||(i.value||(i.value={}),g==null||g.forEach(_=>{_.value&&(i.value[_.name]=_.value)}))},{deep:!0});const d=Z(()=>{var g,p;return((p=(g=n.message.content)==null?void 0:g.submission)==null?void 0:p.submission_data)??null});Pe(()=>s.value.contact.submission_data,g=>{i.value=g??{}});const f=Z(()=>Object.values(i.value).filter(g=>g).length>1),h=async()=>{if(o.value)return;o.value=!0;const g=r("easychatgpt_conversations",U.handle),p={status:"submitted",message_id:n.message.id,conversation_id:g,submission_data:i.value},{data:v,status:_}=await Xe.submission.submitWidget({widgetId:s.value.contact.id,formData:p});_===200&&(U.isOpenFormContact=!1,s.value.contact.is_finish=1,i.value=v.submission_data),o.value=!1};return Je(()=>{u(),s.value.contact.message_id=n.message.id}),(g,p)=>(m(),x("div",SC,[l("span",CC,[y(U).bot&&y(U).bot.config.ui.logo?(m(),x("img",{key:0,src:y(U).bot.config.ui.logo,alt:y(U).bot.config.ui.name,class:"w-full h-full object-cover"},null,8,$C)):z("",!0)]),y(s).contact?(m(),x("div",TC,[l("div",AC,[l("div",EC,j(y(s).contact.name),1),!a.value&&f.value?(m(),x("button",{key:0,onClick:p[0]||(p[0]=v=>h()),class:"flex items-center space-x-1 text-sm text-primary bg-white rounded-md px-2 py-1"},[l("div",IC,j(y(t)("common.send")),1),o.value?(m(),oe(y(K2),{key:0,size:"14","stroke-width":"2",class:"animation-rotate"})):(m(),oe(y(Ku),{key:1,size:"14"}))])):(m(),x("div",PC,[a.value?(m(),x("div",MC,[l("div",OC,j(y(t)("common.sent")),1),G(y(dl),{size:"16","stroke-width":"2"})])):(m(),oe(y(ik),{key:1,size:"20",class:"text-white"}))]))]),l("div",LC,[d.value?(m(),x("table",RC,[(m(!0),x(_e,null,Me(y(s).contact.fields,v=>(m(),x("tr",DC,[l("td",jC,j(v.label),1),l("td",NC,[d.value[v.name]?(m(),x("div",FC,[l("span",qC,j(d.value[v.name]),1)])):(m(),x("div",zC,"-"))])]))),256))])):(m(),x("table",BC,[(m(!0),x(_e,null,Me(y(s).contact.fields,(v,_)=>(m(),x("tr",UC,[l("td",VC,j(v.label),1),l("td",HC,[i.value[v.name]?(m(),x("div",{key:0,onClick:p[1]||(p[1]=w=>!a.value&&c()),class:ne(["flex items-center px-2 py-1.5 rounded-md",!a.value&&"hover:bg-gray-100 cursor-pointer"])},[l("span",WC,j(i.value[v.name]),1),a.value?z("",!0):(m(),oe(y(nk),{key:0,size:"14",class:"text-gray-500 ml-auto flex-shrink-0"}))],2)):(m(),x("div",GC,[a.value?(m(),x("div",KC,"-")):(m(),x("button",{key:1,class:"text-gray-700 font-medium px-2 py-1.5 hover:bg-gray-100 w-full rounded-lg",onClick:p[2]||(p[2]=w=>c())},QC))]))])]))),256))]))])])):z("",!0)]))}};function sd(){return{isLocked:Z(()=>ae.state.dropdownLockCount>0),lockScroll:()=>{ae.actions.lockDropdown()},unlockScroll:()=>{ae.actions.unlockDropdown()}}}const JC={class:"flex items-center justify-between mb-2.5"},XC={class:"flex gap-1 font-semibold text-sm text-gray-900"},ZC={class:"grid grid-cols-7 mb-1"},YC={class:"grid grid-cols-7 gap-1"},e$=["disabled","onClick"],t$=300,n$=280,s$=Qe({__name:"FormDatepicker",props:{modelValue:{type:String,default:""},disabled:{type:Boolean,default:!1},locale:{type:String,default:"vi",validator:e=>["vi","en"].includes(e)},iconPosition:{type:String,default:"left",validator:e=>["left","right"].includes(e)},classField:{type:[String,Array,Object],default:""},hasError:{type:Boolean,default:!1}},emits:["update:modelValue","change","blur"],setup(e,{emit:t}){const{lockScroll:n,unlockScroll:s}=sd(),r=Z(()=>ae.state.chatContainerRef||ae.state.rootMarketplaceRef||"body"),o=e,i=t,a={vi:{months:["Tháng 1","Tháng 2","Tháng 3","Tháng 4","Tháng 5","Tháng 6","Tháng 7","Tháng 8","Tháng 9","Tháng 10","Tháng 11","Tháng 12"],weekdays:["CN","T2","T3","T4","T5","T6","T7"],placeholder:"DD/MM/YYYY"},en:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Su","Mo","Tu","We","Th","Fr","Sa"],placeholder:"DD/MM/YYYY"}},c=Z(()=>a[o.locale]||a.vi),u=R(!1),d=R(null),f=R(null),h=R("bottom"),g=R({}),p=()=>{if(!f.value)return;const K=f.value.getBoundingClientRect(),J=ae.state.chatContainerRef||ae.state.rootMarketplaceRef,te=J?J.getBoundingClientRect():{top:0,bottom:window.innerHeight,left:0,right:window.innerWidth},ge=te.bottom-K.bottom,ue=K.top-te.top,we=ge<t$&&ue>ge;h.value=we?"top":"bottom";const Ee=Math.max(te.left,Math.min(K.left,te.right-n$-4));g.value=we?{position:"fixed",bottom:`${window.innerHeight-K.top+6}px`,left:`${Ee}px`}:{position:"fixed",top:`${K.bottom+6}px`,left:`${Ee}px`}},v=new Date;v.setHours(0,0,0,0);const _=R(null),w=R(v.getFullYear()),k=R(v.getMonth()),S=K=>{if(!K)return null;let J=String(K).match(/^(\d{4})-(\d{2})-(\d{2})/);return J?new Date(+J[1],+J[2]-1,+J[3]):(J=String(K).match(/^(\d{2})\/(\d{2})\/(\d{4})$/),J?new Date(+J[3],+J[2]-1,+J[1]):null)},E=K=>{if(!K)return"";const J=String(K.getDate()).padStart(2,"0"),te=String(K.getMonth()+1).padStart(2,"0"),ge=K.getFullYear();return`${J}/${te}/${ge}`},O=K=>{if(!K)return"";const J=String(K.getDate()).padStart(2,"0"),te=String(K.getMonth()+1).padStart(2,"0");return`${K.getFullYear()}-${te}-${J}`},I=Z(()=>c.value.placeholder),P=Z(()=>E(_.value)),M=Z(()=>c.value.months[k.value]),q=Z(()=>c.value.weekdays),B=Z(()=>{const K=w.value,J=k.value,te=new Date(K,J,1).getDay(),ge=new Date(K,J+1,0).getDate(),ue=new Date(K,J,0).getDate(),we=[];for(let pe=te-1;pe>=0;pe--)we.push({key:`prev-${pe}`,day:ue-pe,otherMonth:!0,isToday:!1,isSelected:!1,empty:!1,date:new Date(K,J-1,ue-pe)});for(let pe=1;pe<=ge;pe++){const fe=new Date(K,J,pe);we.push({key:`cur-${pe}`,day:pe,otherMonth:!1,isToday:fe.getTime()===v.getTime(),isSelected:_.value?fe.getTime()===_.value.getTime():!1,empty:!1,date:fe})}const Ee=35,re=Math.max(0,Ee-we.length);for(let pe=1;pe<=re;pe++)we.push({key:`next-${pe}`,day:pe,otherMonth:!0,isToday:!1,isSelected:!1,empty:!1,date:new Date(K,J+1,pe)});return we.slice(0,Ee)}),T=()=>{u.value||(p(),n(),u.value=!0,_.value&&(w.value=_.value.getFullYear(),k.value=_.value.getMonth()))},A=()=>{u.value&&s(),u.value=!1,i("blur")},D=()=>{k.value===0?(k.value=11,w.value--):k.value--},Q=()=>{k.value===11?(k.value=0,w.value++):k.value++},W=K=>{_.value=K.date,i("update:modelValue",O(K.date)),i("change",O(K.date)),A()},H=K=>{var J,te;u.value&&((J=f.value)!=null&&J.contains(K.target)||(te=d.value)!=null&&te.contains(K.target)||A())};return Je(()=>document.addEventListener("mousedown",H)),Zn(()=>{document.removeEventListener("mousedown",H),u.value&&s()}),Pe(()=>o.modelValue,K=>{const J=S(K);J&&(!_.value||J.getTime()!==_.value.getTime())?_.value=J:K||(_.value=null)},{immediate:!0}),(K,J)=>(m(),x("div",{class:ne(["relative w-full select-none",{"opacity-70":e.disabled}])},[l("div",{ref_key:"triggerRef",ref:f,class:ne(["flex items-center gap-2 w-full h-[42px] px-3 border rounded-xl bg-white transition-colors",[e.classField,{"border-red-500":e.hasError,"border-gray-200 hover:border-gray-300":!e.hasError,"justify-between":e.iconPosition==="right","cursor-not-allowed bg-gray-50":e.disabled,"cursor-pointer":!e.disabled}]]),onClick:J[0]||(J[0]=te=>!e.disabled&&T())},[e.iconPosition==="left"?(m(),oe(y(Qm),{key:0,class:"w-[18px] h-[18px] shrink-0 text-gray-400",size:18})):z("",!0),l("span",{class:ne(["flex-1 text-sm truncate",P.value?"text-gray-700":"text-gray-400"])},j(P.value||I.value),3),e.iconPosition==="right"?(m(),oe(y(Qm),{key:1,class:"w-[18px] h-[18px] shrink-0 text-gray-400",size:18})):z("",!0)],2),(m(),oe(Yc,{to:r.value},[G(Yt,{name:"dp-fade"},{default:Se(()=>[u.value?(m(),x("div",{key:0,class:ne([`drop-${h.value}`,"z-[9999] w-[280px] bg-white border border-gray-200 rounded-2xl shadow-xl p-3"]),style:ht(g.value),ref_key:"dropdownRef",ref:d},[l("div",JC,[l("button",{type:"button",class:"w-7 h-7 flex items-center justify-center bg-gray-100 hover:bg-gray-200 rounded-lg cursor-pointer text-[18px] leading-none text-gray-700 transition-colors border-0",onClick:D}," "),l("div",XC,[l("span",null,j(M.value),1),l("span",null,j(w.value),1)]),l("button",{type:"button",class:"w-7 h-7 flex items-center justify-center bg-gray-100 hover:bg-gray-200 rounded-lg cursor-pointer text-[18px] leading-none text-gray-700 transition-colors border-0",onClick:Q}," ")]),l("div",ZC,[(m(!0),x(_e,null,Me(q.value,te=>(m(),x("span",{key:te,class:"text-center text-[11px] font-semibold text-gray-400 py-1"},j(te),1))),128))]),l("div",YC,[(m(!0),x(_e,null,Me(B.value,te=>(m(),x("button",{key:te.key,type:"button",disabled:te.empty,class:ne(["w-full size-8 flex items-center justify-center border-0 bg-transparent rounded-lg text-sm leading-8 transition-colors cursor-pointer",{"pointer-events-none":te.empty,"hover:bg-gray-100":!te.isSelected,"text-gray-300":te.otherMonth&&!te.isSelected,"text-gray-700":!te.otherMonth&&!te.isSelected&&!te.isToday,"font-bold text-primary":te.isToday&&!te.isSelected,"!bg-primary text-white font-semibold":te.isSelected}]),onClick:ge=>!te.empty&&W(te)},j(te.empty?"":te.day),11,e$))),128))])],6)):z("",!0)]),_:1})],8,["to"]))],2))}},[["__scopeId","data-v-e341d518"]]),r$=e=>(mn("data-v-28eacf7e"),e=e(),gn(),e),o$={class:"flex items-center justify-center gap-0.5"},i$={class:"grid items-center justify-items-center gap-0.5",style:{"grid-template-rows":"20px 36px 20px"}},a$=["value"],l$=r$(()=>l("span",{class:"text-lg font-bold text-gray-700 self-center pb-0.5"},":",-1)),c$={class:"grid items-center justify-items-center gap-0.5",style:{"grid-template-rows":"20px 36px 20px"}},u$=["value"],d$=160,f$=150,kg=8,Sg=30,h$=Qe({__name:"FormTimer",props:{modelValue:{type:String,default:""},disabled:{type:Boolean,default:!1},locale:{type:String,default:"vi",validator:e=>["vi","en"].includes(e)},classField:{type:[String,Array,Object],default:""},hasError:{type:Boolean,default:!1}},emits:["update:modelValue","change","blur"],setup(e,{emit:t}){const{lockScroll:n,unlockScroll:s}=sd(),r=Z(()=>ae.state.chatContainerRef||ae.state.rootMarketplaceRef||"body"),o=e,i=t,a={vi:{placeholder:"HH:MM",confirm:"Chọn"},en:{placeholder:"HH:MM",confirm:"Set"}},c=Z(()=>a[o.locale]||a.vi),u=R(!1),d=R(null),f=R(null),h=R("bottom"),g=R({}),p=R(0),v=R(0),_=R("00"),w=R("00"),k=Z(()=>c.value.placeholder),S=Z(()=>{if(!o.modelValue)return"";const[J="",te=""]=o.modelValue.split(":"),ge=parseInt(J,10),ue=parseInt(te,10);return isNaN(ge)||isNaN(ue)?"":`${String(ge).padStart(2,"0")}:${String(ue).padStart(2,"0")}`}),E=()=>{if(!d.value)return;const J=d.value.getBoundingClientRect(),te=ae.state.chatContainerRef||ae.state.rootMarketplaceRef,ge=te?te.getBoundingClientRect():{top:0,bottom:window.innerHeight,left:0,right:window.innerWidth},ue=ge.bottom-J.bottom,we=J.top-ge.top,Ee=ue<d$&&we>ue;h.value=Ee?"top":"bottom";const re=Math.max(ge.left,Math.min(J.left,ge.right-f$-4));g.value=Ee?{position:"fixed",bottom:`${window.innerHeight-J.top+6}px`,left:`${re}px`}:{position:"fixed",top:`${J.bottom+6}px`,left:`${re}px`}},O=()=>{u.value?I():(E(),n(),u.value=!0)},I=()=>{u.value&&s(),u.value=!1,i("blur")},P=()=>{p.value=(p.value+1)%24,_.value=String(p.value).padStart(2,"0")},M=()=>{p.value=(p.value+23)%24,_.value=String(p.value).padStart(2,"0")},q=J=>{const te=J.target.value.replace(/\D/g,"").slice(0,2);J.target.value=te,_.value=te;const ge=parseInt(te,10);isNaN(ge)||(p.value=Math.min(23,ge))},B=()=>{const J=Math.min(23,Math.max(0,parseInt(_.value,10)||0));p.value=J,_.value=String(J).padStart(2,"0")},T=()=>{v.value=(v.value+1)%60,w.value=String(v.value).padStart(2,"0")},A=()=>{v.value=(v.value+59)%60,w.value=String(v.value).padStart(2,"0")},D=J=>{const te=J.target.value.replace(/\D/g,"").slice(0,2);J.target.value=te,w.value=te;const ge=parseInt(te,10);isNaN(ge)||(v.value=Math.min(59,ge))},Q=()=>{const J=Math.min(59,Math.max(0,parseInt(w.value,10)||0));v.value=J,w.value=String(J).padStart(2,"0")},W=()=>{const J=`${String(p.value).padStart(2,"0")}:${String(v.value).padStart(2,"0")}`;i("update:modelValue",J),i("change",J),I()},H=J=>{if(!J){p.value=kg,v.value=Sg,_.value=String(kg).padStart(2,"0"),w.value=String(Sg).padStart(2,"0");return}const[te,ge]=J.split(":").map(Number);isNaN(te)||isNaN(ge)||(p.value=Math.min(23,Math.max(0,te)),v.value=Math.min(59,Math.max(0,ge)),_.value=String(p.value).padStart(2,"0"),w.value=String(v.value).padStart(2,"0"))},K=J=>{var te,ge;u.value&&((te=d.value)!=null&&te.contains(J.target)||(ge=f.value)!=null&&ge.contains(J.target)||I())};return Je(()=>document.addEventListener("mousedown",K)),Zn(()=>{document.removeEventListener("mousedown",K),u.value&&s()}),Pe(()=>o.modelValue,H,{immediate:!0}),(J,te)=>(m(),x("div",{class:ne(["relative w-full select-none",{"opacity-70":e.disabled}])},[l("div",{ref_key:"triggerRef",ref:d,class:ne(["flex items-center gap-2 w-full h-[42px] px-3 border rounded-xl bg-white transition-colors",[e.classField,{"border-red-500":e.hasError,"border-gray-200 hover:border-gray-300":!e.hasError,"cursor-not-allowed bg-gray-50":e.disabled,"cursor-pointer":!e.disabled}]]),onClick:te[0]||(te[0]=ge=>!e.disabled&&O())},[G(y(j2),{class:"w-[18px] h-[18px] shrink-0 text-gray-400",size:18}),l("span",{class:ne(["flex-1 text-sm",S.value?"text-gray-700":"text-gray-400"])},j(S.value||k.value),3)],2),(m(),oe(Yc,{to:r.value},[G(Yt,{name:"timer-fade"},{default:Se(()=>[u.value?(m(),x("div",{key:0,class:ne([`drop-${h.value}`,"z-[9999] w-[150px] bg-white border border-gray-200 rounded-2xl shadow-xl p-2.5 flex flex-col gap-2"]),style:ht(g.value),ref_key:"dropdownRef",ref:f},[l("div",o$,[l("div",i$,[l("button",{type:"button",class:"w-[50px] h-5 flex items-center justify-center text-gray-400 hover:bg-gray-100 hover:text-gray-700 rounded-md transition-colors border-0 bg-transparent cursor-pointer",onClick:P},[G(y(Jm),{size:16})]),l("input",{type:"text",inputmode:"numeric",class:"w-[50px] h-9 bg-gray-100 border border-transparent focus:border-primary focus:bg-white rounded-lg text-lg font-medium text-gray-900 text-center outline-none p-0 cursor-text transition-colors appearance-none",value:_.value,onInput:q,onBlur:B,onFocus:te[1]||(te[1]=ge=>ge.target.select()),maxlength:"2"},null,40,a$),l("button",{type:"button",class:"w-[50px] h-5 flex items-center justify-center text-gray-400 hover:bg-gray-100 hover:text-gray-700 rounded-md transition-colors border-0 bg-transparent cursor-pointer",onClick:M},[G(y(mo),{size:16})])]),l$,l("div",c$,[l("button",{type:"button",class:"w-[50px] h-5 flex items-center justify-center text-gray-400 hover:bg-gray-100 hover:text-gray-700 rounded-md transition-colors border-0 bg-transparent cursor-pointer",onClick:T},[G(y(Jm),{size:16})]),l("input",{type:"text",inputmode:"numeric",class:"w-[50px] h-9 bg-gray-100 border border-transparent focus:border-primary focus:bg-white rounded-lg text-lg font-medium text-gray-900 text-center outline-none p-0 cursor-text transition-colors appearance-none",value:w.value,onInput:D,onBlur:Q,onFocus:te[2]||(te[2]=ge=>ge.target.select()),maxlength:"2"},null,40,u$),l("button",{type:"button",class:"w-[50px] h-5 flex items-center justify-center text-gray-400 hover:bg-gray-100 hover:text-gray-700 rounded-md transition-colors border-0 bg-transparent cursor-pointer",onClick:A},[G(y(mo),{size:16})])])]),l("button",{type:"button",class:"w-full h-8 border-0 rounded-lg bg-primary hover:opacity-90 text-white text-[13px] font-semibold cursor-pointer transition-opacity",onClick:W},j(c.value.confirm),1)],6)):z("",!0)]),_:1})],8,["to"]))],2))}},[["__scopeId","data-v-28eacf7e"]]),p$={class:"field-date-time__label"},m$={key:0},g$={class:"field-date-time__controls"},v$=Qe({__name:"FieldDateTime",props:{field:{type:Object,required:!0},modelValue:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},classField:{type:[String,Boolean,Array,Object],default:""},locale:{type:String,default:"vi",validator:e=>["vi","en"].includes(e)},iconPosition:{type:String,default:"left",validator:e=>["left","right"].includes(e)},hasError:{type:Boolean,default:!1}},emits:["update:modelValue","validate","focus","blur"],setup(e,{emit:t}){const n=e,s=t,r=R(""),o=R(""),i=Z(()=>{var g;return(g=n.field.validate)==null?void 0:g.includes("required")}),a=g=>{const p=g?String(g):"",[v="",_=""]=p.split(/[T ]/);r.value=v,o.value=_.slice(0,5)},c=g=>{const p=!i.value||!!g;s("validate",n.field.name,p)},u=()=>{const g=r.value&&o.value?`${r.value}T${o.value}`:"";s("update:modelValue",g),c(g)},d=g=>{r.value=g,u()},f=g=>{o.value=g,u()},h=()=>{u(),s("blur")};return Pe(()=>n.modelValue,a,{immediate:!0}),(g,p)=>(m(),x("div",{class:ne(["field-date-time",{"is-disabled":e.disabled}])},[l("label",p$,[We(j(e.field.label)+" ",1),i.value?(m(),x("span",m$,"*")):z("",!0)]),l("div",g$,[G(s$,{"model-value":r.value,disabled:e.disabled,locale:e.locale,"icon-position":e.iconPosition,"class-field":e.classField,"has-error":e.hasError,"onUpdate:modelValue":d,onBlur:h},null,8,["model-value","disabled","locale","icon-position","class-field","has-error"]),G(h$,{"model-value":o.value,disabled:e.disabled,locale:e.locale,"class-field":e.classField,"has-error":e.hasError,"onUpdate:modelValue":f,onBlur:h},null,8,["model-value","disabled","locale","class-field","has-error"])])],2))}},[["__scopeId","data-v-c47ffb31"]]),y$=e=>(mn("data-v-a29ef6aa"),e=e(),gn(),e),b$={class:"relative"},_$={key:0,class:"space-y-1.5"},x$=["for"],w$={key:0},k$=["type","id","value","placeholder","disabled"],S$={key:2,class:"space-y-1.5"},C$=["for"],$$={key:0},T$={class:"relative"},A$=["id","value","disabled"],E$={value:"",disabled:""},I$=["value"],P$=y$(()=>l("div",{class:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none"},[l("svg",{class:"h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},[l("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"})])],-1)),M$={key:3,class:"space-y-1.5"},O$=["for"],L$={key:0},R$=["id","value","placeholder","disabled"],D$={key:4,class:"relative"},j$=["for"],N$={class:"flex items-center cursor-pointer relative mt-1"},F$=["type","id","checked","disabled"],q$={class:"absolute text-white opacity-0 peer-checked:opacity-100 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 pointer-events-none"},z$=["innerHTML"],B$={class:"text-xs text-red-500 flex items-center gap-1 pt-0.5 pl-1"},U$=["innerHTML"],V$={class:"text-xs text-gray-500 pl-1"},H$=["innerHTML"],rd=Qe({__name:"FormFieldV2",props:{field:{type:Object,required:!0},modelValue:{type:[String,Number,Boolean]},error:{type:String,default:""},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","validate"],setup(e,{emit:t}){const{t:n}=en(),s=e,r=t,o=R(""),i=R(""),a=Z(()=>{var E;return((E=s.field.validate)==null?void 0:E.includes("required"))||!1}),c=Z(()=>!!(o.value||s.error)),u=Z(()=>o.value||s.error),d=Z(()=>[{"bg-gray-50 cursor-not-allowed":s.disabled},"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"]),f=Z(()=>s.field.placeholder||n("form.placeholder")),h=(E,O={})=>n(`form.validation.${E}`,{label:s.field.label,...O}),g=()=>{k(i.value||s.modelValue)},p=(E,O)=>{O?o.value="":o.value=s.field.error||h("required")||"",r("validate",E,O)},v=E=>{if(s.disabled)return;let O=E.target.value;i.value=O,O?k(O):o.value="",r("update:modelValue",O)},_=E=>{s.disabled||(i.value=E,E?k(E):o.value="",r("update:modelValue",E))},w=E=>{if(s.disabled)return;const O=E.target.checked;r("update:modelValue",O),S(O)},k=(E=s.modelValue)=>{var M;o.value="";const O=((M=s.field.validate)==null?void 0:M.split("|"))||[],I=String(E||"").trim();if(O.includes("nullable")&&!I)return r("validate",s.field.name,!0),!0;const P=s.field.name;for(const q of O){if(q==="nullable")continue;const[B,T]=q.split(":");if(B==="required"&&!I)return o.value=s.field.error||h("required"),r("validate",s.field.name,!1),!1;if(!(!I&&B!=="required")){if(P==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(I))return o.value=s.field.error||h("email"),r("validate",s.field.name,!1),!1;if(P==="phone"&&!/^(\+84|0)[3|5|7|8|9][0-9]{8}$/.test(I.replace(/[\s()-]/g,"")))return o.value=s.field.error||h("phone"),r("validate",s.field.name,!1),!1;if(B==="min"&&I.length<parseInt(T))return o.value=s.field.error||h("min",{value:T}),r("validate",s.field.name,!1),!1;if(B==="max"&&I.length>parseInt(T))return o.value=s.field.error||h("max",{value:T}),r("validate",s.field.name,!1),!1}}return r("validate",s.field.name,!0),!0},S=(E=s.modelValue)=>{var I;o.value="";const O=((I=s.field.validate)==null?void 0:I.split("|"))||[];for(const P of O){const[M]=P.split(":");if(M==="required"&&!E)return o.value=s.field.error||h("required"),r("validate",s.field.name,!1),!1}return r("validate",s.field.name,!0),!0};return(E,O)=>(m(),x("div",b$,[["text","email","tel"].includes(e.field.type)?(m(),x("div",_$,[l("label",{for:e.field.name,class:"field-label"},[We(j(e.field.label)+" ",1),a.value?(m(),x("span",w$,"*")):z("",!0)],8,x$),l("input",{type:e.field.type,id:e.field.name,value:e.modelValue,placeholder:f.value,onInput:v,onBlur:g,autocomplete:"off",disabled:e.disabled,class:ne(["w-full px-3 border border-input rounded-xl focus:outline-none h-[42px] text-base lg:text-sm",d.value])},null,42,k$)])):e.field.type==="date"?(m(),oe(v$,{key:1,"model-value":e.modelValue,field:e.field,disabled:e.disabled,"onUpdate:modelValue":_,onValidate:p,onBlur:g},null,8,["model-value","field","disabled"])):e.field.type==="select"?(m(),x("div",S$,[l("label",{for:e.field.name,class:"field-label"},[We(j(e.field.label)+" ",1),a.value?(m(),x("span",$$,"*")):z("",!0)],8,C$),l("div",T$,[l("select",{id:e.field.name,value:e.modelValue,onChange:v,onBlur:g,disabled:e.disabled,class:ne(["custom-select w-full px-3 border border-input rounded-xl focus:outline-none h-[42px] text-base appearance-none",d.value])},[l("option",E$,j(f.value),1),(m(!0),x(_e,null,Me(e.field.options,(I,P)=>(m(),x("option",{key:P,value:I},j(I),9,I$))),128))],42,A$),P$])])):e.field.type==="textarea"?(m(),x("div",M$,[l("label",{for:e.field.name,class:"field-label"},[We(j(e.field.label)+" ",1),a.value?(m(),x("span",L$,"*")):z("",!0)],8,O$),l("textarea",{id:e.field.name,value:e.modelValue,placeholder:f.value,onInput:v,onBlur:g,disabled:e.disabled,class:ne(["w-full resize-none block px-3 py-2 border border-input rounded-xl focus:outline-none transition-colors duration-200 text-base lg:text-sm",d.value]),rows:"2"},null,42,R$)])):e.field.type==="checkbox"?(m(),x("div",D$,[l("label",{for:e.field.name,class:ne(["flex items-start",{"cursor-not-allowed opacity-70":e.disabled}])},[l("div",N$,[l("input",{type:e.field.type,id:e.field.name,checked:e.modelValue,onChange:w,disabled:e.disabled,class:ne(["peer h-[18px] w-[18px] cursor-pointer transition-all appearance-none rounded border border-slate-300 checked:bg-primary checked:border-primary outline-none ring-0 focus:ring-0 focus:outline-none",{"cursor-not-allowed opacity-70":e.disabled}])},null,42,F$),l("span",q$,[G(y(ul),{"stroke-width":3,size:14})])]),l("div",{class:"ml-1.5 text-gray-700 prose prose-sm leading-[140%] select-text cursor-pointer",innerHTML:e.field.label},null,8,z$)],10,j$)])):z("",!0),Lt(l("p",B$,[G(y(Xm),{size:"14","stroke-width":"1.5"}),l("div",{innerHTML:u.value},null,8,U$)],512),[[ei,i.value&&c.value&&e.field.type!=="checkbox"]]),Lt(l("p",V$,[l("div",{innerHTML:e.field.hint},null,8,H$)],512),[[ei,e.field.hint]])]))}},[["__scopeId","data-v-a29ef6aa"]]),W$={key:"submitted",class:"overflow-auto bg-white text-gray-900 flex flex-col items-center justify-center"},G$={class:"flex flex-col items-center justify-center text-center"},K$={class:"mt-2 text-2xl font-semibold text-gray-950"},Q$={class:"mt-1 text-sm text-gray-500"},J$={key:0,class:"bg-gray-50 rounded-xl p-2 py-1 w-full mt-4 divide-y"},X$={class:"min-w-0 flex-1"},Z$={class:"text-sm text-gray-500"},Y$={class:"mt-1 break-words text-base text-gray-950"},e5={key:"form"},t5={key:0,class:"text-lg font-semibold text-gray-900"},n5={key:1,class:"mt-1 text-sm text-gray-500"},s5={class:"space-y-3"},r5={class:"mt-4"},o5=["disabled"],i5={key:1,class:"px-3 flex justify-center items-center bg-primary h-[48px] text-white rounded-3xl text-center text-sm"},a5={class:"flex items-center justify-center gap-2 text-sm text-green-600 bg-green-50 rounded-full py-2 px-3"},l5={__name:"WidgetFormContact",props:{widget:{type:Object,required:!0},messageId:{type:[String,Number],default:null},conversationId:{type:String,default:null},submission:{type:Object,default:null}},setup(e){const{t}=en(),n=e,s=R([]),r=R(!1),o=R(!1),i=R(null),a={hint:null,name:"address",type:"text",label:"Địa chỉ",value:null,options:[],validate:"",placeholder:"Nhập địa chỉ"},c=["sieuthichongthamcomvn-lui","chinhnhanvn-of8","kesgroupvn-dk0","kimtingroupcom"],u=dt({}),d=dt({}),f=R(!1),h=R({}),g=R(null),p=Z(()=>{const te=h.value.title;return te!==void 0&&[!1,0,"false","0"].includes(te)?!1:![!1,0,"false","0"].includes(n.widget.showFormTitle)}),v=Z(()=>_.value&&![!1,0,"false","0"].includes(n.widget.showFormDescription)),_=Z(()=>{const te=n.widget.description;return typeof te=="string"?te:te??""}),w=Z(()=>h.value.source),k=Z(()=>o.value&&w.value!=="website"),S=Z(()=>n.widget.type==="booking_appointment"?t("form.bookingSuccess"):t("form.submitSuccessInfo")),E=Z(()=>t("form.submitSuccessThanks")),O=Z(()=>A(n.widget.successTitle)||S.value),I=Z(()=>A(n.widget.successDescription)||E.value),P=Z(()=>A(n.widget.buttonText)||t("form.submitRequest")),M=Z(()=>{let te=s.value.filter(Ee=>!Ee.hidden);ae.state.handle==="eradovn-fyw"&&(te=te.filter(Ee=>Ee.type!=="email"&&Ee.name!=="demand"));const ue=h.value.hideFields;if(!ue)return te;const we=ue.split(",").map(Ee=>Ee.trim());return te.filter(Ee=>!we.includes(Ee.name))}),q=Z(()=>M.value.filter(te=>{const ge=u[te.name];return ge!=null&&String(ge)!==""})),B=te=>{var ge,ue;return typeof te.label=="string"?te.label:((ge=te.label)==null?void 0:ge.vi)??((ue=te.label)==null?void 0:ue.en)??te.name},T=te=>Array.isArray(te)?te.join(", "):te&&typeof te=="object"?JSON.stringify(te):String(te).replace("T"," "),A=te=>typeof te!="string"?"":te.trim();Pe([o,w],([te,ge])=>{te&&ge==="website"&&setTimeout(()=>{o.value=!1},3e3)});const D=()=>{var ue;const te=i.value;if(!te)return;const ge=te.offsetHeight;window.parent.postMessage({type:"resize-iframe",height:ge+1,message_id:(ue=h.value)==null?void 0:ue.message_id},"*")},Q=()=>{setTimeout(D,50)},W=Z(()=>Object.keys(d).length>0?!1:M.value.filter(ge=>ge.validate==="required").map(ge=>ge.name).every(ge=>{const ue=u[ge];return ue!=null&&String(ue).trim()!==""})),H=(te,ge)=>{ge?delete d[te]:d[te]="",Q()},K=async te=>{var we;if(f.value=!0,Object.keys(d).length>0){Q();return}w.value==="website"&&(u.page_url=window.location.href);const ue={status:"submitted",submission_data:u,message_id:n.messageId??h.value.message_id,conversation_id:n.conversationId??h.value.conversation_id};h.value.source==="website"&&(ue.page_url=window.location.href);try{r.value=!0;const Ee=await Xe.submission.submitWidget({widgetId:n.widget.id,formData:ue});g.value=((we=Ee.data)==null?void 0:we.submission_data)??{...u},o.value=!0,window.parent.postMessage({type:"submit-metric",submission_id:Ee.data.id},"*")}catch(Ee){console.error("Error submitting form:",Ee)}finally{r.value=!1,Q()}};Pe([o,r],Q);const J=()=>{s.value=[...n.widget.fields??[]];const te=ae.state.handle;if(te&&c.includes(te)){const ge=s.value.findIndex(ue=>ue.name==="demand");ge!==-1&&(s.value.some(we=>we.name==="address")||s.value.splice(ge+1,0,a))}};return Pe(()=>{var te;return(te=n.widget)==null?void 0:te.fields},()=>{J(),Q()},{deep:!0}),Je(()=>{var ge,ue;if(h.value=Ya(window.location.href),J(),setTimeout(D,100),typeof ResizeObserver<"u"){const we=i.value;we&&new ResizeObserver(D).observe(we)}const te=n.submission??(h.value.submission&&h.value.source!=="website"?JSON.parse(decodeURIComponent(h.value.submission)):null);if(te&&((ge=h.value).message_id??(ge.message_id=te==null?void 0:te.message_id),(ue=h.value).conversation_id??(ue.conversation_id=te==null?void 0:te.conversation_id),g.value=te==null?void 0:te.submission_data,g.value)){for(const we in g.value)u[we]=g.value[we];o.value=!0}}),(te,ge)=>(m(),x("div",{ref_key:"contactWidgetContainer",ref:i,class:"relative"},[G(Yt,{mode:"out-in","enter-active-class":"transition duration-300 ease-out","enter-from-class":"opacity-0 translate-y-3","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"transition duration-200 ease-in","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 -translate-y-2"},{default:Se(()=>[k.value?(m(),x("div",W$,[l("div",G$,[l("div",K$,j(O.value),1),l("div",Q$,j(I.value),1)]),q.value.length?(m(),x("div",J$,[(m(!0),x(_e,null,Me(q.value,ue=>(m(),x("div",{key:ue.name,class:"p-2"},[l("div",X$,[l("div",Z$,j(B(ue)),1),l("div",Y$,j(T(u[ue.name])),1)])]))),128))])):z("",!0)])):(m(),x("div",e5,[p.value?(m(),x("div",t5,j(e.widget.name),1)):z("",!0),v.value?(m(),x("div",n5,j(_.value),1)):z("",!0),l("form",{onSubmit:Gt(K,["prevent"]),class:ne(v.value||p.value?"mt-3":"mt-0")},[l("div",s5,[(m(!0),x(_e,null,Me(M.value,ue=>(m(),oe(rd,{key:ue.name,modelValue:u[ue.name],"onUpdate:modelValue":we=>u[ue.name]=we,field:ue,error:d[ue.name],disabled:o.value,onValidate:H},null,8,["modelValue","onUpdate:modelValue","field","error","disabled"]))),128))]),l("div",r5,[o.value?z("",!0):(m(),x("button",{key:0,type:"submit",class:ne(["w-full font-medium bg-primary text-white text-sm h-[48px] px-8 rounded-xl transition duration-200 focus:outline-none ring-0 flex justify-center items-center",[W.value?"":"opacity-70 cursor-not-allowed"]]),disabled:r.value||!W.value},j(r.value?y(t)("form.submitting"):P.value),11,o5)),o.value?(m(),x("div",i5,[l("div",null,j(y(t)("common.sent")),1),G(y(Ku),{size:"16",class:"ml-2"})])):z("",!0),o.value&&w.value==="website"?(m(),x("div",{key:2,class:ne(["success-notification transition-opacity duration-300 mt-3",{"opacity-0":!o.value,"opacity-100":o.value}])},[l("div",a5,[G(y(dl),{class:"w-5 h-5"}),l("span",null,j(O.value),1)])],2)):z("",!0)])],34)]))]),_:1})],512))}},c5={key:0,class:"w-full"},u5={key:1,class:"w-[95%] flex items-end space-x-2"},d5={class:"flex overflow-hidden relative flex-shrink-0 bg-white rounded-full size-8 message-avatar"},f5=["src","alt"],h5={key:0,class:"rounded-2xl w-full max-w-[420px] p-4 shadow-iframe-card"},p5={key:1,class:"rounded-2xl overflow-hidden w-full max-w-[420px] p-3 pt-4 shadow-iframe-card"},m5=["src"],g5={key:1,class:"w-full h-[calc(100vh-180px)] md:h-[calc(700px-180px)] rounded-2xl border border-gray-100 shadow-custom-soft overflow-hidden"},v5=["src"],y5=Qe({__name:"CardIframe",props:["item","handle"],setup(e){const{widgets:t}=Ys(),n=e,s=R(180),r=R(!1),o=Z(()=>yn(n.item.content)),i=Z(()=>{var _;return(_=n.item)==null?void 0:_.id}),a=Z(()=>{var _;return((_=n.item)==null?void 0:_.conversation_id)??oo(n.handle)}),c=Z(()=>{var k,S;const _=(S=(k=o.value)==null?void 0:k.iframe)==null?void 0:S.src;if(!_)return null;const w=_.match(/\/embed\/[^/]+\/([a-f0-9-]+)/);return w?w[1]:null}),u=Z(()=>{const _=c.value;return _?[t.value.contact,t.value.booking_appointment].find(k=>(k==null?void 0:k.id)===_)??null:null}),d=Z(()=>{var w,k,S;const _=(k=(w=o.value)==null?void 0:w.iframe)==null?void 0:k.src;return _?iw(_,{message_id:i.value,conversation_id:a.value,locale:Xs.state.locale,submission:(S=o.value)!=null&&S.submission?encodeURIComponent(JSON.stringify(o.value.submission)):null,preview:r.value}):""}),f=_=>new URLSearchParams(window.location.search).get(_),h=_=>{var w,k;try{const S=_.data;S&&typeof S=="object"&&S.type==="resize-iframe"&&S.height&&((w=S.message_id)==null?void 0:w.toString())===((k=i.value)==null?void 0:k.toString())&&(s.value=S.height)}catch(S){console.error("Error handling iframe message:",S)}},g=_=>{try{const w=_.data;w&&typeof w=="object"&&w.type==="submit-metric"&&w.submission_id&&Qt.widgetContact({handle:n.handle,submission_id:w.submission_id})}catch(w){console.error("Error handling iframe message:",w)}},p=_=>{h(_),g(_)},v=()=>{window.addEventListener("message",p)};return Je(()=>{r.value=!!f("preview")}),Zn(()=>{window.removeEventListener("message",p)}),(_,w)=>{var k,S,E,O,I,P;return(S=(k=o.value.iframe)==null?void 0:k.src)!=null&&S.includes("widget.easyaichat.app")||(O=(E=o.value.iframe)==null?void 0:E.src)!=null&&O.includes("widget.geteasy.ai")||(P=(I=o.value.iframe)==null?void 0:I.src)!=null&&P.includes("localhost:5174")?(m(),x("div",c5,[[y(Un),y(Bn),"stagingeasyaichatapp"].includes(y(U).handle)?(m(),oe(wg,{key:0,message:e.item},null,8,["message"])):(m(),x("div",u5,[l("span",d5,[y(U).bot&&y(U).bot.config.ui.logo?(m(),x("img",{key:0,src:y(U).bot.config.ui.logo,alt:y(U).bot.config.ui.name,class:"object-cover w-full h-full"},null,8,f5)):z("",!0)]),u.value?(m(),x("div",h5,[G(l5,{widget:u.value,"message-id":i.value,"conversation-id":a.value,submission:o.value.submission},null,8,["widget","message-id","conversation-id","submission"])])):(m(),x("div",p5,[l("iframe",{src:d.value,style:ht({height:s.value+"px"}),onLoad:v,frameborder:"0",class:"w-full duration-200 transition-height"},null,44,m5)]))]))])):(m(),x("div",g5,[l("iframe",{src:d.value,frameborder:"0",class:"w-full h-full"},null,8,v5)]))}}},[["__scopeId","data-v-31004c8d"]]),b5={class:"flex overflow-hidden relative bg-white rounded-full size-8 flex-shrink-0 message-avatar"},_5=["src","alt"],x5=["src","alt"],w5={__name:"ProductList",props:{products:{type:Array,default:()=>[]},message:{type:Object,default:()=>null}},emits:["open-flow-checkout","send-message","reset-padding"],setup(e,{emit:t}){const n=t,{bot:s,handle:r}=Et(ae.state),o=R(!1),i=[Bn,Un],a=R(!1);Je(()=>{const p=Ya(window.location.href);(p==null?void 0:p.easy_ai_test_production)==="rangdong"&&(a.value=!0),kt(()=>{n("reset-padding")})});const c=Wt(()=>Promise.resolve().then(()=>Aq)),u=Wt(()=>Promise.resolve().then(()=>Zq)),d=Wt(()=>Promise.resolve().then(()=>bz)),f=Wt(()=>Promise.resolve().then(()=>qz)),h=Wt(()=>Promise.resolve().then(()=>dB)),g=Z(()=>i.includes(r.value)?{vertical:c,horizontal:u}:r.value===On&&a.value?{vertical:h,horizontal:h}:{vertical:d,horizontal:f});return(p,v)=>{var _,w,k,S;return e.products.length>1?(m(),x("div",{key:0,class:ne(["grid grid-cols-2 border-l border-gray-200 ecg-slide-up",o.value&&"pointer-events-none opacity-95"])},[(m(!0),x(_e,null,Me(e.products,(E,O)=>(m(),oe(Nt(g.value.vertical),{type:"vertical",item:E,key:`product-${O}-${E.product_sku||""}`,onLoading:v[0]||(v[0]=I=>o.value=I),onOpenFlowCheckout:v[1]||(v[1]=I=>n("open-flow-checkout")),onSendMessage:v[2]||(v[2]=I=>n("send-message",I)),class:"border-r border-b [&:nth-child(1)]:border-t [&:nth-child(2)]:border-t border-gray-200"},null,40,["item"]))),128))],2)):(m(),x("div",{key:1,class:ne([o.value&&"pointer-events-none opacity-95","flex items-end space-x-1 w-full max-w-[600px]"])},[l("span",b5,[(w=(_=e.message)==null?void 0:_.sender)!=null&&w.avatar?(m(),x("img",{key:0,src:e.message.sender.avatar,alt:e.message.sender.name,class:"object-cover w-full h-full"},null,8,_5)):(m(),x("img",{key:1,src:(S=(k=y(s).config)==null?void 0:k.ui)==null?void 0:S.logo,alt:y(s).config.ui.name,class:"object-cover w-full h-full"},null,8,x5))]),(m(),oe(Nt(g.value.horizontal),{type:"horizontal",item:e.products[0],key:e.products[0].product_sku,onLoading:v[3]||(v[3]=E=>o.value=E),onOpenFlowCheckout:v[4]||(v[4]=E=>n("open-flow-checkout")),onSendMessage:v[5]||(v[5]=E=>n("send-message",E))},null,40,["item"]))],2))}}},Cg=e=>{if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,s)).toFixed(2))+" "+n[s]},k5=()=>Date.now().toString(36)+Math.random().toString(36).substring(2,9),od={file_upload:[".pdf",".doc",".docx",".xls",".xlsx",".csv"],image_upload:[".jpg",".jpeg",".png",".webp",".bmp",".tiff",".tif",".heic",".avif"],audio_upload:[".mp3",".wav",".ogg",".m4a"]},Ze=dt({files:[],processedFiles:[],acceptTypes:".pdf,.doc,.docx,.jpg,.jpeg,.png,.gif,.xls,.xlsx,.csv",maxFileSize:10*1024*1024,maxFiles:10,uploading:!1,errors:[],toolbarConfig:null,autoUploadOnPaste:!0}),S5=5,C5=()=>ae.getters.isAgentEnabled.value?S5:Ze.maxFiles,$g=Z(()=>C5());function _l(){const{files:e,acceptTypes:t,maxFileSize:n,maxFiles:s,uploading:r,errors:o,processedFiles:i}=Et(Ze),a=Z(()=>Ze.files.reduce((P,M)=>P+M.size,0)),c=Z(()=>Ze.files.length),u=Z(()=>{const P=Ze.files.map(q=>({...q,loading:q.uploading||!1}));return[...Ze.processedFiles.map(q=>({...q,loading:!1})),...P]}),d=Z(()=>{var M,q,B,T,A,D;const P=[];return(q=(M=Ze.toolbarConfig)==null?void 0:M.file_upload)!=null&&q.visible&&P.push(...od.file_upload),(T=(B=Ze.toolbarConfig)==null?void 0:B.image_upload)!=null&&T.visible&&P.push(...od.image_upload),(D=(A=Ze.toolbarConfig)==null?void 0:A.audio_upload)!=null&&D.visible&&P.push(...od.audio_upload),P}),f=P=>{var H,K,J,te,ge,ue;if(Ze.errors=[],!(((K=(H=Ze.toolbarConfig)==null?void 0:H.file_upload)==null?void 0:K.visible)||((te=(J=Ze.toolbarConfig)==null?void 0:J.image_upload)==null?void 0:te.visible)||((ue=(ge=Ze.toolbarConfig)==null?void 0:ge.audio_upload)==null?void 0:ue.visible)))return Ze.errors.push("Tính năng upload chưa được kích hoạt"),!1;const q=d.value,B=$g.value,T=Ze.processedFiles.length+Ze.files.length;if(T>=B)return Ze.errors.push(`Chỉ được phép tải lên tối đa ${B} file`),!1;let A=B-T,D=0;const Q=Array.from(P).filter(we=>{const Ee=`.${we.name.split(".").pop().toLowerCase()}`;return q.includes(Ee)?A<=0?(D++,!1):we.size>Ze.maxFileSize?(Ze.errors.push(`File "${we.name}" vượt quá kích thước tối đa (${Cg(Ze.maxFileSize)})`),!1):(A--,!0):(Ze.errors.push(`File "${we.name}" không thuộc loại được chấp nhận`),!1)});if(D>0&&Ze.errors.push(`Chỉ được phép tải lên tối đa ${B} file. Đã loại bỏ ${D} file cuối`),Q.length===0)return!1;const W=Q.map(we=>{const Ee={file:we,filename:we.name,size:we.size,mime_type:we.type,uploading:!1};return we.type.startsWith("image/")&&(Ee.previewUrl=URL.createObjectURL(we)),Ee});return Ze.files=[...Ze.files,...W],!0},h=P=>{const M=Ze.processedFiles.findIndex(q=>q.file_id===P);if(M!==-1)return Ze.processedFiles.splice(M,1),!0;if(typeof P=="number"&&P<Ze.files.length){const q=Ze.files[P];return q!=null&&q.previewUrl&&URL.revokeObjectURL(q.previewUrl),Ze.files.splice(P,1),!0}return!1},g=()=>{Ze.files.forEach(P=>{P.previewUrl&&URL.revokeObjectURL(P.previewUrl)}),Ze.files=[],Ze.processedFiles=[],Ze.errors=[]},p=P=>{P&&(Ze.toolbarConfig=P)},v=()=>{Ze.errors=[]},_=async P=>{var B;const M=(B=P.clipboardData)==null?void 0:B.items;if(!M)return!1;const q=[];for(let T=0;T<M.length;T++){const A=M[T];if(A.kind==="file"){const D=A.getAsFile();if(D){let Q=D;if(D.type.startsWith("image/")&&D.name==="image.png"){const W=D.type.split("/")[1],H=`image-${k5()}.${W}`;Q=new File([D],H,{type:D.type})}q.push(Q)}}}if(q.length>0){const T=f(q);return T&&Ze.autoUploadOnPaste&&await S(),T}return!1},w=P=>P.type.startsWith("image/")?"image":P.type==="application/pdf"?"file-text":P.type.includes("word")||P.type.includes("doc")?"file-type":"file",k=P=>P.startsWith("image/"),S=async()=>{if(Ze.files.length===0)return!0;const P=ae.state.handle,M="https://console.easyaichat.app";try{Ze.uploading=!0;const q=Ze.files.map(async(A,D)=>{Ze.files[D].uploading=!0;const Q=new FormData;Q.append("file",A.file),Q.append("handle",P);try{const W=await fetch(M+"/api/chat/upload",{method:"POST",body:Q});if(!W.ok)throw new Error(`Lỗi ${W.status}: ${W.statusText}`);const H=await W.json();return Ze.files[D].uploading=!1,H.file}catch(W){return console.log("Update file error: ",W),Ze.files[D].uploading=!1,null}}),B=await Promise.all(q),T=B.filter(A=>A!==null);return Ze.files.forEach(A=>{A.previewUrl&&URL.revokeObjectURL(A.previewUrl)}),Ze.processedFiles=[...Ze.processedFiles,...T],Ze.files=[],T.length===B.length}catch(q){return console.error("Lỗi khi upload files:",q),!1}finally{setTimeout(()=>{Ze.uploading=!1},500)}};return{files:e,processedFiles:i,acceptTypes:t,allowedExtensions:d,maxFileSize:n,maxFiles:s,maxFilesAllowed:$g,uploading:r,errors:o,totalSize:a,fileCount:c,displayFiles:u,validateFiles:f,removeFile:h,clearFiles:g,updateConfig:p,clearErrors:v,handlePaste:_,uploadFilesToServer:S,getFileIconName:w,isImageFile:k,formatFileSize:Cg,setupPasteListener:()=>{window.addEventListener("paste",_)},cleanupPasteListener:()=>{window.removeEventListener("paste",_)},setAutoUploadOnPaste:P=>{Ze.autoUploadOnPaste=P}}}const $5=["title"],T5={class:"flex-shrink-0 flex items-center justify-center w-11 h-11 bg-white rounded-lg mr-1.5"},A5={key:0,xmlns:"http://www.w3.org/2000/svg",width:"46",height:"46",viewBox:"0 0 32 32"},E5=[ba('<defs><linearGradient id="vscodeIconsFileTypeExcel0" x1="4.494" x2="13.832" y1="-2092.086" y2="-2075.914" gradientTransform="translate(0 2100)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#18884f"></stop><stop offset=".5" stop-color="#117e43"></stop><stop offset="1" stop-color="#0b6631"></stop></linearGradient></defs><path fill="#185c37" d="M19.581 15.35L8.512 13.4v14.409A1.19 1.19 0 0 0 9.705 29h19.1A1.19 1.19 0 0 0 30 27.809V22.5Z"></path><path fill="#21a366" d="M19.581 3H9.705a1.19 1.19 0 0 0-1.193 1.191V9.5L19.581 16l5.861 1.95L30 16V9.5Z"></path><path fill="#107c41" d="M8.512 9.5h11.069V16H8.512Z"></path><path d="M16.434 8.2H8.512v16.25h7.922a1.2 1.2 0 0 0 1.194-1.191V9.391A1.2 1.2 0 0 0 16.434 8.2" opacity="0.1"></path><path d="M15.783 8.85H8.512V25.1h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191" opacity="0.2"></path><path d="M15.783 8.85H8.512V23.8h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191" opacity="0.2"></path><path d="M15.132 8.85h-6.62V23.8h6.62a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191" opacity="0.2"></path><path fill="url(#vscodeIconsFileTypeExcel0)" d="M3.194 8.85h11.938a1.193 1.193 0 0 1 1.194 1.191v11.918a1.193 1.193 0 0 1-1.194 1.191H3.194A1.19 1.19 0 0 1 2 21.959V10.041A1.19 1.19 0 0 1 3.194 8.85"></path><path fill="#fff" d="m5.7 19.873l2.511-3.884l-2.3-3.862h1.847L9.013 14.6c.116.234.2.408.238.524h.017q.123-.281.26-.546l1.342-2.447h1.7l-2.359 3.84l2.419 3.905h-1.809l-1.45-2.711A2.4 2.4 0 0 1 9.2 16.8h-.024a1.7 1.7 0 0 1-.168.351l-1.493 2.722Z"></path><path fill="#33c481" d="M28.806 3h-9.225v6.5H30V4.191A1.19 1.19 0 0 0 28.806 3"></path><path fill="#107c41" d="M19.581 16H30v6.5H19.581Z"></path>',12)],I5={class:"flex-1 min-w-0"},P5={class:"text-xs font-medium text-gray-900 truncate block"},M5={class:"flex items-center text-xs text-gray-500 font-medium"},O5=l("span",{class:"mx-1"},"•",-1),L5={class:"uppercase"},Tg={__name:"CardFileDocs",props:{file:{type:Object,default:()=>{}}},setup(e){const t=e,{formatFileSize:n}=_l();function s(i){return i.split(".").pop().toLowerCase()}const r=Z(()=>{switch(s(t.file.filename)){case"xlsx":return{icon:null,color:""};case"pdf":return{icon:er,color:"text-red-600"};case"csv":return{icon:F2,color:"text-green-600"};case"docx":return{icon:q2,color:"text-blue-600"};case"txt":return{icon:er,color:"text-gray-600"};case"md":return{icon:O2,color:"text-purple-600"};default:return{icon:er,color:"text-gray-600"}}}),o=async()=>{if(t.file.url)try{const i=await fetch(t.file.url);if(!i.ok)throw new Error("Failed to fetch file");const a=await i.blob(),c=window.URL.createObjectURL(a),u=document.createElement("a");u.href=c,u.download=t.file.filename||"download",document.body.appendChild(u),u.click(),document.body.removeChild(u),window.URL.revokeObjectURL(c)}catch(i){console.error("Download failed:",i)}};return(i,a)=>(m(),x("div",{title:e.file.name,class:"flex items-center h-full p-1.5 bg-white group"},[l("div",T5,[r.value.icon?(m(),oe(Nt(r.value.icon),{key:1,size:"32",class:ne(r.value.color)},null,8,["class"])):(m(),x("svg",A5,E5))]),l("div",I5,[l("p",P5,j(e.file.filename),1),l("div",M5,[l("span",null,j(y(n)(e.file.size)),1),O5,l("span",L5,j(s(e.file.filename)),1)])]),e.file.url?(m(),x("button",{key:0,onClick:o,class:"flex-shrink-0 p-1.5 hover:bg-gray-100 rounded-lg transition-colors",title:"Tải xuống"},[G(y(Ym),{size:"16",class:"text-gray-600"})])):z("",!0)],8,$5))}},R5={class:"space-y-1"},D5=["src"],j5={__name:"CardVideo",props:{message:{type:Object,required:!0}},emits:["open-gallery"],setup(e,{emit:t}){const s=yn(e.message.content),r=Array.isArray(s)?s:[s],o=R([]),i=a=>a?a.includes("#")?a:`${a}#t=0.5`:"";return Je(()=>{o.value.forEach(a=>{a&&a.load()})}),(a,c)=>(m(),x("div",R5,[(m(!0),x(_e,null,Me(y(r),(u,d)=>(m(),x("div",{class:"relative",key:d},[l("video",{ref_for:!0,ref:f=>o.value[d]=f,controls:"",playsinline:"",preload:"metadata",class:"w-full h-auto transition-all rounded"},[l("source",{src:i(u.url),type:"video/mp4"},null,8,D5),We(" Your browser does not support the video tag. ")],512)]))),128))]))}},N5={class:"space-y-2"},F5={controls:""},q5=["src"],z5=["src"],B5={__name:"CardAudio",props:{message:{type:Object}},setup(e){const n=e.message.content;return(s,r)=>(m(),x("div",N5,[(m(!0),x(_e,null,Me(y(n),o=>(m(),x("div",{key:o.file_id},[l("audio",F5,[l("source",{src:o.url,type:"audio/ogg"},null,8,q5),l("source",{src:o.url,type:"audio/mpeg"},null,8,z5),We(" Your browser does not support the audio tag. ")])]))),128))]))}},U5=["src","alt","onClick"],V5={__name:"CardImages",props:{message:{type:Object,required:!0},isUser:{type:Boolean,default:!1}},emits:["open-gallery"],setup(e,{emit:t}){const n=e,s=t,r=yn(n.message.content),o=Array.isArray(r)?r:[r];return(i,a)=>y(o).length>0?(m(),x("div",{key:0,class:ne(["grid gap-px rounded overflow-hidden",{"ml-auto":e.isUser&&y(o).length===1,"grid-cols-1 w-[90%] sm:w-[70%]":y(o).length===1,"grid-cols-2":y(o).length===2,"grid-cols-3":y(o).length>=3}])},[(m(!0),x(_e,null,Me(y(o),(c,u)=>(m(),x("div",{key:u,class:ne(["lg:hover:opacity-80 overflow-hidden cursor-zoom-in border border-gray-100",y(o).length>1?"aspect-[1/1]":""])},[l("img",{src:c.url,alt:c.url,onClick:d=>s("open-gallery",c.file_id),class:ne(["w-full h-full",y(o).length===1?"object-contain":"object-cover"])},null,10,U5)],2))),128))],2)):z("",!0)}},H5={key:4,class:"text-xs text-gray-500 absolute right-1 -bottom-1 translate-y-full message-user-status"},W5={key:0},G5={key:1},K5={__name:"CardAttachment",props:{message:{type:Object},files:{type:Array,default:()=>[]},isUser:Boolean,newMessageStatus:{type:String},isLatestUserMessage:{type:Boolean,default:!1}},setup(e){const{t}=en(),n=e;let s=null;const r=i=>{const a=n.files.findIndex(c=>c.file_id===i);a!==-1&&(s=Ow(n.files,a,()=>{s=null}))},o=i=>i.sender_type==="user";return Rt(()=>{s&&(s.remove(),s=null)}),(i,a)=>(m(),x("div",{class:ne(["relative",["max-w-[88%] space-y-4",o(e.message)&&"ml-auto is-user"]])},[e.message.content_type==="image"||e.message.content_type==="gif"?(m(),oe(V5,{key:0,message:e.message,isUser:o(e.message),onOpenGallery:r},null,8,["message","isUser"])):z("",!0),e.message.content_type==="video"?(m(),oe(j5,{key:1,message:e.message,onOpenGallery:r},null,8,["message"])):z("",!0),e.message.content_type==="audio"?(m(),oe(B5,{key:2,message:e.message},null,8,["message"])):z("",!0),e.message.content_type==="file"?(m(),x("div",{key:3,class:ne(o(e.message)&&"flex flex-col items-end w-full space-y-2")},[(m(!0),x(_e,null,Me(e.message.content,(c,u)=>(m(),oe(Tg,{class:"relative border border-gray-200 overflow-hidden rounded-xl w-[240px] sm:w-[268px] h-[60px]",key:u,file:c},null,8,["file"]))),128))],2)):z("",!0),e.isUser&&e.isLatestUserMessage&&e.newMessageStatus!=="unread"?(m(),x("div",H5,[e.newMessageStatus==="sent"?(m(),x("span",W5,j(y(t)("common.sent")),1)):e.newMessageStatus==="received"?(m(),x("span",G5,j(y(t)("common.received")),1)):z("",!0)])):z("",!0)],2))}},Q5=["href"],J5={class:"flex-1 flex flex-col min-w-0"},X5={key:0,class:"font-semibold text-primary text-[15px] leading-[150%] mb-1.5 pl-1"},Z5={key:1,class:"flex items-start gap-1.5 text-gray-700"},Y5={class:"text-sm line-clamp-3"},e3={key:2,class:"flex items-center gap-1.5 text-gray-900 mt-1"},t3={class:"text-sm truncate"},n3={class:"size-6 flex items-center duration-300 group-hover:translate-x-1 bg-gray-50 justify-center group-hover:bg-primary group-hover:text-white ml-auto flex-shrink-0 rounded-full"},s3={__name:"CardStore",props:{store:{type:Object,required:!0}},setup(e){const t=e,n=Z(()=>t.store.google_maps_url?t.store.google_maps_url:t.store.address?`https://www.google.com/maps/search/${encodeURIComponent(t.store.address)}`:"#");function s(r){return!r||r.length===0?"":r.join(" - ")}return(r,o)=>(m(),x("a",{target:"_blank",href:n.value,rel:"noopener noreferrer",class:"flex items-center p-3 hover:bg-white duration-200 group cursor-pointer"},[l("div",J5,[e.store.title?(m(),x("h3",X5,j(e.store.title),1)):z("",!0),e.store.address?(m(),x("div",Z5,[G(y(J2),{size:16,class:"flex-shrink-0 mt-1"}),l("span",Y5,j(e.store.address),1)])):z("",!0),e.store.phone_numbers&&e.store.phone_numbers.length>0?(m(),x("div",e3,[G(y(hl),{size:16,class:"flex-shrink-0"}),l("span",t3,j(s(e.store.phone_numbers)),1)])):z("",!0)]),l("div",n3,[G(y(Pr),{size:"16"})])],8,Q5))}},r3={class:"relative w-[calc(100%-20px)]"},o3={class:"relative pl-[40px]"},i3={class:"absolute bottom-0 left-0"},a3=["src","alt"],l3={class:"border rounded-xl divide-y overflow-hidden"},c3={__name:"ListStores",props:{stores:{type:Array,required:!0,default:()=>[]},logo:{type:String,default:""},botName:{type:String,default:""}},setup(e){const{handle:t}=Et(U);return(n,s)=>(m(),x("div",r3,[l("div",o3,[l("div",i3,[l("span",{class:ne(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",y(t)===y(Cn)?"rounded":"rounded-full"])},[l("img",{src:e.logo,alt:e.botName,class:"object-cover w-full h-full"},null,8,a3)],2)]),l("div",l3,[(m(!0),x(_e,null,Me(e.stores,(r,o)=>(m(),oe(s3,{key:o,store:r},null,8,["store"]))),128))])])]))}};function id(e,t){const n=typeof e=="string"&&!t?`${e}Context`:t,s=Symbol(n);return[r=>{const o=Jr(s,r);if(o||o===null)return o;throw new Error(`Injection \`${s.toString()}\` not found. Component must be used within ${Array.isArray(e)?`one of the following components: ${e.join(", ")}`:`\`${e}\``}`)},r=>(Wc(s,r),r)]}function Ag(e,t,n){const s=n.originalEvent.target,r=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),s.dispatchEvent(r)}function u3(e){return Xd()?(w0(e),!0):!1}function d3(e){let t=!1,n;const s=_0(!0);return(...r)=>(t||(n=s.run(()=>e(...r)),t=!0),n)}function ad(e){return typeof e=="function"?e():y(e)}const Oi=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const f3=e=>typeof e<"u",h3=Object.prototype.toString,p3=e=>h3.call(e)==="[object Object]",m3=()=>{};function xl(e){var t;const n=ad(e);return(t=n==null?void 0:n.$el)!=null?t:n}const Eg=Oi?window:void 0;function g3(...e){let t,n,s,r;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,s,r]=e,t=Eg):[t,n,s,r]=e,!t)return m3;Array.isArray(n)||(n=[n]),Array.isArray(s)||(s=[s]);const o=[],i=()=>{o.forEach(d=>d()),o.length=0},a=(d,f,h,g)=>(d.addEventListener(f,h,g),()=>d.removeEventListener(f,h,g)),c=Pe(()=>[xl(t),ad(r)],([d,f])=>{if(i(),!d)return;const h=p3(f)?{...f}:f;o.push(...n.flatMap(g=>s.map(p=>a(d,g,p,h))))},{immediate:!0,flush:"post"}),u=()=>{c(),i()};return u3(u),u}function v3(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function y3(...e){let t,n,s={};e.length===3?(t=e[0],n=e[1],s=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],s=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:r=Eg,eventName:o="keydown",passive:i=!1,dedupe:a=!1}=s,c=v3(t);return g3(r,o,u=>{u.repeat&&ad(a)||c(u)&&n(u)},i)}function b3(){const e=R(!1),t=es();return t&&Je(()=>{e.value=!0},t),e}function _3(e){return JSON.parse(JSON.stringify(e))}function x3(e,t,n,s={}){var r,o,i;const{clone:a=!1,passive:c=!1,eventName:u,deep:d=!1,defaultValue:f,shouldEmit:h}=s,g=es(),p=n||(g==null?void 0:g.emit)||((r=g==null?void 0:g.$emit)==null?void 0:r.bind(g))||((i=(o=g==null?void 0:g.proxy)==null?void 0:o.$emit)==null?void 0:i.bind(g==null?void 0:g.proxy));let v=u;v=v||`update:${t.toString()}`;const _=S=>a?typeof a=="function"?a(S):_3(S):S,w=()=>f3(e[t])?_(e[t]):f,k=S=>{h?h(S)&&p(v,S):p(v,S)};if(c){const S=w(),E=R(S);let O=!1;return Pe(()=>e[t],I=>{O||(O=!0,E.value=_(I),kt(()=>O=!1))}),Pe(E,I=>{!O&&(I!==e[t]||d)&&k(I)},{deep:d}),E}else return Z({get(){return w()},set(S){k(S)}})}function ld(e){return e?e.flatMap(t=>t.type===_e?ld(t.children):[t]):[]}const[w3]=id("ConfigProvider");function wl(e){const t=es(),n=t==null?void 0:t.type.emits,s={};return n!=null&&n.length||console.warn(`No emitted event found. Please check component: ${t==null?void 0:t.type.__name}`),n==null||n.forEach(r=>{s[Hi(In(r))]=(...o)=>e(r,...o)}),s}function k3(e){const t=es(),n=Object.keys((t==null?void 0:t.type.props)??{}).reduce((r,o)=>{const i=(t==null?void 0:t.type.props[o]).default;return i!==void 0&&(r[o]=i),r},{}),s=X0(e);return Z(()=>{const r={},o=(t==null?void 0:t.vnode.props)??{};return Object.keys(o).forEach(i=>{r[In(i)]=o[i]}),Object.keys({...n,...r}).reduce((i,a)=>(s.value[a]!==void 0&&(i[a]=s.value[a]),i),{})})}function S3(e,t){const n=k3(e),s=t?wl(t):{};return Z(()=>({...n.value,...s}))}function tr(){const e=es(),t=R(),n=Z(()=>{var i,a;return["#text","#comment"].includes((i=t.value)==null?void 0:i.$el.nodeName)?(a=t.value)==null?void 0:a.$el.nextElementSibling:xl(t)}),s=Object.assign({},e.exposed),r={};for(const i in e.props)Object.defineProperty(r,i,{enumerable:!0,configurable:!0,get:()=>e.props[i]});if(Object.keys(s).length>0)for(const i in s)Object.defineProperty(r,i,{enumerable:!0,configurable:!0,get:()=>s[i]});Object.defineProperty(r,"$el",{enumerable:!0,configurable:!0,get:()=>e.vnode.el}),e.exposed=r;function o(i){t.value=i,!(i instanceof Element||!i)&&(Object.defineProperty(r,"$el",{enumerable:!0,configurable:!0,get:()=>i.$el}),e.exposed=r)}return{forwardRef:o,currentRef:t,currentElement:n}}var C3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},vo=new WeakMap,kl=new WeakMap,Sl={},cd=0,Ig=function(e){return e&&(e.host||Ig(e.parentNode))},$3=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=Ig(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},T3=function(e,t,n,s){var r=$3(t,Array.isArray(e)?e:[e]);Sl[n]||(Sl[n]=new WeakMap);var o=Sl[n],i=[],a=new Set,c=new Set(r),u=function(f){!f||a.has(f)||(a.add(f),u(f.parentNode))};r.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))d(h);else try{var g=h.getAttribute(s),p=g!==null&&g!=="false",v=(vo.get(h)||0)+1,_=(o.get(h)||0)+1;vo.set(h,v),o.set(h,_),i.push(h),v===1&&p&&kl.set(h,!0),_===1&&h.setAttribute(n,"true"),p||h.setAttribute(s,"true")}catch(w){console.error("aria-hidden: cannot operate on ",h,w)}})};return d(t),a.clear(),cd++,function(){i.forEach(function(f){var h=vo.get(f)-1,g=o.get(f)-1;vo.set(f,h),o.set(f,g),h||(kl.has(f)||f.removeAttribute(s),kl.delete(f)),g||f.removeAttribute(n)}),cd--,cd||(vo=new WeakMap,vo=new WeakMap,kl=new WeakMap,Sl={})}},A3=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=C3(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live]"))),T3(s,r,n,"aria-hidden")):function(){return null}};function E3(e){let t;Pe(()=>xl(e),n=>{n?t=A3(n):t&&t()}),Rt(()=>{t&&t()})}let I3=0;function Pg(e,t="radix"){const{useId:n}=w3({useId:void 0});return n&&typeof n=="function"?`${t}-${n()}`:`${t}-${++I3}`}function P3(e,t){const n=R(e);function s(r){return t[n.value][r]??n.value}return{state:n,dispatch:r=>{n.value=s(r)}}}const M3=Zt({name:"PrimitiveSlot",inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{var s,r;if(!n.default)return null;const o=ld(n.default()),i=o.findIndex(d=>d.type!==Mn);if(i===-1)return o;const a=o[i];(s=a.props)==null||delete s.ref;const c=a.props?wn(t,a.props):t;t.class&&(r=a.props)!=null&&r.class&&delete a.props.class;const u=ds(a,c);for(const d in c)d.startsWith("on")&&(u.props||(u.props={}),u.props[d]=c[d]);return o.length===1?u:(o[i]=u,o)}}}),Cl=Zt({name:"Primitive",inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:"div"}},setup(e,{attrs:t,slots:n}){const s=e.asChild?"template":e.as;return typeof s=="string"&&["area","img","input"].includes(s)?()=>hr(s,t):s!=="template"?()=>hr(e.as,t,{default:n.default}):()=>hr(M3,t,{default:n.default})}});function O3(e,t){const n=R({}),s=R("none"),r=e.value?"mounted":"unmounted",{state:o,dispatch:i}=P3(r,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),a=h=>{var g;if(Oi){const p=new CustomEvent(h,{bubbles:!1,cancelable:!1});(g=t.value)==null||g.dispatchEvent(p)}};Pe(e,async(h,g)=>{var p;const v=g!==h;if(await kt(),v){const _=s.value,w=$l(t.value);h?(i("MOUNT"),a("enter"),w==="none"&&a("after-enter")):w==="none"||((p=n.value)==null?void 0:p.display)==="none"?(i("UNMOUNT"),a("leave"),a("after-leave")):g&&_!==w?(i("ANIMATION_OUT"),a("leave")):(i("UNMOUNT"),a("after-leave"))}},{immediate:!0});const c=h=>{const g=$l(t.value),p=g.includes(h.animationName),v=o.value==="mounted"?"enter":"leave";h.target===t.value&&p&&(a(`after-${v}`),i("ANIMATION_END")),h.target===t.value&&g==="none"&&i("ANIMATION_END")},u=h=>{h.target===t.value&&(s.value=$l(t.value))},d=Pe(t,(h,g)=>{h?(n.value=getComputedStyle(h),h.addEventListener("animationstart",u),h.addEventListener("animationcancel",c),h.addEventListener("animationend",c)):(i("ANIMATION_END"),g==null||g.removeEventListener("animationstart",u),g==null||g.removeEventListener("animationcancel",c),g==null||g.removeEventListener("animationend",c))},{immediate:!0}),f=Pe(o,()=>{const h=$l(t.value);s.value=o.value==="mounted"?h:"none"});return Rt(()=>{d(),f()}),{isPresent:Z(()=>["mounted","unmountSuspended"].includes(o.value))}}function $l(e){return e&&getComputedStyle(e).animationName||"none"}const L3=Zt({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(e,{slots:t,expose:n}){var s;const{present:r,forceMount:o}=Et(e),i=R(),{isPresent:a}=O3(r,i);n({present:a});let c=t.default({present:a});c=ld(c||[]);const u=es();if(c&&(c==null?void 0:c.length)>1){const d=(s=u==null?void 0:u.parent)!=null&&s.type.name?`<${u.parent.type.name} />`:"component";throw new Error([`Detected an invalid children for \`${d}\` for \`Presence\` component.`,"","Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.","You can apply a few solutions:",["Provide a single child element so that `presence` directive attach correctly.","Ensure the first child is an actual element instead of a raw text node or comment node."].map(f=>` - ${f}`).join(`
`)].join(`
`))}return()=>o.value||r.value||a.value?hr(t.default({present:a})[0],{ref:d=>{const f=xl(d);return typeof(f==null?void 0:f.hasAttribute)>"u"||(f!=null&&f.hasAttribute("data-radix-popper-content-wrapper")?i.value=f.firstElementChild:i.value=f),f}}):null}}),[yo,R3]=id("DialogRoot"),D3=Zt({__name:"DialogRoot",props:{open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:!1},modal:{type:Boolean,default:!0}},emits:["update:open"],setup(e,{emit:t}){const n=e,s=x3(n,"open",t,{defaultValue:n.defaultOpen,passive:n.open===void 0}),r=R(),o=R(),{modal:i}=Et(n);return R3({open:s,modal:i,openModal:()=>{s.value=!0},onOpenChange:a=>{s.value=a},onOpenToggle:()=>{s.value=!s.value},contentId:"",titleId:"",descriptionId:"",triggerElement:r,contentElement:o}),(a,c)=>It(a.$slots,"default",{open:y(s)})}}),j3=Zt({__name:"Teleport",props:{to:{default:"body"},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(e){const t=b3();return(n,s)=>y(t)||n.forceMount?(m(),oe(Yc,{key:0,to:n.to,disabled:n.disabled},[It(n.$slots,"default")],8,["to","disabled"])):z("",!0)}}),nr=Zt({__name:"DialogPortal",props:{to:{},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(e){const t=e;return(n,s)=>(m(),oe(y(j3),Gi(ya(t)),{default:Se(()=>[It(n.$slots,"default")]),_:3},16))}}),N3="dismissableLayer.pointerDownOutside",F3="dismissableLayer.focusOutside";function Mg(e,t){const n=t.closest("[data-dismissable-layer]"),s=e.dataset.dismissableLayer===""?e:e.querySelector("[data-dismissable-layer]"),r=Array.from(e.ownerDocument.querySelectorAll("[data-dismissable-layer]"));return!!(n&&s===n||r.indexOf(s)<r.indexOf(n))}function q3(e,t){var n;const s=((n=t==null?void 0:t.value)==null?void 0:n.ownerDocument)??(globalThis==null?void 0:globalThis.document),r=R(!1),o=R(()=>{});return ks(i=>{if(!Oi)return;const a=async u=>{const d=u.target;if(t!=null&&t.value){if(Mg(t.value,d)){r.value=!1;return}if(u.target&&!r.value){let f=function(){Ag(N3,e,h)};const h={originalEvent:u};u.pointerType==="touch"?(s.removeEventListener("click",o.value),o.value=f,s.addEventListener("click",o.value,{once:!0})):f()}else s.removeEventListener("click",o.value);r.value=!1}},c=window.setTimeout(()=>{s.addEventListener("pointerdown",a)},0);i(()=>{window.clearTimeout(c),s.removeEventListener("pointerdown",a),s.removeEventListener("click",o.value)})}),{onPointerDownCapture:()=>r.value=!0}}function z3(e,t){var n;const s=((n=t==null?void 0:t.value)==null?void 0:n.ownerDocument)??(globalThis==null?void 0:globalThis.document),r=R(!1);return ks(o=>{if(!Oi)return;const i=async a=>{t!=null&&t.value&&(await kt(),!(!t.value||Mg(t.value,a.target))&&a.target&&!r.value&&Ag(F3,e,{originalEvent:a}))};s.addEventListener("focusin",i),o(()=>s.removeEventListener("focusin",i))}),{onFocusCapture:()=>r.value=!0,onBlurCapture:()=>r.value=!1}}const Is=dt({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),B3=Zt({__name:"DismissableLayer",props:{disableOutsidePointerEvents:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","dismiss"],setup(e,{emit:t}){const n=e,s=t,{forwardRef:r,currentElement:o}=tr(),i=Z(()=>{var p;return((p=o.value)==null?void 0:p.ownerDocument)??globalThis.document}),a=Z(()=>Is.layersRoot),c=Z(()=>o.value?Array.from(a.value).indexOf(o.value):-1),u=Z(()=>Is.layersWithOutsidePointerEventsDisabled.size>0),d=Z(()=>{const p=Array.from(a.value),[v]=[...Is.layersWithOutsidePointerEventsDisabled].slice(-1),_=p.indexOf(v);return c.value>=_}),f=q3(async p=>{const v=[...Is.branches].some(_=>_.contains(p.target));!d.value||v||(s("pointerDownOutside",p),s("interactOutside",p),await kt(),p.defaultPrevented||s("dismiss"))},o),h=z3(p=>{[...Is.branches].some(v=>v.contains(p.target))||(s("focusOutside",p),s("interactOutside",p),p.defaultPrevented||s("dismiss"))},o);y3("Escape",p=>{c.value===a.value.size-1&&(s("escapeKeyDown",p),p.defaultPrevented||s("dismiss"))});let g;return ks(p=>{o.value&&(n.disableOutsidePointerEvents&&(Is.layersWithOutsidePointerEventsDisabled.size===0&&(g=i.value.body.style.pointerEvents,i.value.body.style.pointerEvents="none"),Is.layersWithOutsidePointerEventsDisabled.add(o.value)),a.value.add(o.value),p(()=>{n.disableOutsidePointerEvents&&Is.layersWithOutsidePointerEventsDisabled.size===1&&(i.value.body.style.pointerEvents=g)}))}),ks(p=>{p(()=>{o.value&&(a.value.delete(o.value),Is.layersWithOutsidePointerEventsDisabled.delete(o.value))})}),(p,v)=>(m(),oe(y(Cl),{ref:y(r),"as-child":p.asChild,as:p.as,"data-dismissable-layer":"",style:ht({pointerEvents:u.value?d.value?"auto":"none":void 0}),onFocusCapture:y(h).onFocusCapture,onBlurCapture:y(h).onBlurCapture,onPointerdownCapture:y(f).onPointerDownCapture},{default:Se(()=>[It(p.$slots,"default")]),_:3},8,["as-child","as","style","onFocusCapture","onBlurCapture","onPointerdownCapture"]))}}),ud="focusScope.autoFocusOnMount",dd="focusScope.autoFocusOnUnmount",Og={bubbles:!1,cancelable:!0};function U3(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(sr(s,{select:t}),document.activeElement!==n)return!0}function V3(e){const t=Lg(e),n=Rg(t,e),s=Rg(t.reverse(),e);return[n,s]}function Lg(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const r=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||r?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Rg(e,t){for(const n of e)if(!H3(n,{upTo:t}))return n}function H3(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function W3(e){return e instanceof HTMLInputElement&&"select"in e}function sr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&W3(e)&&t&&e.select()}}const G3=d3(()=>R([]));function K3(){const e=G3();return{add(t){const n=e.value[0];t!==n&&(n==null||n.pause()),e.value=Dg(e.value,t),e.value.unshift(t)},remove(t){var n;e.value=Dg(e.value,t),(n=e.value[0])==null||n.resume()}}}function Dg(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function Q3(e){return e.filter(t=>t.tagName!=="A")}const J3=Zt({__name:"FocusScope",props:{loop:{type:Boolean,default:!1},trapped:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["mountAutoFocus","unmountAutoFocus"],setup(e,{emit:t}){const n=e,s=t,{currentRef:r,currentElement:o}=tr(),i=R(null),a=K3(),c=dt({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}});ks(d=>{if(!Oi)return;const f=o.value;if(!n.trapped)return;function h(_){if(c.paused||!f)return;const w=_.target;f.contains(w)?i.value=w:sr(i.value,{select:!0})}function g(_){if(c.paused||!f)return;const w=_.relatedTarget;w!==null&&(f.contains(w)||sr(i.value,{select:!0}))}function p(_){f.contains(i.value)||sr(f)}document.addEventListener("focusin",h),document.addEventListener("focusout",g);const v=new MutationObserver(p);f&&v.observe(f,{childList:!0,subtree:!0}),d(()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",g),v.disconnect()})}),ks(async d=>{const f=o.value;if(await kt(),!f)return;a.add(c);const h=document.activeElement;if(!f.contains(h)){const g=new CustomEvent(ud,Og);f.addEventListener(ud,p=>s("mountAutoFocus",p)),f.dispatchEvent(g),g.defaultPrevented||(U3(Q3(Lg(f)),{select:!0}),document.activeElement===h&&sr(f))}d(()=>{f.removeEventListener(ud,v=>s("mountAutoFocus",v));const g=new CustomEvent(dd,Og),p=v=>{s("unmountAutoFocus",v)};f.addEventListener(dd,p),f.dispatchEvent(g),setTimeout(()=>{g.defaultPrevented||sr(h??document.body,{select:!0}),f.removeEventListener(dd,p),a.remove(c)},0)})});function u(d){if(!n.loop&&!n.trapped||c.paused)return;const f=d.key==="Tab"&&!d.altKey&&!d.ctrlKey&&!d.metaKey,h=document.activeElement;if(f&&h){const g=d.currentTarget,[p,v]=V3(g);p&&v?!d.shiftKey&&h===v?(d.preventDefault(),n.loop&&sr(p,{select:!0})):d.shiftKey&&h===p&&(d.preventDefault(),n.loop&&sr(v,{select:!0})):h===g&&d.preventDefault()}}return(d,f)=>(m(),oe(y(Cl),{ref_key:"currentRef",ref:r,tabindex:"-1","as-child":d.asChild,as:d.as,onKeydown:u},{default:Se(()=>[It(d.$slots,"default")]),_:3},8,["as-child","as"]))}});function X3(e){return e?"open":"closed"}const jg=Zt({__name:"DialogContentImpl",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(e,{emit:t}){const n=e,s=t,r=yo(),{forwardRef:o,currentElement:i}=tr();return r.titleId||(r.titleId=Pg(void 0,"radix-vue-dialog-title")),r.descriptionId||(r.descriptionId=Pg(void 0,"radix-vue-dialog-description")),Je(()=>{r.contentElement=i,document.activeElement!==document.body&&(r.triggerElement.value=document.activeElement)}),(a,c)=>(m(),oe(y(J3),{"as-child":"",loop:"",trapped:n.trapFocus,onMountAutoFocus:c[5]||(c[5]=u=>s("openAutoFocus",u)),onUnmountAutoFocus:c[6]||(c[6]=u=>s("closeAutoFocus",u))},{default:Se(()=>[G(y(B3),wn({id:y(r).contentId,ref:y(o),as:a.as,"as-child":a.asChild,"disable-outside-pointer-events":a.disableOutsidePointerEvents,role:"dialog","aria-describedby":y(r).descriptionId,"aria-labelledby":y(r).titleId,"data-state":y(X3)(y(r).open.value)},a.$attrs,{onDismiss:c[0]||(c[0]=u=>y(r).onOpenChange(!1)),onEscapeKeyDown:c[1]||(c[1]=u=>s("escapeKeyDown",u)),onFocusOutside:c[2]||(c[2]=u=>s("focusOutside",u)),onInteractOutside:c[3]||(c[3]=u=>s("interactOutside",u)),onPointerDownOutside:c[4]||(c[4]=u=>s("pointerDownOutside",u))}),{default:Se(()=>[It(a.$slots,"default")]),_:3},16,["id","as","as-child","disable-outside-pointer-events","aria-describedby","aria-labelledby","data-state"])]),_:3},8,["trapped"]))}}),Z3=Zt({__name:"DialogContentModal",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(e,{emit:t}){const n=e,s=t,r=yo(),o=wl(s),{forwardRef:i,currentElement:a}=tr();return E3(a),(c,u)=>(m(),oe(jg,wn({...n,...y(o)},{ref:y(i),"trap-focus":y(r).open.value,"disable-outside-pointer-events":!0,onCloseAutoFocus:u[0]||(u[0]=d=>{var f;d.defaultPrevented||(d.preventDefault(),(f=y(r).triggerElement.value)==null||f.focus())}),onPointerDownOutside:u[1]||(u[1]=d=>{const f=d.detail.originalEvent,h=f.button===0&&f.ctrlKey===!0;(f.button===2||h)&&d.preventDefault()}),onFocusOutside:u[2]||(u[2]=d=>{d.preventDefault()})}),{default:Se(()=>[It(c.$slots,"default")]),_:3},16,["trap-focus"]))}}),Y3=Zt({__name:"DialogContentNonModal",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(e,{emit:t}){const n=e,s=wl(t);tr();const r=yo(),o=R(!1),i=R(!1);return(a,c)=>(m(),oe(jg,wn({...n,...y(s)},{"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:c[0]||(c[0]=u=>{var d;u.defaultPrevented||(o.value||(d=y(r).triggerElement.value)==null||d.focus(),u.preventDefault()),o.value=!1,i.value=!1}),onInteractOutside:c[1]||(c[1]=u=>{var d;u.defaultPrevented||(o.value=!0,u.detail.originalEvent.type==="pointerdown"&&(i.value=!0));const f=u.target;(d=y(r).triggerElement.value)!=null&&d.contains(f)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&i.value&&u.preventDefault()})}),{default:Se(()=>[It(a.$slots,"default")]),_:3},16))}}),eT=Zt({__name:"DialogContent",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(e,{emit:t}){const n=e,s=t,r=yo(),o=wl(s),{forwardRef:i}=tr();return(a,c)=>(m(),oe(y(L3),{present:a.forceMount||y(r).open.value},{default:Se(()=>[y(r).modal.value?(m(),oe(Z3,wn({key:0,ref:y(i)},{...n,...y(o),...a.$attrs}),{default:Se(()=>[It(a.$slots,"default")]),_:3},16)):(m(),oe(Y3,wn({key:1,ref:y(i)},{...n,...y(o),...a.$attrs}),{default:Se(()=>[It(a.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),Tl=Zt({__name:"DialogTitle",props:{asChild:{type:Boolean},as:{default:"h2"}},setup(e){const t=e,n=yo();return tr(),(s,r)=>(m(),oe(y(Cl),wn(t,{id:y(n).titleId}),{default:Se(()=>[It(s.$slots,"default")]),_:3},16,["id"]))}}),Al=Zt({__name:"DialogDescription",props:{asChild:{type:Boolean},as:{default:"p"}},setup(e){const t=e;tr();const n=yo();return(s,r)=>(m(),oe(y(Cl),wn(t,{id:y(n).descriptionId}),{default:Se(()=>[It(s.$slots,"default")]),_:3},16,["id"]))}});function tT(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}tT(),function(){try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('[vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32,.72,0,1)}[vaul-drawer][vaul-drawer-direction=bottom]{transform:translate3d(0,100%,0)}[vaul-drawer][vaul-drawer-direction=top]{transform:translate3d(0,-100%,0)}[vaul-drawer][vaul-drawer-direction=left]{transform:translate3d(-100%,0,0)}[vaul-drawer][vaul-drawer-direction=right]{transform:translate3d(100%,0,0)}.vaul-dragging .vaul-scrollable [vault-drawer-direction=top],.vaul-dragging .vaul-scrollable [vault-drawer-direction=bottom]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=left],.vaul-dragging .vaul-scrollable [vault-drawer-direction=right]{overflow-x:hidden!important}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=top],[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height, 0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=left],[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height, 0),0,0)}[vaul-overlay]{opacity:0;transition:opacity .5s cubic-bezier(.32,.72,0,1)}[vaul-overlay][vaul-drawer-visible=true]{opacity:1}[vaul-drawer]:after{content:"";position:absolute;background:inherit;background-color:inherit}[vaul-drawer][vaul-drawer-direction=top]:after{top:initial;bottom:100%;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=bottom]:after{top:100%;bottom:initial;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=left]:after{left:initial;right:100%;top:0;bottom:0;width:200%}[vaul-drawer][vaul-drawer-direction=right]:after{left:100%;right:initial;top:0;bottom:0;width:200%}[vaul-overlay][vaul-snap-points=true]:not([vaul-snap-points-overlay=true]):not([data-state=closed]){opacity:0}[vaul-overlay][vaul-snap-points-overlay=true]:not([vaul-drawer-visible=false]){opacity:1}@keyframes fake-animation{}@media (hover: hover) and (pointer: fine){[vaul-drawer]{-webkit-user-select:none;user-select:none}}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();const nT=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const sT=e=>typeof e<"u";function rT(e){return JSON.parse(JSON.stringify(e))}function Ng(e,t,n,s={}){var r,o,i;const{clone:a=!1,passive:c=!1,eventName:u,deep:d=!1,defaultValue:f,shouldEmit:h}=s,g=es(),p=n||(g==null?void 0:g.emit)||((r=g==null?void 0:g.$emit)==null?void 0:r.bind(g))||((i=(o=g==null?void 0:g.proxy)==null?void 0:o.$emit)==null?void 0:i.bind(g==null?void 0:g.proxy));let v=u;t||(t="modelValue"),v=v||`update:${t.toString()}`;const _=S=>a?typeof a=="function"?a(S):rT(S):S,w=()=>sT(e[t])?_(e[t]):f,k=S=>{h?h(S)&&p(v,S):p(v,S)};if(c){const S=w(),E=R(S);let O=!1;return Pe(()=>e[t],I=>{O||(O=!0,E.value=_(I),kt(()=>O=!1))}),Pe(E,I=>{!O&&(I!==e[t]||d)&&k(I)},{deep:d}),E}else return Z({get(){return w()},set(S){k(S)}})}const[Fg,oT]=id("DrawerRoot"),qg=new WeakMap;function Mt(e,t,n=!1){if(!e||!(e instanceof HTMLElement)||!t)return;const s={};Object.entries(t).forEach(([r,o])=>{if(r.startsWith("--")){e.style.setProperty(r,o);return}s[r]=e.style[r],e.style[r]=o}),!n&&qg.set(e,s)}function El(e,t){if(!e||!(e instanceof HTMLElement))return;const n=qg.get(e);n&&(t?e.style[t]=n[t]:Object.entries(n).forEach(([s,r])=>{e.style[s]=r}))}function Il(e,t){const n=window.getComputedStyle(e),s=n.transform||n.webkitTransform||n.mozTransform;let r=s.match(/^matrix3d\((.+)\)$/);return r?Number.parseFloat(r[1].split(", ")[Ut(t)?13:12]):(r=s.match(/^matrix\((.+)\)$/),r?Number.parseFloat(r[1].split(", ")[Ut(t)?5:4]):null)}function iT(e){return 8*(Math.log(e+1)-2)}function Ut(e){switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}}const wt={DURATION:.5,EASE:[.32,.72,0,1]},zg=.4;function aT({activeSnapPoint:e,snapPoints:t,drawerRef:n,overlayRef:s,fadeFromIndex:r,onSnapPointChange:o,direction:i}){const a=R(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);function c(){a.value={innerWidth:window.innerWidth,innerHeight:window.innerHeight}}Je(()=>{typeof window<"u"&&window.addEventListener("resize",c)}),Zn(()=>{typeof window<"u"&&window.removeEventListener("resize",c)});const u=Z(()=>(t.value&&e.value===t.value[t.value.length-1])??null),d=Z(()=>t.value&&t.value.length>0&&((r==null?void 0:r.value)||(r==null?void 0:r.value)===0)&&!Number.isNaN(r==null?void 0:r.value)&&t.value[(r==null?void 0:r.value)??-1]===e.value||!t.value),f=Z(()=>{var k;return((k=t.value)==null?void 0:k.findIndex(S=>S===e.value))??null}),h=Z(()=>{var k;return((k=t.value)==null?void 0:k.map(S=>{const E=typeof S=="string";let O=0;if(E&&(O=Number.parseInt(S,10)),Ut(i.value)){const P=E?O:a.value?S*a.value.innerHeight:0;return a.value?i.value==="bottom"?a.value.innerHeight-P:-a.value.innerHeight+P:P}const I=E?O:a.value?S*a.value.innerWidth:0;return a.value?i.value==="right"?a.value.innerWidth-I:-a.value.innerWidth+I:I}))??[]}),g=Z(()=>{var k;return f.value!==null?(k=h.value)==null?void 0:k[f.value]:null}),p=k=>{var S,E,O,I;const P=((S=h.value)==null?void 0:S.findIndex(M=>M===k))??null;kt(()=>{var M;o(P,h.value),Mt((M=n.value)==null?void 0:M.$el,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Ut(i.value)?`translate3d(0, ${k}px, 0)`:`translate3d(${k}px, 0, 0)`})}),h.value&&P!==h.value.length-1&&P!==(r==null?void 0:r.value)?Mt((E=s.value)==null?void 0:E.$el,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"0"}):Mt((O=s.value)==null?void 0:O.$el,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"1"}),e.value=P!==null?((I=t.value)==null?void 0:I[P])??null:null};Pe([e,h,t],()=>{var k;if(e.value){const S=((k=t.value)==null?void 0:k.findIndex(E=>E===e.value))??-1;h.value&&S!==-1&&typeof h.value[S]=="number"&&p(h.value[S])}},{immediate:!0});function v({draggedDistance:k,closeDrawer:S,velocity:E,dismissible:O}){var I,P,M;if(r.value===void 0)return;const q=i.value==="bottom"||i.value==="right"?(g.value??0)-k:(g.value??0)+k,B=f.value===r.value-1,T=f.value===0,A=k>0;if(B&&Mt((I=s.value)==null?void 0:I.$el,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),E>2&&!A){O?S():p(h.value[0]);return}if(E>2&&A&&h&&t.value){p(h.value[t.value.length-1]);return}const D=(P=h.value)==null?void 0:P.reduce((W,H)=>typeof W!="number"||typeof H!="number"?W:Math.abs(H-q)<Math.abs(W-q)?H:W),Q=Ut(i.value)?window.innerHeight:window.innerWidth;if(E>zg&&Math.abs(k)<Q*.4){const W=A?1:-1;if(W>0&&u){p(h.value[(((M=t.value)==null?void 0:M.length)??0)-1]);return}if(T&&W<0&&O&&S(),f.value===null)return;p(h.value[f.value+W]);return}p(D)}function _({draggedDistance:k}){var S;if(g.value===null)return;const E=i.value==="bottom"||i.value==="right"?g.value-k:g.value+k;(i.value==="bottom"||i.value==="right")&&E<h.value[h.value.length-1]||(i.value==="top"||i.value==="left")&&E>h.value[h.value.length-1]||Mt((S=n.value)==null?void 0:S.$el,{transform:Ut(i.value)?`translate3d(0, ${E}px, 0)`:`translate3d(${E}px, 0, 0)`})}function w(k,S){if(!t.value||typeof f.value!="number"||!h.value||r.value===void 0)return null;const E=f.value===r.value-1;if(f.value>=r.value&&S)return 0;if(E&&!S)return 1;if(!d.value&&!E)return null;const O=E?f.value+1:f.value-1,I=E?h.value[O]-h.value[O-1]:h.value[O+1]-h.value[O],P=k/Math.abs(I);return E?1-P:P}return{isLastSnapPoint:u,shouldFade:d,getPercentageDragged:w,activeSnapPointIndex:f,onRelease:v,onDrag:_,snapPointsOffset:h}}let Li=null;function lT(e){const{isOpen:t,modal:n,nested:s,hasBeenOpened:r}=e,o=R(typeof window<"u"?window.location.href:""),i=R(0);function a(){if(Li===null&&t.value){Li={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height};const{scrollX:u,innerHeight:d}=window;document.body.style.position="fixed",document.body.style.top=`-${i.value}px`,document.body.style.left=`-${u}px`,document.body.style.right="0px",document.body.style.height="auto",setTimeout(()=>{requestAnimationFrame(()=>{const f=d-window.innerHeight;f&&i.value>=d&&(document.body.style.top=`-${i.value+f}px`)})},300)}}function c(){if(Li!==null){const u=-Number.parseInt(document.body.style.top,10),d=-Number.parseInt(document.body.style.left,10);Object.assign(document.body.style,Li),requestAnimationFrame(()=>{if(o.value!==window.location.href){o.value=window.location.href;return}window.scrollTo(d,u)}),Li=null}}return Je(()=>{function u(){i.value=window.scrollY}u(),window.addEventListener("scroll",u),Rt(()=>{window.removeEventListener("scroll",u)})}),Pe([t,r,o],()=>{s.value||!r.value||(t.value?(!window.matchMedia("(display-mode: standalone)").matches&&a(),n.value||setTimeout(()=>{c()},500)):c())}),{restorePositionSetting:c}}const cT=.25,uT=100,Bg=8,Or=16,dT=26,Ug="vaul-dragging";function fT(e,t){return e&&e.value?e:t}function hT(e){const{emitDrag:t,emitRelease:n,emitClose:s,emitOpenChange:r,open:o,dismissible:i,nested:a,modal:c,shouldScaleBackground:u,scrollLockTimeout:d,closeThreshold:f,activeSnapPoint:h,fadeFromIndex:g,direction:p}=e,v=R(o.value??!1),_=R(!1),w=R(!1),k=R(!1),S=R(!1),E=R(null),O=R(null),I=R(null),P=R(null),M=R(null),q=R(!0),B=R(null),T=R(0),A=R(!1);R(0);const D=R(null);R(0);const Q=Z(()=>{var L;return((L=D.value)==null?void 0:L.$el.getBoundingClientRect().height)||0}),W=fT(e.snapPoints,R(void 0)),{activeSnapPointIndex:H,onRelease:K,snapPointsOffset:J,onDrag:te,shouldFade:ge,getPercentageDragged:ue}=aT({snapPoints:W,activeSnapPoint:h,drawerRef:D,fadeFromIndex:g,overlayRef:E,onSnapPointChange:we,direction:p});function we(L,V){W.value&&L===V.length-1&&(O.value=new Date)}const{restorePositionSetting:Ee}=lT({isOpen:v,modal:c,nested:a,hasBeenOpened:_});function re(){return(window.innerWidth-dT)/window.innerWidth}function pe(L,V){var ie;if(!L)return!1;let me=L;const de=(ie=window.getSelection())==null?void 0:ie.toString(),ve=D.value?Il(D.value.$el,p.value):null,he=new Date;if(me.hasAttribute("data-vaul-no-drag")||me.closest("[data-vaul-no-drag]"))return!1;if(p.value==="right"||p.value==="left")return!0;if(O.value&&he.getTime()-O.value.getTime()<500)return!1;if(ve!==null&&(p.value==="bottom"?ve>0:ve<0))return!0;if(de&&de.length>0)return!1;if(M.value&&he.getTime()-M.value.getTime()<d.value&&ve===0||V)return M.value=he,!1;for(;me;){if(me.scrollHeight>me.clientHeight){if(me.scrollTop!==0)return M.value=new Date,!1;if(me.getAttribute("role")==="dialog")return!0}me=me.parentNode}return!0}function fe(L){!i.value&&!W.value||D.value&&!D.value.$el.contains(L.target)||(k.value=!0,I.value=new Date,L.target.setPointerCapture(L.pointerId),T.value=Ut(p.value)?L.clientY:L.clientX)}function $e(L){var V,ie,me,de,ve,he;if(D.value&&k.value){const Te=p.value==="bottom"||p.value==="right"?1:-1,je=(T.value-(Ut(p.value)?L.clientY:L.clientX))*Te,De=je>0,Ie=W.value&&!i.value&&!De;if(Ie&&H.value===0)return;const He=Math.abs(je),ot=document.querySelector("[vaul-drawer-wrapper]");let it=He/Q.value;const pt=ue(He,De);if(pt!==null&&(it=pt),Ie&&it>=1||!q.value&&!pe(L.target,De))return;if((V=D==null?void 0:D.value)==null||V.$el.classList.add(Ug),q.value=!0,Mt((ie=D.value)==null?void 0:ie.$el,{transition:"none"}),Mt((me=E.value)==null?void 0:me.$el,{transition:"none"}),W.value&&te({draggedDistance:je}),De&&!W.value){const Ot=iT(je),cn=Math.min(Ot*-1,0)*Te;Mt((de=D.value)==null?void 0:de.$el,{transform:Ut(p.value)?`translate3d(0, ${cn}px, 0)`:`translate3d(${cn}px, 0, 0)`});return}const yt=1-it;if((ge.value||g.value&&H.value===g.value-1)&&(t(it),Mt((ve=E.value)==null?void 0:ve.$el,{opacity:`${yt}`,transition:"none"},!0)),ot&&E.value&&u.value){const Ot=Math.min(re()+it*(1-re()),1),cn=8-it*8,qt=Math.max(0,14-it*14);Mt(ot,{borderRadius:`${cn}px`,transform:Ut(p.value)?`scale(${Ot}) translate3d(0, ${qt}px, 0)`:`scale(${Ot}) translate3d(${qt}px, 0, 0)`,transition:"none"},!0)}if(!W.value){const Ot=He*Te;Mt((he=D.value)==null?void 0:he.$el,{transform:Ut(p.value)?`translate3d(0, ${Ot}px, 0)`:`translate3d(${Ot}px, 0, 0)`})}}}function Re(){var L;if(!D.value)return;const V=document.querySelector("[vaul-drawer-wrapper]"),ie=Il(D.value.$el,p.value);Mt(D.value.$el,{transform:"translate3d(0, 0, 0)",transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),Mt((L=E.value)==null?void 0:L.$el,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"1"}),u.value&&ie&&ie>0&&v.value&&Mt(V,{borderRadius:`${Bg}px`,overflow:"hidden",...Ut(p.value)?{transform:`scale(${re()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${re()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${wt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${wt.EASE.join(",")})`},!0)}function Le(){var L;D.value&&(s(),Mt(D.value.$el,{transform:Ut(p.value)?`translate3d(0, ${p.value==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${p.value==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),Mt((L=E.value)==null?void 0:L.$el,{opacity:"0",transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),Ve(!1),window.setTimeout(()=>{w.value=!1,v.value=!1},300),window.setTimeout(()=>{W.value&&(h.value=W.value[0])},wt.DURATION*1e3))}ks(()=>{if(!v.value&&u.value&&nT){const L=setTimeout(()=>{El(document.body)},200);return()=>clearTimeout(L)}}),Rt(()=>{Ve(!1),Ee()});function Oe(L){if(!k.value||!D.value)return;D.value.$el.classList.remove(Ug),q.value=!1,k.value=!1,P.value=new Date;const V=Il(D.value.$el,p.value);if(!pe(L.target,!1)||!V||Number.isNaN(V)||I.value===null)return;const ie=P.value.getTime()-I.value.getTime(),me=T.value-(Ut(p.value)?L.clientY:L.clientX),de=Math.abs(me)/ie;if(de>.05&&(S.value=!0,window.setTimeout(()=>{S.value=!1},200)),W.value){const he=p.value==="bottom"||p.value==="right"?1:-1;K({draggedDistance:me*he,closeDrawer:Le,velocity:de,dismissible:i.value}),n(!0);return}if(p.value==="bottom"||p.value==="right"?me>0:me<0){Re(),n(!0);return}if(de>zg){Le(),n(!1);return}const ve=Math.min(D.value.$el.getBoundingClientRect().height??0,window.innerHeight);if(V>=ve*f.value){Le(),n(!1);return}n(!0),Re()}Pe(v,L=>{L&&(O.value=new Date,Ve(!0)),r(L)},{immediate:!0}),Pe(o,L=>{L?(v.value=L,_.value=!0):Le()},{immediate:!0});function Ve(L){const V=document.querySelector("[vaul-drawer-wrapper]");!V||!u.value||(L?(Mt(document.body,{background:document.body.style.backgroundColor||document.body.style.background}),Mt(document.body,{background:"black"},!0),Mt(V,{borderRadius:`${Bg}px`,overflow:"hidden",...Ut(p.value)?{transform:`scale(${re()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${re()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${wt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${wt.EASE.join(",")})`})):(El(V,"overflow"),El(V,"transform"),El(V,"borderRadius"),Mt(V,{transitionProperty:"transform, border-radius",transitionDuration:`${wt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${wt.EASE.join(",")})`})))}function N(L){var V,ie;const me=L?(window.innerWidth-Or)/window.innerWidth:1,de=L?-Or:0;B.value&&window.clearTimeout(B.value),Mt((V=D.value)==null?void 0:V.$el,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:`scale(${me}) translate3d(0, ${de}px, 0)`}),!L&&(ie=D.value)!=null&&ie.$el&&(B.value=window.setTimeout(()=>{var ve,he;const Te=Il((ve=D.value)==null?void 0:ve.$el,p.value);Mt((he=D.value)==null?void 0:he.$el,{transition:"none",transform:Ut(p.value)?`translate3d(0, ${Te}px, 0)`:`translate3d(${Te}px, 0, 0)`})},500))}function ee(L){var V;if(L<0)return;const ie=Ut(p.value)?window.innerHeight:window.innerWidth,me=(ie-Or)/ie,de=me+L*(1-me),ve=-Or+L*Or;Mt((V=D.value)==null?void 0:V.$el,{transform:Ut(p.value)?`scale(${de}) translate3d(0, ${ve}px, 0)`:`scale(${de}) translate3d(${ve}px, 0, 0)`,transition:"none"})}function Y(L){var V;const ie=Ut(p.value)?window.innerHeight:window.innerWidth,me=L?(ie-Or)/ie:1,de=L?-Or:0;L&&Mt((V=D.value)==null?void 0:V.$el,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Ut(p.value)?`scale(${me}) translate3d(0, ${de}px, 0)`:`scale(${me}) translate3d(${de}px, 0, 0)`})}return{open:o,isOpen:v,modal:c,keyboardIsOpen:A,hasBeenOpened:_,isVisible:w,drawerRef:D,drawerHeightRef:Q,overlayRef:E,isDragging:k,dragStartTime:I,isAllowedToDrag:q,snapPoints:W,activeSnapPoint:h,pointerStart:T,dismissible:i,snapPointsOffset:J,direction:p,shouldFade:ge,fadeFromIndex:g,shouldScaleBackground:u,onPress:fe,onDrag:$e,onRelease:Oe,closeDrawer:Le,onNestedDrag:ee,onNestedRelease:Y,onNestedOpenChange:N,emitClose:s,emitDrag:t,emitRelease:n,emitOpenChange:r,nested:a}}const bo=Zt({__name:"DrawerRoot",props:{activeSnapPoint:{default:void 0},closeThreshold:{default:cT},shouldScaleBackground:{type:Boolean,default:void 0},scrollLockTimeout:{default:uT},fixed:{type:Boolean,default:void 0},dismissible:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:void 0},nested:{type:Boolean,default:!1},direction:{default:"bottom"},snapPoints:{default:void 0},fadeFromIndex:{default:void 0}},emits:["drag","release","close","update:open","update:activeSnapPoint","animationEnd"],setup(e,{expose:t,emit:n}){const s=e,r=n;Hf();const o=Z(()=>s.fadeFromIndex??(s.snapPoints&&s.snapPoints.length-1)),i=Ng(s,"open",r,{defaultValue:s.defaultOpen,passive:s.open===void 0}),a=Ng(s,"activeSnapPoint",r,{passive:s.activeSnapPoint===void 0}),c={emitDrag:p=>r("drag",p),emitRelease:p=>r("release",p),emitClose:()=>r("close"),emitOpenChange:p=>{r("update:open",p),setTimeout(()=>{r("animationEnd",p)},wt.DURATION*1e3)}},{closeDrawer:u,hasBeenOpened:d,modal:f,isOpen:h}=oT(hT({...c,...Et(s),activeSnapPoint:a,fadeFromIndex:o,open:i}));function g(p){if(i.value!==void 0){c.emitOpenChange(p);return}p?(d.value=!0,h.value=p):u()}return t({open:h}),(p,v)=>(m(),oe(y(D3),{open:y(h),modal:y(f),"onUpdate:open":g},{default:Se(()=>[It(p.$slots,"default",{open:y(h)})]),_:3},8,["open","modal"]))}}),fd=Zt({__name:"DrawerRootNested",props:{activeSnapPoint:{},closeThreshold:{},shouldScaleBackground:{type:Boolean},scrollLockTimeout:{},fixed:{type:Boolean},dismissible:{type:Boolean},modal:{type:Boolean},open:{type:Boolean},defaultOpen:{type:Boolean},nested:{type:Boolean},direction:{},snapPoints:{},fadeFromIndex:{}},emits:["drag","release","close","update:open","update:activeSnapPoint","animationEnd"],setup(e,{emit:t}){const n=e,s=t,{onNestedDrag:r,onNestedOpenChange:o,onNestedRelease:i}=Fg();function a(){o(!1)}function c(f){r(f)}function u(f){f&&o(f),s("update:open",f)}const d=S3(n,s);return(f,h)=>(m(),oe(bo,wn(y(d),{nested:"",onClose:a,onDrag:c,onRelease:y(i),"onUpdate:open":u}),{default:Se(()=>[It(f.$slots,"default")]),_:3},16,["onRelease"]))}}),rr=Zt({__name:"DrawerContent",setup(e){const{open:t,isOpen:n,isVisible:s,snapPointsOffset:r,drawerRef:o,onPress:i,onDrag:a,onRelease:c,modal:u,emitOpenChange:d,dismissible:f,keyboardIsOpen:h,closeDrawer:g,direction:p}=Fg(),v=Z(()=>r.value&&r.value.length>0?`${r.value[0]}px`:"0");function _(w){if(!u.value||w.defaultPrevented){w.preventDefault();return}h.value&&(h.value=!1),w.preventDefault(),f.value&&d(!1),!(!f.value||t.value!==void 0)&&g()}return Pe(n,w=>{w&&setTimeout(()=>{s.value=!0},1)},{immediate:!0}),(w,k)=>(m(),oe(y(eT),{ref_key:"drawerRef",ref:o,"vaul-drawer":"","vaul-drawer-direction":y(p),"vaul-drawer-visible":y(s)?"true":"false",style:ht({"--snap-point-height":v.value}),onPointerdown:y(i),onPointermove:y(a),onPointerup:y(c),onPointerDownOutside:_,onEscapeKeyDown:k[0]||(k[0]=S=>{y(f)||S.preventDefault()})},{default:Se(()=>[It(w.$slots,"default")]),_:3},8,["vaul-drawer-direction","vaul-drawer-visible","style","onPointerdown","onPointermove","onPointerup"]))}}),pT={class:"drawer-form",tabindex:"-1"},mT={class:"relative pt-[40px] bg-white rounded-t-2xl overflow-hidden"},gT=l("div",{tabindex:"-1",class:"w-10 h-[5px] rounded-full absolute bg-gray-300 left-1/2 -translate-x-1/2 top-4 cursor-grab"},null,-1),Vg={__name:"FormDrawer",props:Qr(["target"],{open:{},openModifiers:{},success:{},successModifiers:{}}),emits:["update:open","update:success"],setup(e){const t=Hf(),n=fr(e,"open"),s=fr(e,"success"),r=R(!1),o=async i=>{await kt(),r.value=!i};return(i,a)=>(m(),x("div",pT,[G(y(bo),{open:n.value,modal:!1,"should-scale-background":!1,"onUpdate:open":o},{default:Se(()=>[G(y(nr),{to:e.target},{default:Se(()=>[l("div",{onClick:a[0]||(a[0]=c=>n.value=!1),class:ne(["drawer-overlay-custom",{"drawer-overlay-custom--open":n.value}])},null,2),G(y(rr),{"aria-describedby":"dialog-description",class:"absolute inset-x-0 bottom-0 z-50 w-full outline-none border-none",tabindex:"-1"},{default:Se(()=>[G(y(Tl),{class:"sr-only"},{default:Se(()=>[We("DrawerTitle")]),_:1}),G(y(Al),{class:"sr-only"},{default:Se(()=>[We("DrawerDescription")]),_:1}),It(i.$slots,"fields")]),_:3})]),_:3},8,["to"])]),_:3},8,["open"]),y(t).success&&r.value?(m(),oe(y(bo),{key:0,modal:!1,"should-scale-background":!1,open:s.value},{default:Se(()=>[G(y(nr),{to:e.target},{default:Se(()=>[l("div",{onClick:a[1]||(a[1]=c=>s.value=!1),class:ne(["drawer-overlay-custom",{"drawer-overlay-custom--open":s.value}])},null,2),G(y(rr),{class:"absolute inset-x-0 bottom-0 z-50 w-full outline-none border-none",tabindex:"-1"},{default:Se(()=>[G(y(Tl),{class:"sr-only"},{default:Se(()=>[We("DrawerTitle")]),_:1}),G(y(Al),{class:"sr-only"},{default:Se(()=>[We("DrawerDescription")]),_:1}),l("div",mT,[gT,It(i.$slots,"success")])]),_:3})]),_:3},8,["to"])]),_:3},8,["open"])):z("",!0)]))}},vT={tabindex:"-1",class:"relative pb-4 pt-3 bg-white rounded-t-2xl overflow-hidden"},yT=l("div",{class:"flex justify-center"},[l("div",{tabindex:"-1",class:"w-10 h-[4px] rounded-full bg-gray-500 cursor-grab"})],-1),bT={key:0,class:"py-2 relative"},_T={class:"font-medium text-[18px] text-center tracking-wide text-gray-900"},xT={class:"px-5"},wT={class:"flex items-center space-x-3"},kT=l("button",{type:"submit",tabindex:"-1",class:"flex items-center justify-center h-12 bg-primary text-white border border-gray-200 w-full rounded-lg"}," Gửi yêu cầu ",-1),ST={class:"pb-6 pt-2"},CT={class:"text-[32px] flex items-center justify-center rounded-full"},$T=l("div",{class:"text-center mt-3 pl-2"},[l("div",{class:"font-medium text-gray-600 text-[18px]"}," Cảm ơn bạn đã liên hệ. "),l("div",{class:"text-[14px] text-gray-500 mt-1"}," Chúng tôi sẽ phản hồi lại trong thời gian sớm nhất. ")],-1),TT={__name:"FormContact",props:{form:{type:Object},message:{type:Object},chatViewRef:{type:Object}},setup(e){const{widgets:t}=Ys(),{getStorage:n}=Ks();R([]);const s=R(!1),r=async()=>{if(s.value)return;s.value=!0;const o=n("easychatgpt_conversations",U.handle),i=t.value.contact.fields.reduce((d,f)=>({...d,[f.name]:f.value}),{});if(!o)return;const a={status:"submitted",message_id:t.value.contact.message_id,conversation_id:o,submission_data:i},{data:c,status:u}=await Xe.submission.submitWidget({widgetId:t.value.contact.id,formData:a});u===200&&(U.isOpenFormContact=!1,U.isSuccessFormContact=!0,t.value.contact.is_finish=1,t.value.contact.submission_data=c.submission_data,t.value.contact.fields.forEach(d=>{d.value=""})),s.value=!1};return(o,i)=>(m(),oe(Vg,{target:e.chatViewRef,open:y(U).isOpenFormContact,"onUpdate:open":i[3]||(i[3]=a=>y(U).isOpenFormContact=a),success:y(U).isSuccessFormContact,"onUpdate:success":i[4]||(i[4]=a=>y(U).isSuccessFormContact=a)},{fields:Se(()=>{var a;return[l("div",vT,[yT,(a=y(t).contact)!=null&&a.name?(m(),x("div",bT,[l("div",_T,j(y(t).contact.name),1)])):z("",!0),l("div",xT,[l("form",{onSubmit:i[1]||(i[1]=Gt(c=>r(),["prevent"])),class:"space-y-4",tabindex:"-1"},[(m(!0),x(_e,null,Me(y(t).contact.fields,(c,u)=>(m(),oe(rd,{class:"px-0",field:c,key:u,modelValue:c.value,"onUpdate:modelValue":d=>c.value=d},null,8,["field","modelValue","onUpdate:modelValue"]))),128)),l("div",wT,[l("button",{onClick:i[0]||(i[0]=c=>y(U).isOpenFormContact=!1),type:"button",tabindex:"-1",class:"flex items-center justify-center h-12 bg-white hover:bg-gray-100 border border-gray-200 w-full rounded-lg text-gray-600"}," Quay lại "),kT])],32)])])]}),success:Se(()=>[l("div",null,[l("div",ST,[l("div",CT,[G(y(Hu),{"stroke-width":"1",size:"50",class:"text-gray-500"})]),$T]),l("button",{onClick:i[2]||(i[2]=a=>y(U).isSuccessFormContact=!1),class:"p-3 w-full text-sm font-medium text-primary flex items-center justify-center border-t border-t-gray-200 outline-none focus:outline-none"}," Tiếp Tục ")])]),_:1},8,["target","open","success"]))}};function Pl(){var s;const{getStorage:e}=Ks(),t=((s=U.bot)==null?void 0:s.config.apiHost)||U.apiDomain;return{update:async({formData:r,status:o})=>{var u;const i=e("easychatgpt_conversations",U.handle),a=U.forms&&U.forms.order&&U.forms.order.id;if(!a||!i)throw new Error("Missing data: formId or conversationId is required");let{submission_data:c}=await St.post(`${t}/api/bots/${U.handle}/widgets/${a}/submission`,{status:o,conversation_id:i,submission_data:r}).then(d=>d.data);return c?(U.handle!==$s&&(U.isOpenForm=!0),U.selectedForm=c,(!c.items||((u=c.items)==null?void 0:u.length)===0)&&(U.isOpenForm=!1,U.totalFormItems=0),localStorage.setItem(U.localStorageFormOrder,JSON.stringify(c)),{success:!0,data:c}):{success:!1,data:null}}}}const Hg=e=>(mn("data-v-cf69952f"),e=e(),gn(),e),AT={class:"ecg-quantity"},ET=["disabled"],IT=[Hg(()=>l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-minus"},[l("path",{d:"M5 12h14"})],-1))],PT=["min","max","step","disabled"],MT=["disabled"],OT=[Hg(()=>l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-plus"},[l("path",{d:"M5 12h14"}),l("path",{d:"M12 5v14"})],-1))],Wg=Qe({__name:"FieldQuantity",props:Qr({min:{type:Number,default:1},max:{type:Number,default:99},disabled:{type:Boolean,default:!1},step:{type:Number,default:1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Number.isNaN||window.isNaN,n=/^-?(?:\d+|\d+\.\d+|\.\d+)(?:[eE][-+]?\d+)?$/,s=/\.\d*(?:0|9){10}\d*$/,r=(v,_=1e11)=>s.test(String(v))?Math.round(v*_)/_:v,o=e,i=fr(e,"modelValue"),a=R(null),c=Z(()=>t(i.value)||i.value<o.max),u=Z(()=>t(i.value)||i.value>o.min);function d(){if(!u.value)return;let v=i.value;t(v)&&(v=o.min||1),p(r(v-o.step))}function f(){if(!c.value)return;let v=i.value;t(v)&&(v=o.min||1),p(r(v+o.step))}function h(v){p(v.target.value)}function g(v){const _=v.clipboardData||window.clipboardData;_&&!n.test(_.getData("text"))&&v.preventDefault()}function p(v){let _=typeof v!="number"?parseFloat(v):v;t(_)?(_=o.min||1,a.value.value=_):o.min<=o.max&&(_=Math.min(o.max,Math.max(o.min,_))),i.value=_}return(v,_)=>(m(),x("div",AT,[l("button",{type:"button",class:"ecg-quantity__button ecg-quantity__button--minus",disabled:e.disabled||!u.value,onClick:Gt(d,["prevent"])},IT,8,ET),Lt(l("input",{ref_key:"input",ref:a,type:"number",class:"ecg-quantity__input","onUpdate:modelValue":_[0]||(_[0]=w=>i.value=w),min:e.min,max:e.max,step:e.step,autocomplete:"off",disabled:e.disabled||!u.value&&!c.value,onChange:h,onPaste:g,tabindex:"-1"},null,40,PT),[[rn,i.value]]),l("button",{type:"button",class:"ecg-quantity__button ecg-quantity__button--plus",disabled:e.disabled||!c.value,onClick:Gt(f,["prevent"])},OT,8,MT)]))}},[["__scopeId","data-v-cf69952f"]]),LT={class:"flex space-x-2 w-full"},RT=["src","alt"],DT=["src","alt"],jT={class:"flex-1"},NT={class:"flex"},FT={class:"flex-1 mr-1 text-gray-900 text-sm font-medium line-clamp-2"},qT={class:"text-sm font-ligh text-red-500 font-medium"},zT={__name:"CardProductOrder",props:["item"],setup(e){const t=e,n=Py(),s=R(!1),r=Z(()=>{var d;return((d=U.bot)==null?void 0:d.config.ui.logo)||U.appDomain+"/link.png"}),o=R(t.item.quantity),i=Z(()=>Number(t.item.price)*o.value),a=async d=>{let f=U.selectedForm;f&&(f.items.forEach(h=>{h.sku===t.item.sku&&(h.quantity=d)}),f={...f,items:f.items}),Pl().update({formData:f,status:"draft"})},c=async()=>{let d=U.selectedForm;if(d){const f=d.items.filter(h=>{var g,p;return((g=h.sku)==null?void 0:g.toString())!==((p=t.item.sku)==null?void 0:p.toString())});d={...d,items:f}}await Pl().update({formData:d,status:"draft"}),n.contentFormRef&&(n.contentFormRef.style.height="auto")},u=R(null);return Pe(o,d=>{clearTimeout(u.value),a(Number(d))}),(d,f)=>(m(),x("div",LT,[l("div",{class:ne(["w-[90px] flex-shrink-0 h-fit rounded overflow-hidden",(s.value||!e.item.image)&&"aspect-[3/2] flex items-center justify-center border border-gray-100 rounded"])},[e.item.image?(m(),x("img",{key:0,src:e.item.image,alt:e.item.title,class:"w-full h-full object-contain",onError:f[0]||(f[0]=h=>(h.target.src=r.value,h.target.className="max-w-[24px]",s.value=!0))},null,40,RT)):(m(),x("img",{key:1,src:r.value,alt:e.item.title,class:"max-w-[24px] w-full h-full object-contain"},null,8,DT))],2),l("div",jT,[l("div",NT,[l("h3",FT,j(e.item.title),1)]),l("div",null,[l("div",qT,j(y(et)(i.value)),1),G(Wg,{modelValue:o.value,"onUpdate:modelValue":f[1]||(f[1]=h=>o.value=h),class:"mt-1.5"},null,8,["modelValue"])])]),l("div",null,[l("button",{onClick:f[2]||(f[2]=h=>c()),class:"text-gray-400 hover:text-red-400 size-[24px] hover:bg-red-50 flex items-center justify-center rounded"},[G(y(cg),{size:"16"})])])]))}},BT={},UT={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"-0.5 -0.5 16 16","stroke-linecap":"round","stroke-linejoin":"round",stroke:"currentColor",height:"16",width:"16",class:"text-gray-500"},VT=[l("path",{d:"M2.5 13.125h10M3.5412500000000002 8.241875A1.42375 1.42375 0 0 0 3.125 9.248125V11.25h2.014375c0.3775 0 0.739375 -0.15 1.00625 -0.41750000000000004l5.9375 -5.940625000000001a1.42375 1.42375 0 0 0 0 -2.0125l-0.5862499999999999 -0.5874999999999999a1.4231250000000002 1.4231250000000002 0 0 0 -2.01375 0.000625z","stroke-width":"1"},null,-1)];function HT(e,t){return m(),x("svg",UT,VT)}const WT=Qe(BT,[["render",HT]]);function GT(e,t){const n=t.split(":")[0],s=t.split(":")[1]??null;switch(n){case"array":return Array.isArray(e);case"required":return!!e;case"email":const r=/^[\w.!?#$%&'=~|{}`+*^][\w\-.!?#$%&'=~|{}`+*^]*@((xn--)?[\w]+([-][\w]+)*\.)+[a-z]{2,}$/i,o=e&&!e.includes("@gnail")&&!e.includes("@gmai.");return e&&r.test(e)&&o;case"date":return new Date(e)!=="Invalid Date"&&!isNaN(new Date(e));case"string":return typeof e=="string";case"phone":return/^(84|19|0[2|3|5|7|8|9])\d{8}$/g.test(e);case"in":const c=s.split(",");return Array.isArray(e)?e.every(u=>c.includes(u.toString())):e&&c.includes(e.toString());case"integer":return!isNaN(e);case"min":return e.length>=parseInt(s);case"max":return e.length<=parseInt(s);default:return!0}}function Gg(e,t){let n={};for(const s of Object.entries(e))Kg(s[1],t[s[0]])||(n[s[0]]="");return n}function Kg(e,t){if(t===void 0)return!0;let n=!0;for(const s of t.split("|"))if(!GT(e,s)){n=!1;break}return n}const KT={class:"ecg-form-wrapper"},QT=["type"],JT=["type"],XT=["value"],ZT=["value"],YT={key:3,class:"flex items-center space-x-4"},e4={class:"ecg-form-radio"},t4=["id","name","value"],n4=l("div",{class:"checkmark"},null,-1),s4=["for"],r4={key:4,class:"text-xs text-red-500 pl-1 absolute left-0 bottom-0 translate-y-full"},as={__name:"FormField",props:Qr({field:{type:Object,required:!0},classField:{type:[String,Boolean]}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=e,n=fr(e,"modelValue"),s=R(""),r=Z(()=>{var o;return(o=t.field.validate)==null?void 0:o.includes("required")});return Pe(()=>n.value,o=>{let i=`${t.field.label?t.field.label:""} không hợp lệ.`;r.value&&!o&&(i=`${t.field.label?t.field.label:""} là bắt buộc.`);const a=Kg(o,t.field.validate);s.value=a===!0?"":i}),(o,i)=>(m(),x("div",KT,[e.field.type==="tel"||e.field.type==="text"||e.field.type==="email"||e.field.type==="number"?Lt((m(),x("input",wn({key:0,type:e.field.type},{...e.field,placeholder:e.field.label+`${r.value?" *":""}`,autocomplete:"off",required:e.field.validate==="required"},{class:["ecg-form-field",e.classField],tabindex:"-1","onUpdate:modelValue":i[0]||(i[0]=a=>n.value=a)}),null,16,QT)),[[R1,n.value]]):e.field.type==="textarea"?Lt((m(),x("textarea",wn({key:1,type:e.field.type},{...e.field,rows:e.field.rows??3,placeholder:e.field.label+`${r.value?" *":""}`,autocomplete:"off",required:e.field.validate==="required"},{class:["ecg-form-field",e.classField],tabindex:"-1","onUpdate:modelValue":i[1]||(i[1]=a=>n.value=a)}),null,16,JT)),[[rn,n.value]]):e.field.type==="select"?Lt((m(),x("select",{key:n.value,"onUpdate:modelValue":i[2]||(i[2]=a=>n.value=a),class:ne(["ecg-form-field",[n.value?"has-value":"none-value",e.classField]]),tabindex:"-1"},[l("option",{disabled:"",value:n.value===void 0?void 0:""},j(e.field.label),9,XT),(m(!0),x(_e,null,Me(e.field.options,a=>(m(),x("option",{value:e.field.keyValue?a[e.field.keyValue]:a},j(e.field.keyLabel?a[e.field.keyLabel]:a),9,ZT))),256))],2)),[[Nh,n.value]]):e.field.type==="checkbox"?(m(),x("div",YT,[(m(!0),x(_e,null,Me(e.field.options,(a,c)=>(m(),x("div",e4,[Lt(l("input",{type:"radio","onUpdate:modelValue":i[3]||(i[3]=u=>n.value=u),id:`${e.field.name}-${c}`,name:e.field.name,value:a},null,8,t4),[[jh,n.value]]),n4,l("label",{for:`${e.field.name}-${c}`},j(a),9,s4)]))),256))])):z("",!0),s.value?(m(),x("div",r4,j(s.value),1)):z("",!0)]))}},o4={tabindex:"-1",class:"relative pb-4 pt-3 bg-white rounded-t-2xl overflow-hidden outline-none"},i4=l("div",{class:"flex justify-center"},[l("div",{tabindex:"-1",class:"w-10 h-[4px] rounded-full bg-gray-500 cursor-grab"})],-1),a4={class:"pt-2 pb-3 relative"},l4=l("div",{class:"h-[0.5px] w-full bg-gray-100 absolute bottom-0 inset-x-0"},null,-1),c4={class:"px-5 pt-5"},u4={key:0},d4={class:"flex items-center space-x-2"},f4={class:"flex items-center space-x-2"},h4=l("button",{type:"submit",class:"flex items-center justify-center h-11 bg-primary text-white border border-gray-200 w-full rounded-lg"}," Lưu thay đổi ",-1),p4={key:1},m4={class:"max-h-[208px] overflow-y-auto"},g4={class:"mt-5"},v4={key:0,"aria-label":"add-information",class:"py-0.5 flex items-center justify-center"},y4=l("div",{class:"font-medium text-sm text-gray-500 ml-1"}," Thêm địa chỉ ",-1),b4={key:1,class:"flex items-start justify-between"},_4={class:"text-sm text-gray-500 line-clamp-2"},x4={"aria-label":"edit-info"},w4={class:"mt-5 px-1"},k4={class:"flex items-center justify-between"},S4={class:"text-gray-500 mr-2 text-sm"},C4={class:"text-right text-[16px] font-medium"},$4={class:"text-red-500 text-sm"},T4={class:"bg-white z-20 mt-4"},A4=l("div",{class:"text-gray-500 text-[10px] mt-1.5 text-center"}," Nhân viên sẽ gọi tư vấn giá, khuyến mãi chính xác sau khi đặt hàng ",-1),E4={class:"pb-6 pt-2"},I4={class:"text-[32px] flex items-center justify-center rounded-full"},P4=l("div",{class:"text-center mt-3 pl-2"},[l("div",{class:"font-medium text-gray-600 text-[18px]"}," Đặt hàng thành công "),l("div",{class:"text-[14px] text-gray-500 mt-1"}," Chúng tôi sẽ liên hệ với quý khách để xác nhận đơn hàng ")],-1),M4={__name:"FormOrder",props:{chatViewRef:{type:Object}},emits:["send-message"],setup(e,{emit:t}){var g;const n=t,s=((g=U.bot)==null?void 0:g.config.apiHost)||U.apiDomain,r=R(!1),o=R(null),i=Z(()=>{var p,v;return!!((v=(p=U.forms)==null?void 0:p.order)!=null&&v.fields.find(_=>_.name==="gender"||_.label==="Danh xưng"))});Pe(()=>U.forms.order,p=>{p&&U.forms.order.fields.forEach(v=>{v.value=""})}),Pe(()=>U.isOpenForm,p=>{p&&(r.value=!1)});const a=Z(()=>{const{gender:p,full_name:v,phone:_,email:w,address:k}=U.selectedForm;return[p?p+" "+v:v,_,w,k].filter(E=>!!E).join(" | ")}),c=Z(()=>{var v;let p=!1;return U.selectedForm?((v=U.forms.order)==null||v.fields.forEach(_=>{U.selectedForm[_.name]&&(p=!0)}),!p):!1}),u=Z(()=>{var v,_;let p=0;return(_=(v=U.selectedForm)==null?void 0:v.items)==null||_.forEach(w=>{p=p+Number(w.price)*w.quantity}),p}),d=async p=>{await kt();const v=p.offsetHeight;o.value.style.height=v?`${v}px`:"auto"},f=async()=>{var w,k;const p=oo(U.handle);if(!p)return;let v=JSON.parse(localStorage.getItem(U.localStorageFormOrder));v={submission_data:{items:v.items||[]},status:"draft",conversation_id:p},(k=(w=U.forms)==null?void 0:w.order)==null||k.fields.forEach(S=>{v.submission_data[S.name]=S.value});const{submission_data:_}=await St.post(`${s}/api/bots/${U.handle}/widgets/${U.forms.order.id}/submission`,v).then(S=>S.data);_&&(localStorage.setItem(U.localStorageFormOrder,JSON.stringify(_)),U.selectedForm=_,r.value=!1)},h=async()=>{var k,S,E,O,I;const p=oo(U.handle);if(!p)return;let v=JSON.parse(localStorage.getItem(U.localStorageFormOrder));if(v={status:"submitted",conversation_id:p,submission_data:{...v}},await St.post(`${s}/api/bots/${U.handle}/widgets/${(k=U.forms.order)==null?void 0:k.id}/submission`,v).then(P=>P.data)){console.log("formData",v);const{title:P,full_name:M,phone:q,email:B,address:T,items:A}=v.submission_data,D=M||"";if(U.handle===$s){const Q=fw({name:D,phone:q||"",email:B||"",address:T||"",items:A||[],shopName:((S=U.bot)==null?void 0:S.name)||((I=(O=(E=U.bot)==null?void 0:E.config)==null?void 0:O.ui)==null?void 0:I.title)||""});n("send-message",Q)}if(localStorage.removeItem(U.localStorageFormOrder),U.selectedForm=null,U.isOpenForm=!1,U.isSuccessForm=!0,U.totalFormItems=0,U.forms.order.fields)for(var w in U.forms.order.fields)U.forms.order.fields[w].value=""}};return(p,v)=>(m(),oe(Vg,{target:e.chatViewRef,open:y(U).isOpenForm,"onUpdate:open":v[7]||(v[7]=_=>y(U).isOpenForm=_),success:y(U).isSuccessForm,"onUpdate:success":v[8]||(v[8]=_=>y(U).isSuccessForm=_)},{fields:Se(()=>[l("div",o4,[i4,l("div",a4,[G(Yt,{appear:"",mode:"out-in",name:"scale-fade"},{default:Se(()=>[(m(),x("div",{key:r.value,class:"font-medium text-[18px] text-center tracking-wide text-gray-900"},j(r.value?"Thông tin khách hàng":"Giỏ hàng"),1))]),_:1}),l4]),l("div",c4,[l("div",{class:"duration-300",ref_key:"contentFormRef",ref:o},[G(Yt,{appear:"",name:"scale-fade",mode:"out-in",onBeforeEnter:d,onBeforeLeave:d},{default:Se(()=>{var _,w,k;return[(m(),x("div",{key:r.value},[r.value?(m(),x("div",u4,[l("form",{onSubmit:v[3]||(v[3]=Gt(S=>f(),["prevent"])),class:"space-y-[18px]"},[i.value?(m(),x(_e,{key:0},[l("div",d4,[G(as,{classField:"form-field-custom",field:y(U).forms.order.fields[0],modelValue:y(U).forms.order.fields[0].value,"onUpdate:modelValue":v[0]||(v[0]=S=>y(U).forms.order.fields[0].value=S)},null,8,["field","modelValue"]),G(as,{class:"flex-1",field:y(U).forms.order.fields[1],modelValue:y(U).forms.order.fields[1].value,"onUpdate:modelValue":v[1]||(v[1]=S=>y(U).forms.order.fields[1].value=S)},null,8,["field","modelValue"])]),(m(!0),x(_e,null,Me(y(U).forms.order.fields,(S,E)=>(m(),x("div",null,[E>1?(m(),oe(as,{field:S,key:E,modelValue:S.value,"onUpdate:modelValue":O=>S.value=O},null,8,["field","modelValue","onUpdate:modelValue"])):z("",!0)]))),256))],64)):(m(!0),x(_e,{key:1},Me(y(U).forms.order.fields,(S,E)=>(m(),oe(as,{field:S,key:E,modelValue:S.value,"onUpdate:modelValue":O=>S.value=O},null,8,["field","modelValue","onUpdate:modelValue"]))),128)),l("div",f4,[l("button",{type:"button",onClick:v[2]||(v[2]=S=>[r.value=!1]),class:"flex items-center justify-center h-11 bg-white hover:bg-gray-100 border border-gray-200 w-full rounded-lg text-gray-600"}," Quay lại "),h4])],32)])):(m(),x("div",p4,[l("div",m4,[(m(),x("div",{class:"space-y-5",key:(w=(_=y(U).selectedForm)==null?void 0:_.items)==null?void 0:w.length},[(m(!0),x(_e,null,Me(((k=y(U).selectedForm)==null?void 0:k.items)||[],(S,E)=>(m(),oe(zT,{key:E,item:S,contentFormRef:o.value},null,8,["item","contentFormRef"]))),128))]))]),l("div",g4,[l("div",{onClick:v[4]||(v[4]=S=>r.value=!0),class:"relative p-3 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-50 duration-100"},[c.value||!y(U).selectedForm?(m(),x("div",v4,[G(y(R2),{size:"16",class:"text-gray-500"}),y4])):(m(),x("div",b4,[l("div",_4,j(a.value),1),l("button",x4,[G(WT)])]))])]),l("div",w4,[l("div",k4,[l("div",S4," Giá tham khảo ("+j(y(U).totalFormItems)+" sản phẩm) ",1),l("div",C4,[l("div",$4,j(y(et)(u.value)),1)])])]),l("div",T4,[l("div",null,[l("button",{onClick:v[5]||(v[5]=S=>h()),class:ne([c.value?"cursor-not-allowed opacity-90 bg-gray-100 border-gray-200 text-gray-500":"bg-primary border-primary text-white hover:opacity-80 ","flex items-center justify-center h-11 border w-full rounded-lg text-[16px]"])}," Đặt hàng ",2)]),A4])]))]))]}),_:1})],512)])])]),success:Se(()=>[l("div",null,[l("div",E4,[l("div",I4,[G(y(ln),{"stroke-width":"1",size:"50",class:"text-gray-500"})]),P4]),l("button",{onClick:v[6]||(v[6]=_=>y(U).isSuccessForm=!1),class:"p-3 w-full text-sm text-primary flex items-center justify-center bg-white border-t border-t-gray-200"}," Tiếp tục mua sắm ")])]),_:1},8,["target","open","success"]))}},Qg={__name:"Drawer",props:Qr({slotNames:{type:Array,default:()=>[]},chatViewRef:{type:Object,default:()=>null},isNestedOpen:{type:Boolean,default:!1}},{open:{},openModifiers:{}}),emits:["update:open"],setup(e){const t=e,n=fr(e,"open"),s=R(0),r=R(0),o=R(0),i=R(""),a=R(null);Pe(()=>t.isNestedOpen,g=>{g||(a.value.$el.style.transform="unset")});const c=Z(()=>t.slotNames.find(g=>g.active));Pe(c,()=>{s.value=s.value+1});const u=g=>{i.value.style.height=`${r.value}px`},d=g=>{o.value=g.offsetHeight,i.value.style.height=`${g.offsetHeight}px`},f=g=>{i.value&&i.value.style&&(i.value.style.height="auto")},h=g=>{r.value=g.offsetHeight};return(g,p)=>(m(),oe(y(bo),{open:n.value,"onUpdate:open":p[1]||(p[1]=v=>n.value=v),modal:!1,"should-scale-background":!1},{default:Se(()=>[G(y(nr),{to:e.chatViewRef},{default:Se(()=>[l("div",{onClick:p[0]||(p[0]=v=>n.value=!1),class:ne(["drawer-overlay-custom",{"drawer-overlay-custom--open":n.value}])},null,2),G(y(rr),{ref_key:"drawerContentWrapperRef",ref:a,class:"flex overflow-hidden absolute right-0 bottom-0 left-0 z-50 flex-col bg-white rounded-t-2xl outline-none"},{default:Se(()=>[G(y(Tl),{class:"sr-only"},{default:Se(()=>[We("DrawerTitle")]),_:1}),G(y(Al),{class:"sr-only"},{default:Se(()=>[We("DrawerDescription")]),_:1}),l("div",{ref_key:"drawerContentRef",ref:i,class:"content-drawer"},[G(Yt,{onBeforeEnter:u,onEnter:d,onAfterEnter:f,onLeave:h,mode:"out-in",name:"scale-fade"},{default:Se(()=>[(m(),x("div",{key:s.value},[(m(!0),x(_e,null,Me(e.slotNames,(v,_)=>(m(),x(_e,{key:_+v.active},[v.active?It(g.$slots,v.name,{key:0}):z("",!0)],64))),128))]))]),_:3})],512)]),_:3},512)]),_:3},8,["to"])]),_:3},8,["open"]))}},O4=[l("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"#f1f5f9"},null,-1),l("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentColor"},null,-1)],tn={__name:"IconSpinner",props:{color:{type:String,default:"text-primary"}},setup(e){return(t,n)=>(m(),x("svg",{"aria-hidden":"true",role:"status",class:ne(["inline animate-spin",[e.color]]),viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},O4,2))}},L4={class:"flex space-x-3 w-full"},R4={class:"w-[96px] h-[96px] flex-shrink-0 rounded-md overflow-hidden border border-gray-100 flex items-center justify-center"},D4=["src"],j4=["src","alt"],N4={class:"flex-1"},F4={class:"flex flex-1 mr-1 mb-1 w-full text-sm font-medium text-gray-900"},q4={key:0,class:"px-2 py-0.5 mb-1 text-xs text-gray-500 bg-gray-50 rounded w-fit"},z4={class:"flex items-center space-x-1"},B4={class:"text-sm font-semibold text-red-500"},U4={key:0,class:"text-xs text-gray-500"},V4={__name:"CardOrder",props:["item"],setup(e){var u,d;const t=e,n=R(!1),s=((d=(u=U.bot)==null?void 0:u.config)==null?void 0:d.ui.logo)||`${U.appDomain}/link.png`,r=R(null),o=R(t.item.quantity),i=R(!1);Pe(o,()=>{clearTimeout(r.value),r.value=setTimeout(()=>{a()},380)});async function a(){const{data:f}=await Xe.cart.update(t.item.id,{quantity:o.value});f.success&&(U.cart=f.data,ECG.sync.emit("cart",{source:"easy-ai-chat",data:f.data}))}async function c(){try{if(i.value)return;i.value=!0;const{data:f}=await Xe.cart.remove(t.item.id);f.success&&(U.cart=f.data,ECG.sync.emit("cart",{source:"easy-ai-chat",data:f.data}))}catch{}finally{i.value=!1}}return(f,h)=>{var g;return m(),x("div",L4,[l("div",R4,[n.value?(m(),x("img",{key:0,src:y(s),alt:"image error",class:"w-[32px] h-[32px] object-cover"},null,8,D4)):(m(),x("img",{key:1,src:e.item.image,alt:e.item.name,class:"object-contain w-full h-full",onError:h[0]||(h[0]=p=>n.value=!0)},null,40,j4))]),l("div",N4,[l("h3",F4,j(e.item.name),1),(g=e.item.properties)!=null&&g.title?(m(),x("div",q4,j(e.item.properties.title),1)):z("",!0),l("div",null,[l("div",z4,[l("div",B4,j(y(et)(e.item.price)),1),e.item.compare_at_price>e.item.price?(m(),x("del",U4,j(y(et)(e.item.compare_at_price)),1)):z("",!0)]),G(Wg,{modelValue:o.value,"onUpdate:modelValue":h[1]||(h[1]=p=>o.value=p),class:"mt-1.5"},null,8,["modelValue"])])]),l("div",null,[l("button",{onClick:h[2]||(h[2]=p=>c()),class:ne([i.value?"bg-red-50 ":"hover:text-red-400 hover:bg-red-50 ","text-gray-400 size-[24px] flex items-center justify-center rounded-full"])},[i.value?(m(),oe(tn,{key:0,class:"max-w-[16px] h-[16px] !text-red-500"})):(m(),oe(y(cg),{key:1,size:"16"}))],2)])])}}},H4={},W4={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},G4=[l("path",{d:"m15 18-6-6 6-6"},null,-1)];function K4(e,t){return m(),x("svg",W4,G4)}const Jg=Qe(H4,[["render",K4]]),Q4={},J4={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},X4=[l("circle",{cx:"12",cy:"12",r:"10"},null,-1),l("path",{d:"M12 16v-4"},null,-1),l("path",{d:"M12 8h.01"},null,-1)];function Z4(e,t){return m(),x("svg",J4,X4)}const Ml=Qe(Q4,[["render",Z4]]),Y4=e=>(mn("data-v-61c5fc1a"),e=e(),gn(),e),e6={class:"relative pb-4 pt-5 bg-white rounded-t-2xl overflow-hidden outline-none"},t6={class:"relative text-center mb-4"},n6={class:"font-semibold text-gray-900 text-lg"},s6=["placeholder"],r6={key:0,class:"text-red-500 flex items-center mt-2 space-x-1"},o6={class:"text-xs"},i6={class:"text-sm text-gray-900"},a6={type:"submit",class:"flex items-center justify-center h-12 w-full rounded-lg text-base bg-primary text-white hover:opacity-80 font-medium"},l6={key:0,class:"absolute left-1/2 -translate-x-1/2 top-1/3"},c6={class:"px-5 py-4 bg-red-50 rounded-xl relative fade-in"},u6={class:"text-center text-sm font-medium text-red-500"},d6=[Y4(()=>l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"max-w-[14px]"},[l("path",{d:"M18 6 6 18"}),l("path",{d:"m6 6 12 12"})],-1))],Xg=Qe({__name:"AuthLogin",emits:["success","error"],setup(e,{emit:t}){const{t:n}=en(),s=t,r=dt({identifier:"",type:"phone"}),o={identifier:"required|phone"},i=R(!1),a=R(!1),c=R(null),u=R(null);Pe(()=>r.identifier,f=>{f&&(i.value=!1,u.value=null,c.value=null)});const d=async()=>{var f,h;try{const g=Gg(r,o);if(i.value=Object.keys(g).length>0,i.value||a.value)return;a.value=!0;const{data:p}=await Xe.auth.login(r);p&&p.success?s("success",{form:r}):(i.value=!0,p.message==="otp_service_under_maintenance"?u.value=n("auth.otpMaintenance"):u.value=n("auth.invalidPhone"))}catch(g){console.log(g),c.value=(h=(f=g.response)==null?void 0:f.data)==null?void 0:h.message,s("error",{form:r})}finally{a.value=!1}};return(f,h)=>(m(),x("div",e6,[l("div",t6,[l("div",n6,j(y(n)("auth.login")),1)]),l("form",{onSubmit:h[1]||(h[1]=Gt(g=>d(),["prevent"])),class:"px-6 space-y-4"},[l("div",null,[Lt(l("input",{type:"tel","onUpdate:modelValue":h[0]||(h[0]=g=>r.identifier=g),placeholder:y(n)("auth.phonePlaceholder"),class:"ecg-form-field !h-12"},null,8,s6),[[rn,r.identifier]]),i.value?(m(),x("div",r6,[G(Ml),l("div",o6,j(u.value??y(n)("auth.requiredField")),1)])):z("",!0)]),l("p",i6,j(y(n)("auth.otpHint")),1),l("button",a6,[a.value?(m(),oe(tn,{key:0,class:"mr-1 w-4 h-4"})):z("",!0),l("div",null,j(y(n)("auth.continue")),1)])],32),c.value?(m(),x("div",l6,[l("div",c6,[l("div",u6,[l("div",null,j(y(n)("auth.genericError")),1)]),l("button",{onClick:h[2]||(h[2]=g=>c.value=null),class:"size-5 text-red-500 rounded-full absolute -top-1 -right-1 bg-red-100 hover:bg-red-200 flex items-center justify-center z-10"},d6)])])):z("",!0)]))}},[["__scopeId","data-v-61c5fc1a"]]),hd=e=>(mn("data-v-ca9c6389"),e=e(),gn(),e),f6={class:"relative pb-4 pt-4 bg-white rounded-t-2xl overflow-hidden outline-none"},h6=hd(()=>l("div",{class:"relative text-center mb-4"},[l("div",{class:"font-semibold text-gray-900 text-lg"}," Nhập mã xác minh ")],-1)),p6={class:"px-6 space-y-4"},m6={class:"text-sm text-gray-900"},g6=hd(()=>l("br",null,null,-1)),v6={key:0,class:"ecg-fieldset-error text-red-500 flex items-center mt-2 space-x-1"},y6={class:"text-xs font-medium"},b6={type:"submit",form:"ecg-form-verify-otp",class:"flex items-center justify-center h-12 w-full rounded-lg text-base bg-primary text-white hover:opacity-80 font-medium !mt-6"},_6=hd(()=>l("div",null,"Xác minh",-1)),Zg=Qe({__name:"AuthVerifyOtp",props:["identifier"],emits:["success","error"],setup(e,{emit:t}){const n=e,s=t,r=dt({identifier:n.identifier,code:""}),o=R(!1),i=R(!1),a=R(null);R(null),R(null);const c=async()=>{var d,f;try{const{data:h}=await Xe.auth.getUser();h.success&&(U.user=h.data)}catch(h){((f=(d=h.response.data)==null?void 0:d.raw)==null?void 0:f.message)==="error_token_is_expired"&&(U.user=null,U.token=null,Tt.remove(ss))}},u=async()=>{try{if(o.value=r.code.length<6,o.value||i.value)return;i.value=!0;const{data:d}=await Xe.auth.verifyOtp(r);d.success&&(Tt.set(ss,d.data.access_token,"14d"),ECG.sync.emit("login",{source:"easy-ai-chat",data:d.data}),c(),s("success",{form:r}),r.code="",r.identifier="",Xe.cart.getList())}catch{o.value=!0,a.value="Mã xác thực không hợp lệ. Vui lòng kiểm tra lại"}finally{i.value=!1}};return(d,f)=>(m(),x("div",f6,[h6,l("div",p6,[l("div",null,[l("p",m6,[We(" Nhập mã xác minh gồm 6 số vừa được gửi đến "),g6,We(" SĐT "),l("strong",null,j(r.identifier),1),We(" của bạn. ")])]),l("div",null,[l("form",{onSubmit:f[1]||(f[1]=Gt(h=>u(),["prevent"])),id:"ecg-form-verify-otp"},[Lt(l("input",{type:"number","onUpdate:modelValue":f[0]||(f[0]=h=>r.code=h),placeholder:"Nhập mã xác thực",class:"ecg-form-field !h-12"},null,512),[[rn,r.code]])],32),o.value?(m(),x("div",v6,[G(Ml),l("div",y6,j(a.value),1)])):z("",!0)]),l("button",b6,[i.value?(m(),oe(tn,{key:0,class:"mr-1 w-4 h-4"})):z("",!0),_6])])]))}},[["__scopeId","data-v-ca9c6389"]]),x6={},w6={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-ticket-percent"},k6=[l("path",{d:"M2 9a3 3 0 1 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 1 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z"},null,-1),l("path",{d:"M9 9h.01"},null,-1),l("path",{d:"m15 9-6 6"},null,-1),l("path",{d:"M15 15h.01"},null,-1)];function S6(e,t){return m(),x("svg",w6,k6)}const Ol=Qe(x6,[["render",S6]]),C6={},$6={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},T6=[l("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)];function A6(e,t){return m(),x("svg",$6,T6)}const _o=Qe(C6,[["render",A6]]),E6={class:"flex items-center rounded h-[110px] w-full"},I6=["src","alt"],P6={key:2,class:"absolute inset-0 bg-primary opacity-10"},M6={key:0,class:"absolute inset-0 bg-primary opacity-10"},O6={class:"flex flex-col relative z-10 h-full"},L6={class:"flex items-start"},R6={class:"font-medium text-sm text-gray-900 flex-1"},D6={class:"mt-auto flex md:items-center md:flex-row flex-col md:space-y-0 space-y-1"},j6={class:"text-xs text-gray-500 tracking-tight"},N6={__name:"CardCoupon",props:{isActive:{type:Boolean,default:!1},coupon:{type:Object,default:!1},loading:{type:Boolean,default:!1}},emits:["remove","apply",",onViewDetail"],setup(e,{emit:t}){const n=t;return(s,r)=>(m(),x("div",E6,[l("div",{class:ne(["p-2 rounded-lg border border-r-0 w-[110px] h-full flex-shrink-0 flex items-center justify-center relative",e.isActive?"border-primary":"border-gray-200"])},[e.coupon.image?(m(),x("img",{key:0,src:e.coupon.image,alt:e.coupon.title,class:"w-full h-full object-cover rounded-lg relative z-10"},null,8,I6)):(m(),oe(Ol,{key:1,class:"text-gray-500 scale-125 relative z-10"})),e.isActive?(m(),x("div",P6)):z("",!0)],2),l("div",{class:ne(["border-r border-dashed h-[100px] flex-shrink-0",e.isActive?"border-primary":"border-gray-200"])},null,2),l("div",{class:ne(["flex-1 p-3 border border-l-0 rounded-lg h-full relative overflow-hidden",e.isActive?"border-primary":"border-gray-200"])},[e.isActive?(m(),x("div",M6)):z("",!0),l("div",O6,[l("div",L6,[l("div",R6,j(e.coupon.title),1),l("button",{class:"w-6 h-6 flex items-center justify-center rounded-md text-primary",onClick:r[0]||(r[0]=o=>n("onViewDetail",e.coupon))},[G(Ml)])]),l("div",D6,[l("div",j6," HSD: "+j(e.coupon.started_at)+"-"+j(e.coupon.ended_at),1),l("button",{onClick:r[1]||(r[1]=o=>e.isActive?n("remove",e.coupon.code):n("apply",e.coupon.code)),class:"px-[8px] w-full md:w-fit py-[6px] text-xs text-white bg-primary rounded-md font-medium flex items-center justify-center ml-auto"},[e.loading?(m(),oe(tn,{key:0,class:"w-3 mr-1"})):z("",!0),We(" "+j(e.isActive?"Bỏ chọn":"Áp dụng"),1)])])])],2)]))}},F6={},q6={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},z6=[l("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"},null,-1),l("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"},null,-1)];function B6(e,t){return m(),x("svg",q6,z6)}const U6=Qe(F6,[["render",B6]]);function V6(e=2e3){const t=R(!1),n=R(null),s=async i=>{if(navigator.clipboard)try{return await navigator.clipboard.writeText(i),o(),!0}catch(a){return console.error("Failed to copy:",a),r(i)}else return r(i)},r=i=>{try{const a=document.createElement("textarea");a.value=i,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",document.body.appendChild(a),a.focus(),a.select();const c=document.execCommand("copy");return document.body.removeChild(a),c?(o(),!0):!1}catch(a){return console.error("Fallback: Failed to copy:",a),!1}},o=()=>{t.value=!0,n.value&&clearTimeout(n.value),n.value=setTimeout(()=>{t.value=!1},e)};return Zn(()=>{n.value&&clearTimeout(n.value)}),{copied:t,copy:s}}const H6={class:"flex flex-col bg-white rounded-t-3xl h-full pt-5"},W6=l("div",{class:"w-[38px] h-[6px] rounded-full bg-gray-400 cursor-grab mx-auto mb-5"},null,-1),G6={class:"font-semibold text-gray-900 text-xl text-center px-4 mb-6"},K6={class:"relative group"},Q6={class:"flex items-center text-sm px-4 py-3 bg-gray-50 relative z-10"},J6=l("div",{class:"w-[33%] text-gray-500"},"Mã",-1),X6={class:"flex-1 flex items-center"},Z6={class:"text-gray-700 mr-2"},Y6=[l("div",{class:"text-sm text-green-700 px-4 h-11 flex items-center justify-center rounded-lg bg-green-100 whitespace-nowrap"}," Sao chép mã thành công ",-1)],e8={class:"flex text-sm px-4 py-3 bg-white"},t8=l("div",{class:"w-[33%] text-gray-500"},"Hạn sử dụng",-1),n8={class:"flex-1 text-gray-700"},s8={class:"px-4 py-3 bg-gray-50"},r8=l("div",{class:"text-sm mb-3 text-gray-500"},"Điều kiện",-1),o8=["innerHTML"],i8={class:"py-3 px-4 bg-white"},a8={__name:"CouponDetail",props:{coupon:{type:Object},active:{type:Boolean,default:!1}},emits:["apply","remove"],setup(e,{emit:t}){const n=t,{copied:s,copy:r}=V6();return(o,i)=>(m(),x("div",H6,[W6,l("div",G6,j(e.coupon.title),1),l("div",K6,[l("div",Q6,[J6,l("div",X6,[l("div",Z6,j(e.coupon.code),1),l("button",{onClick:i[0]||(i[0]=a=>y(r)(e.coupon.code)),class:"h-[24px] w-[24px] flex items-center justify-center text-blue-600 bg-blue-50 rounded-full overflow-hidden"},[G(U6)])])]),l("div",{class:ne([y(s)?"translate-y-full ":"translate-y-0","absolute left-1/2 -translate-x-1/2 bottom-0 duration-200"])},Y6,2)]),l("div",e8,[t8,l("div",n8,j(e.coupon.started_at)+" - "+j(e.coupon.ended_at),1)]),l("div",s8,[r8,l("div",{class:"max-h-[132px] overflow-y-auto prose coupon-detail-desc",innerHTML:e.coupon.description},null,8,o8)]),l("div",i8,[l("button",{onClick:i[1]||(i[1]=a=>e.active?n("remove",e.coupon.code):n("apply",e.coupon.code)),class:"flex items-center justify-center h-12 w-full rounded-lg text-base bg-primary text-white hover:opacity-80 font-medium"},j(e.active?"Bỏ chọn":"Áp dụng"),1)])]))}},l8={class:"flex space-x-2 w-full"},c8={class:"w-[86px] h-[86px] flex-shrink-0 rounded-xl overflow-hidden border border-gray-100 flex items-center justify-center"},u8=["src"],d8=["src","alt"],f8={class:"flex-1"},h8={class:"text-gray-700 font-medium text-sm line-clamp-2 mb-2"},p8={class:"flex items-center space-x-4"},m8={class:"text-sm text-red-500 font-medium"},g8={key:0,class:"text-sm text-gray-500 0 font-light ml-2"},v8={class:"text-sm text-gray-500 ml-auto"},Ll={__name:"CardProductCheckout",props:["item"],setup(e){var s,r;const t=((r=(s=U.bot)==null?void 0:s.config)==null?void 0:r.ui.logo)||`${U.appDomain}/link.png`,n=R(!1);return(o,i)=>(m(),x("div",l8,[l("div",c8,[n.value?(m(),x("img",{key:0,src:y(t),alt:"image error",class:"w-[28px] h-[28px]"},null,8,u8)):(m(),x("img",{key:1,src:e.item.image,alt:e.item.name,class:"w-full h-full object-contain",onError:i[0]||(i[0]=a=>n.value=!0)},null,40,d8))]),l("div",f8,[l("h3",h8,j(e.item.name),1),l("div",p8,[l("div",null,[l("span",m8,j(y(et)(Number(e.item.price))),1),e.item.compare_at_price>e.item.price?(m(),x("del",g8,j(y(et)(Number(e.item.compare_at_price))),1)):z("",!0)]),l("div",v8," x"+j(e.item.quantity),1)])])]))}},y8={class:"flex items-center rounded h-[60px]"},b8=["src","alt"],_8={key:2,class:"absolute inset-0 bg-primary opacity-10"},x8={key:0,class:"absolute inset-0 bg-primary opacity-10"},w8={class:"flex items-center relative"},k8={class:"font-medium text-sm text-gray-900 flex-1 line-clamp-1"},S8={__name:"CardCouponActive",props:{isActive:{type:Boolean,default:!1},coupon:{type:Object,default:!1},loading:{type:Boolean,default:!1}},emits:["remove","apply",",onViewDetail"],setup(e,{emit:t}){const n=t;return(s,r)=>(m(),x("div",y8,[l("div",{class:ne(["p-2 rounded-lg border border-r-0 w-[60px] h-full flex-shrink-0 flex items-center justify-center relative",e.isActive?"border-primary":"border-gray-200"])},[e.coupon.image?(m(),x("img",{key:0,src:e.coupon.image,alt:e.coupon.title,class:"w-full h-full object-cover rounded-lg relative z-10"},null,8,b8)):(m(),oe(Ol,{key:1,class:"text-primary scale-125 relative z-10 w-4"})),e.isActive?(m(),x("div",_8)):z("",!0)],2),l("div",{class:ne(["border-r border-dashed h-[48px] flex-shrink-0",e.isActive?"border-primary":"border-gray-200"])},null,2),l("div",{class:ne(["flex-1 p-3 border border-l-0 rounded-lg h-full relative overflow-hidden",e.isActive?"border-primary":"border-gray-200"])},[e.isActive?(m(),x("div",x8)):z("",!0),l("div",w8,[l("div",k8,j(e.coupon.title),1),l("button",{class:"w-8 h-8 flex items-center justify-center rounded-md text-primary mr-1 cursor-pointer",onClick:r[0]||(r[0]=o=>n("onViewDetail",e.coupon))},[G(Ml)]),l("button",{onClick:r[1]||(r[1]=o=>n("remove",e.coupon.code)),class:"px-[12px] w-fit py-[6px] text-xs text-white bg-primary rounded-md font-medium flex items-center justify-center ml-auto"},[e.loading?(m(),oe(tn,{key:0,class:"w-3 mr-1"})):z("",!0),We(" Bỏ chọn ")])])],2)]))}},C8={class:"py-4"},$8={class:"mb-2 space-y-3"},T8=l("div",{class:"w-[36px] h-[6px] rounded-full bg-gray-500 cursor-grab mx-auto"},null,-1),A8={key:0,class:"font-medium text-xl text-center text-gray-900"},E8={key:0,class:"px-5"},I8={class:"max-h-[320px] pt-4 overflow-y-auto scroll-hidden relative"},P8={class:"space-y-5"},M8={class:"pt-3 px-1"},O8={class:"flex items-center justify-between"},L8={class:"text-gray-500 mr-2 text-sm"},R8={class:"text-right text-base"},D8={class:"text-gray-900 text-sm"},j8={key:0,class:"flex items-center justify-between"},N8=l("div",{class:"text-gray-500 mr-2 text-sm"}," Khuyến mãi ",-1),F8={class:"text-right text-base"},q8={class:"text-green-500 text-sm"},z8={class:"flex items-center justify-between mt-2"},B8=l("div",{class:"text-gray-500 mr-2 text-sm"},[l("span",{class:"font-medium text-gray-900"},"Tổng cộng"),l("span",{class:"text-xs ml-1"},"(Đã bao gồm VAT)")],-1),U8={class:"text-right text-[16px] font-medium"},V8={class:"text-red-500 text-sm"},H8={class:"bg-white z-20 mt-4"},W8={key:1,class:"px-5 pt-4"},G8=l("div",{class:"flex flex-col items-center justify-center space-y-2 py-2"},[l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",class:"text-gray-500"},[l("circle",{cx:"8",cy:"21",r:"1"}),l("circle",{cx:"19",cy:"21",r:"1"}),l("path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"})]),l("div",{class:"text-lg font-semibold text-gray-700"}," Giỏ hàng trống "),l("div",{class:"text-sm text-gray-700"}," Chưa có sản phẩm nào trong giỏ hàng của bạn. ")],-1),K8=l("div",{class:"mb-5 space-y-3 relative"},[l("div",{class:"w-[36px] h-[6px] rounded-full bg-gray-500 cursor-grab mx-auto"}),l("div",{class:"font-medium text-xl text-center text-gray-900"}," Xác nhận đơn hàng ")],-1),Q8={class:"px-6 space-y-4 max-h-[520px] overflow-y-scroll scroll-hidden"},J8={key:0,class:"border border-gray-200 rounded-xl"},X8={class:"flex items-center justify-between px-3 py-2 border-b"},Z8=l("div",{class:"font-semibold text-gray-700"}," Thông tin người nhận ",-1),Y8={class:"px-3 py-4"},eA={class:"space-y-1"},tA={class:"text-sm text-gray-700 font-medium"},nA={key:0,class:"text-sm text-gray-700 font-medium"},sA={class:"text-sm text-gray-700"},rA=[l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[l("circle",{cx:"12",cy:"12",r:"10"}),l("path",{d:"M8 12h8"}),l("path",{d:"M12 8v8"})],-1),l("div",null,"Thêm địa chỉ",-1)],oA={class:"w-full"},iA=l("label",{for:"order-email",class:"block text-sm font-medium text-gray-700 mb-1 pl-1"}," Email ",-1),aA={class:"w-full"},lA=l("label",{for:"order-notes",class:"block text-sm font-medium text-gray-700 mb-1 pl-1"}," Ghi chú ",-1),cA={class:"border border-gray-200 rounded-xl"},uA=l("div",{class:"flex items-center justify-between px-3 py-2 border-b"},[l("div",{class:"font-semibold text-gray-700"}," Hình thức thanh toán ")],-1),dA={class:"py-4 px-3"},fA={class:"flex space-x-2"},hA=l("div",{class:"text-sm text-gray-600"}," Thanh toán tiền mặt (COD) ",-1),pA={class:"border border-gray-200 rounded-xl"},mA={class:"flex items-center justify-between mb-2.5 px-3 py-2 border-b border-b-gray-200"},gA=l("div",{class:"flex items-center space-x-1"},[l("div",{class:"font-semibold text-gray-700"}," Tóm tắt đơn hàng ")],-1),vA={class:"space-y-3 pt-1 pb-3 px-3"},yA={key:0,class:"px-3 pb-3 pt-1"},bA={class:"px-3 pb-3 pt-1"},_A={class:"flex items-center justify-between"},xA={class:"text-gray-500 mr-2 text-sm"},wA={class:"text-right text-base"},kA={class:"text-gray-700 text-sm"},SA={key:0,class:"flex items-center justify-between"},CA=l("div",{class:"text-gray-500 mr-2 text-sm"}," Khuyến mãi ",-1),$A={class:"text-right text-base"},TA={class:"text-green-500 text-sm"},AA={class:"flex items-center justify-between"},EA=l("div",{class:"text-gray-500 mr-2 text-sm"}," Phí vận chuyển ",-1),IA={class:"text-right text-base"},PA={class:"text-gray-700 text-sm"},MA={class:"flex items-center justify-between mt-2"},OA=l("div",{class:"text-gray-500 mr-2 text-sm"},[l("span",{class:"font-medium text-gray-900"},"Tổng cộng"),We(" (Đã bao gồm VAT) ")],-1),LA={class:"text-right text-[16px] font-medium"},RA={class:"text-red-500 text-sm"},DA=l("span",{class:"text-sm text-gray-900"},"Khuyến mãi",-1),jA={class:"flex items-center ml-auto"},NA=l("span",{class:"text-sm text-gray-400 tracking-tight"},"Chọn mã",-1),FA=l("span",null,"Đặt mua",-1),qA=l("div",{class:"w-[36px] h-[6px] rounded-full bg-gray-500 cursor-grab mx-auto"},null,-1),zA={class:"text-[20px] font-semibold text-gray-900 h-12 flex items-center justify-center"},BA={class:"space-y-3 h-[calc(100%-56px)] overflow-y-auto px-6 relative"},UA={key:0,class:"h-full flex flex-col justify-between"},VA={key:0,class:"absolute top-[46%] -translate-y-1/2 right-[3px] z-10"},HA={key:0,class:"absolute top-[46%] -translate-y-1/2 right-[3px] z-10"},WA={class:"flex items-center justify-between bg-white space-x-2 sticky bottom-0 inset-x-0 py-3"},GA={form:"form-submit-new-address",type:"submit",class:"py-[10px] bg-primary text-white rounded-lg flex-1 flex items-center justify-center"},KA=l("span",null,"Lưu thay đổi",-1),QA={key:1,class:"flex flex-col justify-between h-full space-y-3"},JA={class:"space-y-1 px-4 pt-3 pb-2"},XA={class:"flex items-center justify-between"},ZA={class:"text-sm"},YA={key:0,class:"text-xs text-green-500"},eE={class:"text-sm"},tE=l("span",{class:"text-gray-500 mr-1"}," Điện thoại: ",-1),nE={class:"text-gray-900"},sE={class:"text-sm"},rE=l("span",{class:"text-gray-500 mr-1"}," Địa chỉ: ",-1),oE={class:"text-gray-900"},iE={class:"border-t px-4 py-2"},aE=["onClick"],lE={class:"flex items-center justify-between bg-white sticky bottom-0 inset-x-0 py-3 space-x-2"},cE={class:"flex flex-col px-4 pb-3 pt-6 bg-white h-full"},uE=l("div",{class:"font-semibold text-gray-900 text-xl text-center mb-4"}," Khuyến mãi ",-1),dE={class:"mb-4"},fE={class:"flex items-center space-x-2"},hE={class:"relative flex-1"},pE=l("span",null,"Áp dụng",-1),mE={key:0,class:"text-xs text-red-500 mt-1"},gE={class:"flex-1 relative"},vE={class:"space-y-4 overflow-y-auto scroll-hidden absolute inset-0 h-full"},yE={class:"sticky bottom-0 z-10 pt-3"},bE={key:0,class:"px-6 pt-5 pb-4 bg-white rounded-t-2xl"},_E={class:"relative max-h-[520px] overflow-y-scroll scroll-hidden space-y-4"},xE=l("div",{class:"sticky top-0 z-10 bg-white pb-1"},[l("div",{class:"w-9 h-[6px] rounded-full bg-gray-500 mx-auto cursor-grab mb-3"}),l("div",{class:"text-center mt-1 font-medium text-gray-900 text-lg"}," Đặt hàng thành công ")],-1),wE={key:0,class:"rounded-xl border border-gray-200"},kE=l("div",{class:"py-2 px-4 text-base font-medium text-gray-900 border-b border-b-gray-200"}," Thông tin người nhận ",-1),SE={class:"p-4 space-y-2"},CE={class:"flex space-x-3"},$E={key:0,class:"text-sm text-gray-700 w-[120px] flex-shrink-0"},TE={class:"text-sm text-gray-700 font-medium"},AE={key:0,class:"flex space-x-3"},EE=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Số điện thoại ",-1),IE={class:"text-sm text-gray-700 font-medium"},PE={class:"flex space-x-3"},ME=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Địa chỉ nhận hàng ",-1),OE={class:"text-sm text-gray-700 font-medium"},LE={class:"rounded-xl border border-gray-200"},RE=l("div",{class:"py-2 px-4 text-base font-medium text-gray-900 border-b border-b-gray-200"}," Thông tin đơn hàng ",-1),DE={class:"p-4 space-y-2"},jE={class:"flex space-x-3"},NE=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Mã đơn hàng ",-1),FE={class:"text-sm text-gray-700 font-medium"},qE=l("div",{class:"flex space-x-3"},[l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Phương thức thanh toán "),l("div",{class:"text-sm text-gray-700 font-medium"}," Thanh toán tiền mặt khi nhận hàng (COD) ")],-1),zE={key:0,class:"flex space-x-3"},BE=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Ghi chú đơn ",-1),UE={class:"text-sm text-gray-700 font-medium"},VE={key:0,class:"font-semibold text-gray-700 mb-3"},HE={key:1,class:"space-y-3 mb-4 border-b border-b-gray-200 pb-4"},WE={class:"flex items-center justify-between"},GE=l("div",{class:"text-gray-500 mr-2 text-sm"}," Tổng tiền hàng ",-1),KE={class:"text-right text-[16px] font-medium"},QE={class:"text-gray-700 text-sm"},JE={key:0,class:"flex items-center justify-between"},XE=l("div",{class:"text-gray-500 mr-2 text-sm"}," Phí vận chuyển ",-1),ZE={class:"text-right text-base"},YE={class:"text-gray-700 text-sm"},eI={key:1,class:"flex items-center justify-between"},tI=l("div",{class:"text-gray-500 mr-2 text-sm"}," Khuyến mãi ",-1),nI={class:"text-right text-[16px] font-medium"},sI={class:"text-green-500 text-sm"},rI={class:"flex items-center justify-between mt-2"},oI=l("div",{class:"text-gray-500 mr-2 text-sm"},[l("span",{class:"font-medium text-gray-900"},"Tổng cộng"),We(" (Đã bao gồm VAT) ")],-1),iI={class:"text-red-500 text-base font-semibold"},aI={class:"sticky bottom-0 pt-2 bg-white"},lI={__name:"FlowCheckout",props:Qr(["chatViewRef"],{open:{},openModifiers:{}}),emits:["update:open"],setup(e){const t=fr(e,"open"),n=R([]),s=R(null),r=R(null),o=R(0),i=R(!1),a=dt({first_name:"",last_name:"",phone:"",note:"",address:"",province_name:"",province_code:"",district_name:"",district_code:"",ward_name:"",ward_code:"",type:"home",is_default:!1,postal_code:""}),c={phone:"required|phone"},u=R(!1),d=R(!1),f=R(""),h=R(""),g=Z(()=>U.user&&!i.value?[{name:"cart",active:o.value===0},{name:"checkout",active:o.value===1},{name:"success",active:o.value===2}]:[{name:"cart",active:o.value===0},{name:"phone",active:o.value===1},{name:"otp",active:o.value===2},{name:"checkout",active:o.value===3},{name:"success",active:o.value===4},{name:"orders",active:o.value===5},{name:"order-detail",active:o.value===6}]);Pe(t,Y=>{o.value=0,Y&&(i.value=!U.user)});const p=R(null),v=R(!1),_=R(!1),w=async()=>{const{data:Y}=await Xe.cart.getList();Y.success&&(U.cart=Y.data)},k=Y=>{if(g.value.length-1===o.value)return;const L=g.value.findIndex(V=>V.name===Y);if(L!==-1){o.value=L;return}o.value=o.value+1},S=Y=>{if(o.value===0)return;const L=g.value.findIndex(V=>V.name===Y);if(L!==-1){o.value=L;return}o.value=o.value-1},E=R(null),O=R(null),I=async()=>{var Y,L,V;try{const ie=oo(U.handle);if(!((Y=U.forms.order)!=null&&Y.id)||!ie)return;const me={male:"Nam",female:"Nữ"},de=(V=(L=U.cart)==null?void 0:L.items)==null?void 0:V.map(he=>({...he,sku:he.product_sku,title:he.title??he.name})),ve={status:"submitted",conversation_id:ie,submission_data:{title:me[U.user.gender]??"Khác",full_name:s.value.name,phone:s.value.phone,email:s.value.email??h.value,address:`${s.value.address} ${s.value.ward_name}, ${s.value.district_name}, ${s.value.province_name}`,note:f.value,items:de}};await Xe.submission.add({formId:U.forms.order.id,formData:ve})}catch(ie){console.log(ie)}},P=async()=>{try{if(v.value)return;O.value=null,v.value=!0;const{data:Y}=await Xe.order.checkout({cart_token:U.cart.token,note:f.value,email:h.value,shipping_address_id:s.value.id});Y.success&&(p.value=Y.data,k(),w(),I())}catch{}finally{v.value=!1,h.value="",f.value=""}},M=async()=>{if(!Tt.get(ss))return;const{data:L}=await Xe.address.getList();L.success&&(n.value=L.data||[],s.value=n.value.find(V=>!!V.is_default)??n.value[0])},q=dt({district:!1,ward:!1}),B=R([]),T=R([]),A=R([]),D=async()=>{const{data:Y}=await Xe.location.provinces();Y.success&&Y.data&&(B.value=Object.values(Y.data))},Q=async Y=>{q.district=!0;const{data:L}=await Xe.location.districts(Y);L.success&&L.data&&(T.value=Object.values(L.data)),q.district=!1},W=async Y=>{q.ward=!0;const{data:L}=await Xe.location.wards(Y);L.success&&L.data&&(A.value=Object.values(L.data)),q.ward=!1};Pe(()=>a.province_code,Y=>{var L,V;a.district_code="",T.value=[],a.ward_code="",A.value=[],Y&&(a.province_name=(V=(L=B.value)==null?void 0:L.find(ie=>ie.code.toString()===Y.toString()))==null?void 0:V.name,Q(Y))}),Pe(()=>a.district_code,Y=>{var L;a.ward_code="",A.value=[],Y&&(a.district_name=(L=T.value.find(V=>V.code===Y))==null?void 0:L.name,W(Y))}),Pe(()=>a.ward_code,Y=>{var L;Y&&(a.ward_name=(L=A.value.find(V=>V.code===Y))==null?void 0:L.name)});const H=()=>{for(const Y in a)switch(Y){case"is_default":a[Y]=!0;break;case"type":a[Y]="home";break;default:a[Y]="";break}},K=()=>{d.value=!1,u.value=!1,H()},J=async()=>{try{const Y=Gg(a,c);if(_.value)return;_.value=!0,a.phone=a.phone.toString();const{data:L}=await Xe.address.create(a);L.success&&(s.value=L.data,n.value.push(L.data),d.value=!1,u.value=!1,H())}catch(Y){console.log("error: ",Y)}finally{_.value=!1}},te=async(Y={})=>{try{if(Object.keys(Y).length===0)return;const{province_code:L,province_name:V,district_code:ie,district_name:me,ward_code:de,ward_name:ve,name:he,phone:Te,email:je,address:De}=Y,Ie={name:he??"",phone:Te??"",email:je??"",address1:De,province:V,province_code:L,district:me,district_code:ie,ward:ve,ward_code:de},{data:He}=await Xe.order.checkShipping({address:Ie});He.success&&(U.cart=He.data)}catch{}};Pe(s,Y=>{Y&&te(Y)},{immediate:!0});const ge=Y=>{k(),E.value=Y.form.identifier},ue=Y=>{k(),M(),w()},we=R("");R("");const Ee=R(!1),re=R(!1),pe=R(null),fe=R([]),$e=R(!1),Re=dt({}),Le=Z(()=>{var Y,L;return(L=(Y=U.cart)==null?void 0:Y.coupon)==null?void 0:L.code}),Oe=Z(()=>fe.value.find(Y=>Y.code===Le.value)),Ve=async()=>{const{data:Y}=await Xe.cart.coupons();Y.success&&(fe.value=Y.data)},N=async(Y,L="card")=>{const V=L==="text"?"text":Y;try{if(!Y||Re[V])return;Re[V]=!0,$e.value=!1,re.value=!1;const{data:ie}=await Xe.cart.applyCoupon({code:Y});ie.data&&(U.cart=ie.data),ie.success?L==="text"&&($e.value=!1):$e.value=!0}catch(ie){console.log("Error coupon: ",ie)}finally{Re[V]=!1,we.value=""}},ee=async Y=>{try{if(!Y||Re[Y])return;Re[Y]=!0,$e.value=!1,re.value=!1;const{data:L}=await Xe.cart.removeCoupon({code:Y});console.log("removeCoupon = ",L),L.data&&(U.cart=L.data)}catch(L){console.log("Error coupon: ",L)}finally{Re[Y]=!1,we.value=""}};return Pe(()=>U.user,Y=>{Y?(M(),Ve(),D()):(n.value=[],s.value=null)},{immediate:!0}),(Y,L)=>(m(),oe(Qg,{chatViewRef:e.chatViewRef,open:t.value,"onUpdate:open":L[41]||(L[41]=V=>t.value=V),slotNames:g.value,isNestedOpen:u.value||Ee.value||re.value},{cart:Se(()=>{var V,ie,me,de;return[l("div",C8,[l("div",$8,[T8,((ie=(V=y(U).cart)==null?void 0:V.items)==null?void 0:ie.length)>0?(m(),x("div",A8," Giỏ hàng ")):z("",!0)]),((de=(me=y(U).cart)==null?void 0:me.items)==null?void 0:de.length)>0?(m(),x("div",E8,[l("div",I8,[l("div",P8,[(m(!0),x(_e,null,Me(y(U).cart.items,(ve,he)=>(m(),oe(V4,{key:he,item:ve},null,8,["item"]))),128))])]),l("div",M8,[l("div",O8,[l("div",L8,j(y(U).cart.total_items)+" sản phẩm ",1),l("div",R8,[l("div",D8,j(y(et)(y(U).cart.subtotal_price)),1)])]),y(U).cart.total_discounts?(m(),x("div",j8,[N8,l("div",F8,[l("div",q8,j(y(et)(y(U).cart.total_discounts)),1)])])):z("",!0),l("div",z8,[B8,l("div",U8,[l("div",V8,j(y(et)(y(U).cart.total_price-(y(U).cart.shipping_price||0))),1)])])]),l("div",H8,[l("div",null,[l("button",{onClick:L[0]||(L[0]=ve=>(k(),y(U).user&&te())),class:ne(["flex items-center justify-center h-12 border w-full rounded-xl text-base ","bg-primary text-white hover:opacity-80 font-medium"])}," Đặt hàng ")])])])):(m(),x("div",W8,[G8,l("button",{onClick:L[1]||(L[1]=ve=>t.value=!1),class:ne(["flex items-center justify-center h-12 border w-full rounded-lg text-base mt-3","bg-primary text-white hover:opacity-80 font-medium"])}," Tiếp tục mua sắm ")]))])]}),phone:Se(()=>[G(Xg,{onSuccess:L[2]||(L[2]=V=>ge(V))})]),otp:Se(()=>[G(Zg,{onSuccess:L[3]||(L[3]=V=>ue(V)),identifier:E.value},null,8,["identifier"])]),checkout:Se(()=>[l("div",{ref_key:"checkoutRef",ref:r,class:"py-4 relative"},[K8,l("button",{onClick:L[4]||(L[4]=V=>S("cart")),class:"size-10 flex items-center justify-center rounded-full hover:bg-gray-100 text-gray-900 absolute left-4 top-5"},[G(Jg)]),l("div",Q8,[s.value?(m(),x("div",J8,[l("div",X8,[Z8,l("button",{onClick:L[5]||(L[5]=V=>u.value=!0),class:"text-sm px-2 py-1 bg-gray-50 hover:bg-gray-100 rounded-md text-gray-500"}," Thay đổi ")]),l("div",Y8,[l("div",eA,[l("div",tA,[l("div",null,j((s.value.first_name?`${s.value.first_name} `:"")+(s.value.last_name?s.value.last_name:"")),1)]),s.value.phone?(m(),x("div",nA,[l("div",null,j(s.value.phone),1)])):z("",!0),l("div",sA,[l("div",null,j(`${s.value.address} ${s.value.ward_name}, ${s.value.district_name}, ${s.value.province_name}`),1)])])])])):(m(),x("div",{key:1,onClick:L[6]||(L[6]=V=>(u.value=!0,d.value=!0)),class:"h-[70px] border border-dashed border-gray-300 flex items-center justify-center rounded-xl text-gray-700 cursor-pointer hover:bg-gray-50"},rA)),l("div",oA,[iA,G(as,{modelValue:h.value,"onUpdate:modelValue":L[7]||(L[7]=V=>h.value=V),field:{id:"order-email",name:"email",type:"email",label:"Email"}},null,8,["modelValue"])]),l("div",aA,[lA,Lt(l("textarea",{id:"order-notes","onUpdate:modelValue":L[8]||(L[8]=V=>f.value=V),placeholder:"Nhập ghi chú cho đơn hàng",rows:"2",class:"w-full text-sm rounded-lg border border-gray-200 p-3 text-gray-700 focus:outline-none resize-none"},null,512),[[rn,f.value]])]),l("div",cA,[uA,l("div",dA,[l("div",fA,[G(y(U2),{size:"18"}),hA])])]),l("div",pA,[l("div",null,[l("div",mA,[gA,l("button",{onClick:L[9]||(L[9]=V=>S("cart")),class:"text-sm px-2 py-1 bg-gray-100 hover:bg-gray-200 rounded-md text-gray-500"}," Thay đổi ")]),l("div",vA,[(m(!0),x(_e,null,Me(y(U).cart.items,V=>(m(),oe(Ll,{key:V.product_sku,item:V},null,8,["item"]))),128))])]),Oe.value?(m(),x("div",yA,[G(S8,{coupon:Oe.value,"is-active":!0,onOnViewDetail:L[10]||(L[10]=V=>(re.value=!0,pe.value=V)),onRemove:L[11]||(L[11]=V=>ee(V)),loading:Re[Oe.value.code]},null,8,["coupon","loading"])])):z("",!0),l("div",bA,[l("div",_A,[l("div",xA,j(y(U).cart.total_items)+" sản phẩm ",1),l("div",wA,[l("div",kA,j(y(et)(y(U).cart.subtotal_price)),1)])]),y(U).cart.total_discounts?(m(),x("div",SA,[CA,l("div",$A,[l("div",TA,j(y(et)(y(U).cart.total_discounts)),1)])])):z("",!0),l("div",AA,[EA,l("div",IA,[l("div",PA,j(y(et)(y(U).cart.shipping_price)),1)])]),l("div",MA,[OA,l("div",LA,[l("div",RA,j(y(et)(y(U).cart.total_price)),1)])])])]),l("div",{class:ne(["sticky bottom-0 bg-white border-t border-t-gray-100 z-10",fe.value&&fe.value.length>0?"pt-0":"pt-4"])},[fe.value&&fe.value.length>0?(m(),x("div",{key:0,onClick:L[12]||(L[12]=V=>Ee.value=!0),class:"flex items-center px-1 py-2.5 cursor-pointer"},[G(Ol,{class:"mr-1 text-primary"}),DA,l("div",jA,[NA,G(xg,{class:"text-gray-400 w-4"})])])):z("",!0),l("button",{onClick:L[13]||(L[13]=V=>P()),class:ne(["flex items-center justify-center h-12 w-full rounded-lg text-base bg-primary text-white hover:opacity-80 font-medium",v.value&&"opacity-80"])},[v.value?(m(),oe(tn,{key:0,class:"w-[16px] h-[16px] mr-2"})):z("",!0),FA],2)],2)])],512),G(y(fd),{key:"DrawerRootNested-Address",open:u.value,"onUpdate:open":L[25]||(L[25]=V=>u.value=V),modal:!1},{default:Se(()=>[G(y(nr),{to:e.chatViewRef},{default:Se(()=>[l("div",{onClick:L[14]||(L[14]=V=>u.value=!1),class:ne(["drawer-overlay-custom !z-50",{"drawer-overlay-custom--open":u.value}])},null,2),G(y(rr),{class:"bg-white pt-4 flex flex-col rounded-t-3xl absolute bottom-0 left-0 right-0 outline-none z-50 overflow-hidden h-[540px]"},{default:Se(()=>[qA,l("div",zA,j(d.value?"Thêm địa chỉ":" Sổ địa chỉ "),1),l("div",BA,[d.value?(m(),x("div",UA,[l("form",{id:"form-submit-new-address",onSubmit:L[21]||(L[21]=Gt(V=>J(),["prevent"])),class:"space-y-[18px]"},[G(as,{modelValue:a.last_name,"onUpdate:modelValue":L[15]||(L[15]=V=>a.last_name=V),field:{name:"last_name",type:"text",label:"Họ và tên",validate:"required"}},null,8,["modelValue"]),G(as,{modelValue:a.phone,"onUpdate:modelValue":L[16]||(L[16]=V=>a.phone=V),field:{name:"phone",type:"number",label:"Số điện thoại",validate:"required"}},null,8,["modelValue"]),G(as,{modelValue:a.province_code,"onUpdate:modelValue":L[17]||(L[17]=V=>a.province_code=V),field:{name:"province_code",type:"select",label:"Tỉnh/Thành phố",validate:"required",keyValue:"code",keyLabel:"name",options:B.value}},null,8,["modelValue","field"]),l("div",{class:ne(["relative",q.district&&"pointer-events-none opacity-80 bg-gray-50"])},[G(as,{classField:q.district&&"loading",modelValue:a.district_code,"onUpdate:modelValue":L[18]||(L[18]=V=>a.district_code=V),field:{name:"district_code",type:"select",label:"Quận/Huyện",validate:"required",keyValue:"code",keyLabel:"name",options:T.value}},null,8,["classField","modelValue","field"]),q.district?(m(),x("div",VA,[G(tn,{color:"text-gray-700",class:"w-[14px] h-[14px]"})])):z("",!0)],2),l("div",{class:ne(["relative",q.ward&&"pointer-events-none opacity-80 bg-gray-50"])},[G(as,{classField:q.ward&&"loading",modelValue:a.ward_code,"onUpdate:modelValue":L[19]||(L[19]=V=>a.ward_code=V),field:{name:"ward_code",type:"select",label:"Phường/Xã",validate:"required",keyValue:"code",keyLabel:"name",options:A.value}},null,8,["classField","modelValue","field"]),q.ward?(m(),x("div",HA,[G(tn,{color:"text-gray-700",class:"w-[14px] h-[14px]"})])):z("",!0)],2),G(as,{modelValue:a.address,"onUpdate:modelValue":L[20]||(L[20]=V=>a.address=V),field:{name:"address",type:"textarea",label:"Địa chỉ",validate:"required",rows:2}},null,8,["modelValue"])],32),l("div",WA,[l("button",{onClick:L[22]||(L[22]=V=>K()),class:"py-[10px] bg-gray-100 hover:bg-gray-200 rounded-lg flex-1"}," Quay lại "),l("button",GA,[_.value?(m(),oe(tn,{key:0,class:"mr-1 w-4 h-4"})):z("",!0),KA])])])):(m(),x("div",QA,[(m(!0),x(_e,null,Me(n.value,V=>{var ie,me;return m(),x("div",{key:V.id,class:"border border-gray-200 rounded-xl bg-white"},[l("div",JA,[l("div",XA,[l("div",ZA,j(V.first_name?`${V.first_name} `:"")+" "+j(V.last_name?V.last_name:""),1),V.is_default?(m(),x("div",YA," Mặc định ")):z("",!0)]),l("div",eE,[tE,l("span",nE,j(V.phone),1)]),l("div",sE,[rE,l("span",oE,j(`${V.address} ${V.ward_name}, ${V.district_name}, ${V.province_name}`),1)])]),l("div",iE,[l("button",{onClick:de=>(s.value=V,u.value=!1),class:ne(["px-3 py-2 rounded-xl text-sm",((ie=s.value)==null?void 0:ie.id)===V.id?"bg-primary text-white cursor-default":"hover:bg-gray-50 text-gray-500 border border-gray-200 "])},j(((me=s.value)==null?void 0:me.id)===V.id?"Đang sử dụng":"Giao đến địa chỉ này"),11,aE)])])}),128)),l("div",lE,[l("button",{class:"px-3 py-[10px] bg-gray-100 rounded-lg flex-1",onClick:L[23]||(L[23]=V=>u.value=!1)}," Quay lại "),l("button",{onClick:L[24]||(L[24]=V=>d.value=!0),class:"px-3 py-[10px] bg-primary text-white rounded-lg flex-1"}," Thêm mới ")])]))])]),_:1})]),_:1},8,["to"])]),_:1},8,["open"]),G(y(fd),{open:Ee.value,"onUpdate:open":L[35]||(L[35]=V=>Ee.value=V),modal:!1},{default:Se(()=>[G(y(nr),{to:e.chatViewRef},{default:Se(()=>[l("div",{onClick:L[26]||(L[26]=V=>Ee.value=!1),class:ne(["drawer-overlay-custom",{"drawer-overlay-custom--open":Ee.value}])},null,2),G(y(rr),{class:"absolute bottom-0 left-0 right-0 outline-none z-[50] overflow-hidden h-full"},{default:Se(()=>[l("div",cE,[l("button",{onClick:L[27]||(L[27]=V=>Ee.value=!1),class:"size-10 flex items-center justify-center rounded-full hover:bg-gray-100 text-gray-900 absolute right-[12px] top-[14px]"},[G(_o)]),uE,l("div",dE,[l("div",fE,[l("div",hE,[Lt(l("input",{type:"text","onUpdate:modelValue":L[28]||(L[28]=V=>we.value=V),placeholder:"Nhập mã khuyến mãi",class:"block w-full h-10 border border-gray-200 rounded-lg text-base pr-6 pl-10 focus:outline-none"},null,512),[[rn,we.value]]),G(Ol,{class:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-500"}),we.value?(m(),x("button",{key:0,onClick:L[29]||(L[29]=V=>we.value=""),class:"absolute right-2 top-1/2 -translate-y-1/2 z-10 w-4 h-4 flex items-center justify-center bg-gray-400 rounded-full cursor-pointer"},[G(_o,{class:"w-3 text-white"})])):z("",!0)]),l("button",{onClick:L[30]||(L[30]=V=>N(we.value,"text")),class:ne([[we.value?"bg-primary text-white":"bg-gray-100 text-gray-300 border border-gray-200 cursor-not-allowed",Re[we.value]&&"opacity-60 cursor-not-allowed"],"h-10 text-sm font-medium rounded-lg hover:opacity-80 px-4 flex items-center"])},[Re.text?(m(),oe(tn,{key:0,class:"w-4 mr-1"})):z("",!0),pE],2)]),$e.value?(m(),x("div",mE," Mã không hợp lệ hoặc bạn không nằm trong chương trình áp dụng ! ")):z("",!0)]),l("div",gE,[l("div",vE,[(m(!0),x(_e,null,Me(fe.value,V=>(m(),oe(N6,{key:V.id,coupon:V,loading:Re[V.code],"is-active":V.code===Le.value,onOnViewDetail:L[31]||(L[31]=ie=>(re.value=!0,pe.value=ie)),onRemove:L[32]||(L[32]=ie=>ee(ie)),onApply:L[33]||(L[33]=ie=>N(ie))},null,8,["coupon","loading","is-active"]))),128))])]),l("div",yE,[l("button",{onClick:L[34]||(L[34]=V=>Ee.value=!1),class:"flex items-center justify-center h-12 w-full rounded-lg text-base bg-primary text-white hover:opacity-80 font-medium"}," Xong ")])])]),_:1})]),_:1},8,["to"])]),_:1},8,["open"]),G(y(fd),{open:re.value,"onUpdate:open":L[39]||(L[39]=V=>re.value=V),modal:!1},{default:Se(()=>[G(y(nr),{to:e.chatViewRef},{default:Se(()=>[l("div",{onClick:L[36]||(L[36]=V=>re.value=!1),class:ne(["drawer-overlay-custom !z-50",{"drawer-overlay-custom--open":re.value}])},null,2),G(y(rr),{class:"absolute bottom-0 left-0 right-0 outline-none z-[50] overflow-hidden h-fit"},{default:Se(()=>[G(a8,{coupon:pe.value,active:pe.value&&pe.value.code===Le.value,onRemove:L[37]||(L[37]=V=>ee(V)),onApply:L[38]||(L[38]=V=>N(V))},null,8,["coupon","active"])]),_:1})]),_:1},8,["to"])]),_:1},8,["open"])]),success:Se(()=>{var V,ie,me,de;return[p.value?(m(),x("div",bE,[l("div",_E,[xE,p.value.shipping_address?(m(),x("div",wE,[kE,l("div",SE,[l("div",CE,[(V=p.value.shipping_address)!=null&&V.name||(ie=s.value)!=null&&ie.last_name?(m(),x("div",$E," Họ và tên ")):z("",!0),l("div",TE,j(p.value.shipping_address.name??((me=s.value)==null?void 0:me.last_name)),1)]),(de=p.value.shipping_address)!=null&&de.phone?(m(),x("div",AE,[EE,l("div",IE,j(p.value.shipping_address.phone),1)])):z("",!0),l("div",PE,[ME,l("div",OE,j(p.value.shipping_address.address1),1)])])])):z("",!0),l("div",LE,[RE,l("div",DE,[l("div",jE,[NE,l("div",FE," #"+j(p.value.order_number),1)]),qE,p.value.note?(m(),x("div",zE,[BE,l("div",UE,j(p.value.note),1)])):z("",!0)])]),l("div",null,[p.value.items&&p.value.items.length>0?(m(),x("div",VE," Sản phẩm đã đặt ")):z("",!0),p.value.items&&p.value.items.length>0?(m(),x("div",HE,[(m(!0),x(_e,null,Me(p.value.items,ve=>(m(),oe(Ll,{key:ve.product_sku,item:ve},null,8,["item"]))),128))])):z("",!0),l("div",null,[l("div",WE,[GE,l("div",KE,[l("div",QE,j(y(et)(p.value.subtotal_price)),1)])]),p.value.shipping_price?(m(),x("div",JE,[XE,l("div",ZE,[l("div",YE,j(y(et)(p.value.shipping_price)),1)])])):z("",!0),p.value.total_discounts?(m(),x("div",eI,[tI,l("div",nI,[l("div",sI,j(y(et)(p.value.total_discounts)),1)])])):z("",!0),l("div",rI,[oI,l("div",iI,j(y(et)(p.value.total_price)),1)])])])]),l("div",aI,[l("button",{onClick:L[40]||(L[40]=ve=>t.value=!1),class:"flex items-center justify-center h-12 w-full rounded-lg text-base bg-primary text-white hover:opacity-80 font-medium"}," Tiếp tục mua sắm ")])])):z("",!0)]}),_:1},8,["chatViewRef","open","slotNames","isNestedOpen"]))}},cI=["src"],uI={__name:"ChatBanner",props:{banners:{type:Array,default:()=>[]}},emits:["close"],setup(e,{emit:t}){const n="https://widget.geteasy.ai",s=e,r=t,o=R(!0),i=R(null),a=()=>{var u;((u=i.value)==null?void 0:u.offsetWidth)<480?o.value=!0:o.value=!1},c=Z(()=>s.banners.filter(u=>u.image_url));return Je(()=>{n!==window.location.origin&&a()}),(u,d)=>c.value.length>0?(m(),x("div",{key:0,ref_key:"chatBannerRef",ref:i,class:ne(["chat-banners",o.value?"block":"hidden"])},[G(Mi,{autoplay:!0,pagination:!0},{default:Se(()=>[(m(!0),x(_e,null,Me(c.value,(f,h)=>(m(),oe(bl,{key:h,class:"w-full h-[150px]"},{default:Se(()=>[(m(),oe(Nt(f.link?"a":"div"),{href:f.link,target:"_blank",class:"block w-full h-full"},{default:Se(()=>[l("img",{src:f.image_url,alt:"ecg-banner",class:"object-cover w-full h-full"},null,8,cI)]),_:2},1032,["href"]))]),_:2},1024))),128))]),_:1}),l("button",{onClick:d[0]||(d[0]=f=>r("close")),class:"close-banner-btn"},[G(_o,{class:"w-3"})])],2)):z("",!0)}},dI={class:"relative bg-white mx-auto mt-3 mb-2 w-fit max-w-[300px]"},fI={class:"flex justify-end items-end flex-col gap-1"},hI={class:"flex-shrink-0 px-1.5 py-0.5 text-blue-500 bg-blue-50 w-fit rounded-xl flex items-center gap-1"},pI=l("span",{class:"text-xs"},"Tin nhắn thoại",-1),mI={class:"text-sm text-white px-4 py-2.5 bg-primary rounded-xl"},gI={__name:"ChatVoiceCardUser",props:{messageText:{type:String,default:""}},setup(e){return(t,n)=>(m(),x("div",dI,[l("div",fI,[l("div",hI,[G(y(ng),{size:"14"}),pI]),l("div",mI,j(e.messageText),1)])]))}},vI={viewBox:"0 0 24 24"},yI=["id"],bI=["stop-color"],_I=["stop-color"],xI=["fill"],wI={__name:"IconAI",props:{fromColor:{type:String,default:"#2a83e9"},toColor:{type:String,default:"#0ea5e9"},id:{type:String,default:""}},setup(e){const t=e,n=Z(()=>t.id||`star-gradient-${Math.random().toString(36).substring(2,9)}`);return(s,r)=>(m(),x("svg",vI,[l("defs",null,[l("linearGradient",{id:n.value,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},[l("stop",{offset:"0%","stop-color":e.fromColor},null,8,bI),l("stop",{offset:"100%","stop-color":e.toColor},null,8,_I)],8,yI)]),l("path",{fill:`url(#${n.value})`,"fill-rule":"evenodd",d:"M9 4.5a.75.75 0 01.721.544l.813 2.846a3.75 3.75 0 002.576 2.576l2.846.813a.75.75 0 010 1.442l-2.846.813a3.75 3.75 0 00-2.576 2.576l-.813 2.846a.75.75 0 01-1.442 0l-.813-2.846a3.75 3.75 0 00-2.576-2.576l-2.846-.813a.75.75 0 010-1.442l2.846-.813A3.75 3.75 0 007.466 7.89l.813-2.846A.75.75 0 019 4.5zM18 1.5a.75.75 0 01.728.568l.258 1.036c.236.94.97 1.674 1.91 1.91l1.036.258a.75.75 0 010 1.456l-1.036.258c-.94.236-1.674.97-1.91 1.91l-.258 1.036a.75.75 0 01-1.456 0l-.258-1.036a2.625 2.625 0 00-1.91-1.91l-1.036-.258a.75.75 0 010-1.456l1.036-.258a2.625 2.625 0 001.91-1.91l.258-1.036A.75.75 0 0118 1.5zM16.5 15a.75.75 0 01.712.513l.394 1.183c.15.447.5.799.948.948l1.183.395a.75.75 0 010 1.422l-1.183.395c-.447.15-.799.5-.948.948l-.395 1.183a.75.75 0 01-1.422 0l-.395-1.183a1.5 1.5 0 00-.948-.948l-1.183-.395a.75.75 0 010-1.422l1.183-.395c.447-.15.799-.5.948-.948l.395-1.183A.75.75 0 0116.5 15z","clip-rule":"evenodd"},null,8,xI)]))}},kI={class:"shine-wrapper max-h-[18px]"},SI={class:"inline-flex items-center shine-effect"},Ri=Qe({__name:"AITitle",props:{title:{type:String,default:"AI đề xuất"},size:{type:String,default:"sm"}},setup(e){const t=e,n=Z(()=>{switch(t.size){case"sm":return"text-xs";case"md":return"text-sm";case"lg":return"text-base";default:return"text-xs"}});return(s,r)=>(m(),x("div",kI,[l("div",SI,[G(wI,{class:ne(["mr-1",[e.size==="lg"?"w-6":e.size==="md"?"w-[18px]":"w-4"]]),style:{"max-width":"24px"}},null,8,["class"]),l("div",{class:ne([n.value,"font-semibold leading-[120%]"]),style:{background:"linear-gradient(to right, #2a83e9, #0ea5e9)","background-clip":"text","-webkit-background-clip":"text","-webkit-text-fill-color":"transparent"}},j(e.title),3)])]))}},[["__scopeId","data-v-9bdf7947"]]),CI={class:"ai-suggestion-wrapper"},$I={key:0,class:"ai-suggestion-container pb-1 pt-2 pl-4 pr-[10px] border-t border-gray-50 shadow-[0_-2px_4px_-1px_rgba(0,0,0,0.05)] rounded-t-xl bg-white",style:{"will-change":"max-height, opacity"}},TI=["title"],AI={key:0,class:"w-[48px] max-h-[48px] h-auto rounded overflow-hidden mr-2 flex-shrink-0"},EI=["src","alt"],II={key:1,class:"size-[48px] flex items-center justify-center"},PI=["src","alt"],MI={class:"relative flex-1"},OI={class:"text-sm leading-[140%] line-clamp-2 text-gray-900"},LI={key:0,class:"flex flex-wrap"},RI=["onClick","innerHTML"],DI="ecg-quick-replies",jI=Qe({__name:"WidgetFeatureAIProductInsight",props:{widget:{type:Object,default:()=>({})}},emits:["sendMessage"],setup(e,{expose:t,emit:n}){var A,D,Q,W;const s=e,r=n,{bot:o,handle:i}=Et(ae.state),a=(D=(A=o.value.config)==null?void 0:A.ui)==null?void 0:D.logo,c=(W=(Q=o.value.config)==null?void 0:Q.ui)==null?void 0:W.name,u=R(null),d=R(null),f=R(null),h=R(!1),g=R(!1),p=R([]),v=R(!1),_=R(null),w=(H,K=[],J)=>{var ue;const te=((ue=s.widget)==null?void 0:ue.dynamic_prompts)??no[i.value]??no.default;let ge=gm(te,{title:H,logo:a,brand:c})[J];return K.length>0&&ge.length>K.length?K.map(we=>ge.find(Ee=>Ee.id===we)).filter(Boolean):ge},k=()=>{let H=Tt.get(DI);return(!H||H==="undefined")&&(H={}),H},S=()=>{const H=k(),K=kx(f.value.name);return H[K]??[]},E=H=>{Ir().send({message:H.message}),p.value=p.value.filter(K=>K.id!==H.id),p.value.length===0&&(h.value=!1),r("sendMessage",H.message)},O=()=>{var K;const H=((K=f.value.image)==null?void 0:K.contentUrl)??f.value.image;return Array.isArray(H)?H[0]:H},I=({selector:H,position:K,widget:J,style:te}={})=>{u.value&&(u.value.remove(),u.value=null),typeof window<"u"&&window.EAC&&!u.value?u.value=window.EAC.injectWidget(H,J,{position:K,style:te}):u.value=wi(H,J,{position:K,style:te})},P=({selector:H,position:K,widget:J,style:te,props:ge}={})=>{d.value&&(d.value.remove(),d.value=null),typeof window<"u"&&window.EAC&&!d.value?d.value=window.EAC.injectWidget(H,J,{position:K,style:te,props:ge}):d.value=wi(H,J,{position:K,style:te,props:ge})},M=()=>{const H=os("Product");if(!H)return;let K=H.sku?"product":"category";if(i.value===wr&&(K="product"),K==="product"&&i.value===On&&(I({selector:".gallery-product",position:"bottom",widget:s.widget,style:{margin:"12px 0",borderRadius:"12px",border:"1px solid #e5e7eb",padding:"12px",overflow:"hidden"}}),P({selector:"[data-target='panel-main-item']",position:"before",widget:{type:"ai_summary_page_content"},style:{margin:"16px 0"},props:{isShowHighlight:!1}})),K==="product"&&i.value===wr){const J=As()?{selector:"#form1 a#ca",position:"before",widget:s.widget,style:{width:"98%",margin:"0 auto",margin:"12px 0",border:"1px solid #e5e7eb",padding:"12px"}}:{selector:"#form1 ul.tu",position:"before",widget:s.widget,style:{width:"100%",maxWidth:"824px",marginBottom:"12px",border:"1px solid #e5e7eb",padding:"12px"}};I(J)}},q=()=>{f.value=os("Product");const H=Ts();if(f.value){i.value===wr&&(f.value.name=H.title);const K=S();_.value=O()??ms();let J=f.value.sku?"product":"category";i.value===wr&&(J="product"),p.value=w(f.value.name,K,J),setTimeout(()=>{h.value=!0},200)}else{const K=wx({handle:i.value});if(K){f.value={name:H.title};const J=S();_.value=ms();const te=K==="product"?"product":"category";p.value=w(f.value.name,J,te),setTimeout(()=>{h.value=!0},200)}}},B=()=>{p.value=[],h.value=!1,f.value=null,v.value=!1,_.value=null,u.value&&(u.value.remove(),u.value=null)},T=()=>{h.value=!h.value,h.value?g.value=!1:(g.value=!1,setTimeout(()=>{g.value=!0},200))};return Je(()=>{bi(()=>{Na.SPA.includes(i.value)&&B(),setTimeout(()=>{q(),Na.SPA.includes(i.value)&&M()},1500),u.value&&Na.SPA.includes(i.value)&&(u.value.remove(),u.value=null)},!0),Na.SSR.includes(i.value)&&M()}),t({tags:p,showToggleButton:g}),(H,K)=>(m(),x("div",CI,[G(Yt,{name:"expand-ai-suggestion"},{default:Se(()=>[f.value&&h.value?(m(),x("div",$I,[l("div",{title:f.value.name,class:"flex items-start"},[_.value&&!v.value?(m(),x("div",AI,[l("img",{src:_.value,alt:f.value.name,onError:K[0]||(K[0]=()=>{v.value=!0}),class:"object-contain w-full h-full"},null,40,EI)])):(m(),x("div",II,[l("img",{src:y(a),alt:y(c),class:"w-[24px] h-[24px] object-cover rounded-full overflow-hidden"},null,8,PI)])),l("div",MI,[G(Ri,{title:"AI đề xuất",class:"mb-1"}),l("div",OI,j(f.value.name),1)]),l("button",{onClick:T,class:"flex-shrink-0 p-1 ml-2 text-gray-500 transition-colors hover:text-gray-700"},[G(y(mo),{class:"w-4 h-4"})])],8,TI),p.value.length>0?(m(),x("div",LI,[(m(!0),x(_e,null,Me(p.value,J=>(m(),x("button",{key:J.name,onClick:te=>E(J),class:"prose suggestion-tag",innerHTML:J.name},null,8,RI))),128))])):z("",!0)])):z("",!0)]),_:1}),f.value&&!h.value&&g.value?(m(),x("button",{key:0,onClick:K[1]||(K[1]=J=>T()),class:"flex absolute bottom-0 right-3 z-30 ml-auto gap-1 items-center py-2 px-3 bg-white rounded-3xl rounded-br-md border border-blue-200 hover:bg-blue-50 cursor-pointer ai-suggestion-toggle"},[G(Ri,{title:"AI đề xuất"})])):z("",!0)]))}},[["__scopeId","data-v-36a6a2b9"]]),NI={class:"relative py-4 bg-white rounded-t-2xl overflow-hidden outline-none"},FI=l("div",{class:"relative text-center mb-2"},[l("div",{class:"w-[36px] h-[6px] rounded-full bg-gray-500 cursor-grab mx-auto mb-2"}),l("div",{class:"font-semibold text-gray-700 text-lg"}," Thông tin cá nhân ")],-1),qI={class:"px-3 divide-y divide-gray-100"},zI={class:"flex px-4 py-3"},BI=l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"text-gray-500 mr-3"},[l("circle",{cx:"12",cy:"8",r:"5"}),l("path",{d:"M20 21a8 8 0 0 0-16 0"})],-1),UI=l("div",{class:"text-sm text-gray-400"},"Họ và tên",-1),VI={class:"text-base text-gray-700"},HI={class:"flex px-4 py-3"},WI=ba('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-gray-500 mr-3"><path d="M8 2v4"></path><path d="M16 2v4"></path><rect width="18" height="18" x="3" y="4" rx="2"></rect><path d="M3 10h18"></path></svg>',1),GI=l("div",{class:"text-sm text-gray-400"},"Ngày sinh",-1),KI={class:"text-base text-gray-700"},QI={class:"flex px-4 py-3"},JI=ba('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class="text-gray-500 mr-3 scale-125"><g clip-path="url(#clip0_2871_105064)"><path d="M16.8719 1.81324C16.871 1.80435 16.8693 1.79573 16.8681 1.78696C16.8665 1.77555 16.8651 1.76411 16.8629 1.75278C16.8608 1.74255 16.858 1.7326 16.8555 1.72253C16.8531 1.71284 16.8509 1.70311 16.848 1.6935C16.845 1.68362 16.8413 1.67408 16.8378 1.66439C16.8344 1.65482 16.8313 1.64516 16.8274 1.63574C16.8236 1.62674 16.8192 1.61812 16.8151 1.60931C16.8105 1.59962 16.8062 1.58985 16.8011 1.58035C16.7966 1.57192 16.7915 1.56395 16.7866 1.55575C16.781 1.54644 16.7758 1.53698 16.7697 1.5279C16.7637 1.51905 16.7571 1.5107 16.7508 1.50219C16.7449 1.49437 16.7395 1.48636 16.7332 1.47873C16.7214 1.46427 16.7087 1.45046 16.6956 1.43711C16.6943 1.43578 16.6932 1.43433 16.6919 1.43303C16.6904 1.4315 16.6887 1.43028 16.6872 1.42876C16.6741 1.41587 16.6605 1.40343 16.6462 1.39172C16.6388 1.38565 16.6311 1.38039 16.6235 1.37474C16.6147 1.36818 16.6061 1.36139 16.597 1.35529C16.5882 1.34941 16.5791 1.3443 16.5701 1.33892C16.5616 1.33385 16.5533 1.32851 16.5445 1.32378C16.5355 1.31897 16.5263 1.31493 16.5171 1.31058C16.5078 1.30615 16.4985 1.3015 16.489 1.29753C16.4803 1.29395 16.4715 1.29109 16.4627 1.28792C16.4522 1.28411 16.4418 1.28014 16.4311 1.27686C16.4226 1.27434 16.414 1.27247 16.4055 1.2703C16.3943 1.26744 16.3832 1.26431 16.3718 1.26206C16.3623 1.26019 16.3528 1.25916 16.3433 1.25771C16.3326 1.25611 16.3221 1.25416 16.3113 1.25309C16.2955 1.25157 16.2797 1.25107 16.2638 1.25069C16.2592 1.25061 16.2547 1.25 16.25 1.25H13.125C12.9592 1.25 12.8003 1.31585 12.6831 1.43306C12.5658 1.55027 12.5 1.70924 12.5 1.875C12.5 2.04076 12.5658 2.19973 12.6831 2.31694C12.8003 2.43415 12.9592 2.5 13.125 2.5H14.7411L12.8322 4.40887C12.2025 3.86831 11.455 3.48283 10.6494 3.28336C9.84389 3.0839 9.00282 3.07599 8.19368 3.26028C7.38453 3.44458 6.62984 3.81593 5.99014 4.34457C5.35043 4.8732 4.84352 5.54441 4.51007 6.30433C4.17662 7.06426 4.0259 7.89175 4.07001 8.72045C4.11412 9.54914 4.35183 10.356 4.76407 11.0762C5.1763 11.7964 5.7516 12.41 6.44381 12.8678C7.13601 13.3255 7.92586 13.6147 8.75 13.712V15.3125H6.875C6.70924 15.3125 6.55027 15.3783 6.43306 15.4956C6.31585 15.6128 6.25 15.7717 6.25 15.9375C6.25 16.1033 6.31585 16.2622 6.43306 16.3794C6.55027 16.4967 6.70924 16.5625 6.875 16.5625H8.75V18.125C8.75 18.2908 8.81585 18.4497 8.93306 18.5669C9.05027 18.6842 9.20924 18.75 9.375 18.75C9.54076 18.75 9.69973 18.6842 9.81694 18.5669C9.93415 18.4497 10 18.2908 10 18.125V16.5625H11.875C12.0408 16.5625 12.1997 16.4967 12.3169 16.3794C12.4342 16.2622 12.5 16.1033 12.5 15.9375C12.5 15.7717 12.4342 15.6128 12.3169 15.4956C12.1997 15.3783 12.0408 15.3125 11.875 15.3125H10V13.712C10.9189 13.604 11.7937 13.2576 12.5374 12.7072C13.2812 12.1568 13.8681 11.4215 14.24 10.5743C14.6119 9.72705 14.7558 8.79731 14.6575 7.87729C14.5591 6.95727 14.222 6.07895 13.6794 5.32944L15.625 3.38391V5C15.625 5.16576 15.6908 5.32473 15.8081 5.44194C15.9253 5.55915 16.0842 5.625 16.25 5.625C16.4158 5.625 16.5747 5.55915 16.6919 5.44194C16.8092 5.32473 16.875 5.16576 16.875 5V1.87519C16.875 1.85451 16.8739 1.83384 16.8719 1.81324ZM9.375 12.5C8.57151 12.5 7.78607 12.2617 7.118 11.8153C6.44992 11.369 5.92922 10.7345 5.62174 9.99215C5.31426 9.24983 5.23381 8.43299 5.39056 7.64495C5.54731 6.8569 5.93423 6.13303 6.50238 5.56488C7.07053 4.99673 7.7944 4.60981 8.58245 4.45306C9.37049 4.29631 10.1873 4.37676 10.9297 4.68424C11.672 4.99172 12.3065 5.51242 12.7528 6.1805C13.1992 6.84857 13.4375 7.63401 13.4375 8.4375C13.4363 9.51457 13.0079 10.5472 12.2463 11.3088C11.4847 12.0704 10.4521 12.4988 9.375 12.5Z" fill="currentColor"></path></g><defs><clipPath id="clip0_2871_105064"><rect width="20" height="20" fill="white"></rect></clipPath></defs></svg>',1),XI=l("div",{class:"text-sm text-gray-400"},"Giới tính",-1),ZI={class:"text-base text-gray-700"},YI={class:"flex px-4 py-3"},e9=l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"text-gray-500 mr-3"},[l("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})],-1),t9=l("div",{class:"text-sm text-gray-400"},"Số điện thoại",-1),n9={class:"text-base text-gray-700"},s9={class:"flex px-4 py-3"},r9=l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"mr-3 text-gray-500"},[l("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),l("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})],-1),o9=l("div",{class:"text-sm text-gray-400"},"Địa chỉ email",-1),i9={class:"text-base text-gray-700"},a9={__name:"AuthAccount",setup(e){const t={male:"Nam",female:"Nữ"};return(n,s)=>(m(),x("div",NI,[FI,l("div",qI,[l("div",zI,[BI,l("div",null,[UI,l("div",VI,j(y(U).user.name),1)])]),l("div",HI,[WI,l("div",null,[GI,l("div",KI,j(y(U).user.birthday),1)])]),l("div",QI,[JI,l("div",null,[XI,l("div",ZI,j(t[y(U).user.gender]??"Khác"),1)])]),l("div",YI,[e9,l("div",null,[t9,l("div",n9,j(y(U).user.phone),1)])]),l("div",s9,[r9,l("div",null,[o9,l("div",i9,j(y(U).user.email??"---"),1)])])])]))}},ct=e=>(mn("data-v-d8858f82"),e=e(),gn(),e),l9={class:"flow-auth-checkout relative"},c9=[ct(()=>l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-user-round"},[l("circle",{cx:"12",cy:"8",r:"5"}),l("path",{d:"M20 21a8 8 0 0 0-16 0"})],-1)),ct(()=>l("div",null,"Tài khoản",-1))],u9=[ct(()=>l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-shopping-bag"},[l("path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z"}),l("path",{d:"M3 6h18"}),l("path",{d:"M16 10a4 4 0 0 1-8 0"})],-1)),ct(()=>l("div",null,"Đơn hàng",-1))],d9=[ct(()=>l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-log-out"},[l("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),l("polyline",{points:"16 17 21 12 16 7"}),l("line",{x1:"21",x2:"9",y1:"12",y2:"12"})],-1)),ct(()=>l("div",null,"Đăng xuất",-1))],f9={class:"px-6 py-6 bg-white rounded-t-2xl overflow-hidden"},h9=ct(()=>l("div",{class:"text-center font-medium text-gray-600 text-xl"}," Xác thực thành công 🎉 ",-1)),p9=ct(()=>l("div",{class:"my-6"},[l("p",{class:"text-sm text-gray-900 marker:text-xs"}," Tận hưởng các lợi ích bổ sung và trải nghiệm phong phú hơn cho tài khoản "),l("ul",{class:"pl-8 list-disc mt-3 space-y-2"},[l("li",{class:"text-sm text-gray-900"}," Mua hàng với ưu đãi đặc biệt 💰 "),l("li",{class:"text-sm text-gray-900"}," Lưu lại trạng thái giỏ hàng của bạn. 🎁 "),l("li",{class:"text-sm text-gray-900"}," Kiểm trạng thái đơn hàng. 🛒 "),l("li",{class:"text-sm text-gray-900"},"...")])],-1)),m9={class:"bg-white mt-4"},g9={class:"px-6 pb-6 pt-3 bg-white rounded-t-2xl relative"},v9=ct(()=>l("div",{class:"flex justify-center mb-2"},[l("div",{class:"w-[36px] h-[6px] rounded-full bg-gray-500 cursor-grab mx-auto"})],-1)),y9=ct(()=>l("div",{class:"font-medium text-[20px] text-center tracking-wide text-gray-900 mb-3"}," Đơn hàng của tôi ",-1)),b9={class:"relative h-[520px] overflow-y-scroll scroll-hidden space-y-6"},_9=[ct(()=>l("div",{class:"h-[48px] rounded-xl bg-gray-100"},null,-1)),ct(()=>l("div",{class:"flex-1 rounded-xl bg-gray-100"},null,-1)),ct(()=>l("div",{class:"h-[60px] rounded-xl bg-gray-100"},null,-1))],x9={class:"rounded-xl bg-white border border-gray-200 overflow-hidden"},w9={class:"py-3 pl-4 pr-3.5 flex items-center justify-between border-b border-b-gray-200"},k9={class:"space-x-1"},S9=ct(()=>l("span",{class:"text-sm text-gray-500"},"Đơn hàng:",-1)),C9={class:"text-sm text-gray-700 font-semibold"},$9={key:0,class:"flex items-center justify-center h-[26px] px-3 text-xs font-medium rounded-md capitalize bg-blue-50 text-blue-600"},T9={class:"w-full max-w-full overflow-x-auto scroll-hidden flex space-x-4 py-3 pr-4"},A9={class:"w-[94px] h-[94px] mx-auto flex items-center justify-center rounded-lg bg-white overflow-hidden"},E9=["src"],I9=["src","alt","onError"],P9={class:"px-1 mt-2"},M9={class:"text-xs line-clamp-2 font-medium"},O9={class:"h-6 min-w-6 px-0.5 font-medium text-gray-500 flex items-center justify-center text-[10px] bg-gray-200 absolute top-0 right-0 rounded-bl-xl"},L9={class:"py-3 px-4 border-t border-t-gray-200 flex items-center justify-between"},R9={class:"text-sm text-gray-700"},D9={class:"text-sm"},j9=ct(()=>l("span",{class:"mr-1 text-gray-500"},"Tổng tiền:",-1)),N9={class:"text-red-500 test-sm font-semibold"},F9=["onClick"],q9={key:0,class:"h-[380px] flex items-center justify-center"},z9=[ct(()=>l("div",null,[l("div",{class:"flex flex-col items-center justify-center space-y-2"},[l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",class:"text-gray-700"},[l("circle",{cx:"8",cy:"21",r:"1"}),l("circle",{cx:"19",cy:"21",r:"1"}),l("path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"})]),l("div",{class:"text-lg font-semibold text-gray-700"}," Không tìm thấy đơn hàng ")])],-1))],B9={class:"relative py-6 bg-white rounded-t-2xl overflow-hidden outline-none"},U9={class:"flex items-center pl-4 pr-6"},V9={key:0,class:"h-[40px] w-full rounded-xl bg-gray-100 ml-3"},H9=ct(()=>l("div",{class:"font-semibold text-gray-900 text-lg tracking-tight"}," Đơn hàng chi tiết ",-1)),W9={key:0,class:"flex items-center justify-center h-[26px] px-3 text-xs font-medium bg-blue-50 text-blue-600 rounded-md ml-auto"},G9={class:"relative max-h-[480px] overflow-y-scroll scroll-hidden space-y-4 px-6 mt-4"},K9=[ct(()=>l("div",{class:"h-[42px] rounded-xl bg-gray-100"},null,-1)),ct(()=>l("div",{class:"flex-1 rounded-xl bg-gray-100"},null,-1)),ct(()=>l("div",{class:"h-[52px] rounded-xl bg-gray-100"},null,-1))],Q9={class:"rounded-xl border border-gray-200"},J9=ct(()=>l("div",{class:"py-3 px-4 text-base font-medium text-gray-900 border-b border-b-gray-200"}," Thông tin người nhận ",-1)),X9={class:"py-3 px-4 space-y-2"},Z9={key:0,class:"flex space-x-3"},Y9=ct(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Họ và tên ",-1)),eP={class:"text-sm text-gray-700 font-medium"},tP={class:"flex space-x-3"},nP=ct(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Số điện thoại ",-1)),sP={class:"text-sm text-gray-700 font-medium"},rP={class:"flex space-x-3"},oP=ct(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Địa chỉ nhận hàng ",-1)),iP={class:"text-sm text-gray-700 font-medium"},aP={class:"rounded-xl border border-gray-200"},lP=ct(()=>l("div",{class:"py-3 px-4 text-base font-medium text-gray-900 border-b border-b-gray-200"}," Thông tin đơn hàng ",-1)),cP={class:"py-3 px-4 space-y-2"},uP={class:"flex space-x-3"},dP=ct(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Ngày đặt hàng ",-1)),fP={class:"text-sm text-gray-700 font-medium"},hP={class:"flex space-x-3"},pP=ct(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Mã đơn hàng ",-1)),mP={class:"text-sm text-gray-700 font-medium"},gP=ct(()=>l("div",{class:"flex space-x-3"},[l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Phương thức thanh toán "),l("div",{class:"text-sm text-gray-700 font-medium"}," Thanh toán tiền mặt khi nhận hàng (COD) ")],-1)),vP={key:0,class:"flex space-x-3"},yP=ct(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Ghi chú ",-1)),bP={class:"text-sm text-gray-700 font-medium"},_P=ct(()=>l("div",{class:"font-semibold text-gray-700 mb-3"}," Sản phẩm đã đặt ",-1)),xP={class:"space-y-3 mb-4 border-b border-b-gray-200 pb-4"},wP={class:"flex items-center justify-between"},kP=ct(()=>l("div",{class:"text-gray-500 mr-2 text-sm"}," Tổng tiền hàng ",-1)),SP={class:"text-right text-[16px] font-medium"},CP={class:"text-gray-700 text-sm"},$P={key:0,class:"flex items-center justify-between"},TP=ct(()=>l("div",{class:"text-gray-500 mr-2 text-sm"}," Khuyến mãi ",-1)),AP={class:"text-right text-[16px] font-medium"},EP={class:"text-green-500 text-sm"},IP={key:1,class:"flex items-center justify-between"},PP=ct(()=>l("div",{class:"text-gray-500 mr-2 text-sm"}," Phí vận chuyển ",-1)),MP={class:"text-right text-base"},OP={class:"text-gray-700 text-sm"},LP={class:"flex items-center justify-between mt-2"},RP=ct(()=>l("div",{class:"text-gray-500 mr-2 text-sm"},[l("span",{class:"font-medium text-gray-900"},"Tổng cộng"),l("span",{class:"text-xs ml-1"},"(Đã bao gồm VAT)")],-1)),DP={class:"text-red-500 text-base font-semibold"},jP=Qe({__name:"FlowAuth",props:Qr(["chatViewRef"],{open:{},openModifiers:{}}),emits:["update:open"],setup(e){var S,E;const t=fr(e,"open"),n=R("phone"),s=R(!1),r=((E=(S=U.bot)==null?void 0:S.config)==null?void 0:E.ui.logo)||`${U.appDomain}/link.png`,o=Z(()=>[{name:"phone",active:n.value==="phone"},{name:"otp",active:n.value==="otp"},{name:"success",active:n.value==="success"},{name:"orders",active:n.value==="orders"},{name:"order-detail",active:n.value==="order-detail"},{name:"account",active:n.value==="account"}]),i=O=>{o.value.find(P=>P.name===O)&&(n.value=O)},a=R(null),c=O=>{i("otp"),a.value=O.form.identifier},u=O=>{i("success")},d=async()=>{try{const O=await Xe.auth.logout();U.user=null,U.token=null,s.value=!1,Tt.remove(ss);const{data:I}=await Xe.cart.getList();I.success&&(U.cart=I.data,ECG.sync.emit("logout",{source:"easy-ai-chat",data:I.data}))}catch{}},f=R([]),h=R(null),g=R({}),p=R(!1),v=R(!1),_=async()=>{try{const{data:O}=await Xe.order.getStatuses();if(O.success){const I=O.data||[];g.value=I.reduce((P,M)=>(P[M.code]=M.name,P),{})}}catch(O){console.log("error: ",O)}},w=async()=>{try{p.value=!0,_();const{data:O}=await Xe.order.getList({paginate:!1});O.success&&(f.value=O.data.orders)}catch(O){const I=O.response.data.raw;I.success&&(f.value=I.data.orders)}finally{p.value=!1}},k=async O=>{try{if(!O||v.value)return;i("order-detail"),v.value=!0;const{data:I}=await Xe.order.getOne(O);I.success&&(h.value=I.data)}catch{}finally{v.value=!1}};return Pe(s,O=>{O&&w()}),(O,I)=>(m(),x(_e,null,[l("div",l9,[y(U).user?(m(),x("button",{key:0,onClick:I[0]||(I[0]=P=>s.value=!s.value),class:"size-8 flex items-center justify-center rounded-lg cursor-pointer bg-white/10 hover:bg-white/20"},[G(y(ug),{size:"14"})])):(m(),x("button",{key:1,onClick:I[1]||(I[1]=P=>(t.value=!0,n.value="phone")),class:"size-8 flex items-center justify-center rounded-lg cursor-pointer bg-white/10 hover:bg-white/20"},[G(y(ug),{size:"14"})])),l("div",{class:ne(["ecg-account-menu",s.value&&"open"])},[l("button",{onClick:I[2]||(I[2]=P=>(s.value=!1,t.value=!0,n.value="account")),class:"ecg-account-menu-item"},c9),l("button",{onClick:I[3]||(I[3]=P=>(s.value=!1,t.value=!0,n.value="orders")),class:"ecg-account-menu-item"},u9),l("button",{class:"ecg-account-menu-item",onClick:I[4]||(I[4]=P=>d())},d9)],2)]),G(Qg,{chatViewRef:e.chatViewRef,open:t.value,"onUpdate:open":I[7]||(I[7]=P=>t.value=P),slotNames:o.value},{phone:Se(()=>[G(Xg,{onSuccess:c})]),otp:Se(()=>[G(Zg,{identifier:a.value,onSuccess:u},null,8,["identifier"])]),success:Se(()=>[l("div",f9,[h9,p9,l("div",m9,[l("button",{onClick:I[5]||(I[5]=P=>t.value=!1),class:"flex items-center justify-center h-12 w-full rounded-lg text-base bg-primary text-white hover:opacity-80 font-medium"}," Tiếp tục mua sắm ")])])]),orders:Se(()=>[l("div",g9,[v9,y9,l("div",b9,[p.value?(m(),x(_e,{key:0},Me(3,(P,M)=>l("div",{key:M,class:"rounded-xl animate-pulse bg-white overflow-hidden h-[316px] flex flex-col space-y-3 p-3 border border-gray-100"},_9)),64)):(m(),x(_e,{key:1},[(m(!0),x(_e,null,Me(f.value,P=>(m(),x("div",x9,[l("div",w9,[l("div",k9,[S9,l("span",C9,"#"+j(P.order_number),1)]),g.value[P.status]?(m(),x("div",$9,j(g.value[P.status]),1)):z("",!0)]),l("div",T9,[(m(!0),x(_e,null,Me(P.items,M=>(m(),x("div",{class:ne([P.items.length>2?"ml-4 last:ml-0":"ml-4","w-[120px] flex-shrink-0 px-2 pt-6 pb-3 bg-gray-100 rounded-xl relative overflow-hidden"])},[l("div",A9,[M.fe_is_image_error?(m(),x("img",{key:0,src:y(r),alt:"image error",class:"w-[28px] h-[28px]"},null,8,E9)):(m(),x("img",{key:1,src:M.image,alt:M.name,class:"w-full h-full object-cover",onError:q=>M.fe_is_image_error=!0},null,40,I9))]),l("div",P9,[l("div",M9,j(M.name),1)]),l("div",O9," x"+j(M.quantity),1)],2))),256))]),l("div",L9,[l("div",null,[l("div",R9,j(P.total_items)+" sản phẩm ",1),l("div",D9,[j9,l("span",N9,j(y(et)(P.total_price)),1)])]),l("button",{onClick:M=>k(P.id),class:"px-4 h-9 hover:bg-gray-200 text-gray-700 rounded-xl flex items-center justify-center text-sm font-medium border"}," Xem chi tiết ",8,F9)])]))),256)),f.value.length===0?(m(),x("div",q9,z9)):z("",!0)],64))])])]),"order-detail":Se(()=>[l("div",B9,[l("div",U9,[v.value?(m(),x("div",V9)):(m(),x(_e,{key:1},[l("button",{onClick:I[6]||(I[6]=P=>i("orders")),class:"size-10 flex items-center justify-center rounded-full hover:bg-gray-100 text-gray-900 mr-0.5"},[G(Jg)]),H9,g.value[h.value.status]?(m(),x("div",W9,j(g.value[h.value.status]),1)):z("",!0)],64))]),l("div",G9,[v.value||!h.value?(m(),x(_e,{key:0},Me(3,(P,M)=>l("div",{key:M,class:"rounded-xl animate-pulse bg-white overflow-hidden h-[280px] flex flex-col space-y-3 p-3 border border-gray-200"},K9)),64)):(m(),x(_e,{key:1},[l("div",Q9,[J9,l("div",X9,[h.value.shipping_address.name?(m(),x("div",Z9,[Y9,l("div",eP,j(h.value.shipping_address.name),1)])):z("",!0),l("div",tP,[nP,l("div",sP,j(h.value.shipping_address.phone),1)]),l("div",rP,[oP,l("div",iP,j(`${h.value.shipping_address.address1}`),1)])])]),l("div",aP,[lP,l("div",cP,[l("div",uP,[dP,l("div",fP,j(y(ja)(h.value.created_at)),1)]),l("div",hP,[pP,l("div",mP," #"+j(h.value.order_number),1)]),gP,h.value.note?(m(),x("div",vP,[yP,l("div",bP,j(h.value.note??"---"),1)])):z("",!0)])]),l("div",null,[_P,l("div",xP,[(m(!0),x(_e,null,Me(h.value.items,P=>(m(),oe(Ll,{key:P.sku,item:P},null,8,["item"]))),128))]),l("div",null,[l("div",wP,[kP,l("div",SP,[l("div",CP,j(y(et)(h.value.subtotal_price)),1)])]),h.value.total_discounts?(m(),x("div",$P,[TP,l("div",AP,[l("div",EP,j(y(et)(h.value.total_discounts)),1)])])):z("",!0),h.value.shipping_price?(m(),x("div",IP,[PP,l("div",MP,[l("div",OP,j(y(et)(h.value.shipping_price)),1)])])):z("",!0),l("div",LP,[RP,l("div",DP,j(y(et)(h.value.total_price)),1)])])])],64))])])]),account:Se(()=>[G(a9)]),_:1},8,["chatViewRef","open","slotNames"])],64))}},[["__scopeId","data-v-d8858f82"]]),NP={key:0,class:"relative"},FP={key:0,class:"absolute top-0 inset-x-0 -translate-y-[110%]"},qP={class:"bg-red-50 w-[100%] rounded-2xl relative py-3 pl-4 pr-10 flex items-start border border-red-300"},zP={class:"space-y-2"},BP={class:"text-red-600 whitespace-pre-line flex items-start"},UP={class:"pt-0.5"},VP={class:"text-sm"},HP={key:1,class:"custom-scrollbar"},WP={class:"flex space-x-2.5 w-fit pt-2"},GP=["onClick"],KP={key:0,class:"group relative w-full h-full"},QP=["src"],JP={key:0,class:"inset-0 absolute bg-white/10"},XP={key:1,class:"absolute inset-0 flex items-center justify-center"},ZP=Qe({__name:"FilePreview",props:{disabled:{type:Boolean,default:!1},showEmptyState:{type:Boolean,default:!0}},setup(e){const t=e,{removeFile:n,displayFiles:s,isImageFile:r,errors:o}=_l();Pe(o,a=>{if(a&&a.length>0){const c=setTimeout(()=>{o.value=[],clearTimeout(c)},5e3)}});const i=a=>{t.disabled||n(a)};return(a,c)=>y(s).length>0||y(o).length>0?(m(),x("div",NP,[y(o).length>0?(m(),x("div",FP,[l("div",qP,[l("div",zP,[(m(!0),x(_e,null,Me(y(o),u=>(m(),x("div",BP,[l("div",UP,[G(y(D2),{size:"20","stroke-width":"1.5",class:"flex-shrink-0 mr-2"})]),l("p",VP,j(u),1)]))),256))]),l("button",{onClick:c[0]||(c[0]=u=>o.value=[]),class:"size-7 flex-shrink-0 rounded-3xl flex items-center justify-center absolute top-2 right-1.5"},[G(y(Es),{size:"18",class:"text-red-500"})])])])):z("",!0),y(s).length>0?(m(),x("div",HP,[l("div",WP,[(m(!0),x(_e,null,Me(y(s),(u,d)=>(m(),x("div",{key:u.file_id||`file-${d}`,class:"eac-card-file"},[l("button",{type:"button",class:"eac-remove-file",onClick:f=>i(u.file_id||d)},[G(y(Es),{size:"12","stroke-width":"2"})],8,GP),l("div",{class:ne(["relative border border-gray-200 overflow-hidden rounded-xl",{"w-[240px] sm:w-[268px] h-[60px]":!y(r)(u.mime_type),"w-[80px] h-[80px]":y(r)(u.mime_type),"shadow-sm":y(r)(u.mime_type)}])},[y(r)(u.mime_type)?(m(),x("div",KP,[l("img",{src:u.url||u.previewUrl,alt:"preview",class:"w-full h-full object-cover"},null,8,QP),u.loading?(m(),x("div",JP)):z("",!0),u.loading?(m(),x("div",XP,[G(y(G2),{size:"18",class:"animate-spin text-white mt-1"})])):z("",!0)])):(m(),oe(Tg,{key:1,file:u},null,8,["file"]))],2)]))),128))])])):z("",!0)])):z("",!0)}},[["__scopeId","data-v-c3e36a9e"]]),YP={class:"w-fit relative group"},eM=["accept","multiple"],tM=["disabled"],nM={key:0,class:"absolute hidden group-hover:block bg-orange-100 text-orange-500 -right-12 w-[150px] px-3 py-1 text-center text-xs border rounded-xl shadow-sm top-0 -translate-y-full"},sM={__name:"FileTrigger",props:{disabled:{type:Boolean,default:!1},handle:{type:String,default:""},toolbar:{type:Object,default:()=>({})},accept:{type:String,default:""}},setup(e){const t=e,{allowedExtensions:n,validateFiles:s,updateConfig:r,uploadFilesToServer:o,files:i,maxFilesAllowed:a,errors:c,processedFiles:u}=_l();ks(()=>{t.toolbar&&r(t.toolbar)});const d=Z(()=>t.accept?t.accept:n.value.join(",")),f=Z(()=>!0),h=R(null),g=()=>{t.disabled||u.value.length>=a.value||h.value.click()},p=async v=>{if(t.disabled||u.value.length>=a.value)return;const _=v.target.files;if(!_.length)return;const w=u.value.length+i.value.length;if(w>=a.value){c.value=[`Chỉ được phép tải lên tối đa ${a.value} file`],v.target.value="";return}const k=a.value-w,S=Array.from(_).slice(0,k);_.length>k&&(c.value=[`Chỉ được tải thêm ${k} file. Đã loại bỏ ${_.length-k} file cuối`]),s(S)&&await o(),v.target.value=""};return(v,_)=>(m(),x("div",YP,[l("input",{ref_key:"fileInput",ref:h,type:"file",class:"hidden",accept:d.value,multiple:f.value,onChange:p},null,40,eM),l("button",{type:"button",class:"size-9 flex items-center justify-center rounded-full sm:hover:bg-gray-100 cursor-pointer text-gray-500",onClick:g,disabled:e.disabled},[G(y(Gu),{size:"18"})],8,tM),y(u).length>=y(a)?(m(),x("div",nM," Chỉ được phép tải lên tối đa "+j(y(a))+" file ",1)):z("",!0)]))}},pd={en:"en-US",vi:"vi-VN",ja:"ja-JP"},rM=e=>e&&pd[e]?pd[e]:e&&e.includes("en-")||e==="en"?"en-US":e&&e.includes("vi-")||e==="vi"?"vi-VN":e&&e.includes("ja-")||e==="ja"?"ja-JP":pd.ja,Ce=dt({isOpen:!1,isRecording:!1,isProcessing:!1,isStartSpeechToText:!1,showPermissionDenied:!1,permissionStatus:"prompt",recognition:null,recordedTranscript:"",finalTranscript:"",recordTime:0,recordingTimer:null,recordingStartTime:null,maxRecordingTime:60,restartTimeout:null});function md(){const{isOpen:e,isRecording:t,isProcessing:n,isStartSpeechToText:s,showPermissionDenied:r,permissionStatus:o,recordedTranscript:i,recordTime:a}=Et(Ce),c=Z(()=>{switch(Ce.permissionStatus){case"prompt":return{type:"info",title:"Cần quyền truy cập mic",message:"Nhấn vào nút mic và cho phép trình duyệt truy cập để bắt đầu nói chuyện với tôi."};case"granted":return null;case"denied":return{type:"error",title:"Không thể truy cập mic",message:"Bạn cần cấp quyền mic trong cài đặt trình duyệt. Nhấn vào biểu tượng ổ khóa bên cạnh URL và bật quyền mic."};case"not_supported":return{type:"error",title:"Trình duyệt không hỗ trợ Mic",message:"Rất tiếc, trình duyệt hiện tại chưa hỗ trợ nhận diện giọng nói. Vui lòng dùng Chrome, Edge hoặc Safari phiên bản mới nhất để trò chuyện."};default:return null}}),u=()=>{Ce.isOpen=!Ce.isOpen},d=()=>{Ce.isOpen=!0},f=()=>{Ce.isOpen=!1},h=B=>{Ce.isProcessing=B},g=()=>{const B="webkitSpeechRecognition"in window||"SpeechRecognition"in window;return B||(Ce.permissionStatus="not_supported"),B},p=async()=>{try{return!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia?(Ce.permissionStatus="not_supported",{granted:!1,reason:"not_supported"}):((await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(T=>T.stop()),Ce.permissionStatus="granted",{granted:!0})}catch(B){return B.name==="NotAllowedError"||B.name==="PermissionDeniedError"?(Ce.permissionStatus="denied",{granted:!1,reason:"denied"}):B.name==="NotFoundError"?(Ce.permissionStatus="denied",{granted:!1,reason:"not_found"}):(Ce.permissionStatus="denied",{granted:!1,reason:"error"})}},v=()=>{Ce.showPermissionDenied=!0,Ce.permissionStatus="denied"},_=()=>{Ce.showPermissionDenied=!1},w=()=>{Ce.recordTime=0,Ce.recordingStartTime=Date.now(),Ce.recordingTimer=setInterval(()=>{Ce.recordTime=Math.floor((Date.now()-Ce.recordingStartTime)/1e3),Ce.recordTime>=Ce.maxRecordingTime&&I()},1e3)},k=()=>{Ce.recordingTimer&&(clearInterval(Ce.recordingTimer),Ce.recordingTimer=null,Ce.recordingStartTime&&(Ce.recordTime=Math.floor((Date.now()-Ce.recordingStartTime)/1e3)))},S=()=>{Ce.restartTimeout&&(clearTimeout(Ce.restartTimeout),Ce.restartTimeout=null)},E=()=>{try{if(!g())return Ce.permissionStatus="not_supported",!1;const B=window.SpeechRecognition||window.webkitSpeechRecognition;return Ce.recognition=new B,Ce.recognition.continuous=!0,Ce.recognition.interimResults=!0,Ce.recognition.lang=rM(Xs.state.locale),Ce.recognition.maxAlternatives=1,Ce.recognition.onstart=()=>{Ce.isRecording=!0,Ce.permissionStatus="granted"},Ce.recognition.onend=()=>{Ce.isStartSpeechToText&&Ce.recognition&&(S(),Ce.restartTimeout=setTimeout(()=>{if(Ce.isStartSpeechToText&&Ce.recognition)try{Ce.recognition.start()}catch{}},300))},Ce.recognition.onresult=T=>{let A="";for(let D=T.resultIndex;D<T.results.length;D++){const Q=T.results[D][0].transcript;T.results[D].isFinal?Ce.finalTranscript+=Q:A+=Q}Ce.recordedTranscript=Ce.finalTranscript+A},Ce.recognition.onerror=T=>{T.error==="no-speech"&&Ce.isStartSpeechToText?(S(),Ce.restartTimeout=setTimeout(()=>{if(Ce.isStartSpeechToText&&Ce.recognition)try{Ce.recognition.start()}catch{}},300)):(T.error==="not-allowed"||T.error==="service-not-allowed")&&(Ce.isStartSpeechToText=!1,Ce.permissionStatus="denied",v())},!0}catch{return Ce.permissionStatus="not_supported",!1}},O=async()=>{try{if(!g())return Ce.permissionStatus="not_supported",!1;const B=await p();return B.granted?(Ce.recordedTranscript="",Ce.finalTranscript="",!Ce.recognition&&!E()?!1:Ce.recognition?(Ce.recognition.start(),Ce.isRecording=!0,Ce.isStartSpeechToText=!0,Ce.permissionStatus="granted",w(),!0):!1):(B.reason==="not_supported"?Ce.permissionStatus="not_supported":(Ce.permissionStatus="denied",v()),!1)}catch{return Ce.permissionStatus="denied",!1}},I=()=>{if(S(),Ce.isStartSpeechToText=!1,Ce.recognition)try{return Ce.isRecording&&Ce.recognition.stop(),Ce.isRecording=!1,k(),!0}catch{return!1}return!1};return{isOpen:e,isRecording:t,isProcessing:n,isStartSpeechToText:s,showPermissionDenied:r,permissionStatus:o,permissionMessage:c,recordedTranscript:i,recordTime:a,toggleChatVoice:u,openChatVoice:d,closeChatVoice:f,setProcessing:h,isSpeechRecognitionSupported:g,checkMicrophonePermission:p,showPermissionDeniedMessage:v,hidePermissionDeniedMessage:_,startSpeechRecognition:O,stopSpeechRecognition:I,resetTranscript:()=>{Ce.recordedTranscript="",Ce.finalTranscript="",Ce.recordTime=0},saveTranscript:()=>Ce.recordedTranscript&&Ce.recordedTranscript.trim()!==""?{type:"voice",content:Ce.recordedTranscript,timestamp:new Date().toISOString(),duration:Ce.recordTime}:null,releaseMediaResources:()=>{try{if(S(),Ce.isStartSpeechToText=!1,Ce.recognition){try{Ce.isRecording&&Ce.recognition.stop()}catch{}Ce.recognition=null}return Ce.recordedTranscript="",Ce.finalTranscript="",Ce.recordTime=0,Ce.isRecording=!1,Ce.recordingTimer&&(clearInterval(Ce.recordingTimer),Ce.recordingTimer=null),!0}catch{return!1}}}}const Fe={search:e=>{vt.track("web_search",e)},categoryView:e=>{vt.track("web_category_view",e)},productSelect:e=>{vt.track("web_product_select",e)},productView:e=>{vt.track("web_product_view",e)},addToCart:e=>{vt.track("web_add_to_cart",e)},removeFromCart:e=>{vt.track("web_remove_from_cart",e)},checkout:e=>{vt.track("web_checkout",e)},purchase:e=>{vt.track("web_purchase",e)},cartView:e=>{vt.track("web_cart_view",e)},addShippingInfo:e=>{vt.track("web_add_shipping_info",e)},addPaymentInfo:e=>{vt.track("web_add_payment_info",e)},selectPromotion:e=>{vt.track("web_promotion_select",e)},viewPromotion:e=>{vt.track("web_promotion_view",e)},login:e=>{vt.track("web_login",e)},signUp:e=>{vt.track("web_sign_up",e)},generateLead:e=>{vt.track("web_generate_lead",e)},trackOrder:e=>{vt.track("web_order_track",e)},buttonClick:e=>{vt.track("web_button_click",e)}},oM=Object.freeze(Object.defineProperty({__proto__:null,initMetricWebsiteFactory:async()=>{try{const e=ae.state.handle;if(!e)return;switch(e){case On:await Promise.resolve().then(()=>SB);break;case xr:await Promise.resolve().then(()=>sU);break;case $s:await Promise.resolve().then(()=>EU);break;case fi:await Promise.resolve().then(()=>XU);break;case kr:await Promise.resolve().then(()=>pV);break;default:break}}catch(e){console.error(`Failed to load metric for ${handle}:`,e)}},metric:vt,metricChatbot:Qt,metricWebsite:Fe},Symbol.toStringTag,{value:"Module"})),iM={class:"max-h-screen overflow-y-auto scroll-hidden"},aM={class:"flex justify-between items-start mb-4 outline-none ring-0",tabindex:"0"},lM={class:"flex items-center gap-2"},cM={class:"size-8 rounded-full overflow-hidden",style:{"max-width":"32px"}},uM=["src","alt"],dM={key:0,class:"font-semibold text-primary"},fM={class:"mb-5 px-1 select-text"},hM=["innerHTML"],pM=["innerHTML"],mM={class:"space-y-4"},gM={class:"mt-6"},vM=["disabled"],yM={key:1,class:"px-3 flex justify-center items-center bg-primary h-[46px] text-white rounded-xl text-center text-base"},bM=l("div",null,"Đã gửi thành công",-1),_M={__name:"WidgetFormRenderPreSend",props:{bot:{type:Object,required:!0},widget:{type:Object,required:!0},chatViewRef:{type:Object,required:!0}},setup(e){const t=e,{isOpenLeadForm:n}=Et(ae.state),s=R(!As()),r=R(!1),o=R(!1),i=dt({}),a=R({}),c=R(!1),u=Z(()=>Object.keys(a.value).length>0?!1:t.widget.fields.filter(g=>{var p;return(p=g.validate)==null?void 0:p.includes("required")}).map(g=>g.name).every(g=>{const p=i[g];return typeof p=="boolean"?p===!0:p&&p.toString().trim()!==""})),d=(h,g)=>{g?delete a.value[h]:a.value[h]=""},f=async()=>{if(c.value=!0,!(Object.keys(a.value).length>0))try{r.value=!0;const g={};t.widget.fields.forEach(_=>{g[_.name]=i[_.name]}),g.user_id=Qs(),g.page_url=window.location.href;const{data:p}=await Xe.submission.submitWidget({widgetId:t.widget.id,formData:{status:"submitted",submission_data:g}}),v={};t.widget.fields.forEach(_=>{["name","phone","email"].includes(_.name)&&(v[_.name]=i[_.name]||"")}),ae.actions.updateChatState({visitor:v,isOpen:!0}),Qt.widgetContact({widget_id:t.widget.id,widget_type:t.widget.type,form_data:(p==null?void 0:p.submission_data)||{}}),o.value=!0,setTimeout(()=>{n.value=!1},1500)}catch(g){console.log("Error: ",g)}finally{r.value=!1}};return(h,g)=>(m(),oe(y(bo),{modal:!s.value,dismissible:!1,open:y(n),"onUpdate:open":g[1]||(g[1]=p=>Ft(n)?n.value=p:null),shouldScaleBackground:!1},{default:Se(()=>[G(y(nr),{to:e.chatViewRef},{default:Se(()=>[l("div",{class:ne(["drawer-overlay-custom backdrop-blur-sm",[y(n)&&"drawer-overlay-custom--open"]])},null,2),G(y(rr),{"aria-describedby":"widget lead form",class:"absolute p-5 bg-white rounded-3xl bottom-8 lg:bottom-5 z-50 inset-x-4 lg:inset-x-5 outline-none overflow-hidden"},{default:Se(()=>[G(y(Tl),{"aria-describedby":"widget lead form title",class:"hidden"}),G(y(Al),{"aria-describedby":"widget lead form desc",class:"hidden"}),l("div",iM,[l("div",aM,[l("div",lM,[l("div",cM,[l("img",{src:e.bot.config.ui.logo,alt:e.bot.config.ui.name,class:"w-full"},null,8,uM)]),e.bot.config.ui.name?(m(),x("div",dM,j(e.bot.config.ui.name),1)):z("",!0)]),z("",!0)]),l("div",null,[l("div",fM,[l("div",{class:"text-gray-800 text-lg font-medium leading-[120%]",innerHTML:e.widget.formHeaderTitle||"Vui lòng để lại thông tin"},null,8,hM),e.widget.formHeaderSubTitle?(m(),x("p",{key:0,innerHTML:e.widget.formHeaderSubTitle,class:"text-base text-gray-700 mt-2 leading-[140%]"},null,8,pM)):z("",!0)]),l("form",{onSubmit:Gt(f,["prevent"])},[l("div",mM,[(m(!0),x(_e,null,Me(t.widget.fields,p=>(m(),oe(rd,{key:p.name,modelValue:i[p.name],"onUpdate:modelValue":v=>i[p.name]=v,field:p,error:a.value[p.name],disabled:o.value,onValidate:d},null,8,["modelValue","onUpdate:modelValue","field","error","disabled"]))),128))]),l("div",gM,[o.value?z("",!0):(m(),x("button",{key:0,type:"submit",class:ne(["w-full font-medium bg-primary text-white text-base h-[46px] rounded-xl focus:outline-none ring-0 flex justify-center items-center",[u.value?"":"opacity-70 cursor-not-allowed"]]),disabled:r.value||!u.value},j(r.value?"Đang gửi...":e.widget.buttonText||"Gửi"),11,vM)),o.value?(m(),x("div",yM,[bM,G(y(Ku),{size:"16",class:"ml-2"})])):z("",!0)])],32)])])]),_:1})]),_:1},8,["to"])]),_:1},8,["modal","open"]))}},xM={key:0,class:"flex-shrink-0 px-1.5 py-[3px] text-blue-500 bg-blue-50 w-fit rounded-xl flex items-center gap-1.5 translate-y-1.5"},wM=l("span",{class:"text-xs"},"Đang phát trực tiếp",-1),kM={key:1,class:"flex items-center gap-1.5 bg-blue-50 rounded-full pl-1 pr-2.5 py-1 w-fit translate-y-1.5"},SM={class:"text-[11px] leading-3 font-medium tracking-tight tabular-nums text-right text-blue-400"},CM=16,$M={__name:"ChatVoiceCard",props:{audioSrc:{type:String,required:!0},isLastAudio:{type:Boolean,default:!1},assistantProcessing:{type:Boolean,default:!1},voiceProcessing:{type:Boolean,default:!1}},setup(e){const t=e,n=R(null),s=R(!1),r=R(0),o=R(0),i=R([]),a=Z(()=>o.value?r.value/o.value:0),c=Z(()=>{if(!o.value&&!r.value)return"00:00";const p=s.value||r.value>.5?r.value:o.value;return d(p)}),u=()=>Array.from({length:CM},()=>Math.floor(Math.random()*70)+30),d=p=>{if(!p||isNaN(p))return"00:00";const v=Math.floor(p/60),_=Math.floor(p%60);return`${v.toString().padStart(2,"0")}:${_.toString().padStart(2,"0")}`},f=()=>{n.value&&(s.value?n.value.pause():n.value.play())},h=p=>{if(!n.value||!o.value)return;const v=p.currentTarget.getBoundingClientRect(),_=p.clientX-v.left,w=Math.max(0,Math.min(1,_/v.width));n.value.currentTime=w*o.value,r.value=n.value.currentTime},g=()=>{n.value&&(n.value.pause(),n.value=null),t.audioSrc&&(n.value=new Audio(t.audioSrc),s.value=!1,r.value=0,o.value=0,n.value.addEventListener("loadedmetadata",()=>{o.value=n.value.duration}),n.value.addEventListener("timeupdate",()=>{n.value&&(r.value=n.value.currentTime)}),n.value.addEventListener("play",()=>s.value=!0),n.value.addEventListener("pause",()=>s.value=!1),n.value.addEventListener("ended",()=>{s.value=!1,r.value=0}))};return Pe(()=>t.audioSrc,()=>{g()}),Je(()=>{i.value=u(),g()}),Rt(()=>{n.value&&(n.value.pause(),n.value.src="",n.value=null)}),(p,v)=>e.isLastAudio&&e.voiceProcessing&&!e.assistantProcessing?(m(),x("div",xM,[G(y(Vu),{size:"16"}),wM])):(m(),x("div",kM,[l("button",{onClick:f,class:ne([s.value?"bg-blue-500":"bg-blue-400","flex-shrink-0 size-5 flex items-center justify-center text-white rounded-full hover:bg-blue-500 active:scale-95 transition-all duration-200 focus:outline-none"])},[s.value?(m(),oe(y(tk),{key:0,size:10,fill:"currentColor"})):(m(),oe(y(og),{key:1,size:10,fill:"currentColor",class:"ml-0.5"}))],2),l("div",{class:"flex items-center gap-0.5 h-3.5 cursor-pointer group",onClick:h,title:"Click to seek"},[(m(!0),x(_e,null,Me(i.value,(_,w)=>(m(),x("div",{key:w,class:ne(["w-[3px] rounded-full transition-colors duration-100 ease-linear group-hover:opacity-80",w/i.value.length<a.value?"bg-blue-400":"bg-blue-200"]),style:ht({height:`${_}%`})},null,6))),128))]),l("div",SM,j(c.value),1)]))}},TM={__name:"CardAgentJoinExit",props:{message:{type:Object,required:!0},bot:{type:Object,required:!0}},emits:["scroll-to-bottom"],setup(e,{emit:t}){const n=e,s=t;return Z(()=>{const r=n.bot.config.initialMessage.messages||[];return Object.values(r).map(o=>({content:o.content,content_type:o.displayType,sender_type:"assistant",is_welcome_message:!0}))}),Je(()=>{s("scroll-to-bottom")}),(r,o)=>z("",!0)}},AM={class:"flex items-end gap-2 my-1"},EM={class:"relative flex flex-shrink-0 overflow-hidden bg-white rounded-full size-8 message-avatar"},IM=["src","alt"],PM={class:"flex-1 flex items-center gap-1.5 flex-wrap"},MM=["onClick"],OM={class:"leading-none"},LM={__name:"CardCtaText",props:{elements:{type:Array,default:()=>[]},title:{type:String,default:""},bot:{type:Object,default:()=>({})}},emits:["send-message"],setup(e,{emit:t}){const n=t,s=i=>typeof i=="string"?i:(i==null?void 0:i.label)||i,r=i=>typeof i=="string"?i:(i==null?void 0:i.full_content)||(i==null?void 0:i.label)||i,o=i=>{Qt.ctaClick({type:"follow_up_questions",value:i}),n("send-message",i)};return(i,a)=>{var c,u,d;return m(),x("div",AM,[l("div",EM,[(d=(u=(c=e.bot)==null?void 0:c.config)==null?void 0:u.ui)!=null&&d.logo?(m(),x("img",{key:0,src:e.bot.config.ui.logo,alt:e.bot.config.ui.name,class:"object-cover w-full h-full"},null,8,IM)):z("",!0)]),l("div",PM,[(m(!0),x(_e,null,Me(e.elements,(f,h)=>(m(),x("button",{key:h,onClick:g=>o(r(f)),class:"flex items-center justify-center p-3 border border-primary text-primary hover:bg-primary hover:text-white text-sm rounded-lg transition-colors"},[l("span",OM,j(s(f)),1)],8,MM))),128))])])}}},RM={class:"flex-1 max-w-[300px]"},DM={class:"bg-gray-50/90 border rounded-xl"},jM={class:"flex items-center gap-2 text-sm leading-none text-gray-700"},NM={class:"overflow-hidden"},FM={class:"pb-2 px-1 pt-0"},qM={class:"border-t border-gray-200 pt-2 space-y-1"},zM=["href","title"],BM={class:"flex items-center mt-0.5 justify-center size-4 text-xs bg-gray-400 text-white flex-shrink-0 rounded-full"},UM={class:"leading-5 underline decoration-dashed underline-offset-4 decoration-gray-400 truncate group-hover/cite:decoration-blue-500 min-w-0 break-words"},VM={__name:"CardCitations",props:{citations:{type:Array,default:()=>[]}},setup(e){const t=R(!1),n=s=>{try{return decodeURIComponent(s)}catch{return s}};return(s,r)=>(m(),x("div",RM,[l("div",DM,[l("div",{class:"flex items-center justify-between gap-4 px-3 py-3 cursor-pointer select-none",onClick:r[0]||(r[0]=o=>t.value=!t.value)},[l("div",jM,[G(y(M2),{size:16,class:"shrink-0"}),l("div",null,"Nguồn ("+j(e.citations.length)+")",1)]),G(y(mo),{size:16,class:ne(["text-gray-700 transition-transform duration-200",{"rotate-180":t.value}])},null,8,["class"])]),l("div",{class:ne(["grid transition-[grid-template-rows] duration-300 ease-in-out",t.value?"grid-rows-[1fr]":"grid-rows-[0fr]"])},[l("div",NM,[l("div",FM,[l("div",qM,[(m(!0),x(_e,null,Me(e.citations,(o,i)=>(m(),x("a",{key:i,href:o.link,target:"_blank",rel:"noopener noreferrer nofollow",title:n(o.title),class:"group/cite flex items-start gap-1.5 py-1.5 px-2 -mx-1 rounded-lg text-sm text-gray-700 hover:text-blue-600 transition-colors duration-150"},[l("div",BM,j(i+1),1),l("span",UM,j(n(o.title)),1)],8,zM))),128))])])])],2)])]))}},HM=e=>(mn("data-v-ddc21beb"),e=e(),gn(),e),WM={class:"flex items-end gap-2 my-1"},GM={class:"relative flex flex-shrink-0 overflow-hidden bg-white rounded-full size-8 message-avatar"},KM=["src","alt"],QM={class:"flex-1 min-w-0"},JM={class:"overflow-hidden rounded-2xl bg-white text-sm border border-gray-200 shadow-sm"},XM={class:"flex items-center gap-3 border-b bg-white border-gray-100 pl-4 pr-2 py-3"},ZM={class:"flex items-center gap-1 text-gray-900"},YM=HM(()=>l("div",{class:"text-lg font-semibold text-gray-900"}," Đơn hàng ",-1)),eO={key:0,class:"inline-flex ml-auto items-center gap-1.5 rounded-full bg-amber-50 px-2.5 py-1 text-xs font-medium text-amber-600"},tO={class:"px-4 py-3.5"},nO=["innerHTML"],sO={key:1,class:"mt-3 flex flex-col gap-2"},rO=["disabled","onClick"],oO=Qe({__name:"OrderCard",props:{message:{type:Object,required:!0},bot:{type:Object,default:()=>({})},conversationId:{type:[String,Object],default:null}},setup(e){const t=e,n=R(!1),s=Z(()=>yn(t.message.content)||{}),r=Z(()=>{var f;return Xa(((f=s.value)==null?void 0:f.body_markdown)||"",{separate:!1})[0]||""}),o=Z(()=>{var f,h;return((f=s.value)==null?void 0:f.status)==="draft"&&Array.isArray((h=s.value)==null?void 0:h.actions)&&s.value.actions.length>0}),i={confirmed:"Đã xác nhận",submitted:"Đã xác nhận",cancelled:"Đã hủy",paid:"Đã thanh toán"},a=Z(()=>{var f;return i[(f=s.value)==null?void 0:f.status]||""}),c=Z(()=>{var f,h;return((f=s.value)==null?void 0:f.status)==="cancelled"?"bg-red-50 text-red-600":((h=s.value)==null?void 0:h.status)==="paid"?"bg-green-50 text-green-600":"bg-primary/10 text-primary"}),u=()=>{const f=t.conversationId;return f&&typeof f=="object"&&"value"in f?f.value:f},d=async f=>{if(!(n.value||f.type!=="confirm")){n.value=!0;try{const{data:h}=await Xe.order.confirm(s.value.order_id,{conversation_id:u()}),g=h==null?void 0:h.data;h!=null&&h.success&&g?t.message.content=JSON.stringify({...s.value,...g}):pn.actions.error({message:"Xác nhận đơn thất bại, vui lòng thử lại."})}catch{pn.actions.error({message:"Xác nhận đơn thất bại, vui lòng thử lại."})}finally{n.value=!1}}};return(f,h)=>{var g,p,v;return m(),x("div",WM,[l("div",GM,[(v=(p=(g=e.bot)==null?void 0:g.config)==null?void 0:p.ui)!=null&&v.logo?(m(),x("img",{key:0,src:e.bot.config.ui.logo,alt:e.bot.config.ui.name,class:"object-cover w-full h-full"},null,8,KM)):z("",!0)]),l("div",QM,[l("div",JM,[l("div",XM,[l("div",ZM,[G(y(ln),{size:"18",class:"text-gray-700"}),YM]),s.value.status==="draft"?(m(),x("div",eO,[G(tn,{class:"size-3 text-current"}),We(" Chờ xác nhận ")])):z("",!0)]),l("div",tO,[l("div",{class:"prose prose-sm max-w-none",innerHTML:r.value},null,8,nO),a.value?(m(),x("div",{key:0,class:ne(["mt-3 inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium",c.value])},[s.value.status!=="cancelled"?(m(),oe(y(dl),{key:0,size:"13","stroke-width":"2"})):z("",!0),We(" "+j(a.value),1)],2)):z("",!0),o.value?(m(),x("div",sO,[(m(!0),x(_e,null,Me(s.value.actions,(_,w)=>(m(),x("button",{key:w,disabled:n.value,onClick:k=>d(_),class:ne(["flex h-[44px] w-full items-center justify-center gap-2 rounded-xl px-4 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-60",_.style==="primary"?"bg-primary text-white hover:opacity-90":"border border-primary text-primary hover:bg-primary hover:text-white"])},[n.value?(m(),oe(tn,{key:0,class:"size-4 text-current"})):_.type==="confirm"?(m(),oe(y(dl),{key:1,size:"17","stroke-width":"2"})):(m(),oe(y(ln),{key:2,size:"17","stroke-width":"1.8"})),l("span",null,j(_.label),1)],10,rO))),128))])):z("",!0)])])])])}}},[["__scopeId","data-v-ddc21beb"]]),iO={class:"relative ecg-widget-header"},aO={class:"flex items-center justify-between p-3.5 text-white bg-primary"},lO={class:"flex items-center gap-2"},cO=["aria-label"],uO=["src","alt"],dO={class:"text-base font-medium tracking-tight"},fO={class:"flex gap-1.5"},hO={key:0,class:"text-[10px] leading-[12px] h-3 min-w-3 tracking-tighter text-center font-semibold rounded-full absolute bg-white text-primary top-0 right-0"},pO={key:0,class:"text-[10px] leading-[12px] h-3 min-w-3 tracking-tighter text-center font-semibold rounded-full absolute bg-white text-primary top-0 right-0"},mO={class:"flex flex-col flex-grow px-2 pt-4 space-y-4 duration-100 lg:px-4 chat-content-item"},gO={class:"space-y-3 mb-4"},vO=["id"],yO=["src","alt"],bO=["id"],_O=["src","alt"],xO=["src","alt"],wO={key:2,class:"ml-auto"},kO={key:3,class:"relative w-full"},SO=["onClick"],CO={key:1,class:"relative pl-[40px]"},$O={key:0,class:"absolute bottom-0 left-0"},TO=["src","alt"],AO={key:7,class:"w-full"},EO={key:13,class:"flex items-end gap-2 w-full"},IO=["src","alt"],PO=["src","alt"],MO={key:0,class:"justify-center !items-start messages-group duration-200 pt-4 pb-2"},OO=["src","alt"],LO={class:"messages"},RO={key:1,class:"justify-center !items-start messages-group duration-200 opacity-100 py-4"},DO=["src","alt"],jO={class:"messages"},NO={key:0,class:"flex flex-col items-end py-4 space-y-2"},FO=["onClick","innerHTML"],qO={class:"relative"},zO=["aria-label","title"],BO={class:"relative z-30 bg-white"},UO={class:"w-full px-3 pt-1"},VO={class:"border border-gray-200 rounded-2xl"},HO={key:0,class:"p-2 pb-1"},WO={class:"flex items-center gap-1"},GO={class:"flex-shrink-0"},KO=["innerHTML"],QO={class:"relative flex w-full"},JO={key:0,class:"flex absolute top-1/2 -translate-y-1/2 left-1.5 z-10 items-center quick-prompts"},XO=["title"],ZO={key:0,class:"overflow-hidden quick-prompts-popover"},YO=["onClick"],e7=["placeholder"],t7={class:"absolute z-10 flex items-center duration-200 top-1/2 -translate-y-1/2 right-1"},n7={key:0,class:"size-3 rounded-sm bg-white"},Yg={__name:"ChatView",props:{showMenu:{type:Boolean,default:!1}},setup(e){const t=Wt({loader:()=>Promise.resolve().then(()=>bV),delay:1e3}),n=Wt({loader:()=>Promise.resolve().then(()=>WV),delay:1e3}),s=Wt({loader:()=>Promise.resolve().then(()=>KV),delay:1e3}),{bot:r,handle:o}=Et(U),{messages:i,conversationId:a,conversation:c,assistantProcessing:u,newMessageStatus:d,storageConversations:f,fetchMessages:h,refreshConversation:g,clickQuickPrompt:p,send:v,currentMessage:_,agentTyping:w,currentAgent:k,messagesContainerRef:S,scrollToBottom:E,validatedAgentAvatar:O,isAgentEnabled:I}=Ir({handle:o.value}),{voiceAudio:P}=jm({handle:o.value}),{processedFiles:M,uploadFilesToServer:q,setupPasteListener:B,cleanupPasteListener:T}=_l(),{isOpen:A,isStartSpeechToText:D,closeChatVoice:Q,releaseMediaResources:W}=md(),{widgets:H}=Ys(),{isLocked:K}=sd(),{t:J}=en(),te=R(!1),ge=R(!1),ue=R(null),we=le=>{ue.value={id:le.id,content:le.content,content_type:le.content_type,sender_type:le.sender_type,sender_name:le.sender_name||null},kt(()=>{fe.value&&fe.value.focus()})},Ee=()=>{ue.value=null},re=R(null),pe=R(null),fe=R(null),$e=R(!1),Re=R(!0),Le=R(null),Oe=R(!1);Wc("chatViewRef",re);const Ve=["file","gif","image","video","audio","sticker","business_card"],N=Z(()=>{const le=[];return i.value.forEach(xe=>{if(Ve.includes(xe.content_type))try{xe.content.forEach((at,gt)=>{le.push({...at,messageId:xe.id,messageIndex:gt})})}catch(Ge){console.warn("Failed to parse message content:",Ge)}}),le}),ee=Z(()=>!i.value.find(xe=>xe.sender_type==="user")),Y=Z(()=>{var xe,Ge,at;let le=((at=(Ge=(xe=r.value)==null?void 0:xe.config)==null?void 0:Ge.quickPrompt)==null?void 0:at.messages)||[];return le=Object.values(le),le.map(gt=>gt.content)}),L=Z(()=>{var le,xe,Ge;return!!((Ge=(xe=(le=r.value)==null?void 0:le.config)==null?void 0:xe.delay_response)!=null&&Ge.active)}),V=Z(()=>L.value||u.value),ie=Z(()=>{var xe,Ge;const le=(Ge=(xe=r.value)==null?void 0:xe.config)!=null&&Ge.stream?i.value:dw(i.value,"assistant");return ys(le)});Pe(a,le=>{ue.value=null,le?U.localStorageFormOrder=`${yu}-${a.value}`:(localStorage.removeItem(U.localStorageFormOrder),U.selectedForm=null,U.totalFormItems=0)},{immediate:!0});const me=le=>{if(le.key==="Escape"&&ue.value){Ee();return}if(le.key===" "&&le.stopPropagation(),!(le.key==="Enter"&&le.shiftKey)&&le.key==="Enter"&&!le.shiftKey){if(le.preventDefault(),ge.value||u.value&&!L.value)return;(_.value.trim().length>1||M.value.length>0)&&Ie()}},de=le=>{if(!fe.value)return;fe.value.style.height="auto";const Ge=Math.min(fe.value.scrollHeight,120);fe.value.style.height=`${Ge}px`},ve=le=>{le.stopPropagation(),de()},he=le=>{le.stopPropagation()},Te=le=>{le.stopPropagation()},je=le=>{if(!S.value)return;const xe=S.value,Ge=xe.scrollTop,at=xe.scrollHeight,gt=xe.clientHeight,_n=at-(Ge+gt);Oe.value=_n>300},De=()=>{E(),Oe.value=!1},Ie=async()=>{A.value&&(Q(),W());const le=_.value;_.value="",await q();const xe=M.value,Ge=ue.value;ue.value=null,v({message:le,files:xe,replyTarget:Ge}),M.value=[],fe.value&&(fe.value.style.height="44px")},He=le=>le.sender_type==="user";function ot(){if(!r.value)return;const le=r.value.config.initialMessage.messages??[],xe=r.value.config.introductionMessage,Ge=Object.values(le).map(gt=>gt.content);let at=_i(Ge).length;if(xe&&typeof xe=="string"&&(at+=1),at>0)for(let gt=0;gt<at;gt++)i.value[gt]&&(i.value[gt].is_welcome_message=!0)}const it=async()=>{var le,xe;try{const Ge=Tt.get(ss);if(!Ge)return;const{data:at}=await Xe.auth.getUser();at.success&&(U.user=at.data,U.token=Ge)}catch(Ge){((xe=(le=Ge.response.data)==null?void 0:le.raw)==null?void 0:xe.message)==="error_token_is_expired"&&(U.user=null,U.token=null,Tt.remove(ss))}},pt=async()=>{const{data:le}=await Xe.cart.getList();le.success&&(U.cart=le.data)},yt=async()=>{o.value===On&&await Promise.all([pt(),it()]),h({onSuccess:async()=>{ot()}})},Ot=async le=>{const{source:xe}=le||{};xe==="rangdongstore"&&pt()},cn=async()=>{try{await Xe.auth.logout(),U.user=null,U.token=null,Tt.remove(ss),pt()}catch{}},qt=(le={})=>{const{source:xe,data:Ge}=le;xe==="rangdongstore"&&(Tt.set(ss,Ge.access_token,"14d"),it(),pt())};Je(async()=>{await yt(),kC().getForms(),f.value[o.value]||localStorage.removeItem(`${yu}-${o.value}`),Le.value=window.location.origin,o.value===On&&window.ECG&&(ECG.sync.on("login",qt),ECG.sync.on("logout",cn),ECG.sync.on("cart",Ot)),B(),kt(async()=>{de()}),E({delay:500})}),zf(()=>{E()}),Rt(()=>{T()});const Dn=()=>{A.value&&(Q(),W())},se=async(le="")=>{await kt(),_.value=le,fe.value&&(fe.value.style.height="44px"),console.log("Voice input cancelled")},be=le=>{le&&le.trim()&&(_.value=le,kt(()=>{fe.value&&(fe.value.focus(),de())}))},qe=async le=>{(A.value||D.value)&&(Q(),W());const xe=le||"Không có nội dung thoại",Ge=o.value==="g8homevn";if(Ge)try{console.log("[ChatView] Unlocking audio for voice message..."),await P.unlockAudio()}catch(at){console.error("[ChatView] Failed to unlock audio:",at)}v({message:xe,mode:Ge?"voice":void 0,audio_url:Ge?!0:void 0}),_.value="",fe.value&&(fe.value.style.height="44px")},ze=async le=>{const xe=Pu(le)?le.message:le;p(xe),te.value=!1,await kt(),v({message:xe})};return Pe(i,()=>{E()}),(le,xe)=>{var Ge,at,gt,_n,jn,Qn,Tn,Jt,Bl,Ul,Dr;return m(),x("div",{id:"chat-view",ref_key:"chatViewRef",ref:re,class:"flex flex-col overflow-hidden bg-white"},[y(r)?(m(),x(_e,{key:0},[l("div",iO,[l("div",aO,[l("div",lO,[e.showMenu?(m(),x("button",{key:0,onClick:xe[0]||(xe[0]=ke=>le.$emit("close")),class:"p-1.5 rounded-lg hover:bg-white/10 text-white","aria-label":y(J)("common.back")},[G(y(go),{size:20})],8,cO)):z("",!0),y(r).config.ui.logo&&!e.showMenu?(m(),x("div",{key:1,class:ne(["flex items-center justify-center overflow-hidden bg-white size-8 shrink-0",y(o)===y(Cn)?"rounded":"rounded-full"])},[l("img",{src:y(r).config.ui.logo,alt:y(r).config.ui.name,loading:"lazy",class:"object-cover w-full h-full"},null,8,uO)],2)):z("",!0),l("h2",dO,j(y(r).config.ui.name),1)]),l("div",fO,[y(o)===y(On)?(m(),x(_e,{key:0},[G(jP,{chatViewRef:re.value},null,8,["chatViewRef"]),l("button",{onClick:xe[1]||(xe[1]=ke=>y(U).cart?$e.value=!0:null),class:ne(["relative flex items-center justify-center flex-shrink-0 p-2 rounded-lg size-8 bg-white/10 hover:bg-white/20",y(U).cart?"cursor-pointer":"cursor-not-allowed"])},[G(y(ln),{size:"14"}),y(U).cart&&y(U).cart.total_items?(m(),x("span",hO,j(y(U).cart&&y(U).cart.total_items),1)):z("",!0)],2)],64)):y(U).forms&&y(U).forms.order&&![y(Bn),y(Un),y(li),y(xr),y(ro),y(_r),y(rs),y(kr)].includes(y(o))?(m(),x("button",{key:1,class:ne([y(U).totalFormItems===0?"cursor-not-allowed":"cursor-pointer ","relative flex items-center justify-center rounded-md size-8 bg-white/10 hover:bg-white/20"]),onClick:xe[2]||(xe[2]=ke=>y(U).totalFormItems>0?y(U).isOpenForm=!0:null)},[G(y(ln),{size:"14"}),y(U).totalFormItems>0?(m(),x("span",pO,j(y(U).totalFormItems),1)):z("",!0)],2)):z("",!0),l("div",{class:ne(["flex items-center justify-center rounded-lg size-8 bg-white/10 hover:bg-white/20",y(u)?"cursor-wait":"cursor-pointer"]),onClick:xe[3]||(xe[3]=ke=>(y(g)(),Oe.value=!1))},[G(y(ok),{size:"14"})],2),It(le.$slots,"actions")])])]),l("div",{class:"messages-wrapper",ref_key:"messagesContainerRef",ref:S,style:ht({overflowY:y(K)?"hidden":""}),onWheel:he,onTouchmove:Te,onScroll:je},[Re.value&&((gt=(at=(Ge=y(r))==null?void 0:Ge.config)==null?void 0:at.banners)==null?void 0:gt.length)>0?(m(),oe(uI,{key:0,banners:y(r).config.banners,onClose:xe[4]||(xe[4]=ke=>Re.value=!1),class:"chat-content-item"},null,8,["banners"])):z("",!0),l("div",mO,[l("div",gO,[(m(!0),x(_e,null,Me(ie.value,(ke,ls)=>{var Co,Vl,Hl,Wl,Gl,Kl,Fi,bs,Ql,Jl,Xl,$o,To,Zl,Yl,ec,tc,Ao,nc,sc,rc,oc,ic,Jn,qi,_s,Eo,ac,lc,cc,uc,Io,dc,fc,zi,jr;return m(),x(_e,{key:ke.id},[ke.is_welcome_message?(m(),x("div",{key:0,id:ke.id?`message-${ke.id}`:void 0,class:ne(["messages-group message-assistant",!((Co=ie.value[ls+1])!=null&&Co.is_welcome_message)&&"!mt-2"])},[l("span",{class:ne(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",[!((Vl=ie.value[ls+1])!=null&&Vl.is_welcome_message)||ke.is_introduction_message?"opacity-100":"opacity-0",y(o)===y(Cn)?"rounded":"rounded-full"]])},[y(r).config.ui.logo?(m(),x("img",{key:0,src:y(r).config.ui.logo,alt:y(r).config.ui.name,class:"object-cover w-full h-full"},null,8,yO)):z("",!0)],2),l("div",{class:ne(["messages",{"is-user":He(ke)}])},[(m(!0),x(_e,null,Me(y(Xa)(ke.content,{separate:!1}),(un,Nr)=>{var An,Os,Xn;return m(),oe(hg,{key:Nr,message:{...ke,content:un},anchorId:!1,chatViewRef:re.value,isUser:He(ke),newMessageStatus:y(d),isLatestUserMessage:ke.is_last_message===!0,logo:(Xn=(Os=(An=y(r))==null?void 0:An.config)==null?void 0:Os.ui)==null?void 0:Xn.logo,onReply:we},null,8,["message","chatViewRef","isUser","newMessageStatus","isLatestUserMessage","logo"])}),128))],2)],10,vO)):ke.content_type!=="system_time_line"?(m(),x("div",{key:1,id:ke.id?`message-${ke.id}`:void 0,class:ne(["messages-group",[He(ke)?"message-user":"message-assistant",ke.sender&&"message-sender"]])},[!He(ke)&&(ke.content_type==="text"||Ve.includes(ke.content_type))?(m(),x(_e,{key:0},[ke.is_last_assistant_message||ke.sender||!((Hl=ie.value[ls])!=null&&Hl.sender)&&((Wl=ie.value[ls+1])!=null&&Wl.sender)?(m(),x("span",{key:0,class:ne(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",y(o)===y(Cn)?"rounded":"rounded-full"])},[(Gl=ke.sender)!=null&&Gl.avatar?(m(),x("img",{key:0,src:(Kl=ke.sender)==null?void 0:Kl.avatar,alt:(Fi=ke.sender)==null?void 0:Fi.name,class:"object-cover w-full h-full"},null,8,_O)):(m(),x("img",{key:1,src:(Ql=(bs=y(r).config)==null?void 0:bs.ui)==null?void 0:Ql.logo,alt:y(r).config.ui.name,class:"object-cover w-full h-full"},null,8,xO))],2)):(m(),x("span",{key:1,class:ne(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",y(o)===y(Cn)?"rounded":"rounded-full"])},null,2))],64)):z("",!0),ke.content_type==="text"&&!ke.audio_url?(m(),x("div",{key:1,class:ne(["messages",{"is-user":He(ke)}])},[(m(!0),x(_e,null,Me(y(Xa)(ke.content,{separate:!ke.is_welcome_message}),(un,Nr)=>{var An,Os,Xn;return m(),x("div",{key:Nr,class:"group-message-nested"},[G(hg,{message:{...ke,content:un},anchorId:!1,chatViewRef:re.value,isUser:He(ke),newMessageStatus:y(d),isLatestUserMessage:ke.is_last_message===!0,logo:(Xn=(Os=(An=y(r))==null?void 0:An.config)==null?void 0:Os.ui)==null?void 0:Xn.logo,onReply:we},null,8,["message","chatViewRef","isUser","newMessageStatus","isLatestUserMessage","logo"])])}),128))],2)):ke.sender_type==="user"&&ke.audio_url?(m(),x("div",wO,[G(gI,{"message-text":ke.content},null,8,["message-text"])])):ke.content_type==="cards"&&((Xl=(Jl=y(yn)(ke.content))==null?void 0:Jl.elements)==null?void 0:Xl.length)>0?(m(),x("div",kO,[((To=($o=y(yn)(ke.content))==null?void 0:$o.elements)==null?void 0:To.length)>1?(m(),oe(Mi,{key:0,class:"w-full max-w-3xl pr-2"},{default:Se(({selectedIndex:un,scrollTo:Nr})=>{var An;return[(m(!0),x(_e,null,Me(((An=y(yn)(ke.content))==null?void 0:An.elements)||[],(Os,Xn)=>(m(),oe(bl,{key:Xn,class:"w-[65%]"},{default:Se(()=>{var hc,pc,mc;return[l("div",{class:ne([[un===Xn?"opacity-100":"opacity-30"],"relative h-full duration-700"])},[l("div",{onClick:Uv=>Nr(Xn),class:ne(["absolute inset-0 z-10 cursor-pointer",un==Xn&&"hidden"])},null,10,SO),G(fC,{item:Os,logo:(mc=(pc=(hc=y(r))==null?void 0:hc.config)==null?void 0:pc.ui)==null?void 0:mc.logo},null,8,["item","logo"])],2)]}),_:2},1024))),128))]}),_:2},1024)):(m(),x("div",CO,[ke.is_last_assistant_message?(m(),x("div",$O,[l("span",{class:ne(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",y(o)===y(Cn)?"rounded":"rounded-full"])},[y(r).config.ui.logo?(m(),x("img",{key:0,src:y(r).config.ui.logo,alt:y(r).config.ui.name,class:"object-cover w-full h-full"},null,8,TO)):z("",!0)],2)])):z("",!0),G(wC,{item:(Yl=(Zl=y(yn)(ke.content))==null?void 0:Zl.elements)==null?void 0:Yl[0],logo:(Ao=(tc=(ec=y(r))==null?void 0:ec.config)==null?void 0:tc.ui)==null?void 0:Ao.logo},null,8,["item","logo"])]))])):ke.content_type==="iframe"?(m(),oe(y5,{key:4,item:ke,handle:y(o)},null,8,["item","handle"])):ke.content&&ke.content_type==="product_cards"&&((sc=(nc=y(yn)(ke.content))==null?void 0:nc.elements)==null?void 0:sc.length)>0?(m(),oe(w5,{key:5,products:((rc=y(yn)(ke.content))==null?void 0:rc.elements)||[],message:ke,onSendMessage:xe[5]||(xe[5]=un=>y(v)({message:un})),onOpenFlowCheckout:xe[6]||(xe[6]=un=>$e.value=!0)},null,8,["products","message"])):ke.content&&ke.content_type==="address"&&((ic=(oc=y(yn)(ke.content))==null?void 0:oc.elements)==null?void 0:ic.length)>0?(m(),oe(c3,{key:6,stores:(Jn=y(yn)(ke.content))==null?void 0:Jn.elements,logo:(Eo=(_s=(qi=y(r))==null?void 0:qi.config)==null?void 0:_s.ui)==null?void 0:Eo.logo,botName:(cc=(lc=(ac=y(r))==null?void 0:ac.config)==null?void 0:lc.ui)==null?void 0:cc.name},null,8,["stores","logo","botName"])):ke.content_type==="form"?(m(),x("div",AO,[G(wg,{message:ke},null,8,["message"])])):ke.content_type==="audio"&&ke.audio_url?(m(),oe($M,{key:8,audioSrc:ke.audio_url,isLastAudio:ke.is_last_audio,assistantProcessing:y(u),voiceProcessing:y(P).isPlaying.value},null,8,["audioSrc","isLastAudio","assistantProcessing","voiceProcessing"])):[...Ve,"attachment"].includes(ke.content_type)?(m(),oe(K5,{key:9,message:ke,files:N.value,isUser:He(ke),newMessageStatus:y(d),isLatestUserMessage:ke.is_last_message===!0},null,8,["message","files","isUser","newMessageStatus","isLatestUserMessage"])):ke.content_type==="agent_join"||ke.content_type==="agent_exit"?(m(),oe(TM,{key:10,message:ke,bot:y(r)},null,8,["message","bot"])):ke.content_type==="follow_up"?(m(),oe(LM,{key:11,elements:((uc=y(yn)(ke.content))==null?void 0:uc.elements)||[],title:((Io=y(yn)(ke.content))==null?void 0:Io.title)||"",bot:y(r),onSendMessage:xe[7]||(xe[7]=un=>y(v)({message:un}))},null,8,["elements","title","bot"])):ke.content_type==="order"?(m(),oe(oO,{key:12,message:ke,bot:y(r),"conversation-id":y(a)},null,8,["message","bot","conversation-id"])):ke.content_type==="citations"?(m(),x("div",EO,[l("span",{class:ne(["flex overflow-hidden relative bg-white size-8 flex-shrink-0 message-avatar",y(o)===y(Cn)?"rounded":"rounded-full"])},[(dc=ke==null?void 0:ke.sender)!=null&&dc.avatar?(m(),x("img",{key:0,src:ke.sender.avatar,alt:ke.sender.name,class:"object-cover w-full h-full"},null,8,IO)):(m(),x("img",{key:1,src:(zi=(fc=y(r).config)==null?void 0:fc.ui)==null?void 0:zi.logo,alt:y(r).config.ui.name,class:"object-cover w-full h-full"},null,8,PO))],2),G(VM,{citations:((jr=y(yn)(ke.content))==null?void 0:jr.elements)||[]},null,8,["citations"])])):z("",!0)],10,bO)):z("",!0)],64)}),128)),y(u)&&y(r).is_bot_working_hours&&((_n=y(c))==null?void 0:_n.response_mode)!=="manual"&&y(d)==="read"?(m(),x("div",MO,[l("div",{class:ne(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",y(o)===y(Cn)?"rounded":"rounded-full"])},[y(r).config.ui.logo?(m(),x("img",{key:0,src:y(r).config.ui.logo,alt:y(r).config.ui.name,class:"object-cover w-full h-full"},null,8,OO)):z("",!0)],2),l("div",LO,[G(y(t),{onStart:y(E)},null,8,["onStart"])])])):z("",!0),y(w)&&!y(u)?(m(),x("div",RO,[l("div",{class:ne(["relative flex flex-shrink-0 overflow-hidden bg-white size-8",y(o)===y(Cn)?"rounded":"rounded-full"])},[l("img",{src:y(O)||y(r).config.ui.logo,alt:((jn=y(k))==null?void 0:jn.name)||y(r).config.ui.name,class:"object-cover w-full h-full"},null,8,DO)],2),l("div",jO,[G(y(t),{onStart:y(E),agent:y(k)},null,8,["onStart","agent"])])])):z("",!0)])]),l("div",{class:ne(["px-4 duration-200",[pe.value&&pe.value.showToggleButton&&!y(u)?"pb-8":"pb-0"]])},[ee.value&&!y(u)?(m(),x("div",NO,[(m(!0),x(_e,null,Me(Y.value,(ke,ls)=>(m(),x("div",{key:ls,class:"quick-prompt-tag active",onClick:Co=>ze(ke),innerHTML:y(Pu)(ke)?ke.name:ke},null,8,FO))),128))])):z("",!0)],2)],36),l("div",qO,[Oe.value&&!y(u)?(m(),x("button",{key:0,onClick:De,class:"size-8 rounded-full bg-gray-50 border border-gray-200 absolute left-1/2 -translate-x-1/2 -top-0.5 -translate-y-full flex items-center justify-center z-40","aria-label":y(J)("chat.scrollToBottom"),title:y(J)("chat.scrollToBottom")},[G(y(mo),{size:16,class:"text-gray-600"})],8,zO)):z("",!0),(y(H).ai_product_insight||y(no)[y(o)])&&![y(ai)].includes(y(o))?(m(),oe(jI,{key:1,ref_key:"aiSuggestionRef",ref:pe,widget:y(H).ai_product_insight},null,8,["widget"])):z("",!0),l("div",BO,[l("div",UO,[l("div",VO,[G(Yt,{name:"expand",mode:"out-in"},{default:Se(()=>[y(pn).state.message?(m(),x("div",HO,[l("div",{class:ne(["px-3 py-2 rounded-md border animate-[slideIn_0.3s_ease-out_forwards]",y(pn).state.type==="success"?"bg-green-50/80 border-green-200 text-green-500":y(pn).state.type==="warning"?"bg-orange-50/80 border-orange-200 text-orange-500":"bg-red-50/80 border-red-200 text-red-500"])},[l("div",WO,[l("div",GO,[y(pn).state.type==="success"?(m(),oe(y(L2),{key:0,class:"text-green-500 size-4"})):y(pn).state.type==="warning"?(m(),oe(y(W2),{key:1,class:"text-orange-500 size-4"})):(m(),oe(y(ak),{key:2,class:"text-red-500 size-4"}))]),l("div",{class:"text-sm leading-[120%] font-normal",innerHTML:y(pn).state.message},null,8,KO)])],2)])):z("",!0)]),_:1}),G(Yt,{name:"expand",mode:"out-in"},{default:Se(()=>[G(ZP,{class:"px-3"})]),_:1}),G(Yt,{name:"expand",mode:"out-in"},{default:Se(()=>[ue.value?(m(),oe(aS,{key:0,replyTarget:ue.value,onCancel:Ee},null,8,["replyTarget"])):z("",!0)]),_:1}),l("div",QO,[Y.value.length>0?(m(),x("div",JO,[l("button",{type:"button",onClick:xe[8]||(xe[8]=ke=>te.value=!te.value),class:ne(["flex items-center justify-center transition-colors rounded-full size-8 overflow-hidden hover:bg-gray-50",te.value?"bg-gray-50":"bg-white"]),title:y(J)("chat.quickPrompts")},[G(y(X2),{size:"18",class:"text-gray-500"})],10,XO),te.value?(m(),x("div",ZO,[(m(!0),x(_e,null,Me(Y.value,(ke,ls)=>(m(),x("div",{key:ls,class:"quick-prompt-item",onClick:Co=>ze(ke)},j(y(Pu)(ke)?ke.name:ke),9,YO))),128))])):z("",!0)])):z("",!0),Lt(l("textarea",{id:"eac-chat-input",class:"resize-none rounded-3xl input",placeholder:y(J)("chat.placeholder"),"onUpdate:modelValue":xe[9]||(xe[9]=ke=>Ft(_)?_.value=ke:null),onKeydown:me,onFocus:xe[10]||(xe[10]=ke=>Dn()),onInput:ve,onCompositionstart:xe[11]||(xe[11]=ke=>ge.value=!0),onCompositionend:xe[12]||(xe[12]=ke=>ge.value=!1),ref_key:"textareaRef",ref:fe,rows:"1"},null,40,e7),[[rn,y(_)]]),l("div",t7,[(y(H).voice_chat||y(r).is_test_user)&&!y(I)?(m(),oe(y(s),{key:0,assistantProcessing:y(u),voiceProcessing:y(P).isPlaying.value,class:ne(["duration-200",[y(_).length>0?"scale-0":"scale-100"]])},null,8,["assistantProcessing","voiceProcessing","class"])):z("",!0),(Tn=(Qn=y(r).config.toolbar)==null?void 0:Qn.file_upload)!=null&&Tn.visible||(Bl=(Jt=y(r).config.toolbar)==null?void 0:Jt.image_upload)!=null&&Bl.visible||(Dr=(Ul=y(r).config.toolbar)==null?void 0:Ul.audio_upload)!=null&&Dr.visible?(m(),oe(sM,{key:1,handle:y(o),toolbar:y(r).config.toolbar,disabled:y(u)},null,8,["handle","toolbar","disabled"])):z("",!0),l("button",{type:"button",onClick:xe[13]||(xe[13]=ke=>y(u)&&!L.value||y(_).length<=1&&y(M).length===0?null:Ie()),class:ne([[y(_).length>1||y(M).length>0||y(i).length>0&&V.value?"bg-primary text-white sm:hover:opacity-80":"bg-gray-100 text-gray-400 cursor-default",y(u)&&!L.value&&"flicker-effect cursor-wait"],"flex items-center justify-center ml-1.5 duration-200 rounded-full size-9"])},[y(u)&&!L.value?(m(),x("div",n7)):(m(),oe(y(ag),{key:1,size:"16"}))],2)])]),y(H).voice_chat?(m(),oe(y(n),{key:0,onCancelTranscription:xe[14]||(xe[14]=ke=>se()),onEditTranscription:xe[15]||(xe[15]=ke=>be(ke)),onTranscriptionComplete:xe[16]||(xe[16]=ke=>qe(ke))})):z("",!0)])])])]),y(o)===y(On)?(m(),oe(lI,{key:0,chatViewRef:re.value,open:$e.value,"onUpdate:open":xe[17]||(xe[17]=ke=>$e.value=ke)},null,8,["chatViewRef","open"])):(m(),oe(M4,{key:1,chatViewRef:re.value,onSendMessage:xe[18]||(xe[18]=ke=>y(v)({message:ke}))},null,8,["chatViewRef"])),G(TT,{chatViewRef:re.value},null,8,["chatViewRef"]),re.value&&y(H).widget_form_render_pre_send?(m(),oe(_M,{key:2,bot:y(r),widget:y(H).widget_form_render_pre_send,chatViewRef:re.value},null,8,["bot","widget","chatViewRef"])):z("",!0)],64)):z("",!0)],512)}}},s7=Object.freeze(Object.defineProperty({__proto__:null,default:Yg},Symbol.toStringTag,{value:"Module"})),r7={key:0,class:"text-white font-medium bg-red-500 h-[22px] min-w-[22px] px-0.5 absolute -top-1.5 -right-2.5 z-10 text-sm rounded-full flex items-center justify-center"},o7=["src","alt"],i7={__name:"ChatButton",props:{isOpen:{type:Boolean,default:!1},chatPosition:{type:String,default:"right"}},emits:["toggle"],setup(e,{emit:t}){const n=t,{bot:s,handle:r,chatState:o}=Et(ae.state),i=Z(()=>o.value.unreadMessageCount),a=()=>{n("toggle")};return(c,u)=>{var d,f,h;return m(),x("div",{class:ne(["duration-300 relative w-fit border-[3px]",[y(r)===y(Cn)?"rounded-lg":"rounded-full",e.isOpen?"translate-y-[150%] opacity-0 invisible":"delay-300",{left:"mr-auto",right:"ml-auto"}[e.chatPosition],i.value>0?" border-white ring-2 ring-red-500":"border-transparent"]])},[i.value>0?(m(),x("div",r7,[l("span",null,j(i.value),1)])):z("",!0),l("button",{"aria-label":"chat-button",class:ne(["flex relative justify-center items-center cursor-pointer chat-button disabled:pointer-events-none disabled:opacity-50 group",[[y(Un),y(Bn)].includes(y(r))?"rounded-2xl bg-transparent shadow":y(r)===y(Cn)&&y(s).config.ui.iconImage?"rounded-lg bg-transparent shadow":"rounded-full bg-primary shadow",(d=y(s).config.ui)!=null&&d.iconImage&&((h=(f=y(s).config.ui)==null?void 0:f.iconImage)!=null&&h.includes(".gif"))?"bg-transparent shadow-none":"overflow-hidden"]]),onClick:a},[y(s).config.ui.iconImage?(m(),x("img",{key:0,src:y(s).config.ui.iconImage,alt:y(s).config.ui.name,class:"object-cover w-full h-full"},null,8,o7)):(m(),oe(y(tg),{key:1,size:"48",class:"block text-white max-w-[56%]"}))],2)],2)}}},a7=["innerHTML"],l7=Qe({__name:"VerticalSlideUp",props:{messages:{type:Array,default:()=>[]},stopIndex:{type:Number,default:0}},setup(e){const t=e,n=R(null),s=R(null),r=R([]),o=dt({verticalSlideList:null,verticalSlideItemHeight:0,indexVertical:0,maxIndexVertical:0,heightSlideItemActive:null,heightSlideItemPreActive:null,isStopVertical:!1,slideInterval:null,hasStarted:!1}),i=R(null),a=()=>{kt(()=>{!n.value||!s.value||t.messages.length===0||(o.verticalSlideList=r.value,o.maxIndexVertical=t.messages.length,h(),n.value&&s.value&&(o.hasStarted=!0,o.slideInterval=setInterval(d,2500)))})},c=()=>{o.isStopVertical=!0},u=()=>{o.isStopVertical=!1},d=()=>{if(!(o.isStopVertical||!o.hasStarted)){if(!n.value||!s.value){clearInterval(o.slideInterval);return}i.value||(o.indexVertical=0,i.value=t.messages[0]),f(),o.verticalSlideItemHeight+=o.heightSlideItemPreActive||0,n.value&&(n.value.style.height=o.heightSlideItemActive>0?`${o.heightSlideItemActive}px`:"42px"),s.value&&(o.verticalSlideItemHeight>=s.value.offsetHeight?(o.verticalSlideItemHeight=0,o.indexVertical=0,i.value=t.messages[o.indexVertical],s.value.style.transform=`translateY(${o.verticalSlideItemHeight}px)`):(i.value=t.messages[o.indexVertical],s.value.style.transform=`translateY(-${o.verticalSlideItemHeight}px)`))}},f=()=>{var p,v,_,w,k,S;o.indexVertical>=o.maxIndexVertical&&(o.indexVertical=0),i.value=t.messages[o.indexVertical+1],o.heightSlideItemPreActive=((v=(p=o.verticalSlideList)==null?void 0:p[o.indexVertical])==null?void 0:v.offsetHeight)||0,o.heightSlideItemActive=((w=(_=o.verticalSlideList)==null?void 0:_[o.indexVertical+1])==null?void 0:w.offsetHeight)||((S=(k=o.verticalSlideList)==null?void 0:k[0])==null?void 0:S.offsetHeight)||42,o.indexVertical+=1},h=()=>{var p;!n.value||!o.verticalSlideList||(o.heightSlideItemActive=((p=o.verticalSlideList[o.indexVertical])==null?void 0:p.offsetHeight)||42,o.verticalSlideItemHeight=0,n.value&&(n.value.style.height=o.heightSlideItemActive>0?`${o.heightSlideItemActive}px`:"42px"))},g=()=>{o.slideInterval&&(clearInterval(o.slideInterval),o.slideInterval=null)};return Pe(()=>t.messages,p=>{p&&p.length>0&&(g(),o.indexVertical=0,o.hasStarted=!1,o.verticalSlideItemHeight=0,a())},{deep:!0}),Je(()=>{a()}),Rt(()=>{g()}),(p,v)=>(m(),x("div",{ref_key:"verticalCustomSlide",ref:n,class:"vertical-custom-slide duration-500"},[l("div",{ref_key:"verticalMove",ref:s,class:"duration-1000 vertical-move",onMouseover:c,onMouseleave:u},[(m(!0),x(_e,null,Me(e.messages,(_,w)=>(m(),x("div",{key:_+w,ref_for:!0,ref_key:"verticalSlideItem",ref:r,class:ne(["flex-1 text-sm text-gray-700 duration-1000 vertical-slide-item",i.value===_||!i.value?"opacity-100":"opacity-0"]),innerHTML:_},null,10,a7))),128))],544)],512))}},[["__scopeId","data-v-62f66be8"]]),c7=dt({quickPrompts:[],welcomeMessages:[],welcomeMessagesDefault:[],quickPromptsDefault:[],keyQuickPrompt:1}),gd=(e=[])=>e==null?[]:(Array.isArray(e)?e:Object.values(e)).map(n=>typeof n=="string"?n:n==null?void 0:n.content).filter(n=>typeof n=="string"&&n.length>0),ev=e=>e!=null&&e.messages?gd(e.messages).length>0:!1,u7={category:["Xin chào Anh/Chị! Em là trợ lý ảo của {brand}.✨","🔍 Anh/Chị đang xem <br/> <strong>{title}</strong>.","Em rất sẵn lòng hỗ trợ Anh/Chị 😊"],product:["Xin chào Anh/Chị! Em là trợ lý ảo của {brand}.✨","🔍 Anh/Chị đang xem <br/> <strong>{title}</strong>.","Em rất sẵn lòng hỗ trợ Anh/Chị 😊"]},tv={},nv=(e,t)=>{if(!e||!t)return!1;if(e.includes("*")){const s=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\\\*/g,".*");try{return new RegExp(s).test(t)}catch{return t.includes(e.replace(/\*/g,""))}}return t.includes(e)},d7=(e,t,n)=>!Array.isArray(e)||e.length===0?null:e.find(s=>{var o;const r=(o=s.url_pattern)==null?void 0:o.trim();return r?nv(r,t)||nv(r,n):!1})??null,f7=()=>{const e=document.querySelector(".plc ul.gp");if(document.querySelector(".dloc ul.loc")||e){const n=document.querySelector("ul.ulk li:last-child"),s=document.querySelector("ul.ulip li:last-child");return(n==null?void 0:n.textContent)||(s==null?void 0:s.textContent)}return null};function h7(){const{quickPrompts:e,welcomeMessages:t,welcomeMessagesDefault:n,quickPromptsDefault:s,keyQuickPrompt:r}=Et(c7),{widgets:o}=Ys();function i(){var g,p;if(!no[ae.state.handle]&&!o.value.ai_product_insight){t.value=n.value,e.value=s.value;return}const u=os("Product"),d=Ts();let f="",h="";if(d.title&&u&&(u.name=d.title),u){let{sku:v,name:_}=u;f=v?"product":"category",ae.state.handle===wr&&(f="product"),h=_}else if(ae.state.handle===wr){const v=f7();v&&(f="category",h=v)}if(f&&h){const v=((g=o.value.ai_product_insight)==null?void 0:g.dynamic_prompts)??no[ae.state.handle]??no.default;let _=v;if(f==="category"&&(v==null?void 0:v.category_mode)==="custom"&&Array.isArray(v==null?void 0:v.category_url_rules)){const E=window.location.href,O=window.location.pathname,I=d7(v.category_url_rules,E,O);I&&(I.name&&(h=I.name),((p=I.prompts)==null?void 0:p.length)>0&&(_={...v,category:I.prompts}))}let w=[];tv[ae.state.handle]?w=tv[ae.state.handle][f]:w=u7[f];const k=w.map(E=>E.replace("{title}",h).replace("{brand}",U.bot.config.ui.name));t.value=k;let S=gm(_,{title:h,logo:ae.state.bot.config.ui.logo,brand:ae.state.bot.config.ui.name})[f];e.value=S,r.value=r.value+1}else t.value=n.value,e.value=s.value}let a=null;const c=u=>{if(!u)return;const d=ev(u.initialMessage),f=ev(u.quickPrompt);!d&&!f||(n.value=d?gd(u.initialMessage.messages):[],s.value=f?gd(u.quickPrompt.messages):[],clearTimeout(a),a=setTimeout(()=>{i()},500))};return Pe(()=>ae.state.bot,u=>{u!=null&&u.config&&n.value.length===0&&c(u.config)},{immediate:!0}),Pe(()=>{var u;return(u=ae.state.bot)==null?void 0:u.config},(u,d)=>{!u||!d||u!==d&&c(u)}),bi(()=>{setTimeout(()=>{i()},500)}),{quickPrompts:e,welcomeMessages:t,keyQuickPrompt:r}}const p7=["srcset"],m7=["src","alt","width","height"],sv=Qe({__name:"Picture",props:{desktopSrc:{type:String,required:!0},mobileSrc:{type:String,default:null},alt:{type:String,default:"Image"},width:{type:[String,Number],default:null},height:{type:[String,Number],default:null},classImg:{type:String,default:""}},setup(e){const t=e,n=o=>{const i="https://app.easychatgpt.io",a="https://console.easyaichat.app";return o.includes(i)?o.replace(i,a):o},s=Z(()=>t.mobileSrc||t.desktopSrc),r=Z(()=>t.desktopSrc);return(o,i)=>(m(),x("picture",null,[l("source",{srcset:n(s.value),media:"(max-width: 525px)"},null,8,p7),l("img",{src:n(r.value),alt:e.alt,class:ne(e.classImg),width:e.width,height:e.height},null,10,m7)]))}},[["__scopeId","data-v-a2e952ab"]]),g7={key:0},v7={key:0},y7={class:"fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-[9999999999]"},b7={class:"w-[76vw] md:w-[420px] relative"},_7={class:"absolute -top-9 -right-1"},x7="EAC_CLOSE_WIDGET_POPUP_BANNER",w7={__name:"ShapePopupBanner",props:{item:{type:Object,default:()=>{}}},setup(e){const t=e,n=R(!1),s=R(!1),r=R(null),o=R(null),i=Z(()=>{var d;return(d=t.item.banners)==null?void 0:d.find(f=>f.active)}),a=d=>d.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),c=(d,f="")=>{Object.keys(d).forEach(h=>{let g=d[h];const p=`--${f}${a(h)}`;typeof g=="object"&&!Array.isArray(g)&&g!==null?c(g,`${f}${a(h)}-`):(r.value.style.setProperty(p,g),p.includes("-horizontal")?o.value.style.setProperty(p,"0px"):o.value.style.setProperty(p,g))})};Je(()=>{i.value&&(n.value=!0,c(i.value,"ui-"))});const u=()=>{n.value=!1,s.value=!0,Tt.set(x7,1,"1d")};return(d,f)=>i.value?(m(),x("div",g7,[l("div",{ref_key:"shapePopupBannerRef",ref:r,class:ne(["fixed z-[9999999] eac-popup-banner",[`position-${i.value.alignment.position}`,s.value?"translate-x-0":i.value.alignment.position==="left"?"-translate-x-[150%]":"translate-x-[150%]",n.value?"opacity-0":"duration-300"]])},[(m(),oe(Nt(i.value.link?"a":"div"),{href:i.value.link,target:"_blank",class:"w-[70px] rounded-md block cursor-pointer overflow-hidden",onClick:f[0]||(f[0]=h=>s.value=!1)},{default:Se(()=>[G(sv,{desktopSrc:i.value.image_desktop,mobileSrc:i.value.image_mobile,alt:"eac banner popup",classImg:"w-full h-full object-contain"},null,8,["desktopSrc","mobileSrc"])]),_:1},8,["href"])),l("button",{onClick:f[1]||(f[1]=h=>s.value=!1),class:"md:group-hover:opacity-100 duration-200 absolute left-0 -top-[20px] z-10 text-gray-500 size-[18px] rounded-full bg-white border border-gray-100 flex items-center justify-center"},[G(y(Es),{size:"12","stroke-width":"1.5"})])],2),l("button",{onClick:f[2]||(f[2]=h=>s.value=!0),ref_key:"buttonBannerTrigger",ref:o,"aria-label":"eac-button-banner-trigger",class:ne(["fixed z-[9999999] eac-popup-banner button-trigger bg-primary w-5 h-10 flex items-center justify-center -translate-y-full shadow",[`position-${i.value.alignment.position}`,s.value?i.value.alignment.position==="left"?"-translate-x-[100%]":"translate-x-[100%]":"translate-x-0",i.value.alignment.position==="left"?"rounded-r-lg":"rounded-l-lg",n.value?"opacity-0":"duration-300"]])},[G(y(Pr),{"stroke-width":"2.5",class:ne(["text-white",i.value.alignment.position==="right"?"rotate-180":"rotate-0"])},null,8,["class"])],2),G(Yt,{name:"fade"},{default:Se(()=>[n.value?(m(),x("div",v7,[l("div",{onClick:f[3]||(f[3]=h=>u()),class:"fixed inset-0 z-[9999999998] bg-black opacity-20"}),l("div",y7,[l("div",b7,[l("div",_7,[l("button",{"aria-label":"eac-button-close-banner",onClick:f[4]||(f[4]=h=>n.value=!1),class:"size-7 z-50 bg-white shadow text-gray-500 cursor-pointer rounded-full flex items-center justify-center"},[G(y(Es),{size:"18","stroke-width":"2"})])]),(m(),oe(Nt(i.value.link?"a":"div"),{href:i.value.link,target:"_blank",class:"block",onClick:f[5]||(f[5]=h=>u())},{default:Se(()=>[G(sv,{desktopSrc:i.value.image_desktop,mobileSrc:i.value.image_mobile,alt:"eac banner popup",classImg:"w-full h-full"},null,8,["desktopSrc","mobileSrc"])]),_:1},8,["href"]))])])])):z("",!0)]),_:1})])):z("",!0)}},k7={},S7={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32",version:"1.1",fill:"currentColor"},C7=[l("path",{d:"M28 0H4C1.8 0 0 1.8 0 4v18c0 2.2 1.8 4 4 4h6v5.25c0 0.6 0.7 1 1.2 0.6L19 26h9c2.2 0 4-1.8 4-4V4c0-2.2-1.8-4-4-4zM20 8.3c0.9 0 1.7 0.75 1.7 1.7s-0.75 1.7-1.7 1.7-1.7-0.75-1.7-1.7 0.75-1.7 1.7-1.7zM12 8.3c0.9 0 1.7 0.75 1.7 1.7s-0.75 1.7-1.7 1.7-1.7-0.75-1.7-1.7 0.75-1.7 1.7-1.7zM22.2 17.1c-1.6 1.8-4.2 2.9-6.2 2.9s-4.7-1-6.3-2.9c-0.4-0.4-0.3-1 0.1-1.4 0.4-0.4 1-0.3 1.4 0.1 1.2 1.4 2.9 2.2 4.7 2.2 1.8 0 3.6-0.8 4.7-2.2 0.4-0.4 1-0.5 1.4-0.1 0.4 0.4 0.5 1 0.1 1.4z"},null,-1)];function $7(e,t){return m(),x("svg",S7,C7)}const T7=Qe(k7,[["render",$7]]),A7={class:"px-5 pt-8"},E7={key:0,class:"flex flex-col items-center pb-6 sm:pt-3 sm:min-h-[220px] relative"},I7={class:"mb-3"},P7={class:"text-[18px] font-medium text-gray-900 mb-2"},M7=["innerHTML"],O7={class:"mt-3"},L7={class:"flex items-center justify-center space-x-1"},R7={key:1,"data-name":"eac-widget-form-survey",class:"h-fit sm:max-h-[76vh] overflow-y-auto scroll-hidden"},D7={class:"overflow-y-auto flex-1"},j7={class:"mb-3 relative"},N7=["src","alt"],F7=["innerHTML"],q7={class:"text-xs text-gray-500 text-center mt-1"},z7=["innerHTML"],B7={class:"space-y-4"},U7={class:"flex items-center justify-center space-x-2"},V7=["onClick"],H7={class:"text-sm font-medium mt-1 text-[#FAAD14] text-center"},W7={key:0,class:"flex justify-center flex-wrap gap-1.5 mb-4"},G7=["onClick"],K7=["placeholder"],Q7={class:"text-xs text-gray-500 text-right"},J7={class:"pt-4 sticky bottom-0 bg-white"},X7=Qe({__name:"WidgetWebsiteSurvey",props:{bot:{type:Object,default:null},preview:{type:Boolean,default:!1},widget:{type:Object,default:null}},emits:["close"],setup(e,{emit:t}){const{t:n}=en(),s=e,r=t,o=R(!1),i=R(!1),a=dt({rating:5,detailed_feedback:"",feedback_issues:[],page_url:""}),c={websiteSpeed:"survey.website.issues.websiteSpeed",accountLogin:"survey.website.issues.accountLogin",productSearch:"survey.website.issues.productSearch",addToCart:"survey.website.issues.addToCart",productPrice:"survey.website.issues.productPrice",customerService:"survey.website.issues.customerService",other:"survey.website.issues.other",createChatbot:"survey.website.issues.createChatbot",trainChatbot:"survey.website.issues.trainChatbot",serviceSearch:"survey.website.issues.serviceSearch",servicePrice:"survey.website.issues.servicePrice",integration:"survey.website.issues.integration",ui:"survey.website.issues.ui",transcriptAccuracy:"survey.website.issues.transcriptAccuracy",summaryQuality:"survey.website.issues.summaryQuality",websiteUi:"survey.website.issues.websiteUi",orderFlow:"survey.website.issues.orderFlow",userAccount:"survey.website.issues.userAccount"},u={"rangdongstorevn-zll":[c.websiteSpeed,c.accountLogin,c.productSearch,c.addToCart,c.productPrice,c.customerService,c.other],"easychatgptio-ujc":[c.websiteSpeed,c.accountLogin,c.createChatbot,c.trainChatbot,c.productPrice,c.customerService,c.other],"easychatgptio-qqh":[c.websiteSpeed,c.accountLogin,c.createChatbot,c.trainChatbot,c.productPrice,c.customerService,c.other],"jamstackvietnamcom-zux":[c.websiteSpeed,c.serviceSearch,c.servicePrice,c.customerService,c.other],easyaiagentsapp:[c.integration,c.ui,c.transcriptAccuracy,c.summaryQuality,c.other],default:[c.websiteUi,c.orderFlow,c.customerService,c.productPrice,c.userAccount,c.other]},d=Z(()=>{var E;return(u[(E=s.bot)==null?void 0:E.handle]??u.default).map(O=>n(O))}),f=Z(()=>{var S;return((S=s.bot)==null?void 0:S.handle)==="easyaiagentsapp"?{title:n("survey.website.meetingTitle"),description:n("survey.website.meetingDescription")}:{title:n("survey.website.title"),description:n("survey.website.description")}}),h=Z(()=>[n("survey.ratingVeryBad"),n("survey.ratingBad"),n("survey.ratingAverage"),n("survey.ratingGood"),n("survey.ratingExcellent")]),g=S=>{a.rating=S},p=()=>{o.value=!0,a.feedback_issues=[],a.detailed_feedback="";let S=setTimeout(()=>{r("close"),clearTimeout(S),ae.actions.setSurveyHidden(),localStorage.setItem("EAI_SURVEY_HIDDEN","1")},3e3)},v=async()=>{try{if(i.value)return;i.value=!0,a.page_url=window.location.href;const S={status:"submitted",conversation_id:null,message_id:null,submission_data:a},E=await Xe.submission.submitWidget({widgetId:s.widget.id,formData:S});E.data&&E.status===200&&p()}catch(S){console.log("Error Submission: ",S)}finally{i.value=!1}},_=()=>{p()},w=()=>{a.detailed_feedback.length>300&&(a.detailed_feedback=a.detailed_feedback.slice(0,300))},k=S=>{const E=a.feedback_issues.indexOf(S);E===-1?a.feedback_issues.push(S):a.feedback_issues.splice(E,1)};return(S,E)=>{var O;return m(),x("div",A7,[o.value?(m(),x("div",E7,[l("div",I7,[G(y(Hu),{size:"42","stroke-width":"1",class:"text-gray-600"})]),l("h3",P7,j(y(n)("survey.thanksTitle")),1),l("p",{class:"text-center text-sm text-gray-600 px-2",innerHTML:y(n)("survey.thanksBody")},null,8,M7),l("div",O7,[l("div",L7,[(m(),x(_e,null,Me(5,I=>G(y(ml),{size:32,"stroke-width":"1",fill:a.rating>=I?"#FAAD14":"none",color:a.rating>=I?"#FAAD14":"#d1d5db",class:ne(["star-icon",a.rating>=I?"star-active":""])},null,8,["fill","color","class"])),64))])])])):(m(),x("div",R7,[l("div",D7,[l("div",j7,[l("div",{class:ne(["size-[42px] overflow-hidden mx-auto mb-2",((O=s.bot)==null?void 0:O.handle)===y(Cn)?"rounded":"rounded-full"])},[l("img",{src:e.bot.config.ui.logo,alt:e.bot.config.ui.name,class:"w-full h-full object-cover"},null,8,N7)],2),l("h2",{class:"text-[20px] font-medium text-gray-900 text-center",innerHTML:f.value.title},null,8,F7),l("div",q7,[l("span",{innerHTML:f.value.description},null,8,z7)])]),l("div",B7,[l("div",null,[l("div",U7,[(m(),x(_e,null,Me(5,I=>l("div",{key:I,class:"star-wrapper",onClick:P=>g(I)},[G(y(ml),{size:40,"stroke-width":"1",fill:a.rating>=I?"#FAAD14":"none",stroke:"#FAAD14",color:a.rating>=I?"#FAAD14":"#d1d5db",class:ne(["star-icon",a.rating>=I?"star-active":"star-inactive"])},null,8,["fill","color","class"])],8,V7)),64))]),l("div",H7,j(h.value[a.rating-1]),1)]),l("div",null,[a.rating<=3?(m(),x("div",W7,[(m(!0),x(_e,null,Me(d.value,I=>(m(),x("div",{key:I,onClick:P=>k(I),class:ne(["px-2 py-1 text-xs text-gray-700 border rounded tracking-tight cursor-pointer",a.feedback_issues.includes(I)?"bg-gray-200 border-gray-300 ":"border-gray-200 hover:bg-gray-50"])},j(I),11,G7))),128))])):z("",!0),Lt(l("textarea",{"onUpdate:modelValue":E[0]||(E[0]=I=>a.detailed_feedback=I),placeholder:y(n)("survey.detailPlaceholder"),rows:3,onInput:w,class:"text-base placeholder:text-xs sm:text-xs text-gray-700 block w-full rounded-md border border-gray-200 px-3 py-2 resize-none focus:outline-none"},null,40,K7),[[rn,a.detailed_feedback]]),l("div",Q7,j(a.detailed_feedback.length)+" / 300 ",1)])])]),l("div",J7,[l("button",{onClick:E[1]||(E[1]=I=>e.preview?_():v()),class:"w-full h-10 text-sm font-medium px-4 flex items-center justify-center bg-primary text-white rounded-lg"},[l("div",null,j(y(n)("survey.submit")),1)])])]))])}}},[["__scopeId","data-v-13c354eb"]]),Z7={class:"px-5 pt-8"},Y7={key:0,class:"flex flex-col items-center pb-6 sm:pt-4 sm:min-h-[240px] relative"},eL={class:"mb-3"},tL={class:"text-[20px] font-medium text-gray-900 mb-2"},nL=["innerHTML"],sL={class:"mt-3"},rL={class:"flex items-center justify-center space-x-1"},oL={key:1,"data-name":"eac-widget-form-survey",class:"h-fit sm:max-h-[76vh] overflow-y-auto scroll-hidden"},iL={class:"mb-3 relative"},aL={class:"size-[40px] rounded-full overflow-hidden mx-auto mb-2"},lL=["src","alt"],cL={class:"text-base font-medium text-gray-900 text-center"},uL=["innerHTML"],dL={class:"space-y-4"},fL={class:"space-y-1"},hL={class:"flex items-center justify-center space-x-2"},pL=["onClick"],mL={class:"text-sm font-medium text-[#FAAD14] text-center"},gL={key:0,class:"space-y-1"},vL={class:"text-sm text-gray-900"},yL={class:"flex flex-wrap gap-1"},bL=["onClick"],_L={key:1,class:"space-y-1"},xL={class:"text-sm text-gray-900"},wL={class:"flex flex-wrap gap-1"},kL=["onClick"],SL={class:"space-y-1"},CL={class:"text-sm text-gray-900"},$L={class:"flex flex-wrap gap-1"},TL=["onClick"],AL=["placeholder"],EL={class:"text-xs text-gray-500 text-right"},IL={class:"pt-3 sticky bottom-0 bg-white"},PL="survey_order",ML=Qe({__name:"WidgetOrderSurvey",props:{bot:{type:Object,default:null},preview:{type:Boolean,default:!1},widget:{type:Object,default:null}},emits:["open","close"],setup(e,{emit:t}){const{t:n}=en(),s=`${PL}_submitted_ids`,r=e,o=t,i=R(!1),a=R(!1),c=R(""),u=dt({order_id:null,rating:5,positive_feedbacks:[],negative_feedbacks:[],expectations:[],suggestion:""}),d=Z(()=>[n("survey.ratingVeryBad"),n("survey.ratingBad"),n("survey.ratingAverage"),n("survey.ratingGood"),n("survey.ratingExcellent")]),f=Z(()=>[n("survey.order.positive.productPrice"),n("survey.order.positive.manyOffers"),n("survey.order.positive.easyPayment")]),h=Z(()=>[n("survey.order.negative.pageSpeed"),n("survey.order.negative.findProduct"),n("survey.order.negative.purchaseFlow"),n("survey.order.negative.promoCode"),n("survey.order.negative.paymentMethod"),n("survey.order.negative.deliveryAddress")]),g=Z(()=>[n("survey.order.expectations.fastDelivery"),n("survey.order.expectations.asDescribed"),n("survey.order.expectations.nicePackaging")]),p=M=>{const q=Tt.get(s)||[],B=Array.isArray(q)?[...q,M]:[M];Tt.set(s,B,"30d")},v=M=>{u.rating=M},_=async()=>{try{if(a.value)return;a.value=!0;const M={status:"submitted",conversation_id:null,submission_data:u},q=await Xe.submission.submitWidget({widgetId:r.widget.id,formData:M});q.data&&q.status===200&&(i.value=!0,p(c.value),setTimeout(()=>{o("close")},3e3))}catch(M){console.log("Error Submission: ",M)}finally{a.value=!1}},w=()=>{i.value=!0;let M=setTimeout(()=>{o("close"),clearTimeout(M)},3e3)},k=()=>{u.suggestion.length>300&&(u.suggestion=u.suggestion.slice(0,300))},S=(M,q)=>{const B=u[q].indexOf(M);B===-1?u[q].push(M):u[q].splice(B,1)},E=()=>{u.order_id=c.value,setTimeout(()=>{o("open")},3500)},O=()=>{const M=Tt.get(s)||[];(Array.isArray(M)?M:[]).includes(c.value)||E()};function I(M){let q=M;try{M.includes("://")?q=new URL(M).pathname:q=M.replace(/^(https?:\/\/)?[^\/]+/,"")}catch{q=M.replace(/^(https?:\/\/)?[^\/]+/,"")}return[/^\/dat-hang-thanh-cong(\?.*)?$/,/^\/dat-hang\/thanh-cong(\/[a-zA-Z0-9-_]+)?(\?.*)?$/,/^\/don-hang\/thanh-cong(\/[a-zA-Z0-9-_]+)?(\?.*)?$/,/^\/thanh-toan\/thanh-cong(\/[a-zA-Z0-9-_]+)?(\?.*)?$/,/^\/giao-dich\/thanh-cong(\/[a-zA-Z0-9-_]+)?(\?.*)?$/,/^\/gio-hang-hoan-tat(\?.*)?$/,/^\/dat-hang-hoan-tat(\?.*)?$/,/^\/thanh-toan-hoan-tat(\?.*)?$/,/^\/don-hang-hoan-tat(\?.*)?$/,/^\/checkout\/success(\?.*)?$/,/^\/checkout\/confirm(\?.*)?$/,/^\/checkout\/confirmation(\?.*)?$/,/^\/checkout\/complete(\?.*)?$/,/^\/order\/success(\?.*)?$/,/^\/order\/confirm(\?.*)?$/,/^\/order\/complete(\?.*)?$/,/^\/order-confirmed(\?.*)?$/,/^\/order-placed(\?.*)?$/,/^\/order-received(\?.*)?$/,/^\/payment\/success(\?.*)?$/,/^\/payment\/confirm(\?.*)?$/,/^\/payment-completed(\?.*)?$/,/^\/purchase\/success(\?.*)?$/,/^\/purchase-complete(\?.*)?$/,/^\/transaction\/complete(\?.*)?$/,/^\/thank-you(\?.*)?$/,/^\/thanks(\?.*)?$/,/^\/confirmation\/[a-zA-Z0-9-_]+$/,/^\/order\/confirmed\/[a-zA-Z0-9-_]+$/,/^\/transaction\/[a-zA-Z0-9-_]+\/success$/,/^\/receipt\/[a-zA-Z0-9-_]+$/,/^\/invoice\/[a-zA-Z0-9-_]+$/].some(T=>T.test(q))}function P(M){let q=M,B;try{if(M.includes("://")){const A=new URL(M);q=A.pathname,B=A.searchParams}else{q=M.replace(/^(https?:\/\/)?[^\/]+/,"");const A=M.split("?")[1];A&&(B=new URLSearchParams(A))}}catch{q=M.replace(/^(https?:\/\/)?[^\/]+/,"");const D=M.split("?")[1];D&&(B=new URLSearchParams(D))}if(B){const A=["orderId","orderID","order_id","orderNumber","order_number","orderNumberId","transactionId","transaction_id","transId","trans_id","id","code","reference","ref","confirmation","confirmationNumber","confirmation_number"];for(const D of A)if(B.has(D))return B.get(D)}const T=[/\/order\/([a-zA-Z0-9-_]+)$/,/\/transaction\/([a-zA-Z0-9-_]+)\/success$/,/\/confirmation\/([a-zA-Z0-9-_]+)$/,/\/receipt\/([a-zA-Z0-9-_]+)$/,/\/invoice\/([a-zA-Z0-9-_]+)$/,/\/dat-hang\/thanh-cong\/([a-zA-Z0-9-_]+)$/,/\/([a-zA-Z0-9-_]{8,})$/];for(const A of T){const D=q.match(A);if(D&&D[1])return D[1]}return null}return Je(()=>{bi(()=>{const M=window.location.href;I(M)?(c.value=P(M),O()):o("close")},!0)}),(M,q)=>(m(),x("div",Z7,[i.value?(m(),x("div",Y7,[l("div",eL,[G(y(Hu),{size:"42","stroke-width":"1",class:"text-gray-600"})]),l("h3",tL,j(y(n)("survey.thanksTitle")),1),l("p",{class:"text-center text-sm text-gray-600 px-2",innerHTML:y(n)("survey.thanksBody")},null,8,nL),l("div",sL,[l("div",rL,[(m(),x(_e,null,Me(5,B=>G(y(ml),{key:B,size:32,"stroke-width":"1",fill:u.rating>=B?"#FAAD14":"none",color:u.rating>=B?"#FAAD14":"#d1d5db",class:ne(["star-icon",u.rating>=B?"star-active":""])},null,8,["fill","color","class"])),64))])])])):(m(),x("div",oL,[l("div",null,[l("div",iL,[l("div",aL,[l("img",{src:e.bot.config.ui.logo,alt:e.bot.config.ui.name,class:"w-full h-full object-cover"},null,8,lL)]),l("h2",cL,j(y(n)("survey.order.title")),1),l("div",{class:"text-xs text-gray-500 text-center mt-1",innerHTML:y(n)("survey.order.description")},null,8,uL)]),l("div",dL,[l("div",fL,[l("div",hL,[(m(),x(_e,null,Me(5,B=>l("div",{key:B,class:"star-wrapper",onClick:T=>v(B)},[G(y(ml),{size:32,"stroke-width":"1",fill:u.rating>=B?"#FAAD14":"none",stroke:"#FAAD14",color:u.rating>=B?"#FAAD14":"#d1d5db",class:ne(["star-icon",u.rating>=B?"star-active":"star-inactive"])},null,8,["fill","color","class"])],8,pL)),64))]),l("div",mL,j(d.value[u.rating-1]),1)]),u.rating>3?(m(),x("div",gL,[l("div",vL,j(y(n)("survey.order.likeQuestion")),1),l("div",yL,[(m(!0),x(_e,null,Me(f.value,B=>(m(),x("div",{key:B,onClick:T=>S(B,"positive_feedbacks"),class:ne(["px-2 py-1 text-xs text-gray-700 border rounded tracking-tight cursor-pointer",u.positive_feedbacks.includes(B)?"bg-gray-200 border-gray-300 ":"border-gray-200 hover:bg-gray-50"])},j(B),11,bL))),128))])])):(m(),x("div",_L,[l("div",xL,j(y(n)("survey.order.difficultyQuestion")),1),l("div",wL,[(m(!0),x(_e,null,Me(h.value,B=>(m(),x("div",{key:B,onClick:T=>S(B,"negative_feedbacks"),class:ne(["px-2 py-1 text-xs text-gray-700 border rounded tracking-tight cursor-pointer",u.negative_feedbacks.includes(B)?"bg-gray-200 border-gray-300 ":"border-gray-200 hover:bg-gray-50"])},j(B),11,kL))),128))])])),l("div",SL,[l("div",CL,j(y(n)("survey.order.expectationQuestion")),1),l("div",$L,[(m(!0),x(_e,null,Me(g.value,B=>(m(),x("div",{key:B,onClick:T=>S(B,"expectations"),class:ne(["px-2 py-1 text-xs text-gray-700 border rounded tracking-tight cursor-pointer",u.expectations.includes(B)?"bg-gray-200 border-gray-300 ":"border-gray-200 hover:bg-gray-50"])},j(B),11,TL))),128))])]),l("div",null,[Lt(l("textarea",{"onUpdate:modelValue":q[0]||(q[0]=B=>u.suggestion=B),placeholder:y(n)("survey.order.suggestionPlaceholder"),onInput:k,rows:"3",class:"placeholder:text-xs text-gray-700 block w-full rounded-md border border-gray-200 px-3 py-2 resize-none focus:outline-none"},null,40,AL),[[rn,u.suggestion]]),l("div",EL,j(u.suggestion.length)+" / 300 ",1)])])]),l("div",IL,[l("button",{onClick:q[1]||(q[1]=B=>e.preview?w():_()),class:"w-full h-10 text-sm font-medium px-4 flex items-center justify-center bg-primary text-white rounded-lg"},[l("div",null,j(y(n)("survey.submit")),1)])])]))]))}},[["__scopeId","data-v-a0e2b673"]]),OL=["width","height"],LL=[ba('<path d="M29.0312 2.39062V2.39062C21.8342 9.58768 10.1655 9.58768 2.9684 2.39062V2.39062" stroke="url(#paint0_linear_950_398)" stroke-width="3" stroke-linecap="square"></path><defs><linearGradient id="paint0_linear_950_398" x1="9.48412" y1="8.90634" x2="22.5155" y2="-4.12509" gradientUnits="userSpaceOnUse"><stop offset="0%" stop-color="#3A087F"></stop><stop offset="40%" stop-color="#A535EB"></stop><stop offset="70%" stop-color="#FCA63E"></stop><stop offset="88%" stop-color="#54D5A4"></stop><stop offset="100%" stop-color="#1B8AF7"></stop></linearGradient></defs>',2)],RL={__name:"IconEAI",props:{size:{type:String,default:"sm",validator:e=>["sm","md","lg"].includes(e)}},setup(e){const t=e,n=Z(()=>{switch(t.size){case"lg":return{width:48,height:15};case"sm":return{width:20,height:6.25};case"md":default:return{width:32,height:10}}});return(s,r)=>(m(),x("svg",{width:n.value.width,height:n.value.height,viewBox:"0 0 32 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},LL,8,OL))}},DL={key:0,href:"https://geteasy.ai",target:"_blank",rel:"nofollow noreferrer",class:"text-[10px] text-gray-500 font-medium flex items-center space-x-1 px-2 pb-0.5"},jL={class:"flex items-center space-x-1"},NL={class:"font-bold text-gray-900"},rv={__name:"PoweredByEAC",setup(e){const{t}=en(),n=Z(()=>{const s=ae.state.handle;return![Bn,Un,_r,"nexpovn","g8homevn","tanchauhomecom","govivn","bvdkmocchauvn"].includes(s)});return(s,r)=>n.value?(m(),x("a",DL,[l("span",null,j(y(t)("widget.poweredBy")),1),l("div",jL,[G(RL,{class:"mt-px"}),l("span",NL,j(y(t)("widget.easyAi")),1)])])):z("",!0)}},FL={class:"flex justify-center py-2"},ov={__name:"TemplateWidgetSlide",props:{position:{type:String,default:"right",validator:e=>["left","right"].includes(e)},autoslide:{type:Boolean,default:!1},duration:{type:Number,default:0},handle:{type:String,default:""}},setup(e){const t=e,n=R(!1),s=R(!1),r=()=>{n.value=!n.value},o=()=>{n.value=!1},i=()=>{n.value=!0},a={easyaiagentsapp:["/meetings/recaps","/meetings/","/easyaiagentsapp/widget"]},c=()=>{t.autoslide&&setTimeout(()=>{n.value=!0},t.duration)};return Je(()=>{c(),bi(()=>{a[t.handle]?a[t.handle].some(d=>window.location.pathname.includes(d))?s.value=!0:s.value=!1:(s.value=!0,c())},!0)}),(u,d)=>(m(),x(_e,null,[s.value?It(u.$slots,"trigger",Gi(wn({key:0},{isOpen:n.value,position:e.position,toggleSlide:r,closeSlide:o,openSlide:i}))):z("",!0),G(Yt,{name:"fade"},{default:Se(()=>[n.value?(m(),x("div",{key:0,onClick:o,class:"sm:hidden z-[9999999901] fixed inset-0 bg-black bg-opacity-30"})):z("",!0)]),_:1}),s.value?(m(),x("div",{key:1,class:ne(["fixed z-[9999999902] w-screen h-fit max-sm:rounded-t-3xl sm:w-[325px] bg-white overflow-hidden transition-transform duration-500 ease-in-out",e.position==="left"?"left-0 sm:rounded-r-2xl":"right-0 sm:rounded-l-2xl","max-sm:bottom-0 sm:top-[48%] sm:-translate-y-1/2",n.value?"sm:delay-150":"",n.value?{left:"transform max-sm:translate-y-0 sm:translate-x-0",right:"transform max-sm:translate-y-0 sm:-translate-x-0"}[e.position]:{left:"max-sm:translate-y-full sm:-translate-x-full",right:"max-sm:translate-y-full sm:translate-x-full"}[e.position]]),style:{"box-shadow":"rgba(100, 100, 111, 0.2) 0px 7px 29px 0px"}},[l("button",{onClick:o,class:"absolute z-10 right-2 top-3 bg-white text-gray-600 size-8 flex items-center justify-center sm:hover:bg-gray-100 rounded-md"},[G(y(Es),{size:"18","stroke-width":"2"})]),l("div",null,[It(u.$slots,"widget",Gi(ya({isOpen:n.value,closeSlide:o,openSlide:i})))]),l("div",FL,[G(rv)])],2)):z("",!0)],64))}},qL={key:0},zL={key:0},BL=l("div",{class:"absolute inset-0 bg-gray-500/60"},null,-1),UL=["src","alt"],VL={class:"text-sm font-medium text-primary leading-[120%]"},HL={key:1},WL=["onClick"],GL=["onClick","innerHTML"],KL=["onClick","innerHTML"],QL=["onClick"],JL={class:"pb-1 text-base text-white whitespace-nowrap rotate-90"},XL={class:"flex items-center space-x-2"},ZL={class:"text-sm sm:text-base"},YL=["title"],iv={__name:"ChatWidget",props:{isPreview:{type:Boolean,default:!1},isOpenInit:{type:Boolean,default:!1}},setup(e){var fe,$e,Re;const t=Wt(()=>Promise.resolve().then(()=>oH)),n=Wt(()=>Promise.resolve().then(()=>lv)),s=Wt(()=>Promise.resolve().then(()=>kH)),r=Wt(()=>Promise.resolve().then(()=>AH)),o=e,{widgets:i,widgetSettingType:a}=Ys(),{t:c}=en(),{bot:u,handle:d,chatState:f}=Et(ae.state),h=R(!1),g=R(!1),p=R(null),v=R(null),_=R(!1),w=R(!1),k=R(!1),{getStorage:S}=Ks(),{isOpen:E,toggleChatbot:O}=Ci({openInit:o.isOpenInit,milliseconds:(Re=($e=(fe=u.value)==null?void 0:fe.config)==null?void 0:$e.ui)==null?void 0:Re.automaticallyExpand}),{clickQuickPrompt:I,send:P,isLiveChatEnabled:M}=Ir(),{quickPrompts:q,welcomeMessages:B,keyQuickPrompt:T}=h7(),A=()=>{const Le=os("Product");Le&&Le.sku&&(_.value=!0,w.value=!1)},D=Z(()=>_.value?w.value:!0),Q=()=>{_.value&&(w.value=!0)},W=()=>{_.value&&(w.value=!1)};Je(async()=>{p.value=window.location.hostname;const Le=S("easychatgpt_conversations",d.value);Le&&(U.localStorageFormOrder=`${yu}-${Le}`),ge(),localStorage.getItem("EAI_SURVEY_HIDDEN")==="1"&&(k.value=!0),setTimeout(()=>{h.value=!0},1e3)}),Pe(()=>U.localStorageFormOrder,Le=>{Le&&(U.selectedForm=JSON.parse(localStorage.getItem(Le)))});const H=Z(()=>{var Le,Oe,Ve,N;return((N=(Ve=(Oe=(Le=u.value)==null?void 0:Le.config)==null?void 0:Oe.ui)==null?void 0:Ve.alignment)==null?void 0:N.position)||"right"});Pe(E,Le=>{Le?h.value=!1:setTimeout(()=>{h.value=!0},800),A()}),Pe(d,Le=>{Le&&[Bn,Un].includes(Le)&&A()},{immediate:!0});function K(Le){E.value=!0,h.value=!1,P({message:Le})}function J(){g.value=!1,Tt.set(vu,1,"1d")}function te(){ae.actions.resetUnreadMessageCount(),J()}function ge(){Tt.get(vu)!=="1"?(g.value=!0,Tt.remove(vu)):g.value=!1}function ue(){k.value=!0,localStorage.setItem("EAI_SURVEY_HIDDEN","1")}const we=Le=>Le!==null&&typeof Le=="object",Ee=Z(()=>{var Le;return(Le=u.value.widgets)==null?void 0:Le.find(Oe=>Oe.type.includes("website_survey")&&Oe.active&&!Oe.is_deleted)}),re=Z(()=>k_.includes(d.value)&&!o.isPreview),pe=Z(()=>[Bn,Un].includes(d.value));return(Le,Oe)=>{var Ve,N,ee,Y;return y(u)?(m(),x("div",qL,[re.value?z("",!0):(m(),x("div",{key:0,class:ne(["chat-widget",[`position-${y(u).config.ui.alignment.position}`,`btn-size-desktop-${((Ve=y(u).config.ui.bubble_chat)==null?void 0:Ve.offset.desktop.size)??"medium"}`,`btn-size-mobile-${((N=y(u).config.ui.bubble_chat)==null?void 0:N.offset.mobile.size)??"medium"}`]]),style:ht([{display:"none"},{"--size-desktop-custom":((ee=y(u).config.ui.bubble_chat)==null?void 0:ee.offset.desktop.custom)??"var(--size-medium)","--size-mobile-custom":((Y=y(u).config.ui.bubble_chat)==null?void 0:Y.offset.mobile.custom)??"var(--size-medium)","--z-index-chatview":9999999999,"--z-index-bubblechat":999999990}])},[l("div",{class:ne(["w-screen grow sm:w-[425px] sm:h-[720px] sm:max-h-[calc(100vh-6rem)] z-[var(--z-index-chatview)] overflow-hidden ecg-chat-view sm:rounded-3xl box-shadow-md max-sm:border-t-0 max-sm:border-x-0 fixed max-sm:right-0 sm:right-4 duration-500",[[y(E)?"max-sm:top-0 delay-300":"opacity-0 invisible translate-y-[150%]",pe.value?"h-[calc(100dvh-52px)] max-sm:top-[52px]":"h-dvh rounded-none max-sm:top-0"]]])},[G(y(t),{ref_key:"chatViewRef",ref:v,class:"h-full w-full",onCloseChat:Oe[0]||(Oe[0]=L=>y(O)())},null,512)],2),l("div",{class:ne([[!y(E)&&"z-[var(--z-index-bubblechat)]"],"chat-button-group fixed bottom-[var(--ui-alignment-offset-vertical)] space-y-2"]),onMouseenter:Q,onMouseleave:W},[!y(f).unreadMessageCount&&g.value&&!y(E)&&D.value?(m(),x("div",zL,[l("div",{class:ne(["flex-col space-y-2 sm:space-y-3 group",[{left:"items-start",right:"items-end"}[H.value],[y(ci),y(ui),y(di),y($s),y(ai)].includes(y(d))||e.isPreview?"flex":"hidden sm:flex"]])},[h.value?(m(),x("div",{key:0,class:ne(["pr-0.5 duration-500 group-hover:block inner-close",[[y(ci),y(ui),y(di),y($s),y(Bn),y(Un)].includes(y(d))?"sm:hidden":"hidden"]])},[l("button",{onClick:Oe[1]||(Oe[1]=L=>J()),class:"flex overflow-hidden relative justify-center items-center w-6 h-6 md:w-5 md:h-5 rounded-full hover:opacity-70"},[G(_o,{class:"relative z-10 w-4 md:w-3 text-white"}),BL])],2)):z("",!0),(m(),x("div",{key:y(T),class:ne([h.value?"translate-y-0 opacity-100 visible":"translate-y-[60%] opacity-0 invisible","px-3 pt-2 cursor-pointer pb-1 box-shadow-md bg-white rounded-xl relative w-[180px] sm:w-[200px] duration-1000 delay-75"]),onClick:Oe[2]||(Oe[2]=L=>E.value=!0)},[y(u).config.ui?(m(),x("div",{key:0,class:ne(["items-center space-x-1 sm:space-x-2 mb-1 sm:mb-1.5",[y(ci),y(ui),y(di),y($s),y(Bn),y(Un),y(ai)].includes(y(d))||e.isPreview?"flex":"hidden sm:flex "])},[y(u).config.ui.logo?(m(),x("div",{key:0,class:ne(["overflow-hidden size-5 sm:size-6 shrink-0",y(d)===y(Cn)?"rounded":"rounded-full"])},[l("img",{src:y(u).config.ui.logo,alt:y(u).config.ui.name,class:"object-cover w-full h-full"},null,8,UL)],2)):z("",!0),l("div",VL,j(y(u).config.ui.name),1)],2)):z("",!0),y(B)&&y(B).length>0?(m(),x("div",HL,[(m(),oe(l7,{messages:y(B),key:y(B)},null,8,["messages"]))])):z("",!0)],2))],2)])):z("",!0),!y(f).unreadMessageCount&&g.value&&!y(E)&&y(q).length>0&&D.value&&![y($s),y(Bn),y(Un),y(Cn),y(ro)].includes(y(d))?(m(!0),x(_e,{key:1},Me(y(q),(L,V)=>(m(),x("div",{key:V,class:ne(["duration-500",[y(E)?"translate-y-1/2 opacity-0 invisible":"translate-y-0 opacity-100 visible",[y(ci),y(ui),y(di)].includes(y(d))||e.isPreview?"block":"hidden sm:block"]]),onClick:ie=>y(I)(L)},[(m(),x("div",{key:y(T),class:ne(["flex-col space-y-3 duration-1000 group",[H.value==="left"?"items-start":"items-end",[y(ci),y(ui),y(di)].includes(y(d))||e.isPreview?"flex":"hidden sm:flex"]])},[l("div",{class:ne([[h.value?"translate-x-0 opacity-100 visible":"translate-y-full opacity-0 invisible",`delay-${V*200+300}ms`],"duration-1000"])},[we(L)?(m(),x("div",{key:0,onClick:ie=>K(L.message),class:"quick-prompt-tag",innerHTML:L.name},null,8,GL)):(m(),x("div",{key:1,onClick:ie=>K(L),class:"quick-prompt-tag",innerHTML:L},null,8,KL))],2)],2))],10,WL))),128)):z("",!0),G(Yt,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"opacity-0 translate-y-4 scale-50","enter-to-class":"opacity-100 translate-y-0 scale-100","leave-active-class":"transition-all duration-200 ease-in","leave-from-class":"opacity-100 translate-y-0 scale-100","leave-to-class":"opacity-0 translate-y-4 scale-50"},{default:Se(()=>[y(f).unreadMessageCount>0&&y(M)?(m(),oe(y(r),{key:0,onToggle:Oe[3]||(Oe[3]=L=>y(O)()),onClose:Oe[4]||(Oe[4]=L=>te()),style:ht({transformOrigin:H.value==="right"?"bottom right":"bottom left"})},null,8,["style"])):z("",!0)]),_:1}),G(i7,{isOpen:y(E),chatPosition:H.value,onToggle:Oe[5]||(Oe[5]=L=>y(O)())},null,8,["isOpen","chatPosition"])],34)],6)),y(i).ai_ask?(m(),oe(y(n),{key:1,widget:y(i).ai_ask},null,8,["widget"])):z("",!0),y(i).product_card_summary&&y(a)!=="auto_detect_card_product"&&![y(wr)].includes(y(d))?(m(),oe(y(s),{key:2,bot:y(u)},null,8,["bot"])):z("",!0),y(i).popup_banner&&![y(Bn),y(Un)].includes(y(d))?(m(),oe(w7,{key:3,item:y(i).popup_banner},null,8,["item"])):z("",!0),Ee.value&&!y(ae).state.isSurveyHidden&&!k.value&&!["www.dienmayxanh.com","www.thegioididong.com","www.nhathuocankhang.com"].includes(p.value)?(m(),oe(y(ov),{key:4,position:"right",handle:y(d)},{trigger:Se(({isOpen:L,position:V,toggleSlide:ie})=>[l("div",{class:ne(["fixed z-40 w-[30px] h-[98px] sm:h-[112px] sm:w-[34px] group opacity-100",V==="left"?"left-0":"right-0",L?V==="right"?"translate-x-full":"-translate-x-full":"translate-x-0 delay-300"]),style:"top: 30%;"},[l("button",{onClick:ie,class:ne(["w-full h-full bg-primary hover:opacity-90 text-white flex items-center justify-center duration-200",V==="left"&&"rounded-r-lg",V==="right"&&"rounded-l-lg"])},[l("div",JL,[l("div",XL,[l("div",ZL,j(y(c)("survey.rate")),1),G(T7,{class:"size-[15px] sm:size-[17px] -rotate-90 text-white"})])])],10,QL),l("button",{onClick:Gt(ue,["stop"]),class:ne(["absolute -top-[5px] w-4 h-4 rounded-full bg-white shadow-md flex items-center justify-center text-gray-500 hover:text-gray-900 border border-gray-200 z-10 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",[V==="left"?"-right-[5px]":"-left-[5px]"]]),title:y(c)("survey.closeRate")},[G(_o,{class:"w-2.5 h-2.5"})],10,YL)],2)]),widget:Se(({closeSlide:L})=>[G(y(X7),{bot:y(u),preview:e.isPreview,widget:Ee.value,onClose:L},null,8,["bot","preview","widget","onClose"])]),_:1},8,["handle"])):z("",!0),y(i).order_survey&&!["www.dienmayxanh.com","www.thegioididong.com","www.nhathuocankhang.com"].includes(p.value)?(m(),oe(y(ov),{key:5,position:"right"},{widget:Se(({openSlide:L,closeSlide:V})=>[G(y(ML),{bot:y(u),widget:y(i).order_survey,preview:e.isPreview,onOpen:L,onClose:V},null,8,["bot","widget","preview","onOpen","onClose"])]),_:1})):z("",!0)])):z("",!0)}}},av="https://widget.geteasy.ai",vd="easychatgpt-widget";window.EasyAIChat={_config:null,_initialized:!1,init(e){if(this._initialized)return;this._config=e;const t=async()=>{let n=document.getElementById(vd);if(n!=null&&n.hasAttribute("data-ecg-initialized")){this._initialized=!0;return}n||(n=document.createElement("div"),n.id=vd,document.body.appendChild(n));const s=document.createElement("div"),r=n.attachShadow({mode:"open"});r.appendChild(s),Zr(iv,this._config).mount(s);const o=document.createElement("link");o.rel="stylesheet",o.href=`${av}/dist/widget/main.css?v=${Date.now()}`,o.onload=()=>{n.setAttribute("data-ecg-initialized","true"),this._initialized=!0},r.appendChild(o);const i=e.handle||null,a=e.workspaceUuid||null;a&&an.actions.init(a),i&&ae.actions.setHandle(i);const c=await ae.actions.fetchBotInit(i,{},{website:!0,workspaceUuid:a,preview:!!e.preview});!i&&(c!=null&&c.handle)&&(this._config={...this._config,handle:c.handle});const u=a||(c==null?void 0:c.workspace_uuid);u&&!a&&an.actions.init(u),Ir({handle:(c==null?void 0:c.handle)||i})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t()},injectWidget:wi,injectChat(e,{type:t="view"}={}){const n=document.querySelector(e);if(!n){console.error(`Target element not found: ${e}`);return}let s;n.shadowRoot?(s=n.shadowRoot,s.innerHTML=""):s=n.attachShadow({mode:"open"});const r=document.createElement("div");r.setAttribute("id","chat-app"),s.appendChild(r),Zr(t==="view"?Yg:iv,this._config).mount(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${av}/dist/widget/main.css`,s.appendChild(i);const a=document.getElementById(vd);a&&n.setAttribute("style",a.getAttribute("style"))},send(e){Ci().isOpen.value=!0,Ir().send({message:e})},rcm:{init:e=>an.actions.init(e)},sync:{event:{login:"eac-sync-login",logout:"eac-sync-logout",cart:"eac-sync-cart",namespace:"eac-sync"},emit(e,t){if(!e)return;const n=this.event[e]||`${this.event.namespace}-${e}`;window.dispatchEvent(new CustomEvent(n,{detail:t,bubbles:!0,composed:!0}))},on(e,t){if(!e||typeof t!="function")return;const n=this.event[e]||`${this.event.namespace}-${e}`,s=r=>t(r.detail,r);return window.addEventListener(n,s),()=>window.removeEventListener(n,s)},offAll(e){if(!e)return;const t=this.event[e]||`${this.event.namespace}-${e}`;window.removeEventListener(t,null)}}},window.EasyAI=window.EasyAIChat,window.EAI=window.EasyAIChat,window.EAC=window.EasyAIChat,window.ECG=window.EasyAIChat,window.EasyChatGPT=window.EasyAIChat;const eR={class:"bg-white"},tR=["onClick"],nR={class:"flex-1 text-sm"},sR={key:0,class:"flex flex-col px-1 mt-2"},rR={class:"pl-1"},oR={class:"px-3 py-2 mt-1 text-sm bg-blue-50 rounded-lg"},iR={key:0,class:"ask-ai-result"},aR={key:1,class:"ask-ai-result"},lR=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"WidgetFeatureAIProductInsightEmbed",props:{widget:{type:Object,default:()=>({})}},setup(e){const t=e,n=R(null),s=R({}),r=R([]);let o=R(null);const i=[{id:1,name:"👍 Tóm tắt ưu điểm",message:"👍 Tóm tắt ưu điểm của {title}"},{id:2,name:"🆚 So sánh mẫu tương đương",message:"🆚 So sánh các mẫu tương đương của {title}"}],a=Z(()=>{var g,p;return((p=(g=t.widget)==null?void 0:g.dynamic_prompts)==null?void 0:p.product)??i}),c=g=>{if(!g)return;const p=g.split(" ");r.value=[];let v=0;o.value=setInterval(()=>{v<p.length?(r.value.push(p[v]),v++):clearInterval(o.value)},60)},u=()=>{clearInterval(o.value),r.value=[]},d=async()=>{try{const g=window.location.href;if(s.value[g]){c(s.value[g]);return}const{data:p}=await Xe.summary.getSummary({handle:ae.state.handle,source:g});p!=null&&p.highlight&&(s.value[g]=p.highlight,c(s.value[g]))}catch(g){console.log("Failed to get summary:",g)}},f=()=>{const g=Ts(),p=os("Product");g.title&&(p.name=g.title),p?(n.value=p,d()):n.value=null};Je(()=>{u(),f()});const h=g=>{const p=g.replace(/{title}/g,n.value.name).replace(/{product}/g,n.value.name);EAC.send(p)};return(g,p)=>(m(),x("div",eR,[(m(!0),x(_e,null,Me(a.value,(v,_)=>(m(),x("div",{key:_,class:"flex justify-between items-center py-2 pr-2 pl-3 text-gray-800 rounded-lg cursor-pointer hover:bg-gray-100",onClick:w=>h(v.message)},[l("div",nR,j(v.name),1),G(y(Pr),{size:"16",class:"text-gray-600"})],8,tR))),128)),r.value?(m(),x("div",sR,[l("div",rR,[G(Ri,{title:"AI đánh giá",size:"md"})]),l("div",oR,[r.value.length?(m(),x("div",iR,[(m(),x("span",{key:r.value.length},j(r.value.join(" ")),1))])):(m(),x("div",aR,"AI đang xử lý ..."))])])):z("",!0)]))}}},Symbol.toStringTag,{value:"Module"})),cR={key:0,class:"p-4 sm:px-4 sm:py-5 w-full border border-blue-100 rounded-2xl bg-blue-50/60"},uR={key:0,class:"flex flex-col"},dR={class:"mb-2 flex items-center gap-1"},fR={class:"text-sm pl-1"},hR={key:0},pR={key:0,class:"mb-1.5"},mR={key:1},gR={class:"space-y-1"},vR=l("span",{class:"size-1 rounded-full bg-gray-700 flex-shrink-0 mr-2 translate-y-2"},null,-1),yR={key:1,class:"ask-ai-result"},bR=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"WidgetSummaryPageContent",props:{widget:{type:Object,default:()=>({})},isShowHighlight:{type:Boolean,default:!0},isShowFeatures:{type:Boolean,default:!0}},setup(e){const t=e,n=R({}),s=Z(()=>{const g=t.isShowHighlight&&r.value.highlight,p=t.isShowFeatures&&r.value.features.length;return g||p}),r=R({highlight:"",features:[]});let o=R(null),i=R("highlight"),a=R(0);const c=g=>{r.value={highlight:"",features:[]},i.value="highlight",a.value=0,g.highlight?u(g.highlight,g):g.features&&g.features.length&&(i.value="features",d(g))},u=(g,p)=>{const v=g.split(" ");let _=0;const w=[],k=setInterval(()=>{_<v.length?(w.push(v[_]),r.value.highlight=w.join(" "),_++):(clearInterval(k),p.features&&p.features.length&&setTimeout(()=>{i.value="features",d(p)},200))},40);o.value=k},d=g=>{if(a.value>=g.features.length)return;const v=g.features[a.value].split(" ");let _=0;const w=[],k=setInterval(()=>{if(_<v.length){w.push(v[_]);const S=[...r.value.features];S[a.value]=w.join(" "),r.value.features=S,_++}else clearInterval(k),a.value++,a.value<g.features.length&&setTimeout(()=>{d(g)},100)},40);o.value=k},f=()=>{clearInterval(o.value),r.value={highlight:"",features:[]},i.value="highlight",a.value=0},h=async()=>{try{const g=ae.state.handle,p=window.location.href;if(n.value[p]){c(n.value[p]);return}const{data:v}=await Xe.summary.getSummary({handle:g,source:p});v&&(v.highlight||v.features&&v.features.length)&&(n.value[p]=v,c(v))}catch(g){console.log("Failed to get summary:",g)}};return Je(()=>{f(),h()}),(g,p)=>s.value?(m(),x("div",cR,[s.value?(m(),x("div",uR,[l("div",dR,[G(Ri,{title:"AI tóm tắt",size:"md"})]),l("div",fR,[r.value.highlight||r.value.features.length?(m(),x("div",hR,[e.isShowHighlight&&r.value.highlight?(m(),x("div",pR,[l("span",null,j(r.value.highlight),1)])):z("",!0),e.isShowFeatures&&r.value.features.length?(m(),x("div",mR,[l("ul",gR,[(m(!0),x(_e,null,Me(r.value.features,(v,_)=>(m(),x("li",{key:_,class:"flex items-start"},[vR,l("span",null,j(v),1)]))),128))])])):z("",!0)])):(m(),x("div",yR,"AI đang xử lý ..."))])])):z("",!0)])):z("",!0)}}},Symbol.toStringTag,{value:"Module"})),_R={class:"flex items-center gap-1.5 relative"},xR={class:"flex items-center pl-1.5 text-sm text-gray-700 touch-manipulation cursor-pointer"},wR={class:"transition-all duration-300 w-[130px] opacity-100"},kR=["aria-label"],lv=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"WidgetAskAI",props:{widget:{type:Object,required:!0}},setup(e){const t=R(!1),n=R(null),s=R(null),r=R(""),o=R(""),i=R(!1),a=R(!1),c=R(!1),u=R(null),d=R(null),f=R([]),h=dt({top:"0px",left:"0px",transform:"translate(-50%, 100%)",boxShadow:"rgba(100, 100, 111, 0.2) 0px 7px 29px 0px"}),g=e;Pe(t,W=>{W?kt(()=>{s.value&&(s.value.focus(),kt(O))}):(r.value="",o.value="",a.value=!1,c.value=!1,clearTimeout(u.value),d.value=null,I())});const p=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768,v=()=>{const W=window.getSelection();if(!W.rangeCount||W.isCollapsed)return null;const K=W.getRangeAt(0).getBoundingClientRect();return K.width===0&&K.height===0?null:{x:K.left+K.width/2,y:K.bottom}},_=(W,H)=>{const K=window.pageXOffset,J=window.pageYOffset,te=window.innerWidth,ge=window.innerHeight,ue=i.value?16:10,we=50,Ee=i.value?200:280;let re=W,pe=H,fe="-50%",$e="0%";const Re=ge-H,Le=H;if(Re<we+ue&&Le>we+ue?(pe=H-ue,$e="-100%"):(pe=H+ue,$e="0%"),i.value)re=te/2,fe="-50%";else{const Oe=Ee/2;W-Oe<ue?re=ue+Oe:W+Oe>te-ue?re=te-ue-Oe:re=W}h.top=`${pe+J}px`,h.left=`${re+K}px`,h.transform=`translate(${fe}, ${$e})`,kt(()=>{if(!n.value)return;const Oe=n.value.getBoundingClientRect();let Ve=re+K,N=pe+J;Oe.left<ue?(Ve=ue+K,h.transform=`translate(0%, ${$e})`):Oe.right>te-ue&&(Ve=te-ue-Oe.width+K,h.transform=`translate(0%, ${$e})`),(Oe.bottom>ge-ue||Oe.top<ue)&&(Le>Re&&Le>we+ue?(N=pe+J-Oe.height-ue*2,h.transform=`translate(${fe.includes("0%")?"0%":"-50%"}, 0%)`):(N=ue+J,h.transform=`translate(${fe.includes("0%")?"0%":"-50%"}, 0%)`)),h.left=`${Ve}px`,h.top=`${N}px`,i.value&&Oe.width>te-ue*2&&(n.value.style.maxWidth=`${te-ue*2}px`)})},w=(W,H,K)=>{r.value=K;const J=window.getSelection();J.rangeCount&&!J.isCollapsed&&(d.value=J.getRangeAt(0).cloneRange()),_(W,H),t.value=!0},k=()=>{t.value=!1,n.value&&(n.value.style.maxWidth=""),I()},S=W=>{setTimeout(()=>{var K,J;((K=n.value)==null?void 0:K.contains(document.activeElement))||((J=n.value)==null?void 0:J.contains(W.relatedTarget))||(a.value=!1,i.value||(c.value=!1,k()))},150)},E=W=>{var te;W==null||W.stopPropagation(),W==null||W.preventDefault(),c.value=!0;const H=o.value.trim(),K=r.value.trim().replace(/\s+/g," ");let J="";H&&K?J=`<blockquote><p>${K}</p></blockquote><p>${H}</p>`:H?J=`<p>${H}</p>`:K&&(J=`<blockquote><p>${K}</p></blockquote>`),J&&((te=window.EAC)!=null&&te.send)&&window.EAC.send(J),setTimeout(k,150)},O=()=>{if(!d.value)return;I();const W=d.value.getClientRects();for(let H=0;H<W.length;H++){const K=W[H],J=document.createElement("span");J.style.position="absolute",J.style.backgroundColor="rgba(0, 123, 255, 0.15)",J.style.pointerEvents="none",J.style.left=`${K.left+window.pageXOffset}px`,J.style.top=`${K.top+window.pageYOffset}px`,J.style.width=`${K.width}px`,J.style.height=`${K.height}px`,J.style.zIndex="999999",document.body.appendChild(J),f.value.push(J)}},I=()=>{f.value.forEach(W=>W.remove()),f.value=[]},P=()=>{clearTimeout(u.value),u.value=setTimeout(()=>{const W=window.getSelection(),H=W==null?void 0:W.toString().trim();if(H&&H.length>0&&!W.isCollapsed){const K=v();K&&w(K.x,K.y,H)}else!a.value&&!c.value&&k()},200)},M=W=>{t.value&&n.value&&!n.value.contains(W.target)&&k()},q=()=>{t.value&&k()},B=(W,H)=>{if(!H||!W)return!1;const K=H.replace(/\*\*\//g,"(.*/)?").replace(/\*\*/g,".*").replace(/\*/g,"[^/]*").replace(/\?/g,".").replace(/\./g,"\\.");return new RegExp(`^${K}$`).test(W)},T=(W,H="")=>{const K=H.split(`
`).map(te=>te.trim()).filter(te=>te.length>0);let J=K.length===0;return K.length>0&&(J=K.some(te=>B(W,te))),J},A=()=>{clearTimeout(u.value),document.removeEventListener("mouseup",P),document.removeEventListener("selectionchange",P),document.removeEventListener("touchend",P),document.removeEventListener("click",M),window.removeEventListener("orientationchange",D),window.removeEventListener("scroll",q),[".layout-wrapper",".chat-widget-wrapper"].forEach(W=>{const H=document.querySelector(W);H&&H.removeEventListener("scroll",q)}),I(),d.value=null},D=()=>{setTimeout(()=>{i.value=p()},500)},Q=()=>{var K;const W=window.location.pathname;if(!T(W,(K=g.widget)==null?void 0:K.include_path_patterns)){t.value=!1;return}i.value=p(),i.value?(document.addEventListener("selectionchange",P,{passive:!0}),document.addEventListener("touchend",P,{passive:!0})):document.addEventListener("mouseup",P,{passive:!0}),document.addEventListener("click",M,{passive:!1}),i.value&&window.addEventListener("orientationchange",D,{passive:!0}),window.addEventListener("scroll",q,{passive:!0}),[".layout-wrapper",".chat-widget-wrapper"].forEach(J=>{const te=document.querySelector(J);te&&te.addEventListener("scroll",q,{passive:!0})})};return Je(()=>{bi(()=>{A(),Q()},!0)}),Rt(()=>{A()}),(W,H)=>t.value?(m(),x("div",{key:0,ref_key:"tooltip",ref:n,onClick:H[3]||(H[3]=Gt(()=>{},["stop"])),class:"fixed z-[9999999990] bg-white rounded-xl p-1 border border-gray-200",style:ht(h)},[l("div",_R,[l("div",xR,[G(y(Y2),{size:"17","stroke-width":"1.5"}),l("div",wR,[Lt(l("input",{ref_key:"inputRef",ref:s,type:"text","onUpdate:modelValue":H[0]||(H[0]=K=>o.value=K),onKeydown:[gr(E,["enter"]),gr(k,["esc"])],onFocus:H[1]||(H[1]=K=>a.value=!0),onBlur:S,placeholder:"Nhập câu hỏi ✨",class:"border-none w-full outline-none px-2 h-7"},null,544),[[rn,o.value]])]),l("button",{"aria-label":`eac-widget-ask-ai${i.value?"-mobile":""}`,class:ne(["whitespace-nowrap text-[13px] font-medium tracking-tight h-7 flex justify-center items-center px-2 rounded-lg transition-all duration-300",[(i.value,"bg-gray-50 hover:bg-blue-50 hover:text-blue-500 border border-gray-100"),o.value&&"text-blue-500 !bg-blue-50"]]),onClick:E,onMousedown:H[2]||(H[2]=Gt(()=>{},["prevent"]))}," Hỏi AI ",42,kR)])])],4)):z("",!0)}}},Symbol.toStringTag,{value:"Module"})),SR={class:"relative flex flex-col w-full overflow-hidden h-dvh"},CR={class:"flex items-center justify-between px-3 h-[50px] sm:px-4"},$R={class:"bg-white px-2.5 py-1 rounded-lg text-gray-900"},TR={class:"text-gray-500"},AR={class:"flex gap-2"},ER={class:"flex items-center justify-center h-[calc(100%-80px-50px)] overflow-hidden sm:px-14 py-4 px-2"},IR=["src","alt"],PR=["src"],MR={class:"h-[80px] flex-shrink-0 p-2 flex items-center justify-center"},OR={class:"flex h-full gap-2 overflow-x-auto"},LR=["onClick"],RR=["src","alt"],DR=["data-index","src"],jR=["src"],NR={key:2,class:"absolute inset-0 flex items-center justify-center bg-black/20"},FR={class:"flex items-center justify-center w-6 h-6 rounded-full sm:w-8 sm:h-8 bg-white/70"},qR=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"ImageGallery",props:{media:{type:Array,required:!0},initialIndex:{type:Number,default:0},onRemove:{type:Function,default:null}},emits:["close"],setup(e,{emit:t}){const n=e,s=Z(()=>n.media.filter(T=>T.type==="image"||T.type==="video")),r=t,o=R(n.initialIndex),i=R([]),a=R([]);R({});const c=R(null),u=Z(()=>s.value[o.value]||{});Pe(u,T=>{T.type==="video"&&c.value&&c.value.load()});const d=()=>{o.value<s.value.length-1?o.value++:o.value=0,g()},f=()=>{o.value>0?o.value--:o.value=s.value.length-1,g()},h=T=>{o.value=T,g()},g=async()=>{await kt();const T=i.value[o.value];T&&T.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},p=async()=>{try{const T=await fetch(u.value.url);if(!T.ok)throw new Error("Failed to fetch file");const A=await T.blob(),D=window.URL.createObjectURL(A),Q=document.createElement("a");if(Q.href=D,u.value.filename)Q.download=u.value.filename;else{const W=u.value.url.split("?")[0],H=W.substring(W.lastIndexOf("/")+1);Q.download=H||`download_${Date.now()}`}document.body.appendChild(Q),Q.click(),document.body.removeChild(Q),window.URL.revokeObjectURL(D)}catch(T){console.error("Download failed:",T)}},v=T=>new Promise((A,D)=>{T.load();const Q=()=>{T.currentTime=.1,T.removeEventListener("loadedmetadata",Q)},W=()=>{A(),T.removeEventListener("loadeddata",W),T.removeEventListener("error",H)},H=()=>{D(new Error("Cannot load video")),T.removeEventListener("loadedmetadata",Q),T.removeEventListener("loadeddata",W),T.removeEventListener("error",H)};T.addEventListener("loadedmetadata",Q),T.addEventListener("loadeddata",W),T.addEventListener("error",H),setTimeout(()=>{A()},3e3)}),_=async()=>{await kt();for(const[T,A]of s.value.entries())if(A.type==="video"&&A.url){const D=a.value[T];if(D)try{await v(D)}catch(Q){console.error(`Error setting thumbnail for video ${A.url}:`,Q)}}},w=()=>{n.onRemove?n.onRemove():r("close")},k=T=>{T.target===T.currentTarget&&w()},S=T=>{switch(T.key){case"ArrowLeft":f();break;case"ArrowRight":d();break;case"Escape":w();break}},E=R(0),O=R(0),I=R(0),P=R(0),M=T=>{E.value=T.changedTouches[0].screenX,I.value=T.changedTouches[0].screenY},q=T=>{O.value=T.changedTouches[0].screenX,P.value=T.changedTouches[0].screenY},B=()=>{const T=E.value-O.value,A=Math.abs(I.value-P.value);Math.abs(T)>50&&A<100&&(T>0?d():f())};return Je(async()=>{document.addEventListener("keydown",S),document.body.style.overflow="hidden",g(),await _()}),Rt(()=>{document.removeEventListener("keydown",S),document.body.style.overflow=""}),(T,A)=>(m(),x("div",{class:"flex fixed inset-0 z-[99999999990] justify-center items-center bg-black/40",onClick:k,onTouchstart:M,onTouchmove:q,onTouchend:B},[l("div",SR,[l("div",CR,[l("div",$R,[We(j(u.value.type==="video"?"Video":"Hình ảnh")+" ",1),l("span",TR,j(o.value+1)+"/"+j(s.value.length),1)]),l("div",AR,[l("button",{onClick:p,class:"p-2 hover:bg-gray-100 rounded-lg transition-colors bg-white",title:"Tải xuống"},[G(y(Ym),{size:"18"})]),l("button",{onClick:w,class:"p-2 hover:bg-gray-100 rounded-lg transition-colors bg-white"},[G(y(Es),{size:"18"})])])]),l("div",ER,[u.value.type==="image"?(m(),x("img",{key:0,src:u.value.url,alt:`Gallery Image ${o.value+1}`,class:"object-contain w-full h-full"},null,8,IR)):u.value.type==="video"?(m(),x("video",{ref_key:"mainVideoRef",ref:c,key:u.value.url,controls:"",playsinline:"","webkit-playsinline":"",preload:"metadata",class:"h-full max-w-full"},[l("source",{src:u.value.url+"#t=0.5",type:"video/mp4"},null,8,PR),We(" Your browser does not support the video tag. ")])):z("",!0)]),s.value.length>1?(m(),x("button",{key:0,onClick:f,class:"absolute hidden sm:block left-1 top-[46%] -translate-y-1/2 z-20 pointer-events-auto p-2 rounded-full bg-white",title:"Trước"},[G(y(go),{size:"16",class:"text-gray-500"})])):z("",!0),s.value.length>1?(m(),x("button",{key:1,onClick:d,class:"absolute hidden sm:block right-1 top-[46%] -translate-y-1/2 z-20 pointer-events-auto p-2 rounded-full bg-white",title:"Sau"},[G(y(Pr),{size:"16",class:"text-gray-500"})])):z("",!0),l("div",MR,[l("div",OR,[(m(!0),x(_e,null,Me(s.value,(D,Q)=>(m(),x("div",{key:Q,ref_for:!0,ref:W=>{W&&(i.value[Q]=W)},class:"relative flex-shrink-0 h-full overflow-hidden rounded-lg cursor-pointer group aspect-[1/1]",onClick:W=>h(Q)},[D.type==="image"?(m(),x("img",{key:0,src:D.url,alt:`Thumbnail ${Q+1}`,class:ne(["object-cover w-full h-full transition-all border rounded-lg border-gray-100",Q==o.value?"border-primary":""])},null,10,RR)):D.type==="video"?(m(),x("video",{key:1,ref_for:!0,ref:W=>{W&&(a.value[Q]=W)},muted:"",playsinline:"","webkit-playsinline":"",preload:"metadata",class:ne(["object-cover w-full h-full transition-all border-2 rounded-lg",Q===o.value?"border-blue-500":"border-gray-200 hover:border-gray-300"]),"data-index":Q,src:D.url+"#t=0.1"},[l("source",{src:D.url,type:"video/mp4"},null,8,jR)],10,DR)):z("",!0),D.type==="video"?(m(),x("div",NR,[l("div",FR,[G(y(og),{class:"w-3 h-3 sm:w-4 sm:h-4 text-gray-700 ml-0.5"})])])):z("",!0)],8,LR))),128))])])])],32))}}},Symbol.toStringTag,{value:"Module"})),zR={},BR={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},UR=[l("rect",{width:"16",height:"16",rx:"8",fill:"#0959B6"},null,-1),l("path",{d:"M7.36454 4.38676C7.64356 3.87108 8.35644 3.87108 8.63546 4.38676L9.3989 5.7977C9.503 5.99008 9.68228 6.12577 9.89009 6.16945L11.4142 6.48979C11.9712 6.60686 12.1915 7.31311 11.8069 7.74889L10.7547 8.94125C10.6112 9.10382 10.5427 9.32337 10.567 9.54274L10.7455 11.1517C10.8108 11.7397 10.2341 12.1762 9.71735 11.9298L8.30357 11.2558C8.11081 11.1639 7.88919 11.1639 7.69643 11.2558L6.28265 11.9298C5.76594 12.1762 5.18921 11.7397 5.25445 11.1517L5.43296 9.54274C5.4573 9.32337 5.38882 9.10382 5.24534 8.94125L4.19307 7.74889C3.80849 7.31311 4.02878 6.60686 4.58581 6.48979L6.10991 6.16945C6.31772 6.12577 6.49701 5.99008 6.6011 5.7977L7.36454 4.38676Z",fill:"white"},null,-1)];function VR(e,t){return m(),x("svg",BR,UR)}const cv=Qe(zR,[["render",VR]]),HR={},WR={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},GR=[l("path",{d:"M12.3337 0.833313C12.5249 0.833437 12.6993 0.942626 12.783 1.11456C12.8666 1.28669 12.8445 1.4914 12.7263 1.64191L9.69507 5.50031H13.6667C13.8653 5.50031 14.045 5.61736 14.1248 5.79913C14.2044 5.98106 14.1686 6.19324 14.0339 6.33917L6.03394 15.0062C5.87818 15.1746 5.62774 15.2151 5.42651 15.1048C5.22521 14.9944 5.12492 14.7614 5.18335 14.5394L6.6853 8.83331H2.66675C2.49178 8.83331 2.32959 8.7418 2.23901 8.5921C2.14844 8.44241 2.1422 8.25588 2.22339 8.10089L5.89038 1.10089L5.92651 1.0423C6.01953 0.912191 6.17102 0.833313 6.33374 0.833313H12.3337Z",fill:"url(#paint0_linear_745_62583)",stroke:"#9C020C","stroke-linejoin":"round"},null,-1),l("defs",null,[l("linearGradient",{id:"paint0_linear_745_62583",x1:"8.16675",y1:"1.33331",x2:"8.16675",y2:"14.6666",gradientUnits:"userSpaceOnUse"},[l("stop",{"stop-color":"#FFF067"}),l("stop",{offset:"1","stop-color":"#FCE61E"})])],-1)];function KR(e,t){return m(),x("svg",WR,GR)}const Rl=Qe(HR,[["render",KR]]),QR={},JR={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},XR=[l("g",{"clip-path":"url(#clip0_745_62553)"},[l("path",{d:"M12.4332 1.90002L12.8399 4.47336L15.1799 5.66669L13.9999 8.00002L15.1866 10.3334L12.8266 11.5267L12.4199 14.1L9.82657 13.6934L7.9799 15.5334L6.12657 13.6667L3.55323 14.0934L3.1399 11.5L0.813232 10.3134L1.9999 7.98002L0.819899 5.66669L3.1599 4.46002L3.56657 1.90669L6.14657 2.33336L7.9999 0.460022L9.84657 2.30669L12.4332 1.90002ZM6.33323 4.66669C6.06802 4.66669 5.81366 4.77205 5.62613 4.95958C5.43859 5.14712 5.33323 5.40147 5.33323 5.66669C5.33323 5.93191 5.43859 6.18626 5.62613 6.3738C5.81366 6.56133 6.06802 6.66669 6.33323 6.66669C6.59845 6.66669 6.8528 6.56133 7.04034 6.3738C7.22788 6.18626 7.33323 5.93191 7.33323 5.66669C7.33323 5.40147 7.22788 5.14712 7.04034 4.95958C6.8528 4.77205 6.59845 4.66669 6.33323 4.66669ZM9.66657 9.33336C9.40135 9.33336 9.147 9.43871 8.95946 9.62625C8.77192 9.81379 8.66657 10.0681 8.66657 10.3334C8.66657 10.5986 8.77192 10.8529 8.95946 11.0405C9.147 11.228 9.40135 11.3334 9.66657 11.3334C9.93178 11.3334 10.1861 11.228 10.3737 11.0405C10.5612 10.8529 10.6666 10.5986 10.6666 10.3334C10.6666 10.0681 10.5612 9.81379 10.3737 9.62625C10.1861 9.43871 9.93178 9.33336 9.66657 9.33336ZM5.60657 11.3334L11.3332 5.60669L10.3932 4.66669L4.66657 10.3934L5.60657 11.3334Z",fill:"#FFE58F"})],-1),l("defs",null,[l("clipPath",{id:"clip0_745_62553"},[l("rect",{width:"16",height:"16",fill:"white"})])],-1)];function ZR(e,t){return m(),x("svg",JR,XR)}const uv=Qe(QR,[["render",ZR]]),YR={},eD={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},tD=[l("rect",{width:"16",height:"16",rx:"8",fill:"#FFF1B8"},null,-1),l("path",{d:"M5.60441 12.0963C5.1167 11.5747 4.62901 11.0323 4.31864 10.3856C4.00829 9.69707 3.91961 8.90427 4.0748 8.1532C4.22998 7.40213 4.58466 6.69278 5.09455 6.08775C5.05022 6.60934 5.24973 7.15177 5.62659 7.54818C5.4049 6.54675 5.7596 5.46186 6.46898 4.66906C7.17836 3.87627 8.15378 3.35467 9.17351 3C8.66364 3.50072 8.59714 4.29351 8.79665 4.96114C8.99617 5.62876 9.41737 6.21293 9.79423 6.81795C10.1711 7.42298 10.5258 8.04887 10.548 8.73736C10.7475 8.38269 10.9692 8.028 11.1022 7.63162C11.2352 7.23521 11.3017 6.81795 11.1909 6.42155C11.5899 6.88054 11.8116 7.33952 11.9224 7.92369C12.0332 8.50787 12.0111 9.11289 11.9446 9.69707C11.8559 10.3438 11.6786 11.0114 11.3017 11.5539C10.8584 12.2006 10.1489 12.6596 9.37306 12.91C7.99859 13.1395 6.64632 12.9517 5.60441 12.0963Z",fill:"#F3705A"},null,-1),l("path",{d:"M7.34185 12.8641C9.00724 13.5566 10.6523 11.4576 9.73839 9.83469C9.73839 9.81305 9.71807 9.81305 9.71807 9.79142C9.79932 10.6786 9.59621 11.3278 9.21032 11.6957C9.41343 11.1763 9.27125 10.5704 9.02753 10.0511C8.78382 9.5534 8.43856 9.09898 8.17453 8.62292C7.91049 8.12523 7.70741 7.56261 7.82927 7C7.34183 7.3895 6.99658 7.97375 6.8544 8.60127C6.71223 9.2288 6.79347 9.92126 7.0575 10.5055C6.75286 10.2675 6.52946 9.87798 6.50914 9.46684C6.18418 9.87798 5.9811 10.4189 6.00139 10.9599C6.00141 11.8038 6.631 12.5612 7.34185 12.8641Z",fill:"#FFD15C"},null,-1)];function nD(e,t){return m(),x("svg",eD,tD)}const dv=Qe(YR,[["render",nD]]),fv={__name:"Badge",props:{variant:{type:String,default:"orange",validator:e=>["re_qua_troi","khong_dau_re_hon","re_nhat_roi","gia_re_giat_minh","khong_dau_re_bang","re_nhat_thi_truong","availability","gray"].includes(e)},size:{type:String,default:"md",validator:e=>["sm","md"].includes(e)}},setup(e){const t=e,n={availability:{icon:dv,text:"",bg:"bg-gradient-to-r from-yellow-300 via-yellow-400 to-amber-500 text-red-700 shadow-sm"},re_qua_troi:{icon:uv,text:"RẺ QUÁ TRỜI!",bg:"bg-gradient-to-r from-red-600 to-red-800 text-yellow-300"},khong_dau_re_hon:{icon:Rl,text:"KHÔNG ĐÂU RẺ HƠN",bg:"bg-gradient-to-r from-orange-400 to-red-600 text-yellow-200"},re_nhat_roi:{icon:cv,text:"RẺ NHẤT RỒI!",bg:"bg-gradient-to-r from-[#9C020C] via-[#C41E3A] to-[#800000] text-yellow-300 border border-red-950 shadow-xl"},gia_re_giat_minh:{icon:uv,text:"Giá RẺ GIẬT MÌNH!!!",bg:"bg-gradient-to-r from-yellow-300 via-yellow-200 to-yellow-100 text-red-600 border border-yellow-400"},khong_dau_re_bang:{icon:Rl,text:"KHÔNG ĐÂU RẺ BẰNG",bg:"bg-gradient-to-r from-red-500 to-orange-600 text-yellow-300"},re_nhat_thi_truong:{icon:cv,text:"RẺ NHẤT THỊ TRƯỜNG",bg:"bg-gradient-to-r from-yellow-500 via-orange-400 to-red-600 text-yellow-100"},gray:{icon:null,text:"",bg:"bg-gray-200 text-gray-500 border border-gray-300"}},s=Z(()=>{var a;return((a=n[t.variant])==null?void 0:a.icon)||null}),r=Z(()=>{var a;return((a=n[t.variant])==null?void 0:a.text)||null}),o=Z(()=>{let a="";if(n[t.variant])a=n[t.variant].bg;else switch(t.variant){case"green":a="bg-green-gradient text-yellow-200";break;case"purple":a="bg-purple-gradient text-yellow-200";break;case"red":a="bg-red-gradient text-yellow-300";break;default:a="bg-orange-gradient text-red-800";break}return a}),i=Z(()=>t.size==="sm"?"pl-0.5 pr-1.5 py-[3px] text-xs rounded-full":"px-2 py-1.5 text-[15px] rounded-full");return(a,c)=>(m(),x("div",{class:ne(["inline-flex items-center font-bold leading-none justify-center tracking-tight",[o.value,i.value]])},[s.value?(m(),oe(Nt(s.value),{key:0,class:ne(["bg-red-gradient rounded-full",e.size==="sm"?"size-sm mr-px":"size-l mr-1"])},null,8,["class"])):z("",!0),It(a.$slots,"default",{},()=>[We(j(r.value),1)])],2))}},sD={class:"relative w-full"},rD={key:0},oD={key:0},iD=Qe({__name:"ProgressSale",props:{dayToSale:{type:Number,default:null},endDate:{type:String,required:!0},flashSaleTo:{type:String,required:!0},flashSaleFrom:{type:String,required:!0}},setup(e){const t=e,n=R(0),s=R(0),r=R(0),o=R(0),i=R(!1),a=R(0),c=R(1);let u=null;const d=p=>String(p).padStart(2,"0"),f=p=>{if(!p)return null;const v=new Date(p);return isNaN(v.getTime())?null:v},h=()=>{const p=f(t.flashSaleFrom),v=f(t.flashSaleTo);if(!p||!v){a.value=0;return}a.value=Math.max(v.getTime()-p.getTime(),0)},g=()=>{const p=Date.now(),v=f(t.endDate),_=v?v.getTime():0,w=Math.max(_-p,0);if(w<=0||!v){n.value=0,s.value=0,r.value=0,o.value=0,c.value=100,i.value=!0,clearInterval(u);return}i.value=!1,n.value=Math.floor(w/(1e3*60*60*24)),s.value=Math.floor(w%(1e3*60*60*24)/(1e3*60*60)),r.value=Math.floor(w%(1e3*60*60)/(1e3*60)),o.value=Math.floor(w%(1e3*60)/1e3),a.value>0?c.value=Math.max(1,Math.min(100,Math.ceil(w*100/a.value))):c.value=100};return Pe(()=>t.endDate,()=>{h(),g(),clearInterval(u),u=setInterval(g,1e3)}),Je(()=>{h(),g(),u=setInterval(g,1e3)}),Rt(()=>{clearInterval(u)}),(p,v)=>(m(),x("div",sD,[l("div",{class:ne(["timer_deal_process h-[24px]",{is_ended_bg:i.value}])},[l("span",{style:ht({width:c.value+"%"}),class:ne(["progress_bar_fill",{active:!i.value,is_ended_fill:i.value}])},null,6)],2),l("div",{class:ne(["absolute top-1/2 -translate-y-1/2 left-[8px] font-semibold text-white label text-[11px] md:text-xs flex items-center gap-0.5",{"text-gray-500":i.value}])},[i.value?(m(),x("span",rD,"Chương trình đã kết thúc")):(m(),x(_e,{key:1},[We(" Còn "),n.value>0?(m(),x("span",oD,j(n.value)+" ngày ",1)):z("",!0),We(j(d(s.value))+":"+j(d(r.value))+":"+j(d(o.value))+" ("+j(c.value)+"%) ",1)],64))],2)]))}},[["__scopeId","data-v-00204529"]]),aD={class:"relative flex flex-col h-full group bg-white border border-red-600 lg:border-gray-200 rounded-xl transition-all duration-300 lg:hover:border-red-600 lg:hover:rounded-b-none"},lD={class:"h-full flex flex-col relative overflow-hidden"},cD={key:0,class:"px-1.5 pt-1.5 pb-px"},uD=["src","alt"],dD={key:0,class:"absolute inset-0 flex items-center justify-center p-4 z-10"},fD=["src"],hD={class:"flex flex-col flex-1 px-2.5 pb-2 pt-1"},pD=["title"],mD={class:"flex flex-col gap-1 mb-2 mt-1"},gD={class:"flex items-center gap-2"},vD={class:"flex items-start justify-between flex-wrap"},yD={key:0,class:"text-sm text-gray-500 line-through tracking-tight"},bD={class:"leading-none"},_D=Qe({__name:"CardProductVertical",props:{product:{type:Object,required:!0},ctaKey:{type:String,default:"available"},widgetSource:{type:String,default:"widget_pe_unknown"}},setup(e){const t="https://widget.geteasy.ai",n=e,s=Z(()=>{if(!n.product.discount)return"";const u=String(n.product.discount);return u.includes("%")||u.includes("-")?u:`-${u}%`}),r=Z(()=>{const u=`[${n.product.name}](${n.product.link})`;return{available:{label:"Check chi nhánh còn hàng",message:`Sản phẩm này có hàng ở chi nhánh nào? ${u}`},contact:{label:"Liên hệ tư vấn",message:`Liên hệ tư vấn sản phẩm này: ${u}`}}}),o=Z(()=>r.value[n.ctaKey]||r.value.available),i=()=>{var u;Fe.buttonClick({content:o.value.label,source:n.widgetSource}),(u=window.EasyAI)==null||u.send(o.value.message)},a=()=>{var u;Fe.buttonClick({content:"Tìm mẫu tương tự",source:n.widgetSource}),(u=window.EasyAI)==null||u.send(`${n.product.link}
Tìm mẫu tương tự cho sản phẩm này`)},c=()=>{Fe.productSelect({name:n.product.name,price:n.product.price,img:n.product.image,original_price:n.product.originalPrice,discount:n.product.discount,source:n.widgetSource})};return(u,d)=>(m(),x("div",aD,[l("div",lD,[e.product.badge?(m(),x("div",cD,[G(fv,{variant:e.product.badge},null,8,["variant"])])):z("",!0),(m(),oe(Nt(e.product.link?"a":"div"),{href:e.product.link||void 0,onClick:c,class:"aspect-[1/1] overflow-hidden bg-gray-50 relative block"},{default:Se(()=>[l("img",{src:e.product.image,alt:e.product.name,loading:"lazy",class:ne(["w-full h-full object-contain md:group-hover:scale-105 transition-transform duration-500",{"opacity-50 grayscale-[50%]":e.product.stock_remaining===0}])},null,10,uD),e.product.stock_remaining===0?(m(),x("div",dD,[l("img",{src:y(t)+"/sold-out-min.webp",alt:"Cháy suất",class:"w-full h-auto object-contain"},null,8,fD)])):z("",!0)]),_:1},8,["href"])),l("div",hD,[(m(),oe(Nt(e.product.link?"a":"div"),{href:e.product.link||void 0,onClick:c,class:"block"},{default:Se(()=>[l("h3",{class:"text-sm sm:text-base font-semibold text-gray-900 md:hover:text-red-600 line-clamp-2 md:group-hover:text-red-600 transition-colors duration-300 cursor-pointer min-h-[2.5rem] mb-1",title:e.product.name},j(e.product.name),9,pD)]),_:1},8,["href"])),l("div",mD,[l("div",gD,[l("span",{class:ne(["text-lg md:text-xl font-bold",e.product.stock_remaining===0?"text-gray-400":"text-red-600"])},j(e.product.price),3),e.product.price!=="Liên hệ"&&e.product.discount?(m(),x("div",{key:0,class:ne(["rounded-md px-1 font-semibold text-[11px]",e.product.stock_remaining===0?"bg-gray-200 text-gray-500":"bg-red-500 text-white"])},j(s.value),3)):z("",!0)]),l("div",vD,[e.product.price!=="Liên hệ"&&e.product.originalPrice?(m(),x("span",yD,j(e.product.originalPrice),1)):z("",!0),l("div",{class:ne(["text-[11px] tracking-tight font-medium px-1 py-px border",e.product.stock_remaining===0?"bg-yellow-100 text-yellow-700 border-yellow-300":"text-red-600 bg-red-50 border-red-200"])},j(e.product.stock_remaining>0?"Còn "+e.product.stock_remaining+"/"+e.product.stock_total+" suất":"Suất này đã hết!"),3)])]),e.product.stock_remaining>0?(m(),oe(iD,{key:0,"end-date":e.product.endDate,"flash-sale-from":e.product.flashSaleFrom,"flash-sale-to":e.product.flashSaleTo},null,8,["end-date","flash-sale-from","flash-sale-to"])):(m(),x("button",{key:1,onClick:Gt(a,["stop","prevent"]),class:"w-full flex lg:hover:opacity-90 items-center justify-center gap-1 py-1.5 px-3 text-white bg-orange-gradient text-sm font-semibold rounded-lg border border-gray-200"},[G(y(pl),{size:"14","stroke-width":"2.5"}),We(" Tìm mẫu tương tự ")]))])]),l("button",{onClick:i,class:"w-full gap-1 flex items-center justify-center hover:underline underline-offset-2 tracking-tight transition-all duration-300 z-50 rounded-b bg-orange-gradient text-white text-sm font-medium px-2 py-3 relative opacity-100 pointer-events-auto lg:absolute lg:bottom-0 lg:left-0 lg:right-0 lg:translate-y-full lg:opacity-0 lg:pointer-events-none lg:group-hover:opacity-100 lg:group-hover:pointer-events-auto lg:rounded-b-none lg:group-hover:rounded-b"},[l("span",bD,j(o.value.label),1)])]))}},[["__scopeId","data-v-006d9917"]]),hv=e=>(mn("data-v-ed6650e8"),e=e(),gn(),e),xD={key:0,class:"relative"},wD={class:"h-[64px] lg:h-[90px] flex items-end"},kD={class:"absolute inset-x-0 bottom-0 flex h-full justify-between px-2.5 xl:px-2 md:inset-x-8"},SD={class:"flex items-center -translate-y-2 w-full lg:w-fit"},CD={class:"flex gap-0.5 w-full lg:w-fit items-end overflow-x-auto eai-no-scrollbar"},$D=["onClick"],TD={class:"flex items-center gap-1 md:gap-2 uppercase whitespace-nowrap"},AD={key:0,style:{"box-shadow":"rgba(0, 0, 0, 0.35) 0px 4px 16px"},class:"hidden lg:flex items-center gap-2 bg-gradient-to-r from-red-700 to-red-500 rounded-t-3xl py-3 px-4 absolute -right-4 bottom-0"},ED={class:"p-1 flex relative items-center justify-center w-[160px] xl:w-[180px] bg-white rounded-xl border-4 border-[#FF9300]"},ID=["src"],PD={class:"flex flex-col md:flex-row items-center justify-center gap-2 md:gap-3 mt-1 relative z-30"},MD=hv(()=>l("div",{class:"text-white text-sm font-medium"}," Mỗi SĐT chỉ được mua 1 sản phẩm cùng loại ",-1)),OD=["href"],LD=hv(()=>l("span",{class:"font-bold uppercase text-[11px]"}," Gọi đặt trước ",-1)),RD=Object.freeze(Object.defineProperty({__proto__:null,default:Qe({__name:"WidgetFlashSale",props:{phoneNumber:{type:String,default:null},brandLogo:{type:String,default:null},ctaKey:{type:String,default:"available"}},setup(e){const t="https://widget.geteasy.ai",n=t+"/fs_header_bg.png",s=t+"/text_deal.png",r=t+"/fs_body_bg_mobile.webp",o=t+"/fs_badge_tab.webp",i=t+"/gift_right_icon.webp",a=t+"/fs_body_bg_desk.webp",c=R(!1),u=Z(()=>{var v,_;const p=[];return(v=an.state.flash_sales)!=null&&v.length&&p.push({id:"flashsale",label:"FlashSale",icon:Rl}),(_=an.state.hot_sales)!=null&&_.length&&p.push({id:"hotsale",label:"HotSale",icon:dv}),p}),d=R("");Pe(u,p=>{p.length>0&&!p.some(v=>v.id===d.value)&&(d.value=p[0].id)},{immediate:!0});const f=e,h=()=>{Fe.buttonClick({content:"Gọi đặt trước",source:"widget_pe_flash_sale",href:`tel:${f.phoneNumber}`})},g=Z(()=>d.value==="flashsale"?an.state.flash_sales||[]:an.state.hot_sales||[]);return(p,v)=>{var _,w;return(_=y(an).state.flash_sales)!=null&&_.length||(w=y(an).state.hot_sales)!=null&&w.length?(m(),x("div",xD,[l("div",wD,[l("div",{class:"relative h-[58px] w-[calc(100%-20px)] md:w-[calc(100%-76px)] mx-auto translate-y-1.5",style:ht({background:`url(${n}) center center / 100% 100% no-repeat`})},[l("div",kD,[l("div",SD,[l("div",CD,[(m(!0),x(_e,null,Me(u.value,k=>(m(),x("button",{key:k.id,onClick:S=>d.value=k.id,class:ne(["flex-1 rounded-t-2xl min-w-0 group px-4 lg:px-6 xl:px-8 py-3 font-black md:py-2.5 text-lg md:text-2xl transition-all duration-300 relative overflow-hidden h-full flex items-center justify-center cursor-pointer",d.value===k.id?"text-white":"text-red-300/80 md:hover:text-white"]),style:ht({background:`url(${o}) center center / 100% 100% no-repeat`})},[l("div",TD,[k.icon?(m(),oe(Nt(k.icon),{key:0,class:ne([d.value===k.id?"opacity-100 scale-110":"opacity-30 scale-90 md:group-hover:opacity-100 md:group-hover:scale-110","w-5 h-5 md:w-6 md:h-6 transition-all duration-300"])},null,8,["class"])):z("",!0),l("span",null,j(k.label),1)])],14,$D))),128))])]),e.brandLogo?(m(),x("div",AD,[l("img",{src:s,class:"w-[300px] shrink-0",alt:"Deal độc quyền từ"}),l("div",ED,[l("img",{src:e.brandLogo,class:"w-full h-full object-cover rounded-xl",alt:"Brand Logo"},null,8,ID),l("img",{alt:"Gift Box Right",class:"absolute -bottom-5 -right-12 size-16 animate-zoom",src:i})])])):z("",!0)])],4)]),l("div",{class:"px-2 md:px-4 pb-5 md:pb-8 pt-4 relative eai-main-container",style:ht({"--body-bg":`url(${a})`,"--body-bg-mobile":`url(${r})`})},[G(Mi,{"slides-per-view":1.4,"space-between":8,"allow-overflow":!0,breakpoints:{768:{slidesPerView:3},1024:{slidesPerView:4},1280:{slidesPerView:5}},"show-arrows":!0,"size-arrow":"xl",class:ne(["p-2 md:p-4 md:pb-3",{"z-50":c.value}])},{default:Se(()=>[(m(!0),x(_e,null,Me(g.value,(k,S)=>(m(),oe(bl,{key:`${d.value}-${S}`},{default:Se(()=>[G(_D,{product:k,"cta-key":e.ctaKey,"widget-source":"widget_pe_flash_sale",onMouseenter:v[0]||(v[0]=E=>c.value=!0),onMouseleave:v[1]||(v[1]=E=>c.value=!1)},null,8,["product","cta-key"])]),_:2},1024))),128))]),_:1},8,["class"]),l("div",PD,[MD,e.phoneNumber?(m(),x("a",{key:0,href:`tel:${e.phoneNumber}`,onClick:h,class:"bg-white hover:bg-red-50 text-red-600 px-2 py-1 rounded-full flex items-center gap-1 shadow transition-all"},[G(y(hl),{class:"w-3 h-3 fill-red-600 eai-shake-icon"}),LD],8,OD)):z("",!0)])],4)])):z("",!0)}}},[["__scopeId","data-v-ed6650e8"]])},Symbol.toStringTag,{value:"Module"})),DD={class:"flex gap-2 items-start h-full"},jD={class:"flex-shrink-0"},ND={class:"w-[72px] h-[72px] flex items-center justify-center rounded bg-gray-50 overflow-hidden"},FD=["src","alt"],qD={class:"flex-1 flex flex-col min-w-0 h-full"},zD={class:"text-sm text-gray-900 group-hover:text-red-600 font-medium line-clamp-1 mb-1"},BD={class:"flex items-center justify-between"},UD={class:"flex items-center gap-1 flex-wrap"},VD={class:"text-sm font-semibold text-red-600 tracking-tight"},HD={key:0,class:"text-white bg-red-500 rounded-md px-1 font-semibold text-[10px]"},WD={key:0,class:"text-[11px] mt-1 w-fit tracking-tight text-red-600 font-medium px-1 py-px bg-red-50 border border-red-200"},GD=Qe({__name:"CardProductHorizontal",props:{image:{type:String,required:!0},name:{type:String,required:!0},price:{type:String,required:!0},originalPrice:{type:String,default:null},discount:{type:[String,Number],default:null},badge:{type:String,default:null},link:{type:String,default:null},stock_remaining:{type:Number,default:null},stock_total:{type:Number,default:null},sale_ends_at:{type:String,default:null},widgetSource:{type:String,default:"widget_pe_unknown"}},emits:["cta-click"],setup(e){const t=e,n=Z(()=>{if(!t.discount)return"";const r=String(t.discount);return r.includes("%")||r.includes("-")?r:`-${r}%`}),s=()=>{Fe.productSelect({name:t.name,price:t.price,img:t.image,original_price:t.originalPrice,discount:t.discount,source:t.widgetSource})};return(r,o)=>(m(),oe(Nt(e.link?"a":"div"),{href:e.link||void 0,onClick:s,class:"group relative bg-white border border-gray-200 rounded-lg p-2 cursor-pointer block transition-colors duration-200"},{default:Se(()=>[l("div",DD,[l("div",jD,[l("div",ND,[l("img",{src:e.image,alt:e.name,loading:"lazy",class:"w-full h-full object-contain"},null,8,FD)])]),l("div",qD,[l("h3",zD,j(e.name),1),l("div",null,[l("div",BD,[l("div",UD,[l("span",VD,j(e.price),1),e.price!=="Liên hệ"&&e.discount?(m(),x("div",HD,j(n.value),1)):z("",!0)])]),e.stock_remaining!=null&&e.stock_total?(m(),x("div",WD," Còn "+j(e.stock_remaining)+"/"+j(e.stock_total)+" suất ",1)):z("",!0)])])])]),_:1},8,["href"]))}},[["__scopeId","data-v-10679a4a"]]),KD={class:"relative"},QD={class:"mb-1"},JD={class:"text-lg font-bold"},XD=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"WidgetRecommendation",props:{title:{type:String,default:""},titleKey:{type:String,default:"rcm.youMayLike"},autoplay:{type:Boolean,default:!1},dataKey:{type:String,default:"you_may_like"},breakpoints:{type:Object,default:()=>({768:{slidesPerView:2.5},1024:{slidesPerView:3.2},1280:{slidesPerView:4}})}},setup(e){const{t}=en(),n=e,s=Z(()=>n.title?n.title:t(n.titleKey)),r=Z(()=>an.state[n.dataKey]||[]);return(o,i)=>(m(),x("div",KD,[l("div",QD,[l("h2",JD,j(s.value),1)]),G(Mi,{loop:!1,autoplay:e.autoplay,"size-arrow":"lg","slides-per-view":1.2,"space-between":8,breakpoints:e.breakpoints},{default:Se(()=>[(m(!0),x(_e,null,Me(r.value,(a,c)=>(m(),oe(bl,{key:c},{default:Se(()=>[G(GD,wn(a,{"widget-source":`widget_pe_${e.dataKey}`}),null,16,["widget-source"])]),_:2},1024))),128))]),_:1},8,["autoplay","breakpoints"])]))}}},Symbol.toStringTag,{value:"Module"})),ZD={},YD={width:"16",height:"26",viewBox:"0 0 16 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"text-yellow-400"},ej=[l("path",{d:"M5.27059 0C7.54353 0 9.82118 0 12.0941 0C12.64 0.324982 12.7388 0.639809 12.48 1.26946C11.6141 3.39708 10.7435 5.51962 9.87765 7.64724C9.84471 7.72849 9.81647 7.80973 9.77882 7.91637C9.90118 7.91637 9.98588 7.91637 10.0706 7.91637C11.7412 7.91637 13.4118 7.92652 15.0824 7.91129C15.5153 7.90621 15.8259 8.04839 16 8.48508C16 8.62219 16 8.75421 16 8.89131C15.92 9.02334 15.8447 9.16044 15.7647 9.29246C12.7953 14.284 9.82118 19.2755 6.85177 24.267C6.57882 24.724 6.31529 25.181 6.03765 25.6279C5.75059 26.0849 5.20941 26.1255 4.89882 25.7244C4.71529 25.4857 4.71529 25.2166 4.78118 24.9322C5.45882 21.9922 6.13647 19.047 6.81412 16.1069C6.92235 15.6398 7.02588 15.1777 7.13412 14.6801C7.00706 14.6801 6.91294 14.6801 6.82353 14.6801C4.85647 14.6801 2.88941 14.6699 0.922353 14.6851C0.484706 14.6902 0.174118 14.5531 0 14.1164C0 13.9793 0 13.8473 0 13.7102C0.0329412 13.6391 0.0752941 13.568 0.103529 13.4918C1.63765 9.2163 3.17176 4.93567 4.70118 0.655042C4.81412 0.345294 4.97412 0.111713 5.27059 0Z",fill:"currentColor"},null,-1)];function tj(e,t){return m(),x("svg",YD,ej)}const nj=Qe(ZD,[["render",tj]]),sj={class:"flex flex-col items-center"},rj={class:"leading-none"},oj={class:"flex flex-col items-center"},ij={class:"leading-none"},aj={class:"flex flex-col items-center"},lj={class:"leading-none"},cj=Qe({__name:"CountDownProduct",props:{endDate:{type:String,required:!0},size:{type:String,default:"md",validator:e=>["sm","md","lg"].includes(e)},showLabel:{type:Boolean,default:!1},isSoldOut:{type:Boolean,default:!1}},emits:["end-flash-sales"],setup(e,{emit:t}){const n=e,s=t;R(0);const r=R(0),o=R(0),i=R(0),a=R(!1);let c=null;const u=Z(()=>{switch(n.size){case"sm":return"size-5 text-[10px]";case"lg":return"size-9 text-lg";default:return"size-6 text-xs"}}),d=Z(()=>{switch(n.size){case"lg":return"text-[10px]";default:return"text-[8px]"}}),f=_=>String(_??0).padStart(2,"0"),h=_=>{if(!_)return null;const w=_.replace(" ","T"),k=new Date(w);return isNaN(k.getTime())?null:k},g=_=>{r.value=Math.floor(_/(1e3*60*60)),o.value=Math.floor(_%(1e3*60*60)/(1e3*60)),i.value=Math.floor(_%(1e3*60)/1e3)},p=()=>{const _=h(n.endDate);if(!_){a.value=!0,clearInterval(c);return}const w=Math.max(_.getTime()-Date.now(),0);g(w),w===0?(a.value=!0,clearInterval(c),c=null,s("end-flash-sales")):a.value=!1},v=()=>{clearInterval(c),p(),c=setInterval(p,1e3)};return Pe(()=>n.endDate,v),Je(v),Rt(()=>clearInterval(c)),(_,w)=>a.value?(m(),x("div",{key:1,class:ne(["text-red-500 font-bold italic",[e.size==="lg"?"text-sm":"text-[10px]"]])}," Chương trình đã kết thúc ",2)):(m(),x("div",{key:0,class:ne(["flex items-center",[e.size==="lg"?"gap-2":"gap-0.5"]])},[l("div",sj,[l("div",{class:ne(["rounded-md bg-yellow-50 flex items-center justify-center font-bold text-red-600 leading-none shadow-sm",u.value])},[l("span",rj,j(f(r.value)),1)],2),e.showLabel?(m(),x("span",{key:0,class:ne(["text-white font-bold mt-1 uppercase tracking-tighter",d.value])},"Giờ",2)):z("",!0)]),e.showLabel?z("",!0):(m(),x("span",{key:0,class:ne(["text-white font-bold",[e.size==="lg"?"text-lg pb-0.5":"text-xs pb-0.5"]])},":",2)),l("div",oj,[l("div",{class:ne(["rounded-md bg-yellow-50 flex items-center justify-center font-bold text-red-600 leading-none shadow-sm",u.value])},[l("span",ij,j(f(o.value)),1)],2),e.showLabel?(m(),x("span",{key:0,class:ne(["text-white font-bold mt-1 uppercase tracking-tighter",d.value])},"Phút",2)):z("",!0)]),e.showLabel?z("",!0):(m(),x("span",{key:1,class:ne(["text-white font-bold",[e.size==="lg"?"text-lg pb-0.5":"text-xs pb-0.5"]])},":",2)),l("div",aj,[l("div",{class:ne(["rounded-md bg-yellow-50 flex items-center justify-center font-bold text-red-600 leading-none shadow-sm",u.value])},[l("span",lj,j(f(i.value)),1)],2),e.showLabel?(m(),x("span",{key:0,class:ne(["text-white font-bold mt-1 uppercase tracking-tighter",d.value])},"Giây",2)):z("",!0)])],2))}},[["__scopeId","data-v-97daa3d7"]]),xo=e=>(mn("data-v-d39ca5f1"),e=e(),gn(),e),uj={class:"flex items-center"},dj={class:"flex items-center relative z-10 shrink-0 gap-1 mr-2"},fj=xo(()=>l("span",{class:"text-white font-bold text-lg"},"Flash Sale",-1)),hj={key:0},pj={class:"text-gray-900 text-[11px] tracking-tight"},mj={key:0,class:"flex items-center text-[11px] text-white mt-2"},gj=xo(()=>l("span",{class:"leading-3"},"Có ",-1)),vj={class:"relative min-w-[18px] h-[14px] mx-0.5 overflow-hidden flex items-center justify-center"},yj=xo(()=>l("span",{class:"leading-3"},"khách đang xem.",-1)),bj={key:0,class:"relative z-10 space-y-1.5 mt-2.5 md:mt-3"},_j=xo(()=>l("div",{class:"w-px h-4 bg-gray-300 shrink-0"},null,-1)),xj={class:"text-[10px] text-white italic leading-none min-h-[14px]"},wj={key:0,class:"font-medium"},kj={key:1},Sj={key:1,class:"absolute top-1.5 right-1 z-20"},Cj=["src"],$j={key:0,class:"relative z-10 px-2.5 pt-2.5 pb-2"},Tj={class:"flex items-center text-xs font-semibold text-orange-500 mb-1.5"},Aj=xo(()=>l("span",{class:"leading-none"},"Đăng ký nhận giá tốt",-1)),Ej=xo(()=>l("div",{class:"w-px h-4 bg-gray-300 shrink-0"},null,-1)),Ij={class:"text-[11px] italic leading-none min-h-[14px] mt-1.5"},Pj={key:0,class:"font-medium text-green-600"},Mj={key:1,class:"text-gray-700"},Oj=Object.freeze(Object.defineProperty({__proto__:null,default:Qe({__name:"ProductFlashSale",props:{product:{type:Object,default:null},productId:{type:[String,Number],default:null},showSocialProof:{type:Boolean,default:!0},showRegistrationForm:{type:Boolean,default:!0},flashSaleList:{type:Array,default:()=>[]}},emits:["end-flash-sales"],setup(e,{emit:t}){var P,M;const n="https://widget.geteasy.ai",s=e,r=Z(()=>{if(s.product)return s.product;const q=window.location.pathname;return(an.state.flash_sales??[]).find(T=>T.link&&T.link.includes(q))??null}),o=Z(()=>{var B;const q=(B=r.value)==null?void 0:B.sale_ends_at;if(q){const T=new Date(q);if(!isNaN(T.getTime())&&T>new Date)return q}return el(1)}),i=t,a=R(""),c=R(""),u=R(!1),d=R(!1),f=R(((P=r.value)==null?void 0:P.viewing_now)||an.state.signals.viewing_now||12),h=R(!1),g=Z(()=>a.value.trim().length>0),p=Z(()=>{var q;return((q=r.value)==null?void 0:q.ordered_by)??[]}),v=Z(()=>{var q;return((q=r.value)==null?void 0:q.ordered_count)??p.value.length}),_=R(!1),w=()=>{const q=p.value.map(B=>({name:B.name,phone:B.phone,time:B.ordered_at}));Lw(q)},k=Z(()=>{const q=c.value.trim();return q?/^(0|84|\+84)(3|5|7|8|9)([0-9]{8})$/.test(q):!1}),S=async()=>{var q;if(h.value=!0,!g.value||!k.value){_.value=!1,setTimeout(()=>{_.value=!0},10);return}try{if(u.value=!0,await new Promise(B=>setTimeout(B,1e3)),d.value=!0,Fe.generateLead({name:a.value,phone:c.value,page_url:window.location.href,source:"widget_pe_flash_sale_form"}),(q=window.EasyAI)!=null&&q.send&&r.value){const T=r.value.stock_remaining===0?"nhận ưu đãi giá tốt":"nhận suất Flash Sale",A=`[${r.value.name}](${r.value.link||window.location.href})`,D=`- Khách hàng: ${a.value}
- Số điện thoại: ${c.value}
- Nhu cầu: Đăng ký ${T} sản phẩm ${A}`;window.EasyAI.send(D)}a.value="",c.value=""}catch(B){console.error("Registration failed:",B)}finally{u.value=!1}};let E=null;const O=((M=r.value)==null?void 0:M.viewing_now)||an.state.signals.viewing_now||71;Je(()=>{E=setInterval(()=>{const q=Math.floor(Math.random()*7)-3;let B=f.value+q;B>O+10&&(B=O+10),B<O-10&&(B=O-10),B<1&&(B=1),f.value=B},3500)}),Rt(()=>{E&&clearInterval(E)});const I=()=>{i("end-flash-sales",s.productId)};return(q,B)=>{var T,A,D,Q,W,H,K;return r.value?(m(),x("div",{key:0,class:ne(["rounded-xl overflow-hidden",((T=r.value)==null?void 0:T.stock_remaining)>0?"":"bg-gray-50 border border-gray-200"])},[l("div",{class:ne(["relative px-2.5 py-3 overflow-hidden eai-product-flash-sale",((A=r.value)==null?void 0:A.stock_remaining)===0?"grayscale":""])},[l("div",null,[l("div",uj,[l("div",dj,[G(nj,{class:"!text-white"}),fj]),((D=r.value)==null?void 0:D.stock_remaining)>0?(m(),x("div",hj,[G(cj,{"end-date":o.value,onEndFlashSales:I},null,8,["end-date"])])):z("",!0),((Q=r.value)==null?void 0:Q.stock_remaining)>0?(m(),oe(fv,{key:1,variant:"availability",size:"sm",class:"ml-auto"},{default:Se(()=>{var J;return[l("span",pj,[((J=r.value)==null?void 0:J.stock_remaining)!=null?(m(),x(_e,{key:0},[We(" Còn "+j(r.value.stock_remaining)+"/"+j(r.value.stock_total??10)+" suất ",1)],64)):(m(),x(_e,{key:1},[We("Còn vài suất")],64))])]}),_:1})):z("",!0)]),e.showSocialProof?(m(),x("div",mj,[G(y(N2),{size:"15",class:"mr-0.5"}),gj,l("div",vj,[G(Yt,{name:"slide-up"},{default:Se(()=>[(m(),x("span",{key:f.value,class:"absolute inset-x-0 w-full text-center font-semibold text-white"},j(f.value),1))]),_:1})]),yj,v.value>0?(m(),x("button",{key:0,class:"shrink-0 ml-0.5 font-medium text-white underline px-1 rounded transition-all hover:text-white",onClick:w},j(v.value)+" khách đã đặt ",1)):z("",!0)])):z("",!0)]),((W=r.value)==null?void 0:W.stock_remaining)>0&&e.showRegistrationForm?(m(),x("div",bj,[l("div",{class:ne(["flex items-center bg-white rounded-md p-0.5 h-8 shadow-sm transition-all duration-300 border",[_.value?"shake-error":"",h.value&&!d.value&&(!g.value||!k.value)?"border-red-500":"border-transparent"]])},[Lt(l("input",{"onUpdate:modelValue":B[0]||(B[0]=J=>a.value=J),type:"text",placeholder:"Họ và tên",class:ne(["flex-1 min-w-0 bg-transparent border-none focus:ring-0 text-[13px] px-2 py-0 h-full focus-within:outline-none",[h.value&&!d.value&&!g.value?"text-red-500 placeholder:text-red-400":"text-gray-900 placeholder:text-gray-500"]]),onKeyup:gr(S,["enter"])},null,34),[[rn,a.value]]),_j,Lt(l("input",{"onUpdate:modelValue":B[1]||(B[1]=J=>c.value=J),type:"tel",placeholder:"Số điện thoại",class:ne(["flex-1 min-w-0 bg-transparent border-none focus:ring-0 text-[13px] px-2 py-0 h-full focus-within:outline-none",[h.value&&!d.value&&!k.value?"text-red-500 placeholder:text-red-400":"text-gray-900 placeholder:text-gray-500"]]),onKeyup:gr(S,["enter"])},null,34),[[rn,c.value]]),l("button",{class:ne(["bg-orange-gradient px-2.5 py-0 rounded-md text-white font-semibold text-xs whitespace-nowrap h-[26px] flex items-center shrink-0 ml-0.5",u.value&&"opacity-50 cursor-not-allowed"]),onClick:S},j(u.value?"Đang gửi":"Đặt ngay"),3)],2),l("div",xj,[d.value?(m(),x("span",wj," Cảm ơn bạn! Chúng tôi sẽ liên hệ tư vấn sớm nhất. ")):(m(),x("span",kj," * Lưu ý: Số lượng & thời gian có hạn. Vui lòng điền thông tin để giữ suất. "))])])):z("",!0),((H=r.value)==null?void 0:H.stock_remaining)===0?(m(),x("div",Sj,[l("img",{src:y(n)+"/soldout-min.webp",alt:"Cháy suất",class:"w-[120px] object-contain"},null,8,Cj)])):z("",!0)],2),((K=r.value)==null?void 0:K.stock_remaining)===0&&e.showRegistrationForm?(m(),x("div",$j,[l("div",Tj,[G(y(z2),{size:"16",class:"mr-0.5"}),Aj]),l("div",{class:ne(["flex items-center bg-white rounded-md p-0.5 h-8 shadow-sm transition-all duration-300 border border-gray-200",[_.value?"shake-error":"",h.value&&!d.value&&(!g.value||!k.value)?"border-red-500":""]])},[Lt(l("input",{"onUpdate:modelValue":B[2]||(B[2]=J=>a.value=J),type:"text",placeholder:"Họ và tên",class:ne(["flex-1 min-w-0 bg-transparent border-none focus:ring-0 text-[13px] px-2 py-0 h-full focus-within:outline-none",[h.value&&!d.value&&!g.value?"text-red-500 placeholder:text-red-400":"text-gray-900 placeholder:text-gray-500"]]),onKeyup:gr(S,["enter"])},null,34),[[rn,a.value]]),Ej,Lt(l("input",{"onUpdate:modelValue":B[3]||(B[3]=J=>c.value=J),type:"tel",placeholder:"Số điện thoại",class:ne(["flex-1 min-w-0 bg-transparent border-none focus:ring-0 text-[13px] px-2 py-0 h-full focus-within:outline-none",[h.value&&!d.value&&!k.value?"text-red-500 placeholder:text-red-400":"text-gray-900 placeholder:text-gray-500"]]),onKeyup:gr(S,["enter"])},null,34),[[rn,c.value]]),l("button",{class:ne(["bg-orange-gradient px-2.5 py-0 rounded-md text-white font-semibold text-xs whitespace-nowrap h-[26px] flex items-center shrink-0 ml-0.5",u.value&&"opacity-50 cursor-not-allowed"]),onClick:S},j(u.value?"Đang gửi":"Đăng ký"),3)],2),l("div",Ij,[d.value?(m(),x("span",Pj," Cảm ơn bạn! Chúng tôi sẽ liên hệ tư vấn sớm nhất. ")):(m(),x("span",Mj," * Lưu ý: Suất hiện tại đã hết! Để lại thông tin để nhận tư vấn giá tốt nhất. "))])])):z("",!0)],2)):z("",!0)}}},[["__scopeId","data-v-d39ca5f1"]])},Symbol.toStringTag,{value:"Module"})),Lj={key:0,class:"shrink-0"},Rj={class:"size-12 shrink-0 flex items-center justify-center cursor-pointer overflow-hidden"},Dj=["src","alt"],jj={class:"flex-1 min-w-0 py-1 cursor-pointer"},Nj={class:"text-sm line-clamp-2 leading-5 text-gray-900 md:group-hover:text-orange-600 transition-colors duration-300"},Fj={class:"shrink-0 text-right flex flex-col justify-center cursor-pointer tracking-tight"},qj={key:0,class:"flex items-center justify-end gap-1 mb-1"},zj={class:"text-[10px] text-red-500 font-semibold bg-red-100 px-1 rounded"},Bj={class:"text-[10px] text-gray-400 line-through"},Uj={class:"text-sm font-bold text-red-500"},pv=Qe({__name:"RCMProductCombo",props:{product:{type:Object,required:!0},isSelected:{type:Boolean,default:!0},showCheckbox:{type:Boolean,default:!0},highlight:{type:Boolean,default:!1}},emits:["toggle"],setup(e){const t=s=>et(s),n=(s,r)=>{if(!s||!r)return"";const o=parseFloat(s),i=parseFloat(r);return i<=o?"":`-${Math.round((1-o/i)*100)}%`};return(s,r)=>(m(),x("div",{class:ne(["flex items-center gap-2 pr-3 py-2.5 pl-2 transition-all h-full group",[e.highlight?"bg-white":"md:hover:bg-orange-50 cursor-pointer"]]),onClick:r[1]||(r[1]=o=>e.highlight?null:s.$emit("toggle"))},[e.showCheckbox?(m(),x("div",Lj,[l("button",{onClick:r[0]||(r[0]=Gt(o=>s.$emit("toggle"),["stop"])),class:ne(["size-4 rounded flex items-center text-white justify-center transition-colors cursor-pointer border",e.isSelected?"bg-orange-600 border-orange-600 ":"bg-white border-gray-300"])},[e.isSelected?(m(),oe(y(ul),{key:0,size:12,"stroke-width":"3"})):z("",!0)],2)])):z("",!0),l("div",Rj,[l("img",{src:e.product.properties.image,class:"w-full h-full object-contain",alt:e.product.properties.name},null,8,Dj)]),l("div",jj,[l("h3",Nj,j(e.product.properties.name),1)]),l("div",Fj,[e.product.properties.originalPrice?(m(),x("div",qj,[l("span",zj,j(n(e.product.properties.price,e.product.properties.originalPrice)),1),l("span",Bj,j(t(e.product.properties.originalPrice)),1)])):z("",!0),l("div",Uj,j(t(e.product.properties.price)),1)])],2))}},[["__scopeId","data-v-742576ca"]]),Lr=e=>(mn("data-v-3a2e4a9d"),e=e(),gn(),e),Vj={key:0},Hj=Lr(()=>l("h2",{class:"text-base font-semibold text-gray-900 mb-3"},[l("span",{class:"text-white font-semibold text-xs tracking-tight bg-red-600 px-1.5 py-1 rounded"},"Ưu đãi"),We(" Mua kèm dành riêng cho bạn ")],-1)),Wj={class:"flex-1 space-y-1"},Gj={class:"text-[11px] leading-none"},Kj=Lr(()=>l("span",{class:"font-normal"},"Bạn đã được thưởng",-1)),Qj=Lr(()=>l("span",{class:"text-teal-600 font-bold ml-1 mr-0.5"},"Miễn phí vận chuyển",-1)),Jj=Lr(()=>l("span",{class:"font-normal"},"!",-1)),Xj=Lr(()=>l("span",{class:"font-normal"},"Chọn thêm",-1)),Zj={class:"text-orange-600 font-bold mx-1"},Yj=Lr(()=>l("span",{class:"font-normal"},[We("sản phẩm để được "),l("span",{class:"font-bold"},"Miễn phí vận chuyển")],-1)),eN={class:"w-full h-0.5 bg-gray-200 rounded-full overflow-hidden"},tN={key:0,class:"border border-gray-300 rounded-lg overflow-hidden bg-white"},nN={class:"flex justify-center relative z-10 my-1"},sN={class:"size-4 flex items-center justify-center bg-gray-400 rounded-full"},rN={key:1,class:"border border-gray-200 rounded-lg overflow-hidden bg-white divide-y divide-gray-100"},oN={class:"border-t border-gray-50"},iN={class:"flex-1 min-w-0 flex items-center gap-1.5"},aN={class:"text-xs text-gray-900 font-medium"},lN={class:"flex items-center gap-1"},cN={class:"text-xs w-14 text-red-600 font-semibold whitespace-nowrap"},uN={key:0,class:"bg-orange-50/50 px-2.5 py-3 space-y-2 overflow-hidden"},dN=["onClick"],fN={class:"flex flex-col gap-1 absolute -left-1.5 top-1/2 -translate-y-1/2"},hN={class:"size-2.5 rounded-full bg-orange-50"},pN={class:"h-[72px] w-[78px] flex items-center justify-center text-white bg-orange-gradient"},mN={class:"flex flex-col items-center gap-0 text-xs text-orange-50"},gN={class:"flex-1 h-[72px] border border-l-0 border-gray-200 rounded-r-md min-w-0 flex items-center gap-2 pl-3 pr-2"},vN={class:"flex-1"},yN={class:"text-sm font-semibold text-gray-900"},bN={class:"text-[10px] leading-3 text-gray-900"},_N={class:"mt-1.5 flex items-center pr-8"},xN={class:"flex-1 h-1 bg-gray-200 rounded-full overflow-hidden"},wN={class:"flex items-center gap-1 mt-0.5 pr-2"},kN={key:1,class:"text-[10px] leading-3 text-gray-700"},SN={class:"text-[10px] leading-3 text-gray-700"},CN={class:"flex flex-col gap-1 mt-2.5 px-0.5"},$N=Lr(()=>l("span",null,"Nhận ưu đãi",-1)),TN={class:"text-[10px] font-normal opacity-90"},AN=Object.freeze(Object.defineProperty({__proto__:null,default:Qe({__name:"WidgetCombo",props:{dataKey:{type:String,default:"also_bought"}},setup(e){const t=e,n=R(!1),s=R(null),r=T=>{const A=Math.floor(T/3600),D=Math.floor(T%3600/60),Q=T%60;return`${String(A).padStart(2,"0")}:${String(D).padStart(2,"0")}:${String(Q).padStart(2,"0")}`};let o;Je(()=>{o=setInterval(()=>{i.value.forEach(T=>{T.remainingTime>0&&T.remainingTime--})},1e3)}),Rt(()=>{o&&clearInterval(o)});const i=R([{id:"V1",title:"Giảm 12% Tối đa 99k",minOrder:25e4,type:"percentage",value:12,maxDiscount:99e3,totalTime:10*3600,remainingTime:8*3600+45*60,tag:null},{id:"V2",title:"Giảm trực tiếp 200k",minOrder:15e5,type:"flat",value:2e5,totalTime:5*3600,remainingTime:35*60+20,tag:"Sắp hết hạn"}]),a=T=>{s.value===T?s.value=null:s.value=T},c=Z(()=>i.value.find(T=>T.id===s.value)),u=Z(()=>{if(!i.value.length)return"00:00:00";if(c.value)return r(Math.max(0,c.value.remainingTime));const T=Math.min(...i.value.map(A=>A.remainingTime));return r(Math.max(0,T))}),d=Z(()=>{const T=an.state.source_product,A=(an.state[t.dataKey]||[]).slice(0,2);return!T&&(!A||A.length===0)?[]:[T,...A].filter(Boolean)}),f=Z(()=>d.value&&d.value.length>0?d.value[0]:null),h=Z(()=>d.value&&d.value.length>1?d.value.slice(1,3):[]),g=R([]),p=T=>{const A=g.value.indexOf(T);A>-1?g.value.splice(A,1):g.value.push(T)},v=T=>g.value.includes(T),_=Z(()=>(f.value?1:0)+g.value.length),w=Z(()=>(f.value?1:0)+h.value.length),k=Z(()=>w.value===0?0:Math.round(_.value/w.value*100)),S=Z(()=>k.value>=100),E=T=>et(T),O=T=>{if(!T)return 0;const A=parseFloat(T);return isNaN(A)?0:A},I=Z(()=>{let T=0;const A=D=>{const Q=O(D.originalPrice),W=O(D.price);return!Q||Q<=0?W:Math.max(Q,W)};return f.value&&(T+=A(f.value.properties)),h.value.forEach((D,Q)=>{v(Q)&&(T+=A(D.properties))}),T}),P=Z(()=>{let T=0;return f.value&&(T+=O(f.value.properties.price)),h.value.forEach((A,D)=>{v(D)&&(T+=O(A.properties.price))}),T}),M=Z(()=>{const T=P.value;if(c.value){const A=c.value;if(T>=(A.minOrder||0)){let D=0;return A.type==="percentage"?(D=Math.floor(T*A.value/100),A.maxDiscount&&(D=Math.min(D,A.maxDiscount))):D=A.value,Math.max(0,T-D)}}return T}),q=Z(()=>Math.max(0,I.value-M.value)),B=()=>{var Q,W,H,K;const T=`[${(W=(Q=f.value)==null?void 0:Q.properties)==null?void 0:W.name}](${((K=(H=f.value)==null?void 0:H.properties)==null?void 0:K.url)||window.location.href})`,A=h.value.filter((J,te)=>v(te)).map(J=>{var te,ge;return`[${(te=J.properties)==null?void 0:te.name}](${((ge=J.properties)==null?void 0:ge.url)||window.location.href})`});let D=`Nhận khuyến mãi combo:
`;D+=`- Sản phẩm chính: ${T}
`,A.length>0&&(D+=`- Sản phẩm mua kèm: ${A.join(", ")}
`),c.value&&(D+=`- Voucher: ${c.value.title}
`),D+=`- Vận chuyển: ${S.value?"Miễn phí vận chuyển":"Có phí vận chuyển"}
`,alert(D)};return Pe(()=>h.value,T=>{T&&T.length>0&&(g.value=T.map((A,D)=>D))},{immediate:!0}),(T,A)=>f.value?(m(),x("div",Vj,[Hj,l("div",{class:ne(["flex items-center px-2 py-1.5 rounded-md mb-1.5 transition-colors duration-300",S.value?"bg-teal-50":"bg-orange-50"])},[l("div",{class:ne(["size-5 rounded-full flex items-center justify-center mr-1.5 transition-colors duration-300",S.value?"bg-teal-500":"bg-orange-500"])},[G(y(lk),{size:"12","stroke-width":"2",class:"text-white"})],2),l("div",Wj,[l("div",Gj,[S.value?(m(),x(_e,{key:0},[Kj,Qj,Jj],64)):(m(),x(_e,{key:1},[Xj,l("span",Zj,j(w.value-_.value),1),Yj],64))]),l("div",eN,[l("div",{class:ne(["h-full transition-all duration-500",S.value?"bg-teal-500":"bg-orange-500"]),style:ht({width:`${k.value}%`})},null,6)])])],2),f.value?(m(),x("div",tN,[G(pv,{product:f.value,"show-checkbox":!1,highlight:""},null,8,["product"])])):z("",!0),l("div",nN,[l("div",sN,[G(y(ig),{size:10,class:"text-white","stroke-width":"2"})])]),h.value.length>0?(m(),x("div",rN,[(m(!0),x(_e,null,Me(h.value,(D,Q)=>(m(),oe(pv,{key:D.properties.id||Q,product:D,"is-selected":v(Q),onToggle:W=>p(Q)},null,8,["product","is-selected","onToggle"]))),128)),l("div",oN,[l("div",{class:"flex bg-orange-50 items-center gap-1.5 py-2 pl-3 pr-2 cursor-pointer transition-colors group",onClick:A[0]||(A[0]=D=>n.value=!n.value)},[G(y(lg),{size:"16",class:"text-orange-600 transition-transform"}),l("div",iN,[l("span",aN,j(c.value?c.value.title:"Voucher giảm đến 200k sắp hết hạn"),1)]),l("div",lN,[l("div",cN,j(u.value),1),G(y(Pr),{size:"14",class:ne(["text-gray-700 transition-transform duration-300",n.value?"rotate-90":""])},null,8,["class"])])]),G(Yt,{name:"expand"},{default:Se(()=>[n.value?(m(),x("div",uN,[(m(!0),x(_e,null,Me(i.value,D=>(m(),x("div",{key:D.id,class:"bg-white overflow-hidden rounded-md flex items-center cursor-pointer group transition-all relative",onClick:Q=>a(D.id)},[l("div",fN,[(m(),x(_e,null,Me(4,Q=>l("div",hN)),64))]),l("div",pN,[l("div",mN,[G(y(lg),{size:"18"}),We(" Giảm giá ")])]),l("div",gN,[l("div",vN,[l("div",yN,j(D.title),1),l("div",bN," Đơn tối thiểu "+j(E(D.minOrder)),1),l("div",_N,[l("div",xN,[l("div",{class:"h-full voucher-progress transition-all duration-500 rounded-full",style:ht({width:`${D.remainingTime/D.totalTime*100}%`})},null,4)])]),l("div",wN,[D.tag?(m(),x("div",{key:0,class:ne(["text-[10px] leading-3",D.id==="V2"?"text-red-600":"text-gray-700"])},j(D.tag),3)):z("",!0),D.tag?(m(),x("span",kN,"•")):z("",!0),l("div",SN," Hết hạn trong "+j(r(D.remainingTime)),1)])]),l("div",{class:ne(["size-5 text-white rounded-full border flex items-center justify-center transition-all shrink-0",s.value===D.id?"bg-orange-500 border-orange-500 ":"bg-white border-gray-200 group-hover:bg-orange-100 group-hover:border-orange-400"])},[s.value===D.id?(m(),oe(y(ul),{key:0,size:12,"stroke-width":"3"})):z("",!0)],2)])],8,dN))),128))])):z("",!0)]),_:1})])])):z("",!0),l("div",CN,[l("button",{onClick:B,class:"px-4 py-1.5 rounded-lg font-semibold text-sm transition-all duration-200 bg-red-500 text-white shadow-sm md:hover:bg-red-600 active:scale-95 flex flex-col items-center justify-center leading-tight gap-0.5"},[$N,l("span",TN,"Tổng "+j(E(M.value))+" - Tiết kiệm "+j(E(q.value)),1)])])])):z("",!0)}},[["__scopeId","data-v-3a2e4a9d"]])},Symbol.toStringTag,{value:"Module"})),mv=e=>(mn("data-v-b2e81a91"),e=e(),gn(),e),EN=["id"],IN={class:"fc-card"},PN={class:"fc-card__top"},MN=["data-value"],ON=["data-value"],LN=["data-value"],RN={class:"fc-slot"},DN=mv(()=>l("span",{class:"fc-colon"},":",-1)),jN=["id"],NN={class:"fc-card"},FN={class:"fc-card__top"},qN=["data-value"],zN=["data-value"],BN=["data-value"],UN={class:"fc-slot"},VN=mv(()=>l("span",{class:"fc-colon"},":",-1)),HN=["id"],WN={class:"fc-card"},GN={class:"fc-card__top"},KN=["data-value"],QN=["data-value"],JN=["data-value"],XN={class:"fc-slot"},ZN=Qe({__name:"FlipCountdown",props:{totalSeconds:{type:Number,default:3600},labels:{type:Object,default:()=>({hours:"Giờ",minutes:"Phút",seconds:"Giây"})},size:{type:String,default:"md",validator:e=>["xs","sm","md","lg","xl"].includes(e)},variant:{type:String,default:"red",validator:e=>["red","yellow","white"].includes(e)}},emits:["elapsed"],setup(e,{emit:t}){const n=e,s=t,r=R(n.totalSeconds),o=Z(()=>{const u=Math.max(0,r.value);return{hours:String(Math.floor(u/3600)).padStart(2,"0"),minutes:String(Math.floor(u%3600/60)).padStart(2,"0"),seconds:String(u%60).padStart(2,"0")}}),i=Math.random().toString(36).slice(2,9),a=R({hours:{current:o.value.hours,previous:o.value.hours,id:`fc-h-${i}`},minutes:{current:o.value.minutes,previous:o.value.minutes,id:`fc-m-${i}`},seconds:{current:o.value.seconds,previous:o.value.seconds,id:`fc-s-${i}`}});Pe(o,u=>{["hours","minutes","seconds"].forEach(d=>{const f=a.value[d];if(u[d]!==f.current){f.previous=f.current,f.current=u[d];const h=document.getElementById(f.id);h&&(h.classList.remove("flip"),h.offsetWidth,h.classList.add("flip"))}})});let c;return Je(()=>{if(r.value<=0){s("elapsed");return}c=setInterval(()=>{r.value--,r.value<=0&&(clearInterval(c),s("elapsed"))},1e3)}),Rt(()=>{c&&clearInterval(c)}),(u,d)=>(m(),x("div",{class:ne(["fc-clock",["is-"+e.size,"is-"+e.variant]])},[l("span",{class:"fc-piece",id:a.value.hours.id},[l("span",IN,[l("b",PN,j(a.value.hours.current),1),l("b",{class:"fc-card__bottom","data-value":a.value.hours.current},null,8,MN),l("b",{class:"fc-card__back","data-value":a.value.hours.previous},null,8,ON),l("b",{class:"fc-card__back-bottom","data-value":a.value.hours.previous},null,8,LN)]),l("span",RN,j(e.labels.hours),1)],8,EN),DN,l("span",{class:"fc-piece",id:a.value.minutes.id},[l("span",NN,[l("b",FN,j(a.value.minutes.current),1),l("b",{class:"fc-card__bottom","data-value":a.value.minutes.current},null,8,qN),l("b",{class:"fc-card__back","data-value":a.value.minutes.previous},null,8,zN),l("b",{class:"fc-card__back-bottom","data-value":a.value.minutes.previous},null,8,BN)]),l("span",UN,j(e.labels.minutes),1)],8,jN),VN,l("span",{class:"fc-piece",id:a.value.seconds.id},[l("span",WN,[l("b",GN,j(a.value.seconds.current),1),l("b",{class:"fc-card__bottom","data-value":a.value.seconds.current},null,8,KN),l("b",{class:"fc-card__back","data-value":a.value.seconds.previous},null,8,QN),l("b",{class:"fc-card__back-bottom","data-value":a.value.seconds.previous},null,8,JN)]),l("span",XN,j(e.labels.seconds),1)],8,HN)],2))}},[["__scopeId","data-v-b2e81a91"]]),Dl=e=>(mn("data-v-56657c6b"),e=e(),gn(),e),YN={class:"border border-red-500 rounded overflow-hidden"},eF={class:"relative overflow-hidden border-b bg-red-500"},tF={class:"relative px-3 py-2 sm:px-4 sm:py-3 flex flex-col sm:flex-row items-center justify-between gap-2 sm:gap-3"},nF={class:"flex items-center gap-1 w-full sm:w-auto justify-center sm:justify-start"},sF=Dl(()=>l("h2",{class:"font-semibold flex items-center gap-1"},[l("span",{class:"text-lg md:text-2xl text-white text-center sm:text-left"},"Ưu đãi mua kèm dành cho bạn")],-1)),rF={class:"shrink-0 flex justify-center w-full sm:w-auto"},oF={class:"flex flex-col w-full bg-gray-50/50"},iF={class:"flex items-stretch px-2 py-3 sm:px-4 sm:py-6 gap-0"},aF={key:0,class:"combo-card shrink-0"},lF={class:"h-full bg-white flex flex-col rounded"},cF={class:"aspect-[1/1] relative overflow-hidden mb-1"},uF=["src","alt"],dF={class:"flex-1 flex flex-col p-1"},fF={class:"text-xs sm:text-sm font-medium line-clamp-2 text-gray-900 mb-1"},hF={class:"space-y-0.5"},pF={class:"text-xs sm:text-sm font-bold text-red-500"},mF={key:0,class:"flex items-center gap-1 flex-wrap"},gF={class:"text-[10px] sm:text-xs text-gray-400 line-through"},vF={class:"text-[10px] sm:text-xs text-red-500 font-semibold bg-red-50 px-1 rounded"},yF={key:1,class:"flex items-center justify-center shrink-0 px-1 sm:px-4"},bF={class:"rounded-full p-1 sm:p-2"},_F={key:2,class:"flex-1 min-w-0 relative"},xF=["disabled"],wF=["disabled"],kF={class:"flex items-stretch h-full"},SF=["onClick"],CF={class:"aspect-[1/1] relative overflow-hidden mb-1"},$F=["src","alt"],TF={key:0,class:"absolute inset-0 bg-orange-600/5 flex items-center justify-center"},AF={class:"flex-1 flex flex-col p-1"},EF={class:"text-xs sm:text-sm font-medium line-clamp-2 text-gray-900 md:group-hover:text-orange-600 transition-colors duration-300 mb-1"},IF={class:"ml-1"},PF={class:"space-y-0.5"},MF={class:"text-xs sm:text-sm font-bold text-red-500"},OF={key:0,class:"flex items-center gap-1 flex-wrap"},LF={class:"text-[10px] sm:text-xs text-gray-400 line-through"},RF={class:"text-[10px] sm:text-xs text-red-500 font-semibold bg-red-50 px-1 rounded"},DF={class:"flex flex-col lg:flex-row items-center justify-between border-t border-gray-200 p-2 sm:px-6 gap-2 lg:gap-12 bg-white"},jF={class:"flex items-center justify-between w-full lg:w-auto flex-1 lg:pr-16"},NF={class:"flex flex-col font-bold items-center lg:items-start text-center lg:text-left"},FF=Dl(()=>l("span",{class:"text-xs sm:text-sm text-gray-900"},"Tổng tiền gốc:",-1)),qF={class:"text-sm sm:text-base font-medium text-gray-700"},zF={class:"flex flex-col items-center font-bold lg:items-start text-center lg:text-left"},BF=Dl(()=>l("span",{class:"text-xs sm:text-sm text-gray-900"},"Tiết kiệm:",-1)),UF={class:"text-sm sm:text-base text-green-600"},VF={class:"flex font-bold flex-col items-center lg:items-start text-center lg:text-left"},HF=Dl(()=>l("span",{class:"text-xs sm:text-sm text-gray-900"},"Tổng tiền:",-1)),WF={class:"text-sm sm:text-base text-red-500"},GF=Object.freeze(Object.defineProperty({__proto__:null,default:Qe({__name:"WidgetComboHorizontal",props:{dataKey:{type:String,default:"also_bought"}},setup(e){const t=e,n=R(null),s=R(0),r=R(0),o=R(1),i=R(!1),a=R(!0),c=T=>{var A;T&&(r.value=T.slideNodes().length,o.value=((A=n.value)==null?void 0:A.currentSlidesPerView)||1,d(T))},u=T=>{var D,Q;s.value=T.currentIndex,o.value=((D=n.value)==null?void 0:D.currentSlidesPerView)||1;const A=(Q=n.value)==null?void 0:Q.emblaApi;A&&d(A)},d=T=>{i.value=T.canScrollPrev(),a.value=T.canScrollNext()};Z(()=>f.value>=100);const f=Z(()=>k.value===0?0:Math.round(w.value/k.value*100)),h=Z(()=>an.state.source_product||null),g=Z(()=>(an.state[t.dataKey]||[]).map(A=>{const D=A.properties??A;return{id:D.id,properties:D,signals:A.signals??{}}})),p=R([]),v=T=>{const A=p.value.indexOf(T);A>-1?p.value.splice(A,1):p.value.push(T)},_=T=>p.value.includes(T),w=Z(()=>(h.value?1:0)+p.value.length),k=Z(()=>(h.value?1:0)+g.value.length),S=T=>et(T),E=(T,A)=>{if(!T||!A)return"";const D=parseFloat(T),Q=parseFloat(A);return Q<=D?"":`-${Math.round((1-D/Q)*100)}%`},O=T=>{if(!T)return 0;const A=parseFloat(T);return isNaN(A)?0:A},I=Z(()=>{let T=0;const A=D=>{const Q=O(D.originalPrice),W=O(D.price);return!Q||Q<=0?W:Math.max(Q,W)};return h.value&&(T+=A(h.value.properties)),p.value.forEach(D=>{g.value[D]&&(T+=A(g.value[D].properties))}),T}),P=Z(()=>{let T=0;return h.value&&(T+=O(h.value.properties.price)),p.value.forEach(A=>{g.value[A]&&(T+=O(g.value[A].properties.price))}),T}),M=Z(()=>P.value),q=Z(()=>Math.max(0,I.value-M.value)),B=()=>{var Q,W,H,K,J;const T=`[${(W=(Q=h.value)==null?void 0:Q.properties)==null?void 0:W.name}](${((K=(H=h.value)==null?void 0:H.properties)==null?void 0:K.url)||window.location.href})`,A=p.value.map(te=>{var ue,we;const ge=g.value[te];return`[${(ue=ge.properties)==null?void 0:ue.name}](${((we=ge.properties)==null?void 0:we.url)||window.location.href})`});let D=`Nhận khuyến mãi combo:
`;D+=`- Sản phẩm chính: ${T}
`,A.length>0&&(D+=`- Sản phẩm mua kèm: ${A.join(", ")}
`),(J=window.EasyAI)!=null&&J.send&&window.EasyAI.send(D),Fe!=null&&Fe.generateLead&&Fe.generateLead({source:"widget_combo_chat_trigger",page_url:window.location.href})};return Pe(()=>g.value,T=>{T&&T.length>0&&p.value.length===0&&(p.value=T.map((A,D)=>D))},{immediate:!0}),(T,A)=>(m(),x("div",YN,[l("div",eF,[l("div",tF,[l("div",nF,[G(Rl,{class:"size-6 sm:size-7 shrink-0"}),sF]),l("div",rF,[G(ZN,{"total-seconds":6312,variant:"white"})])])]),l("div",oF,[l("div",iF,[h.value?(m(),x("div",aF,[l("div",lF,[l("div",cF,[l("img",{src:h.value.properties.image,class:"w-full h-full object-contain",alt:h.value.properties.name},null,8,uF)]),l("div",dF,[l("h3",fF,j(h.value.properties.name),1),l("div",hF,[l("div",pF,j(S(h.value.properties.price)),1),h.value.properties.originalPrice?(m(),x("div",mF,[l("span",gF,j(S(h.value.properties.originalPrice)),1),l("span",vF,j(E(h.value.properties.price,h.value.properties.originalPrice)),1)])):z("",!0)])])])])):z("",!0),h.value&&g.value.length>0?(m(),x("div",yF,[l("div",bF,[G(y(ig),{class:"w-3.5 h-3.5 sm:w-[18px] sm:h-[18px] text-gray-700","stroke-width":"3"})])])):z("",!0),g.value.length>0?(m(),x("div",_F,[g.value.length>o.value?(m(),x("button",{key:0,class:"absolute left-0 md:-left-2 shadow-xl top-1/2 -translate-y-1/2 z-10 size-8 sm:size-11 rounded-full border border-gray-200 bg-white flex items-center justify-center text-gray-500 disabled:opacity-0 disabled:cursor-not-allowed",disabled:!i.value,onClick:A[0]||(A[0]=D=>{var Q;return(Q=n.value)==null?void 0:Q.scrollPrev()})},[G(y(go),{class:"w-4 h-4 sm:w-5 sm:h-5","stroke-width":"3"})],8,xF)):z("",!0),g.value.length>o.value?(m(),x("button",{key:1,class:"absolute right-0 md:-right-2 shadow-xl top-1/2 -translate-y-1/2 z-10 size-8 sm:size-11 rounded-full border border-gray-200 bg-white flex items-center justify-center text-gray-500 disabled:opacity-0 disabled:cursor-not-allowed",disabled:!a.value,onClick:A[1]||(A[1]=D=>{var Q;return(Q=n.value)==null?void 0:Q.scrollNext()})},[G(y(Pr),{class:"w-4 h-4 sm:w-5 sm:h-5","stroke-width":"3"})],8,wF)):z("",!0),G(Mi,{ref_key:"sliderRef",ref:n,"slides-per-view":1,"space-between":4,"show-arrows":!1,breakpoints:{325:{slidesPerView:2,spaceBetween:4},768:{slidesPerView:2,spaceBetween:8},1024:{slidesPerView:3,spaceBetween:8},1280:{slidesPerView:4,spaceBetween:8}},onChange:u,onInit:c},{default:Se(()=>[(m(!0),x(_e,null,Me(g.value,(D,Q)=>(m(),x("div",{key:D.id||Q,class:"embla__slide"},[l("div",kF,[l("div",{class:"flex-1 min-w-0 h-full group bg-white transition-all cursor-pointer flex flex-col rounded",onClick:W=>v(Q)},[l("div",CF,[l("img",{src:D.properties.image,class:"w-full h-full object-contain",alt:D.properties.name},null,8,$F),_(Q)?(m(),x("div",TF)):z("",!0)]),l("div",AF,[l("h3",EF,[l("div",{class:ne(["size-3.5 sm:size-4 translate-y-0.5 inline-flex shrink-0 rounded border items-center justify-center transition-all duration-300",_(Q)?"bg-orange-600 border-orange-600 shadow-sm":"bg-white border-gray-300"])},[G(y(ul),{class:ne([[_(Q)?"opacity-100":"opacity-0"],"w-2.5 h-2.5 sm:w-3.5 sm:h-3.5 text-white"]),"stroke-width":"2"},null,8,["class"])],2),l("span",IF,j(D.properties.name),1)]),l("div",PF,[l("div",MF,j(S(D.properties.price)),1),D.properties.originalPrice?(m(),x("div",OF,[l("span",LF,j(S(D.properties.originalPrice)),1),l("span",RF,j(E(D.properties.price,D.properties.originalPrice)),1)])):z("",!0)])])],8,SF)])]))),128))]),_:1},512)])):z("",!0)]),l("div",DF,[l("div",jF,[l("div",NF,[FF,l("span",qF,j(S(I.value)),1)]),l("div",zF,[BF,l("span",UF,j(S(q.value)),1)]),l("div",VF,[HF,l("span",WF,j(S(M.value)),1)])]),l("button",{onClick:B,class:"w-full lg:w-[40%] text-sm sm:text-base px-4 py-2.5 sm:py-3 rounded-md font-semibold transition-all duration-200 bg-red-500 text-white active:scale-[0.95] flex items-center justify-center hover:brightness-110"}," Nhận khuyến mãi ")])])]))}},[["__scopeId","data-v-56657c6b"]])},Symbol.toStringTag,{value:"Module"})),gv=e=>(mn("data-v-0e32e6e0"),e=e(),gn(),e),KF=gv(()=>l("div",{class:"px-4 py-3 border-b border-gray-100 text-center"},[l("h3",{class:"font-bold text-sm uppercase text-gray-800 tracking-wide mt-0.5"}," Khách hàng đã đặt ")],-1)),QF={class:"overflow-y-auto p-3 flex-1"},JF={class:"mb-3 text-gray-700 text-xs font-semibold"},XF={class:"overflow-x-auto eai-no-scrollbar"},ZF={class:"w-full text-left border border-gray-100"},YF=gv(()=>l("thead",{class:"border-b-2 border-gray-100"},[l("tr",{class:"border-b-2 border-gray-100 border-t-0 font-bold text-gray-700 text-[11px] bg-white"},[l("th",{class:"py-2 px-1.5 bg-white"},"Khách hàng"),l("th",{class:"py-2 px-1.5 text-center bg-white"}," SĐT "),l("th",{class:"py-2 px-1.5 bg-white"},"Thời gian")])],-1)),eq={class:"text-[11px]"},tq={class:"py-2 px-1.5 text-gray-700 font-medium"},nq={class:"py-2 px-1.5 text-gray-600 text-center"},sq={class:"py-2 px-1.5 text-gray-600"},rq=Object.freeze(Object.defineProperty({__proto__:null,default:Qe({__name:"CustomerListModal",props:{customers:{type:Array,default:()=>[]},onRemove:{type:Function,default:null}},emits:["close"],setup(e,{emit:t}){const n=e,s=t,r=()=>{n.onRemove?n.onRemove():s("close")},o=i=>{i.key==="Escape"&&r()};return Je(()=>{document.addEventListener("keydown",o)}),Rt(()=>{document.removeEventListener("keydown",o)}),(i,a)=>(m(),x("div",{class:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/50 p-4 eai-customer-modal-overlay",onClick:r},[l("div",{onClick:a[0]||(a[0]=Gt(()=>{},["stop"])),class:"bg-white rounded-xl w-full max-w-sm flex flex-col shadow-2xl relative text-gray-800 max-h-[85vh] overflow-hidden"},[l("button",{class:"absolute top-3 right-3 p-1.5 bg-gray-100/80 rounded-full text-gray-600 hover:text-gray-900 hover:bg-gray-200 transition-colors z-10 block cursor-pointer",onClick:r},[G(y(Es),{class:"w-4 h-4"})]),KF,l("div",QF,[l("div",JF," Có "+j(e.customers.length)+" khách đã đặt ",1),l("div",XF,[l("table",ZF,[YF,l("tbody",eq,[(m(!0),x(_e,null,Me(e.customers,(c,u)=>(m(),x("tr",{key:u,class:ne(u%2===0?"bg-gray-50":"bg-white")},[l("td",tq,j(c.name),1),l("td",nq,j(c.phone),1),l("td",sq,j(y(ja)(c.time)),1)],2))),128))])])])])])]))}},[["__scopeId","data-v-0e32e6e0"]])},Symbol.toStringTag,{value:"Module"})),Di={ADD_CART:"/cart/api/cart/AddProduct"},ji={DMX_STAGING:"https://staging.dienmayxanh.com",DMX_PRODUCTION:"https://www.dienmayxanh.com",TGDD_STAGING:"https://staging.thegioididong.com",TGDD_PRODUCTION:"https://www.thegioididong.com"},oq={"www.dienmayxanh.com":{ADD_CART:ji.DMX_PRODUCTION+Di.ADD_CART},"staging.dienmayxanh.com":{ADD_CART:ji.DMX_STAGING+Di.ADD_CART},"www.thegioididong.com":{ADD_CART:ji.TGDD_PRODUCTION+Di.ADD_CART},"staging.thegioididong.com":{ADD_CART:ji.TGDD_STAGING+Di.ADD_CART},localhost:{ADD_CART:ji.DMX_PRODUCTION+Di.ADD_CART}};function vv(){const e=R(!1),t=R(null),n=R(null),s=R(null),{handle:r}=Et(ae.state),o=async({productId:c,productCode:u,productType:d,quantity:f})=>{try{e.value=!0,t.value||(t.value=window.location.hostname);const h=oq[t.value].ADD_CART,g={requestChooseServiceDetail:{bringProductsName:"",isTransContact:!1,isUserManual:!1,lstProductCodeMoreColors:"",productId:c},requestProductAdd:[{indexGiftAdds:[],productId:c,productCode:u,productType:Number(d)||1,quantity:Number(f)||1}]},p=await fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(g)});if(!p.ok)throw new Error(`EAC - Error adding product to cart: ${p.status}`);return await p.json()}catch(h){throw console.error("EAC - Error adding product to cart:",h),h}finally{e.value=!1}},i=(c=[],u)=>{var p,v;const{origin:d,pathname:f}=window.location;let h=(p=c.find(_=>_.href.includes("/cart/single")))==null?void 0:p.href,g=(v=c.find(_=>_.href.includes("/cart/them-vao-gio-hang")))==null?void 0:v.href;if(u===d+f){const _=document.querySelector('a.btn-buynow[href*="/cart/single"]'),w=document.querySelector('a.btn-buynow[href*="/cart/them-vao-gio-hang"]');_!=null&&_.href&&(h=_.href),w!=null&&w.href&&(g=w.href)}h&&(n.value=d+h),g&&(s.value=d+g)},a=c=>{const u=c.split("?")[1];return u?u.split("&").reduce((d,f)=>{const[h,g]=f.split("=");return d[h]=g,d},{}):{}};return Je(()=>{t.value=window.location.hostname}),{addCart:o,getLinkBuyNowAndSingleCart:i,getParamCTALink:a,isLoading:e,linkSingleCart:n,linkBuyNow:s}}const iq={class:"p-[8px] flex flex-col group h-full"},aq=["src","alt"],lq=["src","alt"],cq={class:"flex flex-col flex-1 mt-2"},uq={class:"flex flex-wrap items-center mt-1"},dq={class:"mr-1 text-red-500 font-semibold text-[15px]"},fq={key:0},hq={key:1},pq={key:2},mq={key:0,class:"text-xs font-light text-gray-500"},gq={key:1,class:"text-xs font-light text-gray-500"},vq={key:0,class:"mt-2 mb-1 variant-attributes"},yq={class:"mb-0.5 text-xs tracking-tight text-gray-500"},bq={class:"flex space-x-2"},_q=["onClick"],xq={key:1,class:"flex items-center mt-2"},wq={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},kq={key:0,class:"mt-4"},Sq={href:"/cart",class:"flex justify-center items-center p-2 w-full text-sm text-white rounded border transition-colors duration-200 bg-[#FC7600] border-[#FC7600] hover:bg-[#FC7600]/80 hover:border-[#FC7600]/80"},Cq={key:1,class:"mt-4"},$q=["href"],Tq=["href"],Aq=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"CardProductNew",props:{item:{type:Object}},emits:["open-flow-checkout","send-message","loading"],setup(e,{emit:t}){var O,I;const n=e,s=t,{addCart:r,getLinkBuyNowAndSingleCart:o,linkSingleCart:i,linkBuyNow:a}=vv(),c=R(!1),u=((I=(O=U.bot)==null?void 0:O.config)==null?void 0:I.ui.logo)||`${U.appDomain}/link.png`,d=R(null),f=R(!1);Za(n.item.links)&&(n.item.links=JSON.parse(n.item.links)),Pe(f,P=>{s("loading",P)});const h=R(!1),g=R(null),p=R(null),v=R(!1),_=()=>{var q,B,T;const{source:P,links:M}=n.item;if(p.value=(q=M==null?void 0:M.variant_items)==null?void 0:q.filter(A=>!A.hasOwnProperty("status")||A.status),v.value=((B=M==null?void 0:M.service_packs)==null?void 0:B.length)>0,((T=p.value)==null?void 0:T.length)>0){const A=p.value[0];A.code&&A.color_hex?g.value=A:g.value=null}o(M==null?void 0:M.cta_links,P)},w=async P=>{if(!Number(P))return;const M=document.querySelector(".header__cart .cart-number");M&&(M.textContent||M.classList.add("has-cart"),M.textContent=P)};async function k(){try{const P=new Date().getTime(),q=`${window.location.origin}/cart/api/cart/info?_=${P}`,T=await(await fetch(q,{method:"GET",headers:{Accept:"application/json"}})).json();if(T&&T.items_count){const A=document.querySelector(".header__cart .cart-number");A&&(A.textContent||A.classList.add("has-cart"),A.textContent=T.items_count)}}catch(P){console.error("Error:",P)}}function S(){var q,B,T,A,D,Q;if(f.value)return;let P=(T=(B=(q=n.item.links)==null?void 0:q.cta_links)==null?void 0:B.find(W=>W.href.includes("/cart/them-vao-gio-hang")))==null?void 0:T.href;if(!P)return s("send-message",`Liên hệ tư vấn ${n.item.title}`);if(f.value=!0,v.value){const W=(A=n.item.links)==null?void 0:A.service_packs,H=((D=W==null?void 0:W[0])==null?void 0:D.data_id)??((Q=W==null?void 0:W[1])==null?void 0:Q.data_id)??1;P=P+`&packageSelection=${H}`}const M=document.createElement("iframe");M.style.display="none",M.src=P,M.onload=async W=>{document.body.removeChild(M),f.value=!1,h.value=!0,k();let{title:H,image:K,source:J}=n.item;const te=await Tr(K);te.status||(K=u);const ge=co({title:H,image:K,source:J,isImageValid:te.status,cartUrl:"/cart"});s("send-message",ge)},M.onerror=W=>{document.body.removeChild(M),f.value=!1},document.body.appendChild(M)}const E=async()=>{if(v.value||a.value&&!a.value.includes("productCode")){S();return}try{if(!a.value&&!g.value)return s("send-message",`Liên hệ tư vấn ${n.item.title}`);if(f.value)return;f.value=!0;let P={};if(g.value)P={quantity:1,productId:g.value.id,productCode:g.value.code,productType:g.value.product_type};else{const q=Ya(a.value);P={quantity:1,productId:q.productId,productCode:q.productCode,productType:q.productType}}const M=await r(P,v.value);if(M&&M.data){h.value=!0;const q=M.data.products.reduce((W,H)=>W+H.quantity,0);w(q);let{title:B,image:T,source:A}=n.item;const D=await Tr(T);D.status||(T=u);const Q=co({title:B,image:T,source:A,isImageValid:D.status,cartUrl:"/cart"});s("send-message",Q)}else{const q=M.errormessage;pn.actions.warning({message:q})}}catch(P){console.log(P),P!=null&&P.message&&pn.actions.error({message:"Có lỗi xảy ra, vui lòng thử lại sau"})}finally{f.value=!1}};return Je(()=>{d.value=window.location.origin,_()}),(P,M)=>{var q,B,T,A;return m(),x("div",iq,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:"_self",class:"rounded overflow-hidden flex items-center justify-center aspect-[1/1]"},{default:Se(()=>[e.item.image&&!c.value?(m(),x("img",{key:0,src:e.item.image,alt:e.item.title,class:"object-contain w-full h-full",onError:M[0]||(M[0]=()=>c.value=!0)},null,40,aq)):(m(),x("img",{key:1,src:y(u),alt:e.item.title,class:"object-cover overflow-hidden w-8 h-8 rounded-full"},null,8,lq))]),_:1},8,["href"])),l("div",cq,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:"_self",class:"text-sm font-medium text-gray-900 line-clamp-1 sm:group-hover:text-primary"},{default:Se(()=>[We(j(e.item.title),1)]),_:1},8,["href"])),l("div",uq,[l("div",dq,[e.item.texts&&e.item.texts.price?(m(),x("div",fq,j(e.item.texts.price),1)):g.value&&g.value.price_text?(m(),x("div",hq,j(g.value.price_text),1)):e.item.price?(m(),x("div",pq,j(y(et)(e.item.price,{currency:e.item.currency})),1)):z("",!0)]),g.value&&g.value.old_price_text!==g.value.price_text&&g.value.old_price_text!=="0₫"?(m(),x("del",mq,j(g.value.old_price_text),1)):!((B=(q=e.item.links)==null?void 0:q.variant_items)!=null&&B.length)&&e.item.old_price>0&&e.item.old_price!==e.item.price&&e.item.old_price_text!==0?(m(),x("del",gq,j(y(et)(e.item.old_price,{currency:e.item.currency})),1)):z("",!0)]),g.value?(m(),x("div",vq,[l("div",yq," Màu: "+j(g.value.color||""),1),l("div",bq,[(m(!0),x(_e,null,Me(p.value,(D,Q)=>(m(),x("div",{key:Q,class:"cursor-pointer",onClick:W=>g.value=D},[l("div",{class:ne(["size-[20px] rounded-full border ring-1 shadow-[inset_0_3px_4px_rgba(0,0,0,0.05)]",g.value.code===D.code?"border-blue-50 ring-blue-300":"border-transparent ring-transparent"]),style:ht({backgroundColor:D.color_hex})},null,6)],8,_q))),128))])])):z("",!0),Number(e.item.rating)||e.item.review_count?(m(),x("div",xq,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:ht({"--rating":Number(e.item.rating)})},null,4)):z("",!0),e.item.review_count?(m(),x("div",wq," ("+j(y(vm)(e.item.review_count))+") ",1)):z("",!0)])):z("",!0)]),h.value?(m(),x("div",kq,[l("a",Sq,[G(y(ln),{"stroke-width":"1.5",size:"18",class:"mr-1"}),We(" Thanh toán ngay ")])])):(m(),x("div",Cq,[y(i)?(m(),x("a",{key:0,href:y(i),class:"flex justify-center items-center p-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[G(y(ln),{"stroke-width":"1.5",size:"18",class:"mr-1"}),We(" Mua ngay ")],8,$q)):(A=(T=e.item.links)==null?void 0:T.cta_links)!=null&&A.length?(m(),x("button",{key:2,onClick:M[1]||(M[1]=D=>E()),class:ne(["flex justify-center items-center p-2 w-full text-sm bg-white rounded border border-gray-200",f.value?"cursor-pointer text-gray-400":"hover:bg-primary hover:text-white hover:border-primary text-gray-600"])},[y(a)||g.value?(m(),x(_e,{key:0},[f.value?(m(),oe(tn,{key:0,class:"w-[18px] h-[18px] mr-1"})):(m(),oe(y(ln),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"}))],64)):(m(),oe(y(eg),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"})),We(" "+j(y(a)||g.value?"Thêm vào giỏ":"Liên hệ"),1)],2)):(m(),x("a",{key:1,href:e.item.source,class:"flex justify-center items-center p-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[G(y(pl),{"stroke-width":"1.5",size:"18",class:"mr-1"}),We(" Xem chi tiết ")],8,Tq))]))])}}}},Symbol.toStringTag,{value:"Module"})),Eq={class:"p-[10px] rounded group border border-gray-200 w-full"},Iq={class:"flex"},Pq=["src","alt"],Mq=["src","alt"],Oq={class:"flex flex-col flex-1"},Lq={class:"flex flex-wrap items-center mt-1"},Rq={class:"mr-1 text-red-500 font-semibold text-[15px]"},Dq={key:0},jq={key:1},Nq={key:2},Fq={key:0,class:"text-xs font-light text-gray-500"},qq={key:1,class:"text-xs font-light text-gray-500"},zq={key:0,class:"my-2 variant-attributes"},Bq={class:"mb-0.5 text-xs tracking-tight text-gray-500"},Uq={class:"flex space-x-2"},Vq=["onClick"],Hq={key:1,class:"flex items-center"},Wq={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},Gq={key:0,class:"mt-3"},Kq={href:"/cart",class:"flex justify-center items-center p-2 w-full text-sm text-white rounded border transition-colors duration-200 bg-[#FC7600] border-[#FC7600] hover:bg-[#FC7600]/80 hover:border-[#FC7600]/80"},Qq={key:1,class:"mt-3"},Jq=["href"],Xq=["href"],Zq=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"CardProductRowNew",props:{item:{type:Object}},emits:["open-flow-checkout","send-message","loading"],setup(e,{emit:t}){var O,I;const n=e,s=t,{addCart:r,getLinkBuyNowAndSingleCart:o,linkSingleCart:i,linkBuyNow:a}=vv(),c=R(!1),u=((I=(O=U.bot)==null?void 0:O.config)==null?void 0:I.ui.logo)||`${U.appDomain}/link.png`,d=R(null),f=R(!1);Za(n.item.links)&&(n.item.links=JSON.parse(n.item.links)),Pe(f,P=>{s("loading",P)});const h=R(!1),g=R(null),p=R(null),v=R(!1),_=()=>{var q,B,T;const{source:P,links:M}=n.item;if(p.value=(q=M==null?void 0:M.variant_items)==null?void 0:q.filter(A=>!A.hasOwnProperty("status")||A.status),v.value=((B=M==null?void 0:M.service_packs)==null?void 0:B.length)>0,((T=p.value)==null?void 0:T.length)>0){const A=p.value[0];A.code&&A.color_hex?g.value=A:g.value=null}o(M==null?void 0:M.cta_links,P)},w=async P=>{if(!Number(P))return;const M=document.querySelector(".header__cart .cart-number");M&&(M.textContent||M.classList.add("has-cart"),M.textContent=P)};async function k(){try{const P=new Date().getTime(),q=`${window.location.origin}/cart/api/cart/info?_=${P}`,T=await(await fetch(q,{method:"GET",headers:{Accept:"application/json"}})).json();if(T&&T.items_count){const A=document.querySelector(".header__cart .cart-number");A&&(A.textContent||A.classList.add("has-cart"),A.textContent=T.items_count)}}catch(P){console.error("Error:",P)}}function S(){var q,B,T,A,D,Q;if(f.value)return;let P=(T=(B=(q=n.item.links)==null?void 0:q.cta_links)==null?void 0:B.find(W=>W.href.includes("/cart/them-vao-gio-hang")))==null?void 0:T.href;if(!P)return s("send-message",`Liên hệ tư vấn ${n.item.title}`);if(f.value=!0,v.value){const W=(A=n.item.links)==null?void 0:A.service_packs,H=((D=W==null?void 0:W[0])==null?void 0:D.data_id)??((Q=W==null?void 0:W[1])==null?void 0:Q.data_id)??1;P=P+`&packageSelection=${H}`}const M=document.createElement("iframe");M.style.display="none",M.src=P,M.onload=async W=>{document.body.removeChild(M),f.value=!1,h.value=!0,k();let{title:H,image:K,source:J}=n.item;const te=await Tr(K);te.status||(K=u);const ge=co({title:H,image:K,source:J,isImageValid:te.status,cartUrl:"/cart"});s("send-message",ge)},M.onerror=W=>{document.body.removeChild(M),f.value=!1},document.body.appendChild(M)}const E=async()=>{if(v.value||a.value&&!a.value.includes("productCode")){S();return}try{if(!a.value&&!g.value)return s("send-message",`Liên hệ tư vấn ${n.item.title}`);if(f.value)return;f.value=!0;let P={};if(g.value)P={quantity:1,productId:g.value.id,productCode:g.value.code,productType:g.value.product_type};else{const q=Ya(a.value);P={quantity:1,productId:q.productId,productCode:q.productCode,productType:q.productType}}const M=await r(P);if(M&&M.data){h.value=!0;const q=M.data.products.reduce((W,H)=>W+H.quantity,0);w(q);let{title:B,image:T,source:A}=n.item;const D=await Tr(T);D.status||(T=u);const Q=co({title:B,image:T,source:A,isImageValid:D.status,cartUrl:"/cart"});s("send-message",Q)}else{const q=M.errormessage;console.log("Failed to add to cart",q),pn.actions.warning({message:q})}}catch(P){console.log(P),P!=null&&P.message&&pn.actions.error({message:"Có lỗi xảy ra, vui lòng thử lại sau"})}finally{f.value=!1}};return Je(()=>{d.value=window.location.origin,_()}),(P,M)=>{var q,B;return m(),x("div",Eq,[l("div",Iq,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:"_self",class:"rounded overflow-hidden size-[124px] flex items-center justify-center mr-2 flex-shrink-0"},{default:Se(()=>[e.item.image&&!c.value?(m(),x("img",{key:0,src:e.item.image,alt:e.item.title,class:"object-contain w-full h-full",onError:M[0]||(M[0]=()=>c.value=!0)},null,40,Pq)):(m(),x("img",{key:1,src:y(u),alt:e.item.title,class:"object-cover overflow-hidden w-8 h-8 rounded-full"},null,8,Mq))]),_:1},8,["href"])),l("div",Oq,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:"_self",class:"text-sm font-medium text-gray-900 line-clamp-2 group-hover:text-primary"},{default:Se(()=>[We(j(e.item.title),1)]),_:1},8,["href"])),l("div",Lq,[l("div",Rq,[e.item.texts&&e.item.texts.price?(m(),x("div",Dq,j(e.item.texts.price),1)):g.value&&g.value.price_text&&g.value.price_text!=="0₫"?(m(),x("div",jq,j(g.value.price_text),1)):e.item.price&&e.item.price!==0?(m(),x("div",Nq,j(y(et)(e.item.price,{currency:e.item.currency})),1)):z("",!0)]),g.value&&g.value.old_price_text!==g.value.price_text&&g.value.old_price_text!=="0₫"?(m(),x("del",Fq,j(g.value.old_price_text),1)):e.item.old_price>0&&e.item.old_price!==e.item.price?(m(),x("del",qq,j(y(et)(e.item.old_price,{currency:e.item.currency})),1)):z("",!0)]),g.value?(m(),x("div",zq,[l("div",Bq," Màu: "+j(g.value.color||""),1),l("div",Uq,[(m(!0),x(_e,null,Me(p.value,(T,A)=>(m(),x("div",{key:A,class:"cursor-pointer",onClick:D=>g.value=T},[l("div",{class:ne(["size-[20px] rounded-full border ring-1 shadow-[inset_0_3px_4px_rgba(0,0,0,0.05)]",g.value.code===T.code?"border-blue-50 ring-blue-300":"border-transparent ring-transparent"]),style:ht({backgroundColor:T.color_hex})},null,6)],8,Vq))),128))])])):z("",!0),Number(e.item.rating)||e.item.review_count?(m(),x("div",Hq,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:ht({"--rating":Number(e.item.rating)})},null,4)):z("",!0),e.item.review_count?(m(),x("div",Wq," ("+j(y(vm)(e.item.review_count))+") ",1)):z("",!0)])):z("",!0)])]),h.value?(m(),x("div",Gq,[l("a",Kq,[G(y(ln),{"stroke-width":"1.5",size:"18",class:"mr-1"}),We(" Thanh toán ngay ")])])):(m(),x("div",Qq,[y(i)?(m(),x("a",{key:0,href:y(i),class:"flex justify-center items-center p-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[G(y(ln),{"stroke-width":"1.5",size:"18",class:"mr-1"}),We(" Mua ngay ")],8,Jq)):(B=(q=e.item.links)==null?void 0:q.cta_links)!=null&&B.length?(m(),x("button",{key:2,onClick:M[1]||(M[1]=T=>E()),class:ne(["flex justify-center items-center p-2 w-full text-sm bg-white rounded border border-gray-200",f.value?"cursor-pointer text-gray-400":"hover:bg-primary hover:text-white hover:border-primary text-gray-600"])},[y(a)||g.value?(m(),x(_e,{key:0},[f.value?(m(),oe(tn,{key:0,class:"w-[18px] h-[18px] mr-1"})):(m(),oe(y(ln),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"}))],64)):(m(),oe(y(eg),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"})),We(" "+j(y(a)||g.value?"Thêm vào giỏ":"Liên hệ"),1)],2)):(m(),x("a",{key:1,href:e.item.source,class:"flex justify-center items-center p-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[G(y(pl),{"stroke-width":"1.5",size:"18",class:"mr-1"}),We(" Xem chi tiết ")],8,Xq))]))])}}}},Symbol.toStringTag,{value:"Module"})),yd="data:image/webp;base64,UklGRs4HAABXRUJQVlA4WAoAAAAQAAAATwAATwAAQUxQSPICAAABoLNt2zk/un7v+86x6dZV2K3KP1ZfwFXMT7A2O1Vx0q5tI7adbGXbnnlxF+P5PdVWETEBDLAKFTDlojn3PbLx+Oc//90q6lriP79+9cH2Zx5YNn46QMMxigG48PpXPmlpuN9suP9SB94PLVScddNBteeUci6ln1JyTimr/aOHzwPvhuI8LPhBUky5aLglxSzp5QkIQwhwzVGplTSiOUp6biaVG1AVmP6mFLNGORa1boEwEAdL/lVKGvUobT6HxgA8rJOialha+nGcRl8e3lbMqmdLuoJGHw62qqnaRukKGj1V8JaaqnGSJgi9BNaoqVon/XQurltgkaJq3tJWqi6Oaf8o100t3Ubo5HlDUbUvas3CtQWuUZKBUc/h2+CoDSqawENgrqJMjHqpzbFbyQapnIfzTKrIyKiHaARWKVqR9aED/5GyFcq6BMZUZGbU/XCToh1JG+B5S4q+Ob06pWyHVMan/qZiSNbSy2Rq0gMLlW15+g4lS7K2Lbfmg8dtKfrqVWt+3aBsifTPdmvibmvKXmv0/4vd1uTt1rQ2WPP3q0qWFP38uDWfL7cl6/jt1mxYqGxJ0iOXydSke6f+pmJI1uzqlLIdRa0LeV7RjqyPT+MmS5JehjEVO6KuA/+RshnSBQRWKVqRdIDKM6liRdQNBBy7lWwo+v0cKgJzFG1oaRWB9qNKFhT9Nw0HBK6xoamHCLR73lSsX9LXU6g6OKb/q1y3rHgJns6BJYp1i1pEg+6BdWrWq6k1NOixgrfVrFNTb0PVCw62qlmfpraBo3cPbynmeuSod8DTr4c1UqxDlNaDp38Hi/5WSqOWkv5dCo5BVoGpr0sxjVKK0lszCBUDDnD1UanEPBo5FunYtRAYvPMwZ5ekEmMuwyg5xiJp91zwjqGGCiZWfaSOOaWUcp8ppZTV8ePVk0Bg6MGBH7vp+VO/aYi/n3r+5nEPLjCSPgBUUy9beMfyx17bsH333n0d9+7evuG1x1fesejyaRVA8AwSVlA4ILYEAADQFwCdASpQAFAAPpE8mkiloyKhKlYMsLASCWwAwRUM/xA2Fnrn5VcyryxE3d6c0ePj1L+YB+nXSS/ZL1GfsT+zvYi9AD+l/3jrO/QA8s/9tfg4/dT0o80i/sfaNXl76ct5g9pApl3j6+n9/l+3Yzf7Gq+vivPeDsxrS8Ac+g4ROxcsYb1Dynxi3fMahIR8AmwnnORqL3l+YpsU6AovnW9ixEvnik3G1/u0FppJvwgoFpoTGooCj/HXcsHZGT+ppelIf9KZwSagAP64fDB/EPBHP9CQUeoZif9cesHyt44/1mUNwqV2KO+5KYBIwMFzENaQSKM5qn/W/jgsPwWGtAzYDwipxSe+YbHkEhlUzrCw3YoOR8Vx+32F5x9ClgVDh96Z6PnpU1Kv4QtLm4ohGi8uQBKAfuXCwPQHV9/jkNUtephv3YHaxZVG3oVJ8h5jQFNXXrcoyK+PaXueO1hhfYuqWViv5TA616B5ahMnR1YL/P0EOECH6QJtZxM0sDjTaNdbcXsm0f/J2Ts6cSA04Ujrr6swaIlZB18HnLJBgs46U6sphVTPoylZ4ATN0B/y4/q+zfyD8A0Mzl1CcwkgeLIMMg5EF9I51UV7TxBzZiSGd/3qN5Sug+24Pf32UJLb3H8aoLhdU6bZESTkB7FYPclMU3EdisGAacV97K9+z1iBK4fei7Ih1TXyM1IUMDjBZi6e5ihvUjTKdUj0NeY7zbBZ9L/c4j9s9OpB0SCK50s6DuzvtOFQpQuRN8/XvOHsrgnEvFFlkHclw9QWBh7UHnel71YTiGSEoIXdnAbKpa+N+bIaSiuLUWx2C4su0zXbFAu9Q4NvkWKPO/arQCYj2dZTVNa1uE/fO+KNXRN4y3B65trNNG02vu9zOQzPOslKfoyr6uR8zdPyBYPoMimypbm+cR7DBudc0ulUN34dOuG3z0Gida533lBAmQP2PBojhagBEJms3kDJ70DD6T/agFpi3S6fPt2O9zDxoPK1qTqIxfC3xkmYAjXX+eqDEBQnE2UI6MSgDpFfq3WA7i8ynHPx5yZw31WxqGez86vDf80bHiNkeDTdusq3x1ndKLV7xUzWVhDmjk+jD/GS2w9kIdxsHPaUK66/rvo/VerYa/NyTRCpYtncY46YUzH5IrWOI6IYNjlxfMWMvwUFKqZFhbfIDvtMYhDOLpln9CSPJW866m+/rF6dMr4BrOENDp6ZQg7Y/uvPM/ZvgIIBDSfOixn0kWCPFJvq7QPW/sSLHlzzxCsfd1bxfBwGOAz0wJ388A9w2/X0lJH+Ugd/bXlSFAIgaihWPLmtamdoC35/RHQ0cWowD2z3yFWaAZvuIQEgkelnrFFNBqRHO+T/8WmFMI8ePR4zzlScQr0mHLjIc5xqM+7ENp7QABi+k6D55pRS6KVMqab4+mt68FCRlA/e8mdr01+nGVIf2L/PdacR75ZfSLyaHhSeYX/yl67hz0nH5BeEkBYqrUZI43bZg5QLUspHsaCf+NGtMA2eFvwBsUQMfm8nPVLb53yqsm5rs9mMqDMvC0YEOFM237KrGPE3tfbzFQ4YSU17vqFw3zTjUKAWoeIWUwlY+3JjlE8+RUCFvuByPBjDAAA=";function yv(){const e=R(!1),t=R(null),n=R(null),s="https://ecommerce.pico.vn",r="/user/api/shopping-cart",o=St.create({baseURL:s,timeout:1e4,headers:{"Content-Type":"application/json"}}),i=()=>{const d=navigator.userAgent.toLowerCase(),f=window.screen.width;return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(d)?f>=768?"Tablet":"Mobile":"Desktop"};o.interceptors.request.use(d=>{try{const f=Tt.get("guestId"),h=Tt.get("access"),g=Tt.get("sale-region")||"MN1",p=i();f&&h&&(d.headers={...d.headers,access:h,channel:"b2c",party:"ecom",platform:p,"sale-region":g,uuid:f})}catch(f){console.warn("Failed to add custom headers:",f)}return d},d=>Promise.reject(d)),o.interceptors.response.use(d=>d,d=>{var h,g;const f=((g=(h=d.response)==null?void 0:h.data)==null?void 0:g.message)||d.message||"API request failed";return console.error("API Error:",f),Promise.reject(d)});const a=async d=>{var h,g;if(!(d!=null&&d.productId))throw new Error("Product ID is required");const f=c();if(!f.isValid)throw new Error(`Missing required cookies: ${f.missing.join(", ")}`);e.value=!0,t.value=null,n.value=null;try{const p={productId:d.productId,shippingMethod:d.shippingMethod||"pickUpInStore",quantity:d.quantity||1,serviceIds:d.serviceIds||[],selectedReceiveAtWarehouse:d.selectedReceiveAtWarehouse||!1},v=await o.post(r,p);return n.value=v.data,v.data}catch(p){const v=((g=(h=p.response)==null?void 0:h.data)==null?void 0:g.message)||p.message||"Failed to add product to cart";throw t.value=v,new Error(v)}finally{e.value=!1}},c=()=>{const f=["guestId","access"].filter(h=>!Tt.get(h));return{isValid:f.length===0,missing:f}},u=()=>({uuid:Tt.get("guestId"),access:Tt.get("access"),saleRegion:Tt.get("sale-region")||"MN1",platform:i()});return Z(()=>c().isValid),Z(()=>u()),{isLoading:Vr(e),error:Vr(t),cartResponse:Vr(n),addToCart:a}}function bv(){R(!1);const e=R(!1),t=(s=1)=>{const r=document.querySelector(".cart-header .count_item");if(r){const o=parseInt(r.textContent)||0;r.textContent=o+s,r.classList.remove("hidden-count")}};return{addToCart:async s=>{try{if(e.value)return;e.value=!0;const r=new FormData;r.append("variantId",s.variantId),r.append("quantity",s.quantity||1);const o=await fetch("https://eco-mart.vn/cart/add",{method:"POST",body:r,headers:{"X-Requested-With":"XMLHttpRequest"}});if(o.ok){const i=o.headers.get("content-type");if(i&&i.includes("application/json")){const a=await o.json();return console.log("Item added to cart successfully:",a),t(s.quantity||1),a}else return console.log("Item added to cart successfully"),t(s.quantity||1),{success:!0,message:"Added to cart"}}else throw new Error(`HTTP error! status: ${o.status}`)}catch(r){throw console.error("Error adding item to cart:",r),r}finally{e.value=!1}}}}function _v(){const e=R(!1),t=(s=1)=>{const r=document.querySelector(".cart-count")||document.querySelector(".shopping-cart .count")||document.querySelector("#cart-count");if(r){const o=parseInt(r.textContent)||0;r.textContent=o+s}};return{addToCart:async s=>{try{if(e.value)return;e.value=!0;const r=new URLSearchParams;r.append("a","cart-add"),r.append("Product_ID",s.productId),r.append("Rule_ID",s.ruleId||""),r.append("quantity",s.quantity||1),r.append("muangay","0"),r.append("ptype",""),r.append("previewDate",""),r.append("promotionList",""),r.append("totalDiscount",""),r.append("comboItems","[]"),r.append("insuranceItems","[]"),r.append("selectedPromotionOffer",""),r.append("selectedPromotionOfferGifts",'[""]'),r.append("selectedPromotionPayment","");const o=window.location.hostname.includes("viettelstore.vn")?"/Site/_Sys/ajax.aspx":"https://viettelstore.vn/Site/_Sys/ajax.aspx",i=await fetch(o,{method:"POST",body:r,headers:{"X-Requested-With":"XMLHttpRequest","Content-Type":"application/x-www-form-urlencoded"}});if(i.ok){const a=await i.text();return a.includes("stt: 1")||a.includes('"stt":1')?(t(s.quantity||1),{success:!0,message:"Thêm vào giỏ hàng thành công"}):(pn.actions.warning({message:"Sản phẩm hiện không thể thêm vào giỏ hàng"}),{success:!1,message:a})}throw new Error(`HTTP error! status: ${i.status}`)}catch(r){throw pn.actions.error({message:"Có lỗi xảy ra, vui lòng thử lại sau"}),r}finally{e.value=!1}}}}const Yq={class:"p-[8px] flex flex-col group sm:hover:shadow duration-200 h-full"},ez=["src","alt"],tz=["src","alt"],nz={class:"flex flex-col flex-1 mt-2"},sz={key:0,class:"mt-1 text-sm text-gray-500 line-clamp-2"},rz={key:1,class:"flex flex-wrap items-center mt-1"},oz={class:"mr-1 text-sm font-semibold text-red-500"},iz={key:0},az={key:1},lz={key:2},cz={key:0,class:"text-xs font-light text-gray-500"},uz={key:2,class:"flex items-center mt-1"},dz={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},fz={key:0,class:"mt-4"},hz=["href"],pz={key:1,class:"mt-4"},mz=["href"],gz=["src"],vz=l("div",{class:"leading-[140%]"},"Chat zalo",-1),yz=l("div",{class:"leading-[140%]"},"Liên hệ hotline",-1),bz=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"CardProduct",props:{item:{type:Object}},emits:["open-flow-checkout","send-message","loading"],setup(e,{emit:t}){var q,B;const n={[fi]:"https://zalo.me/0935194469",[rs]:"https://zalo.me/2915476565064825313"},s=e,r=t,o=R(!1),i=((B=(q=U.bot)==null?void 0:q.config)==null?void 0:B.ui.logo)||`${U.appDomain}/link.png`,a=R(null),c=R(!1),u=R(!1),d=R(!1);Za(s.item.links)&&(s.item.links=JSON.parse(s.item.links)),Pe(c,T=>{r("loading",T)});const f=T=>new URLSearchParams(window.location.search).get(T);Je(()=>{a.value=window.location.origin,d.value=!!f("preview")});const h=async()=>{var T;if(!c.value)try{c.value=!0;let A=U.selectedForm;const D=lo(s.item);(T=D.texts)!=null&&T.price&&(D.price=0,D.old_price=0);const Q={...D,quantity:1};if(A){let W=!1;A.items.forEach(H=>{var K,J;((K=H.sku)==null?void 0:K.toString())===((J=Q.sku)==null?void 0:J.toString())&&(W=!0,H.quantity=Number(H.quantity)+1)}),A={...A,items:W?A.items:[...A.items,Q]}}else A={items:[Q]};Pl().update({formData:A,status:"draft"}),U.handle===$s&&v({hideCheckout:!0})}catch{}finally{c.value=!1}},g=async()=>{try{if(c.value)return;c.value=!0;const T={quantity:1,product_id:s.item.product_id,product_sku:s.item.product_sku},{data:A}=await Xe.cart.add(T);A.success&&(U.cart=A.data,r("open-flow-checkout"),ECG.sync.emit("cart",{source:"easy-ai-chat",data:A.data}))}catch(T){console.log("ecg error: ",T)}finally{c.value=!1}};function p(){U.handle===On?g():U.handle===li?_(s.item.sku):U.handle===xr?w():U.handle===ro?S():U.handle===rs?E():U.handle===kr?k():h(),O("add_to_cart",{product_id:s.item.product_sku,name:s.item.title,price:s.item.price,quantity:1})}const v=async(T={})=>{let{title:A,image:D,source:Q}=s.item;const W=M(),H=await Tr(D);H.status||(D=i);const K=co({title:A,image:D,source:Q,isImageValid:H.status,cartUrl:W,...T});r("send-message",K)};async function _(T){if(c.value)return;const A="https://mediamart.vn/cart/add-items/";try{if(!T)throw new Error("Product IDs are required");c.value=!0;let D="";if(Array.isArray(T)){if(T.length===0)throw new Error("Product IDs array cannot be empty");T.forEach(H=>{if(!H||H<=0)throw new Error("All product IDs must be positive numbers")}),D=T.join(",")}else{if(T<=0)throw new Error("Product ID must be a positive number");D=T.toString()}const Q=A+D+"?utm_source=easyai",W=await fetch(Q,{method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}});if(!W.ok){const H=await W.text();throw console.log("Error response:",H),new Error(`HTTP error! status: ${W.status} - ${H}`)}await W.text(),u.value=!0,v()}catch(D){console.error("Error adding items to cart:",D)}finally{c.value=!1}}async function w(){var T;try{if(c.value)return;c.value=!0;const A=await yv().addToCart({productId:s.item.product_id,quantity:1,serviceIds:[],giftItems:[],selectedReceiveAtWarehouse:!1});if(A&&A.data){u.value=!0,v();const D=(T=A.data.products)==null?void 0:T.reduce((H,K)=>H+K.quantity,0),Q=document.querySelector('a[href="/checkout/cart"] .bg-product-salePrice'),W=document.querySelector("#bottomMobileTab .bg-red.rounded-full");Q&&(Q.textContent=D||0),W&&(W.textContent=D||0)}c.value=!1}catch(A){console.error("Error adding items to cart:",A)}finally{c.value=!1}}async function k(){var T,A;try{if(c.value)return;c.value=!0;const H=(((s.item.links||{}).variants||[])[0]||{}).rule_id||"",K=s.item.product_id||s.item.product_sku||((A=(T=s.item.source)==null?void 0:T.match(/pid(\d+)/))==null?void 0:A[1])||"",J=await _v().addToCart({productId:K,ruleId:H,quantity:1});J&&J.success&&(u.value=!0,v())}catch(D){console.error("ViettelStore: Error adding to cart:",D)}finally{c.value=!1}}async function S(){try{if(c.value||!s.item.product_id)return;c.value=!0;const T=await bv().addToCart({variantId:s.item.product_id,quantity:1});T&&T.success&&(u.value=!0,v()),c.value=!1}catch(T){console.error("Error adding items to cart:",T)}finally{c.value=!1}}async function E(){var T;try{if(c.value)return;const A=(T=s.item.links)==null?void 0:T.purchase_info;if(!A||!A.purchasable||!A.product_id)return;c.value=!0;const D=`${A.product_id}-${A.product_type??0}`,Q=new FormData;Q.append("action","create"),Q.append("item_type","product"),Q.append("item_id",D),Q.append("props[quantity]",1);const H=await(await fetch("https://www.phucanh.vn/ajax/cart.php",{method:"POST",body:Q})).json();if((H.status==="success"||H.status==="error"&&H.error_type==="item-in-cart")&&(H.status==="error"&&H.error_type==="item-in-cart"&&pn.actions.warning({message:H.message||"Sản phẩm đã tồn tại trong giỏ hàng"}),H.status==="success")){u.value=!0;const K=document.getElementById("count_shopping_cart_store");if(K){const J=parseInt(K.textContent)||0;K.textContent=J+1}v()}}catch(A){console.error("Error adding items to cart Phuc Anh:",A)}finally{c.value=!1}}function O(T,A={}){["hotline","add_to_cart","checkout"].includes(T)&&Qt.ctaClick({type:T,...A})}function I(T,A={}){["product","page"].includes(T)&&Qt.linkClick({type:T,...A})}const P=()=>{const{image:T,image_url:A}=s.item;return T||(Array.isArray(A)&&A[0]?A[0]:(o.value=!0,null))},M=()=>({[xr]:"/checkout/cart?utm_source=easyai&utm_medium=productcard",[li]:"/cart?utm_source=easyai&utm_medium=productcard",[ro]:"/cart?utm_source=easyai&utm_medium=productcard",[kr]:"/gio-hang.html?utm_source=easyai&utm_medium=productcard",[rs]:"/cart?utm_source=easyai&utm_medium=productcard"})[U.handle]||"/cart";return(T,A)=>{var D,Q,W,H,K,J,te,ge,ue,we;return m(),x("div",Yq,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:d.value?"_blank":"_self",onClick:A[1]||(A[1]=Ee=>I("product",{url:e.item.source})),class:"rounded-sm overflow-hidden flex items-center justify-center aspect-[1/1]"},{default:Se(()=>[P()&&!o.value?(m(),x("img",{key:0,src:P(),alt:e.item.title,class:"object-contain w-full h-full",onError:A[0]||(A[0]=()=>o.value=!0)},null,40,ez)):(m(),x("img",{key:1,src:y(i),alt:e.item.title,class:"object-cover overflow-hidden w-8 h-8 rounded-full"},null,8,tz))]),_:1},8,["href","target"])),l("div",nz,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:d.value?"_blank":"_self",onClick:A[2]||(A[2]=Ee=>I("product",{url:e.item.source})),class:"text-sm font-medium text-gray-900 line-clamp-2 sm:group-hover:text-primary",style:{"word-break":"break-word"}},{default:Se(()=>[We(j(e.item.title),1)]),_:1},8,["href","target"])),!e.item.price&&!e.item.rating&&e.item.description?(m(),x("p",sz,j(e.item.description),1)):z("",!0),y(U).handle!==y(_r)?(m(),x("div",rz,[l("div",oz,[e.item.texts&&e.item.texts.price?(m(),x("div",iz,j(e.item.texts.price),1)):e.item.price?(m(),x("div",az,j(y(et)(e.item.price,{currency:e.item.currency})),1)):(m(),x("div",lz,"Liên hệ"))]),e.item.old_price>0&&e.item.old_price!==e.item.price?(m(),x("del",cz,j(y(et)(e.item.old_price,{currency:e.item.currency})),1)):z("",!0)])):z("",!0),Number(e.item.rating)||e.item.review_count?(m(),x("div",uz,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:ht({"--rating":Number(e.item.rating)})},null,4)):z("",!0),e.item.review_count?(m(),x("div",dz," ("+j(e.item.review_count)+") ",1)):z("",!0)])):z("",!0)]),u.value?(m(),x("div",fz,[l("a",{href:M(),onClick:A[3]||(A[3]=Ee=>O("checkout",{product_id:e.item.product_id||e.item.product_sku,name:e.item.title,price:e.item.price,quantity:1})),class:"flex justify-center items-center p-2 w-full text-sm text-white rounded border transition-colors duration-200 bg-[#FC7600] border-[#FC7600] hover:bg-[#FC7600]/80 hover:border-[#FC7600]/80"},[G(y(ln),{"stroke-width":"1.5",size:"18",class:"mr-1"}),We(" Thanh toán ngay ")],8,hz)])):(m(),x("div",pz,[y(U).handle===y(On)||y(U).forms.order&&e.item.price&&y(U).handle!==y(_r)&&!(y(U).handle===y(rs)&&(!((D=e.item.links)!=null&&D.purchase_info)||!((W=(Q=e.item.links)==null?void 0:Q.purchase_info)!=null&&W.purchasable)||!((K=(H=e.item.links)==null?void 0:H.purchase_info)!=null&&K.product_id)))?(m(),x("button",{key:0,onClick:A[4]||(A[4]=Ee=>p()),class:ne(["flex justify-center items-center p-2 w-full text-sm bg-white rounded border border-gray-200",c.value?"cursor-pointer text-gray-400":"hover:bg-primary hover:text-white hover:border-primary text-gray-600"])},[c.value?(m(),oe(tn,{key:0,class:"w-[18px] h-[18px] mr-1"})):(m(),oe(y(ln),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"})),We(" Thêm vào giỏ ")],2)):y(U).handle===y(fi)&&!e.item.price||y(U).handle===y(rs)&&(!((J=e.item.links)!=null&&J.purchase_info)||!((ge=(te=e.item.links)==null?void 0:te.purchase_info)!=null&&ge.purchasable)||!((we=(ue=e.item.links)==null?void 0:ue.purchase_info)!=null&&we.product_id))?(m(),x("a",{key:1,href:n[y(U).handle],target:"_blank",class:"flex justify-center items-center p-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[l("img",{src:y(yd),class:"w-[18px] h-[18px] mr-2"},null,8,gz),vz],8,mz)):y(U).handle===y(_r)?(m(),x("a",{key:2,href:"tel:19002628",onClick:A[5]||(A[5]=Ee=>O("hotline",{value:"19002628"})),class:"flex justify-center items-center p-2 mt-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[G(y(hl),{size:"18",class:"mr-2"}),yz])):z("",!0)]))])}}}},Symbol.toStringTag,{value:"Module"})),_z={class:"p-[12px] group border border-gray-200 w-full"},xz={class:"flex"},wz=["src","alt"],kz=["src","alt"],Sz={class:"flex flex-col flex-1"},Cz={key:0,class:"my-1 text-sm text-gray-500 line-clamp-2"},$z={class:"flex flex-wrap items-center mt-1"},Tz={class:"mr-1 text-sm font-semibold text-red-500"},Az={key:0},Ez={key:1},Iz={key:2},Pz={key:0,class:"text-xs font-light text-gray-500"},Mz={key:1,class:"flex items-center"},Oz={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},Lz={key:0,class:"mt-2"},Rz=["href"],Dz=["href"],jz=["src"],Nz=l("div",{class:"leading-[140%]"},"Chat zalo",-1),Fz=l("div",{class:"leading-[140%]"},"Liên hệ hotline",-1),qz=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"CardProductRow",props:{item:{type:Object}},emits:["open-flow-checkout","send-message","loading"],setup(e,{emit:t}){var q,B;const n={[fi]:"https://zalo.me/0935194469",[rs]:"https://zalo.me/2915476565064825313"},s=e,r=t,o=R(!1),i=((B=(q=U.bot)==null?void 0:q.config)==null?void 0:B.ui.logo)||`${U.appDomain}/link.png`,a=R(null),c=R(!1);Za(s.item.links)&&(s.item.links=JSON.parse(s.item.links));const u=R(!1),d=R(!1);Pe(u,T=>{r("loading",T)});const f=T=>new URLSearchParams(window.location.search).get(T);Je(()=>{a.value=window.location.origin,c.value=!!f("preview")});const h=async()=>{var T;if(!u.value)try{u.value=!0;let A=U.selectedForm;const D=lo(s.item);(T=D.texts)!=null&&T.price&&(D.price=0,D.old_price=0);const Q={...D,quantity:1};if(A){let W=!1;A.items.forEach(H=>{var K,J;((K=H.sku)==null?void 0:K.toString())===((J=Q.sku)==null?void 0:J.toString())&&(W=!0,H.quantity=Number(H.quantity)+1)}),A={...A,items:W?A.items:[...A.items,Q]}}else A={items:[Q]};Pl().update({formData:A,status:"draft"}),U.handle===$s&&v({hideCheckout:!0})}catch{}finally{u.value=!1}},g=async()=>{try{if(u.value)return;u.value=!0;const T={quantity:1,product_id:s.item.product_id,product_sku:s.item.product_sku},{data:A}=await Xe.cart.add(T);A.success&&(U.cart=A.data,r("open-flow-checkout"),ECG.sync.emit("cart",{source:"easy-ai-chat",data:A.data}))}catch(T){console.log("ecg error: ",T)}finally{u.value=!1}};function p(){U.handle===On?g():U.handle===li?_(s.item.sku):U.handle===xr?w():U.handle===ro?S():U.handle===rs?E():U.handle===kr?k():h(),O("add_to_cart",{product_id:s.item.product_sku,name:s.item.title,price:s.item.price,quantity:1})}const v=async(T={})=>{let{title:A,image:D,source:Q}=s.item;const W=M(),H=await Tr(D);H.status||(D=i);const K=co({title:A,image:D,source:Q,isImageValid:H.status,cartUrl:W,...T});r("send-message",K)};async function _(T){if(u.value)return;const A="https://mediamart.vn/cart/add-items/";try{if(!T)throw new Error("Product IDs are required");u.value=!0;let D="";if(Array.isArray(T)){if(T.length===0)throw new Error("Product IDs array cannot be empty");T.forEach(H=>{if(!H||H<=0)throw new Error("All product IDs must be positive numbers")}),D=T.join(",")}else{if(T<=0)throw new Error("Product ID must be a positive number");D=T.toString()}const Q=A+D+"?utm_source=easyai",W=await fetch(Q,{method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}});if(!W.ok){const H=await W.text();throw console.log("Error response:",H),new Error(`HTTP error! status: ${W.status} - ${H}`)}await W.text(),d.value=!0,v()}catch(D){console.error("Error adding items to cart:",D)}finally{u.value=!1}}async function w(){var T;try{if(u.value)return;u.value=!0;const A=await yv().addToCart({productId:s.item.product_id,quantity:1,serviceIds:[],giftItems:[],selectedReceiveAtWarehouse:!1});if(A&&A.data){d.value=!0,v();const D=(T=A.data.products)==null?void 0:T.reduce((H,K)=>H+K.quantity,0),Q=document.querySelector('a[href="/checkout/cart"] .bg-product-salePrice'),W=document.querySelector("#bottomMobileTab .bg-red.rounded-full");Q&&(Q.textContent=D||0),W&&(W.textContent=D||0)}u.value=!1}catch(A){console.error("Error adding items to cart:",A)}finally{u.value=!1}}async function k(){var T,A;try{if(u.value)return;u.value=!0;const H=(((s.item.links||{}).variants||[])[0]||{}).rule_id||"",K=s.item.product_id||s.item.product_sku||((A=(T=s.item.source)==null?void 0:T.match(/pid(\d+)/))==null?void 0:A[1])||"",J=await _v().addToCart({productId:K,ruleId:H,quantity:1});J&&J.success&&(d.value=!0,v())}catch(D){console.error("ViettelStore: Error adding to cart:",D)}finally{u.value=!1}}async function S(){try{if(u.value)return;u.value=!0;const T=await bv().addToCart({variantId:s.item.product_id,quantity:1});T&&T.success&&(d.value=!0,v()),u.value=!1}catch(T){console.error("Error adding items to cart:",T)}finally{u.value=!1}}async function E(){var T;try{if(u.value)return;const A=(T=s.item.links)==null?void 0:T.purchase_info;if(!A||!A.purchasable||!A.product_id)return;u.value=!0;const D=`${A.product_id}-${A.product_type??0}`,Q=new FormData;Q.append("action","create"),Q.append("item_type","product"),Q.append("item_id",D),Q.append("props[quantity]",1);const H=await(await fetch("https://www.phucanh.vn/ajax/cart.php",{method:"POST",body:Q})).json();if(console.log(H),(H.status==="success"||H.status==="error"&&H.error_type==="item-in-cart")&&(H.status==="error"&&H.error_type==="item-in-cart"&&pn.actions.warning({message:H.message||"Sản phẩm đã tồn tại trong giỏ hàng"}),H.status==="success")){d.value=!0;const K=document.getElementById("count_shopping_cart_store");if(K){const J=parseInt(K.textContent)||0;K.textContent=J+1}v()}}catch(A){console.error("Error adding items to cart Phuc Anh:",A)}finally{u.value=!1}}function O(T,A={}){["hotline","add_to_cart","checkout"].includes(T)&&Qt.ctaClick({type:T,...A})}function I(T,A={}){["product","page"].includes(T)&&Qt.linkClick({type:T,...A})}const P=()=>{const{image:T,image_url:A}=s.item;return T||(Array.isArray(A)&&A[0]?A[0]:(o.value=!0,null))},M=()=>({[xr]:"/checkout/cart?utm_source=easyai&utm_medium=productcard",[li]:"/cart?utm_source=easyai&utm_medium=productcard",[ro]:"/cart?utm_source=easyai&utm_medium=productcard",[kr]:"/gio-hang.html?utm_source=easyai&utm_medium=productcard",[rs]:"/cart?utm_source=easyai&utm_medium=productcard"})[U.handle]||"/cart";return(T,A)=>{var D,Q,W,H,K,J,te,ge,ue,we;return m(),x("div",_z,[l("div",xz,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:c.value?"_blank":"_self",onClick:A[1]||(A[1]=Ee=>I("product",{url:e.item.source})),class:"rounded overflow-hidden w-[110px] h-[110px] flex items-center justify-center mr-3 flex-shrink-0"},{default:Se(()=>[P()&&!o.value?(m(),x("img",{key:0,src:P(),alt:e.item.title,class:"object-contain w-full h-full",onError:A[0]||(A[0]=()=>o.value=!0)},null,40,wz)):(m(),x("img",{key:1,src:y(i),alt:e.item.title,class:"object-cover overflow-hidden w-8 h-8 rounded-full"},null,8,kz))]),_:1},8,["href","target"])),l("div",Sz,[(m(),oe(Nt(e.item.source?"a":"div"),{href:e.item.source,target:c.value?"_blank":"_self",onClick:A[2]||(A[2]=Ee=>I("product",{url:e.item.source})),class:"text-sm font-medium text-gray-900 line-clamp-2 group-hover:text-primary",style:{"word-break":"break-word"}},{default:Se(()=>[We(j(e.item.title),1)]),_:1},8,["href","target"])),!e.item.price&&!e.item.rating&&e.item.description?(m(),x("p",Cz,j(e.item.description),1)):z("",!0),l("div",$z,[l("div",Tz,[e.item.texts&&e.item.texts.price?(m(),x("div",Az,j(e.item.texts.price),1)):e.item.price?(m(),x("div",Ez,j(y(et)(e.item.price,{currency:e.item.currency})),1)):(m(),x("div",Iz,"Liên hệ"))]),e.item.old_price>0&&e.item.old_price!==e.item.price?(m(),x("del",Pz,j(y(et)(e.item.old_price,{currency:e.item.currency})),1)):z("",!0)]),Number(e.item.rating)||e.item.review_count?(m(),x("div",Mz,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:ht({"--rating":Number(e.item.rating)})},null,4)):z("",!0),e.item.review_count?(m(),x("div",Oz," ("+j(e.item.review_count)+") ",1)):z("",!0)])):z("",!0)])]),d.value?(m(),x("div",Lz,[l("a",{href:M(),onClick:A[3]||(A[3]=Ee=>O("checkout",{product_id:e.item.product_id||e.item.product_sku,name:e.item.title,price:e.item.price,quantity:1})),class:"flex justify-center items-center p-2 w-full text-sm text-white rounded border transition-colors duration-200 bg-[#FC7600] border-[#FC7600] hover:bg-[#FC7600]/80 hover:border-[#FC7600]/80"},[G(y(ln),{"stroke-width":"1.5",size:"18",class:"mr-1"}),We(" Thanh toán ngay ")],8,Rz)])):(m(),x(_e,{key:1},[y(U).handle===y(On)||y(U).forms.order&&e.item.price&&y(U).handle!==y(_r)&&!(y(U).handle===y(rs)&&(!((D=e.item.links)!=null&&D.purchase_info)||!((W=(Q=e.item.links)==null?void 0:Q.purchase_info)!=null&&W.purchasable)||!((K=(H=e.item.links)==null?void 0:H.purchase_info)!=null&&K.product_id)))?(m(),x("button",{key:0,onClick:A[4]||(A[4]=Ee=>p()),class:ne(["flex justify-center items-center p-2.5 mt-2 w-full text-sm bg-white rounded border border-gray-200",u.value?"cursor-pointer text-gray-400":"hover:bg-primary hover:text-white hover:border-primary text-gray-600"])},[u.value?(m(),oe(tn,{key:0,class:"w-[18px] h-[18px] mr-1"})):(m(),oe(y(ln),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"})),We(" Thêm vào giỏ ")],2)):y(U).handle===y(fi)&&!e.item.price||y(U).handle===y(rs)&&(!((J=e.item.links)!=null&&J.purchase_info)||!((ge=(te=e.item.links)==null?void 0:te.purchase_info)!=null&&ge.purchasable)||!((we=(ue=e.item.links)==null?void 0:ue.purchase_info)!=null&&we.product_id))?(m(),x("a",{key:1,href:n[y(U).handle],target:"_blank",class:"flex justify-center items-center p-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[l("img",{src:y(yd),class:"w-[18px] h-[18px] mr-2"},null,8,jz),Nz],8,Dz)):y(_r)===y(U).handle?(m(),x("a",{key:2,href:"tel:19002628",onClick:A[5]||(A[5]=Ee=>O("hotline",{value:"19002628"})),class:"flex justify-center items-center p-2 mt-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[G(y(hl),{size:"18",class:"mr-2"}),Fz])):z("",!0)],64))])}}}},Symbol.toStringTag,{value:"Module"})),zz={key:0,class:"flex flex-col p-2 group"},Bz=["href"],Uz=["src","alt"],Vz=["src","alt"],Hz={class:"flex flex-col flex-1 mt-2"},Wz=["href"],Gz={class:"flex flex-wrap items-center mt-1"},Kz={class:"mr-1 text-sm font-semibold text-red-500"},Qz={key:0,class:"text-xs font-light text-gray-500"},Jz={key:0,class:"flex items-center mt-1"},Xz={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},Zz=l("div",null,"Thêm vào giỏ",-1),Yz={key:1,class:"flex p-2 border border-gray-200 group"},eB=["href"],tB=["src","alt"],nB=["src","alt"],sB={class:"flex flex-col flex-1 ml-3 min-w-0"},rB=["href"],oB={class:"flex flex-wrap items-center mt-1"},iB={class:"mr-1 text-sm font-semibold text-red-500"},aB={key:0,class:"text-xs font-light text-gray-500"},lB={key:0,class:"flex items-center mt-1"},cB={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},uB=l("div",null,"Thêm vào giỏ",-1),dB=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"CardProductRangDong",props:{item:{type:Object},type:{type:String,default:"vertical",validator:e=>["vertical","horizontal"].includes(e)}},emits:["open-flow-checkout"],setup(e,{emit:t}){const n="https://widget.geteasy.ai",s=e,r=t,o=R(!1),i=R(!1),a=Z(()=>{var d,f;return((f=(d=ae.bot.config)==null?void 0:d.ui)==null?void 0:f.logo)||`${n}/link.png`}),c=async()=>{try{if(i.value)return;i.value=!0;const d={quantity:1,product_id:s.item.product_id,product_sku:s.item.product_sku},{data:f}=await Xe.cart.add(d);f.success&&(U.cart=f.data,r("open-flow-checkout"),ECG.sync.emit("cart",{source:"easy-ai-chat",data:f.data}))}catch(d){console.log("ecg error: ",d)}finally{i.value=!1}},u=()=>{var f,h,g,p;const d=lo(s.item)??{};((h=(f=d.links)==null?void 0:f.variants)==null?void 0:h.length)>0?($m.actions.setSelectedProduct({...d,options:((g=d.links)==null?void 0:g.options)??[],variants:((p=d.links)==null?void 0:p.variants)??[]}),$m.actions.toggleOpenPanelVariants(!0)):c()};return(d,f)=>e.type==="vertical"?(m(),x("div",zz,[l("a",{href:e.item.source,target:"_self",class:"rounded overflow-hidden flex items-center justify-center aspect-[1/1]"},[e.item.image&&!o.value?(m(),x("img",{key:0,src:e.item.image,alt:e.item.title,class:"object-cover w-full h-full",onError:f[0]||(f[0]=()=>o.value=!0)},null,40,Uz)):(m(),x("img",{key:1,src:a.value,alt:e.item.title,class:"object-cover overflow-hidden w-8 h-8 rounded-full"},null,8,Vz))],8,Bz),l("div",Hz,[l("a",{href:e.item.source,target:"_self",class:"text-sm font-medium text-gray-900 line-clamp-2 sm:group-hover:text-primary"},j(e.item.title),9,Wz),l("div",Gz,[l("div",Kz,j(y(et)(e.item.price,{currency:e.item.currency})),1),e.item.old_price>0&&e.item.old_price!==e.item.price?(m(),x("del",Qz,j(y(et)(e.item.old_price,{currency:e.item.currency})),1)):z("",!0)]),Number(e.item.rating)||e.item.review_count?(m(),x("div",Jz,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:ht({"--rating":Number(e.item.rating)})},null,4)):z("",!0),e.item.review_count?(m(),x("div",Xz," ("+j(e.item.review_count)+") ",1)):z("",!0)])):z("",!0)]),l("button",{onClick:f[1]||(f[1]=h=>u()),class:"flex justify-center items-center p-2 mt-4 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[i.value?(m(),oe(tn,{key:0,class:"w-[16px] h-[16px] mr-1"})):(m(),oe(y(ln),{key:1,"stroke-width":"1.5",class:"mr-1 size-[16px]"})),Zz])])):(m(),x("div",Yz,[l("a",{href:e.item.source,target:"_self",class:"flex overflow-hidden flex-shrink-0 justify-center items-center size-[100px] rounded"},[e.item.image&&!o.value?(m(),x("img",{key:0,src:e.item.image,alt:e.item.title,class:"object-cover w-full h-full",onError:f[2]||(f[2]=()=>o.value=!0)},null,40,tB)):(m(),x("img",{key:1,src:a.value,alt:e.item.title,class:"object-cover overflow-hidden w-8 h-8 rounded-full"},null,8,nB))],8,eB),l("div",sB,[l("a",{href:e.item.source,target:"_self",class:"text-sm font-medium text-gray-900 line-clamp-2 sm:group-hover:text-primary"},j(e.item.title),9,rB),l("div",oB,[l("div",iB,j(y(et)(e.item.price,{currency:e.item.currency})),1),e.item.old_price>0&&e.item.old_price!==e.item.price?(m(),x("del",aB,j(y(et)(e.item.old_price,{currency:e.item.currency})),1)):z("",!0)]),Number(e.item.rating)||e.item.review_count?(m(),x("div",lB,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:ht({"--rating":Number(e.item.rating)})},null,4)):z("",!0),e.item.review_count?(m(),x("div",cB," ("+j(e.item.review_count)+") ",1)):z("",!0)])):z("",!0),l("button",{onClick:f[3]||(f[3]=h=>u()),class:"flex justify-center items-center p-1.5 mt-2 w-full text-sm text-gray-600 bg-white rounded border border-gray-200 hover:bg-primary hover:text-white hover:border-primary"},[i.value?(m(),oe(tn,{key:0,class:"w-[16px] h-[16px] mr-1"})):(m(),oe(y(ln),{key:1,"stroke-width":"1.5",class:"mr-1 size-[16px]"})),uB])])]))}}},Symbol.toStringTag,{value:"Module"})),xv=()=>{var n,s;return(ae.state.handle||((s=(n=window==null?void 0:window.EAI)==null?void 0:n._config)==null?void 0:s.handle))===On},Gn={addToCart:[".rangdong-add-to-cart"],buyNow:[".btn-buy-now",".rangdong-buy-now"],cartSize:[".cart-box .badge"],cartTotalPrice:[".flex.items-center.justify-between.caption .font-medium.text-red-400.body-text"],purchaseTotalPrice:[".rangdong-purchase-total-price"],quantityInput:["#quantity-product"],purchaseCustomerName:[".rangdong-purchase-customer-name"],purchaseCustomerPhone:[".rangdong-purchase-customer-phone"],purchaseCustomerEmail:[".rangdong-purchase-customer-email"],purchaseCustomerShippingAddress:[".rangdong-purchase-shipping-address"],purchaseCustomerDeliveryMethod:[".rangdong-purchase-delivery-method-name"],purchaseCustomerPaymentGateway:[".rangdong-purchase-payment-gateway-name"]},jl={category:/^\/([a-z0-9-]+)-c-(\d+)\/?$/,product:/^\/([a-z0-9-]+)-p-(\d+)$/,search:/^\/tim-kiem\?keyword=([^&]+)/,checkout:/^\/don-hang\/?$/,purchase:/^\/dat-hang-thanh-cong\?orderId=([^&]+)/};let bd=[];const wv=(e,t)=>{const n=e.match(t);return(n==null?void 0:n[2])||null},fB=e=>{const t=e.match(jl.purchase);return(t==null?void 0:t[1])||null},kv=e=>{for(const[t,n]of Object.entries(jl))if(n.test(e))return t;return"unknown"},hB=e=>{if(!e.includes("?"))return{};const[,t]=e.split("?"),n={};return new URLSearchParams(t).forEach((s,r)=>{n[r]=s}),n},pB=()=>{var e;for(const t of Gn.cartSize){const n=document.querySelector(t);if(n)return((e=n.textContent)==null?void 0:e.trim())||"0"}return"0"},mB=()=>{var e;for(const t of Gn.cartTotalPrice){const n=document.querySelector(t);if(n)return((e=n.textContent)==null?void 0:e.trim())||"0"}return"0"},gB=()=>{var e;for(const t of Gn.purchaseTotalPrice){const n=document.querySelector(t);if(n)return((e=n.textContent)==null?void 0:e.trim())||"0"}return"0"},vB=()=>{var e;for(const t of Gn.quantityInput){const n=document.querySelector(t);if(n)return((e=n.value)==null?void 0:e.trim())||"1"}return"1"},wo=e=>{var t;for(const n of e){const s=document.querySelector(n);if(s)return((t=s.innerText)==null?void 0:t.trim())||""}return""},yB=()=>({name:wo(Gn.purchaseCustomerName),phone:wo(Gn.purchaseCustomerPhone),email:wo(Gn.purchaseCustomerEmail),shipping_address:wo(Gn.purchaseCustomerShippingAddress),delivery_method:wo(Gn.purchaseCustomerDeliveryMethod),payment_gateway:wo(Gn.purchaseCustomerPaymentGateway)}),bB=()=>{bd.forEach(({element:e,event:t,handler:n})=>{e.removeEventListener(t,n)}),bd=[]},_B=(e,t,n,s)=>{const r=vB();Fe.addToCart({id:e??"",name:t??"",price:n??"",image:s??"",quantity:r,brand:"Rạng Đông"})},xB=(e,t,n,s)=>{const r=[];if(Gn.addToCart.forEach(i=>{const a=document.querySelectorAll(i);r.push(...a)}),Gn.buyNow.forEach(i=>{const a=document.querySelectorAll(i);r.push(...a)}),r.length===0)return;const o=()=>{_B(e,t,n,s)};r.forEach(i=>{i.addEventListener("click",o),bd.push({element:i,event:"click",handler:o})})},wB=()=>{const e=pB(),t=mB();Fe.checkout({cart_size:e,cart_total_price:t})},kB=e=>{const t=fB(e),n=gB(),s=yB();Fe.purchase({order_id:t??"",total_value:n??"",customer:s})};ki(e=>{if(!xv())return;switch(kv(e)){case"search":const{keyword:n}=hB(e);Fe.search({search_term:n??""});break;case"purchase":setTimeout(()=>{kB(e)},1500);break}},!0),Am(e=>{bB();const t=()=>{var r;const n=kv(e),s=os("Product")||{};switch(n){case"category":const o=wv(e,jl.category);Fe.categoryView({category_id:o??"",name:s.name??s.title??"",brand:"Rạng Đông",image:s.image??"",url:window.location.href});break;case"product":const a={id:wv(e,jl.product)??s.productID??"",sku:s.sku??"",name:s.name??s.title??"",brand:"Rạng Đông",price:((r=s.offers)==null?void 0:r.price)??"",image:s.image??"",url:window.location.href};Fe.productView(a),setTimeout(()=>{xB(a.product_id,a.name,a.price,a.image)},1500);break;case"checkout":setTimeout(()=>{wB()},1500);break}};setTimeout(()=>{xv()&&t()},1e3)},!0);const SB=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),CB=(e,t)=>{let n;return(...s)=>{n&&clearTimeout(n),n=setTimeout(()=>{e.apply(null,s)},t)}},$B=()=>window.location.hostname==="m.pico.vn",TB=()=>{var n,s;return(ae.state.handle||((s=(n=window==null?void 0:window.EAI)==null?void 0:n._config)==null?void 0:s.handle))===xr},AB={cart:/^\/checkout\/cart\/?$/,purchase:/^\/checkout\/confirm\/?$/,login:/^\/login\/?$/,register:/^\/register\/?$/,category:/^\/[a-z0-9-]+\.c\/?$/,product:/^\/[a-z0-9-]+-[A-Z0-9]+$/},Sv={productCard:[".productCardSwp",".itemProducts"],addToCartButton:["#add-to-cart","#buy-now","#installment"]},Cv=e=>{if(!e.includes("?"))return{};const t={};return new URLSearchParams(e.split("?")[1]).forEach((n,s)=>{t[s]=n}),t},EB=e=>Cv(e).query||null,IB=e=>e.split("/").filter(Boolean).length===1,PB=e=>{const t=new URL(e,window.location.origin).pathname;if(os("CollectionPage"))return"category";for(const[s,r]of Object.entries(AB))if(r.test(t))return s;return"unknown"},ko=e=>{const t=e==null?void 0:e.match(/([\d.]+(?:\s*đ)?)/i);return t?t[0].trim():null},_d=e=>{const t=e==null?void 0:e.match(/-([A-Z0-9]+)$/);return t?t[1]:null},MB=()=>{var s,r;const e=os("CollectionPage");if(e){let o=e.name;if(!o){const i=Ts();o=i==null?void 0:i.title}if(!o){const i=document.querySelector("title");o=(s=i==null?void 0:i.textContent)==null?void 0:s.trim()}return{name:o||"null",brand:"Pico",url:window.location.href,description:e.description||""}}const t=Ts();let n=t==null?void 0:t.title;if(!n){const o=document.querySelector("title");n=(r=o==null?void 0:o.textContent)==null?void 0:r.trim()}return{name:n||"null",brand:"Pico",url:window.location.href}},OB=()=>{setTimeout(()=>Fe.categoryView(MB()),1e3)},LB=e=>{const t=new URL(e,window.location.origin).pathname,n=IB(t)?EB(e):null;n&&Fe.search({search_term:n})},RB=e=>{var o;const t={},n=e.querySelector("a.line-clamp-2");n&&(t.name=(o=n.textContent)==null?void 0:o.trim(),t.product_sku=_d(n.href));const s=e.querySelector(".sale-price .text-2xl.font-extrabold.text-red-500, .sale-price p");s&&(t.price=ko(s.textContent));const r=e.querySelector(".originPrice .text-base.text-zinc-500, .originPrice p");return r&&(t.originPrice=ko(r.textContent)),t},DB=()=>{var i,a,c,u,d,f,h,g,p,v,_,w,k,S;const e=os("Product");if(e)return{id:e.sku||"",sku:e.sku||"",mpn:e.mpn||"",name:e.name||"",brand:typeof e.brand=="object"?((i=e.brand)==null?void 0:i.name)||"":e.brand||"",price:((c=(a=e.offers)==null?void 0:a.price)==null?void 0:c.toString())||"",originPrice:((d=(u=e.offers)==null?void 0:u.highPrice)==null?void 0:d.toString())||"",image:Array.isArray(e.image)?e.image[0]||"":e.image||"",url:window.location.href};const t={};t.name=((h=(f=document.querySelector("title"))==null?void 0:f.textContent)==null?void 0:h.trim())||((p=(g=document.querySelector("h1"))==null?void 0:g.textContent)==null?void 0:p.trim())||((_=(v=document.querySelector("h3.text-titleDetail"))==null?void 0:v.textContent)==null?void 0:_.trim());const n=Array.from(document.querySelectorAll("li")).find(E=>{var O,I;return(I=(O=E.querySelector(".label"))==null?void 0:O.textContent)==null?void 0:I.includes("Thương hiệu")}),s=n==null?void 0:n.querySelector("span.value a");if(s)t.brand=(w=s.textContent)==null?void 0:w.trim();else{const E=Array.from(document.querySelectorAll(".highLightSpec .label")).find(O=>{var I;return(I=O.textContent)==null?void 0:I.includes("Thương hiệu")});if(E){const O=(k=E.closest(".relative"))==null?void 0:k.querySelector(".value span");O&&(t.brand=(S=O.textContent)==null?void 0:S.trim())}}t.product_sku=_d(window.location.pathname);const r=[".text-2xl.font-extrabold.text-red-600",".text-2xl.font-extrabold.text-red-500",".entry-price .text-3xl.font-extrabold.text-orange",".entry-price .text-3xl.font-extrabold.text-white"];for(const E of r){const O=document.querySelector(E);if(O){t.price=ko(O.textContent);break}}const o=[".originPrice .text-base.text-zinc-500",".originPrice p",".entry-price .originPrice",".originPrice.text-dark-800"];for(const E of o){const O=document.querySelector(E);if(O){t.originPrice=ko(O.textContent);break}}return t},jB=()=>{document.addEventListener("click",e=>{for(const t of Sv.productCard){const n=e.target.closest(t);if(n){Fe.productSelect(RB(n));break}}})},NB=()=>{setTimeout(()=>Fe.productView(DB()),1500)},FB=()=>{document.querySelectorAll(Sv.addToCartButton.join(", ")).forEach(t=>{t.addEventListener("click",()=>{var r,o;const n=os("Product")||{},s={id:n.sku||"",sku:n.sku||"",name:n.name||"",url:window.location.href,price:((r=n.offers)==null?void 0:r.price)||"",image:Array.isArray(n.image)?n.image[0]||"":n.image||"",brand:typeof n.brand=="object"?((o=n.brand)==null?void 0:o.name)||"":n.brand||""};Fe.addToCart(s)})})},$v=e=>{var n;const t=e.querySelector(".cartItemAction span");return parseInt(((n=t==null?void 0:t.textContent)==null?void 0:n.trim())||"0",10)||0},qB=()=>{const e=Array.from(document.querySelectorAll(".cartItemsContent .cartItem"));if(e.length===0)return"0";const t=e.reduce((n,s)=>n+$v(s),0);return t>0?t.toString():e.length.toString()},xd=()=>{var n;const e=(n=document.querySelector(".cartTotal span:nth-child(2)"))==null?void 0:n.textContent,t=ko(e);return t||"0"},zB=()=>Array.from(document.querySelectorAll(".cartItemsContent .cartItem")).map(t=>{var d,f;const n=t.querySelector(".cartItemThumb img"),s=(n==null?void 0:n.src)||(n==null?void 0:n.getAttribute("src"))||"";let r=t.querySelector(".cartItemTitle a");const o=((d=r==null?void 0:r.textContent)==null?void 0:d.trim())||(n==null?void 0:n.getAttribute("alt"))||"";let i;i=t.querySelector(".cartItemPrice p:first-child");const a=((f=i==null?void 0:i.textContent)==null?void 0:f.trim())||"",c=ko(a),u=$v(t);return{name:o,image:s,price:c,quantity:u}}),BB=()=>{setTimeout(()=>{const e=qB();e!=="0"&&Fe.cartView({cart_size:e,cart_total_price:xd()})},1500)},UB=()=>{document.addEventListener("click",e=>{var r,o;const t=e.target.closest(".cartItemDelete, button[class*='cartItemDelete'], [data-remove-cart], [data-delete-cart], button[class*='remove'], button[class*='delete'], [aria-label*='xóa'], [aria-label*='remove'], [aria-label*='delete']");if(!t)return;const n=t.closest(".cartItem, [class*='cartItem'], [class*='cart-item'], [data-cart-item]"),s={};if(n){const i=n.querySelector("a, h3, h4, [class*='name'], [class*='title']");i&&(s.name=(r=i.textContent)==null?void 0:r.trim()),s.product_sku=_d((o=n.querySelector("a[href]"))==null?void 0:o.href)}Fe.removeFromCart(s)})},VB=()=>{var r;const e=()=>{const o=zB(),i=o.reduce((c,u)=>c+u.quantity,0).toString();Fe.checkout({cart_size:i,cart_total_price:xd(),products:o});const a={total_value:xd(),products:o};sessionStorage.setItem("pico_checkout",JSON.stringify(a))},t=document.querySelector("#btnCheckout");if(t){t.addEventListener("click",e);return}const n=['button[type="submit"]',"[data-checkout]","[class*='checkout']","[class*='thanh-toan']","[class*='dat-hang']"],s=["thanh toán","đặt hàng","checkout"];for(const o of n)for(const i of document.querySelectorAll(o)){const a=((r=i.textContent)==null?void 0:r.toLowerCase())||"";if(s.some(c=>a.includes(c))){i.addEventListener("click",e);return}}},HB=()=>{var i,a,c,u,d,f,h,g,p;const e={},t=$B(),n=document.querySelector('input[name="shippingMethod"]:checked');if(n){const v=n.value,_={standard:"Giao hàng tận nơi",pickUpInStore:"Nhận tại cửa hàng"};e.delivery_method=_[v]||v}if(t){const v=document.querySelectorAll('.flex.flex-col .relative.w-full button[type="button"]');if(v.length>0){const _=(c=(a=(i=v[0])==null?void 0:i.querySelector(".truncate"))==null?void 0:a.textContent)==null?void 0:c.trim();_&&_!=="Chọn thành phố"&&(e.city=_)}if(v.length>1){const _=(f=(d=(u=v[1])==null?void 0:u.querySelector(".truncate"))==null?void 0:d.textContent)==null?void 0:f.trim();_&&_!=="Chọn quận huyện"&&(e.district=_)}if(v.length>2){const _=(p=(g=(h=v[2])==null?void 0:h.querySelector(".truncate"))==null?void 0:g.textContent)==null?void 0:p.trim();_&&_!=="Chọn phường xã"&&(e.ward=_)}}else{const v=document.querySelector('input[name="provinceCode[name]"]');v!=null&&v.value&&(e.city=v.value.trim());const _=document.querySelector('input[name="districtCode[name]"]');_!=null&&_.value&&(e.district=_.value.trim());const w=document.querySelector('input[name="wardCode[name]"]');w!=null&&w.value&&(e.ward=w.value.trim())}const s=document.querySelector('input[name="address"][placeholder="Nhập số nhà, tên đường"]');let r="";s!=null&&s.value&&(r=s.value.trim());const o=[r,e.ward,e.district,e.city].filter(Boolean);if(o.length>0&&(e.address=o.join(", ")),e.delivery_method==="pickup"){const v=document.querySelector('input[name="storeCode[name]"]');v!=null&&v.value&&(e.store_name=v.value.trim())}return e},WB=()=>{const e=()=>{const r=HB();Object.keys(r).length>0&&Fe.addShippingInfo(r)},t=CB(e,1e3);document.querySelectorAll('input[name="shippingMethod"]').forEach(r=>{r.addEventListener("change",e,!0)});const n=document.querySelector('input[name="address"][placeholder="Nhập số nhà, tên đường"]');n&&n.addEventListener("input",t,!0),['input[name="provinceCode[name]"]','input[name="districtCode[name]"]','input[name="wardCode[name]"]'].forEach(r=>{const o=document.querySelector(r);o&&(new MutationObserver(t).observe(o,{attributes:!0,attributeFilter:["value"]}),o.addEventListener("input",t,!0),o.addEventListener("change",t,!0))})},GB=()=>{const e=()=>{var s,r;const t=document.querySelector('input[name*="payment"]:checked, input[type="radio"][name*="payment"]:checked, select[name*="payment"]');if(!t)return;const n={method_id:t.id||t.value,method_name:t.getAttribute("data-name")||((r=(s=t.closest("label"))==null?void 0:s.textContent)==null?void 0:r.trim())};Object.keys(n).forEach(o=>!n[o]&&delete n[o]),Object.keys(n).length>0&&Fe.addPaymentInfo(n)};document.querySelectorAll('input[name*="payment"], select[name*="payment"]').forEach(t=>{t.addEventListener("change",e,!0)})},KB=e=>{const t={},n=Cv(window.location.href);n.orderNumberId&&(t.order_id=n.orderNumberId);const s=document.body.innerHTML.match(/Đơn hàng:\s*#([A-Z0-9]+)/);if(s&&(t.order_number=s[1]),e)try{const i=JSON.parse(e);t.total_value=i.total_value||"",t.products=i.products||[]}catch(i){console.error("Failed to parse pico checkout data:",i),t.total_value="",t.products=[]}else t.total_value="",t.products=[];const r={gender:"",name:"",phone:"",email:"",shipping_address:"",payment_gateway:"",delivery_method:""},o=document.querySelector(".checkoutPaymentOrderAddress");if(o){const i=o.innerHTML.match(/Khách hàng:<\/span>\s*<span[^>]*>([^-]+)-\s*([\d\s]+)</);i&&(r.name=i[1].trim(),r.phone=i[2].trim().replace(/\s/g,""));const a=o.innerHTML.match(/Giao đến:<\/span>\s*<span[^>]*>([^<]+)</);a&&(r.shipping_address=a[1].trim());const c=o.innerHTML.match(/Hình thức thanh toán:<\/span>\s*<span[^>]*>([^<]+)</);c&&(r.payment_gateway=c[1].trim())}if(!r.name||!r.phone)try{const i=localStorage.getItem("guestInfo");if(i){const a=JSON.parse(i);if(r.gender||(r.gender=a.gender||""),r.name||(r.name=a.name||""),r.phone||(r.phone=a.phone||""),!r.payment_gateway){const c={COD:"Thanh toán khi nhận hàng (COD)",bankTransfer:"Chuyển khoản ngân hàng",creditCard:"Thẻ tín dụng/Ghi nợ"};r.payment_gateway=c[a.payment]||c.COD}}}catch{}return r.delivery_method="",t.customer=r,t};let wd=!1;const QB=()=>{if(wd)return;const e=sessionStorage.getItem("pico_checkout");e&&setTimeout(()=>{const t=KB(e);t.order_id&&(Fe.purchase(t),wd=!0,setTimeout(()=>wd=!1,6e4),sessionStorage.removeItem("pico_checkout"))},1500)},JB=e=>{var n,s;const t=(s=(n=e.querySelector('input[name="phone"]'))==null?void 0:n.value)==null?void 0:s.trim();return t?{phone:t}:{}},XB=e=>{var o,i,a,c,u,d;const t={},n=(i=(o=e.querySelector('input[name="name"]'))==null?void 0:o.value)==null?void 0:i.trim(),s=(c=(a=e.querySelector('input[name="phone"]'))==null?void 0:a.value)==null?void 0:c.trim(),r=(d=(u=e.querySelector('input[name="email"]'))==null?void 0:u.value)==null?void 0:d.trim();return n&&(t.name=n),s&&(t.phone=s),r&&(t.email=r),t},ZB=()=>{const e=document.querySelector("form");e&&e.addEventListener("submit",t=>{const n=JB(e);n.phone&&sessionStorage.setItem("pico_login_data",JSON.stringify(n))},!0)},Tv=()=>{let e=!1;const t=()=>{var o,i;if(e)return;const s=['[aria-haspopup="menu"] span','[id*="radix"] span'];let r=null;for(const a of s){const c=document.querySelectorAll(a);for(const u of c){const d=(o=u.textContent)==null?void 0:o.trim();if(d&&d.includes("Chào,")){r=d;break}}if(r)break}if(!r){const a=document.querySelectorAll("span");for(const c of a){const u=(i=c.textContent)==null?void 0:i.trim();if(u&&u.includes("Chào,")){r=u;break}}}if(r&&r.includes("Chào,")){const a=sessionStorage.getItem("pico_login_data");if(a)try{const c=JSON.parse(a),u=r.match(/Chào,\s*(.+)/);u&&u[1]&&(c.name=u[1].trim()),Fe.login(c),sessionStorage.removeItem("pico_login_data"),e=!0}catch{}}};setTimeout(t,1e3),new MutationObserver(()=>{t()}).observe(document.body,{childList:!0,subtree:!0})},YB=()=>{const e=s=>{var i;const r=document.querySelector("h3.text-HeadlineLarge"),o=(i=r==null?void 0:r.textContent)==null?void 0:i.trim();if(o&&o.includes("Đăng ký tài khoản thành công")){const a=sessionStorage.getItem("pico_signup_data");if(a)try{const c=JSON.parse(a);Fe.signUp(c),sessionStorage.removeItem("pico_signup_data"),s&&s.disconnect()}catch{}}};setTimeout(()=>e(null),500);const t=new MutationObserver(()=>{e(t)});t.observe(document.body,{childList:!0,subtree:!0});const n=document.querySelector("form");n&&n.addEventListener("submit",s=>{const r=XB(n);(r.phone||r.email)&&sessionStorage.setItem("pico_signup_data",JSON.stringify(r))},!0)},eU=()=>{},tU=()=>{const e=document.getElementById("contact");e&&e.addEventListener("click",()=>{setTimeout(()=>{const t=document.getElementById("headlessui-portal-root");if(!t)return;const n=t.querySelector("form");if(!n)return;const s=()=>{const r={};n.querySelectorAll("input, select, textarea").forEach(a=>{const c=a.name||a.id||"unnamed";a.type==="checkbox"?r[c]=a.checked:a.type==="radio"?a.checked?r[c]=a.value:r[c]||(r[c]=null):r[c]=a.value});const o=r.name||"",i=r.phone||"";if(o&&i){const a=os("Product")||{};Fe.generateLead({name:o,phone:i,demand:"Tư vấn sản phẩm "+(a.name||""),url:window.location.href})}};n.addEventListener("submit",s)},2e3)})},nU=e=>{const t=PB(e);switch(LB(e),t){case"category":OB();break;case"product":NB(),setTimeout(()=>{FB(),tU()},1500);break;case"cart":BB(),UB(),setTimeout(()=>{VB(),WB(),GB()},1500);break;case"purchase":QB();break;case"login":setTimeout(ZB,500),Tv();break;case"register":setTimeout(YB,500);break;default:Tv();break}};ki(e=>{TB()&&nU(e)},!0),jB(),setTimeout(eU,1500);const sU=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),rU=(e,t)=>{let n;return(...s)=>{n&&clearTimeout(n),n=setTimeout(()=>{e.apply(null,s)},t)}},oU=()=>{var n,s;return(ae.state.handle||((s=(n=window==null?void 0:window.EAI)==null?void 0:n._config)==null?void 0:s.handle))==="laptop88vn"},iU={cart:/^\/cart$/,contact:/^\/lien-he$/},Nl={addToCartButton:[".buy-now.btn-add"],removeFromCartButton:[".delete-from-cart"],promotionBanner:["#wrapPopup #popupContact a",".banner-sale a",".owl-stage .owl-item a",".banner-sale-detail a"],productCard:[".product-item",".product-item.js-pro-item"]},aU=()=>!!document.querySelector(".product-detail"),lU=()=>!!document.querySelector(".product-category"),cU=()=>!!document.querySelector(".send-cart");let bn=[],Av=[];const uU=()=>{bn.forEach(({element:e,event:t,handler:n,options:s})=>{e.removeEventListener(t,n,s)}),bn=[],Av.forEach(e=>{e.disconnect()}),Av=[]},So=e=>e?e.replace(/\D/g,""):"",dU=e=>{for(const[t,n]of Object.entries(iU))if(n.test(e))return t;return"unknown"},fU=()=>{const e=document.querySelector(".search-form"),t=document.getElementById("js-search");if(!e||!t)return;const n=()=>{var r;const s=(r=t.value)==null?void 0:r.trim();s&&Fe.search({search_term:s})};e.addEventListener("submit",n),bn.push({element:e,event:"submit",handler:n})},hU=()=>{var n;const e=Ts();if(e&&e.title)return{name:e.title,brand:null,image:e.image||"",url:window.location.href};const t=document.querySelector("h1");return{name:((n=t==null?void 0:t.textContent)==null?void 0:n.trim())||"",brand:null,image:ms()||"",url:window.location.href}},pU=()=>{setTimeout(()=>{const e=hU();e.name&&Fe.categoryView(e)},1500)},mU=e=>{var p,v;const t=e.getAttribute("data-id")||"",n=e.querySelector(".product-title a"),s=((p=n==null?void 0:n.textContent)==null?void 0:p.trim())||"",r=e.querySelector(".product-img a")||e.querySelector(".product-title a"),o=(r==null?void 0:r.href)||"",i=e.querySelector(".product-img img"),a=(i==null?void 0:i.src)||"",c=e.querySelector(`.item-price, .js-price-configurable-${t}`),u=c?So(c.textContent):"",d=e.querySelector(".old-price"),f=d?So(d.textContent):"",h=e.querySelector(".price-saleoff"),g=((v=h==null?void 0:h.textContent)==null?void 0:v.trim())||"";return{id:t,name:s,url:o,price:u,originalPrice:f,discount:g,image:a}},Ev=()=>{document.querySelectorAll(Nl.productCard.join(", ")).forEach(t=>{t.querySelectorAll(".product-img a, .product-title a").forEach(s=>{const r=()=>{const o=mU(t);o.name&&Fe.productSelect(o)};s.addEventListener("click",r),bn.push({element:s,event:"click",handler:r})})})},Iv=()=>{var i;let e={id:"",sku:"",name:"",url:window.location.href,price:"",originalPrice:"",discount:"",image:"",quantity:1,brand:null};const t=Ts();t&&(e.name=t.title||"",e.image=t.image||ms()||"");const n=document.querySelector(".buy-now.btn-add");n&&(e.id=n.getAttribute("data-id")||""),e.sku=new URLSearchParams(window.location.search).get("sku")||"";const s=document.querySelector(".product-detail .main-product-mid .price");s&&(e.price=s.getAttribute("data-price")||So(s.textContent));const r=document.querySelector(".product-detail .main-product-mid .old-price");r&&(e.originalPrice=So(r.textContent));const o=document.querySelector(".product-detail .main-product-mid .saleof-price");return o&&(e.discount=((i=o.textContent)==null?void 0:i.trim())||""),e.image||(e.image=ms()||""),e},gU=()=>{setTimeout(()=>{const e=Iv();e.name&&Fe.productView(e)},1500)},vU=()=>{document.querySelectorAll(Nl.addToCartButton.join(", ")).forEach(t=>{const n=()=>{const s=Iv();s.name&&Fe.addToCart(s)};t.addEventListener("click",n),bn.push({element:t,event:"click",handler:n})})},kd=()=>{const e=document.querySelectorAll(".js-item-row");return Array.from(e).map(t=>{var c,u,d;const n=((c=t.querySelector(".cart-image img"))==null?void 0:c.src)||"",s=((d=(u=t.querySelector(".name-product a"))==null?void 0:u.textContent)==null?void 0:d.trim().replace(/\s+/g," "))||"",r=t.querySelector(".buy-price"),o=(r==null?void 0:r.value)||"",i=t.querySelector(".buy-quantity"),a=parseInt((i==null?void 0:i.value)||"1",10);return{image:n,name:s,price:o,quantity:a}})},Pv=()=>kd().reduce((n,s)=>n+s.quantity,0).toString(),Mv=()=>{var t,n;const e=((n=(t=document.querySelector(".total-cart-price"))==null?void 0:t.textContent)==null?void 0:n.trim())||"";return So(e)},yU=()=>{setTimeout(()=>{const e=Pv(),t=Mv(),n=kd();Fe.cartView({cart_size:e,cart_total_price:t,products:n})},1500)},bU=()=>{document.querySelectorAll(Nl.removeFromCartButton.join(", ")).forEach(t=>{const n=()=>{var r;const s=t.closest(".js-item-row");if(s){const o=s.querySelector(".name-product a"),i=((r=o==null?void 0:o.textContent)==null?void 0:r.trim().replace(/\s+/g," "))||"",a=(o==null?void 0:o.href)||"",c=s.querySelector(".cart-image img"),u=(c==null?void 0:c.src)||"",d=s.querySelector(".buy-price"),f=(d==null?void 0:d.value)||"",h=s.querySelector(".buy-quantity"),g=parseInt((h==null?void 0:h.value)||"1",10);Fe.removeFromCart({name:i,url:a,image:u,price:f,quantity:g})}};t.addEventListener("click",n),bn.push({element:t,event:"click",handler:n})})},Ov=()=>{var c,u;const e={},t=document.getElementById("buyer_name");t!=null&&t.value&&(e.name=t.value.trim());const n=document.getElementById("buyer_tel");n!=null&&n.value&&(e.phone=n.value.trim());const s=document.getElementById("buyer_email");s!=null&&s.value&&(e.email=s.value.trim());const r=document.getElementById("buyer_address");r!=null&&r.value&&(e.address=r.value.trim());const o=document.querySelector('input[name="ship_method"]:checked');if(o){const d=o.nextElementSibling;d&&(e.delivery_method=((c=d.textContent)==null?void 0:c.trim())||"")}const i=document.querySelector('input[name="location"]:checked');i!=null&&i.value&&(e.store_location=i.value.trim());const a=document.querySelector('input[name="pay_method"]:checked');if(a){const d=document.querySelector(`label[for="${a.id}"]`);d&&(e.payment_gateway=((u=d.textContent)==null?void 0:u.trim())||"Thanh toán khi nhận hàng (COD)")}else e.payment_gateway="Thanh toán khi nhận hàng (COD)";return e},_U=()=>{const e=document.getElementById("formCart");if(!e)return;const t=()=>{const a=Ov();Object.keys(a).length>0&&Fe.addShippingInfo(a)},n=rU(t,1e3);["#buyer_name","#buyer_tel","#buyer_email","#buyer_address"].forEach(a=>{const c=e.querySelector(a);c&&(c.addEventListener("input",n,!0),bn.push({element:c,event:"input",handler:n,options:!0}))}),e.querySelectorAll('input[name="ship_method"]').forEach(a=>{a.addEventListener("change",t,!0),bn.push({element:a,event:"change",handler:t,options:!0})}),e.querySelectorAll('input[name="location"]').forEach(a=>{a.addEventListener("change",t,!0),bn.push({element:a,event:"change",handler:t,options:!0})}),e.querySelectorAll('input[name="pay_method"]').forEach(a=>{a.addEventListener("change",t,!0),bn.push({element:a,event:"change",handler:t,options:!0})})},xU=()=>{const e=document.getElementById("btn-submit");if(!e)return;const t=()=>{const n=Pv(),s=Mv(),r=kd(),o=Ov();Fe.checkout({cart_size:n,cart_total_price:s,products:r,...o});const i={customer:{name:o.name||"",phone:o.phone||"",email:o.email||"",shipping_address:o.address||"",delivery_method:o.delivery_method||"",store_location:o.store_location||"",payment_gateway:o.payment_gateway||"Thanh toán khi nhận hàng (COD)"},products:r};sessionStorage.setItem("laptop88_checkout",JSON.stringify(i))};e.addEventListener("click",t),bn.push({element:e,event:"click",handler:t})},wU=()=>{const e={},t=document.querySelectorAll(".block-box-info .item-info");t.forEach(s=>{const r=s.textContent;if(r.includes("Mã đơn hàng:")){const o=r.match(/#(\d+)/);o&&(e.order_id=o[1],e.order_number=o[1])}});const n=sessionStorage.getItem("laptop88_checkout");if(n)try{const s=JSON.parse(n);e.customer=s.customer||{},e.products=s.products||[]}catch(s){console.error("Failed to parse checkout data:",s),e.customer={},e.products=[]}else{e.customer={},e.products=[],t.forEach(r=>{var i,a,c,u,d;const o=r.textContent;if(o.includes("Người nhận:")){const h=(i=o.split(":")[1])==null?void 0:i.trim();h&&(e.customer.name=h)}else if(o.includes("Số điện thoại:")){const h=(a=o.split(":")[1])==null?void 0:a.trim();h&&(e.customer.phone=h)}else if(o.includes("Email:")){const h=(c=o.split(":")[1])==null?void 0:c.trim();h&&(e.customer.email=h)}else if(o.includes("Địa chỉ:")){const h=(u=o.split(":")[1])==null?void 0:u.trim();h&&(e.customer.shipping_address=h)}else if(o.includes("Phương thức thanh toán:")){const h=(d=o.split(":")[1])==null?void 0:d.trim();h&&(e.customer.payment_gateway=h)}});const s=document.querySelectorAll(".product-list .product-item.js-item-row");e.products=Array.from(s).map(r=>{var f,h,g,p,v,_;const o=((f=r.querySelector(".product-img img"))==null?void 0:f.src)||"",i=((g=(h=r.querySelector(".product-info p:first-child"))==null?void 0:h.textContent)==null?void 0:g.trim())||"",a=((p=r.querySelector(".product-info p:nth-child(2)"))==null?void 0:p.textContent)||"",c=parseInt(((v=a.match(/\d+/))==null?void 0:v[0])||"1",10),u=((_=r.querySelector(".product-info p:last-child"))==null?void 0:_.textContent)||"",d=So(u);return{image:o,name:i,quantity:c,price:d}})}if(e.products&&e.products.length>0){const s=e.products.reduce((r,o)=>{const i=parseFloat(o.price)||0,a=o.quantity||1;return r+i*a},0);e.total_value=s.toString()}return e};let Sd=!1;const kU=()=>{Sd||setTimeout(()=>{const e=wU();e.order_id&&e.total_value&&(Fe.purchase(e),Sd=!0,setTimeout(()=>Sd=!1,6e4),sessionStorage.removeItem("laptop88_checkout"))},1500)},SU=()=>{const e=document.getElementById("now_submit"),t=document.getElementById("email_newsletter");if(!e||!t)return;const n=()=>{var o;const r=(o=t.value)==null?void 0:o.trim();r&&r.includes("@")&&Fe.generateLead({email:r,demand:"Khách hàng nhận thông tin khuyến mãi",url:window.location.href})};e.addEventListener("click",n),bn.push({element:e,event:"click",handler:n});const s=document.querySelector(".newleter-form");if(s){const r=o=>{o.preventDefault(),n()};s.addEventListener("submit",r),bn.push({element:s,event:"submit",handler:r})}},CU=()=>{const e=document.querySelector('input[type="submit"].btn_cyan');if(!e)return;const t=()=>{var d,f,h,g;const n=document.getElementById("contact_name"),s=document.getElementById("contact_email"),r=document.getElementById("contact_tel"),o=document.getElementById("contact_message"),i=((d=n==null?void 0:n.value)==null?void 0:d.trim())||"",a=((f=s==null?void 0:s.value)==null?void 0:f.trim())||"",c=((h=r==null?void 0:r.value)==null?void 0:h.trim())||"",u=((g=o==null?void 0:o.value)==null?void 0:g.trim())||"";i&&a&&u&&Fe.generateLead({name:i,phone:c,email:a,demand:"Liên hệ",note:u,url:window.location.href})};e.addEventListener("click",t),bn.push({element:e,event:"click",handler:t})},$U=e=>{const t=e.href||e.getAttribute("href")||"null",n=e.querySelector("img"),s=(n==null?void 0:n.alt)||e.getAttribute("title")||"null",r=(n==null?void 0:n.src)||"";let o="banner";return e.closest("#wrapPopup #popupContact")?o="popup-contact":e.closest(".banner-sale")?o="banner-sale":e.closest(".owl-stage .owl-item")?o="owl-carousel":e.closest(".banner-sale-detail")&&(o="banner-sale-detail"),{link:t,name:s,image:r,source:o}},TU=e=>{Fe.selectPromotion($U(e))},AU=()=>{const e=document.querySelectorAll(Nl.promotionBanner.join(", "));e.length!==0&&e.forEach(t=>{const n=()=>{TU(t)};t.addEventListener("click",n),bn.push({element:t,event:"click",handler:n})})};ki(e=>{if(!oU())return;uU();const t=new URL(e,window.location.origin).pathname,n=dU(t);cU()?kU():n==="contact"?setTimeout(()=>{CU()},1500):n==="cart"?(yU(),bU(),setTimeout(()=>{_U(),xU()},1500)):aU()?(gU(),setTimeout(vU,1500)):lU()?(pU(),setTimeout(()=>{Ev()},1500)):setTimeout(()=>{Ev()},1500),setTimeout(()=>{fU(),AU(),SU()},2e3)},!0);const EU=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),IU=(e,t)=>{let n;return(...s)=>{n&&clearTimeout(n),n=setTimeout(()=>{e.apply(null,s)},t)}},PU=()=>{var t,n;return(ae.state.handle||((n=(t=window==null?void 0:window.EAI)==null?void 0:t._config)==null?void 0:n.handle))==="noithatgiaphongvn"},Ni=e=>e?e.replace(/\s+/g,"").replace(/₫|đ/g,"").replace(/&nbsp;/g,""):"",Fl=e=>{try{const t=document.querySelectorAll('script[type="application/ld+json"]');for(let n=0;n<t.length;n++){const s=JSON.parse(t[n].textContent);if(s!=null&&s["@graph"]&&Array.isArray(s["@graph"])){const r=s["@graph"].find(o=>o["@type"]===e);if(r)return r}else if((s==null?void 0:s["@type"])===e)return s}}catch{}return null},$n={searchForm:"form.searchform",searchInput:'input[name="s"]',addToCartButton:'button[name="ux-buy-now"]',removeFromCartButton:".product-remove a.remove",productCard:".product-small.box",productCardLink:".woocommerce-LoopProduct-link",productCardImage:".box-image img:first-child",productCardPrice:".price ins .woocommerce-Price-amount bdi, .price > .woocommerce-Price-amount bdi",productCardId:"a[data-prod_id]",checkoutButton:"#place_order",contactForm:'form[aria-label="Form liên hệ"]',cartItem:".woocommerce-cart-form__cart-item"},Cd={cart:/\/gio-hang$/,checkout:/\/thanh-toan$/,purchase:/\/thanh-toan\/order-received\//},$d="noithatgiaphong_checkout",MU=()=>!!Fl("Product"),OU=()=>!!Fl("CollectionPage"),Lv=()=>Cd.purchase.test(window.location.pathname),LU=()=>Cd.cart.test(window.location.pathname),RU=()=>Cd.checkout.test(window.location.pathname)&&!Lv();let Td=[];const DU=()=>{Td.forEach(({element:e,event:t,handler:n,options:s})=>{e.removeEventListener(t,n,s)}),Td=[]},Ps=(e,t,n,s)=>{e.addEventListener(t,n,s),Td.push({element:e,event:t,handler:n,options:s})},jU=()=>{document.querySelectorAll($n.searchForm).forEach(t=>{const n=t.querySelector($n.searchInput);if(!n)return;Ps(t,"submit",()=>{var o;const r=(o=n.value)==null?void 0:o.trim();r&&Fe.search({search_term:r})})})},NU=()=>{var s;const e=Fl("CollectionPage");if(e!=null&&e.name)return{name:e.name,url:e.url||window.location.href,image:ms()||""};const t=Ts();if(t!=null&&t.title)return{name:t.title,url:window.location.href,image:t.image||ms()||""};const n=document.querySelector("h1");return{name:((s=n==null?void 0:n.textContent)==null?void 0:s.trim())||"",url:window.location.href,image:ms()||""}},FU=()=>{setTimeout(()=>{const e=NU();e.name&&Fe.categoryView(e)},1500)},qU=e=>{var d;const t=e.querySelector($n.productCardLink),n=((d=t==null?void 0:t.textContent)==null?void 0:d.trim())||"",s=(t==null?void 0:t.href)||"",r=e.querySelector($n.productCardImage),o=(r==null?void 0:r.src)||"",i=e.querySelector($n.productCardPrice),a=i?Ni(i.textContent):"",c=e.querySelector($n.productCardId);return{id:(c==null?void 0:c.getAttribute("data-prod_id"))||"",name:n,url:s,price:a,image:o}},Rv=()=>{document.querySelectorAll($n.productCard).forEach(t=>{t.querySelectorAll(".box-image a, "+$n.productCardLink).forEach(s=>{Ps(s,"click",()=>{const o=qU(t);o.name&&Fe.productSelect(o)})})})},Dv=()=>{var n;let e={id:"",sku:"",name:"",url:window.location.href,price:"",image:"",quantity:1,brand:null,category:""};const t=Fl("Product");if(t){if(e.name=t.name||"",e.id=t.productID||"",e.sku=t.sku||"",e.category=t.category||"",t.offers&&(e.price=t.offers.price||""),Array.isArray(t.image)&&t.image.length>0){const s=t.image[0];e.image=typeof s=="string"?s:(s==null?void 0:s.url)||""}else typeof t.image=="string"&&(e.image=t.image);(n=t.brand)!=null&&n.name&&(e.brand=t.brand.name)}if(!e.name||!e.image){const s=Ts();s&&(e.name||(e.name=s.title||""),e.image||(e.image=s.image||ms()||""))}return e.image||(e.image=ms()||""),e},zU=()=>{setTimeout(()=>{const e=Dv();e.name&&Fe.productView(e)},1500)},BU=()=>{document.querySelectorAll($n.addToCartButton).forEach(t=>{Ps(t,"click",()=>{const s=Dv(),r=document.querySelector("input.qty");r&&(s.quantity=parseInt(r.value||"1",10)),s.name&&Fe.addToCart(s)})})},jv=()=>{const e=document.querySelectorAll($n.cartItem);return Array.from(e).map(t=>{var g;const n=t.querySelector(".product-name a"),s=((g=n==null?void 0:n.textContent)==null?void 0:g.trim())||"",r=(n==null?void 0:n.href)||"",o=t.querySelector(".product-thumbnail img"),i=(o==null?void 0:o.src)||"",a=t.querySelector(".product-price .woocommerce-Price-amount bdi"),c=a?Ni(a.textContent):"",u=t.querySelector("input.qty"),d=parseInt((u==null?void 0:u.value)||"1",10),f=t.querySelector(".product-remove a.remove");return{id:(f==null?void 0:f.getAttribute("data-product_id"))||"",name:s,url:r,image:i,price:c,quantity:d}})},UU=()=>{const e=document.querySelector(".cart-collaterals .woocommerce-Price-amount bdi");return e?Ni(e.textContent):""},VU=()=>{setTimeout(()=>{const e=jv(),t=e.reduce((s,r)=>s+r.quantity,0).toString(),n=UU();Fe.cartView({cart_size:t,cart_total_price:n,products:e})},1500)},HU=()=>{document.querySelectorAll($n.removeFromCartButton).forEach(t=>{Ps(t,"click",()=>{var p;const s=t.closest($n.cartItem);if(!s)return;const r=s.querySelector(".product-name a"),o=((p=r==null?void 0:r.textContent)==null?void 0:p.trim())||"",i=(r==null?void 0:r.href)||"",a=s.querySelector(".product-thumbnail img"),c=(a==null?void 0:a.src)||"",u=s.querySelector(".product-price .woocommerce-Price-amount bdi"),d=u?Ni(u.textContent):"",f=s.querySelector("input.qty"),h=parseInt((f==null?void 0:f.value)||"1",10),g=t.getAttribute("data-product_id")||"";Fe.removeFromCart({id:g,name:o,url:i,image:c,price:d,quantity:h})})})},Ad=()=>{var u,d,f;const e={},t=document.getElementById("billing_last_name");t!=null&&t.value&&(e.name=t.value.trim());const n=document.getElementById("billing_phone");n!=null&&n.value&&(e.phone=n.value.trim());const s=document.getElementById("billing_email");s!=null&&s.value&&(e.email=s.value.trim());const r=document.getElementById("billing_address_1");r!=null&&r.value&&(e.address=r.value.trim());const o=document.getElementById("select2-billing_state-container");if(o){const h=(u=o.textContent)==null?void 0:u.trim();h&&h!=="Chọn tỉnh / thành phố"&&(e.state=h)}const i=document.getElementById("select2-billing_city-container");if(i){const h=(d=i.textContent)==null?void 0:d.trim();h&&h!=="Chọn quận / huyện"&&(e.city=h)}const a=document.getElementById("order_comments");a!=null&&a.value&&(e.note=a.value.trim());const c=document.querySelector('input[name="payment_method"]:checked');if(c){const h=document.querySelector(`label[for="${c.id}"]`);e.payment_gateway=((f=h==null?void 0:h.textContent)==null?void 0:f.trim())||c.value||""}return e},WU=()=>{const e=document.querySelector("form.woocommerce-checkout");if(!e)return;const t=()=>{const i=Ad();Object.keys(i).length>0&&Fe.addShippingInfo(i)},n=IU(t,1e3);["#billing_last_name","#billing_phone","#billing_email","#billing_address_1"].forEach(i=>{const a=e.querySelector(i);a&&Ps(a,"input",n,!0)}),["billing_state","billing_city"].forEach(i=>{const a=document.getElementById(i);a&&Ps(a,"change",t,!0)}),e.querySelectorAll('input[name="payment_method"]').forEach(i=>{Ps(i,"change",()=>{const c=Ad();c.payment_gateway&&Fe.addPaymentInfo({payment_gateway:c.payment_gateway})},!0)})},GU=()=>{const e=document.querySelector($n.checkoutButton);if(!e)return;Ps(e,"click",()=>{const n=jv(),s=Ad(),r=n.reduce((i,a)=>{const c=parseFloat(a.price.replace(/\./g,""))||0;return i+c*a.quantity},0).toString();Fe.checkout({cart_size:n.reduce((i,a)=>i+a.quantity,0).toString(),cart_total_price:r,products:n,...s});const o={customer:{name:s.name||"",phone:s.phone||"",email:s.email||"",shipping_address:[s.address,s.city,s.state].filter(Boolean).join(", "),payment_gateway:s.payment_gateway||""},products:n};sessionStorage.setItem($d,JSON.stringify(o))})};let Ed=!1;const KU=()=>{const e={customer:{},products:[]},t=window.location.pathname.match(/\/order-received\/(\d+)/);t&&(e.order_id=t[1],e.order_number=t[1]),document.querySelectorAll(".woocommerce-customer-details address p").forEach(i=>{var c;const a=((c=i.textContent)==null?void 0:c.trim())||"";a&&!e.customer.name&&(e.customer.name=a)});const s=document.querySelectorAll(".woocommerce-table__line-item.order_item"),r=Array.from(s).map(i=>{var v,_;const a=i.querySelector(".product-name a");let c=((v=a==null?void 0:a.textContent)==null?void 0:v.trim())||"";if(!c){const w=i.querySelector(".product-name");if(w){const k=w.cloneNode(!0),S=k.querySelector(".product-quantity");S&&S.remove(),c=((_=k.textContent)==null?void 0:_.trim())||""}}const u=(a==null?void 0:a.href)||"",d=i.querySelector(".product-quantity"),f=(d==null?void 0:d.textContent)||"",h=parseInt(f.replace(/[^\d]/g,"")||"1",10),g=i.querySelector(".product-total .woocommerce-Price-amount bdi"),p=g?Ni(g.textContent):"";return{name:c,url:u,price:p,quantity:h,image:""}});r.length>0&&(e.products=r);const o=sessionStorage.getItem($d);if(o)try{const i=JSON.parse(o);i.customer&&Object.keys(i.customer).length>0&&(e.customer={...i.customer,...e.customer})}catch{}if(e.products&&e.products.length>0){const i=e.products.reduce((a,c)=>{const u=parseFloat(c.price.replace(/\./g,""))||0;return a+u*c.quantity},0);e.total_value=i.toString()}return e},QU=()=>{Ed||setTimeout(()=>{const e=KU();e.order_id&&(Fe.purchase(e),Ed=!0,setTimeout(()=>Ed=!1,6e4),sessionStorage.removeItem($d))},1500)},JU=()=>{document.querySelectorAll($n.contactForm).forEach(t=>{Ps(t,"submit",()=>{var a,c,u,d,f,h,g,p;const s=((c=(a=t.querySelector('input[name="your-tel"]'))==null?void 0:a.value)==null?void 0:c.trim())||"",r=((d=(u=t.querySelector('input[name="your-name"]'))==null?void 0:u.value)==null?void 0:d.trim())||"",o=((h=(f=t.querySelector('input[name="your-email"]'))==null?void 0:f.value)==null?void 0:h.trim())||"",i=((p=(g=t.querySelector('textarea[name="your-message"]'))==null?void 0:g.value)==null?void 0:p.trim())||"";!s&&!o||Fe.generateLead({demand:"Liên hệ tư vấn",name:r,phone:s,email:o,note:i,page_url:window.location.href,page_title:document.title})})})};ki(e=>{PU()&&(DU(),Lv()?QU():LU()?(VU(),setTimeout(()=>{HU()},1500)):RU()?setTimeout(()=>{WU(),GU()},1500):setTimeout(()=>{MU()?(zU(),BU()):(OU()&&FU(),Rv())},1500),setTimeout(()=>{jU(),JU()},2e3))},!0);const XU=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),ZU=(e,t)=>{let n;return(...s)=>{n&&clearTimeout(n),n=setTimeout(()=>{e.apply(null,s)},t)}},YU=()=>{var n,s;return(ae.state.handle||((s=(n=window==null?void 0:window.EAI)==null?void 0:n._config)==null?void 0:s.handle))===kr},Nv={search:/^\/ket-qua-tim-kiem\.html$/,cart:/^\/gio-hang\.html$/,purchase:/^\/dat-hang-thanh-cong\.html$/,product:/^\/([a-z0-9-]+)\/([a-z0-9-]+)-pid(\d+)\.html$/},ql={addToCartButton:["#dathang1",".btn-add-to-cart"],removeFromCartButton:[".delete-product"],productCard:[".product-info-container.product-item"],loadMoreButton:["#div_Danh_Sach_San_Pham_loadMore_btn",".loadMore_btn"]};let Kn=[],zl=[],Id=!1;const eV=()=>{Kn.forEach(({element:e,event:t,handler:n,options:s})=>{e.removeEventListener(t,n,s)}),Kn=[],zl.forEach(e=>{e.disconnect()}),zl=[],Id=!1},Ms=e=>e?e.replace(/\D/g,""):"",tV=e=>{for(const[t,n]of Object.entries(Nv))if(n.test(e))return t;return"unknown"},nV=e=>{const t=new URL(e,window.location.origin);if(!Nv.search.test(t.pathname))return;const n=t.searchParams.get("keyword");n&&Fe.search({search_term:n})},sV=()=>{const e=Pd();return!!(e&&!e.mpn)},Pd=()=>{var t;const e=document.querySelectorAll('script[type="application/ld+json"]');for(const n of e)try{const r=n.textContent.replace(/[\x00-\x1F]+/g," "),o=JSON.parse(r);if((t=o["@context"])!=null&&t.includes("schema.org")&&o["@type"]==="Product")return o}catch{continue}return null},rV=()=>{setTimeout(()=>{const e=Pd();e&&!e.mpn&&Fe.categoryView({name:e.name||"",url:window.location.href,image:e.image||""})},1500)},oV=e=>{var g;const t=e.querySelector("a[data-id]"),n=(t==null?void 0:t.getAttribute("data-id"))||e.getAttribute("data-id")||"",s=(t==null?void 0:t.getAttribute("data-name"))||"",r=(t==null?void 0:t.href)||"",o=e.querySelector(".product-image img.product__img"),i=(o==null?void 0:o.src)||"",a=e.querySelector(".block-box-price .price"),c=a?Ms(a.textContent):"",u=e.querySelector(".block-box-price .price-old"),d=u?Ms(u.textContent):"",f=e.querySelector(".percent-discount-text2"),h=((g=f==null?void 0:f.textContent)==null?void 0:g.trim())||"";return{id:n,sku:n,name:s,url:r,price:c,originalPrice:d,discount:h,image:i}},Md=()=>{document.querySelectorAll(ql.productCard.join(", ")).forEach(t=>{t.querySelectorAll("a[data-id]").forEach(s=>{const r=()=>{const o=oV(t);o.name&&Fe.productSelect(o)};s.addEventListener("click",r),Kn.push({element:s,event:"click",handler:r})})})},Fv=()=>{document.querySelectorAll(ql.loadMoreButton.join(", ")).forEach(t=>{const n=()=>{setTimeout(()=>{Md()},2500)};t.addEventListener("click",n),Kn.push({element:t,event:"click",handler:n})})},qv=()=>{var r,o;let e={id:"",sku:"",name:"",url:window.location.href,price:"",originalPrice:"",discount:null,image:"",brand:""};const t=Pd();t&&t.mpn&&(e.id=t.mpn||"",e.sku=t.mpn||"",e.name=t.name||"",e.image=t.image||"",e.brand=typeof t.brand=="object"?((r=t.brand)==null?void 0:r.name)||"":t.brand||"");const n=document.querySelector(".wrap-price .new-price");n?e.price=Ms(n.textContent):(o=t==null?void 0:t.offers)!=null&&o.Price&&(e.price=t.offers.Price.toString());const s=document.querySelector(".wrap-price .old-price");return s&&(e.originalPrice=Ms(s.textContent)),e},iV=()=>{setTimeout(()=>{const e=qv();e.name&&Fe.productView(e)},1500)},aV=()=>{document.querySelectorAll(ql.addToCartButton.join(", ")).forEach(t=>{const n=()=>{const s=qv();s.name&&Fe.addToCart(s)};t.addEventListener("click",n),Kn.push({element:t,event:"click",handler:n})})},Od=()=>{const e=document.querySelectorAll(".item-product");return Array.from(e).map(t=>{var k,S;const n=t.querySelector('input[name$=".ProductName"]'),s=(n==null?void 0:n.value)||"",r=t.querySelector('input[name$=".ProductPrice"]'),o=(r==null?void 0:r.value)||"",i=t.querySelector('input[name$=".LinkImage"]'),a=(i==null?void 0:i.value)||"",c=t.querySelector(".number"),u=parseInt(((k=c==null?void 0:c.textContent)==null?void 0:k.trim())||"1",10),d=t.querySelector(".cart-image a")||t.querySelector(".title a"),f=(d==null?void 0:d.href)||"",h=t.querySelector(".price[data-cartid]"),g=h?Ms(h.textContent):o,p=t.querySelector(".price-old"),v=p&&!p.classList.contains("hidden")?Ms(p.textContent):"",_=t.querySelector(".color-rule-id"),w=_?[(S=_.textContent)==null?void 0:S.trim()]:[];return{name:s,price:g,originalPrice:v,quantity:u,image:a,url:f,attributes:w}})},zv=()=>document.querySelectorAll(".item-product").length.toString(),Ld=()=>{const e=document.getElementById("totalpayment");if(e){const t=e.getAttribute("data-totalpayment");return t||Ms(e.textContent)}return""},lV=()=>{setTimeout(()=>{const e=zv(),t=Ld(),n=Od();Fe.cartView({cart_size:e,cart_total_price:t,products:n})},1500)},cV=()=>{document.querySelectorAll(ql.removeFromCartButton.join(", ")).forEach(t=>{const n=()=>{var r;const s=t.closest(".item-product");if(s){const o=s.querySelector('input[name$=".ProductName"]'),i=(o==null?void 0:o.value)||"",a=s.querySelector('input[name$=".LinkImage"]'),c=(a==null?void 0:a.value)||"",u=s.querySelector('input[name$=".ProductPrice"]'),d=(u==null?void 0:u.value)||"",f=s.querySelector(".cart-image a")||s.querySelector(".title a"),h=(f==null?void 0:f.href)||"",g=s.querySelector(".number"),p=parseInt(((r=g==null?void 0:g.textContent)==null?void 0:r.trim())||"1",10);Fe.removeFromCart({name:i,url:h,image:c,price:d,quantity:p})}};t.addEventListener("click",n),Kn.push({element:t,event:"click",handler:n})})},Bv=()=>{var u,d,f,h;const e={},t=g=>{const p=document.querySelectorAll(g);for(const v of p)if(v.value&&v.value.trim()!=="")return v.value.trim();return""},n=document.querySelector('input[name="chkgender"]:checked');n&&(e.gender=n.value==="1"?"Anh":"Chị");const s=t("#popup_payment_inp_hoten, input[name='fullname']");s&&(e.name=s);const r=t("#popup_payment_inp_sdt, input[name='phone']");r&&(e.phone=r);const o=t("#popup_payment_inp_email, input[name='txtMailReceiver']");o&&(e.email=o);const i=document.querySelector(".nav-delivery .btn-default-PaymentType.active");if(i){const g=i.querySelector(".text");e.delivery_method=((u=g==null?void 0:g.textContent)==null?void 0:u.trim())||""}if(e.delivery_method==="Nhận hàng tại cửa hàng"){e.city="",e.ward="",e.address="";const g=document.querySelector("#store-address .item.market .check");if(g){const p=Array.from(g.childNodes).filter(v=>v.nodeType===Node.TEXT_NODE).map(v=>v.textContent.trim()).filter(Boolean).join(" ");e.full_address=p||""}}else{const g=document.querySelector("#ad-market .city-selected");if(g){const w=(d=g.textContent)==null?void 0:d.trim();w&&w!=="Chọn tỉnh, thành"&&(e.city=w)}const p=document.querySelector("#ad-market .ward-selected");if(p){const w=(f=p.textContent)==null?void 0:f.trim();w&&w!=="Chọn phường, xã"&&(e.ward=w)}const v=t("#popup_payment_inp_diachi, input[name='Address'], input[name='address']");v&&(e.address=v);const _=[e.address,e.ward,e.city].filter(Boolean);_.length>0&&(e.full_address=_.join(", "))}const c=document.querySelector(".payment-type .tablinks.active .btn-default-PaymentType");if(c){const g=c.querySelector(".txt-menthod");e.payment_gateway=((h=g==null?void 0:g.textContent)==null?void 0:h.trim())||""}return e},uV=()=>{const e=document.getElementById("ShopCart");if(!e)return;const t=()=>{const d=Bv();if(Object.keys(d).length>0){Fe.addShippingInfo(d);let f={customer:{},products:Od(),cart_total_price:Ld()};try{const h=sessionStorage.getItem("viettelstore_checkout");h&&(f=JSON.parse(h))}catch{}f.customer={...f.customer,gender:d.gender||f.customer.gender||"",name:d.name||f.customer.name||"",phone:d.phone||f.customer.phone||"",email:d.email||f.customer.email||"",shipping_address:d.full_address||f.customer.shipping_address||"",delivery_method:d.delivery_method||f.customer.delivery_method||"",payment_gateway:d.payment_gateway||f.customer.payment_gateway||""},sessionStorage.setItem("viettelstore_checkout",JSON.stringify(f))}},n=ZU(t,1e3);["#popup_payment_inp_hoten","input[name='fullname']","#popup_payment_inp_sdt","input[name='phone']","#popup_payment_inp_email","input[name='txtMailReceiver']","#popup_payment_inp_diachi","input[name='Address']","input[name='address']"].forEach(d=>{document.querySelectorAll(d).forEach(h=>{h.addEventListener("input",n,!0),Kn.push({element:h,event:"input",handler:n,options:!0})})}),e.querySelectorAll('input[name="chkgender"]').forEach(d=>{d.addEventListener("change",t,!0),Kn.push({element:d,event:"change",handler:t,options:!0})}),document.querySelectorAll(".nav-delivery .btn-default-PaymentType").forEach(d=>{const f=()=>setTimeout(t,500);d.addEventListener("click",f,!0),Kn.push({element:d,event:"click",handler:f,options:!0})}),document.querySelectorAll(".payment-type .tablinks").forEach(d=>{const f=()=>setTimeout(t,500);d.addEventListener("click",f,!0),Kn.push({element:d,event:"click",handler:f,options:!0})});const a=document.querySelector("#ad-market .city-selected");if(a){const d=new MutationObserver(n);d.observe(a,{childList:!0,characterData:!0,subtree:!0,attributes:!0,attributeFilter:["data-value"]}),zl.push(d)}const c=document.querySelector("#ad-market .ward-selected");if(c){const d=new MutationObserver(n);d.observe(c,{childList:!0,characterData:!0,subtree:!0,attributes:!0,attributeFilter:["data-value"]}),zl.push(d)}document.querySelectorAll("#store-address .item.market label, .list-store .item.market label").forEach(d=>{const f=()=>setTimeout(t,300);d.addEventListener("click",f,!0),Kn.push({element:d,event:"click",handler:f,options:!0})})},dV=()=>{const e=document.getElementById("buynow1");if(!e)return;const t=()=>{const n=document.getElementById("agreePolicy");if(!(n!=null&&n.checked))return;const s=zv(),r=Ld(),o=Od(),i=Bv();let a={customer:{},products:o,cart_total_price:r};try{const u=sessionStorage.getItem("viettelstore_checkout");u&&(a=JSON.parse(u))}catch{}const c={gender:i.gender||a.customer.gender||"",name:i.name||a.customer.name||"",phone:i.phone||a.customer.phone||"",email:i.email||a.customer.email||"",shipping_address:i.full_address||a.customer.shipping_address||"",delivery_method:i.delivery_method||a.customer.delivery_method||"",payment_gateway:i.payment_gateway||a.customer.payment_gateway||""};a.customer=c,a.products=o,a.cart_total_price=r,sessionStorage.setItem("viettelstore_checkout",JSON.stringify(a)),Id||c.name&&c.phone&&(Fe.checkout({cart_size:s,cart_total_price:r,products:o,...c}),Id=!0)};e.addEventListener("click",t),Kn.push({element:e,event:"click",handler:t})},fV=()=>{var o;const e={},n=new URLSearchParams(window.location.search).get("ordercode");if(n&&(e.order_id=n,e.order_number=n),!e.order_id){const i=document.querySelector(".hightlight.color-black span");i&&(e.order_id=((o=i.textContent)==null?void 0:o.trim())||"",e.order_number=e.order_id)}const s=sessionStorage.getItem("viettelstore_checkout");if(s)try{const i=JSON.parse(s);e.customer=i.customer||{},e.products=i.products||[]}catch(i){console.error("Failed to parse viettelstore checkout data:",i),e.customer={},e.products=[]}else{e.customer={},e.products=[];const i=document.querySelectorAll(".table.product tbody tr");e.products=Array.from(i).map(a=>{var k,S,E,O;const c=a.querySelector(".img img"),u=(c==null?void 0:c.src)||"",d=((S=(k=a.querySelector(".text-medium.color-black"))==null?void 0:k.textContent)==null?void 0:S.trim())||(c==null?void 0:c.alt)||"",h=(((E=a.querySelector(".text-medium.mau-gray[style]"))==null?void 0:E.textContent)||"").match(/Số lượng:\s*(\d+)/),g=h?parseInt(h[1],10):1,p=a.querySelector(".text-medium.mau-red"),v=p?Ms(p.textContent):"",_=a.querySelector("p.text-medium.mau-gray:not([style])"),w=_?[(O=_.textContent)==null?void 0:O.trim()]:[];return{name:d,image:u,price:v,quantity:g,attributes:w}})}const r=document.querySelector(".frame-total-price.price2");if(r)e.total_value=Ms(r.textContent);else if(e.products&&e.products.length>0){const i=e.products.reduce((a,c)=>{const u=parseFloat(c.price)||0,d=c.quantity||1;return a+u*d},0);e.total_value=i.toString()}return e};let Rd=!1;const hV=()=>{Rd||setTimeout(()=>{const e=fV();e.order_id&&(Fe.purchase(e),Rd=!0,setTimeout(()=>Rd=!1,6e4),sessionStorage.removeItem("viettelstore_checkout"))},1500)};ki(e=>{if(!YU())return;eV();const t=new URL(e,window.location.origin).pathname;switch(tV(t)){case"search":nV(e),setTimeout(()=>{Md(),Fv()},1500);break;case"product":iV(),setTimeout(aV,1500);break;case"cart":lV(),cV(),setTimeout(()=>{uV(),dV()},1500);break;case"purchase":hV();break;default:sV()&&rV(),setTimeout(()=>{Md(),Fv()},1500);break}},!0);const pV=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),mV=(e=>(mn("data-v-08506e2e"),e=e(),gn(),e))(()=>l("div",{class:"inline-flex items-center justify-center px-5 h-11 rounded-xl bg-gray-100"},[l("span",{class:"ecg-loader"})],-1)),gV={class:"text-xs text-gray-600 ml-2 animate-pulse mt-0.5"},vV={key:0,class:"typing-text"},yV={key:1,class:"typing-text"},bV=Object.freeze(Object.defineProperty({__proto__:null,default:Qe({__name:"TypingIndicator",props:{variant:{type:String,default:"secondary"},agent:{type:Object,default:()=>null}},emits:["start"],setup(e,{emit:t}){const{t:n}=en(),s=t;return Je(()=>{s("start")}),(r,o)=>(m(),x("div",null,[mV,l("div",gV,[e.agent&&e.agent.name?(m(),x("span",vV,j(y(n)("chat.typingWithAgent",{name:e.agent.name})),1)):(m(),x("span",yV,j(y(n)("chat.typing")),1))])]))}},[["__scopeId","data-v-08506e2e"]])},Symbol.toStringTag,{value:"Module"})),_V={},xV={class:"text-white",xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},wV=[l("path",{fill:"currentColor",d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z"},null,-1),l("path",{d:"M6 12h16"},null,-1)];function kV(e,t){return m(),x("svg",xV,wV)}const SV=Qe(_V,[["render",kV]]),CV={},$V={class:"text-gray-800",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},TV=[l("path",{d:"M3 6h18"},null,-1),l("path",{fill:"currentColor",d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"},null,-1),l("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"},null,-1)];function AV(e,t){return m(),x("svg",$V,TV)}const EV=Qe(CV,[["render",AV]]),IV={key:0,class:"text-center px-4"},PV={class:"mb-3 flex justify-center"},MV={class:"w-12 h-12 bg-red-50 rounded-full flex items-center justify-center"},OV={class:"text-base font-semibold text-gray-900 mb-2"},LV={class:"text-sm text-gray-600 mb-5"},RV={key:1},DV={class:"px-8 pb-4 mb-6 text-center text-gray-500 text-base"},jV={key:0,class:"flex items-center justify-center gap-2 animate-pulse"},NV=l("div",{class:"text-sm"},"Đang nghe ...",-1),FV={key:1,class:"text-gray-900"},qV={class:"flex items-center mx-auto gap-10 max-w-[320px]"},zV={class:"flex flex-col items-center justify-center gap-4"},BV=l("span",{class:"text-sm text-gray-900"},"Xóa",-1),UV={class:"flex flex-col items-center justify-center gap-4"},VV=l("span",{class:"text-sm text-gray-900"},"Gửi tin nhắn",-1),HV=l("span",{class:"text-sm text-gray-900"},"Chỉnh sửa",-1),WV=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"ChatVoiceSetting",emits:["transcriptionComplete","editTranscription","cancelTranscription"],setup(e,{emit:t}){const n=t,{isOpen:s,showPermissionDenied:r,permissionMessage:o,hidePermissionDeniedMessage:i,stopSpeechRecognition:a,releaseMediaResources:c,startSpeechRecognition:u,isSpeechRecognitionSupported:d,setProcessing:f,recordedTranscript:h}=md(),g=R(!1),p=Jr("chatViewRef",null),v=()=>{i(),g.value=!1,s.value=!1},_=()=>{a(),c(),g.value=!1,s.value=!1,n("cancelTranscription","")},w=async()=>{f(!0);try{a(),await new Promise(S=>setTimeout(S,100)),h.value&&h.value.trim()!==""&&n("transcriptionComplete",h.value)}catch{}finally{f(!1),c(),g.value=!1,s.value=!1}},k=()=>{a(),h.value&&h.value.trim()!==""&&(n("editTranscription",h.value),h.value=""),g.value=!1,s.value=!1,c()};return Pe(r,S=>{S&&(g.value=!0)}),Pe(s,async S=>{if(S&&!g.value){if(!d()){g.value=!0;return}f(!0),g.value=!0,await u(),f(!1)}}),Pe(g,S=>{S||(c(),s.value=!1,i())}),(S,E)=>(m(),oe(y(bo),{modal:!1,open:g.value,"onUpdate:open":E[1]||(E[1]=O=>g.value=O),"should-scale-background":!1},{default:Se(()=>[G(y(nr),{to:y(p)},{default:Se(()=>[l("div",{onClick:E[0]||(E[0]=O=>g.value=!1),class:ne(["drawer-overlay-custom",{"drawer-overlay-custom--open":g.value}])},null,2),G(y(rr),{class:"px-4 pb-10 pt-12 bg-white absolute bottom-0 rounded-t-2xl left-0 right-0 outline-none z-50 overflow-hidden"},{default:Se(()=>[y(o)&&y(o).type==="error"?(m(),x("div",IV,[l("div",PV,[l("div",MV,[G(y(ek),{class:"w-6 h-6 text-red-500"})])]),l("h3",OV,j(y(o).title),1),l("p",LV,j(y(o).message),1),l("button",{onClick:v,class:"w-full py-2.5 px-4 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors text-sm font-medium"}," Đã hiểu ")])):(m(),x("div",RV,[l("div",DV,[y(h)?(m(),x("div",FV,j(y(h)),1)):(m(),x("div",jV,[G(y(Vu),{size:"18"}),NV]))]),l("div",qV,[l("div",zV,[l("button",{onClick:_,class:"bg-gray-100 rounded-full size-[80px] flex items-center justify-center hover:bg-red-50 hover:text-red-600 transition-colors"},[G(EV)]),BV]),l("div",UV,[l("button",{onClick:w,class:"bg-blue-500 rounded-full size-[80px] flex items-center justify-center pulse-animation-3"},[G(SV)]),VV]),l("div",{class:ne([y(h)?"opacity-100":"opacity-50 pointer-events-none","flex flex-col items-center justify-center gap-4"])},[l("button",{onClick:k,class:"bg-gray-100 rounded-full size-[80px] flex items-center justify-center hover:bg-orange-50 hover:text-orange-600 transition-colors"},[G(y(sk),{size:"26",class:"text-gray-900"})]),HV],2)])]))]),_:1})]),_:1},8,["to"])]),_:1},8,["open"]))}}},Symbol.toStringTag,{value:"Module"})),GV=["disabled"],KV=Object.freeze(Object.defineProperty({__proto__:null,default:Qe({__name:"ChatVoiceTrigger",props:{assistantProcessing:{type:Boolean,default:!1},voiceProcessing:{type:Boolean,default:!1}},setup(e){const{openChatVoice:t,checkMicrophonePermission:n,showPermissionDeniedMessage:s}=md(),r=async()=>{(await n()).granted?t():s()};return(o,i)=>(m(),x("button",{onClick:i[0]||(i[0]=a=>r()),class:ne(["button-mic-trigger",e.voiceProcessing&&"voice-processing pulse-animation-1"]),disabled:e.assistantProcessing||e.voiceProcessing},[e.voiceProcessing?(m(),oe(y(Vu),{key:0,size:"16"})):(m(),oe(y(ng),{key:1,size:"18"}))],10,GV))}},[["__scopeId","data-v-d2852a2c"]])},Symbol.toStringTag,{value:"Module"})),QV={class:"px-4 pb-1 pt-2"},JV={class:"flex items-center w-full justify-around pb-3 pt-3.5 px-2 rounded-3xl shadow-sm border border-gray-100 bg-white"},XV={class:"text-xs font-medium"},ZV={class:"text-xs font-medium"},YV={class:"text-xs font-medium"},eH={class:"text-xs font-medium"},tH={__name:"ChatMenu",props:{currentScreen:{type:String,required:!0},menu:{type:Object,default:()=>{}}},emits:["change-screen"],setup(e,{emit:t}){const{t:n}=en(),s=t,r=o=>{s("change-screen",o)};return(o,i)=>(m(),x("div",QV,[l("div",JV,[e.menu.home?(m(),x("button",{key:0,onClick:i[0]||(i[0]=a=>r("home")),class:ne(["flex flex-col items-center gap-1 transition-colors",e.currentScreen==="home"?"text-primary":"text-gray-500 hover:text-gray-600"])},[G(y(H2),{size:20}),l("div",XV,j(y(n)("menu.home")),1)],2)):z("",!0),l("button",{onClick:i[1]||(i[1]=a=>r("conversations")),class:ne(["flex flex-col items-center gap-1 transition-colors",e.currentScreen==="conversations"?"text-primary":"text-gray-500 hover:text-gray-600"])},[G(y(Z2),{size:20}),l("div",ZV,j(y(n)("menu.messages")),1)],2),e.menu.help_center?(m(),x("button",{key:1,onClick:i[2]||(i[2]=a=>r("helps")),class:ne(["flex flex-col items-center gap-1 transition-colors",e.currentScreen==="helps"?"text-primary":"text-gray-500 hover:text-gray-600"])},[G(y(Zm),{size:20}),l("div",YV,j(y(n)("menu.help")),1)],2)):z("",!0),e.menu.order_tracking?(m(),x("button",{key:2,onClick:i[3]||(i[3]=a=>r("order_tracking")),class:ne(["flex flex-col items-center gap-1 transition-colors",e.currentScreen==="order_tracking"?"text-primary":"text-gray-500 hover:text-gray-600"])},[G(y(Wu),{size:20}),l("div",eH,j(y(n)("menu.orders")),1)],2)):z("",!0)])]))}},nH={class:"flex-1 overflow-hidden h-full"},sH={key:0,class:"flex-1 px-4 pb-1"},rH=["innerHTML"],oH=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"ChatContainer",emits:["close-chat"],setup(e){const t=Wt(()=>Promise.resolve().then(()=>dW)),n=Wt(()=>Promise.resolve().then(()=>s7)),s=Wt(()=>Promise.resolve().then(()=>OW)),r=Wt(()=>Promise.resolve().then(()=>JG)),o=R(null),i=Z(()=>{var k;return(k=ae.state.bot)==null?void 0:k.config.ui.signature}),a=Z(()=>{var k,S;return((S=(k=ae.state.bot)==null?void 0:k.config)==null?void 0:S.page)??{}}),c=Z(()=>!a.value||Object.keys(a.value).length===0?!1:Object.values(a.value).some(k=>k&&k.enabled===!0)),u=Z(()=>{var k,S,E;return{home:((k=a.value.home)==null?void 0:k.enabled)||!1,help_center:((S=a.value.help_center)==null?void 0:S.enabled)||!1,order_tracking:((E=a.value.order_tracking)==null?void 0:E.enabled)||!1}}),d=Z(()=>c.value),f=Z(()=>{const k=["conversations"];return u.value.home&&k.push("home"),u.value.help_center&&k.push("helps"),u.value.order_tracking&&k.push("order_tracking"),k.push("chat"),k}),h=()=>c.value&&u.value.home?"home":"conversations",g=k=>k==="chat"?"conversations":f.value.includes(k)?k:h(),p=Z(()=>{const k=ae.state.chatState.viewTab;return g(k)});Je(()=>{ae.state.chatContainerRef=o.value}),Zn(()=>{ae.state.chatContainerRef=null}),Je(()=>{let k=ae.state.chatState.viewTab;ae.state.chatState.shouldOpenChatScreen?k="conversations":(!k||k==="chat")&&(k=h());const S=g(k);S!==ae.state.chatState.viewTab&&ae.actions.updateChatState({viewTab:S})});const v=k=>{ae.actions.updateChatState({viewTab:k})},_=()=>{if(u.value.home){ae.actions.updateChatState({viewTab:"home"});return}ae.actions.updateChatState({viewTab:"conversations"})},w=k=>{ae.actions.updateChatState({viewTab:"conversations"}),kt(()=>{setTimeout(()=>{const{send:S}=Ir();S({message:k})},200)})};return(k,S)=>{var E,O,I;return m(),x("div",{id:"ei-chat-container",ref_key:"chatContainerRef",ref:o,class:"flex flex-col h-full w-full bg-gray-50"},[l("div",nH,[(m(),oe(zo,null,[p.value==="home"&&((E=a.value.home)!=null&&E.enabled)?(m(),oe(y(t),{key:0,onCloseChat:S[0]||(S[0]=P=>k.$emit("close-chat")),onSendMessage:w,onSetScreen:S[1]||(S[1]=P=>v(P)),dataHome:a.value.home},null,8,["dataHome"])):z("",!0)],1024)),(m(),oe(zo,null,[p.value==="conversations"?(m(),oe(y(n),{key:0,class:"h-full w-full pb-1",showMenu:d.value,onClose:_},{actions:Se(()=>[l("button",{onClick:S[2]||(S[2]=P=>k.$emit("close-chat")),"aria-label":"eac-close-chat",class:"size-8 rounded-lg flex items-center justify-center bg-white/10 hover:bg-white/20"},[G(y(fl),{size:"16"})])]),_:1},8,["showMenu"])):z("",!0)],1024)),(m(),oe(zo,null,[p.value==="helps"&&((O=a.value.help_center)!=null&&O.enabled)?(m(),oe(y(s),{key:0,onClose:_,onCloseChat:S[3]||(S[3]=P=>k.$emit("close-chat")),dataHelpCenter:a.value.help_center},null,8,["dataHelpCenter"])):z("",!0)],1024)),(m(),oe(zo,null,[p.value==="order_tracking"&&((I=a.value.order_tracking)!=null&&I.enabled)?(m(),oe(y(r),{key:0,onClose:_,onCloseChat:S[4]||(S[4]=P=>k.$emit("close-chat"))})):z("",!0)],1024))]),(m(),oe(zo,null,[d.value&&!["conversations"].includes(p.value)?(m(),oe(tH,{key:0,"current-screen":p.value,menu:u.value,onChangeScreen:v},null,8,["current-screen","menu"])):z("",!0)],1024)),l("div",{class:ne(["flex items-center justify-center w-full py-1",[i.value&&i.value.length>35?"flex-col text-center":"flex-row",p.value==="conversations"&&"bg-white",i.value&&i.value.length<=35&&"pl-6 pr-4"]])},[i.value?(m(),x("div",sH,[l("div",{class:"text-[10px] text-gray-500 font-medium leading-[120%]",innerHTML:i.value},null,8,rH)])):z("",!0),G(rv)],2)],512)}}}},Symbol.toStringTag,{value:"Module"})),iH=dt({top:0,left:0,container:null,title:null,link:null,aiText:{},isLoadingSummary:!1});function aH(e){const t=e.trim();return t.startsWith("#")?"id":t.startsWith(".")?"class":null}const lH=(e,t)=>{const n=aH(t),s=t.slice(1);return n==="class"?e.classList.contains(s):n==="id"?e.id===s:!1};function cH(){const{widgets:e}=Ys(),{container:t,title:n,top:s,left:r,link:o,aiText:i,isLoadingSummary:a}=Et(iH),c=()=>{t.value=null,n.value=null},u=v=>{var E;const _=v.getBoundingClientRect(),k=["h2","h3",".product-title","strong a",".name_pro",".card-title",".product-name",".title-2"].reduce((O,I)=>{if(O)return O;const P=v.querySelector(I);return P?P.textContent:O},""),S=v.tagName.toLowerCase()==="a"?v.href:((E=v.querySelector("a"))==null?void 0:E.href)||"";return{container:v,title:k,left:_.left,top:_.top,link:S}},d=v=>{c();const _=[".product-card",".card-product",".item-product","#adv3 .c","#uc .c",".km .c",".km .h",".c.jcarousel-item",".q .x",".pkd .h",".pkd .c",".product-card"];let w=null;for(const k of _)if(lH(v.target,k)){w=v.target;break}if(!w)for(const k of _){const S=k.replaceAll(".w-1/2",""),E=v.target.closest(S);if(E){w=E;break}}if(w){const k=u(w);t.value=k.container,n.value=k.title,s.value=k.top+8,r.value=k.left+8,o.value=k.link}else t.value=null,n.value=null,s.value=0,r.value=0,o.value=null},f=()=>{t.value&&c()};Je(()=>{var v,_,w,k,S;((_=(v=e.value.product_card_summary)==null?void 0:v.config_enhances)==null?void 0:_.length)>0&&((S=(k=(w=e.value.product_card_summary.config_enhances[0])==null?void 0:w.widgetSettings)==null?void 0:k.selectorProductCards)==null?void 0:S.length)>0,document.addEventListener("mousemove",d),document.addEventListener("scroll",f),window.addEventListener("resize",f)}),Rt(()=>{document.removeEventListener("mousemove",d),document.removeEventListener("scroll",f),window.removeEventListener("resize",f)});const p=((v,_)=>{let w;return(...k)=>{clearTimeout(w),w=setTimeout(()=>v(...k),_)}})(async()=>{var v;try{if(!o.value||i.value[o.value]||a.value)return;a.value=!0;const{data:_}=await Xe.summary.getSummary({handle:(v=U.bot)==null?void 0:v.handle,source:o.value});_!=null&&_.highlight&&(i.value[o.value]=_.highlight),a.value=!1}catch{a.value=!1}},500);return Pe(o,v=>{v&&p()}),{top:s,left:r,container:t,title:n,aiText:i,link:o,isLoadingSummary:a}}const uH={class:"relative ask-ai-group"},dH={class:"flex items-center bg-white border border-b-[3px] border-gray-200 rounded-lg h-8"},fH={class:"flex justify-center items-center text-gray-900 size-8"},hH={class:"size-[20px] overflow-hidden rounded-full"},pH=["src"],mH=l("div",{class:"text-xs w-[0px] group-hover:opacity-100 group-hover:w-[72px] duration-200"},[l("div",{class:"text-gray-900 whitespace-nowrap opacity-0 delay-100 group-hover:opacity-100"}," Trợ lý AI ")],-1),gH=["onClick"],vH={class:"flex-1"},yH={class:"flex flex-col px-1 mt-1"},bH={key:0,class:"text-[12px] p-2 rounded-xl bg-blue-50 mt-0.5"},_H={class:"ask-ai-result"},xH={key:1,class:"text-[12px] p-2 rounded-xl bg-blue-50 mt-0.5"},wH=[l("div",{class:"ask-ai-result"},"AI đang xử lý ...",-1)],kH=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"WidgetFeatureSummaryCard",props:["bot"],setup(e){const{container:t,title:n,top:s,left:r,link:o,aiText:i}=cH(),a=R(null),c=R([]);let u=R(null);const d=p=>{ECG.send(p)},f=()=>{if(!i.value[o.value])return;const v=`❝${i.value[o.value]}❞`.split(" ");c.value=[];let _=0;u.value=setInterval(()=>{_<v.length?(c.value.push(v[_]),_++):clearInterval(u.value)},60)},h=()=>{c.value.length>0||(clearInterval(u.value),f())},g=()=>{clearInterval(u.value),c.value=[]};return ks(()=>{i.value[o.value]&&c.value.length===0&&(clearInterval(u.value),f())}),Pe(t,()=>{t.value&&a.value.style&&(a.value.style.top=`${s.value}px`,a.value.style.left=`${r.value}px`),g()}),(p,v)=>{var _,w;return m(),x("div",{onMousemove:v[2]||(v[2]=Gt(()=>{},["stop"])),onMouseover:h,ref_key:"ShapeDetectElementRef",ref:a,class:ne(["fixed z-50 duration-100 delay-150 group",y(t)?"opacity-100 visible ":"opacity-0 invisible pointer-events-none"])},[l("div",uH,[l("div",dH,[l("div",fH,[l("div",hH,[l("img",{src:(w=(_=y(U).bot)==null?void 0:_.config)==null?void 0:w.ui.logo,class:"object-cover w-full h-full"},null,8,pH)])]),mH]),l("div",{onMouseover:v[0]||(v[0]=Gt(()=>{},["stop"])),onMousemove:v[1]||(v[1]=Gt(()=>{},["stop"])),class:"ask-ai-quick-replies"},[(m(!0),x(_e,null,Me([{name:"✏️ Tóm tắt ưu nhược điểm",content:`Tóm tắt ưu nhược điểm của ${y(n)}`},{name:"🔍 Sản phẩm tương tự",content:`Tìm Sản phẩm tương tự với ${y(n)}`}],(k,S)=>(m(),x("div",{key:S,class:"tag-suggestion",onClick:E=>d(k.content)},[l("div",vH,j(k.name),1),G(y(Pr),{size:"12",class:"text-gray-600"})],8,gH))),128)),l("div",yH,[G(Ri,{title:"AI đánh giá"}),y(i)[y(o)]&&c.value.length?(m(),x("div",bH,[l("div",_H,[(m(),x("span",{key:c.value.length},j(c.value.join(" ")),1))])])):(m(),x("div",xH,wH))])],32)])],34)}}}},Symbol.toStringTag,{value:"Module"})),SH={class:"flex items-center gap-1"},CH=["src","alt"],$H={class:"flex-1 truncate text-sm tracking-tight relative text-gray-500"},TH=["innerHTML"],AH=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"ChatBoxNewMessage",emits:["toggle","close"],setup(e,{emit:t}){const n=t,s=Z(()=>ae.state.chatState.lastUnreadMessage),r=Z(()=>{var c,u;return(u=(c=ae.state.bot)==null?void 0:c.config)==null?void 0:u.ui}),o=Z(()=>{const c="Bạn có tin nhắn mới";if(!s.value)return c;const{content_type:u,content:d}=s.value;switch(u){case"text":return Xa(d||"",{separate:!1})[0]||c;case"image":return`Đã gửi ${Array.isArray(d)?d.length:1} hình ảnh`;case"video":return`Đã gửi ${Array.isArray(d)?d.length:1} video`;case"file":return`Đã gửi ${Array.isArray(d)?d.length:1} file đính kèm`;case"gif":return`Đã gửi ${Array.isArray(d)?d.length:1} ảnh gif`;case"sticker":return`Đã gửi ${Array.isArray(d)?d.length:1} nhãn`;case"product_cards":return`Có ${Array.isArray(d.elements)?d.elements.length:1} sản phẩm được đề xuất`;default:return"Có tin nhắn mới"}}),i=()=>{n("toggle")},a=()=>{n("close")};return(c,u)=>r.value?(m(),x("div",{key:0,onClick:u[1]||(u[1]=d=>i()),class:ne(["p-4 py-3 min-w-[180px] max-w-[280px] cursor-pointer border bg-white rounded-2xl border-gray-100 box-shadow-md relative group",[r.value.alignment.position==="right"?"ml-auto":"mr-auto"]])},[l("button",{onClick:u[0]||(u[0]=Gt(d=>a(),["stop"])),class:"absolute -top-2 -right-2 size-5 bg-white border border-gray-100 rounded-full flex items-center justify-center text-gray-400 hover:text-gray-600 shadow-sm"},[G(_o,{class:"size-3"})]),l("div",SH,[l("img",{src:r.value.logo,alt:r.value.name,class:"size-5 object-cover rounded-full overflow-hidden"},null,8,CH),l("div",$H,j(r.value.name),1)]),l("div",{class:"mt-2.5 text-base text-gray-900 leading-[140%] line-clamp-2",innerHTML:o.value},null,8,TH)],2)):z("",!0)}}},Symbol.toStringTag,{value:"Module"})),EH="data:image/webp;base64,UklGRtAGAABXRUJQVlA4WAoAAAAQAAAATwAATwAAQUxQSHQDAAABoLRtmyHJXtAbEV+Ojd2xbdu27XN2trWybdu2Mba9sn1OZkR876KcGRExAWi7ywCg756XP/7NuLmrCtVi1dxx3zxx+V59ASBzKLlYwOx+6/fz2MZ5P9y2hwWslEkA7PTgdNaGEKPW0xhDYO2Mh3YGIGVxBjj9D5Lqg7KNGryS/OMMwLgyWAHOn0yqj+xg9EpOPh8Q2zEBDhlN+sCOB0+OPgSQzhhBnzdIH1nK6Mk3+kBMB6zBkQsZAksbIhceAWvb5oD7yIKlLsh7AdcmgfmMMbLkMfIzA2mLoOdwFsrSa8HhPSFtcOgziTkrmXNSb7iWLLqOZ8GK5hzXFbYFA/zGnJXN+StgmnN4iTkrnPNFuKYyXE7PSntehqwJh62UWi1l3BKukcFQelbccwhMA8FVLFj5gldC6lgMXkmtnnLlIJgawRMsmMCCj0MAWGyQU1OgzNeHBQQP0zOJng9BYNB3CTUNysV9YQSX0TORnpdCLH5nSEXgb7DYJFJToQwbA1fQM5melwMfMaTkQ3Sfw5iOyNnddo5MatzpYsaURF70KENKAh/5OjVfj2NMSeS4edSUKOetZmJX+9R4plY1Of+n5v/l1JQol89JzZwhjCmJHPIuQ0oC370jNXceT02J8vgNV1PToVyzEUYxpiNyFPAEfTo8nwCOZkhH4NFAr4XUVCgX9YLgVfpUeL4KcTiAMRWRB8LBYCRDGgJHwQCC8+nT4HkBBDAw0xhTEDnNwAAQnEufAs/zIKg1+JeheoFDYFDXYTeqVk65O1w9CO5nUbWCD0DQ0ABj6KvlORYwjeCwac5Ypch8Mzg0m+F4qlZHlScgQ/MZrmLQqmjg1cjQquAeBq2GBt4Lh5aNw72sRlTeB2tag3G4mbECnrwO1qCdxuELhtIVjKfAGbQ3w6X0JQuRU7ZGhnYLzmYoVSzIpy0ydOCUUsWCnHQw4NB+h2NKFDy56GpADDpyKGNTqu3S4EnOvbU3IOiow37NqCfpfdBWNHhPkn9f1B0Qg07tTq0XPcn5OWuDbzKw1g+/a3sAYtBpi53qBU+ueHL7Hhuf/fS/C9nioiHPnrsxACsGnbdYL1IZlJx140DU77PNkZfc+uCzL730zIO3XnrkNn0AwIhFOR1eoZL8/XQHiDVWxKBlI2JRWgN5pSi+PhBAZlDfWCdNOmvQcVZQOCA2AwAAEBIAnQEqUABQAD6RQptKJaOpJqZzPAEgEglsALcBrtmeJf3b8pvZUq3924fE0MNfzAP033BHni+jX0AP8B1G3oAeXF7I37m+jk0QVoKAEM28ZX1Bvu/Qd/YAwzNKM/u7WIhKfKfM5UCi/VqPyy1fqXAeNELL+x/0vfCAyanmz6ARgozz/YZk1AcINuzmw5zBsUNBv6rWKBQAAP7+hwO2nl3XheqGaUHr0VXrM5+plmfGH6mWj3uls1bOfMt/ud8vaff/3PhdErNr0VYDglGwtuE5TdY4tJsi/qmB3Fyu5ekjJHM3+/ALHhQ3AapMI0mrValYr818USUxcL7L8aP8m9zXKUbcY/J8IJmEIGTvGZFEO2AOKEk+nYnR4mvbWxhnUJIhpjZtosZGnU7Q64JsR0WWKjYSHFjmEeWxOfJZbvVtvUW9H8H83STcpAL1D3wqajrI14tJWvWwkhihI9066wKy2DJd6uXWfdj3kisfWmJ+Ps/eN64Mv/G3t8kniLVI9P6QP0BBeC1hKku6NqN/01nmr92masef+qGZRMPptSyZivex0QbQd57ZSZkAgs+kPcQQrFrDMZiMzW7KBSZznEGVv1gxivHe50KOxW+90WcrWvmhcTMt2Bvy15JsAySPkK5HGwmMkSMngEhLnwiRaP2W/hetQIA9ZQzWh4rlCIyzfmO71hUcFH4k40wS15dyhTB4tLXLF+zTJT/I2XzBOk0viLeRaxek2Dxi0LQgg/S+9pyWdlt/U0HkhjqJapySw7JzPSRqHyUm8v6b6G31v7M/iei1qCaj1Xap9JP4/54SdujaMqtntHw0rzHM11NGEepodiBwVGkV0kdu74zCvu9Szrw2upBo7hcEkQ6T/HoKnK0XY/ZS1Ta3y0CLl53I/3/JQxt8shI5RsK2qmH0jJYZET2hUWKaH8c7qg17F7dDpRjS6kstyAk9Z8gygk/41sQlApXP0e+5ofkEuaT8Pr4b4KZRrnfpBiBtMhB/PdllZM1VCbItbHtdP4kxENVhE+dheJKTH7ZpVZvKiGo5XZaowwhvlh3hDT3xiX6S+c0GwE9Cq4+XZ6HYyBZhvuvgBPMlxyAA",IH="data:image/webp;base64,UklGRiIDAABXRUJQVlA4WAoAAAAQAAAAOwAAKQAAQUxQSBYCAAABmS8wRPQ/EHS1bTumV9fzft/3W4PYNiu7SmencrIFTmfV2YOks50qG2Cvtarf9syHp5hZmmcHIiZgAgjAFwFQJ2ukkbLSUurVqlGlQrkygYDHcRyloGKxWCgvL2/QkEF9evXp1KVDhzZtIoAvgkIhIll7rDTdGA2qoDQjfdp88cgtQzyxAiSOuKEGCpVSBaKI+DtVRBUTwpcy02ZocsAznhjgiZ13BkLCERDCwX/qFPmnSqnEGE/tdZsv4ovscEbECaCUhQNEfLfM9ZUT8VwB4aDkfaHARVsIbDRFzAODPmwyViMsAwWLIlZuqUcwH4QJKCwGTGEFmAs1RrMiMBmyUmBUYLQKWVUgrKSkZAhlBKiWlgYFmwKBlAZmoESDWjCrUKuKHaBKJTsKFQJ2gIDHkgPTCUuRkKW8HDsCQwbZAQb0sSPQpweEnW6dzCiR06WNGaBfl3aDqihhQqFTtzZdxoFNhRahPk2gjIi/AL8hYQP4DvgARgU+A96DsOFJfAC889MMMY+BUOAVeHyRE+5Awim5WAWcBEQ8d513FkKOEBAloqBUogIOgC8HMXHOcTdUQmECqogoEP9EFagiQjgQwml1GDw5AODcNMV+a0wxSr1yDv5rUSCKAKEezb574SV48gBAJXwtbgAysrKy0hqk1KlRq0qFCuUCgYDHEQ6gVCwWC+Xl5Awa0K9Xt07tWnUZBgC+HABWUDgg5gAAAHAGAJ0BKjwAKgA+kUKcSiWjoqGquAgAsBIJQBmSPD/btNJ4B+ICARCIkGqat3IjrK03S10Sw6ypi4rmAAD+75rHhRPAdCf3sF3YLuwX+t8bGiqpePf6+ZV0dxFTe7agBbBH1AchhTT7x9k/dJRfGFcPovaDi8eVUNUP1q3g8+OUoGyQgbRPetMkJI13uHCbkXFXPGtBGJws9i1MH8nd+a/UHPeexfV+h69/xluP6t0TfCatucBVlP+EPTXNe3S/cE/iobCvjR5ICW3hH/Yn/qxzc/Gmf3c9jY4ABATpB/fLP+nwAAAA",PH="data:image/webp;base64,UklGRugEAABXRUJQVlA4WAoAAAAQAAAAOwAAOwAAQUxQSHcCAAABoF1texox+izL4aQL5mWqIlAB3WMPyxhmTi4ZqqD7oWVuYCzpf4MeW2ogIiZAizsvacmOvT88eDL5/ffJ04c/7ntniSTvNLjz0qqdl0aJzml8edcqybthKi9t+OkfgBRjMjNLKSaAf49tlHw1gJfWXgdiSCyYQgRurJN8b43qzw2C0asFsC+8mn6qWh+NIDBggPEnqqsenHQQWmNQa+Gw5BZy0lmIDB6N85JbwEm3aY0MreWu5DpV0m3mZDrnrlR1qXWWOdnOuaC6Q6ODtGTcckTNW7w+AsvB3mLGJ/JvqFSPiOREZOxVveb1OS150fKlvCSntYblZrBOTvK6TiA3Ajfl5bSBbDsBm+S8fiKUEDgur1X/YCUY/62WdhIpMrBbukQo5aqWjEhlJCZLdySKtff2kgazviIHfiCWc+xBOYnHT0jlPJ9gpRiz33uwN3cx7PUe/swBeyPWw6SHbI3ZU1IpiecPS3r8I7GUyLF9pHIOvJMo1t5bMiaVkZgs1WVCGYGr0i7iUNbbHmnVv1gJxv9r5HWMUELghLzTRobuCTbLyesGIb/ALdWS0zrDcjNYLyfJ6wva3Fq+lpekSn5MzCsybVS9Jq9PMMvJjM/k9eZGh2lzajmqRm+vdZ55PnMuqlbHSrrLPJc596Wqi5x0l9ZysJb7klN3J13A4nDRuCg5LeqkI9DaMNbCUclp8arWJ2MIQwSYfqa6Uq+N/JdAsH4sAF81atS3l9bdBGJIi6QQgFvrJa/+Ky9tOv4fQIwpmZmlFCLAfyc2S77SoM5Lq3dfmRidbXJ1z2qpdhrceUlL3z1w7PHz2Z9/zp4/PnbgvaWSvNPiAFZQOCBKAgAA0A8AnQEqPAA8AD6ROppIpaMioSwSvMiwEglsALc91bx/6T+O/M+a4978nj5mJyfmAfp90gPMB+z3q8f3L1K+gB/iOox9ADy4PZL/dbCL/5zM1Vzm6J7xhy4G/R3MLed+sS6PrZreMRjtw41/Y6bqD02brsXp8yo0yXZ7V2MLgOLuFvePo02QAP7p7DbDiD2AyeFnhD8uelTZYyYXoBksTpcFgc/ktYPE6iT+knfc/9Jtb588XC/1PKhDE1cUpGsvYvD1Vy4oDHQSmA28w5jCAaxFPaJpFp6vXcWSHtl4WMdzB3qEdnw9/xKklfBKXeCWgCVmbyPy5WnuvHtgZ0OGL6Jy1YsvVUV+2C/mhFD1UAUWH1fVs2H+EfdjxT93F6UkxVMkANEm2YyWfHVGqdBEL4ZpU8RK24FaJcZZx6V2vNHS92tAjgAPnCQ7sK05PprSS16cUciKUh8BN189s1C0WtaAqZ8X8XNGaDq1TfbOOQ69pdTOFumUTwycReIq/h+uKoqH5zdq6qH7bKD0ikCnlMOhJX+iiZOSNC3+jYLD32LMU5VT8TYLVA+cLTaQy7w/Egw5udxqoqfrcSapUVLf+5mTzE7ehYGgAB2cUKyKRqN/ReHqvIXB2PP6QTwINn1hZTeQ+rTWfWSoTSZc7F/8yelk1fypMzzkGu5/3k0seBJ4Qw35QRbCW1jWYbcuGDqMereBBHe+m2Y+oAMKFg64a/izMfpfD2NrBPiCOgr+gTsiO6s7Bd33Ksp/4ePaYCvTufb6zat8b0AAAA==",MH="data:image/webp;base64,UklGRsgCAABXRUJQVlA4ILwCAADQDwCdASo8ADwAPpE+mkoloyIhphVc6LASCWwAyPwycMkVbNA7Te2a8wH6k7qB1yHoAfsZ6Y37R/CJ+1Ho7PJOGfdAOsb43XC1Rnd5ntpzshIe31RIcoFm31ExFqzOptCaeeTKd67V7dWliYw17KyFJlv/a7aKs4VfB4xcnRSRCAuZO+dtYAAA/vz4RBV1eN0U1NoEF8pKwqlyuIW6K/4/cbPyMYJ/pQr9SecL6LJwtcjd+OhNpN95DikBQoaXIdSqPer9MxQgALTc+/Xb1G17b3D2E38w4EEIC1Hkg2K5jEsfQ3H/5dIYH392O1/Kp4xHvGy2f3of/n8TerbP+GjTe0WMRRsm8HcL7XzbSZ/eQiTyDOUamFZg1URFvVrGi9WoBX2DjZeoHadtpp6SZphBfnZ5HQd++VNZVS2P+/XTkFQr6aPzrtFFJF+KFBajDJ89rLuuMmFPdTXNI51OO0a4o+/Gs55TJ4v4873zFJV6dIytNWyKx0/iemiS1Mkf2rDqWh0Okq2RE48VzeClfag/9WxzSiQp8H5pAR6+8709epX0Gwi7oO7novsJ4LfYS1Rl4eT5ir1ASGKUe+mVUFexvfIZC/S4PzyQgN6FxF/s6xP5kPu8OvctjT4qU2mM06VwKkQFxWHdhpFiq8P8DFqPLSENIjySy2gOtgbBcMdYffxCqWUrfQPFbBIykRPs94LdOZfMpS/JD5Wn3LfoA3zoG3Jm/343JbsINmvPcjIg4wJZAkTzQRZ2eZtRfwz5QprDxP8ArsM/z3Hce95ow4iTGtl58FHWAQ7glFcgveS1tilLrJE6e22uozcOl+B+rZPk7XuOZk+LFIH3wxP/hL7waKjcJyU35wdJ5UXMshZDVATPsNh7KQnslc3vJIn25/GQD3KuD3n/6NEh/ZYHTwQDe/si+9+Pwp8S0AAA",OH="data:image/webp;base64,UklGRjAFAABXRUJQVlA4WAoAAAAQAAAAOwAAOwAAQUxQSCcBAAABgKPtf9rmp0ea40xwrzQ73ob5PmnOkWYrMwRs/fVbgv6X2yEiGLZtG0m61wvUXgEA4IBsaTydPyy97DDsVcQvH+bTcSkCHLY0FoX2JVP0opWHNZs3UF+Q4iWE4wlBvJBvVRizeQ/IODBFQ0z2Ny6LAWNhykrCPiwc6jvSVMOEVTgUFhQqKHzLAW3GVDFmE9lLBh0Cz6PSZqYTFcf0WngOp5qPyZxBi8DZgyZ3Syq68JrEoomoEr5ewr86RBPRPUN1z27dzqDbVXQ7kmo3G+h2wuyFYhfNoKXXgRtA/k0nEr7m4FBjotP5y3Cw6DPR2BpdWMAAfY2N090xkKpvaW+r18rmDRiLfOuCKXreyMEabOmA6GR4ena3SCQcoSSLu9lkWMxsbUkAAFZQOCDiAwAAkBMAnQEqPAA8AD6RRJxKpaOioagYCACwEglsAJ0yy7i/xPmn1B3AOm2NtC8/LW+A56TpAP6r1FHoAeWT7IX7qekrWQwZMsVmY+UJ6r+wHsV/sAmBREtU2N9/xgfF8opeIE0NsIuAlPZKb6PHYVYRNE5cBqV9wann0N9gYnI/fhLtJO4WqSGSNtUxxPZp2Be4GUBERjBHfLUJyu8fRJ70TL5529MAAP7i5+SrLJ5fkdH4p9w/L6/Ob+7rKmVW0OdOqSVPGBTfp5QZUDS+/q2P/p6Wt+Ib99JrtE6GeFO/a7+3NGcUXQVlxnXIUY0QaJ/kQqw6gxw73cN6jfwaVd4wdnql2QZuQ/p1Xmf0bnsAL2csUpkT5WCBx59ShbqM9UikwsOcerYPHP3ODfKyLVRR01JRYqWV/xxEXKbT0JqGkE2A3UtAw4y0O6wHQ1tck7/HFuQnkrTimYL14QLddiD2kD5PnzZXz66PgIAnDYVBwyQehO4KGMQu2r0ix2Fv242bQk8cOcPCd94shae5zHmuNZMpcbkDzgQ0zN8QKtnCiFIs8IeXPL+1IW/g3bT4/+nkfoBPDPNphUZyxqfVsQ+joRZmLxRIapH1QQdUIBq1PSEvbXzhx9mGzjeygvag7nsNzgw8C93JCPW/yVADO1FvbAqeHjP8To/eu4lrw0eJ56YnH5PEZVXtBz5rzk4k1gDH+ANgsj74npMSrsFoeMm4SKNPLAvJNmQiQeYvNS8N4/eeA0N69CR24KHJuvK0gmz6hrKFNZsgzTFs1CtPQeaJ7adhkMBu0d1pzyBmgo/R01DmsMsKbgyIKK5fu6kYlIyo8BBqK+e4G/hB058OdO32EP4nDigGdWq+7vXKclkPW63iErBpE88OVyGQ9rwTAyBq/pg766uv9fvNWn1j9F0hG/9P+bkp4CjI/Cg5E5gKZSnYXGjwCkJgz/mDVn1Misb80Y0PGYlQCKSj2zQp7bgnxiFm8ynY4r28zFiQUBlaFHU/b+q1ta4yv6q1DJsfRXm3MpHIifySNr/9WxGzXhSV2nwvlN0STPNjkmHfukscGxVtKjA4V6lMB6/uHBiZRHRSmyNuz4aL9r6vlFa4Y88xUQsLvGS5ZHB8CGmpLcALSNlhmIRX3yc9mGHFH0q26/8xbvgk6siErWxyHanUioWtpLbspm7XzJoMjznUfwjD4z6ayPndm1SCX2wfk2HJrxahGkd4nhEfNkNGqUhxrTx5jE1rkjjkLWOXvcXpAyHneYa5e8hENqWeQMJXm1hra6G7Hi9iF7BLo53iY+gL3VAcS1wvIltQRWuAMT8rnyZTIAAAAA==",LH="data:image/webp;base64,UklGRm4DAABXRUJQVlA4WAoAAAAQAAAATwAATwAAQUxQSJoAAAABd6AokqQ2eumZwxccIImICJB3FP/iTUREOKqtPWryh6Fd/hKihIMCfHTUgAKWLJEQB0RCDHSe589HPgE9Ef2fACN1/0XiOCvUqHuCsLMil7BJN34qdXiD0MO2HpTv6fXDEZo7y/r149gPX5BG/F37ZYmvH8d+uH84wvrK0rSe4z1xeDN4WLmETbrxU6m6Bwg7K0bq/psqznI1VlA4IK4CAACwEACdASpQAFAAPoE2kkelIyGhOtJKAKAQCWgAzXw+R9eob5pGRzP/QD3ifjveLeZL9gPVl9Dfnb9SrvR+Q33MywNLEzXvADYsO0rhxXJx7KXxXdoTB8ZWHAkzZylMtACVBtshEWjG9Sp8Q0aCJZi5rxPVt0wtC6gRLvNhYhlSdVP92uGrp3q5eLDCb2QAAP701AsbKZIFRUBPGa3/BQJhqpXKH/+Wf3m4uoqabIf/1OP+Tj/k47PphdOUJnNzbozRRsC9XhpWuovdCGnqO5RELU8yD0YJ+EPyTwahyQ8Fxbix1/aae9iLM6vj1aD1Jr5eEfeYf6o91HoRPEWxro/W2C3FeuarTtDaT/7rsN6dfxBBbChkpEuqXX5rB15SPub9OUXo3t/jrUbhHvEEmKdIWaQcQ/tjsyu3hXM6idjz8Kk2Sv32kL4MsQcGn9MLR3xy3OJl2cEd2H8LqM+x1eD36Ey7bSMk31KpwnrpkZjw6+9MVU6P+qtf+oqFNdSG/pocX2W8EPZ2pIHAoy8+3Wv6352mPlgJdGXKwDIgp0iFBiMipo1scHutKQ/0zxQ9QCuJGQfsPaSz+Qf1SMWX9SUlNXDrDIxVPET12ny8UtWdcarMIt80h1o5M6FCXSR6LoK+MSAsW6UvVrsfZR+6qSHroWbTR5JfEpo2rfunAjSst0JFQ3r/qliI2e31hdYCKKRxmlana4XfQK54DyKptPIiYr5VrER59fGMiceimEcoIQlpK0kAZcYl+eT+nOna90pXtK8OU3X/NSwH+PT65pfBwRi430iM5IXvQ7ClCOPIDZZP6pcwqnE8x1PzTV4OEdgjOHIVuKFt6iYdGV75SaiwOL/QW7q3VDeews5B8ImQX014vPFQZWHKRUie8rV+XfcGPAynLLfble6Z9v4AAA==",RH={id:"eac-home-screen",class:"relative pt-4 flex flex-col h-full w-full"},DH=l("div",{class:"flex flex-col absolute top-0 left-0 w-full xs:rounded-t-lg overflow-hidden h-72"},[l("div",{class:"flex-1 bg-primary"}),l("div",{class:"h-48",style:{background:`linear-gradient(
180deg,
var(--ui-primary-color) 46.88%,
rgba(0, 0, 0, 0) 100%
)`}})],-1),jH={class:"flex flex-col flex-1 overscroll-none overflow-y-auto px-4 pt-0 pb-2 w-full h-full relative"},NH={class:"p-2 py-8 relative"},FH={key:0,class:"text-[28px] font-semibold text-white whitespace-pre-wrap"},qH={key:1,class:"text-base text-white whitespace-pre-wrap mt-2"},zH={class:"flex-1 space-y-6"},BH={class:"bg-white rounded-2xl border border-gray-200/90 shadow-custom-soft overflow-hidden px-4 py-5"},UH={class:"flex-shrink-0"},VH={class:"relative"},HH=["src","alt"],WH=l("div",{class:"size-3 border-2 border-white bg-green-500 rounded-full absolute bottom-0 right-0"},null,-1),GH={class:"flex-1 min-w-0"},KH={class:"mb-1 flex items-center justify-between"},QH={class:"text-gray-600 text-sm tracking-tight"},JH={class:"flex-shrink-0 size-[18px] bg-red-500 text-white text-[11px] font-semibold rounded-full flex items-center justify-center"},XH={class:"flex items-center gap-2"},ZH={class:"text-base text-gray-900 font-medium line-clamp-2 flex-1"},YH={key:0,class:"space-y-2"},eW=["onClick"],tW={class:"flex-1 text-sm sm:group-hover:font-semibold sm:group-hover:text-primary"},nW={class:"p-1 duration-300 sm:-translate-x-0.5 sm:group-hover:translate-x-1.5 bg-primary text-white border border-primary rounded-full flex items-center justify-center"},sW={key:1,class:"border border-gray-100 shadow-sm rounded-2xl bg-white overflow-hidden"},rW={class:"py-3 px-4 border-b border-b-gray-100 font-medium"},oW={class:"divide-y divide-gray-100"},iW=["href","target"],aW={class:"size-9 bg-gray-50 rounded-full flex items-center justify-center flex-shrink-0"},lW=["src","alt"],cW={class:"text-left"},uW={class:"text-sm text-gray-900"},dW=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"HomeScreen",props:{dataHome:{type:Object,default:()=>({})}},emits:["close-chat","send-message","set-screen"],setup(e,{emit:t}){const{t:n}=en(),s=e,r=t,{bot:o}=Et(ae.state),{messages:i}=Ir(),a=Z(()=>{var w,k;return((k=(w=o.value)==null?void 0:w.config)==null?void 0:k.ui)||{}}),c=Z(()=>{var w,k,S;return((S=(k=(w=o.value)==null?void 0:w.config)==null?void 0:k.quickPrompt)==null?void 0:S.messages)||[]}),u=Z(()=>{var w;return(w=s.dataHome)==null?void 0:w.title}),d=Z(()=>{var w;return(w=s.dataHome)==null?void 0:w.description}),f=Z(()=>{const w=i.value.filter(S=>S.sender_type==="assistant"&&S.content_type==="text");if(w.length===0)return{content:n("home.defaultWelcome"),created_at:null};const k=w[w.length-1];return{content:k.content||n("home.newMessage"),created_at:k.created_at}}),h=()=>{ae.actions.updateChatState({viewTab:"conversations"})},g=w=>{r("send-message",w)},p=(w,k=null)=>w==="custom"?k||B2:{messenger:EH,zalo:yd,hotline:rg,email:Q2,phone:rg,youtube:IH,facebook:PH,tiktok:MH,instagram:OH,linkedin:LH}[w]||tg,v=(w,k)=>k?w==="hotline"||w==="phone"?k.startsWith("tel:")?k:`tel:${k}`:w==="email"?k.startsWith("mailto:")?k:`mailto:${k}`:k:"#",_=Z(()=>{var k;return(((k=s.dataHome)==null?void 0:k.quick_contact)||[]).filter(S=>S.enabled!==!1).map(S=>({type:S.type,href:v(S.type,S.value),target:S.type==="messenger"||S.type==="zalo"||S.type==="custom"?"_blank":void 0,icon:p(S.type,S.logo_url),title:S.title,subtitle:S.description,subtitleClass:S.type==="hotline"||S.type==="phone"?"text-red-500 font-medium":"text-gray-500"}))});return(w,k)=>(m(),x("div",RH,[DH,l("div",jH,[l("div",NH,[l("button",{onClick:k[0]||(k[0]=S=>w.$emit("close-chat")),"aria-label":"eac-close-chat",class:"p-2 absolute right-0 top-0 rounded-lg hover:bg-white/10 cursor-pointer text-white"},[G(y(fl),{size:"20"})]),u.value?(m(),x("div",FH,j(u.value),1)):z("",!0),d.value?(m(),x("div",qH,j(d.value),1)):z("",!0)]),l("div",zH,[l("div",BH,[l("div",{class:"flex gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-100 py-3 px-2.5 rounded-xl cursor-pointer",onClick:k[1]||(k[1]=S=>h())},[l("div",UH,[l("div",VH,[l("img",{src:a.value.iconImage||a.value.logo,alt:a.value.name,class:"size-12 ring-1 ring-gray-100 border-2 border-white rounded-full object-cover shadow-sm"},null,8,HH),WH])]),l("div",GH,[l("div",KH,[l("div",QH,j(a.value.name),1),l("div",JH,j(y(ae).state.chatState.unreadMessageCount||1),1)]),l("div",XH,[l("p",ZH,j(f.value.content),1)])])]),l("button",{onClick:k[2]||(k[2]=S=>h()),class:"w-full mt-3 h-12 rounded-xl text-base text-white bg-primary hover:opacity-90 transition-opacity flex items-center justify-center gap-1"},[We(j(y(n)("home.sendMessage"))+" ",1),G(y(ag),{size:18})])]),c.value.length>0?(m(),x("div",YH,[(m(!0),x(_e,null,Me(c.value,(S,E)=>(m(),x("div",{key:E,onClick:O=>g(S.content),class:"overflow-hidden flex items-center rounded-xl cursor-pointer text-gray-900 px-4 py-3.5 gap-2 bg-white border border-gray-200 shadow-sm group"},[l("div",tW,j(S.content),1),l("div",nW,[G(y(Km),{size:"12","stroke-width":"3.5"})])],8,eW))),128))])):z("",!0),_.value.length>0?(m(),x("div",sW,[l("div",rW,j(y(n)("home.quickLinks")),1),l("div",oW,[(m(!0),x(_e,null,Me(_.value,(S,E)=>(m(),x("a",{key:E,href:S.href,target:S.target,rel:"nofollow noreferrer",class:"flex items-center gap-2.5 px-3 py-2 bg-white hover:bg-gray-50 transition-colors"},[l("div",aW,[typeof S.icon!="string"?(m(),oe(Nt(S.icon),{key:0,size:"22",class:"fill-blue-500 stroke-white stroke-1"})):(m(),x("img",{key:1,src:S.icon,alt:S.title,class:ne(["w-6",["tiktok"].includes(S.type)?"object-cover rounded-full":"object-contain"])},null,10,lW))]),l("div",cW,[l("div",uW,j(S.title),1),l("div",{class:ne(["text-xs",S.subtitleClass])},j(S.subtitle),3)])],8,iW))),128))])])):z("",!0)])])]))}}},Symbol.toStringTag,{value:"Module"})),fW={class:"flex flex-col h-full bg-gray-50"},hW={class:"flex items-center gap-2 p-3 bg-primary relative"},pW=["aria-label"],mW={class:"text-base font-medium text-white"},gW={class:"flex-1 overflow-y-auto p-4"},vW={class:"space-y-6"},yW={key:0},bW={class:"flex items-center gap-2 mb-3 px-1 text-gray-800"},_W={class:"font-semibold"},xW={class:"space-y-2"},wW=["onClick"],kW={class:"overflow-hidden"},SW={class:"px-4 pb-4 pt-0"},CW={class:"text-sm text-gray-600 leading-relaxed whitespace-pre-wrap"},$W={key:1},TW={class:"flex items-center gap-2 mb-3 px-1 text-gray-800"},AW={class:"font-semibold"},EW={class:"space-y-2"},IW=["href"],PW={class:"flex-1 text-sm sm:group-hover:font-semibold sm:group-hover:text-primary"},MW={class:"p-1 duration-300 sm:-translate-x-0.5 sm:group-hover:translate-x-1.5 bg-primary text-white border border-primary rounded-full flex items-center justify-center"},OW=Object.freeze(Object.defineProperty({__proto__:null,default:Qe({__name:"ChatHelps",props:{dataHelpCenter:{type:Object,default:()=>({})}},emits:["close","close-chat"],setup(e){const{t}=en(),n=e,s=R(null),r=Z(()=>{var d;return((d=n.dataHelpCenter)==null?void 0:d.faqs)||[]}),o=Z(()=>{var f;return(((f=n.dataHelpCenter)==null?void 0:f.documents)||[]).map(h=>({icon:h.title.includes("📖")?"📖":"📄",title:h.title.replace(/^📖\s*/,"").trim(),url:h.link}))}),i=d=>{s.value=s.value===d?null:d},a=d=>{d.style.height="0",d.offsetHeight,d.style.height=d.scrollHeight+"px"},c=d=>{d.style.height="auto"},u=d=>{d.style.height=d.scrollHeight+"px",d.offsetHeight,d.style.height="0"};return(d,f)=>(m(),x("div",fW,[l("div",hW,[l("button",{onClick:f[0]||(f[0]=h=>d.$emit("close")),class:"p-1.5 rounded-lg hover:bg-white/10 text-white","aria-label":y(t)("common.back")},[G(y(go),{size:20})],8,pW),l("h2",mW,j(y(t)("help.title")),1),l("button",{onClick:f[1]||(f[1]=h=>d.$emit("close-chat")),"aria-label":"eac-close-chat",class:"p-1.5 rounded-lg hover:bg-white/10 cursor-pointer text-white ml-auto"},[G(y(fl),{size:"20"})])]),l("div",gW,[l("div",vW,[r.value.length>0?(m(),x("div",yW,[l("div",bW,[G(y(Zm),{size:18}),l("h3",_W,j(y(t)("help.faq")),1)]),l("div",xW,[(m(!0),x(_e,null,Me(r.value,(h,g)=>(m(),x("div",{key:g,class:"bg-white shadow-sm rounded-xl border border-gray-200 overflow-hidden transition-all duration-200"},[l("button",{onClick:p=>i(g),class:ne(["w-full flex items-center justify-between px-4 py-3.5 text-left transition-colors",[s.value===g?"":"hover:bg-gray-100 hover:shadow"]])},[l("span",{class:ne(["text-sm text-gray-800 pr-3",s.value===g?"font-semibold":"font-normal"])},j(h.question),3),G(y(mo),{size:16,class:ne(["text-gray-500 flex-shrink-0 transition-transform duration-300",{"rotate-180":s.value===g}])},null,8,["class"])],10,wW),G(Yt,{name:"accordion",onEnter:a,onAfterEnter:c,onLeave:u},{default:Se(()=>[Lt(l("div",kW,[l("div",SW,[l("div",CW,j(h.answer),1)])],512),[[ei,s.value===g]])]),_:2},1024)]))),128))])])):z("",!0),o.value.length>0?(m(),x("div",$W,[l("div",TW,[G(y(er),{size:18}),l("h3",AW,j(y(t)("help.documents")),1)]),l("div",EW,[(m(!0),x(_e,null,Me(o.value,(h,g)=>(m(),x("a",{key:g,href:h.url,target:"_blank",rel:"noopener noreferrer",class:"overflow-hidden flex items-center rounded-xl cursor-pointer text-gray-900 px-4 py-3.5 gap-2 bg-white border border-gray-200 shadow-sm group"},[l("div",PW,j(h.title),1),l("div",MW,[G(y(Km),{size:"12","stroke-width":"3.5"})])],8,IW))),128))])])):z("",!0)])])]))}},[["__scopeId","data-v-6ad2da93"]])},Symbol.toStringTag,{value:"Module"})),LW={class:"flex flex-col h-full bg-gray-50"},RW={class:"flex items-center gap-2 p-3 bg-primary"},DW={class:"text-base font-medium text-white flex-1"},jW={class:"flex-1 overflow-y-auto"},NW={key:0,class:"p-4 space-y-6"},FW={class:"bg-white rounded-2xl border border-gray-200 shadow-sm p-4"},qW={class:"flex items-center gap-2 mb-4 text-gray-800"},zW=l("h3",{class:"text-base font-medium"},"Tra cứu đơn hàng",-1),BW={class:"space-y-3"},UW={class:"relative"},VW=["disabled"],HW={key:1},WW={key:2,class:"flex items-center gap-2"},GW=l("span",{class:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"},null,-1),KW={key:0,class:"bg-red-50 border border-red-200 rounded-xl p-3"},QW={class:"flex items-start gap-2"},JW={class:"text-sm text-red-700"},XW={key:1,class:"p-4 space-y-4"},ZW={class:"bg-white rounded-2xl border border-gray-200 shadow-sm overflow-hidden"},YW={class:"p-4"},eG={class:"flex items-center justify-between mb-2"},tG={class:"flex items-center gap-2"},nG=l("span",{class:"text-sm font-medium text-gray-600"}," Mã đơn hàng: ",-1),sG={class:"font-semibold text-gray-800"},rG={class:"flex items-center justify-between"},oG={class:"text-xs text-gray-500"},iG={key:0,class:"bg-white rounded-2xl border border-gray-200 shadow-sm"},aG=l("div",{class:"py-3 px-4 text-base font-medium text-gray-900 border-b border-gray-200"}," Thông tin người nhận ",-1),lG={class:"py-3 px-4 space-y-2"},cG={key:0,class:"flex space-x-3"},uG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Họ và tên ",-1),dG={class:"text-sm text-gray-700 font-medium"},fG={key:1,class:"flex space-x-3"},hG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Số điện thoại ",-1),pG={class:"text-sm text-gray-700 font-medium"},mG={key:2,class:"flex space-x-3"},gG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Địa chỉ nhận hàng ",-1),vG={class:"text-sm text-gray-700 font-medium"},yG={class:"bg-white rounded-2xl border border-gray-200 shadow-sm"},bG=l("div",{class:"py-3 px-4 text-base font-medium text-gray-900 border-b border-gray-200"}," Thông tin đơn hàng ",-1),_G={class:"py-3 px-4 space-y-2"},xG={class:"flex space-x-3"},wG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Ngày đặt hàng ",-1),kG={class:"text-sm text-gray-700 font-medium"},SG={class:"flex space-x-3"},CG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Mã đơn hàng ",-1),$G={class:"text-sm text-gray-700 font-medium"},TG={key:0,class:"flex space-x-3"},AG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Phương thức thanh toán ",-1),EG={class:"text-sm text-gray-700 font-medium"},IG={key:1,class:"flex space-x-3"},PG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Ghi chú ",-1),MG={class:"text-sm text-gray-700 font-medium"},OG=l("div",{class:"font-semibold text-gray-700 mb-3"}," Sản phẩm đã đặt ",-1),LG={class:"space-y-3 mb-4 border-b border-b-gray-200 pb-4"},RG={class:"flex items-center justify-between"},DG=l("div",{class:"text-gray-500 mr-2 text-sm"}," Tổng tiền hàng ",-1),jG={class:"text-right text-base"},NG={class:"text-gray-700 text-sm"},FG={key:0,class:"flex items-center justify-between"},qG=l("div",{class:"text-gray-500 mr-2 text-sm"}," Khuyến mãi ",-1),zG={class:"text-right text-base"},BG={class:"text-green-500 text-sm"},UG={key:1,class:"flex items-center justify-between"},VG=l("div",{class:"text-gray-500 mr-2 text-sm"}," Phí vận chuyển ",-1),HG={class:"text-right text-base"},WG={class:"text-gray-700 text-sm"},GG={class:"flex items-center justify-between mt-2"},KG=l("div",{class:"text-gray-500 mr-2 text-sm"},[l("span",{class:"font-medium text-gray-900"},"Tổng cộng"),l("span",{class:"text-xs ml-1"},"(Đã bao gồm VAT)")],-1),QG={class:"text-red-500 text-base font-semibold"},JG=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"ChatOrder",emits:["close","close-chat"],setup(e){const t=R(""),n=R(!1),s=R(null),r=R(""),o=R("search"),i=async()=>{if(t.value.trim()){n.value=!0,r.value="",s.value=null;try{const{data:d}=await Xe.order.getOne(t.value.trim());if(d.success){const f={...(d==null?void 0:d.data)??{},order_number:t.value};s.value=f,o.value="detail"}}catch(d){console.error("Error checking order:",d),r.value="Không tìm thấy đơn hàng. Vui lòng kiểm tra lại mã đơn hàng hoặc liên hệ bộ phận chăm sóc khách hàng."}finally{n.value=!1}}},a=()=>{o.value="search",s.value=null,r.value="",t.value=""},c=d=>({pending:"Đang xử lý",confirmed:"Đã xác nhận",processing:"Đang chuẩn bị",shipped:"Đang giao hàng",delivered:"Đã giao hàng",cancelled:"Đã hủy"})[d]||d,u=d=>({pending:"bg-yellow-100 text-yellow-800",confirmed:"bg-blue-100 text-blue-800",processing:"bg-purple-100 text-purple-800",shipped:"bg-indigo-100 text-indigo-800",delivered:"bg-green-100 text-green-800",cancelled:"bg-red-100 text-red-800"})[d]||"bg-gray-100 text-gray-800";return(d,f)=>(m(),x("div",LW,[l("div",RW,[o.value==="detail"?(m(),x("button",{key:0,onClick:a,class:"p-1.5 rounded-lg hover:bg-white/10 text-white","aria-label":"Quay lại"},[G(y(go),{size:20})])):(m(),x("button",{key:1,onClick:f[0]||(f[0]=h=>d.$emit("close")),class:"p-1.5 rounded-lg hover:bg-white/10 text-white","aria-label":"Quay lại"},[G(y(go),{size:20})])),l("h2",DW,j(o.value==="detail"?"Chi tiết đơn hàng":"Tra cứu đơn hàng"),1),l("button",{onClick:f[1]||(f[1]=h=>d.$emit("close-chat")),class:"p-1.5 rounded-lg hover:bg-white/10 text-white","aria-label":"Đóng chat"},[G(y(fl),{size:20})])]),l("div",jW,[o.value==="search"?(m(),x("div",NW,[l("div",FW,[l("div",qW,[G(y(Wu),{size:18}),zW]),l("div",BW,[l("div",UW,[Lt(l("input",{"onUpdate:modelValue":f[2]||(f[2]=h=>t.value=h),type:"text",placeholder:"Nhập mã đơn hàng (VD: DH123456)",class:"w-full px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/20 focus:border-primary outline-none transition-colors bg-white",onKeyup:gr(i,["enter"])},null,544),[[rn,t.value]])]),l("button",{onClick:i,disabled:!t.value.trim()||n.value,class:"w-full py-2.5 bg-primary text-white font-medium rounded-lg hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-opacity flex items-center justify-center gap-2"},[n.value?z("",!0):(m(),oe(y(pl),{key:0,size:18})),n.value?(m(),x("span",WW,[GW,We(" Đang tìm kiếm... ")])):(m(),x("span",HW,"Kiểm tra đơn hàng"))],8,VW)])]),r.value?(m(),x("div",KW,[l("div",QW,[G(y(Xm),{size:18,class:"text-red-500 flex-shrink-0 mt-0.5"}),l("div",JW,j(r.value),1)])])):z("",!0)])):o.value==="detail"&&s.value?(m(),x("div",XW,[l("div",ZW,[l("div",YW,[l("div",eG,[l("div",tG,[G(y(Wu),{size:20,class:"text-primary"}),nG,l("span",sG," #"+j(s.value.order_number),1)])]),l("div",rG,[l("div",oG," Ngày đặt: "+j(y(ja)(s.value.created_at)),1),s.value.status?(m(),x("span",{key:0,class:ne(["px-3 py-1 text-xs font-medium rounded-full",u(s.value.status)])},j(c(s.value.status)),3)):z("",!0)])])]),s.value.shipping_address?(m(),x("div",iG,[aG,l("div",lG,[s.value.shipping_address.name?(m(),x("div",cG,[uG,l("div",dG,j(s.value.shipping_address.name),1)])):z("",!0),s.value.shipping_address.phone?(m(),x("div",fG,[hG,l("div",pG,j(s.value.shipping_address.phone),1)])):z("",!0),s.value.shipping_address.address1?(m(),x("div",mG,[gG,l("div",vG,j(s.value.shipping_address.address1),1)])):z("",!0)])])):z("",!0),l("div",yG,[bG,l("div",_G,[l("div",xG,[wG,l("div",kG,j(y(ja)(s.value.created_at)),1)]),l("div",SG,[CG,l("div",$G," #"+j(s.value.order_number),1)]),s.value.payment_gateway_names?(m(),x("div",TG,[AG,l("div",EG,j(s.value.payment_gateway_names),1)])):z("",!0),s.value.note?(m(),x("div",IG,[PG,l("div",MG,j(s.value.note),1)])):z("",!0)])]),l("div",null,[OG,l("div",LG,[(m(!0),x(_e,null,Me(s.value.items,h=>(m(),oe(Ll,{key:h.sku,item:h},null,8,["item"]))),128))]),l("div",null,[l("div",RG,[DG,l("div",jG,[l("div",NG,j(y(et)(s.value.subtotal_price)),1)])]),s.value.total_discounts?(m(),x("div",FG,[qG,l("div",zG,[l("div",BG,j(y(et)(s.value.total_discounts)),1)])])):z("",!0),s.value.shipping_price?(m(),x("div",UG,[VG,l("div",HG,[l("div",WG,j(y(et)(s.value.shipping_price)),1)])])):z("",!0),l("div",GG,[KG,l("div",QG,j(y(et)(s.value.total_price)),1)])])])])):z("",!0)])]))}}},Symbol.toStringTag,{value:"Module"}))});