signalbird 2.1.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -94,7 +94,7 @@ değil, kasıtlı bir duvardır — anahtar bir kez istemciye indiğinde herkesi
94
94
  | Go | `go get github.com/Pariette-Inc/signalbird.sdk` |
95
95
  | .NET, ASP.NET Core | `dotnet add package Signalbird.Sdk` |
96
96
  | Swift (iOS, macOS) | SPM: `https://github.com/Pariette-Inc/signalbird.sdk` |
97
- | Kotlin (Android) | `implementation("io.signalbird:signalbird-sdk:2.1.1")` |
97
+ | Kotlin (Android) | `implementation("io.signalbird:signalbird-sdk:2.3.0")` |
98
98
  | Canlı sohbet widget'ı (herhangi bir site) | `<script async src="https://signalbird.io/sdk/v1/signalbird.js" data-key="sb_public_live_…" data-channel="destek"></script>` |
99
99
 
100
100
  > Hepsi **bu repodan** çıkar ve **aynı sürümü** taşır — ayrı SDK reposu ya da
@@ -1,278 +1,490 @@
1
- var Signalbird=(function(exports){'use strict';var _=class{constructor(e,t,i,n,r){this.baseUrl=e;this.publicKey=t;this.chatKey=i;this.secret=n;this.log=r;}get(e,t){return this.request("GET",e+ge(t))}post(e,t,i=false){return this.request("POST",e,t,i)}patch(e,t){return this.request("PATCH",e,t)}delete(e){return this.request("DELETE",e)}upload(e,t){let i=new FormData;return i.append("file",t,t.name),this.request("POST",e,i)}async request(e,t,i,n=false){let r={Accept:"application/json","X-Signalbird-Key":this.publicKey,...this.chatKey?{"X-Signalbird-Module-Key":this.chatKey}:{}},o=this.secret();o&&(r["X-Signalbird-Visitor"]=o);let l;i instanceof FormData?l=i:i!==void 0&&(r["Content-Type"]="application/json",l=JSON.stringify(i));let d=0,h=null;try{let f=await fetch(this.baseUrl+t,{method:e,headers:r,body:l,keepalive:n});d=f.status;let c=await f.text();try{h=c?JSON.parse(c):null;}catch(u){h=c;}if(f.ok)return {ok:!0,status:d,data:h}}catch(f){return this.log("network",e,t,f),{ok:false,status:0,code:"NETWORK_ERROR",message:String(f)}}let g=h&&h.code||`HTTP_${d}`,p=h&&h.message||`HTTP ${d}`;return this.log("error",e,t,g,p),{ok:false,status:d,code:g,message:p,data:h}}};function ge(s){if(!s)return "";let e=new URLSearchParams;for(let i in s){let n=s[i];n!=null&&n!==""&&e.set(i,String(n));}let t=e.toString();return t?`?${t}`:""}var V="sb_visitor",z=class{constructor(e){this.publicKey=e;this.visitor=null;this.conversation=null;this.messages=[];this.agent=null;this.agentTyping=false;this.online=false;this.withinHours=true;this.unread=0;this.isOpen=false;this.rated=new Set;this.listeners={};this.visitor=this.readVisitor();}on(e,t){var i;return ((i=this.listeners)[e]||(i[e]=[])).push(t),()=>this.off(e,t)}off(e,t){let i=this.listeners[e];i&&(this.listeners[e]=i.filter(n=>n!==t));}emit(e,t){for(let i of this.listeners[e]||[])try{i(t);}catch(n){}}readVisitor(){try{let e=localStorage.getItem(V);if(!e)return null;let t=JSON.parse(e);return !t||!t.secret||t.publicKey!==this.publicKey?null:t}catch(e){return null}}setVisitor(e){var i,n,r,o,l,d,h;let t=e.secret||((i=this.visitor)==null?void 0:i.secret);if(t){this.visitor={id:e.id,secret:t,publicKey:this.publicKey,name:(o=(r=e.name)!=null?r:(n=this.visitor)==null?void 0:n.name)!=null?o:null,email:(h=(d=e.email)!=null?d:(l=this.visitor)==null?void 0:l.email)!=null?h:null};try{localStorage.setItem(V,JSON.stringify(this.visitor));}catch(g){}}}clearVisitor(){this.visitor=null,this.conversation=null,this.messages=[],this.setUnread(0);try{localStorage.removeItem(V);}catch(e){}this.emit("change");}get secret(){var e,t;return (t=(e=this.visitor)==null?void 0:e.secret)!=null?t:null}setConversation(e){var i;let t=(e==null?void 0:e.id)!==((i=this.conversation)==null?void 0:i.id);this.conversation=e,t&&(this.messages=[]),this.emit("change");}mergeMessages(e,t=false){let i=0,n=new Map,r=new Map;for(let l of this.messages)n.set(l.id,l),l.client_id&&r.set(l.client_id,l);let o=t?this.messages.filter(l=>l._pending||l._failed):[...this.messages];for(let l of e){let d=n.get(l.id)||(l.client_id?r.get(l.client_id):void 0);if(d){let h=o.indexOf(d),g={...d,...l,_pending:false,_failed:false,_files:void 0};h>=0?o[h]=g:o.push(g),n.set(l.id,g);}else o.push(l),n.set(l.id,l),l.sender_type==="agent"&&i++;}return o.sort((l,d)=>q(l).localeCompare(q(d))),this.messages=o,this.emit("messages"),i}upsertMessage(e){this.mergeMessages([e]);}removeMessage(e){this.messages=this.messages.filter(t=>t.id!==e),this.emit("messages");}find(e){return e?this.messages.find(t=>t.id===e):void 0}get lastServerMessageId(){for(let e=this.messages.length-1;e>=0;e--){let t=this.messages[e];if(!t._pending&&!t._failed&&!t.id.startsWith("local_"))return t.id}return null}setUnread(e){let t=Math.max(0,e|0);t!==this.unread&&(this.unread=t,this.emit("unread",t));}get dismissed(){return X(this.dismissKey)==="1"}setDismissed(e){try{e?localStorage.setItem(this.dismissKey,"1"):localStorage.removeItem(this.dismissKey);}catch(t){}}get dismissKey(){return `sb_dismissed_${this.publicKey}`}wasRated(e){return this.rated.has(e)||X(`sb_rated_${e}`)==="1"}markRated(e){this.rated.add(e);try{localStorage.setItem(`sb_rated_${e}`,"1");}catch(t){}}};function q(s){return s.created_at||""}function X(s){try{return localStorage.getItem(s)}catch(e){return null}}var D=[2e4,2e4,2e4,6e4,6e4,18e4],J=3e3,fe=45e3,me=3e5,A=class{constructor(e){this.tick=e;this.timer=null;this.step=0;this.open=false;this.live=false;this.running=false;this.stopped=true;this.onVisible=this.onVisible.bind(this);}start(){this.stopped=false,document.addEventListener("visibilitychange",this.onVisible),window.addEventListener("online",this.onVisible),this.schedule(0);}stop(){this.stopped=true,this.timer&&clearTimeout(this.timer),this.timer=null,document.removeEventListener("visibilitychange",this.onVisible),window.removeEventListener("online",this.onVisible);}setOpen(e){this.open=e,this.step=0,this.schedule(e?0:J);}poke(e=0){this.step=0,this.schedule(e);}onVisible(){document.hidden||(this.step=0,this.schedule(0));}setLive(e){this.live!==e&&(this.live=e,this.step=0,this.schedule());}interval(){return this.live?this.open?fe:me:this.open?J:D[Math.min(this.step,D.length-1)]}schedule(e=this.interval()){this.stopped||(this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.run();},e));}async run(){if(this.stopped||this.running)return;if(document.hidden||typeof navigator!="undefined"&&navigator.onLine===false){this.schedule();return}this.running=true;let e=false;try{e=await this.tick()===!0;}catch(t){}finally{this.running=false;}e?this.step=0:this.open||(this.step=Math.min(this.step+1,D.length-1)),this.schedule();}};var Z=[1e3,2e3,5e3,1e4,3e4],R=class{constructor(e,t,i,n,r=()=>{}){this.config=e;this.auth=t;this.onEvent=i;this.onState=n;this.log=r;this.ws=null;this.sid=null;this.attempt=0;this.closed=false;this.timer=null;this.pending=new Set;this.joined=new Set;}get connected(){var e;return ((e=this.ws)==null?void 0:e.readyState)===WebSocket.OPEN&&this.sid!==null}connect(){if(!this.config.enabled||!this.config.url||typeof WebSocket=="undefined"||this.ws)return;this.closed=false;let t=`${this.config.url.replace(/^http/,"ws").replace(/\/$/,"")}/socket.io/?EIO=4&transport=websocket`;try{this.ws=new WebSocket(t);}catch(i){this.log("socket open failed",i),this.retry();return}this.ws.onmessage=i=>this.handle(String(i.data)),this.ws.onclose=()=>this.retry(),this.ws.onerror=()=>{this.log("socket error");};}subscribe(e){this.joined.has(e)||this.pending.has(e)||(this.pending.add(e),this.connected&&this.flush());}close(){var e;this.closed=true,this.timer&&clearTimeout(this.timer),this.timer=null,this.joined.clear();try{(e=this.ws)==null||e.close();}catch(t){}this.ws=null,this.sid=null;}handle(e){let t=e[0];if(t==="0"){this.send("40");return}if(t==="2"){this.send("3");return}if(t!=="4")return;let i=e[1],n=e.slice(2);if(i==="0"){try{this.sid=String(JSON.parse(n||"{}").sid||"");}catch(r){this.sid="";}this.attempt=0,this.onState(true),this.flush();return}if(i==="2"){let r;try{r=JSON.parse(n);}catch(d){return}if(!Array.isArray(r))return;let[o,l]=r;typeof o=="string"&&o.startsWith("chat.")&&this.onEvent({name:o,data:l!=null?l:{}});}}async flush(){let e=this.sid;if(e)for(let t of Array.from(this.pending))try{let i=await this.auth(e,t);if(!i){this.pending.delete(t);continue}this.emit("subscribe",{channel:t,auth:i.auth,at:i.at}),this.pending.delete(t),this.joined.add(t);}catch(i){this.log("subscribe failed",t,i);}}emit(e,t){this.send(`42${JSON.stringify([e,t])}`);}send(e){var t;if(((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN)try{this.ws.send(e);}catch(i){}}retry(){if(this.ws=null,this.sid=null,this.joined.forEach(t=>this.pending.add(t)),this.joined.clear(),this.onState(false),this.closed)return;let e=Z[Math.min(this.attempt,Z.length-1)];this.attempt++,this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>this.connect(),e);}};var Q=`
1
+ var Signalbird=(function(exports){'use strict';var j=class{constructor(e,t,i,n,r){this.baseUrl=e;this.publicKey=t;this.chatKey=i;this.secret=n;this.log=r;}get(e,t){return this.request("GET",e+Me(t))}post(e,t,i=false){return this.request("POST",e,t,i)}patch(e,t){return this.request("PATCH",e,t)}delete(e){return this.request("DELETE",e)}upload(e,t){let i=new FormData;return i.append("file",t,t.name),this.request("POST",e,i)}async request(e,t,i,n=false){let r={Accept:"application/json","X-Signalbird-Key":this.publicKey,...this.chatKey?{"X-Signalbird-Module-Key":this.chatKey}:{}},o=this.secret();o&&(r["X-Signalbird-Visitor"]=o);let l;i instanceof FormData?l=i:i!==void 0&&(r["Content-Type"]="application/json",l=JSON.stringify(i));let d=0,c=null;try{let u=await fetch(this.baseUrl+t,{method:e,headers:r,body:l,keepalive:n});d=u.status;let m=await u.text();try{c=m?JSON.parse(m):null;}catch(f){c=m;}if(u.ok)return {ok:!0,status:d,data:c}}catch(u){return this.log("network",e,t,u),{ok:false,status:0,code:"NETWORK_ERROR",message:String(u)}}let h=c&&c.code||`HTTP_${d}`,p=c&&c.message||`HTTP ${d}`;return this.log("error",e,t,h,p),{ok:false,status:d,code:h,message:p,data:c}}};function Me(s){if(!s)return "";let e=new URLSearchParams;for(let i in s){let n=s[i];n!=null&&n!==""&&e.set(i,String(n));}let t=e.toString();return t?`?${t}`:""}var q="sb_visitor",N=class{constructor(e){this.publicKey=e;this.visitor=null;this.conversation=null;this.messages=[];this.agent=null;this.agentTyping=false;this.online=false;this.withinHours=true;this.unread=0;this.isOpen=false;this.rated=new Set;this.listeners={};this.visitor=this.readVisitor();}on(e,t){var i;return ((i=this.listeners)[e]||(i[e]=[])).push(t),()=>this.off(e,t)}off(e,t){let i=this.listeners[e];i&&(this.listeners[e]=i.filter(n=>n!==t));}emit(e,t){for(let i of this.listeners[e]||[])try{i(t);}catch(n){}}readVisitor(){try{let e=localStorage.getItem(q);if(!e)return null;let t=JSON.parse(e);return !t||!t.secret||t.publicKey!==this.publicKey?null:t}catch(e){return null}}setVisitor(e){var i,n,r,o,l,d,c;let t=e.secret||((i=this.visitor)==null?void 0:i.secret);if(t){this.visitor={id:e.id,secret:t,publicKey:this.publicKey,name:(o=(r=e.name)!=null?r:(n=this.visitor)==null?void 0:n.name)!=null?o:null,email:(c=(d=e.email)!=null?d:(l=this.visitor)==null?void 0:l.email)!=null?c:null};try{localStorage.setItem(q,JSON.stringify(this.visitor));}catch(h){}}}clearVisitor(){this.visitor=null,this.conversation=null,this.messages=[],this.setUnread(0);try{localStorage.removeItem(q);}catch(e){}this.emit("change");}get secret(){var e,t;return (t=(e=this.visitor)==null?void 0:e.secret)!=null?t:null}setConversation(e){var i;let t=(e==null?void 0:e.id)!==((i=this.conversation)==null?void 0:i.id);this.conversation=e,t&&(this.messages=[]),this.emit("change");}mergeMessages(e,t=false){let i=0,n=new Map,r=new Map;for(let l of this.messages)n.set(l.id,l),l.client_id&&r.set(l.client_id,l);let o=t?this.messages.filter(l=>l._pending||l._failed):[...this.messages];for(let l of e){let d=n.get(l.id)||(l.client_id?r.get(l.client_id):void 0);if(d){let c=o.indexOf(d),h={...d,...l,_pending:false,_failed:false,_files:void 0};c>=0?o[c]=h:o.push(h),n.set(l.id,h);}else o.push(l),n.set(l.id,l),l.sender_type==="agent"&&i++;}return o.sort((l,d)=>ie(l).localeCompare(ie(d))),this.messages=o,this.emit("messages"),i}upsertMessage(e){this.mergeMessages([e]);}removeMessage(e){this.messages=this.messages.filter(t=>t.id!==e),this.emit("messages");}find(e){return e?this.messages.find(t=>t.id===e):void 0}get lastServerMessageId(){for(let e=this.messages.length-1;e>=0;e--){let t=this.messages[e];if(!t._pending&&!t._failed&&!t.id.startsWith("local_"))return t.id}return null}setUnread(e){let t=Math.max(0,e|0);t!==this.unread&&(this.unread=t,this.emit("unread",t));}get dismissed(){return se(this.dismissKey)==="1"}setDismissed(e){try{e?localStorage.setItem(this.dismissKey,"1"):localStorage.removeItem(this.dismissKey);}catch(t){}}get dismissKey(){return `sb_dismissed_${this.publicKey}`}wasRated(e){return this.rated.has(e)||se(`sb_rated_${e}`)==="1"}markRated(e){this.rated.add(e);try{localStorage.setItem(`sb_rated_${e}`,"1");}catch(t){}}};function ie(s){return s.created_at||""}function se(s){try{return localStorage.getItem(s)}catch(e){return null}}var G=[2e4,2e4,2e4,6e4,6e4,18e4],ne=3e3,Ce=45e3,Se=3e5,H=class{constructor(e){this.tick=e;this.timer=null;this.step=0;this.open=false;this.live=false;this.running=false;this.stopped=true;this.onVisible=this.onVisible.bind(this);}start(){this.stopped=false,document.addEventListener("visibilitychange",this.onVisible),window.addEventListener("online",this.onVisible),this.schedule(0);}stop(){this.stopped=true,this.timer&&clearTimeout(this.timer),this.timer=null,document.removeEventListener("visibilitychange",this.onVisible),window.removeEventListener("online",this.onVisible);}setOpen(e){this.open=e,this.step=0,this.schedule(e?0:ne);}poke(e=0){this.step=0,this.schedule(e);}onVisible(){document.hidden||(this.step=0,this.schedule(0));}setLive(e){this.live!==e&&(this.live=e,this.step=0,this.schedule());}interval(){return this.live?this.open?Ce:Se:this.open?ne:G[Math.min(this.step,G.length-1)]}schedule(e=this.interval()){this.stopped||(this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.run();},e));}async run(){if(this.stopped||this.running)return;if(document.hidden||typeof navigator!="undefined"&&navigator.onLine===false){this.schedule();return}this.running=true;let e=false;try{e=await this.tick()===!0;}catch(t){}finally{this.running=false;}e?this.step=0:this.open||(this.step=Math.min(this.step+1,G.length-1)),this.schedule();}};var re=[1e3,2e3,5e3,1e4,3e4],I=class{constructor(e,t,i,n,r=()=>{}){this.config=e;this.auth=t;this.onEvent=i;this.onState=n;this.log=r;this.ws=null;this.sid=null;this.attempt=0;this.closed=false;this.timer=null;this.pending=new Set;this.joined=new Set;}get connected(){var e;return ((e=this.ws)==null?void 0:e.readyState)===WebSocket.OPEN&&this.sid!==null}connect(){if(!this.config.enabled||!this.config.url||typeof WebSocket=="undefined"||this.ws)return;this.closed=false;let t=`${this.config.url.replace(/^http/,"ws").replace(/\/$/,"")}/socket.io/?EIO=4&transport=websocket`;try{this.ws=new WebSocket(t);}catch(i){this.log("socket open failed",i),this.retry();return}this.ws.onmessage=i=>this.handle(String(i.data)),this.ws.onclose=()=>this.retry(),this.ws.onerror=()=>{this.log("socket error");};}subscribe(e){this.joined.has(e)||this.pending.has(e)||(this.pending.add(e),this.connected&&this.flush());}close(){var e;this.closed=true,this.timer&&clearTimeout(this.timer),this.timer=null,this.joined.clear();try{(e=this.ws)==null||e.close();}catch(t){}this.ws=null,this.sid=null;}handle(e){let t=e[0];if(t==="0"){this.send("40");return}if(t==="2"){this.send("3");return}if(t!=="4")return;let i=e[1],n=e.slice(2);if(i==="0"){try{this.sid=String(JSON.parse(n||"{}").sid||"");}catch(r){this.sid="";}this.attempt=0,this.onState(true),this.flush();return}if(i==="2"){let r;try{r=JSON.parse(n);}catch(d){return}if(!Array.isArray(r))return;let[o,l]=r;typeof o=="string"&&o.startsWith("chat.")&&this.onEvent({name:o,data:l!=null?l:{}});}}async flush(){let e=this.sid;if(e)for(let t of Array.from(this.pending))try{let i=await this.auth(e,t);if(!i){this.pending.delete(t);continue}this.emit("subscribe",{channel:t,auth:i.auth,at:i.at}),this.pending.delete(t),this.joined.add(t);}catch(i){this.log("subscribe failed",t,i);}}emit(e,t){this.send(`42${JSON.stringify([e,t])}`);}send(e){var t;if(((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN)try{this.ws.send(e);}catch(i){}}retry(){if(this.ws=null,this.sid=null,this.joined.forEach(t=>this.pending.add(t)),this.joined.clear(),this.onState(false),this.closed)return;let e=re[Math.min(this.attempt,re.length-1)];this.attempt++,this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>this.connect(),e);}};var ae=`
2
2
  :host{all:initial}
3
3
  *,*::before,*::after{box-sizing:border-box}
4
4
 
5
5
  .sb{
6
- /* Marka \u2014 tek de\u011Fi\u015Fken, d\u0131\u015Far\u0131dan gelir */
7
- --sb-c:#111827;--sb-fg:#fff;
6
+ /* \u2500\u2500 Marka: tek de\u011Fi\u015Fken gelir, palet buradan t\xFCrer \u2500\u2500 */
7
+ --sb-c:#4f46e5;--sb-fg:#fff;
8
+ --sb-grad:linear-gradient(145deg,color-mix(in srgb,var(--sb-c) 82%,#fff) 0%,var(--sb-c) 48%,color-mix(in srgb,var(--sb-c) 86%,#000) 100%);
9
+ --sb-ring:color-mix(in srgb,var(--sb-c) 28%,transparent);
10
+ --sb-tint:color-mix(in srgb,var(--sb-c) 8%,transparent);
11
+ --sb-edge:color-mix(in srgb,var(--sb-c) 55%,var(--sb-b));
8
12
 
9
- /* N\xF6trler: so\u011Fuk e\u011Fimli, saf gri de\u011Fil */
10
- --sb-bg:#fff;--sb-t:#14171f;--sb-m:#697084;--sb-b:#e6e8ec;--sb-s:#f5f6f8;--sb-s2:#eef0f4;
11
- --sb-sh:0 1px 2px rgba(16,20,30,.06),0 12px 32px -8px rgba(16,20,30,.18),0 32px 64px -24px rgba(16,20,30,.22);
12
- --sb-r:16px;--sb-rb:14px;
13
+ /* \u2500\u2500 N\xF6trler: so\u011Fuk e\u011Fimli. Saf gri ekranda \xF6l\xFCd\xFCr. \u2500\u2500 */
14
+ --sb-bg:#fbfbfd;--sb-el:#fff;--sb-t:#12151d;--sb-m:#6b7385;--sb-b:#e4e7ee;
15
+ --sb-s:#f1f3f7;--sb-s2:#e8ebf1;
13
16
 
14
- /* Ziyaret\xE7inin ta\u015F\u0131d\u0131\u011F\u0131 miktar; s\xFCr\xFCklenmediyse 0 */
15
- --sb-dx:0px;--sb-dy:0px;
17
+ /* \u2500\u2500 G\xF6lge: temas + yay\u0131lma + derinlik \u2500\u2500 */
18
+ --sb-sh:0 1px 1px rgba(16,20,30,.04),0 8px 24px -6px rgba(16,20,30,.14),0 32px 64px -24px rgba(16,20,30,.26);
19
+ --sb-sh-s:0 1px 2px rgba(16,20,30,.06),0 6px 18px -6px rgba(16,20,30,.16);
16
20
 
17
- position:fixed;bottom:20px;z-index:2147483000;
21
+ --sb-r:22px;--sb-rb:18px;
22
+ --sb-spring:cubic-bezier(.22,1.12,.36,1);
23
+ --sb-kb:0px; /* mobil klavye y\xFCksekli\u011Fi \u2014 visualViewport verir */
24
+ --sb-dx:0px;--sb-dy:0px; /* ziyaret\xE7inin ta\u015F\u0131d\u0131\u011F\u0131 miktar */
25
+
26
+ position:fixed;bottom:max(20px,env(safe-area-inset-bottom));z-index:2147483000;
18
27
  font:400 14px/1.5 ui-sans-serif,system-ui,-apple-system,"SF Pro Text","Segoe UI Variable Text","Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
19
- font-feature-settings:"cv11","ss01";
28
+ font-feature-settings:"cv11","ss01";font-variant-ligatures:common-ligatures;
20
29
  color:var(--sb-t);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;
21
30
  direction:ltr;text-align:left;
22
31
  }
23
- .sb.right{right:20px}.sb.left{left:20px}
32
+ .sb.right{right:max(20px,env(safe-area-inset-right))}
33
+ .sb.left{left:max(20px,env(safe-area-inset-left))}
24
34
 
25
35
  .sb.dark{
26
- --sb-bg:#15171d;--sb-t:#eceef3;--sb-m:#9aa1b2;--sb-b:#2b2f3a;--sb-s:#1f222b;--sb-s2:#262a35;
27
- --sb-sh:0 1px 2px rgba(0,0,0,.4),0 16px 40px -8px rgba(0,0,0,.55),0 40px 72px -28px rgba(0,0,0,.6);
36
+ --sb-bg:#101319;--sb-el:#171b23;--sb-t:#e9ecf3;--sb-m:#98a0b2;--sb-b:#272c37;
37
+ --sb-s:#1c212a;--sb-s2:#242a35;
38
+ --sb-tint:color-mix(in srgb,var(--sb-c) 16%,transparent);
39
+ --sb-sh:0 1px 1px rgba(0,0,0,.5),0 12px 32px -8px rgba(0,0,0,.6),0 40px 80px -28px rgba(0,0,0,.7);
40
+ --sb-sh-s:0 2px 8px rgba(0,0,0,.4),0 10px 24px -8px rgba(0,0,0,.5);
28
41
  }
29
42
 
30
43
  button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer;-webkit-tap-highlight-color:transparent}
31
- button:disabled{cursor:default;opacity:.45}
32
- input,textarea{font:inherit;color:inherit}
33
- svg{display:block}
44
+ button:disabled{cursor:default}
45
+ input,textarea,select{font:inherit;color:inherit}
46
+ svg{display:block;flex:none}
34
47
  a{color:inherit}
35
- :focus-visible{outline:2px solid var(--sb-c);outline-offset:2px}
36
-
37
- /* \u2500\u2500 Balon \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
38
- .ln{position:relative;display:flex;align-items:center;gap:9px;height:56px;min-width:56px;padding:0 20px 0 17px;border-radius:28px;
39
- background:var(--sb-c);color:var(--sb-fg);
40
- box-shadow:0 2px 6px rgba(16,20,30,.14),0 10px 28px -6px rgba(16,20,30,.32);
41
- transition:transform .18s cubic-bezier(.2,.7,.3,1),box-shadow .18s}
42
- .ln:hover{transform:translateY(-2px);box-shadow:0 4px 10px rgba(16,20,30,.16),0 16px 36px -8px rgba(16,20,30,.38)}
43
- .ln:active{transform:translateY(0)}
44
- .ln.icon-only{padding:0;justify-content:center;width:56px}
45
- .ln .lt{font-weight:600;font-size:14.5px;letter-spacing:-.01em;white-space:nowrap}
46
- .ln .lg{width:30px;height:30px;border-radius:50%;object-fit:cover;display:block}
47
- .badge{position:absolute;top:-3px;right:-3px;min-width:21px;height:21px;padding:0 6px;border-radius:11px;background:#ef4444;color:#fff;
48
- font-size:11px;font-weight:700;font-variant-numeric:tabular-nums;display:flex;align-items:center;justify-content:center;
49
- border:2px solid var(--sb-bg);box-shadow:0 2px 6px rgba(239,68,68,.4)}
50
-
51
- /* Yeni mesaj dikkat \xE7ekmesi: balon iki kez yaylan\u0131r ve etraf\u0131nda bir halka
52
- da\u011F\u0131l\u0131r. Rozet k\xFC\xE7\xFCk, ses ise taray\u0131c\u0131 etkile\u015Fim bekledi\u011Fi i\xE7in \xE7o\u011Fu zaman
53
- hi\xE7 \xE7alm\u0131yor - sessiz sekmede g\xF6r\xFClen tek sinyal hareket.
54
- Hareketi kapatan kullan\u0131c\u0131da animasyon H\u0130\xC7 \xE7al\u0131\u015Fmaz; rozet ve ses kal\u0131r. */
55
- @keyframes sb-attn{0%,100%{transform:scale(1)}15%{transform:scale(1.16)}30%{transform:scale(.96)}
56
- 45%{transform:scale(1.10)}60%{transform:scale(1)}}
57
- @keyframes sb-attn-ring{0%{box-shadow:0 0 0 0 rgba(99,102,241,.45)}100%{box-shadow:0 0 0 18px rgba(99,102,241,0)}}
58
- .sb-attn{animation:sb-attn 1.2s ease-in-out 2}
59
- .sb-attn::after{content:'';position:absolute;inset:0;border-radius:inherit;pointer-events:none;
60
- animation:sb-attn-ring 1.2s ease-out 2}
61
- @media (prefers-reduced-motion:reduce){.sb-attn,.sb-attn::after{animation:none}}
62
-
63
- .sb.open .ln{display:none}
64
-
65
- /* Balonu kapatma \u2014 balonun d\u0131\u015F\u0131nda, \xFCst k\xF6\u015Fede. Masa\xFCst\xFCnde yaln\u0131z hover'da:
66
- s\xFCrekli duran bir \xE7arp\u0131, sohbete davetten \xE7ok "beni kapat" davetidir. */
67
- .dm{position:absolute;top:-6px;right:-6px;width:22px;height:22px;border-radius:11px;background:var(--sb-bg);color:var(--sb-m);
68
- box-shadow:0 2px 8px rgba(16,20,30,.24);display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .15s;pointer-events:none}
69
- .sb:hover .dm{opacity:1;pointer-events:auto}
70
- .dm:hover{color:var(--sb-t)}
71
- .sb.open .dm,.sb.hidden .dm{display:none}
72
- @media (hover:none){.dm{opacity:1;pointer-events:auto}}
73
-
74
- /* Ziyaret\xE7i balonu kapatt\u0131: widget t\xFCmden gizlenir. Kald\u0131r\u0131lmaz \u2014
75
- sayfadaki "destek" d\xFC\u011Fmesi Signalbird.chat.open() ile onu geri getirir. */
76
- .sb.hidden .ln{display:none}
77
-
78
- /* launcher_mode:'manual' \u2014 balon hi\xE7 \xE7izilmez, sohbeti sitenin kendi d\xFC\u011Fmesi
79
- a\xE7ar. Ziyaret\xE7inin kapatma tercihinden AYRI bir s\u0131n\u0131f: biri site sahibinin
80
- ayar\u0131, di\u011Feri ziyaret\xE7inin karar\u0131. */
81
- .sb.no-ln .ln,.sb.no-ln .dm{display:none}
82
-
83
- /* \u2500\u2500 Panel \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
84
- .pn{position:absolute;bottom:0;width:400px;max-width:calc(100vw - 40px);height:min(660px,calc(100vh - 40px));
85
- background:var(--sb-bg);border-radius:var(--sb-r);box-shadow:var(--sb-sh);
86
- display:none;flex-direction:column;overflow:hidden;
87
- transform-origin:bottom right;animation:sbIn .22s cubic-bezier(.2,.8,.25,1)}
88
- .sb.dark .pn{border:1px solid var(--sb-b)}
89
- .sb.left .pn{transform-origin:bottom left;left:0}.sb.right .pn{right:0}
90
- .sb.open .pn{display:flex}
91
- /* Ziyaret\xE7inin ta\u015F\u0131d\u0131\u011F\u0131 konum. S\xFCr\xFCkleme yoksa ikisi de 0. */
48
+ :focus-visible{outline:2px solid var(--sb-c);outline-offset:2px;border-radius:6px}
49
+
50
+ /* \u2550\u2550 BALON \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
51
+ .ln{position:relative;display:flex;align-items:center;gap:10px;height:60px;min-width:60px;padding:0 22px 0 18px;
52
+ border-radius:30px;background:var(--sb-grad);color:var(--sb-fg);
53
+ box-shadow:0 2px 6px rgba(16,20,30,.16),0 12px 28px -8px var(--sb-ring),0 24px 48px -20px rgba(16,20,30,.32);
54
+ transition:transform .3s var(--sb-spring),box-shadow .3s ease,opacity .2s ease}
55
+ .ln::before{content:'';position:absolute;inset:0;border-radius:inherit;pointer-events:none;
56
+ background:linear-gradient(180deg,rgba(255,255,255,.22),rgba(255,255,255,0) 55%)}
57
+ .ln:hover{transform:translateY(-3px) scale(1.03)}
58
+ .ln:active{transform:translateY(-1px) scale(.99)}
59
+ .ln.icon-only{padding:0;justify-content:center;width:60px}
60
+ .ln .lt{position:relative;font-weight:600;font-size:15px;letter-spacing:-.012em;white-space:nowrap}
61
+ .ln .lg{width:32px;height:32px;border-radius:50%;object-fit:cover}
62
+ .ln .lm{position:relative;transition:transform .35s var(--sb-spring)}
63
+ .ln:hover .lm{transform:rotate(-8deg) scale(1.06)}
64
+
65
+ /* Ajan\u0131n \xE7evrimi\xE7i oldu\u011Funu balonda s\xF6yl\xFCyoruz: sohbete girmeden \xF6nce
66
+ "\u015Fu an biri var m\u0131" sorusunun cevab\u0131 g\xF6r\xFCns\xFCn. */
67
+ .ln-on{position:absolute;right:-1px;bottom:-1px;width:15px;height:15px;border-radius:50%;background:#22c55e;
68
+ border:3px solid var(--sb-bg);display:none}
69
+ .sb.agent-on .ln.icon-only .ln-on{display:block}
70
+
71
+ .badge{position:absolute;top:-2px;right:-2px;min-width:22px;height:22px;padding:0 6px;border-radius:11px;
72
+ background:#f43f5e;color:#fff;font-size:11.5px;font-weight:700;font-variant-numeric:tabular-nums;
73
+ display:none;align-items:center;justify-content:center;border:2.5px solid var(--sb-bg);
74
+ box-shadow:0 2px 8px rgba(244,63,94,.45);animation:sbPop .4s var(--sb-spring)}
75
+ .badge.on{display:flex}
76
+ @keyframes sbPop{from{transform:scale(0)}to{transform:scale(1)}}
77
+
78
+ /* Okunmam\u0131\u015F varken sessiz nab\u0131z \u2014 hareket, sessiz sekmede g\xF6r\xFClen tek sinyal.
79
+ Rozet k\xFC\xE7\xFCkt\xFCr, ses ise taray\u0131c\u0131 etkile\u015Fim bekledi\u011Fi i\xE7in \xE7o\u011Fu kez hi\xE7
80
+ \xE7almaz (bkz. sound.ts). */
81
+ .ln-pulse{position:absolute;inset:0;border-radius:inherit;pointer-events:none;display:none}
82
+ .sb.pulse .ln-pulse{display:block}
83
+ .ln-pulse::after{content:'';position:absolute;inset:0;border-radius:inherit;
84
+ box-shadow:0 0 0 0 var(--sb-ring);animation:sbRing 2.4s ease-out infinite}
85
+ @keyframes sbRing{0%{box-shadow:0 0 0 0 var(--sb-ring)}70%,100%{box-shadow:0 0 0 20px transparent}}
86
+
87
+ /* Yeni mesaj geldi\u011Finde tek seferlik yaylanma. */
88
+ @keyframes sbAttn{0%,100%{transform:none}18%{transform:scale(1.14) rotate(-3deg)}36%{transform:scale(.97) rotate(2deg)}
89
+ 56%{transform:scale(1.07)}78%{transform:scale(.99)}}
90
+ .ln.attn{animation:sbAttn 1.1s var(--sb-spring) 2}
91
+
92
+ .sb.open .ln,.sb.hidden .ln,.sb.no-ln .ln{opacity:0;pointer-events:none;transform:scale(.7);position:absolute;bottom:0}
93
+ .sb.right.open .ln,.sb.right.hidden .ln,.sb.right.no-ln .ln{right:0}
94
+ .sb.left.open .ln,.sb.left.hidden .ln,.sb.left.no-ln .ln{left:0}
95
+
96
+ /* Balonu tamamen kapatma. Ayr\u0131 d\xFC\u011Fmedir, balonun \u0130\xC7\u0130NDE de\u011Fil: i\xE7 i\xE7e d\xFC\u011Fme
97
+ HTML'de ge\xE7ersiz ve dokunmatikte "kapatay\u0131m derken a\xE7t\u0131m" hatas\u0131n\u0131 do\u011Furur. */
98
+ .dm{position:absolute;top:-8px;width:24px;height:24px;border-radius:12px;background:var(--sb-el);color:var(--sb-m);
99
+ box-shadow:var(--sb-sh-s);display:flex;align-items:center;justify-content:center;opacity:0;pointer-events:none;
100
+ transition:opacity .18s,transform .18s var(--sb-spring);transform:scale(.8);z-index:2}
101
+ .sb.right .dm{right:-8px}.sb.left .dm{left:-8px}
102
+ .sb:hover .dm{opacity:1;pointer-events:auto;transform:scale(1)}
103
+ .dm:hover{color:var(--sb-t);background:var(--sb-s)}
104
+ .sb.open .dm,.sb.hidden .dm,.sb.no-ln .dm{display:none}
105
+ @media (hover:none){.dm{opacity:1;pointer-events:auto;transform:scale(1)}}
106
+
107
+ /* \u2550\u2550 KAR\u015EILAMA KARTI (teaser) \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
108
+ Ziyaret\xE7i hen\xFCz hi\xE7 konu\u015Fmad\u0131ysa, sayfada bir s\xFCre kald\u0131ktan sonra bir
109
+ KEZ a\xE7\u0131l\u0131r. Kapat\u0131l\u0131rsa bir daha \xE7\u0131kmaz (karar taray\u0131c\u0131da saklan\u0131r).
110
+ Sohbeti ba\u015Flatan \u015Fey balonun kendisi de\u011Fil, bu c\xFCmledir. */
111
+ .teaser{position:absolute;bottom:74px;width:296px;max-width:calc(100vw - 40px);display:none;
112
+ background:var(--sb-el);border:1px solid var(--sb-b);border-radius:20px;box-shadow:var(--sb-sh);
113
+ padding:14px 15px;gap:11px;align-items:flex-start;cursor:pointer;text-align:left;
114
+ animation:sbTeaser .5s var(--sb-spring) both}
115
+ .sb.right .teaser{right:0;transform-origin:bottom right}
116
+ .sb.left .teaser{left:0;transform-origin:bottom left}
117
+ .sb.tz .teaser{display:flex}
118
+ .sb.open .teaser,.sb.hidden .teaser{display:none}
119
+ .teaser:hover{border-color:var(--sb-edge)}
120
+ @keyframes sbTeaser{from{opacity:0;transform:translateY(14px) scale(.92)}to{opacity:1;transform:none}}
121
+ .teaser .tv{width:40px;height:40px;border-radius:50%;overflow:hidden;flex:none;background:var(--sb-s2);
122
+ display:flex;align-items:center;justify-content:center;font-weight:650;font-size:14px;color:var(--sb-t)}
123
+ .teaser .tv img{width:100%;height:100%;object-fit:cover}
124
+ .teaser .tc{flex:1;min-width:0}
125
+ .teaser .tn{font-size:12px;font-weight:650;color:var(--sb-m);letter-spacing:.01em;margin-bottom:2px}
126
+ .teaser .tb{font-size:13.5px;line-height:1.45;color:var(--sb-t);
127
+ display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
128
+ .teaser .tx{width:22px;height:22px;border-radius:11px;color:var(--sb-m);display:flex;align-items:center;justify-content:center;
129
+ flex:none;margin:-4px -4px 0 0}
130
+ .teaser .tx:hover{background:var(--sb-s);color:var(--sb-t)}
131
+
132
+ /* \u2550\u2550 MESAJ \xD6N\u0130ZLEMES\u0130 (toast) \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
133
+ Panel kapal\u0131yken ajan yazd\u0131\u011F\u0131nda balonun \xFCst\xFCnde belirir. Rozet "bir \u015Fey
134
+ var" der; bu kart NE oldu\u011Funu s\xF6yler \u2014 a\xE7\u0131lma oran\u0131n\u0131 belirleyen fark. */
135
+ .toast{position:absolute;bottom:74px;width:296px;max-width:calc(100vw - 40px);display:none;gap:11px;
136
+ background:var(--sb-el);border:1px solid var(--sb-b);border-radius:20px;box-shadow:var(--sb-sh);
137
+ padding:13px 14px;align-items:flex-start;cursor:pointer;text-align:left;
138
+ animation:sbTeaser .45s var(--sb-spring) both}
139
+ .sb.right .toast{right:0;transform-origin:bottom right}
140
+ .sb.left .toast{left:0;transform-origin:bottom left}
141
+ .sb.tst .toast{display:flex}
142
+ .sb.tst .teaser{display:none}
143
+ .sb.open .toast{display:none}
144
+ .toast .tv{width:36px;height:36px;border-radius:50%;overflow:hidden;flex:none;background:var(--sb-s2);
145
+ display:flex;align-items:center;justify-content:center;font-weight:650;font-size:13px}
146
+ .toast .tv img{width:100%;height:100%;object-fit:cover}
147
+ .toast .tn{font-size:12px;font-weight:650;margin-bottom:2px}
148
+ .toast .tb{font-size:13px;line-height:1.45;color:var(--sb-m);
149
+ display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
150
+
151
+ /* \u2550\u2550 PANEL \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
152
+ .pn{position:absolute;bottom:0;width:404px;max-width:calc(100vw - 40px);
153
+ height:min(688px,calc(100vh - 40px));background:var(--sb-bg);border-radius:var(--sb-r);
154
+ box-shadow:var(--sb-sh);display:none;flex-direction:column;overflow:hidden;
155
+ border:1px solid color-mix(in srgb,var(--sb-b) 70%,transparent)}
156
+ .sb.right .pn{right:0;transform-origin:bottom right}
157
+ .sb.left .pn{left:0;transform-origin:bottom left}
158
+ .sb.open .pn{display:flex;animation:sbIn .42s var(--sb-spring)}
92
159
  .sb.right .pn{translate:calc(-1 * var(--sb-dx)) calc(-1 * var(--sb-dy))}
93
160
  .sb.left .pn{translate:var(--sb-dx) calc(-1 * var(--sb-dy))}
94
- .sb.moving .pn,.sb.sizing .pn{animation:none;transition:none;user-select:none}
95
- @keyframes sbIn{from{opacity:0;transform:translateY(14px) scale(.975)}to{opacity:1;transform:none}}
96
- @media (prefers-reduced-motion:reduce){.pn{animation:none}.ln{transition:none}}
97
- /* \u2500\u2500 \xC7ekmece (layout:'sidebar') \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
98
- Ekran boyu, kenara yasl\u0131 panel. K\xF6\u015Fe penceresinin aksine ta\u015F\u0131nmaz ve
99
- boyutland\u0131r\u0131lmaz; geni\u015Flik sabittir, y\xFCkseklik ekran\u0131n kendisidir. Mobilde
100
- zaten tam ekran a\xE7\u0131l\u0131yordu, orada iki bi\xE7im ayn\u0131 yere var\u0131r. */
161
+ .sb.moving .pn,.sb.sizing .pn{animation:none!important;transition:none;user-select:none}
162
+ @keyframes sbIn{from{opacity:0;transform:translateY(24px) scale(.9)}to{opacity:1;transform:none}}
163
+
164
+ /* Marka \u0131\u015F\u0131\u011F\u0131: rengin panele de\u011Fdi\u011Fi yer. Blok bir ba\u015Fl\u0131k \u015Feridi de\u011Fil \u2014
165
+ tepeden a\u015Fa\u011F\u0131 s\xF6nen bir ayd\u0131nlanma. Renk AZ yerde, HER ZAMAN ayn\u0131 anlamda. */
166
+ .glow{position:absolute;top:0;left:0;right:0;height:190px;pointer-events:none;z-index:0;
167
+ background:radial-gradient(120% 100% at 50% 0%,var(--sb-tint) 0%,transparent 72%)}
168
+
169
+ /* \u2500\u2500 \xC7ekmece (layout:'sidebar') \u2500\u2500 */
101
170
  .sb.sidebar{top:0;bottom:0;height:100vh;height:100dvh;display:flex;align-items:flex-end;padding-bottom:20px}
102
- .sb.sidebar.right{right:20px}.sb.sidebar.left{left:20px}
103
- .sb.sidebar .pn{position:fixed;top:0;bottom:0;height:100vh;height:100dvh;width:420px;max-width:100vw;
104
- border-radius:0;translate:none!important;animation:sbSlideR .24s cubic-bezier(.2,.8,.25,1)}
171
+ .sb.sidebar .pn{position:fixed;top:0;bottom:0;height:100vh;height:100dvh;width:432px;max-width:100vw;
172
+ border-radius:0;border:0;translate:none!important}
105
173
  .sb.sidebar.right .pn{right:0;left:auto}
106
- .sb.sidebar.left .pn{left:0;right:auto;animation-name:sbSlideL}
107
- .sb.sidebar .gp{display:none}
108
- @keyframes sbSlideR{from{opacity:.4;transform:translateX(24px)}to{opacity:1;transform:none}}
109
- @keyframes sbSlideL{from{opacity:.4;transform:translateX(-24px)}to{opacity:1;transform:none}}
110
- @media (prefers-reduced-motion:reduce){.sb.sidebar .pn{animation:none}}
174
+ .sb.sidebar.left .pn{left:0;right:auto}
175
+ .sb.sidebar.open .pn{animation:sbSlide .4s var(--sb-spring)}
176
+ .sb.sidebar.left.open .pn{animation-name:sbSlideL}
177
+ @keyframes sbSlide{from{opacity:.5;transform:translateX(40px)}to{opacity:1;transform:none}}
178
+ @keyframes sbSlideL{from{opacity:.5;transform:translateX(-40px)}to{opacity:1;transform:none}}
179
+ .sb.sidebar .gp,.sb.sidebar .drag{display:none}
111
180
 
181
+ @media (prefers-reduced-motion:reduce){
182
+ .sb *,.sb *::before,.sb *::after{animation:none!important;transition:none!important}
183
+ }
184
+
185
+ /* \u2550\u2550 MOB\u0130L \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
186
+ Panel tam ekran. Klavye a\xE7\u0131l\u0131nca g\xF6vde k\u0131sal\u0131r (--sb-kb) \u2014 kompozit\xF6r
187
+ klavyenin alt\u0131nda kal\u0131p eri\u015Filemez olmuyor. Tepedeki tutamak a\u015Fa\u011F\u0131
188
+ s\xFCr\xFCklenerek kapat\u0131l\u0131r; mobilde "kapat" d\xFC\u011Fmesini aramak yerine al\u0131\u015F\u0131lm\u0131\u015F
189
+ jest \xE7al\u0131\u015F\u0131r. */
112
190
  @media (max-width:640px){
113
- .sb.open{inset:0!important;bottom:0}
114
- .sb.sidebar{padding-bottom:0}
115
- .pn{position:fixed;inset:0;width:100%!important;max-width:none;height:100%!important;border-radius:0;translate:none!important}
191
+ .sb.open{inset:0!important;padding:0}
192
+ .sb.open .pn{position:fixed;inset:0;width:100%!important;max-width:none;
193
+ height:calc(100dvh - var(--sb-kb))!important;border-radius:0;border:0;translate:none!important;
194
+ animation:sbUp .34s var(--sb-spring)}
195
+ @keyframes sbUp{from{opacity:.6;transform:translateY(28px)}to{opacity:1;transform:none}}
116
196
  .gp{display:none!important}
197
+ /* Taban kural (.drag{display:none}) bu bloktan SONRA geliyor; e\u015Fit
198
+ \xF6zg\xFCll\xFCkte sonraki kazan\u0131rd\u0131. Se\xE7ici bilerek daha \xF6zg\xFCl. */
199
+ .sb.open .drag{display:flex}
200
+ .hd{padding-top:calc(6px + env(safe-area-inset-top))}
201
+ .cp{padding-bottom:calc(10px + env(safe-area-inset-bottom))}
202
+ .sb.open.kb .cp{padding-bottom:10px}
203
+ .teaser,.toast{width:calc(100vw - 40px)}
204
+ .cr textarea{font-size:16px} /* iOS 16px alt\u0131nda sayfay\u0131 yak\u0131nla\u015Ft\u0131r\u0131r */
205
+ .row{max-width:88%}
117
206
  }
118
207
 
119
- /* Marka hatt\u0131 \u2014 rengin panelde tuttu\u011Fu ilk yer */
120
- .br{height:3px;flex:none;background:var(--sb-c)}
208
+ /* A\u015Fa\u011F\u0131 s\xFCr\xFCkleyerek kapatma tutama\u011F\u0131 (yaln\u0131z mobil). */
209
+ .drag{display:none;justify-content:center;padding:10px 0 4px;flex:none;position:relative;z-index:2;
210
+ touch-action:none;cursor:grab}
211
+ .drag i{width:42px;height:5px;border-radius:3px;background:var(--sb-m);opacity:.35}
212
+ .drag:active i{opacity:.6}
213
+ .sb.dragging .pn{transition:none}
121
214
 
122
- /* Boyutland\u0131rma tutama\u011F\u0131 \u2014 panelin d\u0131\u015F k\xF6\u015Fesinde (sa\u011Fdaysa sol \xFCst) */
123
- .gp{position:absolute;width:18px;height:18px;z-index:6;opacity:0;transition:opacity .15s}
215
+ /* Boyutland\u0131rma tutama\u011F\u0131 \u2014 panelin DI\u015E k\xF6\u015Fesinde (sa\u011Fdaysa sol \xFCst); i\xE7 k\xF6\u015Fe
216
+ tam da kayd\u0131rma \xE7ubu\u011Funa denk gelirdi. */
217
+ .gp{position:absolute;width:20px;height:20px;z-index:6;opacity:0;transition:opacity .15s}
124
218
  .sb.right .gp{top:0;left:0;cursor:nwse-resize}
125
219
  .sb.left .gp{top:0;right:0;cursor:nesw-resize}
126
- .sb.open:hover .gp{opacity:.5}
220
+ .sb.open .pn:hover .gp{opacity:.45}
127
221
  .gp:hover{opacity:1!important}
128
- .gp::after{content:"";position:absolute;top:6px;width:9px;height:9px;border-color:var(--sb-m);border-style:solid}
129
- .sb.right .gp::after{left:6px;border-width:1.5px 0 0 1.5px;border-radius:3px 0 0 0}
130
- .sb.left .gp::after{right:6px;border-width:1.5px 1.5px 0 0;border-radius:0 3px 0 0}
222
+ .gp::after{content:"";position:absolute;top:7px;width:9px;height:9px;border-color:var(--sb-m);border-style:solid}
223
+ .sb.right .gp::after{left:7px;border-width:1.5px 0 0 1.5px;border-radius:4px 0 0 0}
224
+ .sb.left .gp::after{right:7px;border-width:1.5px 1.5px 0 0;border-radius:0 4px 0 0}
131
225
 
132
- /* \u2500\u2500 Ba\u015Fl\u0131k \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
133
- .hd{display:flex;align-items:center;gap:11px;padding:13px 10px 13px 15px;flex:none;
134
- background:var(--sb-bg);border-bottom:1px solid var(--sb-b);cursor:grab;touch-action:none}
226
+ /* \u2550\u2550 BA\u015ELIK \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
227
+ .hd{position:relative;z-index:1;display:flex;align-items:center;gap:12px;padding:14px 12px 14px 16px;flex:none;
228
+ cursor:grab;touch-action:none}
135
229
  .sb.moving .hd{cursor:grabbing}
136
- .hd .av{position:relative;width:38px;height:38px;border-radius:50%;background:var(--sb-s2);color:var(--sb-t);
137
- display:flex;align-items:center;justify-content:center;font-weight:650;font-size:14px;letter-spacing:-.02em;
138
- overflow:hidden;flex:none;box-shadow:0 0 0 2px var(--sb-bg),0 0 0 3.5px color-mix(in srgb,var(--sb-c) 55%,transparent)}
230
+ .hd .av{position:relative;width:42px;height:42px;border-radius:50%;flex:none;overflow:visible}
231
+ .hd .av .ph{width:100%;height:100%;border-radius:50%;overflow:hidden;background:var(--sb-s2);color:var(--sb-t);
232
+ display:flex;align-items:center;justify-content:center;font-weight:650;font-size:15px;letter-spacing:-.02em;
233
+ box-shadow:0 0 0 2px var(--sb-bg),0 0 0 3.5px var(--sb-ring)}
139
234
  .hd .av img{width:100%;height:100%;object-fit:cover}
235
+ .hd .dot{position:absolute;right:-1px;bottom:-1px;width:13px;height:13px;border-radius:50%;background:#9ca3af;
236
+ border:2.5px solid var(--sb-bg);transition:background .2s}
237
+ .hd .dot.on{background:#22c55e}
238
+ .hd .dot.on::after{content:'';position:absolute;inset:-2px;border-radius:50%;
239
+ box-shadow:0 0 0 0 rgba(34,197,94,.5);animation:sbLive 2.6s ease-out infinite}
240
+ @keyframes sbLive{0%{box-shadow:0 0 0 0 rgba(34,197,94,.45)}70%,100%{box-shadow:0 0 0 9px transparent}}
140
241
  .hd .hi{flex:1;min-width:0}
141
- .hd .hn{font-weight:650;font-size:15px;letter-spacing:-.015em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
142
- .hd .hs{font-size:12.5px;color:var(--sb-m);display:flex;align-items:center;gap:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:1px}
143
- .dot{width:7px;height:7px;border-radius:50%;background:#9ca3af;flex:none}
144
- .dot.on{background:#22c55e;box-shadow:0 0 0 3px rgba(34,197,94,.18)}
145
- .hb{width:34px;height:34px;border-radius:10px;display:flex;align-items:center;justify-content:center;color:var(--sb-m);flex:none}
242
+ .hd .hn{font-weight:650;font-size:15.5px;letter-spacing:-.018em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
243
+ .hd .hs{font-size:12.5px;color:var(--sb-m);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:1px}
244
+ .hd .ha{display:flex;align-items:center;gap:2px;flex:none}
245
+ .hb{width:38px;height:38px;border-radius:12px;display:flex;align-items:center;justify-content:center;color:var(--sb-m);flex:none;
246
+ transition:background .15s,color .15s}
146
247
  .hb:hover{background:var(--sb-s);color:var(--sb-t)}
248
+ .hb.hide{display:none}
249
+
250
+ /* \u2550\u2550 BANT \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
251
+ .bn{position:relative;z-index:1;display:none;align-items:center;gap:8px;margin:0 12px 8px;padding:10px 13px;
252
+ font-size:12.5px;line-height:1.45;border-radius:14px;background:#fff7e6;color:#8a5a06;border:1px solid #f5e2bb}
253
+ .bn.on{display:flex}
254
+ .bn.err{background:#fdecec;color:#9b2c2c;border-color:#f3cdcd}
255
+ .sb.dark .bn{background:#2a2313;color:#e9c47f;border-color:#3b3117}
256
+ .sb.dark .bn.err{background:#2c1919;color:#f0a8a8;border-color:#432020}
257
+
258
+ /* \u2550\u2550 G\xD6VDE \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
259
+ .bd{position:relative;z-index:1;flex:1;min-height:0;display:flex;flex-direction:column}
260
+ .ml{flex:1;overflow-y:auto;padding:10px 16px 12px;display:flex;flex-direction:column;
261
+ overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--sb-b) transparent}
262
+ /* Mesajlar alta yaslan\u0131r. justify-content:flex-end ta\u015Fma olunca listenin
263
+ \xDCST\xDCN\xDC k\u0131rp\u0131yor; s\xF6zde \xF6\u011Feye verilen margin-top:auto ise hem az mesajda
264
+ alta yaslar hem \xE7ok mesajda normal kayd\u0131rmay\u0131 bozmaz. */
265
+ .ml::before{content:'';margin-top:auto}
266
+ .ml::-webkit-scrollbar{width:10px}
267
+ .ml::-webkit-scrollbar-thumb{background:var(--sb-b);border-radius:5px;border:3px solid transparent;background-clip:content-box}
268
+ .ml::-webkit-scrollbar-thumb:hover{background:var(--sb-m);background-clip:content-box}
269
+
270
+ /* \u2500\u2500 Bo\u015F ekran: form duvar\u0131 de\u011Fil, davet \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
271
+ Ziyaret\xE7i paneli a\xE7t\u0131\u011F\u0131nda ilk g\xF6rd\xFC\u011F\xFC \u015Fey ya bir form ya bo\u015F bir kutuydu.
272
+ \u015Eimdi: kar\u015F\u0131lama c\xFCmlesi, yan\u0131t s\xFCresi ve tek dokunu\u015Fla ba\u015Flatan konu
273
+ \xE7ipleri. "Ne yazaca\u011F\u0131m\u0131 bilmiyorum" en s\u0131k terk sebebidir. */
274
+ .hero{margin-top:auto;padding:26px 6px 14px;display:flex;flex-direction:column;align-items:flex-start;gap:6px}
275
+ .hero .hv{display:flex;margin-bottom:12px}
276
+ .hero .hv span{width:44px;height:44px;border-radius:50%;overflow:hidden;background:var(--sb-s2);
277
+ display:flex;align-items:center;justify-content:center;font-weight:650;font-size:15px;color:var(--sb-t);
278
+ box-shadow:0 0 0 3px var(--sb-bg);margin-left:-12px}
279
+ .hero .hv span:first-child{margin-left:0}
280
+ .hero .hv img{width:100%;height:100%;object-fit:cover}
281
+ .hero h4{margin:0;font-size:22px;font-weight:680;letter-spacing:-.028em;line-height:1.25;text-wrap:balance;
282
+ background:var(--sb-grad);-webkit-background-clip:text;background-clip:text;color:transparent}
283
+ .hero p{margin:2px 0 0;color:var(--sb-m);font-size:13.5px;line-height:1.5}
284
+ .qk{display:flex;flex-wrap:wrap;gap:7px;margin-top:16px}
285
+ .qk button{font-size:13px;font-weight:550;padding:9px 14px;border-radius:14px;background:var(--sb-el);
286
+ border:1px solid var(--sb-b);color:var(--sb-t);box-shadow:var(--sb-sh-s);
287
+ transition:transform .2s var(--sb-spring),border-color .15s,background .15s}
288
+ .qk button:hover{transform:translateY(-2px);border-color:var(--sb-edge);background:var(--sb-tint)}
147
289
 
148
- /* \u2500\u2500 Bant \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
149
- .bn{padding:9px 16px;font-size:12.5px;background:#fef6e0;color:#8a5a06;flex:none;border-bottom:1px solid var(--sb-b)}
150
- .bn.err{background:#fdeaea;color:#992b2b}
151
- .sb.dark .bn{background:#2c2413;color:#e8c37a}
152
- .sb.dark .bn.err{background:#2e1a1a;color:#f0a6a6}
153
-
154
- /* \u2500\u2500 G\xF6vde \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
155
- .bd{flex:1;min-height:0;display:flex;flex-direction:column;position:relative;background:var(--sb-bg)}
156
- .ml{flex:1;overflow-y:auto;padding:18px 16px 10px;display:flex;flex-direction:column;gap:2px;overscroll-behavior:contain;scrollbar-width:thin}
157
- .ml::-webkit-scrollbar{width:8px}
158
- .ml::-webkit-scrollbar-thumb{background:var(--sb-b);border-radius:4px;border:2px solid var(--sb-bg)}
159
- .ml::-webkit-scrollbar-thumb:hover{background:var(--sb-m)}
160
- .day{align-self:center;font-size:11px;font-weight:600;letter-spacing:.02em;color:var(--sb-m);background:var(--sb-s);
161
- padding:4px 11px;border-radius:11px;margin:12px 0 10px}
162
- .gr{align-self:flex-start;background:var(--sb-s);padding:11px 14px;border-radius:var(--sb-rb);border-bottom-left-radius:5px;max-width:85%;color:var(--sb-t)}
163
-
164
- /* \u2500\u2500 Mesaj sat\u0131r\u0131 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
165
- .row{display:flex;flex-direction:column;max-width:82%;position:relative;margin-top:2px}
166
- .row.v{align-self:flex-end;align-items:flex-end}
167
- .row.a{align-self:flex-start;align-items:flex-start}
168
- .row.s{align-self:center;max-width:90%}
169
- .row.s .bb{background:none;color:var(--sb-m);font-size:12px;text-align:center;padding:5px 8px;box-shadow:none}
290
+ .day{align-self:center;font-size:11px;font-weight:650;letter-spacing:.02em;color:var(--sb-m);
291
+ background:var(--sb-s);padding:5px 12px;border-radius:12px;margin:14px 0 10px}
292
+
293
+ /* \u2550\u2550 MESAJ SATIRI \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
294
+ Ayn\u0131 ki\u015Finin arka arkaya mesajlar\u0131 GRUPLANIR: avatar bir kez, saat bir kez,
295
+ aradaki bo\u015Fluk 2px. Her mesaja avatar basmak sohbeti liste gibi g\xF6steriyor;
296
+ gruplan\u0131nca konu\u015Fma gibi g\xF6r\xFCn\xFCyor. */
297
+ .row{display:flex;gap:8px;max-width:84%;position:relative;margin-top:2px}
170
298
  .row.gap{margin-top:12px}
171
- .bb{position:relative;padding:9px 13px;border-radius:var(--sb-rb);word-wrap:break-word;overflow-wrap:anywhere;white-space:pre-wrap;line-height:1.48}
172
- .row.a .bb{background:var(--sb-s);border-bottom-left-radius:5px}
173
- .row.v .bb{background:var(--sb-c);color:var(--sb-fg);border-bottom-right-radius:5px}
174
- .row.pend .bb{opacity:.6}
175
- .row.fail .bb{background:#fdeaea;color:#992b2b;cursor:pointer}
176
- .bb.del{font-style:italic;opacity:.7}
177
- .q{display:block;border-left:2.5px solid currentColor;opacity:.72;padding:3px 9px;margin:0 0 7px;font-size:12px;border-radius:4px;
178
- background:rgba(120,130,150,.12);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:250px}
179
- .row.v .q{background:rgba(255,255,255,.16)}
180
- .mt{display:flex;align-items:center;gap:5px;font-size:11px;color:var(--sb-m);margin-top:4px;padding:0 3px;font-variant-numeric:tabular-nums}
299
+ .row.v{align-self:flex-end;flex-direction:row-reverse}
300
+ .row.a{align-self:flex-start}
301
+ .row.s{align-self:center;max-width:92%;margin:8px 0}
302
+ .row .av{width:28px;height:28px;border-radius:50%;overflow:hidden;flex:none;align-self:flex-end;background:var(--sb-s2);
303
+ display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:650;color:var(--sb-m)}
304
+ .row .av img{width:100%;height:100%;object-fit:cover}
305
+ .row .av.gh{visibility:hidden}
306
+ /* \xD6be\u011Fin son sat\u0131r\u0131nda baloncu\u011Fun ALTINDA saat sat\u0131r\u0131 var; avatar onunla de\u011Fil
307
+ baloncukla hizalanmal\u0131 \u2014 yoksa y\xFCz, mesaj\u0131n bir sat\u0131r a\u015Fa\u011F\u0131s\u0131na kay\u0131yor. */
308
+ .row.a:not(.mid) .av{margin-bottom:19px}
309
+ .row .cl{display:flex;flex-direction:column;min-width:0}
310
+ .row.v .cl{align-items:flex-end}
311
+
312
+ .bb{position:relative;padding:10px 14px;border-radius:var(--sb-rb);word-wrap:break-word;overflow-wrap:anywhere;
313
+ white-space:pre-wrap;line-height:1.5;font-size:14px;max-width:100%}
314
+ .row.a .bb{background:var(--sb-el);border:1px solid var(--sb-b);border-bottom-left-radius:6px;box-shadow:var(--sb-sh-s)}
315
+ .row.v .bb{background:var(--sb-grad);color:var(--sb-fg);border-bottom-right-radius:6px;
316
+ box-shadow:0 2px 8px -2px var(--sb-ring),0 8px 20px -10px var(--sb-ring)}
317
+ .row.a.mid .bb{border-bottom-left-radius:var(--sb-rb)}
318
+ .row.v.mid .bb{border-bottom-right-radius:var(--sb-rb)}
319
+ .row.pend .bb{opacity:.65}
320
+ .row.fail .bb{background:#fdecec;color:#9b2c2c;border:1px solid #f3cdcd;cursor:pointer;box-shadow:none}
321
+ .bb.del{font-style:italic;opacity:.65}
322
+ .row.s .bb{background:none;border:0;box-shadow:none;color:var(--sb-m);font-size:12px;text-align:center;padding:4px 10px}
323
+ .bb a{text-decoration:underline;text-underline-offset:2px}
324
+
325
+ /* Yeni gelen mesaj yerine oturur \u2014 liste z\u0131plamaz, mesaj belirir. */
326
+ @keyframes sbMsg{from{opacity:0;transform:translateY(8px) scale(.97)}to{opacity:1;transform:none}}
327
+ .row.new .bb{animation:sbMsg .34s var(--sb-spring)}
328
+
329
+ .q{display:block;border-left:2.5px solid currentColor;opacity:.75;padding:4px 10px;margin:0 0 8px;font-size:12px;
330
+ border-radius:5px;background:rgba(120,130,150,.12);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:250px}
331
+ .row.v .q{background:rgba(255,255,255,.18)}
332
+ .mt{display:flex;align-items:center;gap:5px;font-size:11px;color:var(--sb-m);margin-top:4px;padding:0 4px;
333
+ font-variant-numeric:tabular-nums}
181
334
  .mt .tk{display:inline-flex}.mt .tk.rd{color:#3b82f6}
182
335
  .mt .ed{font-style:italic}
183
336
  .imgs{display:flex;flex-wrap:wrap;gap:4px;margin:2px 0}
184
- .imgs img{max-width:220px;max-height:200px;border-radius:11px;display:block;cursor:zoom-in;object-fit:cover;background:var(--sb-s2)}
185
- .fr{display:flex;align-items:center;gap:9px;padding:9px 11px;border-radius:11px;background:rgba(120,130,150,.12);margin:2px 0;
186
- text-decoration:none;font-size:13px;max-width:260px}
187
- .row.v .fr{background:rgba(255,255,255,.15)}
337
+ .imgs img{max-width:216px;max-height:200px;border-radius:13px;display:block;cursor:zoom-in;object-fit:cover;background:var(--sb-s2)}
338
+ .fr{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:13px;background:rgba(120,130,150,.13);
339
+ margin:2px 0;text-decoration:none;font-size:13px;max-width:260px}
340
+ .row.v .fr{background:rgba(255,255,255,.16)}
188
341
  .fr .fn{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex:1}
189
342
  .fr .fs{opacity:.7;font-size:11px;white-space:nowrap;font-variant-numeric:tabular-nums}
190
- .rx{display:flex;flex-wrap:wrap;gap:4px;margin-top:5px}
191
- .rx button{font-size:12px;padding:2px 8px;border-radius:11px;background:var(--sb-s);border:1px solid var(--sb-b);line-height:1.5}
192
- .rx button.me{border-color:var(--sb-c);background:var(--sb-bg)}
343
+ .rx{display:flex;flex-wrap:wrap;gap:4px;margin-top:-6px;padding:0 4px;z-index:1}
344
+ .rx button{font-size:12px;padding:3px 9px;border-radius:12px;background:var(--sb-el);border:1px solid var(--sb-b);
345
+ line-height:1.5;box-shadow:var(--sb-sh-s)}
346
+ .rx button.me{border-color:var(--sb-c);background:var(--sb-tint)}
193
347
  .row.v .rx{justify-content:flex-end}
194
348
 
195
- /* Mesaj eylem \xE7ubu\u011Fu */
196
- .ac{position:absolute;top:-32px;display:none;align-items:center;gap:2px;background:var(--sb-bg);border:1px solid var(--sb-b);
197
- border-radius:20px;padding:3px 5px;box-shadow:0 4px 14px rgba(16,20,30,.14);z-index:2}
198
- .row.a .ac{left:0}.row.v .ac{right:0}
199
- .row:hover .ac,.row.acts .ac{display:flex}
200
- .ac button{width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:15px;color:var(--sb-t)}
201
- .ac button:hover{background:var(--sb-s)}
202
- .menu{position:absolute;top:0;display:none;flex-direction:column;background:var(--sb-bg);border:1px solid var(--sb-b);border-radius:12px;
203
- box-shadow:0 10px 28px rgba(16,20,30,.16);z-index:3;min-width:126px;overflow:hidden;padding:4px}
204
- .row.a .menu{left:0}.row.v .menu{right:0}
205
- .menu.show{display:flex}
206
- .menu button{padding:8px 11px;text-align:left;font-size:13px;border-radius:8px}
349
+ /* Mesaj eylem \xE7ubu\u011Fu \u2014 masa\xFCst\xFCnde hover, dokunmatikte uzun bas\u0131\u015F. */
350
+ .ac{position:absolute;top:-34px;display:flex;align-items:center;gap:2px;background:var(--sb-el);
351
+ border:1px solid var(--sb-b);border-radius:20px;padding:3px 5px;box-shadow:var(--sb-sh-s);z-index:3;
352
+ opacity:0;pointer-events:none;transform:translateY(4px) scale(.94);transition:opacity .15s,transform .18s var(--sb-spring)}
353
+ .row.a .ac{left:36px}.row.v .ac{right:36px}
354
+ .row:hover .ac,.row.acts .ac{opacity:1;pointer-events:auto;transform:none}
355
+ .ac button{width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;
356
+ font-size:15px;color:var(--sb-t);transition:background .12s,transform .18s var(--sb-spring)}
357
+ .ac button:hover{background:var(--sb-s);transform:scale(1.18)}
358
+ .menu{position:absolute;top:0;display:none;flex-direction:column;background:var(--sb-el);border:1px solid var(--sb-b);
359
+ border-radius:14px;box-shadow:var(--sb-sh);z-index:4;min-width:140px;overflow:hidden;padding:5px}
360
+ .row.a .menu{left:36px}.row.v .menu{right:36px}
361
+ .menu.show{display:flex;animation:sbTeaser .2s var(--sb-spring)}
362
+ .menu button{padding:9px 12px;text-align:left;font-size:13px;border-radius:9px}
207
363
  .menu button:hover{background:var(--sb-s)}
208
- .menu button.dg{color:#dc2626}
209
-
210
- /* Yaz\u0131yor */
211
- .tp{display:none;align-items:center;gap:4px;padding:6px 18px 4px;color:var(--sb-m);font-size:12px}
212
- .tp.on{display:flex}
213
- .tp i{width:6px;height:6px;border-radius:50%;background:var(--sb-m);animation:sbDot 1.2s infinite ease-in-out}
214
- .tp i:nth-child(2){animation-delay:.2s}.tp i:nth-child(3){animation-delay:.4s}
215
- @keyframes sbDot{0%,80%,100%{transform:scale(.6);opacity:.4}40%{transform:scale(1);opacity:1}}
216
-
217
- /* \u2500\u2500 Kompozit\xF6r \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
218
- .cp{border-top:1px solid var(--sb-b);padding:10px 12px 8px;flex:none;background:var(--sb-bg)}
219
- .rq{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--sb-m);padding:5px 9px 6px;border-left:2.5px solid var(--sb-c);
220
- background:var(--sb-s);border-radius:0 8px 8px 0;margin:0 0 8px}
364
+ .menu button.dg{color:#e11d48}
365
+
366
+ /* Yaz\u0131yor \u2014 \xFC\xE7 nokta, ajan\u0131n baloncu\u011Funun yerinde. */
367
+ .tp{display:none;align-items:center;gap:8px;padding:6px 16px 10px}
368
+ .tp.on{display:flex;animation:sbMsg .3s var(--sb-spring)}
369
+ .tp .av{width:28px;height:28px;border-radius:50%;overflow:hidden;background:var(--sb-s2);flex:none;
370
+ display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:650;color:var(--sb-m)}
371
+ .tp .av img{width:100%;height:100%;object-fit:cover}
372
+ .tp .dots{display:flex;align-items:center;gap:4px;background:var(--sb-el);border:1px solid var(--sb-b);
373
+ border-radius:var(--sb-rb);border-bottom-left-radius:6px;padding:12px 14px;box-shadow:var(--sb-sh-s)}
374
+ .tp i{width:6px;height:6px;border-radius:50%;background:var(--sb-m);animation:sbDot 1.3s infinite ease-in-out}
375
+ .tp i:nth-child(2){animation-delay:.18s}.tp i:nth-child(3){animation-delay:.36s}
376
+ @keyframes sbDot{0%,75%,100%{transform:translateY(0);opacity:.35}35%{transform:translateY(-4px);opacity:1}}
377
+
378
+ /* A\u015Fa\u011F\u0131 in d\xFC\u011Fmesi \u2014 uzun ge\xE7mi\u015Fte "yeni mesaj a\u015Fa\u011F\u0131da" kaybolmas\u0131n. */
379
+ .jump{position:absolute;left:50%;bottom:8px;transform:translateX(-50%) translateY(8px);opacity:0;pointer-events:none;
380
+ display:flex;align-items:center;gap:6px;padding:7px 13px;border-radius:16px;background:var(--sb-el);
381
+ border:1px solid var(--sb-b);box-shadow:var(--sb-sh-s);font-size:12.5px;font-weight:600;color:var(--sb-t);
382
+ transition:opacity .2s,transform .25s var(--sb-spring);z-index:3}
383
+ .jump.on{opacity:1;pointer-events:auto;transform:translateX(-50%)}
384
+
385
+ /* \u2550\u2550 KOMPOZ\u0130T\xD6R \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
386
+ .cp{position:relative;z-index:1;padding:10px 12px 8px;flex:none;background:var(--sb-bg);
387
+ border-top:1px solid color-mix(in srgb,var(--sb-b) 60%,transparent)}
388
+ .rq{display:none;align-items:center;gap:8px;font-size:12px;color:var(--sb-m);padding:7px 10px;
389
+ border-left:2.5px solid var(--sb-c);background:var(--sb-s);border-radius:0 10px 10px 0;margin:0 0 8px}
390
+ .rq.on{display:flex;animation:sbMsg .25s var(--sb-spring)}
221
391
  .rq .rt{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
222
- .rq button{opacity:.7}
223
- .chips{display:flex;flex-wrap:wrap;gap:6px;padding:0 0 8px}
224
- .chip{display:flex;align-items:center;gap:7px;font-size:12px;background:var(--sb-s);border:1px solid var(--sb-b);border-radius:10px;padding:5px 9px;max-width:100%}
225
- .chip img{width:28px;height:28px;object-fit:cover;border-radius:6px}
226
- .chip span{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;max-width:160px}
227
- .chip button{opacity:.6;line-height:1}
228
- .cr{display:flex;align-items:flex-end;gap:7px;background:var(--sb-s);border:1px solid var(--sb-b);border-radius:14px;padding:3px 4px 3px 6px;
229
- transition:border-color .15s,box-shadow .15s}
230
- .cr:focus-within{border-color:color-mix(in srgb,var(--sb-c) 55%,var(--sb-b));box-shadow:0 0 0 3px color-mix(in srgb,var(--sb-c) 14%,transparent)}
231
- .cr textarea{flex:1;resize:none;border:0;background:none;padding:9px 4px;max-height:140px;min-height:38px;outline:none;line-height:1.45}
392
+ .rq button{opacity:.7;display:flex}
393
+ .chips{display:none;flex-wrap:wrap;gap:6px;padding:0 0 8px}
394
+ .chips.on{display:flex}
395
+ .chip{position:relative;display:flex;align-items:center;gap:8px;font-size:12px;background:var(--sb-el);
396
+ border:1px solid var(--sb-b);border-radius:12px;padding:5px 9px;max-width:100%;box-shadow:var(--sb-sh-s)}
397
+ .chip img{width:30px;height:30px;object-fit:cover;border-radius:8px}
398
+ .chip span{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;max-width:150px}
399
+ .chip button{opacity:.6;line-height:1;display:flex}
400
+ .chip button:hover{opacity:1}
401
+
402
+ /* Kalan karakter \u2014 s\u0131n\u0131ra yakla\u015F\u0131nca belirir, s\u0131f\u0131rda uyar\u0131r. S\xFCrekli duran
403
+ bir saya\xE7 k\u0131sa yazmay\u0131 kural gibi g\xF6sterip sohbetin tonunu bozard\u0131. */
404
+ .cnt{display:none;justify-content:flex-end;padding:0 6px 4px;font-size:11px;font-weight:600;
405
+ color:var(--sb-m);font-variant-numeric:tabular-nums}
406
+ .cnt.on{display:flex}
407
+ .cnt.full{color:#e11d48}
408
+
409
+ .cr{display:flex;align-items:flex-end;gap:6px;background:var(--sb-el);border:1.5px solid var(--sb-b);
410
+ border-radius:20px;padding:4px 5px 4px 6px;transition:border-color .18s,box-shadow .18s}
411
+ .cr:focus-within{border-color:var(--sb-edge);box-shadow:0 0 0 4px var(--sb-tint)}
412
+ .cr textarea{flex:1;resize:none;border:0;background:none;padding:10px 4px;max-height:132px;min-height:40px;
413
+ outline:none;line-height:1.45}
232
414
  .cr textarea::placeholder{color:var(--sb-m)}
233
- .cb{width:36px;height:36px;border-radius:11px;display:flex;align-items:center;justify-content:center;color:var(--sb-m);flex:none}
234
- .cb:hover{background:var(--sb-s2);color:var(--sb-t)}
235
- .cb.sd{background:var(--sb-c);color:var(--sb-fg);border-radius:50%;width:36px;height:36px}
236
- .cb.sd:hover{background:var(--sb-c);filter:brightness(1.12)}
237
-
238
- /* \u0130mza \u2014 "Signalbird ile" yerine ger\xE7ek bir marka sat\u0131r\u0131.
239
- Ku\u015F i\u015Fareti + kelime i\u015Fareti, tek s\u0131ra, d\xFC\u015F\xFCk kontrast: m\xFC\u015Fterinin
240
- markas\u0131yla yar\u0131\u015Fmaz ama okunur ve t\u0131klan\u0131r. */
241
- .pw{display:flex;align-items:center;justify-content:center;padding:7px 0 3px}
242
- .pw a{display:inline-flex;align-items:center;gap:5px;text-decoration:none;color:var(--sb-m);opacity:.72;
243
- font-size:11px;letter-spacing:.01em;padding:3px 8px;border-radius:8px;transition:opacity .15s,background .15s}
415
+ .cb{width:40px;height:40px;border-radius:14px;display:flex;align-items:center;justify-content:center;color:var(--sb-m);
416
+ flex:none;transition:background .15s,color .15s,transform .2s var(--sb-spring)}
417
+ .cb:hover{background:var(--sb-s);color:var(--sb-t)}
418
+ .cb:active{transform:scale(.92)}
419
+ .cb.sd{background:var(--sb-grad);color:var(--sb-fg);border-radius:50%;box-shadow:0 2px 10px -2px var(--sb-ring)}
420
+ .cb.sd:disabled{background:var(--sb-s2);color:var(--sb-m);box-shadow:none;transform:scale(.9);opacity:1}
421
+ .cb.sd:not(:disabled):hover{filter:brightness(1.1);transform:scale(1.06)}
422
+
423
+ /* Emoji se\xE7ici \u2014 24 y\xFCz yeter; tam bir emoji klavyesi widget'a 40 KB ekler. */
424
+ .emj{position:absolute;bottom:100%;left:12px;right:12px;margin-bottom:8px;display:none;flex-wrap:wrap;gap:2px;
425
+ background:var(--sb-el);border:1px solid var(--sb-b);border-radius:16px;padding:8px;box-shadow:var(--sb-sh);z-index:5}
426
+ .emj.on{display:flex;animation:sbTeaser .22s var(--sb-spring)}
427
+ .emj button{width:34px;height:34px;border-radius:9px;font-size:19px;line-height:1;display:flex;align-items:center;justify-content:center}
428
+ .emj button:hover{background:var(--sb-s);transform:scale(1.15)}
429
+
430
+ /* \u0130mza \u2014 c\xFCmle kurmaz, isim s\xF6yler. M\xFC\u015Fterinin markas\u0131yla yar\u0131\u015Fmaz. */
431
+ .pw{display:flex;align-items:center;justify-content:center;padding:8px 0 2px}
432
+ .pw a{display:inline-flex;align-items:center;gap:5px;text-decoration:none;color:var(--sb-m);opacity:.65;
433
+ font-size:11px;padding:3px 9px;border-radius:9px;transition:opacity .15s,background .15s}
244
434
  .pw a:hover{opacity:1;background:var(--sb-s)}
245
- .pw .pk{opacity:.85;flex:none}
246
- .pw .pn2{font-weight:600;letter-spacing:-.005em;color:var(--sb-t);opacity:.75}
247
-
248
- .drop{position:absolute;inset:8px;background:color-mix(in srgb,var(--sb-bg) 92%,transparent);display:none;align-items:center;justify-content:center;
249
- font-weight:600;color:var(--sb-c);border:2px dashed var(--sb-c);border-radius:12px;z-index:5;pointer-events:none}
250
- .bd.dragging .drop{display:flex}
251
-
252
- /* \u2500\u2500 \xD6n-form ve puanlama \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
253
- .fm{flex:1;overflow-y:auto;padding:26px 22px;display:flex;flex-direction:column;gap:13px}
254
- .fm h3{margin:0;font-size:19px;font-weight:650;letter-spacing:-.02em;text-wrap:balance}
255
- .fm p{margin:0 0 4px;color:var(--sb-m);font-size:13.5px;line-height:1.55}
256
- .fm input,.fm textarea,.fm select{width:100%;border:1px solid var(--sb-b);border-radius:11px;padding:11px 13px;outline:none;
257
- background:var(--sb-s);color:inherit;font:inherit;transition:border-color .15s,box-shadow .15s}
258
- .fm input:focus,.fm textarea:focus,.fm select:focus{border-color:color-mix(in srgb,var(--sb-c) 55%,var(--sb-b));
259
- box-shadow:0 0 0 3px color-mix(in srgb,var(--sb-c) 14%,transparent);background:var(--sb-bg)}
260
- .fm textarea{resize:vertical;min-height:74px}
261
- .btn{background:var(--sb-c);color:var(--sb-fg);border-radius:11px;padding:12px 16px;font-weight:600;text-align:center;letter-spacing:-.01em;
262
- transition:filter .15s,transform .1s}
263
- .btn:hover{filter:brightness(1.08)}
435
+ .pw .pn2{font-weight:650;letter-spacing:-.008em;color:var(--sb-t);opacity:.8}
436
+
437
+ .drop{position:absolute;inset:8px;background:color-mix(in srgb,var(--sb-bg) 88%,transparent);display:none;
438
+ align-items:center;justify-content:center;flex-direction:column;gap:8px;font-weight:600;color:var(--sb-c);
439
+ border:2px dashed var(--sb-edge);border-radius:16px;z-index:6;pointer-events:none;backdrop-filter:blur(2px)}
440
+ .bd.dragover .drop{display:flex}
441
+
442
+ /* \u2550\u2550 FORMLAR (\xF6n-form, puanlama) \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
443
+ .fm{flex:1;overflow-y:auto;padding:24px 22px 22px;display:flex;flex-direction:column;gap:14px}
444
+ .fm h3{margin:0;font-size:21px;font-weight:680;letter-spacing:-.028em;text-wrap:balance;line-height:1.25}
445
+ .fm p{margin:-6px 0 4px;color:var(--sb-m);font-size:13.5px;line-height:1.55}
446
+ .fld{position:relative}
447
+ .fld input,.fld select,.fm textarea{width:100%;border:1.5px solid var(--sb-b);border-radius:14px;
448
+ padding:20px 14px 8px;outline:none;background:var(--sb-el);color:inherit;font:inherit;
449
+ transition:border-color .18s,box-shadow .18s}
450
+ .fm textarea{padding:14px;resize:vertical;min-height:86px}
451
+ .fld input:focus,.fld select:focus,.fm textarea:focus{border-color:var(--sb-edge);box-shadow:0 0 0 4px var(--sb-tint)}
452
+ /* Y\xFCzen etiket: yer tutucu metin, kullan\u0131c\u0131 yazmaya ba\u015Flay\u0131nca kaybolan tek
453
+ ipucudur. Etiket kal\u0131r \u2014 alan\u0131n ne oldu\u011Fu her zaman g\xF6r\xFCn\xFCr. */
454
+ .fld label{position:absolute;left:15px;top:14px;font-size:14px;color:var(--sb-m);pointer-events:none;
455
+ transition:transform .18s var(--sb-spring),font-size .18s,color .18s;transform-origin:left top}
456
+ .fld input:focus+label,.fld input.has+label,.fld select+label{transform:translateY(-8px) scale(.78);color:var(--sb-m)}
457
+ .fld input:focus+label{color:var(--sb-c)}
458
+ .fld select{appearance:none;padding-top:20px}
459
+ .fld .cv{position:absolute;right:14px;top:50%;transform:translateY(-50%);color:var(--sb-m);pointer-events:none}
460
+ .fld.bad input{border-color:#e11d48}
461
+
462
+ .btn{background:var(--sb-grad);color:var(--sb-fg);border-radius:15px;padding:14px 18px;font-weight:620;
463
+ text-align:center;letter-spacing:-.012em;box-shadow:0 2px 10px -2px var(--sb-ring);
464
+ transition:filter .15s,transform .18s var(--sb-spring)}
465
+ .btn:hover{filter:brightness(1.08);transform:translateY(-1px)}
264
466
  .btn:active{transform:translateY(1px)}
265
- .btn.gh{background:none;color:var(--sb-m);font-weight:500}
266
- .btn.gh:hover{background:var(--sb-s);filter:none}
267
- .stars{display:flex;justify-content:center;gap:7px;margin:10px 0}
268
- .stars button{color:var(--sb-b);padding:4px;transition:transform .12s,color .12s}
269
- .stars button:hover{transform:scale(1.14)}
467
+ .btn.gh{background:none;color:var(--sb-m);font-weight:520;box-shadow:none}
468
+ .btn.gh:hover{background:var(--sb-s);filter:none;transform:none}
469
+
470
+ .stars{display:flex;justify-content:center;gap:8px;margin:14px 0 6px}
471
+ .stars button{color:var(--sb-b);padding:4px;transition:transform .22s var(--sb-spring),color .18s}
472
+ .stars button:hover{transform:scale(1.2) rotate(-6deg)}
270
473
  .stars button.on{color:#f5a524}
271
474
  .stars button.on svg{fill:currentColor}
272
- .ok{text-align:center;padding:34px 22px;color:var(--sb-t)}
273
- .ok .rv{margin-top:20px;color:var(--sb-m)}
274
- .notice{margin:10px 16px;padding:10px 13px;font-size:12.5px;color:var(--sb-m);background:var(--sb-s);border:1px solid var(--sb-b);
275
- border-radius:11px;text-align:center}
276
- .notice button{color:var(--sb-c);font-weight:600;margin-left:6px}
277
- `;function a(s,e,...t){let i=document.createElement(s);if(e)for(let n in e){let r=e[n];r==null||r===false||(n==="class"?i.className=String(r):n==="style"?i.setAttribute("style",String(r)):n.startsWith("on")&&typeof r=="function"?i.addEventListener(n.slice(2).toLowerCase(),r):n==="html"?i.innerHTML=String(r):n in i&&n!=="list"&&n!=="form"?i[n]=r:i.setAttribute(n,String(r)));}return be(i,t),i}function be(s,e){for(let t of e)t==null||t===false||s.appendChild(typeof t=="object"?t:document.createTextNode(String(t)));}function C(s){for(;s.firstChild;)s.removeChild(s.firstChild);}function v(s,e=18){let t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("width",String(e)),t.setAttribute("height",String(e)),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","2"),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round"),t.innerHTML=ve[s],t}function K(s=26){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("viewBox","10 2 28 38"),e.setAttribute("width",String(s)),e.setAttribute("height",String(s)),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linejoin","round"),e.setAttribute("aria-hidden","true"),e.innerHTML='<path d="M16 16 L30 16 L33 18 L24 33 L15 18 Z" fill="currentColor" fill-opacity=".18" stroke="none"/><path d="M23 4 L31 9 L23 14 L16 9 Z" fill="currentColor" fill-opacity=".28" stroke="none"/><path d="M30 16 L33 18 L36 27 L34 34 L41 32 L44 38 L31 37 L24 37 L17 35 L13 27 L15 18 L16 16"/><path d="M16 16 L16 9 L23 4 L31 9 L30 16"/><path d="M21.4 12.4 L23.2 18.6 L25 12.4 Z" fill="currentColor" fill-opacity=".35"/><circle cx="28.4" cy="11.4" r="1.6" fill="currentColor" stroke="none"/>',e}var ve={chat:'<path d="M21 11.5a8.4 8.4 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.4 8.4 0 0 1-3.8-.9L3 21l1.9-5.7a8.4 8.4 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.4 8.4 0 0 1 3.8-.9h.5a8.5 8.5 0 0 1 8 8v.5z"/>',close:'<path d="M18 6 6 18M6 6l12 12"/>',send:'<path d="m22 2-7 20-4-9-9-4 20-7z"/><path d="M22 2 11 13"/>',clip:'<path d="m21.4 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"/>',file:'<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><path d="M14 2v6h6"/>',check:'<path d="M20 6 9 17l-5-5"/>',checks:'<path d="M18 6 7 17l-4-4"/><path d="m22 10-7.5 7.5L13 16"/>',reply:'<path d="M9 17H5a2 2 0 0 1-2-2V9"/><path d="m3 9 4-4"/><path d="m3 9 4 4"/><path d="M9 17h6a6 6 0 0 0 0-12h-2"/>',more:'<circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/>',star:'<path d="m12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/>',chevron:'<path d="m6 9 6 6 6-6"/>',smile:'<circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><path d="M9 9h.01M15 9h.01"/>',done:'<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><path d="m22 4-10 10-3-3"/>'};function ee(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(0)} KB`:`${(s/1024/1024).toFixed(1)} MB`}function te(){return typeof crypto!="undefined"&&"randomUUID"in crypto?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{let e=Math.random()*16|0;return (s==="x"?e:e&3|8).toString(16)})}var ie=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F62E}","\u{1F622}","\u{1F64F}"],ye=900*1e3;function ae(s,e){let t=s.scrollHeight-s.scrollTop-s.clientHeight<40,i=s.scrollHeight;C(s),e.greeting&&e.messages.length===0&&s.appendChild(a("div",{class:"gr"},e.greeting));let n="",r=null;for(let o of e.messages){let l=Ce(o.created_at);l!==n&&(s.appendChild(a("div",{class:"day"},Te(o.created_at,e))),n=l,r=null),s.appendChild(xe(o,e,r)),r=o;}(t||i===0)&&(s.scrollTop=s.scrollHeight);}function U(s){s.scrollTop=s.scrollHeight;}function xe(s,e,t){var f;let i=s.sender_type==="visitor"?"v":s.sender_type==="system"?"s":"a",n=t&&t.sender_type!==s.sender_type,r=a("div",{class:`row ${i}${n?" gap":""}${s._pending?" pend":""}${s._failed?" fail":""}`,"data-id":s.id}),o=a("div",{class:`bb${s.deleted_at?" del":""}`});if(s.deleted_at)return o.textContent=e.t.deleted,r.appendChild(o),r;if(s.reply_to_id){let c=e.find(s.reply_to_id),u=c?c.sender_type==="visitor"?e.t.you:c.sender_name||e.agentName:"";o.appendChild(a("span",{class:"q"},u?`${u}: `:"",c?I(c,e.t):"\u2026"));}let l=s.attachments||[],d=l.filter(c=>ne(c.mime)),h=l.filter(c=>!ne(c.mime));if(s._files&&s._files.length){let c=a("div",{class:"imgs"});for(let u of s._files)u.type.startsWith("image/")?c.appendChild(a("img",{src:URL.createObjectURL(u),alt:u.name})):o.appendChild(se({name:u.name,url:"",mime:u.type,size:u.size},e));c.childNodes.length&&o.appendChild(c);}if(d.length){let c=a("div",{class:"imgs"});for(let u of d)c.appendChild(a("img",{src:u.url,alt:u.name,loading:"lazy",onclick:()=>e.actions.openImage(u.url)}));o.appendChild(c);}for(let c of h)o.appendChild(se(c,e));let g=(i==="v"?null:(f=s.translation)==null?void 0:f.body)||s.body;g&&o.appendChild(document.createTextNode(g)),s._failed&&(o.appendChild(a("div",{style:"font-size:11px;margin-top:4px"},e.t.failed)),o.addEventListener("click",()=>e.actions.retry(s))),r.appendChild(o);let p=s.reactions&&Object.keys(s.reactions).length?s.reactions:null;if(p){let c=a("div",{class:"rx"});for(let u in p){let b=p[u]||[];if(!b.length)continue;let x=b.includes("visitor");c.appendChild(a("button",{class:x?"me":"",type:"button",onclick:()=>e.actions.react(s,u)},`${u} ${b.length}`));}c.childNodes.length&&r.appendChild(c);}if(i!=="s"){let c=a("div",{class:"mt"},Le(s.created_at,e.locale));if(s.edited_at&&c.appendChild(a("span",{class:"ed"},`\xB7 ${e.t.edited}`)),i==="v"&&!s._failed){let u=a("span",{class:`tk${s.read_at?" rd":""}`});u.appendChild(s._pending?v("check",12):s.read_at||s.delivered_at?v("checks",13):v("check",12)),s._pending&&(u.style.opacity=".4"),c.appendChild(u);}r.appendChild(c);}return i!=="s"&&!s._pending&&!s._failed&&(r.appendChild(we(s,e,r)),ke(r)),r}function we(s,e,t){let i=a("div",{class:"ac"});for(let l of ie.slice(0,3))i.appendChild(a("button",{type:"button",title:e.t.react,onclick:()=>e.actions.react(s,l)},l));i.appendChild(a("button",{type:"button",title:e.t.reply,onclick:()=>e.actions.reply(s)},v("reply",15)));let n=a("div",{class:"menu"});for(let l of ie.slice(3))n.appendChild(a("button",{type:"button",onclick:()=>{n.classList.remove("show"),e.actions.react(s,l);}},`${l} ${e.t.react}`));return s.sender_type==="visitor"&&Date.now()-Date.parse(s.created_at)<ye&&(n.appendChild(a("button",{type:"button",onclick:()=>{n.classList.remove("show"),e.actions.edit(s);}},e.t.edit)),n.appendChild(a("button",{type:"button",class:"dg",onclick:()=>{n.classList.remove("show"),e.actions.remove(s);}},e.t.delete))),i.appendChild(a("button",{type:"button",title:e.t.react,onclick:l=>{l.stopPropagation(),n.classList.toggle("show"),n.style.top=`${t.offsetHeight+4}px`;}},v("more",15))),t.appendChild(n),document.addEventListener("click",()=>n.classList.remove("show"),{once:true,capture:true}),i}function ke(s){let e=null,t=()=>{e=setTimeout(()=>{s.classList.add("acts");let n=r=>{s.contains(r.target)||(s.classList.remove("acts"),document.removeEventListener("touchstart",n,true));};document.addEventListener("touchstart",n,true);},450);},i=()=>e&&clearTimeout(e);s.addEventListener("touchstart",t,{passive:true}),s.addEventListener("touchend",i),s.addEventListener("touchmove",i,{passive:true});}function se(s,e){return a("a",{class:"fr",href:s.url||void 0,target:"_blank",rel:"noopener"},v("file",18),a("span",{class:"fn"},s.name||e.t.attachment),a("span",{class:"fs"},ee(s.size||0)))}function I(s,e){var n,r;if(s.deleted_at)return e.deleted;let t=(s.sender_type==="visitor"?null:(n=s.translation)==null?void 0:n.body)||s.body;if(t)return t.length>90?t.slice(0,90)+"\u2026":t;let i=(r=s.attachments)==null?void 0:r[0];return i?`\u{1F4CE} ${i.name}`:"\u2026"}function ne(s){return !!s&&s.startsWith("image/")}function Ce(s){let e=new Date(s);return `${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`}function Te(s,e){let t=new Date(s),i=new Date,n=Math.round((re(i)-re(t))/864e5);if(n===0)return e.t.today;if(n===1)return e.t.yesterday;try{return new Intl.DateTimeFormat(e.locale,{day:"numeric",month:"long",year:t.getFullYear()!==i.getFullYear()?"numeric":void 0}).format(t)}catch(r){return t.toLocaleDateString()}}function re(s){return new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime()}function Le(s,e){let t=new Date(s);try{return new Intl.DateTimeFormat(e,{hour:"2-digit",minute:"2-digit"}).format(t)}catch(i){return t.toLocaleTimeString()}}var Ee={launcher:"Sohbet",title:"Sohbet",online:"\xC7evrimi\xE7i",offline:"Genelde birka\xE7 dakika i\xE7inde yan\u0131tl\u0131yoruz",greeting:"Merhaba! Size nas\u0131l yard\u0131mc\u0131 olabiliriz?",offlineMessage:"\u015Eu an \xE7evrimd\u0131\u015F\u0131y\u0131z. Mesaj\u0131n\u0131z\u0131 b\u0131rak\u0131n, en k\u0131sa s\xFCrede d\xF6nelim.",prechatTitle:"Ba\u015Flamadan \xF6nce",prechatHint:"Size geri d\xF6nebilmemiz i\xE7in bilgilerinizi b\u0131rak\u0131n.",topicLabel:"Konu",topicPlaceholder:"Konu se\xE7in (iste\u011Fe ba\u011Fl\u0131)",name:"Ad\u0131n\u0131z",email:"E-posta",start:"Sohbete ba\u015Fla",skip:"Atla",placeholder:"Mesaj\u0131n\u0131z\u0131 yaz\u0131n\u2026",send:"G\xF6nder",attach:"Dosya ekle",typing:"yaz\u0131yor\u2026",today:"Bug\xFCn",yesterday:"D\xFCn",reply:"Yan\u0131tla",react:"Tepki ver",edit:"D\xFCzenle",delete:"Sil",deleted:"Bu mesaj silindi",edited:"d\xFCzenlendi",save:"Kaydet",cancel:"Vazge\xE7",you:"Siz",agent:"Destek",system:"Sistem",endChat:"Sohbeti bitir",newChat:"Yeni sohbet",resolved:"Bu sohbet \xE7\xF6z\xFCld\xFC olarak i\u015Faretlendi.",closed:"Bu sohbet kapat\u0131ld\u0131.",rateTitle:"Bu sohbeti nas\u0131l buldunuz?",rateComment:"Eklemek istedi\u011Finiz bir \u015Fey var m\u0131? (iste\u011Fe ba\u011Fl\u0131)",rateSend:"G\xF6nder",rateThanks:"Te\u015Fekk\xFCrler! Geri bildiriminiz al\u0131nd\u0131.",reviewIntro:"Yard\u0131mc\u0131 olabildiysek bizi yorumlar m\u0131s\u0131n\u0131z?",reviewCta:"De\u011Ferlendir",failed:"G\xF6nderilemedi \u2014 tekrar dene",fileTooLarge:"Dosya \xE7ok b\xFCy\xFCk (en fazla {mb} MB)",fileNotAllowed:"Yaln\u0131zca foto\u011Fraf y\xFCkleyebilirsiniz",unavailable:"Sohbet \u015Fu an kullan\u0131lam\u0131yor. L\xFCtfen daha sonra tekrar deneyin.",close:"Kapat",dismiss:"Sohbet balonunu gizle",minimize:"K\xFC\xE7\xFClt",unreadTitle:"({n}) Yeni mesaj",dropHere:"Dosyay\u0131 buraya b\u0131rak\u0131n",replyingTo:"Yan\u0131tlan\u0131yor",attachment:"Ek",poweredBy:"Signalbird ile",resize:"Boyutland\u0131r"},Me={launcher:"Chat",title:"Chat",online:"Online",offline:"We usually reply within a few minutes",greeting:"Hi there! How can we help you?",offlineMessage:"We're offline right now. Leave a message and we'll get back to you.",prechatTitle:"Before we start",prechatHint:"Leave your details so we can get back to you.",topicLabel:"Topic",topicPlaceholder:"Pick a topic (optional)",name:"Your name",email:"Email",start:"Start chat",skip:"Skip",placeholder:"Type your message\u2026",send:"Send",attach:"Attach file",typing:"is typing\u2026",today:"Today",yesterday:"Yesterday",reply:"Reply",react:"React",edit:"Edit",delete:"Delete",deleted:"This message was deleted",edited:"edited",save:"Save",cancel:"Cancel",you:"You",agent:"Support",system:"System",endChat:"End chat",newChat:"New chat",resolved:"This conversation was marked as resolved.",closed:"This conversation was closed.",rateTitle:"How was this conversation?",rateComment:"Anything to add? (optional)",rateSend:"Send",rateThanks:"Thanks! Your feedback was received.",reviewIntro:"If we were helpful, would you leave us a review?",reviewCta:"Leave a review",failed:"Not sent \u2014 tap to retry",fileTooLarge:"File is too large (max {mb} MB)",fileNotAllowed:"Only photos can be uploaded",unavailable:"Chat is unavailable right now. Please try again later.",close:"Close",dismiss:"Hide the chat bubble",minimize:"Minimize",unreadTitle:"({n}) New message",dropHere:"Drop the file here",replyingTo:"Replying to",attachment:"Attachment",poweredBy:"Powered by Signalbird",resize:"Resize"};function F(s,e){let t=n=>n&&n!=="auto"?n.toLowerCase().slice(0,2):null;return (t(e)||t(s)||t(typeof navigator!="undefined"?navigator.language:null)||"en")==="tr"?"tr":"en"}function j(s){return s==="tr"?Ee:Me}function P(s,e){return s.replace(/\{(\w+)\}/g,(t,i)=>{var n;return String((n=e[i])!=null?n:"")})}var Se=/^image\/(jpeg|png|gif|webp)$/,O=class{constructor(e){this.o=e;this.list=null;this.typingEl=null;this.textarea=null;this.chips=null;this.replyBar=null;this.notice=null;this.files=[];this.replyTo=null;this.editing=null;this.view="none";this.typingTimer=null;this.wasTyping=false;var d;let t=e.t;this.host=a("div",{id:"signalbird-widget"}),this.root=this.host.attachShadow({mode:"open"}),this.root.appendChild(a("style",null,Q));let i=e.settings.position==="left"?"left":"right",n=e.settings.layout==="sidebar"?" sidebar":"";if(this.wrap=a("div",{class:`sb ${i}${n}${Ae(e.settings.theme)?" dark":""}`,style:`--sb-c:${Re(e.settings.color)}`}),e.settings.theme==="auto"&&typeof matchMedia=="function"){let h=matchMedia("(prefers-color-scheme: dark)");(d=h.addEventListener)==null||d.call(h,"change",g=>this.wrap.classList.toggle("dark",g.matches));}this.badge=a("span",{class:"badge",style:"display:none"});let r=e.settings.launcher_text;this.launcher=a("button",{class:`ln${r?"":" icon-only"}`,type:"button","aria-label":r||t.launcher,onclick:()=>e.actions.open()},this.launcherMark(),r?a("span",{class:"lt"},r):null,this.badge),this.dismissBtn=a("button",{class:"dm",type:"button",title:t.dismiss,"aria-label":t.dismiss,onclick:h=>{h.stopPropagation(),e.actions.dismiss();}},v("close",12)),this.headerAvatar=a("div",{class:"av"},this.brandAvatar()),this.headerName=a("div",{class:"hn"},e.appName||t.title),this.headerDot=a("span",{class:"dot"}),this.headerStatus=a("div",{class:"hs"},this.headerDot,a("span",null,t.offline)),this.endBtn=a("button",{class:"hb",type:"button",title:t.endChat,style:"display:none",onclick:()=>e.actions.endChat()},v("done",18));let o=a("div",{class:"hd"},this.headerAvatar,a("div",{class:"hi"},this.headerName,this.headerStatus),this.endBtn,a("button",{class:"hb",type:"button",title:t.close,"aria-label":t.close,onclick:()=>e.actions.close()},v("close",20)));this.banner=a("div",{class:"bn",style:"display:none"}),this.body=a("div",{class:"bd"}),this.grip=a("div",{class:"gp",title:t.resize,"aria-hidden":"true"}),this.panel=a("div",{class:"pn",role:"dialog","aria-label":t.title},a("div",{class:"br"}),o,this.banner,this.body,this.grip),e.settings.layout!=="sidebar"&&(this.restoreGeometry(),this.enableMove(o),this.enableResize()),this.wrap.appendChild(this.launcher),this.wrap.appendChild(this.dismissBtn),this.wrap.appendChild(this.panel),this.root.appendChild(this.wrap);let l=0;this.body.addEventListener("dragenter",h=>{h.preventDefault(),l++,this.body.classList.add("dragging");}),this.body.addEventListener("dragover",h=>h.preventDefault()),this.body.addEventListener("dragleave",()=>{--l<=0&&(l=0,this.body.classList.remove("dragging"));}),this.body.addEventListener("drop",h=>{var g;h.preventDefault(),l=0,this.body.classList.remove("dragging"),this.view==="chat"&&((g=h.dataTransfer)!=null&&g.files)&&this.addFiles(Array.from(h.dataTransfer.files));});}mount(){this.host.isConnected||document.body.appendChild(this.host);}unmount(){this.host.remove();}setDismissed(e){this.wrap.classList.toggle("hidden",e);}setLauncherHidden(e){this.wrap.classList.toggle("no-ln",e);}setOpen(e){this.wrap.classList.toggle("open",e),e&&this.list&&requestAnimationFrame(()=>{var t;this.list&&U(this.list),(t=this.textarea)==null||t.focus();});}setUnread(e){this.badge.textContent=e>99?"99+":String(e),this.badge.style.display=e>0?"flex":"none";}attention(){let e=this.launcher;e.classList.remove("sb-attn"),e.offsetWidth,e.classList.add("sb-attn"),window.setTimeout(()=>e.classList.remove("sb-attn"),2400);}setHeader(e,t){var o;let i=this.o.t,n=(e==null?void 0:e.name)||this.o.appName||i.title;this.headerName.textContent=n,C(this.headerAvatar),e!=null&&e.avatar?this.headerAvatar.appendChild(a("img",{src:e.avatar,alt:""})):this.headerAvatar.appendChild(e?document.createTextNode(oe(n)):this.brandAvatar());let r=(o=e==null?void 0:e.online)!=null?o:t;this.headerDot.classList.toggle("on",r),this.headerStatus.lastChild.textContent=r?i.online:i.offline;}setBanner(e,t=false){this.banner.textContent=e||"",this.banner.className=`bn${t?" err":""}`,this.banner.style.display=e?"block":"none";}setEndVisible(e){this.endBtn.style.display=e?"flex":"none";}showPrechat(e){let t=this.o.t,i=this.o.settings.prechat||{name:true,email:true,required:false};this.view="prechat",this.list=null,this.textarea=null,C(this.body);let n=a("input",{type:"text",placeholder:t.name,value:e.name||"",autocomplete:"name"}),r=a("input",{type:"email",placeholder:t.email,value:e.email||"",autocomplete:"email"}),o=this.o.topics||[],l=o.length?a("select",{"aria-label":t.topicLabel},a("option",{value:""},t.topicPlaceholder),...o.map(g=>a("option",{value:g.slug},g.name))):null,d=()=>{let g=n.value.trim(),p=r.value.trim();if(i.required&&(i.name&&!g||i.email&&!p)){(i.name&&!g?n:r).focus();return}if(p&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p)){r.focus();return}this.o.actions.submitPrechat(g,p,(l==null?void 0:l.value)||null);},h=a("form",{class:"fm",onsubmit:g=>{g.preventDefault(),d();}},a("h3",null,t.prechatTitle),a("p",null,this.o.settings.greeting||t.prechatHint),i.name?n:null,i.email?r:null,l,a("button",{class:"btn",type:"submit"},t.start),i.required?null:a("button",{class:"btn gh",type:"button",onclick:()=>this.o.actions.skipPrechat((l==null?void 0:l.value)||null)},t.skip));this.body.appendChild(h),setTimeout(()=>(i.name?n:r).focus(),50);}showChat(){if(this.view==="chat"&&this.list)return;let e=this.o.t;this.view="chat",C(this.body),this.list=a("div",{class:"ml"}),this.notice=a("div",{class:"notice",style:"display:none"}),this.typingEl=a("div",{class:"tp"},a("i"),a("i"),a("i"),a("span",{style:"margin-left:4px"},"")),this.replyBar=a("div",{class:"rq",style:"display:none"}),this.chips=a("div",{class:"chips",style:"display:none"}),this.textarea=a("textarea",{rows:1,placeholder:e.placeholder,"aria-label":e.placeholder,onkeydown:n=>{n.key==="Enter"&&!n.shiftKey&&!n.isComposing?(n.preventDefault(),this.submit()):n.key==="Escape"&&(this.editing?this.cancelEdit():this.replyTo&&this.setReply(null));},oninput:()=>{this.autosize(),this.notifyTyping();},onpaste:n=>{var o;let r=Array.from(((o=n.clipboardData)==null?void 0:o.files)||[]);r.length&&(n.preventDefault(),this.addFiles(r));}});let t=a("input",{type:"file",multiple:true,style:"display:none",accept:"image/jpeg,image/png,image/gif,image/webp",onchange:()=>{this.addFiles(Array.from(t.files||[])),t.value="";}}),i=a("div",{class:"cp"},this.replyBar,this.chips,a("div",{class:"cr"},a("button",{class:"cb",type:"button",title:e.attach,"aria-label":e.attach,onclick:()=>t.click()},v("clip",19)),this.textarea,a("button",{class:"cb sd",type:"button",title:e.send,"aria-label":e.send,onclick:()=>this.submit()},v("send",17))),t,a("div",{class:"pw"},a("a",{href:"https://signalbird.io",target:"_blank",rel:"noopener",title:e.poweredBy},a("span",{class:"pk"},K(13)),a("span",{class:"pn2"},"Signalbird"))));this.body.appendChild(this.list),this.body.appendChild(this.notice),this.body.appendChild(this.typingEl),this.body.appendChild(i),this.body.appendChild(a("div",{class:"drop"},e.dropHere));}showRating(){let e=this.o.t;this.view="rating",this.list=null,this.textarea=null,C(this.body);let t=0,i=[],n=()=>i.forEach((d,h)=>d.classList.toggle("on",h<t)),r=a("div",{class:"stars"});for(let d=1;d<=5;d++){let h=a("button",{type:"button","aria-label":String(d),onclick:()=>{t=d,n();}},v("star",30));i.push(h),r.appendChild(h);}let o=a("textarea",{placeholder:e.rateComment}),l=a("form",{class:"fm",onsubmit:d=>{d.preventDefault(),this.o.actions.rate(t,o.value.trim());}},a("h3",{style:"text-align:center"},e.rateTitle),r,o,a("button",{class:"btn",type:"submit"},e.rateSend),a("button",{class:"btn gh",type:"button",onclick:()=>this.o.actions.rate(0,"")},e.skip));this.body.appendChild(l);}showThanks(e){this.view="none",this.list=null,C(this.body);let t=a("div",{class:"ok"},a("p",null,this.o.t.rateThanks));e!=null&&e.url&&(t.appendChild(a("p",{class:"rv"},this.o.t.reviewIntro)),t.appendChild(a("a",{class:"btn",href:e.url,target:"_blank",rel:"noopener noreferrer",style:"margin-top:10px;display:inline-flex;text-decoration:none"},e.label||this.o.t.reviewCta))),t.appendChild(a("button",{class:"btn gh",type:"button",style:"margin-top:10px",onclick:()=>this.o.actions.newChat()},this.o.t.newChat)),this.body.appendChild(t);}get currentView(){return this.view}render(e){this.list&&ae(this.list,{...e,t:this.o.t,locale:this.o.locale,actions:this.o.actions});}setTyping(e,t){this.typingEl&&(this.typingEl.classList.toggle("on",e),this.typingEl.lastChild.textContent=`${t} ${this.o.t.typing}`,e&&this.list&&U(this.list));}setNotice(e,t){if(this.notice){if(C(this.notice),!e){this.notice.style.display="none";return}this.notice.appendChild(document.createTextNode(e)),t&&this.notice.appendChild(a("button",{type:"button",onclick:t.fn},t.label)),this.notice.style.display="block";}}setReply(e){var i;if(this.replyTo=e,!this.replyBar)return;if(C(this.replyBar),!e){this.replyBar.style.display="none";return}let t=e.sender_type==="visitor"?this.o.t.you:e.sender_name||this.o.t.agent;this.replyBar.appendChild(a("span",{class:"rt"},`${this.o.t.replyingTo} ${t}: ${I(e,this.o.t)}`)),this.replyBar.appendChild(a("button",{type:"button",onclick:()=>this.setReply(null)},v("close",14))),this.replyBar.style.display="flex",(i=this.textarea)==null||i.focus();}startEdit(e){this.textarea&&(this.editing=e,this.setReply(null),this.textarea.value=e.body||"",this.autosize(),this.textarea.focus(),this.replyBar&&(C(this.replyBar),this.replyBar.appendChild(a("span",{class:"rt"},`${this.o.t.edit}: ${I(e,this.o.t)}`)),this.replyBar.appendChild(a("button",{type:"button",onclick:()=>this.cancelEdit()},v("close",14))),this.replyBar.style.display="flex"));}cancelEdit(){this.editing=null,this.textarea&&(this.textarea.value="",this.autosize()),this.replyBar&&(C(this.replyBar),this.replyBar.style.display="none");}submit(){if(!this.textarea)return;let e=this.textarea.value.trim();if(this.editing){let n=this.editing;this.cancelEdit(),e&&e!==n.body&&this.o.actions.saveEdit(n,e);return}if(!e&&this.files.length===0)return;let t=this.files,i=this.replyTo;this.files=[],this.renderChips(),this.setReply(null),this.textarea.value="",this.autosize(),this.stopTyping(),this.o.actions.send(e,t,i),this.textarea.focus();}addFiles(e){let t=this.o.maxMb*1024*1024;for(let i of e){if(i.size>t){this.flash(P(this.o.t.fileTooLarge,{mb:this.o.maxMb}));continue}if(i.type&&!Se.test(i.type)){this.flash(this.o.t.fileNotAllowed);continue}if(this.files.length>=5)break;this.files.push(i);}this.renderChips();}renderChips(){this.chips&&(C(this.chips),this.chips.style.display=this.files.length?"flex":"none",this.files.forEach((e,t)=>{let i=a("div",{class:"chip"},e.type.startsWith("image/")?a("img",{src:URL.createObjectURL(e),alt:""}):v("file",16),a("span",null,e.name),a("button",{type:"button",onclick:()=>{this.files.splice(t,1),this.renderChips();}},v("close",12)));this.chips.appendChild(i);}));}launcherMark(){let e=this.o.settings,t=de(e.logo_url);return e.launcher_icon==="logo"&&t?a("img",{class:"lg",src:t,alt:""}):e.launcher_icon==="chat"?v("chat",24):K(26)}brandAvatar(){let e=de(this.o.settings.logo_url);return e?a("img",{src:e,alt:""}):document.createTextNode(oe(this.o.appName))}restoreGeometry(){let e=_e();e&&(e.w&&(this.panel.style.width=`${e.w}px`),e.h&&(this.panel.style.height=`${e.h}px`),this.wrap.style.setProperty("--sb-dx",`${e.dx||0}px`),this.wrap.style.setProperty("--sb-dy",`${e.dy||0}px`));}saveGeometry(){ze({w:this.panel.offsetWidth,h:this.panel.offsetHeight,dx:parseFloat(this.wrap.style.getPropertyValue("--sb-dx"))||0,dy:parseFloat(this.wrap.style.getPropertyValue("--sb-dy"))||0});}enableMove(e){e.addEventListener("pointerdown",t=>{if(t.button!==0||le()||t.target.closest("button"))return;let i=t.clientX,n=t.clientY,r=parseFloat(this.wrap.style.getPropertyValue("--sb-dx"))||0,o=parseFloat(this.wrap.style.getPropertyValue("--sb-dy"))||0,l=this.wrap.classList.contains("left")?-1:1,d=false,h=p=>{let f=p.clientX-i,c=p.clientY-n;if(!d&&Math.abs(f)+Math.abs(c)<4)return;d=true,this.wrap.classList.add("moving");let u=Math.max(0,innerWidth-this.panel.offsetWidth-24),b=Math.max(0,innerHeight-this.panel.offsetHeight-24);this.wrap.style.setProperty("--sb-dx",`${H(r-f*l,0,u)}px`),this.wrap.style.setProperty("--sb-dy",`${H(o-c,0,b)}px`);},g=()=>{removeEventListener("pointermove",h),removeEventListener("pointerup",g),this.wrap.classList.remove("moving"),d&&this.saveGeometry();};addEventListener("pointermove",h),addEventListener("pointerup",g);});}enableResize(){this.grip.addEventListener("pointerdown",e=>{if(e.button!==0||le())return;e.preventDefault();let t=e.clientX,i=e.clientY,n=this.panel.offsetWidth,r=this.panel.offsetHeight,o=this.wrap.classList.contains("left")?-1:1;this.wrap.classList.add("sizing");let l=h=>{this.panel.style.width=`${H(n+(t-h.clientX)*o,320,innerWidth-40)}px`,this.panel.style.height=`${H(r+(i-h.clientY),380,innerHeight-40)}px`;},d=()=>{removeEventListener("pointermove",l),removeEventListener("pointerup",d),this.wrap.classList.remove("sizing"),this.saveGeometry();};addEventListener("pointermove",l),addEventListener("pointerup",d);});}flash(e){this.setBanner(e,true),setTimeout(()=>this.setBanner(null),3e3);}autosize(){let e=this.textarea;e&&(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,120)}px`);}notifyTyping(){this.wasTyping||(this.wasTyping=true,this.o.actions.typing(true)),this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=setTimeout(()=>this.stopTyping(),2500);}stopTyping(){this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=null,this.wasTyping&&(this.wasTyping=false,this.o.actions.typing(false));}};function oe(s){return (s||"?").split(/\s+/).slice(0,2).map(e=>e[0]||"").join("").toUpperCase()}var pe="sb_geometry";function _e(){try{let s=localStorage.getItem(pe);if(!s)return null;let e=JSON.parse(s);return !e||e.w>innerWidth||e.h>innerHeight?null:e}catch(s){return null}}function ze(s){try{localStorage.setItem(pe,JSON.stringify(s));}catch(e){}}function H(s,e,t){return Math.min(Math.max(s,e),t)}function le(){return innerWidth<=640}function Ae(s){return s==="dark"?true:s!=="auto"||typeof matchMedia!="function"?false:matchMedia("(prefers-color-scheme: dark)").matches}function de(s){return typeof s=="string"&&/^(https:\/\/|data:image\/)/i.test(s)?s:null}function Re(s){return s&&/^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%]+\)|hsla?\([\d\s.,%]+\))$/i.test(s)?s:"#111827"}var $=class{constructor(){this.original=null;this.timer=null;this.label="";}update(e,t){e>0&&document.hidden?(this.label=t(e),this.begin()):this.end();}begin(){if(this.timer)return;this.original=document.title;let e=false;this.timer=setInterval(()=>{if(!document.hidden)return this.end();e=!e,document.title=e?this.label:this.original||"";},1200);}end(){this.timer&&clearInterval(this.timer),this.timer=null,this.original!==null&&(document.title=this.original,this.original=null);}};var M=null;function Y(){try{let s=window.AudioContext||window.webkitAudioContext;if(!s)return;M||(M=new s),M.state==="suspended"&&M.resume();let e=M.currentTime,t=M.createGain();t.gain.setValueAtTime(1e-4,e),t.gain.exponentialRampToValueAtTime(.12,e+.02),t.gain.exponentialRampToValueAtTime(1e-4,e+.35),t.connect(M.destination);let i=M.createOscillator();i.type="sine",i.frequency.setValueAtTime(880,e),i.frequency.setValueAtTime(1175,e+.12),i.connect(t),i.start(e),i.stop(e+.36);}catch(s){}}var Ie="https://live.signalbird.io/api",k="/v1/sdk/chat/conversations",N=class{constructor(e){this.opts=e;this.title=new $;this.topic=null;this.ui=null;this.settings=null;this.appName="";this.started=false;this.destroyed=false;this.pendingSends=new Map;this.ratingMode=null;this.autoOpened=false;this.identity=null;this.lastTypingSent=0;this.pollCount=0;this.forceFull=false;this.socket=null;this.onVisibility=()=>{this.syncUnread(),!document.hidden&&this.store.isOpen&&this.store.conversation&&this.markRead();};this.baseUrl=(e.baseUrl||Ie).replace(/\/$/,""),this.store=new z(e.publicKey),this.api=new _(this.baseUrl,e.publicKey,e.chatKey,()=>this.store.secret,(...t)=>this.log(...t)),this.poller=new A(()=>this.tick()),this.identity=e.user&&(e.user.name||e.user.email||e.user.external_id)?e.user:null,this.locale=F(null,e.locale),this.t=j(this.locale),this.ready=this.start().catch(t=>this.log("start failed",t));}log(...e){this.opts.debug&&console.debug("[signalbird]",...e);}async start(){var g;let e=await this.api.post("/v1/sdk/bootstrap",{page_url:location.href,locale:this.opts.locale});if(!e.ok||!((g=e.data)!=null&&g.app)){this.log("bootstrap failed",e);return}if(this.destroyed)return;let{app:t,online:i,within_hours:n,visitor:r,conversation:o,topics:l,realtime:d}=e.data;if(!t.chat_enabled){this.log("chat disabled for app");return}this.settings=t.chat||{},this.appName=t.name||"",this.locale=F(this.settings.locale,this.opts.locale),this.t=j(this.locale),this.store.visitor&&!r&&this.store.clearVisitor(),r&&this.store.setVisitor({id:r.id,name:r.name,email:r.email}),this.store.online=!!i,this.store.withinHours=n!==false,o&&this.store.setConversation(o);let h=Number(this.settings.max_attachment_mb||t.max_attachment_mb||10);this.ui=new O({t:this.t,locale:this.locale,settings:this.settings,appName:this.appName,maxMb:h,topics:l||[],actions:{open:()=>this.open(),close:()=>this.close(),send:(p,f,c)=>{this.send(p,f,c);},typing:p=>{this.typing(p);},submitPrechat:(p,f,c)=>{this.submitPrechat(p,f,c);},skipPrechat:p=>{this.topic=p,this.enterChat();},rate:(p,f)=>{this.rate(p,f);},dismiss:()=>this.dismiss(),endChat:()=>this.endChat(),newChat:()=>this.newChat(),saveEdit:(p,f)=>{this.saveEdit(p,f);},reply:p=>{var f;return (f=this.ui)==null?void 0:f.setReply(p)},react:(p,f)=>{this.react(p,f);},edit:p=>{var f;return (f=this.ui)==null?void 0:f.startEdit(p)},remove:p=>{this.remove(p);},retry:p=>{this.retry(p);},openImage:p=>window.open(p,"_blank","noopener")}}),this.store.on("unread",()=>this.syncUnread()),this.store.on("messages",()=>this.render()),this.store.on("change",()=>this.render()),document.addEventListener("visibilitychange",this.onVisibility),this.ui.mount(),this.ui.setDismissed(this.store.dismissed),this.syncLauncher(),this.ui.setHeader(this.store.agent,this.store.online),this.applyBanner(),this.store.setUnread((r==null?void 0:r.unread)||(o==null?void 0:o.visitor_unread)||0),this.syncUnread(),this.started=true,this.poller.start(),d!=null&&d.enabled&&(this.socket=new R(d,(p,f)=>this.authorizeChannel(p,f),p=>this.onSocketEvent(p),p=>{this.log("socket",p?"connected":"disconnected"),this.poller.setLive(p),p&&this.poller.poke(0);},(...p)=>this.log(...p)),this.socket.connect(),this.subscribeVisitor()),this.opts.user&&this.identify(this.opts.user);}applyBanner(){!this.ui||!this.settings||this.ui.setBanner(this.store.withinHours?null:this.settings.offline_message||this.t.offlineMessage);}syncUnread(){var t;let e=this.store.isOpen&&!document.hidden?0:this.store.unread;(t=this.ui)==null||t.setUnread(this.store.unread),this.title.update(e,i=>P(this.t.unreadTitle,{n:i})),this.store.emit("public:unread",this.store.unread),this.syncLauncher();}syncLauncher(){var i;if(!this.ui)return;if(((i=this.settings)==null?void 0:i.launcher_mode)!=="manual"){this.ui.setLauncherHidden(false);return}let e=this.store.conversation,t=!!e&&e.status!=="closed";this.ui.setLauncherHidden(!(this.store.isOpen||t||this.store.unread>0));}dismiss(){var e;this.store.setDismissed(true),this.close(),(e=this.ui)==null||e.setDismissed(true);}open(){var e,t;this.store.dismissed&&(this.store.setDismissed(false),(e=this.ui)==null||e.setDismissed(false)),!(!this.ui||this.store.isOpen)&&(((t=this.store.conversation)==null?void 0:t.status)==="closed"&&(this.store.setConversation(null),this.ratingMode=null),this.store.isOpen=true,this.ui.setOpen(true),this.syncLauncher(),this.poller.setOpen(true),this.decideView(),this.store.emit("public:open"),this.store.conversation?this.loadConversation():this.store.setUnread(0),this.syncUnread());}close(){if(!this.ui||!this.store.isOpen)return;let e=this.store.conversation;if(e&&e.status==="resolved"&&!this.store.wasRated(e.id)&&this.ui.currentView==="chat"&&this.store.messages.some(t=>t.sender_type==="agent")){this.ratingMode="resolved",this.ui.setEndVisible(false),this.ui.showRating();return}this.store.isOpen=false,this.ui.setOpen(false),this.poller.setOpen(false),this.typing(false),this.store.emit("public:close"),this.syncUnread(),this.syncLauncher();}toggle(){this.store.isOpen?this.close():this.open();}isOpen(){return this.store.isOpen}on(e,t){this.store.on(`public:${e}`,t);}off(e,t){this.store.off(`public:${e}`,t);}async identify(e){var r;if(await this.ready,this.destroyed)return;this.identity={...this.identity||{},...e},((r=this.ui)==null?void 0:r.currentView)==="prechat"&&this.enterChat();let[t,...i]=(e.name||"").trim().split(/\s+/),n={external_id:e.external_id,email:e.email,phone:e.phone,first_name:t||void 0,last_name:i.join(" ")||void 0,attributes:e.attributes};e.external_id&&this.check(await this.api.post("/v1/sdk/identify",n)),await this.session({name:e.name,email:e.email,external_id:e.external_id});}async pushRegister(e){return await this.ready,this.api.post("/v1/sdk/devices",{provider:e.platform==="ios"?"apns":"fcm",locale:this.locale,...e})}destroy(){var e,t;this.destroyed=true,(e=this.socket)==null||e.close(),this.socket=null,this.poller.stop(),this.title.end(),document.removeEventListener("visibilitychange",this.onVisibility),(t=this.ui)==null||t.unmount(),this.ui=null;}decideView(){var r,o;if(!this.ui||!this.settings)return;let e=this.settings.prechat,t=this.store.visitor;!!!((r=this.identity)!=null&&r.name||(o=this.identity)!=null&&o.email||t!=null&&t.name||t!=null&&t.email)&&!this.store.conversation&&e&&(e.name||e.email)?this.ui.showPrechat({}):this.enterChat();}enterChat(){var e;this.ui&&(this.ratingMode=null,this.ui.showChat(),this.ui.setEndVisible(((e=this.store.conversation)==null?void 0:e.status)==="open"),this.render());}render(){var t,i;if(!this.ui||this.ui.currentView!=="chat")return;let e=this.store.conversation;this.ui.render({messages:this.store.messages,greeting:((t=this.settings)==null?void 0:t.greeting)||this.t.greeting,agentName:((i=this.store.agent)==null?void 0:i.name)||this.t.agent,find:n=>this.store.find(n)}),this.ui.setEndVisible((e==null?void 0:e.status)==="open"),e&&e.status!=="open"?this.ui.setNotice(e.status==="resolved"?this.t.resolved:this.t.closed,{label:this.t.newChat,fn:()=>this.newChat()}):this.ui.setNotice(null);}async submitPrechat(e,t,i){var r;this.topic=i,await this.session({name:e||void 0,email:t||void 0})?this.enterChat():(r=this.ui)==null||r.setBanner(this.t.unavailable,true);}newChat(){this.ratingMode=null,this.store.setConversation(null),this.enterChat(),this.store.isOpen||this.open();}endChat(){!this.ui||!this.store.conversation||(this.ratingMode="end",this.ui.setEndVisible(false),this.ui.showRating());}async rate(e,t){var r;let i=this.store.conversation,n=this.ratingMode;if(this.ratingMode=null,!(!i||!this.ui)){if(e>0){let o=await this.api.post(`${k}/${i.id}/rate`,{rating:e,comment:t||void 0});this.check(o),this.store.markRated(i.id);}if(n==="end"){let o=await this.api.post(`${k}/${i.id}/close`);this.check(o),((r=this.store.conversation)==null?void 0:r.id)===i.id&&this.store.setConversation({...i,status:"closed"}),this.ui.showThanks(this.reviewFor(e));return}e===0&&this.store.markRated(i.id),this.enterChat(),this.close();}}reviewFor(e){var n,r,o,l;let t=(((n=this.settings)==null?void 0:n.review_url)||"").trim(),i=Number((o=(r=this.settings)==null?void 0:r.review_min_rating)!=null?o:3);return !t||!/^https?:\/\//i.test(t)?null:e>0&&e>=i?{url:t,label:((l=this.settings)==null?void 0:l.review_label)||null}:null}async session(e={}){var n;let t=this.identity?{name:this.identity.name,email:this.identity.email,external_id:this.identity.external_id}:{},i=await this.api.post("/v1/sdk/chat/session",{...t,...e,locale:this.locale,page_url:location.href,user_agent:navigator.userAgent});if(i.ok&&((n=i.data)!=null&&n.visitor)){let r=i.data.visitor;return !r.secret&&!this.store.visitor?(this.log("session returned no secret"),false):(this.store.setVisitor(r),this.subscribeVisitor(),true)}return !i.ok&&i.code==="VISITOR_INVALID"&&this.store.visitor?(this.store.clearVisitor(),this.session(e)):(this.check(i),false)}subscribeVisitor(){var t;let e=(t=this.store.visitor)==null?void 0:t.id;this.socket&&e&&this.socket.subscribe(`visitor.${e}`);}async authorizeChannel(e,t){var n;let i=await this.api.post("/v1/sdk/chat/socket/auth",{socket_id:e,channel:t});return i.ok&&((n=i.data)!=null&&n.auth)?{auth:i.data.auth,at:i.data.at}:null}onSocketEvent(e){var t,i;if(e.name==="chat.typing"){e.data.who==="agent"&&(this.store.agentTyping=e.data.active===true,(i=this.ui)==null||i.setTyping(this.store.agentTyping,((t=this.store.agent)==null?void 0:t.name)||this.t.agent));return}e.data.updated===true&&(this.forceFull=true),this.poller.poke(0);}async loadConversation(){let e=this.store.conversation;if(!e)return;let t=await this.api.get(`${k}/${e.id}`,{limit:50});this.applyPayload(t,true)&&this.store.isOpen&&!document.hidden&&this.store.setUnread(0);}applyPayload(e,t){var n,r,o,l;if(!e.ok)return this.check(e),e.status===404&&this.store.setConversation(null),-1;let i=e.data;if(i.conversation){let d=(n=this.store.conversation)==null?void 0:n.status;this.store.conversation=i.conversation,d!==i.conversation.status&&this.store.emit("change");}return i.agent!==void 0&&(this.store.agent=i.agent||null),this.store.agentTyping=!!i.agent_typing,(r=this.ui)==null||r.setHeader(this.store.agent,this.store.online),(l=this.ui)==null||l.setTyping(this.store.agentTyping,((o=this.store.agent)==null?void 0:o.name)||this.t.agent),this.store.mergeMessages(i.messages||[],t)}async tick(){var d,h,g,p;if(!this.started||!this.store.visitor)return false;this.pollCount++;let e=this.store.conversation;if(this.store.isOpen&&e){let f=this.pollCount%5===0||this.forceFull;this.forceFull=false;let c=f?void 0:this.store.lastServerMessageId||void 0,u=await this.api.get(`${k}/${e.id}`,c?{after:c}:{limit:50}),b=this.applyPayload(u,!c);return b>0&&(document.hidden?(this.store.setUnread(this.store.unread+b),(d=this.settings)!=null&&d.sound&&Y()):this.markRead()),b>0}if(this.store.isOpen&&!e&&this.pollCount%10!==0)return false;let t=await this.api.get(k);if(!t.ok)return this.check(t),false;let i=t.data,n=Array.isArray(i)?i:(i==null?void 0:i.conversations)||(i==null?void 0:i.data)||[],r=n.find(f=>f.status==="open")||null,o=n.reduce((f,c)=>f+(c.visitor_unread||0),0),l=o>this.store.unread;return r&&r.id!==((h=this.store.conversation)==null?void 0:h.id)&&(this.store.setConversation(r),this.store.isOpen&&this.loadConversation()),(!this.store.isOpen||document.hidden)&&(this.store.setUnread(o),l&&((g=this.settings)!=null&&g.sound&&Y(),(p=this.ui)==null||p.attention(),!this.autoOpened&&!document.hidden&&(this.autoOpened=true,this.open()))),l}async markRead(){let e=this.store.conversation,t=this.store.lastServerMessageId;!e||!t||(this.store.setUnread(0),await this.api.post(`${k}/${e.id}/read`,{last_message_id:t},true));}async send(e,t,i,n=te()){var l;let r={id:`local_${n}`,client_id:n,sender_type:"visitor",type:t.length?t[0].type.startsWith("image/")?"image":"file":"text",body:e||null,attachments:null,reply_to_id:(i==null?void 0:i.id)||null,created_at:new Date().toISOString(),_pending:true,_files:t};this.pendingSends.set(n,{text:e,files:t,replyTo:(i==null?void 0:i.id)||null}),this.store.upsertMessage(r);let o=()=>{let d=this.store.find(r.id);d&&this.store.upsertMessage({...d,_pending:false,_failed:true});};try{if(!this.store.visitor&&!await this.session())return o();let d=this.store.conversation,h=!d||d.status!=="open";if(h&&t.length===0){let c=await this.api.post(k,{body:e,page_url:location.href,client_id:n,...this.topic?{topic:this.topic}:{}});if(!c.ok)return this.sendFailed(c,o);this.store.setConversation(c.data.conversation),this.store.mergeMessages(c.data.messages||[]),this.reconcile(r,c.data.messages),this.pendingSends.delete(n),this.poller.poke(3e3);return}if(h){let c=await this.api.post(k,{page_url:location.href,...this.topic?{topic:this.topic}:{}});if(!c.ok)return this.sendFailed(c,o);this.store.setConversation(c.data.conversation),this.store.mergeMessages(c.data.messages||[]),d=c.data.conversation;}if(!d)return o();let g=[];for(let c of t){let u=await this.api.upload(`${k}/${d.id}/attachments`,c);if(!u.ok)return this.sendFailed(u,o);g.push(u.data);}let p=await this.api.post(`${k}/${d.id}/messages`,{body:e||void 0,attachments:g.length?g:void 0,reply_to_id:(i==null?void 0:i.id)||void 0,client_id:n});if(!p.ok)return this.sendFailed(p,o);let f=((l=p.data)==null?void 0:l.message)||p.data;this.reconcile(r,[f]),this.pendingSends.delete(n),this.poller.poke(3e3);}catch(d){this.log("send error",d),o();}}reconcile(e,t){let i=(t||[]).find(n=>n.client_id===e.client_id);i?this.store.mergeMessages([{...i,client_id:e.client_id}]):t&&t.length&&(this.store.removeMessage(e.id),this.store.mergeMessages(t));}sendFailed(e,t){var i;this.check(e),(e.code==="CHAT_UNAVAILABLE"||e.status===503)&&((i=this.ui)==null||i.setBanner(this.t.unavailable,true)),t();}async retry(e){let t=e.client_id?this.pendingSends.get(e.client_id):null;this.store.removeMessage(e.id),!(!t||!e.client_id)&&await this.send(t.text,t.files,this.store.find(t.replyTo)||null,e.client_id);}async typing(e){let t=this.store.conversation;if(!t||t.status!=="open"||!this.store.visitor)return;let i=Date.now();e&&i-this.lastTypingSent<4e3||(this.lastTypingSent=e?i:0,await this.api.post(`${k}/${t.id}/typing`,{is_typing:e},true));}async react(e,t){var h,g,p,f;let i=this.store.conversation;if(!i)return;let n={...e.reactions||{}},r=[...n[t]||[]],o=r.indexOf("visitor");o>=0?r.splice(o,1):r.push("visitor"),n[t]=r,this.store.upsertMessage({...e,reactions:n});let l=await this.api.post(`${k}/${i.id}/messages/${e.id}/reactions`,{emoji:t});if(!l.ok){this.check(l),this.store.upsertMessage({...e});return}let d=(f=(g=(h=l.data)==null?void 0:h.message)==null?void 0:g.reactions)!=null?f:(p=l.data)==null?void 0:p.reactions;d&&this.store.upsertMessage({...e,reactions:d});}async saveEdit(e,t){var o;let i=this.store.conversation;if(!i)return;this.store.upsertMessage({...e,body:t,edited_at:new Date().toISOString()});let n=await this.api.patch(`${k}/${i.id}/messages/${e.id}`,{body:t});if(!n.ok){this.check(n),this.store.upsertMessage({...e});return}let r=((o=n.data)==null?void 0:o.message)||n.data;r&&r.id&&this.store.upsertMessage(r);}async remove(e){let t=this.store.conversation;if(!t)return;this.store.upsertMessage({...e,deleted_at:new Date().toISOString()});let i=await this.api.delete(`${k}/${t.id}/messages/${e.id}`);i.ok||(this.check(i),this.store.upsertMessage({...e}));}check(e){e.ok||(e.code==="VISITOR_INVALID"||e.status===401&&this.store.visitor)&&(this.store.clearVisitor(),this.store.isOpen&&this.decideView());}};var Pe={tr:{loading:"Y\xFCkleniyor\u2026",failed:"Ekran y\xFCklenemedi.",expired:"Bu ba\u011Flant\u0131n\u0131n s\xFCresi doldu.",retry:"Yeniden dene"},en:{loading:"Loading\u2026",failed:"The screen could not be loaded.",expired:"This link has expired.",retry:"Try again"}};function He(s){if(s==="light"||s==="dark")return s;if(typeof document!="undefined"){let e=document.documentElement;if(e.classList.contains("dark")||e.dataset.theme==="dark")return "dark";if(e.classList.contains("light")||e.dataset.theme==="light")return "light"}return typeof window!="undefined"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Oe(s){if(typeof s=="string")return s||null;if(s&&typeof s=="object"){let e=s;if(typeof e.url=="string")return e.url;if(e.data&&typeof e.data.url=="string")return e.data.url}return null}function ce(s){var f,c;let e=Pe[(f=s.language)!=null?f:"tr"],t=new Map,i=null,n=null,r=null,o=(c=s.theme)!=null?c:"auto",l=false,d=(u,b)=>{var x;(x=t.get(u))==null||x.forEach(w=>{try{w(b);}catch(E){console.warn("[signalbird]",E);}});},h=()=>{r&&(window.removeEventListener("message",r),r=null),n=null,i&&(i.textContent="");},g=(u,b)=>{var E;if(!i)return;i.textContent="";let x=document.createElement("div");x.setAttribute("data-signalbird-status",""),x.style.cssText=`display:flex;align-items:center;justify-content:center;gap:12px;min-height:${(E=s.minHeight)!=null?E:220}px;font:13px/1.5 system-ui,-apple-system,sans-serif;color:#6b7280;text-align:center;padding:24px;`;let w=document.createElement("span");if(w.textContent=u,x.appendChild(w),b){let y=document.createElement("button");y.type="button",y.textContent=e.retry,y.style.cssText="border:1px solid currentColor;border-radius:8px;background:transparent;color:inherit;padding:4px 10px;font:inherit;cursor:pointer;",y.addEventListener("click",()=>{p();}),x.appendChild(y);}i.appendChild(x);},p=async()=>{var E;if(!i||l)return;h(),g(e.loading,false);let u=He(o),b=null;try{s.url?(b=s.url,s={...s,url:void 0}):s.mint&&(b=Oe(await s.mint({module:s.module,theme:u,locale:s.locale})));}catch(y){d("error",y),g(y instanceof Error?y.message:e.failed,true);return}if(!b){d("error",new Error("EMBED_URL_MISSING")),g(e.expired,!!s.mint);return}let x=b;try{let y=new URL(b);y.searchParams.set("theme",u),s.locale&&y.searchParams.set("locale",s.locale),s.accent&&y.searchParams.set("accent",s.accent.replace(/^#/,"")),x=y.toString();}catch(y){}let w=document.createElement("iframe");w.src=x,w.title="Signalbird",w.style.cssText="width:100%;border:0;display:block;",w.style.height=`${typeof s.height=="number"?s.height:(E=s.minHeight)!=null?E:640}px`,w.setAttribute("allow","clipboard-write; fullscreen; autoplay"),w.setAttribute("sandbox","allow-same-origin allow-scripts allow-forms allow-popups allow-downloads"),w.setAttribute("referrerpolicy","strict-origin-when-cross-origin"),w.setAttribute("loading","lazy"),s.className&&(w.className=s.className),i.textContent="",i.appendChild(w),n=w,r=y=>{var W,G;if(!n||y.source!==n.contentWindow)return;let L=y.data;if(!(!L||typeof L.type!="string")){if(L.type==="signalbird:ready"){d("ready",L.module);return}if(L.type==="signalbird:height"&&typeof L.px=="number"&&(d("height",L.px),((W=s.height)!=null?W:"auto")==="auto")){let ue=Math.max(L.px,(G=s.minHeight)!=null?G:220);n.style.height=`${ue}px`;}}},window.addEventListener("message",r);};return {async mount(u){let b=typeof u=="string"?document.querySelector(u):u;if(!(b instanceof HTMLElement))throw new Error("Signalbird: g\xF6mme kab\u0131 bulunamad\u0131 \u2014 "+String(u));i=b,l=false,await p();},refresh:()=>p(),async setTheme(u){o=u,await p();},destroy(){l=true,h(),t.clear(),i=null;},on(u,b){t.has(u)||t.set(u,new Set),t.get(u).add(b);},off(u,b){var x;(x=t.get(u))==null||x.delete(b);}}}var ut="2.1.1",m=null,B=[],S=null;function T(s,e){try{return s()}catch(t){try{console.warn("[signalbird]",t);}catch(i){}return e}}function he(s){s.catch(()=>{});}function $e(s){T(()=>{if(!s||!s.publicKey){console.warn("[signalbird] init: publicKey zorunlu");return}if(!(typeof document=="undefined"||typeof window=="undefined")){m&&m.destroy(),m=new N(s);for(let{event:e,fn:t}of B)m.on(e,t);if(S){let e=S;S=null,he(m.identify(e));}}},void 0);}function gt(s){T(()=>{if(s){if(!m){S={...S||{},...s};return}he(m.identify(s));}},void 0);}var ft={open(){T(()=>m==null?void 0:m.open(),void 0);},close(){T(()=>m==null?void 0:m.close(),void 0);},toggle(){T(()=>m==null?void 0:m.toggle(),void 0);},isOpen(){return T(()=>!!(m!=null&&m.isOpen()),false)},on(s,e){T(()=>{typeof e=="function"&&(B.push({event:s,fn:e}),m==null||m.on(s,e));},void 0);},off(s,e){T(()=>{let t=B.findIndex(i=>i.event===s&&i.fn===e);t>=0&&B.splice(t,1),m==null||m.off(s,e);},void 0);}},mt={register(s){return T(()=>m?m.pushRegister(s).catch(e=>({ok:!1,status:0,code:"NETWORK_ERROR",message:String(e)})):Promise.resolve({ok:!1,status:0,code:"NOT_INITIALIZED",message:"Signalbird.init \xE7a\u011Fr\u0131lmad\u0131"}),Promise.resolve({ok:false,status:0,code:"WIDGET_ERROR",message:"widget error"}))}},bt=ce;function vt(){T(()=>{m==null||m.destroy(),m=null;},void 0);}T(()=>{if(typeof document=="undefined")return;let s=document.currentScript||document.querySelector('script[data-key][src*="signalbird"]'),e=s==null?void 0:s.dataset;if(!e||!e.key)return;let t=()=>$e({publicKey:e.key,chatKey:e.channel||void 0,baseUrl:e.baseUrl||void 0,locale:e.locale||void 0,debug:e.debug==="true"||e.debug==="1"});document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0});},void 0);
278
- exports.chat=ft;exports.destroy=vt;exports.embed=bt;exports.identify=gt;exports.init=$e;exports.push=mt;exports.version=ut;return exports;})({});
475
+ .rl{text-align:center;font-size:13px;color:var(--sb-m);min-height:20px}
476
+
477
+ .ok{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;
478
+ padding:30px 24px;gap:8px}
479
+ .ok .ic{width:64px;height:64px;border-radius:50%;background:var(--sb-tint);color:var(--sb-c);
480
+ display:flex;align-items:center;justify-content:center;margin-bottom:8px;animation:sbPop .5s var(--sb-spring)}
481
+ .ok h3{margin:0;font-size:19px;font-weight:660;letter-spacing:-.02em}
482
+ .ok p{margin:0;color:var(--sb-m);font-size:13.5px;line-height:1.55}
483
+ .ok .btn{margin-top:14px;text-decoration:none;display:inline-flex;justify-content:center}
484
+
485
+ .notice{margin:0 16px 10px;padding:11px 14px;font-size:12.5px;color:var(--sb-m);background:var(--sb-el);
486
+ border:1px solid var(--sb-b);border-radius:14px;text-align:center;display:none}
487
+ .notice.on{display:block}
488
+ .notice button{color:var(--sb-c);font-weight:650;margin-left:6px}
489
+ `;function a(s,e,...t){let i=document.createElement(s);if(e)for(let n in e){let r=e[n];r==null||r===false||(n==="class"?i.className=String(r):n==="style"?i.setAttribute("style",String(r)):n.startsWith("on")&&typeof r=="function"?i.addEventListener(n.slice(2).toLowerCase(),r):n==="html"?i.innerHTML=String(r):n in i&&n!=="list"&&n!=="form"?i[n]=r:i.setAttribute(n,String(r)));}return _e(i,t),i}function _e(s,e){for(let t of e)t==null||t===false||s.appendChild(typeof t=="object"?t:document.createTextNode(String(t)));}function k(s){for(;s.firstChild;)s.removeChild(s.firstChild);}function y(s,e=18){let t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("width",String(e)),t.setAttribute("height",String(e)),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","2"),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round"),t.innerHTML=ze[s],t}function W(s=26){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("viewBox","10 2 28 38"),e.setAttribute("width",String(s)),e.setAttribute("height",String(s)),e.setAttribute("fill","none"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e.setAttribute("stroke-linejoin","round"),e.setAttribute("aria-hidden","true"),e.innerHTML='<path d="M16 16 L30 16 L33 18 L24 33 L15 18 Z" fill="currentColor" fill-opacity=".18" stroke="none"/><path d="M23 4 L31 9 L23 14 L16 9 Z" fill="currentColor" fill-opacity=".28" stroke="none"/><path d="M30 16 L33 18 L36 27 L34 34 L41 32 L44 38 L31 37 L24 37 L17 35 L13 27 L15 18 L16 16"/><path d="M16 16 L16 9 L23 4 L31 9 L30 16"/><path d="M21.4 12.4 L23.2 18.6 L25 12.4 Z" fill="currentColor" fill-opacity=".35"/><circle cx="28.4" cy="11.4" r="1.6" fill="currentColor" stroke="none"/>',e}var ze={chat:'<path d="M21 11.5a8.4 8.4 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.4 8.4 0 0 1-3.8-.9L3 21l1.9-5.7a8.4 8.4 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.4 8.4 0 0 1 3.8-.9h.5a8.5 8.5 0 0 1 8 8v.5z"/>',close:'<path d="M18 6 6 18M6 6l12 12"/>',send:'<path d="m22 2-7 20-4-9-9-4 20-7z"/><path d="M22 2 11 13"/>',clip:'<path d="m21.4 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"/>',file:'<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><path d="M14 2v6h6"/>',check:'<path d="M20 6 9 17l-5-5"/>',checks:'<path d="M18 6 7 17l-4-4"/><path d="m22 10-7.5 7.5L13 16"/>',reply:'<path d="M9 17H5a2 2 0 0 1-2-2V9"/><path d="m3 9 4-4"/><path d="m3 9 4 4"/><path d="M9 17h6a6 6 0 0 0 0-12h-2"/>',more:'<circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/>',star:'<path d="m12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/>',chevron:'<path d="m6 9 6 6 6-6"/>',smile:'<circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><path d="M9 9h.01M15 9h.01"/>',done:'<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><path d="m22 4-10 10-3-3"/>',down:'<path d="M12 5v14"/><path d="m19 12-7 7-7-7"/>',image:'<rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="9" cy="9" r="1.5"/><path d="m21 15-4.5-4.5L9 18"/>',heart:'<path d="M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.7l-1-1.1a5.5 5.5 0 0 0-7.8 7.8l1.1 1L12 21l7.7-7.6 1.1-1a5.5 5.5 0 0 0 0-7.8z"/>'};function B(s){return (s||"?").trim().split(/\s+/).slice(0,2).map(e=>e[0]||"").join("").toUpperCase()}function C(s,e){let t=A(s);return t?a("img",{src:t,alt:"",loading:"lazy"}):document.createTextNode(B(e))}function A(s){return typeof s=="string"&&/^(https:\/\/|data:image\/)/i.test(s)?s:null}function oe(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(0)} KB`:`${(s/1024/1024).toFixed(1)} MB`}function le(){return typeof crypto!="undefined"&&"randomUUID"in crypto?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{let e=Math.random()*16|0;return (s==="x"?e:e&3|8).toString(16)})}var de=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F62E}","\u{1F622}","\u{1F64F}"],ge=["\u{1F600}","\u{1F604}","\u{1F60A}","\u{1F642}","\u{1F609}","\u{1F60D}","\u{1F929}","\u{1F60E}","\u{1F914}","\u{1F610}","\u{1F615}","\u{1F641}","\u{1F622}","\u{1F62D}","\u{1F621}","\u{1F92F}","\u{1F44D}","\u{1F44E}","\u{1F44F}","\u{1F64F}","\u{1F4AA}","\u{1F525}","\u2705","\u2764\uFE0F"],Ae=900*1e3,Re=300*1e3;function be(s,e){let t=O(s),i=s.childNodes.length===0,n=Pe(s);if(k(s),e.messages.length===0){s.appendChild(je(e));return}let r="";for(let o=0;o<e.messages.length;o++){let l=e.messages[o],d=J(l.created_at),c=d===r&&e.messages[o-1]||null,h=e.messages[o+1]||null;d!==r&&(s.appendChild(a("div",{class:"day"},$e(l.created_at,e))),r=d),s.appendChild(Ne(l,e,c,He(l,h)?h:null,!i&&!n.has(l.id)));}(t||i)&&z(s);}function O(s,e=60){return s.scrollHeight-s.scrollTop-s.clientHeight<e}function z(s,e=false){if(e&&typeof s.scrollTo=="function"){s.scrollTo({top:s.scrollHeight,behavior:"smooth"});return}s.scrollTop=s.scrollHeight;}function Pe(s){let e=new Set;return s.querySelectorAll("[data-id]").forEach(t=>{let i=t.dataset.id;i&&e.add(i);}),e}function je(s){let e=a("div",{class:"hero"});e.appendChild(a("div",{class:"hv"},a("span",null,C(s.agentAvatar,s.brandName||s.agentName)))),e.appendChild(a("h4",null,s.greeting||s.t.greeting)),s.responseHint&&e.appendChild(a("p",null,s.responseHint));let t=s.quick||[];if(t.length&&s.onQuick){let i=a("div",{class:"qk"});for(let n of t.slice(0,6))i.appendChild(a("button",{type:"button",onclick:()=>s.onQuick(n)},n));e.appendChild(i);}return e}function Ne(s,e,t,i,n){var x;let r=s.sender_type==="visitor"?"v":s.sender_type==="system"?"s":"a",o=!pe(t,s),l=!pe(s,i),d=a("div",{class:`row ${r}`+(o&&t?" gap":"")+(l?"":" mid")+(s._pending?" pend":"")+(s._failed?" fail":"")+(n?" new":""),"data-id":s.id});if(r==="s")return d.appendChild(a("div",{class:"bb"},s.body||"")),d;r==="a"&&d.appendChild(a("div",{class:`av${l?"":" gh"}`},C(e.agentAvatar,s.sender_name||e.agentName)));let c=a("div",{class:"cl"}),h=a("div",{class:`bb${s.deleted_at?" del":""}`});if(s.deleted_at)return h.textContent=e.t.deleted,c.appendChild(h),d.appendChild(c),d;if(s.reply_to_id){let b=e.find(s.reply_to_id),g=b?b.sender_type==="visitor"?e.t.you:b.sender_name||e.agentName:"";h.appendChild(a("span",{class:"q"},g?`${g}: `:"",b?$(b,e.t):"\u2026"));}if(s._files&&s._files.length){let b=a("div",{class:"imgs"});for(let g of s._files)g.type.startsWith("image/")?b.appendChild(a("img",{src:URL.createObjectURL(g),alt:g.name})):h.appendChild(ce({name:g.name,url:"",mime:g.type,size:g.size},e));b.childNodes.length&&h.appendChild(b);}let p=s.attachments||[],u=p.filter(b=>he(b.mime));if(u.length){let b=a("div",{class:"imgs"});for(let g of u)b.appendChild(a("img",{src:g.url,alt:g.name,loading:"lazy",onclick:()=>e.actions.openImage(g.url)}));h.appendChild(b);}for(let b of p.filter(g=>!he(g.mime)))h.appendChild(ce(b,e));let m=(r==="v"?null:(x=s.translation)==null?void 0:x.body)||s.body;m&&h.appendChild(Oe(m)),s._failed&&(h.appendChild(a("div",{style:"font-size:11px;margin-top:5px;font-weight:600"},e.t.failed)),h.addEventListener("click",()=>e.actions.retry(s))),c.appendChild(h);let f=s.reactions&&Object.keys(s.reactions).length?s.reactions:null;if(f){let b=a("div",{class:"rx"});for(let g in f){let L=f[g]||[];if(!L.length)continue;let w=L.includes("visitor");b.appendChild(a("button",{class:w?"me":"",type:"button",onclick:()=>e.actions.react(s,g)},`${g} ${L.length}`));}b.childNodes.length&&c.appendChild(b);}if(l){let b=a("div",{class:"mt"},Ve(s.created_at,e.locale));if(s.edited_at&&b.appendChild(a("span",{class:"ed"},`\xB7 ${e.t.edited}`)),r==="v"&&!s._failed){let g=a("span",{class:`tk${s.read_at?" rd":""}`});g.appendChild(s._pending?y("check",12):s.read_at||s.delivered_at?y("checks",13):y("check",12)),s._pending&&(g.style.opacity=".4"),b.appendChild(g);}c.appendChild(b);}return d.appendChild(c),!s._pending&&!s._failed&&(d.appendChild(Ie(s,e,d)),Be(d)),d}function pe(s,e){if(!s||!e||s.sender_type!==e.sender_type||s.sender_type==="system"||s.sender_id!==e.sender_id)return false;let t=Date.parse(e.created_at)-Date.parse(s.created_at);return t>=0&&t<Re}function He(s,e){return !!e&&J(s.created_at)===J(e.created_at)}function Ie(s,e,t){let i=a("div",{class:"ac"});for(let o of de.slice(0,3))i.appendChild(a("button",{type:"button",title:e.t.react,onclick:()=>e.actions.react(s,o)},o));i.appendChild(a("button",{type:"button",title:e.t.reply,onclick:()=>e.actions.reply(s)},y("reply",15)));let n=a("div",{class:"menu"});for(let o of de.slice(3))n.appendChild(a("button",{type:"button",onclick:()=>{n.classList.remove("show"),e.actions.react(s,o);}},`${o} ${e.t.react}`));return s.sender_type==="visitor"&&Date.now()-Date.parse(s.created_at)<Ae&&(n.appendChild(a("button",{type:"button",onclick:()=>{n.classList.remove("show"),e.actions.edit(s);}},e.t.edit)),n.appendChild(a("button",{type:"button",class:"dg",onclick:()=>{n.classList.remove("show"),e.actions.remove(s);}},e.t.delete))),i.appendChild(a("button",{type:"button",title:e.t.react,onclick:o=>{o.stopPropagation(),n.classList.toggle("show"),n.style.top=`${t.offsetHeight+4}px`;}},y("more",15))),t.appendChild(n),document.addEventListener("click",()=>n.classList.remove("show"),{once:true,capture:true}),i}function Be(s){let e=null,t=()=>{e=setTimeout(()=>{var r;s.classList.add("acts");try{(r=navigator.vibrate)==null||r.call(navigator,8);}catch(o){}let n=o=>{s.contains(o.target)||(s.classList.remove("acts"),document.removeEventListener("touchstart",n,true));};document.addEventListener("touchstart",n,true);},420);},i=()=>e&&clearTimeout(e);s.addEventListener("touchstart",t,{passive:true}),s.addEventListener("touchend",i),s.addEventListener("touchmove",i,{passive:true});}function ce(s,e){return a("a",{class:"fr",href:s.url||void 0,target:"_blank",rel:"noopener"},y("file",18),a("span",{class:"fn"},s.name||e.t.attachment),a("span",{class:"fs"},oe(s.size||0)))}function Oe(s){let e=document.createDocumentFragment(),t=/(https?:\/\/[^\s<]+)/g,i=0,n;for(;n=t.exec(s);){n.index>i&&e.appendChild(document.createTextNode(s.slice(i,n.index)));let r=n[1].replace(/[.,;:!?)]+$/,"");e.appendChild(a("a",{href:r,target:"_blank",rel:"noopener noreferrer nofollow"},r)),i=n.index+r.length;}return i<s.length&&e.appendChild(document.createTextNode(s.slice(i))),e}function $(s,e){var n,r;if(s.deleted_at)return e.deleted;let t=(s.sender_type==="visitor"?null:(n=s.translation)==null?void 0:n.body)||s.body;if(t)return t.length>90?t.slice(0,90)+"\u2026":t;let i=(r=s.attachments)==null?void 0:r[0];return i?`\u{1F4CE} ${i.name}`:"\u2026"}function he(s){return !!s&&s.startsWith("image/")}function J(s){let e=new Date(s);return `${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`}function $e(s,e){let t=new Date(s),i=new Date,n=Math.round((ue(i)-ue(t))/864e5);if(n===0)return e.t.today;if(n===1)return e.t.yesterday;try{return new Intl.DateTimeFormat(e.locale,{day:"numeric",month:"long",year:t.getFullYear()!==i.getFullYear()?"numeric":void 0}).format(t)}catch(r){return t.toLocaleDateString()}}function ue(s){return new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime()}function Ve(s,e){let t=new Date(s);try{return new Intl.DateTimeFormat(e,{hour:"2-digit",minute:"2-digit"}).format(t)}catch(i){return t.toLocaleTimeString()}}var De={launcher:"Sohbet",title:"Sohbet",online:"\xC7evrimi\xE7i",offline:"Genelde birka\xE7 dakika i\xE7inde yan\u0131tl\u0131yoruz",greeting:"Merhaba! Size nas\u0131l yard\u0131mc\u0131 olabiliriz?",offlineMessage:"\u015Eu an \xE7evrimd\u0131\u015F\u0131y\u0131z. Mesaj\u0131n\u0131z\u0131 b\u0131rak\u0131n, en k\u0131sa s\xFCrede d\xF6nelim.",prechatTitle:"Ba\u015Flamadan \xF6nce",prechatHint:"Size geri d\xF6nebilmemiz i\xE7in bilgilerinizi b\u0131rak\u0131n.",topicLabel:"Konu",topicPlaceholder:"Konu se\xE7in (iste\u011Fe ba\u011Fl\u0131)",name:"Ad\u0131n\u0131z",email:"E-posta",start:"Sohbete ba\u015Fla",skip:"Atla",placeholder:"Mesaj\u0131n\u0131z\u0131 yaz\u0131n\u2026",send:"G\xF6nder",attach:"Dosya ekle",typing:"yaz\u0131yor\u2026",today:"Bug\xFCn",yesterday:"D\xFCn",reply:"Yan\u0131tla",react:"Tepki ver",edit:"D\xFCzenle",delete:"Sil",deleted:"Bu mesaj silindi",edited:"d\xFCzenlendi",save:"Kaydet",cancel:"Vazge\xE7",you:"Siz",agent:"Destek",system:"Sistem",endChat:"Sohbeti bitir",newChat:"Yeni sohbet",resolved:"Bu sohbet \xE7\xF6z\xFCld\xFC olarak i\u015Faretlendi.",closed:"Bu sohbet kapat\u0131ld\u0131.",rateTitle:"Bu sohbeti nas\u0131l buldunuz?",rateComment:"Eklemek istedi\u011Finiz bir \u015Fey var m\u0131? (iste\u011Fe ba\u011Fl\u0131)",rateSend:"G\xF6nder",rateThanks:"Geri bildiriminiz bize ula\u015Ft\u0131.",rateThanksTitle:"Te\u015Fekk\xFCrler!",rateScale:["Hi\xE7 iyi de\u011Fildi","Bekledi\u011Fim gibi olmad\u0131","\u0130dare eder","\u0130yiydi","Harikayd\u0131"],reviewIntro:"Yard\u0131mc\u0131 olabildiysek bizi yorumlar m\u0131s\u0131n\u0131z?",reviewCta:"De\u011Ferlendir",failed:"G\xF6nderilemedi \u2014 tekrar dene",fileTooLarge:"Dosya \xE7ok b\xFCy\xFCk (en fazla {mb} MB)",fileNotAllowed:"Bu dosya t\xFCr\xFCn\xFC y\xFCkleyemezsiniz",tooLong:"Mesaj en fazla {max} karakter olabilir",unavailable:"Sohbet \u015Fu an kullan\u0131lam\u0131yor. L\xFCtfen daha sonra tekrar deneyin.",close:"Kapat",dismiss:"Sohbet balonunu gizle",minimize:"K\xFC\xE7\xFClt",unreadTitle:"({n}) Yeni mesaj",dropHere:"Dosyay\u0131 buraya b\u0131rak\u0131n",replyingTo:"Yan\u0131tlan\u0131yor",attachment:"Ek",poweredBy:"Signalbird ile",resize:"Boyutland\u0131r",emoji:"Emoji ekle",jump:"En alta in",newMessage:"Yeni mesaj",replyFast:"\u015Eu an buraday\u0131z \u2014 genelde birka\xE7 dakika i\xE7inde yan\u0131tl\u0131yoruz."},Ke={launcher:"Chat",title:"Chat",online:"Online",offline:"We usually reply within a few minutes",greeting:"Hi there! How can we help you?",offlineMessage:"We're offline right now. Leave a message and we'll get back to you.",prechatTitle:"Before we start",prechatHint:"Leave your details so we can get back to you.",topicLabel:"Topic",topicPlaceholder:"Pick a topic (optional)",name:"Your name",email:"Email",start:"Start chat",skip:"Skip",placeholder:"Type your message\u2026",send:"Send",attach:"Attach file",typing:"is typing\u2026",today:"Today",yesterday:"Yesterday",reply:"Reply",react:"React",edit:"Edit",delete:"Delete",deleted:"This message was deleted",edited:"edited",save:"Save",cancel:"Cancel",you:"You",agent:"Support",system:"System",endChat:"End chat",newChat:"New chat",resolved:"This conversation was marked as resolved.",closed:"This conversation was closed.",rateTitle:"How was this conversation?",rateComment:"Anything to add? (optional)",rateSend:"Send",rateThanks:"Your feedback reached us.",rateThanksTitle:"Thank you!",rateScale:["Not good at all","Not what I expected","It was okay","Good","Excellent"],reviewIntro:"If we were helpful, would you leave us a review?",reviewCta:"Leave a review",failed:"Not sent \u2014 tap to retry",fileTooLarge:"File is too large (max {mb} MB)",fileNotAllowed:"That file type cannot be uploaded",tooLong:"A message may be at most {max} characters",unavailable:"Chat is unavailable right now. Please try again later.",close:"Close",dismiss:"Hide the chat bubble",minimize:"Minimize",unreadTitle:"({n}) New message",dropHere:"Drop the file here",replyingTo:"Replying to",attachment:"Attachment",poweredBy:"Powered by Signalbird",resize:"Resize",emoji:"Add emoji",jump:"Jump to latest",newMessage:"New message",replyFast:"We're here right now \u2014 we usually reply within a few minutes."};function X(s,e){let t=n=>n&&n!=="auto"?n.toLowerCase().slice(0,2):null;return (t(e)||t(s)||t(typeof navigator!="undefined"?navigator.language:null)||"en")==="tr"?"tr":"en"}function Z(s){return s==="tr"?De:Ke}function R(s,e){return s.replace(/\{(\w+)\}/g,(t,i)=>{var n;return String((n=e[i])!=null?n:"")})}var Fe=["image/jpeg","image/png","image/gif","image/webp"],Ue=420,Ye=60,qe=11e3,Ge=9e3,me="sb_teaser",fe="sb_seen",K=class{constructor(e){this.o=e;this.list=null;this.typingEl=null;this.typingAvatar=null;this.jumpBtn=null;this.textarea=null;this.sendBtn=null;this.emojiBox=null;this.chips=null;this.replyBar=null;this.notice=null;this.files=[];this.counter=null;this.replyTo=null;this.editing=null;this.view="none";this.agent=null;this.online=false;this.typingTimer=null;this.teaserTimer=null;this.toastTimer=null;this.attnTimer=null;this.wasTyping=false;this.scrollLock=0;this.locked=false;var l;let t=e.t;this.host=a("div",{id:"signalbird-widget"}),this.root=this.host.attachShadow({mode:"open"}),this.root.appendChild(a("style",null,ae));let i=e.settings.position==="left"?"left":"right",n=e.settings.layout==="sidebar"?" sidebar":"";if(this.wrap=a("div",{class:`sb ${i}${n}${Xe(e.settings.theme)?" dark":""}`,style:`--sb-c:${Ze(e.settings.color)}`}),e.settings.theme==="auto"&&typeof matchMedia=="function"){let d=matchMedia("(prefers-color-scheme: dark)");(l=d.addEventListener)==null||l.call(d,"change",c=>this.wrap.classList.toggle("dark",c.matches));}this.badge=a("span",{class:"badge"});let r=e.settings.launcher_text;this.launcher=a("button",{class:`ln${r?"":" icon-only"}`,type:"button","aria-label":r||t.launcher,onclick:()=>this.onLauncher()},a("span",{class:"lm"},this.launcherMark()),r?a("span",{class:"lt"},r):null,a("span",{class:"ln-on"}),a("span",{class:"ln-pulse"}),this.badge),this.dismissBtn=a("button",{class:"dm",type:"button",title:t.dismiss,"aria-label":t.dismiss,onclick:d=>{d.stopPropagation(),e.actions.dismiss();}},y("close",13)),this.teaser=this.buildTeaser(),this.toast=this.buildToast(),this.headerPhoto=a("div",{class:"ph"},this.brandAvatar()),this.headerDot=a("span",{class:"dot"}),this.headerName=a("div",{class:"hn"},e.appName||t.title),this.headerStatus=a("div",{class:"hs"},t.offline),this.endBtn=a("button",{class:"hb hide",type:"button",title:t.endChat,"aria-label":t.endChat,onclick:()=>e.actions.endChat()},y("done",19));let o=a("div",{class:"hd"},a("div",{class:"av"},this.headerPhoto,this.headerDot),a("div",{class:"hi"},this.headerName,this.headerStatus),a("div",{class:"ha"},this.endBtn,a("button",{class:"hb",type:"button",title:t.close,"aria-label":t.close,onclick:()=>e.actions.close()},y("close",20))));this.dragBar=a("div",{class:"drag","aria-hidden":"true"},a("i")),this.banner=a("div",{class:"bn"}),this.body=a("div",{class:"bd"}),this.grip=a("div",{class:"gp",title:t.resize,"aria-hidden":"true"}),this.panel=a("div",{class:"pn",role:"dialog","aria-modal":"false","aria-label":t.title},a("div",{class:"glow","aria-hidden":"true"}),this.dragBar,o,this.banner,this.body,this.grip),e.settings.layout!=="sidebar"&&(this.restoreGeometry(),this.enableMove(o),this.enableResize()),this.enableSwipeClose(),this.wrap.appendChild(this.launcher),this.wrap.appendChild(this.dismissBtn),this.wrap.appendChild(this.teaser),this.wrap.appendChild(this.toast),this.wrap.appendChild(this.panel),this.root.appendChild(this.wrap),this.enableDrop(),this.onKey=this.onKey.bind(this),this.onViewport=this.onViewport.bind(this);}key(e){return `${e}_${this.o.publicKey}`}mount(){this.host.isConnected||document.body.appendChild(this.host),document.addEventListener("keydown",this.onKey),this.scheduleTeaser();}unmount(){var e;this.clearTimers(),this.unlockScroll(),document.removeEventListener("keydown",this.onKey),(e=D())==null||e.removeEventListener("resize",this.onViewport),this.host.remove();}setDismissed(e){this.wrap.classList.toggle("hidden",e),e&&this.hideTeaser(false);}setLauncherHidden(e){this.wrap.classList.toggle("no-ln",e),e&&this.hideTeaser(false);}setOpen(e){var t;this.wrap.classList.toggle("open",e),e?(ye(this.key(fe)),this.hideTeaser(false),this.hideToast(),this.lockScroll(),this.bindViewport(),requestAnimationFrame(()=>{var i;this.list&&z(this.list),S()||(i=this.textarea)==null||i.focus();})):(this.unlockScroll(),(t=D())==null||t.removeEventListener("resize",this.onViewport),this.wrap.style.setProperty("--sb-kb","0px"),this.wrap.classList.remove("kb"),this.hideEmoji());}setUnread(e){this.badge.textContent=e>99?"99+":String(e),this.badge.classList.toggle("on",e>0),this.wrap.classList.toggle("pulse",e>0),e===0&&this.hideToast();}attention(e){let t=this.launcher;t.classList.remove("attn"),t.offsetWidth,t.classList.add("attn"),this.attnTimer&&clearTimeout(this.attnTimer),this.attnTimer=setTimeout(()=>t.classList.remove("attn"),2400),e&&(e.body||e.name)&&this.showToast(e);}setHeader(e,t){var r;let i=this.o.t;this.agent=e,this.online=(r=e==null?void 0:e.online)!=null?r:t;let n=(e==null?void 0:e.name)||this.o.appName||i.title;this.headerName.textContent=n,k(this.headerPhoto),this.headerPhoto.appendChild(e?C(e.avatar,n):this.brandAvatar()),this.headerDot.classList.toggle("on",this.online),this.headerStatus.textContent=this.online?i.online:i.offline,this.wrap.classList.toggle("agent-on",this.online),this.typingAvatar&&(k(this.typingAvatar),this.typingAvatar.appendChild(C(e==null?void 0:e.avatar,n)));}setBanner(e,t=false){k(this.banner),this.banner.className=`bn${t?" err":""}${e?" on":""}`,e&&(this.banner.appendChild(y(t?"close":"chat",15)),this.banner.appendChild(a("span",null,e)));}setEndVisible(e){this.endBtn.classList.toggle("hide",!e);}get currentView(){return this.view}showPrechat(e){let t=this.o.t,i=this.o.settings.prechat||{name:true,email:true,required:false};this.view="prechat",this.list=null,this.textarea=null,k(this.body);let n=ve("text",t.name,e.name||"","name"),r=ve("email",t.email,e.email||"","email"),o=this.o.topics||[],l=o.length?a("select",{"aria-label":t.topicLabel},a("option",{value:""},t.topicPlaceholder),...o.map(p=>a("option",{value:p.slug},p.name))):null,d=l?a("div",{class:"fld"},l,a("label",null,t.topicLabel),a("span",{class:"cv"},y("chevron",16))):null,c=()=>{let p=n.input.value.trim(),u=r.input.value.trim();if(i.required&&(i.name&&!p||i.email&&!u)){let m=i.name&&!p?n:r;m.wrap.classList.add("bad"),m.input.focus();return}if(u&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(u)){r.wrap.classList.add("bad"),r.input.focus();return}this.o.actions.submitPrechat(p,u,(l==null?void 0:l.value)||null);},h=a("form",{class:"fm",onsubmit:p=>{p.preventDefault(),c();}},a("h3",null,t.prechatTitle),a("p",null,this.o.settings.greeting||t.prechatHint),i.name?n.wrap:null,i.email?r.wrap:null,d,a("button",{class:"btn",type:"submit"},t.start),i.required?null:a("button",{class:"btn gh",type:"button",onclick:()=>this.o.actions.skipPrechat((l==null?void 0:l.value)||null)},t.skip));this.body.appendChild(h),S()||setTimeout(()=>(i.name?n.input:r.input).focus(),60);}showChat(){var t,i;if(this.view==="chat"&&this.list)return;let e=this.o.t;this.view="chat",k(this.body),this.list=a("div",{class:"ml"}),this.list.addEventListener("scroll",()=>this.syncJump(),{passive:true}),this.jumpBtn=a("button",{class:"jump",type:"button","aria-label":e.jump,onclick:()=>this.list&&z(this.list,true)},y("down",14),a("span",null,e.jump)),this.typingAvatar=a("div",{class:"av"},C((t=this.agent)==null?void 0:t.avatar,((i=this.agent)==null?void 0:i.name)||this.o.appName)),this.typingEl=a("div",{class:"tp","aria-live":"polite"},this.typingAvatar,a("div",{class:"dots"},a("i"),a("i"),a("i"))),this.notice=a("div",{class:"notice"}),this.body.appendChild(this.list),this.body.appendChild(this.jumpBtn),this.body.appendChild(this.typingEl),this.body.appendChild(this.notice),this.body.appendChild(this.buildComposer()),this.body.appendChild(a("div",{class:"drop"},y("image",26),a("span",null,e.dropHere)));}showRating(){let e=this.o.t;this.view="rating",this.list=null,this.textarea=null,k(this.body);let t=0,i=[],n=a("div",{class:"rl"}),r=()=>{i.forEach((c,h)=>c.classList.toggle("on",h<t)),n.textContent=t?e.rateScale[t-1]:"";},o=a("div",{class:"stars"});for(let c=1;c<=5;c++){let h=a("button",{type:"button","aria-label":String(c),onclick:()=>{t=c,r();}},y("star",32));i.push(h),o.appendChild(h);}let l=a("textarea",{placeholder:e.rateComment,rows:3}),d=a("form",{class:"fm",onsubmit:c=>{c.preventDefault(),this.o.actions.rate(t,l.value.trim());}},a("h3",{style:"text-align:center"},e.rateTitle),o,n,l,a("button",{class:"btn",type:"submit"},e.rateSend),a("button",{class:"btn gh",type:"button",onclick:()=>this.o.actions.rate(0,"")},e.skip));this.body.appendChild(d);}showThanks(e){let t=this.o.t;this.view="none",this.list=null,this.textarea=null,k(this.body);let i=a("div",{class:"ok"},a("div",{class:"ic"},y("done",30)),a("h3",null,t.rateThanksTitle),a("p",null,t.rateThanks));e!=null&&e.url&&(i.appendChild(a("p",{style:"margin-top:16px"},t.reviewIntro)),i.appendChild(a("a",{class:"btn",href:e.url,target:"_blank",rel:"noopener noreferrer"},e.label||t.reviewCta))),i.appendChild(a("button",{class:"btn gh",type:"button",onclick:()=>this.o.actions.newChat()},t.newChat)),this.body.appendChild(i);}render(e){var t,i;this.list&&(be(this.list,{...e,t:this.o.t,locale:this.o.locale,actions:this.o.actions,agentAvatar:((t=this.agent)==null?void 0:t.avatar)||A(this.o.settings.logo_url),brandName:((i=this.agent)==null?void 0:i.name)||this.o.appName,responseHint:this.online?this.o.t.replyFast:this.o.settings.offline_message||this.o.t.offlineMessage,quick:this.quickStarters(),onQuick:n=>this.o.actions.send(n,[],null)}),this.syncJump());}setTyping(e,t){this.typingEl&&(this.typingEl.classList.toggle("on",e),this.typingEl.setAttribute("aria-label",`${t} ${this.o.t.typing}`),e&&this.list&&O(this.list,120)&&z(this.list,true));}setNotice(e,t){this.notice&&(k(this.notice),this.notice.classList.toggle("on",!!e),e&&(this.notice.appendChild(document.createTextNode(e)),t&&this.notice.appendChild(a("button",{type:"button",onclick:t.fn},t.label))));}setReply(e){var i;if(this.replyTo=e,!this.replyBar||(k(this.replyBar),this.replyBar.classList.toggle("on",!!e),!e))return;let t=e.sender_type==="visitor"?this.o.t.you:e.sender_name||this.o.t.agent;this.replyBar.appendChild(y("reply",14)),this.replyBar.appendChild(a("span",{class:"rt"},`${this.o.t.replyingTo} ${t}: ${$(e,this.o.t)}`)),this.replyBar.appendChild(a("button",{type:"button","aria-label":this.o.t.cancel,onclick:()=>this.setReply(null)},y("close",14))),(i=this.textarea)==null||i.focus();}startEdit(e){!this.textarea||!this.replyBar||(this.editing=e,this.setReply(null),this.textarea.value=e.body||"",this.autosize(),this.syncSend(),this.textarea.focus(),k(this.replyBar),this.replyBar.classList.add("on"),this.replyBar.appendChild(a("span",{class:"rt"},`${this.o.t.edit}: ${$(e,this.o.t)}`)),this.replyBar.appendChild(a("button",{type:"button","aria-label":this.o.t.cancel,onclick:()=>this.cancelEdit()},y("close",14))));}buildComposer(){let e=this.o.t;this.replyBar=a("div",{class:"rq"}),this.chips=a("div",{class:"chips"}),this.textarea=a("textarea",{rows:1,placeholder:e.placeholder,"aria-label":e.placeholder,maxLength:this.maxChars,onkeydown:n=>{n.key==="Enter"&&!n.shiftKey&&!n.isComposing?(n.preventDefault(),this.submit()):n.key==="Escape"&&(this.editing?this.cancelEdit():this.replyTo?this.setReply(null):this.hideEmoji());},oninput:()=>{this.autosize(),this.syncSend(),this.notifyTyping();},onpaste:n=>{var o;let r=Array.from(((o=n.clipboardData)==null?void 0:o.files)||[]);r.length&&(n.preventDefault(),this.addFiles(r));}});let t=a("input",{type:"file",multiple:true,style:"display:none",accept:this.allowedMimes.join(","),onchange:()=>{this.addFiles(Array.from(t.files||[])),t.value="";}});return this.emojiBox=a("div",{class:"emj"},...ge.map(n=>a("button",{type:"button",onclick:()=>this.insertEmoji(n)},n))),this.sendBtn=a("button",{class:"cb sd",type:"button",title:e.send,"aria-label":e.send,disabled:true,onclick:()=>this.submit()},y("send",17)),this.counter=a("div",{class:"cnt"}),a("div",{class:"cp"},this.emojiBox,this.replyBar,this.chips,this.counter,a("div",{class:"cr"},a("button",{class:"cb",type:"button",title:e.attach,"aria-label":e.attach,onclick:()=>t.click()},y("clip",19)),this.textarea,a("button",{class:"cb",type:"button",title:e.emoji,"aria-label":e.emoji,onclick:n=>{n.stopPropagation(),this.toggleEmoji();}},y("smile",19)),this.sendBtn),t,a("div",{class:"pw"},a("a",{href:"https://signalbird.io",target:"_blank",rel:"noopener",title:e.poweredBy},a("span",{class:"pk"},W(13)),a("span",{class:"pn2"},"Signalbird"))))}submit(){if(!this.textarea)return;let e=this.textarea.value.trim();if(this.editing){let n=this.editing;this.cancelEdit(),e&&e!==n.body&&this.o.actions.saveEdit(n,e);return}if(!e&&this.files.length===0)return;if(this.textarea.value.length>this.maxChars){this.flash(R(this.o.t.tooLong,{max:this.maxChars}));return}let t=this.files,i=this.replyTo;this.files=[],this.renderChips(),this.setReply(null),this.hideEmoji(),this.textarea.value="",this.autosize(),this.syncSend(),this.stopTyping(),this.o.actions.send(e,t,i),S()||this.textarea.focus();}cancelEdit(){this.editing=null,this.textarea&&(this.textarea.value="",this.autosize(),this.syncSend()),this.replyBar&&(k(this.replyBar),this.replyBar.classList.remove("on"));}addFiles(e){let t=this.o.maxMb*1024*1024;for(let i of e){if(i.size>t){this.flash(R(this.o.t.fileTooLarge,{mb:this.o.maxMb}));continue}if(i.type&&!this.allowedMimes.includes(i.type)){this.flash(this.o.t.fileNotAllowed);continue}if(this.files.length>=5)break;this.files.push(i);}this.renderChips(),this.syncSend();}renderChips(){this.chips&&(k(this.chips),this.chips.classList.toggle("on",this.files.length>0),this.files.forEach((e,t)=>{this.chips.appendChild(a("div",{class:"chip"},e.type.startsWith("image/")?a("img",{src:URL.createObjectURL(e),alt:""}):y("file",16),a("span",null,e.name),a("button",{type:"button","aria-label":this.o.t.delete,onclick:()=>{this.files.splice(t,1),this.renderChips(),this.syncSend();}},y("close",12))));}));}syncSend(){if(!this.sendBtn||!this.textarea)return;let e=!this.textarea.value.trim()&&this.files.length===0;this.sendBtn.disabled=e||this.textarea.value.length>this.maxChars,this.syncCounter();}syncCounter(){if(!this.counter||!this.textarea)return;let e=this.maxChars-this.textarea.value.length,t=e<=Ye;this.counter.classList.toggle("on",t),this.counter.classList.toggle("full",e<=0),this.counter.textContent=t?String(e):"";}toggleEmoji(){if(!this.emojiBox)return;this.emojiBox.classList.toggle("on")&&document.addEventListener("click",()=>this.hideEmoji(),{once:true,capture:true});}hideEmoji(){var e;(e=this.emojiBox)==null||e.classList.remove("on");}insertEmoji(e){var n,r;if(!this.textarea)return;let t=this.textarea,i=(n=t.selectionStart)!=null?n:t.value.length;t.value=t.value.slice(0,i)+e+t.value.slice((r=t.selectionEnd)!=null?r:i),t.selectionStart=t.selectionEnd=i+e.length,this.autosize(),this.syncSend(),t.focus();}autosize(){let e=this.textarea;e&&(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,132)}px`);}notifyTyping(){this.wasTyping||(this.wasTyping=true,this.o.actions.typing(true)),this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=setTimeout(()=>this.stopTyping(),2500);}stopTyping(){this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=null,this.wasTyping&&(this.wasTyping=false,this.o.actions.typing(false));}syncJump(){!this.jumpBtn||!this.list||this.jumpBtn.classList.toggle("on",!O(this.list,160));}flash(e){this.setBanner(e,true),setTimeout(()=>this.setBanner(null),3200);}buildTeaser(){let e=this.o.t,t=this.o.settings;return a("div",{class:"teaser",role:"button",tabindex:0,onclick:()=>{this.hideTeaser(true),this.o.actions.open();}},a("div",{class:"tv"},this.brandAvatar()),a("div",{class:"tc"},a("div",{class:"tn"},this.o.appName||e.title),a("div",{class:"tb"},t.greeting||e.greeting)),a("button",{class:"tx",type:"button","aria-label":e.close,onclick:i=>{i.stopPropagation(),this.hideTeaser(true);}},y("close",13)))}buildToast(){return a("div",{class:"toast",role:"button",tabindex:0,onclick:()=>{this.hideToast(),this.o.actions.open();}},a("div",{class:"tv"}),a("div",{class:"tc"},a("div",{class:"tn"}),a("div",{class:"tb"})))}scheduleTeaser(){xe(this.key(me))||xe(this.key(fe))||this.o.settings.launcher_mode!=="manual"&&(this.teaserTimer=setTimeout(()=>{this.wrap.classList.contains("open")||this.wrap.classList.contains("hidden")||this.wrap.classList.contains("no-ln")||this.wrap.classList.contains("tst")||this.wrap.classList.add("tz");},qe));}hideTeaser(e){this.teaserTimer&&clearTimeout(this.teaserTimer),this.teaserTimer=null,this.wrap.classList.remove("tz"),e&&ye(this.key(me));}showToast(e){var o,l;let t=e.name||((o=this.agent)==null?void 0:o.name)||this.o.appName||this.o.t.agent,i=this.toast.querySelector(".tv"),n=this.toast.querySelector(".tn"),r=this.toast.querySelector(".tb");k(i),i.appendChild(C(e.avatar||((l=this.agent)==null?void 0:l.avatar),t)),n.textContent=t,r.textContent=e.body||this.o.t.newMessage,this.hideTeaser(false),this.wrap.classList.add("tst"),this.toastTimer&&clearTimeout(this.toastTimer),this.toastTimer=setTimeout(()=>this.hideToast(),Ge);}hideToast(){this.toastTimer&&clearTimeout(this.toastTimer),this.toastTimer=null,this.wrap.classList.remove("tst");}onLauncher(){this.hideTeaser(true),this.hideToast(),this.o.actions.open();}get allowedMimes(){let e=this.o.settings.attachment_mimes;return Array.isArray(e)&&e.length?e:Fe}get maxChars(){let e=Number(this.o.settings.max_message_chars);return Number.isFinite(e)&&e>0?e:Ue}quickStarters(){return (this.o.topics||[]).slice(0,4).map(e=>e.name).filter(Boolean)}bindViewport(){let e=D();e&&(e.addEventListener("resize",this.onViewport),this.onViewport());}onViewport(){let e=D();if(!e||!S())return;let t=Math.max(0,window.innerHeight-e.height-e.offsetTop);this.wrap.style.setProperty("--sb-kb",`${t}px`),this.wrap.classList.toggle("kb",t>40),t>40&&this.list&&requestAnimationFrame(()=>this.list&&z(this.list));}lockScroll(){if(this.locked||!S())return;this.locked=true,this.scrollLock=window.scrollY||0;let e=document.body.style;e.position="fixed",e.top=`-${this.scrollLock}px`,e.left="0",e.right="0",e.width="100%";}unlockScroll(){if(!this.locked)return;this.locked=false;let e=document.body.style;e.position="",e.top="",e.left="",e.right="",e.width="",window.scrollTo(0,this.scrollLock);}enableSwipeClose(){let e=0,t=0,i=false,n=()=>{i&&(i=false,this.wrap.classList.remove("dragging"),this.panel.style.transform="",t>110&&this.o.actions.close(),removeEventListener("pointermove",r),removeEventListener("pointerup",n),removeEventListener("pointercancel",n));},r=o=>{i&&(t=Math.max(0,o.clientY-e),this.panel.style.transform=`translateY(${t}px)`,this.panel.style.opacity=String(Math.max(.5,1-t/420)));};this.dragBar.addEventListener("pointerdown",o=>{S()&&(i=true,e=o.clientY,t=0,this.wrap.classList.add("dragging"),addEventListener("pointermove",r),addEventListener("pointerup",n),addEventListener("pointercancel",n));});}onKey(e){var t;if(e.key==="Escape"){if((t=this.emojiBox)!=null&&t.classList.contains("on")){this.hideEmoji();return}this.wrap.classList.contains("open")&&this.o.actions.close();}}enableDrop(){let e=0;this.body.addEventListener("dragenter",t=>{t.preventDefault(),e++,this.view==="chat"&&this.body.classList.add("dragover");}),this.body.addEventListener("dragover",t=>t.preventDefault()),this.body.addEventListener("dragleave",()=>{--e<=0&&(e=0,this.body.classList.remove("dragover"));}),this.body.addEventListener("drop",t=>{var i;t.preventDefault(),e=0,this.body.classList.remove("dragover"),this.view==="chat"&&((i=t.dataTransfer)!=null&&i.files)&&this.addFiles(Array.from(t.dataTransfer.files));});}clearTimers(){for(let e of [this.typingTimer,this.teaserTimer,this.toastTimer,this.attnTimer])e&&clearTimeout(e);}launcherMark(){let e=this.o.settings,t=A(e.logo_url);return e.launcher_icon==="logo"&&t?a("img",{class:"lg",src:t,alt:""}):e.launcher_icon==="chat"?y("chat",25):W(27)}brandAvatar(){let e=A(this.o.settings.logo_url);return e?a("img",{src:e,alt:""}):document.createTextNode(B(this.o.appName))}restoreGeometry(){let e=We();e&&(e.w&&(this.panel.style.width=`${e.w}px`),e.h&&(this.panel.style.height=`${e.h}px`),this.wrap.style.setProperty("--sb-dx",`${e.dx||0}px`),this.wrap.style.setProperty("--sb-dy",`${e.dy||0}px`));}saveGeometry(){Je({w:this.panel.offsetWidth,h:this.panel.offsetHeight,dx:parseFloat(this.wrap.style.getPropertyValue("--sb-dx"))||0,dy:parseFloat(this.wrap.style.getPropertyValue("--sb-dy"))||0});}enableMove(e){e.addEventListener("pointerdown",t=>{if(t.button!==0||S()||t.target.closest("button"))return;let i=t.clientX,n=t.clientY,r=parseFloat(this.wrap.style.getPropertyValue("--sb-dx"))||0,o=parseFloat(this.wrap.style.getPropertyValue("--sb-dy"))||0,l=this.wrap.classList.contains("left")?-1:1,d=false,c=p=>{let u=p.clientX-i,m=p.clientY-n;if(!d&&Math.abs(u)+Math.abs(m)<4)return;d=true,this.wrap.classList.add("moving");let f=Math.max(0,innerWidth-this.panel.offsetWidth-24),x=Math.max(0,innerHeight-this.panel.offsetHeight-24);this.wrap.style.setProperty("--sb-dx",`${V(r-u*l,0,f)}px`),this.wrap.style.setProperty("--sb-dy",`${V(o-m,0,x)}px`);},h=()=>{removeEventListener("pointermove",c),removeEventListener("pointerup",h),this.wrap.classList.remove("moving"),d&&this.saveGeometry();};addEventListener("pointermove",c),addEventListener("pointerup",h);});}enableResize(){this.grip.addEventListener("pointerdown",e=>{if(e.button!==0||S())return;e.preventDefault();let t=e.clientX,i=e.clientY,n=this.panel.offsetWidth,r=this.panel.offsetHeight,o=this.wrap.classList.contains("left")?-1:1;this.wrap.classList.add("sizing");let l=c=>{this.panel.style.width=`${V(n+(t-c.clientX)*o,340,innerWidth-40)}px`,this.panel.style.height=`${V(r+(i-c.clientY),400,innerHeight-40)}px`;},d=()=>{removeEventListener("pointermove",l),removeEventListener("pointerup",d),this.wrap.classList.remove("sizing"),this.saveGeometry();};addEventListener("pointermove",l),addEventListener("pointerup",d);});}};function ve(s,e,t,i){let n=a("input",{type:s,value:t,autocomplete:i,placeholder:" "});return t&&n.classList.add("has"),n.addEventListener("input",()=>{var r;n.classList.toggle("has",n.value.length>0),(r=n.parentElement)==null||r.classList.remove("bad");}),{wrap:a("div",{class:"fld"},n,a("label",null,e)),input:n}}var we="sb_geometry";function We(){try{let s=localStorage.getItem(we);if(!s)return null;let e=JSON.parse(s);return !e||e.w>innerWidth||e.h>innerHeight?null:e}catch(s){return null}}function Je(s){try{localStorage.setItem(we,JSON.stringify(s));}catch(e){}}function ye(s){try{localStorage.setItem(s,"1");}catch(e){}}function xe(s){try{return localStorage.getItem(s)==="1"}catch(e){return false}}function V(s,e,t){return Math.min(Math.max(s,e),t)}function S(){return innerWidth<=640}function D(){return typeof window!="undefined"&&window.visualViewport||null}function Xe(s){return s==="dark"?true:s!=="auto"||typeof matchMedia!="function"?false:matchMedia("(prefers-color-scheme: dark)").matches}function Ze(s){return s&&/^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%]+\)|hsla?\([\d\s.,%]+\))$/i.test(s)?s:"#4f46e5"}var F=class{constructor(){this.original=null;this.timer=null;this.label="";}update(e,t){e>0&&document.hidden?(this.label=t(e),this.begin()):this.end();}begin(){if(this.timer)return;this.original=document.title;let e=false;this.timer=setInterval(()=>{if(!document.hidden)return this.end();e=!e,document.title=e?this.label:this.original||"";},1200);}end(){this.timer&&clearInterval(this.timer),this.timer=null,this.original!==null&&(document.title=this.original,this.original=null);}};var _=null;function Q(){try{let s=window.AudioContext||window.webkitAudioContext;if(!s)return;_||(_=new s),_.state==="suspended"&&_.resume();let e=_.currentTime,t=_.createGain();t.gain.setValueAtTime(1e-4,e),t.gain.exponentialRampToValueAtTime(.12,e+.02),t.gain.exponentialRampToValueAtTime(1e-4,e+.35),t.connect(_.destination);let i=_.createOscillator();i.type="sine",i.frequency.setValueAtTime(880,e),i.frequency.setValueAtTime(1175,e+.12),i.connect(t),i.start(e),i.stop(e+.36);}catch(s){}}var Qe="https://live.signalbird.io/api",T="/v1/sdk/chat/conversations",U=class{constructor(e){this.opts=e;this.title=new F;this.topic=null;this.ui=null;this.settings=null;this.appName="";this.started=false;this.destroyed=false;this.pendingSends=new Map;this.ratingMode=null;this.autoOpened=false;this.identity=null;this.lastTypingSent=0;this.pollCount=0;this.forceFull=false;this.socket=null;this.onVisibility=()=>{this.syncUnread(),!document.hidden&&this.store.isOpen&&this.store.conversation&&this.markRead();};this.baseUrl=(e.baseUrl||Qe).replace(/\/$/,""),this.store=new N(e.publicKey),this.api=new j(this.baseUrl,e.publicKey,e.chatKey,()=>this.store.secret,(...t)=>this.log(...t)),this.poller=new H(()=>this.tick()),this.identity=e.user&&(e.user.name||e.user.email||e.user.external_id)?e.user:null,this.locale=X(null,e.locale),this.t=Z(this.locale),this.ready=this.start().catch(t=>this.log("start failed",t));}log(...e){this.opts.debug&&console.debug("[signalbird]",...e);}async start(){var h;let e=await this.api.post("/v1/sdk/bootstrap",{page_url:location.href,locale:this.opts.locale});if(!e.ok||!((h=e.data)!=null&&h.app)){this.log("bootstrap failed",e);return}if(this.destroyed)return;let{app:t,online:i,within_hours:n,visitor:r,conversation:o,topics:l,realtime:d}=e.data;if(!t.chat_enabled){this.log("chat disabled for app");return}this.settings=t.chat||{},this.appName=t.name||"",this.locale=X(this.settings.locale,this.opts.locale),this.t=Z(this.locale),this.store.visitor&&!r&&this.store.clearVisitor(),r&&this.store.setVisitor({id:r.id,name:r.name,email:r.email}),this.store.online=!!i,this.store.withinHours=n!==false,o&&this.store.setConversation(o);let c=Number(this.settings.max_attachment_mb||t.max_attachment_mb||10);this.ui=new K({t:this.t,locale:this.locale,publicKey:this.opts.publicKey,settings:this.settings,appName:this.appName,maxMb:c,topics:l||[],actions:{open:()=>this.open(),close:()=>this.close(),send:(p,u,m)=>{this.send(p,u,m);},typing:p=>{this.typing(p);},submitPrechat:(p,u,m)=>{this.submitPrechat(p,u,m);},skipPrechat:p=>{this.topic=p,this.enterChat();},rate:(p,u)=>{this.rate(p,u);},dismiss:()=>this.dismiss(),endChat:()=>this.endChat(),newChat:()=>this.newChat(),saveEdit:(p,u)=>{this.saveEdit(p,u);},reply:p=>{var u;return (u=this.ui)==null?void 0:u.setReply(p)},react:(p,u)=>{this.react(p,u);},edit:p=>{var u;return (u=this.ui)==null?void 0:u.startEdit(p)},remove:p=>{this.remove(p);},retry:p=>{this.retry(p);},openImage:p=>window.open(p,"_blank","noopener")}}),this.store.on("unread",()=>this.syncUnread()),this.store.on("messages",()=>this.render()),this.store.on("change",()=>this.render()),document.addEventListener("visibilitychange",this.onVisibility),this.ui.mount(),this.ui.setDismissed(this.store.dismissed),this.syncLauncher(),this.ui.setHeader(this.store.agent,this.store.online),this.applyBanner(),this.store.setUnread((r==null?void 0:r.unread)||(o==null?void 0:o.visitor_unread)||0),this.syncUnread(),this.started=true,this.poller.start(),d!=null&&d.enabled&&(this.socket=new I(d,(p,u)=>this.authorizeChannel(p,u),p=>this.onSocketEvent(p),p=>{this.log("socket",p?"connected":"disconnected"),this.poller.setLive(p),p&&this.poller.poke(0);},(...p)=>this.log(...p)),this.socket.connect(),this.subscribeVisitor()),this.opts.user&&this.identify(this.opts.user);}applyBanner(){!this.ui||!this.settings||this.ui.setBanner(this.store.withinHours?null:this.settings.offline_message||this.t.offlineMessage);}syncUnread(){var t;let e=this.store.isOpen&&!document.hidden?0:this.store.unread;(t=this.ui)==null||t.setUnread(this.store.unread),this.title.update(e,i=>R(this.t.unreadTitle,{n:i})),this.store.emit("public:unread",this.store.unread),this.syncLauncher();}syncLauncher(){var i;if(!this.ui)return;if(((i=this.settings)==null?void 0:i.launcher_mode)!=="manual"){this.ui.setLauncherHidden(false);return}let e=this.store.conversation,t=!!e&&e.status!=="closed";this.ui.setLauncherHidden(!(this.store.isOpen||t||this.store.unread>0));}dismiss(){var e;this.store.setDismissed(true),this.close(),(e=this.ui)==null||e.setDismissed(true);}open(){var e,t;this.store.dismissed&&(this.store.setDismissed(false),(e=this.ui)==null||e.setDismissed(false)),!(!this.ui||this.store.isOpen)&&(((t=this.store.conversation)==null?void 0:t.status)==="closed"&&(this.store.setConversation(null),this.ratingMode=null),this.store.isOpen=true,this.ui.setOpen(true),this.syncLauncher(),this.poller.setOpen(true),this.decideView(),this.store.emit("public:open"),this.store.conversation?this.loadConversation():this.store.setUnread(0),this.syncUnread());}close(){if(!this.ui||!this.store.isOpen)return;let e=this.store.conversation;if(e&&e.status==="resolved"&&!this.store.wasRated(e.id)&&this.ui.currentView==="chat"&&this.store.messages.some(t=>t.sender_type==="agent")){this.ratingMode="resolved",this.ui.setEndVisible(false),this.ui.showRating();return}this.store.isOpen=false,this.ui.setOpen(false),this.poller.setOpen(false),this.typing(false),this.store.emit("public:close"),this.syncUnread(),this.syncLauncher();}toggle(){this.store.isOpen?this.close():this.open();}isOpen(){return this.store.isOpen}on(e,t){this.store.on(`public:${e}`,t);}off(e,t){this.store.off(`public:${e}`,t);}async identify(e){var r;if(await this.ready,this.destroyed)return;this.identity={...this.identity||{},...e},((r=this.ui)==null?void 0:r.currentView)==="prechat"&&this.enterChat();let[t,...i]=(e.name||"").trim().split(/\s+/),n={external_id:e.external_id,email:e.email,phone:e.phone,first_name:t||void 0,last_name:i.join(" ")||void 0,attributes:e.attributes};e.external_id&&this.check(await this.api.post("/v1/sdk/identify",n)),await this.session({name:e.name,email:e.email,external_id:e.external_id});}async pushRegister(e){return await this.ready,this.api.post("/v1/sdk/devices",{provider:e.platform==="ios"?"apns":"fcm",locale:ke(),...e})}destroy(){var e,t;this.destroyed=true,(e=this.socket)==null||e.close(),this.socket=null,this.poller.stop(),this.title.end(),document.removeEventListener("visibilitychange",this.onVisibility),(t=this.ui)==null||t.unmount(),this.ui=null;}decideView(){var r,o;if(!this.ui||!this.settings)return;let e=this.settings.prechat,t=this.store.visitor;!!!((r=this.identity)!=null&&r.name||(o=this.identity)!=null&&o.email||t!=null&&t.name||t!=null&&t.email)&&!this.store.conversation&&e&&(e.name||e.email)?this.ui.showPrechat({}):this.enterChat();}enterChat(){var e;this.ui&&(this.ratingMode=null,this.ui.showChat(),this.ui.setEndVisible(((e=this.store.conversation)==null?void 0:e.status)==="open"),this.render());}render(){var t,i;if(!this.ui||this.ui.currentView!=="chat")return;let e=this.store.conversation;this.ui.render({messages:this.store.messages,greeting:((t=this.settings)==null?void 0:t.greeting)||this.t.greeting,agentName:((i=this.store.agent)==null?void 0:i.name)||this.t.agent,find:n=>this.store.find(n)}),this.ui.setEndVisible((e==null?void 0:e.status)==="open"),e&&e.status!=="open"?this.ui.setNotice(e.status==="resolved"?this.t.resolved:this.t.closed,{label:this.t.newChat,fn:()=>this.newChat()}):this.ui.setNotice(null);}async submitPrechat(e,t,i){var r;this.topic=i,await this.session({name:e||void 0,email:t||void 0})?this.enterChat():(r=this.ui)==null||r.setBanner(this.t.unavailable,true);}newChat(){this.ratingMode=null,this.store.setConversation(null),this.enterChat(),this.store.isOpen||this.open();}endChat(){!this.ui||!this.store.conversation||(this.ratingMode="end",this.ui.setEndVisible(false),this.ui.showRating());}async rate(e,t){var r;let i=this.store.conversation,n=this.ratingMode;if(this.ratingMode=null,!(!i||!this.ui)){if(e>0){let o=await this.api.post(`${T}/${i.id}/rate`,{rating:e,comment:t||void 0});this.check(o),this.store.markRated(i.id);}if(n==="end"){let o=await this.api.post(`${T}/${i.id}/close`);this.check(o),((r=this.store.conversation)==null?void 0:r.id)===i.id&&this.store.setConversation({...i,status:"closed"}),this.ui.showThanks(this.reviewFor(e));return}e===0&&this.store.markRated(i.id),this.enterChat(),this.close();}}reviewFor(e){var n,r,o,l;let t=(((n=this.settings)==null?void 0:n.review_url)||"").trim(),i=Number((o=(r=this.settings)==null?void 0:r.review_min_rating)!=null?o:3);return !t||!/^https?:\/\//i.test(t)?null:e>0&&e>=i?{url:t,label:((l=this.settings)==null?void 0:l.review_label)||null}:null}async session(e={}){var n;let t=this.identity?{name:this.identity.name,email:this.identity.email,external_id:this.identity.external_id}:{},i=await this.api.post("/v1/sdk/chat/session",{...t,...e,locale:ke(),page_url:location.href,user_agent:navigator.userAgent});if(i.ok&&((n=i.data)!=null&&n.visitor)){let r=i.data.visitor;return !r.secret&&!this.store.visitor?(this.log("session returned no secret"),false):(this.store.setVisitor(r),this.subscribeVisitor(),true)}return !i.ok&&i.code==="VISITOR_INVALID"&&this.store.visitor?(this.store.clearVisitor(),this.session(e)):(this.check(i),false)}subscribeVisitor(){var t;let e=(t=this.store.visitor)==null?void 0:t.id;this.socket&&e&&this.socket.subscribe(`visitor.${e}`);}async authorizeChannel(e,t){var n;let i=await this.api.post("/v1/sdk/chat/socket/auth",{socket_id:e,channel:t});return i.ok&&((n=i.data)!=null&&n.auth)?{auth:i.data.auth,at:i.data.at}:null}onSocketEvent(e){var t,i;if(e.name==="chat.typing"){e.data.who==="agent"&&(this.store.agentTyping=e.data.active===true,(i=this.ui)==null||i.setTyping(this.store.agentTyping,((t=this.store.agent)==null?void 0:t.name)||this.t.agent));return}e.data.updated===true&&(this.forceFull=true),this.poller.poke(0);}async loadConversation(){let e=this.store.conversation;if(!e)return;let t=await this.api.get(`${T}/${e.id}`,{limit:50});this.applyPayload(t,true)&&this.store.isOpen&&!document.hidden&&this.store.setUnread(0);}applyPayload(e,t){var n,r,o,l;if(!e.ok)return this.check(e),e.status===404&&this.store.setConversation(null),-1;let i=e.data;if(i.conversation){let d=(n=this.store.conversation)==null?void 0:n.status;this.store.conversation=i.conversation,d!==i.conversation.status&&this.store.emit("change");}return i.agent!==void 0&&(this.store.agent=i.agent||null),this.store.agentTyping=!!i.agent_typing,(r=this.ui)==null||r.setHeader(this.store.agent,this.store.online),(l=this.ui)==null||l.setTyping(this.store.agentTyping,((o=this.store.agent)==null?void 0:o.name)||this.t.agent),this.store.mergeMessages(i.messages||[],t)}async tick(){var d,c,h,p,u,m,f,x;if(!this.started||!this.store.visitor)return false;this.pollCount++;let e=this.store.conversation;if(this.store.isOpen&&e){let b=this.pollCount%5===0||this.forceFull;this.forceFull=false;let g=b?void 0:this.store.lastServerMessageId||void 0,L=await this.api.get(`${T}/${e.id}`,g?{after:g}:{limit:50}),w=this.applyPayload(L,!g);return w>0&&(document.hidden?(this.store.setUnread(this.store.unread+w),(d=this.settings)!=null&&d.sound&&Q()):this.markRead()),w>0}if(this.store.isOpen&&!e&&this.pollCount%10!==0)return false;let t=await this.api.get(T);if(!t.ok)return this.check(t),false;let i=t.data,n=Array.isArray(i)?i:(i==null?void 0:i.conversations)||(i==null?void 0:i.data)||[],r=n.find(b=>b.status==="open")||null,o=n.reduce((b,g)=>b+(g.visitor_unread||0),0),l=o>this.store.unread;return r&&r.id!==((c=this.store.conversation)==null?void 0:c.id)&&(this.store.setConversation(r),this.store.isOpen&&this.loadConversation()),(!this.store.isOpen||document.hidden)&&(this.store.setUnread(o),l&&((h=this.settings)!=null&&h.sound&&Q(),(x=this.ui)==null||x.attention({name:((p=r==null?void 0:r.agent)==null?void 0:p.name)||((u=this.store.agent)==null?void 0:u.name)||this.t.agent,avatar:((m=r==null?void 0:r.agent)==null?void 0:m.avatar)||((f=this.store.agent)==null?void 0:f.avatar)||null,body:(r==null?void 0:r.last_message_sender)==="agent"&&(r==null?void 0:r.last_message_preview)||null}),!this.autoOpened&&!document.hidden&&(this.autoOpened=true,this.open()))),l}async markRead(){let e=this.store.conversation,t=this.store.lastServerMessageId;!e||!t||(this.store.setUnread(0),await this.api.post(`${T}/${e.id}/read`,{last_message_id:t},true));}async send(e,t,i,n=le()){var l;let r={id:`local_${n}`,client_id:n,sender_type:"visitor",type:t.length?t[0].type.startsWith("image/")?"image":"file":"text",body:e||null,attachments:null,reply_to_id:(i==null?void 0:i.id)||null,created_at:new Date().toISOString(),_pending:true,_files:t};this.pendingSends.set(n,{text:e,files:t,replyTo:(i==null?void 0:i.id)||null}),this.store.upsertMessage(r);let o=()=>{let d=this.store.find(r.id);d&&this.store.upsertMessage({...d,_pending:false,_failed:true});};try{if(!this.store.visitor&&!await this.session())return o();let d=this.store.conversation,c=!d||d.status!=="open";if(c&&t.length===0){let m=await this.api.post(T,{body:e,page_url:location.href,client_id:n,...this.topic?{topic:this.topic}:{}});if(!m.ok)return this.sendFailed(m,o);this.store.setConversation(m.data.conversation),this.store.mergeMessages(m.data.messages||[]),this.reconcile(r,m.data.messages),this.pendingSends.delete(n),this.poller.poke(3e3);return}if(c){let m=await this.api.post(T,{page_url:location.href,...this.topic?{topic:this.topic}:{}});if(!m.ok)return this.sendFailed(m,o);this.store.setConversation(m.data.conversation),this.store.mergeMessages(m.data.messages||[]),d=m.data.conversation;}if(!d)return o();let h=[];for(let m of t){let f=await this.api.upload(`${T}/${d.id}/attachments`,m);if(!f.ok)return this.sendFailed(f,o);h.push(f.data);}let p=await this.api.post(`${T}/${d.id}/messages`,{body:e||void 0,attachments:h.length?h:void 0,reply_to_id:(i==null?void 0:i.id)||void 0,client_id:n});if(!p.ok)return this.sendFailed(p,o);let u=((l=p.data)==null?void 0:l.message)||p.data;this.reconcile(r,[u]),this.pendingSends.delete(n),this.poller.poke(3e3);}catch(d){this.log("send error",d),o();}}reconcile(e,t){let i=(t||[]).find(n=>n.client_id===e.client_id);i?this.store.mergeMessages([{...i,client_id:e.client_id}]):t&&t.length&&(this.store.removeMessage(e.id),this.store.mergeMessages(t));}sendFailed(e,t){var i;this.check(e),(e.code==="CHAT_UNAVAILABLE"||e.status===503)&&((i=this.ui)==null||i.setBanner(this.t.unavailable,true)),t();}async retry(e){let t=e.client_id?this.pendingSends.get(e.client_id):null;this.store.removeMessage(e.id),!(!t||!e.client_id)&&await this.send(t.text,t.files,this.store.find(t.replyTo)||null,e.client_id);}async typing(e){let t=this.store.conversation;if(!t||t.status!=="open"||!this.store.visitor)return;let i=Date.now();e&&i-this.lastTypingSent<4e3||(this.lastTypingSent=e?i:0,await this.api.post(`${T}/${t.id}/typing`,{is_typing:e},true));}async react(e,t){var c,h,p,u;let i=this.store.conversation;if(!i)return;let n={...e.reactions||{}},r=[...n[t]||[]],o=r.indexOf("visitor");o>=0?r.splice(o,1):r.push("visitor"),n[t]=r,this.store.upsertMessage({...e,reactions:n});let l=await this.api.post(`${T}/${i.id}/messages/${e.id}/reactions`,{emoji:t});if(!l.ok){this.check(l),this.store.upsertMessage({...e});return}let d=(u=(h=(c=l.data)==null?void 0:c.message)==null?void 0:h.reactions)!=null?u:(p=l.data)==null?void 0:p.reactions;d&&this.store.upsertMessage({...e,reactions:d});}async saveEdit(e,t){var o;let i=this.store.conversation;if(!i)return;this.store.upsertMessage({...e,body:t,edited_at:new Date().toISOString()});let n=await this.api.patch(`${T}/${i.id}/messages/${e.id}`,{body:t});if(!n.ok){this.check(n),this.store.upsertMessage({...e});return}let r=((o=n.data)==null?void 0:o.message)||n.data;r&&r.id&&this.store.upsertMessage(r);}async remove(e){let t=this.store.conversation;if(!t)return;this.store.upsertMessage({...e,deleted_at:new Date().toISOString()});let i=await this.api.delete(`${T}/${t.id}/messages/${e.id}`);i.ok||(this.check(i),this.store.upsertMessage({...e}));}check(e){e.ok||(e.code==="VISITOR_INVALID"||e.status===401&&this.store.visitor)&&(this.store.clearVisitor(),this.store.isOpen&&this.decideView());}};function ke(){var s;try{return ((s=navigator.languages)==null?void 0:s[0])||navigator.language||void 0}catch(e){return}}var et={tr:{loading:"Y\xFCkleniyor\u2026",failed:"Ekran y\xFCklenemedi.",expired:"Bu ba\u011Flant\u0131n\u0131n s\xFCresi doldu.",retry:"Yeniden dene"},en:{loading:"Loading\u2026",failed:"The screen could not be loaded.",expired:"This link has expired.",retry:"Try again"}};function tt(s){if(s==="light"||s==="dark")return s;if(typeof document!="undefined"){let e=document.documentElement;if(e.classList.contains("dark")||e.dataset.theme==="dark")return "dark";if(e.classList.contains("light")||e.dataset.theme==="light")return "light"}return typeof window!="undefined"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function it(s){if(typeof s=="string")return s||null;if(s&&typeof s=="object"){let e=s;if(typeof e.url=="string")return e.url;if(e.data&&typeof e.data.url=="string")return e.data.url}return null}function Te(s){var u,m;let e=et[(u=s.language)!=null?u:"tr"],t=new Map,i=null,n=null,r=null,o=(m=s.theme)!=null?m:"auto",l=false,d=(f,x)=>{var b;(b=t.get(f))==null||b.forEach(g=>{try{g(x);}catch(L){console.warn("[signalbird]",L);}});},c=()=>{r&&(window.removeEventListener("message",r),r=null),n=null,i&&(i.textContent="");},h=(f,x)=>{var L;if(!i)return;i.textContent="";let b=document.createElement("div");b.setAttribute("data-signalbird-status",""),b.style.cssText=`display:flex;align-items:center;justify-content:center;gap:12px;min-height:${(L=s.minHeight)!=null?L:220}px;font:13px/1.5 system-ui,-apple-system,sans-serif;color:#6b7280;text-align:center;padding:24px;`;let g=document.createElement("span");if(g.textContent=f,b.appendChild(g),x){let w=document.createElement("button");w.type="button",w.textContent=e.retry,w.style.cssText="border:1px solid currentColor;border-radius:8px;background:transparent;color:inherit;padding:4px 10px;font:inherit;cursor:pointer;",w.addEventListener("click",()=>{p();}),b.appendChild(w);}i.appendChild(b);},p=async()=>{var L;if(!i||l)return;c(),h(e.loading,false);let f=tt(o),x=null;try{s.url?(x=s.url,s={...s,url:void 0}):s.mint&&(x=it(await s.mint({module:s.module,theme:f,locale:s.locale})));}catch(w){d("error",w),h(w instanceof Error?w.message:e.failed,true);return}if(!x){d("error",new Error("EMBED_URL_MISSING")),h(e.expired,!!s.mint);return}let b=x;try{let w=new URL(x);w.searchParams.set("theme",f),s.locale&&w.searchParams.set("locale",s.locale),s.accent&&w.searchParams.set("accent",s.accent.replace(/^#/,"")),b=w.toString();}catch(w){}let g=document.createElement("iframe");g.src=b,g.title="Signalbird",g.style.cssText="width:100%;border:0;display:block;",g.style.height=`${typeof s.height=="number"?s.height:(L=s.minHeight)!=null?L:640}px`,g.setAttribute("allow","clipboard-write; fullscreen; autoplay"),g.setAttribute("sandbox","allow-same-origin allow-scripts allow-forms allow-popups allow-downloads"),g.setAttribute("referrerpolicy","strict-origin-when-cross-origin"),g.setAttribute("loading","lazy"),s.className&&(g.className=s.className),i.textContent="",i.appendChild(g),n=g,r=w=>{var ee,te;if(!n||w.source!==n.contentWindow)return;let M=w.data;if(!(!M||typeof M.type!="string")){if(M.type==="signalbird:ready"){d("ready",M.module);return}if(M.type==="signalbird:height"&&typeof M.px=="number"&&(d("height",M.px),((ee=s.height)!=null?ee:"auto")==="auto")){let Ee=Math.max(M.px,(te=s.minHeight)!=null?te:220);n.style.height=`${Ee}px`;}}},window.addEventListener("message",r);};return {async mount(f){let x=typeof f=="string"?document.querySelector(f):f;if(!(x instanceof HTMLElement))throw new Error("Signalbird: g\xF6mme kab\u0131 bulunamad\u0131 \u2014 "+String(f));i=x,l=false,await p();},refresh:()=>p(),async setTheme(f){o=f,await p();},destroy(){l=true,c(),t.clear(),i=null;},on(f,x){t.has(f)||t.set(f,new Set),t.get(f).add(x);},off(f,x){var b;(b=t.get(f))==null||b.delete(x);}}}var Pt="2.3.0",v=null,Y=[],P=null;function E(s,e){try{return s()}catch(t){try{console.warn("[signalbird]",t);}catch(i){}return e}}function Le(s){s.catch(()=>{});}function st(s){E(()=>{if(!s||!s.publicKey){console.warn("[signalbird] init: publicKey zorunlu");return}if(!(typeof document=="undefined"||typeof window=="undefined")){v&&v.destroy(),v=new U(s);for(let{event:e,fn:t}of Y)v.on(e,t);if(P){let e=P;P=null,Le(v.identify(e));}}},void 0);}function jt(s){E(()=>{if(s){if(!v){P={...P||{},...s};return}Le(v.identify(s));}},void 0);}var Nt={open(){E(()=>v==null?void 0:v.open(),void 0);},close(){E(()=>v==null?void 0:v.close(),void 0);},toggle(){E(()=>v==null?void 0:v.toggle(),void 0);},isOpen(){return E(()=>!!(v!=null&&v.isOpen()),false)},on(s,e){E(()=>{typeof e=="function"&&(Y.push({event:s,fn:e}),v==null||v.on(s,e));},void 0);},off(s,e){E(()=>{let t=Y.findIndex(i=>i.event===s&&i.fn===e);t>=0&&Y.splice(t,1),v==null||v.off(s,e);},void 0);}},Ht={register(s){return E(()=>v?v.pushRegister(s).catch(e=>({ok:!1,status:0,code:"NETWORK_ERROR",message:String(e)})):Promise.resolve({ok:!1,status:0,code:"NOT_INITIALIZED",message:"Signalbird.init \xE7a\u011Fr\u0131lmad\u0131"}),Promise.resolve({ok:false,status:0,code:"WIDGET_ERROR",message:"widget error"}))}},It=Te;function Bt(){E(()=>{v==null||v.destroy(),v=null;},void 0);}E(()=>{if(typeof document=="undefined")return;let s=document.currentScript||document.querySelector('script[data-key][src*="signalbird"]'),e=s==null?void 0:s.dataset;if(!e||!e.key)return;let t=()=>st({publicKey:e.key,chatKey:e.channel||void 0,baseUrl:e.baseUrl||void 0,locale:e.locale||void 0,debug:e.debug==="true"||e.debug==="1"});document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0});},void 0);
490
+ exports.chat=Nt;exports.destroy=Bt;exports.embed=It;exports.identify=jt;exports.init=st;exports.push=Ht;exports.version=Pt;return exports;})({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalbird",
3
- "version": "2.1.1",
3
+ "version": "2.3.0",
4
4
  "description": "Signalbird SDK — Telsiz (Radio), Gönderim (Messaging), Yönetim (Management) ve son kullanıcı sohbet/push istemcisi: sunucu, tarayıcı, mobil",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",