453 lines
914 KiB
Plaintext
453 lines
914 KiB
Plaintext
(function(Nt){typeof define=="function"&&define.amd?define(Nt):Nt()})(function(){"use strict";var QK=Object.defineProperty;var s0=Nt=>{throw TypeError(Nt)};var JK=(Nt,nt,sn)=>nt in Nt?QK(Nt,nt,{enumerable:!0,configurable:!0,writable:!0,value:sn}):Nt[nt]=sn;var Ct=(Nt,nt,sn)=>JK(Nt,typeof nt!="symbol"?nt+"":nt,sn),XK=(Nt,nt,sn)=>nt.has(Nt)||s0("Cannot "+sn);var r0=(Nt,nt,sn)=>nt.has(Nt)?s0("Cannot add the same private member more than once"):nt instanceof WeakSet?nt.add(Nt):nt.set(Nt,sn);var bc=(Nt,nt,sn)=>(XK(Nt,nt,"access private method"),sn);/**
|
||
* @vue/shared v3.4.21
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/var Lr,Bd,i0;function Nt(e,t){const n=new Set(e.split(","));return s=>n.has(s)}const nt={},sn=[],In=()=>{},l0=()=>!1,Bi=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),_c=e=>e.startsWith("onUpdate:"),Zt=Object.assign,xc=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},c0=Object.prototype.hasOwnProperty,ft=(e,t)=>c0.call(e,t),He=Array.isArray,Fr=e=>zr(e)==="[object Map]",qr=e=>zr(e)==="[object Set]",Ud=e=>zr(e)==="[object Date]",u0=e=>zr(e)==="[object RegExp]",et=e=>typeof e=="function",Et=e=>typeof e=="string",Ls=e=>typeof e=="symbol",bt=e=>e!==null&&typeof e=="object",Vd=e=>(bt(e)||et(e))&&et(e.then)&&et(e.catch),Hd=Object.prototype.toString,zr=e=>Hd.call(e),d0=e=>zr(e).slice(8,-1),Wd=e=>zr(e)==="[object Object]",wc=e=>Et(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Io=Nt(",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))},f0=/-(\w)/g,Pn=Ui(e=>e.replace(f0,(t,n)=>n?n.toUpperCase():"")),h0=/\B([A-Z])/g,Rs=Ui(e=>e.replace(h0,"-$1").toLowerCase()),Vi=Ui(e=>e.charAt(0).toUpperCase()+e.slice(1)),Hi=Ui(e=>e?`on${Vi(e)}`:""),ls=(e,t)=>!Object.is(e,t),Br=(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})},Po=e=>{const t=parseFloat(e);return isNaN(t)?e:t},p0=e=>{const t=Et(e)?Number(e):NaN;return isNaN(t)?e:t};let Gd;const Kd=()=>Gd||(Gd=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function mt(e){if(He(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],r=Et(s)?y0(s):mt(s);if(r)for(const o in r)t[o]=r[o]}return t}else if(Et(e)||bt(e))return e}const m0=/;(?![^(]*\))/g,g0=/:([^]+)/,v0=/\/\*[^]*?\*\//g;function y0(e){const t={};return e.replace(v0,"").split(m0).forEach(n=>{if(n){const s=n.split(g0);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function ne(e){let t="";if(Et(e))t=e;else if(He(e))for(let n=0;n<e.length;n++){const s=ne(e[n]);s&&(t+=s+" ")}else if(bt(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&&!Et(t)&&(e.class=ne(t)),n&&(e.style=mt(n)),e}const b0=Nt("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function Qd(e){return!!e||e===""}function _0(e,t){if(e.length!==t.length)return!1;let n=!0;for(let s=0;n&&s<e.length;s++)n=rr(e[s],t[s]);return n}function rr(e,t){if(e===t)return!0;let n=Ud(e),s=Ud(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=He(e),s=He(t),n||s)return n&&s?_0(e,t):!1;if(n=bt(e),s=bt(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||!rr(e[i],t[i]))return!1}}return String(e)===String(t)}function kc(e,t){return e.findIndex(n=>rr(n,t))}const D=e=>Et(e)?e:e==null?"":He(e)||bt(e)&&(e.toString===Hd||!et(e.toString))?JSON.stringify(e,Jd,2):String(e),Jd=(e,t)=>t&&t.__v_isRef?Jd(e,t.value):Fr(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[s,r],o)=>(n[Sc(s,o)+" =>"]=r,n),{})}:qr(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Sc(n))}:Ls(t)?Sc(t):bt(t)&&!He(t)&&!Wd(t)?String(t):t,Sc=(e,t="")=>{var n;return Ls(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};let Mn;class Xd{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=Mn,!t&&Mn&&(this.index=(Mn.scopes||(Mn.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){const n=Mn;try{return Mn=this,t()}finally{Mn=n}}}on(){Mn=this}off(){Mn=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 x0(e){return new Xd(e)}function w0(e,t=Mn){t&&t.active&&t.effects.push(e)}function Zd(){return Mn}function k0(e){Mn&&Mn.cleanups.push(e)}let or;class Cc{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,w0(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&&(S0(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=or;try{return Ds=!0,or=this,this._runnings++,Yd(this),this.fn()}finally{ef(this),this._runnings--,or=n,Ds=t}}stop(){var t;this.active&&(Yd(this),ef(this),(t=this.onStop)==null||t.call(this),this.active=!1)}}function S0(e){return e.value}function Yd(e){e._trackId++,e._depsLength=0}function ef(e){if(e.deps.length>e._depsLength){for(let t=e._depsLength;t<e.deps.length;t++)tf(e.deps[t],e);e.deps.length=e._depsLength}}function tf(e,t){const n=e.get(t);n!==void 0&&t._trackId!==n&&(e.delete(t),e.size===0&&e.cleanup())}let Ds=!0,$c=0;const nf=[];function js(){nf.push(Ds),Ds=!1}function Ns(){const e=nf.pop();Ds=e===void 0?!0:e}function Tc(){$c++}function Ac(){for($c--;!$c&&Ec.length;)Ec.shift()()}function sf(e,t,n){if(t.get(e)!==e._trackId){t.set(e,e._trackId);const s=e.deps[e._depsLength];s!==t?(s&&tf(s,e),e.deps[e._depsLength++]=t):e._depsLength++}}const Ec=[];function rf(e,t,n){Tc();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&&Ec.push(s.scheduler)))}Ac()}const of=(e,t)=>{const n=new Map;return n.cleanup=e,n.computed=t,n},Ki=new WeakMap,ir=Symbol(""),Ic=Symbol("");function wn(e,t,n){if(Ds&&or){let s=Ki.get(e);s||Ki.set(e,s=new Map);let r=s.get(n);r||s.set(n,r=of(()=>s.delete(n))),sf(or,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"&&He(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":He(e)?wc(n)&&a.push(i.get("length")):(a.push(i.get(ir)),Fr(e)&&a.push(i.get(Ic)));break;case"delete":He(e)||(a.push(i.get(ir)),Fr(e)&&a.push(i.get(Ic)));break;case"set":Fr(e)&&a.push(i.get(ir));break}Tc();for(const c of a)c&&rf(c,4);Ac()}function C0(e,t){var n;return(n=Ki.get(e))==null?void 0:n.get(t)}const $0=Nt("__proto__,__v_isRef,__isVue"),af=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Ls)),lf=T0();function T0(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){const s=ct(this);for(let o=0,i=this.length;o<i;o++)wn(s,"get",o+"");const r=s[t](...n);return r===-1||r===!1?s[t](...n.map(ct)):r}}),["push","pop","shift","unshift","splice"].forEach(t=>{e[t]=function(...n){js(),Tc();const s=ct(this)[t].apply(this,n);return Ac(),Ns(),s}}),e}function A0(e){const t=ct(this);return wn(t,"has",e),t.hasOwnProperty(e)}class cf{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?z0:vf:o?gf:mf).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const i=He(t);if(!r){if(i&&ft(lf,n))return Reflect.get(lf,n,s);if(n==="hasOwnProperty")return A0}const a=Reflect.get(t,n,s);return(Ls(n)?af.has(n):$0(n))||(r||wn(t,"get",n),o)?a:Bt(a)?i&&wc(n)?a:a.value:bt(a)?r?Ur(a):ht(a):a}}class uf extends cf{constructor(t=!1){super(!1,t)}set(t,n,s,r){let o=t[n];if(!this._isShallow){const c=Hr(o);if(!ta(s)&&!Hr(s)&&(o=ct(o),s=ct(s)),!He(t)&&Bt(o)&&!Bt(s))return c?!1:(o.value=s,!0)}const i=He(t)&&wc(n)?Number(n)<t.length:ft(t,n),a=Reflect.set(t,n,s,r);return t===ct(r)&&(i?ls(s,o)&&xs(t,"set",n,s):xs(t,"add",n,s)),a}deleteProperty(t,n){const s=ft(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)||!af.has(n))&&wn(t,"has",n),s}ownKeys(t){return wn(t,"iterate",He(t)?"length":ir),Reflect.ownKeys(t)}}class E0 extends cf{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const I0=new uf,P0=new E0,M0=new uf(!0),Pc=e=>e,Qi=e=>Reflect.getPrototypeOf(e);function Ji(e,t,n=!1,s=!1){e=e.__v_raw;const r=ct(e),o=ct(t);n||(ls(t,o)&&wn(r,"get",t),wn(r,"get",o));const{has:i}=Qi(r),a=s?Pc:n?Lc:Mo;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=ct(n),r=ct(e);return t||(ls(e,r)&&wn(s,"has",e),wn(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&&wn(ct(e),"iterate",ir),Reflect.get(e,"size",e)}function df(e){e=ct(e);const t=ct(this);return Qi(t).has.call(t,e)||(t.add(e),xs(t,"add",e,e)),this}function ff(e,t){t=ct(t);const n=ct(this),{has:s,get:r}=Qi(n);let o=s.call(n,e);o||(e=ct(e),o=s.call(n,e));const i=r.call(n,e);return n.set(e,t),o?ls(t,i)&&xs(n,"set",e,t):xs(n,"add",e,t),this}function hf(e){const t=ct(this),{has:n,get:s}=Qi(t);let r=n.call(t,e);r||(e=ct(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 pf(){const e=ct(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=ct(i),c=t?Pc:e?Lc:Mo;return!e&&wn(a,"iterate",ir),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=ct(r),i=Fr(o),a=e==="entries"||e===Symbol.iterator&&i,c=e==="keys"&&i,u=r[e](...s),d=n?Pc:t?Lc:Mo;return!t&&wn(o,"iterate",c?Ic:ir),{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 O0(){const e={get(o){return Ji(this,o)},get size(){return Zi(this)},has:Xi,add:df,set:ff,delete:hf,clear:pf,forEach:Yi(!1,!1)},t={get(o){return Ji(this,o,!1,!0)},get size(){return Zi(this)},has:Xi,add:df,set:ff,delete:hf,clear:pf,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[L0,R0,D0,j0]=O0();function Mc(e,t){const n=t?e?j0:D0:e?R0:L0;return(s,r,o)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?s:Reflect.get(ft(n,r)&&r in s?n:s,r,o)}const N0={get:Mc(!1,!1)},F0={get:Mc(!1,!0)},q0={get:Mc(!0,!1)},mf=new WeakMap,gf=new WeakMap,vf=new WeakMap,z0=new WeakMap;function B0(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function U0(e){return e.__v_skip||!Object.isExtensible(e)?0:B0(d0(e))}function ht(e){return Hr(e)?e:Oc(e,!1,I0,N0,mf)}function V0(e){return Oc(e,!1,M0,F0,gf)}function Ur(e){return Oc(e,!0,P0,q0,vf)}function Oc(e,t,n,s,r){if(!bt(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=r.get(e);if(o)return o;const i=U0(e);if(i===0)return e;const a=new Proxy(e,i===2?s:n);return r.set(e,a),a}function Vr(e){return Hr(e)?Vr(e.__v_raw):!!(e&&e.__v_isReactive)}function Hr(e){return!!(e&&e.__v_isReadonly)}function ta(e){return!!(e&&e.__v_isShallow)}function yf(e){return Vr(e)||Hr(e)}function ct(e){const t=e&&e.__v_raw;return t?ct(t):e}function bf(e){return Object.isExtensible(e)&&Wi(e,"__v_skip",!0),e}const Mo=e=>bt(e)?ht(e):e,Lc=e=>bt(e)?Ur(e):e;class _f{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 Cc(()=>t(this._value),()=>Oo(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=ct(this);return(!t._cacheable||t.effect.dirty)&&ls(t._value,t._value=t.effect.run())&&Oo(t,4),Rc(t),t.effect._dirtyLevel>=2&&Oo(t,2),t._value}set value(t){this._setter(t)}get _dirty(){return this.effect.dirty}set _dirty(t){this.effect.dirty=t}}function H0(e,t,n=!1){let s,r;const o=et(e);return o?(s=e,r=In):(s=e.get,r=e.set),new _f(s,r,o||!r,n)}function Rc(e){var t;Ds&&or&&(e=ct(e),sf(or,(t=e.dep)!=null?t:e.dep=of(()=>e.dep=void 0,e instanceof _f?e:void 0)))}function Oo(e,t=4,n){e=ct(e);const s=e.dep;s&&rf(s,t)}function Bt(e){return!!(e&&e.__v_isRef===!0)}function L(e){return wf(e,!1)}function xf(e){return wf(e,!0)}function wf(e,t){return Bt(e)?e:new W0(e,t)}class W0{constructor(t,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?t:ct(t),this._value=n?t:Mo(t)}get value(){return Rc(this),this._value}set value(t){const n=this.__v_isShallow||ta(t)||Hr(t);t=n?t:ct(t),ls(t,this._rawValue)&&(this._rawValue=t,this._value=n?t:Mo(t),Oo(this,4))}}function y(e){return Bt(e)?e.value:e}const G0={get:(e,t,n)=>y(Reflect.get(e,t,n)),set:(e,t,n,s)=>{const r=e[t];return Bt(r)&&!Bt(n)?(r.value=n,!0):Reflect.set(e,t,n,s)}};function kf(e){return Vr(e)?e:new Proxy(e,G0)}class K0{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:n,set:s}=t(()=>Rc(this),()=>Oo(this));this._get=n,this._set=s}get value(){return this._get()}set value(t){this._set(t)}}function Q0(e){return new K0(e)}function It(e){const t=He(e)?new Array(e.length):{};for(const n in e)t[n]=Sf(e,n);return t}class J0{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 C0(ct(this._object),this._key)}}class X0{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function Z0(e,t,n){return Bt(e)?e:et(e)?new X0(e):bt(e)&&arguments.length>1?Sf(e,t,n):L(e)}function Sf(e,t,n){const s=e[t];return Bt(s)?s:new J0(e,t,n)}var Lo={FORGE_RELEASE_DIRECTORY:"/home/forge/widget.geteasy.ai/releases/74622250",FORGE_SITE_BRANCH:"main",USER:"forge",SSH_CLIENT:"159.203.150.232 50106 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:"fix(constants): comment out viettelstorevn bot handle in hidden chat view (#943)",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:"74622250",npm_config_registry:"https://registry.npmjs.org/",FORGE_COMPOSER:"php8.4 /usr/local/bin/composer",XDG_SESSION_ID:"135159",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:"1afe463af8f79a0453405d5d611c3ed71a350f18",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 50106 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 Ro=[];function Y0(e,...t){js();const n=Ro.length?Ro[Ro.length-1].component:null,s=n&&n.appContext.config.warnHandler,r=ey();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 <${xh(n,o.type)}>`).join(`
|
||
`),r]);else{const o=[`[Vue warn]: ${e}`,...t];r.length&&o.push(`
|
||
`,...ty(r)),console.warn(...o)}Ns()}function ey(){let e=Ro[Ro.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 ty(e){const t=[];return e.forEach((n,s)=>{t.push(...s===0?[]:[`
|
||
`],...ny(n))}),t}function ny({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",s=e.component?e.component.parent==null:!1,r=` at <${xh(e.component,e.type,s)}`,o=">"+n;return e.props?[r,...sy(e.props),o]:[r+o]}function sy(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(s=>{t.push(...Cf(s,e[s]))}),n.length>3&&t.push(" ..."),t}function Cf(e,t,n){return Et(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):typeof t=="number"||typeof t=="boolean"||t==null?n?t:[`${e}=${t}`]:Bt(t)?(t=Cf(e,ct(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):et(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=ct(t),n?t:[`${e}=`,t])}function ws(e,t,n,s){try{return s?e(...s):e()}catch(r){Do(r,t,n)}}function jn(e,t,n,s){if(et(e)){const o=ws(e,t,n,s);return o&&Vd(o)&&o.catch(i=>{Do(i,t,n)}),o}const r=[];for(let o=0;o<e.length;o++)r.push(jn(e[o],t,n,s));return r}function Do(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}}ry(e,n,r,s)}function ry(e,t,n,s=!0){console.error(e)}let jo=!1,Dc=!1;const hn=[];let cs=0;const Wr=[];let qs=null,ar=0;const $f=Promise.resolve();let jc=null;function wt(e){const t=jc||$f;return e?t.then(this?e.bind(this):e):t}function oy(e){let t=cs+1,n=hn.length;for(;t<n;){const s=t+n>>>1,r=hn[s],o=No(r);o<e||o===e&&r.pre?t=s+1:n=s}return t}function na(e){(!hn.length||!hn.includes(e,jo&&e.allowRecurse?cs+1:cs))&&(e.id==null?hn.push(e):hn.splice(oy(e.id),0,e),Tf())}function Tf(){!jo&&!Dc&&(Dc=!0,jc=$f.then(If))}function iy(e){const t=hn.indexOf(e);t>cs&&hn.splice(t,1)}function ay(e){He(e)?Wr.push(...e):(!qs||!qs.includes(e,e.allowRecurse?ar+1:ar))&&Wr.push(e),Tf()}function Af(e,t,n=jo?cs+1:0){for(;n<hn.length;n++){const s=hn[n];if(s&&s.pre){if(e&&s.id!==e.uid)continue;hn.splice(n,1),n--,s()}}}function Ef(e){if(Wr.length){const t=[...new Set(Wr)].sort((n,s)=>No(n)-No(s));if(Wr.length=0,qs){qs.push(...t);return}for(qs=t,ar=0;ar<qs.length;ar++)qs[ar]();qs=null,ar=0}}const No=e=>e.id==null?1/0:e.id,ly=(e,t)=>{const n=No(e)-No(t);if(n===0){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function If(e){Dc=!1,jo=!0,hn.sort(ly);const t=In;try{for(cs=0;cs<hn.length;cs++){const n=hn[cs];n&&n.active!==!1&&(Lo.NODE_ENV!=="production"&&t(n),ws(n,null,14))}}finally{cs=0,hn.length=0,Ef(),jo=!1,jc=null,(hn.length||Wr.length)&&If()}}function cy(e,t,...n){if(e.isUnmounted)return;const s=e.vnode.props||nt;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]||nt;h&&(r=n.map(g=>Et(g)?g.trim():g)),f&&(r=n.map(Po))}let a,c=s[a=Hi(t)]||s[a=Hi(Pn(t))];!c&&o&&(c=s[a=Hi(Rs(t))]),c&&jn(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,jn(u,e,6,r)}}function Pf(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(!et(e)){const c=u=>{const d=Pf(u,t,!0);d&&(a=!0,Zt(i,d))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!o&&!a?(bt(e)&&s.set(e,null),null):(He(o)?o.forEach(c=>i[c]=null):Zt(i,o),bt(e)&&s.set(e,i),i)}function sa(e,t){return!e||!Bi(t)?!1:(t=t.slice(2).replace(/Once$/,""),ft(e,t[0].toLowerCase()+t.slice(1))||ft(e,Rs(t))||ft(e,t))}let Gt=null,ra=null;function oa(e){const t=Gt;return Gt=e,ra=e&&e.type.__scopeId||null,t}function gn(e){ra=e}function vn(){ra=null}function xe(e,t=Gt,n){if(!t||e._n)return e;const s=(...r)=>{s._d&&hh(-1);const o=oa(t);let i;try{i=e(...r)}finally{oa(o),s._d&&hh(1)}return i};return s._n=!0,s._c=!0,s._d=!0,s}function YK(){}function Mf(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=Lo.NODE_ENV!=="production"&&g.__isScriptSetup?new Proxy(E,{get(I,M,P){return Y0(`Property '${String(M)}' was accessed via 'this'. Avoid using 'this' in templates.`),Reflect.get(I,M,P)}}):E;_=ds(d.call(O,E,f,o,g,h,p)),w=c}else{const E=t;Lo.NODE_ENV,_=ds(E.length>1?E(o,Lo.NODE_ENV!=="production"?{get attrs(){return c},slots:a,emit:u}:{attrs:c,slots:a,emit:u}):E(o,null)),w=t.props?c:uy(c)}}catch(E){Wo.length=0,Do(E,e,1),_=G(On)}let C=_;if(w&&v!==!1){const E=Object.keys(w),{shapeFlag:O}=C;E.length&&O&7&&(i&&E.some(_c)&&(w=dy(w,i)),C=us(C,w))}return n.dirs&&(C=us(C),C.dirs=C.dirs?C.dirs.concat(n.dirs):n.dirs),n.transition&&(C.transition=n.transition),_=C,oa(k),_}const uy=e=>{let t;for(const n in e)(n==="class"||n==="style"||Bi(n))&&((t||(t={}))[n]=e[n]);return t},dy=(e,t)=>{const n={};for(const s in e)(!_c(s)||!(s.slice(9)in t))&&(n[s]=e[s]);return n};function fy(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?Of(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?Of(s,i,u):!0:!!i;return!1}function Of(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 hy({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 py="components",Lf=Symbol.for("v-ndc");function Ft(e){return Et(e)?my(py,e,!1)||e:e||Lf}function my(e,t,n=!0,s=!1){const r=Gt||Ut;if(r){const o=r.type;{const a=wa(o,!1);if(a&&(a===t||a===Pn(t)||a===Vi(Pn(t))))return o}const i=Rf(r[e]||o[e],t)||Rf(r.appContext[e],t);return!i&&s?o:i}}function Rf(e,t){return e&&(e[t]||e[Pn(t)]||e[Vi(Pn(t))])}const Df=e=>e.__isSuspense;function gy(e,t){t&&t.pendingBranch?He(e)?t.effects.push(...e):t.effects.push(e):ay(e)}const vy=Symbol.for("v-scx"),yy=()=>Qr(vy);function ks(e,t){return aa(e,null,t)}function by(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}=nt){if(t&&o){const I=t;t=(...M)=>{I(...M),O()}}const c=Ut,u=I=>s===!0?I:lr(I,s===!1?1:void 0);let d,f=!1,h=!1;if(Bt(e)?(d=()=>e.value,f=ta(e)):Vr(e)?(d=()=>u(e),f=!0):He(e)?(h=!0,f=e.some(I=>Vr(I)||ta(I)),d=()=>e.map(I=>{if(Bt(I))return I.value;if(Vr(I))return u(I);if(et(I))return ws(I,c,2)})):et(e)?t?d=()=>ws(e,c,2):d=()=>(g&&g(),jn(e,c,3,[p])):d=In,t&&s){const I=d;d=()=>lr(I())}let g,p=I=>{g=C.onStop=()=>{ws(I,c,4),g=C.onStop=void 0}},v;if(Jo)if(p=In,t?n&&jn(t,c,3,[d(),h?[]:void 0,p]):d(),r==="sync"){const I=yy();v=I.__watcherHandles||(I.__watcherHandles=[])}else return In;let _=h?new Array(e.length).fill(ia):ia;const w=()=>{if(!(!C.active||!C.dirty))if(t){const I=C.run();(s||f||(h?I.some((M,P)=>ls(M,_[P])):ls(I,_)))&&(g&&g(),jn(t,c,3,[I,_===ia?void 0:h&&_[0]===ia?[]:_,p]),_=I)}else C.run()};w.allowRecurse=!!t;let k;r==="sync"?k=w:r==="post"?k=()=>rn(w,c&&c.suspense):(w.pre=!0,c&&(w.id=c.uid),k=()=>na(w));const C=new Cc(d,In,k),E=Zd(),O=()=>{C.stop(),E&&xc(E.effects,C)};return t?n?w():_=C.run():r==="post"?rn(C.run.bind(C),c&&c.suspense):C.run(),v&&v.push(O),O}function _y(e,t,n){const s=this.proxy,r=Et(e)?e.includes(".")?jf(s,e):()=>s[e]:e.bind(s,s);let o;et(t)?o=t:(o=t.handler,n=t);const i=Qo(this),a=aa(r,o.bind(s),n);return i(),a}function jf(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 lr(e,t,n=0,s){if(!bt(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),Bt(e))lr(e.value,t,n,s);else if(He(e))for(let r=0;r<e.length;r++)lr(e[r],t,n,s);else if(qr(e)||Fr(e))e.forEach(r=>{lr(r,t,n,s)});else if(Wd(e))for(const r in e)lr(e[r],t,n,s);return e}function Rt(e,t){if(Gt===null)return e;const n=xa(Gt)||Gt.proxy,s=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[o,i,a,c=nt]=t[r];o&&(et(o)&&(o={mounted:o,updated:o}),o.deep&&lr(i),s.push({dir:o,instance:n,value:i,oldValue:void 0,arg:a,modifiers:c}))}return e}function cr(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(),jn(c,n,8,[e.el,a,e,t]),Ns())}}const zs=Symbol("_leaveCb"),la=Symbol("_enterCb");function xy(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Je(()=>{e.isMounted=!0}),Xn(()=>{e.isUnmounting=!0}),e}const Nn=[Function,Array],Nf={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Nn,onEnter:Nn,onAfterEnter:Nn,onEnterCancelled:Nn,onBeforeLeave:Nn,onLeave:Nn,onAfterLeave:Nn,onLeaveCancelled:Nn,onBeforeAppear:Nn,onAppear:Nn,onAfterAppear:Nn,onAppearCancelled:Nn},wy={name:"BaseTransition",props:Nf,setup(e,{slots:t}){const n=Yn(),s=xy();return()=>{const r=t.default&&zf(t.default(),!0);if(!r||!r.length)return;let o=r[0];if(r.length>1){for(const h of r)if(h.type!==On){o=h;break}}const i=ct(e),{mode:a}=i;if(s.isLeaving)return Fc(o);const c=qf(o);if(!c)return Fc(o);const u=Nc(c,i,s,n);ca(c,u);const d=n.subTree,f=d&&qf(d);if(f&&f.type!==On&&!Bs(c,f)){const h=Nc(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())},Fc(o);a==="in-out"&&c.type!==On&&(h.delayLeave=(g,p,v)=>{const _=Ff(s,f);_[String(f.key)]=f,g[zs]=()=>{p(),g[zs]=void 0,delete u.delayedLeave},u.delayedLeave=v})}return o}}};function Ff(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 Nc(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,C=String(e.key),E=Ff(n,e),O=(P,q)=>{P&&jn(P,s,9,q)},I=(P,q)=>{const H=q[1];O(P,q),He(P)?P.every(T=>T.length<=1)&&H():P.length<=1&&H()},M={mode:o,persisted:i,beforeEnter(P){let q=a;if(!n.isMounted)if(r)q=v||a;else return;P[zs]&&P[zs](!0);const H=E[C];H&&Bs(e,H)&&H.el[zs]&&H.el[zs](),O(q,[P])},enter(P){let q=c,H=u,T=d;if(!n.isMounted)if(r)q=_||c,H=w||u,T=k||d;else return;let A=!1;const R=P[la]=K=>{A||(A=!0,K?O(T,[P]):O(H,[P]),M.delayedLeave&&M.delayedLeave(),P[la]=void 0)};q?I(q,[P,R]):R()},leave(P,q){const H=String(e.key);if(P[la]&&P[la](!0),n.isUnmounting)return q();O(f,[P]);let T=!1;const A=P[zs]=R=>{T||(T=!0,q(),R?O(p,[P]):O(g,[P]),P[zs]=void 0,E[H]===e&&delete E[H])};E[H]=e,h?I(h,[P,A]):A()},clone(P){return Nc(P,t,n,s)}};return M}function Fc(e){if(Fo(e))return e=us(e),e.children=null,e}function qf(e){return Fo(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 zf(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===be?(i.patchFlag&128&&r++,s=s.concat(zf(i.children,t,a))):(t||i.type!==On)&&s.push(a!=null?us(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 Yt(e,t){return et(e)?Zt({name:e.name},t,{setup:e}):e}const Gr=e=>!!e.type.__asyncLoader;/*! #__NO_SIDE_EFFECTS__ */function Kt(e){et(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 Yt({name:"AsyncComponentWrapper",__asyncLoader:h,get __asyncResolved(){return u},setup(){const g=Ut;if(u)return()=>qc(u,g);const p=k=>{c=null,Do(k,g,13,!s)};if(i&&g.suspense||Jo)return h().then(k=>()=>qc(k,g)).catch(k=>(p(k),()=>s?G(s,{error:k}):null));const v=L(!1),_=L(),w=L(!!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&&Fo(g.parent.vnode)&&(g.parent.effect.dirty=!0,na(g.parent.update))}).catch(k=>{p(k),_.value=k}),()=>{if(v.value&&u)return qc(u,g);if(_.value&&s)return G(s,{error:_.value});if(n&&!w.value)return G(n)}}})}function qc(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 Fo=e=>e.type.__isKeepAlive,qo={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=Yn(),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,C,E,O,I)=>{const M=k.component;u(k,C,E,0,a),c(M.vnode,k,C,E,M,a,O,k.slotScopeIds,I),rn(()=>{M.isDeactivated=!1,M.a&&Br(M.a);const P=k.props&&k.props.onVnodeMounted;P&&Fn(P,M.parent,k)},a)},s.deactivate=k=>{const C=k.component;u(k,h,null,1,a),rn(()=>{C.da&&Br(C.da);const E=k.props&&k.props.onVnodeUnmounted;E&&Fn(E,C.parent,k),C.isDeactivated=!0},a)};function g(k){zc(k),d(k,n,a,!0)}function p(k){r.forEach((C,E)=>{const O=wa(C.type);O&&(!k||!k(O))&&v(E)})}function v(k){const C=r.get(k);!i||!Bs(C,i)?g(C):i&&zc(i),r.delete(k),o.delete(k)}Pe(()=>[e.include,e.exclude],([k,C])=>{k&&p(E=>zo(k,E)),C&&p(E=>!zo(C,E))},{flush:"post",deep:!0});let _=null;const w=()=>{_!=null&&r.set(_,Bc(n.subTree))};return Je(w),Vf(w),Xn(()=>{r.forEach(k=>{const{subTree:C,suspense:E}=n,O=Bc(C);if(k.type===O.type&&k.key===O.key){zc(O);const I=O.component.da;I&&rn(I,E);return}g(k)})}),()=>{if(_=null,!t.default)return null;const k=t.default(),C=k[0];if(k.length>1)return i=null,k;if(!Ko(C)||!(C.shapeFlag&4)&&!(C.shapeFlag&128))return i=null,C;let E=Bc(C);const O=E.type,I=wa(Gr(E)?E.type.__asyncResolved||{}:O),{include:M,exclude:P,max:q}=e;if(M&&(!I||!zo(M,I))||P&&I&&zo(P,I))return i=E,C;const H=E.key==null?O:E.key,T=r.get(H);return E.el&&(E=us(E),C.shapeFlag&128&&(C.ssContent=E)),_=H,T?(E.el=T.el,E.component=T.component,E.transition&&ca(E,E.transition),E.shapeFlag|=512,o.delete(H),o.add(H)):(o.add(H),q&&o.size>parseInt(q,10)&&v(o.values().next().value)),E.shapeFlag|=256,i=E,Df(C.type)?C:E}}};function zo(e,t){return He(e)?e.some(n=>zo(n,t)):Et(e)?e.split(",").includes(t):u0(e)?e.test(t):!1}function Bf(e,t){Uf(e,"a",t)}function ky(e,t){Uf(e,"da",t)}function Uf(e,t,n=Ut){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;)Fo(r.parent.vnode)&&Sy(s,t,n,r),r=r.parent}}function Sy(e,t,n,s){const r=ua(t,e,s,!0);Dt(()=>{xc(s[t],r)},n)}function zc(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function Bc(e){return e.shapeFlag&128?e.ssContent:e}function ua(e,t,n=Ut,s=!1){if(n){const r=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{if(n.isUnmounted)return;js();const a=Qo(n),c=jn(t,n,e,i);return a(),Ns(),c});return s?r.unshift(o):r.push(o),o}}const Ss=e=>(t,n=Ut)=>(!Jo||e==="sp")&&ua(e,(...s)=>t(...s),n),Cy=Ss("bm"),Je=Ss("m"),$y=Ss("bu"),Vf=Ss("u"),Xn=Ss("bum"),Dt=Ss("um"),Ty=Ss("sp"),Ay=Ss("rtg"),Ey=Ss("rtc");function Iy(e,t=Ut){ua("ec",e,t)}function Me(e,t,n,s){let r;const o=n;if(He(e)||Et(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(bt(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 Pt(e,t,n={},s,r){if(Gt.isCE||Gt.parent&&Gr(Gt.parent)&&Gt.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&&Hf(o(n)),a=oe(be,{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 Hf(e){return e.some(t=>Ko(t)?!(t.type===On||t.type===be&&!Hf(t.children)):!0)?e:null}const Uc=e=>e?vh(e)?xa(e)||e.proxy:Uc(e.parent):null,Bo=Zt(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=>Uc(e.parent),$root:e=>Uc(e.root),$emit:e=>e.emit,$options:e=>Jf(e),$forceUpdate:e=>e.f||(e.f=()=>{e.effect.dirty=!0,na(e.update)}),$nextTick:e=>e.n||(e.n=wt.bind(e.proxy)),$watch:e=>_y.bind(e)}),Vc=(e,t)=>e!==nt&&!e.__isScriptSetup&&ft(e,t),Py={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(Vc(s,t))return i[t]=1,s[t];if(r!==nt&&ft(r,t))return i[t]=2,r[t];if((u=e.propsOptions[0])&&ft(u,t))return i[t]=3,o[t];if(n!==nt&&ft(n,t))return i[t]=4,n[t];Hc&&(i[t]=0)}}const d=Bo[t];let f,h;if(d)return t==="$attrs"&&wn(e,"get",t),d(e);if((f=a.__cssModules)&&(f=f[t]))return f;if(n!==nt&&ft(n,t))return i[t]=4,n[t];if(h=c.config.globalProperties,ft(h,t))return h[t]},set({_:e},t,n){const{data:s,setupState:r,ctx:o}=e;return Vc(r,t)?(r[t]=n,!0):s!==nt&&ft(s,t)?(s[t]=n,!0):ft(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!==nt&&ft(e,i)||Vc(t,i)||(a=o[0])&&ft(a,i)||ft(s,i)||ft(Bo,i)||ft(r.config.globalProperties,i)},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:ft(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Wf(){return Gf().slots}function My(){return Gf().attrs}function Gf(){const e=Yn();return e.setupContext||(e.setupContext=_h(e))}function da(e){return He(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function Kr(e,t){return!e||!t?e||t:He(e)&&He(t)?e.concat(t):Zt({},da(e),da(t))}let Hc=!0;function Oy(e){const t=Jf(e),n=e.proxy,s=e.ctx;Hc=!1,t.beforeCreate&&Kf(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:C,unmounted:E,render:O,renderTracked:I,renderTriggered:M,errorCaptured:P,serverPrefetch:q,expose:H,inheritAttrs:T,components:A,directives:R,filters:K}=t;if(u&&Ly(u,s,null),i)for(const J in i){const X=i[J];et(X)&&(s[J]=X.bind(n))}if(r){const J=r.call(n,n);bt(J)&&(e.data=ht(J))}if(Hc=!0,o)for(const J in o){const X=o[J],Y=et(X)?X.bind(n,n):et(X.get)?X.get.bind(n,n):In,he=!et(X)&&et(X.set)?X.set.bind(n):In,ce=te({get:Y,set:he});Object.defineProperty(s,J,{enumerable:!0,configurable:!0,get:()=>ce.value,set:ue=>ce.value=ue})}if(a)for(const J in a)Qf(a[J],s,n,J);if(c){const J=et(c)?c.call(n):c;Reflect.ownKeys(J).forEach(X=>{Gc(X,J[X])})}d&&Kf(d,e,"c");function U(J,X){He(X)?X.forEach(Y=>J(Y.bind(n))):X&&J(X.bind(n))}if(U(Cy,f),U(Je,h),U($y,g),U(Vf,p),U(Bf,v),U(ky,_),U(Iy,P),U(Ey,I),U(Ay,M),U(Xn,k),U(Dt,E),U(Ty,q),He(H))if(H.length){const J=e.exposed||(e.exposed={});H.forEach(X=>{Object.defineProperty(J,X,{get:()=>n[X],set:Y=>n[X]=Y})})}else e.exposed||(e.exposed={});O&&e.render===In&&(e.render=O),T!=null&&(e.inheritAttrs=T),A&&(e.components=A),R&&(e.directives=R)}function Ly(e,t,n=In){He(e)&&(e=Wc(e));for(const s in e){const r=e[s];let o;bt(r)?"default"in r?o=Qr(r.from||s,r.default,!0):o=Qr(r.from||s):o=Qr(r),Bt(o)?Object.defineProperty(t,s,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[s]=o}}function Kf(e,t,n){jn(He(e)?e.map(s=>s.bind(t.proxy)):e.bind(t.proxy),t,n)}function Qf(e,t,n,s){const r=s.includes(".")?jf(n,s):()=>n[s];if(Et(e)){const o=t[e];et(o)&&Pe(r,o)}else if(et(e))Pe(r,e.bind(n));else if(bt(e))if(He(e))e.forEach(o=>Qf(o,t,n,s));else{const o=et(e.handler)?e.handler.bind(n):t[e.handler];et(o)&&Pe(r,o,e)}}function Jf(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)),bt(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=Ry[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const Ry={data:Xf,props:Zf,emits:Zf,methods:Uo,computed:Uo,beforeCreate:yn,created:yn,beforeMount:yn,mounted:yn,beforeUpdate:yn,updated:yn,beforeDestroy:yn,beforeUnmount:yn,destroyed:yn,unmounted:yn,activated:yn,deactivated:yn,errorCaptured:yn,serverPrefetch:yn,components:Uo,directives:Uo,watch:jy,provide:Xf,inject:Dy};function Xf(e,t){return t?e?function(){return Zt(et(e)?e.call(this,this):e,et(t)?t.call(this,this):t)}:t:e}function Dy(e,t){return Uo(Wc(e),Wc(t))}function Wc(e){if(He(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function yn(e,t){return e?[...new Set([].concat(e,t))]:t}function Uo(e,t){return e?Zt(Object.create(null),e,t):t}function Zf(e,t){return e?He(e)&&He(t)?[...new Set([...e,...t])]:Zt(Object.create(null),da(e),da(t??{})):t}function jy(e,t){if(!e)return t;if(!t)return e;const n=Zt(Object.create(null),e);for(const s in t)n[s]=yn(e[s],t[s]);return n}function Yf(){return{app:null,config:{isNativeTag:l0,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 Ny=0;function Fy(e,t){return function(s,r=null){et(s)||(s=Zt({},s)),r!=null&&!bt(r)&&(r=null);const o=Yf(),i=new WeakSet;let a=!1;const c=o.app={_uid:Ny++,_component:s,_props:r,_container:null,_context:o,_instance:null,version:c1,get config(){return o.config},set config(u){},use(u,...d){return i.has(u)||(u&&et(u.install)?(i.add(u),u.install(c,...d)):et(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=Vo;Vo=c;try{return u()}finally{Vo=d}}};return c}}let Vo=null;function Gc(e,t){if(Ut){let n=Ut.provides;const s=Ut.parent&&Ut.parent.provides;s===n&&(n=Ut.provides=Object.create(s)),n[e]=t}}function Qr(e,t,n=!1){const s=Ut||Gt;if(s||Vo){const r=s?s.parent==null?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:Vo._context.provides;if(r&&e in r)return r[e];if(arguments.length>1)return n&&et(t)?t.call(s&&s.proxy):t}}function qy(e,t,n,s=!1){const r={},o={};Wi(o,ga,1),e.propsDefaults=Object.create(null),eh(e,t,r,o);for(const i in e.propsOptions[0])i in r||(r[i]=void 0);n?e.props=s?r:V0(r):e.type.props?e.props=r:e.props=o,e.attrs=o}function zy(e,t,n,s){const{props:r,attrs:o,vnode:{patchFlag:i}}=e,a=ct(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(ft(o,h))g!==o[h]&&(o[h]=g,u=!0);else{const p=Pn(h);r[p]=Kc(c,a,p,g,e,!1)}else g!==o[h]&&(o[h]=g,u=!0)}}}else{eh(e,t,r,o)&&(u=!0);let d;for(const f in a)(!t||!ft(t,f)&&((d=Rs(f))===f||!ft(t,d)))&&(c?n&&(n[f]!==void 0||n[d]!==void 0)&&(r[f]=Kc(c,a,f,void 0,e,!0)):delete r[f]);if(o!==a)for(const f in o)(!t||!ft(t,f))&&(delete o[f],u=!0)}u&&xs(e,"set","$attrs")}function eh(e,t,n,s){const[r,o]=e.propsOptions;let i=!1,a;if(t)for(let c in t){if(Io(c))continue;const u=t[c];let d;r&&ft(r,d=Pn(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=ct(n),u=a||nt;for(let d=0;d<o.length;d++){const f=o[d];n[f]=Kc(r,c,f,u[f],e,!ft(u,f))}}return i}function Kc(e,t,n,s,r,o){const i=e[n];if(i!=null){const a=ft(i,"default");if(a&&s===void 0){const c=i.default;if(i.type!==Function&&!i.skipFactory&&et(c)){const{propsDefaults:u}=r;if(n in u)s=u[n];else{const d=Qo(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 th(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(!et(e)){const d=f=>{c=!0;const[h,g]=th(f,t,!0);Zt(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 bt(e)&&s.set(e,sn),sn;if(He(o))for(let d=0;d<o.length;d++){const f=Pn(o[d]);nh(f)&&(i[f]=nt)}else if(o)for(const d in o){const f=Pn(d);if(nh(f)){const h=o[d],g=i[f]=He(h)||et(h)?{type:h}:Zt({},h);if(g){const p=oh(Boolean,g.type),v=oh(String,g.type);g[0]=p>-1,g[1]=v<0||p<v,(p>-1||ft(g,"default"))&&a.push(f)}}}const u=[i,a];return bt(e)&&s.set(e,u),u}function nh(e){return e[0]!=="$"&&!Io(e)}function sh(e){return e===null?"null":typeof e=="function"?e.name||"":typeof e=="object"&&e.constructor&&e.constructor.name||""}function rh(e,t){return sh(e)===sh(t)}function oh(e,t){return He(t)?t.findIndex(n=>rh(n,e)):et(t)&&rh(t,e)?0:-1}const ih=e=>e[0]==="_"||e==="$stable",Qc=e=>He(e)?e.map(ds):[ds(e)],By=(e,t,n)=>{if(t._n)return t;const s=xe((...r)=>(Lo.NODE_ENV!=="production"&&Ut&&(!n||(n.root,Ut.root)),Qc(t(...r))),n);return s._c=!1,s},ah=(e,t,n)=>{const s=e._ctx;for(const r in e){if(ih(r))continue;const o=e[r];if(et(o))t[r]=By(r,o,s);else if(o!=null){const i=Qc(o);t[r]=()=>i}}},lh=(e,t)=>{const n=Qc(t);e.slots.default=()=>n},Uy=(e,t)=>{if(e.vnode.shapeFlag&32){const n=t._;n?(e.slots=ct(t),Wi(t,"_",n)):ah(t,e.slots={})}else e.slots={},t&&lh(e,t);Wi(e.slots,ga,1)},Vy=(e,t,n)=>{const{vnode:s,slots:r}=e;let o=!0,i=nt;if(s.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:(Zt(r,t),!n&&a===1&&delete r._):(o=!t.$stable,ah(t,r)),i=t}else t&&(lh(e,t),i={default:1});if(o)for(const a in r)!ih(a)&&i[a]==null&&delete r[a]};function Jc(e,t,n,s,r=!1){if(He(e)){e.forEach((h,g)=>Jc(h,t&&(He(t)?t[g]:t),n,s,r));return}if(Gr(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===nt?a.refs={}:a.refs,f=a.setupState;if(u!=null&&u!==c&&(Et(u)?(d[u]=null,ft(f,u)&&(f[u]=null)):Bt(u)&&(u.value=null)),et(c))ws(c,a,12,[i,d]);else{const h=Et(c),g=Bt(c);if(h||g){const p=()=>{if(e.f){const v=h?ft(f,c)?f[c]:d[c]:c.value;r?He(v)&&xc(v,o):He(v)?v.includes(o)||v.push(o):h?(d[c]=[o],ft(f,c)&&(f[c]=d[c])):(c.value=[o],e.k&&(d[e.k]=c.value))}else h?(d[c]=i,ft(f,c)&&(f[c]=i)):g&&(c.value=i,e.k&&(d[e.k]=i))};i?(p.id=-1,rn(p,n)):p()}}}const rn=gy;function Hy(e){return Wy(e)}function Wy(e,t){const n=Kd();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=In,insertStaticContent:p}=e,v=(N,ee,Q,j=null,B=null,ie=null,me=void 0,de=null,ge=!!ee.dynamicChildren)=>{if(N===ee)return;N&&!Bs(N,ee)&&(j=Ce(N),ue(N,B,ie,!0),N=null),ee.patchFlag===-2&&(ge=!1,ee.dynamicChildren=null);const{type:pe,ref:Ae,shapeFlag:Ne}=ee;switch(pe){case pa:_(N,ee,Q,j);break;case On:w(N,ee,Q,j);break;case ma:N==null&&k(ee,Q,j,me);break;case be:A(N,ee,Q,j,B,ie,me,de,ge);break;default:Ne&1?O(N,ee,Q,j,B,ie,me,de,ge):Ne&6?R(N,ee,Q,j,B,ie,me,de,ge):(Ne&64||Ne&128)&&pe.process(N,ee,Q,j,B,ie,me,de,ge,Be)}Ae!=null&&B&&Jc(Ae,N&&N.ref,ie,ee||N,!ee)},_=(N,ee,Q,j)=>{if(N==null)s(ee.el=a(ee.children),Q,j);else{const B=ee.el=N.el;ee.children!==N.children&&u(B,ee.children)}},w=(N,ee,Q,j)=>{N==null?s(ee.el=c(ee.children||""),Q,j):ee.el=N.el},k=(N,ee,Q,j)=>{[N.el,N.anchor]=p(N.children,ee,Q,j,N.el,N.anchor)},C=({el:N,anchor:ee},Q,j)=>{let B;for(;N&&N!==ee;)B=h(N),s(N,Q,j),N=B;s(ee,Q,j)},E=({el:N,anchor:ee})=>{let Q;for(;N&&N!==ee;)Q=h(N),r(N),N=Q;r(ee)},O=(N,ee,Q,j,B,ie,me,de,ge)=>{ee.type==="svg"?me="svg":ee.type==="math"&&(me="mathml"),N==null?I(ee,Q,j,B,ie,me,de,ge):q(N,ee,B,ie,me,de,ge)},I=(N,ee,Q,j,B,ie,me,de)=>{let ge,pe;const{props:Ae,shapeFlag:Ne,transition:De,dirs:Ie}=N;if(ge=N.el=i(N.type,ie,Ae&&Ae.is,Ae),Ne&8?d(ge,N.children):Ne&16&&P(N.children,ge,null,j,B,Xc(N,ie),me,de),Ie&&cr(N,null,j,"created"),M(ge,N,N.scopeId,me,j),Ae){for(const it in Ae)it!=="value"&&!Io(it)&&o(ge,it,null,Ae[it],ie,N.children,j,B,fe);"value"in Ae&&o(ge,"value",null,Ae.value,ie),(pe=Ae.onVnodeBeforeMount)&&Fn(pe,j,N)}Ie&&cr(N,null,j,"beforeMount");const We=Gy(B,De);We&&De.beforeEnter(ge),s(ge,ee,Q),((pe=Ae&&Ae.onVnodeMounted)||We||Ie)&&rn(()=>{pe&&Fn(pe,j,N),We&&De.enter(ge),Ie&&cr(N,null,j,"mounted")},B)},M=(N,ee,Q,j,B)=>{if(Q&&g(N,Q),j)for(let ie=0;ie<j.length;ie++)g(N,j[ie]);if(B){let ie=B.subTree;if(ee===ie){const me=B.vnode;M(N,me,me.scopeId,me.slotScopeIds,B.parent)}}},P=(N,ee,Q,j,B,ie,me,de,ge=0)=>{for(let pe=ge;pe<N.length;pe++){const Ae=N[pe]=de?Us(N[pe]):ds(N[pe]);v(null,Ae,ee,Q,j,B,ie,me,de)}},q=(N,ee,Q,j,B,ie,me)=>{const de=ee.el=N.el;let{patchFlag:ge,dynamicChildren:pe,dirs:Ae}=ee;ge|=N.patchFlag&16;const Ne=N.props||nt,De=ee.props||nt;let Ie;if(Q&&ur(Q,!1),(Ie=De.onVnodeBeforeUpdate)&&Fn(Ie,Q,ee,N),Ae&&cr(ee,N,Q,"beforeUpdate"),Q&&ur(Q,!0),pe?H(N.dynamicChildren,pe,de,Q,j,Xc(ee,B),ie):me||X(N,ee,de,null,Q,j,Xc(ee,B),ie,!1),ge>0){if(ge&16)T(de,ee,Ne,De,Q,j,B);else if(ge&2&&Ne.class!==De.class&&o(de,"class",null,De.class,B),ge&4&&o(de,"style",Ne.style,De.style,B),ge&8){const We=ee.dynamicProps;for(let it=0;it<We.length;it++){const at=We[it],dt=Ne[at],Tt=De[at];(Tt!==dt||at==="value")&&o(de,at,dt,Tt,B,N.children,Q,j,fe)}}ge&1&&N.children!==ee.children&&d(de,ee.children)}else!me&&pe==null&&T(de,ee,Ne,De,Q,j,B);((Ie=De.onVnodeUpdated)||Ae)&&rn(()=>{Ie&&Fn(Ie,Q,ee,N),Ae&&cr(ee,N,Q,"updated")},j)},H=(N,ee,Q,j,B,ie,me)=>{for(let de=0;de<ee.length;de++){const ge=N[de],pe=ee[de],Ae=ge.el&&(ge.type===be||!Bs(ge,pe)||ge.shapeFlag&70)?f(ge.el):Q;v(ge,pe,Ae,null,j,B,ie,me,!0)}},T=(N,ee,Q,j,B,ie,me)=>{if(Q!==j){if(Q!==nt)for(const de in Q)!Io(de)&&!(de in j)&&o(N,de,Q[de],null,me,ee.children,B,ie,fe);for(const de in j){if(Io(de))continue;const ge=j[de],pe=Q[de];ge!==pe&&de!=="value"&&o(N,de,pe,ge,me,ee.children,B,ie,fe)}"value"in j&&o(N,"value",Q.value,j.value,me)}},A=(N,ee,Q,j,B,ie,me,de,ge)=>{const pe=ee.el=N?N.el:a(""),Ae=ee.anchor=N?N.anchor:a("");let{patchFlag:Ne,dynamicChildren:De,slotScopeIds:Ie}=ee;Ie&&(de=de?de.concat(Ie):Ie),N==null?(s(pe,Q,j),s(Ae,Q,j),P(ee.children||[],Q,Ae,B,ie,me,de,ge)):Ne>0&&Ne&64&&De&&N.dynamicChildren?(H(N.dynamicChildren,De,Q,B,ie,me,de),(ee.key!=null||B&&ee===B.subTree)&&Zc(N,ee,!0)):X(N,ee,Q,Ae,B,ie,me,de,ge)},R=(N,ee,Q,j,B,ie,me,de,ge)=>{ee.slotScopeIds=de,N==null?ee.shapeFlag&512?B.ctx.activate(ee,Q,j,me,ge):K(ee,Q,j,B,ie,me,ge):W(N,ee,ge)},K=(N,ee,Q,j,B,ie,me)=>{const de=N.component=n1(N,j,B);if(Fo(N)&&(de.ctx.renderer=Be),s1(de),de.asyncDep){if(B&&B.registerDep(de,U),!N.el){const ge=de.subTree=G(On);w(null,ge,ee,Q)}}else U(de,N,ee,Q,B,ie,me)},W=(N,ee,Q)=>{const j=ee.component=N.component;if(fy(N,ee,Q))if(j.asyncDep&&!j.asyncResolved){J(j,ee,Q);return}else j.next=ee,iy(j.update),j.effect.dirty=!0,j.update();else ee.el=N.el,j.vnode=ee},U=(N,ee,Q,j,B,ie,me)=>{const de=()=>{if(N.isMounted){let{next:Ae,bu:Ne,u:De,parent:Ie,vnode:We}=N;{const Lt=ch(N);if(Lt){Ae&&(Ae.el=We.el,J(N,Ae,me)),Lt.asyncDep.then(()=>{N.isUnmounted||de()});return}}let it=Ae,at;ur(N,!1),Ae?(Ae.el=We.el,J(N,Ae,me)):Ae=We,Ne&&Br(Ne),(at=Ae.props&&Ae.props.onVnodeBeforeUpdate)&&Fn(at,Ie,Ae,We),ur(N,!0);const dt=Mf(N),Tt=N.subTree;N.subTree=dt,v(Tt,dt,f(Tt.el),Ce(Tt),N,B,ie),Ae.el=dt.el,it===null&&hy(N,dt.el),De&&rn(De,B),(at=Ae.props&&Ae.props.onVnodeUpdated)&&rn(()=>Fn(at,Ie,Ae,We),B)}else{let Ae;const{el:Ne,props:De}=ee,{bm:Ie,m:We,parent:it}=N,at=Gr(ee);ur(N,!1),Ie&&Br(Ie),!at&&(Ae=De&&De.onVnodeBeforeMount)&&Fn(Ae,it,ee),ur(N,!0);{const dt=N.subTree=Mf(N);v(null,dt,Q,j,N,B,ie),ee.el=dt.el}if(We&&rn(We,B),!at&&(Ae=De&&De.onVnodeMounted)){const dt=ee;rn(()=>Fn(Ae,it,dt),B)}(ee.shapeFlag&256||it&&Gr(it.vnode)&&it.vnode.shapeFlag&256)&&N.a&&rn(N.a,B),N.isMounted=!0,ee=Q=j=null}},ge=N.effect=new Cc(de,In,()=>na(pe),N.scope),pe=N.update=()=>{ge.dirty&&ge.run()};pe.id=N.uid,ur(N,!0),pe()},J=(N,ee,Q)=>{ee.component=N;const j=N.vnode.props;N.vnode=ee,N.next=null,zy(N,ee.props,j,Q),Vy(N,ee.children,Q),js(),Af(N),Ns()},X=(N,ee,Q,j,B,ie,me,de,ge=!1)=>{const pe=N&&N.children,Ae=N?N.shapeFlag:0,Ne=ee.children,{patchFlag:De,shapeFlag:Ie}=ee;if(De>0){if(De&128){he(pe,Ne,Q,j,B,ie,me,de,ge);return}else if(De&256){Y(pe,Ne,Q,j,B,ie,me,de,ge);return}}Ie&8?(Ae&16&&fe(pe,B,ie),Ne!==pe&&d(Q,Ne)):Ae&16?Ie&16?he(pe,Ne,Q,j,B,ie,me,de,ge):fe(pe,B,ie,!0):(Ae&8&&d(Q,""),Ie&16&&P(Ne,Q,j,B,ie,me,de,ge))},Y=(N,ee,Q,j,B,ie,me,de,ge)=>{N=N||sn,ee=ee||sn;const pe=N.length,Ae=ee.length,Ne=Math.min(pe,Ae);let De;for(De=0;De<Ne;De++){const Ie=ee[De]=ge?Us(ee[De]):ds(ee[De]);v(N[De],Ie,Q,null,B,ie,me,de,ge)}pe>Ae?fe(N,B,ie,!0,!1,Ne):P(ee,Q,j,B,ie,me,de,ge,Ne)},he=(N,ee,Q,j,B,ie,me,de,ge)=>{let pe=0;const Ae=ee.length;let Ne=N.length-1,De=Ae-1;for(;pe<=Ne&&pe<=De;){const Ie=N[pe],We=ee[pe]=ge?Us(ee[pe]):ds(ee[pe]);if(Bs(Ie,We))v(Ie,We,Q,null,B,ie,me,de,ge);else break;pe++}for(;pe<=Ne&&pe<=De;){const Ie=N[Ne],We=ee[De]=ge?Us(ee[De]):ds(ee[De]);if(Bs(Ie,We))v(Ie,We,Q,null,B,ie,me,de,ge);else break;Ne--,De--}if(pe>Ne){if(pe<=De){const Ie=De+1,We=Ie<Ae?ee[Ie].el:j;for(;pe<=De;)v(null,ee[pe]=ge?Us(ee[pe]):ds(ee[pe]),Q,We,B,ie,me,de,ge),pe++}}else if(pe>De)for(;pe<=Ne;)ue(N[pe],B,ie,!0),pe++;else{const Ie=pe,We=pe,it=new Map;for(pe=We;pe<=De;pe++){const ye=ee[pe]=ge?Us(ee[pe]):ds(ee[pe]);ye.key!=null&&it.set(ye.key,pe)}let at,dt=0;const Tt=De-We+1;let Lt=!1,un=0;const qt=new Array(Tt);for(pe=0;pe<Tt;pe++)qt[pe]=0;for(pe=Ie;pe<=Ne;pe++){const ye=N[pe];if(dt>=Tt){ue(ye,B,ie,!0);continue}let Re;if(ye.key!=null)Re=it.get(ye.key);else for(at=We;at<=De;at++)if(qt[at-We]===0&&Bs(ye,ee[at])){Re=at;break}Re===void 0?ue(ye,B,ie,!0):(qt[Re-We]=pe+1,Re>=un?un=Re:Lt=!0,v(ye,ee[Re],Q,null,B,ie,me,de,ge),dt++)}const se=Lt?Ky(qt):sn;for(at=se.length-1,pe=Tt-1;pe>=0;pe--){const ye=We+pe,Re=ee[ye],ze=ye+1<Ae?ee[ye+1].el:j;qt[pe]===0?v(null,Re,Q,ze,B,ie,me,de,ge):Lt&&(at<0||pe!==se[at]?ce(Re,Q,ze,2):at--)}}},ce=(N,ee,Q,j,B=null)=>{const{el:ie,type:me,transition:de,children:ge,shapeFlag:pe}=N;if(pe&6){ce(N.component.subTree,ee,Q,j);return}if(pe&128){N.suspense.move(ee,Q,j);return}if(pe&64){me.move(N,ee,Q,Be);return}if(me===be){s(ie,ee,Q);for(let Ne=0;Ne<ge.length;Ne++)ce(ge[Ne],ee,Q,j);s(N.anchor,ee,Q);return}if(me===ma){C(N,ee,Q);return}if(j!==2&&pe&1&&de)if(j===0)de.beforeEnter(ie),s(ie,ee,Q),rn(()=>de.enter(ie),B);else{const{leave:Ne,delayLeave:De,afterLeave:Ie}=de,We=()=>s(ie,ee,Q),it=()=>{Ne(ie,()=>{We(),Ie&&Ie()})};De?De(ie,We,it):it()}else s(ie,ee,Q)},ue=(N,ee,Q,j=!1,B=!1)=>{const{type:ie,props:me,ref:de,children:ge,dynamicChildren:pe,shapeFlag:Ae,patchFlag:Ne,dirs:De}=N;if(de!=null&&Jc(de,null,Q,N,!0),Ae&256){ee.ctx.deactivate(N);return}const Ie=Ae&1&&De,We=!Gr(N);let it;if(We&&(it=me&&me.onVnodeBeforeUnmount)&&Fn(it,ee,N),Ae&6)re(N.component,Q,j);else{if(Ae&128){N.suspense.unmount(Q,j);return}Ie&&cr(N,null,ee,"beforeUnmount"),Ae&64?N.type.remove(N,ee,Q,B,Be,j):pe&&(ie!==be||Ne>0&&Ne&64)?fe(pe,ee,Q,!1,!0):(ie===be&&Ne&384||!B&&Ae&16)&&fe(ge,ee,Q),j&&Te(N)}(We&&(it=me&&me.onVnodeUnmounted)||Ie)&&rn(()=>{it&&Fn(it,ee,N),Ie&&cr(N,null,ee,"unmounted")},Q)},Te=N=>{const{type:ee,el:Q,anchor:j,transition:B}=N;if(ee===be){je(Q,j);return}if(ee===ma){E(N);return}const ie=()=>{r(Q),B&&!B.persisted&&B.afterLeave&&B.afterLeave()};if(N.shapeFlag&1&&B&&!B.persisted){const{leave:me,delayLeave:de}=B,ge=()=>me(Q,ie);de?de(N.el,ie,ge):ge()}else ie()},je=(N,ee)=>{let Q;for(;N!==ee;)Q=h(N),r(N),N=Q;r(ee)},re=(N,ee,Q)=>{const{bum:j,scope:B,update:ie,subTree:me,um:de}=N;j&&Br(j),B.stop(),ie&&(ie.active=!1,ue(me,N,ee,Q)),de&&rn(de,ee),rn(()=>{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,Q,j=!1,B=!1,ie=0)=>{for(let me=ie;me<N.length;me++)ue(N[me],ee,Q,j,B)},Ce=N=>N.shapeFlag&6?Ce(N.component.subTree):N.shapeFlag&128?N.suspense.next():h(N.anchor||N.el);let $e=!1;const Le=(N,ee,Q)=>{N==null?ee._vnode&&ue(ee._vnode,null,null,!0):v(ee._vnode||null,N,ee,null,null,null,Q),$e||($e=!0,Af(),Ef(),$e=!1),ee._vnode=N},Be={p:v,um:ue,m:ce,r:Te,mt:K,mc:P,pc:X,pbc:H,n:Ce,o:e};return{render:Le,hydrate:void 0,createApp:Fy(Le)}}function Xc({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 ur({effect:e,update:t},n){e.allowRecurse=t.allowRecurse=n}function Gy(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Zc(e,t,n=!1){const s=e.children,r=t.children;if(He(s)&&He(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||Zc(i,a)),a.type===pa&&(a.el=i.el)}}function Ky(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 ch(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:ch(t)}const Qy=e=>e.__isTeleport,Ho=e=>e&&(e.disabled||e.disabled===""),uh=e=>typeof SVGElement<"u"&&e instanceof SVGElement,dh=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Yc=(e,t)=>{const n=e&&e.to;return Et(n)?t?t(n):null:n},Jy={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=Ho(t.props);let{shapeFlag:k,children:C,dynamicChildren:E}=t;if(e==null){const O=t.el=v(""),I=t.anchor=v("");g(O,n,s),g(I,n,s);const M=t.target=Yc(t.props,p),P=t.targetAnchor=v("");M&&(g(P,M),i==="svg"||uh(M)?i="svg":(i==="mathml"||dh(M))&&(i="mathml"));const q=(H,T)=>{k&16&&d(C,H,T,r,o,i,a,c)};w?q(n,I):M&&q(M,P)}else{t.el=e.el;const O=t.anchor=e.anchor,I=t.target=e.target,M=t.targetAnchor=e.targetAnchor,P=Ho(e.props),q=P?n:I,H=P?O:M;if(i==="svg"||uh(I)?i="svg":(i==="mathml"||dh(I))&&(i="mathml"),E?(h(e.dynamicChildren,E,q,r,o,i,a),Zc(e,t,!0)):c||f(e,t,q,H,r,o,i,a,!1),w)P?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=Yc(t.props,p);T&&ha(t,T,null,u,0)}else P&&ha(t,I,M,u,1)}fh(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||!Ho(h);for(let p=0;p<c.length;p++){const v=c[p];r(v,t,n,g,!!v.dynamicChildren)}}},move:ha,hydrate:Xy};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||Ho(d))&&c&16)for(let h=0;h<u.length;h++)r(u[h],t,n,2);f&&s(a,t,n)}function Xy(e,t,n,s,r,o,{o:{nextSibling:i,parentNode:a,querySelector:c}},u){const d=t.target=Yc(t.props,c);if(d){const f=d._lpa||d.firstChild;if(t.shapeFlag&16)if(Ho(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)}fh(t)}return t.anchor&&i(t.anchor)}const eu=Jy;function fh(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 be=Symbol.for("v-fgt"),pa=Symbol.for("v-txt"),On=Symbol.for("v-cmt"),ma=Symbol.for("v-stc"),Wo=[];let Zn=null;function m(e=!1){Wo.push(Zn=e?null:[])}function Zy(){Wo.pop(),Zn=Wo[Wo.length-1]||null}let Go=1;function hh(e){Go+=e}function ph(e){return e.dynamicChildren=Go>0?Zn||sn:null,Zy(),Go>0&&Zn&&Zn.push(e),e}function x(e,t,n,s,r,o){return ph(l(e,t,n,s,r,o,!0))}function oe(e,t,n,s,r){return ph(G(e,t,n,s,r,!0))}function Ko(e){return e?e.__v_isVNode===!0:!1}function Bs(e,t){return e.type===t.type&&e.key===t.key}const ga="__vInternal",mh=({key:e})=>e??null,va=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Et(e)||Bt(e)||et(e)?{i:Gt,r:e,k:t,f:!!n}:e:null);function l(e,t=null,n=null,s=0,r=null,o=e===be?0:1,i=!1,a=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&mh(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:Gt};return a?(tu(c,n),o&128&&e.normalize(c)):n&&(c.shapeFlag|=Et(n)?8:16),Go>0&&!i&&Zn&&(c.patchFlag>0||o&6)&&c.patchFlag!==32&&Zn.push(c),c}const G=Yy;function Yy(e,t=null,n=null,s=0,r=null,o=!1){if((!e||e===Lf)&&(e=On),Ko(e)){const a=us(e,t,!0);return n&&tu(a,n),Go>0&&!o&&Zn&&(a.shapeFlag&6?Zn[Zn.indexOf(e)]=a:Zn.push(a)),a.patchFlag|=-2,a}if(l1(e)&&(e=e.__vccOpts),t){t=ya(t);let{class:a,style:c}=t;a&&!Et(a)&&(t.class=ne(a)),bt(c)&&(yf(c)&&!He(c)&&(c=Zt({},c)),t.style=mt(c))}const i=Et(e)?1:Df(e)?128:Qy(e)?64:bt(e)?4:et(e)?2:0;return l(e,t,n,s,r,i,o,!0)}function ya(e){return e?yf(e)||ga in e?Zt({},e):e:null}function us(e,t,n=!1){const{props:s,ref:r,patchFlag:o,children:i}=e,a=t?kn(s||{},t):s;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:a,key:a&&mh(a),ref:t&&t.ref?n&&r?He(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!==be?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&&us(e.ssContent),ssFallback:e.ssFallback&&us(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce}}function Ge(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(On,null,e)):G(On,null,e)}function ds(e){return e==null||typeof e=="boolean"?G(On):He(e)?G(be,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:us(e)}function tu(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(He(t))n=16;else if(typeof t=="object")if(s&65){const r=t.default;r&&(r._c&&(r._d=!1),tu(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!(ga in t)?t._ctx=Gt:r===3&&Gt&&(Gt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else et(t)?(t={default:t,_ctx:Gt},n=32):(t=String(t),s&64?(n=16,t=[Ge(t)]):n=8);e.children=t,e.shapeFlag|=n}function kn(...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=mt([t.style,s.style]);else if(Bi(r)){const o=t[r],i=s[r];i&&o!==i&&!(He(o)&&o.includes(i))&&(t[r]=o?[].concat(o,i):i)}else r!==""&&(t[r]=s[r])}return t}function Fn(e,t,n,s=null){jn(e,t,7,[n,s])}const e1=Yf();let t1=0;function n1(e,t,n){const s=e.type,r=(t?t.appContext:e.appContext)||e1,o={uid:t1++,vnode:e,type:s,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,scope:new Xd(!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:th(s,r),emitsOptions:Pf(s,r),emit:null,emitted:null,propsDefaults:nt,inheritAttrs:s.inheritAttrs,ctx:nt,data:nt,props:nt,attrs:nt,slots:nt,refs:nt,setupState:nt,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=cy.bind(null,o),e.ce&&e.ce(o),o}let Ut=null;const Yn=()=>Ut||Gt;let _a,nu;{const e=Kd(),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=>Ut=n),nu=t("__VUE_SSR_SETTERS__",n=>Jo=n)}const Qo=e=>{const t=Ut;return _a(e),e.scope.on(),()=>{e.scope.off(),_a(t)}},gh=()=>{Ut&&Ut.scope.off(),_a(null)};function vh(e){return e.vnode.shapeFlag&4}let Jo=!1;function s1(e,t=!1){t&&nu(t);const{props:n,children:s}=e.vnode,r=vh(e);qy(e,n,r,t),Uy(e,s);const o=r?r1(e,t):void 0;return t&&nu(!1),o}function r1(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=bf(new Proxy(e.ctx,Py));const{setup:s}=n;if(s){const r=e.setupContext=s.length>1?_h(e):null,o=Qo(e);js();const i=ws(s,e,0,[e.props,r]);if(Ns(),o(),Vd(i)){if(i.then(gh,gh),t)return i.then(a=>{yh(e,a)}).catch(a=>{Do(a,e,0)});e.asyncDep=i}else yh(e,i)}else bh(e)}function yh(e,t,n){et(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:bt(t)&&(e.setupState=kf(t)),bh(e)}function bh(e,t,n){const s=e.type;e.render||(e.render=s.render||In);{const r=Qo(e);js();try{Oy(e)}finally{Ns(),r()}}}function o1(e){return e.attrsProxy||(e.attrsProxy=new Proxy(e.attrs,{get(t,n){return wn(e,"get","$attrs"),t[n]}}))}function _h(e){const t=n=>{e.exposed=n||{}};return{get attrs(){return o1(e)},slots:e.slots,emit:e.emit,expose:t}}function xa(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(kf(bf(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Bo)return Bo[n](e)},has(t,n){return n in t||n in Bo}}))}const i1=/(?:^|[-_])(\w)/g,a1=e=>e.replace(i1,t=>t.toUpperCase()).replace(/[-_]/g,"");function wa(e,t=!0){return et(e)?e.displayName||e.name:e.name||t&&e.__name}function xh(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?a1(s):n?"App":"Anonymous"}function l1(e){return et(e)&&"__vccOpts"in e}const te=(e,t)=>H0(e,t,Jo);function dr(e,t,n=nt){const s=Yn(),r=Pn(t),o=Rs(t),i=Q0((c,u)=>{let d;return by(()=>{const f=e[t];ls(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))&&ls(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 fr(e,t,n){const s=arguments.length;return s===2?bt(t)&&!He(t)?Ko(t)?G(e,null,[t]):G(e,t):G(e,null,t):(s>3?n=Array.prototype.slice.call(arguments,2):s===3&&Ko(n)&&(n=[n]),G(e,t,n))}const c1="3.4.21",u1="http://www.w3.org/2000/svg",d1="http://www.w3.org/1998/Math/MathML",Vs=typeof document<"u"?document:null,wh=Vs&&Vs.createElement("template"),f1={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(u1,e):t==="mathml"?Vs.createElementNS(d1,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{wh.innerHTML=s==="svg"?`<svg>${e}</svg>`:s==="mathml"?`<math>${e}</math>`:e;const a=wh.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",Xo="animation",Zo=Symbol("_vtc"),en=(e,{slots:t})=>fr(wy,h1(e),t);en.displayName="Transition";const kh={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};en.props=Zt({},Nf,kh);const hr=(e,t=[])=>{He(e)?e.forEach(n=>n(...t)):e&&e(...t)},Sh=e=>e?He(e)?e.some(t=>t.length>1):e.length>1:!1;function h1(e){const t={};for(const A in e)A in kh||(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=p1(r),v=p&&p[0],_=p&&p[1],{onBeforeEnter:w,onEnter:k,onEnterCancelled:C,onLeave:E,onLeaveCancelled:O,onBeforeAppear:I=w,onAppear:M=k,onAppearCancelled:P=C}=t,q=(A,R,K)=>{pr(A,R?d:a),pr(A,R?u:i),K&&K()},H=(A,R)=>{A._isLeaving=!1,pr(A,f),pr(A,g),pr(A,h),R&&R()},T=A=>(R,K)=>{const W=A?M:k,U=()=>q(R,A,K);hr(W,[R,U]),Ch(()=>{pr(R,A?c:o),Ws(R,A?d:a),Sh(W)||$h(R,s,v,U)})};return Zt(t,{onBeforeEnter(A){hr(w,[A]),Ws(A,o),Ws(A,i)},onBeforeAppear(A){hr(I,[A]),Ws(A,c),Ws(A,u)},onEnter:T(!1),onAppear:T(!0),onLeave(A,R){A._isLeaving=!0;const K=()=>H(A,R);Ws(A,f),v1(),Ws(A,h),Ch(()=>{A._isLeaving&&(pr(A,f),Ws(A,g),Sh(E)||$h(A,s,_,K))}),hr(E,[A,K])},onEnterCancelled(A){q(A,!1),hr(C,[A])},onAppearCancelled(A){q(A,!0),hr(P,[A])},onLeaveCancelled(A){H(A),hr(O,[A])}})}function p1(e){if(e==null)return null;if(bt(e))return[su(e.enter),su(e.leave)];{const t=su(e);return[t,t]}}function su(e){return p0(e)}function Ws(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Zo]||(e[Zo]=new Set)).add(t)}function pr(e,t){t.split(/\s+/).forEach(s=>s&&e.classList.remove(s));const n=e[Zo];n&&(n.delete(t),n.size||(e[Zo]=void 0))}function Ch(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let m1=0;function $h(e,t,n,s){const r=e._endId=++m1,o=()=>{r===e._endId&&s()};if(n)return setTimeout(o,n);const{type:i,timeout:a,propCount:c}=g1(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 g1(e,t){const n=window.getComputedStyle(e),s=p=>(n[p]||"").split(", "),r=s(`${Hs}Delay`),o=s(`${Hs}Duration`),i=Th(r,o),a=s(`${Xo}Delay`),c=s(`${Xo}Duration`),u=Th(a,c);let d=null,f=0,h=0;t===Hs?i>0&&(d=Hs,f=i,h=o.length):t===Xo?u>0&&(d=Xo,f=u,h=c.length):(f=Math.max(i,u),d=f>0?i>u?Hs:Xo: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 Th(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,s)=>Ah(n)+Ah(e[s])))}function Ah(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function v1(){return document.body.offsetHeight}function y1(e,t,n){const s=e[Zo];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const ka=Symbol("_vod"),Eh=Symbol("_vsh"),Yo={beforeMount(e,{value:t},{transition:n}){e[ka]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):ei(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),ei(e,!0),s.enter(e)):s.leave(e,()=>{ei(e,!1)}):ei(e,t))},beforeUnmount(e,{value:t}){ei(e,t)}};function ei(e,t){e.style.display=t?e[ka]:"none",e[Eh]=!t}const b1=Symbol(""),_1=/(^|;)\s*display\s*:/;function x1(e,t,n){const s=e.style,r=Et(n);let o=!1;if(n&&!r){if(t)if(Et(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[b1];i&&(n+=";"+i),s.cssText=n,o=_1.test(n)}}else t&&e.removeAttribute("style");ka in e&&(e[ka]=o?s.display:"",e[Eh]&&(s.display="none"))}const Ih=/\s*!important$/;function Sa(e,t,n){if(He(n))n.forEach(s=>Sa(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const s=w1(e,t);Ih.test(n)?e.setProperty(Rs(s),n.replace(Ih,""),"important"):e[s]=n}}const Ph=["Webkit","Moz","ms"],ru={};function w1(e,t){const n=ru[t];if(n)return n;let s=Pn(t);if(s!=="filter"&&s in e)return ru[t]=s;s=Vi(s);for(let r=0;r<Ph.length;r++){const o=Ph[r]+s;if(o in e)return ru[t]=o}return t}const Mh="http://www.w3.org/1999/xlink";function k1(e,t,n,s,r){if(s&&t.startsWith("xlink:"))n==null?e.removeAttributeNS(Mh,t.slice(6,t.length)):e.setAttributeNS(Mh,t,n);else{const o=b0(t);n==null||o&&!Qd(n)?e.removeAttribute(t):e.setAttribute(t,o?"":n)}}function S1(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=Qd(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 C1(e,t,n,s){e.removeEventListener(t,n,s)}const Oh=Symbol("_vei");function $1(e,t,n,s,r=null){const o=e[Oh]||(e[Oh]={}),i=o[t];if(s&&i)i.value=s;else{const[a,c]=T1(t);if(s){const u=o[t]=I1(s,r);Cs(e,a,u,c)}else i&&(C1(e,a,i,c),o[t]=void 0)}}const Lh=/(?:Once|Passive|Capture)$/;function T1(e){let t;if(Lh.test(e)){t={};let s;for(;s=e.match(Lh);)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 ou=0;const A1=Promise.resolve(),E1=()=>ou||(A1.then(()=>ou=0),ou=Date.now());function I1(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;jn(P1(s,n.value),t,5,[s])};return n.value=e,n.attached=E1(),n}function P1(e,t){if(He(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 Rh=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,M1=(e,t,n,s,r,o,i,a,c)=>{const u=r==="svg";t==="class"?y1(e,s,u):t==="style"?x1(e,n,s):Bi(t)?_c(t)||$1(e,t,n,s,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):O1(e,t,s,u))?S1(e,t,s,o,i,a,c):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),k1(e,t,s,u))};function O1(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&Rh(t)&&et(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 Rh(t)&&Et(n)?!1:t in e}const Gs=e=>{const t=e.props["onUpdate:modelValue"]||!1;return He(t)?n=>Br(t,n):t};function L1(e){e.target.composing=!0}function Dh(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const qn=Symbol("_assign"),on={created(e,{modifiers:{lazy:t,trim:n,number:s}},r){e[qn]=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=Po(a)),e[qn](a)}),n&&Cs(e,"change",()=>{e.value=e.value.trim()}),t||(Cs(e,"compositionstart",L1),Cs(e,"compositionend",Dh),Cs(e,"change",Dh))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,modifiers:{lazy:n,trim:s,number:r}},o){if(e[qn]=Gs(o),e.composing)return;const i=r||e.type==="number"?Po(e.value):e.value,a=t??"";i!==a&&(document.activeElement===e&&e.type!=="range"&&(n||s&&e.value.trim()===a)||(e.value=a))}},R1={deep:!0,created(e,t,n){e[qn]=Gs(n),Cs(e,"change",()=>{const s=e._modelValue,r=Jr(e),o=e.checked,i=e[qn];if(He(s)){const a=kc(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(qr(s)){const a=new Set(s);o?a.add(r):a.delete(r),i(a)}else i(zh(e,o))})},mounted:jh,beforeUpdate(e,t,n){e[qn]=Gs(n),jh(e,t,n)}};function jh(e,{value:t,oldValue:n},s){e._modelValue=t,He(t)?e.checked=kc(t,s.props.value)>-1:qr(t)?e.checked=t.has(s.props.value):t!==n&&(e.checked=rr(t,zh(e,!0)))}const Nh={created(e,{value:t},n){e.checked=rr(t,n.props.value),e[qn]=Gs(n),Cs(e,"change",()=>{e[qn](Jr(e))})},beforeUpdate(e,{value:t,oldValue:n},s){e[qn]=Gs(s),t!==n&&(e.checked=rr(t,s.props.value))}},Fh={deep:!0,created(e,{value:t,modifiers:{number:n}},s){const r=qr(t);Cs(e,"change",()=>{const o=Array.prototype.filter.call(e.options,i=>i.selected).map(i=>n?Po(Jr(i)):Jr(i));e[qn](e.multiple?r?new Set(o):o:o[0]),e._assigning=!0,wt(()=>{e._assigning=!1})}),e[qn]=Gs(s)},mounted(e,{value:t,modifiers:{number:n}}){qh(e,t,n)},beforeUpdate(e,t,n){e[qn]=Gs(n)},updated(e,{value:t,modifiers:{number:n}}){e._assigning||qh(e,t,n)}};function qh(e,t,n){const s=e.multiple,r=He(t);if(!(s&&!r&&!qr(t))){for(let o=0,i=e.options.length;o<i;o++){const a=e.options[o],c=Jr(a);if(s)if(r){const u=typeof c;u==="string"||u==="number"?a.selected=t.includes(n?Po(c):c):a.selected=kc(t,c)>-1}else a.selected=t.has(c);else if(rr(Jr(a),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!s&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Jr(e){return"_value"in e?e._value:e.value}function zh(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const D1={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 j1(e,t){switch(e){case"SELECT":return Fh;case"TEXTAREA":return on;default:switch(t){case"checkbox":return R1;case"radio":return Nh;default:return on}}}function Ca(e,t,n,s,r){const i=j1(e.tagName,n.props&&n.props.type)[r];i&&i(e,t,n,s)}const N1=["ctrl","shift","alt","meta"],F1={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)=>N1.some(n=>e[`${n}Key`]&&!t.includes(n))},Qt=(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=F1[t[i]];if(a&&a(r,t))return}return e(r,...o)})},q1={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},mr=(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||q1[i]===o))return e(r)})},z1=Zt({patchProp:M1},f1);let Bh;function B1(){return Bh||(Bh=Hy(z1))}const Xr=(...e)=>{const t=B1().createApp(...e),{mount:n}=t;return t.mount=s=>{const r=V1(s);if(!r)return;const o=t._component;!et(o)&&!o.render&&!o.template&&(o.template=r.innerHTML),r.innerHTML="";const i=n(r,!1,U1(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),i},t};function U1(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function V1(e){return Et(e)?document.querySelector(e):e}function Uh(e,t){return function(){return e.apply(t,arguments)}}const{toString:H1}=Object.prototype,{getPrototypeOf:iu}=Object,{iterator:$a,toStringTag:Vh}=Symbol,Ta=(e=>t=>{const n=H1.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),es=e=>(e=e.toLowerCase(),t=>Ta(t)===e),Aa=e=>t=>typeof t===e,{isArray:Zr}=Array,Yr=Aa("undefined");function ti(e){return e!==null&&!Yr(e)&&e.constructor!==null&&!Yr(e.constructor)&&Sn(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Hh=es("ArrayBuffer");function W1(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Hh(e.buffer),t}const G1=Aa("string"),Sn=Aa("function"),Wh=Aa("number"),ni=e=>e!==null&&typeof e=="object",K1=e=>e===!0||e===!1,Ea=e=>{if(Ta(e)!=="object")return!1;const t=iu(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Vh in e)&&!($a in e)},Q1=e=>{if(!ni(e)||ti(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},J1=es("Date"),X1=es("File"),Z1=es("Blob"),Y1=es("FileList"),eb=e=>ni(e)&&Sn(e.pipe),tb=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Sn(e.append)&&((t=Ta(e))==="formdata"||t==="object"&&Sn(e.toString)&&e.toString()==="[object FormData]"))},nb=es("URLSearchParams"),[sb,rb,ob,ib]=["ReadableStream","Request","Response","Headers"].map(es),ab=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function si(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,r;if(typeof e!="object"&&(e=[e]),Zr(e))for(s=0,r=e.length;s<r;s++)t.call(null,e[s],s,e);else{if(ti(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 Gh(e,t){if(ti(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 gr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Kh=e=>!Yr(e)&&e!==gr;function au(){const{caseless:e,skipUndefined:t}=Kh(this)&&this||{},n={},s=(r,o)=>{const i=e&&Gh(n,o)||o;Ea(n[i])&&Ea(r)?n[i]=au(n[i],r):Ea(r)?n[i]=au({},r):Zr(r)?n[i]=r.slice():(!t||!Yr(r))&&(n[i]=r)};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&si(arguments[r],s);return n}const lb=(e,t,n,{allOwnKeys:s}={})=>(si(t,(r,o)=>{n&&Sn(r)?e[o]=Uh(r,n):e[o]=r},{allOwnKeys:s}),e),cb=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),ub=(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)},db=(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&&iu(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},fb=(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},hb=e=>{if(!e)return null;if(Zr(e))return e;let t=e.length;if(!Wh(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},pb=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&iu(Uint8Array)),mb=(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])}},gb=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},vb=es("HTMLFormElement"),yb=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,r){return s.toUpperCase()+r}),Qh=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),bb=es("RegExp"),Jh=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};si(n,(r,o)=>{let i;(i=t(r,o,e))!==!1&&(s[o]=i||r)}),Object.defineProperties(e,s)},_b=e=>{Jh(e,(t,n)=>{if(Sn(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(Sn(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+"'")})}})},xb=(e,t)=>{const n={},s=r=>{r.forEach(o=>{n[o]=!0})};return Zr(e)?s(e):s(String(e).split(t)),n},wb=()=>{},kb=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Sb(e){return!!(e&&Sn(e.append)&&e[Vh]==="FormData"&&e[$a])}const Cb=e=>{const t=new Array(10),n=(s,r)=>{if(ni(s)){if(t.indexOf(s)>=0)return;if(ti(s))return s;if(!("toJSON"in s)){t[r]=s;const o=Zr(s)?[]:{};return si(s,(i,a)=>{const c=n(i,r+1);!Yr(c)&&(o[a]=c)}),t[r]=void 0,o}}return s};return n(e,0)},$b=es("AsyncFunction"),Tb=e=>e&&(ni(e)||Sn(e))&&Sn(e.then)&&Sn(e.catch),Xh=((e,t)=>e?setImmediate:t?((n,s)=>(gr.addEventListener("message",({source:r,data:o})=>{r===gr&&o===n&&s.length&&s.shift()()},!1),r=>{s.push(r),gr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Sn(gr.postMessage)),Ab=typeof queueMicrotask<"u"?queueMicrotask.bind(gr):typeof process<"u"&&process.nextTick||Xh,le={isArray:Zr,isArrayBuffer:Hh,isBuffer:ti,isFormData:tb,isArrayBufferView:W1,isString:G1,isNumber:Wh,isBoolean:K1,isObject:ni,isPlainObject:Ea,isEmptyObject:Q1,isReadableStream:sb,isRequest:rb,isResponse:ob,isHeaders:ib,isUndefined:Yr,isDate:J1,isFile:X1,isBlob:Z1,isRegExp:bb,isFunction:Sn,isStream:eb,isURLSearchParams:nb,isTypedArray:pb,isFileList:Y1,forEach:si,merge:au,extend:lb,trim:ab,stripBOM:cb,inherits:ub,toFlatObject:db,kindOf:Ta,kindOfTest:es,endsWith:fb,toArray:hb,forEachEntry:mb,matchAll:gb,isHTMLForm:vb,hasOwnProperty:Qh,hasOwnProp:Qh,reduceDescriptors:Jh,freezeMethods:_b,toObjectSet:xb,toCamelCase:yb,noop:wb,toFiniteNumber:kb,findKey:Gh,global:gr,isContextDefined:Kh,isSpecCompliantForm:Sb,toJSONObject:Cb,isAsyncFn:$b,isThenable:Tb,setImmediate:Xh,asap:Ab,isIterable:e=>e!=null&&Sn(e[$a])};function rt(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)}le.inherits(rt,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:le.toJSONObject(this.config),code:this.code,status:this.status}}});const Zh=rt.prototype,Yh={};["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=>{Yh[e]={value:e}}),Object.defineProperties(rt,Yh),Object.defineProperty(Zh,"isAxiosError",{value:!0}),rt.from=(e,t,n,s,r,o)=>{const i=Object.create(Zh);le.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 rt.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 Eb=null;function lu(e){return le.isPlainObject(e)||le.isArray(e)}function ep(e){return le.endsWith(e,"[]")?e.slice(0,-2):e}function tp(e,t,n){return e?e.concat(t).map(function(r,o){return r=ep(r),!n&&o?"["+r+"]":r}).join(n?".":""):t}function Ib(e){return le.isArray(e)&&!e.some(lu)}const Pb=le.toFlatObject(le,{},null,function(t){return/^is[A-Z]/.test(t)});function Ia(e,t,n){if(!le.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=le.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,_){return!le.isUndefined(_[v])});const s=n.metaTokens,r=n.visitor||d,o=n.dots,i=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&le.isSpecCompliantForm(t);if(!le.isFunction(r))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(le.isDate(p))return p.toISOString();if(le.isBoolean(p))return p.toString();if(!c&&le.isBlob(p))throw new rt("Blob is not supported. Use a Buffer instead.");return le.isArrayBuffer(p)||le.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(le.endsWith(v,"{}"))v=s?v:v.slice(0,-2),p=JSON.stringify(p);else if(le.isArray(p)&&Ib(p)||(le.isFileList(p)||le.endsWith(v,"[]"))&&(w=le.toArray(p)))return v=ep(v),w.forEach(function(C,E){!(le.isUndefined(C)||C===null)&&t.append(i===!0?tp([v],E,o):i===null?v:v+"[]",u(C))}),!1}return lu(p)?!0:(t.append(tp(_,v,o),u(p)),!1)}const f=[],h=Object.assign(Pb,{defaultVisitor:d,convertValue:u,isVisitable:lu});function g(p,v){if(!le.isUndefined(p)){if(f.indexOf(p)!==-1)throw Error("Circular reference detected in "+v.join("."));f.push(p),le.forEach(p,function(w,k){(!(le.isUndefined(w)||w===null)&&r.call(t,w,le.isString(k)?k.trim():k,v,h))===!0&&g(w,v?v.concat(k):[k])}),f.pop()}}if(!le.isObject(e))throw new TypeError("data must be an object");return g(e),t}function np(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function cu(e,t){this._pairs=[],e&&Ia(e,this,t)}const sp=cu.prototype;sp.append=function(t,n){this._pairs.push([t,n])},sp.toString=function(t){const n=t?function(s){return t.call(this,s,np)}:np;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function Mb(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function rp(e,t,n){if(!t)return e;const s=n&&n.encode||Mb;le.isFunction(n)&&(n={serialize:n});const r=n&&n.serialize;let o;if(r?o=r(t,n):o=le.isURLSearchParams(t)?t.toString():new cu(t,n).toString(s),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class op{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){le.forEach(this.handlers,function(s){s!==null&&t(s)})}}const ip={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ob={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:cu,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},uu=typeof window<"u"&&typeof document<"u",du=typeof navigator=="object"&&navigator||void 0,Lb=uu&&(!du||["ReactNative","NativeScript","NS"].indexOf(du.product)<0),Rb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Db=uu&&window.location.href||"http://localhost",pn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:uu,hasStandardBrowserEnv:Lb,hasStandardBrowserWebWorkerEnv:Rb,navigator:du,origin:Db},Symbol.toStringTag,{value:"Module"})),...Ob};function jb(e,t){return Ia(e,new pn.classes.URLSearchParams,{visitor:function(n,s,r,o){return pn.isNode&&le.isBuffer(n)?(this.append(s,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function Nb(e){return le.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Fb(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 ap(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&&le.isArray(r)?r.length:i,c?(le.hasOwnProp(r,i)?r[i]=[r[i],s]:r[i]=s,!a):((!r[i]||!le.isObject(r[i]))&&(r[i]=[]),t(n,s,r[i],o)&&le.isArray(r[i])&&(r[i]=Fb(r[i])),!a)}if(le.isFormData(e)&&le.isFunction(e.entries)){const n={};return le.forEachEntry(e,(s,r)=>{t(Nb(s),r,n,0)}),n}return null}function qb(e,t,n){if(le.isString(e))try{return(t||JSON.parse)(e),le.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const ri={transitional:ip,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",r=s.indexOf("application/json")>-1,o=le.isObject(t);if(o&&le.isHTMLForm(t)&&(t=new FormData(t)),le.isFormData(t))return r?JSON.stringify(ap(t)):t;if(le.isArrayBuffer(t)||le.isBuffer(t)||le.isStream(t)||le.isFile(t)||le.isBlob(t)||le.isReadableStream(t))return t;if(le.isArrayBufferView(t))return t.buffer;if(le.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 jb(t,this.formSerializer).toString();if((a=le.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),qb(t)):t}],transformResponse:[function(t){const n=this.transitional||ri.transitional,s=n&&n.forcedJSONParsing,r=this.responseType==="json";if(le.isResponse(t)||le.isReadableStream(t))return t;if(t&&le.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"?rt.from(a,rt.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:pn.classes.FormData,Blob:pn.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};le.forEach(["delete","get","head","post","put","patch"],e=>{ri.headers[e]={}});const zb=le.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"]),Bb=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]&&zb[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t},lp=Symbol("internals");function oi(e){return e&&String(e).trim().toLowerCase()}function Pa(e){return e===!1||e==null?e:le.isArray(e)?e.map(Pa):String(e)}function Ub(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 Vb=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function fu(e,t,n,s,r){if(le.isFunction(s))return s.call(this,t,n);if(r&&(t=n),!!le.isString(t)){if(le.isString(s))return t.indexOf(s)!==-1;if(le.isRegExp(s))return s.test(t)}}function Hb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function Wb(e,t){const n=le.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 Cn=class{constructor(t){t&&this.set(t)}set(t,n,s){const r=this;function o(a,c,u){const d=oi(c);if(!d)throw new Error("header name must be a non-empty string");const f=le.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)=>le.forEach(a,(u,d)=>o(u,d,c));if(le.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(le.isString(t)&&(t=t.trim())&&!Vb(t))i(Bb(t),n);else if(le.isObject(t)&&le.isIterable(t)){let a={},c,u;for(const d of t){if(!le.isArray(d))throw TypeError("Object iterator must return a key-value pair");a[u=d[0]]=(c=a[u])?le.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=oi(t),t){const s=le.findKey(this,t);if(s){const r=this[s];if(!n)return r;if(n===!0)return Ub(r);if(le.isFunction(n))return n.call(this,r,s);if(le.isRegExp(n))return n.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=oi(t),t){const s=le.findKey(this,t);return!!(s&&this[s]!==void 0&&(!n||fu(this,this[s],s,n)))}return!1}delete(t,n){const s=this;let r=!1;function o(i){if(i=oi(i),i){const a=le.findKey(s,i);a&&(!n||fu(s,s[a],a,n))&&(delete s[a],r=!0)}}return le.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||fu(this,this[o],o,t,!0))&&(delete this[o],r=!0)}return r}normalize(t){const n=this,s={};return le.forEach(this,(r,o)=>{const i=le.findKey(s,o);if(i){n[i]=Pa(r),delete n[o];return}const a=t?Hb(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 le.forEach(this,(s,r)=>{s!=null&&s!==!1&&(n[r]=t&&le.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[lp]=this[lp]={accessors:{}}).accessors,r=this.prototype;function o(i){const a=oi(i);s[a]||(Wb(r,i),s[a]=!0)}return le.isArray(t)?t.forEach(o):o(t),this}};Cn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),le.reduceDescriptors(Cn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}}),le.freezeMethods(Cn);function hu(e,t){const n=this||ri,s=t||n,r=Cn.from(s.headers);let o=s.data;return le.forEach(e,function(a){o=a.call(n,o,r.normalize(),t?t.status:void 0)}),r.normalize(),o}function cp(e){return!!(e&&e.__CANCEL__)}function eo(e,t,n){rt.call(this,e??"canceled",rt.ERR_CANCELED,t,n),this.name="CanceledError"}le.inherits(eo,rt,{__CANCEL__:!0});function up(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new rt("Request failed with status code "+n.status,[rt.ERR_BAD_REQUEST,rt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Gb(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Kb(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 Qb(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=Kb(50,250);return Qb(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)},dp=(e,t)=>{const n=e!=null;return[s=>t[0]({lengthComputable:n,total:e,loaded:s}),t[1]]},fp=e=>(...t)=>le.asap(()=>e(...t)),Jb=pn.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,pn.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(pn.origin),pn.navigator&&/(msie|trident)/i.test(pn.navigator.userAgent)):()=>!0,Xb=pn.hasStandardBrowserEnv?{write(e,t,n,s,r,o){const i=[e+"="+encodeURIComponent(t)];le.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),le.isString(s)&&i.push("path="+s),le.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 Zb(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Yb(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function hp(e,t,n){let s=!Zb(t);return e&&(s||n==!1)?Yb(e,t):t}const pp=e=>e instanceof Cn?{...e}:e;function vr(e,t){t=t||{};const n={};function s(u,d,f,h){return le.isPlainObject(u)&&le.isPlainObject(d)?le.merge.call({caseless:h},u,d):le.isPlainObject(d)?le.merge({},d):le.isArray(d)?d.slice():d}function r(u,d,f,h){if(le.isUndefined(d)){if(!le.isUndefined(u))return s(void 0,u,f,h)}else return s(u,d,f,h)}function o(u,d){if(!le.isUndefined(d))return s(void 0,d)}function i(u,d){if(le.isUndefined(d)){if(!le.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(pp(u),pp(d),f,!0)};return le.forEach(Object.keys({...e,...t}),function(d){const f=c[d]||r,h=f(e[d],t[d],d);le.isUndefined(h)&&f!==a||(n[d]=h)}),n}const mp=e=>{const t=vr({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:r,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=Cn.from(i),t.url=rp(hp(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),le.isFormData(n)){if(pn.hasStandardBrowserEnv||pn.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(le.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(pn.hasStandardBrowserEnv&&(s&&le.isFunction(s)&&(s=s(t)),s||s!==!1&&Jb(t.url))){const c=r&&o&&Xb.read(o);c&&i.set(r,c)}return t},e_=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,s){const r=mp(e);let o=r.data;const i=Cn.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 C=Cn.from("getAllResponseHeaders"in _&&_.getAllResponseHeaders()),O={data:!a||a==="text"||a==="json"?_.responseText:_.response,status:_.status,statusText:_.statusText,headers:C,config:e,request:_};up(function(M){n(M),v()},function(M){s(M),v()},O),_=null}"onloadend"in _?_.onloadend=w:_.onreadystatechange=function(){!_||_.readyState!==4||_.status===0&&!(_.responseURL&&_.responseURL.indexOf("file:")===0)||setTimeout(w)},_.onabort=function(){_&&(s(new rt("Request aborted",rt.ECONNABORTED,e,_)),_=null)},_.onerror=function(E){const O=E&&E.message?E.message:"Network Error",I=new rt(O,rt.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||ip;r.timeoutErrorMessage&&(E=r.timeoutErrorMessage),s(new rt(E,O.clarifyTimeoutError?rt.ETIMEDOUT:rt.ECONNABORTED,e,_)),_=null},o===void 0&&i.setContentType(null),"setRequestHeader"in _&&le.forEach(i.toJSON(),function(E,O){_.setRequestHeader(O,E)}),le.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=C=>{_&&(s(!C||C.type?new eo(null,e,_):C),_.abort(),_=null)},r.cancelToken&&r.cancelToken.subscribe(d),r.signal&&(r.signal.aborted?d():r.signal.addEventListener("abort",d)));const k=Gb(r.url);if(k&&pn.protocols.indexOf(k)===-1){s(new rt("Unsupported protocol "+k+":",rt.ERR_BAD_REQUEST,e));return}_.send(o||null)})},t_=(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 rt?d:new eo(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,o(new rt(`timeout ${t} of ms exceeded`,rt.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=()=>le.asap(a),c}},n_=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},s_=async function*(e,t){for await(const n of r_(e))yield*n_(n,t)},r_=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()}},gp=(e,t,n,s)=>{const r=s_(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})},vp=64*1024,{isFunction:Oa}=le,o_=(({Request:e,Response:t})=>({Request:e,Response:t}))(le.global),{ReadableStream:yp,TextEncoder:bp}=le.global,_p=(e,...t)=>{try{return!!e(...t)}catch{return!1}},i_=e=>{e=le.merge.call({skipUndefined:!0},o_,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(yp),c=r&&(typeof bp=="function"?(p=>v=>p.encode(v))(new bp):async p=>new Uint8Array(await new n(p).arrayBuffer())),u=o&&a&&_p(()=>{let p=!1;const v=new n(pn.origin,{body:new yp,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!v}),d=i&&a&&_p(()=>le.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 rt(`Response type '${p}' is not supported`,rt.ERR_NOT_SUPPORT,_)})});const h=async p=>{if(p==null)return 0;if(le.isBlob(p))return p.size;if(le.isSpecCompliantForm(p))return(await new n(pn.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(le.isArrayBufferView(p)||le.isArrayBuffer(p))return p.byteLength;if(le.isURLSearchParams(p)&&(p=p+""),le.isString(p))return(await c(p)).byteLength},g=async(p,v)=>{const _=le.toFiniteNumber(p.getContentLength());return _??h(v)};return async p=>{let{url:v,method:_,data:w,signal:k,cancelToken:C,timeout:E,onDownloadProgress:O,onUploadProgress:I,responseType:M,headers:P,withCredentials:q="same-origin",fetchOptions:H}=mp(p),T=t||fetch;M=M?(M+"").toLowerCase():"text";let A=t_([k,C&&C.toAbortSignal()],E),R=null;const K=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let W;try{if(I&&u&&_!=="get"&&_!=="head"&&(W=await g(P,w))!==0){let ce=new n(v,{method:"POST",body:w,duplex:"half"}),ue;if(le.isFormData(w)&&(ue=ce.headers.get("content-type"))&&P.setContentType(ue),ce.body){const[Te,je]=dp(W,Ma(fp(I)));w=gp(ce.body,vp,Te,je)}}le.isString(q)||(q=q?"include":"omit");const U=o&&"credentials"in n.prototype,J={...H,signal:A,method:_.toUpperCase(),headers:P.normalize().toJSON(),body:w,duplex:"half",credentials:U?q:void 0};R=o&&new n(v,J);let X=await(o?T(R,H):T(v,J));const Y=d&&(M==="stream"||M==="response");if(d&&(O||Y&&K)){const ce={};["status","statusText","headers"].forEach(re=>{ce[re]=X[re]});const ue=le.toFiniteNumber(X.headers.get("content-length")),[Te,je]=O&&dp(ue,Ma(fp(O),!0))||[];X=new s(gp(X.body,vp,Te,()=>{je&&je(),K&&K()}),ce)}M=M||"text";let he=await f[le.findKey(f,M)||"text"](X,p);return!Y&&K&&K(),await new Promise((ce,ue)=>{up(ce,ue,{data:he,headers:Cn.from(X.headers),status:X.status,statusText:X.statusText,config:p,request:R})})}catch(U){throw K&&K(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new rt("Network Error",rt.ERR_NETWORK,p,R),{cause:U.cause||U}):rt.from(U,U&&U.code,p,R)}}},a_=new Map,xp=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=a_;for(;a--;)c=o[a],u=d.get(c),u===void 0&&d.set(c,u=a?new Map:i_(t)),d=u;return u};xp();const pu={http:Eb,xhr:e_,fetch:{get:xp}};le.forEach(pu,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const wp=e=>`- ${e}`,l_=e=>le.isFunction(e)||e===null||e===!1,kp={getAdapter:(e,t)=>{e=le.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,!l_(s)&&(r=pu[(a=String(s)).toLowerCase()],r===void 0))throw new rt(`Unknown adapter '${a}'`);if(r&&(le.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(wp).join(`
|
||
`):" "+wp(i[0]):"as no adapter specified";throw new rt("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:pu};function mu(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new eo(null,e)}function Sp(e){return mu(e),e.headers=Cn.from(e.headers),e.data=hu.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),kp.getAdapter(e.adapter||ri.adapter,e)(e).then(function(s){return mu(e),s.data=hu.call(e,e.transformResponse,s),s.headers=Cn.from(s.headers),s},function(s){return cp(s)||(mu(e),s&&s.response&&(s.response.data=hu.call(e,e.transformResponse,s.response),s.response.headers=Cn.from(s.response.headers))),Promise.reject(s)})}const Cp="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 $p={};La.transitional=function(t,n,s){function r(o,i){return"[Axios v"+Cp+"] Transitional option '"+o+"'"+i+(s?". "+s:"")}return(o,i,a)=>{if(t===!1)throw new rt(r(i," has been removed"+(n?" in "+n:"")),rt.ERR_DEPRECATED);return n&&!$p[i]&&($p[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 c_(e,t,n){if(typeof e!="object")throw new rt("options must be an object",rt.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 rt("option "+o+" must be "+c,rt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new rt("Unknown option "+o,rt.ERR_BAD_OPTION)}}const Ra={assertOptions:c_,validators:La},fs=Ra.validators;let yr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new op,response:new op}}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=vr(this.defaults,n);const{transitional:s,paramsSerializer:r,headers:o}=n;s!==void 0&&Ra.assertOptions(s,{silentJSONParsing:fs.transitional(fs.boolean),forcedJSONParsing:fs.transitional(fs.boolean),clarifyTimeoutError:fs.transitional(fs.boolean)},!1),r!=null&&(le.isFunction(r)?n.paramsSerializer={serialize:r}:Ra.assertOptions(r,{encode:fs.function,serialize:fs.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ra.assertOptions(n,{baseUrl:fs.spelling("baseURL"),withXsrfToken:fs.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&le.merge(o.common,o[n.method]);o&&le.forEach(["delete","get","head","post","put","patch","common"],p=>{delete o[p]}),n.headers=Cn.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=[Sp.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=Sp.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=vr(this.defaults,t);const n=hp(t.baseURL,t.url,t.allowAbsoluteUrls);return rp(n,t.params,t.paramsSerializer)}};le.forEach(["delete","get","head","options"],function(t){yr.prototype[t]=function(n,s){return this.request(vr(s||{},{method:t,url:n,data:(s||{}).data}))}}),le.forEach(["post","put","patch"],function(t){function n(s){return function(o,i,a){return this.request(vr(a||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}yr.prototype[t]=n(),yr.prototype[t+"Form"]=n(!0)});let u_=class o0{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 eo(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 o0(function(r){t=r}),cancel:t}}};function d_(e){return function(n){return e.apply(null,n)}}function f_(e){return le.isObject(e)&&e.isAxiosError===!0}const gu={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(gu).forEach(([e,t])=>{gu[t]=e});function Tp(e){const t=new yr(e),n=Uh(yr.prototype.request,t);return le.extend(n,yr.prototype,t,{allOwnKeys:!0}),le.extend(n,t,null,{allOwnKeys:!0}),n.create=function(r){return Tp(vr(e,r))},n}const kt=Tp(ri);kt.Axios=yr,kt.CanceledError=eo,kt.CancelToken=u_,kt.isCancel=cp,kt.VERSION=Cp,kt.toFormData=Ia,kt.AxiosError=rt,kt.Cancel=kt.CanceledError,kt.all=function(t){return Promise.all(t)},kt.spread=d_,kt.isAxiosError=f_,kt.mergeConfig=vr,kt.AxiosHeaders=Cn,kt.formToJSON=e=>ap(le.isHTMLForm(e)?new FormData(e):e),kt.getAdapter=kp.getAdapter,kt.HttpStatusCode=gu,kt.default=kt;const{Axios:lQ,AxiosError:cQ,CanceledError:uQ,isCancel:dQ,CancelToken:fQ,VERSION:hQ,all:pQ,Cancel:mQ,isAxiosError:gQ,spread:vQ,toFormData:yQ,AxiosHeaders:bQ,HttpStatusCode:_Q,formToJSON:xQ,getAdapter:wQ,mergeConfig:kQ}=kt,an=[];for(let e=0;e<256;++e)an.push((e+256).toString(16).slice(1));function h_(e,t=0){return(an[e[t+0]]+an[e[t+1]]+an[e[t+2]]+an[e[t+3]]+"-"+an[e[t+4]]+an[e[t+5]]+"-"+an[e[t+6]]+an[e[t+7]]+"-"+an[e[t+8]]+an[e[t+9]]+"-"+an[e[t+10]]+an[e[t+11]]+an[e[t+12]]+an[e[t+13]]+an[e[t+14]]+an[e[t+15]]).toLowerCase()}let vu;const p_=new Uint8Array(16);function m_(){if(!vu){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");vu=crypto.getRandomValues.bind(crypto)}return vu(p_)}const Ap={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function hs(e,t,n){var r;if(Ap.randomUUID&&!e)return Ap.randomUUID();e=e||{};const s=e.random??((r=e.rng)==null?void 0:r.call(e))??m_();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,h_(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 Ep="eac_uuid",Da="eac-user-id",g_="rybbit-user-id",Qs=()=>{var o;const{getStorage:e,saveStorage:t,clearStorage:n}=Ks();let s=e(Da),r=e(g_);if(r)return r;if(!s){const i=e(Ep);i&&(s=i,t(Da,i),n(Ep))}return s||(s=hs(),t(Da,s)),(o=window.rybbit)==null||o.identify(s),s};async function v_(e){return e}const y_=async(e,t)=>e,b_=(e,t,n)=>async function(s){if(!s)throw new Error("userId is required");try{let r=await t(s);return r||(r=hs(),await n(s,r)),e(r),r}catch(r){console.error("Enhanced identify failed:",r)}},__=()=>{const e=window.rybbit.identify;window.rybbit.identify=b_(e,v_,y_)},x_=()=>{const e=window.rybbit.clearUserId;window.rybbit.clearUserId=()=>{e(),localStorage.removeItem(Da)}},w_=()=>{__(),x_()};function ts(e){return new Promise(t=>setTimeout(t,e))}function tt(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 to={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}"}]}},yu="EASYCHATGPT_WIDGET_CLOSE_MESSAGE",bu="easychatgpt-form",ns="ecg_auth_token",Jt="easychatgpt_conversations",no="easychatgpt_group_conversations",Ln="rangdongstorevn-zll",zn="wwwdienmayxanhcom-urk",Bn="wwwthegioididongcom-rtx",ii="easychatgptio-ujc",k_="consoleeasyaichatapp-pwg",br="dienmaycholoncom",ai="mediamartvn",_r="picovn-drr",so="eco-martvn-a3r",xr="eradovn-fyw",li="wwwdragontourvn",ci="gaothuannguyencom",ui="truemotocarecom",di="bvdkmocchauvn",$s="laptop88vn",fi="noithatgiaphongvn",$n="bvdaihoccomvn-7n5",ss="wwwphucanhvn",wr="viettelstorevn",S_=["bepantoanvn-upq","easyaiagentsapp","khaphanspace","consoleeasyaichatapp-pwg"],Na={SPA:["rangdongstorevn-zll"],SSR:["eradovn-fyw"]};function Ip(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _u={exports:{}},Mt={},xu={exports:{}},kr={};function Pp(){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 C_(e,t,n){}function $_(e,t,n){}var T_=/javascript\s*\:/img;function A_(e,t){return T_.test(t)?"":t}kr.whiteList=Pp(),kr.getDefaultWhiteList=Pp,kr.onAttr=C_,kr.onIgnoreAttr=$_,kr.safeAttrValue=A_;var E_={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=E_;function I_(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 P_=I_,Fa=kr,M_=P_;function Mp(e){return e==null}function O_(e){var t={};for(var n in e)t[n]=e[n];return t}function Op(e){e=O_(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}Op.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=M_(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 Mp(_)?d+":"+f:_}else{var _=o(d,f,v);if(!Mp(_))return _}}});return a};var L_=Op;(function(e,t){var n=kr,s=L_;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)})(xu,xu.exports);var wu=xu.exports,ku={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}},R_=wu.FilterCSS,D_=wu.getDefaultWhiteList,qa=ku;function Lp(){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 Rp=new R_;function j_(e,t,n){}function N_(e,t,n){}function F_(e,t,n){}function q_(e,t,n){}function Dp(e){return e.replace(B_,"<").replace(U_,">")}function z_(e,t,n,s){if(n=Vp(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(jp.lastIndex=0,jp.test(n)||(Np.lastIndex=0,Np.test(n)&&(za.lastIndex=0,za.test(n))))return"";s!==!1&&(s=s||Rp,n=s.process(n))}return n=Hp(n),n}var B_=/</g,U_=/>/g,V_=/"/g,H_=/"/g,W_=/&#([a-zA-Z0-9]*);?/gim,G_=/:?/gim,K_=/&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,jp=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,Np=/u\s*r\s*l\s*\(.*/gi;function Fp(e){return e.replace(V_,""")}function qp(e){return e.replace(H_,'"')}function zp(e){return e.replace(W_,function(n,s){return s[0]==="x"||s[0]==="X"?String.fromCharCode(parseInt(s.substr(1),16)):String.fromCharCode(parseInt(s,10))})}function Bp(e){return e.replace(G_,":").replace(K_," ")}function Up(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 Vp(e){return e=qp(e),e=zp(e),e=Bp(e),e=Up(e),e}function Hp(e){return e=Fp(e),e=Dp(e),e}function Q_(){return""}function J_(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 X_(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 Z_(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("")}Mt.whiteList=Lp(),Mt.getDefaultWhiteList=Lp,Mt.onTag=j_,Mt.onIgnoreTag=N_,Mt.onTagAttr=F_,Mt.onIgnoreTagAttr=q_,Mt.safeAttrValue=z_,Mt.escapeHtml=Dp,Mt.escapeQuote=Fp,Mt.unescapeQuote=qp,Mt.escapeHtmlEntities=zp,Mt.escapeDangerHtml5Entities=Bp,Mt.clearNonPrintableCharacter=Up,Mt.friendlyAttrValue=Vp,Mt.escapeAttrValue=Hp,Mt.onIgnoreTagStripAll=Q_,Mt.StripTagBody=J_,Mt.stripCommentTag=X_,Mt.stripBlankChar=Z_,Mt.attributeWrapSign='"',Mt.cssFilter=Rp,Mt.getDefaultCSSWhiteList=D_;var Ba={},Js=ku;function Y_(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 ex(e){return e.slice(0,2)==="</"}function tx(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=Y_(d),s+=t(o,s.length,u,d,ex(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 nx=/[^a-zA-Z0-9\\_:.-]/gim;function sx(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(nx,"").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:ox(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=rx(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=ix(e,c-1),f===-1){d=Js.trim(e.slice(n,c)),d=Wp(d),a(o,d),o=!1,n=c+1;continue}else continue}return n<e.length&&(o===!1?a(e.slice(n)):a(o,Wp(Js.trim(e.slice(n))))),Js.trim(r.join(" "))}function rx(e,t){for(;t<e.length;t++){var n=e[t];if(n!==" ")return n==="="?t:-1}}function ox(e,t){for(;t<e.length;t++){var n=e[t];if(n!==" ")return n==="'"||n==='"'?t:-1}}function ix(e,t){for(;t>0;t--){var n=e[t];if(n!==" ")return n==="="?t:-1}}function ax(e){return e[0]==='"'&&e[e.length-1]==='"'||e[0]==="'"&&e[e.length-1]==="'"}function Wp(e){return ax(e)?e.substr(1,e.length-2):e}Ba.parseTag=tx,Ba.parseAttr=sx;var lx=wu.FilterCSS,Un=Mt,Gp=Ba,cx=Gp.parseTag,ux=Gp.parseAttr,Ua=ku;function Va(e){return e==null}function dx(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 fx(e){var t={};for(var n in e)t[n]=e[n];return t}function hx(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 Kp(e){e=fx(e||{}),e.stripIgnoreTag&&(e.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),e.onIgnoreTag=Un.onIgnoreTagStripAll),e.whiteList||e.allowList?e.whiteList=hx(e.whiteList||e.allowList):e.whiteList=Un.whiteList,this.attributeWrapSign=e.singleQuotedAttributeValue===!0?"'":Un.attributeWrapSign,e.onTag=e.onTag||Un.onTag,e.onTagAttr=e.onTagAttr||Un.onTagAttr,e.onIgnoreTag=e.onIgnoreTag||Un.onIgnoreTag,e.onIgnoreTagAttr=e.onIgnoreTagAttr||Un.onIgnoreTagAttr,e.safeAttrValue=e.safeAttrValue||Un.safeAttrValue,e.escapeHtml=e.escapeHtml||Un.escapeHtml,this.options=e,e.css===!1?this.cssFilter=!1:(e.css=e.css||{},this.cssFilter=new lx(e.css))}Kp.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=Un.stripBlankChar(e)),n.allowCommentTag||(e=Un.stripCommentTag(e));var h=!1;n.stripIgnoreTagBody&&(h=Un.StripTagBody(n.stripIgnoreTagBody,o),o=h.onIgnoreTag);var g=cx(e,function(p,v,_,w,k){var C={sourcePosition:p,position:v,isClosing:k,isWhite:Object.prototype.hasOwnProperty.call(s,_)},E=r(_,w,C);if(!Va(E))return E;if(C.isWhite){if(C.isClosing)return"</"+_+">";var O=dx(w),I=s[_],M=ux(O.html,function(P,q){var H=Ua.indexOf(I,P)!==-1,T=i(_,P,q,H);return Va(T)?H?(q=c(_,P,q,f),q?P+"="+d+q+d:P):(T=a(_,P,q,H),Va(T)?void 0:T):T});return w="<"+_,M&&(w+=" "+M),O.closing&&(w+=" /"),w+=">",w}else return E=o(_,w,C),Va(E)?u(w):E},u);return h&&(g=h.remove(g)),g};var px=Kp;(function(e,t){var n=Mt,s=Ba,r=px;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)})(_u,_u.exports);var Qp=_u.exports;const mx=[/<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*["'][^"']*["']/],Jp=[/expression\s*\(/i,/javascript\s*:/i,/vbscript\s*:/i,/data\s*:\s*(?!image\/)/i,/@import/i,/behavior\s*:/i,/-moz-binding/i],Xp=e=>{if(!e||typeof e!="string")return!1;if(mx.some(t=>t.test(e)))return!0;if(/&[a-zA-Z]+;|&#\d+;|&#x[0-9a-fA-F]+;/.test(e)){const t=e.replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/'/gi,"'").replace(/&/gi,"&").replace(/</gi,"<").replace(/>/gi,">").replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/'/gi,"'");if(t!==e)return Xp(t)}return!1},gx=e=>{if(!e||typeof e!="string")return"";let t=e.replace(/\/\*[\s\S]*?\*\//g,"").trim();if(Jp.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();Jp.some(c=>c.test(a))||s.push(`${i}: ${a}`)}),s.join("; ")},Zp={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=gx(n);return r?`style="${r}"`:""}if(t==="href"||t==="src"){const r=bx(n);return r!==n?`${t}="${r}"`:null}return s?null:""},onIgnoreTagAttr:(e,t,n,s)=>""},vx=new Qp.FilterXSS(Zp),yx=(e,t={})=>{if(!e||typeof e!="string")return"";const n={...Zp,...t};return(t&&Object.keys(t).length>0?new Qp.FilterXSS(n):vx).process(e)},bx=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},Yp=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),_x=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,em=e=>typeof e=="string"&&_x.test(e);function ro(e){return(JSON.parse(localStorage.getItem(Jt))||{})[e]}function tm(){const e=new URLSearchParams(window.location.search).get("conversation_id");return e&&em(e)?e:null}const oo={lpnasamarketcom:{category:/(.*)-pc(\d+)\.html$/,product:/(.*)-p(\d+)\.html$/},"picovn-drr":{category:/^\/[^\/]+\.c$/}};function rs(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 ps(){const e=document.querySelector('meta[property="og:image"]');return e?e.getAttribute("content"):null}function xx(){const e=document.querySelector('link[rel="canonical"]');return e&&e.href?e.href:window.location.origin+window.location.pathname}function wx(e){if(!oo[e])return null;const t=xx(),n=new URL(t).pathname;if(n==="/")return null;let s=!1,r=!1;return oo[e].category&&(s=n.match(oo[e].category)),oo[e].product&&(r=n.match(oo[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 kx({handle:e}){if(!oo[e])return null;try{const t=wx(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 Sx(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 Su(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Sr=Su();function nm(e){Sr=e}const sm=/[&<>"']/,Cx=new RegExp(sm.source,"g"),rm=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,$x=new RegExp(rm.source,"g"),Tx={"&":"&","<":"<",">":">",'"':""","'":"'"},om=e=>Tx[e];function Rn(e,t){if(t){if(sm.test(e))return e.replace(Cx,om)}else if(rm.test(e))return e.replace($x,om);return e}const Ax=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Ex(e){return e.replace(Ax,(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 Ix=/(^|[^\[])\^/g;function _t(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(Ix,"$1"),n=n.replace(r,i),s},getRegex:()=>new RegExp(n,t)};return s}function im(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}const pi={exec:()=>null};function am(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 Px(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 lm(e,t,n,s){const r=t.href,o=t.title?Rn(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:Rn(i)}}function Mx(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){Ct(this,"options");Ct(this,"rules");Ct(this,"lexer");this.options=t||Sr}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=Mx(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+|$)`),C=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," ")),C.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||C.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=am(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(am(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:Rn(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=Px(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)),lm(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 lm(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=Rn(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=Rn(n[1]),r="mailto:"+s):(s=Rn(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=Rn(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=Rn(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=Rn(n[0]),{type:"text",raw:n[0],text:s}}}}const Ox=/^(?: *(?:\n|$))+/,Lx=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Rx=/^ {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+|$)/,Dx=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,cm=/(?:[*+-]|\d{1,9}[.)])/,um=_t(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,cm).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(),Cu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,jx=/^[^\n]+/,$u=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Nx=_t(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",$u).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Fx=_t(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,cm).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",Tu=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,qx=_t("^ {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",Tu).replace("tag",Ga).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),dm=_t(Cu).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(),Au={blockquote:_t(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",dm).getRegex(),code:Lx,def:Nx,fences:Rx,heading:Dx,hr:mi,html:qx,lheading:um,list:Fx,newline:Ox,paragraph:dm,table:pi,text:jx},fm=_t("^ *([^\\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(),zx={...Au,table:fm,paragraph:_t(Cu).replace("hr",mi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",fm).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()},Bx={...Au,html:_t(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Tu).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:_t(Cu).replace("hr",mi).replace("heading",` *#{1,6} *[^
|
||
]`).replace("lheading",um).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},hm=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ux=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,pm=/^( {2,}|\\)\n(?!\s*$)/,Vx=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,gi="\\p{P}\\p{S}",Hx=_t(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,gi).getRegex(),Wx=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Gx=_t(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,gi).getRegex(),Kx=_t("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,gi).getRegex(),Qx=_t("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,gi).getRegex(),Jx=_t(/\\([punct])/,"gu").replace(/punct/g,gi).getRegex(),Xx=_t(/^<(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(),Zx=_t(Tu).replace("(?:-->|$)","-->").getRegex(),Yx=_t("^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",Zx).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ka=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ew=_t(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Ka).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),mm=_t(/^!?\[(label)\]\[(ref)\]/).replace("label",Ka).replace("ref",$u).getRegex(),gm=_t(/^!?\[(ref)\](?:\[\])?/).replace("ref",$u).getRegex(),tw=_t("reflink|nolink(?!\\()","g").replace("reflink",mm).replace("nolink",gm).getRegex(),Eu={_backpedal:pi,anyPunctuation:Jx,autolink:Xx,blockSkip:Wx,br:pm,code:Ux,del:pi,emStrongLDelim:Gx,emStrongRDelimAst:Kx,emStrongRDelimUnd:Qx,escape:hm,link:ew,nolink:gm,punctuation:Hx,reflink:mm,reflinkSearch:tw,tag:Yx,text:Vx,url:pi},nw={...Eu,link:_t(/^!?\[(label)\]\((.*?)\)/).replace("label",Ka).getRegex(),reflink:_t(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ka).getRegex()},Iu={...Eu,escape:_t(hm).replace("])","~|])").getRegex(),url:_t(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},sw={...Iu,br:_t(pm).replace("{2,}","*").getRegex(),text:_t(Iu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Qa={normal:Au,gfm:zx,pedantic:Bx},vi={normal:Eu,gfm:Iu,breaks:sw,pedantic:nw};class ms{constructor(t){Ct(this,"tokens");Ct(this,"options");Ct(this,"state");Ct(this,"tokenizer");Ct(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Sr,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 ms(n).lex(t)}static lexInline(t,n){return new ms(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){Ct(this,"options");this.options=t||Sr}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-'+Rn(r)+'">'+(s?t:Rn(t,!0))+`</code></pre>
|
||
`:"<pre><code>"+(s?t:Rn(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=im(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=im(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 Pu{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 gs{constructor(t){Ct(this,"options");Ct(this,"renderer");Ct(this,"textRenderer");this.options=t||Sr,this.options.renderer=this.options.renderer||new Ja,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Pu}static parse(t,n){return new gs(n).parse(t)}static parseInline(t,n){return new gs(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,Ex(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){Ct(this,"options");this.options=t||Sr}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}}Ct(yi,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class rw{constructor(...t){r0(this,Lr);Ct(this,"defaults",Su());Ct(this,"options",this.setOptions);Ct(this,"parse",bc(this,Lr,Bd).call(this,ms.lex,gs.parse));Ct(this,"parseInline",bc(this,Lr,Bd).call(this,ms.lexInline,gs.parseInline));Ct(this,"Parser",gs);Ct(this,"Renderer",Ja);Ct(this,"TextRenderer",Pu);Ct(this,"Lexer",ms);Ct(this,"Tokenizer",Wa);Ct(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 ms.lex(t,n??this.defaults)}parser(t,n){return gs.parse(t,n??this.defaults)}}Lr=new WeakSet,Bd=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=bc(this,Lr,i0).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)}}},i0=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>"+Rn(s.message+"",!0)+"</pre>";return n?Promise.resolve(r):r}if(n)return Promise.reject(s);throw s}};const Cr=new rw;function gt(e,t){return Cr.parse(e,t)}gt.options=gt.setOptions=function(e){return Cr.setOptions(e),gt.defaults=Cr.defaults,nm(gt.defaults),gt},gt.getDefaults=Su,gt.defaults=Sr,gt.use=function(...e){return Cr.use(...e),gt.defaults=Cr.defaults,nm(gt.defaults),gt},gt.walkTokens=function(e,t){return Cr.walkTokens(e,t)},gt.parseInline=Cr.parseInline,gt.Parser=gs,gt.parser=gs.parse,gt.Renderer=Ja,gt.TextRenderer=Pu,gt.Lexer=ms,gt.lexer=ms.lex,gt.Tokenizer=Wa,gt.Hooks=yi,gt.parse=gt,gt.options,gt.setOptions,gt.use,gt.walkTokens,gt.parseInline,gs.parse,ms.lex;const ow=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},iw=e=>{const t=e.trim();return/^\d+\.$/.test(t)};gt.setOptions({gfm:!0,breaks:!0,sanitize:!1});const Xa=(e,{separate:t=!0}={})=>{if(typeof e=="string"){const n=e.trim();if(iw(n))return[`<p>${n}</p>`];if(Xp(e))return[`<p class="js-blocked-content">${Yp(e)}</p>`];try{let s=ow(e);s=s.replace(/\[([^\]]*\|[^\]]*)\]/g,(c,u)=>`[${u.replace(/\|/g,"/")}]`);const r=gt(s),o=yx(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">${Yp(e)}</p>`]}}return[]};async function $r(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 io=e=>typeof e=="function",Za=e=>{try{return JSON.parse(e),typeof e=="string"}catch{return!1}};function vm(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 aw(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 ym=(e,t="vi-VN")=>new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:0,useGrouping:!0}).format(e),Mu=e=>e!==null&&typeof e=="object";function bn(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 lw(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 cw(e=typeof window<"u"?window.location.pathname:""){return/^\/embed\//.test(e)}function uw(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 dw(e=typeof window<"u"?window.location.pathname:""){return cw(e)||uw(e)}const bm=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),_m=(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}${bm(s)}`;typeof r=="object"&&!Array.isArray(r)&&r!==null?_m(r,`${t}${bm(s)}-`,n):n.style.setProperty(o,r)})},xm=(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]=xm({...s},r):e[n]=r}),e);function ao(e){return e===null||typeof e!="object"?e:JSON.parse(JSON.stringify(e))}function lo({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 fw(e=[],t){const n=ao(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 vs(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 hw({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?tt(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 pw="https://console.easyaichat.app",mw=async(e,t={})=>{try{const n=t.apiHost||pw,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 kt.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=xm(c,t);return _m(u.ui,"ui-"),a.config=u,a}catch(n){console.error(n)}},V=ht({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(()=>V.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)}),V.totalFormItems=n}else V.totalFormItems=0},{immediate:!0}),Pe(()=>V.handle,()=>{const e=JSON.parse(localStorage.getItem("easychatgpt_conversations"))||{};Object.values(e).length>0&&(V.conversationId=Object.values(e)[0])});const wm={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 co(e){return!e||typeof e!="string"?xi:e.trim().toLowerCase().split("-")[0]==="en"?"en":xi}function gw({isEmbed:e=!1,queryLang:t=null,botLanguage:n=null,forceEnFromPath:s=!1}={}){return s?"en":co(e&&t?t:n??xi)}function uo(e,t){const n=co(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 vw(e,t){return t.split(".").reduce((n,s)=>n==null?void 0:n[s],e)}function yw(e,t={}){return!t||typeof e!="string"?e:e.replace(/\{(\w+)\}/g,(n,s)=>t[s]!==void 0?String(t[s]):`{${s}}`)}function km(e){const t=co(e),n=wm[t]||wm[xi];return function(r,o){const i=vw(n,r);return typeof i!="string"?r:yw(i,o)}}const Sm=ht({locale:"vi"});let Cm=km("vi");const Xs={state:Sm,actions:{setLocale(e){const t=co(e);Sm.locale=t,Cm=km(t)},t(e,t){return Cm(e,t)}},getters:{}},bw={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>.'}}]}]},_w={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."}}]}},xw={[ii]:bw,[k_]:_w};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 ww(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 Ou(e,t="en"){if(tl(e))return e[t]??e.en??null;if(Array.isArray(e))return e.map(n=>Ou(n,t));if(e&&typeof e=="object"){const n={};for(const s of Object.keys(e))n[s]=Ou(e[s],t);return n}return e}function Lu(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"?Lu(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"?Lu(e[n],s):e[n]=s)}}}function Vn(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(ww(t[n])){const r=t[n][s]??t[n].en;(!e[n]||typeof e[n]!="object")&&(e[n]={}),e[n][s]=r}}}function kw(e,t,n="en"){!Array.isArray(e)||!Array.isArray(t)||t.forEach((s,r)=>{e[r]&&(Vn(e[r],s,"title",n),Vn(e[r],s,"link",n))})}function Sw(e,t,n="en"){!Array.isArray(e)||!Array.isArray(t)||t.forEach((s,r)=>{e[r]&&(Vn(e[r],s,"question",n),Vn(e[r],s,"answer",n))})}function Cw(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&&(Vn(i,o,"label",n),Vn(i,o,"placeholder",n),Vn(i,o,"hint",n),Vn(i,o,"options",n))}}}function $w(e,t){var i,a;if(!(e!=null&&e.config)||t!=="en")return;const n=xw[e.handle];if(!n)return;const{widgets:s,page:r,...o}=n;if(Lu(e.config,Ou(o,"en")),r!=null&&r.home&&((i=e.config.page)!=null&&i.home)){Vn(e.config.page.home,r.home,"title","en"),Vn(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]&&(Vn(c[f],d,"title","en"),Vn(c[f],d,"description","en"))})}r!=null&&r.help_center&&((a=e.config.page)!=null&&a.help_center)&&(Sw(e.config.page.help_center.faqs,r.help_center.faqs,"en"),kw(e.config.page.help_center.documents,r.help_center.documents,"en")),Cw(e.widgets,s,"en")}const Tw=()=>/^\/(en|ja)(\/|$)/.test(window.location.pathname),Aw="https://widget.geteasy.ai"+"/public/cs-avatar.png",Ew=["home","conversations","helps","order_tracking"],Ke=ht({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:Aw,isOnline:!0},isCheckInit:!1,isSurveyHidden:!1}),Iw={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=gw({isEmbed:dw(),queryLang:lw(),botLanguage:(n=e==null?void 0:e.config)==null?void 0:n.language,forceEnFromPath:(e==null?void 0:e.handle)===ii&&Tw()});Xs.actions.setLocale(t),$w(e,Xs.state.locale),V.bot=e,V.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(()=>iM);window.rybbit&&(Qs(),w_(),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},Ew.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 mw(e,{...t,workspaceUuid:s,...n});return r?(this.setBot(r),n.website&&![zn,Bn].includes(r.handle)&&this.loadScriptTracking(),this.checkChatStateInit(),r):void 0}catch(r){return console.error("Error fetch bot in store = ",r),null}}},Pw={handle:te(()=>{var e;return(e=Ke.bot)==null?void 0:e.handle}),isAgentEnabled:te(()=>{var e;return((e=Ke.bot)==null?void 0:e.agent_enabled)===!0})},ae={state:Ke,actions:Iw,getters:Pw},Mw=ht({user:null,token:null});Ur(Mw);const $m=ht({selectedProduct:null,isOpenPanelVariants:!1}),Tm={actions:{toggleOpenPanelVariants(e){$m.isOpenPanelVariants=e},setSelectedProduct(e){$m.selectedProduct=e}}},Dn=ht({message:null,type:null}),mn={state:Dn,actions:{success({message:e,duration:t=3e3}){Dn.message=e,Dn.type="success",setTimeout(()=>{Dn.message=null,Dn.type=null},t)},error({message:e,duration:t=3e3}){Dn.message=e,Dn.type="error",setTimeout(()=>{Dn.message=null,Dn.type=null},t)},warning({message:e,duration:t=3e3}){Dn.message=e,Dn.type="warning",setTimeout(()=>{Dn.message=null,Dn.type=null},t)}},getters:{}},Ru="https://widget.geteasy.ai",nl={ai_product_insight:()=>Promise.resolve().then(()=>cR),ai_summary_page_content:()=>Promise.resolve().then(()=>_R),ai_ask:()=>Promise.resolve().then(()=>cv),eac_image_gallery:()=>Promise.resolve().then(()=>zR),rcm_product_flash_sale:()=>Promise.resolve().then(()=>DD),rcm_product_recommendation:()=>Promise.resolve().then(()=>ZD),rcm_flash_sale_register:()=>Promise.resolve().then(()=>Lj),rcm_combo:()=>Promise.resolve().then(()=>EN),rcm_combo_horizontal:()=>Promise.resolve().then(()=>KF),rcm_customer_list_modal:()=>Promise.resolve().then(()=>oq)};function Ow(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; ${Ow(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=Kt({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=Xr(u,d);let h=!1;const g=document.createElement("link");g.rel="stylesheet",g.href=`${Ru}/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=Xr(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 Lw(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=`${Ru}/dist/widget/main.css`,i.appendChild(c);const u=Kt({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=Xr(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 Rw(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=`${Ru}/dist/widget/main.css`,o.appendChild(a);const c=Kt({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=Xr(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 Am{constructor(t={}){Ct(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)}})});Ct(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 Em(e,t=!1){const n=new Am({watchPath:!0,watchQuery:!1}).on(e).start();return t&&setTimeout(()=>e(n.current,null),0),n}function ki(e,t=!1){const n=new Am({watchPath:!0,watchQuery:!0}).on(e).start();return t&&setTimeout(()=>e(n.current,null),1e3),n}const Im="https://widget.geteasy.ai",St=ht({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}}),Pm=e=>{if(!e)return e;try{const t=new URL(e);return`${t.origin}${t.pathname}`}catch{return e.split("?")[0]}},Dw=e=>e&&`${Pm(e)}?utm_source=easyai`,jw="https://engine.geteasy.ai/api/recommendations",Nw={"31c91fbc-38e2-4e84-868e-da29623b9505":e=>((e.properties??e).image??"").includes("media-new.laptop88.vn")},Du=e=>{const t=e.properties??e,n=e.signals??{};return{id:t.id,name:t.name,image:t.image,link:Dw(t.url),sku:t.sku||null,price:Number(t.price)>0?tt(Number(t.price)):"Liên hệ",originalPrice:Number(t.originalPrice)>0?tt(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??[]}},Fw=async(e,{include:t,itemUrl:n,userId:s})=>{const r=new URLSearchParams({include:t.join(","),workspace_uuid:e});n&&r.set("item_url",Pm(n)),s&&r.set("identified_user_id",s),t.includes("flash_sale")&&r.set("hide_sold_out","true");const o=await fetch(`${jw}?${r}`,{headers:{"X-API-Key":"test"}});if(!o.ok)throw new Error(`[EAI RCM] HTTP ${o.status}`);return o.json()},qw={"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)}},Mm={homepage:{include:["flash_sale","recently_viewed"],rcm_product_flash_sale:{selector:[".eai-homepage-flashsale"],position:"top",props:{phoneNumber:"19002098",brandLogo:Im+"/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:Im+"/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":Mm,"18193462-6eba-4fc1-8da9-536e1424ce51":Mm},Om={"74af8f88-1745-4f44-9726-e7082e53e321":{delay:500},"18193462-6eba-4fc1-8da9-536e1424ce51":{delay:500}};let rl=[],Lm=null;const zw=()=>{rl.forEach(e=>{try{e.remove()}catch{}}),rl=[]},ol="easy_ai_test_mode",Bw=["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"],Uw=e=>e.map((t,n)=>({...t,badge:il[n%il.length]})),Rm=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)})),ln={state:St,actions:{checkTestMode(){const e=new URLSearchParams(window.location.search).get(ol);e==="true"&&localStorage.setItem(ol,"true"),e==="false"&&localStorage.removeItem(ol),St.isTestMode=localStorage.getItem(ol)==="true"},detectPageType(e){const t=qw[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=St.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 Fw(e,v),w=Nw[e]??(()=>!0);St.flash_sales=(c=_.flash_sale)!=null&&c.length?Rm(_.flash_sale.filter(w).map(Du)):null,St.hot_sales=(u=_.hot_sale)!=null&&u.length?Rm(_.hot_sale.filter(w).map(Du)):null,St.recently_viewed=(d=_.recently_viewed)!=null&&d.length?Uw(_.recently_viewed.filter(w).map(Du)):null,St.also_bought=(f=_.also_bought)!=null&&f.length?_.also_bought.filter(w):null,St.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&&(St.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=St.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")||Bw.includes(i)&&!St.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=St.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=St[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(),!(!St.isTestMode&&!t.includes(e)||St.isInitialized||(St.isInitialized=!0,!sl[e]))&&(St.pageType=this.detectPageType(e),!(!St.pageType&&!St.isTestMode)&&(await this.fetchAndStore(e),this.injectWidgets(e),Om[e]&&!Lm))){const{delay:s}=Om[e],r=this;Lm=Em(async()=>{zw(),await new Promise(o=>setTimeout(o,s)),St.flash_sales=null,St.hot_sales=null,St.recently_viewed=null,St.also_bought=null,St.source_product=null,St.pageType=r.detectPageType(e),St.pageType&&(await r.fetchAndStore(e),r.injectWidgets(e))})}},async demoFetch(e,t,n={}){const s=sl[e];s&&(St.pageType=n.page_type||this.detectPageType(e)||Object.keys(s)[0],await this.fetchAndStore(e,t,n.item_url))}}},Dm=!1,Vw=e=>({getList(){return e.get(`/bots/${V.handle}/addresses`,{params:{mock:Dm}})},create(t){return e.post(`/bots/${V.handle}/addresses`,t,{params:{mock:Dm}})}}),fo=!1,Hw=e=>({getUser(){return e.get(`/bots/${V.handle}/profile`,{params:{mock:fo}})},updateUser(t){return e.put(`/bots/${V.handle}/profile`,t,{params:{mock:fo}})},login({type:t,identifier:n}){return e.post(`/bots/${V.handle}/auth/login`,{type:t,identifier:n},{params:{mock:fo}})},verifyOtp({code:t,identifier:n}){return e.post(`/bots/${V.handle}/auth/otp/verify`,{code:t,identifier:n},{params:{mock:fo}})},requestOtp({type:t,identifier:n}){return e.post(`/bots/${V.handle}/auth/otp/request`,{type:t,identifier:n},{params:{mock:fo}})},logout(){return e.post(`/bots/${V.handle}/auth/logout`,{},{params:{mock:fo}})}}),Tr=!1,Ww=e=>({getList(){return e.get(`/bots/${V.handle}/cart`,{params:{mock:Tr}})},add(t){return e.post(`/bots/${V.handle}/cart/items`,t,{params:{mock:Tr}})},update(t,n){return e.patch(`/bots/${V.handle}/cart/items/${t}`,n,{params:{mock:Tr}})},remove(t){return e.delete(`/bots/${V.handle}/cart/items/${t}`,{params:{mock:Tr}})},coupons(){return e.get(`/bots/${V.handle}/coupons`,{params:{mock:Tr}})},applyCoupon(t){return e.post(`/bots/${V.handle}/cart/coupon`,t,{params:{mock:Tr}})},removeCoupon(t={}){return e.delete(`/bots/${V.handle}/cart/coupon`,{...t,params:{mock:Tr}})}});var jm={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)})()})(jm);var Gw=jm.exports;const $t=Ip(Gw),ho={RECEIVED:"received",START:"start",DELTA:"delta",MESSAGES:"messages",AUDIO:"audio",DONE:"done"},Kw="mp3",Qw=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||$t.get(ns),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||$t.get(ns),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 C=this._handleSSEEvent(h,k,{onReceived:n,onStart:s,onDelta:r,onMessages:o,onAudioChunk:i,onComplete:a});C&&(g=C)}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 ho.RECEIVED:s&&s(n);break;case ho.START:r&&r(n);break;case ho.DELTA:return o&&o({content:n.content||"",content_type:n.content_type||"text",conversation_id:n.conversation_id}),n.conversation_id;case ho.MESSAGES:return i&&i({messages:n.messages||[],conversation_id:n.conversation_id}),n.conversation_id;case ho.AUDIO:if(a){const u=n.format||Kw;a(n.content,n.sentence_index,n.text,u)}break;case ho.DONE:c&&c(n);break}return null}}),Jw=e=>({initConnection(t){return e.post("/live-chat/init",t)}}),ju=!1,Xw=e=>({provinces(){return e.get(`/bots/${V.handle}/locations/provinces`,{params:{mock:ju}})},districts(t){return e.get(`/bots/${V.handle}/locations/provinces/${t}/districts`,{params:{mock:ju}})},wards(t){return e.get(`/bots/${V.handle}/locations/districts/${t}/wards`,{params:{mock:ju}})}}),Si=!1,Zw=e=>({checkout(t){return e.post(`/bots/${V.handle}/checkout`,t,{params:{mock:Si}})},checkShipping(t){return e.post(`/bots/${V.handle}/cart/shipping-address`,t,{params:{mock:Si}})},getList(t={}){return e.get(`/bots/${V.handle}/orders`,{params:{mock:Si,...t}})},getOne(t){return e.get(`/bots/${V.handle}/orders/${t}`,{params:{mock:Si}})},getStatuses(){return e.get(`/bots/${V.handle}/orders/statuses`,{params:{mock:Si}})},confirm(t,n){return e.post(`/widget/orders/${t}/confirm`,n)}}),Yw=e=>({update({conversationId:t,messageId:n,form:s={reaction:"love"}}){return e.post(`/bots/${V.handle}/conversations/${t}/messages/${n}/reaction`,s)},removeAll({conversationId:t,messageId:n}){return e.post(`/bots/${V.handle}/conversations/${t}/messages/${n}/reset-all-reaction`)}}),e2=e=>({add({formId:t,formData:n}){return e.post(`/bots/${V.handle}/widgets/${t}/submission`,n)},submitWidget({widgetId:t,formData:n}){return e.post(`/bots/${V.handle}/widgets/${t}/submission`,n)}}),t2=e=>({getSummary(t){return e.post("/widgets/summary",t)},getComparisonSummary(t){return e.post("/widgets/compare",t)}}),n2=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})}}),Hn=kt.create({baseURL:"https://console.easyaichat.app"+"/api",withCredentials:!0,headers:{"Content-Type":"application/json",Accept:"application/json"}});Hn.interceptors.request.use(e=>{const t=Qs(),n=$t.get(ns);return e.headers["X-Easy-Ai-User-Id"]=t,n&&(e.headers.Authorization=`Bearer ${n}`),e},e=>Promise.reject(e));const Xe={address:Vw(Hn),auth:Hw(Hn),cart:Ww(Hn),chat:Qw(Hn),liveChat:Jw(Hn),location:Xw(Hn),order:Zw(Hn),reaction:Yw(Hn),submission:e2(Hn),summary:t2(Hn),widget:n2(Hn)},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()}},Xt={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)}},s2=ht({isPlaying:!1,currentSentenceIndex:null});function r2(){const{isPlaying:e,currentSentenceIndex:t}=It(s2),n=L(null),s=L(null),r=L(0),o=L([]),i=L(!1),a=L(!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,C=>C.charCodeAt(0)).buffer},h=async(_,w,k="mp3")=>{try{await u(),e.value=!0,t.value=w;const C=f(_),E=await n.value.decodeAudioData(C),O=n.value.createBufferSource();O.buffer=E,O.connect(s.value);const I=n.value.currentTime,M=Math.max(I+.01,r.value);O.start(M),r.value=M+E.duration,o.value.push(O),O.onended=()=>{const P=o.value.indexOf(O);P>-1&&o.value.splice(P,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 Dt(()=>{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 o2=ht({conversationId:null,messages:[],assistantProcessing:!1,newMessageStatus:"unread",storageConversations:{},messagesContainerRef:null});function Nm(){const{getStorage:e,saveStorage:t}=Ks(),{conversationId:n,messages:s,assistantProcessing:r,newMessageStatus:o,storageConversations:i,messagesContainerRef:a}=It(o2),c=te(()=>{var E;return(E=ae.state.bot)==null?void 0:E.handle}),u=r2(),d=async()=>{try{const{data:E}=await Xe.cart.getList();E.success&&(V.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(Jt)??{};const E=tm();if(E){n.value=E;return}c.value&&(n.value=i.value[c.value]??null)})();const g=()=>{var P,q,H,T,A;s.value=[];const E=((H=(q=(P=V.bot)==null?void 0:P.config)==null?void 0:q.initialMessage)==null?void 0:H.messages)??[],O=Object.values(E).map(R=>R.content);_i(O).forEach(R=>{s.value.push({content:R,content_type:"text",sender_type:"assistant",is_welcome_message:!0})});const M=(A=(T=V.bot)==null?void 0:T.config)==null?void 0:A.introductionMessage;M&&typeof M=="string"&&s.value.push({content:M,content_type:"text",sender_type:"assistant",is_welcome_message:!0,is_introduction_message:!0}),s.value=vs(s.value)},p=()=>{const E=e(Jt);delete E[c.value],t(Jt,E)};function v(){var P,q,H,T,A;const E=((H=(q=(P=V.bot)==null?void 0:P.config)==null?void 0:q.initialMessage)==null?void 0:H.messages)??[],O=(A=(T=V.bot)==null?void 0:T.config)==null?void 0:A.introductionMessage,I=Object.values(E).map(R=>R.content);let M=_i(I).length;if(O&&typeof O=="string"&&(M+=1),M>0)for(let R=0;R<M;R++)s.value[R]&&(s.value[R].is_welcome_message=!0);s.value=vs(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:M,onError:P,onFinish:q,content_type:H,replyTarget:T}={})=>{var J,X;if(!E&&(!O||O.length===0)||r.value)return;r.value=!0;const A=(O==null?void 0:O.map(Y=>Y.file_id))??[],R=E||"";if(s.value.forEach(Y=>{Y.sender_type==="user"&&delete Y.is_last_message}),A.length>0&&s.value.push({content:O,content_type:"attachment",sender_type:"user",timestamp:new Date().toISOString(),is_last_message:!R}),R){const Y={content:R,content_type:H||"text",sender_type:"user",audio_url:M==="voice"?!0:void 0,timestamp:new Date().toISOString(),is_last_message:!0};T&&(Y.reply_to_message_id=T.id,Y.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(Y)}let K={handle:c.value,query:R,stream:!1,conversation_id:n.value,attachments:A??[],content_type:H||"text"};M&&(K.mode=M),T!=null&&T.id&&(K.reply_to_message_id=T.id),n.value||Xt.conversationStart({handle:c.value});const W=((J=s.value.filter(Y=>Y.sender_type==="user"))==null?void 0:J.length)||1;Xt.messageSend({mode:M==="voice"?"voice":"text",content:R,conversation_id:n.value,message_user_order:W}),(async()=>(await ts(1200),o.value="sent",await ts(2e3),o.value==="sent"&&(o.value="received"),await ts(1e3),o.value==="received"&&(o.value="read")))();let U=null;try{const Y=(X=V.cart)==null?void 0:X.token,he=M==="voice"?{onAudioChunk:(ue,Te,je,re)=>{u.queueAudioChunk(ue,Te,je,re)},onStart:ue=>{},onComplete:ue=>{}}:{onReceived:ue=>{},onStart:ue=>{r.value=!0},onDelta:ue=>{ue.conversation_id&&!n.value&&(n.value=ue.conversation_id,i.value[c.value]=ue.conversation_id,t(Jt,i.value));const Te=ue.content_type||"text";U&&U.content_type!==Te&&(delete U.is_streaming,s.value=vs(s.value),U={content:"",content_type:Te,sender_type:"assistant",is_streaming:!0},s.value.push(U)),U||(U={content:"",content_type:Te,sender_type:"assistant",is_streaming:!0},s.value.push(U)),U.content+=ue.content},onMessages:ue=>{if(ue.messages&&ue.messages.length>0){U=null,s.value=vs(ue.messages);for(let Te=s.value.length-1;Te>=0;Te--)if(s.value[Te].sender_type==="user"){s.value[Te].is_last_message=!0;break}}ue.conversation_id&&!n.value&&(n.value=ue.conversation_id,i.value[c.value]=ue.conversation_id,t(Jt,i.value))},onComplete:ue=>{}},{data:ce}=await Xe.chat.sendMessage(K,Y,he);if(o.value="unread",!isStreamEnabled&&(ce!=null&&ce.messages)&&ce.messages.length>0){s.value=vs(ce.messages);for(let ue=s.value.length-1;ue>=0;ue--)if(s.value[ue].sender_type==="user"){s.value[ue].is_last_message=!0;break}}c.value==="rangdongstorevn-zll"&&f(),ce!=null&&ce.conversation_id&&!n.value&&(n.value=ce.conversation_id,i.value[c.value]=ce.conversation_id,t(Jt,i.value)),io(I)&&I(ce)}catch(Y){io(P)&&P(Y)}finally{r.value=!1,io(q)&&q(),v()}},fetchMessages:async({onSuccess:E,onError:O,onFinish:I}={})=>{var P;if(s.value.length>0)return;const M=(P=V==null?void 0:V.cart)==null?void 0:P.token;if(n.value){r.value=!0;try{const{data:q}=await Xe.chat.getConversations({handle:c.value,conversationId:n.value,token:M});q&&(s.value=vs(q.data),io(E)&&E(q))}catch(q){g(),p(),io(O)&&O(q)}finally{r.value=!1,io(I)&&I()}}else g()},initializeMessages:g,refreshConversation:async()=>{r.value||(u.reset(),s.value=[],n.value=null,delete i.value[c.value],localStorage.setItem(Jt,JSON.stringify(i.value)),g(),Xt.conversationReset())},clickQuickPrompt:E=>{Xt.quickPromptClick({handle:c.value,quick_prompt:E}),ae.state.chatState.shouldOpenChatScreen=!0},voiceAudio:u}}class Nu{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 Fm{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 i2(e){try{new e}catch(t){if(t instanceof Error&&t.message.includes("is not a constructor"))return!1}return!0}class Fu extends Nu{constructor(t,n,s){super(),this.name=n,this.pusher=t,this.options=s,this.eventFormatter=new Fm(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 qm extends Fu{whisper(t,n){return this.pusher.channels.channels[this.name].trigger(`client-${t}`,n),this}}class a2 extends Fu{whisper(t,n){return this.pusher.channels.channels[this.name].trigger(`client-${t}`,n),this}}class l2 extends qm{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 zm extends Nu{constructor(t,n,s){super(),this.events={},this.listeners={},this.name=n,this.socket=t,this.options=s,this.eventFormatter=new Fm(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 Bm extends zm{whisper(t,n){return this.socket.emit("client event",{channel:this.name,event:`client-${t}`,data:n}),this}}class c2 extends Bm{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 Nu{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 Um extends al{whisper(t,n){return this}}class u2 extends al{whisper(t,n){return this}}class d2 extends Um{here(t){return this}joining(t){return this}whisper(t,n){return this}leaving(t){return this}}const Vm=class a0{constructor(t){this.setOptions(t),this.connect()}setOptions(t){this.options={...a0._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}};Vm._defaultOptions={auth:{headers:{}},authEndpoint:"/broadcasting/auth",userAuthentication:{endpoint:"/broadcasting/user-auth",headers:{}},csrfToken:null,bearerToken:null,host:null,key:null,namespace:"App.Events"};let qu=Vm;class ll extends qu{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 Fu(this.pusher,t,this.options)),this.channels[t]}privateChannel(t){return this.channels["private-"+t]||(this.channels["private-"+t]=new qm(this.pusher,"private-"+t,this.options)),this.channels["private-"+t]}encryptedPrivateChannel(t){return this.channels["private-encrypted-"+t]||(this.channels["private-encrypted-"+t]=new a2(this.pusher,"private-encrypted-"+t,this.options)),this.channels["private-encrypted-"+t]}presenceChannel(t){return this.channels["presence-"+t]||(this.channels["presence-"+t]=new l2(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 f2 extends qu{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 zm(this.socket,t,this.options)),this.channels[t]}privateChannel(t){return this.channels["private-"+t]||(this.channels["private-"+t]=new Bm(this.socket,"private-"+t,this.options)),this.channels["private-"+t]}presenceChannel(t){return this.channels["presence-"+t]||(this.channels["presence-"+t]=new c2(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 Hm extends qu{constructor(){super(...arguments),this.channels={}}connect(){}listen(t,n,s){return new al}channel(t){return new al}privateChannel(t){return new Um}encryptedPrivateChannel(t){return new u2}presenceChannel(t){return new d2}leave(t){}leaveChannel(t){}socketId(){return"fake-socket-id"}disconnect(){}}class h2{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 f2(this.options);else if(this.options.broadcaster==="null")this.connector=new Hm(this.options);else if(typeof this.options.broadcaster=="function"&&i2(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 Hm}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 Wm={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,C){k.__proto__=C}||function(k,C){for(var E in C)C.hasOwnProperty(E)&&(k[E]=C[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 C=_[k]<<16|_[k+1]<<8|_[k+2];w+=this._encodeByte(C>>>3*6&63),w+=this._encodeByte(C>>>2*6&63),w+=this._encodeByte(C>>>1*6&63),w+=this._encodeByte(C>>>0*6&63)}var E=_.length-k;if(E>0){var C=_[k]<<16|(E===2?_[k+1]<<8:0);w+=this._encodeByte(C>>>3*6&63),w+=this._encodeByte(C>>>2*6&63),E===2?w+=this._encodeByte(C>>>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,C=new Uint8Array(this.maxDecodedLength(k)),E=0,O=0,I=0,M=0,P=0,q=0,H=0;O<k-4;O+=4)M=this._decodeChar(_.charCodeAt(O+0)),P=this._decodeChar(_.charCodeAt(O+1)),q=this._decodeChar(_.charCodeAt(O+2)),H=this._decodeChar(_.charCodeAt(O+3)),C[E++]=M<<2|P>>>4,C[E++]=P<<4|q>>>2,C[E++]=q<<6|H,I|=M&i,I|=P&i,I|=q&i,I|=H&i;if(O<k-1&&(M=this._decodeChar(_.charCodeAt(O)),P=this._decodeChar(_.charCodeAt(O+1)),C[E++]=M<<2|P>>>4,I|=M&i,I|=P&i),O<k-2&&(q=this._decodeChar(_.charCodeAt(O+2)),C[E++]=P<<4|q>>>2,I|=q&i),O<k-3&&(H=this._decodeChar(_.charCodeAt(O+3)),C[E++]=q<<6|H,I|=H&i),I!==0)throw new Error("Base64Coder: incorrect characters for decoding");return C},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,S){this.lastId=0,this.prefix=b,this.name=S}create(b){this.lastId++;var S=this.lastId,F=this.prefix+S,Z=this.name+"["+S+"]",ve=!1,Ee=function(){ve||(b.apply(null,arguments),ve=!0)};return this[S]=Ee,{number:S,id:F,name:Z,callback:Ee}}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,S,F){var Z=this;if(Z.loading[b]&&Z.loading[b].length>0)Z.loading[b].push(F);else{Z.loading[b]=[F];var ve=ot.createScriptRequest(Z.getPath(b,S)),Ee=Z.receivers.create(function(Ve){if(Z.receivers.remove(Ee),Z.loading[b]){var st=Z.loading[b];delete Z.loading[b];for(var pt=function(Wt){Wt||ve.cleanup()},yt=0;yt<st.length;yt++)st[yt](Ve,pt)}});ve.send(Ee)}}getRoot(b){var S,F=ot.getDocument().location.protocol;return b&&b.useTLS||F==="https:"?S=this.options.cdn_https:S=this.options.cdn_http,S.replace(/\/*$/,"")+"/"+this.options.version}getPath(b,S){return this.getRoot(S)+"/"+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:",S=h.urls[$];if(!S)return"";let F;return S.fullUrl?F=S.fullUrl:S.path&&(F=h.baseUrl+S.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 C 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 M extends Error{constructor(b){super(b),Object.setPrototypeOf(this,new.target.prototype)}}class P extends Error{constructor(b,S){super(S),this.status=b,Object.setPrototypeOf(this,new.target.prototype)}}var H=function($,b,S,F,Z){const ve=ot.createXHR();ve.open("POST",S.endpoint,!0),ve.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var Ee in S.headers)ve.setRequestHeader(Ee,S.headers[Ee]);if(S.headersProvider!=null){let Ve=S.headersProvider();for(var Ee in Ve)ve.setRequestHeader(Ee,Ve[Ee])}return ve.onreadystatechange=function(){if(ve.readyState===4)if(ve.status===200){let Ve,st=!1;try{Ve=JSON.parse(ve.responseText),st=!0}catch{Z(new P(200,`JSON returned from ${F.toString()} endpoint was invalid, yet status code was 200. Data was: ${ve.responseText}`),null)}st&&Z(null,Ve)}else{let Ve="";switch(F){case v.UserAuthentication:Ve=p.buildLogSuffix("authenticationEndpoint");break;case v.ChannelAuthorization:Ve=`Clients must be authorized to join private or presence channels. ${p.buildLogSuffix("authorizationEndpoint")}`;break}Z(new P(ve.status,`Unable to retrieve auth string from ${F.toString()} endpoint - received status: ${ve.status} from ${S.endpoint}. ${Ve}`),null)}},ve.send(b),ve};function T($){return J(W($))}var A=String.fromCharCode,R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K=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,K)},U=function($){var b=[0,2,1][$.length%3],S=$.charCodeAt(0)<<16|($.length>1?$.charCodeAt(1):0)<<8|($.length>2?$.charCodeAt(2):0),F=[R.charAt(S>>>18),R.charAt(S>>>12&63),b>=2?"=":R.charAt(S>>>6&63),b>=1?"=":R.charAt(S&63)];return F.join("")},J=window.btoa||function($){return $.replace(/[\s\S]{1,3}/g,U)};class X{constructor(b,S,F,Z){this.clear=S,this.timer=b(()=>{this.timer&&(this.timer=Z(this.timer))},F)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var Y=X;function he($){window.clearTimeout($)}function ce($){window.clearInterval($)}class ue extends Y{constructor(b,S){super(setTimeout,he,b,function(F){return S(),null})}}class Te extends Y{constructor(b,S){super(setInterval,ce,b,function(F){return S(),F})}}var je={now(){return Date.now?Date.now():new Date().valueOf()},defer($){return new ue(0,$)},method($,...b){var S=Array.prototype.slice.call(arguments,1);return function(F){return F[$].apply(F,S.concat(arguments))}}},re=je;function fe($,...b){for(var S=0;S<b.length;S++){var F=b[S];for(var Z in F)F[Z]&&F[Z].constructor&&F[Z].constructor===Object?$[Z]=fe($[Z]||{},F[Z]):$[Z]=F[Z]}return $}function Ce(){for(var $=["Pusher"],b=0;b<arguments.length;b++)typeof arguments[b]=="string"?$.push(arguments[b]):$.push(Ne(arguments[b]));return $.join(" : ")}function $e($,b){var S=Array.prototype.indexOf;if($===null)return-1;if(S&&$.indexOf===S)return $.indexOf(b);for(var F=0,Z=$.length;F<Z;F++)if($[F]===b)return F;return-1}function Le($,b){for(var S in $)Object.prototype.hasOwnProperty.call($,S)&&b($[S],S,$)}function Be($){var b=[];return Le($,function(S,F){b.push(F)}),b}function Ue($){var b=[];return Le($,function(S){b.push(S)}),b}function N($,b,S){for(var F=0;F<$.length;F++)b.call(S||window,$[F],F,$)}function ee($,b){for(var S=[],F=0;F<$.length;F++)S.push(b($[F],F,$,S));return S}function Q($,b){var S={};return Le($,function(F,Z){S[Z]=b(F)}),S}function j($,b){b=b||function(Z){return!!Z};for(var S=[],F=0;F<$.length;F++)b($[F],F,$,S)&&S.push($[F]);return S}function B($,b){var S={};return Le($,function(F,Z){(b&&b(F,Z,$,S)||F)&&(S[Z]=F)}),S}function ie($){var b=[];return Le($,function(S,F){b.push([F,S])}),b}function me($,b){for(var S=0;S<$.length;S++)if(b($[S],S,$))return!0;return!1}function de($,b){for(var S=0;S<$.length;S++)if(!b($[S],S,$))return!1;return!0}function ge($){return Q($,function(b){return typeof b=="object"&&(b=Ne(b)),encodeURIComponent(T(b.toString()))})}function pe($){var b=B($,function(F){return F!==void 0}),S=ee(ie(ge(b)),re.method("join","=")).join("&");return S}function Ae($){var b=[],S=[];return function F(Z,ve){var Ee,Ve,st;switch(typeof Z){case"object":if(!Z)return null;for(Ee=0;Ee<b.length;Ee+=1)if(b[Ee]===Z)return{$ref:S[Ee]};if(b.push(Z),S.push(ve),Object.prototype.toString.apply(Z)==="[object Array]")for(st=[],Ee=0;Ee<Z.length;Ee+=1)st[Ee]=F(Z[Ee],ve+"["+Ee+"]");else{st={};for(Ve in Z)Object.prototype.hasOwnProperty.call(Z,Ve)&&(st[Ve]=F(Z[Ve],ve+"["+JSON.stringify(Ve)+"]"))}return st;case"number":case"string":case"boolean":return Z}}($,"$")}function Ne($){try{return JSON.stringify($)}catch{return JSON.stringify(Ae($))}}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,...S){var F=Ce.apply(this,arguments);Fd.log?Fd.log(F):Fd.logToConsole&&b.bind(this)(F)}}var Ie=new De,We=function($,b,S,F,Z){(S.headers!==void 0||S.headersProvider!=null)&&Ie.warn(`To send headers with the ${F.toString()} request, you must use AJAX, rather than JSONP.`);var ve=$.nextAuthCallbackID.toString();$.nextAuthCallbackID++;var Ee=$.getDocument(),Ve=Ee.createElement("script");$.auth_callbacks[ve]=function(yt){Z(null,yt)};var st="Pusher.auth_callbacks['"+ve+"']";Ve.src=S.endpoint+"?callback="+encodeURIComponent(st)+"&"+b;var pt=Ee.getElementsByTagName("head")[0]||Ee.documentElement;pt.insertBefore(Ve,pt.firstChild)},it=We;class at{constructor(b){this.src=b}send(b){var S=this,F="Error loading "+S.src;S.script=document.createElement("script"),S.script.id=b.id,S.script.src=S.src,S.script.type="text/javascript",S.script.charset="UTF-8",S.script.addEventListener?(S.script.onerror=function(){b.callback(F)},S.script.onload=function(){b.callback(null)}):S.script.onreadystatechange=function(){(S.script.readyState==="loaded"||S.script.readyState==="complete")&&b.callback(null)},S.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(S.errorScript=document.createElement("script"),S.errorScript.id=b.id+"_error",S.errorScript.text=b.name+"('"+F+"');",S.script.async=S.errorScript.async=!1):S.script.async=!0;var Z=document.getElementsByTagName("head")[0];Z.insertBefore(S.script,Z.firstChild),S.errorScript&&Z.insertBefore(S.errorScript,S.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 dt{constructor(b,S){this.url=b,this.data=S}send(b){if(!this.request){var S=pe(this.data),F=this.url+"/"+b.number+"?"+S;this.request=ot.createScriptRequest(F),this.request.send(b)}}cleanup(){this.request&&this.request.cleanup()}}var Tt=function($,b){return function(S,F){var Z="http"+(b?"s":"")+"://",ve=Z+($.host||$.options.host)+$.options.path,Ee=ot.createJSONPRequest(ve,S),Ve=ot.ScriptReceivers.create(function(st,pt){i.remove(Ve),Ee.cleanup(),pt&&pt.host&&($.host=pt.host),F&&F(st,pt)});Ee.send(Ve)}},Lt={name:"jsonp",getAgent:Tt},un=Lt;function qt($,b,S){var F=$+(b.useTLS?"s":""),Z=b.useTLS?b.hostTLS:b.hostNonTLS;return F+"://"+Z+S}function se($,b){var S="/app/"+$,F="?protocol="+c.PROTOCOL+"&client=js&version="+c.VERSION+(b?"&"+b:"");return S+F}var ye={getInitial:function($,b){var S=(b.httpPath||"")+se($,"flash=false");return qt("ws",b,S)}},Re={getInitial:function($,b){var S=(b.httpPath||"/pusher")+se($);return qt("http",b,S)}},ze={getInitial:function($,b){return qt("http",b,b.httpPath||"/pusher")},getPath:function($,b){return se($)}};class Oe{constructor(){this._callbacks={}}get(b){return this._callbacks[we(b)]}add(b,S,F){var Z=we(b);this._callbacks[Z]=this._callbacks[Z]||[],this._callbacks[Z].push({fn:S,context:F})}remove(b,S,F){if(!b&&!S&&!F){this._callbacks={};return}var Z=b?[we(b)]:Be(this._callbacks);S||F?this.removeCallback(Z,S,F):this.removeAllCallbacks(Z)}removeCallback(b,S,F){N(b,function(Z){this._callbacks[Z]=j(this._callbacks[Z]||[],function(ve){return S&&S!==ve.fn||F&&F!==ve.context}),this._callbacks[Z].length===0&&delete this._callbacks[Z]},this)}removeAllCallbacks(b){N(b,function(S){delete this._callbacks[S]},this)}}function we($){return"_"+$}class ke{constructor(b){this.callbacks=new Oe,this.global_callbacks=[],this.failThrough=b}bind(b,S,F){return this.callbacks.add(b,S,F),this}bind_global(b){return this.global_callbacks.push(b),this}unbind(b,S,F){return this.callbacks.remove(b,S,F),this}unbind_global(b){return b?(this.global_callbacks=j(this.global_callbacks||[],S=>S!==b),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(b,S,F){for(var Z=0;Z<this.global_callbacks.length;Z++)this.global_callbacks[Z](b,S);var ve=this.callbacks.get(b),Ee=[];if(F?Ee.push(S,F):S&&Ee.push(S),ve&&ve.length>0)for(var Z=0;Z<ve.length;Z++)ve[Z].fn.apply(ve[Z].context||window,Ee);else this.failThrough&&this.failThrough(b,S);return this}}class Ye extends ke{constructor(b,S,F,Z,ve){super(),this.initialize=ot.transportConnectionInitializer,this.hooks=b,this.name=S,this.priority=F,this.key=Z,this.options=ve,this.state="new",this.timeline=ve.timeline,this.activityTimeout=ve.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(S){return re.defer(()=>{this.onError(S),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"?(re.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,S){this.state=b,this.timeline.info(this.buildTimelineMessage({state:b,params:S})),this.emit(b,S)}buildTimelineMessage(b){return fe({cid:this.id},b)}}class lt{constructor(b){this.hooks=b}isSupported(b){return this.hooks.isSupported(b)}createConnection(b,S,F,Z){return new Ye(this.hooks,b,S,F,Z)}}var At=new lt({urls:ye,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!ot.getWebSocketAPI()},isSupported:function(){return!!ot.getWebSocketAPI()},getSocket:function($){return ot.createWebSocket($)}}),An={urls:Re,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Kn=fe({getSocket:function($){return ot.HTTPFactory.createStreamingSocket($)}},An),xn=fe({getSocket:function($){return ot.HTTPFactory.createPollingSocket($)}},An),zt={isSupported:function(){return ot.isXHRSupported()}},Bl=new lt(fe({},Kn,zt)),Ul=new lt(fe({},xn,zt)),Vl={ws:At,xhr_streaming:Bl,xhr_polling:Ul},Rr=Vl,_e=new lt({file:"sockjs",urls:ze,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}))}}),as={isSupported:function($){var b=ot.isXDRSupported($.useTLS);return b}},So=new lt(fe({},Kn,as)),Hl=new lt(fe({},xn,as));Rr.xdr_streaming=So,Rr.xdr_polling=Hl,Rr.sockjs=_e;var Wl=Rr;class Gl extends ke{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 Kl=new Gl;class Ql{constructor(b,S,F){this.manager=b,this.transport=S,this.minPingDelay=F.minPingDelay,this.maxPingDelay=F.maxPingDelay,this.pingDelay=void 0}createConnection(b,S,F,Z){Z=fe({},Z,{activityTimeout:this.pingDelay});var ve=this.transport.createConnection(b,S,F,Z),Ee=null,Ve=function(){ve.unbind("open",Ve),ve.bind("closed",st),Ee=re.now()},st=pt=>{if(ve.unbind("closed",st),pt.code===1002||pt.code===1003)this.manager.reportDeath();else if(!pt.wasClean&&Ee){var yt=re.now()-Ee;yt<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(yt/2,this.minPingDelay))}};return ve.bind("open",Ve),ve}isSupported(b){return this.manager.isAlive()&&this.transport.isSupported(b)}}const Fi={decodeMessage:function($){try{var b=JSON.parse($.data),S=b.data;if(typeof S=="string")try{S=JSON.parse(b.data)}catch{}var F={event:b.event,channel:b.channel,data:S};return b.user_id&&(F.user_id=b.user_id),F}catch(Z){throw{type:"MessageParseError",error:Z,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 Jl extends ke{constructor(b,S){super(),this.id=b,this.transport=S,this.activityTimeout=S.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(b){return this.transport.send(b)}send_event(b,S,F){var Z={event:b,data:S};return F&&(Z.channel=F),Ie.debug("Event sent",Z),this.send(bs.encodeMessage(Z))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var b={message:F=>{var Z;try{Z=bs.decodeMessage(F)}catch(ve){this.emit("error",{type:"MessageParseError",error:ve,data:F.data})}if(Z!==void 0){switch(Ie.debug("Event recd",Z),Z.event){case"pusher:error":this.emit("error",{type:"PusherError",data:Z.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",Z)}},activity:()=>{this.emit("activity")},error:F=>{this.emit("error",F)},closed:F=>{S(),F&&F.code&&this.handleCloseEvent(F),this.transport=null,this.emit("closed")}},S=()=>{Le(b,(F,Z)=>{this.transport.unbind(Z,F)})};Le(b,(F,Z)=>{this.transport.bind(Z,F)})}handleCloseEvent(b){var S=bs.getCloseAction(b),F=bs.getCloseError(b);F&&this.emit("error",F),S&&this.emit(S,{action:S,error:F})}}class Xl{constructor(b,S){this.transport=b,this.callback=S,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=b=>{this.unbindListeners();var S;try{S=bs.processHandshake(b)}catch(F){this.finish("error",{error:F}),this.transport.close();return}S.action==="connected"?this.finish("connected",{connection:new Jl(S.id,this.transport),activityTimeout:S.activityTimeout}):(this.finish(S.action,{error:S.error}),this.transport.close())},this.onClosed=b=>{this.unbindListeners();var S=bs.getCloseAction(b)||"backoff",F=bs.getCloseError(b);this.finish(S,{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,S){this.callback(fe({transport:this.transport,action:b},S))}}class Zl{constructor(b,S){this.timeline=b,this.options=S||{}}send(b,S){this.timeline.isEmpty()||this.timeline.send(ot.TimelineTransport.getAgent(this,b),S)}}class Co extends ke{constructor(b,S){super(function(F,Z){Ie.debug("No callbacks on "+b+" for "+F)}),this.name=b,this.pusher=S,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(b,S){return S(null,{auth:""})}trigger(b,S){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,S,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(b){var S=b.event,F=b.data;if(S==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(b);else if(S==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(b);else if(S.indexOf("pusher_internal:")!==0){var Z={};this.emit(S,F,Z)}}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,S)=>{b?(this.subscriptionPending=!1,Ie.error(b.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:b.message},b instanceof P?{status:b.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:S.auth,channel_data:S.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 $o extends Co{authorize(b,S){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:b},S)}}class Yl{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,(S,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 S=this.get(b.user_id);return S&&(delete this.members[b.user_id],this.count--),S}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var ec=function($,b,S,F){function Z(ve){return ve instanceof S?ve:new S(function(Ee){Ee(ve)})}return new(S||(S=Promise))(function(ve,Ee){function Ve(yt){try{pt(F.next(yt))}catch(Wt){Ee(Wt)}}function st(yt){try{pt(F.throw(yt))}catch(Wt){Ee(Wt)}}function pt(yt){yt.done?ve(yt.value):Z(yt.value).then(Ve,st)}pt((F=F.apply($,b||[])).next())})};class tc extends $o{constructor(b,S){super(b,S),this.members=new Yl}authorize(b,S){super.authorize(b,(F,Z)=>ec(this,void 0,void 0,function*(){if(!F)if(Z=Z,Z.channel_data!=null){var ve=JSON.parse(Z.channel_data);this.members.setMyID(ve.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 Ee=p.buildLogSuffix("authorizationEndpoint");Ie.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${Ee}, or the user should be signed in.`),S("Invalid auth response");return}S(F,Z)}))}handleEvent(b){var S=b.event;if(S.indexOf("pusher_internal:")===0)this.handleInternalEvent(b);else{var F=b.data,Z={};b.user_id&&(Z.user_id=b.user_id),this.emit(S,F,Z)}}handleInternalEvent(b){var S=b.event,F=b.data;switch(S){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(b);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(b);break;case"pusher_internal:member_added":var Z=this.members.addMember(F);this.emit("pusher:member_added",Z);break;case"pusher_internal:member_removed":var ve=this.members.removeMember(F);ve&&this.emit("pusher:member_removed",ve);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 nc=r(1),To=r(0);class sc extends $o{constructor(b,S,F){super(b,S),this.key=null,this.nacl=F}authorize(b,S){super.authorize(b,(F,Z)=>{if(F){S(F,Z);return}let ve=Z.shared_secret;if(!ve){S(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(To.decode)(ve),delete Z.shared_secret,S(null,Z)})}trigger(b,S){throw new O("Client events are not currently supported for encrypted channels")}handleEvent(b){var S=b.event,F=b.data;if(S.indexOf("pusher_internal:")===0||S.indexOf("pusher:")===0){super.handleEvent(b);return}this.handleEncryptedEvent(S,F)}handleEncryptedEvent(b,S){if(!this.key){Ie.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!S.ciphertext||!S.nonce){Ie.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+S);return}let F=Object(To.decode)(S.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 Z=Object(To.decode)(S.nonce);if(Z.length<this.nacl.secretbox.nonceLength){Ie.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${Z.length}`);return}let ve=this.nacl.secretbox.open(F,Z,this.key);if(ve===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,(Ee,Ve)=>{if(Ee){Ie.error(`Failed to make a request to the authEndpoint: ${Ve}. Unable to fetch new key, so dropping encrypted event`);return}if(ve=this.nacl.secretbox.open(F,Z,this.key),ve===null){Ie.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(b,this.getDataToEmit(ve))});return}this.emit(b,this.getDataToEmit(ve))}getDataToEmit(b){let S=Object(nc.decode)(b);try{return JSON.parse(S)}catch{return S}}}class rc extends ke{constructor(b,S){super(),this.state="initialized",this.connection=null,this.key=b,this.options=S,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=ot.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,S,F){return this.connection?this.connection.send_event(b,S,F):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var b=(S,F)=>{S?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 ue(b||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new ue(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new ue(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 ue(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(b){return fe({},b,{message:S=>{this.resetActivityCheck(),this.emit("message",S)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:S=>{this.emit("error",S)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(b){return fe({},b,{connected:S=>{this.activityTimeout=Math.min(this.options.activityTimeout,S.activityTimeout,S.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(S.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let b=S=>F=>{F.error&&this.emit("error",{type:"WebSocketError",error:F.error}),S(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 S in this.connectionCallbacks)this.connection.bind(S,this.connectionCallbacks[S]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var b in this.connectionCallbacks)this.connection.unbind(b,this.connectionCallbacks[b]);var S=this.connection;return this.connection=null,S}}updateState(b,S){var F=this.state;if(this.state=b,F!==b){var Z=b;Z==="connected"&&(Z+=" with new socket ID "+S.socket_id),Ie.debug("State changed",F+" -> "+Z),this.timeline.info({state:b,params:S}),this.emit("state_change",{previous:F,current:b}),this.emit(b,S)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class oc{constructor(){this.channels={}}add(b,S){return this.channels[b]||(this.channels[b]=ic(b,S)),this.channels[b]}all(){return Ue(this.channels)}find(b){return this.channels[b]}remove(b){var S=this.channels[b];return delete this.channels[b],S}disconnect(){Le(this.channels,function(b){b.disconnect()})}}function ic($,b){if($.indexOf("private-encrypted-")===0){if(b.config.nacl)return Qn.createEncryptedChannel($,b,b.config.nacl);let S="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",F=p.buildLogSuffix("encryptedChannelSupport");throw new O(`${S}. ${F}`)}else{if($.indexOf("private-")===0)return Qn.createPrivateChannel($,b);if($.indexOf("presence-")===0)return Qn.createPresenceChannel($,b);if($.indexOf("#")===0)throw new w('Cannot create a channel with name "'+$+'".');return Qn.createChannel($,b)}}var ac={createChannels(){return new oc},createConnectionManager($,b){return new rc($,b)},createChannel($,b){return new Co($,b)},createPrivateChannel($,b){return new $o($,b)},createPresenceChannel($,b){return new tc($,b)},createEncryptedChannel($,b,S){return new sc($,b,S)},createTimelineSender($,b){return new Zl($,b)},createHandshake($,b){return new Xl($,b)},createAssistantToTheTransportManager($,b,S){return new Ql($,b,S)}},Qn=ac;class qi{constructor(b){this.options=b||{},this.livesLeft=this.options.lives||1/0}getAssistant(b){return Qn.createAssistantToTheTransportManager(this,b,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class _s{constructor(b,S){this.strategies=b,this.loop=!!S.loop,this.failFast=!!S.failFast,this.timeout=S.timeout,this.timeoutLimit=S.timeoutLimit}isSupported(){return me(this.strategies,re.method("isSupported"))}connect(b,S){var F=this.strategies,Z=0,ve=this.timeout,Ee=null,Ve=(st,pt)=>{pt?S(null,pt):(Z=Z+1,this.loop&&(Z=Z%F.length),Z<F.length?(ve&&(ve=ve*2,this.timeoutLimit&&(ve=Math.min(ve,this.timeoutLimit))),Ee=this.tryStrategy(F[Z],b,{timeout:ve,failFast:this.failFast},Ve)):S(!0))};return Ee=this.tryStrategy(F[Z],b,{timeout:ve,failFast:this.failFast},Ve),{abort:function(){Ee.abort()},forceMinPriority:function(st){b=st,Ee&&Ee.forceMinPriority(st)}}}tryStrategy(b,S,F,Z){var ve=null,Ee=null;return F.timeout>0&&(ve=new ue(F.timeout,function(){Ee.abort(),Z(!0)})),Ee=b.connect(S,function(Ve,st){Ve&&ve&&ve.isRunning()&&!F.failFast||(ve&&ve.ensureAborted(),Z(Ve,st))}),{abort:function(){ve&&ve.ensureAborted(),Ee.abort()},forceMinPriority:function(Ve){Ee.forceMinPriority(Ve)}}}}class Ao{constructor(b){this.strategies=b}isSupported(){return me(this.strategies,re.method("isSupported"))}connect(b,S){return lc(this.strategies,b,function(F,Z){return function(ve,Ee){if(Z[F].error=ve,ve){cc(Z)&&S(!0);return}N(Z,function(Ve){Ve.forceMinPriority(Ee.transport.priority)}),S(null,Ee)}})}}function lc($,b,S){var F=ee($,function(Z,ve,Ee,Ve){return Z.connect(b,S(ve,Ve))});return{abort:function(){N(F,uc)},forceMinPriority:function(Z){N(F,function(ve){ve.forceMinPriority(Z)})}}}function cc($){return de($,function(b){return!!b.error})}function uc($){!$.error&&!$.aborted&&($.abort(),$.aborted=!0)}class dc{constructor(b,S,F){this.strategy=b,this.transports=S,this.ttl=F.ttl||1800*1e3,this.usingTLS=F.useTLS,this.timeline=F.timeline}isSupported(){return this.strategy.isSupported()}connect(b,S){var F=this.usingTLS,Z=fc(F),ve=Z&&Z.cacheSkipCount?Z.cacheSkipCount:0,Ee=[this.strategy];if(Z&&Z.timestamp+this.ttl>=re.now()){var Ve=this.transports[Z.transport];Ve&&(["ws","wss"].includes(Z.transport)||ve>3?(this.timeline.info({cached:!0,transport:Z.transport,latency:Z.latency}),Ee.push(new _s([Ve],{timeout:Z.latency*2+1e3,failFast:!0}))):ve++)}var st=re.now(),pt=Ee.pop().connect(b,function yt(Wt,yc){Wt?(zi(F),Ee.length>0?(st=re.now(),pt=Ee.pop().connect(b,yt)):S(Wt)):(hc(F,yc.transport.name,re.now()-st,ve),S(null,yc))});return{abort:function(){pt.abort()},forceMinPriority:function(yt){b=yt,pt&&pt.forceMinPriority(yt)}}}}function Eo($){return"pusherTransport"+($?"TLS":"NonTLS")}function fc($){var b=ot.getLocalStorage();if(b)try{var S=b[Eo($)];if(S)return JSON.parse(S)}catch{zi($)}return null}function hc($,b,S,F){var Z=ot.getLocalStorage();if(Z)try{Z[Eo($)]=Ne({timestamp:re.now(),transport:b,latency:S,cacheSkipCount:F})}catch{}}function zi($){var b=ot.getLocalStorage();if(b)try{delete b[Eo($)]}catch{}}class Dr{constructor(b,{delay:S}){this.strategy=b,this.options={delay:S}}isSupported(){return this.strategy.isSupported()}connect(b,S){var F=this.strategy,Z,ve=new ue(this.options.delay,function(){Z=F.connect(b,S)});return{abort:function(){ve.ensureAborted(),Z&&Z.abort()},forceMinPriority:function(Ee){b=Ee,Z&&Z.forceMinPriority(Ee)}}}}class dn{constructor(b,S,F){this.test=b,this.trueBranch=S,this.falseBranch=F}isSupported(){var b=this.test()?this.trueBranch:this.falseBranch;return b.isSupported()}connect(b,S){var F=this.test()?this.trueBranch:this.falseBranch;return F.connect(b,S)}}class jr{constructor(b){this.strategy=b}isSupported(){return this.strategy.isSupported()}connect(b,S){var F=this.strategy.connect(b,function(Z,ve){ve&&F.abort(),S(Z,ve)});return F}}function En($){return function(){return $.isSupported()}}var Os=function($,b,S){var F={};function Z(t0,HK,WK,GK,KK){var n0=S($,t0,HK,WK,GK,KK);return F[t0]=n0,n0}var ve=Object.assign({},b,{hostNonTLS:$.wsHost+":"+$.wsPort,hostTLS:$.wsHost+":"+$.wssPort,httpPath:$.wsPath}),Ee=Object.assign({},ve,{useTLS:!0}),Ve=Object.assign({},b,{hostNonTLS:$.httpHost+":"+$.httpPort,hostTLS:$.httpHost+":"+$.httpsPort,httpPath:$.httpPath}),st={loop:!0,timeout:15e3,timeoutLimit:6e4},pt=new qi({minPingDelay:1e4,maxPingDelay:$.activityTimeout}),yt=new qi({lives:2,minPingDelay:1e4,maxPingDelay:$.activityTimeout}),Wt=Z("ws","ws",3,ve,pt),yc=Z("wss","ws",3,Ee,pt),qK=Z("sockjs","sockjs",1,Ve),Qv=Z("xhr_streaming","xhr_streaming",1,Ve,yt),zK=Z("xdr_streaming","xdr_streaming",1,Ve,yt),Jv=Z("xhr_polling","xhr_polling",1,Ve),BK=Z("xdr_polling","xdr_polling",1,Ve),Xv=new _s([Wt],st),UK=new _s([yc],st),VK=new _s([qK],st),Zv=new _s([new dn(En(Qv),Qv,zK)],st),Yv=new _s([new dn(En(Jv),Jv,BK)],st),e0=new _s([new dn(En(Zv),new Ao([Zv,new Dr(Yv,{delay:4e3})]),Yv)],st),qd=new dn(En(e0),e0,VK),zd;return b.useTLS?zd=new Ao([Xv,new Dr(qd,{delay:2e3})]):zd=new Ao([Xv,new Dr(UK,{delay:2e3}),new Dr(qd,{delay:5e3})]),new dc(new jr(new dn(En(Wt),zd,qd)),F,{ttl:18e5,timeline:b.timeline,useTLS:b.useTLS})},Jn=Os,pc=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,S){$.hooks.isInitialized()?($.changeState("initialized"),S(!0)):(b&&$.onError(b),$.onClose(),S(!1))})):$.onClose()},mc={getRequest:function($){var b=new window.XDomainRequest;return b.ontimeout=function(){$.emit("error",new k),$.close()},b.onerror=function(S){$.emit("error",S),$.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()}},gc=mc;const Vv=256*1024;class ZG extends ke{constructor(b,S,F){super(),this.hooks=b,this.method=S,this.url=F}start(b){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},ot.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&&(ot.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(b,S){for(;;){var F=this.advanceBuffer(S);if(F)this.emit("chunk",{status:b,data:F});else break}this.isBufferTooLong(S)&&this.emit("buffer_too_long")}advanceBuffer(b){var S=b.slice(this.position),F=S.indexOf(`
|
||
`);return F!==-1?(this.position+=F+1,S.slice(0,F)):null}isBufferTooLong(b){return this.position===b.length&&b.length>Vv}}var jd;(function($){$[$.CONNECTING=0]="CONNECTING",$[$.OPEN=1]="OPEN",$[$.CLOSED=3]="CLOSED"})(jd||(jd={}));var Nr=jd,YG=1;class eK{constructor(b,S){this.hooks=b,this.session=Wv(1e3)+"/"+rK(8),this.location=tK(S),this.readyState=Nr.CONNECTING,this.openStream()}send(b){return this.sendRaw(JSON.stringify([b]))}ping(){this.hooks.sendHeartbeat(this)}close(b,S){this.onClose(b,S,!0)}sendRaw(b){if(this.readyState===Nr.OPEN)try{return ot.createSocketRequest("POST",Hv(nK(this.location,this.session))).start(b),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(b,S,F){this.closeStream(),this.readyState=Nr.CLOSED,this.onclose&&this.onclose({code:b,reason:S,wasClean:F})}onChunk(b){if(b.status===200){this.readyState===Nr.OPEN&&this.onActivity();var S,F=b.data.slice(0,1);switch(F){case"o":S=JSON.parse(b.data.slice(1)||"{}"),this.onOpen(S);break;case"a":S=JSON.parse(b.data.slice(1)||"[]");for(var Z=0;Z<S.length;Z++)this.onEvent(S[Z]);break;case"m":S=JSON.parse(b.data.slice(1)||"null"),this.onEvent(S);break;case"h":this.hooks.onHeartbeat(this);break;case"c":S=JSON.parse(b.data.slice(1)||"[]"),this.onClose(S[0],S[1],!0);break}}}onOpen(b){this.readyState===Nr.CONNECTING?(b&&b.hostname&&(this.location.base=sK(this.location.base,b.hostname)),this.readyState=Nr.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(b){this.readyState===Nr.OPEN&&this.onmessage&&this.onmessage({data:b})}onActivity(){this.onactivity&&this.onactivity()}onError(b){this.onerror&&this.onerror(b)}openStream(){this.stream=ot.createSocketRequest("POST",Hv(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){re.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 tK($){var b=/([^\?]*)\/*(\??.*)/.exec($);return{base:b[1],queryString:b[2]}}function nK($,b){return $.base+"/"+b+"/xhr_send"}function Hv($){var b=$.indexOf("?")===-1?"?":"&";return $+b+"t="+ +new Date+"&n="+YG++}function sK($,b){var S=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec($);return S[1]+b+S[3]}function Wv($){return ot.randomInt($)}function rK($){for(var b=[],S=0;S<$;S++)b.push(Wv(32).toString(32));return b.join("")}var oK=eK,iK={getReceiveURL:function($,b){return $.base+"/"+b+"/xhr_streaming"+$.queryString},onHeartbeat:function($){$.sendRaw("[]")},sendHeartbeat:function($){$.sendRaw("[]")},onFinished:function($,b){$.onClose(1006,"Connection interrupted ("+b+")",!1)}},aK=iK,lK={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)}},cK=lK,uK={getRequest:function($){var b=ot.getXHRAPI(),S=new b;return S.onreadystatechange=S.onprogress=function(){switch(S.readyState){case 3:S.responseText&&S.responseText.length>0&&$.onChunk(S.status,S.responseText);break;case 4:S.responseText&&S.responseText.length>0&&$.onChunk(S.status,S.responseText),$.emit("finished",S.status),$.close();break}},S},abortRequest:function($){$.onreadystatechange=null,$.abort()}},dK=uK,fK={createStreamingSocket($){return this.createSocket(aK,$)},createPollingSocket($){return this.createSocket(cK,$)},createSocket($,b){return new oK($,b)},createXHR($,b){return this.createRequest(dK,$,b)},createRequest($,b,S){return new ZG($,b,S)}},Gv=fK;Gv.createXDR=function($,b){return this.createRequest(gc,$,b)};var hK=Gv,pK={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:i,DependenciesReceivers:d,getDefaultStrategy:Jn,Transports:Wl,transportConnectionInitializer:pc,HTTPFactory:hK,TimelineTransport:un,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:H,jsonp:it}},onDocumentBody($){document.body?$():setTimeout(()=>{this.onDocumentBody($)},0)},createJSONPRequest($,b){return new dt($,b)},createScriptRequest($){return new at($)},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 Kl},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:",S=this.getProtocol();return!!window.XDomainRequest&&S===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)}()*$)}},ot=pK,Nd;(function($){$[$.ERROR=3]="ERROR",$[$.INFO=6]="INFO",$[$.DEBUG=7]="DEBUG"})(Nd||(Nd={}));var vc=Nd;class mK{constructor(b,S,F){this.key=b,this.session=S,this.events=[],this.options=F||{},this.sent=0,this.uniqueID=0}log(b,S){b<=this.options.level&&(this.events.push(fe({},S,{timestamp:re.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(b){this.log(vc.ERROR,b)}info(b){this.log(vc.INFO,b)}debug(b){this.log(vc.DEBUG,b)}isEmpty(){return this.events.length===0}send(b,S){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,(Z,ve)=>{Z||this.sent++,S&&S(Z,ve)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class gK{constructor(b,S,F,Z){this.name=b,this.priority=S,this.transport=F,this.options=Z||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(b,S){if(this.isSupported()){if(this.priority<b)return Kv(new C,S)}else return Kv(new M,S);var F=!1,Z=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),ve=null,Ee=function(){Z.unbind("initialized",Ee),Z.connect()},Ve=function(){ve=Qn.createHandshake(Z,function(Wt){F=!0,yt(),S(null,Wt)})},st=function(Wt){yt(),S(Wt)},pt=function(){yt();var Wt;Wt=Ne(Z),S(new E(Wt))},yt=function(){Z.unbind("initialized",Ee),Z.unbind("open",Ve),Z.unbind("error",st),Z.unbind("closed",pt)};return Z.bind("initialized",Ee),Z.bind("open",Ve),Z.bind("error",st),Z.bind("closed",pt),Z.initialize(),{abort:()=>{F||(yt(),ve?ve.close():Z.close())},forceMinPriority:Wt=>{F||this.priority<Wt&&(ve?ve.close():Z.close())}}}}function Kv($,b){return re.defer(function(){b($)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:vK}=ot;var yK=function($,b,S,F,Z,ve){var Ee=vK[S];if(!Ee)throw new I(S);var Ve=(!$.enabledTransports||$e($.enabledTransports,b)!==-1)&&(!$.disabledTransports||$e($.disabledTransports,b)===-1),st;return Ve?(Z=Object.assign({ignoreNullOrigin:$.ignoreNullOrigin},Z),st=new gK(b,F,ve?ve.getAssistant(Ee):Ee,Z)):st=bK,st},bK={isSupported:function(){return!1},connect:function($,b){var S=re.defer(function(){b(new M)});return{abort:function(){S.ensureAborted()},forceMinPriority:function(){}}}};function _K($){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 xK=($,b)=>{var S="socket_id="+encodeURIComponent($.socketId);for(var F in b.params)S+="&"+encodeURIComponent(F)+"="+encodeURIComponent(b.params[F]);if(b.paramsProvider!=null){let Z=b.paramsProvider();for(var F in Z)S+="&"+encodeURIComponent(F)+"="+encodeURIComponent(Z[F])}return S};var wK=$=>{if(typeof ot.getAuthorizers()[$.transport]>"u")throw`'${$.transport}' is not a recognized auth transport`;return(b,S)=>{const F=xK(b,$);ot.getAuthorizers()[$.transport](ot,F,$,v.UserAuthentication,S)}};const kK=($,b)=>{var S="socket_id="+encodeURIComponent($.socketId);S+="&channel_name="+encodeURIComponent($.channelName);for(var F in b.params)S+="&"+encodeURIComponent(F)+"="+encodeURIComponent(b.params[F]);if(b.paramsProvider!=null){let Z=b.paramsProvider();for(var F in Z)S+="&"+encodeURIComponent(F)+"="+encodeURIComponent(Z[F])}return S};var SK=$=>{if(typeof ot.getAuthorizers()[$.transport]>"u")throw`'${$.transport}' is not a recognized auth transport`;return(b,S)=>{const F=kK(b,$);ot.getAuthorizers()[$.transport](ot,F,$,v.ChannelAuthorization,S)}};const CK=($,b,S)=>{const F={authTransport:b.transport,authEndpoint:b.endpoint,auth:{params:b.params,headers:b.headers}};return(Z,ve)=>{const Ee=$.channel(Z.channelName);S(Ee,F).authorize(Z.socketId,ve)}};function $K($,b){let S={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:PK($),httpHost:TK($),useTLS:IK($),wsHost:AK($),userAuthenticator:MK($),channelAuthorizer:LK($,b)};return"disabledTransports"in $&&(S.disabledTransports=$.disabledTransports),"enabledTransports"in $&&(S.enabledTransports=$.enabledTransports),"ignoreNullOrigin"in $&&(S.ignoreNullOrigin=$.ignoreNullOrigin),"timelineParams"in $&&(S.timelineParams=$.timelineParams),"nacl"in $&&(S.nacl=$.nacl),S}function TK($){return $.httpHost?$.httpHost:$.cluster?`sockjs-${$.cluster}.pusher.com`:c.httpHost}function AK($){return $.wsHost?$.wsHost:EK($.cluster)}function EK($){return`ws-${$}.pusher.com`}function IK($){return ot.getProtocol()==="https:"?!0:$.forceTLS!==!1}function PK($){return"enableStats"in $?$.enableStats:"disableStats"in $?!$.disableStats:!1}function MK($){const b=Object.assign(Object.assign({},c.userAuthentication),$.userAuthentication);return"customHandler"in b&&b.customHandler!=null?b.customHandler:wK(b)}function OK($,b){let S;return"channelAuthorization"in $?S=Object.assign(Object.assign({},c.channelAuthorization),$.channelAuthorization):(S={transport:$.authTransport||c.authTransport,endpoint:$.authEndpoint||c.authEndpoint},"auth"in $&&("params"in $.auth&&(S.params=$.auth.params),"headers"in $.auth&&(S.headers=$.auth.headers)),"authorizer"in $&&(S.customHandler=CK(b,S,$.authorizer))),S}function LK($,b){const S=OK($,b);return"customHandler"in S&&S.customHandler!=null?S.customHandler:SK(S)}class RK extends ke{constructor(b){super(function(S,F){Ie.debug(`No callbacks on watchlist events for ${S}`)}),this.pusher=b,this.bindWatchlistInternalEvent()}handleEvent(b){b.data.events.forEach(S=>{this.emit(S.name,S)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",b=>{var S=b.event;S==="pusher_internal:watchlist_events"&&this.handleEvent(b)})}}function DK(){let $,b;return{promise:new Promise((F,Z)=>{$=F,b=Z}),resolve:$,reject:b}}var jK=DK;class NK extends ke{constructor(b){super(function(S,F){Ie.debug("No callbacks on user for "+S)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(S,F)=>{if(S){Ie.warn(`Error during signin: ${S}`),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:S,current:F})=>{S!=="connected"&&F==="connected"&&this._signin(),S==="connected"&&F!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new RK(b),this.pusher.connection.bind("message",S=>{var F=S.event;F==="pusher:signin_success"&&this._onSigninSuccess(S.data),this.serverToUserChannel&&this.serverToUserChannel.name===S.channel&&this.serverToUserChannel.handleEvent(S)})}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=S=>{S.subscriptionPending&&S.subscriptionCancelled?S.reinstateSubscription():!S.subscriptionPending&&this.pusher.connection.state==="connected"&&S.subscribe()};this.serverToUserChannel=new Co(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((S,F)=>{S.indexOf("pusher_internal:")===0||S.indexOf("pusher:")===0||this.emit(S,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:S}=jK();b.done=!1;const F=()=>{b.done=!0};b.then(F).catch(F),this.signinDonePromise=b,this._signinDoneResolve=S}}class fn{static ready(){fn.isReady=!0;for(var b=0,S=fn.instances.length;b<S;b++)fn.instances[b].connect()}static getClientFeatures(){return Be(B({ws:ot.Transports.ws},function(b){return b.isSupported({})}))}constructor(b,S){FK(b),_K(S),this.key=b,this.config=$K(S,this),this.channels=Qn.createChannels(),this.global_emitter=new ke,this.sessionID=ot.randomInt(1e9),this.timeline=new mK(this.key,this.sessionID,{cluster:this.config.cluster,features:fn.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:vc.INFO,version:c.VERSION}),this.config.enableStats&&(this.timelineSender=Qn.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+ot.TimelineTransport.name}));var F=Z=>ot.getDefaultStrategy(this.config,Z,yK);this.connection=Qn.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",Z=>{var ve=Z.event,Ee=ve.indexOf("pusher_internal:")===0;if(Z.channel){var Ve=this.channel(Z.channel);Ve&&Ve.handleEvent(Z)}Ee||this.global_emitter.emit(Z.event,Z.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",Z=>{Ie.warn(Z)}),fn.instances.push(this),this.timeline.info({instances:fn.instances.length}),this.user=new NK(this),fn.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(),S=this.timelineSender;this.timelineSenderTimer=new Te(6e4,function(){S.send(b)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(b,S,F){return this.global_emitter.bind(b,S,F),this}unbind(b,S,F){return this.global_emitter.unbind(b,S,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 S=this.channels.add(b,this);return S.subscriptionPending&&S.subscriptionCancelled?S.reinstateSubscription():!S.subscriptionPending&&this.connection.state==="connected"&&S.subscribe(),S}unsubscribe(b){var S=this.channels.find(b);S&&S.subscriptionPending?S.cancelSubscription():(S=this.channels.remove(b),S&&S.subscribed&&S.unsubscribe())}send_event(b,S,F){return this.connection.send_event(b,S,F)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}fn.instances=[],fn.isReady=!1,fn.logToConsole=!1,fn.Runtime=ot,fn.ScriptReceivers=ot.ScriptReceivers,fn.DependenciesReceivers=ot.DependenciesReceivers,fn.auth_callbacks=ot.auth_callbacks;var Fd=s.default=fn;function FK($){if($==null)throw"You must pass your app key when you instantiate Pusher."}ot.setup(fn)}])})})(Wm);var p2=Wm.exports;const m2=Ip(p2);window.Pusher=m2;let Ar=null;const g2=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}},Gm=()=>Ar||(Ar=new h2({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}}}),g2(Ar),window.Echo=Ar,Ar),Km=()=>Ar,v2="https://widget.geteasy.ai",y2=ht({isMobile:!1}),Ci=(e={})=>{const{openInit:t=!1,milliseconds:n}=e,s=768,{isMobile:r}=It(y2),o=te({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===v2?c():ae.state.chatState.isOpen||(o.value=t,c()),window.addEventListener("resize",a))})(),{isOpen:o,toggleChatbot:u}},b2=100,zu={MESSAGE_SEND:"push.message.send",USER_LEFT:"push.user.left",USER_STATUS:"push.user.status"},Vt={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 Bu=null;function _2(){const{getStorage:e,saveStorage:t}=Ks(),{isOpen:n}=Ci();if(Bu)return Bu;const s=L(null),r=L(null),o=L([]),i=L(null),a=L(null),c=L(null),u=L(null),d=L(!1),f=L(!1),h=L(null),g=L(!1),p=L(!1),v=Qs(),_=L("unread"),w=L(null),k=L(!1),C=L(null),E=L(0),O=L(!1),I=te(()=>{var se,ye,Re;return((Re=(ye=(se=ae==null?void 0:ae.state)==null?void 0:se.bot)==null?void 0:ye.config)==null?void 0:Re.stream)===!0}),M=te(()=>{var se,ye,Re,ze;return!!((ze=(Re=(ye=(se=ae==null?void 0:ae.state)==null?void 0:se.bot)==null?void 0:ye.config)==null?void 0:Re.delay_response)!=null&&ze.active)}),P=async()=>{if(!w.value)return;await wt(),await ts(b2);const se=w.value;se.scrollTo({top:se.scrollHeight,behavior:"smooth"})},q=()=>{const ye=new URLSearchParams(window.location.search).get("conversation_id");return ye&&!em(ye)?null:ye};(()=>{var se;try{i.value=e(Jt)??{},a.value=e(no)??{};const ye=q();if(ye){c.value=ye;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 T=(se={})=>({user_id:v,handle:ae.state.handle,...se}),A=()=>{s.value&&(I.value&&(s.value.listen(Vt.STREAM_START,Ae),s.value.listen(Vt.STREAM_DELTA,Ne),s.value.listen(Vt.STREAM_DONE,De),s.value.listen(Vt.STREAM_CANCELLED,Ie),s.value.listen(Vt.STREAM_MESSAGE_PROCESSED,We)),s.value.listen(Vt.CONVERSATION_PROCESSED,it),s.value.listen(Vt.MESSAGE_RECEIVED,at),s.value.listen(Vt.MESSAGE_PROCESSED,Tt),s.value.listen(Vt.ADMIN_TYPING,Lt),s.value.listen(Vt.ADMIN_VIEWED,un))},R=()=>{s.value&&(s.value.stopListening(Vt.MESSAGE_RECEIVED),s.value.stopListening(Vt.CONVERSATION_PROCESSED),s.value.stopListening(Vt.MESSAGE_PROCESSED),I.value&&(s.value.stopListening(Vt.STREAM_START),s.value.stopListening(Vt.STREAM_DELTA),s.value.stopListening(Vt.STREAM_DONE),s.value.stopListening(Vt.STREAM_CANCELLED),s.value.stopListening(Vt.STREAM_MESSAGE_PROCESSED)),s.value.stopListening(Vt.ADMIN_TYPING),s.value.stopListening(Vt.ADMIN_VIEWED))},K=()=>{const se=Km();if(!se){console.warn("Echo not initialized for connection tracking");return}const ye=se.connector.pusher.connection;d.value=ye.state==="connected",ye.bind("connected",()=>{d.value=!0}),ye.bind("disconnected",()=>{d.value=!1})},W=()=>{var we,ke,Ye,lt,At,An,Kn;let se=((lt=(Ye=(ke=(we=ae==null?void 0:ae.state)==null?void 0:we.bot)==null?void 0:ke.config)==null?void 0:Ye.initialMessage)==null?void 0:lt.messages)??[];se=Object.values(se),Array.isArray(se)||(se=[]);const ye=se.map(xn=>xn.content),ze=_i(ye).map((xn,zt)=>({id:zt,content_type:"text",sender_type:"assistant",content:xn,is_welcome_message:!0})),Oe=(Kn=(An=(At=ae==null?void 0:ae.state)==null?void 0:At.bot)==null?void 0:An.config)==null?void 0:Kn.introductionMessage;return Oe&&typeof Oe=="string"&&ze.push({id:ze.length,content_type:"text",sender_type:"assistant",content:Oe,is_welcome_message:!0,is_introduction_message:!0}),ze},U=()=>{o.value=[];const se=W();o.value=vs(se)},J=(se=[])=>{let ye=se.filter(ze=>!ze.is_welcome_message);if(!(ye!=null&&ye.length))return;if(!ae.state.chatState.lastAssistantMessageId){const ze=[...ye].reverse().find(Oe=>Oe.sender_type==="assistant");ze!=null&&ze.id&&ae.actions.setLastAssistantMessageId(ze.id);return}const Re=ye.findIndex(ze=>ze.id===ae.state.chatState.lastAssistantMessageId);if(Re!==-1){const ze=ye.slice(Re+1).filter(Oe=>Oe.sender_type==="assistant"&&!Oe.is_welcome_message);if(ze.length>0){const Oe=ae.state.chatState.unreadMessageCount||0;ae.state.chatState.unreadMessageCount=Oe+ze.length;const we=ze[ze.length-1];we!=null&&we.id&&(ae.state.chatState.lastAssistantMessageId=we.id),ae.actions.saveChatState();const{isOpen:ke}=Ci();ke.value||ae.actions.updateLastUnreadMessage(ye)}}},X=se=>{if(!se.length)return[];const ye=se.reduce((ze,Oe)=>{const we=ze.find(ke=>ke.type===Oe.type);return we?(we.files.push(Oe),we.ids.push(Oe.file_id)):ze.push({type:Oe.type,message_id:hs(),files:[Oe],ids:[Oe.file_id]}),ze},[]),Re=["image","video","audio","file"];return[...ye.filter(ze=>Re.includes(ze.type)).sort((ze,Oe)=>Re.indexOf(ze.type)-Re.indexOf(Oe.type)),...ye.filter(ze=>!Re.includes(ze.type))]},Y=()=>new Promise((se,ye)=>{const Re=Km();if(!Re){ye(new Error("Echo not initialized"));return}const ze=Re.connector.pusher.connection;if(ze.state==="connected"){se();return}const Oe=setTimeout(()=>{ze.unbind("connected",we),ye(new Error("Connection timeout"))},1e4),we=()=>{clearTimeout(Oe),se()};ze.bind("connected",we)}),he=async()=>{if(!(g.value||d.value&&s.value)){await je(ae.state.handle);try{g.value=!0,h.value=null;const se=Gm();if(!se)throw new Error("Failed to initialize Echo");const ye=re();if(!ye){g.value=!1;return}const Re=`chat.${ye}`;s.value=se.channel(Re),A(),K(),await Y()}catch(se){throw h.value=se.message,se}finally{g.value=!1}}},ce=async se=>{var ye,Re,ze;if(!p.value)try{p.value=!0,h.value=null,a.value||(a.value=e(no)??{}),c.value||(c.value=e(Jt,se)),u.value||(u.value=e(no,se),u.value&&((ye=ae.actions)==null||ye.setGroupConversationId(u.value)));const{data:Oe}=await Xe.liveChat.initConnection({handle:se,conversation_id:c.value,group_conversation_id:u.value});if(Oe!=null&&Oe.group_conversation_id?(u.value=Oe.group_conversation_id,a.value||(a.value={}),a.value[ae.state.handle]=u.value,t(no,a.value),(Re=ae.actions)==null||Re.setGroupConversationId(u.value)):Oe!=null&&Oe.conversation_id&&u.value,Oe!=null&&Oe.conversation_id&&(c.value=Oe.conversation_id,i.value||(i.value={}),i.value[ae.state.handle]=c.value,t(Jt,i.value)),((ze=Oe.messages)==null?void 0:ze.length)>0)if(o.value=vs(Oe.messages),ae.state.chatState.assistantProcessing){if(!ae.state.chatState.isOpen){const we=[...Oe.messages].reverse().find(ke=>ke.sender_type==="assistant");we&&(ae.actions.incrementUnreadMessageCount(),ae.actions.setLastAssistantMessageId(we.id),ae.actions.updateLastUnreadMessage(Oe.messages))}ae.state.chatState.assistantProcessing=!1,ae.actions.saveChatState()}else J(Oe.messages);else U();Oe.conversation&&(r.value=Oe.conversation,await he())}catch(Oe){throw h.value=Oe.message,Oe}finally{p.value=!1}},ue=async()=>{let se=0;for(;p.value&&se<50;)await ts(100),se+=1},Te=se=>{var ye;if(se){if(!u.value){const Re=ae.state.groupConversationId||e(no,se);Re&&(u.value=Re,(ye=ae.actions)==null||ye.setGroupConversationId(Re))}if(!c.value){const Re=e(Jt,se);Re&&(c.value=Re)}}},je=async se=>{if(!se)throw new Error("Missing bot handle");if(Te(se),!(u.value||c.value)&&(await ue(),Te(se),!(u.value||c.value)&&(await ce(se),Te(se),!u.value&&!c.value)))throw new Error("Missing conversation id")},re=()=>u.value||c.value||null,fe=async(se={})=>{var ke,Ye;const{message:ye,files:Re=[],content_type:ze,replyTarget:Oe}=se,we=ye?ye.trim():"";if(!(!we&&Re.length===0)&&!(!M.value&&f.value))try{(r.value&&((ke=r.value)==null?void 0:ke.response_mode)==="auto"||!r.value)&&(f.value=!0,ae.state.chatState.assistantProcessing=!0,ae.actions.saveChatState()),o.value.forEach(zt=>{zt.sender_type==="user"&&delete zt.is_last_message});const lt={message:we,message_id:hs()},At=X(Re);if(At.forEach(zt=>{o.value.push({content:zt.files,content_type:zt.type,sender_type:"user",message_id:zt.message_id,is_last_message:!we})}),we){const zt={content:lt.message,message_id:lt.message_id,content_type:ze||"text",sender_type:"user",status:"sending",timestamp:new Date().toISOString(),is_last_message:!0};Oe&&(zt.reply_to_message_id=Oe.id,zt.quoted_message={id:Oe.id,content:Oe.content,content_type:Oe.content_type,sender_type:Oe.sender_type,sender_name:Oe.sender_name}),o.value.push(zt)}const An=((Ye=o.value.filter(zt=>zt.sender_type==="user"))==null?void 0:Ye.length)||1;if(Xt.messageSend({content:lt.message,message_user_order:An,conversation_id:c.value}),_.value="unread",(async()=>(await ts(1e3),_.value==="unread"&&(_.value="sent",await ts(1500),_.value==="sent"&&(_.value="received",await ts(2e3),_.value==="received"&&(_.value="read")))))(),await je(ae.state.handle),!re())throw f.value=!1,new Error("Missing conversation id");if((!r.value||!s.value)&&await he(),!s.value)throw f.value=!1,new Error("Channel not ready");const xn={conversation_id:c.value,group_conversation_id:u.value,content:lt,attachments:At,content_type:ze||"text",stream:I.value};Oe!=null&&Oe.id&&(xn.reply_to_message_id=Oe.id),s.value.whisper(zu.MESSAGE_SEND,T(xn))}catch(lt){throw f.value=!1,_.value="unread",lt}},Ce=()=>{s.value&&(re()&&`${re()}`,s.value.whisper(zu.USER_LEFT,T()),R(),s.value.unsubscribe()),s.value=null,d.value=!1},$e=async()=>{var se;Ce(),(se=ae==null?void 0:ae.state)!=null&&se.handle&&(await je(ae.state.handle),await he())},Le=async()=>{var Re;if(f.value)return;const se=o.value.filter(ze=>!ze.is_welcome_message).length>0,ye=c.value!==null||u.value!==null;!se||!ye||(Ce(),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(Jt,JSON.stringify(i.value)),localStorage.setItem(no,JSON.stringify(a.value)),ae.actions.resetChatState(),(Re=ae==null?void 0:ae.state)!=null&&Re.handle&&await ce(ae.state.handle),Xt.conversationReset())},Be=(se,ye)=>{if(typeof se=="string"&&typeof ye=="string")return se.trim()===ye.trim();try{return JSON.stringify(se)===JSON.stringify(ye)}catch{return!1}},Ue=(se,ye)=>{if(typeof se!="string"||!new Set(["product_cards","cards","address","iframe","follow_up","image","video","file","gif","sticker","business_card","attachment"]).has(ye))return se;try{return JSON.parse(se)}catch{return se}},N=(se,ye)=>{const Re=se.content_type||"text";if(Re==="text"&&/widget\.easyaichat\.app\/embed\//.test(se.content))return null;let ze=Ue(se.content,Re);return new Set(["image","video","file","gif","sticker","business_card","attachment"]).has(Re)&&!Array.isArray(ze)&&(ze=[ze]),{id:ye,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:Re,...se.audio_url?{audio_url:se.audio_url}:{}}},ee=se=>{const ye=o.value.filter(Oe=>Oe.is_streaming===!0);if(!ye.length)return null;const Re=ye.find(Oe=>Oe.content_type===se.content_type&&Be(Oe.content,se.content));if(Re)return Re;const ze=ye.filter(Oe=>Oe.message_id===se.message_id);return ze.length===1?ze[0]:null},Q=se=>{const ye=ee(se);if(ye){Object.assign(ye,{...se,is_streaming:!1}),dt(se);return}if(se.content_type==="product_cards"){const ze=o.value.map((Oe,we)=>Oe.is_streaming&&Oe.content_type==="product_cards"?we:-1).filter(Oe=>Oe!==-1);if(ze.length>0){const[Oe,...we]=ze;Object.assign(o.value[Oe],{...se,is_streaming:!1}),we.sort((ke,Ye)=>Ye-ke).forEach(ke=>o.value.splice(ke,1)),dt(se);return}}o.value.some(ze=>ze.content_type===se.content_type&&Be(ze.content,se.content))||(o.value.push({...se,is_streaming:!1}),dt(se))},j=()=>{f.value=!1,ae.state.chatState.assistantProcessing=!1,ae.actions.saveChatState(),_.value="unread"},B=se=>o.value.findIndex(ye=>ye.message_id===se&&ye.status==="sending"),ie=se=>o.value.findIndex(ye=>ye.message_id===se&&ye.status==="received"),me=se=>{const ye=ie(se);return ye!==-1?ye:B(se)},de=(se,ye)=>{se!==-1&&(o.value[se]={...o.value[se],...ye})},ge=se=>o.value.find(ye=>se.message_id&&ye.message_id===se.message_id?ye.sender_type===se.sender_type&&ye.content_type===se.content_type:!1),pe=se=>{ge(se)||o.value.push(se)},Ae=se=>{const ye=ro(ae.state.handle);if(se!=null&&se.conversation_id&&se.conversation_id!==ye){O.value=!1;return}O.value=!0,f.value=!0,E.value=0},Ne=se=>{if(O.value)try{const ye=`delta-${E.value}`;E.value++;const Re=N(se,ye);if(!Re)return;o.value.push(Re),f.value=!1,_.value="unread",P()}catch{}},De=se=>{O.value&&(se.conversation&&(r.value=se.conversation),j(),E.value=0,O.value=!1)},Ie=se=>{O.value&&(E.value=0,j(),O.value=!1)},We=se=>{var ye;(ye=se.message)!=null&&ye.message_id&&Q(se.message),se.conversation&&(r.value=se.conversation,se.conversation.response_mode==="manual"&&j())},it=se=>{se.conversation&&(r.value=se.conversation)},at=se=>{const ye=ro(ae.state.handle);se.conversation_id&&se.conversation_id!==ye&&(c.value=se.conversation_id,i.value||(i.value={}),i.value[ae.state.handle]=se.conversation_id,t(Jt,i.value));let Re=B(se.message_id);Re!==-1&&de(Re,{status:"received"})},dt=se=>{if(!(se!=null&&se.id)||se.sender_type!=="assistant")return;ae.actions.setLastAssistantMessageId(se.id);const{isOpen:ye}=Ci();ye.value||(ae.actions.incrementUnreadMessageCount(),ae.actions.updateLastUnreadMessage(o.value))},Tt=se=>{if(se.message){const ye=me(se.message.message_id);ye!==-1?de(ye,{...se.message,status:"processed"}):ge(se.message)||pe(se.message),dt(se.message),se.message.sender_type==="assistant"&&(!I.value||!O.value)&&(j(),P())}se.conversation&&(r.value=se.conversation)},Lt=se=>{se.toggle_typing!==void 0&&(C.value=se.sender,k.value=se.toggle_typing,P())},un=se=>{var ye;if(s.value){const Re=(ye=r.value)==null?void 0:ye.response_mode;s.value.whisper(zu.USER_STATUS,T({is_processing:Re==="manual"?!1:f.value,response_mode:Re}))}};Pe(n,async se=>{var ye;se&&((ye=o.value)==null?void 0:ye.length)>0&&ae.actions.updateLastAssistantMessageIdFromMessages(o.value)});const qt={conversation:r,messages:o,conversationId:c,groupConversationId:u,isConnected:d,isProcessing:f,connectionError:h,newMessageStatus:_,messagesContainerRef:w,agentTyping:k,currentAgent:C,fetchInit:ce,connect:he,sendMessage:fe,disconnect:Ce,reconnect:$e,refreshConversation:Le};return Bu=qt,qt}const ys={TYPING:".agent.typing",BUBBLE:".agent.bubble",EXTRAS:".agent.extras",REACTION:".agent.react",LIVECHAT_MESSAGE_PROCESSED:".pull.message.processed"},x2=2,w2=1200,k2={love:"❤️",like:"👍",haha:"🤣",wow:"😮",cry:"😭",dislike:"👎"},S2=e=>{if(!e||typeof e!="object")return null;const t=Object.keys(e)[0];return t?k2[t]??null:null},Uu=["image","gif","video","audio","file"],C2=e=>Uu.includes(e==null?void 0:e.type)?e.type:"file",$2=e=>{const t=hs();return{id:t,message_id:t,content:[e],content_type:C2(e),sender_type:"user",status:"sending",created_at:new Date().toISOString()}},T2=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:Uu.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}]}:Uu.includes(e.content_type)&&!Array.isArray(e.content)?{...e,content_type:"text"}:e};let Vu=null;function A2(){if(Vu)return Vu;const{getStorage:e,saveStorage:t}=Ks(),n=L(null),s=L(null),r=L([]),o=L(!1),i=L(!1),a=L(null);let c=null,u=0;const d=()=>new Date().toISOString(),f=re=>typeof re=="string"?re:JSON.stringify(re),h=()=>{r.value=vs(r.value.slice())},g=re=>{if(re.message_id!=null)return r.value.some(Ce=>Ce.message_id!=null&&String(Ce.message_id)===String(re.message_id)&&Ce.sender_type===re.sender_type||Ce.id!=null&&String(Ce.id)===String(re.message_id));const fe=f(re.content);return r.value.some(Ce=>Ce.message_id==null&&Ce.content_type===re.content_type&&Ce.sender_type===re.sender_type&&f(Ce.content)===fe)},p=()=>{u<=0&&!o.value&&(i.value=!1)},v=re=>{if(!n.value)return;const fe=e(Jt)??{};fe[n.value]=re,t(Jt,fe)},_=()=>{s.value||(s.value=hs(),v(s.value),Y())},w=re=>{!re||re===s.value||(s.value=re,v(re),Y())},k=()=>{if(!n.value)return;const re=e(Jt)??{};delete re[n.value],t(Jt,re)},C=()=>{var $e,Le,Be,Ue,N;r.value=[];const re=((Be=(Le=($e=V.bot)==null?void 0:$e.config)==null?void 0:Le.initialMessage)==null?void 0:Be.messages)??[],fe=Object.values(re).map(ee=>ee.content);_i(fe).forEach(ee=>{r.value.push({content:ee,content_type:"text",sender_type:"assistant",is_welcome_message:!0})});const Ce=(N=(Ue=V.bot)==null?void 0:Ue.config)==null?void 0:N.introductionMessage;Ce&&typeof Ce=="string"&&r.value.push({content:Ce,content_type:"text",sender_type:"assistant",is_welcome_message:!0,is_introduction_message:!0}),h()},E=()=>{he(),s.value=null,k(),C()},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(fe=>{const Ce=T2(fe);if(Ce.sender_type==="user"&&Ce.reactions){const $e=S2(Ce.reactions);$e&&(Ce.bot_reaction=$e)}return Ce}),h())}catch{k(),s.value=null,he(),C()}},I=re=>{if(!(re!=null&&re.message_id))return null;const fe=r.value.find(Ce=>Ce.id!=null&&String(Ce.id)===String(re.message_id)||Ce.message_id!=null&&String(Ce.message_id)===String(re.message_id));return fe?{id:fe.id,content:fe.content,content_type:fe.content_type,sender_type:fe.sender_type,sender_name:fe.sender_name||null}:{id:re.message_id,content:re.preview||"",content_type:"text",sender_type:"user"}},M=({content:re,message_id:fe,quote:Ce})=>{const $e={id:fe??hs(),message_id:fe??null,conversation_id:s.value,content:re,content_type:"text",sender_type:"assistant",status:"processed",created_at:d(),quoted_message:I(Ce)};g($e)||(r.value.push($e),h())},P=re=>{if(!re||typeof re!="object")return null;if(re.type==="sources"){const fe=Array.isArray(re.sources)?re.sources:[];if(fe.length===0)return null;const Ce=fe.map($e=>({title:$e.title,link:$e.url}));return{id:hs(),content_type:"citations",content:JSON.stringify({elements:Ce}),sender_type:"assistant",status:"processed",created_at:d()}}if(re.type==="iframe"){const fe=re.iframe??{};return fe.src?{id:hs(),content_type:"iframe",content:JSON.stringify({iframe:{src:fe.src,width:fe.width??"100%",height:fe.height??"600px"}}),sender_type:"assistant",status:"processed",created_at:d()}:null}return null},q=re=>{const fe=P(re);!fe||g(fe)||(r.value.push(fe),h())},H=re=>{Array.isArray(re)&&re.forEach(fe=>M({content:fe.content,message_id:fe.message_id,quote:fe.quote}))},T=re=>{Array.isArray(re)&&re.forEach(fe=>q(fe))},A=re=>!(re!=null&&re.conversation_id)||re.conversation_id===s.value,R=re=>{A(re)&&(o.value=(re==null?void 0:re.typing)===!0,o.value?i.value=!0:p())},K=re=>{A(re)&&M({content:re.content,message_id:re.message_id,quote:re.quote})},W=re=>{var Be;const fe=re==null?void 0:re.message;if(!fe)return;const Ce=((Be=re==null?void 0:re.conversation)==null?void 0:Be.conversation_id)??(re==null?void 0:re.conversation_id);if(Ce&&Ce!==s.value)return;const $e=[fe.id,fe.message_id].filter(Ue=>Ue!=null).map(String);r.value.some(Ue=>[Ue.id,Ue.message_id].filter(N=>N!=null).map(String).some(N=>$e.includes(N)))||(r.value.push(fe),h())},U=re=>{A(re)&&T(re.extras)},J=re=>{if(!A(re))return;const fe=re==null?void 0:re.emoji;if(!fe)return;const $e=(re.message_id!=null?r.value.find(Le=>String(Le.id)===String(re.message_id)||String(Le.message_id)===String(re.message_id)):null)??[...r.value].reverse().find(Le=>Le.sender_type==="user");$e&&($e.bot_reaction=fe,h())},X=()=>{a.value&&(a.value.stopListening(ys.TYPING),a.value.stopListening(ys.BUBBLE),a.value.stopListening(ys.EXTRAS),a.value.stopListening(ys.REACTION),a.value.stopListening(ys.LIVECHAT_MESSAGE_PROCESSED),a.value.unsubscribe(),a.value=null,c=null)},Y=()=>{if(!s.value)return;const re=Gm();if(!re)return;const fe=`chat.${s.value}`;a.value&&c===fe||(a.value&&X(),a.value=re.channel(fe),c=fe,a.value.listen(ys.TYPING,R),a.value.listen(ys.BUBBLE,K),a.value.listen(ys.EXTRAS,U),a.value.listen(ys.REACTION,J),a.value.listen(ys.LIVECHAT_MESSAGE_PROCESSED,W))},he=()=>{X()},ce=async re=>{n.value=re??null;const fe=tm()??(n.value?e(Jt,n.value):null);if(!fe){C();return}s.value=fe,Y(),await O()},ue=async re=>{let fe=0;for(;;){const Ce=await Xe.chat.sendAgentMessage(re);if(Ce.status!=="busy"||fe>=x2)return Ce;fe+=1,await ts(w2*fe)}},je={onInit:ce,send:async({message:re,files:fe,replyTarget:Ce}={})=>{const $e=typeof re=="string"?re.trim():"",Le=(Ce==null?void 0:Ce.id)!=null&&/^\d+$/.test(String(Ce.id))?Number(Ce.id):null,Be=Array.isArray(fe)?fe.filter(B=>B==null?void 0:B.file_id):[],Ue=Be.map(B=>B.file_id);if(!$e&&Ue.length===0)return;i.value=!0,r.value.forEach(B=>{B.sender_type==="user"&&delete B.is_last_message});const N=Be.map($2);N.forEach(B=>r.value.push(B));let ee=null;if($e){const B=hs();ee={id:B,message_id:B,content:$e,content_type:"text",sender_type:"user",status:"sending",created_at:d()},r.value.push(ee)}const Q=ee??N[N.length-1];Q&&(Q.is_last_message=!0),Le&&Q&&(Q.reply_to_message_id=Le,Q.quoted_message={id:Ce.id,content:Ce.content,content_type:Ce.content_type,sender_type:Ce.sender_type,sender_name:Ce.sender_name||null}),h(),_();const j=B=>{N.forEach(ie=>ie.status=B),ee&&(ee.status=B)};u+=1;try{const B=await ue({handle:n.value,query:$e||void 0,conversation_id:s.value,reply_to_message_id:Le??void 0,attachments:Ue.length>0?Ue:void 0});if(B.status==="busy"){j("failed");return}B.conversation_id&&w(B.conversation_id),j("sent"),B.status==="ok"&&(H(B.bubbles),T(B.extras),(B.extras??[]).forEach(ie=>{(ie==null?void 0:ie.type)==="react"&&J({...ie,conversation_id:s.value})}))}catch{j("failed")}finally{u-=1,p()}},refreshConversation:E,messages:r,conversationId:s,agentTyping:o,isProcessing:i,connect:Y,disconnect:he};return Vu=je,je}const E2=ht({widgets:{},selectedWidgetEmbed:null,widgetSettingType:null});function Zs(){const{widgetSettingType:e,widgets:t,selectedWidgetEmbed:n}=It(E2),{bot:s}=It(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[C,E]=k.split("=");return C&&E&&(w[C]=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=ao(p);return v.name=uo(v.name,f),v.formHeaderTitle=uo(v.formHeaderTitle,f),v.description=uo(v.description,f),v.successTitle=uo(v.successTitle,f),v.successDescription=uo(v.successDescription,f),v.buttonText=uo(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===Ln?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=V.bot.widgets)!=null&&f.length))return;const g=ao(V.bot.widgets),p=g.findIndex(C=>C.id===d.id);if(p===-1)return;g[p]=d;const v=(h=V.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 I2={SCROLL_BOTTOM_DELAY:100},P2=ht({pendingMessage:null,currentMessage:""});function Er(e={}){const{pendingMessage:t,currentMessage:n}=It(P2),{widgets:s}=Zs(),r=ae.getters.isAgentEnabled,o=te(()=>r.value?"agent":"livechat"),i=_2(),a=Nm(),c=A2(),u=L(!1),d=L(null),f=L(null);Pe(()=>i.currentAgent.value,async w=>{var C,E,O,I;const k=(I=(O=(E=(C=ae==null?void 0:ae.state)==null?void 0:C.bot)==null?void 0:E.config)==null?void 0:O.ui)==null?void 0:I.logo;if(!w||!w.avatar){f.value=k;return}try{(await $r(w.avatar)).status?f.value=w.avatar:f.value=k}catch{f.value=k}},{immediate:!0}),Pe(d,w=>{w&&(a.messagesContainerRef.value=w,i.messagesContainerRef.value=w)},{deep:!0}),Je(async()=>{var k,C;const w=(C=(k=ae==null?void 0:ae.state)==null?void 0:k.bot)==null?void 0:C.handle;w&&(r.value?await c.onInit(w):await i.fetchInit(w))});const h=async()=>{await ts(1200);const w=ae.state.chatState.visitor,k=s.value.widget_form_render_pre_send,C=parseInt(k==null?void 0:k.maximumMessageCount)||1,O=i.messages.value.filter(I=>I.sender_type==="user").length;k&&!w&&O>=C&&(ae.state.isOpenLeadForm=!0)},g=async w=>{h(),ae.actions.updateChatState({viewTab:"conversations"});const k=r.value?c.send(w):i.sendMessage(w);return _(),await k},p=async()=>{},v=async()=>r.value?c.refreshConversation():await i.refreshConversation();async function _(w={}){var C;if(!d.value)return;await wt(),await ts(w.delay||I2.SCROLL_BOTTOM_DELAY);const k=((C=d.value)==null?void 0:C.scrollHeight)||0;d.value.scrollTo({top:w.top||k,behavior:w.behavior||"smooth"})}return{isAgentEnabled:r,chatService:o,pendingMessage:t,currentMessage:n,messages:r.value?c.messages:i.messages,conversationId:r.value?c.conversationId:i.conversationId,conversation:i.conversation,assistantProcessing:r.value?u:i.isProcessing,newMessageStatus:i.newMessageStatus,storageConversations:a.storageConversations,send:g,fetchMessages:p,refreshConversation:v,initializeMessages:a.initializeMessages,clickQuickPrompt:a.clickQuickPrompt,messagesContainerRef:d,scrollToBottom:_,isConnected:i.isConnected,connectionError:i.connectionError,agentTyping:r.value?c.agentTyping:i.agentTyping,currentAgent:i.currentAgent,validatedAgentAvatar:f}}/**
|
||
* @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 M2=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 Fe=(e,t)=>({size:n,strokeWidth:s=2,absoluteStrokeWidth:r,color:o,class:i,...a},{attrs:c,slots:u})=>fr("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-${M2(e)}`],...a},[...t.map(d=>fr(...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 Qm=Fe("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 Hu=Fe("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 O2=Fe("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 L2=Fe("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 Jm=Fe("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=Fe("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 po=Fe("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 mo=Fe("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 Ir=Fe("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 Xm=Fe("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 Zm=Fe("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 R2=Fe("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=Fe("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 Ym=Fe("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 D2=Fe("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 j2=Fe("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 Wu=Fe("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 N2=Fe("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 eg=Fe("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 F2=Fe("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 q2=Fe("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 Ys=Fe("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 z2=Fe("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 B2=Fe("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 U2=Fe("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 V2=Fe("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 tg=Fe("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 H2=Fe("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 W2=Fe("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 G2=Fe("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 K2=Fe("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 Q2=Fe("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 J2=Fe("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 X2=Fe("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 Z2=Fe("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 Y2=Fe("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 ek=Fe("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 ng=Fe("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 tk=Fe("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 sg=Fe("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=Fe("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 rg=Fe("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 Gu=Fe("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 Ku=Fe("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 nk=Fe("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 sk=Fe("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 rk=Fe("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=Fe("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 og=Fe("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 ig=Fe("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 ag=Fe("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 ok=Fe("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 ik=Fe("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=Fe("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 lg=Fe("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 Qu=Fe("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 cn=Fe("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 ak=Fe("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=Fe("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 cg=Fe("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 ug=Fe("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 lk=Fe("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 ck=Fe("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 dg=Fe("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 fg=Fe("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=Fe("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},uk=e=>(gn("data-v-76058769"),e=e(),vn(),e),dk={class:"relative reaction-container"},fk={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"},hk={class:"text-xs font-medium leading-[100%] tracking-tight text-gray-700"},pk={key:0,class:"leading-[100%]"},mk={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`}},gk=["onClick"],vk={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"},yk=uk(()=>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)),bk={key:0,class:"absolute top-0 left-0 w-full h-full pointer-events-none z-50 overflow-visible"},_k=350,xk=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=L(!1),i=L([]),a=L(!1),c=L(s.messageReactions),u=L(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 K=Math.random()*Math.PI*2,W=30+Math.random()*60,U=Math.cos(K)*W,J=Math.sin(K)*W,X=.4+Math.random()*.3,Y=Math.random()*.15,he=12+Math.random()*8,ce=.6+Math.random()*.4;return{"--x":`${U}px`,"--y":`${J}px`,"--duration":`${X}s`,"--delay":`${Y}s`,"--size":`${he}px`,"--opacity":ce}};let g;const p=()=>{a.value=!1,setTimeout(()=>{a.value=!0,g&&clearTimeout(g),g=setTimeout(()=>{a.value=!1},800)},10)},v=te(()=>Object.keys(c.value||{}).slice(0,3).map(W=>({ui:d[W],id:W}))),_=te(()=>Object.values(c.value||{}).reduce((K,W)=>K+W,0)),w=K=>{u.value=K,i.value=[K],o.value=!1,T(),p(),Xt.interaction({type:"reaction",conversationId:s.conversationId,...K})},k=()=>{if(u.value){T(),p(),Xt.interaction({type:"reaction",conversationId:s.conversationId,...u.value});return}const K=f.find(W=>W.id==="love");if(K){u.value=K,i.value=[K],c.value||(c.value={});const W={...c.value};W[K.id]&&delete W[K.id],c.value={[K.id]:(c.value[K.id]||0)+1,...W},T(),p()}},C=()=>{u.value=null,i.value=[],o.value=!1,A()};Dt(()=>{g&&clearTimeout(g)});const E=()=>{document.dispatchEvent(new CustomEvent("close-all-emoji-pickers",{detail:{except:s.messageId}})),o.value=!0},O=K=>{const W=document.querySelector(".emoji-picker");W&&!W.contains(K.target)&&(o.value=!1)};let I,M;Je(()=>{if(document.addEventListener("click",O,{passive:!0}),s.chatViewRef&&(I=K=>{if(!As()||!o.value)return;const W=s.chatViewRef.querySelector(".emoji-picker.show-emoji");if(!W)return;const U=K.target.closest(".reaction-container"),J=W.closest(".reaction-container");J&&U!==J&&(o.value=!1)},s.chatViewRef.addEventListener("touchstart",I,{passive:!0}),M=K=>{var U;((U=K.detail)==null?void 0:U.except)!==s.messageId&&(o.value=!1)},s.chatViewRef.addEventListener("close-all-emoji-pickers",M)),c.value&&Object.keys(c.value).length>0){const K=Object.keys(c.value)[0],W=f.find(U=>U.id===K);W&&(u.value=W,i.value=[W])}}),Dt(()=>{document.removeEventListener("click",O),s.chatViewRef&&(I&&s.chatViewRef.removeEventListener("touchstart",I),M&&s.chatViewRef.removeEventListener("close-all-emoji-pickers",M)),g&&clearTimeout(g)});let P;const q=()=>{As()&&(P=setTimeout(()=>{E()},_k))},H=()=>{As()&&P&&clearTimeout(P)},T=async()=>{try{if(!R.value){console.error("Missing required props: messageId or conversationId");return}if(!u.value)return;const{data:K}=await Xe.reaction.update({conversationId:s.conversationId,messageId:s.messageId,form:{reaction:u.value.id}});if(K.success){const W=K.data.reactions;if(r("update:messageReactions",K.data.reactions),u.value&&W[u.value.id]){const U=u.value.id,J={[U]:W[U]};Object.keys(W).forEach(X=>{X!==U&&(J[X]=W[X])}),c.value=J}else c.value=W}}catch(K){console.error("Error saving reaction to message:",K)}},A=async()=>{try{if(!R.value){console.error("Missing required props: messageId or conversationId");return}const{data:K}=await Xe.reaction.removeAll({conversationId:s.conversationId,messageId:s.messageId});K.success&&(c.value={},u.value=null,i.value=[],r("update:messageReactions",{}))}catch(K){console.error("Error removing reactions from message:",K)}};t({selectedReactions:i,showEmojis:o,openEmojis:E});const R=te(()=>!!s.messageId&&!!s.conversationId);return(K,W)=>{var U;return m(),x("div",dk,[l("div",{class:"flex items-center group-reactions",onTouchstartPassive:W[0]||(W[0]=J=>q()),onTouchend:W[1]||(W[1]=J=>H())},[_.value>1?(m(),x("div",fk,[(m(!0),x(be,null,Me(v.value,J=>(m(),x("div",{key:J.id,class:"text-center"},[l("div",{class:ne(["content-center",["love","dislike","like"].includes(J.id)?"text-sm sm:text-xs translate-y-[1px]":"text-sm"])},D(J.ui),3)]))),128)),l("div",hk,D(_.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((U=u.value)==null?void 0:U.id)?"text-sm sm:text-xs":"text-sm"]])},[u.value?(m(),x("div",pk,D(u.value.emoji),1)):(m(),oe(y(H2),{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",mk,[(m(),x(be,null,Me(f,(J,X)=>l("button",{key:J.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:mt({"--delay":`${X*.03}s`}),onClick:Y=>w(J)},[l("span",{class:ne(["leading-[100%]",["love","dislike","like"].includes(J.id)?"text-base sm:text-sm translate-y-[1px]":"text-lg sm:text-base"])},D(J.emoji),3),l("div",vk,D(J.label),1)],12,gk)),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:C},[G(y(Es),{size:"16","stroke-width":"2"}),yk])):z("",!0)])],2),a.value?(m(),x("div",bk,[(m(),x(be,null,Me(15,J=>{var X;return l("div",{key:J,class:"firework-particle absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 will-change-[transform,opacity]",style:mt(h())},D(((X=u.value)==null?void 0:X.emoji)||"✨"),5)}),64))])):z("",!0)])}}},[["__scopeId","data-v-76058769"]]);function tn(){const e=te(()=>Xs.state.locale);function t(n,s){return e.value,Xs.actions.t(n,s)}return{t,locale:e}}const wk={},kk={viewBox:"0 0 16 16",width:"12",height:"12",fill:"currentColor","aria-hidden":"true"},Sk=[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 Ck(e,t){return m(),x("svg",kk,Sk)}const hg=Qe(wk,[["render",Ck]]),$k={class:"text-xs truncate m-0 mb-0.5 text-gray-600 font-light"},Tk={class:"font-medium inline-block max-w-[200px] truncate align-bottom"},Ak={class:"font-medium inline-block max-w-[200px] truncate align-bottom"},Ek={key:0,class:"text-xs italic opacity-60 m-0"},Ik={key:1,class:"flex items-center gap-2 min-w-0"},Pk={class:"flex-shrink-0 size-9 rounded-lg overflow-hidden bg-gray-200 flex items-center justify-center"},Mk=["src"],Ok={class:"min-w-0 flex flex-col gap-0.5"},Lk={class:"text-xs m-0 font-medium text-gray-700 truncate"},Rk={class:"text-xs m-0 text-gray-500 truncate"},Dk={key:0},jk={key:2,class:"text-xs line-clamp-1 m-0 whitespace-pre-wrap break-words text-gray-500"},Nk=1500,Fk={__name:"ChatBubbleQuote",props:{quotedMessage:{type:Object,required:!0},isUser:{type:Boolean,default:!1}},setup(e){const{t}=tn(),{bot:n}=It(ae.state),s=e,r=L(null),o=te(()=>{var I,M,P;return((P=(M=(I=n.value)==null?void 0:I.config)==null?void 0:M.ui)==null?void 0:P.name)||""}),i=te(()=>{var I;return!!((I=s.quotedMessage)!=null&&I.unavailable)}),a=te(()=>{var I;return!i.value&&!!((I=s.quotedMessage)!=null&&I.id)}),c=(I,M)=>{var q,H;let P=I==null?void 0:I.parentElement;for(;P&&P!==M&&P!==document.body;){const A=getComputedStyle(P).overflowY;if((A==="auto"||A==="scroll"||A==="overlay")&&P.scrollHeight>P.clientHeight)return P;P=P.parentElement}return((q=M==null?void 0:M.querySelector)==null?void 0:q.call(M,".messages-wrapper"))||((H=I==null?void 0:I.closest)==null?void 0:H.call(I,".messages-wrapper"))||null},u=()=>{var H,T,A,R;if(!a.value)return;const I=((T=(H=r.value)==null?void 0:H.getRootNode)==null?void 0:T.call(H))||document,M=s.quotedMessage.id,P=((A=I.getElementById)==null?void 0:A.call(I,`message-${M}`))||((R=I.querySelector)==null?void 0:R.call(I,`[id="message-${M}"]`));if(!P)return;const q=c(P,I);if(q){const K=q.getBoundingClientRect(),W=P.getBoundingClientRect(),U=W.top-K.top-q.clientHeight/2+W.height/2;q.scrollTo({top:Math.max(0,q.scrollTop+U),behavior:"smooth"})}else P.scrollIntoView({behavior:"smooth",block:"center"});P.classList.add("quote-target-focus"),setTimeout(()=>{P.classList.remove("quote-target-focus")},Nk)},d=te(()=>{var I;return s.quotedMessage&&(((I=s.quotedMessage.sender)==null?void 0:I.name)||s.quotedMessage.sender_name)||""}),f=te(()=>{var M;const I=(M=s.quotedMessage)==null?void 0:M.sender_type;return I?s.isUser?I==="user":I!=="user":!1}),h=["image","gif","video","audio","file","sticker","attachment"],g=I=>{const M=document.createElement("div");return M.innerHTML=I,(M.textContent||M.innerText||"").replace(/\s+/g," ").trim()},p=te(()=>{var I;return((I=s.quotedMessage)==null?void 0:I.content_type)||""}),v=te(()=>h.includes(p.value)),_=te(()=>{var M;const I=(M=s.quotedMessage)==null?void 0:M.content;if(Array.isArray(I))return I;if(typeof I=="string")try{const P=JSON.parse(I);return Array.isArray(P)?P:[]}catch{return[]}return[]}),w=te(()=>{var I;return["image","gif","sticker"].includes(p.value)&&((I=_.value[0])==null?void 0:I.url)||null}),k=te(()=>({file:Ys,attachment:Ku,video:fg,audio:rg})[p.value]||Ys),C=te(()=>{const I=p.value;return t(`chat.quote_media.${I==="attachment"?"file":I}`)}),E=te(()=>{const I=_.value[0];return!I||typeof I!="object"?"":I.filename||I.name||I.title||""}),O=te(()=>{if(!s.quotedMessage)return"";const I=s.quotedMessage.content;return typeof I=="string"?g(I):""});return(I,M)=>(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(hg,{class:"text-gray-500"}),l("p",$k,[e.isUser?(m(),x(be,{key:0},[f.value?(m(),x(be,{key:0},[Ge(D(y(t)("chat.reply_context.you_replied_to_yourself")),1)],64)):(m(),x(be,{key:1},[Ge(D(y(t)("chat.reply_context.you_replied_to"))+" ",1),l("span",Tk,D(d.value||o.value),1)],64))],64)):(m(),x(be,{key:1},[l("span",Ak,D(d.value||o.value),1),Ge(" "+D(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",Ek,D(y(t)("chat.original_message_unavailable")),1)):v.value?(m(),x("div",Ik,[l("div",Pk,[w.value?(m(),x("img",{key:0,src:w.value,alt:"",class:"size-full object-cover"},null,8,Mk)):(m(),oe(Ft(k.value),{key:1,class:"size-4 text-gray-500"}))]),l("div",Ok,[l("p",Lk,D(d.value||o.value),1),l("p",Rk,[l("span",null,"["+D(C.value)+"] ",1),E.value?(m(),x("span",Dk,D(E.value),1)):z("",!0)])])])):(m(),x("p",jk,D(O.value),1))],2))}},Ju="(?:\\p{Extended_Pictographic}(?:\\uFE0F|\\uFE0E)?(?:\\u200D\\p{Extended_Pictographic}(?:\\uFE0F|\\uFE0E)?)*)|(?:\\p{Regional_Indicator}{2})";function qk(e){return typeof e!="string"?"":e.replace(/<[^>]*>/g,"").replace(/ /gi," ").replace(/\s+/g," ").trim()}function zk(e,t={}){const n=t.maxEmoji??6,s=qk(e);if(!s||!new RegExp(Ju,"u").test(s))return!1;const o=s.match(new RegExp(Ju,"gu"))??[];return o.length===0||o.length>n?!1:s.replace(new RegExp(Ju,"gu"),"").replace(/[\uFE0F\uFE0E\u200D\p{Emoji_Modifier}]/gu,"").replace(/\s+/g,"")===""}const Bk=["id"],Uk=["innerHTML"],Vk=["aria-label","title"],Hk={key:0,class:"text-xs text-gray-500 absolute right-1 -bottom-1 translate-y-full message-user-status"},Wk={key:0},Gk={key:1},Kk={key:1,class:"absolute right-1.5 -bottom-3 z-10"},Qk={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",Jk=500,pg={__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}=tn(),s=e,r=te(()=>{const O=s.message;return!(!O||!/^\d+$/.test(String(O.id??""))||O.is_streaming||O.sender_type!=="assistant"&&O.sender_type!=="user")}),o=L(!1),i=L(null),a=new Map,c=O=>I=>{Xt.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=L(null),h=te(()=>{const O=s.message.content;return d(O)}),g=te(()=>{var O;return zk(((O=s.message)==null?void 0:O.content)??"")}),p=te(()=>s.message.content.includes("ecg-cart-success")),v=te(()=>s.message.content.includes("eai-order-summary"));Je(()=>{wt(()=>{var I;const O=(I=f.value)==null?void 0:I.querySelectorAll("a");O==null||O.forEach(M=>{const P=M.getAttribute("href"),q=P.includes(window.location.origin),H=P.includes("dienmayxanh"),T=q||H?"_self":"_blank";M.setAttribute("target",T);const A=c(P);a.set(M,A),M.addEventListener("click",A)})}),o.value=s.message.reactions&&Object.keys(s.message.reactions).length>0}),Xn(()=>{a.forEach((O,I)=>{I.removeEventListener("click",O)}),a.clear()});let _;const w=L(!1),k=()=>{As()&&(w.value=!0,_=setTimeout(()=>{i.value.openEmojis(),_=null,o.value=!0},Jk))},C=()=>{As()&&(w.value=!1,_&&(clearTimeout(_),_=null))},E=O=>{o.value=Object.keys(O).length>0};return(O,I)=>{var M;return m(),x("div",{id:e.anchorId&&((M=e.message)!=null&&M.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(Fk,{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]=P=>i.value?k():null),onTouchend:I[2]||(I[2]=P=>i.value?C():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,Uk),r.value?(m(),x("button",{key:0,type:"button",onClick:I[0]||(I[0]=P=>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(ok),{class:"size-3"})],10,Vk)):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(xk,{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",Hk,[e.newMessageStatus==="sent"?(m(),x("span",Wk,D(y(n)("common.sent")),1)):e.newMessageStatus==="received"?(m(),x("span",Gk,D(y(n)("common.received")),1)):z("",!0)])):z("",!0)],34)],2),e.isUser&&e.message.bot_reaction?(m(),x("div",Kk,[l("div",Qk,D(e.message.bot_reaction),1)])):z("",!0)],10,Bk)}}},Xk={class:"flex items-center gap-2 px-3 py-1.5 pb-2s bg-gray-50 rounded-t-2xl mb-1 overflow-hidden"},Zk={key:0,class:"flex-shrink-0 size-8 rounded-lg overflow-hidden bg-gray-200 flex items-center justify-center"},Yk=["src"],eS={class:"flex-1 min-w-0"},tS={class:"flex items-center gap-1 mb-0.5"},nS={class:"text-xs font-light text-gray-900 truncate m-0"},sS={class:"font-medium"},rS={key:0,class:"text-xs text-gray-500 truncate m-0"},oS={key:0},iS={key:1,class:"text-xs text-gray-500 truncate m-0"},aS=["aria-label"],lS={__name:"ReplyComposerPreview",props:{replyTarget:{type:Object,required:!0}},emits:["cancel"],setup(e){const{t}=tn(),{bot:n}=It(ae.state),s=e,r=te(()=>{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=te(()=>{var v;return((v=s.replyTarget)==null?void 0:v.content_type)||""}),c=te(()=>o.includes(a.value)),u=te(()=>{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=te(()=>{var v;return["image","gif","sticker"].includes(a.value)&&((v=u.value[0])==null?void 0:v.url)||null}),f=te(()=>({file:Ys,attachment:Ku,video:fg,audio:rg})[a.value]||Ys),h=te(()=>{const v=a.value;return t(`chat.quote_media.${v==="attachment"?"file":v}`)}),g=te(()=>{const v=u.value[0];return!v||typeof v!="object"?"":v.filename||v.name||v.title||""}),p=te(()=>{if(!s.replyTarget)return"";const v=s.replyTarget.content;return typeof v=="string"?i(v):""});return(v,_)=>(m(),x("div",Xk,[c.value?(m(),x("div",Zk,[d.value?(m(),x("img",{key:0,src:d.value,alt:"",class:"size-full object-cover"},null,8,Yk)):(m(),oe(Ft(f.value),{key:1,class:"size-4 text-gray-500"}))])):z("",!0),l("div",eS,[l("div",tS,[G(hg,{class:"text-gray-500"}),l("p",nS,[Ge(D(y(t)("chat.replying_to"))+" ",1),l("span",sS,D(e.replyTarget.sender_name||r.value),1)])]),c.value?(m(),x("p",rS,[l("span",null,"["+D(h.value)+"]",1),g.value?(m(),x("span",oS,D(g.value),1)):z("",!0)])):(m(),x("p",iS,D(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,aS)]))}};function cS(e){return Object.prototype.toString.call(e)==="[object Object]"}function mg(e){return cS(e)||Array.isArray(e)}function uS(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function Xu(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}`:!mg(a)||!mg(c)?a===c:Xu(a,c)})}function gg(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function dS(e,t){if(e.length!==t.length)return!1;const n=gg(e),s=gg(t);return n.every((r,o)=>{const i=s[o];return Xu(r,i)})}function Zu(e){return typeof e=="number"}function Yu(e){return typeof e=="string"}function vl(e){return typeof e=="boolean"}function vg(e){return Object.prototype.toString.call(e)==="[object Object]"}function jt(e){return Math.abs(e)}function ed(e){return Math.sign(e)}function $i(e,t){return jt(e-t)}function fS(e,t){if(e===0||t===0||jt(e)<=jt(t))return 0;const n=$i(jt(e),jt(t));return jt(n/e)}function hS(e){return Math.round(e*100)/100}function Ti(e){return Ei(e).map(Number)}function os(e){return e[Ai(e)]}function Ai(e){return Math.max(0,e.length-1)}function td(e,t){return t===Ai(e)}function yg(e,t=0){return Array.from(Array(e),(n,s)=>t+s)}function Ei(e){return Object.keys(e)}function bg(e,t){return[e,t].reduce((n,s)=>(Ei(s).forEach(r=>{const o=n[r],i=s[r],a=vg(o)&&vg(i);n[r]=a?bg(o,i):i}),n),{})}function nd(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function pS(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 Yu(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 mS(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 gS(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 Pr(e=0,t=0){const n=jt(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 _g(e,t,n){const{constrain:s}=Pr(0,e),r=e+1;let o=i(t);function i(h){return n?jt((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 _g(e,a(),n)}const f={get:a,set:c,add:u,clone:d};return f}function vS(e,t,n,s,r,o,i,a,c,u,d,f,h,g,p,v,_,w,k){const{cross:C,direction:E}=e,O=["INPUT","SELECT","TEXTAREA"],I={passive:!1},M=Ii(),P=Ii(),q=Pr(50,225).constrain(g.measure(20)),H={mouse:300,touch:400},T={mouse:500,touch:600},A=p?43:25;let R=!1,K=0,W=0,U=!1,J=!1,X=!1,Y=!1;function he(N){if(!k)return;function ee(j){(vl(k)||k(N,j))&&fe(j)}const Q=t;M.add(Q,"dragstart",j=>j.preventDefault(),I).add(Q,"touchmove",()=>{},I).add(Q,"touchend",()=>{}).add(Q,"touchstart",ee).add(Q,"mousedown",ee).add(Q,"touchcancel",$e).add(Q,"contextmenu",$e).add(Q,"click",Le,!0)}function ce(){M.clear(),P.clear()}function ue(){const N=Y?n:t;P.add(N,"touchmove",Ce,I).add(N,"touchend",$e).add(N,"mousemove",Ce,I).add(N,"mouseup",$e)}function Te(N){const ee=N.nodeName||"";return O.includes(ee)}function je(){return(p?T:H)[Y?"mouse":"touch"]}function re(N,ee){const Q=f.add(ed(N)*-1),j=d.byDistance(N,!p).distance;return p||jt(N)<q?j:_&&ee?j*.5:d.byIndex(Q.get(),0).distance}function fe(N){const ee=nd(N,s);Y=ee,X=p&&ee&&!N.buttons&&R,R=$i(r.get(),i.get())>=2,!(ee&&N.button!==0)&&(Te(N.target)||(U=!0,o.pointerDown(N),u.useFriction(0).useDuration(0),r.set(i),ue(),K=o.readPoint(N),W=o.readPoint(N,C),h.emit("pointerDown")))}function Ce(N){if(!nd(N,s)&&N.touches.length>=2)return $e(N);const Q=o.readPoint(N),j=o.readPoint(N,C),B=$i(Q,K),ie=$i(j,W);if(!J&&!Y&&(!N.cancelable||(J=B>ie,!J)))return $e(N);const me=o.pointerMove(N);B>v&&(X=!0),u.useFriction(.3).useDuration(.75),a.start(),r.add(E(me)),N.preventDefault()}function $e(N){const Q=d.byDistance(0,!1).index!==f.get(),j=o.pointerUp(N)*je(),B=re(E(j),Q),ie=fS(j,B),me=A-10*ie,de=w+ie/50;J=!1,U=!1,P.clear(),u.useDuration(me).useFriction(de),c.distance(B,!p),Y=!1,h.emit("pointerUp")}function Le(N){X&&(N.stopPropagation(),N.preventDefault(),X=!1)}function Be(){return U}return{init:he,destroy:ce,pointerDown:Be}}function yS(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(nd(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&&jt(v)>.1?v:0}return{pointerDown:a,pointerMove:c,pointerUp:u,readPoint:i}}function bS(){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 _S(e){function t(s){return e*(s/100)}return{measure:t}}function xS(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 C of k){if(f)return;const E=C.target===e,O=s.indexOf(C.target),I=E?u:d[O],M=h(E?e:s[O]);if(jt(M-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 wS(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(),M=!c;let P=0;return M?(i=0,n.set(s),e.set(s),P=I):(n.set(e),i+=I/c,i*=u,d+=i,e.add(i),P=d-f),a=ed(P),f=d,O}function g(){const I=s.get()-t.get();return jt(I)<.001}function p(){return c}function v(){return a}function _(){return i}function w(){return C(r)}function k(){return E(o)}function C(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:C};return O}function kS(e,t,n,s,r){const o=r.measure(10),i=r.measure(50),a=Pr(.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=jt(e[p]-t.get()),_=n.get()-t.get(),w=a.constrain(v/i);n.subtract(_*w),!g&&jt(_)<o&&(n.set(e.constrain(n.get())),s.useDuration(25).useBaseFriction())}function f(g){c=!g}return{shouldConstrain:u,constrain:d,toggleActive:f}}function SS(e,t,n,s,r){const o=Pr(-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=os(i),_=i.lastIndexOf(p),w=i.indexOf(v)+1;return Pr(_,w)}function f(){return n.map((p,v)=>{const{min:_,max:w}=o,k=o.constrain(p),C=!v,E=td(n,v);return C?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 CS(e,t,n){const s=t[0],r=n?s-e:os(t);return{limit:Pr(r,s)}}function $S(e,t,n,s){const o=t.min+.1,i=t.max+.1,{reachedMin:a,reachedMax:c}=Pr(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 TS(e){const{max:t,length:n}=e;function s(o){const i=o-t;return n?i/-n:0}return{get:s}}function AS(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=>os(v)[i]-v[0][o]).map(jt)}function h(){return s.map(v=>n[o]-v[o]).map(v=>-jt(v))}function g(){return a(u).map(v=>v[0]).map((v,_)=>v+c[_])}return{snaps:u,snapsAligned:d}}function ES(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=td(_,v);if(w){const C=os(_[0])+1;return yg(C)}if(k){const C=Ai(o)-os(_)[0]+1;return yg(C,os(_)[0])}return p})}return{slideRegistry:u}}function IS(e,t,n,s,r){const{reachedAny:o,removeOffset:i,constrain:a}=s;function c(p){return p.concat().sort((v,_)=>jt(v)-jt(_))[0]}function u(p){const v=e?i(p):a(p),_=t.map((k,C)=>({diff:d(k-v,0),index:C})).sort((k,C)=>jt(k.diff)-jt(C.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=>ed(k)===v);return w.length?c(w):os(_)-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(_),C=!e&&o(_);if(!v||C)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 PS(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 MS(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(C=>C.includes(v));Zu(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 Zu(c)?c:c.get()}return{get:n,set:s,add:r,subtract:o}}function xg(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=hS(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 OS(e,t,n,s,r,o,i,a,c){const d=Ti(r),f=Ti(r).reverse(),h=w().concat(k());function g(M,P){return M.reduce((q,H)=>q-r[H],P)}function p(M,P){return M.reduce((q,H)=>g(q,P)>0?q.concat([H]):q,[])}function v(M){return o.map((P,q)=>({start:P-s[q]+.5+M,end:P+t-.5+M}))}function _(M,P,q){const H=v(P);return M.map(T=>{const A=q?0:-n,R=q?n:0,K=q?"end":"start",W=H[T][K];return{index:T,loopPoint:W,slideLocation:Pi(-1),translate:xg(e,c[T]),target:()=>a.get()>W?A:R}})}function w(){const M=i[0],P=p(f,M);return _(P,n,!1)}function k(){const M=t-i[0]-1,P=p(d,M);return _(P,-n,!0)}function C(){return h.every(({index:M})=>{const P=d.filter(q=>q!==M);return g(P,t)<=.1})}function E(){h.forEach(M=>{const{target:P,translate:q,slideLocation:H}=M,T=P();T!==H.get()&&(q.to(T),H.set(T))})}function O(){h.forEach(M=>M.translate.clear())}return{canLoop:C,clear:O,loop:E,loopPoints:h}}function LS(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 RS(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 DS(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 jt(t[a]-k[a])}function v(){if(!u)return 0;const k=o.getComputedStyle(os(s));return parseFloat(k.getPropertyValue(`margin-${c}`))}function _(){return n.map((k,C,E)=>{const O=!C,I=td(E,C);return O?h[C]+d:I?h[C]+f:E[C+1][a]-k[a]}).map(jt)}return{slideSizes:h,slideSizesWithGaps:g,startGap:d,endGap:f}}function jS(e,t,n,s,r,o,i,a,c){const{startEdge:u,endEdge:d,direction:f}=e,h=Zu(n);function g(w,k){return Ti(w).filter(C=>C%k===0).map(C=>w.slice(C,C+k))}function p(w){return w.length?Ti(w).reduce((k,C,E)=>{const O=os(k)||0,I=O===0,M=C===Ai(w),P=r[u]-o[O][u],q=r[u]-o[C][d],H=!s&&I?f(i):0,T=!s&&M?f(a):0,A=jt(q-T-(P+H));return E&&A>t+c&&k.push(C),M&&k.push(w.length),k},[]).map((k,C,E)=>{const O=Math.max(E[C-1]||0);return w.slice(O,k)}):[]}function v(w){return h?g(w,n):p(w)}return{groupSlides:v}}function NS(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:C,watchSlides:E,watchDrag:O,watchFocus:I}=o,M=2,P=bS(),q=P.measure(t),H=n.map(P.measure),T=gS(c,u),A=T.measureSize(q),R=_S(A),K=pS(a,A),W=!f&&!!k,U=f||!!k,{slideSizes:J,slideSizesWithGaps:X,startGap:Y,endGap:he}=DS(T,q,H,n,U,r),ce=jS(T,A,_,f,q,H,Y,he,M),{snaps:ue,snapsAligned:Te}=AS(T,K,q,H,ce),je=-os(ue)+os(X),{snapsContained:re,scrollContainLimit:fe}=SS(A,je,Te,k,M),Ce=W?re:Te,{limit:$e}=CS(je,Ce,f),Le=_g(Ai(Ce),d,f),Be=Le.clone(),Ue=Ti(n),N=({dragHandler:Tt,scrollBody:Lt,scrollBounds:un,options:{loop:qt}})=>{qt||un.constrain(Tt.pointerDown()),Lt.seek()},ee=({scrollBody:Tt,translate:Lt,location:un,offsetLocation:qt,previousLocation:se,scrollLooper:ye,slideLooper:Re,dragHandler:ze,animation:Oe,eventHandler:we,scrollBounds:ke,options:{loop:Ye}},lt)=>{const At=Tt.settled(),An=!ke.shouldConstrain(),Kn=Ye?At:At&&An,xn=Kn&&!ze.pointerDown();xn&&Oe.stop();const zt=un.get()*lt+se.get()*(1-lt);qt.set(zt),Ye&&(ye.loop(Tt.direction()),Re.loop()),Lt.to(qt.get()),xn&&we.emit("settle"),Kn||we.emit("scroll")},Q=mS(s,r,()=>N(dt),Tt=>ee(dt,Tt)),j=.68,B=Ce[Le.get()],ie=Pi(B),me=Pi(B),de=Pi(B),ge=Pi(B),pe=wS(ie,de,me,ge,h,j),Ae=IS(f,Ce,je,$e,ge),Ne=PS(Q,Le,Be,pe,Ae,ge,i),De=TS($e),Ie=Ii(),We=RS(t,n,i,v),{slideRegistry:it}=ES(W,k,Ce,fe,ce,Ue),at=MS(e,n,it,Ne,pe,Ie,i,I),dt={ownerDocument:s,ownerWindow:r,eventHandler:i,containerRect:q,slideRects:H,animation:Q,axis:T,dragHandler:vS(T,e,s,r,ge,yS(T,r),ie,Q,Ne,pe,Ae,Le,i,R,g,p,w,j,O),eventStore:Ie,percentOfView:R,index:Le,indexPrevious:Be,limit:$e,location:ie,offsetLocation:de,previousLocation:me,options:o,resizeHandler:xS(t,i,r,n,T,C,P),scrollBody:pe,scrollBounds:kS($e,de,ge,pe,R),scrollLooper:$S(je,$e,de,[ie,de,me,ge]),scrollProgress:De,scrollSnapList:Ce.map(De.get),scrollSnaps:Ce,scrollTarget:Ae,scrollTo:Ne,slideLooper:OS(T,A,je,J,X,ue,Ce,de,n),slideFocus:at,slidesHandler:LS(t,i,E),slidesInView:We,slideIndexes:Ue,slideRegistry:it,slidesToScroll:ce,target:ge,translate:xg(T,t)};return dt}function FS(){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 qS={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 zS(e){function t(o,i){return bg(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 BS(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=zS(r),i=BS(o),a=Ii(),c=FS(),{mergeOptions:u,optionsAtMedia:d,optionsMediaQueries:f}=o,{on:h,off:g,emit:p}=c,v=T;let _=!1,w,k=u(qS,yl.globalOptions),C=u(k),E=[],O,I,M;function P(){const{container:Ue,slides:N}=C;I=(Yu(Ue)?e.querySelector(Ue):Ue)||e.children[0];const Q=Yu(N)?I.querySelectorAll(N):N;M=[].slice.call(Q||I.children)}function q(Ue){const N=NS(e,I,M,s,r,Ue,c);if(Ue.loop&&!N.slideLooper.canLoop()){const ee=Object.assign({},Ue,{loop:!1});return q(ee)}return N}function H(Ue,N){_||(k=u(k,Ue),C=d(k),E=N||E,P(),w=q(C),f([k,...E.map(({options:ee})=>ee)]).forEach(ee=>a.add(ee,"change",T)),C.active&&(w.translate.to(w.location.get()),w.animation.init(),w.slidesInView.init(),w.slideFocus.init(Be),w.eventHandler.init(Be),w.resizeHandler.init(Be),w.slidesHandler.init(Be),w.options.loop&&w.slideLooper.loop(),I.offsetParent&&M.length&&w.dragHandler.init(Be),O=i.init(Be,E)))}function T(Ue,N){const ee=ce();A(),H(u({startIndex:ee},Ue),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 R(){_||(_=!0,a.clear(),A(),c.emit("destroy"),c.clear())}function K(Ue,N,ee){!C.active||_||(w.scrollBody.useBaseFriction().useDuration(N===!0?0:C.duration),w.scrollTo.index(Ue,ee||0))}function W(Ue){const N=w.index.add(1).get();K(N,Ue,-1)}function U(Ue){const N=w.index.add(-1).get();K(N,Ue,1)}function J(){return w.index.add(1).get()!==ce()}function X(){return w.index.add(-1).get()!==ce()}function Y(){return w.scrollSnapList}function he(){return w.scrollProgress.get(w.offsetLocation.get())}function ce(){return w.index.get()}function ue(){return w.indexPrevious.get()}function Te(){return w.slidesInView.get()}function je(){return w.slidesInView.get(!1)}function re(){return O}function fe(){return w}function Ce(){return e}function $e(){return I}function Le(){return M}const Be={canScrollNext:J,canScrollPrev:X,containerNode:$e,internalEngine:fe,destroy:R,off:g,on:h,emit:p,plugins:re,previousScrollSnap:ue,reInit:v,rootNode:Ce,scrollNext:W,scrollPrev:U,scrollProgress:he,scrollSnapList:Y,scrollTo:K,selectedScrollSnap:ce,slideNodes:Le,slidesInView:Te,slidesNotInView:je};return H(t,n),setTimeout(()=>c.emit("init"),0),Be}yl.globalOptions=void 0;function sd(e={},t=[]){const n=Bt(e),s=Bt(t);let r=n?e.value:e,o=s?t.value:t;const i=xf(),a=xf();function c(){a.value&&a.value.reInit(r,o)}return Je(()=>{!uS()||!i.value||(yl.globalOptions=sd.globalOptions,a.value=yl(i.value,r,o))}),Xn(()=>{a.value&&a.value.destroy()}),n&&Pe(e,u=>{Xu(r,u)||(r=u,c())}),s&&Pe(t,u=>{dS(o,u)||(o=u,c())}),[i,a]}sd.globalOptions=void 0;const US={},VS={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"},HS=[l("path",{d:"m15 18-6-6 6-6"},null,-1)];function WS(e,t){return m(),x("svg",VS,HS)}const GS=Qe(US,[["render",WS]]),KS={},QS={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"},JS=[l("path",{d:"m9 18 6-6-6-6"},null,-1)];function XS(e,t){return m(),x("svg",QS,JS)}const wg=Qe(KS,[["render",XS]]),ZS={class:"embla__container"},YS={key:0,class:"embla__controls hidden md:flex"},eC={key:0,class:"embla__buttons"},tC={key:1,class:"embla__dots"},nC=["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]=sd({duration:r.duration,loop:r.loop,align:"start",slidesToScroll:1}),a=L([]),c=L(0),u=L(!1),d=L(!0);let f=null;function h(){if(r.breakpoints)return r.breakpoints;const R={};return r.slidesPerViewTablet!=null&&(R[768]={slidesPerView:r.slidesPerViewTablet}),r.slidesPerView!=null&&(r.slidesPerViewTablet!=null||r.slidesPerViewMobile!=null)&&(R[1280]={slidesPerView:r.slidesPerView}),R}const g=L(r.slidesPerViewMobile??r.slidesPerView??null),p=L(r.spaceBetween??0);function v(){if(!r.slidesPerView&&!r.breakpoints)return;const R=window.innerWidth,K=h(),W=Object.keys(K).map(Number).sort((J,X)=>J-X);let U={slidesPerView:r.slidesPerViewMobile??r.slidesPerView??1,spaceBetween:r.spaceBetween??0};for(const J of W)if(R>=J)U={...U,...K[J]};else break;g.value=U.slidesPerView,p.value=U.spaceBetween}const _=te(()=>!!(r.slidesPerView||r.breakpoints)),w=te(()=>_.value?{"--slides-per-view":g.value,"--space-between":`${p.value}px`}:{}),k=te(()=>{switch(r.sizeArrow){case"xl":return"size-14";case"lg":return"size-10";default:return"size-8"}}),C=te(()=>{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",H),q(),E(),s("init",i.value))}),Dt(()=>{window.removeEventListener("resize",v),O()}),Pe(()=>r.autoplay,R=>{R?E():O()});function E(){r.autoplay&&a.value.length>1&&(f=setInterval(()=>{var R;(R=i.value)==null||R.scrollNext()},3e3))}function O(){f&&(clearInterval(f),f=null)}function I(R){var K;(K=i.value)==null||K.scrollTo(R)}function M(){var R;(R=i.value)==null||R.scrollPrev()}function P(){var R;(R=i.value)==null||R.scrollNext()}function q(){i.value&&(u.value=i.value.canScrollPrev(),d.value=i.value.canScrollNext())}function H(){c.value=i.value.selectedScrollSnap(),q();const R={currentIndex:c.value,activeSlide:a.value[c.value],totalSlides:a.value.length};s("change",R),s("slideChange",R)}const T=()=>{r.autoplay&&O()},A=()=>{r.autoplay&&E()};return t({scrollTo:I,scrollPrev:M,scrollNext:P,emblaApi:i,currentSlidesPerView:g}),(R,K)=>(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:mt(w.value),ref_key:"emblaRef",ref:o},[l("div",ZS,[Pt(R.$slots,"default",Gi(ya({selectedIndex:c.value,scrollTo:I})))])],6),a.value&&a.value.length>1?(m(),x("div",YS,[e.showArrows?(m(),x("div",eC,[Rt(l("button",{class:ne(["embla__button embla__button--prev",k.value]),onClick:K[0]||(K[0]=W=>{var U;return(U=y(i))==null?void 0:U.scrollPrev()})},[G(GS,{class:ne(C.value)},null,8,["class"])],2),[[Yo,u.value]]),Rt(l("button",{class:ne(["embla__button embla__button--next",k.value]),onClick:K[1]||(K[1]=W=>{var U;return(U=y(i))==null?void 0:U.scrollNext()})},[G(wg,{class:ne(C.value)},null,8,["class"])],2),[[Yo,d.value]])])):z("",!0),e.pagination?(m(),x("div",tC,[(m(!0),x(be,null,Me(a.value,(W,U)=>(m(),x("button",{key:U,class:ne(["embla__dot",{"is-selected":U===c.value}]),onClick:J=>I(U)},null,10,nC))),128))])):z("",!0)])):z("",!0)],32))}},sC={},rC={class:"embla__slide"};function oC(e,t){return m(),x("div",rC,[Pt(e.$slots,"default")])}const bl=Qe(sC,[["render",oC]]),iC={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"},aC=["href"],lC=["src"],cC={key:1,class:"w-full flex items-center justify-center h-full min-h-[118px]"},uC=["src"],dC=["href","innerHTML"],fC=["innerHTML"],hC={__name:"CardPreview",props:["item","logo"],setup(e){const n="https://widget.geteasy.ai"+"/link.png";function s(r,o={}){["product","page"].includes(r)&&Xt.linkClick({type:r,...o})}return(r,o)=>(m(),x("div",iC,[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,lC)):(m(),x("div",cC,[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,uC)]))],8,aC),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,dC)):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,fC)):z("",!0)]))}},pC={class:"rounded-lg flex p-2 group border border-gray-200 hover:border-primary duration-500 w-[96%] max-w-xl"},mC={class:"w-[138px] h-[90px] flex-shrink-0 mr-2"},gC=["href"],vC=["src"],yC={key:1,class:"min-h-[84px] w-full flex items-center justify-center"},bC=["src"],_C={class:"overflow-hidden space-y-1"},xC=["href","innerHTML"],wC=["innerHTML"],kC={__name:"CardPreviewHorizontal",props:["item","logo"],setup(e){function t(n,s={}){["product","page"].includes(n)&&Xt.linkClick({type:n,...s})}return(n,s)=>(m(),x("div",pC,[l("div",mC,[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,vC)):(m(),x("div",yC,[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,bC)]))],10,gC)]),l("div",_C,[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,xC)):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,wC)):z("",!0)])]))}};function SC(){var r;const e=((r=V.bot)==null?void 0:r.config.apiHost)||V.apiDomain,t=kt.create({baseURL:`${e}/api/bots/${V.handle}/forms`});return{submit:async({formData:o,type:i})=>{const a=V.forms&&V.forms[i]&&V.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(V.bot.widgets??[]));if(o.length==0)return;const i=o.reduce((a,c)=>c.active?{...a,[c.type]:c}:a,{});V.forms=i}}}const CC={class:"messages-group w-full"},$C={class:"relative flex size-8 overflow-hidden rounded-full shrink-0 bg-white message-avatar"},TC=["src","alt"],AC={key:0,class:"rounded-2xl bg-white w-full overflow-hidden max-w-[540px]"},EC={class:"flex items-center justify-between pl-4 pr-2.5 h-12 bg-primary"},IC={class:"font-semibold text-base text-white"},PC={class:"font-medium"},MC={key:1,class:"flex items-center justify-center mr-1"},OC={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"},LC={class:"font-medium"},RC={class:"pl-4 pr-3 py-2 border border-primary border-b-2 border-b-primary rounded-b-2xl"},DC={key:0,class:"w-full"},jC={class:"text-sm text-gray-700 border-b border-b-gray-200 last:border-b-0"},NC={class:"text-gray-500 p-2 pl-0 min-w-[114px] content-start"},FC={class:"py-1"},qC={key:0,class:"flex items-center px-2 py-1.5 rounded-md"},zC={class:"font-medium text-gray-700 whitespace-pre-wrap"},BC={key:1,class:"px-2"},UC={key:1,class:"w-full"},VC={class:"text-sm text-gray-700 border-b border-b-gray-200 last:border-b-0"},HC={class:"text-gray-500 p-2 pl-0 min-w-[114px] content-start"},WC={class:"py-1"},GC={class:"font-medium text-gray-700 whitespace-pre-wrap"},KC={key:1},QC={key:0,class:"px-2"},JC=[l("div",{class:"text-sm font-normal text-blue-400 underline underline-offset-2 text-left"}," Nhập thông tin ",-1)],kg={__name:"CardFormContact",props:{message:{type:Object}},setup(e){const{t}=tn(),n=e,{widgets:s}=Zs(),{getStorage:r}=Ks(),o=L(!1),i=L({}),a=te(()=>{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=()=>{V.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=te(()=>{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=te(()=>Object.values(i.value).filter(g=>g).length>1),h=async()=>{if(o.value)return;o.value=!0;const g=r("easychatgpt_conversations",V.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&&(V.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",CC,[l("span",$C,[y(V).bot&&y(V).bot.config.ui.logo?(m(),x("img",{key:0,src:y(V).bot.config.ui.logo,alt:y(V).bot.config.ui.name,class:"w-full h-full object-cover"},null,8,TC)):z("",!0)]),y(s).contact?(m(),x("div",AC,[l("div",EC,[l("div",IC,D(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",PC,D(y(t)("common.send")),1),o.value?(m(),oe(y(Q2),{key:0,size:"14","stroke-width":"2",class:"animation-rotate"})):(m(),oe(y(Qu),{key:1,size:"14"}))])):(m(),x("div",MC,[a.value?(m(),x("div",OC,[l("div",LC,D(y(t)("common.sent")),1),G(y(dl),{size:"16","stroke-width":"2"})])):(m(),oe(y(ak),{key:1,size:"20",class:"text-white"}))]))]),l("div",RC,[d.value?(m(),x("table",DC,[(m(!0),x(be,null,Me(y(s).contact.fields,v=>(m(),x("tr",jC,[l("td",NC,D(v.label),1),l("td",FC,[d.value[v.name]?(m(),x("div",qC,[l("span",zC,D(d.value[v.name]),1)])):(m(),x("div",BC,"-"))])]))),256))])):(m(),x("table",UC,[(m(!0),x(be,null,Me(y(s).contact.fields,(v,_)=>(m(),x("tr",VC,[l("td",HC,D(v.label),1),l("td",WC,[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",GC,D(i.value[v.name]),1),a.value?z("",!0):(m(),oe(y(sk),{key:0,size:"14",class:"text-gray-500 ml-auto flex-shrink-0"}))],2)):(m(),x("div",KC,[a.value?(m(),x("div",QC,"-")):(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())},JC))]))])]))),256))]))])])):z("",!0)]))}};function rd(){return{isLocked:te(()=>ae.state.dropdownLockCount>0),lockScroll:()=>{ae.actions.lockDropdown()},unlockScroll:()=>{ae.actions.unlockDropdown()}}}const XC={class:"flex items-center justify-between mb-2.5"},ZC={class:"flex gap-1 font-semibold text-sm text-gray-900"},YC={class:"grid grid-cols-7 mb-1"},e$={class:"grid grid-cols-7 gap-1"},t$=["disabled","onClick"],n$=300,s$=280,r$=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}=rd(),r=te(()=>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=te(()=>a[o.locale]||a.vi),u=L(!1),d=L(null),f=L(null),h=L("bottom"),g=L({}),p=()=>{if(!f.value)return;const J=f.value.getBoundingClientRect(),X=ae.state.chatContainerRef||ae.state.rootMarketplaceRef,Y=X?X.getBoundingClientRect():{top:0,bottom:window.innerHeight,left:0,right:window.innerWidth},he=Y.bottom-J.bottom,ce=J.top-Y.top,ue=he<n$&&ce>he;h.value=ue?"top":"bottom";const Te=Math.max(Y.left,Math.min(J.left,Y.right-s$-4));g.value=ue?{position:"fixed",bottom:`${window.innerHeight-J.top+6}px`,left:`${Te}px`}:{position:"fixed",top:`${J.bottom+6}px`,left:`${Te}px`}},v=new Date;v.setHours(0,0,0,0);const _=L(null),w=L(v.getFullYear()),k=L(v.getMonth()),C=J=>{if(!J)return null;let X=String(J).match(/^(\d{4})-(\d{2})-(\d{2})/);return X?new Date(+X[1],+X[2]-1,+X[3]):(X=String(J).match(/^(\d{2})\/(\d{2})\/(\d{4})$/),X?new Date(+X[3],+X[2]-1,+X[1]):null)},E=J=>{if(!J)return"";const X=String(J.getDate()).padStart(2,"0"),Y=String(J.getMonth()+1).padStart(2,"0"),he=J.getFullYear();return`${X}/${Y}/${he}`},O=J=>{if(!J)return"";const X=String(J.getDate()).padStart(2,"0"),Y=String(J.getMonth()+1).padStart(2,"0");return`${J.getFullYear()}-${Y}-${X}`},I=te(()=>c.value.placeholder),M=te(()=>E(_.value)),P=te(()=>c.value.months[k.value]),q=te(()=>c.value.weekdays),H=te(()=>{const J=w.value,X=k.value,Y=new Date(J,X,1).getDay(),he=new Date(J,X+1,0).getDate(),ce=new Date(J,X,0).getDate(),ue=[];for(let re=Y-1;re>=0;re--)ue.push({key:`prev-${re}`,day:ce-re,otherMonth:!0,isToday:!1,isSelected:!1,empty:!1,date:new Date(J,X-1,ce-re)});for(let re=1;re<=he;re++){const fe=new Date(J,X,re);ue.push({key:`cur-${re}`,day:re,otherMonth:!1,isToday:fe.getTime()===v.getTime(),isSelected:_.value?fe.getTime()===_.value.getTime():!1,empty:!1,date:fe})}const Te=35,je=Math.max(0,Te-ue.length);for(let re=1;re<=je;re++)ue.push({key:`next-${re}`,day:re,otherMonth:!0,isToday:!1,isSelected:!1,empty:!1,date:new Date(J,X+1,re)});return ue.slice(0,Te)}),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")},R=()=>{k.value===0?(k.value=11,w.value--):k.value--},K=()=>{k.value===11?(k.value=0,w.value++):k.value++},W=J=>{_.value=J.date,i("update:modelValue",O(J.date)),i("change",O(J.date)),A()},U=J=>{var X,Y;u.value&&((X=f.value)!=null&&X.contains(J.target)||(Y=d.value)!=null&&Y.contains(J.target)||A())};return Je(()=>document.addEventListener("mousedown",U)),Xn(()=>{document.removeEventListener("mousedown",U),u.value&&s()}),Pe(()=>o.modelValue,J=>{const X=C(J);X&&(!_.value||X.getTime()!==_.value.getTime())?_.value=X:J||(_.value=null)},{immediate:!0}),(J,X)=>(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:X[0]||(X[0]=Y=>!e.disabled&&T())},[e.iconPosition==="left"?(m(),oe(y(Jm),{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",M.value?"text-gray-700":"text-gray-400"])},D(M.value||I.value),3),e.iconPosition==="right"?(m(),oe(y(Jm),{key:1,class:"w-[18px] h-[18px] shrink-0 text-gray-400",size:18})):z("",!0)],2),(m(),oe(eu,{to:r.value},[G(en,{name:"dp-fade"},{default:xe(()=>[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:mt(g.value),ref_key:"dropdownRef",ref:d},[l("div",XC,[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:R}," ‹ "),l("div",ZC,[l("span",null,D(P.value),1),l("span",null,D(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:K}," › ")]),l("div",YC,[(m(!0),x(be,null,Me(q.value,Y=>(m(),x("span",{key:Y,class:"text-center text-[11px] font-semibold text-gray-400 py-1"},D(Y),1))),128))]),l("div",e$,[(m(!0),x(be,null,Me(H.value,Y=>(m(),x("button",{key:Y.key,type:"button",disabled:Y.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":Y.empty,"hover:bg-gray-100":!Y.isSelected,"text-gray-300":Y.otherMonth&&!Y.isSelected,"text-gray-700":!Y.otherMonth&&!Y.isSelected&&!Y.isToday,"font-bold text-primary":Y.isToday&&!Y.isSelected,"!bg-primary text-white font-semibold":Y.isSelected}]),onClick:he=>!Y.empty&&W(Y)},D(Y.empty?"":Y.day),11,t$))),128))])],6)):z("",!0)]),_:1})],8,["to"]))],2))}},[["__scopeId","data-v-e341d518"]]),o$=e=>(gn("data-v-28eacf7e"),e=e(),vn(),e),i$={class:"flex items-center justify-center gap-0.5"},a$={class:"grid items-center justify-items-center gap-0.5",style:{"grid-template-rows":"20px 36px 20px"}},l$=["value"],c$=o$(()=>l("span",{class:"text-lg font-bold text-gray-700 self-center pb-0.5"},":",-1)),u$={class:"grid items-center justify-items-center gap-0.5",style:{"grid-template-rows":"20px 36px 20px"}},d$=["value"],f$=160,h$=150,Sg=8,Cg=30,p$=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}=rd(),r=te(()=>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=te(()=>a[o.locale]||a.vi),u=L(!1),d=L(null),f=L(null),h=L("bottom"),g=L({}),p=L(0),v=L(0),_=L("00"),w=L("00"),k=te(()=>c.value.placeholder),C=te(()=>{if(!o.modelValue)return"";const[X="",Y=""]=o.modelValue.split(":"),he=parseInt(X,10),ce=parseInt(Y,10);return isNaN(he)||isNaN(ce)?"":`${String(he).padStart(2,"0")}:${String(ce).padStart(2,"0")}`}),E=()=>{if(!d.value)return;const X=d.value.getBoundingClientRect(),Y=ae.state.chatContainerRef||ae.state.rootMarketplaceRef,he=Y?Y.getBoundingClientRect():{top:0,bottom:window.innerHeight,left:0,right:window.innerWidth},ce=he.bottom-X.bottom,ue=X.top-he.top,Te=ce<f$&&ue>ce;h.value=Te?"top":"bottom";const je=Math.max(he.left,Math.min(X.left,he.right-h$-4));g.value=Te?{position:"fixed",bottom:`${window.innerHeight-X.top+6}px`,left:`${je}px`}:{position:"fixed",top:`${X.bottom+6}px`,left:`${je}px`}},O=()=>{u.value?I():(E(),n(),u.value=!0)},I=()=>{u.value&&s(),u.value=!1,i("blur")},M=()=>{p.value=(p.value+1)%24,_.value=String(p.value).padStart(2,"0")},P=()=>{p.value=(p.value+23)%24,_.value=String(p.value).padStart(2,"0")},q=X=>{const Y=X.target.value.replace(/\D/g,"").slice(0,2);X.target.value=Y,_.value=Y;const he=parseInt(Y,10);isNaN(he)||(p.value=Math.min(23,he))},H=()=>{const X=Math.min(23,Math.max(0,parseInt(_.value,10)||0));p.value=X,_.value=String(X).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")},R=X=>{const Y=X.target.value.replace(/\D/g,"").slice(0,2);X.target.value=Y,w.value=Y;const he=parseInt(Y,10);isNaN(he)||(v.value=Math.min(59,he))},K=()=>{const X=Math.min(59,Math.max(0,parseInt(w.value,10)||0));v.value=X,w.value=String(X).padStart(2,"0")},W=()=>{const X=`${String(p.value).padStart(2,"0")}:${String(v.value).padStart(2,"0")}`;i("update:modelValue",X),i("change",X),I()},U=X=>{if(!X){p.value=Sg,v.value=Cg,_.value=String(Sg).padStart(2,"0"),w.value=String(Cg).padStart(2,"0");return}const[Y,he]=X.split(":").map(Number);isNaN(Y)||isNaN(he)||(p.value=Math.min(23,Math.max(0,Y)),v.value=Math.min(59,Math.max(0,he)),_.value=String(p.value).padStart(2,"0"),w.value=String(v.value).padStart(2,"0"))},J=X=>{var Y,he;u.value&&((Y=d.value)!=null&&Y.contains(X.target)||(he=f.value)!=null&&he.contains(X.target)||I())};return Je(()=>document.addEventListener("mousedown",J)),Xn(()=>{document.removeEventListener("mousedown",J),u.value&&s()}),Pe(()=>o.modelValue,U,{immediate:!0}),(X,Y)=>(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:Y[0]||(Y[0]=he=>!e.disabled&&O())},[G(y(N2),{class:"w-[18px] h-[18px] shrink-0 text-gray-400",size:18}),l("span",{class:ne(["flex-1 text-sm",C.value?"text-gray-700":"text-gray-400"])},D(C.value||k.value),3)],2),(m(),oe(eu,{to:r.value},[G(en,{name:"timer-fade"},{default:xe(()=>[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:mt(g.value),ref_key:"dropdownRef",ref:f},[l("div",i$,[l("div",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(Xm),{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:H,onFocus:Y[1]||(Y[1]=he=>he.target.select()),maxlength:"2"},null,40,l$),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(po),{size:16})])]),c$,l("div",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:T},[G(y(Xm),{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:R,onBlur:K,onFocus:Y[2]||(Y[2]=he=>he.target.select()),maxlength:"2"},null,40,d$),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(po),{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},D(c.value.confirm),1)],6)):z("",!0)]),_:1})],8,["to"]))],2))}},[["__scopeId","data-v-28eacf7e"]]),m$={class:"field-date-time__label"},g$={key:0},v$={class:"field-date-time__controls"},y$=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=L(""),o=L(""),i=te(()=>{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",m$,[Ge(D(e.field.label)+" ",1),i.value?(m(),x("span",g$,"*")):z("",!0)]),l("div",v$,[G(r$,{"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(p$,{"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"]]),b$=e=>(gn("data-v-a29ef6aa"),e=e(),vn(),e),_$={class:"relative"},x$={key:0,class:"space-y-1.5"},w$=["for"],k$={key:0},S$=["type","id","value","placeholder","disabled"],C$={key:2,class:"space-y-1.5"},$$=["for"],T$={key:0},A$={class:"relative"},E$=["id","value","disabled"],I$={value:"",disabled:""},P$=["value"],M$=b$(()=>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)),O$={key:3,class:"space-y-1.5"},L$=["for"],R$={key:0},D$=["id","value","placeholder","disabled"],j$={key:4,class:"relative"},N$=["for"],F$={class:"flex items-center cursor-pointer relative mt-1"},q$=["type","id","checked","disabled"],z$={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"},B$=["innerHTML"],U$={class:"text-xs text-red-500 flex items-center gap-1 pt-0.5 pl-1"},V$=["innerHTML"],H$={class:"text-xs text-gray-500 pl-1"},W$=["innerHTML"],od=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}=tn(),s=e,r=t,o=L(""),i=L(""),a=te(()=>{var E;return((E=s.field.validate)==null?void 0:E.includes("required"))||!1}),c=te(()=>!!(o.value||s.error)),u=te(()=>o.value||s.error),d=te(()=>[{"bg-gray-50 cursor-not-allowed":s.disabled},"[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"]),f=te(()=>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),C(O)},k=(E=s.modelValue)=>{var P;o.value="";const O=((P=s.field.validate)==null?void 0:P.split("|"))||[],I=String(E||"").trim();if(O.includes("nullable")&&!I)return r("validate",s.field.name,!0),!0;const M=s.field.name;for(const q of O){if(q==="nullable")continue;const[H,T]=q.split(":");if(H==="required"&&!I)return o.value=s.field.error||h("required"),r("validate",s.field.name,!1),!1;if(!(!I&&H!=="required")){if(M==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(I))return o.value=s.field.error||h("email"),r("validate",s.field.name,!1),!1;if(M==="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(H==="min"&&I.length<parseInt(T))return o.value=s.field.error||h("min",{value:T}),r("validate",s.field.name,!1),!1;if(H==="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},C=(E=s.modelValue)=>{var I;o.value="";const O=((I=s.field.validate)==null?void 0:I.split("|"))||[];for(const M of O){const[P]=M.split(":");if(P==="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",_$,[["text","email","tel"].includes(e.field.type)?(m(),x("div",x$,[l("label",{for:e.field.name,class:"field-label"},[Ge(D(e.field.label)+" ",1),a.value?(m(),x("span",k$,"*")):z("",!0)],8,w$),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,S$)])):e.field.type==="date"?(m(),oe(y$,{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",C$,[l("label",{for:e.field.name,class:"field-label"},[Ge(D(e.field.label)+" ",1),a.value?(m(),x("span",T$,"*")):z("",!0)],8,$$),l("div",A$,[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",I$,D(f.value),1),(m(!0),x(be,null,Me(e.field.options,(I,M)=>(m(),x("option",{key:M,value:I},D(I),9,P$))),128))],42,E$),M$])])):e.field.type==="textarea"?(m(),x("div",O$,[l("label",{for:e.field.name,class:"field-label"},[Ge(D(e.field.label)+" ",1),a.value?(m(),x("span",R$,"*")):z("",!0)],8,L$),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,D$)])):e.field.type==="checkbox"?(m(),x("div",j$,[l("label",{for:e.field.name,class:ne(["flex items-start",{"cursor-not-allowed opacity-70":e.disabled}])},[l("div",F$,[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,q$),l("span",z$,[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,B$)],10,N$)])):z("",!0),Rt(l("p",U$,[G(y(Zm),{size:"14","stroke-width":"1.5"}),l("div",{innerHTML:u.value},null,8,V$)],512),[[Yo,i.value&&c.value&&e.field.type!=="checkbox"]]),Rt(l("p",H$,[l("div",{innerHTML:e.field.hint},null,8,W$)],512),[[Yo,e.field.hint]])]))}},[["__scopeId","data-v-a29ef6aa"]]),G$={key:"submitted",class:"overflow-auto bg-white text-gray-900 flex flex-col items-center justify-center"},K$={class:"flex flex-col items-center justify-center text-center"},Q$={class:"mt-2 text-2xl font-semibold text-gray-950"},J$={class:"mt-1 text-sm text-gray-500"},X$={key:0,class:"bg-gray-50 rounded-xl p-2 py-1 w-full mt-4 divide-y"},Z$={class:"min-w-0 flex-1"},Y$={class:"text-sm text-gray-500"},e5={class:"mt-1 break-words text-base text-gray-950"},t5={key:"form"},n5={key:0,class:"text-lg font-semibold text-gray-900"},s5={key:1,class:"mt-1 text-sm text-gray-500"},r5={class:"space-y-3"},o5={class:"mt-4"},i5=["disabled"],a5={key:1,class:"px-3 flex justify-center items-center bg-primary h-[48px] text-white rounded-3xl text-center text-sm"},l5={class:"flex items-center justify-center gap-2 text-sm text-green-600 bg-green-50 rounded-full py-2 px-3"},c5={__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}=tn(),n=e,s=L([]),r=L(!1),o=L(!1),i=L(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=ht({}),d=ht({}),f=L(!1),h=L({}),g=L(null),p=te(()=>{const Y=h.value.title;return Y!==void 0&&[!1,0,"false","0"].includes(Y)?!1:![!1,0,"false","0"].includes(n.widget.showFormTitle)}),v=te(()=>_.value&&![!1,0,"false","0"].includes(n.widget.showFormDescription)),_=te(()=>{const Y=n.widget.description;return typeof Y=="string"?Y:Y??""}),w=te(()=>h.value.source),k=te(()=>o.value&&w.value!=="website"),C=te(()=>n.widget.type==="booking_appointment"?t("form.bookingSuccess"):t("form.submitSuccessInfo")),E=te(()=>t("form.submitSuccessThanks")),O=te(()=>A(n.widget.successTitle)||C.value),I=te(()=>A(n.widget.successDescription)||E.value),M=te(()=>A(n.widget.buttonText)||t("form.submitRequest")),P=te(()=>{let Y=s.value.filter(Te=>!Te.hidden);ae.state.handle==="eradovn-fyw"&&(Y=Y.filter(Te=>Te.type!=="email"&&Te.name!=="demand"));const ce=h.value.hideFields;if(!ce)return Y;const ue=ce.split(",").map(Te=>Te.trim());return Y.filter(Te=>!ue.includes(Te.name))}),q=te(()=>P.value.filter(Y=>{const he=u[Y.name];return he!=null&&String(he)!==""})),H=Y=>{var he,ce;return typeof Y.label=="string"?Y.label:((he=Y.label)==null?void 0:he.vi)??((ce=Y.label)==null?void 0:ce.en)??Y.name},T=Y=>Array.isArray(Y)?Y.join(", "):Y&&typeof Y=="object"?JSON.stringify(Y):String(Y).replace("T"," "),A=Y=>typeof Y!="string"?"":Y.trim();Pe([o,w],([Y,he])=>{Y&&he==="website"&&setTimeout(()=>{o.value=!1},3e3)});const R=()=>{var ce;const Y=i.value;if(!Y)return;const he=Y.offsetHeight;window.parent.postMessage({type:"resize-iframe",height:he+1,message_id:(ce=h.value)==null?void 0:ce.message_id},"*")},K=()=>{setTimeout(R,50)},W=te(()=>Object.keys(d).length>0?!1:P.value.filter(he=>he.validate==="required").map(he=>he.name).every(he=>{const ce=u[he];return ce!=null&&String(ce).trim()!==""})),U=(Y,he)=>{he?delete d[Y]:d[Y]="",K()},J=async Y=>{var ue;if(f.value=!0,Object.keys(d).length>0){K();return}w.value==="website"&&(u.page_url=window.location.href);const ce={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"&&(ce.page_url=window.location.href);try{r.value=!0;const Te=await Xe.submission.submitWidget({widgetId:n.widget.id,formData:ce});g.value=((ue=Te.data)==null?void 0:ue.submission_data)??{...u},o.value=!0,window.parent.postMessage({type:"submit-metric",submission_id:Te.data.id},"*")}catch(Te){console.error("Error submitting form:",Te)}finally{r.value=!1,K()}};Pe([o,r],K);const X=()=>{s.value=[...n.widget.fields??[]];const Y=ae.state.handle;if(Y&&c.includes(Y)){const he=s.value.findIndex(ce=>ce.name==="demand");he!==-1&&(s.value.some(ue=>ue.name==="address")||s.value.splice(he+1,0,a))}};return Pe(()=>{var Y;return(Y=n.widget)==null?void 0:Y.fields},()=>{X(),K()},{deep:!0}),Je(()=>{var he,ce;if(h.value=Ya(window.location.href),X(),setTimeout(R,100),typeof ResizeObserver<"u"){const ue=i.value;ue&&new ResizeObserver(R).observe(ue)}const Y=n.submission??(h.value.submission&&h.value.source!=="website"?JSON.parse(decodeURIComponent(h.value.submission)):null);if(Y&&((he=h.value).message_id??(he.message_id=Y==null?void 0:Y.message_id),(ce=h.value).conversation_id??(ce.conversation_id=Y==null?void 0:Y.conversation_id),g.value=Y==null?void 0:Y.submission_data,g.value)){for(const ue in g.value)u[ue]=g.value[ue];o.value=!0}}),(Y,he)=>(m(),x("div",{ref_key:"contactWidgetContainer",ref:i,class:"relative"},[G(en,{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:xe(()=>[k.value?(m(),x("div",G$,[l("div",K$,[l("div",Q$,D(O.value),1),l("div",J$,D(I.value),1)]),q.value.length?(m(),x("div",X$,[(m(!0),x(be,null,Me(q.value,ce=>(m(),x("div",{key:ce.name,class:"p-2"},[l("div",Z$,[l("div",Y$,D(H(ce)),1),l("div",e5,D(T(u[ce.name])),1)])]))),128))])):z("",!0)])):(m(),x("div",t5,[p.value?(m(),x("div",n5,D(e.widget.name),1)):z("",!0),v.value?(m(),x("div",s5,D(_.value),1)):z("",!0),l("form",{onSubmit:Qt(J,["prevent"]),class:ne(v.value||p.value?"mt-3":"mt-0")},[l("div",r5,[(m(!0),x(be,null,Me(P.value,ce=>(m(),oe(od,{key:ce.name,modelValue:u[ce.name],"onUpdate:modelValue":ue=>u[ce.name]=ue,field:ce,error:d[ce.name],disabled:o.value,onValidate:U},null,8,["modelValue","onUpdate:modelValue","field","error","disabled"]))),128))]),l("div",o5,[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},D(r.value?y(t)("form.submitting"):M.value),11,i5)),o.value?(m(),x("div",a5,[l("div",null,D(y(t)("common.sent")),1),G(y(Qu),{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",l5,[G(y(dl),{class:"w-5 h-5"}),l("span",null,D(O.value),1)])],2)):z("",!0)])],34)]))]),_:1})],512))}},u5={key:0,class:"w-full"},d5={key:1,class:"w-[95%] flex items-end space-x-2"},f5={class:"flex overflow-hidden relative flex-shrink-0 bg-white rounded-full size-8 message-avatar"},h5=["src","alt"],p5={key:0,class:"rounded-2xl w-full max-w-[420px] p-4 shadow-iframe-card"},m5={key:1,class:"rounded-2xl overflow-hidden w-full max-w-[420px] p-3 pt-4 shadow-iframe-card"},g5=["src"],v5={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"},y5=["src"],b5=Qe({__name:"CardIframe",props:["item","handle"],setup(e){const{widgets:t}=Zs(),n=e,s=L(180),r=L(!1),o=te(()=>bn(n.item.content)),i=te(()=>{var _;return(_=n.item)==null?void 0:_.id}),a=te(()=>{var _;return((_=n.item)==null?void 0:_.conversation_id)??ro(n.handle)}),c=te(()=>{var k,C;const _=(C=(k=o.value)==null?void 0:k.iframe)==null?void 0:C.src;if(!_)return null;const w=_.match(/\/embed\/[^/]+\/([a-f0-9-]+)/);return w?w[1]:null}),u=te(()=>{const _=c.value;return _?[t.value.contact,t.value.booking_appointment].find(k=>(k==null?void 0:k.id)===_)??null:null}),d=te(()=>{var w,k,C;const _=(k=(w=o.value)==null?void 0:w.iframe)==null?void 0:k.src;return _?aw(_,{message_id:i.value,conversation_id:a.value,locale:Xs.state.locale,submission:(C=o.value)!=null&&C.submission?encodeURIComponent(JSON.stringify(o.value.submission)):null,preview:r.value}):""}),f=_=>new URLSearchParams(window.location.search).get(_),h=_=>{var w,k;try{const C=_.data;C&&typeof C=="object"&&C.type==="resize-iframe"&&C.height&&((w=C.message_id)==null?void 0:w.toString())===((k=i.value)==null?void 0:k.toString())&&(s.value=C.height)}catch(C){console.error("Error handling iframe message:",C)}},g=_=>{try{const w=_.data;w&&typeof w=="object"&&w.type==="submit-metric"&&w.submission_id&&Xt.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")}),Xn(()=>{window.removeEventListener("message",p)}),(_,w)=>{var k,C,E,O,I,M;return(C=(k=o.value.iframe)==null?void 0:k.src)!=null&&C.includes("widget.easyaichat.app")||(O=(E=o.value.iframe)==null?void 0:E.src)!=null&&O.includes("widget.geteasy.ai")||(M=(I=o.value.iframe)==null?void 0:I.src)!=null&&M.includes("localhost:5174")?(m(),x("div",u5,[[y(Bn),y(zn),"stagingeasyaichatapp"].includes(y(V).handle)?(m(),oe(kg,{key:0,message:e.item},null,8,["message"])):(m(),x("div",d5,[l("span",f5,[y(V).bot&&y(V).bot.config.ui.logo?(m(),x("img",{key:0,src:y(V).bot.config.ui.logo,alt:y(V).bot.config.ui.name,class:"object-cover w-full h-full"},null,8,h5)):z("",!0)]),u.value?(m(),x("div",p5,[G(c5,{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",m5,[l("iframe",{src:d.value,style:mt({height:s.value+"px"}),onLoad:v,frameborder:"0",class:"w-full duration-200 transition-height"},null,44,g5)]))]))])):(m(),x("div",v5,[l("iframe",{src:d.value,frameborder:"0",class:"w-full h-full"},null,8,y5)]))}}},[["__scopeId","data-v-31004c8d"]]),_5={class:"flex overflow-hidden relative bg-white rounded-full size-8 flex-shrink-0 message-avatar"},x5=["src","alt"],w5=["src","alt"],k5={__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}=It(ae.state),o=L(!1),i=[zn,Bn],a=L(!1);Je(()=>{const p=Ya(window.location.href);(p==null?void 0:p.easy_ai_test_production)==="rangdong"&&(a.value=!0),wt(()=>{n("reset-padding")})});const c=Kt(()=>Promise.resolve().then(()=>Eq)),u=Kt(()=>Promise.resolve().then(()=>Yq)),d=Kt(()=>Promise.resolve().then(()=>_z)),f=Kt(()=>Promise.resolve().then(()=>zz)),h=Kt(()=>Promise.resolve().then(()=>fB)),g=te(()=>i.includes(r.value)?{vertical:c,horizontal:u}:r.value===Ln&&a.value?{vertical:h,horizontal:h}:{vertical:d,horizontal:f});return(p,v)=>{var _,w,k,C;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(be,null,Me(e.products,(E,O)=>(m(),oe(Ft(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",_5,[(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,x5)):(m(),x("img",{key:1,src:(C=(k=y(s).config)==null?void 0:k.ui)==null?void 0:C.logo,alt:y(s).config.ui.name,class:"object-cover w-full h-full"},null,8,w5))]),(m(),oe(Ft(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))}}},$g=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]},S5=()=>Date.now().toString(36)+Math.random().toString(36).substring(2,9),id={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=ht({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}),C5=5,$5=()=>ae.getters.isAgentEnabled.value?C5:Ze.maxFiles,Tg=te(()=>$5());function _l(){const{files:e,acceptTypes:t,maxFileSize:n,maxFiles:s,uploading:r,errors:o,processedFiles:i}=It(Ze),a=te(()=>Ze.files.reduce((M,P)=>M+P.size,0)),c=te(()=>Ze.files.length),u=te(()=>{const M=Ze.files.map(q=>({...q,loading:q.uploading||!1}));return[...Ze.processedFiles.map(q=>({...q,loading:!1})),...M]}),d=te(()=>{var P,q,H,T,A,R;const M=[];return(q=(P=Ze.toolbarConfig)==null?void 0:P.file_upload)!=null&&q.visible&&M.push(...id.file_upload),(T=(H=Ze.toolbarConfig)==null?void 0:H.image_upload)!=null&&T.visible&&M.push(...id.image_upload),(R=(A=Ze.toolbarConfig)==null?void 0:A.audio_upload)!=null&&R.visible&&M.push(...id.audio_upload),M}),f=M=>{var U,J,X,Y,he,ce;if(Ze.errors=[],!(((J=(U=Ze.toolbarConfig)==null?void 0:U.file_upload)==null?void 0:J.visible)||((Y=(X=Ze.toolbarConfig)==null?void 0:X.image_upload)==null?void 0:Y.visible)||((ce=(he=Ze.toolbarConfig)==null?void 0:he.audio_upload)==null?void 0:ce.visible)))return Ze.errors.push("Tính năng upload chưa được kích hoạt"),!1;const q=d.value,H=Tg.value,T=Ze.processedFiles.length+Ze.files.length;if(T>=H)return Ze.errors.push(`Chỉ được phép tải lên tối đa ${H} file`),!1;let A=H-T,R=0;const K=Array.from(M).filter(ue=>{const Te=`.${ue.name.split(".").pop().toLowerCase()}`;return q.includes(Te)?A<=0?(R++,!1):ue.size>Ze.maxFileSize?(Ze.errors.push(`File "${ue.name}" vượt quá kích thước tối đa (${$g(Ze.maxFileSize)})`),!1):(A--,!0):(Ze.errors.push(`File "${ue.name}" không thuộc loại được chấp nhận`),!1)});if(R>0&&Ze.errors.push(`Chỉ được phép tải lên tối đa ${H} file. Đã loại bỏ ${R} file cuối`),K.length===0)return!1;const W=K.map(ue=>{const Te={file:ue,filename:ue.name,size:ue.size,mime_type:ue.type,uploading:!1};return ue.type.startsWith("image/")&&(Te.previewUrl=URL.createObjectURL(ue)),Te});return Ze.files=[...Ze.files,...W],!0},h=M=>{const P=Ze.processedFiles.findIndex(q=>q.file_id===M);if(P!==-1)return Ze.processedFiles.splice(P,1),!0;if(typeof M=="number"&&M<Ze.files.length){const q=Ze.files[M];return q!=null&&q.previewUrl&&URL.revokeObjectURL(q.previewUrl),Ze.files.splice(M,1),!0}return!1},g=()=>{Ze.files.forEach(M=>{M.previewUrl&&URL.revokeObjectURL(M.previewUrl)}),Ze.files=[],Ze.processedFiles=[],Ze.errors=[]},p=M=>{M&&(Ze.toolbarConfig=M)},v=()=>{Ze.errors=[]},_=async M=>{var H;const P=(H=M.clipboardData)==null?void 0:H.items;if(!P)return!1;const q=[];for(let T=0;T<P.length;T++){const A=P[T];if(A.kind==="file"){const R=A.getAsFile();if(R){let K=R;if(R.type.startsWith("image/")&&R.name==="image.png"){const W=R.type.split("/")[1],U=`image-${S5()}.${W}`;K=new File([R],U,{type:R.type})}q.push(K)}}}if(q.length>0){const T=f(q);return T&&Ze.autoUploadOnPaste&&await C(),T}return!1},w=M=>M.type.startsWith("image/")?"image":M.type==="application/pdf"?"file-text":M.type.includes("word")||M.type.includes("doc")?"file-type":"file",k=M=>M.startsWith("image/"),C=async()=>{if(Ze.files.length===0)return!0;const M=ae.state.handle,P="https://console.easyaichat.app";try{Ze.uploading=!0;const q=Ze.files.map(async(A,R)=>{Ze.files[R].uploading=!0;const K=new FormData;K.append("file",A.file),K.append("handle",M);try{const W=await fetch(P+"/api/chat/upload",{method:"POST",body:K});if(!W.ok)throw new Error(`Lỗi ${W.status}: ${W.statusText}`);const U=await W.json();return Ze.files[R].uploading=!1,U.file}catch(W){return console.log("Update file error: ",W),Ze.files[R].uploading=!1,null}}),H=await Promise.all(q),T=H.filter(A=>A!==null);return Ze.files.forEach(A=>{A.previewUrl&&URL.revokeObjectURL(A.previewUrl)}),Ze.processedFiles=[...Ze.processedFiles,...T],Ze.files=[],T.length===H.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:Tg,uploading:r,errors:o,totalSize:a,fileCount:c,displayFiles:u,validateFiles:f,removeFile:h,clearFiles:g,updateConfig:p,clearErrors:v,handlePaste:_,uploadFilesToServer:C,getFileIconName:w,isImageFile:k,formatFileSize:$g,setupPasteListener:()=>{window.addEventListener("paste",_)},cleanupPasteListener:()=>{window.removeEventListener("paste",_)},setAutoUploadOnPaste:M=>{Ze.autoUploadOnPaste=M}}}const T5=["title"],A5={class:"flex-shrink-0 flex items-center justify-center w-11 h-11 bg-white rounded-lg mr-1.5"},E5={key:0,xmlns:"http://www.w3.org/2000/svg",width:"46",height:"46",viewBox:"0 0 32 32"},I5=[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)],P5={class:"flex-1 min-w-0"},M5={class:"text-xs font-medium text-gray-900 truncate block"},O5={class:"flex items-center text-xs text-gray-500 font-medium"},L5=l("span",{class:"mx-1"},"•",-1),R5={class:"uppercase"},Ag={__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=te(()=>{switch(s(t.file.filename)){case"xlsx":return{icon:null,color:""};case"pdf":return{icon:Ys,color:"text-red-600"};case"csv":return{icon:q2,color:"text-green-600"};case"docx":return{icon:z2,color:"text-blue-600"};case"txt":return{icon:Ys,color:"text-gray-600"};case"md":return{icon:L2,color:"text-purple-600"};default:return{icon:Ys,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",A5,[r.value.icon?(m(),oe(Ft(r.value.icon),{key:1,size:"32",class:ne(r.value.color)},null,8,["class"])):(m(),x("svg",E5,I5))]),l("div",P5,[l("p",M5,D(e.file.filename),1),l("div",O5,[l("span",null,D(y(n)(e.file.size)),1),L5,l("span",R5,D(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(eg),{size:"16",class:"text-gray-600"})])):z("",!0)],8,T5))}},D5={class:"space-y-1"},j5=["src"],N5={__name:"CardVideo",props:{message:{type:Object,required:!0}},emits:["open-gallery"],setup(e,{emit:t}){const s=bn(e.message.content),r=Array.isArray(s)?s:[s],o=L([]),i=a=>a?a.includes("#")?a:`${a}#t=0.5`:"";return Je(()=>{o.value.forEach(a=>{a&&a.load()})}),(a,c)=>(m(),x("div",D5,[(m(!0),x(be,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,j5),Ge(" Your browser does not support the video tag. ")],512)]))),128))]))}},F5={class:"space-y-2"},q5={controls:""},z5=["src"],B5=["src"],U5={__name:"CardAudio",props:{message:{type:Object}},setup(e){const n=e.message.content;return(s,r)=>(m(),x("div",F5,[(m(!0),x(be,null,Me(y(n),o=>(m(),x("div",{key:o.file_id},[l("audio",q5,[l("source",{src:o.url,type:"audio/ogg"},null,8,z5),l("source",{src:o.url,type:"audio/mpeg"},null,8,B5),Ge(" Your browser does not support the audio tag. ")])]))),128))]))}},V5=["src","alt","onClick"],H5={__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=bn(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(be,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,V5)],2))),128))],2)):z("",!0)}},W5={key:4,class:"text-xs text-gray-500 absolute right-1 -bottom-1 translate-y-full message-user-status"},G5={key:0},K5={key:1},Q5={__name:"CardAttachment",props:{message:{type:Object},files:{type:Array,default:()=>[]},isUser:Boolean,newMessageStatus:{type:String},isLatestUserMessage:{type:Boolean,default:!1}},setup(e){const{t}=tn(),n=e;let s=null;const r=i=>{const a=n.files.findIndex(c=>c.file_id===i);a!==-1&&(s=Lw(n.files,a,()=>{s=null}))},o=i=>i.sender_type==="user";return Dt(()=>{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(H5,{key:0,message:e.message,isUser:o(e.message),onOpenGallery:r},null,8,["message","isUser"])):z("",!0),e.message.content_type==="video"?(m(),oe(N5,{key:1,message:e.message,onOpenGallery:r},null,8,["message"])):z("",!0),e.message.content_type==="audio"?(m(),oe(U5,{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(be,null,Me(e.message.content,(c,u)=>(m(),oe(Ag,{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",W5,[e.newMessageStatus==="sent"?(m(),x("span",G5,D(y(t)("common.sent")),1)):e.newMessageStatus==="received"?(m(),x("span",K5,D(y(t)("common.received")),1)):z("",!0)])):z("",!0)],2))}},J5=["href"],X5={class:"flex-1 flex flex-col min-w-0"},Z5={key:0,class:"font-semibold text-primary text-[15px] leading-[150%] mb-1.5 pl-1"},Y5={key:1,class:"flex items-start gap-1.5 text-gray-700"},e3={class:"text-sm line-clamp-3"},t3={key:2,class:"flex items-center gap-1.5 text-gray-900 mt-1"},n3={class:"text-sm truncate"},s3={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"},r3={__name:"CardStore",props:{store:{type:Object,required:!0}},setup(e){const t=e,n=te(()=>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",X5,[e.store.title?(m(),x("h3",Z5,D(e.store.title),1)):z("",!0),e.store.address?(m(),x("div",Y5,[G(y(X2),{size:16,class:"flex-shrink-0 mt-1"}),l("span",e3,D(e.store.address),1)])):z("",!0),e.store.phone_numbers&&e.store.phone_numbers.length>0?(m(),x("div",t3,[G(y(hl),{size:16,class:"flex-shrink-0"}),l("span",n3,D(s(e.store.phone_numbers)),1)])):z("",!0)]),l("div",s3,[G(y(Ir),{size:"16"})])],8,J5))}},o3={class:"relative w-[calc(100%-20px)]"},i3={class:"relative pl-[40px]"},a3={class:"absolute bottom-0 left-0"},l3=["src","alt"],c3={class:"border rounded-xl divide-y overflow-hidden"},u3={__name:"ListStores",props:{stores:{type:Array,required:!0,default:()=>[]},logo:{type:String,default:""},botName:{type:String,default:""}},setup(e){const{handle:t}=It(V);return(n,s)=>(m(),x("div",o3,[l("div",i3,[l("div",a3,[l("span",{class:ne(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",y(t)===y($n)?"rounded":"rounded-full"])},[l("img",{src:e.logo,alt:e.botName,class:"object-cover w-full h-full"},null,8,l3)],2)]),l("div",c3,[(m(!0),x(be,null,Me(e.stores,(r,o)=>(m(),oe(r3,{key:o,store:r},null,8,["store"]))),128))])])]))}};function ad(e,t){const n=typeof e=="string"&&!t?`${e}Context`:t,s=Symbol(n);return[r=>{const o=Qr(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=>(Gc(s,r),r)]}function Eg(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 d3(e){return Zd()?(k0(e),!0):!1}function f3(e){let t=!1,n;const s=x0(!0);return(...r)=>(t||(n=s.run(()=>e(...r)),t=!0),n)}function ld(e){return typeof e=="function"?e():y(e)}const Oi=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const h3=e=>typeof e<"u",p3=Object.prototype.toString,m3=e=>p3.call(e)==="[object Object]",g3=()=>{};function xl(e){var t;const n=ld(e);return(t=n==null?void 0:n.$el)!=null?t:n}const Ig=Oi?window:void 0;function v3(...e){let t,n,s,r;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,s,r]=e,t=Ig):[t,n,s,r]=e,!t)return g3;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),ld(r)],([d,f])=>{if(i(),!d)return;const h=m3(f)?{...f}:f;o.push(...n.flatMap(g=>s.map(p=>a(d,g,p,h))))},{immediate:!0,flush:"post"}),u=()=>{c(),i()};return d3(u),u}function y3(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function b3(...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=Ig,eventName:o="keydown",passive:i=!1,dedupe:a=!1}=s,c=y3(t);return v3(r,o,u=>{u.repeat&&ld(a)||c(u)&&n(u)},i)}function _3(){const e=L(!1),t=Yn();return t&&Je(()=>{e.value=!0},t),e}function x3(e){return JSON.parse(JSON.stringify(e))}function w3(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=Yn(),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 _=C=>a?typeof a=="function"?a(C):x3(C):C,w=()=>h3(e[t])?_(e[t]):f,k=C=>{h?h(C)&&p(v,C):p(v,C)};if(c){const C=w(),E=L(C);let O=!1;return Pe(()=>e[t],I=>{O||(O=!0,E.value=_(I),wt(()=>O=!1))}),Pe(E,I=>{!O&&(I!==e[t]||d)&&k(I)},{deep:d}),E}else return te({get(){return w()},set(C){k(C)}})}function cd(e){return e?e.flatMap(t=>t.type===be?cd(t.children):[t]):[]}const[k3]=ad("ConfigProvider");function wl(e){const t=Yn(),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(Pn(r))]=(...o)=>e(r,...o)}),s}function S3(e){const t=Yn(),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=Z0(e);return te(()=>{const r={},o=(t==null?void 0:t.vnode.props)??{};return Object.keys(o).forEach(i=>{r[Pn(i)]=o[i]}),Object.keys({...n,...r}).reduce((i,a)=>(s.value[a]!==void 0&&(i[a]=s.value[a]),i),{})})}function C3(e,t){const n=S3(e),s=t?wl(t):{};return te(()=>({...n.value,...s}))}function er(){const e=Yn(),t=L(),n=te(()=>{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 $3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},go=new WeakMap,kl=new WeakMap,Sl={},ud=0,Pg=function(e){return e&&(e.host||Pg(e.parentNode))},T3=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=Pg(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})},A3=function(e,t,n,s){var r=T3(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=(go.get(h)||0)+1,_=(o.get(h)||0)+1;go.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(),ud++,function(){i.forEach(function(f){var h=go.get(f)-1,g=o.get(f)-1;go.set(f,h),o.set(f,g),h||(kl.has(f)||f.removeAttribute(s),kl.delete(f)),g||f.removeAttribute(n)}),ud--,ud||(go=new WeakMap,go=new WeakMap,kl=new WeakMap,Sl={})}},E3=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=$3(e);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live]"))),A3(s,r,n,"aria-hidden")):function(){return null}};function I3(e){let t;Pe(()=>xl(e),n=>{n?t=E3(n):t&&t()}),Dt(()=>{t&&t()})}let P3=0;function Mg(e,t="radix"){const{useId:n}=k3({useId:void 0});return n&&typeof n=="function"?`${t}-${n()}`:`${t}-${++P3}`}function M3(e,t){const n=L(e);function s(r){return t[n.value][r]??n.value}return{state:n,dispatch:r=>{n.value=s(r)}}}const O3=Yt({name:"PrimitiveSlot",inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{var s,r;if(!n.default)return null;const o=cd(n.default()),i=o.findIndex(d=>d.type!==On);if(i===-1)return o;const a=o[i];(s=a.props)==null||delete s.ref;const c=a.props?kn(t,a.props):t;t.class&&(r=a.props)!=null&&r.class&&delete a.props.class;const u=us(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=Yt({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)?()=>fr(s,t):s!=="template"?()=>fr(e.as,t,{default:n.default}):()=>fr(O3,t,{default:n.default})}});function L3(e,t){const n=L({}),s=L("none"),r=e.value?"mounted":"unmounted",{state:o,dispatch:i}=M3(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 wt(),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 Dt(()=>{d(),f()}),{isPresent:te(()=>["mounted","unmountSuspended"].includes(o.value))}}function $l(e){return e&&getComputedStyle(e).animationName||"none"}const R3=Yt({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}=It(e),i=L(),{isPresent:a}=L3(r,i);n({present:a});let c=t.default({present:a});c=cd(c||[]);const u=Yn();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?fr(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}}),[vo,D3]=ad("DialogRoot"),j3=Yt({__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=w3(n,"open",t,{defaultValue:n.defaultOpen,passive:n.open===void 0}),r=L(),o=L(),{modal:i}=It(n);return D3({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)=>Pt(a.$slots,"default",{open:y(s)})}}),N3=Yt({__name:"Teleport",props:{to:{default:"body"},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(e){const t=_3();return(n,s)=>y(t)||n.forceMount?(m(),oe(eu,{key:0,to:n.to,disabled:n.disabled},[Pt(n.$slots,"default")],8,["to","disabled"])):z("",!0)}}),tr=Yt({__name:"DialogPortal",props:{to:{},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(e){const t=e;return(n,s)=>(m(),oe(y(N3),Gi(ya(t)),{default:xe(()=>[Pt(n.$slots,"default")]),_:3},16))}}),F3="dismissableLayer.pointerDownOutside",q3="dismissableLayer.focusOutside";function Og(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 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=L(!1),o=L(()=>{});return ks(i=>{if(!Oi)return;const a=async u=>{const d=u.target;if(t!=null&&t.value){if(Og(t.value,d)){r.value=!1;return}if(u.target&&!r.value){let f=function(){Eg(F3,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 B3(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=L(!1);return ks(o=>{if(!Oi)return;const i=async a=>{t!=null&&t.value&&(await wt(),!(!t.value||Og(t.value,a.target))&&a.target&&!r.value&&Eg(q3,e,{originalEvent:a}))};s.addEventListener("focusin",i),o(()=>s.removeEventListener("focusin",i))}),{onFocusCapture:()=>r.value=!0,onBlurCapture:()=>r.value=!1}}const Is=ht({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),U3=Yt({__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}=er(),i=te(()=>{var p;return((p=o.value)==null?void 0:p.ownerDocument)??globalThis.document}),a=te(()=>Is.layersRoot),c=te(()=>o.value?Array.from(a.value).indexOf(o.value):-1),u=te(()=>Is.layersWithOutsidePointerEventsDisabled.size>0),d=te(()=>{const p=Array.from(a.value),[v]=[...Is.layersWithOutsidePointerEventsDisabled].slice(-1),_=p.indexOf(v);return c.value>=_}),f=z3(async p=>{const v=[...Is.branches].some(_=>_.contains(p.target));!d.value||v||(s("pointerDownOutside",p),s("interactOutside",p),await wt(),p.defaultPrevented||s("dismiss"))},o),h=B3(p=>{[...Is.branches].some(v=>v.contains(p.target))||(s("focusOutside",p),s("interactOutside",p),p.defaultPrevented||s("dismiss"))},o);b3("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:mt({pointerEvents:u.value?d.value?"auto":"none":void 0}),onFocusCapture:y(h).onFocusCapture,onBlurCapture:y(h).onBlurCapture,onPointerdownCapture:y(f).onPointerDownCapture},{default:xe(()=>[Pt(p.$slots,"default")]),_:3},8,["as-child","as","style","onFocusCapture","onBlurCapture","onPointerdownCapture"]))}}),dd="focusScope.autoFocusOnMount",fd="focusScope.autoFocusOnUnmount",Lg={bubbles:!1,cancelable:!0};function V3(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(nr(s,{select:t}),document.activeElement!==n)return!0}function H3(e){const t=Rg(e),n=Dg(t,e),s=Dg(t.reverse(),e);return[n,s]}function Rg(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 Dg(e,t){for(const n of e)if(!W3(n,{upTo:t}))return n}function W3(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 G3(e){return e instanceof HTMLInputElement&&"select"in e}function nr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&G3(e)&&t&&e.select()}}const K3=f3(()=>L([]));function Q3(){const e=K3();return{add(t){const n=e.value[0];t!==n&&(n==null||n.pause()),e.value=jg(e.value,t),e.value.unshift(t)},remove(t){var n;e.value=jg(e.value,t),(n=e.value[0])==null||n.resume()}}}function jg(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function J3(e){return e.filter(t=>t.tagName!=="A")}const X3=Yt({__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}=er(),i=L(null),a=Q3(),c=ht({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:nr(i.value,{select:!0})}function g(_){if(c.paused||!f)return;const w=_.relatedTarget;w!==null&&(f.contains(w)||nr(i.value,{select:!0}))}function p(_){f.contains(i.value)||nr(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 wt(),!f)return;a.add(c);const h=document.activeElement;if(!f.contains(h)){const g=new CustomEvent(dd,Lg);f.addEventListener(dd,p=>s("mountAutoFocus",p)),f.dispatchEvent(g),g.defaultPrevented||(V3(J3(Rg(f)),{select:!0}),document.activeElement===h&&nr(f))}d(()=>{f.removeEventListener(dd,v=>s("mountAutoFocus",v));const g=new CustomEvent(fd,Lg),p=v=>{s("unmountAutoFocus",v)};f.addEventListener(fd,p),f.dispatchEvent(g),setTimeout(()=>{g.defaultPrevented||nr(h??document.body,{select:!0}),f.removeEventListener(fd,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]=H3(g);p&&v?!d.shiftKey&&h===v?(d.preventDefault(),n.loop&&nr(p,{select:!0})):d.shiftKey&&h===p&&(d.preventDefault(),n.loop&&nr(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:xe(()=>[Pt(d.$slots,"default")]),_:3},8,["as-child","as"]))}});function Z3(e){return e?"open":"closed"}const Ng=Yt({__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=vo(),{forwardRef:o,currentElement:i}=er();return r.titleId||(r.titleId=Mg(void 0,"radix-vue-dialog-title")),r.descriptionId||(r.descriptionId=Mg(void 0,"radix-vue-dialog-description")),Je(()=>{r.contentElement=i,document.activeElement!==document.body&&(r.triggerElement.value=document.activeElement)}),(a,c)=>(m(),oe(y(X3),{"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:xe(()=>[G(y(U3),kn({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(Z3)(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:xe(()=>[Pt(a.$slots,"default")]),_:3},16,["id","as","as-child","disable-outside-pointer-events","aria-describedby","aria-labelledby","data-state"])]),_:3},8,["trapped"]))}}),Y3=Yt({__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=vo(),o=wl(s),{forwardRef:i,currentElement:a}=er();return I3(a),(c,u)=>(m(),oe(Ng,kn({...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:xe(()=>[Pt(c.$slots,"default")]),_:3},16,["trap-focus"]))}}),eT=Yt({__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);er();const r=vo(),o=L(!1),i=L(!1);return(a,c)=>(m(),oe(Ng,kn({...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:xe(()=>[Pt(a.$slots,"default")]),_:3},16))}}),tT=Yt({__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=vo(),o=wl(s),{forwardRef:i}=er();return(a,c)=>(m(),oe(y(R3),{present:a.forceMount||y(r).open.value},{default:xe(()=>[y(r).modal.value?(m(),oe(Y3,kn({key:0,ref:y(i)},{...n,...y(o),...a.$attrs}),{default:xe(()=>[Pt(a.$slots,"default")]),_:3},16)):(m(),oe(eT,kn({key:1,ref:y(i)},{...n,...y(o),...a.$attrs}),{default:xe(()=>[Pt(a.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),Tl=Yt({__name:"DialogTitle",props:{asChild:{type:Boolean},as:{default:"h2"}},setup(e){const t=e,n=vo();return er(),(s,r)=>(m(),oe(y(Cl),kn(t,{id:y(n).titleId}),{default:xe(()=>[Pt(s.$slots,"default")]),_:3},16,["id"]))}}),Al=Yt({__name:"DialogDescription",props:{asChild:{type:Boolean},as:{default:"p"}},setup(e){const t=e;er();const n=vo();return(s,r)=>(m(),oe(y(Cl),kn(t,{id:y(n).descriptionId}),{default:xe(()=>[Pt(s.$slots,"default")]),_:3},16,["id"]))}});function nT(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}nT(),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 sT=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const rT=e=>typeof e<"u";function oT(e){return JSON.parse(JSON.stringify(e))}function Fg(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=Yn(),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 _=C=>a?typeof a=="function"?a(C):oT(C):C,w=()=>rT(e[t])?_(e[t]):f,k=C=>{h?h(C)&&p(v,C):p(v,C)};if(c){const C=w(),E=L(C);let O=!1;return Pe(()=>e[t],I=>{O||(O=!0,E.value=_(I),wt(()=>O=!1))}),Pe(E,I=>{!O&&(I!==e[t]||d)&&k(I)},{deep:d}),E}else return te({get(){return w()},set(C){k(C)}})}const[qg,iT]=ad("DrawerRoot"),zg=new WeakMap;function Ot(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&&zg.set(e,s)}function El(e,t){if(!e||!(e instanceof HTMLElement))return;const n=zg.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(", ")[Ht(t)?13:12]):(r=s.match(/^matrix\((.+)\)$/),r?Number.parseFloat(r[1].split(", ")[Ht(t)?5:4]):null)}function aT(e){return 8*(Math.log(e+1)-2)}function Ht(e){switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}}const xt={DURATION:.5,EASE:[.32,.72,0,1]},Bg=.4;function lT({activeSnapPoint:e,snapPoints:t,drawerRef:n,overlayRef:s,fadeFromIndex:r,onSnapPointChange:o,direction:i}){const a=L(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)}),Xn(()=>{typeof window<"u"&&window.removeEventListener("resize",c)});const u=te(()=>(t.value&&e.value===t.value[t.value.length-1])??null),d=te(()=>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=te(()=>{var k;return((k=t.value)==null?void 0:k.findIndex(C=>C===e.value))??null}),h=te(()=>{var k;return((k=t.value)==null?void 0:k.map(C=>{const E=typeof C=="string";let O=0;if(E&&(O=Number.parseInt(C,10)),Ht(i.value)){const M=E?O:a.value?C*a.value.innerHeight:0;return a.value?i.value==="bottom"?a.value.innerHeight-M:-a.value.innerHeight+M:M}const I=E?O:a.value?C*a.value.innerWidth:0;return a.value?i.value==="right"?a.value.innerWidth-I:-a.value.innerWidth+I:I}))??[]}),g=te(()=>{var k;return f.value!==null?(k=h.value)==null?void 0:k[f.value]:null}),p=k=>{var C,E,O,I;const M=((C=h.value)==null?void 0:C.findIndex(P=>P===k))??null;wt(()=>{var P;o(M,h.value),Ot((P=n.value)==null?void 0:P.$el,{transition:`transform ${xt.DURATION}s cubic-bezier(${xt.EASE.join(",")})`,transform:Ht(i.value)?`translate3d(0, ${k}px, 0)`:`translate3d(${k}px, 0, 0)`})}),h.value&&M!==h.value.length-1&&M!==(r==null?void 0:r.value)?Ot((E=s.value)==null?void 0:E.$el,{transition:`opacity ${xt.DURATION}s cubic-bezier(${xt.EASE.join(",")})`,opacity:"0"}):Ot((O=s.value)==null?void 0:O.$el,{transition:`opacity ${xt.DURATION}s cubic-bezier(${xt.EASE.join(",")})`,opacity:"1"}),e.value=M!==null?((I=t.value)==null?void 0:I[M])??null:null};Pe([e,h,t],()=>{var k;if(e.value){const C=((k=t.value)==null?void 0:k.findIndex(E=>E===e.value))??-1;h.value&&C!==-1&&typeof h.value[C]=="number"&&p(h.value[C])}},{immediate:!0});function v({draggedDistance:k,closeDrawer:C,velocity:E,dismissible:O}){var I,M,P;if(r.value===void 0)return;const q=i.value==="bottom"||i.value==="right"?(g.value??0)-k:(g.value??0)+k,H=f.value===r.value-1,T=f.value===0,A=k>0;if(H&&Ot((I=s.value)==null?void 0:I.$el,{transition:`opacity ${xt.DURATION}s cubic-bezier(${xt.EASE.join(",")})`}),E>2&&!A){O?C():p(h.value[0]);return}if(E>2&&A&&h&&t.value){p(h.value[t.value.length-1]);return}const R=(M=h.value)==null?void 0:M.reduce((W,U)=>typeof W!="number"||typeof U!="number"?W:Math.abs(U-q)<Math.abs(W-q)?U:W),K=Ht(i.value)?window.innerHeight:window.innerWidth;if(E>Bg&&Math.abs(k)<K*.4){const W=A?1:-1;if(W>0&&u){p(h.value[(((P=t.value)==null?void 0:P.length)??0)-1]);return}if(T&&W<0&&O&&C(),f.value===null)return;p(h.value[f.value+W]);return}p(R)}function _({draggedDistance:k}){var C;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]||Ot((C=n.value)==null?void 0:C.$el,{transform:Ht(i.value)?`translate3d(0, ${E}px, 0)`:`translate3d(${E}px, 0, 0)`})}function w(k,C){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&&C)return 0;if(E&&!C)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],M=k/Math.abs(I);return E?1-M:M}return{isLastSnapPoint:u,shouldFade:d,getPercentageDragged:w,activeSnapPointIndex:f,onRelease:v,onDrag:_,snapPointsOffset:h}}let Li=null;function cT(e){const{isOpen:t,modal:n,nested:s,hasBeenOpened:r}=e,o=L(typeof window<"u"?window.location.href:""),i=L(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),Dt(()=>{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 uT=.25,dT=100,Ug=8,Mr=16,fT=26,Vg="vaul-dragging";function hT(e,t){return e&&e.value?e:t}function pT(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=L(o.value??!1),_=L(!1),w=L(!1),k=L(!1),C=L(!1),E=L(null),O=L(null),I=L(null),M=L(null),P=L(null),q=L(!0),H=L(null),T=L(0),A=L(!1);L(0);const R=L(null);L(0);const K=te(()=>{var j;return((j=R.value)==null?void 0:j.$el.getBoundingClientRect().height)||0}),W=hT(e.snapPoints,L(void 0)),{activeSnapPointIndex:U,onRelease:J,snapPointsOffset:X,onDrag:Y,shouldFade:he,getPercentageDragged:ce}=lT({snapPoints:W,activeSnapPoint:h,drawerRef:R,fadeFromIndex:g,overlayRef:E,onSnapPointChange:ue,direction:p});function ue(j,B){W.value&&j===B.length-1&&(O.value=new Date)}const{restorePositionSetting:Te}=cT({isOpen:v,modal:c,nested:a,hasBeenOpened:_});function je(){return(window.innerWidth-fT)/window.innerWidth}function re(j,B){var ie;if(!j)return!1;let me=j;const de=(ie=window.getSelection())==null?void 0:ie.toString(),ge=R.value?Il(R.value.$el,p.value):null,pe=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&&pe.getTime()-O.value.getTime()<500)return!1;if(ge!==null&&(p.value==="bottom"?ge>0:ge<0))return!0;if(de&&de.length>0)return!1;if(P.value&&pe.getTime()-P.value.getTime()<d.value&&ge===0||B)return P.value=pe,!1;for(;me;){if(me.scrollHeight>me.clientHeight){if(me.scrollTop!==0)return P.value=new Date,!1;if(me.getAttribute("role")==="dialog")return!0}me=me.parentNode}return!0}function fe(j){!i.value&&!W.value||R.value&&!R.value.$el.contains(j.target)||(k.value=!0,I.value=new Date,j.target.setPointerCapture(j.pointerId),T.value=Ht(p.value)?j.clientY:j.clientX)}function Ce(j){var B,ie,me,de,ge,pe;if(R.value&&k.value){const Ae=p.value==="bottom"||p.value==="right"?1:-1,Ne=(T.value-(Ht(p.value)?j.clientY:j.clientX))*Ae,De=Ne>0,Ie=W.value&&!i.value&&!De;if(Ie&&U.value===0)return;const We=Math.abs(Ne),it=document.querySelector("[vaul-drawer-wrapper]");let at=We/K.value;const dt=ce(We,De);if(dt!==null&&(at=dt),Ie&&at>=1||!q.value&&!re(j.target,De))return;if((B=R==null?void 0:R.value)==null||B.$el.classList.add(Vg),q.value=!0,Ot((ie=R.value)==null?void 0:ie.$el,{transition:"none"}),Ot((me=E.value)==null?void 0:me.$el,{transition:"none"}),W.value&&Y({draggedDistance:Ne}),De&&!W.value){const Lt=aT(Ne),un=Math.min(Lt*-1,0)*Ae;Ot((de=R.value)==null?void 0:de.$el,{transform:Ht(p.value)?`translate3d(0, ${un}px, 0)`:`translate3d(${un}px, 0, 0)`});return}const Tt=1-at;if((he.value||g.value&&U.value===g.value-1)&&(t(at),Ot((ge=E.value)==null?void 0:ge.$el,{opacity:`${Tt}`,transition:"none"},!0)),it&&E.value&&u.value){const Lt=Math.min(je()+at*(1-je()),1),un=8-at*8,qt=Math.max(0,14-at*14);Ot(it,{borderRadius:`${un}px`,transform:Ht(p.value)?`scale(${Lt}) translate3d(0, ${qt}px, 0)`:`scale(${Lt}) translate3d(${qt}px, 0, 0)`,transition:"none"},!0)}if(!W.value){const Lt=We*Ae;Ot((pe=R.value)==null?void 0:pe.$el,{transform:Ht(p.value)?`translate3d(0, ${Lt}px, 0)`:`translate3d(${Lt}px, 0, 0)`})}}}function $e(){var j;if(!R.value)return;const B=document.querySelector("[vaul-drawer-wrapper]"),ie=Il(R.value.$el,p.value);Ot(R.value.$el,{transform:"translate3d(0, 0, 0)",transition:`transform ${xt.DURATION}s cubic-bezier(${xt.EASE.join(",")})`}),Ot((j=E.value)==null?void 0:j.$el,{transition:`opacity ${xt.DURATION}s cubic-bezier(${xt.EASE.join(",")})`,opacity:"1"}),u.value&&ie&&ie>0&&v.value&&Ot(B,{borderRadius:`${Ug}px`,overflow:"hidden",...Ht(p.value)?{transform:`scale(${je()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${je()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${xt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${xt.EASE.join(",")})`},!0)}function Le(){var j;R.value&&(s(),Ot(R.value.$el,{transform:Ht(p.value)?`translate3d(0, ${p.value==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${p.value==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${xt.DURATION}s cubic-bezier(${xt.EASE.join(",")})`}),Ot((j=E.value)==null?void 0:j.$el,{opacity:"0",transition:`opacity ${xt.DURATION}s cubic-bezier(${xt.EASE.join(",")})`}),Ue(!1),window.setTimeout(()=>{w.value=!1,v.value=!1},300),window.setTimeout(()=>{W.value&&(h.value=W.value[0])},xt.DURATION*1e3))}ks(()=>{if(!v.value&&u.value&&sT){const j=setTimeout(()=>{El(document.body)},200);return()=>clearTimeout(j)}}),Dt(()=>{Ue(!1),Te()});function Be(j){if(!k.value||!R.value)return;R.value.$el.classList.remove(Vg),q.value=!1,k.value=!1,M.value=new Date;const B=Il(R.value.$el,p.value);if(!re(j.target,!1)||!B||Number.isNaN(B)||I.value===null)return;const ie=M.value.getTime()-I.value.getTime(),me=T.value-(Ht(p.value)?j.clientY:j.clientX),de=Math.abs(me)/ie;if(de>.05&&(C.value=!0,window.setTimeout(()=>{C.value=!1},200)),W.value){const pe=p.value==="bottom"||p.value==="right"?1:-1;J({draggedDistance:me*pe,closeDrawer:Le,velocity:de,dismissible:i.value}),n(!0);return}if(p.value==="bottom"||p.value==="right"?me>0:me<0){$e(),n(!0);return}if(de>Bg){Le(),n(!1);return}const ge=Math.min(R.value.$el.getBoundingClientRect().height??0,window.innerHeight);if(B>=ge*f.value){Le(),n(!1);return}n(!0),$e()}Pe(v,j=>{j&&(O.value=new Date,Ue(!0)),r(j)},{immediate:!0}),Pe(o,j=>{j?(v.value=j,_.value=!0):Le()},{immediate:!0});function Ue(j){const B=document.querySelector("[vaul-drawer-wrapper]");!B||!u.value||(j?(Ot(document.body,{background:document.body.style.backgroundColor||document.body.style.background}),Ot(document.body,{background:"black"},!0),Ot(B,{borderRadius:`${Ug}px`,overflow:"hidden",...Ht(p.value)?{transform:`scale(${je()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${je()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${xt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${xt.EASE.join(",")})`})):(El(B,"overflow"),El(B,"transform"),El(B,"borderRadius"),Ot(B,{transitionProperty:"transform, border-radius",transitionDuration:`${xt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${xt.EASE.join(",")})`})))}function N(j){var B,ie;const me=j?(window.innerWidth-Mr)/window.innerWidth:1,de=j?-Mr:0;H.value&&window.clearTimeout(H.value),Ot((B=R.value)==null?void 0:B.$el,{transition:`transform ${xt.DURATION}s cubic-bezier(${xt.EASE.join(",")})`,transform:`scale(${me}) translate3d(0, ${de}px, 0)`}),!j&&(ie=R.value)!=null&&ie.$el&&(H.value=window.setTimeout(()=>{var ge,pe;const Ae=Il((ge=R.value)==null?void 0:ge.$el,p.value);Ot((pe=R.value)==null?void 0:pe.$el,{transition:"none",transform:Ht(p.value)?`translate3d(0, ${Ae}px, 0)`:`translate3d(${Ae}px, 0, 0)`})},500))}function ee(j){var B;if(j<0)return;const ie=Ht(p.value)?window.innerHeight:window.innerWidth,me=(ie-Mr)/ie,de=me+j*(1-me),ge=-Mr+j*Mr;Ot((B=R.value)==null?void 0:B.$el,{transform:Ht(p.value)?`scale(${de}) translate3d(0, ${ge}px, 0)`:`scale(${de}) translate3d(${ge}px, 0, 0)`,transition:"none"})}function Q(j){var B;const ie=Ht(p.value)?window.innerHeight:window.innerWidth,me=j?(ie-Mr)/ie:1,de=j?-Mr:0;j&&Ot((B=R.value)==null?void 0:B.$el,{transition:`transform ${xt.DURATION}s cubic-bezier(${xt.EASE.join(",")})`,transform:Ht(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:R,drawerHeightRef:K,overlayRef:E,isDragging:k,dragStartTime:I,isAllowedToDrag:q,snapPoints:W,activeSnapPoint:h,pointerStart:T,dismissible:i,snapPointsOffset:X,direction:p,shouldFade:he,fadeFromIndex:g,shouldScaleBackground:u,onPress:fe,onDrag:Ce,onRelease:Be,closeDrawer:Le,onNestedDrag:ee,onNestedRelease:Q,onNestedOpenChange:N,emitClose:s,emitDrag:t,emitRelease:n,emitOpenChange:r,nested:a}}const yo=Yt({__name:"DrawerRoot",props:{activeSnapPoint:{default:void 0},closeThreshold:{default:uT},shouldScaleBackground:{type:Boolean,default:void 0},scrollLockTimeout:{default:dT},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;Wf();const o=te(()=>s.fadeFromIndex??(s.snapPoints&&s.snapPoints.length-1)),i=Fg(s,"open",r,{defaultValue:s.defaultOpen,passive:s.open===void 0}),a=Fg(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)},xt.DURATION*1e3)}},{closeDrawer:u,hasBeenOpened:d,modal:f,isOpen:h}=iT(pT({...c,...It(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(j3),{open:y(h),modal:y(f),"onUpdate:open":g},{default:xe(()=>[Pt(p.$slots,"default",{open:y(h)})]),_:3},8,["open","modal"]))}}),hd=Yt({__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}=qg();function a(){o(!1)}function c(f){r(f)}function u(f){f&&o(f),s("update:open",f)}const d=C3(n,s);return(f,h)=>(m(),oe(yo,kn(y(d),{nested:"",onClose:a,onDrag:c,onRelease:y(i),"onUpdate:open":u}),{default:xe(()=>[Pt(f.$slots,"default")]),_:3},16,["onRelease"]))}}),sr=Yt({__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}=qg(),v=te(()=>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(tT),{ref_key:"drawerRef",ref:o,"vaul-drawer":"","vaul-drawer-direction":y(p),"vaul-drawer-visible":y(s)?"true":"false",style:mt({"--snap-point-height":v.value}),onPointerdown:y(i),onPointermove:y(a),onPointerup:y(c),onPointerDownOutside:_,onEscapeKeyDown:k[0]||(k[0]=C=>{y(f)||C.preventDefault()})},{default:xe(()=>[Pt(w.$slots,"default")]),_:3},8,["vaul-drawer-direction","vaul-drawer-visible","style","onPointerdown","onPointermove","onPointerup"]))}}),mT={class:"drawer-form",tabindex:"-1"},gT={class:"relative pt-[40px] bg-white rounded-t-2xl overflow-hidden"},vT=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),Hg={__name:"FormDrawer",props:Kr(["target"],{open:{},openModifiers:{},success:{},successModifiers:{}}),emits:["update:open","update:success"],setup(e){const t=Wf(),n=dr(e,"open"),s=dr(e,"success"),r=L(!1),o=async i=>{await wt(),r.value=!i};return(i,a)=>(m(),x("div",mT,[G(y(yo),{open:n.value,modal:!1,"should-scale-background":!1,"onUpdate:open":o},{default:xe(()=>[G(y(tr),{to:e.target},{default:xe(()=>[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(sr),{"aria-describedby":"dialog-description",class:"absolute inset-x-0 bottom-0 z-50 w-full outline-none border-none",tabindex:"-1"},{default:xe(()=>[G(y(Tl),{class:"sr-only"},{default:xe(()=>[Ge("DrawerTitle")]),_:1}),G(y(Al),{class:"sr-only"},{default:xe(()=>[Ge("DrawerDescription")]),_:1}),Pt(i.$slots,"fields")]),_:3})]),_:3},8,["to"])]),_:3},8,["open"]),y(t).success&&r.value?(m(),oe(y(yo),{key:0,modal:!1,"should-scale-background":!1,open:s.value},{default:xe(()=>[G(y(tr),{to:e.target},{default:xe(()=>[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(sr),{class:"absolute inset-x-0 bottom-0 z-50 w-full outline-none border-none",tabindex:"-1"},{default:xe(()=>[G(y(Tl),{class:"sr-only"},{default:xe(()=>[Ge("DrawerTitle")]),_:1}),G(y(Al),{class:"sr-only"},{default:xe(()=>[Ge("DrawerDescription")]),_:1}),l("div",gT,[vT,Pt(i.$slots,"success")])]),_:3})]),_:3},8,["to"])]),_:3},8,["open"])):z("",!0)]))}},yT={tabindex:"-1",class:"relative pb-4 pt-3 bg-white rounded-t-2xl overflow-hidden"},bT=l("div",{class:"flex justify-center"},[l("div",{tabindex:"-1",class:"w-10 h-[4px] rounded-full bg-gray-500 cursor-grab"})],-1),_T={key:0,class:"py-2 relative"},xT={class:"font-medium text-[18px] text-center tracking-wide text-gray-900"},wT={class:"px-5"},kT={class:"flex items-center space-x-3"},ST=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),CT={class:"pb-6 pt-2"},$T={class:"text-[32px] flex items-center justify-center rounded-full"},TT=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),AT={__name:"FormContact",props:{form:{type:Object},message:{type:Object},chatViewRef:{type:Object}},setup(e){const{widgets:t}=Zs(),{getStorage:n}=Ks();L([]);const s=L(!1),r=async()=>{if(s.value)return;s.value=!0;const o=n("easychatgpt_conversations",V.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&&(V.isOpenFormContact=!1,V.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(Hg,{target:e.chatViewRef,open:y(V).isOpenFormContact,"onUpdate:open":i[3]||(i[3]=a=>y(V).isOpenFormContact=a),success:y(V).isSuccessFormContact,"onUpdate:success":i[4]||(i[4]=a=>y(V).isSuccessFormContact=a)},{fields:xe(()=>{var a;return[l("div",yT,[bT,(a=y(t).contact)!=null&&a.name?(m(),x("div",_T,[l("div",xT,D(y(t).contact.name),1)])):z("",!0),l("div",wT,[l("form",{onSubmit:i[1]||(i[1]=Qt(c=>r(),["prevent"])),class:"space-y-4",tabindex:"-1"},[(m(!0),x(be,null,Me(y(t).contact.fields,(c,u)=>(m(),oe(od,{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",kT,[l("button",{onClick:i[0]||(i[0]=c=>y(V).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 "),ST])],32)])])]}),success:xe(()=>[l("div",null,[l("div",CT,[l("div",$T,[G(y(Wu),{"stroke-width":"1",size:"50",class:"text-gray-500"})]),TT]),l("button",{onClick:i[2]||(i[2]=a=>y(V).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=V.bot)==null?void 0:s.config.apiHost)||V.apiDomain;return{update:async({formData:r,status:o})=>{var u;const i=e("easychatgpt_conversations",V.handle),a=V.forms&&V.forms.order&&V.forms.order.id;if(!a||!i)throw new Error("Missing data: formId or conversationId is required");let{submission_data:c}=await kt.post(`${t}/api/bots/${V.handle}/widgets/${a}/submission`,{status:o,conversation_id:i,submission_data:r}).then(d=>d.data);return c?(V.handle!==$s&&(V.isOpenForm=!0),V.selectedForm=c,(!c.items||((u=c.items)==null?void 0:u.length)===0)&&(V.isOpenForm=!1,V.totalFormItems=0),localStorage.setItem(V.localStorageFormOrder,JSON.stringify(c)),{success:!0,data:c}):{success:!1,data:null}}}}const Wg=e=>(gn("data-v-cf69952f"),e=e(),vn(),e),ET={class:"ecg-quantity"},IT=["disabled"],PT=[Wg(()=>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))],MT=["min","max","step","disabled"],OT=["disabled"],LT=[Wg(()=>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))],Gg=Qe({__name:"FieldQuantity",props:Kr({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=dr(e,"modelValue"),a=L(null),c=te(()=>t(i.value)||i.value<o.max),u=te(()=>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",ET,[l("button",{type:"button",class:"ecg-quantity__button ecg-quantity__button--minus",disabled:e.disabled||!u.value,onClick:Qt(d,["prevent"])},PT,8,IT),Rt(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,MT),[[on,i.value]]),l("button",{type:"button",class:"ecg-quantity__button ecg-quantity__button--plus",disabled:e.disabled||!c.value,onClick:Qt(f,["prevent"])},LT,8,OT)]))}},[["__scopeId","data-v-cf69952f"]]),RT={class:"flex space-x-2 w-full"},DT=["src","alt"],jT=["src","alt"],NT={class:"flex-1"},FT={class:"flex"},qT={class:"flex-1 mr-1 text-gray-900 text-sm font-medium line-clamp-2"},zT={class:"text-sm font-ligh text-red-500 font-medium"},BT={__name:"CardProductOrder",props:["item"],setup(e){const t=e,n=My(),s=L(!1),r=te(()=>{var d;return((d=V.bot)==null?void 0:d.config.ui.logo)||V.appDomain+"/link.png"}),o=L(t.item.quantity),i=te(()=>Number(t.item.price)*o.value),a=async d=>{let f=V.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=V.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=L(null);return Pe(o,d=>{clearTimeout(u.value),a(Number(d))}),(d,f)=>(m(),x("div",RT,[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,DT)):(m(),x("img",{key:1,src:r.value,alt:e.item.title,class:"max-w-[24px] w-full h-full object-contain"},null,8,jT))],2),l("div",NT,[l("div",FT,[l("h3",qT,D(e.item.title),1)]),l("div",null,[l("div",zT,D(y(tt)(i.value)),1),G(Gg,{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(ug),{size:"16"})])])]))}},UT={},VT={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"},HT=[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 WT(e,t){return m(),x("svg",VT,HT)}const GT=Qe(UT,[["render",WT]]);function KT(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 Kg(e,t){let n={};for(const s of Object.entries(e))Qg(s[1],t[s[0]])||(n[s[0]]="");return n}function Qg(e,t){if(t===void 0)return!0;let n=!0;for(const s of t.split("|"))if(!KT(e,s)){n=!1;break}return n}const QT={class:"ecg-form-wrapper"},JT=["type"],XT=["type"],ZT=["value"],YT=["value"],e4={key:3,class:"flex items-center space-x-4"},t4={class:"ecg-form-radio"},n4=["id","name","value"],s4=l("div",{class:"checkmark"},null,-1),r4=["for"],o4={key:4,class:"text-xs text-red-500 pl-1 absolute left-0 bottom-0 translate-y-full"},is={__name:"FormField",props:Kr({field:{type:Object,required:!0},classField:{type:[String,Boolean]}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=e,n=dr(e,"modelValue"),s=L(""),r=te(()=>{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=Qg(o,t.field.validate);s.value=a===!0?"":i}),(o,i)=>(m(),x("div",QT,[e.field.type==="tel"||e.field.type==="text"||e.field.type==="email"||e.field.type==="number"?Rt((m(),x("input",kn({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,JT)),[[D1,n.value]]):e.field.type==="textarea"?Rt((m(),x("textarea",kn({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,XT)),[[on,n.value]]):e.field.type==="select"?Rt((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:""},D(e.field.label),9,ZT),(m(!0),x(be,null,Me(e.field.options,a=>(m(),x("option",{value:e.field.keyValue?a[e.field.keyValue]:a},D(e.field.keyLabel?a[e.field.keyLabel]:a),9,YT))),256))],2)),[[Fh,n.value]]):e.field.type==="checkbox"?(m(),x("div",e4,[(m(!0),x(be,null,Me(e.field.options,(a,c)=>(m(),x("div",t4,[Rt(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,n4),[[Nh,n.value]]),s4,l("label",{for:`${e.field.name}-${c}`},D(a),9,r4)]))),256))])):z("",!0),s.value?(m(),x("div",o4,D(s.value),1)):z("",!0)]))}},i4={tabindex:"-1",class:"relative pb-4 pt-3 bg-white rounded-t-2xl overflow-hidden outline-none"},a4=l("div",{class:"flex justify-center"},[l("div",{tabindex:"-1",class:"w-10 h-[4px] rounded-full bg-gray-500 cursor-grab"})],-1),l4={class:"pt-2 pb-3 relative"},c4=l("div",{class:"h-[0.5px] w-full bg-gray-100 absolute bottom-0 inset-x-0"},null,-1),u4={class:"px-5 pt-5"},d4={key:0},f4={class:"flex items-center space-x-2"},h4={class:"flex items-center space-x-2"},p4=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),m4={key:1},g4={class:"max-h-[208px] overflow-y-auto"},v4={class:"mt-5"},y4={key:0,"aria-label":"add-information",class:"py-0.5 flex items-center justify-center"},b4=l("div",{class:"font-medium text-sm text-gray-500 ml-1"}," Thêm địa chỉ ",-1),_4={key:1,class:"flex items-start justify-between"},x4={class:"text-sm text-gray-500 line-clamp-2"},w4={"aria-label":"edit-info"},k4={class:"mt-5 px-1"},S4={class:"flex items-center justify-between"},C4={class:"text-gray-500 mr-2 text-sm"},$4={class:"text-right text-[16px] font-medium"},T4={class:"text-red-500 text-sm"},A4={class:"bg-white z-20 mt-4"},E4=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),I4={class:"pb-6 pt-2"},P4={class:"text-[32px] flex items-center justify-center rounded-full"},M4=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),O4={__name:"FormOrder",props:{chatViewRef:{type:Object}},emits:["send-message"],setup(e,{emit:t}){var g;const n=t,s=((g=V.bot)==null?void 0:g.config.apiHost)||V.apiDomain,r=L(!1),o=L(null),i=te(()=>{var p,v;return!!((v=(p=V.forms)==null?void 0:p.order)!=null&&v.fields.find(_=>_.name==="gender"||_.label==="Danh xưng"))});Pe(()=>V.forms.order,p=>{p&&V.forms.order.fields.forEach(v=>{v.value=""})}),Pe(()=>V.isOpenForm,p=>{p&&(r.value=!1)});const a=te(()=>{const{gender:p,full_name:v,phone:_,email:w,address:k}=V.selectedForm;return[p?p+" "+v:v,_,w,k].filter(E=>!!E).join(" | ")}),c=te(()=>{var v;let p=!1;return V.selectedForm?((v=V.forms.order)==null||v.fields.forEach(_=>{V.selectedForm[_.name]&&(p=!0)}),!p):!1}),u=te(()=>{var v,_;let p=0;return(_=(v=V.selectedForm)==null?void 0:v.items)==null||_.forEach(w=>{p=p+Number(w.price)*w.quantity}),p}),d=async p=>{await wt();const v=p.offsetHeight;o.value.style.height=v?`${v}px`:"auto"},f=async()=>{var w,k;const p=ro(V.handle);if(!p)return;let v=JSON.parse(localStorage.getItem(V.localStorageFormOrder));v={submission_data:{items:v.items||[]},status:"draft",conversation_id:p},(k=(w=V.forms)==null?void 0:w.order)==null||k.fields.forEach(C=>{v.submission_data[C.name]=C.value});const{submission_data:_}=await kt.post(`${s}/api/bots/${V.handle}/widgets/${V.forms.order.id}/submission`,v).then(C=>C.data);_&&(localStorage.setItem(V.localStorageFormOrder,JSON.stringify(_)),V.selectedForm=_,r.value=!1)},h=async()=>{var k,C,E,O,I;const p=ro(V.handle);if(!p)return;let v=JSON.parse(localStorage.getItem(V.localStorageFormOrder));if(v={status:"submitted",conversation_id:p,submission_data:{...v}},await kt.post(`${s}/api/bots/${V.handle}/widgets/${(k=V.forms.order)==null?void 0:k.id}/submission`,v).then(M=>M.data)){console.log("formData",v);const{title:M,full_name:P,phone:q,email:H,address:T,items:A}=v.submission_data,R=P||"";if(V.handle===$s){const K=hw({name:R,phone:q||"",email:H||"",address:T||"",items:A||[],shopName:((C=V.bot)==null?void 0:C.name)||((I=(O=(E=V.bot)==null?void 0:E.config)==null?void 0:O.ui)==null?void 0:I.title)||""});n("send-message",K)}if(localStorage.removeItem(V.localStorageFormOrder),V.selectedForm=null,V.isOpenForm=!1,V.isSuccessForm=!0,V.totalFormItems=0,V.forms.order.fields)for(var w in V.forms.order.fields)V.forms.order.fields[w].value=""}};return(p,v)=>(m(),oe(Hg,{target:e.chatViewRef,open:y(V).isOpenForm,"onUpdate:open":v[7]||(v[7]=_=>y(V).isOpenForm=_),success:y(V).isSuccessForm,"onUpdate:success":v[8]||(v[8]=_=>y(V).isSuccessForm=_)},{fields:xe(()=>[l("div",i4,[a4,l("div",l4,[G(en,{appear:"",mode:"out-in",name:"scale-fade"},{default:xe(()=>[(m(),x("div",{key:r.value,class:"font-medium text-[18px] text-center tracking-wide text-gray-900"},D(r.value?"Thông tin khách hàng":"Giỏ hàng"),1))]),_:1}),c4]),l("div",u4,[l("div",{class:"duration-300",ref_key:"contentFormRef",ref:o},[G(en,{appear:"",name:"scale-fade",mode:"out-in",onBeforeEnter:d,onBeforeLeave:d},{default:xe(()=>{var _,w,k;return[(m(),x("div",{key:r.value},[r.value?(m(),x("div",d4,[l("form",{onSubmit:v[3]||(v[3]=Qt(C=>f(),["prevent"])),class:"space-y-[18px]"},[i.value?(m(),x(be,{key:0},[l("div",f4,[G(is,{classField:"form-field-custom",field:y(V).forms.order.fields[0],modelValue:y(V).forms.order.fields[0].value,"onUpdate:modelValue":v[0]||(v[0]=C=>y(V).forms.order.fields[0].value=C)},null,8,["field","modelValue"]),G(is,{class:"flex-1",field:y(V).forms.order.fields[1],modelValue:y(V).forms.order.fields[1].value,"onUpdate:modelValue":v[1]||(v[1]=C=>y(V).forms.order.fields[1].value=C)},null,8,["field","modelValue"])]),(m(!0),x(be,null,Me(y(V).forms.order.fields,(C,E)=>(m(),x("div",null,[E>1?(m(),oe(is,{field:C,key:E,modelValue:C.value,"onUpdate:modelValue":O=>C.value=O},null,8,["field","modelValue","onUpdate:modelValue"])):z("",!0)]))),256))],64)):(m(!0),x(be,{key:1},Me(y(V).forms.order.fields,(C,E)=>(m(),oe(is,{field:C,key:E,modelValue:C.value,"onUpdate:modelValue":O=>C.value=O},null,8,["field","modelValue","onUpdate:modelValue"]))),128)),l("div",h4,[l("button",{type:"button",onClick:v[2]||(v[2]=C=>[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 "),p4])],32)])):(m(),x("div",m4,[l("div",g4,[(m(),x("div",{class:"space-y-5",key:(w=(_=y(V).selectedForm)==null?void 0:_.items)==null?void 0:w.length},[(m(!0),x(be,null,Me(((k=y(V).selectedForm)==null?void 0:k.items)||[],(C,E)=>(m(),oe(BT,{key:E,item:C,contentFormRef:o.value},null,8,["item","contentFormRef"]))),128))]))]),l("div",v4,[l("div",{onClick:v[4]||(v[4]=C=>r.value=!0),class:"relative p-3 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-50 duration-100"},[c.value||!y(V).selectedForm?(m(),x("div",y4,[G(y(D2),{size:"16",class:"text-gray-500"}),b4])):(m(),x("div",_4,[l("div",x4,D(a.value),1),l("button",w4,[G(GT)])]))])]),l("div",k4,[l("div",S4,[l("div",C4," Giá tham khảo ("+D(y(V).totalFormItems)+" sản phẩm) ",1),l("div",$4,[l("div",T4,D(y(tt)(u.value)),1)])])]),l("div",A4,[l("div",null,[l("button",{onClick:v[5]||(v[5]=C=>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)]),E4])]))]))]}),_:1})],512)])])]),success:xe(()=>[l("div",null,[l("div",I4,[l("div",P4,[G(y(cn),{"stroke-width":"1",size:"50",class:"text-gray-500"})]),M4]),l("button",{onClick:v[6]||(v[6]=_=>y(V).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"]))}},Jg={__name:"Drawer",props:Kr({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=dr(e,"open"),s=L(0),r=L(0),o=L(0),i=L(""),a=L(null);Pe(()=>t.isNestedOpen,g=>{g||(a.value.$el.style.transform="unset")});const c=te(()=>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(yo),{open:n.value,"onUpdate:open":p[1]||(p[1]=v=>n.value=v),modal:!1,"should-scale-background":!1},{default:xe(()=>[G(y(tr),{to:e.chatViewRef},{default:xe(()=>[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(sr),{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:xe(()=>[G(y(Tl),{class:"sr-only"},{default:xe(()=>[Ge("DrawerTitle")]),_:1}),G(y(Al),{class:"sr-only"},{default:xe(()=>[Ge("DrawerDescription")]),_:1}),l("div",{ref_key:"drawerContentRef",ref:i,class:"content-drawer"},[G(en,{onBeforeEnter:u,onEnter:d,onAfterEnter:f,onLeave:h,mode:"out-in",name:"scale-fade"},{default:xe(()=>[(m(),x("div",{key:s.value},[(m(!0),x(be,null,Me(e.slotNames,(v,_)=>(m(),x(be,{key:_+v.active},[v.active?Pt(g.$slots,v.name,{key:0}):z("",!0)],64))),128))]))]),_:3})],512)]),_:3},512)]),_:3},8,["to"])]),_:3},8,["open"]))}},L4=[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)],nn={__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"},L4,2))}},R4={class:"flex space-x-3 w-full"},D4={class:"w-[96px] h-[96px] flex-shrink-0 rounded-md overflow-hidden border border-gray-100 flex items-center justify-center"},j4=["src"],N4=["src","alt"],F4={class:"flex-1"},q4={class:"flex flex-1 mr-1 mb-1 w-full text-sm font-medium text-gray-900"},z4={key:0,class:"px-2 py-0.5 mb-1 text-xs text-gray-500 bg-gray-50 rounded w-fit"},B4={class:"flex items-center space-x-1"},U4={class:"text-sm font-semibold text-red-500"},V4={key:0,class:"text-xs text-gray-500"},H4={__name:"CardOrder",props:["item"],setup(e){var u,d;const t=e,n=L(!1),s=((d=(u=V.bot)==null?void 0:u.config)==null?void 0:d.ui.logo)||`${V.appDomain}/link.png`,r=L(null),o=L(t.item.quantity),i=L(!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&&(V.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&&(V.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",R4,[l("div",D4,[n.value?(m(),x("img",{key:0,src:y(s),alt:"image error",class:"w-[32px] h-[32px] object-cover"},null,8,j4)):(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,N4))]),l("div",F4,[l("h3",q4,D(e.item.name),1),(g=e.item.properties)!=null&&g.title?(m(),x("div",z4,D(e.item.properties.title),1)):z("",!0),l("div",null,[l("div",B4,[l("div",U4,D(y(tt)(e.item.price)),1),e.item.compare_at_price>e.item.price?(m(),x("del",V4,D(y(tt)(e.item.compare_at_price)),1)):z("",!0)]),G(Gg,{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(nn,{key:0,class:"max-w-[16px] h-[16px] !text-red-500"})):(m(),oe(y(ug),{key:1,size:"16"}))],2)])])}}},W4={},G4={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"},K4=[l("path",{d:"m15 18-6-6 6-6"},null,-1)];function Q4(e,t){return m(),x("svg",G4,K4)}const Xg=Qe(W4,[["render",Q4]]),J4={},X4={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"},Z4=[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 Y4(e,t){return m(),x("svg",X4,Z4)}const Ml=Qe(J4,[["render",Y4]]),e6=e=>(gn("data-v-61c5fc1a"),e=e(),vn(),e),t6={class:"relative pb-4 pt-5 bg-white rounded-t-2xl overflow-hidden outline-none"},n6={class:"relative text-center mb-4"},s6={class:"font-semibold text-gray-900 text-lg"},r6=["placeholder"],o6={key:0,class:"text-red-500 flex items-center mt-2 space-x-1"},i6={class:"text-xs"},a6={class:"text-sm text-gray-900"},l6={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"},c6={key:0,class:"absolute left-1/2 -translate-x-1/2 top-1/3"},u6={class:"px-5 py-4 bg-red-50 rounded-xl relative fade-in"},d6={class:"text-center text-sm font-medium text-red-500"},f6=[e6(()=>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))],Zg=Qe({__name:"AuthLogin",emits:["success","error"],setup(e,{emit:t}){const{t:n}=tn(),s=t,r=ht({identifier:"",type:"phone"}),o={identifier:"required|phone"},i=L(!1),a=L(!1),c=L(null),u=L(null);Pe(()=>r.identifier,f=>{f&&(i.value=!1,u.value=null,c.value=null)});const d=async()=>{var f,h;try{const g=Kg(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",t6,[l("div",n6,[l("div",s6,D(y(n)("auth.login")),1)]),l("form",{onSubmit:h[1]||(h[1]=Qt(g=>d(),["prevent"])),class:"px-6 space-y-4"},[l("div",null,[Rt(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,r6),[[on,r.identifier]]),i.value?(m(),x("div",o6,[G(Ml),l("div",i6,D(u.value??y(n)("auth.requiredField")),1)])):z("",!0)]),l("p",a6,D(y(n)("auth.otpHint")),1),l("button",l6,[a.value?(m(),oe(nn,{key:0,class:"mr-1 w-4 h-4"})):z("",!0),l("div",null,D(y(n)("auth.continue")),1)])],32),c.value?(m(),x("div",c6,[l("div",u6,[l("div",d6,[l("div",null,D(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"},f6)])])):z("",!0)]))}},[["__scopeId","data-v-61c5fc1a"]]),pd=e=>(gn("data-v-ca9c6389"),e=e(),vn(),e),h6={class:"relative pb-4 pt-4 bg-white rounded-t-2xl overflow-hidden outline-none"},p6=pd(()=>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)),m6={class:"px-6 space-y-4"},g6={class:"text-sm text-gray-900"},v6=pd(()=>l("br",null,null,-1)),y6={key:0,class:"ecg-fieldset-error text-red-500 flex items-center mt-2 space-x-1"},b6={class:"text-xs font-medium"},_6={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"},x6=pd(()=>l("div",null,"Xác minh",-1)),Yg=Qe({__name:"AuthVerifyOtp",props:["identifier"],emits:["success","error"],setup(e,{emit:t}){const n=e,s=t,r=ht({identifier:n.identifier,code:""}),o=L(!1),i=L(!1),a=L(null);L(null),L(null);const c=async()=>{var d,f;try{const{data:h}=await Xe.auth.getUser();h.success&&(V.user=h.data)}catch(h){((f=(d=h.response.data)==null?void 0:d.raw)==null?void 0:f.message)==="error_token_is_expired"&&(V.user=null,V.token=null,$t.remove(ns))}},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&&($t.set(ns,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",h6,[p6,l("div",m6,[l("div",null,[l("p",g6,[Ge(" Nhập mã xác minh gồm 6 số vừa được gửi đến "),v6,Ge(" SĐT "),l("strong",null,D(r.identifier),1),Ge(" của bạn. ")])]),l("div",null,[l("form",{onSubmit:f[1]||(f[1]=Qt(h=>u(),["prevent"])),id:"ecg-form-verify-otp"},[Rt(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),[[on,r.code]])],32),o.value?(m(),x("div",y6,[G(Ml),l("div",b6,D(a.value),1)])):z("",!0)]),l("button",_6,[i.value?(m(),oe(nn,{key:0,class:"mr-1 w-4 h-4"})):z("",!0),x6])])]))}},[["__scopeId","data-v-ca9c6389"]]),w6={},k6={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"},S6=[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 C6(e,t){return m(),x("svg",k6,S6)}const Ol=Qe(w6,[["render",C6]]),$6={},T6={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},A6=[l("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)];function E6(e,t){return m(),x("svg",T6,A6)}const bo=Qe($6,[["render",E6]]),I6={class:"flex items-center rounded h-[110px] w-full"},P6=["src","alt"],M6={key:2,class:"absolute inset-0 bg-primary opacity-10"},O6={key:0,class:"absolute inset-0 bg-primary opacity-10"},L6={class:"flex flex-col relative z-10 h-full"},R6={class:"flex items-start"},D6={class:"font-medium text-sm text-gray-900 flex-1"},j6={class:"mt-auto flex md:items-center md:flex-row flex-col md:space-y-0 space-y-1"},N6={class:"text-xs text-gray-500 tracking-tight"},F6={__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",I6,[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,P6)):(m(),oe(Ol,{key:1,class:"text-gray-500 scale-125 relative z-10"})),e.isActive?(m(),x("div",M6)):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",O6)):z("",!0),l("div",L6,[l("div",R6,[l("div",D6,D(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",j6,[l("div",N6," HSD: "+D(e.coupon.started_at)+"-"+D(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(nn,{key:0,class:"w-3 mr-1"})):z("",!0),Ge(" "+D(e.isActive?"Bỏ chọn":"Áp dụng"),1)])])])],2)]))}},q6={},z6={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"},B6=[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 U6(e,t){return m(),x("svg",z6,B6)}const V6=Qe(q6,[["render",U6]]);function H6(e=2e3){const t=L(!1),n=L(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 Xn(()=>{n.value&&clearTimeout(n.value)}),{copied:t,copy:s}}const W6={class:"flex flex-col bg-white rounded-t-3xl h-full pt-5"},G6=l("div",{class:"w-[38px] h-[6px] rounded-full bg-gray-400 cursor-grab mx-auto mb-5"},null,-1),K6={class:"font-semibold text-gray-900 text-xl text-center px-4 mb-6"},Q6={class:"relative group"},J6={class:"flex items-center text-sm px-4 py-3 bg-gray-50 relative z-10"},X6=l("div",{class:"w-[33%] text-gray-500"},"Mã",-1),Z6={class:"flex-1 flex items-center"},Y6={class:"text-gray-700 mr-2"},eA=[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)],tA={class:"flex text-sm px-4 py-3 bg-white"},nA=l("div",{class:"w-[33%] text-gray-500"},"Hạn sử dụng",-1),sA={class:"flex-1 text-gray-700"},rA={class:"px-4 py-3 bg-gray-50"},oA=l("div",{class:"text-sm mb-3 text-gray-500"},"Điều kiện",-1),iA=["innerHTML"],aA={class:"py-3 px-4 bg-white"},lA={__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}=H6();return(o,i)=>(m(),x("div",W6,[G6,l("div",K6,D(e.coupon.title),1),l("div",Q6,[l("div",J6,[X6,l("div",Z6,[l("div",Y6,D(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(V6)])])]),l("div",{class:ne([y(s)?"translate-y-full ":"translate-y-0","absolute left-1/2 -translate-x-1/2 bottom-0 duration-200"])},eA,2)]),l("div",tA,[nA,l("div",sA,D(e.coupon.started_at)+" - "+D(e.coupon.ended_at),1)]),l("div",rA,[oA,l("div",{class:"max-h-[132px] overflow-y-auto prose coupon-detail-desc",innerHTML:e.coupon.description},null,8,iA)]),l("div",aA,[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"},D(e.active?"Bỏ chọn":"Áp dụng"),1)])]))}},cA={class:"flex space-x-2 w-full"},uA={class:"w-[86px] h-[86px] flex-shrink-0 rounded-xl overflow-hidden border border-gray-100 flex items-center justify-center"},dA=["src"],fA=["src","alt"],hA={class:"flex-1"},pA={class:"text-gray-700 font-medium text-sm line-clamp-2 mb-2"},mA={class:"flex items-center space-x-4"},gA={class:"text-sm text-red-500 font-medium"},vA={key:0,class:"text-sm text-gray-500 0 font-light ml-2"},yA={class:"text-sm text-gray-500 ml-auto"},Ll={__name:"CardProductCheckout",props:["item"],setup(e){var s,r;const t=((r=(s=V.bot)==null?void 0:s.config)==null?void 0:r.ui.logo)||`${V.appDomain}/link.png`,n=L(!1);return(o,i)=>(m(),x("div",cA,[l("div",uA,[n.value?(m(),x("img",{key:0,src:y(t),alt:"image error",class:"w-[28px] h-[28px]"},null,8,dA)):(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,fA))]),l("div",hA,[l("h3",pA,D(e.item.name),1),l("div",mA,[l("div",null,[l("span",gA,D(y(tt)(Number(e.item.price))),1),e.item.compare_at_price>e.item.price?(m(),x("del",vA,D(y(tt)(Number(e.item.compare_at_price))),1)):z("",!0)]),l("div",yA," x"+D(e.item.quantity),1)])])]))}},bA={class:"flex items-center rounded h-[60px]"},_A=["src","alt"],xA={key:2,class:"absolute inset-0 bg-primary opacity-10"},wA={key:0,class:"absolute inset-0 bg-primary opacity-10"},kA={class:"flex items-center relative"},SA={class:"font-medium text-sm text-gray-900 flex-1 line-clamp-1"},CA={__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",bA,[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,_A)):(m(),oe(Ol,{key:1,class:"text-primary scale-125 relative z-10 w-4"})),e.isActive?(m(),x("div",xA)):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",wA)):z("",!0),l("div",kA,[l("div",SA,D(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(nn,{key:0,class:"w-3 mr-1"})):z("",!0),Ge(" Bỏ chọn ")])])],2)]))}},$A={class:"py-4"},TA={class:"mb-2 space-y-3"},AA=l("div",{class:"w-[36px] h-[6px] rounded-full bg-gray-500 cursor-grab mx-auto"},null,-1),EA={key:0,class:"font-medium text-xl text-center text-gray-900"},IA={key:0,class:"px-5"},PA={class:"max-h-[320px] pt-4 overflow-y-auto scroll-hidden relative"},MA={class:"space-y-5"},OA={class:"pt-3 px-1"},LA={class:"flex items-center justify-between"},RA={class:"text-gray-500 mr-2 text-sm"},DA={class:"text-right text-base"},jA={class:"text-gray-900 text-sm"},NA={key:0,class:"flex items-center justify-between"},FA=l("div",{class:"text-gray-500 mr-2 text-sm"}," Khuyến mãi ",-1),qA={class:"text-right text-base"},zA={class:"text-green-500 text-sm"},BA={class:"flex items-center justify-between mt-2"},UA=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),VA={class:"text-right text-[16px] font-medium"},HA={class:"text-red-500 text-sm"},WA={class:"bg-white z-20 mt-4"},GA={key:1,class:"px-5 pt-4"},KA=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),QA=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),JA={class:"px-6 space-y-4 max-h-[520px] overflow-y-scroll scroll-hidden"},XA={key:0,class:"border border-gray-200 rounded-xl"},ZA={class:"flex items-center justify-between px-3 py-2 border-b"},YA=l("div",{class:"font-semibold text-gray-700"}," Thông tin người nhận ",-1),e8={class:"px-3 py-4"},t8={class:"space-y-1"},n8={class:"text-sm text-gray-700 font-medium"},s8={key:0,class:"text-sm text-gray-700 font-medium"},r8={class:"text-sm text-gray-700"},o8=[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)],i8={class:"w-full"},a8=l("label",{for:"order-email",class:"block text-sm font-medium text-gray-700 mb-1 pl-1"}," Email ",-1),l8={class:"w-full"},c8=l("label",{for:"order-notes",class:"block text-sm font-medium text-gray-700 mb-1 pl-1"}," Ghi chú ",-1),u8={class:"border border-gray-200 rounded-xl"},d8=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),f8={class:"py-4 px-3"},h8={class:"flex space-x-2"},p8=l("div",{class:"text-sm text-gray-600"}," Thanh toán tiền mặt (COD) ",-1),m8={class:"border border-gray-200 rounded-xl"},g8={class:"flex items-center justify-between mb-2.5 px-3 py-2 border-b border-b-gray-200"},v8=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),y8={class:"space-y-3 pt-1 pb-3 px-3"},b8={key:0,class:"px-3 pb-3 pt-1"},_8={class:"px-3 pb-3 pt-1"},x8={class:"flex items-center justify-between"},w8={class:"text-gray-500 mr-2 text-sm"},k8={class:"text-right text-base"},S8={class:"text-gray-700 text-sm"},C8={key:0,class:"flex items-center justify-between"},$8=l("div",{class:"text-gray-500 mr-2 text-sm"}," Khuyến mãi ",-1),T8={class:"text-right text-base"},A8={class:"text-green-500 text-sm"},E8={class:"flex items-center justify-between"},I8=l("div",{class:"text-gray-500 mr-2 text-sm"}," Phí vận chuyển ",-1),P8={class:"text-right text-base"},M8={class:"text-gray-700 text-sm"},O8={class:"flex items-center justify-between mt-2"},L8=l("div",{class:"text-gray-500 mr-2 text-sm"},[l("span",{class:"font-medium text-gray-900"},"Tổng cộng"),Ge(" (Đã bao gồm VAT) ")],-1),R8={class:"text-right text-[16px] font-medium"},D8={class:"text-red-500 text-sm"},j8=l("span",{class:"text-sm text-gray-900"},"Khuyến mãi",-1),N8={class:"flex items-center ml-auto"},F8=l("span",{class:"text-sm text-gray-400 tracking-tight"},"Chọn mã",-1),q8=l("span",null,"Đặt mua",-1),z8=l("div",{class:"w-[36px] h-[6px] rounded-full bg-gray-500 cursor-grab mx-auto"},null,-1),B8={class:"text-[20px] font-semibold text-gray-900 h-12 flex items-center justify-center"},U8={class:"space-y-3 h-[calc(100%-56px)] overflow-y-auto px-6 relative"},V8={key:0,class:"h-full flex flex-col justify-between"},H8={key:0,class:"absolute top-[46%] -translate-y-1/2 right-[3px] z-10"},W8={key:0,class:"absolute top-[46%] -translate-y-1/2 right-[3px] z-10"},G8={class:"flex items-center justify-between bg-white space-x-2 sticky bottom-0 inset-x-0 py-3"},K8={form:"form-submit-new-address",type:"submit",class:"py-[10px] bg-primary text-white rounded-lg flex-1 flex items-center justify-center"},Q8=l("span",null,"Lưu thay đổi",-1),J8={key:1,class:"flex flex-col justify-between h-full space-y-3"},X8={class:"space-y-1 px-4 pt-3 pb-2"},Z8={class:"flex items-center justify-between"},Y8={class:"text-sm"},eE={key:0,class:"text-xs text-green-500"},tE={class:"text-sm"},nE=l("span",{class:"text-gray-500 mr-1"}," Điện thoại: ",-1),sE={class:"text-gray-900"},rE={class:"text-sm"},oE=l("span",{class:"text-gray-500 mr-1"}," Địa chỉ: ",-1),iE={class:"text-gray-900"},aE={class:"border-t px-4 py-2"},lE=["onClick"],cE={class:"flex items-center justify-between bg-white sticky bottom-0 inset-x-0 py-3 space-x-2"},uE={class:"flex flex-col px-4 pb-3 pt-6 bg-white h-full"},dE=l("div",{class:"font-semibold text-gray-900 text-xl text-center mb-4"}," Khuyến mãi ",-1),fE={class:"mb-4"},hE={class:"flex items-center space-x-2"},pE={class:"relative flex-1"},mE=l("span",null,"Áp dụng",-1),gE={key:0,class:"text-xs text-red-500 mt-1"},vE={class:"flex-1 relative"},yE={class:"space-y-4 overflow-y-auto scroll-hidden absolute inset-0 h-full"},bE={class:"sticky bottom-0 z-10 pt-3"},_E={key:0,class:"px-6 pt-5 pb-4 bg-white rounded-t-2xl"},xE={class:"relative max-h-[520px] overflow-y-scroll scroll-hidden space-y-4"},wE=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),kE={key:0,class:"rounded-xl border border-gray-200"},SE=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),CE={class:"p-4 space-y-2"},$E={class:"flex space-x-3"},TE={key:0,class:"text-sm text-gray-700 w-[120px] flex-shrink-0"},AE={class:"text-sm text-gray-700 font-medium"},EE={key:0,class:"flex space-x-3"},IE=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Số điện thoại ",-1),PE={class:"text-sm text-gray-700 font-medium"},ME={class:"flex space-x-3"},OE=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Địa chỉ nhận hàng ",-1),LE={class:"text-sm text-gray-700 font-medium"},RE={class:"rounded-xl border border-gray-200"},DE=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),jE={class:"p-4 space-y-2"},NE={class:"flex space-x-3"},FE=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Mã đơn hàng ",-1),qE={class:"text-sm text-gray-700 font-medium"},zE=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),BE={key:0,class:"flex space-x-3"},UE=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Ghi chú đơn ",-1),VE={class:"text-sm text-gray-700 font-medium"},HE={key:0,class:"font-semibold text-gray-700 mb-3"},WE={key:1,class:"space-y-3 mb-4 border-b border-b-gray-200 pb-4"},GE={class:"flex items-center justify-between"},KE=l("div",{class:"text-gray-500 mr-2 text-sm"}," Tổng tiền hàng ",-1),QE={class:"text-right text-[16px] font-medium"},JE={class:"text-gray-700 text-sm"},XE={key:0,class:"flex items-center justify-between"},ZE=l("div",{class:"text-gray-500 mr-2 text-sm"}," Phí vận chuyển ",-1),YE={class:"text-right text-base"},eI={class:"text-gray-700 text-sm"},tI={key:1,class:"flex items-center justify-between"},nI=l("div",{class:"text-gray-500 mr-2 text-sm"}," Khuyến mãi ",-1),sI={class:"text-right text-[16px] font-medium"},rI={class:"text-green-500 text-sm"},oI={class:"flex items-center justify-between mt-2"},iI=l("div",{class:"text-gray-500 mr-2 text-sm"},[l("span",{class:"font-medium text-gray-900"},"Tổng cộng"),Ge(" (Đã bao gồm VAT) ")],-1),aI={class:"text-red-500 text-base font-semibold"},lI={class:"sticky bottom-0 pt-2 bg-white"},cI={__name:"FlowCheckout",props:Kr(["chatViewRef"],{open:{},openModifiers:{}}),emits:["update:open"],setup(e){const t=dr(e,"open"),n=L([]),s=L(null),r=L(null),o=L(0),i=L(!1),a=ht({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=L(!1),d=L(!1),f=L(""),h=L(""),g=te(()=>V.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,Q=>{o.value=0,Q&&(i.value=!V.user)});const p=L(null),v=L(!1),_=L(!1),w=async()=>{const{data:Q}=await Xe.cart.getList();Q.success&&(V.cart=Q.data)},k=Q=>{if(g.value.length-1===o.value)return;const j=g.value.findIndex(B=>B.name===Q);if(j!==-1){o.value=j;return}o.value=o.value+1},C=Q=>{if(o.value===0)return;const j=g.value.findIndex(B=>B.name===Q);if(j!==-1){o.value=j;return}o.value=o.value-1},E=L(null),O=L(null),I=async()=>{var Q,j,B;try{const ie=ro(V.handle);if(!((Q=V.forms.order)!=null&&Q.id)||!ie)return;const me={male:"Nam",female:"Nữ"},de=(B=(j=V.cart)==null?void 0:j.items)==null?void 0:B.map(pe=>({...pe,sku:pe.product_sku,title:pe.title??pe.name})),ge={status:"submitted",conversation_id:ie,submission_data:{title:me[V.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:V.forms.order.id,formData:ge})}catch(ie){console.log(ie)}},M=async()=>{try{if(v.value)return;O.value=null,v.value=!0;const{data:Q}=await Xe.order.checkout({cart_token:V.cart.token,note:f.value,email:h.value,shipping_address_id:s.value.id});Q.success&&(p.value=Q.data,k(),w(),I())}catch{}finally{v.value=!1,h.value="",f.value=""}},P=async()=>{if(!$t.get(ns))return;const{data:j}=await Xe.address.getList();j.success&&(n.value=j.data||[],s.value=n.value.find(B=>!!B.is_default)??n.value[0])},q=ht({district:!1,ward:!1}),H=L([]),T=L([]),A=L([]),R=async()=>{const{data:Q}=await Xe.location.provinces();Q.success&&Q.data&&(H.value=Object.values(Q.data))},K=async Q=>{q.district=!0;const{data:j}=await Xe.location.districts(Q);j.success&&j.data&&(T.value=Object.values(j.data)),q.district=!1},W=async Q=>{q.ward=!0;const{data:j}=await Xe.location.wards(Q);j.success&&j.data&&(A.value=Object.values(j.data)),q.ward=!1};Pe(()=>a.province_code,Q=>{var j,B;a.district_code="",T.value=[],a.ward_code="",A.value=[],Q&&(a.province_name=(B=(j=H.value)==null?void 0:j.find(ie=>ie.code.toString()===Q.toString()))==null?void 0:B.name,K(Q))}),Pe(()=>a.district_code,Q=>{var j;a.ward_code="",A.value=[],Q&&(a.district_name=(j=T.value.find(B=>B.code===Q))==null?void 0:j.name,W(Q))}),Pe(()=>a.ward_code,Q=>{var j;Q&&(a.ward_name=(j=A.value.find(B=>B.code===Q))==null?void 0:j.name)});const U=()=>{for(const Q in a)switch(Q){case"is_default":a[Q]=!0;break;case"type":a[Q]="home";break;default:a[Q]="";break}},J=()=>{d.value=!1,u.value=!1,U()},X=async()=>{try{const Q=Kg(a,c);if(_.value)return;_.value=!0,a.phone=a.phone.toString();const{data:j}=await Xe.address.create(a);j.success&&(s.value=j.data,n.value.push(j.data),d.value=!1,u.value=!1,U())}catch(Q){console.log("error: ",Q)}finally{_.value=!1}},Y=async(Q={})=>{try{if(Object.keys(Q).length===0)return;const{province_code:j,province_name:B,district_code:ie,district_name:me,ward_code:de,ward_name:ge,name:pe,phone:Ae,email:Ne,address:De}=Q,Ie={name:pe??"",phone:Ae??"",email:Ne??"",address1:De,province:B,province_code:j,district:me,district_code:ie,ward:ge,ward_code:de},{data:We}=await Xe.order.checkShipping({address:Ie});We.success&&(V.cart=We.data)}catch{}};Pe(s,Q=>{Q&&Y(Q)},{immediate:!0});const he=Q=>{k(),E.value=Q.form.identifier},ce=Q=>{k(),P(),w()},ue=L("");L("");const Te=L(!1),je=L(!1),re=L(null),fe=L([]),Ce=L(!1),$e=ht({}),Le=te(()=>{var Q,j;return(j=(Q=V.cart)==null?void 0:Q.coupon)==null?void 0:j.code}),Be=te(()=>fe.value.find(Q=>Q.code===Le.value)),Ue=async()=>{const{data:Q}=await Xe.cart.coupons();Q.success&&(fe.value=Q.data)},N=async(Q,j="card")=>{const B=j==="text"?"text":Q;try{if(!Q||$e[B])return;$e[B]=!0,Ce.value=!1,je.value=!1;const{data:ie}=await Xe.cart.applyCoupon({code:Q});ie.data&&(V.cart=ie.data),ie.success?j==="text"&&(Ce.value=!1):Ce.value=!0}catch(ie){console.log("Error coupon: ",ie)}finally{$e[B]=!1,ue.value=""}},ee=async Q=>{try{if(!Q||$e[Q])return;$e[Q]=!0,Ce.value=!1,je.value=!1;const{data:j}=await Xe.cart.removeCoupon({code:Q});console.log("removeCoupon = ",j),j.data&&(V.cart=j.data)}catch(j){console.log("Error coupon: ",j)}finally{$e[Q]=!1,ue.value=""}};return Pe(()=>V.user,Q=>{Q?(P(),Ue(),R()):(n.value=[],s.value=null)},{immediate:!0}),(Q,j)=>(m(),oe(Jg,{chatViewRef:e.chatViewRef,open:t.value,"onUpdate:open":j[41]||(j[41]=B=>t.value=B),slotNames:g.value,isNestedOpen:u.value||Te.value||je.value},{cart:xe(()=>{var B,ie,me,de;return[l("div",$A,[l("div",TA,[AA,((ie=(B=y(V).cart)==null?void 0:B.items)==null?void 0:ie.length)>0?(m(),x("div",EA," Giỏ hàng ")):z("",!0)]),((de=(me=y(V).cart)==null?void 0:me.items)==null?void 0:de.length)>0?(m(),x("div",IA,[l("div",PA,[l("div",MA,[(m(!0),x(be,null,Me(y(V).cart.items,(ge,pe)=>(m(),oe(H4,{key:pe,item:ge},null,8,["item"]))),128))])]),l("div",OA,[l("div",LA,[l("div",RA,D(y(V).cart.total_items)+" sản phẩm ",1),l("div",DA,[l("div",jA,D(y(tt)(y(V).cart.subtotal_price)),1)])]),y(V).cart.total_discounts?(m(),x("div",NA,[FA,l("div",qA,[l("div",zA,D(y(tt)(y(V).cart.total_discounts)),1)])])):z("",!0),l("div",BA,[UA,l("div",VA,[l("div",HA,D(y(tt)(y(V).cart.total_price-(y(V).cart.shipping_price||0))),1)])])]),l("div",WA,[l("div",null,[l("button",{onClick:j[0]||(j[0]=ge=>(k(),y(V).user&&Y())),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",GA,[KA,l("button",{onClick:j[1]||(j[1]=ge=>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:xe(()=>[G(Zg,{onSuccess:j[2]||(j[2]=B=>he(B))})]),otp:xe(()=>[G(Yg,{onSuccess:j[3]||(j[3]=B=>ce(B)),identifier:E.value},null,8,["identifier"])]),checkout:xe(()=>[l("div",{ref_key:"checkoutRef",ref:r,class:"py-4 relative"},[QA,l("button",{onClick:j[4]||(j[4]=B=>C("cart")),class:"size-10 flex items-center justify-center rounded-full hover:bg-gray-100 text-gray-900 absolute left-4 top-5"},[G(Xg)]),l("div",JA,[s.value?(m(),x("div",XA,[l("div",ZA,[YA,l("button",{onClick:j[5]||(j[5]=B=>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",e8,[l("div",t8,[l("div",n8,[l("div",null,D((s.value.first_name?`${s.value.first_name} `:"")+(s.value.last_name?s.value.last_name:"")),1)]),s.value.phone?(m(),x("div",s8,[l("div",null,D(s.value.phone),1)])):z("",!0),l("div",r8,[l("div",null,D(`${s.value.address} ${s.value.ward_name}, ${s.value.district_name}, ${s.value.province_name}`),1)])])])])):(m(),x("div",{key:1,onClick:j[6]||(j[6]=B=>(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"},o8)),l("div",i8,[a8,G(is,{modelValue:h.value,"onUpdate:modelValue":j[7]||(j[7]=B=>h.value=B),field:{id:"order-email",name:"email",type:"email",label:"Email"}},null,8,["modelValue"])]),l("div",l8,[c8,Rt(l("textarea",{id:"order-notes","onUpdate:modelValue":j[8]||(j[8]=B=>f.value=B),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),[[on,f.value]])]),l("div",u8,[d8,l("div",f8,[l("div",h8,[G(y(V2),{size:"18"}),p8])])]),l("div",m8,[l("div",null,[l("div",g8,[v8,l("button",{onClick:j[9]||(j[9]=B=>C("cart")),class:"text-sm px-2 py-1 bg-gray-100 hover:bg-gray-200 rounded-md text-gray-500"}," Thay đổi ")]),l("div",y8,[(m(!0),x(be,null,Me(y(V).cart.items,B=>(m(),oe(Ll,{key:B.product_sku,item:B},null,8,["item"]))),128))])]),Be.value?(m(),x("div",b8,[G(CA,{coupon:Be.value,"is-active":!0,onOnViewDetail:j[10]||(j[10]=B=>(je.value=!0,re.value=B)),onRemove:j[11]||(j[11]=B=>ee(B)),loading:$e[Be.value.code]},null,8,["coupon","loading"])])):z("",!0),l("div",_8,[l("div",x8,[l("div",w8,D(y(V).cart.total_items)+" sản phẩm ",1),l("div",k8,[l("div",S8,D(y(tt)(y(V).cart.subtotal_price)),1)])]),y(V).cart.total_discounts?(m(),x("div",C8,[$8,l("div",T8,[l("div",A8,D(y(tt)(y(V).cart.total_discounts)),1)])])):z("",!0),l("div",E8,[I8,l("div",P8,[l("div",M8,D(y(tt)(y(V).cart.shipping_price)),1)])]),l("div",O8,[L8,l("div",R8,[l("div",D8,D(y(tt)(y(V).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:j[12]||(j[12]=B=>Te.value=!0),class:"flex items-center px-1 py-2.5 cursor-pointer"},[G(Ol,{class:"mr-1 text-primary"}),j8,l("div",N8,[F8,G(wg,{class:"text-gray-400 w-4"})])])):z("",!0),l("button",{onClick:j[13]||(j[13]=B=>M()),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(nn,{key:0,class:"w-[16px] h-[16px] mr-2"})):z("",!0),q8],2)],2)])],512),G(y(hd),{key:"DrawerRootNested-Address",open:u.value,"onUpdate:open":j[25]||(j[25]=B=>u.value=B),modal:!1},{default:xe(()=>[G(y(tr),{to:e.chatViewRef},{default:xe(()=>[l("div",{onClick:j[14]||(j[14]=B=>u.value=!1),class:ne(["drawer-overlay-custom !z-50",{"drawer-overlay-custom--open":u.value}])},null,2),G(y(sr),{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:xe(()=>[z8,l("div",B8,D(d.value?"Thêm địa chỉ":" Sổ địa chỉ "),1),l("div",U8,[d.value?(m(),x("div",V8,[l("form",{id:"form-submit-new-address",onSubmit:j[21]||(j[21]=Qt(B=>X(),["prevent"])),class:"space-y-[18px]"},[G(is,{modelValue:a.last_name,"onUpdate:modelValue":j[15]||(j[15]=B=>a.last_name=B),field:{name:"last_name",type:"text",label:"Họ và tên",validate:"required"}},null,8,["modelValue"]),G(is,{modelValue:a.phone,"onUpdate:modelValue":j[16]||(j[16]=B=>a.phone=B),field:{name:"phone",type:"number",label:"Số điện thoại",validate:"required"}},null,8,["modelValue"]),G(is,{modelValue:a.province_code,"onUpdate:modelValue":j[17]||(j[17]=B=>a.province_code=B),field:{name:"province_code",type:"select",label:"Tỉnh/Thành phố",validate:"required",keyValue:"code",keyLabel:"name",options:H.value}},null,8,["modelValue","field"]),l("div",{class:ne(["relative",q.district&&"pointer-events-none opacity-80 bg-gray-50"])},[G(is,{classField:q.district&&"loading",modelValue:a.district_code,"onUpdate:modelValue":j[18]||(j[18]=B=>a.district_code=B),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",H8,[G(nn,{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(is,{classField:q.ward&&"loading",modelValue:a.ward_code,"onUpdate:modelValue":j[19]||(j[19]=B=>a.ward_code=B),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",W8,[G(nn,{color:"text-gray-700",class:"w-[14px] h-[14px]"})])):z("",!0)],2),G(is,{modelValue:a.address,"onUpdate:modelValue":j[20]||(j[20]=B=>a.address=B),field:{name:"address",type:"textarea",label:"Địa chỉ",validate:"required",rows:2}},null,8,["modelValue"])],32),l("div",G8,[l("button",{onClick:j[22]||(j[22]=B=>J()),class:"py-[10px] bg-gray-100 hover:bg-gray-200 rounded-lg flex-1"}," Quay lại "),l("button",K8,[_.value?(m(),oe(nn,{key:0,class:"mr-1 w-4 h-4"})):z("",!0),Q8])])])):(m(),x("div",J8,[(m(!0),x(be,null,Me(n.value,B=>{var ie,me;return m(),x("div",{key:B.id,class:"border border-gray-200 rounded-xl bg-white"},[l("div",X8,[l("div",Z8,[l("div",Y8,D(B.first_name?`${B.first_name} `:"")+" "+D(B.last_name?B.last_name:""),1),B.is_default?(m(),x("div",eE," Mặc định ")):z("",!0)]),l("div",tE,[nE,l("span",sE,D(B.phone),1)]),l("div",rE,[oE,l("span",iE,D(`${B.address} ${B.ward_name}, ${B.district_name}, ${B.province_name}`),1)])]),l("div",aE,[l("button",{onClick:de=>(s.value=B,u.value=!1),class:ne(["px-3 py-2 rounded-xl text-sm",((ie=s.value)==null?void 0:ie.id)===B.id?"bg-primary text-white cursor-default":"hover:bg-gray-50 text-gray-500 border border-gray-200 "])},D(((me=s.value)==null?void 0:me.id)===B.id?"Đang sử dụng":"Giao đến địa chỉ này"),11,lE)])])}),128)),l("div",cE,[l("button",{class:"px-3 py-[10px] bg-gray-100 rounded-lg flex-1",onClick:j[23]||(j[23]=B=>u.value=!1)}," Quay lại "),l("button",{onClick:j[24]||(j[24]=B=>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(hd),{open:Te.value,"onUpdate:open":j[35]||(j[35]=B=>Te.value=B),modal:!1},{default:xe(()=>[G(y(tr),{to:e.chatViewRef},{default:xe(()=>[l("div",{onClick:j[26]||(j[26]=B=>Te.value=!1),class:ne(["drawer-overlay-custom",{"drawer-overlay-custom--open":Te.value}])},null,2),G(y(sr),{class:"absolute bottom-0 left-0 right-0 outline-none z-[50] overflow-hidden h-full"},{default:xe(()=>[l("div",uE,[l("button",{onClick:j[27]||(j[27]=B=>Te.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(bo)]),dE,l("div",fE,[l("div",hE,[l("div",pE,[Rt(l("input",{type:"text","onUpdate:modelValue":j[28]||(j[28]=B=>ue.value=B),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),[[on,ue.value]]),G(Ol,{class:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-500"}),ue.value?(m(),x("button",{key:0,onClick:j[29]||(j[29]=B=>ue.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(bo,{class:"w-3 text-white"})])):z("",!0)]),l("button",{onClick:j[30]||(j[30]=B=>N(ue.value,"text")),class:ne([[ue.value?"bg-primary text-white":"bg-gray-100 text-gray-300 border border-gray-200 cursor-not-allowed",$e[ue.value]&&"opacity-60 cursor-not-allowed"],"h-10 text-sm font-medium rounded-lg hover:opacity-80 px-4 flex items-center"])},[$e.text?(m(),oe(nn,{key:0,class:"w-4 mr-1"})):z("",!0),mE],2)]),Ce.value?(m(),x("div",gE," 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",vE,[l("div",yE,[(m(!0),x(be,null,Me(fe.value,B=>(m(),oe(F6,{key:B.id,coupon:B,loading:$e[B.code],"is-active":B.code===Le.value,onOnViewDetail:j[31]||(j[31]=ie=>(je.value=!0,re.value=ie)),onRemove:j[32]||(j[32]=ie=>ee(ie)),onApply:j[33]||(j[33]=ie=>N(ie))},null,8,["coupon","loading","is-active"]))),128))])]),l("div",bE,[l("button",{onClick:j[34]||(j[34]=B=>Te.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(hd),{open:je.value,"onUpdate:open":j[39]||(j[39]=B=>je.value=B),modal:!1},{default:xe(()=>[G(y(tr),{to:e.chatViewRef},{default:xe(()=>[l("div",{onClick:j[36]||(j[36]=B=>je.value=!1),class:ne(["drawer-overlay-custom !z-50",{"drawer-overlay-custom--open":je.value}])},null,2),G(y(sr),{class:"absolute bottom-0 left-0 right-0 outline-none z-[50] overflow-hidden h-fit"},{default:xe(()=>[G(lA,{coupon:re.value,active:re.value&&re.value.code===Le.value,onRemove:j[37]||(j[37]=B=>ee(B)),onApply:j[38]||(j[38]=B=>N(B))},null,8,["coupon","active"])]),_:1})]),_:1},8,["to"])]),_:1},8,["open"])]),success:xe(()=>{var B,ie,me,de;return[p.value?(m(),x("div",_E,[l("div",xE,[wE,p.value.shipping_address?(m(),x("div",kE,[SE,l("div",CE,[l("div",$E,[(B=p.value.shipping_address)!=null&&B.name||(ie=s.value)!=null&&ie.last_name?(m(),x("div",TE," Họ và tên ")):z("",!0),l("div",AE,D(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",EE,[IE,l("div",PE,D(p.value.shipping_address.phone),1)])):z("",!0),l("div",ME,[OE,l("div",LE,D(p.value.shipping_address.address1),1)])])])):z("",!0),l("div",RE,[DE,l("div",jE,[l("div",NE,[FE,l("div",qE," #"+D(p.value.order_number),1)]),zE,p.value.note?(m(),x("div",BE,[UE,l("div",VE,D(p.value.note),1)])):z("",!0)])]),l("div",null,[p.value.items&&p.value.items.length>0?(m(),x("div",HE," Sản phẩm đã đặt ")):z("",!0),p.value.items&&p.value.items.length>0?(m(),x("div",WE,[(m(!0),x(be,null,Me(p.value.items,ge=>(m(),oe(Ll,{key:ge.product_sku,item:ge},null,8,["item"]))),128))])):z("",!0),l("div",null,[l("div",GE,[KE,l("div",QE,[l("div",JE,D(y(tt)(p.value.subtotal_price)),1)])]),p.value.shipping_price?(m(),x("div",XE,[ZE,l("div",YE,[l("div",eI,D(y(tt)(p.value.shipping_price)),1)])])):z("",!0),p.value.total_discounts?(m(),x("div",tI,[nI,l("div",sI,[l("div",rI,D(y(tt)(p.value.total_discounts)),1)])])):z("",!0),l("div",oI,[iI,l("div",aI,D(y(tt)(p.value.total_price)),1)])])])]),l("div",lI,[l("button",{onClick:j[40]||(j[40]=ge=>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"]))}},uI=["src"],dI={__name:"ChatBanner",props:{banners:{type:Array,default:()=>[]}},emits:["close"],setup(e,{emit:t}){const n="https://widget.geteasy.ai",s=e,r=t,o=L(!0),i=L(null),a=()=>{var u;((u=i.value)==null?void 0:u.offsetWidth)<480?o.value=!0:o.value=!1},c=te(()=>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:xe(()=>[(m(!0),x(be,null,Me(c.value,(f,h)=>(m(),oe(bl,{key:h,class:"w-full h-[150px]"},{default:xe(()=>[(m(),oe(Ft(f.link?"a":"div"),{href:f.link,target:"_blank",class:"block w-full h-full"},{default:xe(()=>[l("img",{src:f.image_url,alt:"ecg-banner",class:"object-cover w-full h-full"},null,8,uI)]),_:2},1032,["href"]))]),_:2},1024))),128))]),_:1}),l("button",{onClick:d[0]||(d[0]=f=>r("close")),class:"close-banner-btn"},[G(bo,{class:"w-3"})])],2)):z("",!0)}},fI={class:"relative bg-white mx-auto mt-3 mb-2 w-fit max-w-[300px]"},hI={class:"flex justify-end items-end flex-col gap-1"},pI={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"},mI=l("span",{class:"text-xs"},"Tin nhắn thoại",-1),gI={class:"text-sm text-white px-4 py-2.5 bg-primary rounded-xl"},vI={__name:"ChatVoiceCardUser",props:{messageText:{type:String,default:""}},setup(e){return(t,n)=>(m(),x("div",fI,[l("div",hI,[l("div",pI,[G(y(sg),{size:"14"}),mI]),l("div",gI,D(e.messageText),1)])]))}},yI={viewBox:"0 0 24 24"},bI=["id"],_I=["stop-color"],xI=["stop-color"],wI=["fill"],kI={__name:"IconAI",props:{fromColor:{type:String,default:"#2a83e9"},toColor:{type:String,default:"#0ea5e9"},id:{type:String,default:""}},setup(e){const t=e,n=te(()=>t.id||`star-gradient-${Math.random().toString(36).substring(2,9)}`);return(s,r)=>(m(),x("svg",yI,[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,_I),l("stop",{offset:"100%","stop-color":e.toColor},null,8,xI)],8,bI)]),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,wI)]))}},SI={class:"shine-wrapper max-h-[18px]"},CI={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=te(()=>{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",SI,[l("div",CI,[G(kI,{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"}},D(e.title),3)])]))}},[["__scopeId","data-v-9bdf7947"]]),$I={class:"ai-suggestion-wrapper"},TI={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"}},AI=["title"],EI={key:0,class:"w-[48px] max-h-[48px] h-auto rounded overflow-hidden mr-2 flex-shrink-0"},II=["src","alt"],PI={key:1,class:"size-[48px] flex items-center justify-center"},MI=["src","alt"],OI={class:"relative flex-1"},LI={class:"text-sm leading-[140%] line-clamp-2 text-gray-900"},RI={key:0,class:"flex flex-wrap"},DI=["onClick","innerHTML"],jI="ecg-quick-replies",NI=Qe({__name:"WidgetFeatureAIProductInsight",props:{widget:{type:Object,default:()=>({})}},emits:["sendMessage"],setup(e,{expose:t,emit:n}){var A,R,K,W;const s=e,r=n,{bot:o,handle:i}=It(ae.state),a=(R=(A=o.value.config)==null?void 0:A.ui)==null?void 0:R.logo,c=(W=(K=o.value.config)==null?void 0:K.ui)==null?void 0:W.name,u=L(null),d=L(null),f=L(null),h=L(!1),g=L(!1),p=L([]),v=L(!1),_=L(null),w=(U,J=[],X)=>{var ce;const Y=((ce=s.widget)==null?void 0:ce.dynamic_prompts)??to[i.value]??to.default;let he=vm(Y,{title:U,logo:a,brand:c})[X];return J.length>0&&he.length>J.length?J.map(ue=>he.find(Te=>Te.id===ue)).filter(Boolean):he},k=()=>{let U=$t.get(jI);return(!U||U==="undefined")&&(U={}),U},C=()=>{const U=k(),J=Sx(f.value.name);return U[J]??[]},E=U=>{Er().send({message:U.message}),p.value=p.value.filter(J=>J.id!==U.id),p.value.length===0&&(h.value=!1),r("sendMessage",U.message)},O=()=>{var J;const U=((J=f.value.image)==null?void 0:J.contentUrl)??f.value.image;return Array.isArray(U)?U[0]:U},I=({selector:U,position:J,widget:X,style:Y}={})=>{u.value&&(u.value.remove(),u.value=null),typeof window<"u"&&window.EAC&&!u.value?u.value=window.EAC.injectWidget(U,X,{position:J,style:Y}):u.value=wi(U,X,{position:J,style:Y})},M=({selector:U,position:J,widget:X,style:Y,props:he}={})=>{d.value&&(d.value.remove(),d.value=null),typeof window<"u"&&window.EAC&&!d.value?d.value=window.EAC.injectWidget(U,X,{position:J,style:Y,props:he}):d.value=wi(U,X,{position:J,style:Y,props:he})},P=()=>{const U=rs("Product");if(!U)return;let J=U.sku?"product":"category";if(i.value===xr&&(J="product"),J==="product"&&i.value===Ln&&(I({selector:".gallery-product",position:"bottom",widget:s.widget,style:{margin:"12px 0",borderRadius:"12px",border:"1px solid #e5e7eb",padding:"12px",overflow:"hidden"}}),M({selector:"[data-target='panel-main-item']",position:"before",widget:{type:"ai_summary_page_content"},style:{margin:"16px 0"},props:{isShowHighlight:!1}})),J==="product"&&i.value===xr){const X=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(X)}},q=()=>{f.value=rs("Product");const U=Ts();if(f.value){i.value===xr&&(f.value.name=U.title);const J=C();_.value=O()??ps();let X=f.value.sku?"product":"category";i.value===xr&&(X="product"),p.value=w(f.value.name,J,X),setTimeout(()=>{h.value=!0},200)}else{const J=kx({handle:i.value});if(J){f.value={name:U.title};const X=C();_.value=ps();const Y=J==="product"?"product":"category";p.value=w(f.value.name,X,Y),setTimeout(()=>{h.value=!0},200)}}},H=()=>{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)&&H(),setTimeout(()=>{q(),Na.SPA.includes(i.value)&&P()},1500),u.value&&Na.SPA.includes(i.value)&&(u.value.remove(),u.value=null)},!0),Na.SSR.includes(i.value)&&P()}),t({tags:p,showToggleButton:g}),(U,J)=>(m(),x("div",$I,[G(en,{name:"expand-ai-suggestion"},{default:xe(()=>[f.value&&h.value?(m(),x("div",TI,[l("div",{title:f.value.name,class:"flex items-start"},[_.value&&!v.value?(m(),x("div",EI,[l("img",{src:_.value,alt:f.value.name,onError:J[0]||(J[0]=()=>{v.value=!0}),class:"object-contain w-full h-full"},null,40,II)])):(m(),x("div",PI,[l("img",{src:y(a),alt:y(c),class:"w-[24px] h-[24px] object-cover rounded-full overflow-hidden"},null,8,MI)])),l("div",OI,[G(Ri,{title:"AI đề xuất",class:"mb-1"}),l("div",LI,D(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(po),{class:"w-4 h-4"})])],8,AI),p.value.length>0?(m(),x("div",RI,[(m(!0),x(be,null,Me(p.value,X=>(m(),x("button",{key:X.name,onClick:Y=>E(X),class:"prose suggestion-tag",innerHTML:X.name},null,8,DI))),128))])):z("",!0)])):z("",!0)]),_:1}),f.value&&!h.value&&g.value?(m(),x("button",{key:0,onClick:J[1]||(J[1]=X=>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"]]),FI={class:"relative py-4 bg-white rounded-t-2xl overflow-hidden outline-none"},qI=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),zI={class:"px-3 divide-y divide-gray-100"},BI={class:"flex px-4 py-3"},UI=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),VI=l("div",{class:"text-sm text-gray-400"},"Họ và tên",-1),HI={class:"text-base text-gray-700"},WI={class:"flex px-4 py-3"},GI=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),KI=l("div",{class:"text-sm text-gray-400"},"Ngày sinh",-1),QI={class:"text-base text-gray-700"},JI={class:"flex px-4 py-3"},XI=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),ZI=l("div",{class:"text-sm text-gray-400"},"Giới tính",-1),YI={class:"text-base text-gray-700"},e9={class:"flex px-4 py-3"},t9=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),n9=l("div",{class:"text-sm text-gray-400"},"Số điện thoại",-1),s9={class:"text-base text-gray-700"},r9={class:"flex px-4 py-3"},o9=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),i9=l("div",{class:"text-sm text-gray-400"},"Địa chỉ email",-1),a9={class:"text-base text-gray-700"},l9={__name:"AuthAccount",setup(e){const t={male:"Nam",female:"Nữ"};return(n,s)=>(m(),x("div",FI,[qI,l("div",zI,[l("div",BI,[UI,l("div",null,[VI,l("div",HI,D(y(V).user.name),1)])]),l("div",WI,[GI,l("div",null,[KI,l("div",QI,D(y(V).user.birthday),1)])]),l("div",JI,[XI,l("div",null,[ZI,l("div",YI,D(t[y(V).user.gender]??"Khác"),1)])]),l("div",e9,[t9,l("div",null,[n9,l("div",s9,D(y(V).user.phone),1)])]),l("div",r9,[o9,l("div",null,[i9,l("div",a9,D(y(V).user.email??"---"),1)])])])]))}},ut=e=>(gn("data-v-d8858f82"),e=e(),vn(),e),c9={class:"flow-auth-checkout relative"},u9=[ut(()=>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)),ut(()=>l("div",null,"Tài khoản",-1))],d9=[ut(()=>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)),ut(()=>l("div",null,"Đơn hàng",-1))],f9=[ut(()=>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)),ut(()=>l("div",null,"Đăng xuất",-1))],h9={class:"px-6 py-6 bg-white rounded-t-2xl overflow-hidden"},p9=ut(()=>l("div",{class:"text-center font-medium text-gray-600 text-xl"}," Xác thực thành công 🎉 ",-1)),m9=ut(()=>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)),g9={class:"bg-white mt-4"},v9={class:"px-6 pb-6 pt-3 bg-white rounded-t-2xl relative"},y9=ut(()=>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)),b9=ut(()=>l("div",{class:"font-medium text-[20px] text-center tracking-wide text-gray-900 mb-3"}," Đơn hàng của tôi ",-1)),_9={class:"relative h-[520px] overflow-y-scroll scroll-hidden space-y-6"},x9=[ut(()=>l("div",{class:"h-[48px] rounded-xl bg-gray-100"},null,-1)),ut(()=>l("div",{class:"flex-1 rounded-xl bg-gray-100"},null,-1)),ut(()=>l("div",{class:"h-[60px] rounded-xl bg-gray-100"},null,-1))],w9={class:"rounded-xl bg-white border border-gray-200 overflow-hidden"},k9={class:"py-3 pl-4 pr-3.5 flex items-center justify-between border-b border-b-gray-200"},S9={class:"space-x-1"},C9=ut(()=>l("span",{class:"text-sm text-gray-500"},"Đơn hàng:",-1)),$9={class:"text-sm text-gray-700 font-semibold"},T9={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"},A9={class:"w-full max-w-full overflow-x-auto scroll-hidden flex space-x-4 py-3 pr-4"},E9={class:"w-[94px] h-[94px] mx-auto flex items-center justify-center rounded-lg bg-white overflow-hidden"},I9=["src"],P9=["src","alt","onError"],M9={class:"px-1 mt-2"},O9={class:"text-xs line-clamp-2 font-medium"},L9={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"},R9={class:"py-3 px-4 border-t border-t-gray-200 flex items-center justify-between"},D9={class:"text-sm text-gray-700"},j9={class:"text-sm"},N9=ut(()=>l("span",{class:"mr-1 text-gray-500"},"Tổng tiền:",-1)),F9={class:"text-red-500 test-sm font-semibold"},q9=["onClick"],z9={key:0,class:"h-[380px] flex items-center justify-center"},B9=[ut(()=>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))],U9={class:"relative py-6 bg-white rounded-t-2xl overflow-hidden outline-none"},V9={class:"flex items-center pl-4 pr-6"},H9={key:0,class:"h-[40px] w-full rounded-xl bg-gray-100 ml-3"},W9=ut(()=>l("div",{class:"font-semibold text-gray-900 text-lg tracking-tight"}," Đơn hàng chi tiết ",-1)),G9={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"},K9={class:"relative max-h-[480px] overflow-y-scroll scroll-hidden space-y-4 px-6 mt-4"},Q9=[ut(()=>l("div",{class:"h-[42px] rounded-xl bg-gray-100"},null,-1)),ut(()=>l("div",{class:"flex-1 rounded-xl bg-gray-100"},null,-1)),ut(()=>l("div",{class:"h-[52px] rounded-xl bg-gray-100"},null,-1))],J9={class:"rounded-xl border border-gray-200"},X9=ut(()=>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)),Z9={class:"py-3 px-4 space-y-2"},Y9={key:0,class:"flex space-x-3"},eP=ut(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Họ và tên ",-1)),tP={class:"text-sm text-gray-700 font-medium"},nP={class:"flex space-x-3"},sP=ut(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Số điện thoại ",-1)),rP={class:"text-sm text-gray-700 font-medium"},oP={class:"flex space-x-3"},iP=ut(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Địa chỉ nhận hàng ",-1)),aP={class:"text-sm text-gray-700 font-medium"},lP={class:"rounded-xl border border-gray-200"},cP=ut(()=>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)),uP={class:"py-3 px-4 space-y-2"},dP={class:"flex space-x-3"},fP=ut(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Ngày đặt hàng ",-1)),hP={class:"text-sm text-gray-700 font-medium"},pP={class:"flex space-x-3"},mP=ut(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Mã đơn hàng ",-1)),gP={class:"text-sm text-gray-700 font-medium"},vP=ut(()=>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)),yP={key:0,class:"flex space-x-3"},bP=ut(()=>l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Ghi chú ",-1)),_P={class:"text-sm text-gray-700 font-medium"},xP=ut(()=>l("div",{class:"font-semibold text-gray-700 mb-3"}," Sản phẩm đã đặt ",-1)),wP={class:"space-y-3 mb-4 border-b border-b-gray-200 pb-4"},kP={class:"flex items-center justify-between"},SP=ut(()=>l("div",{class:"text-gray-500 mr-2 text-sm"}," Tổng tiền hàng ",-1)),CP={class:"text-right text-[16px] font-medium"},$P={class:"text-gray-700 text-sm"},TP={key:0,class:"flex items-center justify-between"},AP=ut(()=>l("div",{class:"text-gray-500 mr-2 text-sm"}," Khuyến mãi ",-1)),EP={class:"text-right text-[16px] font-medium"},IP={class:"text-green-500 text-sm"},PP={key:1,class:"flex items-center justify-between"},MP=ut(()=>l("div",{class:"text-gray-500 mr-2 text-sm"}," Phí vận chuyển ",-1)),OP={class:"text-right text-base"},LP={class:"text-gray-700 text-sm"},RP={class:"flex items-center justify-between mt-2"},DP=ut(()=>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)),jP={class:"text-red-500 text-base font-semibold"},NP=Qe({__name:"FlowAuth",props:Kr(["chatViewRef"],{open:{},openModifiers:{}}),emits:["update:open"],setup(e){var C,E;const t=dr(e,"open"),n=L("phone"),s=L(!1),r=((E=(C=V.bot)==null?void 0:C.config)==null?void 0:E.ui.logo)||`${V.appDomain}/link.png`,o=te(()=>[{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(M=>M.name===O)&&(n.value=O)},a=L(null),c=O=>{i("otp"),a.value=O.form.identifier},u=O=>{i("success")},d=async()=>{try{const O=await Xe.auth.logout();V.user=null,V.token=null,s.value=!1,$t.remove(ns);const{data:I}=await Xe.cart.getList();I.success&&(V.cart=I.data,ECG.sync.emit("logout",{source:"easy-ai-chat",data:I.data}))}catch{}},f=L([]),h=L(null),g=L({}),p=L(!1),v=L(!1),_=async()=>{try{const{data:O}=await Xe.order.getStatuses();if(O.success){const I=O.data||[];g.value=I.reduce((M,P)=>(M[P.code]=P.name,M),{})}}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(be,null,[l("div",c9,[y(V).user?(m(),x("button",{key:0,onClick:I[0]||(I[0]=M=>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(dg),{size:"14"})])):(m(),x("button",{key:1,onClick:I[1]||(I[1]=M=>(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(dg),{size:"14"})])),l("div",{class:ne(["ecg-account-menu",s.value&&"open"])},[l("button",{onClick:I[2]||(I[2]=M=>(s.value=!1,t.value=!0,n.value="account")),class:"ecg-account-menu-item"},u9),l("button",{onClick:I[3]||(I[3]=M=>(s.value=!1,t.value=!0,n.value="orders")),class:"ecg-account-menu-item"},d9),l("button",{class:"ecg-account-menu-item",onClick:I[4]||(I[4]=M=>d())},f9)],2)]),G(Jg,{chatViewRef:e.chatViewRef,open:t.value,"onUpdate:open":I[7]||(I[7]=M=>t.value=M),slotNames:o.value},{phone:xe(()=>[G(Zg,{onSuccess:c})]),otp:xe(()=>[G(Yg,{identifier:a.value,onSuccess:u},null,8,["identifier"])]),success:xe(()=>[l("div",h9,[p9,m9,l("div",g9,[l("button",{onClick:I[5]||(I[5]=M=>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:xe(()=>[l("div",v9,[y9,b9,l("div",_9,[p.value?(m(),x(be,{key:0},Me(3,(M,P)=>l("div",{key:P,class:"rounded-xl animate-pulse bg-white overflow-hidden h-[316px] flex flex-col space-y-3 p-3 border border-gray-100"},x9)),64)):(m(),x(be,{key:1},[(m(!0),x(be,null,Me(f.value,M=>(m(),x("div",w9,[l("div",k9,[l("div",S9,[C9,l("span",$9,"#"+D(M.order_number),1)]),g.value[M.status]?(m(),x("div",T9,D(g.value[M.status]),1)):z("",!0)]),l("div",A9,[(m(!0),x(be,null,Me(M.items,P=>(m(),x("div",{class:ne([M.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",E9,[P.fe_is_image_error?(m(),x("img",{key:0,src:y(r),alt:"image error",class:"w-[28px] h-[28px]"},null,8,I9)):(m(),x("img",{key:1,src:P.image,alt:P.name,class:"w-full h-full object-cover",onError:q=>P.fe_is_image_error=!0},null,40,P9))]),l("div",M9,[l("div",O9,D(P.name),1)]),l("div",L9," x"+D(P.quantity),1)],2))),256))]),l("div",R9,[l("div",null,[l("div",D9,D(M.total_items)+" sản phẩm ",1),l("div",j9,[N9,l("span",F9,D(y(tt)(M.total_price)),1)])]),l("button",{onClick:P=>k(M.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,q9)])]))),256)),f.value.length===0?(m(),x("div",z9,B9)):z("",!0)],64))])])]),"order-detail":xe(()=>[l("div",U9,[l("div",V9,[v.value?(m(),x("div",H9)):(m(),x(be,{key:1},[l("button",{onClick:I[6]||(I[6]=M=>i("orders")),class:"size-10 flex items-center justify-center rounded-full hover:bg-gray-100 text-gray-900 mr-0.5"},[G(Xg)]),W9,g.value[h.value.status]?(m(),x("div",G9,D(g.value[h.value.status]),1)):z("",!0)],64))]),l("div",K9,[v.value||!h.value?(m(),x(be,{key:0},Me(3,(M,P)=>l("div",{key:P,class:"rounded-xl animate-pulse bg-white overflow-hidden h-[280px] flex flex-col space-y-3 p-3 border border-gray-200"},Q9)),64)):(m(),x(be,{key:1},[l("div",J9,[X9,l("div",Z9,[h.value.shipping_address.name?(m(),x("div",Y9,[eP,l("div",tP,D(h.value.shipping_address.name),1)])):z("",!0),l("div",nP,[sP,l("div",rP,D(h.value.shipping_address.phone),1)]),l("div",oP,[iP,l("div",aP,D(`${h.value.shipping_address.address1}`),1)])])]),l("div",lP,[cP,l("div",uP,[l("div",dP,[fP,l("div",hP,D(y(ja)(h.value.created_at)),1)]),l("div",pP,[mP,l("div",gP," #"+D(h.value.order_number),1)]),vP,h.value.note?(m(),x("div",yP,[bP,l("div",_P,D(h.value.note??"---"),1)])):z("",!0)])]),l("div",null,[xP,l("div",wP,[(m(!0),x(be,null,Me(h.value.items,M=>(m(),oe(Ll,{key:M.sku,item:M},null,8,["item"]))),128))]),l("div",null,[l("div",kP,[SP,l("div",CP,[l("div",$P,D(y(tt)(h.value.subtotal_price)),1)])]),h.value.total_discounts?(m(),x("div",TP,[AP,l("div",EP,[l("div",IP,D(y(tt)(h.value.total_discounts)),1)])])):z("",!0),h.value.shipping_price?(m(),x("div",PP,[MP,l("div",OP,[l("div",LP,D(y(tt)(h.value.shipping_price)),1)])])):z("",!0),l("div",RP,[DP,l("div",jP,D(y(tt)(h.value.total_price)),1)])])])],64))])])]),account:xe(()=>[G(l9)]),_:1},8,["chatViewRef","open","slotNames"])],64))}},[["__scopeId","data-v-d8858f82"]]),FP={key:0,class:"relative"},qP={key:0,class:"absolute top-0 inset-x-0 -translate-y-[110%]"},zP={class:"bg-red-50 w-[100%] rounded-2xl relative py-3 pl-4 pr-10 flex items-start border border-red-300"},BP={class:"space-y-2"},UP={class:"text-red-600 whitespace-pre-line flex items-start"},VP={class:"pt-0.5"},HP={class:"text-sm"},WP={key:1,class:"custom-scrollbar"},GP={class:"flex space-x-2.5 w-fit pt-2"},KP=["onClick"],QP={key:0,class:"group relative w-full h-full"},JP=["src"],XP={key:0,class:"inset-0 absolute bg-white/10"},ZP={key:1,class:"absolute inset-0 flex items-center justify-center"},YP=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",FP,[y(o).length>0?(m(),x("div",qP,[l("div",zP,[l("div",BP,[(m(!0),x(be,null,Me(y(o),u=>(m(),x("div",UP,[l("div",VP,[G(y(j2),{size:"20","stroke-width":"1.5",class:"flex-shrink-0 mr-2"})]),l("p",HP,D(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",WP,[l("div",GP,[(m(!0),x(be,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,KP),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",QP,[l("img",{src:u.url||u.previewUrl,alt:"preview",class:"w-full h-full object-cover"},null,8,JP),u.loading?(m(),x("div",XP)):z("",!0),u.loading?(m(),x("div",ZP,[G(y(K2),{size:"18",class:"animate-spin text-white mt-1"})])):z("",!0)])):(m(),oe(Ag,{key:1,file:u},null,8,["file"]))],2)]))),128))])])):z("",!0)])):z("",!0)}},[["__scopeId","data-v-c3e36a9e"]]),eM={class:"w-fit relative group"},tM=["accept","multiple"],nM=["disabled"],sM={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"},rM={__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=te(()=>t.accept?t.accept:n.value.join(",")),f=te(()=>!0),h=L(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,C=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(C)&&await o(),v.target.value=""};return(v,_)=>(m(),x("div",eM,[l("input",{ref_key:"fileInput",ref:h,type:"file",class:"hidden",accept:d.value,multiple:f.value,onChange:p},null,40,tM),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(Ku),{size:"18"})],8,nM),y(u).length>=y(a)?(m(),x("div",sM," Chỉ được phép tải lên tối đa "+D(y(a))+" file ",1)):z("",!0)]))}},md={en:"en-US",vi:"vi-VN",ja:"ja-JP"},oM=e=>e&&md[e]?md[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":md.ja,Se=ht({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 gd(){const{isOpen:e,isRecording:t,isProcessing:n,isStartSpeechToText:s,showPermissionDenied:r,permissionStatus:o,recordedTranscript:i,recordTime:a}=It(Se),c=te(()=>{switch(Se.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=()=>{Se.isOpen=!Se.isOpen},d=()=>{Se.isOpen=!0},f=()=>{Se.isOpen=!1},h=H=>{Se.isProcessing=H},g=()=>{const H="webkitSpeechRecognition"in window||"SpeechRecognition"in window;return H||(Se.permissionStatus="not_supported"),H},p=async()=>{try{return!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia?(Se.permissionStatus="not_supported",{granted:!1,reason:"not_supported"}):((await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(T=>T.stop()),Se.permissionStatus="granted",{granted:!0})}catch(H){return H.name==="NotAllowedError"||H.name==="PermissionDeniedError"?(Se.permissionStatus="denied",{granted:!1,reason:"denied"}):H.name==="NotFoundError"?(Se.permissionStatus="denied",{granted:!1,reason:"not_found"}):(Se.permissionStatus="denied",{granted:!1,reason:"error"})}},v=()=>{Se.showPermissionDenied=!0,Se.permissionStatus="denied"},_=()=>{Se.showPermissionDenied=!1},w=()=>{Se.recordTime=0,Se.recordingStartTime=Date.now(),Se.recordingTimer=setInterval(()=>{Se.recordTime=Math.floor((Date.now()-Se.recordingStartTime)/1e3),Se.recordTime>=Se.maxRecordingTime&&I()},1e3)},k=()=>{Se.recordingTimer&&(clearInterval(Se.recordingTimer),Se.recordingTimer=null,Se.recordingStartTime&&(Se.recordTime=Math.floor((Date.now()-Se.recordingStartTime)/1e3)))},C=()=>{Se.restartTimeout&&(clearTimeout(Se.restartTimeout),Se.restartTimeout=null)},E=()=>{try{if(!g())return Se.permissionStatus="not_supported",!1;const H=window.SpeechRecognition||window.webkitSpeechRecognition;return Se.recognition=new H,Se.recognition.continuous=!0,Se.recognition.interimResults=!0,Se.recognition.lang=oM(Xs.state.locale),Se.recognition.maxAlternatives=1,Se.recognition.onstart=()=>{Se.isRecording=!0,Se.permissionStatus="granted"},Se.recognition.onend=()=>{Se.isStartSpeechToText&&Se.recognition&&(C(),Se.restartTimeout=setTimeout(()=>{if(Se.isStartSpeechToText&&Se.recognition)try{Se.recognition.start()}catch{}},300))},Se.recognition.onresult=T=>{let A="";for(let R=T.resultIndex;R<T.results.length;R++){const K=T.results[R][0].transcript;T.results[R].isFinal?Se.finalTranscript+=K:A+=K}Se.recordedTranscript=Se.finalTranscript+A},Se.recognition.onerror=T=>{T.error==="no-speech"&&Se.isStartSpeechToText?(C(),Se.restartTimeout=setTimeout(()=>{if(Se.isStartSpeechToText&&Se.recognition)try{Se.recognition.start()}catch{}},300)):(T.error==="not-allowed"||T.error==="service-not-allowed")&&(Se.isStartSpeechToText=!1,Se.permissionStatus="denied",v())},!0}catch{return Se.permissionStatus="not_supported",!1}},O=async()=>{try{if(!g())return Se.permissionStatus="not_supported",!1;const H=await p();return H.granted?(Se.recordedTranscript="",Se.finalTranscript="",!Se.recognition&&!E()?!1:Se.recognition?(Se.recognition.start(),Se.isRecording=!0,Se.isStartSpeechToText=!0,Se.permissionStatus="granted",w(),!0):!1):(H.reason==="not_supported"?Se.permissionStatus="not_supported":(Se.permissionStatus="denied",v()),!1)}catch{return Se.permissionStatus="denied",!1}},I=()=>{if(C(),Se.isStartSpeechToText=!1,Se.recognition)try{return Se.isRecording&&Se.recognition.stop(),Se.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:()=>{Se.recordedTranscript="",Se.finalTranscript="",Se.recordTime=0},saveTranscript:()=>Se.recordedTranscript&&Se.recordedTranscript.trim()!==""?{type:"voice",content:Se.recordedTranscript,timestamp:new Date().toISOString(),duration:Se.recordTime}:null,releaseMediaResources:()=>{try{if(C(),Se.isStartSpeechToText=!1,Se.recognition){try{Se.isRecording&&Se.recognition.stop()}catch{}Se.recognition=null}return Se.recordedTranscript="",Se.finalTranscript="",Se.recordTime=0,Se.isRecording=!1,Se.recordingTimer&&(clearInterval(Se.recordingTimer),Se.recordingTimer=null),!0}catch{return!1}}}}const qe={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)}},iM=Object.freeze(Object.defineProperty({__proto__:null,initMetricWebsiteFactory:async()=>{try{const e=ae.state.handle;if(!e)return;switch(e){case Ln:await Promise.resolve().then(()=>CB);break;case _r:await Promise.resolve().then(()=>rU);break;case $s:await Promise.resolve().then(()=>IU);break;case fi:await Promise.resolve().then(()=>ZU);break;case wr:await Promise.resolve().then(()=>mV);break;default:break}}catch(e){console.error(`Failed to load metric for ${handle}:`,e)}},metric:vt,metricChatbot:Xt,metricWebsite:qe},Symbol.toStringTag,{value:"Module"})),aM={class:"max-h-screen overflow-y-auto scroll-hidden"},lM={class:"flex justify-between items-start mb-4 outline-none ring-0",tabindex:"0"},cM={class:"flex items-center gap-2"},uM={class:"size-8 rounded-full overflow-hidden",style:{"max-width":"32px"}},dM=["src","alt"],fM={key:0,class:"font-semibold text-primary"},hM={class:"mb-5 px-1 select-text"},pM=["innerHTML"],mM=["innerHTML"],gM={class:"space-y-4"},vM={class:"mt-6"},yM=["disabled"],bM={key:1,class:"px-3 flex justify-center items-center bg-primary h-[46px] text-white rounded-xl text-center text-base"},_M=l("div",null,"Đã gửi thành công",-1),xM={__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}=It(ae.state),s=L(!As()),r=L(!1),o=L(!1),i=ht({}),a=L({}),c=L(!1),u=te(()=>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}),Xt.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(yo),{modal:!s.value,dismissible:!1,open:y(n),"onUpdate:open":g[1]||(g[1]=p=>Bt(n)?n.value=p:null),shouldScaleBackground:!1},{default:xe(()=>[G(y(tr),{to:e.chatViewRef},{default:xe(()=>[l("div",{class:ne(["drawer-overlay-custom backdrop-blur-sm",[y(n)&&"drawer-overlay-custom--open"]])},null,2),G(y(sr),{"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:xe(()=>[G(y(Tl),{"aria-describedby":"widget lead form title",class:"hidden"}),G(y(Al),{"aria-describedby":"widget lead form desc",class:"hidden"}),l("div",aM,[l("div",lM,[l("div",cM,[l("div",uM,[l("img",{src:e.bot.config.ui.logo,alt:e.bot.config.ui.name,class:"w-full"},null,8,dM)]),e.bot.config.ui.name?(m(),x("div",fM,D(e.bot.config.ui.name),1)):z("",!0)]),z("",!0)]),l("div",null,[l("div",hM,[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,pM),e.widget.formHeaderSubTitle?(m(),x("p",{key:0,innerHTML:e.widget.formHeaderSubTitle,class:"text-base text-gray-700 mt-2 leading-[140%]"},null,8,mM)):z("",!0)]),l("form",{onSubmit:Qt(f,["prevent"])},[l("div",gM,[(m(!0),x(be,null,Me(t.widget.fields,p=>(m(),oe(od,{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",vM,[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},D(r.value?"Đang gửi...":e.widget.buttonText||"Gửi"),11,yM)),o.value?(m(),x("div",bM,[_M,G(y(Qu),{size:"16",class:"ml-2"})])):z("",!0)])],32)])])]),_:1})]),_:1},8,["to"])]),_:1},8,["modal","open"]))}},wM={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"},kM=l("span",{class:"text-xs"},"Đang phát trực tiếp",-1),SM={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"},CM={class:"text-[11px] leading-3 font-medium tracking-tight tabular-nums text-right text-blue-400"},$M=16,TM={__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=L(null),s=L(!1),r=L(0),o=L(0),i=L([]),a=te(()=>o.value?r.value/o.value:0),c=te(()=>{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:$M},()=>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()}),Dt(()=>{n.value&&(n.value.pause(),n.value.src="",n.value=null)}),(p,v)=>e.isLastAudio&&e.voiceProcessing&&!e.assistantProcessing?(m(),x("div",wM,[G(y(Hu),{size:"16"}),kM])):(m(),x("div",SM,[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(nk),{key:0,size:10,fill:"currentColor"})):(m(),oe(y(ig),{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(be,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:mt({height:`${_}%`})},null,6))),128))]),l("div",CM,D(c.value),1)]))}},AM={__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 te(()=>{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)}},EM={class:"flex items-end gap-2 my-1"},IM={class:"relative flex flex-shrink-0 overflow-hidden bg-white rounded-full size-8 message-avatar"},PM=["src","alt"],MM={class:"flex-1 flex items-center gap-1.5 flex-wrap"},OM=["onClick"],LM={class:"leading-none"},RM={__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=>{Xt.ctaClick({type:"follow_up_questions",value:i}),n("send-message",i)};return(i,a)=>{var c,u,d;return m(),x("div",EM,[l("div",IM,[(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,PM)):z("",!0)]),l("div",MM,[(m(!0),x(be,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",LM,D(s(f)),1)],8,OM))),128))])])}}},DM={class:"flex-1 max-w-[300px]"},jM={class:"bg-gray-50/90 border rounded-xl"},NM={class:"flex items-center gap-2 text-sm leading-none text-gray-700"},FM={class:"overflow-hidden"},qM={class:"pb-2 px-1 pt-0"},zM={class:"border-t border-gray-200 pt-2 space-y-1"},BM=["href","title"],UM={class:"flex items-center mt-0.5 justify-center size-4 text-xs bg-gray-400 text-white flex-shrink-0 rounded-full"},VM={class:"leading-5 underline decoration-dashed underline-offset-4 decoration-gray-400 truncate group-hover/cite:decoration-blue-500 min-w-0 break-words"},HM={__name:"CardCitations",props:{citations:{type:Array,default:()=>[]}},setup(e){const t=L(!1),n=s=>{try{return decodeURIComponent(s)}catch{return s}};return(s,r)=>(m(),x("div",DM,[l("div",jM,[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",NM,[G(y(O2),{size:16,class:"shrink-0"}),l("div",null,"Nguồn ("+D(e.citations.length)+")",1)]),G(y(po),{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",FM,[l("div",qM,[l("div",zM,[(m(!0),x(be,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",UM,D(i+1),1),l("span",VM,D(n(o.title)),1)],8,BM))),128))])])])],2)])]))}},WM=e=>(gn("data-v-ddc21beb"),e=e(),vn(),e),GM={class:"flex items-end gap-2 my-1"},KM={class:"relative flex flex-shrink-0 overflow-hidden bg-white rounded-full size-8 message-avatar"},QM=["src","alt"],JM={class:"flex-1 min-w-0"},XM={class:"overflow-hidden rounded-2xl bg-white text-sm border border-gray-200 shadow-sm"},ZM={class:"flex items-center gap-3 border-b bg-white border-gray-100 pl-4 pr-2 py-3"},YM={class:"flex items-center gap-1 text-gray-900"},eO=WM(()=>l("div",{class:"text-lg font-semibold text-gray-900"}," Đơn hàng ",-1)),tO={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"},nO={class:"px-4 py-3.5"},sO=["innerHTML"],rO={key:1,class:"mt-3 flex flex-col gap-2"},oO=["disabled","onClick"],iO=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=L(!1),s=te(()=>bn(t.message.content)||{}),r=te(()=>{var f;return Xa(((f=s.value)==null?void 0:f.body_markdown)||"",{separate:!1})[0]||""}),o=te(()=>{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=te(()=>{var f;return i[(f=s.value)==null?void 0:f.status]||""}),c=te(()=>{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}):mn.actions.error({message:"Xác nhận đơn thất bại, vui lòng thử lại."})}catch{mn.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",GM,[l("div",KM,[(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,QM)):z("",!0)]),l("div",JM,[l("div",XM,[l("div",ZM,[l("div",YM,[G(y(cn),{size:"18",class:"text-gray-700"}),eO]),s.value.status==="draft"?(m(),x("div",tO,[G(nn,{class:"size-3 text-current"}),Ge(" Chờ xác nhận ")])):z("",!0)]),l("div",nO,[l("div",{class:"prose prose-sm max-w-none",innerHTML:r.value},null,8,sO),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),Ge(" "+D(a.value),1)],2)):z("",!0),o.value?(m(),x("div",rO,[(m(!0),x(be,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(nn,{key:0,class:"size-4 text-current"})):_.type==="confirm"?(m(),oe(y(dl),{key:1,size:"17","stroke-width":"2"})):(m(),oe(y(cn),{key:2,size:"17","stroke-width":"1.8"})),l("span",null,D(_.label),1)],10,oO))),128))])):z("",!0)])])])])}}},[["__scopeId","data-v-ddc21beb"]]),aO={class:"relative ecg-widget-header"},lO={class:"flex items-center justify-between p-3.5 text-white bg-primary"},cO={class:"flex items-center gap-2"},uO=["aria-label"],dO=["src","alt"],fO={class:"text-base font-medium tracking-tight"},hO={class:"flex gap-1.5"},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={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"},gO={class:"flex flex-col flex-grow px-2 pt-4 space-y-4 duration-100 lg:px-4 chat-content-item"},vO={class:"space-y-3 mb-4"},yO=["id"],bO=["src","alt"],_O=["id"],xO=["src","alt"],wO=["src","alt"],kO={key:2,class:"ml-auto"},SO={key:3,class:"relative w-full"},CO=["onClick"],$O={key:1,class:"relative pl-[40px]"},TO={key:0,class:"absolute bottom-0 left-0"},AO=["src","alt"],EO={key:7,class:"w-full"},IO={key:13,class:"flex items-end gap-2 w-full"},PO=["src","alt"],MO=["src","alt"],OO={key:0,class:"justify-center !items-start messages-group duration-200 pt-4 pb-2"},LO=["src","alt"],RO={class:"messages"},DO={key:1,class:"justify-center !items-start messages-group duration-200 opacity-100 py-4"},jO=["src","alt"],NO={class:"messages"},FO={key:0,class:"flex flex-col items-end py-4 space-y-2"},qO=["onClick","innerHTML"],zO={class:"relative"},BO=["aria-label","title"],UO={class:"relative z-30 bg-white"},VO={class:"w-full px-3 pt-1"},HO={class:"border border-gray-200 rounded-2xl"},WO={key:0,class:"p-2 pb-1"},GO={class:"flex items-center gap-1"},KO={class:"flex-shrink-0"},QO=["innerHTML"],JO={class:"relative flex w-full"},XO={key:0,class:"flex absolute top-1/2 -translate-y-1/2 left-1.5 z-10 items-center quick-prompts"},ZO=["title"],YO={key:0,class:"overflow-hidden quick-prompts-popover"},e7=["onClick"],t7=["placeholder"],n7={class:"absolute z-10 flex items-center duration-200 top-1/2 -translate-y-1/2 right-1"},s7={key:0,class:"size-3 rounded-sm bg-white"},ev={__name:"ChatView",props:{showMenu:{type:Boolean,default:!1}},setup(e){const t=Kt({loader:()=>Promise.resolve().then(()=>_V),delay:1e3}),n=Kt({loader:()=>Promise.resolve().then(()=>GV),delay:1e3}),s=Kt({loader:()=>Promise.resolve().then(()=>QV),delay:1e3}),{bot:r,handle:o}=It(V),{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:C,scrollToBottom:E,validatedAgentAvatar:O,isAgentEnabled:I}=Er({handle:o.value}),{voiceAudio:M}=Nm({handle:o.value}),{processedFiles:P,uploadFilesToServer:q,setupPasteListener:H,cleanupPasteListener:T}=_l(),{isOpen:A,isStartSpeechToText:R,closeChatVoice:K,releaseMediaResources:W}=gd(),{widgets:U}=Zs(),{isLocked:J}=rd(),{t:X}=tn(),Y=L(!1),he=L(!1),ce=L(null),ue=we=>{ce.value={id:we.id,content:we.content,content_type:we.content_type,sender_type:we.sender_type,sender_name:we.sender_name||null},wt(()=>{fe.value&&fe.value.focus()})},Te=()=>{ce.value=null},je=L(null),re=L(null),fe=L(null),Ce=L(!1),$e=L(!0),Le=L(null),Be=L(!1);Gc("chatViewRef",je);const Ue=["file","gif","image","video","audio","sticker","business_card"],N=te(()=>{const we=[];return i.value.forEach(ke=>{if(Ue.includes(ke.content_type))try{ke.content.forEach((lt,At)=>{we.push({...lt,messageId:ke.id,messageIndex:At})})}catch(Ye){console.warn("Failed to parse message content:",Ye)}}),we}),ee=te(()=>!i.value.find(ke=>ke.sender_type==="user")),Q=te(()=>{var ke,Ye,lt;let we=((lt=(Ye=(ke=r.value)==null?void 0:ke.config)==null?void 0:Ye.quickPrompt)==null?void 0:lt.messages)||[];return we=Object.values(we),we.map(At=>At.content)}),j=te(()=>{var we,ke,Ye;return!!((Ye=(ke=(we=r.value)==null?void 0:we.config)==null?void 0:ke.delay_response)!=null&&Ye.active)}),B=te(()=>j.value||u.value),ie=te(()=>{var ke,Ye;const we=(Ye=(ke=r.value)==null?void 0:ke.config)!=null&&Ye.stream?i.value:fw(i.value,"assistant");return vs(we)});Pe(a,we=>{ce.value=null,we?V.localStorageFormOrder=`${bu}-${a.value}`:(localStorage.removeItem(V.localStorageFormOrder),V.selectedForm=null,V.totalFormItems=0)},{immediate:!0});const me=we=>{if(we.key==="Escape"&&ce.value){Te();return}if(we.key===" "&&we.stopPropagation(),!(we.key==="Enter"&&we.shiftKey)&&we.key==="Enter"&&!we.shiftKey){if(we.preventDefault(),he.value||u.value&&!j.value)return;(_.value.trim().length>1||P.value.length>0)&&Ie()}},de=we=>{if(!fe.value)return;fe.value.style.height="auto";const Ye=Math.min(fe.value.scrollHeight,120);fe.value.style.height=`${Ye}px`},ge=we=>{we.stopPropagation(),de()},pe=we=>{we.stopPropagation()},Ae=we=>{we.stopPropagation()},Ne=we=>{if(!C.value)return;const ke=C.value,Ye=ke.scrollTop,lt=ke.scrollHeight,At=ke.clientHeight,An=lt-(Ye+At);Be.value=An>300},De=()=>{E(),Be.value=!1},Ie=async()=>{A.value&&(K(),W());const we=_.value;_.value="",await q();const ke=P.value,Ye=ce.value;ce.value=null,v({message:we,files:ke,replyTarget:Ye}),P.value=[],fe.value&&(fe.value.style.height="44px")},We=we=>we.sender_type==="user";function it(){if(!r.value)return;const we=r.value.config.initialMessage.messages??[],ke=r.value.config.introductionMessage,Ye=Object.values(we).map(At=>At.content);let lt=_i(Ye).length;if(ke&&typeof ke=="string"&&(lt+=1),lt>0)for(let At=0;At<lt;At++)i.value[At]&&(i.value[At].is_welcome_message=!0)}const at=async()=>{var we,ke;try{const Ye=$t.get(ns);if(!Ye)return;const{data:lt}=await Xe.auth.getUser();lt.success&&(V.user=lt.data,V.token=Ye)}catch(Ye){((ke=(we=Ye.response.data)==null?void 0:we.raw)==null?void 0:ke.message)==="error_token_is_expired"&&(V.user=null,V.token=null,$t.remove(ns))}},dt=async()=>{const{data:we}=await Xe.cart.getList();we.success&&(V.cart=we.data)},Tt=async()=>{o.value===Ln&&await Promise.all([dt(),at()]),h({onSuccess:async()=>{it()}})},Lt=async we=>{const{source:ke}=we||{};ke==="rangdongstore"&&dt()},un=async()=>{try{await Xe.auth.logout(),V.user=null,V.token=null,$t.remove(ns),dt()}catch{}},qt=(we={})=>{const{source:ke,data:Ye}=we;ke==="rangdongstore"&&($t.set(ns,Ye.access_token,"14d"),at(),dt())};Je(async()=>{await Tt(),SC().getForms(),f.value[o.value]||localStorage.removeItem(`${bu}-${o.value}`),Le.value=window.location.origin,o.value===Ln&&window.ECG&&(ECG.sync.on("login",qt),ECG.sync.on("logout",un),ECG.sync.on("cart",Lt)),H(),wt(async()=>{de()}),E({delay:500})}),Bf(()=>{E()}),Dt(()=>{T()});const se=()=>{A.value&&(K(),W())},ye=async(we="")=>{await wt(),_.value=we,fe.value&&(fe.value.style.height="44px"),console.log("Voice input cancelled")},Re=we=>{we&&we.trim()&&(_.value=we,wt(()=>{fe.value&&(fe.value.focus(),de())}))},ze=async we=>{(A.value||R.value)&&(K(),W());const ke=we||"Không có nội dung thoại",Ye=o.value==="g8homevn";if(Ye)try{console.log("[ChatView] Unlocking audio for voice message..."),await M.unlockAudio()}catch(lt){console.error("[ChatView] Failed to unlock audio:",lt)}v({message:ke,mode:Ye?"voice":void 0,audio_url:Ye?!0:void 0}),_.value="",fe.value&&(fe.value.style.height="44px")},Oe=async we=>{const ke=Mu(we)?we.message:we;p(ke),Y.value=!1,await wt(),v({message:ke})};return Pe(i,()=>{E()}),(we,ke)=>{var Ye,lt,At,An,Kn,xn,zt,Bl,Ul,Vl,Rr;return m(),x("div",{id:"chat-view",ref_key:"chatViewRef",ref:je,class:"flex flex-col overflow-hidden bg-white"},[y(r)?(m(),x(be,{key:0},[l("div",aO,[l("div",lO,[l("div",cO,[e.showMenu?(m(),x("button",{key:0,onClick:ke[0]||(ke[0]=_e=>we.$emit("close")),class:"p-1.5 rounded-lg hover:bg-white/10 text-white","aria-label":y(X)("common.back")},[G(y(mo),{size:20})],8,uO)):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($n)?"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,dO)],2)):z("",!0),l("h2",fO,D(y(r).config.ui.name),1)]),l("div",hO,[y(o)===y(Ln)?(m(),x(be,{key:0},[G(NP,{chatViewRef:je.value},null,8,["chatViewRef"]),l("button",{onClick:ke[1]||(ke[1]=_e=>y(V).cart?Ce.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(V).cart?"cursor-pointer":"cursor-not-allowed"])},[G(y(cn),{size:"14"}),y(V).cart&&y(V).cart.total_items?(m(),x("span",pO,D(y(V).cart&&y(V).cart.total_items),1)):z("",!0)],2)],64)):y(V).forms&&y(V).forms.order&&![y(zn),y(Bn),y(ai),y(_r),y(so),y(br),y(ss),y(wr)].includes(y(o))?(m(),x("button",{key:1,class:ne([y(V).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:ke[2]||(ke[2]=_e=>y(V).totalFormItems>0?y(V).isOpenForm=!0:null)},[G(y(cn),{size:"14"}),y(V).totalFormItems>0?(m(),x("span",mO,D(y(V).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:ke[3]||(ke[3]=_e=>(y(g)(),Be.value=!1))},[G(y(ik),{size:"14"})],2),Pt(we.$slots,"actions")])])]),l("div",{class:"messages-wrapper",ref_key:"messagesContainerRef",ref:C,style:mt({overflowY:y(J)?"hidden":""}),onWheel:pe,onTouchmove:Ae,onScroll:Ne},[$e.value&&((At=(lt=(Ye=y(r))==null?void 0:Ye.config)==null?void 0:lt.banners)==null?void 0:At.length)>0?(m(),oe(dI,{key:0,banners:y(r).config.banners,onClose:ke[4]||(ke[4]=_e=>$e.value=!1),class:"chat-content-item"},null,8,["banners"])):z("",!0),l("div",gO,[l("div",vO,[(m(!0),x(be,null,Me(ie.value,(_e,as)=>{var So,Hl,Wl,Gl,Kl,Ql,Fi,bs,Jl,Xl,Zl,Co,$o,Yl,ec,tc,nc,To,sc,rc,oc,ic,ac,Qn,qi,_s,Ao,lc,cc,uc,dc,Eo,fc,hc,zi,Dr;return m(),x(be,{key:_e.id},[_e.is_welcome_message?(m(),x("div",{key:0,id:_e.id?`message-${_e.id}`:void 0,class:ne(["messages-group message-assistant",!((So=ie.value[as+1])!=null&&So.is_welcome_message)&&"!mt-2"])},[l("span",{class:ne(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",[!((Hl=ie.value[as+1])!=null&&Hl.is_welcome_message)||_e.is_introduction_message?"opacity-100":"opacity-0",y(o)===y($n)?"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,bO)):z("",!0)],2),l("div",{class:ne(["messages",{"is-user":We(_e)}])},[(m(!0),x(be,null,Me(y(Xa)(_e.content,{separate:!1}),(dn,jr)=>{var En,Os,Jn;return m(),oe(pg,{key:jr,message:{..._e,content:dn},anchorId:!1,chatViewRef:je.value,isUser:We(_e),newMessageStatus:y(d),isLatestUserMessage:_e.is_last_message===!0,logo:(Jn=(Os=(En=y(r))==null?void 0:En.config)==null?void 0:Os.ui)==null?void 0:Jn.logo,onReply:ue},null,8,["message","chatViewRef","isUser","newMessageStatus","isLatestUserMessage","logo"])}),128))],2)],10,yO)):_e.content_type!=="system_time_line"?(m(),x("div",{key:1,id:_e.id?`message-${_e.id}`:void 0,class:ne(["messages-group",[We(_e)?"message-user":"message-assistant",_e.sender&&"message-sender"]])},[!We(_e)&&(_e.content_type==="text"||Ue.includes(_e.content_type))?(m(),x(be,{key:0},[_e.is_last_assistant_message||_e.sender||!((Wl=ie.value[as])!=null&&Wl.sender)&&((Gl=ie.value[as+1])!=null&&Gl.sender)?(m(),x("span",{key:0,class:ne(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",y(o)===y($n)?"rounded":"rounded-full"])},[(Kl=_e.sender)!=null&&Kl.avatar?(m(),x("img",{key:0,src:(Ql=_e.sender)==null?void 0:Ql.avatar,alt:(Fi=_e.sender)==null?void 0:Fi.name,class:"object-cover w-full h-full"},null,8,xO)):(m(),x("img",{key:1,src:(Jl=(bs=y(r).config)==null?void 0:bs.ui)==null?void 0:Jl.logo,alt:y(r).config.ui.name,class:"object-cover w-full h-full"},null,8,wO))],2)):(m(),x("span",{key:1,class:ne(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",y(o)===y($n)?"rounded":"rounded-full"])},null,2))],64)):z("",!0),_e.content_type==="text"&&!_e.audio_url?(m(),x("div",{key:1,class:ne(["messages",{"is-user":We(_e)}])},[(m(!0),x(be,null,Me(y(Xa)(_e.content,{separate:!_e.is_welcome_message}),(dn,jr)=>{var En,Os,Jn;return m(),x("div",{key:jr,class:"group-message-nested"},[G(pg,{message:{..._e,content:dn},anchorId:!1,chatViewRef:je.value,isUser:We(_e),newMessageStatus:y(d),isLatestUserMessage:_e.is_last_message===!0,logo:(Jn=(Os=(En=y(r))==null?void 0:En.config)==null?void 0:Os.ui)==null?void 0:Jn.logo,onReply:ue},null,8,["message","chatViewRef","isUser","newMessageStatus","isLatestUserMessage","logo"])])}),128))],2)):_e.sender_type==="user"&&_e.audio_url?(m(),x("div",kO,[G(vI,{"message-text":_e.content},null,8,["message-text"])])):_e.content_type==="cards"&&((Zl=(Xl=y(bn)(_e.content))==null?void 0:Xl.elements)==null?void 0:Zl.length)>0?(m(),x("div",SO,[(($o=(Co=y(bn)(_e.content))==null?void 0:Co.elements)==null?void 0:$o.length)>1?(m(),oe(Mi,{key:0,class:"w-full max-w-3xl pr-2"},{default:xe(({selectedIndex:dn,scrollTo:jr})=>{var En;return[(m(!0),x(be,null,Me(((En=y(bn)(_e.content))==null?void 0:En.elements)||[],(Os,Jn)=>(m(),oe(bl,{key:Jn,class:"w-[65%]"},{default:xe(()=>{var pc,mc,gc;return[l("div",{class:ne([[dn===Jn?"opacity-100":"opacity-30"],"relative h-full duration-700"])},[l("div",{onClick:Vv=>jr(Jn),class:ne(["absolute inset-0 z-10 cursor-pointer",dn==Jn&&"hidden"])},null,10,CO),G(hC,{item:Os,logo:(gc=(mc=(pc=y(r))==null?void 0:pc.config)==null?void 0:mc.ui)==null?void 0:gc.logo},null,8,["item","logo"])],2)]}),_:2},1024))),128))]}),_:2},1024)):(m(),x("div",$O,[_e.is_last_assistant_message?(m(),x("div",TO,[l("span",{class:ne(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",y(o)===y($n)?"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,AO)):z("",!0)],2)])):z("",!0),G(kC,{item:(ec=(Yl=y(bn)(_e.content))==null?void 0:Yl.elements)==null?void 0:ec[0],logo:(To=(nc=(tc=y(r))==null?void 0:tc.config)==null?void 0:nc.ui)==null?void 0:To.logo},null,8,["item","logo"])]))])):_e.content_type==="iframe"?(m(),oe(b5,{key:4,item:_e,handle:y(o)},null,8,["item","handle"])):_e.content&&_e.content_type==="product_cards"&&((rc=(sc=y(bn)(_e.content))==null?void 0:sc.elements)==null?void 0:rc.length)>0?(m(),oe(k5,{key:5,products:((oc=y(bn)(_e.content))==null?void 0:oc.elements)||[],message:_e,onSendMessage:ke[5]||(ke[5]=dn=>y(v)({message:dn})),onOpenFlowCheckout:ke[6]||(ke[6]=dn=>Ce.value=!0)},null,8,["products","message"])):_e.content&&_e.content_type==="address"&&((ac=(ic=y(bn)(_e.content))==null?void 0:ic.elements)==null?void 0:ac.length)>0?(m(),oe(u3,{key:6,stores:(Qn=y(bn)(_e.content))==null?void 0:Qn.elements,logo:(Ao=(_s=(qi=y(r))==null?void 0:qi.config)==null?void 0:_s.ui)==null?void 0:Ao.logo,botName:(uc=(cc=(lc=y(r))==null?void 0:lc.config)==null?void 0:cc.ui)==null?void 0:uc.name},null,8,["stores","logo","botName"])):_e.content_type==="form"?(m(),x("div",EO,[G(kg,{message:_e},null,8,["message"])])):_e.content_type==="audio"&&_e.audio_url?(m(),oe(TM,{key:8,audioSrc:_e.audio_url,isLastAudio:_e.is_last_audio,assistantProcessing:y(u),voiceProcessing:y(M).isPlaying.value},null,8,["audioSrc","isLastAudio","assistantProcessing","voiceProcessing"])):[...Ue,"attachment"].includes(_e.content_type)?(m(),oe(Q5,{key:9,message:_e,files:N.value,isUser:We(_e),newMessageStatus:y(d),isLatestUserMessage:_e.is_last_message===!0},null,8,["message","files","isUser","newMessageStatus","isLatestUserMessage"])):_e.content_type==="agent_join"||_e.content_type==="agent_exit"?(m(),oe(AM,{key:10,message:_e,bot:y(r)},null,8,["message","bot"])):_e.content_type==="follow_up"?(m(),oe(RM,{key:11,elements:((dc=y(bn)(_e.content))==null?void 0:dc.elements)||[],title:((Eo=y(bn)(_e.content))==null?void 0:Eo.title)||"",bot:y(r),onSendMessage:ke[7]||(ke[7]=dn=>y(v)({message:dn}))},null,8,["elements","title","bot"])):_e.content_type==="order"?(m(),oe(iO,{key:12,message:_e,bot:y(r),"conversation-id":y(a)},null,8,["message","bot","conversation-id"])):_e.content_type==="citations"?(m(),x("div",IO,[l("span",{class:ne(["flex overflow-hidden relative bg-white size-8 flex-shrink-0 message-avatar",y(o)===y($n)?"rounded":"rounded-full"])},[(fc=_e==null?void 0:_e.sender)!=null&&fc.avatar?(m(),x("img",{key:0,src:_e.sender.avatar,alt:_e.sender.name,class:"object-cover w-full h-full"},null,8,PO)):(m(),x("img",{key:1,src:(zi=(hc=y(r).config)==null?void 0:hc.ui)==null?void 0:zi.logo,alt:y(r).config.ui.name,class:"object-cover w-full h-full"},null,8,MO))],2),G(HM,{citations:((Dr=y(bn)(_e.content))==null?void 0:Dr.elements)||[]},null,8,["citations"])])):z("",!0)],10,_O)):z("",!0)],64)}),128)),y(u)&&y(r).is_bot_working_hours&&((An=y(c))==null?void 0:An.response_mode)!=="manual"&&y(d)==="read"?(m(),x("div",OO,[l("div",{class:ne(["relative flex flex-shrink-0 overflow-hidden bg-white size-8 message-avatar",y(o)===y($n)?"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,LO)):z("",!0)],2),l("div",RO,[G(y(t),{onStart:y(E)},null,8,["onStart"])])])):z("",!0),y(w)&&!y(u)?(m(),x("div",DO,[l("div",{class:ne(["relative flex flex-shrink-0 overflow-hidden bg-white size-8",y(o)===y($n)?"rounded":"rounded-full"])},[l("img",{src:y(O)||y(r).config.ui.logo,alt:((Kn=y(k))==null?void 0:Kn.name)||y(r).config.ui.name,class:"object-cover w-full h-full"},null,8,jO)],2),l("div",NO,[G(y(t),{onStart:y(E),agent:y(k)},null,8,["onStart","agent"])])])):z("",!0)])]),l("div",{class:ne(["px-4 duration-200",[re.value&&re.value.showToggleButton&&!y(u)?"pb-8":"pb-0"]])},[ee.value&&!y(u)?(m(),x("div",FO,[(m(!0),x(be,null,Me(Q.value,(_e,as)=>(m(),x("div",{key:as,class:"quick-prompt-tag active",onClick:So=>Oe(_e),innerHTML:y(Mu)(_e)?_e.name:_e},null,8,qO))),128))])):z("",!0)],2)],36),l("div",zO,[Be.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(X)("chat.scrollToBottom"),title:y(X)("chat.scrollToBottom")},[G(y(po),{size:16,class:"text-gray-600"})],8,BO)):z("",!0),(y(U).ai_product_insight||y(to)[y(o)])&&![y(ii)].includes(y(o))?(m(),oe(NI,{key:1,ref_key:"aiSuggestionRef",ref:re,widget:y(U).ai_product_insight},null,8,["widget"])):z("",!0),l("div",UO,[l("div",VO,[l("div",HO,[G(en,{name:"expand",mode:"out-in"},{default:xe(()=>[y(mn).state.message?(m(),x("div",WO,[l("div",{class:ne(["px-3 py-2 rounded-md border animate-[slideIn_0.3s_ease-out_forwards]",y(mn).state.type==="success"?"bg-green-50/80 border-green-200 text-green-500":y(mn).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",GO,[l("div",KO,[y(mn).state.type==="success"?(m(),oe(y(R2),{key:0,class:"text-green-500 size-4"})):y(mn).state.type==="warning"?(m(),oe(y(G2),{key:1,class:"text-orange-500 size-4"})):(m(),oe(y(lk),{key:2,class:"text-red-500 size-4"}))]),l("div",{class:"text-sm leading-[120%] font-normal",innerHTML:y(mn).state.message},null,8,QO)])],2)])):z("",!0)]),_:1}),G(en,{name:"expand",mode:"out-in"},{default:xe(()=>[G(YP,{class:"px-3"})]),_:1}),G(en,{name:"expand",mode:"out-in"},{default:xe(()=>[ce.value?(m(),oe(lS,{key:0,replyTarget:ce.value,onCancel:Te},null,8,["replyTarget"])):z("",!0)]),_:1}),l("div",JO,[Q.value.length>0?(m(),x("div",XO,[l("button",{type:"button",onClick:ke[8]||(ke[8]=_e=>Y.value=!Y.value),class:ne(["flex items-center justify-center transition-colors rounded-full size-8 overflow-hidden hover:bg-gray-50",Y.value?"bg-gray-50":"bg-white"]),title:y(X)("chat.quickPrompts")},[G(y(Z2),{size:"18",class:"text-gray-500"})],10,ZO),Y.value?(m(),x("div",YO,[(m(!0),x(be,null,Me(Q.value,(_e,as)=>(m(),x("div",{key:as,class:"quick-prompt-item",onClick:So=>Oe(_e)},D(y(Mu)(_e)?_e.name:_e),9,e7))),128))])):z("",!0)])):z("",!0),Rt(l("textarea",{id:"eac-chat-input",class:"resize-none rounded-3xl input",placeholder:y(X)("chat.placeholder"),"onUpdate:modelValue":ke[9]||(ke[9]=_e=>Bt(_)?_.value=_e:null),onKeydown:me,onFocus:ke[10]||(ke[10]=_e=>se()),onInput:ge,onCompositionstart:ke[11]||(ke[11]=_e=>he.value=!0),onCompositionend:ke[12]||(ke[12]=_e=>he.value=!1),ref_key:"textareaRef",ref:fe,rows:"1"},null,40,t7),[[on,y(_)]]),l("div",n7,[(y(U).voice_chat||y(r).is_test_user)&&!y(I)?(m(),oe(y(s),{key:0,assistantProcessing:y(u),voiceProcessing:y(M).isPlaying.value,class:ne(["duration-200",[y(_).length>0?"scale-0":"scale-100"]])},null,8,["assistantProcessing","voiceProcessing","class"])):z("",!0),(zt=(xn=y(r).config.toolbar)==null?void 0:xn.file_upload)!=null&&zt.visible||(Ul=(Bl=y(r).config.toolbar)==null?void 0:Bl.image_upload)!=null&&Ul.visible||(Rr=(Vl=y(r).config.toolbar)==null?void 0:Vl.audio_upload)!=null&&Rr.visible?(m(),oe(rM,{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:ke[13]||(ke[13]=_e=>y(u)&&!j.value||y(_).length<=1&&y(P).length===0?null:Ie()),class:ne([[y(_).length>1||y(P).length>0||y(i).length>0&&B.value?"bg-primary text-white sm:hover:opacity-80":"bg-gray-100 text-gray-400 cursor-default",y(u)&&!j.value&&"flicker-effect cursor-wait"],"flex items-center justify-center ml-1.5 duration-200 rounded-full size-9"])},[y(u)&&!j.value?(m(),x("div",s7)):(m(),oe(y(lg),{key:1,size:"16"}))],2)])]),y(U).voice_chat?(m(),oe(y(n),{key:0,onCancelTranscription:ke[14]||(ke[14]=_e=>ye()),onEditTranscription:ke[15]||(ke[15]=_e=>Re(_e)),onTranscriptionComplete:ke[16]||(ke[16]=_e=>ze(_e))})):z("",!0)])])])]),y(o)===y(Ln)?(m(),oe(cI,{key:0,chatViewRef:je.value,open:Ce.value,"onUpdate:open":ke[17]||(ke[17]=_e=>Ce.value=_e)},null,8,["chatViewRef","open"])):(m(),oe(O4,{key:1,chatViewRef:je.value,onSendMessage:ke[18]||(ke[18]=_e=>y(v)({message:_e}))},null,8,["chatViewRef"])),G(AT,{chatViewRef:je.value},null,8,["chatViewRef"]),je.value&&y(U).widget_form_render_pre_send?(m(),oe(xM,{key:2,bot:y(r),widget:y(U).widget_form_render_pre_send,chatViewRef:je.value},null,8,["bot","widget","chatViewRef"])):z("",!0)],64)):z("",!0)],512)}}},r7=Object.freeze(Object.defineProperty({__proto__:null,default:ev},Symbol.toStringTag,{value:"Module"})),o7={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"},i7=["src","alt"],a7={__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}=It(ae.state),i=te(()=>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($n)?"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",o7,[l("span",null,D(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(Bn),y(zn)].includes(y(r))?"rounded-2xl bg-transparent shadow":y(r)===y($n)&&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,i7)):(m(),oe(y(ng),{key:1,size:"48",class:"block text-white max-w-[56%]"}))],2)],2)}}},l7=["innerHTML"],c7=Qe({__name:"VerticalSlideUp",props:{messages:{type:Array,default:()=>[]},stopIndex:{type:Number,default:0}},setup(e){const t=e,n=L(null),s=L(null),r=L([]),o=ht({verticalSlideList:null,verticalSlideItemHeight:0,indexVertical:0,maxIndexVertical:0,heightSlideItemActive:null,heightSlideItemPreActive:null,isStopVertical:!1,slideInterval:null,hasStarted:!1}),i=L(null),a=()=>{wt(()=>{!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,C;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)||((C=(k=o.verticalSlideList)==null?void 0:k[0])==null?void 0:C.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()}),Dt(()=>{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(be,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,l7))),128))],544)],512))}},[["__scopeId","data-v-62f66be8"]]),u7=ht({quickPrompts:[],welcomeMessages:[],welcomeMessagesDefault:[],quickPromptsDefault:[],keyQuickPrompt:1}),vd=(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),tv=e=>e!=null&&e.messages?vd(e.messages).length>0:!1,d7={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ị 😊"]},nv={},sv=(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)},f7=(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?sv(r,t)||sv(r,n):!1})??null,h7=()=>{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 p7(){const{quickPrompts:e,welcomeMessages:t,welcomeMessagesDefault:n,quickPromptsDefault:s,keyQuickPrompt:r}=It(u7),{widgets:o}=Zs();function i(){var g,p;if(!to[ae.state.handle]&&!o.value.ai_product_insight){t.value=n.value,e.value=s.value;return}const u=rs("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===xr&&(f="product"),h=_}else if(ae.state.handle===xr){const v=h7();v&&(f="category",h=v)}if(f&&h){const v=((g=o.value.ai_product_insight)==null?void 0:g.dynamic_prompts)??to[ae.state.handle]??to.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=f7(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=[];nv[ae.state.handle]?w=nv[ae.state.handle][f]:w=d7[f];const k=w.map(E=>E.replace("{title}",h).replace("{brand}",V.bot.config.ui.name));t.value=k;let C=vm(_,{title:h,logo:ae.state.bot.config.ui.logo,brand:ae.state.bot.config.ui.name})[f];e.value=C,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=tv(u.initialMessage),f=tv(u.quickPrompt);!d&&!f||(n.value=d?vd(u.initialMessage.messages):[],s.value=f?vd(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 m7=["srcset"],g7=["src","alt","width","height"],rv=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=te(()=>t.mobileSrc||t.desktopSrc),r=te(()=>t.desktopSrc);return(o,i)=>(m(),x("picture",null,[l("source",{srcset:n(s.value),media:"(max-width: 525px)"},null,8,m7),l("img",{src:n(r.value),alt:e.alt,class:ne(e.classImg),width:e.width,height:e.height},null,10,g7)]))}},[["__scopeId","data-v-a2e952ab"]]),v7={key:0},y7={key:0},b7={class:"fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-[9999999999]"},_7={class:"w-[76vw] md:w-[420px] relative"},x7={class:"absolute -top-9 -right-1"},w7="EAC_CLOSE_WIDGET_POPUP_BANNER",k7={__name:"ShapePopupBanner",props:{item:{type:Object,default:()=>{}}},setup(e){const t=e,n=L(!1),s=L(!1),r=L(null),o=L(null),i=te(()=>{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,$t.set(w7,1,"1d")};return(d,f)=>i.value?(m(),x("div",v7,[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(Ft(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:xe(()=>[G(rv,{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(Ir),{"stroke-width":"2.5",class:ne(["text-white",i.value.alignment.position==="right"?"rotate-180":"rotate-0"])},null,8,["class"])],2),G(en,{name:"fade"},{default:xe(()=>[n.value?(m(),x("div",y7,[l("div",{onClick:f[3]||(f[3]=h=>u()),class:"fixed inset-0 z-[9999999998] bg-black opacity-20"}),l("div",b7,[l("div",_7,[l("div",x7,[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(Ft(i.value.link?"a":"div"),{href:i.value.link,target:"_blank",class:"block",onClick:f[5]||(f[5]=h=>u())},{default:xe(()=>[G(rv,{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)}},S7={},C7={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32",version:"1.1",fill:"currentColor"},$7=[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 T7(e,t){return m(),x("svg",C7,$7)}const A7=Qe(S7,[["render",T7]]),E7={class:"px-5 pt-8"},I7={key:0,class:"flex flex-col items-center pb-6 sm:pt-3 sm:min-h-[220px] relative"},P7={class:"mb-3"},M7={class:"text-[18px] font-medium text-gray-900 mb-2"},O7=["innerHTML"],L7={class:"mt-3"},R7={class:"flex items-center justify-center space-x-1"},D7={key:1,"data-name":"eac-widget-form-survey",class:"h-fit sm:max-h-[76vh] overflow-y-auto scroll-hidden"},j7={class:"overflow-y-auto flex-1"},N7={class:"mb-3 relative"},F7=["src","alt"],q7=["innerHTML"],z7={class:"text-xs text-gray-500 text-center mt-1"},B7=["innerHTML"],U7={class:"space-y-4"},V7={class:"flex items-center justify-center space-x-2"},H7=["onClick"],W7={class:"text-sm font-medium mt-1 text-[#FAAD14] text-center"},G7={key:0,class:"flex justify-center flex-wrap gap-1.5 mb-4"},K7=["onClick"],Q7=["placeholder"],J7={class:"text-xs text-gray-500 text-right"},X7={class:"pt-4 sticky bottom-0 bg-white"},Z7=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}=tn(),s=e,r=t,o=L(!1),i=L(!1),a=ht({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=te(()=>{var E;return(u[(E=s.bot)==null?void 0:E.handle]??u.default).map(O=>n(O))}),f=te(()=>{var C;return((C=s.bot)==null?void 0:C.handle)==="easyaiagentsapp"?{title:n("survey.website.meetingTitle"),description:n("survey.website.meetingDescription")}:{title:n("survey.website.title"),description:n("survey.website.description")}}),h=te(()=>[n("survey.ratingVeryBad"),n("survey.ratingBad"),n("survey.ratingAverage"),n("survey.ratingGood"),n("survey.ratingExcellent")]),g=C=>{a.rating=C},p=()=>{o.value=!0,a.feedback_issues=[],a.detailed_feedback="";let C=setTimeout(()=>{r("close"),clearTimeout(C),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 C={status:"submitted",conversation_id:null,message_id:null,submission_data:a},E=await Xe.submission.submitWidget({widgetId:s.widget.id,formData:C});E.data&&E.status===200&&p()}catch(C){console.log("Error Submission: ",C)}finally{i.value=!1}},_=()=>{p()},w=()=>{a.detailed_feedback.length>300&&(a.detailed_feedback=a.detailed_feedback.slice(0,300))},k=C=>{const E=a.feedback_issues.indexOf(C);E===-1?a.feedback_issues.push(C):a.feedback_issues.splice(E,1)};return(C,E)=>{var O;return m(),x("div",E7,[o.value?(m(),x("div",I7,[l("div",P7,[G(y(Wu),{size:"42","stroke-width":"1",class:"text-gray-600"})]),l("h3",M7,D(y(n)("survey.thanksTitle")),1),l("p",{class:"text-center text-sm text-gray-600 px-2",innerHTML:y(n)("survey.thanksBody")},null,8,O7),l("div",L7,[l("div",R7,[(m(),x(be,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",D7,[l("div",j7,[l("div",N7,[l("div",{class:ne(["size-[42px] overflow-hidden mx-auto mb-2",((O=s.bot)==null?void 0:O.handle)===y($n)?"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,F7)],2),l("h2",{class:"text-[20px] font-medium text-gray-900 text-center",innerHTML:f.value.title},null,8,q7),l("div",z7,[l("span",{innerHTML:f.value.description},null,8,B7)])]),l("div",U7,[l("div",null,[l("div",V7,[(m(),x(be,null,Me(5,I=>l("div",{key:I,class:"star-wrapper",onClick:M=>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,H7)),64))]),l("div",W7,D(h.value[a.rating-1]),1)]),l("div",null,[a.rating<=3?(m(),x("div",G7,[(m(!0),x(be,null,Me(d.value,I=>(m(),x("div",{key:I,onClick:M=>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"])},D(I),11,K7))),128))])):z("",!0),Rt(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,Q7),[[on,a.detailed_feedback]]),l("div",J7,D(a.detailed_feedback.length)+" / 300 ",1)])])]),l("div",X7,[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,D(y(n)("survey.submit")),1)])])]))])}}},[["__scopeId","data-v-13c354eb"]]),Y7={class:"px-5 pt-8"},eL={key:0,class:"flex flex-col items-center pb-6 sm:pt-4 sm:min-h-[240px] relative"},tL={class:"mb-3"},nL={class:"text-[20px] font-medium text-gray-900 mb-2"},sL=["innerHTML"],rL={class:"mt-3"},oL={class:"flex items-center justify-center space-x-1"},iL={key:1,"data-name":"eac-widget-form-survey",class:"h-fit sm:max-h-[76vh] overflow-y-auto scroll-hidden"},aL={class:"mb-3 relative"},lL={class:"size-[40px] rounded-full overflow-hidden mx-auto mb-2"},cL=["src","alt"],uL={class:"text-base font-medium text-gray-900 text-center"},dL=["innerHTML"],fL={class:"space-y-4"},hL={class:"space-y-1"},pL={class:"flex items-center justify-center space-x-2"},mL=["onClick"],gL={class:"text-sm font-medium text-[#FAAD14] text-center"},vL={key:0,class:"space-y-1"},yL={class:"text-sm text-gray-900"},bL={class:"flex flex-wrap gap-1"},_L=["onClick"],xL={key:1,class:"space-y-1"},wL={class:"text-sm text-gray-900"},kL={class:"flex flex-wrap gap-1"},SL=["onClick"],CL={class:"space-y-1"},$L={class:"text-sm text-gray-900"},TL={class:"flex flex-wrap gap-1"},AL=["onClick"],EL=["placeholder"],IL={class:"text-xs text-gray-500 text-right"},PL={class:"pt-3 sticky bottom-0 bg-white"},ML="survey_order",OL=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}=tn(),s=`${ML}_submitted_ids`,r=e,o=t,i=L(!1),a=L(!1),c=L(""),u=ht({order_id:null,rating:5,positive_feedbacks:[],negative_feedbacks:[],expectations:[],suggestion:""}),d=te(()=>[n("survey.ratingVeryBad"),n("survey.ratingBad"),n("survey.ratingAverage"),n("survey.ratingGood"),n("survey.ratingExcellent")]),f=te(()=>[n("survey.order.positive.productPrice"),n("survey.order.positive.manyOffers"),n("survey.order.positive.easyPayment")]),h=te(()=>[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=te(()=>[n("survey.order.expectations.fastDelivery"),n("survey.order.expectations.asDescribed"),n("survey.order.expectations.nicePackaging")]),p=P=>{const q=$t.get(s)||[],H=Array.isArray(q)?[...q,P]:[P];$t.set(s,H,"30d")},v=P=>{u.rating=P},_=async()=>{try{if(a.value)return;a.value=!0;const P={status:"submitted",conversation_id:null,submission_data:u},q=await Xe.submission.submitWidget({widgetId:r.widget.id,formData:P});q.data&&q.status===200&&(i.value=!0,p(c.value),setTimeout(()=>{o("close")},3e3))}catch(P){console.log("Error Submission: ",P)}finally{a.value=!1}},w=()=>{i.value=!0;let P=setTimeout(()=>{o("close"),clearTimeout(P)},3e3)},k=()=>{u.suggestion.length>300&&(u.suggestion=u.suggestion.slice(0,300))},C=(P,q)=>{const H=u[q].indexOf(P);H===-1?u[q].push(P):u[q].splice(H,1)},E=()=>{u.order_id=c.value,setTimeout(()=>{o("open")},3500)},O=()=>{const P=$t.get(s)||[];(Array.isArray(P)?P:[]).includes(c.value)||E()};function I(P){let q=P;try{P.includes("://")?q=new URL(P).pathname:q=P.replace(/^(https?:\/\/)?[^\/]+/,"")}catch{q=P.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 M(P){let q=P,H;try{if(P.includes("://")){const A=new URL(P);q=A.pathname,H=A.searchParams}else{q=P.replace(/^(https?:\/\/)?[^\/]+/,"");const A=P.split("?")[1];A&&(H=new URLSearchParams(A))}}catch{q=P.replace(/^(https?:\/\/)?[^\/]+/,"");const R=P.split("?")[1];R&&(H=new URLSearchParams(R))}if(H){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 R of A)if(H.has(R))return H.get(R)}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 R=q.match(A);if(R&&R[1])return R[1]}return null}return Je(()=>{bi(()=>{const P=window.location.href;I(P)?(c.value=M(P),O()):o("close")},!0)}),(P,q)=>(m(),x("div",Y7,[i.value?(m(),x("div",eL,[l("div",tL,[G(y(Wu),{size:"42","stroke-width":"1",class:"text-gray-600"})]),l("h3",nL,D(y(n)("survey.thanksTitle")),1),l("p",{class:"text-center text-sm text-gray-600 px-2",innerHTML:y(n)("survey.thanksBody")},null,8,sL),l("div",rL,[l("div",oL,[(m(),x(be,null,Me(5,H=>G(y(ml),{key:H,size:32,"stroke-width":"1",fill:u.rating>=H?"#FAAD14":"none",color:u.rating>=H?"#FAAD14":"#d1d5db",class:ne(["star-icon",u.rating>=H?"star-active":""])},null,8,["fill","color","class"])),64))])])])):(m(),x("div",iL,[l("div",null,[l("div",aL,[l("div",lL,[l("img",{src:e.bot.config.ui.logo,alt:e.bot.config.ui.name,class:"w-full h-full object-cover"},null,8,cL)]),l("h2",uL,D(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,dL)]),l("div",fL,[l("div",hL,[l("div",pL,[(m(),x(be,null,Me(5,H=>l("div",{key:H,class:"star-wrapper",onClick:T=>v(H)},[G(y(ml),{size:32,"stroke-width":"1",fill:u.rating>=H?"#FAAD14":"none",stroke:"#FAAD14",color:u.rating>=H?"#FAAD14":"#d1d5db",class:ne(["star-icon",u.rating>=H?"star-active":"star-inactive"])},null,8,["fill","color","class"])],8,mL)),64))]),l("div",gL,D(d.value[u.rating-1]),1)]),u.rating>3?(m(),x("div",vL,[l("div",yL,D(y(n)("survey.order.likeQuestion")),1),l("div",bL,[(m(!0),x(be,null,Me(f.value,H=>(m(),x("div",{key:H,onClick:T=>C(H,"positive_feedbacks"),class:ne(["px-2 py-1 text-xs text-gray-700 border rounded tracking-tight cursor-pointer",u.positive_feedbacks.includes(H)?"bg-gray-200 border-gray-300 ":"border-gray-200 hover:bg-gray-50"])},D(H),11,_L))),128))])])):(m(),x("div",xL,[l("div",wL,D(y(n)("survey.order.difficultyQuestion")),1),l("div",kL,[(m(!0),x(be,null,Me(h.value,H=>(m(),x("div",{key:H,onClick:T=>C(H,"negative_feedbacks"),class:ne(["px-2 py-1 text-xs text-gray-700 border rounded tracking-tight cursor-pointer",u.negative_feedbacks.includes(H)?"bg-gray-200 border-gray-300 ":"border-gray-200 hover:bg-gray-50"])},D(H),11,SL))),128))])])),l("div",CL,[l("div",$L,D(y(n)("survey.order.expectationQuestion")),1),l("div",TL,[(m(!0),x(be,null,Me(g.value,H=>(m(),x("div",{key:H,onClick:T=>C(H,"expectations"),class:ne(["px-2 py-1 text-xs text-gray-700 border rounded tracking-tight cursor-pointer",u.expectations.includes(H)?"bg-gray-200 border-gray-300 ":"border-gray-200 hover:bg-gray-50"])},D(H),11,AL))),128))])]),l("div",null,[Rt(l("textarea",{"onUpdate:modelValue":q[0]||(q[0]=H=>u.suggestion=H),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,EL),[[on,u.suggestion]]),l("div",IL,D(u.suggestion.length)+" / 300 ",1)])])]),l("div",PL,[l("button",{onClick:q[1]||(q[1]=H=>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,D(y(n)("survey.submit")),1)])])]))]))}},[["__scopeId","data-v-a0e2b673"]]),LL=["width","height"],RL=[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)],DL={__name:"IconEAI",props:{size:{type:String,default:"sm",validator:e=>["sm","md","lg"].includes(e)}},setup(e){const t=e,n=te(()=>{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"},RL,8,LL))}},jL={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"},NL={class:"flex items-center space-x-1"},FL={class:"font-bold text-gray-900"},ov={__name:"PoweredByEAC",setup(e){const{t}=tn(),n=te(()=>{const s=ae.state.handle;return![zn,Bn,br,"nexpovn","g8homevn","tanchauhomecom","govivn","bvdkmocchauvn"].includes(s)});return(s,r)=>n.value?(m(),x("a",jL,[l("span",null,D(y(t)("widget.poweredBy")),1),l("div",NL,[G(DL,{class:"mt-px"}),l("span",FL,D(y(t)("widget.easyAi")),1)])])):z("",!0)}},qL={class:"flex justify-center py-2"},iv={__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=L(!1),s=L(!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(be,null,[s.value?Pt(u.$slots,"trigger",Gi(kn({key:0},{isOpen:n.value,position:e.position,toggleSlide:r,closeSlide:o,openSlide:i}))):z("",!0),G(en,{name:"fade"},{default:xe(()=>[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,[Pt(u.$slots,"widget",Gi(ya({isOpen:n.value,closeSlide:o,openSlide:i})))]),l("div",qL,[G(ov)])],2)):z("",!0)],64))}},zL={key:0},BL={key:0},UL=l("div",{class:"absolute inset-0 bg-gray-500/60"},null,-1),VL=["src","alt"],HL={class:"text-sm font-medium text-primary leading-[120%]"},WL={key:1},GL=["onClick"],KL=["onClick","innerHTML"],QL=["onClick","innerHTML"],JL=["onClick"],XL={class:"pb-1 text-base text-white whitespace-nowrap rotate-90"},ZL={class:"flex items-center space-x-2"},YL={class:"text-sm sm:text-base"},eR=["title"],av={__name:"ChatWidget",props:{isPreview:{type:Boolean,default:!1},isOpenInit:{type:Boolean,default:!1}},setup(e){var re,fe,Ce;const t=Kt(()=>Promise.resolve().then(()=>iH)),n=Kt(()=>Promise.resolve().then(()=>cv)),s=Kt(()=>Promise.resolve().then(()=>SH)),r=Kt(()=>Promise.resolve().then(()=>EH)),o=e,{widgets:i,widgetSettingType:a}=Zs(),{t:c}=tn(),{bot:u,handle:d,chatState:f}=It(ae.state),h=L(!1),g=L(!1),p=L(null),v=L(null),_=L(!1),w=L(!1),k=L(!1),{getStorage:C}=Ks(),{isOpen:E,toggleChatbot:O}=Ci({openInit:o.isOpenInit,milliseconds:(Ce=(fe=(re=u.value)==null?void 0:re.config)==null?void 0:fe.ui)==null?void 0:Ce.automaticallyExpand}),{clickQuickPrompt:I,send:M}=Er(),{quickPrompts:P,welcomeMessages:q,keyQuickPrompt:H}=p7(),T=()=>{const $e=rs("Product");$e&&$e.sku&&(_.value=!0,w.value=!1)},A=te(()=>_.value?w.value:!0),R=()=>{_.value&&(w.value=!0)},K=()=>{_.value&&(w.value=!1)};Je(async()=>{p.value=window.location.hostname;const $e=C("easychatgpt_conversations",d.value);$e&&(V.localStorageFormOrder=`${bu}-${$e}`),Y(),localStorage.getItem("EAI_SURVEY_HIDDEN")==="1"&&(k.value=!0),setTimeout(()=>{h.value=!0},1e3)}),Pe(()=>V.localStorageFormOrder,$e=>{$e&&(V.selectedForm=JSON.parse(localStorage.getItem($e)))});const W=te(()=>{var $e,Le,Be,Ue;return((Ue=(Be=(Le=($e=u.value)==null?void 0:$e.config)==null?void 0:Le.ui)==null?void 0:Be.alignment)==null?void 0:Ue.position)||"right"});Pe(E,$e=>{$e?h.value=!1:setTimeout(()=>{h.value=!0},800),T()}),Pe(d,$e=>{$e&&[zn,Bn].includes($e)&&T()},{immediate:!0});function U($e){E.value=!0,h.value=!1,M({message:$e})}function J(){g.value=!1,$t.set(yu,1,"1d")}function X(){ae.actions.resetUnreadMessageCount(),J()}function Y(){$t.get(yu)!=="1"?(g.value=!0,$t.remove(yu)):g.value=!1}function he(){k.value=!0,localStorage.setItem("EAI_SURVEY_HIDDEN","1")}const ce=$e=>$e!==null&&typeof $e=="object",ue=te(()=>{var $e;return($e=u.value.widgets)==null?void 0:$e.find(Le=>Le.type.includes("website_survey")&&Le.active&&!Le.is_deleted)}),Te=te(()=>S_.includes(d.value)&&!o.isPreview),je=te(()=>[zn,Bn].includes(d.value));return($e,Le)=>{var Be,Ue,N,ee;return y(u)?(m(),x("div",zL,[Te.value?z("",!0):(m(),x("div",{key:0,class:ne(["chat-widget",[`position-${y(u).config.ui.alignment.position}`,`btn-size-desktop-${((Be=y(u).config.ui.bubble_chat)==null?void 0:Be.offset.desktop.size)??"medium"}`,`btn-size-mobile-${((Ue=y(u).config.ui.bubble_chat)==null?void 0:Ue.offset.mobile.size)??"medium"}`]]),style:mt([{display:"none"},{"--size-desktop-custom":((N=y(u).config.ui.bubble_chat)==null?void 0:N.offset.desktop.custom)??"var(--size-medium)","--size-mobile-custom":((ee=y(u).config.ui.bubble_chat)==null?void 0:ee.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%]",je.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:Le[0]||(Le[0]=Q=>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:R,onMouseleave:K},[!y(f).unreadMessageCount&&g.value&&!y(E)&&A.value?(m(),x("div",BL,[l("div",{class:ne(["flex-col space-y-2 sm:space-y-3 group",[{left:"items-start",right:"items-end"}[W.value],[y(li),y(ci),y(ui),y(di),y($s),y(ii)].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(li),y(ci),y(ui),y(di),y($s),y(zn),y(Bn)].includes(y(d))?"sm:hidden":"hidden"]])},[l("button",{onClick:Le[1]||(Le[1]=Q=>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(bo,{class:"relative z-10 w-4 md:w-3 text-white"}),UL])],2)):z("",!0),(m(),x("div",{key:y(H),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:Le[2]||(Le[2]=Q=>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(li),y(ci),y(ui),y(di),y($s),y(zn),y(Bn),y(ii)].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($n)?"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,VL)],2)):z("",!0),l("div",HL,D(y(u).config.ui.name),1)],2)):z("",!0),y(q)&&y(q).length>0?(m(),x("div",WL,[(m(),oe(c7,{messages:y(q),key:y(q)},null,8,["messages"]))])):z("",!0)],2))],2)])):z("",!0),!y(f).unreadMessageCount&&g.value&&!y(E)&&y(P).length>0&&A.value&&![y($s),y(zn),y(Bn),y($n),y(so)].includes(y(d))?(m(!0),x(be,{key:1},Me(y(P),(Q,j)=>(m(),x("div",{key:j,class:ne(["duration-500",[y(E)?"translate-y-1/2 opacity-0 invisible":"translate-y-0 opacity-100 visible",[y(li),y(ci),y(ui),y(di)].includes(y(d))||e.isPreview?"block":"hidden sm:block"]]),onClick:B=>y(I)(Q)},[(m(),x("div",{key:y(H),class:ne(["flex-col space-y-3 duration-1000 group",[W.value==="left"?"items-start":"items-end",[y(li),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-${j*200+300}ms`],"duration-1000"])},[ce(Q)?(m(),x("div",{key:0,onClick:B=>U(Q.message),class:"quick-prompt-tag",innerHTML:Q.name},null,8,KL)):(m(),x("div",{key:1,onClick:B=>U(Q),class:"quick-prompt-tag",innerHTML:Q},null,8,QL))],2)],2))],10,GL))),128)):z("",!0),G(en,{"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:xe(()=>[y(f).lastMessageAgent||y(f).unreadMessageCount>0?(m(),oe(y(r),{key:0,onToggle:Le[3]||(Le[3]=Q=>y(O)()),onClose:Le[4]||(Le[4]=Q=>X()),style:mt({transformOrigin:W.value==="right"?"bottom right":"bottom left"})},null,8,["style"])):z("",!0)]),_:1}),G(a7,{isOpen:y(E),chatPosition:W.value,onToggle:Le[5]||(Le[5]=Q=>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(xr)].includes(y(d))?(m(),oe(y(s),{key:2,bot:y(u)},null,8,["bot"])):z("",!0),y(i).popup_banner&&![y(zn),y(Bn)].includes(y(d))?(m(),oe(k7,{key:3,item:y(i).popup_banner},null,8,["item"])):z("",!0),ue.value&&!y(ae).state.isSurveyHidden&&!k.value&&!["www.dienmayxanh.com","www.thegioididong.com","www.nhathuocankhang.com"].includes(p.value)?(m(),oe(y(iv),{key:4,position:"right",handle:y(d)},{trigger:xe(({isOpen:Q,position:j,toggleSlide:B})=>[l("div",{class:ne(["fixed z-40 w-[30px] h-[98px] sm:h-[112px] sm:w-[34px] group opacity-100",j==="left"?"left-0":"right-0",Q?j==="right"?"translate-x-full":"-translate-x-full":"translate-x-0 delay-300"]),style:"top: 30%;"},[l("button",{onClick:B,class:ne(["w-full h-full bg-primary hover:opacity-90 text-white flex items-center justify-center duration-200",j==="left"&&"rounded-r-lg",j==="right"&&"rounded-l-lg"])},[l("div",XL,[l("div",ZL,[l("div",YL,D(y(c)("survey.rate")),1),G(A7,{class:"size-[15px] sm:size-[17px] -rotate-90 text-white"})])])],10,JL),l("button",{onClick:Qt(he,["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",[j==="left"?"-right-[5px]":"-left-[5px]"]]),title:y(c)("survey.closeRate")},[G(bo,{class:"w-2.5 h-2.5"})],10,eR)],2)]),widget:xe(({closeSlide:Q})=>[G(y(Z7),{bot:y(u),preview:e.isPreview,widget:ue.value,onClose:Q},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(iv),{key:5,position:"right"},{widget:xe(({openSlide:Q,closeSlide:j})=>[G(y(OL),{bot:y(u),widget:y(i).order_survey,preview:e.isPreview,onOpen:Q,onClose:j},null,8,["bot","widget","preview","onOpen","onClose"])]),_:1})):z("",!0)])):z("",!0)}}},lv="https://widget.geteasy.ai",yd="easychatgpt-widget";window.EasyAIChat={_config:null,_initialized:!1,init(e){if(this._initialized)return;this._config=e;const t=async()=>{let n=document.getElementById(yd);if(n!=null&&n.hasAttribute("data-ecg-initialized")){this._initialized=!0;return}n||(n=document.createElement("div"),n.id=yd,document.body.appendChild(n));const s=document.createElement("div"),r=n.attachShadow({mode:"open"});r.appendChild(s),Xr(av,this._config).mount(s);const o=document.createElement("link");o.rel="stylesheet",o.href=`${lv}/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&&ln.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&&ln.actions.init(u),Er({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),Xr(t==="view"?ev:av,this._config).mount(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${lv}/dist/widget/main.css`,s.appendChild(i);const a=document.getElementById(yd);a&&n.setAttribute("style",a.getAttribute("style"))},send(e){Ci().isOpen.value=!0,Er().send({message:e})},rcm:{init:e=>ln.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 tR={class:"bg-white"},nR=["onClick"],sR={class:"flex-1 text-sm"},rR={key:0,class:"flex flex-col px-1 mt-2"},oR={class:"pl-1"},iR={class:"px-3 py-2 mt-1 text-sm bg-blue-50 rounded-lg"},aR={key:0,class:"ask-ai-result"},lR={key:1,class:"ask-ai-result"},cR=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"WidgetFeatureAIProductInsightEmbed",props:{widget:{type:Object,default:()=>({})}},setup(e){const t=e,n=L(null),s=L({}),r=L([]);let o=L(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=te(()=>{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=rs("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",tR,[(m(!0),x(be,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",sR,D(v.name),1),G(y(Ir),{size:"16",class:"text-gray-600"})],8,nR))),128)),r.value?(m(),x("div",rR,[l("div",oR,[G(Ri,{title:"AI đánh giá",size:"md"})]),l("div",iR,[r.value.length?(m(),x("div",aR,[(m(),x("span",{key:r.value.length},D(r.value.join(" ")),1))])):(m(),x("div",lR,"AI đang xử lý ..."))])])):z("",!0)]))}}},Symbol.toStringTag,{value:"Module"})),uR={key:0,class:"p-4 sm:px-4 sm:py-5 w-full border border-blue-100 rounded-2xl bg-blue-50/60"},dR={key:0,class:"flex flex-col"},fR={class:"mb-2 flex items-center gap-1"},hR={class:"text-sm pl-1"},pR={key:0},mR={key:0,class:"mb-1.5"},gR={key:1},vR={class:"space-y-1"},yR=l("span",{class:"size-1 rounded-full bg-gray-700 flex-shrink-0 mr-2 translate-y-2"},null,-1),bR={key:1,class:"ask-ai-result"},_R=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=L({}),s=te(()=>{const g=t.isShowHighlight&&r.value.highlight,p=t.isShowFeatures&&r.value.features.length;return g||p}),r=L({highlight:"",features:[]});let o=L(null),i=L("highlight"),a=L(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 C=[...r.value.features];C[a.value]=w.join(" "),r.value.features=C,_++}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",uR,[s.value?(m(),x("div",dR,[l("div",fR,[G(Ri,{title:"AI tóm tắt",size:"md"})]),l("div",hR,[r.value.highlight||r.value.features.length?(m(),x("div",pR,[e.isShowHighlight&&r.value.highlight?(m(),x("div",mR,[l("span",null,D(r.value.highlight),1)])):z("",!0),e.isShowFeatures&&r.value.features.length?(m(),x("div",gR,[l("ul",vR,[(m(!0),x(be,null,Me(r.value.features,(v,_)=>(m(),x("li",{key:_,class:"flex items-start"},[yR,l("span",null,D(v),1)]))),128))])])):z("",!0)])):(m(),x("div",bR,"AI đang xử lý ..."))])])):z("",!0)])):z("",!0)}}},Symbol.toStringTag,{value:"Module"})),xR={class:"flex items-center gap-1.5 relative"},wR={class:"flex items-center pl-1.5 text-sm text-gray-700 touch-manipulation cursor-pointer"},kR={class:"transition-all duration-300 w-[130px] opacity-100"},SR=["aria-label"],cv=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"WidgetAskAI",props:{widget:{type:Object,required:!0}},setup(e){const t=L(!1),n=L(null),s=L(null),r=L(""),o=L(""),i=L(!1),a=L(!1),c=L(!1),u=L(null),d=L(null),f=L([]),h=ht({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?wt(()=>{s.value&&(s.value.focus(),wt(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 J=W.getRangeAt(0).getBoundingClientRect();return J.width===0&&J.height===0?null:{x:J.left+J.width/2,y:J.bottom}},_=(W,U)=>{const J=window.pageXOffset,X=window.pageYOffset,Y=window.innerWidth,he=window.innerHeight,ce=i.value?16:10,ue=50,Te=i.value?200:280;let je=W,re=U,fe="-50%",Ce="0%";const $e=he-U,Le=U;if($e<ue+ce&&Le>ue+ce?(re=U-ce,Ce="-100%"):(re=U+ce,Ce="0%"),i.value)je=Y/2,fe="-50%";else{const Be=Te/2;W-Be<ce?je=ce+Be:W+Be>Y-ce?je=Y-ce-Be:je=W}h.top=`${re+X}px`,h.left=`${je+J}px`,h.transform=`translate(${fe}, ${Ce})`,wt(()=>{if(!n.value)return;const Be=n.value.getBoundingClientRect();let Ue=je+J,N=re+X;Be.left<ce?(Ue=ce+J,h.transform=`translate(0%, ${Ce})`):Be.right>Y-ce&&(Ue=Y-ce-Be.width+J,h.transform=`translate(0%, ${Ce})`),(Be.bottom>he-ce||Be.top<ce)&&(Le>$e&&Le>ue+ce?(N=re+X-Be.height-ce*2,h.transform=`translate(${fe.includes("0%")?"0%":"-50%"}, 0%)`):(N=ce+X,h.transform=`translate(${fe.includes("0%")?"0%":"-50%"}, 0%)`)),h.left=`${Ue}px`,h.top=`${N}px`,i.value&&Be.width>Y-ce*2&&(n.value.style.maxWidth=`${Y-ce*2}px`)})},w=(W,U,J)=>{r.value=J;const X=window.getSelection();X.rangeCount&&!X.isCollapsed&&(d.value=X.getRangeAt(0).cloneRange()),_(W,U),t.value=!0},k=()=>{t.value=!1,n.value&&(n.value.style.maxWidth=""),I()},C=W=>{setTimeout(()=>{var J,X;((J=n.value)==null?void 0:J.contains(document.activeElement))||((X=n.value)==null?void 0:X.contains(W.relatedTarget))||(a.value=!1,i.value||(c.value=!1,k()))},150)},E=W=>{var Y;W==null||W.stopPropagation(),W==null||W.preventDefault(),c.value=!0;const U=o.value.trim(),J=r.value.trim().replace(/\s+/g," ");let X="";U&&J?X=`<blockquote><p>${J}</p></blockquote><p>${U}</p>`:U?X=`<p>${U}</p>`:J&&(X=`<blockquote><p>${J}</p></blockquote>`),X&&((Y=window.EAC)!=null&&Y.send)&&window.EAC.send(X),setTimeout(k,150)},O=()=>{if(!d.value)return;I();const W=d.value.getClientRects();for(let U=0;U<W.length;U++){const J=W[U],X=document.createElement("span");X.style.position="absolute",X.style.backgroundColor="rgba(0, 123, 255, 0.15)",X.style.pointerEvents="none",X.style.left=`${J.left+window.pageXOffset}px`,X.style.top=`${J.top+window.pageYOffset}px`,X.style.width=`${J.width}px`,X.style.height=`${J.height}px`,X.style.zIndex="999999",document.body.appendChild(X),f.value.push(X)}},I=()=>{f.value.forEach(W=>W.remove()),f.value=[]},M=()=>{clearTimeout(u.value),u.value=setTimeout(()=>{const W=window.getSelection(),U=W==null?void 0:W.toString().trim();if(U&&U.length>0&&!W.isCollapsed){const J=v();J&&w(J.x,J.y,U)}else!a.value&&!c.value&&k()},200)},P=W=>{t.value&&n.value&&!n.value.contains(W.target)&&k()},q=()=>{t.value&&k()},H=(W,U)=>{if(!U||!W)return!1;const J=U.replace(/\*\*\//g,"(.*/)?").replace(/\*\*/g,".*").replace(/\*/g,"[^/]*").replace(/\?/g,".").replace(/\./g,"\\.");return new RegExp(`^${J}$`).test(W)},T=(W,U="")=>{const J=U.split(`
|
||
`).map(Y=>Y.trim()).filter(Y=>Y.length>0);let X=J.length===0;return J.length>0&&(X=J.some(Y=>H(W,Y))),X},A=()=>{clearTimeout(u.value),document.removeEventListener("mouseup",M),document.removeEventListener("selectionchange",M),document.removeEventListener("touchend",M),document.removeEventListener("click",P),window.removeEventListener("orientationchange",R),window.removeEventListener("scroll",q),[".layout-wrapper",".chat-widget-wrapper"].forEach(W=>{const U=document.querySelector(W);U&&U.removeEventListener("scroll",q)}),I(),d.value=null},R=()=>{setTimeout(()=>{i.value=p()},500)},K=()=>{var J;const W=window.location.pathname;if(!T(W,(J=g.widget)==null?void 0:J.include_path_patterns)){t.value=!1;return}i.value=p(),i.value?(document.addEventListener("selectionchange",M,{passive:!0}),document.addEventListener("touchend",M,{passive:!0})):document.addEventListener("mouseup",M,{passive:!0}),document.addEventListener("click",P,{passive:!1}),i.value&&window.addEventListener("orientationchange",R,{passive:!0}),window.addEventListener("scroll",q,{passive:!0}),[".layout-wrapper",".chat-widget-wrapper"].forEach(X=>{const Y=document.querySelector(X);Y&&Y.addEventListener("scroll",q,{passive:!0})})};return Je(()=>{bi(()=>{A(),K()},!0)}),Dt(()=>{A()}),(W,U)=>t.value?(m(),x("div",{key:0,ref_key:"tooltip",ref:n,onClick:U[3]||(U[3]=Qt(()=>{},["stop"])),class:"fixed z-[9999999990] bg-white rounded-xl p-1 border border-gray-200",style:mt(h)},[l("div",xR,[l("div",wR,[G(y(ek),{size:"17","stroke-width":"1.5"}),l("div",kR,[Rt(l("input",{ref_key:"inputRef",ref:s,type:"text","onUpdate:modelValue":U[0]||(U[0]=J=>o.value=J),onKeydown:[mr(E,["enter"]),mr(k,["esc"])],onFocus:U[1]||(U[1]=J=>a.value=!0),onBlur:C,placeholder:"Nhập câu hỏi ✨",class:"border-none w-full outline-none px-2 h-7"},null,544),[[on,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:U[2]||(U[2]=Qt(()=>{},["prevent"]))}," Hỏi AI ",42,SR)])])],4)):z("",!0)}}},Symbol.toStringTag,{value:"Module"})),CR={class:"relative flex flex-col w-full overflow-hidden h-dvh"},$R={class:"flex items-center justify-between px-3 h-[50px] sm:px-4"},TR={class:"bg-white px-2.5 py-1 rounded-lg text-gray-900"},AR={class:"text-gray-500"},ER={class:"flex gap-2"},IR={class:"flex items-center justify-center h-[calc(100%-80px-50px)] overflow-hidden sm:px-14 py-4 px-2"},PR=["src","alt"],MR=["src"],OR={class:"h-[80px] flex-shrink-0 p-2 flex items-center justify-center"},LR={class:"flex h-full gap-2 overflow-x-auto"},RR=["onClick"],DR=["src","alt"],jR=["data-index","src"],NR=["src"],FR={key:2,class:"absolute inset-0 flex items-center justify-center bg-black/20"},qR={class:"flex items-center justify-center w-6 h-6 rounded-full sm:w-8 sm:h-8 bg-white/70"},zR=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=te(()=>n.media.filter(T=>T.type==="image"||T.type==="video")),r=t,o=L(n.initialIndex),i=L([]),a=L([]);L({});const c=L(null),u=te(()=>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 wt();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(),R=window.URL.createObjectURL(A),K=document.createElement("a");if(K.href=R,u.value.filename)K.download=u.value.filename;else{const W=u.value.url.split("?")[0],U=W.substring(W.lastIndexOf("/")+1);K.download=U||`download_${Date.now()}`}document.body.appendChild(K),K.click(),document.body.removeChild(K),window.URL.revokeObjectURL(R)}catch(T){console.error("Download failed:",T)}},v=T=>new Promise((A,R)=>{T.load();const K=()=>{T.currentTime=.1,T.removeEventListener("loadedmetadata",K)},W=()=>{A(),T.removeEventListener("loadeddata",W),T.removeEventListener("error",U)},U=()=>{R(new Error("Cannot load video")),T.removeEventListener("loadedmetadata",K),T.removeEventListener("loadeddata",W),T.removeEventListener("error",U)};T.addEventListener("loadedmetadata",K),T.addEventListener("loadeddata",W),T.addEventListener("error",U),setTimeout(()=>{A()},3e3)}),_=async()=>{await wt();for(const[T,A]of s.value.entries())if(A.type==="video"&&A.url){const R=a.value[T];if(R)try{await v(R)}catch(K){console.error(`Error setting thumbnail for video ${A.url}:`,K)}}},w=()=>{n.onRemove?n.onRemove():r("close")},k=T=>{T.target===T.currentTarget&&w()},C=T=>{switch(T.key){case"ArrowLeft":f();break;case"ArrowRight":d();break;case"Escape":w();break}},E=L(0),O=L(0),I=L(0),M=L(0),P=T=>{E.value=T.changedTouches[0].screenX,I.value=T.changedTouches[0].screenY},q=T=>{O.value=T.changedTouches[0].screenX,M.value=T.changedTouches[0].screenY},H=()=>{const T=E.value-O.value,A=Math.abs(I.value-M.value);Math.abs(T)>50&&A<100&&(T>0?d():f())};return Je(async()=>{document.addEventListener("keydown",C),document.body.style.overflow="hidden",g(),await _()}),Dt(()=>{document.removeEventListener("keydown",C),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:P,onTouchmove:q,onTouchend:H},[l("div",CR,[l("div",$R,[l("div",TR,[Ge(D(u.value.type==="video"?"Video":"Hình ảnh")+" ",1),l("span",AR,D(o.value+1)+"/"+D(s.value.length),1)]),l("div",ER,[l("button",{onClick:p,class:"p-2 hover:bg-gray-100 rounded-lg transition-colors bg-white",title:"Tải xuống"},[G(y(eg),{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",IR,[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,PR)):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,MR),Ge(" 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(mo),{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(Ir),{size:"16",class:"text-gray-500"})])):z("",!0),l("div",OR,[l("div",LR,[(m(!0),x(be,null,Me(s.value,(R,K)=>(m(),x("div",{key:K,ref_for:!0,ref:W=>{W&&(i.value[K]=W)},class:"relative flex-shrink-0 h-full overflow-hidden rounded-lg cursor-pointer group aspect-[1/1]",onClick:W=>h(K)},[R.type==="image"?(m(),x("img",{key:0,src:R.url,alt:`Thumbnail ${K+1}`,class:ne(["object-cover w-full h-full transition-all border rounded-lg border-gray-100",K==o.value?"border-primary":""])},null,10,DR)):R.type==="video"?(m(),x("video",{key:1,ref_for:!0,ref:W=>{W&&(a.value[K]=W)},muted:"",playsinline:"","webkit-playsinline":"",preload:"metadata",class:ne(["object-cover w-full h-full transition-all border-2 rounded-lg",K===o.value?"border-blue-500":"border-gray-200 hover:border-gray-300"]),"data-index":K,src:R.url+"#t=0.1"},[l("source",{src:R.url,type:"video/mp4"},null,8,NR)],10,jR)):z("",!0),R.type==="video"?(m(),x("div",FR,[l("div",qR,[G(y(ig),{class:"w-3 h-3 sm:w-4 sm:h-4 text-gray-700 ml-0.5"})])])):z("",!0)],8,RR))),128))])])])],32))}}},Symbol.toStringTag,{value:"Module"})),BR={},UR={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},VR=[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 HR(e,t){return m(),x("svg",UR,VR)}const uv=Qe(BR,[["render",HR]]),WR={},GR={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},KR=[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 QR(e,t){return m(),x("svg",GR,KR)}const Rl=Qe(WR,[["render",QR]]),JR={},XR={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ZR=[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 YR(e,t){return m(),x("svg",XR,ZR)}const dv=Qe(JR,[["render",YR]]),eD={},tD={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},nD=[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 sD(e,t){return m(),x("svg",tD,nD)}const fv=Qe(eD,[["render",sD]]),hv={__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:fv,text:"",bg:"bg-gradient-to-r from-yellow-300 via-yellow-400 to-amber-500 text-red-700 shadow-sm"},re_qua_troi:{icon:dv,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:uv,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:dv,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:uv,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=te(()=>{var a;return((a=n[t.variant])==null?void 0:a.icon)||null}),r=te(()=>{var a;return((a=n[t.variant])==null?void 0:a.text)||null}),o=te(()=>{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=te(()=>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(Ft(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),Pt(a.$slots,"default",{},()=>[Ge(D(r.value),1)])],2))}},rD={class:"relative w-full"},oD={key:0},iD={key:0},aD=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=L(0),s=L(0),r=L(0),o=L(0),i=L(!1),a=L(0),c=L(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)}),Dt(()=>{clearInterval(u)}),(p,v)=>(m(),x("div",rD,[l("div",{class:ne(["timer_deal_process h-[24px]",{is_ended_bg:i.value}])},[l("span",{style:mt({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",oD,"Chương trình đã kết thúc")):(m(),x(be,{key:1},[Ge(" Còn "),n.value>0?(m(),x("span",iD,D(n.value)+" ngày ",1)):z("",!0),Ge(D(d(s.value))+":"+D(d(r.value))+":"+D(d(o.value))+" ("+D(c.value)+"%) ",1)],64))],2)]))}},[["__scopeId","data-v-00204529"]]),lD={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"},cD={class:"h-full flex flex-col relative overflow-hidden"},uD={key:0,class:"px-1.5 pt-1.5 pb-px"},dD=["src","alt"],fD={key:0,class:"absolute inset-0 flex items-center justify-center p-4 z-10"},hD=["src"],pD={class:"flex flex-col flex-1 px-2.5 pb-2 pt-1"},mD=["title"],gD={class:"flex flex-col gap-1 mb-2 mt-1"},vD={class:"flex items-center gap-2"},yD={class:"flex items-start justify-between flex-wrap"},bD={key:0,class:"text-sm text-gray-500 line-through tracking-tight"},_D={class:"leading-none"},xD=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=te(()=>{if(!n.product.discount)return"";const u=String(n.product.discount);return u.includes("%")||u.includes("-")?u:`-${u}%`}),r=te(()=>{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=te(()=>r.value[n.ctaKey]||r.value.available),i=()=>{var u;qe.buttonClick({content:o.value.label,source:n.widgetSource}),(u=window.EasyAI)==null||u.send(o.value.message)},a=()=>{var u;qe.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=()=>{qe.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",lD,[l("div",cD,[e.product.badge?(m(),x("div",uD,[G(hv,{variant:e.product.badge},null,8,["variant"])])):z("",!0),(m(),oe(Ft(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:xe(()=>[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,dD),e.product.stock_remaining===0?(m(),x("div",fD,[l("img",{src:y(t)+"/sold-out-min.webp",alt:"Cháy suất",class:"w-full h-auto object-contain"},null,8,hD)])):z("",!0)]),_:1},8,["href"])),l("div",pD,[(m(),oe(Ft(e.product.link?"a":"div"),{href:e.product.link||void 0,onClick:c,class:"block"},{default:xe(()=>[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},D(e.product.name),9,mD)]),_:1},8,["href"])),l("div",gD,[l("div",vD,[l("span",{class:ne(["text-lg md:text-xl font-bold",e.product.stock_remaining===0?"text-gray-400":"text-red-600"])},D(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"])},D(s.value),3)):z("",!0)]),l("div",yD,[e.product.price!=="Liên hệ"&&e.product.originalPrice?(m(),x("span",bD,D(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"])},D(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(aD,{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:Qt(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"}),Ge(" 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",_D,D(o.value.label),1)])]))}},[["__scopeId","data-v-006d9917"]]),pv=e=>(gn("data-v-ed6650e8"),e=e(),vn(),e),wD={key:0,class:"relative"},kD={class:"h-[64px] lg:h-[90px] flex items-end"},SD={class:"absolute inset-x-0 bottom-0 flex h-full justify-between px-2.5 xl:px-2 md:inset-x-8"},CD={class:"flex items-center -translate-y-2 w-full lg:w-fit"},$D={class:"flex gap-0.5 w-full lg:w-fit items-end overflow-x-auto eai-no-scrollbar"},TD=["onClick"],AD={class:"flex items-center gap-1 md:gap-2 uppercase whitespace-nowrap"},ED={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"},ID={class:"p-1 flex relative items-center justify-center w-[160px] xl:w-[180px] bg-white rounded-xl border-4 border-[#FF9300]"},PD=["src"],MD={class:"flex flex-col md:flex-row items-center justify-center gap-2 md:gap-3 mt-1 relative z-30"},OD=pv(()=>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)),LD=["href"],RD=pv(()=>l("span",{class:"font-bold uppercase text-[11px]"}," Gọi đặt trước ",-1)),DD=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=L(!1),u=te(()=>{var v,_;const p=[];return(v=ln.state.flash_sales)!=null&&v.length&&p.push({id:"flashsale",label:"FlashSale",icon:Rl}),(_=ln.state.hot_sales)!=null&&_.length&&p.push({id:"hotsale",label:"HotSale",icon:fv}),p}),d=L("");Pe(u,p=>{p.length>0&&!p.some(v=>v.id===d.value)&&(d.value=p[0].id)},{immediate:!0});const f=e,h=()=>{qe.buttonClick({content:"Gọi đặt trước",source:"widget_pe_flash_sale",href:`tel:${f.phoneNumber}`})},g=te(()=>d.value==="flashsale"?ln.state.flash_sales||[]:ln.state.hot_sales||[]);return(p,v)=>{var _,w;return(_=y(ln).state.flash_sales)!=null&&_.length||(w=y(ln).state.hot_sales)!=null&&w.length?(m(),x("div",wD,[l("div",kD,[l("div",{class:"relative h-[58px] w-[calc(100%-20px)] md:w-[calc(100%-76px)] mx-auto translate-y-1.5",style:mt({background:`url(${n}) center center / 100% 100% no-repeat`})},[l("div",SD,[l("div",CD,[l("div",$D,[(m(!0),x(be,null,Me(u.value,k=>(m(),x("button",{key:k.id,onClick:C=>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:mt({background:`url(${o}) center center / 100% 100% no-repeat`})},[l("div",AD,[k.icon?(m(),oe(Ft(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,D(k.label),1)])],14,TD))),128))])]),e.brandLogo?(m(),x("div",ED,[l("img",{src:s,class:"w-[300px] shrink-0",alt:"Deal độc quyền từ"}),l("div",ID,[l("img",{src:e.brandLogo,class:"w-full h-full object-cover rounded-xl",alt:"Brand Logo"},null,8,PD),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:mt({"--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:xe(()=>[(m(!0),x(be,null,Me(g.value,(k,C)=>(m(),oe(bl,{key:`${d.value}-${C}`},{default:xe(()=>[G(xD,{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",MD,[OD,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"}),RD],8,LD)):z("",!0)])],4)])):z("",!0)}}},[["__scopeId","data-v-ed6650e8"]])},Symbol.toStringTag,{value:"Module"})),jD={class:"flex gap-2 items-start h-full"},ND={class:"flex-shrink-0"},FD={class:"w-[72px] h-[72px] flex items-center justify-center rounded bg-gray-50 overflow-hidden"},qD=["src","alt"],zD={class:"flex-1 flex flex-col min-w-0 h-full"},BD={class:"text-sm text-gray-900 group-hover:text-red-600 font-medium line-clamp-1 mb-1"},UD={class:"flex items-center justify-between"},VD={class:"flex items-center gap-1 flex-wrap"},HD={class:"text-sm font-semibold text-red-600 tracking-tight"},WD={key:0,class:"text-white bg-red-500 rounded-md px-1 font-semibold text-[10px]"},GD={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"},KD=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=te(()=>{if(!t.discount)return"";const r=String(t.discount);return r.includes("%")||r.includes("-")?r:`-${r}%`}),s=()=>{qe.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(Ft(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:xe(()=>[l("div",jD,[l("div",ND,[l("div",FD,[l("img",{src:e.image,alt:e.name,loading:"lazy",class:"w-full h-full object-contain"},null,8,qD)])]),l("div",zD,[l("h3",BD,D(e.name),1),l("div",null,[l("div",UD,[l("div",VD,[l("span",HD,D(e.price),1),e.price!=="Liên hệ"&&e.discount?(m(),x("div",WD,D(n.value),1)):z("",!0)])]),e.stock_remaining!=null&&e.stock_total?(m(),x("div",GD," Còn "+D(e.stock_remaining)+"/"+D(e.stock_total)+" suất ",1)):z("",!0)])])])]),_:1},8,["href"]))}},[["__scopeId","data-v-10679a4a"]]),QD={class:"relative"},JD={class:"mb-1"},XD={class:"text-lg font-bold"},ZD=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}=tn(),n=e,s=te(()=>n.title?n.title:t(n.titleKey)),r=te(()=>ln.state[n.dataKey]||[]);return(o,i)=>(m(),x("div",QD,[l("div",JD,[l("h2",XD,D(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:xe(()=>[(m(!0),x(be,null,Me(r.value,(a,c)=>(m(),oe(bl,{key:c},{default:xe(()=>[G(KD,kn(a,{"widget-source":`widget_pe_${e.dataKey}`}),null,16,["widget-source"])]),_:2},1024))),128))]),_:1},8,["autoplay","breakpoints"])]))}}},Symbol.toStringTag,{value:"Module"})),YD={},ej={width:"16",height:"26",viewBox:"0 0 16 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"text-yellow-400"},tj=[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 nj(e,t){return m(),x("svg",ej,tj)}const sj=Qe(YD,[["render",nj]]),rj={class:"flex flex-col items-center"},oj={class:"leading-none"},ij={class:"flex flex-col items-center"},aj={class:"leading-none"},lj={class:"flex flex-col items-center"},cj={class:"leading-none"},uj=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;L(0);const r=L(0),o=L(0),i=L(0),a=L(!1);let c=null;const u=te(()=>{switch(n.size){case"sm":return"size-5 text-[10px]";case"lg":return"size-9 text-lg";default:return"size-6 text-xs"}}),d=te(()=>{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),Dt(()=>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",rj,[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",oj,D(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",ij,[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",aj,D(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",lj,[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",cj,D(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"]]),_o=e=>(gn("data-v-d39ca5f1"),e=e(),vn(),e),dj={class:"flex items-center"},fj={class:"flex items-center relative z-10 shrink-0 gap-1 mr-2"},hj=_o(()=>l("span",{class:"text-white font-bold text-lg"},"Flash Sale",-1)),pj={key:0},mj={class:"text-gray-900 text-[11px] tracking-tight"},gj={key:0,class:"flex items-center text-[11px] text-white mt-2"},vj=_o(()=>l("span",{class:"leading-3"},"Có ",-1)),yj={class:"relative min-w-[18px] h-[14px] mx-0.5 overflow-hidden flex items-center justify-center"},bj=_o(()=>l("span",{class:"leading-3"},"khách đang xem.",-1)),_j={key:0,class:"relative z-10 space-y-1.5 mt-2.5 md:mt-3"},xj=_o(()=>l("div",{class:"w-px h-4 bg-gray-300 shrink-0"},null,-1)),wj={class:"text-[10px] text-white italic leading-none min-h-[14px]"},kj={key:0,class:"font-medium"},Sj={key:1},Cj={key:1,class:"absolute top-1.5 right-1 z-20"},$j=["src"],Tj={key:0,class:"relative z-10 px-2.5 pt-2.5 pb-2"},Aj={class:"flex items-center text-xs font-semibold text-orange-500 mb-1.5"},Ej=_o(()=>l("span",{class:"leading-none"},"Đăng ký nhận giá tốt",-1)),Ij=_o(()=>l("div",{class:"w-px h-4 bg-gray-300 shrink-0"},null,-1)),Pj={class:"text-[11px] italic leading-none min-h-[14px] mt-1.5"},Mj={key:0,class:"font-medium text-green-600"},Oj={key:1,class:"text-gray-700"},Lj=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 M,P;const n="https://widget.geteasy.ai",s=e,r=te(()=>{if(s.product)return s.product;const q=window.location.pathname;return(ln.state.flash_sales??[]).find(T=>T.link&&T.link.includes(q))??null}),o=te(()=>{var H;const q=(H=r.value)==null?void 0:H.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=L(""),c=L(""),u=L(!1),d=L(!1),f=L(((M=r.value)==null?void 0:M.viewing_now)||ln.state.signals.viewing_now||12),h=L(!1),g=te(()=>a.value.trim().length>0),p=te(()=>{var q;return((q=r.value)==null?void 0:q.ordered_by)??[]}),v=te(()=>{var q;return((q=r.value)==null?void 0:q.ordered_count)??p.value.length}),_=L(!1),w=()=>{const q=p.value.map(H=>({name:H.name,phone:H.phone,time:H.ordered_at}));Rw(q)},k=te(()=>{const q=c.value.trim();return q?/^(0|84|\+84)(3|5|7|8|9)([0-9]{8})$/.test(q):!1}),C=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(H=>setTimeout(H,1e3)),d.value=!0,qe.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})`,R=`- 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(R)}a.value="",c.value=""}catch(H){console.error("Registration failed:",H)}finally{u.value=!1}};let E=null;const O=((P=r.value)==null?void 0:P.viewing_now)||ln.state.signals.viewing_now||71;Je(()=>{E=setInterval(()=>{const q=Math.floor(Math.random()*7)-3;let H=f.value+q;H>O+10&&(H=O+10),H<O-10&&(H=O-10),H<1&&(H=1),f.value=H},3500)}),Dt(()=>{E&&clearInterval(E)});const I=()=>{i("end-flash-sales",s.productId)};return(q,H)=>{var T,A,R,K,W,U,J;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",dj,[l("div",fj,[G(sj,{class:"!text-white"}),hj]),((R=r.value)==null?void 0:R.stock_remaining)>0?(m(),x("div",pj,[G(uj,{"end-date":o.value,onEndFlashSales:I},null,8,["end-date"])])):z("",!0),((K=r.value)==null?void 0:K.stock_remaining)>0?(m(),oe(hv,{key:1,variant:"availability",size:"sm",class:"ml-auto"},{default:xe(()=>{var X;return[l("span",mj,[((X=r.value)==null?void 0:X.stock_remaining)!=null?(m(),x(be,{key:0},[Ge(" Còn "+D(r.value.stock_remaining)+"/"+D(r.value.stock_total??10)+" suất ",1)],64)):(m(),x(be,{key:1},[Ge("Còn vài suất")],64))])]}),_:1})):z("",!0)]),e.showSocialProof?(m(),x("div",gj,[G(y(F2),{size:"15",class:"mr-0.5"}),vj,l("div",yj,[G(en,{name:"slide-up"},{default:xe(()=>[(m(),x("span",{key:f.value,class:"absolute inset-x-0 w-full text-center font-semibold text-white"},D(f.value),1))]),_:1})]),bj,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},D(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",_j,[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"]])},[Rt(l("input",{"onUpdate:modelValue":H[0]||(H[0]=X=>a.value=X),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:mr(C,["enter"])},null,34),[[on,a.value]]),xj,Rt(l("input",{"onUpdate:modelValue":H[1]||(H[1]=X=>c.value=X),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:mr(C,["enter"])},null,34),[[on,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:C},D(u.value?"Đang gửi":"Đặt ngay"),3)],2),l("div",wj,[d.value?(m(),x("span",kj," Cảm ơn bạn! Chúng tôi sẽ liên hệ tư vấn sớm nhất. ")):(m(),x("span",Sj," * Lưu ý: Số lượng & thời gian có hạn. Vui lòng điền thông tin để giữ suất. "))])])):z("",!0),((U=r.value)==null?void 0:U.stock_remaining)===0?(m(),x("div",Cj,[l("img",{src:y(n)+"/soldout-min.webp",alt:"Cháy suất",class:"w-[120px] object-contain"},null,8,$j)])):z("",!0)],2),((J=r.value)==null?void 0:J.stock_remaining)===0&&e.showRegistrationForm?(m(),x("div",Tj,[l("div",Aj,[G(y(B2),{size:"16",class:"mr-0.5"}),Ej]),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":""]])},[Rt(l("input",{"onUpdate:modelValue":H[2]||(H[2]=X=>a.value=X),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:mr(C,["enter"])},null,34),[[on,a.value]]),Ij,Rt(l("input",{"onUpdate:modelValue":H[3]||(H[3]=X=>c.value=X),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:mr(C,["enter"])},null,34),[[on,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:C},D(u.value?"Đang gửi":"Đăng ký"),3)],2),l("div",Pj,[d.value?(m(),x("span",Mj," Cảm ơn bạn! Chúng tôi sẽ liên hệ tư vấn sớm nhất. ")):(m(),x("span",Oj," * 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"})),Rj={key:0,class:"shrink-0"},Dj={class:"size-12 shrink-0 flex items-center justify-center cursor-pointer overflow-hidden"},jj=["src","alt"],Nj={class:"flex-1 min-w-0 py-1 cursor-pointer"},Fj={class:"text-sm line-clamp-2 leading-5 text-gray-900 md:group-hover:text-orange-600 transition-colors duration-300"},qj={class:"shrink-0 text-right flex flex-col justify-center cursor-pointer tracking-tight"},zj={key:0,class:"flex items-center justify-end gap-1 mb-1"},Bj={class:"text-[10px] text-red-500 font-semibold bg-red-100 px-1 rounded"},Uj={class:"text-[10px] text-gray-400 line-through"},Vj={class:"text-sm font-bold text-red-500"},mv=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=>tt(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",Rj,[l("button",{onClick:r[0]||(r[0]=Qt(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",Dj,[l("img",{src:e.product.properties.image,class:"w-full h-full object-contain",alt:e.product.properties.name},null,8,jj)]),l("div",Nj,[l("h3",Fj,D(e.product.properties.name),1)]),l("div",qj,[e.product.properties.originalPrice?(m(),x("div",zj,[l("span",Bj,D(n(e.product.properties.price,e.product.properties.originalPrice)),1),l("span",Uj,D(t(e.product.properties.originalPrice)),1)])):z("",!0),l("div",Vj,D(t(e.product.properties.price)),1)])],2))}},[["__scopeId","data-v-742576ca"]]),Or=e=>(gn("data-v-3a2e4a9d"),e=e(),vn(),e),Hj={key:0},Wj=Or(()=>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"),Ge(" Mua kèm dành riêng cho bạn ")],-1)),Gj={class:"flex-1 space-y-1"},Kj={class:"text-[11px] leading-none"},Qj=Or(()=>l("span",{class:"font-normal"},"Bạn đã được thưởng",-1)),Jj=Or(()=>l("span",{class:"text-teal-600 font-bold ml-1 mr-0.5"},"Miễn phí vận chuyển",-1)),Xj=Or(()=>l("span",{class:"font-normal"},"!",-1)),Zj=Or(()=>l("span",{class:"font-normal"},"Chọn thêm",-1)),Yj={class:"text-orange-600 font-bold mx-1"},eN=Or(()=>l("span",{class:"font-normal"},[Ge("sản phẩm để được "),l("span",{class:"font-bold"},"Miễn phí vận chuyển")],-1)),tN={class:"w-full h-0.5 bg-gray-200 rounded-full overflow-hidden"},nN={key:0,class:"border border-gray-300 rounded-lg overflow-hidden bg-white"},sN={class:"flex justify-center relative z-10 my-1"},rN={class:"size-4 flex items-center justify-center bg-gray-400 rounded-full"},oN={key:1,class:"border border-gray-200 rounded-lg overflow-hidden bg-white divide-y divide-gray-100"},iN={class:"border-t border-gray-50"},aN={class:"flex-1 min-w-0 flex items-center gap-1.5"},lN={class:"text-xs text-gray-900 font-medium"},cN={class:"flex items-center gap-1"},uN={class:"text-xs w-14 text-red-600 font-semibold whitespace-nowrap"},dN={key:0,class:"bg-orange-50/50 px-2.5 py-3 space-y-2 overflow-hidden"},fN=["onClick"],hN={class:"flex flex-col gap-1 absolute -left-1.5 top-1/2 -translate-y-1/2"},pN={class:"size-2.5 rounded-full bg-orange-50"},mN={class:"h-[72px] w-[78px] flex items-center justify-center text-white bg-orange-gradient"},gN={class:"flex flex-col items-center gap-0 text-xs text-orange-50"},vN={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"},yN={class:"flex-1"},bN={class:"text-sm font-semibold text-gray-900"},_N={class:"text-[10px] leading-3 text-gray-900"},xN={class:"mt-1.5 flex items-center pr-8"},wN={class:"flex-1 h-1 bg-gray-200 rounded-full overflow-hidden"},kN={class:"flex items-center gap-1 mt-0.5 pr-2"},SN={key:1,class:"text-[10px] leading-3 text-gray-700"},CN={class:"text-[10px] leading-3 text-gray-700"},$N={class:"flex flex-col gap-1 mt-2.5 px-0.5"},TN=Or(()=>l("span",null,"Nhận ưu đãi",-1)),AN={class:"text-[10px] font-normal opacity-90"},EN=Object.freeze(Object.defineProperty({__proto__:null,default:Qe({__name:"WidgetCombo",props:{dataKey:{type:String,default:"also_bought"}},setup(e){const t=e,n=L(!1),s=L(null),r=T=>{const A=Math.floor(T/3600),R=Math.floor(T%3600/60),K=T%60;return`${String(A).padStart(2,"0")}:${String(R).padStart(2,"0")}:${String(K).padStart(2,"0")}`};let o;Je(()=>{o=setInterval(()=>{i.value.forEach(T=>{T.remainingTime>0&&T.remainingTime--})},1e3)}),Dt(()=>{o&&clearInterval(o)});const i=L([{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=te(()=>i.value.find(T=>T.id===s.value)),u=te(()=>{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=te(()=>{const T=ln.state.source_product,A=(ln.state[t.dataKey]||[]).slice(0,2);return!T&&(!A||A.length===0)?[]:[T,...A].filter(Boolean)}),f=te(()=>d.value&&d.value.length>0?d.value[0]:null),h=te(()=>d.value&&d.value.length>1?d.value.slice(1,3):[]),g=L([]),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),_=te(()=>(f.value?1:0)+g.value.length),w=te(()=>(f.value?1:0)+h.value.length),k=te(()=>w.value===0?0:Math.round(_.value/w.value*100)),C=te(()=>k.value>=100),E=T=>tt(T),O=T=>{if(!T)return 0;const A=parseFloat(T);return isNaN(A)?0:A},I=te(()=>{let T=0;const A=R=>{const K=O(R.originalPrice),W=O(R.price);return!K||K<=0?W:Math.max(K,W)};return f.value&&(T+=A(f.value.properties)),h.value.forEach((R,K)=>{v(K)&&(T+=A(R.properties))}),T}),M=te(()=>{let T=0;return f.value&&(T+=O(f.value.properties.price)),h.value.forEach((A,R)=>{v(R)&&(T+=O(A.properties.price))}),T}),P=te(()=>{const T=M.value;if(c.value){const A=c.value;if(T>=(A.minOrder||0)){let R=0;return A.type==="percentage"?(R=Math.floor(T*A.value/100),A.maxDiscount&&(R=Math.min(R,A.maxDiscount))):R=A.value,Math.max(0,T-R)}}return T}),q=te(()=>Math.max(0,I.value-P.value)),H=()=>{var K,W,U,J;const T=`[${(W=(K=f.value)==null?void 0:K.properties)==null?void 0:W.name}](${((J=(U=f.value)==null?void 0:U.properties)==null?void 0:J.url)||window.location.href})`,A=h.value.filter((X,Y)=>v(Y)).map(X=>{var Y,he;return`[${(Y=X.properties)==null?void 0:Y.name}](${((he=X.properties)==null?void 0:he.url)||window.location.href})`});let R=`Nhận khuyến mãi combo:
|
||
`;R+=`- Sản phẩm chính: ${T}
|
||
`,A.length>0&&(R+=`- Sản phẩm mua kèm: ${A.join(", ")}
|
||
`),c.value&&(R+=`- Voucher: ${c.value.title}
|
||
`),R+=`- Vận chuyển: ${C.value?"Miễn phí vận chuyển":"Có phí vận chuyển"}
|
||
`,alert(R)};return Pe(()=>h.value,T=>{T&&T.length>0&&(g.value=T.map((A,R)=>R))},{immediate:!0}),(T,A)=>f.value?(m(),x("div",Hj,[Wj,l("div",{class:ne(["flex items-center px-2 py-1.5 rounded-md mb-1.5 transition-colors duration-300",C.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",C.value?"bg-teal-500":"bg-orange-500"])},[G(y(ck),{size:"12","stroke-width":"2",class:"text-white"})],2),l("div",Gj,[l("div",Kj,[C.value?(m(),x(be,{key:0},[Qj,Jj,Xj],64)):(m(),x(be,{key:1},[Zj,l("span",Yj,D(w.value-_.value),1),eN],64))]),l("div",tN,[l("div",{class:ne(["h-full transition-all duration-500",C.value?"bg-teal-500":"bg-orange-500"]),style:mt({width:`${k.value}%`})},null,6)])])],2),f.value?(m(),x("div",nN,[G(mv,{product:f.value,"show-checkbox":!1,highlight:""},null,8,["product"])])):z("",!0),l("div",sN,[l("div",rN,[G(y(ag),{size:10,class:"text-white","stroke-width":"2"})])]),h.value.length>0?(m(),x("div",oN,[(m(!0),x(be,null,Me(h.value,(R,K)=>(m(),oe(mv,{key:R.properties.id||K,product:R,"is-selected":v(K),onToggle:W=>p(K)},null,8,["product","is-selected","onToggle"]))),128)),l("div",iN,[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]=R=>n.value=!n.value)},[G(y(cg),{size:"16",class:"text-orange-600 transition-transform"}),l("div",aN,[l("span",lN,D(c.value?c.value.title:"Voucher giảm đến 200k sắp hết hạn"),1)]),l("div",cN,[l("div",uN,D(u.value),1),G(y(Ir),{size:"14",class:ne(["text-gray-700 transition-transform duration-300",n.value?"rotate-90":""])},null,8,["class"])])]),G(en,{name:"expand"},{default:xe(()=>[n.value?(m(),x("div",dN,[(m(!0),x(be,null,Me(i.value,R=>(m(),x("div",{key:R.id,class:"bg-white overflow-hidden rounded-md flex items-center cursor-pointer group transition-all relative",onClick:K=>a(R.id)},[l("div",hN,[(m(),x(be,null,Me(4,K=>l("div",pN)),64))]),l("div",mN,[l("div",gN,[G(y(cg),{size:"18"}),Ge(" Giảm giá ")])]),l("div",vN,[l("div",yN,[l("div",bN,D(R.title),1),l("div",_N," Đơn tối thiểu "+D(E(R.minOrder)),1),l("div",xN,[l("div",wN,[l("div",{class:"h-full voucher-progress transition-all duration-500 rounded-full",style:mt({width:`${R.remainingTime/R.totalTime*100}%`})},null,4)])]),l("div",kN,[R.tag?(m(),x("div",{key:0,class:ne(["text-[10px] leading-3",R.id==="V2"?"text-red-600":"text-gray-700"])},D(R.tag),3)):z("",!0),R.tag?(m(),x("span",SN,"•")):z("",!0),l("div",CN," Hết hạn trong "+D(r(R.remainingTime)),1)])]),l("div",{class:ne(["size-5 text-white rounded-full border flex items-center justify-center transition-all shrink-0",s.value===R.id?"bg-orange-500 border-orange-500 ":"bg-white border-gray-200 group-hover:bg-orange-100 group-hover:border-orange-400"])},[s.value===R.id?(m(),oe(y(ul),{key:0,size:12,"stroke-width":"3"})):z("",!0)],2)])],8,fN))),128))])):z("",!0)]),_:1})])])):z("",!0),l("div",$N,[l("button",{onClick:H,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"},[TN,l("span",AN,"Tổng "+D(E(P.value))+" - Tiết kiệm "+D(E(q.value)),1)])])])):z("",!0)}},[["__scopeId","data-v-3a2e4a9d"]])},Symbol.toStringTag,{value:"Module"})),gv=e=>(gn("data-v-b2e81a91"),e=e(),vn(),e),IN=["id"],PN={class:"fc-card"},MN={class:"fc-card__top"},ON=["data-value"],LN=["data-value"],RN=["data-value"],DN={class:"fc-slot"},jN=gv(()=>l("span",{class:"fc-colon"},":",-1)),NN=["id"],FN={class:"fc-card"},qN={class:"fc-card__top"},zN=["data-value"],BN=["data-value"],UN=["data-value"],VN={class:"fc-slot"},HN=gv(()=>l("span",{class:"fc-colon"},":",-1)),WN=["id"],GN={class:"fc-card"},KN={class:"fc-card__top"},QN=["data-value"],JN=["data-value"],XN=["data-value"],ZN={class:"fc-slot"},YN=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=L(n.totalSeconds),o=te(()=>{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=L({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)}),Dt(()=>{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",PN,[l("b",MN,D(a.value.hours.current),1),l("b",{class:"fc-card__bottom","data-value":a.value.hours.current},null,8,ON),l("b",{class:"fc-card__back","data-value":a.value.hours.previous},null,8,LN),l("b",{class:"fc-card__back-bottom","data-value":a.value.hours.previous},null,8,RN)]),l("span",DN,D(e.labels.hours),1)],8,IN),jN,l("span",{class:"fc-piece",id:a.value.minutes.id},[l("span",FN,[l("b",qN,D(a.value.minutes.current),1),l("b",{class:"fc-card__bottom","data-value":a.value.minutes.current},null,8,zN),l("b",{class:"fc-card__back","data-value":a.value.minutes.previous},null,8,BN),l("b",{class:"fc-card__back-bottom","data-value":a.value.minutes.previous},null,8,UN)]),l("span",VN,D(e.labels.minutes),1)],8,NN),HN,l("span",{class:"fc-piece",id:a.value.seconds.id},[l("span",GN,[l("b",KN,D(a.value.seconds.current),1),l("b",{class:"fc-card__bottom","data-value":a.value.seconds.current},null,8,QN),l("b",{class:"fc-card__back","data-value":a.value.seconds.previous},null,8,JN),l("b",{class:"fc-card__back-bottom","data-value":a.value.seconds.previous},null,8,XN)]),l("span",ZN,D(e.labels.seconds),1)],8,WN)],2))}},[["__scopeId","data-v-b2e81a91"]]),Dl=e=>(gn("data-v-56657c6b"),e=e(),vn(),e),eF={class:"border border-red-500 rounded overflow-hidden"},tF={class:"relative overflow-hidden border-b bg-red-500"},nF={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"},sF={class:"flex items-center gap-1 w-full sm:w-auto justify-center sm:justify-start"},rF=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)),oF={class:"shrink-0 flex justify-center w-full sm:w-auto"},iF={class:"flex flex-col w-full bg-gray-50/50"},aF={class:"flex items-stretch px-2 py-3 sm:px-4 sm:py-6 gap-0"},lF={key:0,class:"combo-card shrink-0"},cF={class:"h-full bg-white flex flex-col rounded"},uF={class:"aspect-[1/1] relative overflow-hidden mb-1"},dF=["src","alt"],fF={class:"flex-1 flex flex-col p-1"},hF={class:"text-xs sm:text-sm font-medium line-clamp-2 text-gray-900 mb-1"},pF={class:"space-y-0.5"},mF={class:"text-xs sm:text-sm font-bold text-red-500"},gF={key:0,class:"flex items-center gap-1 flex-wrap"},vF={class:"text-[10px] sm:text-xs text-gray-400 line-through"},yF={class:"text-[10px] sm:text-xs text-red-500 font-semibold bg-red-50 px-1 rounded"},bF={key:1,class:"flex items-center justify-center shrink-0 px-1 sm:px-4"},_F={class:"rounded-full p-1 sm:p-2"},xF={key:2,class:"flex-1 min-w-0 relative"},wF=["disabled"],kF=["disabled"],SF={class:"flex items-stretch h-full"},CF=["onClick"],$F={class:"aspect-[1/1] relative overflow-hidden mb-1"},TF=["src","alt"],AF={key:0,class:"absolute inset-0 bg-orange-600/5 flex items-center justify-center"},EF={class:"flex-1 flex flex-col p-1"},IF={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"},PF={class:"ml-1"},MF={class:"space-y-0.5"},OF={class:"text-xs sm:text-sm font-bold text-red-500"},LF={key:0,class:"flex items-center gap-1 flex-wrap"},RF={class:"text-[10px] sm:text-xs text-gray-400 line-through"},DF={class:"text-[10px] sm:text-xs text-red-500 font-semibold bg-red-50 px-1 rounded"},jF={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"},NF={class:"flex items-center justify-between w-full lg:w-auto flex-1 lg:pr-16"},FF={class:"flex flex-col font-bold items-center lg:items-start text-center lg:text-left"},qF=Dl(()=>l("span",{class:"text-xs sm:text-sm text-gray-900"},"Tổng tiền gốc:",-1)),zF={class:"text-sm sm:text-base font-medium text-gray-700"},BF={class:"flex flex-col items-center font-bold lg:items-start text-center lg:text-left"},UF=Dl(()=>l("span",{class:"text-xs sm:text-sm text-gray-900"},"Tiết kiệm:",-1)),VF={class:"text-sm sm:text-base text-green-600"},HF={class:"flex font-bold flex-col items-center lg:items-start text-center lg:text-left"},WF=Dl(()=>l("span",{class:"text-xs sm:text-sm text-gray-900"},"Tổng tiền:",-1)),GF={class:"text-sm sm:text-base text-red-500"},KF=Object.freeze(Object.defineProperty({__proto__:null,default:Qe({__name:"WidgetComboHorizontal",props:{dataKey:{type:String,default:"also_bought"}},setup(e){const t=e,n=L(null),s=L(0),r=L(0),o=L(1),i=L(!1),a=L(!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 R,K;s.value=T.currentIndex,o.value=((R=n.value)==null?void 0:R.currentSlidesPerView)||1;const A=(K=n.value)==null?void 0:K.emblaApi;A&&d(A)},d=T=>{i.value=T.canScrollPrev(),a.value=T.canScrollNext()};te(()=>f.value>=100);const f=te(()=>k.value===0?0:Math.round(w.value/k.value*100)),h=te(()=>ln.state.source_product||null),g=te(()=>(ln.state[t.dataKey]||[]).map(A=>{const R=A.properties??A;return{id:R.id,properties:R,signals:A.signals??{}}})),p=L([]),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=te(()=>(h.value?1:0)+p.value.length),k=te(()=>(h.value?1:0)+g.value.length),C=T=>tt(T),E=(T,A)=>{if(!T||!A)return"";const R=parseFloat(T),K=parseFloat(A);return K<=R?"":`-${Math.round((1-R/K)*100)}%`},O=T=>{if(!T)return 0;const A=parseFloat(T);return isNaN(A)?0:A},I=te(()=>{let T=0;const A=R=>{const K=O(R.originalPrice),W=O(R.price);return!K||K<=0?W:Math.max(K,W)};return h.value&&(T+=A(h.value.properties)),p.value.forEach(R=>{g.value[R]&&(T+=A(g.value[R].properties))}),T}),M=te(()=>{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}),P=te(()=>M.value),q=te(()=>Math.max(0,I.value-P.value)),H=()=>{var K,W,U,J,X;const T=`[${(W=(K=h.value)==null?void 0:K.properties)==null?void 0:W.name}](${((J=(U=h.value)==null?void 0:U.properties)==null?void 0:J.url)||window.location.href})`,A=p.value.map(Y=>{var ce,ue;const he=g.value[Y];return`[${(ce=he.properties)==null?void 0:ce.name}](${((ue=he.properties)==null?void 0:ue.url)||window.location.href})`});let R=`Nhận khuyến mãi combo:
|
||
`;R+=`- Sản phẩm chính: ${T}
|
||
`,A.length>0&&(R+=`- Sản phẩm mua kèm: ${A.join(", ")}
|
||
`),(X=window.EasyAI)!=null&&X.send&&window.EasyAI.send(R),qe!=null&&qe.generateLead&&qe.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,R)=>R))},{immediate:!0}),(T,A)=>(m(),x("div",eF,[l("div",tF,[l("div",nF,[l("div",sF,[G(Rl,{class:"size-6 sm:size-7 shrink-0"}),rF]),l("div",oF,[G(YN,{"total-seconds":6312,variant:"white"})])])]),l("div",iF,[l("div",aF,[h.value?(m(),x("div",lF,[l("div",cF,[l("div",uF,[l("img",{src:h.value.properties.image,class:"w-full h-full object-contain",alt:h.value.properties.name},null,8,dF)]),l("div",fF,[l("h3",hF,D(h.value.properties.name),1),l("div",pF,[l("div",mF,D(C(h.value.properties.price)),1),h.value.properties.originalPrice?(m(),x("div",gF,[l("span",vF,D(C(h.value.properties.originalPrice)),1),l("span",yF,D(E(h.value.properties.price,h.value.properties.originalPrice)),1)])):z("",!0)])])])])):z("",!0),h.value&&g.value.length>0?(m(),x("div",bF,[l("div",_F,[G(y(ag),{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",xF,[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]=R=>{var K;return(K=n.value)==null?void 0:K.scrollPrev()})},[G(y(mo),{class:"w-4 h-4 sm:w-5 sm:h-5","stroke-width":"3"})],8,wF)):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]=R=>{var K;return(K=n.value)==null?void 0:K.scrollNext()})},[G(y(Ir),{class:"w-4 h-4 sm:w-5 sm:h-5","stroke-width":"3"})],8,kF)):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:xe(()=>[(m(!0),x(be,null,Me(g.value,(R,K)=>(m(),x("div",{key:R.id||K,class:"embla__slide"},[l("div",SF,[l("div",{class:"flex-1 min-w-0 h-full group bg-white transition-all cursor-pointer flex flex-col rounded",onClick:W=>v(K)},[l("div",$F,[l("img",{src:R.properties.image,class:"w-full h-full object-contain",alt:R.properties.name},null,8,TF),_(K)?(m(),x("div",AF)):z("",!0)]),l("div",EF,[l("h3",IF,[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",_(K)?"bg-orange-600 border-orange-600 shadow-sm":"bg-white border-gray-300"])},[G(y(ul),{class:ne([[_(K)?"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",PF,D(R.properties.name),1)]),l("div",MF,[l("div",OF,D(C(R.properties.price)),1),R.properties.originalPrice?(m(),x("div",LF,[l("span",RF,D(C(R.properties.originalPrice)),1),l("span",DF,D(E(R.properties.price,R.properties.originalPrice)),1)])):z("",!0)])])],8,CF)])]))),128))]),_:1},512)])):z("",!0)]),l("div",jF,[l("div",NF,[l("div",FF,[qF,l("span",zF,D(C(I.value)),1)]),l("div",BF,[UF,l("span",VF,D(C(q.value)),1)]),l("div",HF,[WF,l("span",GF,D(C(P.value)),1)])]),l("button",{onClick:H,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"})),vv=e=>(gn("data-v-0e32e6e0"),e=e(),vn(),e),QF=vv(()=>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)),JF={class:"overflow-y-auto p-3 flex-1"},XF={class:"mb-3 text-gray-700 text-xs font-semibold"},ZF={class:"overflow-x-auto eai-no-scrollbar"},YF={class:"w-full text-left border border-gray-100"},eq=vv(()=>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)),tq={class:"text-[11px]"},nq={class:"py-2 px-1.5 text-gray-700 font-medium"},sq={class:"py-2 px-1.5 text-gray-600 text-center"},rq={class:"py-2 px-1.5 text-gray-600"},oq=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)}),Dt(()=>{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]=Qt(()=>{},["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"})]),QF,l("div",JF,[l("div",XF," Có "+D(e.customers.length)+" khách đã đặt ",1),l("div",ZF,[l("table",YF,[eq,l("tbody",tq,[(m(!0),x(be,null,Me(e.customers,(c,u)=>(m(),x("tr",{key:u,class:ne(u%2===0?"bg-gray-50":"bg-white")},[l("td",nq,D(c.name),1),l("td",sq,D(c.phone),1),l("td",rq,D(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"},iq={"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 yv(){const e=L(!1),t=L(null),n=L(null),s=L(null),{handle:r}=It(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=iq[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 aq={class:"p-[8px] flex flex-col group h-full"},lq=["src","alt"],cq=["src","alt"],uq={class:"flex flex-col flex-1 mt-2"},dq={class:"flex flex-wrap items-center mt-1"},fq={class:"mr-1 text-red-500 font-semibold text-[15px]"},hq={key:0},pq={key:1},mq={key:2},gq={key:0,class:"text-xs font-light text-gray-500"},vq={key:1,class:"text-xs font-light text-gray-500"},yq={key:0,class:"mt-2 mb-1 variant-attributes"},bq={class:"mb-0.5 text-xs tracking-tight text-gray-500"},_q={class:"flex space-x-2"},xq=["onClick"],wq={key:1,class:"flex items-center mt-2"},kq={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},Sq={key:0,class:"mt-4"},Cq={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"},$q={key:1,class:"mt-4"},Tq=["href"],Aq=["href"],Eq=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}=yv(),c=L(!1),u=((I=(O=V.bot)==null?void 0:O.config)==null?void 0:I.ui.logo)||`${V.appDomain}/link.png`,d=L(null),f=L(!1);Za(n.item.links)&&(n.item.links=JSON.parse(n.item.links)),Pe(f,M=>{s("loading",M)});const h=L(!1),g=L(null),p=L(null),v=L(!1),_=()=>{var q,H,T;const{source:M,links:P}=n.item;if(p.value=(q=P==null?void 0:P.variant_items)==null?void 0:q.filter(A=>!A.hasOwnProperty("status")||A.status),v.value=((H=P==null?void 0:P.service_packs)==null?void 0:H.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(P==null?void 0:P.cta_links,M)},w=async M=>{if(!Number(M))return;const P=document.querySelector(".header__cart .cart-number");P&&(P.textContent||P.classList.add("has-cart"),P.textContent=M)};async function k(){try{const M=new Date().getTime(),q=`${window.location.origin}/cart/api/cart/info?_=${M}`,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(M){console.error("Error:",M)}}function C(){var q,H,T,A,R,K;if(f.value)return;let M=(T=(H=(q=n.item.links)==null?void 0:q.cta_links)==null?void 0:H.find(W=>W.href.includes("/cart/them-vao-gio-hang")))==null?void 0:T.href;if(!M)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,U=((R=W==null?void 0:W[0])==null?void 0:R.data_id)??((K=W==null?void 0:W[1])==null?void 0:K.data_id)??1;M=M+`&packageSelection=${U}`}const P=document.createElement("iframe");P.style.display="none",P.src=M,P.onload=async W=>{document.body.removeChild(P),f.value=!1,h.value=!0,k();let{title:U,image:J,source:X}=n.item;const Y=await $r(J);Y.status||(J=u);const he=lo({title:U,image:J,source:X,isImageValid:Y.status,cartUrl:"/cart"});s("send-message",he)},P.onerror=W=>{document.body.removeChild(P),f.value=!1},document.body.appendChild(P)}const E=async()=>{if(v.value||a.value&&!a.value.includes("productCode")){C();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 M={};if(g.value)M={quantity:1,productId:g.value.id,productCode:g.value.code,productType:g.value.product_type};else{const q=Ya(a.value);M={quantity:1,productId:q.productId,productCode:q.productCode,productType:q.productType}}const P=await r(M,v.value);if(P&&P.data){h.value=!0;const q=P.data.products.reduce((W,U)=>W+U.quantity,0);w(q);let{title:H,image:T,source:A}=n.item;const R=await $r(T);R.status||(T=u);const K=lo({title:H,image:T,source:A,isImageValid:R.status,cartUrl:"/cart"});s("send-message",K)}else{const q=P.errormessage;mn.actions.warning({message:q})}}catch(M){console.log(M),M!=null&&M.message&&mn.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,_()}),(M,P)=>{var q,H,T,A;return m(),x("div",aq,[(m(),oe(Ft(e.item.source?"a":"div"),{href:e.item.source,target:"_self",class:"rounded overflow-hidden flex items-center justify-center aspect-[1/1]"},{default:xe(()=>[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:P[0]||(P[0]=()=>c.value=!0)},null,40,lq)):(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,cq))]),_:1},8,["href"])),l("div",uq,[(m(),oe(Ft(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:xe(()=>[Ge(D(e.item.title),1)]),_:1},8,["href"])),l("div",dq,[l("div",fq,[e.item.texts&&e.item.texts.price?(m(),x("div",hq,D(e.item.texts.price),1)):g.value&&g.value.price_text?(m(),x("div",pq,D(g.value.price_text),1)):e.item.price?(m(),x("div",mq,D(y(tt)(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",gq,D(g.value.old_price_text),1)):!((H=(q=e.item.links)==null?void 0:q.variant_items)!=null&&H.length)&&e.item.old_price>0&&e.item.old_price!==e.item.price&&e.item.old_price_text!==0?(m(),x("del",vq,D(y(tt)(e.item.old_price,{currency:e.item.currency})),1)):z("",!0)]),g.value?(m(),x("div",yq,[l("div",bq," Màu: "+D(g.value.color||""),1),l("div",_q,[(m(!0),x(be,null,Me(p.value,(R,K)=>(m(),x("div",{key:K,class:"cursor-pointer",onClick:W=>g.value=R},[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===R.code?"border-blue-50 ring-blue-300":"border-transparent ring-transparent"]),style:mt({backgroundColor:R.color_hex})},null,6)],8,xq))),128))])])):z("",!0),Number(e.item.rating)||e.item.review_count?(m(),x("div",wq,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:mt({"--rating":Number(e.item.rating)})},null,4)):z("",!0),e.item.review_count?(m(),x("div",kq," ("+D(y(ym)(e.item.review_count))+") ",1)):z("",!0)])):z("",!0)]),h.value?(m(),x("div",Sq,[l("a",Cq,[G(y(cn),{"stroke-width":"1.5",size:"18",class:"mr-1"}),Ge(" Thanh toán ngay ")])])):(m(),x("div",$q,[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(cn),{"stroke-width":"1.5",size:"18",class:"mr-1"}),Ge(" Mua ngay ")],8,Tq)):(A=(T=e.item.links)==null?void 0:T.cta_links)!=null&&A.length?(m(),x("button",{key:2,onClick:P[1]||(P[1]=R=>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(be,{key:0},[f.value?(m(),oe(nn,{key:0,class:"w-[18px] h-[18px] mr-1"})):(m(),oe(y(cn),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"}))],64)):(m(),oe(y(tg),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"})),Ge(" "+D(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"}),Ge(" Xem chi tiết ")],8,Aq))]))])}}}},Symbol.toStringTag,{value:"Module"})),Iq={class:"p-[10px] rounded group border border-gray-200 w-full"},Pq={class:"flex"},Mq=["src","alt"],Oq=["src","alt"],Lq={class:"flex flex-col flex-1"},Rq={class:"flex flex-wrap items-center mt-1"},Dq={class:"mr-1 text-red-500 font-semibold text-[15px]"},jq={key:0},Nq={key:1},Fq={key:2},qq={key:0,class:"text-xs font-light text-gray-500"},zq={key:1,class:"text-xs font-light text-gray-500"},Bq={key:0,class:"my-2 variant-attributes"},Uq={class:"mb-0.5 text-xs tracking-tight text-gray-500"},Vq={class:"flex space-x-2"},Hq=["onClick"],Wq={key:1,class:"flex items-center"},Gq={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},Kq={key:0,class:"mt-3"},Qq={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"},Jq={key:1,class:"mt-3"},Xq=["href"],Zq=["href"],Yq=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}=yv(),c=L(!1),u=((I=(O=V.bot)==null?void 0:O.config)==null?void 0:I.ui.logo)||`${V.appDomain}/link.png`,d=L(null),f=L(!1);Za(n.item.links)&&(n.item.links=JSON.parse(n.item.links)),Pe(f,M=>{s("loading",M)});const h=L(!1),g=L(null),p=L(null),v=L(!1),_=()=>{var q,H,T;const{source:M,links:P}=n.item;if(p.value=(q=P==null?void 0:P.variant_items)==null?void 0:q.filter(A=>!A.hasOwnProperty("status")||A.status),v.value=((H=P==null?void 0:P.service_packs)==null?void 0:H.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(P==null?void 0:P.cta_links,M)},w=async M=>{if(!Number(M))return;const P=document.querySelector(".header__cart .cart-number");P&&(P.textContent||P.classList.add("has-cart"),P.textContent=M)};async function k(){try{const M=new Date().getTime(),q=`${window.location.origin}/cart/api/cart/info?_=${M}`,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(M){console.error("Error:",M)}}function C(){var q,H,T,A,R,K;if(f.value)return;let M=(T=(H=(q=n.item.links)==null?void 0:q.cta_links)==null?void 0:H.find(W=>W.href.includes("/cart/them-vao-gio-hang")))==null?void 0:T.href;if(!M)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,U=((R=W==null?void 0:W[0])==null?void 0:R.data_id)??((K=W==null?void 0:W[1])==null?void 0:K.data_id)??1;M=M+`&packageSelection=${U}`}const P=document.createElement("iframe");P.style.display="none",P.src=M,P.onload=async W=>{document.body.removeChild(P),f.value=!1,h.value=!0,k();let{title:U,image:J,source:X}=n.item;const Y=await $r(J);Y.status||(J=u);const he=lo({title:U,image:J,source:X,isImageValid:Y.status,cartUrl:"/cart"});s("send-message",he)},P.onerror=W=>{document.body.removeChild(P),f.value=!1},document.body.appendChild(P)}const E=async()=>{if(v.value||a.value&&!a.value.includes("productCode")){C();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 M={};if(g.value)M={quantity:1,productId:g.value.id,productCode:g.value.code,productType:g.value.product_type};else{const q=Ya(a.value);M={quantity:1,productId:q.productId,productCode:q.productCode,productType:q.productType}}const P=await r(M);if(P&&P.data){h.value=!0;const q=P.data.products.reduce((W,U)=>W+U.quantity,0);w(q);let{title:H,image:T,source:A}=n.item;const R=await $r(T);R.status||(T=u);const K=lo({title:H,image:T,source:A,isImageValid:R.status,cartUrl:"/cart"});s("send-message",K)}else{const q=P.errormessage;console.log("Failed to add to cart",q),mn.actions.warning({message:q})}}catch(M){console.log(M),M!=null&&M.message&&mn.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,_()}),(M,P)=>{var q,H;return m(),x("div",Iq,[l("div",Pq,[(m(),oe(Ft(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:xe(()=>[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:P[0]||(P[0]=()=>c.value=!0)},null,40,Mq)):(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,Oq))]),_:1},8,["href"])),l("div",Lq,[(m(),oe(Ft(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:xe(()=>[Ge(D(e.item.title),1)]),_:1},8,["href"])),l("div",Rq,[l("div",Dq,[e.item.texts&&e.item.texts.price?(m(),x("div",jq,D(e.item.texts.price),1)):g.value&&g.value.price_text&&g.value.price_text!=="0₫"?(m(),x("div",Nq,D(g.value.price_text),1)):e.item.price&&e.item.price!==0?(m(),x("div",Fq,D(y(tt)(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",qq,D(g.value.old_price_text),1)):e.item.old_price>0&&e.item.old_price!==e.item.price?(m(),x("del",zq,D(y(tt)(e.item.old_price,{currency:e.item.currency})),1)):z("",!0)]),g.value?(m(),x("div",Bq,[l("div",Uq," Màu: "+D(g.value.color||""),1),l("div",Vq,[(m(!0),x(be,null,Me(p.value,(T,A)=>(m(),x("div",{key:A,class:"cursor-pointer",onClick:R=>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:mt({backgroundColor:T.color_hex})},null,6)],8,Hq))),128))])])):z("",!0),Number(e.item.rating)||e.item.review_count?(m(),x("div",Wq,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:mt({"--rating":Number(e.item.rating)})},null,4)):z("",!0),e.item.review_count?(m(),x("div",Gq," ("+D(y(ym)(e.item.review_count))+") ",1)):z("",!0)])):z("",!0)])]),h.value?(m(),x("div",Kq,[l("a",Qq,[G(y(cn),{"stroke-width":"1.5",size:"18",class:"mr-1"}),Ge(" Thanh toán ngay ")])])):(m(),x("div",Jq,[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(cn),{"stroke-width":"1.5",size:"18",class:"mr-1"}),Ge(" Mua ngay ")],8,Xq)):(H=(q=e.item.links)==null?void 0:q.cta_links)!=null&&H.length?(m(),x("button",{key:2,onClick:P[1]||(P[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(be,{key:0},[f.value?(m(),oe(nn,{key:0,class:"w-[18px] h-[18px] mr-1"})):(m(),oe(y(cn),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"}))],64)):(m(),oe(y(tg),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"})),Ge(" "+D(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"}),Ge(" Xem chi tiết ")],8,Zq))]))])}}}},Symbol.toStringTag,{value:"Module"})),bd="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 bv(){const e=L(!1),t=L(null),n=L(null),s="https://ecommerce.pico.vn",r="/user/api/shopping-cart",o=kt.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=$t.get("guestId"),h=$t.get("access"),g=$t.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=>!$t.get(h));return{isValid:f.length===0,missing:f}},u=()=>({uuid:$t.get("guestId"),access:$t.get("access"),saleRegion:$t.get("sale-region")||"MN1",platform:i()});return te(()=>c().isValid),te(()=>u()),{isLoading:Ur(e),error:Ur(t),cartResponse:Ur(n),addToCart:a}}function _v(){L(!1);const e=L(!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 xv(){const e=L(!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"}):(mn.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 mn.actions.error({message:"Có lỗi xảy ra, vui lòng thử lại sau"}),r}finally{e.value=!1}}}}const ez={class:"p-[8px] flex flex-col group sm:hover:shadow duration-200 h-full"},tz=["src","alt"],nz=["src","alt"],sz={class:"flex flex-col flex-1 mt-2"},rz={key:0,class:"mt-1 text-sm text-gray-500 line-clamp-2"},oz={key:1,class:"flex flex-wrap items-center mt-1"},iz={class:"mr-1 text-sm font-semibold text-red-500"},az={key:0},lz={key:1},cz={key:2},uz={key:0,class:"text-xs font-light text-gray-500"},dz={key:2,class:"flex items-center mt-1"},fz={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},hz={key:0,class:"mt-4"},pz=["href"],mz={key:1,class:"mt-4"},gz=["href"],vz=["src"],yz=l("div",{class:"leading-[140%]"},"Chat zalo",-1),bz=l("div",{class:"leading-[140%]"},"Liên hệ hotline",-1),_z=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,H;const n={[fi]:"https://zalo.me/0935194469",[ss]:"https://zalo.me/2915476565064825313"},s=e,r=t,o=L(!1),i=((H=(q=V.bot)==null?void 0:q.config)==null?void 0:H.ui.logo)||`${V.appDomain}/link.png`,a=L(null),c=L(!1),u=L(!1),d=L(!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=V.selectedForm;const R=ao(s.item);(T=R.texts)!=null&&T.price&&(R.price=0,R.old_price=0);const K={...R,quantity:1};if(A){let W=!1;A.items.forEach(U=>{var J,X;((J=U.sku)==null?void 0:J.toString())===((X=K.sku)==null?void 0:X.toString())&&(W=!0,U.quantity=Number(U.quantity)+1)}),A={...A,items:W?A.items:[...A.items,K]}}else A={items:[K]};Pl().update({formData:A,status:"draft"}),V.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&&(V.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(){V.handle===Ln?g():V.handle===ai?_(s.item.sku):V.handle===_r?w():V.handle===so?C():V.handle===ss?E():V.handle===wr?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:R,source:K}=s.item;const W=P(),U=await $r(R);U.status||(R=i);const J=lo({title:A,image:R,source:K,isImageValid:U.status,cartUrl:W,...T});r("send-message",J)};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 R="";if(Array.isArray(T)){if(T.length===0)throw new Error("Product IDs array cannot be empty");T.forEach(U=>{if(!U||U<=0)throw new Error("All product IDs must be positive numbers")}),R=T.join(",")}else{if(T<=0)throw new Error("Product ID must be a positive number");R=T.toString()}const K=A+R+"?utm_source=easyai",W=await fetch(K,{method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}});if(!W.ok){const U=await W.text();throw console.log("Error response:",U),new Error(`HTTP error! status: ${W.status} - ${U}`)}await W.text(),u.value=!0,v()}catch(R){console.error("Error adding items to cart:",R)}finally{c.value=!1}}async function w(){var T;try{if(c.value)return;c.value=!0;const A=await bv().addToCart({productId:s.item.product_id,quantity:1,serviceIds:[],giftItems:[],selectedReceiveAtWarehouse:!1});if(A&&A.data){u.value=!0,v();const R=(T=A.data.products)==null?void 0:T.reduce((U,J)=>U+J.quantity,0),K=document.querySelector('a[href="/checkout/cart"] .bg-product-salePrice'),W=document.querySelector("#bottomMobileTab .bg-red.rounded-full");K&&(K.textContent=R||0),W&&(W.textContent=R||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 U=(((s.item.links||{}).variants||[])[0]||{}).rule_id||"",J=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])||"",X=await xv().addToCart({productId:J,ruleId:U,quantity:1});X&&X.success&&(u.value=!0,v())}catch(R){console.error("ViettelStore: Error adding to cart:",R)}finally{c.value=!1}}async function C(){try{if(c.value||!s.item.product_id)return;c.value=!0;const T=await _v().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 R=`${A.product_id}-${A.product_type??0}`,K=new FormData;K.append("action","create"),K.append("item_type","product"),K.append("item_id",R),K.append("props[quantity]",1);const U=await(await fetch("https://www.phucanh.vn/ajax/cart.php",{method:"POST",body:K})).json();if((U.status==="success"||U.status==="error"&&U.error_type==="item-in-cart")&&(U.status==="error"&&U.error_type==="item-in-cart"&&mn.actions.warning({message:U.message||"Sản phẩm đã tồn tại trong giỏ hàng"}),U.status==="success")){u.value=!0;const J=document.getElementById("count_shopping_cart_store");if(J){const X=parseInt(J.textContent)||0;J.textContent=X+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)&&Xt.ctaClick({type:T,...A})}function I(T,A={}){["product","page"].includes(T)&&Xt.linkClick({type:T,...A})}const M=()=>{const{image:T,image_url:A}=s.item;return T||(Array.isArray(A)&&A[0]?A[0]:(o.value=!0,null))},P=()=>({[_r]:"/checkout/cart?utm_source=easyai&utm_medium=productcard",[ai]:"/cart?utm_source=easyai&utm_medium=productcard",[so]:"/cart?utm_source=easyai&utm_medium=productcard",[wr]:"/gio-hang.html?utm_source=easyai&utm_medium=productcard",[ss]:"/cart?utm_source=easyai&utm_medium=productcard"})[V.handle]||"/cart";return(T,A)=>{var R,K,W,U,J,X,Y,he,ce,ue;return m(),x("div",ez,[(m(),oe(Ft(e.item.source?"a":"div"),{href:e.item.source,target:d.value?"_blank":"_self",onClick:A[1]||(A[1]=Te=>I("product",{url:e.item.source})),class:"rounded-sm overflow-hidden flex items-center justify-center aspect-[1/1]"},{default:xe(()=>[M()&&!o.value?(m(),x("img",{key:0,src:M(),alt:e.item.title,class:"object-contain w-full h-full",onError:A[0]||(A[0]=()=>o.value=!0)},null,40,tz)):(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,nz))]),_:1},8,["href","target"])),l("div",sz,[(m(),oe(Ft(e.item.source?"a":"div"),{href:e.item.source,target:d.value?"_blank":"_self",onClick:A[2]||(A[2]=Te=>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:xe(()=>[Ge(D(e.item.title),1)]),_:1},8,["href","target"])),!e.item.price&&!e.item.rating&&e.item.description?(m(),x("p",rz,D(e.item.description),1)):z("",!0),y(V).handle!==y(br)?(m(),x("div",oz,[l("div",iz,[e.item.texts&&e.item.texts.price?(m(),x("div",az,D(e.item.texts.price),1)):e.item.price?(m(),x("div",lz,D(y(tt)(e.item.price,{currency:e.item.currency})),1)):(m(),x("div",cz,"Liên hệ"))]),e.item.old_price>0&&e.item.old_price!==e.item.price?(m(),x("del",uz,D(y(tt)(e.item.old_price,{currency:e.item.currency})),1)):z("",!0)])):z("",!0),Number(e.item.rating)||e.item.review_count?(m(),x("div",dz,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:mt({"--rating":Number(e.item.rating)})},null,4)):z("",!0),e.item.review_count?(m(),x("div",fz," ("+D(e.item.review_count)+") ",1)):z("",!0)])):z("",!0)]),u.value?(m(),x("div",hz,[l("a",{href:P(),onClick:A[3]||(A[3]=Te=>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(cn),{"stroke-width":"1.5",size:"18",class:"mr-1"}),Ge(" Thanh toán ngay ")],8,pz)])):(m(),x("div",mz,[y(V).handle===y(Ln)||y(V).forms.order&&e.item.price&&y(V).handle!==y(br)&&!(y(V).handle===y(ss)&&(!((R=e.item.links)!=null&&R.purchase_info)||!((W=(K=e.item.links)==null?void 0:K.purchase_info)!=null&&W.purchasable)||!((J=(U=e.item.links)==null?void 0:U.purchase_info)!=null&&J.product_id)))?(m(),x("button",{key:0,onClick:A[4]||(A[4]=Te=>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(nn,{key:0,class:"w-[18px] h-[18px] mr-1"})):(m(),oe(y(cn),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"})),Ge(" Thêm vào giỏ ")],2)):y(V).handle===y(fi)&&!e.item.price||y(V).handle===y(ss)&&(!((X=e.item.links)!=null&&X.purchase_info)||!((he=(Y=e.item.links)==null?void 0:Y.purchase_info)!=null&&he.purchasable)||!((ue=(ce=e.item.links)==null?void 0:ce.purchase_info)!=null&&ue.product_id))?(m(),x("a",{key:1,href:n[y(V).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(bd),class:"w-[18px] h-[18px] mr-2"},null,8,vz),yz],8,gz)):y(V).handle===y(br)?(m(),x("a",{key:2,href:"tel:19002628",onClick:A[5]||(A[5]=Te=>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"}),bz])):z("",!0)]))])}}}},Symbol.toStringTag,{value:"Module"})),xz={class:"p-[12px] group border border-gray-200 w-full"},wz={class:"flex"},kz=["src","alt"],Sz=["src","alt"],Cz={class:"flex flex-col flex-1"},$z={key:0,class:"my-1 text-sm text-gray-500 line-clamp-2"},Tz={class:"flex flex-wrap items-center mt-1"},Az={class:"mr-1 text-sm font-semibold text-red-500"},Ez={key:0},Iz={key:1},Pz={key:2},Mz={key:0,class:"text-xs font-light text-gray-500"},Oz={key:1,class:"flex items-center"},Lz={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},Rz={key:0,class:"mt-2"},Dz=["href"],jz=["href"],Nz=["src"],Fz=l("div",{class:"leading-[140%]"},"Chat zalo",-1),qz=l("div",{class:"leading-[140%]"},"Liên hệ hotline",-1),zz=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,H;const n={[fi]:"https://zalo.me/0935194469",[ss]:"https://zalo.me/2915476565064825313"},s=e,r=t,o=L(!1),i=((H=(q=V.bot)==null?void 0:q.config)==null?void 0:H.ui.logo)||`${V.appDomain}/link.png`,a=L(null),c=L(!1);Za(s.item.links)&&(s.item.links=JSON.parse(s.item.links));const u=L(!1),d=L(!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=V.selectedForm;const R=ao(s.item);(T=R.texts)!=null&&T.price&&(R.price=0,R.old_price=0);const K={...R,quantity:1};if(A){let W=!1;A.items.forEach(U=>{var J,X;((J=U.sku)==null?void 0:J.toString())===((X=K.sku)==null?void 0:X.toString())&&(W=!0,U.quantity=Number(U.quantity)+1)}),A={...A,items:W?A.items:[...A.items,K]}}else A={items:[K]};Pl().update({formData:A,status:"draft"}),V.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&&(V.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(){V.handle===Ln?g():V.handle===ai?_(s.item.sku):V.handle===_r?w():V.handle===so?C():V.handle===ss?E():V.handle===wr?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:R,source:K}=s.item;const W=P(),U=await $r(R);U.status||(R=i);const J=lo({title:A,image:R,source:K,isImageValid:U.status,cartUrl:W,...T});r("send-message",J)};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 R="";if(Array.isArray(T)){if(T.length===0)throw new Error("Product IDs array cannot be empty");T.forEach(U=>{if(!U||U<=0)throw new Error("All product IDs must be positive numbers")}),R=T.join(",")}else{if(T<=0)throw new Error("Product ID must be a positive number");R=T.toString()}const K=A+R+"?utm_source=easyai",W=await fetch(K,{method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}});if(!W.ok){const U=await W.text();throw console.log("Error response:",U),new Error(`HTTP error! status: ${W.status} - ${U}`)}await W.text(),d.value=!0,v()}catch(R){console.error("Error adding items to cart:",R)}finally{u.value=!1}}async function w(){var T;try{if(u.value)return;u.value=!0;const A=await bv().addToCart({productId:s.item.product_id,quantity:1,serviceIds:[],giftItems:[],selectedReceiveAtWarehouse:!1});if(A&&A.data){d.value=!0,v();const R=(T=A.data.products)==null?void 0:T.reduce((U,J)=>U+J.quantity,0),K=document.querySelector('a[href="/checkout/cart"] .bg-product-salePrice'),W=document.querySelector("#bottomMobileTab .bg-red.rounded-full");K&&(K.textContent=R||0),W&&(W.textContent=R||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 U=(((s.item.links||{}).variants||[])[0]||{}).rule_id||"",J=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])||"",X=await xv().addToCart({productId:J,ruleId:U,quantity:1});X&&X.success&&(d.value=!0,v())}catch(R){console.error("ViettelStore: Error adding to cart:",R)}finally{u.value=!1}}async function C(){try{if(u.value)return;u.value=!0;const T=await _v().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 R=`${A.product_id}-${A.product_type??0}`,K=new FormData;K.append("action","create"),K.append("item_type","product"),K.append("item_id",R),K.append("props[quantity]",1);const U=await(await fetch("https://www.phucanh.vn/ajax/cart.php",{method:"POST",body:K})).json();if(console.log(U),(U.status==="success"||U.status==="error"&&U.error_type==="item-in-cart")&&(U.status==="error"&&U.error_type==="item-in-cart"&&mn.actions.warning({message:U.message||"Sản phẩm đã tồn tại trong giỏ hàng"}),U.status==="success")){d.value=!0;const J=document.getElementById("count_shopping_cart_store");if(J){const X=parseInt(J.textContent)||0;J.textContent=X+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)&&Xt.ctaClick({type:T,...A})}function I(T,A={}){["product","page"].includes(T)&&Xt.linkClick({type:T,...A})}const M=()=>{const{image:T,image_url:A}=s.item;return T||(Array.isArray(A)&&A[0]?A[0]:(o.value=!0,null))},P=()=>({[_r]:"/checkout/cart?utm_source=easyai&utm_medium=productcard",[ai]:"/cart?utm_source=easyai&utm_medium=productcard",[so]:"/cart?utm_source=easyai&utm_medium=productcard",[wr]:"/gio-hang.html?utm_source=easyai&utm_medium=productcard",[ss]:"/cart?utm_source=easyai&utm_medium=productcard"})[V.handle]||"/cart";return(T,A)=>{var R,K,W,U,J,X,Y,he,ce,ue;return m(),x("div",xz,[l("div",wz,[(m(),oe(Ft(e.item.source?"a":"div"),{href:e.item.source,target:c.value?"_blank":"_self",onClick:A[1]||(A[1]=Te=>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:xe(()=>[M()&&!o.value?(m(),x("img",{key:0,src:M(),alt:e.item.title,class:"object-contain w-full h-full",onError:A[0]||(A[0]=()=>o.value=!0)},null,40,kz)):(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,Sz))]),_:1},8,["href","target"])),l("div",Cz,[(m(),oe(Ft(e.item.source?"a":"div"),{href:e.item.source,target:c.value?"_blank":"_self",onClick:A[2]||(A[2]=Te=>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:xe(()=>[Ge(D(e.item.title),1)]),_:1},8,["href","target"])),!e.item.price&&!e.item.rating&&e.item.description?(m(),x("p",$z,D(e.item.description),1)):z("",!0),l("div",Tz,[l("div",Az,[e.item.texts&&e.item.texts.price?(m(),x("div",Ez,D(e.item.texts.price),1)):e.item.price?(m(),x("div",Iz,D(y(tt)(e.item.price,{currency:e.item.currency})),1)):(m(),x("div",Pz,"Liên hệ"))]),e.item.old_price>0&&e.item.old_price!==e.item.price?(m(),x("del",Mz,D(y(tt)(e.item.old_price,{currency:e.item.currency})),1)):z("",!0)]),Number(e.item.rating)||e.item.review_count?(m(),x("div",Oz,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:mt({"--rating":Number(e.item.rating)})},null,4)):z("",!0),e.item.review_count?(m(),x("div",Lz," ("+D(e.item.review_count)+") ",1)):z("",!0)])):z("",!0)])]),d.value?(m(),x("div",Rz,[l("a",{href:P(),onClick:A[3]||(A[3]=Te=>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(cn),{"stroke-width":"1.5",size:"18",class:"mr-1"}),Ge(" Thanh toán ngay ")],8,Dz)])):(m(),x(be,{key:1},[y(V).handle===y(Ln)||y(V).forms.order&&e.item.price&&y(V).handle!==y(br)&&!(y(V).handle===y(ss)&&(!((R=e.item.links)!=null&&R.purchase_info)||!((W=(K=e.item.links)==null?void 0:K.purchase_info)!=null&&W.purchasable)||!((J=(U=e.item.links)==null?void 0:U.purchase_info)!=null&&J.product_id)))?(m(),x("button",{key:0,onClick:A[4]||(A[4]=Te=>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(nn,{key:0,class:"w-[18px] h-[18px] mr-1"})):(m(),oe(y(cn),{key:1,"stroke-width":"1.5",size:"18",class:"mr-1"})),Ge(" Thêm vào giỏ ")],2)):y(V).handle===y(fi)&&!e.item.price||y(V).handle===y(ss)&&(!((X=e.item.links)!=null&&X.purchase_info)||!((he=(Y=e.item.links)==null?void 0:Y.purchase_info)!=null&&he.purchasable)||!((ue=(ce=e.item.links)==null?void 0:ce.purchase_info)!=null&&ue.product_id))?(m(),x("a",{key:1,href:n[y(V).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(bd),class:"w-[18px] h-[18px] mr-2"},null,8,Nz),Fz],8,jz)):y(br)===y(V).handle?(m(),x("a",{key:2,href:"tel:19002628",onClick:A[5]||(A[5]=Te=>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"}),qz])):z("",!0)],64))])}}}},Symbol.toStringTag,{value:"Module"})),Bz={key:0,class:"flex flex-col p-2 group"},Uz=["href"],Vz=["src","alt"],Hz=["src","alt"],Wz={class:"flex flex-col flex-1 mt-2"},Gz=["href"],Kz={class:"flex flex-wrap items-center mt-1"},Qz={class:"mr-1 text-sm font-semibold text-red-500"},Jz={key:0,class:"text-xs font-light text-gray-500"},Xz={key:0,class:"flex items-center mt-1"},Zz={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},Yz=l("div",null,"Thêm vào giỏ",-1),eB={key:1,class:"flex p-2 border border-gray-200 group"},tB=["href"],nB=["src","alt"],sB=["src","alt"],rB={class:"flex flex-col flex-1 ml-3 min-w-0"},oB=["href"],iB={class:"flex flex-wrap items-center mt-1"},aB={class:"mr-1 text-sm font-semibold text-red-500"},lB={key:0,class:"text-xs font-light text-gray-500"},cB={key:0,class:"flex items-center mt-1"},uB={key:1,class:"text-gray-500 text-xs translate-y-[1px] ml-0.5"},dB=l("div",null,"Thêm vào giỏ",-1),fB=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=L(!1),i=L(!1),a=te(()=>{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&&(V.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=ao(s.item)??{};((h=(f=d.links)==null?void 0:f.variants)==null?void 0:h.length)>0?(Tm.actions.setSelectedProduct({...d,options:((g=d.links)==null?void 0:g.options)??[],variants:((p=d.links)==null?void 0:p.variants)??[]}),Tm.actions.toggleOpenPanelVariants(!0)):c()};return(d,f)=>e.type==="vertical"?(m(),x("div",Bz,[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,Vz)):(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,Hz))],8,Uz),l("div",Wz,[l("a",{href:e.item.source,target:"_self",class:"text-sm font-medium text-gray-900 line-clamp-2 sm:group-hover:text-primary"},D(e.item.title),9,Gz),l("div",Kz,[l("div",Qz,D(y(tt)(e.item.price,{currency:e.item.currency})),1),e.item.old_price>0&&e.item.old_price!==e.item.price?(m(),x("del",Jz,D(y(tt)(e.item.old_price,{currency:e.item.currency})),1)):z("",!0)]),Number(e.item.rating)||e.item.review_count?(m(),x("div",Xz,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:mt({"--rating":Number(e.item.rating)})},null,4)):z("",!0),e.item.review_count?(m(),x("div",Zz," ("+D(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(nn,{key:0,class:"w-[16px] h-[16px] mr-1"})):(m(),oe(y(cn),{key:1,"stroke-width":"1.5",class:"mr-1 size-[16px]"})),Yz])])):(m(),x("div",eB,[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,nB)):(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,sB))],8,tB),l("div",rB,[l("a",{href:e.item.source,target:"_self",class:"text-sm font-medium text-gray-900 line-clamp-2 sm:group-hover:text-primary"},D(e.item.title),9,oB),l("div",iB,[l("div",aB,D(y(tt)(e.item.price,{currency:e.item.currency})),1),e.item.old_price>0&&e.item.old_price!==e.item.price?(m(),x("del",lB,D(y(tt)(e.item.old_price,{currency:e.item.currency})),1)):z("",!0)]),Number(e.item.rating)||e.item.review_count?(m(),x("div",cB,[Number(e.item.rating)?(m(),x("div",{key:0,class:"ecg-stars",style:mt({"--rating":Number(e.item.rating)})},null,4)):z("",!0),e.item.review_count?(m(),x("div",uB," ("+D(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(nn,{key:0,class:"w-[16px] h-[16px] mr-1"})):(m(),oe(y(cn),{key:1,"stroke-width":"1.5",class:"mr-1 size-[16px]"})),dB])])]))}}},Symbol.toStringTag,{value:"Module"})),wv=()=>{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))===Ln},Wn={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 _d=[];const kv=(e,t)=>{const n=e.match(t);return(n==null?void 0:n[2])||null},hB=e=>{const t=e.match(jl.purchase);return(t==null?void 0:t[1])||null},Sv=e=>{for(const[t,n]of Object.entries(jl))if(n.test(e))return t;return"unknown"},pB=e=>{if(!e.includes("?"))return{};const[,t]=e.split("?"),n={};return new URLSearchParams(t).forEach((s,r)=>{n[r]=s}),n},mB=()=>{var e;for(const t of Wn.cartSize){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 Wn.cartTotalPrice){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 Wn.purchaseTotalPrice){const n=document.querySelector(t);if(n)return((e=n.textContent)==null?void 0:e.trim())||"0"}return"0"},yB=()=>{var e;for(const t of Wn.quantityInput){const n=document.querySelector(t);if(n)return((e=n.value)==null?void 0:e.trim())||"1"}return"1"},xo=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""},bB=()=>({name:xo(Wn.purchaseCustomerName),phone:xo(Wn.purchaseCustomerPhone),email:xo(Wn.purchaseCustomerEmail),shipping_address:xo(Wn.purchaseCustomerShippingAddress),delivery_method:xo(Wn.purchaseCustomerDeliveryMethod),payment_gateway:xo(Wn.purchaseCustomerPaymentGateway)}),_B=()=>{_d.forEach(({element:e,event:t,handler:n})=>{e.removeEventListener(t,n)}),_d=[]},xB=(e,t,n,s)=>{const r=yB();qe.addToCart({id:e??"",name:t??"",price:n??"",image:s??"",quantity:r,brand:"Rạng Đông"})},wB=(e,t,n,s)=>{const r=[];if(Wn.addToCart.forEach(i=>{const a=document.querySelectorAll(i);r.push(...a)}),Wn.buyNow.forEach(i=>{const a=document.querySelectorAll(i);r.push(...a)}),r.length===0)return;const o=()=>{xB(e,t,n,s)};r.forEach(i=>{i.addEventListener("click",o),_d.push({element:i,event:"click",handler:o})})},kB=()=>{const e=mB(),t=gB();qe.checkout({cart_size:e,cart_total_price:t})},SB=e=>{const t=hB(e),n=vB(),s=bB();qe.purchase({order_id:t??"",total_value:n??"",customer:s})};ki(e=>{if(!wv())return;switch(Sv(e)){case"search":const{keyword:n}=pB(e);qe.search({search_term:n??""});break;case"purchase":setTimeout(()=>{SB(e)},1500);break}},!0),Em(e=>{_B();const t=()=>{var r;const n=Sv(e),s=rs("Product")||{};switch(n){case"category":const o=kv(e,jl.category);qe.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:kv(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};qe.productView(a),setTimeout(()=>{wB(a.product_id,a.name,a.price,a.image)},1500);break;case"checkout":setTimeout(()=>{kB()},1500);break}};setTimeout(()=>{wv()&&t()},1e3)},!0);const CB=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),$B=(e,t)=>{let n;return(...s)=>{n&&clearTimeout(n),n=setTimeout(()=>{e.apply(null,s)},t)}},TB=()=>window.location.hostname==="m.pico.vn",AB=()=>{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))===_r},EB={cart:/^\/checkout\/cart\/?$/,purchase:/^\/checkout\/confirm\/?$/,login:/^\/login\/?$/,register:/^\/register\/?$/,category:/^\/[a-z0-9-]+\.c\/?$/,product:/^\/[a-z0-9-]+-[A-Z0-9]+$/},Cv={productCard:[".productCardSwp",".itemProducts"],addToCartButton:["#add-to-cart","#buy-now","#installment"]},$v=e=>{if(!e.includes("?"))return{};const t={};return new URLSearchParams(e.split("?")[1]).forEach((n,s)=>{t[s]=n}),t},IB=e=>$v(e).query||null,PB=e=>e.split("/").filter(Boolean).length===1,MB=e=>{const t=new URL(e,window.location.origin).pathname;if(rs("CollectionPage"))return"category";for(const[s,r]of Object.entries(EB))if(r.test(t))return s;return"unknown"},wo=e=>{const t=e==null?void 0:e.match(/([\d.]+(?:\s*đ)?)/i);return t?t[0].trim():null},xd=e=>{const t=e==null?void 0:e.match(/-([A-Z0-9]+)$/);return t?t[1]:null},OB=()=>{var s,r;const e=rs("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}},LB=()=>{setTimeout(()=>qe.categoryView(OB()),1e3)},RB=e=>{const t=new URL(e,window.location.origin).pathname,n=PB(t)?IB(e):null;n&&qe.search({search_term:n})},DB=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=xd(n.href));const s=e.querySelector(".sale-price .text-2xl.font-extrabold.text-red-500, .sale-price p");s&&(t.price=wo(s.textContent));const r=e.querySelector(".originPrice .text-base.text-zinc-500, .originPrice p");return r&&(t.originPrice=wo(r.textContent)),t},jB=()=>{var i,a,c,u,d,f,h,g,p,v,_,w,k,C;const e=rs("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=(C=O.textContent)==null?void 0:C.trim())}}t.product_sku=xd(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=wo(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=wo(O.textContent);break}}return t},NB=()=>{document.addEventListener("click",e=>{for(const t of Cv.productCard){const n=e.target.closest(t);if(n){qe.productSelect(DB(n));break}}})},FB=()=>{setTimeout(()=>qe.productView(jB()),1500)},qB=()=>{document.querySelectorAll(Cv.addToCartButton.join(", ")).forEach(t=>{t.addEventListener("click",()=>{var r,o;const n=rs("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||""};qe.addToCart(s)})})},Tv=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},zB=()=>{const e=Array.from(document.querySelectorAll(".cartItemsContent .cartItem"));if(e.length===0)return"0";const t=e.reduce((n,s)=>n+Tv(s),0);return t>0?t.toString():e.length.toString()},wd=()=>{var n;const e=(n=document.querySelector(".cartTotal span:nth-child(2)"))==null?void 0:n.textContent,t=wo(e);return t||"0"},BB=()=>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=wo(a),u=Tv(t);return{name:o,image:s,price:c,quantity:u}}),UB=()=>{setTimeout(()=>{const e=zB();e!=="0"&&qe.cartView({cart_size:e,cart_total_price:wd()})},1500)},VB=()=>{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=xd((o=n.querySelector("a[href]"))==null?void 0:o.href)}qe.removeFromCart(s)})},HB=()=>{var r;const e=()=>{const o=BB(),i=o.reduce((c,u)=>c+u.quantity,0).toString();qe.checkout({cart_size:i,cart_total_price:wd(),products:o});const a={total_value:wd(),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}}},WB=()=>{var i,a,c,u,d,f,h,g,p;const e={},t=TB(),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},GB=()=>{const e=()=>{const r=WB();Object.keys(r).length>0&&qe.addShippingInfo(r)},t=$B(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))})},KB=()=>{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&&qe.addPaymentInfo(n)};document.querySelectorAll('input[name*="payment"], select[name*="payment"]').forEach(t=>{t.addEventListener("change",e,!0)})},QB=e=>{const t={},n=$v(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 kd=!1;const JB=()=>{if(kd)return;const e=sessionStorage.getItem("pico_checkout");e&&setTimeout(()=>{const t=QB(e);t.order_id&&(qe.purchase(t),kd=!0,setTimeout(()=>kd=!1,6e4),sessionStorage.removeItem("pico_checkout"))},1500)},XB=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}:{}},ZB=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},YB=()=>{const e=document.querySelector("form");e&&e.addEventListener("submit",t=>{const n=XB(e);n.phone&&sessionStorage.setItem("pico_login_data",JSON.stringify(n))},!0)},Av=()=>{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()),qe.login(c),sessionStorage.removeItem("pico_login_data"),e=!0}catch{}}};setTimeout(t,1e3),new MutationObserver(()=>{t()}).observe(document.body,{childList:!0,subtree:!0})},eU=()=>{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);qe.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=ZB(n);(r.phone||r.email)&&sessionStorage.setItem("pico_signup_data",JSON.stringify(r))},!0)},tU=()=>{},nU=()=>{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=rs("Product")||{};qe.generateLead({name:o,phone:i,demand:"Tư vấn sản phẩm "+(a.name||""),url:window.location.href})}};n.addEventListener("submit",s)},2e3)})},sU=e=>{const t=MB(e);switch(RB(e),t){case"category":LB();break;case"product":FB(),setTimeout(()=>{qB(),nU()},1500);break;case"cart":UB(),VB(),setTimeout(()=>{HB(),GB(),KB()},1500);break;case"purchase":JB();break;case"login":setTimeout(YB,500),Av();break;case"register":setTimeout(eU,500);break;default:Av();break}};ki(e=>{AB()&&sU(e)},!0),NB(),setTimeout(tU,1500);const rU=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),oU=(e,t)=>{let n;return(...s)=>{n&&clearTimeout(n),n=setTimeout(()=>{e.apply(null,s)},t)}},iU=()=>{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"},aU={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"]},lU=()=>!!document.querySelector(".product-detail"),cU=()=>!!document.querySelector(".product-category"),uU=()=>!!document.querySelector(".send-cart");let _n=[],Ev=[];const dU=()=>{_n.forEach(({element:e,event:t,handler:n,options:s})=>{e.removeEventListener(t,n,s)}),_n=[],Ev.forEach(e=>{e.disconnect()}),Ev=[]},ko=e=>e?e.replace(/\D/g,""):"",fU=e=>{for(const[t,n]of Object.entries(aU))if(n.test(e))return t;return"unknown"},hU=()=>{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&&qe.search({search_term:s})};e.addEventListener("submit",n),_n.push({element:e,event:"submit",handler:n})},pU=()=>{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:ps()||"",url:window.location.href}},mU=()=>{setTimeout(()=>{const e=pU();e.name&&qe.categoryView(e)},1500)},gU=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?ko(c.textContent):"",d=e.querySelector(".old-price"),f=d?ko(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}},Iv=()=>{document.querySelectorAll(Nl.productCard.join(", ")).forEach(t=>{t.querySelectorAll(".product-img a, .product-title a").forEach(s=>{const r=()=>{const o=gU(t);o.name&&qe.productSelect(o)};s.addEventListener("click",r),_n.push({element:s,event:"click",handler:r})})})},Pv=()=>{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||ps()||"");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")||ko(s.textContent));const r=document.querySelector(".product-detail .main-product-mid .old-price");r&&(e.originalPrice=ko(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=ps()||""),e},vU=()=>{setTimeout(()=>{const e=Pv();e.name&&qe.productView(e)},1500)},yU=()=>{document.querySelectorAll(Nl.addToCartButton.join(", ")).forEach(t=>{const n=()=>{const s=Pv();s.name&&qe.addToCart(s)};t.addEventListener("click",n),_n.push({element:t,event:"click",handler:n})})},Sd=()=>{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}})},Mv=()=>Sd().reduce((n,s)=>n+s.quantity,0).toString(),Ov=()=>{var t,n;const e=((n=(t=document.querySelector(".total-cart-price"))==null?void 0:t.textContent)==null?void 0:n.trim())||"";return ko(e)},bU=()=>{setTimeout(()=>{const e=Mv(),t=Ov(),n=Sd();qe.cartView({cart_size:e,cart_total_price:t,products:n})},1500)},_U=()=>{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);qe.removeFromCart({name:i,url:a,image:u,price:f,quantity:g})}};t.addEventListener("click",n),_n.push({element:t,event:"click",handler:n})})},Lv=()=>{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},xU=()=>{const e=document.getElementById("formCart");if(!e)return;const t=()=>{const a=Lv();Object.keys(a).length>0&&qe.addShippingInfo(a)},n=oU(t,1e3);["#buyer_name","#buyer_tel","#buyer_email","#buyer_address"].forEach(a=>{const c=e.querySelector(a);c&&(c.addEventListener("input",n,!0),_n.push({element:c,event:"input",handler:n,options:!0}))}),e.querySelectorAll('input[name="ship_method"]').forEach(a=>{a.addEventListener("change",t,!0),_n.push({element:a,event:"change",handler:t,options:!0})}),e.querySelectorAll('input[name="location"]').forEach(a=>{a.addEventListener("change",t,!0),_n.push({element:a,event:"change",handler:t,options:!0})}),e.querySelectorAll('input[name="pay_method"]').forEach(a=>{a.addEventListener("change",t,!0),_n.push({element:a,event:"change",handler:t,options:!0})})},wU=()=>{const e=document.getElementById("btn-submit");if(!e)return;const t=()=>{const n=Mv(),s=Ov(),r=Sd(),o=Lv();qe.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),_n.push({element:e,event:"click",handler:t})},kU=()=>{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=ko(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 Cd=!1;const SU=()=>{Cd||setTimeout(()=>{const e=kU();e.order_id&&e.total_value&&(qe.purchase(e),Cd=!0,setTimeout(()=>Cd=!1,6e4),sessionStorage.removeItem("laptop88_checkout"))},1500)},CU=()=>{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("@")&&qe.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),_n.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),_n.push({element:s,event:"submit",handler:r})}},$U=()=>{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&&qe.generateLead({name:i,phone:c,email:a,demand:"Liên hệ",note:u,url:window.location.href})};e.addEventListener("click",t),_n.push({element:e,event:"click",handler:t})},TU=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}},AU=e=>{qe.selectPromotion(TU(e))},EU=()=>{const e=document.querySelectorAll(Nl.promotionBanner.join(", "));e.length!==0&&e.forEach(t=>{const n=()=>{AU(t)};t.addEventListener("click",n),_n.push({element:t,event:"click",handler:n})})};ki(e=>{if(!iU())return;dU();const t=new URL(e,window.location.origin).pathname,n=fU(t);uU()?SU():n==="contact"?setTimeout(()=>{$U()},1500):n==="cart"?(bU(),_U(),setTimeout(()=>{xU(),wU()},1500)):lU()?(vU(),setTimeout(yU,1500)):cU()?(mU(),setTimeout(()=>{Iv()},1500)):setTimeout(()=>{Iv()},1500),setTimeout(()=>{hU(),EU(),CU()},2e3)},!0);const IU=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),PU=(e,t)=>{let n;return(...s)=>{n&&clearTimeout(n),n=setTimeout(()=>{e.apply(null,s)},t)}},MU=()=>{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(/ /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},Tn={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"},$d={cart:/\/gio-hang$/,checkout:/\/thanh-toan$/,purchase:/\/thanh-toan\/order-received\//},Td="noithatgiaphong_checkout",OU=()=>!!Fl("Product"),LU=()=>!!Fl("CollectionPage"),Rv=()=>$d.purchase.test(window.location.pathname),RU=()=>$d.cart.test(window.location.pathname),DU=()=>$d.checkout.test(window.location.pathname)&&!Rv();let Ad=[];const jU=()=>{Ad.forEach(({element:e,event:t,handler:n,options:s})=>{e.removeEventListener(t,n,s)}),Ad=[]},Ps=(e,t,n,s)=>{e.addEventListener(t,n,s),Ad.push({element:e,event:t,handler:n,options:s})},NU=()=>{document.querySelectorAll(Tn.searchForm).forEach(t=>{const n=t.querySelector(Tn.searchInput);if(!n)return;Ps(t,"submit",()=>{var o;const r=(o=n.value)==null?void 0:o.trim();r&&qe.search({search_term:r})})})},FU=()=>{var s;const e=Fl("CollectionPage");if(e!=null&&e.name)return{name:e.name,url:e.url||window.location.href,image:ps()||""};const t=Ts();if(t!=null&&t.title)return{name:t.title,url:window.location.href,image:t.image||ps()||""};const n=document.querySelector("h1");return{name:((s=n==null?void 0:n.textContent)==null?void 0:s.trim())||"",url:window.location.href,image:ps()||""}},qU=()=>{setTimeout(()=>{const e=FU();e.name&&qe.categoryView(e)},1500)},zU=e=>{var d;const t=e.querySelector(Tn.productCardLink),n=((d=t==null?void 0:t.textContent)==null?void 0:d.trim())||"",s=(t==null?void 0:t.href)||"",r=e.querySelector(Tn.productCardImage),o=(r==null?void 0:r.src)||"",i=e.querySelector(Tn.productCardPrice),a=i?Ni(i.textContent):"",c=e.querySelector(Tn.productCardId);return{id:(c==null?void 0:c.getAttribute("data-prod_id"))||"",name:n,url:s,price:a,image:o}},Dv=()=>{document.querySelectorAll(Tn.productCard).forEach(t=>{t.querySelectorAll(".box-image a, "+Tn.productCardLink).forEach(s=>{Ps(s,"click",()=>{const o=zU(t);o.name&&qe.productSelect(o)})})})},jv=()=>{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||ps()||""))}return e.image||(e.image=ps()||""),e},BU=()=>{setTimeout(()=>{const e=jv();e.name&&qe.productView(e)},1500)},UU=()=>{document.querySelectorAll(Tn.addToCartButton).forEach(t=>{Ps(t,"click",()=>{const s=jv(),r=document.querySelector("input.qty");r&&(s.quantity=parseInt(r.value||"1",10)),s.name&&qe.addToCart(s)})})},Nv=()=>{const e=document.querySelectorAll(Tn.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}})},VU=()=>{const e=document.querySelector(".cart-collaterals .woocommerce-Price-amount bdi");return e?Ni(e.textContent):""},HU=()=>{setTimeout(()=>{const e=Nv(),t=e.reduce((s,r)=>s+r.quantity,0).toString(),n=VU();qe.cartView({cart_size:t,cart_total_price:n,products:e})},1500)},WU=()=>{document.querySelectorAll(Tn.removeFromCartButton).forEach(t=>{Ps(t,"click",()=>{var p;const s=t.closest(Tn.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")||"";qe.removeFromCart({id:g,name:o,url:i,image:c,price:d,quantity:h})})})},Ed=()=>{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},GU=()=>{const e=document.querySelector("form.woocommerce-checkout");if(!e)return;const t=()=>{const i=Ed();Object.keys(i).length>0&&qe.addShippingInfo(i)},n=PU(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=Ed();c.payment_gateway&&qe.addPaymentInfo({payment_gateway:c.payment_gateway})},!0)})},KU=()=>{const e=document.querySelector(Tn.checkoutButton);if(!e)return;Ps(e,"click",()=>{const n=Nv(),s=Ed(),r=n.reduce((i,a)=>{const c=parseFloat(a.price.replace(/\./g,""))||0;return i+c*a.quantity},0).toString();qe.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(Td,JSON.stringify(o))})};let Id=!1;const QU=()=>{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),C=k.querySelector(".product-quantity");C&&C.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(Td);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},JU=()=>{Id||setTimeout(()=>{const e=QU();e.order_id&&(qe.purchase(e),Id=!0,setTimeout(()=>Id=!1,6e4),sessionStorage.removeItem(Td))},1500)},XU=()=>{document.querySelectorAll(Tn.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||qe.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=>{MU()&&(jU(),Rv()?JU():RU()?(HU(),setTimeout(()=>{WU()},1500)):DU()?setTimeout(()=>{GU(),KU()},1500):setTimeout(()=>{OU()?(BU(),UU()):(LU()&&qU(),Dv())},1500),setTimeout(()=>{NU(),XU()},2e3))},!0);const ZU=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),YU=(e,t)=>{let n;return(...s)=>{n&&clearTimeout(n),n=setTimeout(()=>{e.apply(null,s)},t)}},eV=()=>{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))===wr},Fv={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 Gn=[],zl=[],Pd=!1;const tV=()=>{Gn.forEach(({element:e,event:t,handler:n,options:s})=>{e.removeEventListener(t,n,s)}),Gn=[],zl.forEach(e=>{e.disconnect()}),zl=[],Pd=!1},Ms=e=>e?e.replace(/\D/g,""):"",nV=e=>{for(const[t,n]of Object.entries(Fv))if(n.test(e))return t;return"unknown"},sV=e=>{const t=new URL(e,window.location.origin);if(!Fv.search.test(t.pathname))return;const n=t.searchParams.get("keyword");n&&qe.search({search_term:n})},rV=()=>{const e=Md();return!!(e&&!e.mpn)},Md=()=>{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},oV=()=>{setTimeout(()=>{const e=Md();e&&!e.mpn&&qe.categoryView({name:e.name||"",url:window.location.href,image:e.image||""})},1500)},iV=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}},Od=()=>{document.querySelectorAll(ql.productCard.join(", ")).forEach(t=>{t.querySelectorAll("a[data-id]").forEach(s=>{const r=()=>{const o=iV(t);o.name&&qe.productSelect(o)};s.addEventListener("click",r),Gn.push({element:s,event:"click",handler:r})})})},qv=()=>{document.querySelectorAll(ql.loadMoreButton.join(", ")).forEach(t=>{const n=()=>{setTimeout(()=>{Od()},2500)};t.addEventListener("click",n),Gn.push({element:t,event:"click",handler:n})})},zv=()=>{var r,o;let e={id:"",sku:"",name:"",url:window.location.href,price:"",originalPrice:"",discount:null,image:"",brand:""};const t=Md();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},aV=()=>{setTimeout(()=>{const e=zv();e.name&&qe.productView(e)},1500)},lV=()=>{document.querySelectorAll(ql.addToCartButton.join(", ")).forEach(t=>{const n=()=>{const s=zv();s.name&&qe.addToCart(s)};t.addEventListener("click",n),Gn.push({element:t,event:"click",handler:n})})},Ld=()=>{const e=document.querySelectorAll(".item-product");return Array.from(e).map(t=>{var k,C;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=_?[(C=_.textContent)==null?void 0:C.trim()]:[];return{name:s,price:g,originalPrice:v,quantity:u,image:a,url:f,attributes:w}})},Bv=()=>document.querySelectorAll(".item-product").length.toString(),Rd=()=>{const e=document.getElementById("totalpayment");if(e){const t=e.getAttribute("data-totalpayment");return t||Ms(e.textContent)}return""},cV=()=>{setTimeout(()=>{const e=Bv(),t=Rd(),n=Ld();qe.cartView({cart_size:e,cart_total_price:t,products:n})},1500)},uV=()=>{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);qe.removeFromCart({name:i,url:h,image:c,price:d,quantity:p})}};t.addEventListener("click",n),Gn.push({element:t,event:"click",handler:n})})},Uv=()=>{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},dV=()=>{const e=document.getElementById("ShopCart");if(!e)return;const t=()=>{const d=Uv();if(Object.keys(d).length>0){qe.addShippingInfo(d);let f={customer:{},products:Ld(),cart_total_price:Rd()};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=YU(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),Gn.push({element:h,event:"input",handler:n,options:!0})})}),e.querySelectorAll('input[name="chkgender"]').forEach(d=>{d.addEventListener("change",t,!0),Gn.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),Gn.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),Gn.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),Gn.push({element:d,event:"click",handler:f,options:!0})})},fV=()=>{const e=document.getElementById("buynow1");if(!e)return;const t=()=>{const n=document.getElementById("agreePolicy");if(!(n!=null&&n.checked))return;const s=Bv(),r=Rd(),o=Ld(),i=Uv();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)),Pd||c.name&&c.phone&&(qe.checkout({cart_size:s,cart_total_price:r,products:o,...c}),Pd=!0)};e.addEventListener("click",t),Gn.push({element:e,event:"click",handler:t})},hV=()=>{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,C,E,O;const c=a.querySelector(".img img"),u=(c==null?void 0:c.src)||"",d=((C=(k=a.querySelector(".text-medium.color-black"))==null?void 0:k.textContent)==null?void 0:C.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 Dd=!1;const pV=()=>{Dd||setTimeout(()=>{const e=hV();e.order_id&&(qe.purchase(e),Dd=!0,setTimeout(()=>Dd=!1,6e4),sessionStorage.removeItem("viettelstore_checkout"))},1500)};ki(e=>{if(!eV())return;tV();const t=new URL(e,window.location.origin).pathname;switch(nV(t)){case"search":sV(e),setTimeout(()=>{Od(),qv()},1500);break;case"product":aV(),setTimeout(lV,1500);break;case"cart":cV(),uV(),setTimeout(()=>{dV(),fV()},1500);break;case"purchase":pV();break;default:rV()&&oV(),setTimeout(()=>{Od(),qv()},1500);break}},!0);const mV=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),gV=(e=>(gn("data-v-08506e2e"),e=e(),vn(),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)),vV={class:"text-xs text-gray-600 ml-2 animate-pulse mt-0.5"},yV={key:0,class:"typing-text"},bV={key:1,class:"typing-text"},_V=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}=tn(),s=t;return Je(()=>{s("start")}),(r,o)=>(m(),x("div",null,[gV,l("div",vV,[e.agent&&e.agent.name?(m(),x("span",yV,D(y(n)("chat.typingWithAgent",{name:e.agent.name})),1)):(m(),x("span",bV,D(y(n)("chat.typing")),1))])]))}},[["__scopeId","data-v-08506e2e"]])},Symbol.toStringTag,{value:"Module"})),xV={},wV={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"},kV=[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 SV(e,t){return m(),x("svg",wV,kV)}const CV=Qe(xV,[["render",SV]]),$V={},TV={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"},AV=[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 EV(e,t){return m(),x("svg",TV,AV)}const IV=Qe($V,[["render",EV]]),PV={key:0,class:"text-center px-4"},MV={class:"mb-3 flex justify-center"},OV={class:"w-12 h-12 bg-red-50 rounded-full flex items-center justify-center"},LV={class:"text-base font-semibold text-gray-900 mb-2"},RV={class:"text-sm text-gray-600 mb-5"},DV={key:1},jV={class:"px-8 pb-4 mb-6 text-center text-gray-500 text-base"},NV={key:0,class:"flex items-center justify-center gap-2 animate-pulse"},FV=l("div",{class:"text-sm"},"Đang nghe ...",-1),qV={key:1,class:"text-gray-900"},zV={class:"flex items-center mx-auto gap-10 max-w-[320px]"},BV={class:"flex flex-col items-center justify-center gap-4"},UV=l("span",{class:"text-sm text-gray-900"},"Xóa",-1),VV={class:"flex flex-col items-center justify-center gap-4"},HV=l("span",{class:"text-sm text-gray-900"},"Gửi tin nhắn",-1),WV=l("span",{class:"text-sm text-gray-900"},"Chỉnh sửa",-1),GV=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}=gd(),g=L(!1),p=Qr("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(C=>setTimeout(C,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,C=>{C&&(g.value=!0)}),Pe(s,async C=>{if(C&&!g.value){if(!d()){g.value=!0;return}f(!0),g.value=!0,await u(),f(!1)}}),Pe(g,C=>{C||(c(),s.value=!1,i())}),(C,E)=>(m(),oe(y(yo),{modal:!1,open:g.value,"onUpdate:open":E[1]||(E[1]=O=>g.value=O),"should-scale-background":!1},{default:xe(()=>[G(y(tr),{to:y(p)},{default:xe(()=>[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(sr),{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:xe(()=>[y(o)&&y(o).type==="error"?(m(),x("div",PV,[l("div",MV,[l("div",OV,[G(y(tk),{class:"w-6 h-6 text-red-500"})])]),l("h3",LV,D(y(o).title),1),l("p",RV,D(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",DV,[l("div",jV,[y(h)?(m(),x("div",qV,D(y(h)),1)):(m(),x("div",NV,[G(y(Hu),{size:"18"}),FV]))]),l("div",zV,[l("div",BV,[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(IV)]),UV]),l("div",VV,[l("button",{onClick:w,class:"bg-blue-500 rounded-full size-[80px] flex items-center justify-center pulse-animation-3"},[G(CV)]),HV]),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(rk),{size:"26",class:"text-gray-900"})]),WV],2)])]))]),_:1})]),_:1},8,["to"])]),_:1},8,["open"]))}}},Symbol.toStringTag,{value:"Module"})),KV=["disabled"],QV=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}=gd(),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(Hu),{key:0,size:"16"})):(m(),oe(y(sg),{key:1,size:"18"}))],10,KV))}},[["__scopeId","data-v-d2852a2c"]])},Symbol.toStringTag,{value:"Module"})),JV={class:"px-4 pb-1 pt-2"},XV={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"},ZV={class:"text-xs font-medium"},YV={class:"text-xs font-medium"},eH={class:"text-xs font-medium"},tH={class:"text-xs font-medium"},nH={__name:"ChatMenu",props:{currentScreen:{type:String,required:!0},menu:{type:Object,default:()=>{}}},emits:["change-screen"],setup(e,{emit:t}){const{t:n}=tn(),s=t,r=o=>{s("change-screen",o)};return(o,i)=>(m(),x("div",JV,[l("div",XV,[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(W2),{size:20}),l("div",ZV,D(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(Y2),{size:20}),l("div",YV,D(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(Ym),{size:20}),l("div",eH,D(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(Gu),{size:20}),l("div",tH,D(y(n)("menu.orders")),1)],2)):z("",!0)])]))}},sH={class:"flex-1 overflow-hidden h-full"},rH={key:0,class:"flex-1 px-4 pb-1"},oH=["innerHTML"],iH=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"ChatContainer",emits:["close-chat"],setup(e){const t=Kt(()=>Promise.resolve().then(()=>fW)),n=Kt(()=>Promise.resolve().then(()=>r7)),s=Kt(()=>Promise.resolve().then(()=>LW)),r=Kt(()=>Promise.resolve().then(()=>XG)),o=L(null),i=te(()=>{var k;return(k=ae.state.bot)==null?void 0:k.config.ui.signature}),a=te(()=>{var k,C;return((C=(k=ae.state.bot)==null?void 0:k.config)==null?void 0:C.page)??{}}),c=te(()=>!a.value||Object.keys(a.value).length===0?!1:Object.values(a.value).some(k=>k&&k.enabled===!0)),u=te(()=>{var k,C,E;return{home:((k=a.value.home)==null?void 0:k.enabled)||!1,help_center:((C=a.value.help_center)==null?void 0:C.enabled)||!1,order_tracking:((E=a.value.order_tracking)==null?void 0:E.enabled)||!1}}),d=te(()=>c.value),f=te(()=>{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=te(()=>{const k=ae.state.chatState.viewTab;return g(k)});Je(()=>{ae.state.chatContainerRef=o.value}),Xn(()=>{ae.state.chatContainerRef=null}),Je(()=>{let k=ae.state.chatState.viewTab;ae.state.chatState.shouldOpenChatScreen?k="conversations":(!k||k==="chat")&&(k=h());const C=g(k);C!==ae.state.chatState.viewTab&&ae.actions.updateChatState({viewTab:C})});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"}),wt(()=>{setTimeout(()=>{const{send:C}=Er();C({message:k})},200)})};return(k,C)=>{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",sH,[(m(),oe(qo,null,[p.value==="home"&&((E=a.value.home)!=null&&E.enabled)?(m(),oe(y(t),{key:0,onCloseChat:C[0]||(C[0]=M=>k.$emit("close-chat")),onSendMessage:w,onSetScreen:C[1]||(C[1]=M=>v(M)),dataHome:a.value.home},null,8,["dataHome"])):z("",!0)],1024)),(m(),oe(qo,null,[p.value==="conversations"?(m(),oe(y(n),{key:0,class:"h-full w-full pb-1",showMenu:d.value,onClose:_},{actions:xe(()=>[l("button",{onClick:C[2]||(C[2]=M=>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(qo,null,[p.value==="helps"&&((O=a.value.help_center)!=null&&O.enabled)?(m(),oe(y(s),{key:0,onClose:_,onCloseChat:C[3]||(C[3]=M=>k.$emit("close-chat")),dataHelpCenter:a.value.help_center},null,8,["dataHelpCenter"])):z("",!0)],1024)),(m(),oe(qo,null,[p.value==="order_tracking"&&((I=a.value.order_tracking)!=null&&I.enabled)?(m(),oe(y(r),{key:0,onClose:_,onCloseChat:C[4]||(C[4]=M=>k.$emit("close-chat"))})):z("",!0)],1024))]),(m(),oe(qo,null,[d.value&&!["conversations"].includes(p.value)?(m(),oe(nH,{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",rH,[l("div",{class:"text-[10px] text-gray-500 font-medium leading-[120%]",innerHTML:i.value},null,8,oH)])):z("",!0),G(ov)],2)],512)}}}},Symbol.toStringTag,{value:"Module"})),aH=ht({top:0,left:0,container:null,title:null,link:null,aiText:{},isLoadingSummary:!1});function lH(e){const t=e.trim();return t.startsWith("#")?"id":t.startsWith(".")?"class":null}const cH=(e,t)=>{const n=lH(t),s=t.slice(1);return n==="class"?e.classList.contains(s):n==="id"?e.id===s:!1};function uH(){const{widgets:e}=Zs(),{container:t,title:n,top:s,left:r,link:o,aiText:i,isLoadingSummary:a}=It(aH),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 M=v.querySelector(I);return M?M.textContent:O},""),C=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:C}},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(cH(v.target,k)){w=v.target;break}if(!w)for(const k of _){const C=k.replaceAll(".w-1/2",""),E=v.target.closest(C);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,C;((_=(v=e.value.product_card_summary)==null?void 0:v.config_enhances)==null?void 0:_.length)>0&&((C=(k=(w=e.value.product_card_summary.config_enhances[0])==null?void 0:w.widgetSettings)==null?void 0:k.selectorProductCards)==null?void 0:C.length)>0,document.addEventListener("mousemove",d),document.addEventListener("scroll",f),window.addEventListener("resize",f)}),Dt(()=>{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=V.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 dH={class:"relative ask-ai-group"},fH={class:"flex items-center bg-white border border-b-[3px] border-gray-200 rounded-lg h-8"},hH={class:"flex justify-center items-center text-gray-900 size-8"},pH={class:"size-[20px] overflow-hidden rounded-full"},mH=["src"],gH=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),vH=["onClick"],yH={class:"flex-1"},bH={class:"flex flex-col px-1 mt-1"},_H={key:0,class:"text-[12px] p-2 rounded-xl bg-blue-50 mt-0.5"},xH={class:"ask-ai-result"},wH={key:1,class:"text-[12px] p-2 rounded-xl bg-blue-50 mt-0.5"},kH=[l("div",{class:"ask-ai-result"},"AI đang xử lý ...",-1)],SH=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}=uH(),a=L(null),c=L([]);let u=L(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]=Qt(()=>{},["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",dH,[l("div",fH,[l("div",hH,[l("div",pH,[l("img",{src:(w=(_=y(V).bot)==null?void 0:_.config)==null?void 0:w.ui.logo,class:"object-cover w-full h-full"},null,8,mH)])]),gH]),l("div",{onMouseover:v[0]||(v[0]=Qt(()=>{},["stop"])),onMousemove:v[1]||(v[1]=Qt(()=>{},["stop"])),class:"ask-ai-quick-replies"},[(m(!0),x(be,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,C)=>(m(),x("div",{key:C,class:"tag-suggestion",onClick:E=>d(k.content)},[l("div",yH,D(k.name),1),G(y(Ir),{size:"12",class:"text-gray-600"})],8,vH))),128)),l("div",bH,[G(Ri,{title:"AI đánh giá"}),y(i)[y(o)]&&c.value.length?(m(),x("div",_H,[l("div",xH,[(m(),x("span",{key:c.value.length},D(c.value.join(" ")),1))])])):(m(),x("div",wH,kH))])],32)])],34)}}}},Symbol.toStringTag,{value:"Module"})),CH={class:"flex items-center gap-1"},$H=["src","alt"],TH={class:"flex-1 truncate text-sm tracking-tight relative text-gray-500"},AH=["innerHTML"],EH=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"ChatBoxNewMessage",emits:["toggle","close"],setup(e,{emit:t}){const n=t,s=te(()=>ae.state.chatState.lastUnreadMessage),r=te(()=>{var c,u;return(u=(c=ae.state.bot)==null?void 0:c.config)==null?void 0:u.ui}),o=te(()=>{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]=Qt(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(bo,{class:"size-3"})]),l("div",CH,[l("img",{src:r.value.logo,alt:r.value.name,class:"size-5 object-cover rounded-full overflow-hidden"},null,8,$H),l("div",TH,D(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,AH)],2)):z("",!0)}}},Symbol.toStringTag,{value:"Module"})),IH="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",PH="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",MH="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==",OH="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",LH="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==",RH="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==",DH={id:"eac-home-screen",class:"relative pt-4 flex flex-col h-full w-full"},jH=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),NH={class:"flex flex-col flex-1 overscroll-none overflow-y-auto px-4 pt-0 pb-2 w-full h-full relative"},FH={class:"p-2 py-8 relative"},qH={key:0,class:"text-[28px] font-semibold text-white whitespace-pre-wrap"},zH={key:1,class:"text-base text-white whitespace-pre-wrap mt-2"},BH={class:"flex-1 space-y-6"},UH={class:"bg-white rounded-2xl border border-gray-200/90 shadow-custom-soft overflow-hidden px-4 py-5"},VH={class:"flex-shrink-0"},HH={class:"relative"},WH=["src","alt"],GH=l("div",{class:"size-3 border-2 border-white bg-green-500 rounded-full absolute bottom-0 right-0"},null,-1),KH={class:"flex-1 min-w-0"},QH={class:"mb-1 flex items-center justify-between"},JH={class:"text-gray-600 text-sm tracking-tight"},XH={class:"flex-shrink-0 size-[18px] bg-red-500 text-white text-[11px] font-semibold rounded-full flex items-center justify-center"},ZH={class:"flex items-center gap-2"},YH={class:"text-base text-gray-900 font-medium line-clamp-2 flex-1"},eW={key:0,class:"space-y-2"},tW=["onClick"],nW={class:"flex-1 text-sm sm:group-hover:font-semibold sm:group-hover:text-primary"},sW={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"},rW={key:1,class:"border border-gray-100 shadow-sm rounded-2xl bg-white overflow-hidden"},oW={class:"py-3 px-4 border-b border-b-gray-100 font-medium"},iW={class:"divide-y divide-gray-100"},aW=["href","target"],lW={class:"size-9 bg-gray-50 rounded-full flex items-center justify-center flex-shrink-0"},cW=["src","alt"],uW={class:"text-left"},dW={class:"text-sm text-gray-900"},fW=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}=tn(),s=e,r=t,{bot:o}=It(ae.state),{messages:i}=Er(),a=te(()=>{var w,k;return((k=(w=o.value)==null?void 0:w.config)==null?void 0:k.ui)||{}}),c=te(()=>{var w,k,C;return((C=(k=(w=o.value)==null?void 0:w.config)==null?void 0:k.quickPrompt)==null?void 0:C.messages)||[]}),u=te(()=>{var w;return(w=s.dataHome)==null?void 0:w.title}),d=te(()=>{var w;return(w=s.dataHome)==null?void 0:w.description}),f=te(()=>{const w=i.value.filter(C=>C.sender_type==="assistant"&&C.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||U2:{messenger:IH,zalo:bd,hotline:og,email:J2,phone:og,youtube:PH,facebook:MH,tiktok:OH,instagram:LH,linkedin:RH}[w]||ng,v=(w,k)=>k?w==="hotline"||w==="phone"?k.startsWith("tel:")?k:`tel:${k}`:w==="email"?k.startsWith("mailto:")?k:`mailto:${k}`:k:"#",_=te(()=>{var k;return(((k=s.dataHome)==null?void 0:k.quick_contact)||[]).filter(C=>C.enabled!==!1).map(C=>({type:C.type,href:v(C.type,C.value),target:C.type==="messenger"||C.type==="zalo"||C.type==="custom"?"_blank":void 0,icon:p(C.type,C.logo_url),title:C.title,subtitle:C.description,subtitleClass:C.type==="hotline"||C.type==="phone"?"text-red-500 font-medium":"text-gray-500"}))});return(w,k)=>(m(),x("div",DH,[jH,l("div",NH,[l("div",FH,[l("button",{onClick:k[0]||(k[0]=C=>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",qH,D(u.value),1)):z("",!0),d.value?(m(),x("div",zH,D(d.value),1)):z("",!0)]),l("div",BH,[l("div",UH,[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]=C=>h())},[l("div",VH,[l("div",HH,[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,WH),GH])]),l("div",KH,[l("div",QH,[l("div",JH,D(a.value.name),1),l("div",XH,D(y(ae).state.chatState.unreadMessageCount||1),1)]),l("div",ZH,[l("p",YH,D(f.value.content),1)])])]),l("button",{onClick:k[2]||(k[2]=C=>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"},[Ge(D(y(n)("home.sendMessage"))+" ",1),G(y(lg),{size:18})])]),c.value.length>0?(m(),x("div",eW,[(m(!0),x(be,null,Me(c.value,(C,E)=>(m(),x("div",{key:E,onClick:O=>g(C.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",nW,D(C.content),1),l("div",sW,[G(y(Qm),{size:"12","stroke-width":"3.5"})])],8,tW))),128))])):z("",!0),_.value.length>0?(m(),x("div",rW,[l("div",oW,D(y(n)("home.quickLinks")),1),l("div",iW,[(m(!0),x(be,null,Me(_.value,(C,E)=>(m(),x("a",{key:E,href:C.href,target:C.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",lW,[typeof C.icon!="string"?(m(),oe(Ft(C.icon),{key:0,size:"22",class:"fill-blue-500 stroke-white stroke-1"})):(m(),x("img",{key:1,src:C.icon,alt:C.title,class:ne(["w-6",["tiktok"].includes(C.type)?"object-cover rounded-full":"object-contain"])},null,10,cW))]),l("div",uW,[l("div",dW,D(C.title),1),l("div",{class:ne(["text-xs",C.subtitleClass])},D(C.subtitle),3)])],8,aW))),128))])])):z("",!0)])])]))}}},Symbol.toStringTag,{value:"Module"})),hW={class:"flex flex-col h-full bg-gray-50"},pW={class:"flex items-center gap-2 p-3 bg-primary relative"},mW=["aria-label"],gW={class:"text-base font-medium text-white"},vW={class:"flex-1 overflow-y-auto p-4"},yW={class:"space-y-6"},bW={key:0},_W={class:"flex items-center gap-2 mb-3 px-1 text-gray-800"},xW={class:"font-semibold"},wW={class:"space-y-2"},kW=["onClick"],SW={class:"overflow-hidden"},CW={class:"px-4 pb-4 pt-0"},$W={class:"text-sm text-gray-600 leading-relaxed whitespace-pre-wrap"},TW={key:1},AW={class:"flex items-center gap-2 mb-3 px-1 text-gray-800"},EW={class:"font-semibold"},IW={class:"space-y-2"},PW=["href"],MW={class:"flex-1 text-sm sm:group-hover:font-semibold sm:group-hover:text-primary"},OW={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"},LW=Object.freeze(Object.defineProperty({__proto__:null,default:Qe({__name:"ChatHelps",props:{dataHelpCenter:{type:Object,default:()=>({})}},emits:["close","close-chat"],setup(e){const{t}=tn(),n=e,s=L(null),r=te(()=>{var d;return((d=n.dataHelpCenter)==null?void 0:d.faqs)||[]}),o=te(()=>{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",hW,[l("div",pW,[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(mo),{size:20})],8,mW),l("h2",gW,D(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",vW,[l("div",yW,[r.value.length>0?(m(),x("div",bW,[l("div",_W,[G(y(Ym),{size:18}),l("h3",xW,D(y(t)("help.faq")),1)]),l("div",wW,[(m(!0),x(be,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"])},D(h.question),3),G(y(po),{size:16,class:ne(["text-gray-500 flex-shrink-0 transition-transform duration-300",{"rotate-180":s.value===g}])},null,8,["class"])],10,kW),G(en,{name:"accordion",onEnter:a,onAfterEnter:c,onLeave:u},{default:xe(()=>[Rt(l("div",SW,[l("div",CW,[l("div",$W,D(h.answer),1)])],512),[[Yo,s.value===g]])]),_:2},1024)]))),128))])])):z("",!0),o.value.length>0?(m(),x("div",TW,[l("div",AW,[G(y(Ys),{size:18}),l("h3",EW,D(y(t)("help.documents")),1)]),l("div",IW,[(m(!0),x(be,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",MW,D(h.title),1),l("div",OW,[G(y(Qm),{size:"12","stroke-width":"3.5"})])],8,PW))),128))])])):z("",!0)])])]))}},[["__scopeId","data-v-6ad2da93"]])},Symbol.toStringTag,{value:"Module"})),RW={class:"flex flex-col h-full bg-gray-50"},DW={class:"flex items-center gap-2 p-3 bg-primary"},jW={class:"text-base font-medium text-white flex-1"},NW={class:"flex-1 overflow-y-auto"},FW={key:0,class:"p-4 space-y-6"},qW={class:"bg-white rounded-2xl border border-gray-200 shadow-sm p-4"},zW={class:"flex items-center gap-2 mb-4 text-gray-800"},BW=l("h3",{class:"text-base font-medium"},"Tra cứu đơn hàng",-1),UW={class:"space-y-3"},VW={class:"relative"},HW=["disabled"],WW={key:1},GW={key:2,class:"flex items-center gap-2"},KW=l("span",{class:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"},null,-1),QW={key:0,class:"bg-red-50 border border-red-200 rounded-xl p-3"},JW={class:"flex items-start gap-2"},XW={class:"text-sm text-red-700"},ZW={key:1,class:"p-4 space-y-4"},YW={class:"bg-white rounded-2xl border border-gray-200 shadow-sm overflow-hidden"},eG={class:"p-4"},tG={class:"flex items-center justify-between mb-2"},nG={class:"flex items-center gap-2"},sG=l("span",{class:"text-sm font-medium text-gray-600"}," Mã đơn hàng: ",-1),rG={class:"font-semibold text-gray-800"},oG={class:"flex items-center justify-between"},iG={class:"text-xs text-gray-500"},aG={key:0,class:"bg-white rounded-2xl border border-gray-200 shadow-sm"},lG=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),cG={class:"py-3 px-4 space-y-2"},uG={key:0,class:"flex space-x-3"},dG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Họ và tên ",-1),fG={class:"text-sm text-gray-700 font-medium"},hG={key:1,class:"flex space-x-3"},pG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Số điện thoại ",-1),mG={class:"text-sm text-gray-700 font-medium"},gG={key:2,class:"flex space-x-3"},vG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Địa chỉ nhận hàng ",-1),yG={class:"text-sm text-gray-700 font-medium"},bG={class:"bg-white rounded-2xl border border-gray-200 shadow-sm"},_G=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),xG={class:"py-3 px-4 space-y-2"},wG={class:"flex space-x-3"},kG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Ngày đặt hàng ",-1),SG={class:"text-sm text-gray-700 font-medium"},CG={class:"flex space-x-3"},$G=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Mã đơn hàng ",-1),TG={class:"text-sm text-gray-700 font-medium"},AG={key:0,class:"flex space-x-3"},EG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Phương thức thanh toán ",-1),IG={class:"text-sm text-gray-700 font-medium"},PG={key:1,class:"flex space-x-3"},MG=l("div",{class:"text-sm text-gray-700 w-[120px] flex-shrink-0"}," Ghi chú ",-1),OG={class:"text-sm text-gray-700 font-medium"},LG=l("div",{class:"font-semibold text-gray-700 mb-3"}," Sản phẩm đã đặt ",-1),RG={class:"space-y-3 mb-4 border-b border-b-gray-200 pb-4"},DG={class:"flex items-center justify-between"},jG=l("div",{class:"text-gray-500 mr-2 text-sm"}," Tổng tiền hàng ",-1),NG={class:"text-right text-base"},FG={class:"text-gray-700 text-sm"},qG={key:0,class:"flex items-center justify-between"},zG=l("div",{class:"text-gray-500 mr-2 text-sm"}," Khuyến mãi ",-1),BG={class:"text-right text-base"},UG={class:"text-green-500 text-sm"},VG={key:1,class:"flex items-center justify-between"},HG=l("div",{class:"text-gray-500 mr-2 text-sm"}," Phí vận chuyển ",-1),WG={class:"text-right text-base"},GG={class:"text-gray-700 text-sm"},KG={class:"flex items-center justify-between mt-2"},QG=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),JG={class:"text-red-500 text-base font-semibold"},XG=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"ChatOrder",emits:["close","close-chat"],setup(e){const t=L(""),n=L(!1),s=L(null),r=L(""),o=L("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",RW,[l("div",DW,[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(mo),{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(mo),{size:20})])),l("h2",jW,D(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",NW,[o.value==="search"?(m(),x("div",FW,[l("div",qW,[l("div",zW,[G(y(Gu),{size:18}),BW]),l("div",UW,[l("div",VW,[Rt(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:mr(i,["enter"])},null,544),[[on,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",GW,[KW,Ge(" Đang tìm kiếm... ")])):(m(),x("span",WW,"Kiểm tra đơn hàng"))],8,HW)])]),r.value?(m(),x("div",QW,[l("div",JW,[G(y(Zm),{size:18,class:"text-red-500 flex-shrink-0 mt-0.5"}),l("div",XW,D(r.value),1)])])):z("",!0)])):o.value==="detail"&&s.value?(m(),x("div",ZW,[l("div",YW,[l("div",eG,[l("div",tG,[l("div",nG,[G(y(Gu),{size:20,class:"text-primary"}),sG,l("span",rG," #"+D(s.value.order_number),1)])]),l("div",oG,[l("div",iG," Ngày đặt: "+D(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)])},D(c(s.value.status)),3)):z("",!0)])])]),s.value.shipping_address?(m(),x("div",aG,[lG,l("div",cG,[s.value.shipping_address.name?(m(),x("div",uG,[dG,l("div",fG,D(s.value.shipping_address.name),1)])):z("",!0),s.value.shipping_address.phone?(m(),x("div",hG,[pG,l("div",mG,D(s.value.shipping_address.phone),1)])):z("",!0),s.value.shipping_address.address1?(m(),x("div",gG,[vG,l("div",yG,D(s.value.shipping_address.address1),1)])):z("",!0)])])):z("",!0),l("div",bG,[_G,l("div",xG,[l("div",wG,[kG,l("div",SG,D(y(ja)(s.value.created_at)),1)]),l("div",CG,[$G,l("div",TG," #"+D(s.value.order_number),1)]),s.value.payment_gateway_names?(m(),x("div",AG,[EG,l("div",IG,D(s.value.payment_gateway_names),1)])):z("",!0),s.value.note?(m(),x("div",PG,[MG,l("div",OG,D(s.value.note),1)])):z("",!0)])]),l("div",null,[LG,l("div",RG,[(m(!0),x(be,null,Me(s.value.items,h=>(m(),oe(Ll,{key:h.sku,item:h},null,8,["item"]))),128))]),l("div",null,[l("div",DG,[jG,l("div",NG,[l("div",FG,D(y(tt)(s.value.subtotal_price)),1)])]),s.value.total_discounts?(m(),x("div",qG,[zG,l("div",BG,[l("div",UG,D(y(tt)(s.value.total_discounts)),1)])])):z("",!0),s.value.shipping_price?(m(),x("div",VG,[HG,l("div",WG,[l("div",GG,D(y(tt)(s.value.shipping_price)),1)])])):z("",!0),l("div",KG,[QG,l("div",JG,D(y(tt)(s.value.total_price)),1)])])])])):z("",!0)])]))}}},Symbol.toStringTag,{value:"Module"}))});
|