@lightworkai.official/debug-capture 0.19.6 → 0.19.7

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.
@@ -1,4 +1,4 @@
1
- (()=>{var t8=((J)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(J,{get:($,z)=>(typeof require<"u"?require:$)[z]}):J)(function(J){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+J+'" is not supported')});function E1(J){if(!J)return null;let $=J===!0?{}:J,z=(j,Q)=>typeof j==="number"&&Number.isFinite(j)&&j>=0&&j<2000?j:Q;return{side:$.position==="left"?"left":"right",x:z($.offset?.x,16),y:z($.offset?.y,16)}}var e8={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},z0=null;function N4(J){let $=[];if(!J.host?.trim())$.push("host");if(!J.realmKey?.trim())$.push("realmKey");if(!J.app?.name?.trim())$.push("app.name");if(typeof J.module!=="function")$.push("module");if($.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${$.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");z0=J}function P(){if(!z0)throw Error("[debug-capture] configureDebugCapture() has not been called");return z0}function k1(){return z0!==null}function P0(){let J=P().app;return{name:J.name,version:J.version??"0.0.0",environment:J.environment??J3()}}function J3(){if(typeof window>"u")return"unknown";let J=window.location.hostname;if(J==="localhost"||J==="127.0.0.1"||J.endsWith(".local"))return"development";return"production"}function O0(J){let $=z0?.capture?.[J];return typeof $==="number"?$:e8[J]}function f1(J){let $=z0?.module;if(!$)return null;try{return $(J)??null}catch{return null}}function w1(){let J=z0?.redact;return{headers:J?.headers??[],queryKeys:(J?.queryKeys??[]).map(($)=>$.toLowerCase()),bodyKeys:(J?.bodyKeys??[]).map(($)=>$.toLowerCase())}}function _4(){return z0?.capture?.overlaySelectors??[]}var $3='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',z3="[data-lw-mask]",F4={fps:1,quality:0.5};function Q1(){let J=z0?.replay;if(!J)return null;let $=J===!0?{}:J,z=(Z,X)=>typeof Z==="number"&&Z>0?Z:X,j=$.maskInputs!==!1,Q=$.recordCanvas?{fps:z(typeof $.recordCanvas==="object"?$.recordCanvas.fps:void 0,F4.fps),quality:z(typeof $.recordCanvas==="object"?$.recordCanvas.quality:void 0,F4.quality)}:null;return{seconds:z($.seconds,60),maskInputs:j,maskTextSelector:$.maskTextSelector?.trim()||(j?$3:z3),maskText:$.maskText===!0,blockSelector:$.blockSelector?.trim()||"[data-lw-private]",maxBytes:z($.maxBytes,4000000),canvas:Q}}function I4(J){if(typeof window>"u")return!1;let $;try{$=new URL(J,window.location.href)}catch{return!1}if(j3($))return!1;if($.origin===window.location.origin)return!0;return(z0?.capture?.bodyOrigins??[]).some((z)=>{try{return new URL(z).origin===$.origin}catch{return!1}})}function j3(J){if(!z0?.host)return!1;try{if(new URL(z0.host).origin!==J.origin)return!1}catch{return!1}return J.pathname.startsWith("/ingest/")}function C4(J){let $=Object.entries(J).map(([z,j])=>[z.replace(/\/+$/,"")||"/",j]).sort((z,j)=>j[0].length-z[0].length);return(z)=>{let j=(z||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of $)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var Z1="‹redacted›",Q3=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,Z3=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),X3=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,V3=/[\w.+-]+@[\w-]+\.[\w.-]+/g,W3=/\d(?:[\d\s-]{7,})\d/g;function X1(J){return J.replace(V3,Z1).replace(W3,Z1)}function K3(J){if(Q3.test(J))return!0;return w1().headers.some((z)=>z.toLowerCase()===J.toLowerCase())}function V1(J){let $={};for(let[z,j]of Object.entries(J))$[z]=K3(z)?Z1:j;return $}function L0(J){try{let $=/^https?:\/\//i.test(J),z=new URL(J,$?void 0:"http://local.invalid"),j=!1;if(z.searchParams.forEach((Q,Z)=>{if(Z3.has(Z.toLowerCase())||w1().queryKeys.includes(Z.toLowerCase()))z.searchParams.set(Z,Z1),j=!0}),!j)return J;return $?z.toString():`${z.pathname}${z.search}`}catch{return J}}function F2(J,$){if($>6||J===null||typeof J!=="object")return J;if(Array.isArray(J))return J.map((j)=>F2(j,$+1));let z={};for(let[j,Q]of Object.entries(J)){let Z=X3.test(j)||w1().bodyKeys.some((X)=>j.toLowerCase().includes(X));z[j]=Z?Z1:F2(Q,$+1)}return z}function W1(J,$){if(J==null)return null;let z=J,j=J.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);z=JSON.stringify(F2(Q,0))}catch{}if(z.length>$)return`${z.slice(0,$)}… [truncated ${z.length-$} chars]`;return z}var N2=120,_2=40,p0=(J,$)=>J.length>$?`${J.slice(0,$)}…`:J,I2=(J)=>{try{return decodeURIComponent(J)}catch{return J}},u0=[],O4=0,L4=!1;function K1(J,$,z,j){let Q=p0($,N2),Z=u0[u0.length-1];if(J==="navigate"&&Z?.kind==="click"){let W=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${W}`))return Z.at=new Date().toISOString(),Z;let Y=W.split(/[?#]/)[0]??W,q=Z.source?I2(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(q&&(Y===q||Y.startsWith(q)))return Z.detail=p0(`${Z.detail} → ${W}`,N2),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===J&&Z.detail===Q){if(Z.at=new Date().toISOString(),J!=="navigate")Z.count=(Z.count??1)+1;return Z}O4+=1;let X={id:`act_${O4}`,at:new Date().toISOString(),kind:J,detail:Q,count:1,source:z,html:v1(j)};u0.push(X);while(u0.length>O0("maxActions"))G3(u0.shift());return X}var Y3=200000,Y1=0;function v1(J){if(!J)return;if(Y1+J.length>Y3)return;return Y1+=J.length,J}function G3(J){if(!J)return;if(Y1-=(J.html?.length??0)+(J.afterHtml?.length??0),Y1<0)Y1=0}function y1(J){return J instanceof Element&&Boolean(J.closest("[data-debug-reporter]"))}var q3='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',U3={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},S4={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function D3(J){let $=J.getAttribute("role");if($&&S4[$])return S4[$];return U3[J.tagName.toLowerCase()]??"ปุ่ม"}function H3(J,$){try{let z=J,j=0;while(z&&j<=$){let Q=k4(z);if(Q&&typeof Q.memoizedProps?.onClick==="function")return z;z=z.parentElement,j+=1}}catch{}return null}function M3(J){let $=J.getAttribute("aria-label")?.trim();if($)return $;let z=J.getAttribute("title")?.trim();if(z)return z;if(J instanceof HTMLInputElement||J instanceof HTMLTextAreaElement||J instanceof HTMLSelectElement)return(J.getAttribute("placeholder")||J.getAttribute("name")||"").trim();if(J instanceof HTMLImageElement)return(J.getAttribute("alt")||"").trim();let j=(J.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(J instanceof HTMLAnchorElement){let Q=J.getAttribute("href");if(Q?.startsWith("/"))return I2(Q)}return""}function P3(J){if(!(J instanceof Element))return null;let $=J.closest(q3)??H3(J,4);if(!$)return null;let z=$.tagName.toLowerCase();if(z==="html"||z==="body")return null;return $}function B3(J){let $=X1(M3(J));if(!$)return null;return`${D3(J)} “${p0($,_2)}”`}var E4=6000,F3=4000,N3=/(?:^|\s)!?(?:fixed|absolute|sticky|inset-\S+|z-\S+|top-\S+|bottom-\S+|left-\S+|right-\S+|w-screen|h-screen|min-h-screen|max-h-screen|translate-\S+|scale-\S+)(?=\s|$)/g;function _3(J){J.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let $=[J,...Array.from(J.querySelectorAll("*"))];for(let Q of $){for(let X of Array.from(Q.attributes)){let W=X.name.toLowerCase();if(W.startsWith("on")||W==="srcdoc"||W==="value"||W.startsWith("data-"))Q.removeAttribute(X.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let X=Z.replace(N3," ").replace(/\s+/g," ").trim();if(X)Q.setAttribute("class",X);else Q.removeAttribute("class")}}let z=document.createTreeWalker(J,NodeFilter.SHOW_TEXT),j=z.nextNode();while(j){if(j.nodeValue)j.nodeValue=X1(j.nodeValue);j=z.nextNode()}}function C2(J,$,z){try{let j=J.outerHTML;if(!j||j.length>$)return;let Q=J.cloneNode(!0);_3(Q);let Z=Q.outerHTML;return Z&&Z.length<=z?Z:void 0}catch{return}}var I3=(J)=>C2(J,E4,F3),C3=150000,O3=40000,R4=(J)=>C2(J,C3,O3);function L3(J){if(!(J instanceof HTMLInputElement)&&!(J instanceof HTMLTextAreaElement)&&!(J instanceof HTMLSelectElement))return null;let $=J.name||J.id||J.getAttribute("aria-label")||J.getAttribute("placeholder")||J.tagName.toLowerCase();return`ช่อง “${X1($)}”`}var A4=80;function k4(J){let $=Object.keys(J).find((z)=>z.startsWith("__reactFiber$")||z.startsWith("__reactInternalInstance$"));return $?J[$]:null}function S3(J){if(typeof J!=="function")return null;try{let $=Function.prototype.toString.call(J);return($.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??$.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function T4(J){if(!J)return;return`→ ${J.length>A4?`${J.slice(0,A4)}…`:J}`}function R3(J){try{let $=J.closest("a[href]")?.getAttribute("href");if($&&$.startsWith("/"))return T4($);let z=k4(J),j=0;while(z&&j<30){if(typeof z.memoizedProps?.onClick==="function")return T4(S3(z.memoizedProps.onClick));z=z.return,j+=1}return}catch{return}}var A3='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function T3(){let J=_4();return J.length?J.join(", "):A3}function x3(J){let $=J.getAttribute("role");if($==="status"||$==="alert")return"ข้อความแจ้งเตือน";if($==="menu")return"เมนู";if($==="listbox")return"รายการตัวเลือก";if($==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function E3(J){let $=J.getAttribute("aria-label")?.trim();if($)return $;let z=J.getAttribute("aria-labelledby");if(z){let Z=z.split(/\s+/).map((X)=>document.getElementById(X)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=J.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(J.textContent??"").replace(/\s+/g," ").trim()}function f4(J){let $=X1(E3(J)),z=x3(J);return $?`เปิด ${z} “${p0($,_2)}”`:`เปิด ${z}`}var k3='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',f3=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function w3(J){if(J.querySelector(k3))return!0;return f3.test(J.textContent??"")}var y3=400,v3=250,g3=8000;function m3(J,$){if(typeof MutationObserver>"u"){$.html=v1(R4(J));return}let z=Date.now(),j=!1,Q=()=>{j=!0,X.disconnect(),window.clearInterval(W),window.clearTimeout(Y)},Z=()=>{if(j)return;if(Q(),!J.isConnected)return;$.detail=p0(f4(J),N2),$.html=v1(R4(J))},X=new MutationObserver(()=>{z=Date.now()});X.observe(J,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let W=window.setInterval(()=>{if(j)return;if(!J.isConnected){Q();return}if(Date.now()-z>=y3&&!w3(J))Z()},v3),Y=window.setTimeout(Z,g3)}function h3(J){if(y1(J))return;let $=K1("ui",f4(J));if($)m3(J,$)}function b3(){if(typeof MutationObserver>"u")return;let J=new WeakSet;new MutationObserver((z)=>{for(let j of z)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=T3(),X=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let W of X){if(J.has(W))continue;J.add(W),h3(W)}}}).observe(document.body,{childList:!0,subtree:!0})}var u3=1600,p3=2500;function x4(J){return{disabled:J.hasAttribute("disabled")||J.getAttribute("aria-disabled")==="true",busy:J.getAttribute("aria-busy")==="true",text:p0((J.textContent??"").replace(/\s+/g," ").trim(),_2)}}function d3(J,$){if(!J.disabled&&$.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!J.busy&&$.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(J.text!==$.text&&$.text)return`ข้อความเปลี่ยนเป็น “${$.text}”`;return null}function i3(J,$){if(typeof MutationObserver>"u")return;let z=x4(J),j=!1,Q=(W,Y)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(X),$.afterNote=W,Y)$.afterHtml=v1(C2(J,E4,p3))},Z=new MutationObserver(()=>{if(!J.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let W=d3(z,x4(J));if(W)Q(W,!0)});Z.observe(J,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let X=window.setTimeout(()=>{if(!j&&!J.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},u3)}function w4(){if(L4||typeof window>"u")return;L4=!0,document.addEventListener("click",(j)=>{if(y1(j.target))return;let Q=P3(j.target);if(!Q)return;let Z=B3(Q);if(!Z)return;let X=K1("click",`คลิก ${Z}`,R3(Q),I3(Q));if(X)i3(Q,X)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(y1(j.target))return;let Q=L3(j.target);if(Q)K1("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(y1(j.target))return;K1("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let J=()=>K1("navigate",`ไปที่ ${I2(L0(location.pathname+location.search))}`),$=history.pushState.bind(history),z=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=$(...j);return J(),Q},history.replaceState=(...j)=>{let Q=z(...j);return J(),Q},window.addEventListener("popstate",J),b3()}function y4(){return u0.map((J)=>({...J}))}var v4=2000,g1=[],g4=0,m4=!1;function O2(J,$){g4+=1,g1.push({id:`log_${g4}`,at:new Date().toISOString(),level:J,message:$.length>v4?`${$.slice(0,v4)}…`:$});while(g1.length>O0("maxConsoleEntries"))g1.shift()}function c3(){let J=new WeakSet;return($,z)=>{if(typeof z==="object"&&z!==null){if(J.has(z))return"[Circular]";J.add(z)}if(typeof z==="bigint")return z.toString();return z}}function h4(J){if(typeof J==="string")return J;if(J instanceof Error)return`${J.name}: ${J.message}`;try{let $=JSON.stringify(J,c3());if($!==void 0)return $}catch{}try{return String(J)}catch{}try{return Object.prototype.toString.call(J)}catch{return`[${typeof J}]`}}function b4(){if(m4||typeof window>"u")return;m4=!0;let J=["log","info","warn","error","debug"];for(let $ of J){let z=console[$].bind(console);console[$]=(...j)=>{O2($,j.map(h4).join(" ")),z(...j)}}window.addEventListener("error",($)=>{let z=$.filename?` (${$.filename}:${$.lineno}:${$.colno})`:"";O2("exception",`${$.message}${z}`)}),window.addEventListener("unhandledrejection",($)=>{let z=$.reason instanceof Error?`${$.reason.name}: ${$.reason.message}`:h4($.reason);O2("unhandledrejection",z)})}function u4(){return g1.map((J)=>({...J}))}var p4=new Set,d4=new Set;function i4(J,$){return J.add($),()=>J.delete($)}function c4(J,$){for(let z of[...J])z($)}function l4(J){return i4(p4,J)}function d0(J={type:"manual"}){c4(p4,J)}function r4(J){return i4(d4,J)}function o4(J){c4(d4,J)}var l3=15000,r3=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],n4=!1,s4=0;function o3(J){return r3.some(($)=>J.includes($))}function a4(J){let $=J.message??"";if(!$||o3($))return;let z=Date.now();if(z-s4<l3)return;s4=z,o4({...J,message:$})}function t4(){if(n4||typeof window>"u")return;n4=!0,window.addEventListener("error",(J)=>{if(!J.message&&!J.error)return;let $=J.error instanceof Error?J.error:null;a4({type:"runtime-error",message:J.message||($?$.message:"Unknown error"),stack:$?.stack})}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason;a4({type:"unhandledrejection",message:$ instanceof Error?$.message:String($),stack:$ instanceof Error?$.stack:void 0})})}var z6=4000,n3=1e6,s3=1e7,m1=[],e4=0,J6=!1;function j6(J){m1.push(J);while(m1.length>O0("maxRequests"))m1.shift()}function Q6(){return e4+=1,`req_${e4}`}function $6(J){let $={};if(!J)return $;if(J instanceof Headers)J.forEach((z,j)=>{$[j]=z});else if(Array.isArray(J))for(let[z,j]of J)$[z]=j;else Object.assign($,J);return $}function a3(J){let $={};return J.forEach((z,j)=>{$[j]=z}),$}function t3(J){if(J==null)return null;if(typeof J==="string")return J;if(J instanceof URLSearchParams)return J.toString();if(typeof FormData<"u"&&J instanceof FormData)return`[FormData: ${Array.from(J.keys()).join(", ")}]`;if(typeof Blob<"u"&&J instanceof Blob)return`[Blob ${J.size} bytes]`;if(J instanceof ArrayBuffer)return`[ArrayBuffer ${J.byteLength} bytes]`;return"[binary]"}function e3(J,$){let z="",j="GET",Q={},Z=null;if(typeof J==="string")z=J;else if(J instanceof URL)z=J.toString();else z=J.url,j=J.method||j,Q=$6(J.headers);if($){if($.method)j=$.method;if($.headers)Q={...Q,...$6($.headers)};if($.body!==void 0)Z=t3($.body)}return{method:j.toUpperCase(),url:z,headers:Q,body:Z}}function Z6(J){return!I4(J)}function J5(J,$){if(Z6($.url)){$.responseSnippet="[body not captured for this origin]";return}let z=J.headers.get("content-type")??"",j=Number(J.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(z)){$.responseSnippet=`[binary ${z||"unknown"}${Q}]`;return}if(j>n3){$.responseSnippet=`[response ${z||"text"}${Q} — omitted]`;return}try{J.clone().text().then((Z)=>{$.responseSnippet=W1(Z,O0("maxBodyChars"))}).catch(()=>{})}catch{}}function X6(J,$){if(/[?&]_rsc=/.test(J))return!0;for(let z of Object.keys($)){let j=z.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function $5(){if(typeof window>"u"||typeof window.fetch!=="function")return;let J=window.fetch.bind(window);window.fetch=Object.assign(async($,z)=>{let j=e3($,z);if(X6(j.url,j.headers))return J($,z);let Q={id:Q6(),startedAt:new Date().toISOString(),method:j.method,url:L0(j.url),requestHeaders:V1(j.headers),requestBody:W1(j.body,z6),status:null,statusText:null,durationMs:null,via:"fetch"};j6(Q);let Z=performance.now();try{let X=await J($,z);return Q.status=X.status,Q.statusText=X.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=V1(a3(X.headers)),J5(X,Q),X}catch(X){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=X instanceof Error?`${X.name}: ${X.message}`:String(X),X}},J)}function z5(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let J=XMLHttpRequest.prototype,$=J.open,z=J.send,j=function(Z,X){let W=typeof X==="string"?X:X.toString();return this.__lwEntry=X6(W,{})?void 0:{id:Q6(),startedAt:"",method:(Z||"GET").toUpperCase(),url:L0(W),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},$.apply(this,arguments)},Q=function(Z){let X=this.__lwEntry;if(X){X.startedAt=new Date().toISOString(),X.requestBody=typeof Z==="string"?W1(Z,z6):Z==null?null:"[non-string body]";let W=performance.now();j6(X),this.addEventListener("loadend",()=>{if(X.status=this.status||null,X.statusText=this.statusText||null,X.durationMs=Math.round(performance.now()-W),Z6(X.url))X.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{X.responseSnippet=W1(this.responseText||"",O0("maxBodyChars"))}catch{}else{let Y=this.getResponseHeader("content-type")??this.responseType;X.responseSnippet=`[binary ${Y}]`}})}return z.apply(this,arguments)};J.open=j,J.send=Q}function V6(){if(J6)return;J6=!0,$5(),z5()}function W6(){let J=m1.map((z)=>({...z})),$=0;for(let z=J.length-1;z>=0;z-=1){let j=J[z],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if($+Q.length>s3)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else $+=Q.length}return J}var j5=4,K6=3,Q5=4000,Z5="[data-debug-reporter]",Y6=()=>import("@rrweb/record");function G6(J){Y6=J}var Z0=[],L2=null,h1=!1;function q6(){if(typeof window>"u"||L2||h1)return;let J=Q1();if(!J)return;h1=!0;let $=()=>void X5(J);if("requestIdleCallback"in window)window.requestIdleCallback($,{timeout:3000});else setTimeout($,1000)}async function X5(J){let $;try{$=(await Y6()).record}catch(z){h1=!1,console.warn("[debug-capture] session replay could not start:",z);return}if(L2)return;try{L2=$({emit:(z)=>V5(z),checkoutEveryNms:Math.max(1000,J.seconds*1000/2),checkoutEveryNth:Q5,maskAllInputs:J.maskInputs,maskTextSelector:J.maskText?"*":J.maskTextSelector,blockSelector:`${J.blockSelector}, ${Z5}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...J.canvas?{canvas:J.canvas.fps}:{}},recordCanvas:J.canvas!==null,...J.canvas?{dataURLOptions:{type:"image/webp",quality:J.canvas.quality}}:{},errorHandler:()=>!0})??null}catch(z){console.warn("[debug-capture] session replay could not start:",z)}finally{h1=!1}}function V5(J){if(J.type===j5||Z0.length===0){if(Z0.push([]),Z0.length>K6)Z0=Z0.slice(-K6)}Z0[Z0.length-1].push(J)}function U6(J=Date.now()){let $=Q1();if(!$||!Z0.length)return null;let z=J-$.seconds*1000,j=Z0.length-1;while(j>0&&(Z0[j][0]?.timestamp??J)>z)j-=1;let Q=Z0.slice(j).flat(),Z=Q[0]?.timestamp,X=Q[Q.length-1]?.timestamp;if(Z===void 0||X===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(X).toISOString(),durationMs:Math.max(0,X-Z)}}var W5={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindRequest:"คำขอ",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",problemInsteadShare:"แจ้งปัญหาแทน (แนบภาพหน้าจอ)",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTypeSearch:"ค้นหาเรื่องที่ขอ",requestTypeNone:"ไม่พบเรื่องที่ขอ — ลองคำอื่น",requestTypeCount:"{n} เรื่อง — เลื่อนดูหรือพิมพ์ค้นหา",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง",ringTitle:"ทีมงานกำลังโทรหาคุณ",ringAbout:"เรื่อง {key} · {title}",ringChat:"จากแชทกับทีมงาน",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า",ringHint:"เมื่อรับสาย เบราว์เซอร์จะขอใช้ไมโครโฟน · ระหว่างคุย ทีมงานอาจขอดูหน้าจอ — คุณเลือกได้เสมอว่าจะให้ดูหรือไม่",ringTest:"ทดสอบไมค์และลำโพงก่อนรับสาย",ringAnswer:"รับสาย",ringAnswering:"กำลังรับสาย…",ringFallback:"เปิดสายในหน้านี้ไม่ได้ — รับสายในแท็บใหม่แทน ไม่ต้องเข้าสู่ระบบอีก",chatOpen:"แชทกับทีมงาน",chatTitle:"แชทกับทีมงาน",chatUnread:"{n} ข้อความใหม่จากทีมงาน",chatMove:"แชทกับทีมงาน — ลากเพื่อย้ายไปที่อื่นได้ถ้าบังอะไรอยู่",chatLabel:"แชทกับทีมงาน",chatLabelNew:"มีข้อความใหม่จากทีมงาน"},K5={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",failedOffline:"Could not send — the server could not be reached. What you wrote is still here; check your connection and try again.",failedUnavailable:"Could not send — the system is being updated. What you wrote is still here; try again in a moment.",failedTooMany:"Too many reports — try again in {seconds} seconds.",captured:"Captured",reporter:"Reporter",page:"Page",replay:"activity log",handoffTitle:"Opening the support portal",handoffBody:"You will be signed in automatically to see what you reported",handoffGo:"Go now",handoffPreparing:"Preparing…",handoffFailed:"Could not open your reports",handoffBlocked:"Your browser blocked the new tab",handoffOpen:"Open in a new tab",chooseTitle:"How can the team help?",kindProblem:"Report a problem",kindRequest:"Request",askInstead:"Asking for something?",askInsteadAction:"Choose what you need",problemInstead:"Something broken?",problemInsteadAction:"Report a problem instead",problemInsteadShare:"Report a problem instead (with a screenshot)",chooseProblemHint:"Something is broken or not working — with a screenshot",chooseRequestHint:"Ask the team to do something, like access or a data change — no screen sharing",requestTitle:"Ask the team",requestTypeLabel:"What you need",requestTypeSearch:"Search what you need",requestTypeNone:"Nothing matches — try another word",requestTypeCount:"{n} to choose from — scroll or search",requestTarget:"The team aims to finish within {time}",requestSummaryLabel:"Subject",requestSummaryPlaceholder:"What do you need — briefly",requestDetailLabel:"Details (optional)",requestDetailPlaceholder:"What the team needs to know to do it",requestSubmit:"Send request",requestSubmitted:"Request sent",requestWithShot:"Attach this screenshot to the request",requestAnnotateHint:"Mark what you are asking about — box it, point at it, highlight it, or type on it",draftRestored:"What you typed last time, not sent yet",draftClear:"Clear",requestLeaves:"Not sent with a request",requestLeavesWhat:"this page's activity log — it is for problem reports only",days:"{n} days",hours:"{n} hours",ringTitle:"The support team is calling you",ringAbout:"About {key} · {title}",ringChat:"From your chat with support",ringHow:"Answer on your request's page — it opens in a new tab, already signed in",ringOpen:"Open to answer",ringDecline:"Decline",ringOpened:"Opened — press Answer in the new tab",ringBlocked:"Your browser blocked the new tab — open the call here",ringClose:"Close",ringTab:"\uD83D\uDCDE Incoming call",ringHint:"When you answer, your browser asks for the microphone · during the call the team may ask to see your screen — you always choose",ringTest:"Test the microphone and speaker first",ringAnswer:"Answer",ringAnswering:"Answering…",ringFallback:"The call can't open on this page — answer in a new tab instead, already signed in",chatOpen:"Chat with support",chatTitle:"Chat with support",chatUnread:"{n} new from support",chatMove:"Chat with support — drag to move it if it covers something",chatLabel:"Chat with us",chatLabelNew:"New message from support"};function a(J){return J==="en"?K5:W5}var Y5="lw-debug-toasts",G5=6000,q5=`
1
+ (()=>{var z3=((J)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(J,{get:($,z)=>(typeof require<"u"?require:$)[z]}):J)(function(J){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+J+'" is not supported')});function x1(J){if(!J)return null;let $=J===!0?{}:J,z=(j,Q)=>typeof j==="number"&&Number.isFinite(j)&&j>=0&&j<2000?j:Q;return{side:$.position==="left"?"left":"right",x:z($.offset?.x,16),y:z($.offset?.y,16)}}var j3={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},z0=null;function _4(J){let $=[];if(!J.host?.trim())$.push("host");if(!J.realmKey?.trim())$.push("realmKey");if(!J.app?.name?.trim())$.push("app.name");if(typeof J.module!=="function")$.push("module");if($.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${$.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");z0=J}function N(){if(!z0)throw Error("[debug-capture] configureDebugCapture() has not been called");return z0}function k1(){return z0!==null}function B0(){let J=N().app;return{name:J.name,version:J.version??"0.0.0",environment:J.environment??Q3()}}function Q3(){if(typeof window>"u")return"unknown";let J=window.location.hostname;if(J==="localhost"||J==="127.0.0.1"||J.endsWith(".local"))return"development";return"production"}function L0(J){let $=z0?.capture?.[J];return typeof $==="number"?$:j3[J]}function f1(J){let $=z0?.module;if(!$)return null;try{return $(J)??null}catch{return null}}function w1(){let J=z0?.redact;return{headers:J?.headers??[],queryKeys:(J?.queryKeys??[]).map(($)=>$.toLowerCase()),bodyKeys:(J?.bodyKeys??[]).map(($)=>$.toLowerCase())}}function C4(){return z0?.capture?.overlaySelectors??[]}var X3='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',Z3="[data-lw-mask]",N4={fps:1,quality:0.5};function Q1(){let J=z0?.replay;if(!J)return null;let $=J===!0?{}:J,z=(X,Z)=>typeof X==="number"&&X>0?X:Z,j=$.maskInputs!==!1,Q=$.recordCanvas?{fps:z(typeof $.recordCanvas==="object"?$.recordCanvas.fps:void 0,N4.fps),quality:z(typeof $.recordCanvas==="object"?$.recordCanvas.quality:void 0,N4.quality)}:null;return{seconds:z($.seconds,60),maskInputs:j,maskTextSelector:$.maskTextSelector?.trim()||(j?X3:Z3),maskText:$.maskText===!0,blockSelector:$.blockSelector?.trim()||"[data-lw-private]",maxBytes:z($.maxBytes,4000000),canvas:Q}}function I4(J){if(typeof window>"u")return!1;let $;try{$=new URL(J,window.location.href)}catch{return!1}if(V3($))return!1;if($.origin===window.location.origin)return!0;return(z0?.capture?.bodyOrigins??[]).some((z)=>{try{return new URL(z).origin===$.origin}catch{return!1}})}function V3(J){if(!z0?.host)return!1;try{if(new URL(z0.host).origin!==J.origin)return!1}catch{return!1}return J.pathname.startsWith("/ingest/")}function O4(J){let $=Object.entries(J).map(([z,j])=>[z.replace(/\/+$/,"")||"/",j]).sort((z,j)=>j[0].length-z[0].length);return(z)=>{let j=(z||"/").replace(/\/+$/,"")||"/";for(let[Q,X]of $)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:X};return null}}var X1="‹redacted›",W3=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,K3=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),Y3=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,G3=/[\w.+-]+@[\w-]+\.[\w.-]+/g,U3=/\d(?:[\d\s-]{7,})\d/g;function Z1(J){return J.replace(G3,X1).replace(U3,X1)}function q3(J){if(W3.test(J))return!0;return w1().headers.some((z)=>z.toLowerCase()===J.toLowerCase())}function V1(J){let $={};for(let[z,j]of Object.entries(J))$[z]=q3(z)?X1:j;return $}function S0(J){try{let $=/^https?:\/\//i.test(J),z=new URL(J,$?void 0:"http://local.invalid"),j=!1;if(z.searchParams.forEach((Q,X)=>{if(K3.has(X.toLowerCase())||w1().queryKeys.includes(X.toLowerCase()))z.searchParams.set(X,X1),j=!0}),!j)return J;return $?z.toString():`${z.pathname}${z.search}`}catch{return J}}function N2(J,$){if($>6||J===null||typeof J!=="object")return J;if(Array.isArray(J))return J.map((j)=>N2(j,$+1));let z={};for(let[j,Q]of Object.entries(J)){let X=Y3.test(j)||w1().bodyKeys.some((Z)=>j.toLowerCase().includes(Z));z[j]=X?X1:N2(Q,$+1)}return z}function W1(J,$){if(J==null)return null;let z=J,j=J.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);z=JSON.stringify(N2(Q,0))}catch{}if(z.length>$)return`${z.slice(0,$)}… [truncated ${z.length-$} chars]`;return z}var _2=120,C2=40,p0=(J,$)=>J.length>$?`${J.slice(0,$)}…`:J,I2=(J)=>{try{return decodeURIComponent(J)}catch{return J}},u0=[],L4=0,S4=!1;function K1(J,$,z,j){let Q=p0($,_2),X=u0[u0.length-1];if(J==="navigate"&&X?.kind==="click"){let W=Q.replace(/^ไปที่\s*/,"");if(X.detail.includes(`→ ${W}`))return X.at=new Date().toISOString(),X;let Y=W.split(/[?#]/)[0]??W,U=X.source?I2(X.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(U&&(Y===U||Y.startsWith(U)))return X.detail=p0(`${X.detail} → ${W}`,_2),X.source=void 0,X.at=new Date().toISOString(),X}if(X&&X.kind===J&&X.detail===Q){if(X.at=new Date().toISOString(),J!=="navigate")X.count=(X.count??1)+1;return X}L4+=1;let Z={id:`act_${L4}`,at:new Date().toISOString(),kind:J,detail:Q,count:1,source:z,html:g1(j)};u0.push(Z);while(u0.length>L0("maxActions"))H3(u0.shift());return Z}var D3=200000,Y1=0;function g1(J){if(!J)return;if(Y1+J.length>D3)return;return Y1+=J.length,J}function H3(J){if(!J)return;if(Y1-=(J.html?.length??0)+(J.afterHtml?.length??0),Y1<0)Y1=0}function y1(J){return J instanceof Element&&Boolean(J.closest("[data-debug-reporter]"))}var M3='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',B3={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},R4={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function P3(J){let $=J.getAttribute("role");if($&&R4[$])return R4[$];return B3[J.tagName.toLowerCase()]??"ปุ่ม"}function F3(J,$){try{let z=J,j=0;while(z&&j<=$){let Q=f4(z);if(Q&&typeof Q.memoizedProps?.onClick==="function")return z;z=z.parentElement,j+=1}}catch{}return null}function N3(J){let $=J.getAttribute("aria-label")?.trim();if($)return $;let z=J.getAttribute("title")?.trim();if(z)return z;if(J instanceof HTMLInputElement||J instanceof HTMLTextAreaElement||J instanceof HTMLSelectElement)return(J.getAttribute("placeholder")||J.getAttribute("name")||"").trim();if(J instanceof HTMLImageElement)return(J.getAttribute("alt")||"").trim();let j=(J.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(J instanceof HTMLAnchorElement){let Q=J.getAttribute("href");if(Q?.startsWith("/"))return I2(Q)}return""}function _3(J){if(!(J instanceof Element))return null;let $=J.closest(M3)??F3(J,4);if(!$)return null;let z=$.tagName.toLowerCase();if(z==="html"||z==="body")return null;return $}function C3(J){let $=Z1(N3(J));if(!$)return null;return`${P3(J)} “${p0($,C2)}”`}var k4=6000,I3=4000,O3=/(?:^|\s)!?(?:fixed|absolute|sticky|inset-\S+|z-\S+|top-\S+|bottom-\S+|left-\S+|right-\S+|w-screen|h-screen|min-h-screen|max-h-screen|translate-\S+|scale-\S+)(?=\s|$)/g;function L3(J){J.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let $=[J,...Array.from(J.querySelectorAll("*"))];for(let Q of $){for(let Z of Array.from(Q.attributes)){let W=Z.name.toLowerCase();if(W.startsWith("on")||W==="srcdoc"||W==="value"||W.startsWith("data-"))Q.removeAttribute(Z.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let X=Q.getAttribute("class");if(X){let Z=X.replace(O3," ").replace(/\s+/g," ").trim();if(Z)Q.setAttribute("class",Z);else Q.removeAttribute("class")}}let z=document.createTreeWalker(J,NodeFilter.SHOW_TEXT),j=z.nextNode();while(j){if(j.nodeValue)j.nodeValue=Z1(j.nodeValue);j=z.nextNode()}}function O2(J,$,z){try{let j=J.outerHTML;if(!j||j.length>$)return;let Q=J.cloneNode(!0);L3(Q);let X=Q.outerHTML;return X&&X.length<=z?X:void 0}catch{return}}var S3=(J)=>O2(J,k4,I3),R3=150000,T3=40000,T4=(J)=>O2(J,R3,T3);function A3(J){if(!(J instanceof HTMLInputElement)&&!(J instanceof HTMLTextAreaElement)&&!(J instanceof HTMLSelectElement))return null;let $=J.name||J.id||J.getAttribute("aria-label")||J.getAttribute("placeholder")||J.tagName.toLowerCase();return`ช่อง “${Z1($)}”`}var A4=80;function f4(J){let $=Object.keys(J).find((z)=>z.startsWith("__reactFiber$")||z.startsWith("__reactInternalInstance$"));return $?J[$]:null}function E3(J){if(typeof J!=="function")return null;try{let $=Function.prototype.toString.call(J);return($.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??$.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function E4(J){if(!J)return;return`→ ${J.length>A4?`${J.slice(0,A4)}…`:J}`}function x3(J){try{let $=J.closest("a[href]")?.getAttribute("href");if($&&$.startsWith("/"))return E4($);let z=f4(J),j=0;while(z&&j<30){if(typeof z.memoizedProps?.onClick==="function")return E4(E3(z.memoizedProps.onClick));z=z.return,j+=1}return}catch{return}}var k3='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function f3(){let J=C4();return J.length?J.join(", "):k3}function w3(J){let $=J.getAttribute("role");if($==="status"||$==="alert")return"ข้อความแจ้งเตือน";if($==="menu")return"เมนู";if($==="listbox")return"รายการตัวเลือก";if($==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function y3(J){let $=J.getAttribute("aria-label")?.trim();if($)return $;let z=J.getAttribute("aria-labelledby");if(z){let X=z.split(/\s+/).map((Z)=>document.getElementById(Z)?.textContent?.trim()??"").filter(Boolean).join(" ");if(X)return X}let Q=J.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(J.textContent??"").replace(/\s+/g," ").trim()}function w4(J){let $=Z1(y3(J)),z=w3(J);return $?`เปิด ${z} “${p0($,C2)}”`:`เปิด ${z}`}var g3='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',v3=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function m3(J){if(J.querySelector(g3))return!0;return v3.test(J.textContent??"")}var h3=400,b3=250,u3=8000;function p3(J,$){if(typeof MutationObserver>"u"){$.html=g1(T4(J));return}let z=Date.now(),j=!1,Q=()=>{j=!0,Z.disconnect(),window.clearInterval(W),window.clearTimeout(Y)},X=()=>{if(j)return;if(Q(),!J.isConnected)return;$.detail=p0(w4(J),_2),$.html=g1(T4(J))},Z=new MutationObserver(()=>{z=Date.now()});Z.observe(J,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let W=window.setInterval(()=>{if(j)return;if(!J.isConnected){Q();return}if(Date.now()-z>=h3&&!m3(J))X()},b3),Y=window.setTimeout(X,u3)}function d3(J){if(y1(J))return;let $=K1("ui",w4(J));if($)p3(J,$)}function i3(){if(typeof MutationObserver>"u")return;let J=new WeakSet;new MutationObserver((z)=>{for(let j of z)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let X=f3(),Z=Q.matches(X)?[Q]:Array.from(Q.querySelectorAll(X));for(let W of Z){if(J.has(W))continue;J.add(W),d3(W)}}}).observe(document.body,{childList:!0,subtree:!0})}var c3=1600,l3=2500;function x4(J){return{disabled:J.hasAttribute("disabled")||J.getAttribute("aria-disabled")==="true",busy:J.getAttribute("aria-busy")==="true",text:p0((J.textContent??"").replace(/\s+/g," ").trim(),C2)}}function r3(J,$){if(!J.disabled&&$.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!J.busy&&$.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(J.text!==$.text&&$.text)return`ข้อความเปลี่ยนเป็น “${$.text}”`;return null}function o3(J,$){if(typeof MutationObserver>"u")return;let z=x4(J),j=!1,Q=(W,Y)=>{if(j)return;if(j=!0,X.disconnect(),window.clearTimeout(Z),$.afterNote=W,Y)$.afterHtml=g1(O2(J,k4,l3))},X=new MutationObserver(()=>{if(!J.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let W=r3(z,x4(J));if(W)Q(W,!0)});X.observe(J,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let Z=window.setTimeout(()=>{if(!j&&!J.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,X.disconnect()},c3)}function y4(){if(S4||typeof window>"u")return;S4=!0,document.addEventListener("click",(j)=>{if(y1(j.target))return;let Q=_3(j.target);if(!Q)return;let X=C3(Q);if(!X)return;let Z=K1("click",`คลิก ${X}`,x3(Q),S3(Q));if(Z)o3(Q,Z)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(y1(j.target))return;let Q=A3(j.target);if(Q)K1("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(y1(j.target))return;K1("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let J=()=>K1("navigate",`ไปที่ ${I2(S0(location.pathname+location.search))}`),$=history.pushState.bind(history),z=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=$(...j);return J(),Q},history.replaceState=(...j)=>{let Q=z(...j);return J(),Q},window.addEventListener("popstate",J),i3()}function g4(){return u0.map((J)=>({...J}))}var v4=2000,v1=[],m4=0,h4=!1;function L2(J,$){m4+=1,v1.push({id:`log_${m4}`,at:new Date().toISOString(),level:J,message:$.length>v4?`${$.slice(0,v4)}…`:$});while(v1.length>L0("maxConsoleEntries"))v1.shift()}function n3(){let J=new WeakSet;return($,z)=>{if(typeof z==="object"&&z!==null){if(J.has(z))return"[Circular]";J.add(z)}if(typeof z==="bigint")return z.toString();return z}}function b4(J){if(typeof J==="string")return J;if(J instanceof Error)return`${J.name}: ${J.message}`;try{let $=JSON.stringify(J,n3());if($!==void 0)return $}catch{}try{return String(J)}catch{}try{return Object.prototype.toString.call(J)}catch{return`[${typeof J}]`}}function u4(){if(h4||typeof window>"u")return;h4=!0;let J=["log","info","warn","error","debug"];for(let $ of J){let z=console[$].bind(console);console[$]=(...j)=>{L2($,j.map(b4).join(" ")),z(...j)}}window.addEventListener("error",($)=>{let z=$.filename?` (${$.filename}:${$.lineno}:${$.colno})`:"";L2("exception",`${$.message}${z}`)}),window.addEventListener("unhandledrejection",($)=>{let z=$.reason instanceof Error?`${$.reason.name}: ${$.reason.message}`:b4($.reason);L2("unhandledrejection",z)})}function p4(){return v1.map((J)=>({...J}))}var d4=new Set,i4=new Set;function c4(J,$){return J.add($),()=>J.delete($)}function l4(J,$){for(let z of[...J])z($)}function r4(J){return c4(d4,J)}function d0(J={type:"manual"}){l4(d4,J)}function o4(J){return c4(i4,J)}function n4(J){l4(i4,J)}var s3=15000,a3=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],s4=!1,a4=0;function t3(J){return a3.some(($)=>J.includes($))}function t4(J){let $=J.message??"";if(!$||t3($))return;let z=Date.now();if(z-a4<s3)return;a4=z,n4({...J,message:$})}function e4(){if(s4||typeof window>"u")return;s4=!0,window.addEventListener("error",(J)=>{if(!J.message&&!J.error)return;let $=J.error instanceof Error?J.error:null;t4({type:"runtime-error",message:J.message||($?$.message:"Unknown error"),stack:$?.stack})}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason;t4({type:"unhandledrejection",message:$ instanceof Error?$.message:String($),stack:$ instanceof Error?$.stack:void 0})})}var j6=4000,e3=1e6,J5=1e7,m1=[],J6=0,$6=!1;function Q6(J){m1.push(J);while(m1.length>L0("maxRequests"))m1.shift()}function X6(){return J6+=1,`req_${J6}`}function z6(J){let $={};if(!J)return $;if(J instanceof Headers)J.forEach((z,j)=>{$[j]=z});else if(Array.isArray(J))for(let[z,j]of J)$[z]=j;else Object.assign($,J);return $}function $5(J){let $={};return J.forEach((z,j)=>{$[j]=z}),$}function z5(J){if(J==null)return null;if(typeof J==="string")return J;if(J instanceof URLSearchParams)return J.toString();if(typeof FormData<"u"&&J instanceof FormData)return`[FormData: ${Array.from(J.keys()).join(", ")}]`;if(typeof Blob<"u"&&J instanceof Blob)return`[Blob ${J.size} bytes]`;if(J instanceof ArrayBuffer)return`[ArrayBuffer ${J.byteLength} bytes]`;return"[binary]"}function j5(J,$){let z="",j="GET",Q={},X=null;if(typeof J==="string")z=J;else if(J instanceof URL)z=J.toString();else z=J.url,j=J.method||j,Q=z6(J.headers);if($){if($.method)j=$.method;if($.headers)Q={...Q,...z6($.headers)};if($.body!==void 0)X=z5($.body)}return{method:j.toUpperCase(),url:z,headers:Q,body:X}}function Z6(J){return!I4(J)}function Q5(J,$){if(Z6($.url)){$.responseSnippet="[body not captured for this origin]";return}let z=J.headers.get("content-type")??"",j=Number(J.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(z)){$.responseSnippet=`[binary ${z||"unknown"}${Q}]`;return}if(j>e3){$.responseSnippet=`[response ${z||"text"}${Q} — omitted]`;return}try{J.clone().text().then((X)=>{$.responseSnippet=W1(X,L0("maxBodyChars"))}).catch(()=>{})}catch{}}function V6(J,$){if(/[?&]_rsc=/.test(J))return!0;for(let z of Object.keys($)){let j=z.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function X5(){if(typeof window>"u"||typeof window.fetch!=="function")return;let J=window.fetch.bind(window);window.fetch=Object.assign(async($,z)=>{let j=j5($,z);if(V6(j.url,j.headers))return J($,z);let Q={id:X6(),startedAt:new Date().toISOString(),method:j.method,url:S0(j.url),requestHeaders:V1(j.headers),requestBody:W1(j.body,j6),status:null,statusText:null,durationMs:null,via:"fetch"};Q6(Q);let X=performance.now();try{let Z=await J($,z);return Q.status=Z.status,Q.statusText=Z.statusText,Q.durationMs=Math.round(performance.now()-X),Q.responseHeaders=V1($5(Z.headers)),Q5(Z,Q),Z}catch(Z){throw Q.durationMs=Math.round(performance.now()-X),Q.error=Z instanceof Error?`${Z.name}: ${Z.message}`:String(Z),Z}},J)}function Z5(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let J=XMLHttpRequest.prototype,$=J.open,z=J.send,j=function(X,Z){let W=typeof Z==="string"?Z:Z.toString();return this.__lwEntry=V6(W,{})?void 0:{id:X6(),startedAt:"",method:(X||"GET").toUpperCase(),url:S0(W),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},$.apply(this,arguments)},Q=function(X){let Z=this.__lwEntry;if(Z){Z.startedAt=new Date().toISOString(),Z.requestBody=typeof X==="string"?W1(X,j6):X==null?null:"[non-string body]";let W=performance.now();Q6(Z),this.addEventListener("loadend",()=>{if(Z.status=this.status||null,Z.statusText=this.statusText||null,Z.durationMs=Math.round(performance.now()-W),Z6(Z.url))Z.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{Z.responseSnippet=W1(this.responseText||"",L0("maxBodyChars"))}catch{}else{let Y=this.getResponseHeader("content-type")??this.responseType;Z.responseSnippet=`[binary ${Y}]`}})}return z.apply(this,arguments)};J.open=j,J.send=Q}function W6(){if($6)return;$6=!0,X5(),Z5()}function K6(){let J=m1.map((z)=>({...z})),$=0;for(let z=J.length-1;z>=0;z-=1){let j=J[z],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if($+Q.length>J5)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else $+=Q.length}return J}var V5=4,Y6=3,W5=4000,K5="[data-debug-reporter]",G6=()=>import("@rrweb/record");function U6(J){G6=J}var Z0=[],S2=null,h1=!1;function q6(){if(typeof window>"u"||S2||h1)return;let J=Q1();if(!J)return;h1=!0;let $=()=>void Y5(J);if("requestIdleCallback"in window)window.requestIdleCallback($,{timeout:3000});else setTimeout($,1000)}async function Y5(J){let $;try{$=(await G6()).record}catch(z){h1=!1,console.warn("[debug-capture] session replay could not start:",z);return}if(S2)return;try{S2=$({emit:(z)=>G5(z),checkoutEveryNms:Math.max(1000,J.seconds*1000/2),checkoutEveryNth:W5,maskAllInputs:J.maskInputs,maskTextSelector:J.maskText?"*":J.maskTextSelector,blockSelector:`${J.blockSelector}, ${K5}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...J.canvas?{canvas:J.canvas.fps}:{}},recordCanvas:J.canvas!==null,...J.canvas?{dataURLOptions:{type:"image/webp",quality:J.canvas.quality}}:{},errorHandler:()=>!0})??null}catch(z){console.warn("[debug-capture] session replay could not start:",z)}finally{h1=!1}}function G5(J){if(J.type===V5||Z0.length===0){if(Z0.push([]),Z0.length>Y6)Z0=Z0.slice(-Y6)}Z0[Z0.length-1].push(J)}function D6(J=Date.now()){let $=Q1();if(!$||!Z0.length)return null;let z=J-$.seconds*1000,j=Z0.length-1;while(j>0&&(Z0[j][0]?.timestamp??J)>z)j-=1;let Q=Z0.slice(j).flat(),X=Q[0]?.timestamp,Z=Q[Q.length-1]?.timestamp;if(X===void 0||Z===void 0)return null;return{events:Q,startedAt:new Date(X).toISOString(),endedAt:new Date(Z).toISOString(),durationMs:Math.max(0,Z-X)}}var U5={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindRequest:"คำขอ",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",problemInsteadShare:"แจ้งปัญหาแทน (แนบภาพหน้าจอ)",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTypeSearch:"ค้นหาเรื่องที่ขอ",requestTypeNone:"ไม่พบเรื่องที่ขอ — ลองคำอื่น",requestTypeCount:"{n} เรื่อง — เลื่อนดูหรือพิมพ์ค้นหา",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง",ringTitle:"ทีมงานกำลังโทรหาคุณ",ringAbout:"เรื่อง {key} · {title}",ringChat:"จากแชทกับทีมงาน",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า",ringHint:"เมื่อรับสาย เบราว์เซอร์จะขอใช้ไมโครโฟน · ระหว่างคุย ทีมงานอาจขอดูหน้าจอ — คุณเลือกได้เสมอว่าจะให้ดูหรือไม่",ringTest:"ทดสอบไมค์และลำโพงก่อนรับสาย",ringAnswer:"รับสาย",ringAnswering:"กำลังรับสาย…",ringFallback:"เปิดสายในหน้านี้ไม่ได้ — รับสายในแท็บใหม่แทน ไม่ต้องเข้าสู่ระบบอีก",chatOpen:"แชทกับทีมงาน",chatTitle:"แชทกับทีมงาน",chatUnread:"{n} ข้อความใหม่จากทีมงาน",chatMove:"แชทกับทีมงาน — ลากเพื่อย้ายไปที่อื่นได้ถ้าบังอะไรอยู่",chatLabel:"แชทกับทีมงาน",chatLabelNew:"มีข้อความใหม่จากทีมงาน"},q5={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",failedOffline:"Could not send — the server could not be reached. What you wrote is still here; check your connection and try again.",failedUnavailable:"Could not send — the system is being updated. What you wrote is still here; try again in a moment.",failedTooMany:"Too many reports — try again in {seconds} seconds.",captured:"Captured",reporter:"Reporter",page:"Page",replay:"activity log",handoffTitle:"Opening the support portal",handoffBody:"You will be signed in automatically to see what you reported",handoffGo:"Go now",handoffPreparing:"Preparing…",handoffFailed:"Could not open your reports",handoffBlocked:"Your browser blocked the new tab",handoffOpen:"Open in a new tab",chooseTitle:"How can the team help?",kindProblem:"Report a problem",kindRequest:"Request",askInstead:"Asking for something?",askInsteadAction:"Choose what you need",problemInstead:"Something broken?",problemInsteadAction:"Report a problem instead",problemInsteadShare:"Report a problem instead (with a screenshot)",chooseProblemHint:"Something is broken or not working — with a screenshot",chooseRequestHint:"Ask the team to do something, like access or a data change — no screen sharing",requestTitle:"Ask the team",requestTypeLabel:"What you need",requestTypeSearch:"Search what you need",requestTypeNone:"Nothing matches — try another word",requestTypeCount:"{n} to choose from — scroll or search",requestTarget:"The team aims to finish within {time}",requestSummaryLabel:"Subject",requestSummaryPlaceholder:"What do you need — briefly",requestDetailLabel:"Details (optional)",requestDetailPlaceholder:"What the team needs to know to do it",requestSubmit:"Send request",requestSubmitted:"Request sent",requestWithShot:"Attach this screenshot to the request",requestAnnotateHint:"Mark what you are asking about — box it, point at it, highlight it, or type on it",draftRestored:"What you typed last time, not sent yet",draftClear:"Clear",requestLeaves:"Not sent with a request",requestLeavesWhat:"this page's activity log — it is for problem reports only",days:"{n} days",hours:"{n} hours",ringTitle:"The support team is calling you",ringAbout:"About {key} · {title}",ringChat:"From your chat with support",ringHow:"Answer on your request's page — it opens in a new tab, already signed in",ringOpen:"Open to answer",ringDecline:"Decline",ringOpened:"Opened — press Answer in the new tab",ringBlocked:"Your browser blocked the new tab — open the call here",ringClose:"Close",ringTab:"\uD83D\uDCDE Incoming call",ringHint:"When you answer, your browser asks for the microphone · during the call the team may ask to see your screen — you always choose",ringTest:"Test the microphone and speaker first",ringAnswer:"Answer",ringAnswering:"Answering…",ringFallback:"The call can't open on this page — answer in a new tab instead, already signed in",chatOpen:"Chat with support",chatTitle:"Chat with support",chatUnread:"{n} new from support",chatMove:"Chat with support — drag to move it if it covers something",chatLabel:"Chat with us",chatLabelNew:"New message from support"};function e(J){return J==="en"?q5:U5}var D5="lw-debug-toasts",H5=6000,M5=`
2
2
  :host { all: initial; }
3
3
  .stack {
4
4
  position: fixed; top: 16px; right: 16px; z-index: 2147483001;
@@ -30,7 +30,7 @@
30
30
  }
31
31
  @keyframes in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
32
32
  @media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
33
- `,S2=null;function U5(){if(typeof document>"u")return null;if(S2?.isConnected)return S2;let J=document.createElement(Y5);J.dataset.debugReporter="true";let $=J.attachShadow({mode:"open"}),z=document.createElement("style");z.textContent=q5;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),$.append(z,j),document.body.append(J),S2=j,j}function i0(J,$="success",z){let j=k1()?P().toast:void 0;if(j){j({message:J,tone:$,...z?{action:z}:{}});return}let Q=U5();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=$;let X=document.createElement("span");X.className="dot";let W=document.createElement("span");W.textContent=J;let Y=document.createElement("button");Y.type="button",Y.className="close",Y.textContent="✕",Y.setAttribute("aria-label","ปิด");let q=()=>{window.clearTimeout(B),Z.remove()};Y.addEventListener("click",q);let B=$==="error"||z?0:window.setTimeout(q,G5);if(Z.append(X,W),z){let F=document.createElement("button");F.type="button",F.className="action",F.textContent=z.label,F.addEventListener("click",()=>{q(),z.onClick()}),Z.append(F)}Z.append(Y),Q.append(Z)}function D6(J,$,z){let j=J.filter((Z)=>Boolean(Z.error)||Z.status!=null&&Z.status>=400).slice(-20).map((Z)=>({method:Z.method,url:Z.url,status:Z.status,error:Z.error,at:Z.startedAt})),Q=$.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:z.slice(0,20)}}function D5(){let J={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return J;let $=performance.memory;if($)J.memoryUsedMb=Math.round($.usedJSHeapSize/1024/1024),J.memoryLimitMb=Math.round($.jsHeapSizeLimit/1024/1024);let[z]=performance.getEntriesByType("navigation");if(z)J.domContentLoadedMs=Math.round(z.domContentLoadedEventEnd),J.loadEventMs=Math.round(z.loadEventEnd);return J}function R2(J,$){if(!J)return $;try{return J()}catch{return $}}function H6(){let J=P(),{pathname:$,search:z,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:$,search:z},module:f1($),user:R2(J.user,{}),apiHeaders:V1(R2(J.headers,{})),app:{name:P0().name,version:P0().version,environment:P0().environment},client:{userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,online:navigator.onLine,viewport:{width:window.innerWidth,height:window.innerHeight,dpr:window.devicePixelRatio},screen:{width:window.screen.width,height:window.screen.height}},performance:D5(),extra:R2(J.extra,{})}}var H5=2;function b1(J){let $=W6(),z=u4();return{context:H6(),reason:J.reason,note:J.note,cause:D6($,z,J.erroredQueries),actionTrail:y4(),network:$,console:z,screenshotDataUrl:J.screenshotDataUrl,screenshotMethod:J.screenshotMethod,replay:U6()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:H5}}}async function A2(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let z=await M5();if(z.status==="ok")return{dataUrl:z.dataUrl,method:"display-media"};if(z.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let $=await F5();if($)return{dataUrl:$,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function M5(){let J=null;try{let $={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};J=await navigator.mediaDevices.getDisplayMedia($);let z=await P5(J);return z?{status:"ok",dataUrl:z}:{status:"error"}}catch($){if($ instanceof DOMException&&($.name==="NotAllowedError"||$.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{J?.getTracks().forEach(($)=>$.stop())}}async function P5(J){let $=document.createElement("video");$.srcObject=J,$.muted=!0,$.playsInline=!0,await new Promise((X)=>{let W=!1,Y=()=>{if(W)return;W=!0,X()};$.onloadedmetadata=()=>{$.play().then(Y).catch(Y)},window.setTimeout(Y,1500)}),await B5($);let{videoWidth:z,videoHeight:j}=$;if(!z||!j)return null;let Q=document.createElement("canvas");Q.width=z,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage($,0,0,z,j),$.pause(),$.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function B5(J){return new Promise(($)=>{let z=!1,j=()=>{if(z)return;z=!0,$()},Q=J;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function F5(){let J=P().screenshotFallback;if(!J)return null;let $=await J().catch(()=>null);if(!$)return null;try{return await $(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:(z)=>!(z instanceof HTMLElement&&z.dataset?.debugReporter==="true")})}catch{return null}}var N5=2000,_5=0.82,I5=3000000;function C5(J){return new Promise(($,z)=>{let j=new Image;j.onload=()=>$(j),j.onerror=()=>z(Error("could not read the screenshot")),j.src=J})}async function u1(J){try{let $=await C5(J),z=Math.max($.naturalWidth,$.naturalHeight),j=Math.min(1,N5/z),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round($.naturalWidth*j)),Q.height=Math.max(1,Math.round($.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return J;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage($,0,0,Q.width,Q.height);let X=_5,W=Q.toDataURL("image/jpeg",X);while(W.length>I5&&X>0.4)X-=0.15,W=Q.toDataURL("image/jpeg",X);return W}catch{return J}}var O5=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,L5=/^\d+$/,S5=/^[0-9a-f]{16,}$/i;function M6(J){if(J.reason.type==="manual")return null;let $=J.cause?.failedRequests?.[0];if(!$?.url)return null;let z;try{z=new URL($.url,"http://x").pathname}catch{z=$.url}let j=z.split("/").map((Z)=>O5.test(Z)||L5.test(Z)||S5.test(Z)?":id":Z).join("/"),Q=$.status??($.error?"ERR":"?");return`${$.method??"REQ"} ${j} ${Q}`}var P6=2000000;function p1(J){let{screenshotDataUrl:$,replay:z,...j}=J;return JSON.stringify(j).length}function B6(J,$=2000000){if(p1(J)<=$)return J;let z=J.network.map((Q)=>({...Q})),j={...J,network:z};for(let Q of z){if(p1(j)<=$)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&p1(j)>$)j.network=j.network.slice(1);while(j.console.length>1&&p1(j)>$)j.console=j.console.slice(1);return j}function G1(J){let $="";for(let z=0;z<J.length;z+=32768)$+=String.fromCharCode(...J.subarray(z,z+32768));return btoa($)}var R5=4,A5=2,T5=3,x5=0,E5=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),k5=/^\s*javascript:/i;function f5(J,$){let z=J.toLowerCase();if(z.startsWith("on")||z==="srcdoc")return!0;return typeof $==="string"&&k5.test($)}function F6(J,$=!1){if(!J)return;for(let z of Object.keys(J)){let j=J[z];if(f5(z,j)){if($)J[z]=null;else delete J[z];continue}if(typeof j!=="string"||!E5.has(z)||!j.includes("?"))continue;J[z]=L0(j)}}function T2(J){if(!J)return;F6(J.attributes);for(let $ of J.childNodes??[])T2($)}function N6(J){let $=JSON.parse(JSON.stringify(J));for(let z of $){let j=z.data;if(!j||typeof j!=="object")continue;if(z.type===R5&&typeof j.href==="string")j.href=L0(j.href);else if(z.type===A5)T2(j.node);else if(z.type===T5&&j.source===x5){for(let Q of j.adds??[])T2(Q.node);for(let Q of j.attributes??[])F6(Q.attributes,!0)}}return $}var w5="session-replay.json.gz",y5="session-replay.json";function v5(J){return Boolean(J&&J.events.length>0)}async function g5(J){if(typeof CompressionStream>"u")return null;try{let $=new Blob([J]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response($).arrayBuffer())}catch{return null}}async function I6(J,$){if(!v5(J))return{summary:{omitted:"empty"}};let j={seconds:Math.round(J.durationMs/1000),events:J.events.length,startedAt:J.startedAt,endedAt:J.endedAt},Q=N6(J.events),Z=await _6(Q),X=!1;if(Z.bytes.byteLength>$&&b5(Q))Q=u5(Q),Z=await _6(Q),X=!0;let{bytes:W,compressed:Y}=Z;if(W.byteLength>$)return{summary:{...j,bytes:W.byteLength,omitted:"too-large"}};return{dataUri:`data:${Y?"application/gzip":"application/json"};base64,${G1(W)}`,filename:Y?w5:y5,summary:{...j,events:Q.length,bytes:W.byteLength,compressed:Y,...X?{canvasDropped:X}:{}}}}async function _6(J){let $=new TextEncoder().encode(JSON.stringify({events:J})),z=await g5($);return z?{bytes:z,compressed:!0}:{bytes:$,compressed:!1}}var m5=3,C6=2,h5=9;function O6(J){return J.type===m5&&J.data?.source===h5}function b5(J){return J.some(O6)||J.some(($)=>$.type===C6&&L6($.data.node))}function L6(J){if(!J)return!1;if(J.attributes&&"rr_dataURL"in J.attributes)return!0;return(J.childNodes??[]).some(L6)}function S6(J){if(!J)return;if(J.attributes&&"rr_dataURL"in J.attributes)delete J.attributes.rr_dataURL;for(let $ of J.childNodes??[])S6($)}function u5(J){let $=[];for(let z of J){if(O6(z))continue;if(z.type===C6)S6(z.data.node);$.push(z)}return $}var p5=new Set([502,503,504]);class B0 extends Error{kind;retryAfter;status;constructor(J,$,z,j){super(J);this.kind=$;this.retryAfter=z;this.status=j;this.name="ReportError"}}function d5(J){let{screenshotDataUrl:$,replay:z,...j}=J;return{dataUri:`data:application/json;base64,${G1(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function x2(){let J=P().identity;if(!J)return{};try{let $=await J();return $?{authorization:`Bearer ${$}`}:{}}catch{return{}}}async function R6(J,$){let z=P(),j=B6($,P6),{context:Q,note:Z}=j,X=[];if(j.screenshotDataUrl){let C=await u1(j.screenshotDataUrl);X.push({dataUri:C,filename:"screenshot.jpg"})}X.push(d5(j));let W,Y=Q1();if(Y){let C=await I6(j.replay,Y.maxBytes);if(W=C.summary,"dataUri"in C)X.push({dataUri:C.dataUri,filename:C.filename})}let q=M6(j),B={title:J,description:Z.trim()||void 0,appName:P0().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:P0().name,module:Q.module?.label??""},context:{...q?{signature:q}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...W?{replay:W}:{}},attachments:X,...j.reason.fromChat?{fromChat:!0}:{}},F=await fetch(`${z.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":z.realmKey,...await x2()},body:JSON.stringify(B)}).catch(()=>{throw new B0("report never left the browser","offline")});if(!F.ok)throw await E2(F);return await F.json()}async function E2(J){let $=J.headers.get("retry-after"),z=await J.json().then((j)=>j.error).catch(()=>null);if(J.status===429)return new B0("rate limited","rateLimited",$??void 0);if(p5.has(J.status))return new B0("desk unavailable","unavailable");return new B0(z??`Report failed (${J.status})`,"rejected",void 0,J.status)}var d1=null,q1=null,A6=()=>P().host.replace(/\/$/,"");function k2(){return d1}function c0(){if(q1)return q1;return q1=(async()=>{try{let J=await fetch(`${A6()}/ingest/request-types`,{headers:{"x-realm-key":P().realmKey}}),$=J.ok?await J.json():null;d1=Array.isArray($?.types)?$.types.filter(i5):[]}catch{d1=[],q1=null}return d1??[]})(),q1}function i5(J){let $=J;return!!$&&typeof $.id==="string"&&typeof $.name==="string"}async function T6(J){let $=P(),z={};try{z=$.user?.()??{}}catch{z={}}let j=typeof window>"u"?null:window.location,Q={title:J.title,description:J.description.trim()||void 0,ticketTypeId:J.ticketTypeId,appName:P0().name,category:j?f1(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:z.email??void 0,requesterName:z.fullName??void 0,attachments:J.screenshotDataUrl?[{dataUri:await u1(J.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${A6()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await x2()},body:JSON.stringify(Q)}).catch(()=>{throw new B0("request never left the browser","offline")});if(!Z.ok)throw await E2(Z);return await Z.json()}var U1=Math.PI/6;function x6(J,$,z){let j=$.x-J.x,Q=$.y-J.y,Z=Math.hypot(j,Q),X=Math.atan2(Q,j),W=[{x:$.x,y:$.y},{x:$.x-z*Math.cos(X-U1),y:$.y-z*Math.sin(X-U1)},{x:$.x-z*Math.cos(X+U1),y:$.y-z*Math.sin(X+U1)}],Y=z*Math.cos(U1)*0.92;if(Z<=Y)return{shaft:null,head:W};return{shaft:{from:J,to:{x:$.x-Y*Math.cos(X),y:$.y-Y*Math.sin(X)}},head:W}}var f2="#f44336",c5="rgba(250, 204, 21, 0.4)",w2=22,E6="#2563eb",k6=9,f6=11,w6=18,y6=4,i1=8,l5=[{id:"nw",fx:0,fy:0,cursor:"nwse-resize"},{id:"n",fx:0.5,fy:0,cursor:"ns-resize"},{id:"ne",fx:1,fy:0,cursor:"nesw-resize"},{id:"e",fx:1,fy:0.5,cursor:"ew-resize"},{id:"se",fx:1,fy:1,cursor:"nwse-resize"},{id:"s",fx:0.5,fy:1,cursor:"ns-resize"},{id:"sw",fx:0,fy:1,cursor:"nesw-resize"},{id:"w",fx:0,fy:0.5,cursor:"ew-resize"}];function v6(J,$,z){let j=[],Q=null,Z=-1,X=null,W=null,Y=J.getContext("2d");function q(){let V=J.getBoundingClientRect().width;return V>0?J.width/V:1}function B(V){let K=J.getBoundingClientRect();return{x:(V.clientX-K.left)/K.width*J.width,y:(V.clientY-K.top)/K.height*J.height}}function F(V){let K=V.size??w2;if(!Y)return(V.text?.length??0)*K*0.6;Y.save(),Y.font=`600 ${K}px system-ui, sans-serif`;let U=Y.measureText(V.text??"").width;return Y.restore(),U}function C(V){if(V.tool==="text"){let K=V.size??w2;return{left:V.x1,top:V.y1,right:V.x1+F(V),bottom:V.y1+K*1.25}}return{left:Math.min(V.x1,V.x2),top:Math.min(V.y1,V.y2),right:Math.max(V.x1,V.x2),bottom:Math.max(V.y1,V.y2)}}function g(V){if(V.tool==="arrow")return[{id:"tail",x:V.x1,y:V.y1,cursor:"move"},{id:"head",x:V.x2,y:V.y2,cursor:"move"}];let K=C(V);if(V.tool==="text")return[{id:"size",x:K.right,y:K.bottom,cursor:"nwse-resize"}];return l5.map((U)=>({id:U.id,x:K.left+(K.right-K.left)*U.fx,y:K.top+(K.bottom-K.top)*U.fy,cursor:U.cursor}))}function v(V){let K=C(V);return{x:K.right+w6*q(),y:K.top-w6*q()}}function h(V,K,U){let{shaft:G,head:D}=x6({x:K.x1,y:K.y1},{x:K.x2,y:K.y2},Math.max(10,16*U));if(G)V.lineCap="butt",V.beginPath(),V.moveTo(G.from.x,G.from.y),V.lineTo(G.to.x,G.to.y),V.stroke();V.beginPath(),V.moveTo(D[0].x,D[0].y),V.lineTo(D[1].x,D[1].y),V.lineTo(D[2].x,D[2].y),V.closePath(),V.fill()}function _(V,K,U){V.save(),V.lineWidth=Math.max(2,3*U),V.strokeStyle=f2,V.fillStyle=f2;let G=C(K);if(K.tool==="rect")V.strokeRect(G.left,G.top,G.right-G.left,G.bottom-G.top);else if(K.tool==="arrow")h(V,K,U);else if(K.tool==="highlight")V.fillStyle=c5,V.fillRect(G.left,G.top,G.right-G.left,G.bottom-G.top);else if(K.tool==="text"&&K.text){let D=K.size??w2;V.font=`600 ${D}px system-ui, sans-serif`,V.textBaseline="top";let M=D*0.22;V.fillStyle="rgba(255,255,255,0.92)",V.fillRect(G.left-M,G.top-M,G.right-G.left+M*2,G.bottom-G.top+M*2),V.fillStyle=f2,V.fillText(K.text,G.left,G.top)}V.restore()}function S(V,K,U){let G=C(K);V.save(),V.strokeStyle=E6,V.lineWidth=Math.max(1,1.5*U),V.setLineDash([6*U,4*U]),V.strokeRect(G.left,G.top,G.right-G.left,G.bottom-G.top),V.setLineDash([]);let D=k6*U;for(let n of g(K))V.fillStyle="#fff",V.strokeStyle=E6,V.lineWidth=Math.max(1,1.5*U),V.beginPath(),V.rect(n.x-D/2,n.y-D/2,D,D),V.fill(),V.stroke();let M=v(K),k=f6*U;V.beginPath(),V.arc(M.x,M.y,k,0,Math.PI*2),V.fillStyle="#dc2626",V.fill(),V.strokeStyle="#fff",V.lineWidth=Math.max(1.5,2*U),V.beginPath(),V.moveTo(M.x-k*0.4,M.y-k*0.4),V.lineTo(M.x+k*0.4,M.y+k*0.4),V.moveTo(M.x+k*0.4,M.y-k*0.4),V.lineTo(M.x-k*0.4,M.y+k*0.4),V.stroke(),V.restore()}function N(){if(!Y)return;let V=q();if(Y.clearRect(0,0,J.width,J.height),Y.drawImage($,0,0,J.width,J.height),j.forEach((U,G)=>{if(G!==$0)_(Y,U,V)}),X)_(Y,X,V);let K=j[Z];if(K&&!X)S(Y,K,V)}function b(V,K,U,G,D){return Math.abs(V-U)<=D&&Math.abs(K-G)<=D}function T(V,K){let U=j[Z];if(!U)return null;let G=k6*q()/2+3*q();for(let D of g(U))if(b(V,K,D.x,D.y,G))return D.id;return null}function x(V,K){let U=j[Z];if(!U)return!1;let G=v(U);return b(V,K,G.x,G.y,f6*q())}function O(V,K){let U=6*q();for(let G=j.length-1;G>=0;G-=1){let D=j[G];if(D.tool==="arrow"){let k=D.x2-D.x1,n=D.y2-D.y1,G0=Math.hypot(k,n)||1,H=Math.max(0,Math.min(1,((V-D.x1)*k+(K-D.y1)*n)/(G0*G0)));if(Math.hypot(V-(D.x1+H*k),K-(D.y1+H*n))<=U+4*q())return G;continue}let M=C(D);if(V>=M.left-U&&V<=M.right+U&&K>=M.top-U&&K<=M.bottom+U)return G}return-1}function L(V,K,U,G,D){if(K==="tail"){V.x1=U.x1+G,V.y1=U.y1+D;return}if(K==="head"){V.x2=U.x2+G,V.y2=U.y2+D;return}if(K==="size"){let f=(U.size??24)+D;V.size=Math.max(10,f);return}let M=C(U),{left:k,top:n,right:G0,bottom:H}=M;if(K.includes("w"))k=Math.min(G0-i1,k+G);if(K.includes("e"))G0=Math.max(k+i1,G0+G);if(K.includes("n"))n=Math.min(H-i1,n+D);if(K.includes("s"))H=Math.max(n+i1,H+D);V.x1=k,V.y1=n,V.x2=G0,V.y2=H}function m(V,K,U,G){V.x1=K.x1+U,V.y1=K.y1+G,V.x2=K.x2+U,V.y2=K.y2+G}let E=null,$0=-1,w={x:0,y:0,size:24};function p(){let V=J.getBoundingClientRect().width;return V>0?V/J.width:1}function H0(V,K){if(!Y)return V.length*K*0.6;Y.save(),Y.font=`600 ${K}px system-ui, sans-serif`;let U=Y.measureText(V||" ").width;return Y.restore(),U}function l(){if(!E)return;let V=J.parentElement;if(!V)return;let K=J.getBoundingClientRect(),U=V.getBoundingClientRect(),G=p(),D=w.size*G;E.style.left=`${K.left-U.left+w.x*G}px`,E.style.top=`${K.top-U.top+w.y*G}px`,E.style.fontSize=`${D}px`,E.style.width=`${Math.max(40,H0(E.value,D)+D)}px`}function _0(V){let K=E;if(!K)return;E=null;let U=K.value.trim(),G=$0;if($0=-1,K.remove(),V&&U){if(G>=0&&j[G])j[G].text=U,Z=G;else j.push({tool:"text",x1:w.x,y1:w.y,x2:w.x,y2:w.y,text:U,size:w.size}),Z=j.length-1;z()}else if(G>=0)Z=G;J.focus(),N()}function M0(V,K,U=-1){_0(!0);let G=J.parentElement;if(!G)return;if(getComputedStyle(G).position==="static")G.style.position="relative";let D=U>=0?j[U]:void 0;$0=U,w={x:D?.x1??V,y:D?.y1??K,size:D?.size??Math.round(24*q())};let M=document.createElement("input");M.type="text",M.className="text-edit",M.value=D?.text??"",M.setAttribute("aria-label","ข้อความบนภาพ"),M.placeholder="ข้อความ",E=M,G.append(M),l(),M.addEventListener("input",l),M.addEventListener("keydown",(k)=>{if(k.stopPropagation(),k.key==="Enter")_0(!0);else if(k.key==="Escape")_0(!1)}),requestAnimationFrame(()=>{if(E!==M)return;M.focus(),M.select(),M.addEventListener("blur",()=>_0(!0))}),N()}function K0(V){let{x:K,y:U}=B(V);if(J.setPointerCapture(V.pointerId),x(K,U)){Y0();return}let G=T(K,U);if(G&&j[Z]){W={grip:G,x:K,y:U,start:{...j[Z]}};return}if(Q==="text"){if(V.preventDefault(),J.hasPointerCapture(V.pointerId))J.releasePointerCapture(V.pointerId);Q=null,z(),M0(K,U);return}if(Q){X={tool:Q,x1:K,y1:U,x2:K,y2:U},Z=-1;return}let D=O(K,U);Z=D,W=D>=0?{grip:"body",x:K,y:U,start:{...j[D]}}:null,N()}function h0(V){let{x:K,y:U}=B(V);if(X){X.x2=K,X.y2=U,N();return}if(W){let D=j[Z];if(!D)return;let M=K-W.x,k=U-W.y;if(W.grip==="body")m(D,W.start,M,k);else L(D,W.grip,W.start,M,k);N();return}if(Q){J.style.cursor="crosshair";return}if(x(K,U)){J.style.cursor="pointer";return}let G=T(K,U);if(G){let D=j[Z]?g(j[Z]).find((M)=>M.id===G):null;J.style.cursor=D?.cursor??"pointer";return}J.style.cursor=O(K,U)>=0?"move":"default"}function k0(){if(X){if(!(Math.abs(X.x2-X.x1)<y6&&Math.abs(X.y2-X.y1)<y6))j.push(X),Z=j.length-1,Q=null,z();X=null}if(W)W=null,z();N()}function I0(V){let K=J.getBoundingClientRect(),U=(V.clientX-K.left)/K.width*J.width,G=(V.clientY-K.top)/K.height*J.height,D=O(U,G),M=j[D];if(!M||M.tool!=="text")return;V.preventDefault(),M0(M.x1,M.y1,D)}function C0(V){if(Z<0)return;if(V.key==="Delete"||V.key==="Backspace")V.preventDefault(),Y0();else if(V.key==="Escape")V.preventDefault(),Z=-1,N()}function Y0(){if(Z<0)return;j.splice(Z,1),Z=-1,z(),N()}return J.addEventListener("pointerdown",K0),J.addEventListener("pointermove",h0),J.addEventListener("pointerup",k0),J.addEventListener("pointercancel",k0),J.addEventListener("dblclick",I0),J.tabIndex=0,J.addEventListener("keydown",C0),N(),{setTool(V){Q=V,Z=-1,J.style.cursor=V?"crosshair":"default",N()},deleteSelected:Y0,clear(){j.length=0,Z=-1,z(),N()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let V=document.createElement("canvas");V.width=$.naturalWidth,V.height=$.naturalHeight;let K=V.getContext("2d");if(!K)return J.toDataURL("image/png");K.drawImage($,0,0);let U=q();for(let G of j)_(K,G,U);return V.toDataURL("image/png")},destroy(){_0(!1),J.removeEventListener("pointerdown",K0),J.removeEventListener("pointermove",h0),J.removeEventListener("pointerup",k0),J.removeEventListener("pointercancel",k0),J.removeEventListener("dblclick",I0),J.removeEventListener("keydown",C0)}}}var r5=["keydown","keyup","keypress"];function l0(J){for(let $ of r5)J.addEventListener($,(z)=>z.stopPropagation())}var g6=`
33
+ `,R2=null;function B5(){if(typeof document>"u")return null;if(R2?.isConnected)return R2;let J=document.createElement(D5);J.dataset.debugReporter="true";let $=J.attachShadow({mode:"open"}),z=document.createElement("style");z.textContent=M5;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),$.append(z,j),document.body.append(J),R2=j,j}function i0(J,$="success",z){let j=k1()?N().toast:void 0;if(j){j({message:J,tone:$,...z?{action:z}:{}});return}let Q=B5();if(!Q)return;let X=document.createElement("div");X.className="toast",X.dataset.tone=$;let Z=document.createElement("span");Z.className="dot";let W=document.createElement("span");W.textContent=J;let Y=document.createElement("button");Y.type="button",Y.className="close",Y.textContent="✕",Y.setAttribute("aria-label","ปิด");let U=()=>{window.clearTimeout(C),X.remove()};Y.addEventListener("click",U);let C=$==="error"||z?0:window.setTimeout(U,H5);if(X.append(Z,W),z){let M=document.createElement("button");M.type="button",M.className="action",M.textContent=z.label,M.addEventListener("click",()=>{U(),z.onClick()}),X.append(M)}X.append(Y),Q.append(X)}function H6(J,$,z){let j=J.filter((X)=>Boolean(X.error)||X.status!=null&&X.status>=400).slice(-20).map((X)=>({method:X.method,url:X.url,status:X.status,error:X.error,at:X.startedAt})),Q=$.filter((X)=>X.level==="error"||X.level==="exception"||X.level==="unhandledrejection").slice(-20).map((X)=>X.message);return{failedRequests:j,errors:Q,erroredQueries:z.slice(0,20)}}function P5(){let J={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return J;let $=performance.memory;if($)J.memoryUsedMb=Math.round($.usedJSHeapSize/1024/1024),J.memoryLimitMb=Math.round($.jsHeapSizeLimit/1024/1024);let[z]=performance.getEntriesByType("navigation");if(z)J.domContentLoadedMs=Math.round(z.domContentLoadedEventEnd),J.loadEventMs=Math.round(z.loadEventEnd);return J}function T2(J,$){if(!J)return $;try{return J()}catch{return $}}function M6(){let J=N(),{pathname:$,search:z,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:$,search:z},module:f1($),user:T2(J.user,{}),apiHeaders:V1(T2(J.headers,{})),app:{name:B0().name,version:B0().version,environment:B0().environment},client:{userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,online:navigator.onLine,viewport:{width:window.innerWidth,height:window.innerHeight,dpr:window.devicePixelRatio},screen:{width:window.screen.width,height:window.screen.height}},performance:P5(),extra:T2(J.extra,{})}}var F5=2;function b1(J){let $=K6(),z=p4();return{context:M6(),reason:J.reason,note:J.note,cause:H6($,z,J.erroredQueries),actionTrail:g4(),network:$,console:z,screenshotDataUrl:J.screenshotDataUrl,screenshotMethod:J.screenshotMethod,replay:D6()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:F5}}}async function A2(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let z=await N5();if(z.status==="ok")return{dataUrl:z.dataUrl,method:"display-media"};if(z.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let $=await I5();if($)return{dataUrl:$,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function N5(){let J=null;try{let $={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};J=await navigator.mediaDevices.getDisplayMedia($);let z=await _5(J);return z?{status:"ok",dataUrl:z}:{status:"error"}}catch($){if($ instanceof DOMException&&($.name==="NotAllowedError"||$.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{J?.getTracks().forEach(($)=>$.stop())}}async function _5(J){let $=document.createElement("video");$.srcObject=J,$.muted=!0,$.playsInline=!0,await new Promise((Z)=>{let W=!1,Y=()=>{if(W)return;W=!0,Z()};$.onloadedmetadata=()=>{$.play().then(Y).catch(Y)},window.setTimeout(Y,1500)}),await C5($);let{videoWidth:z,videoHeight:j}=$;if(!z||!j)return null;let Q=document.createElement("canvas");Q.width=z,Q.height=j;let X=Q.getContext("2d");if(!X)return null;X.drawImage($,0,0,z,j),$.pause(),$.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function C5(J){return new Promise(($)=>{let z=!1,j=()=>{if(z)return;z=!0,$()},Q=J;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function I5(){let J=N().screenshotFallback;if(!J)return null;let $=await J().catch(()=>null);if(!$)return null;try{return await $(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:(z)=>!(z instanceof HTMLElement&&z.dataset?.debugReporter==="true")})}catch{return null}}var O5=2000,L5=0.82,S5=3000000;function R5(J){return new Promise(($,z)=>{let j=new Image;j.onload=()=>$(j),j.onerror=()=>z(Error("could not read the screenshot")),j.src=J})}async function u1(J){try{let $=await R5(J),z=Math.max($.naturalWidth,$.naturalHeight),j=Math.min(1,O5/z),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round($.naturalWidth*j)),Q.height=Math.max(1,Math.round($.naturalHeight*j));let X=Q.getContext("2d");if(!X)return J;X.fillStyle="#fff",X.fillRect(0,0,Q.width,Q.height),X.drawImage($,0,0,Q.width,Q.height);let Z=L5,W=Q.toDataURL("image/jpeg",Z);while(W.length>S5&&Z>0.4)Z-=0.15,W=Q.toDataURL("image/jpeg",Z);return W}catch{return J}}var T5=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,A5=/^\d+$/,E5=/^[0-9a-f]{16,}$/i;function B6(J){if(J.reason.type==="manual")return null;let $=J.cause?.failedRequests?.[0];if(!$?.url)return null;let z;try{z=new URL($.url,"http://x").pathname}catch{z=$.url}let j=z.split("/").map((X)=>T5.test(X)||A5.test(X)||E5.test(X)?":id":X).join("/"),Q=$.status??($.error?"ERR":"?");return`${$.method??"REQ"} ${j} ${Q}`}var P6=2000000;function p1(J){let{screenshotDataUrl:$,replay:z,...j}=J;return JSON.stringify(j).length}function F6(J,$=2000000){if(p1(J)<=$)return J;let z=J.network.map((Q)=>({...Q})),j={...J,network:z};for(let Q of z){if(p1(j)<=$)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&p1(j)>$)j.network=j.network.slice(1);while(j.console.length>1&&p1(j)>$)j.console=j.console.slice(1);return j}function G1(J){let $="";for(let z=0;z<J.length;z+=32768)$+=String.fromCharCode(...J.subarray(z,z+32768));return btoa($)}var x5=4,k5=2,f5=3,w5=0,y5=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),g5=/^\s*javascript:/i;function v5(J,$){let z=J.toLowerCase();if(z.startsWith("on")||z==="srcdoc")return!0;return typeof $==="string"&&g5.test($)}function N6(J,$=!1){if(!J)return;for(let z of Object.keys(J)){let j=J[z];if(v5(z,j)){if($)J[z]=null;else delete J[z];continue}if(typeof j!=="string"||!y5.has(z)||!j.includes("?"))continue;J[z]=S0(j)}}function E2(J){if(!J)return;N6(J.attributes);for(let $ of J.childNodes??[])E2($)}function _6(J){let $=JSON.parse(JSON.stringify(J));for(let z of $){let j=z.data;if(!j||typeof j!=="object")continue;if(z.type===x5&&typeof j.href==="string")j.href=S0(j.href);else if(z.type===k5)E2(j.node);else if(z.type===f5&&j.source===w5){for(let Q of j.adds??[])E2(Q.node);for(let Q of j.attributes??[])N6(Q.attributes,!0)}}return $}var m5="session-replay.json.gz",h5="session-replay.json";function b5(J){return Boolean(J&&J.events.length>0)}async function u5(J){if(typeof CompressionStream>"u")return null;try{let $=new Blob([J]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response($).arrayBuffer())}catch{return null}}async function I6(J,$){if(!b5(J))return{summary:{omitted:"empty"}};let j={seconds:Math.round(J.durationMs/1000),events:J.events.length,startedAt:J.startedAt,endedAt:J.endedAt},Q=_6(J.events),X=await C6(Q),Z=!1;if(X.bytes.byteLength>$&&i5(Q))Q=c5(Q),X=await C6(Q),Z=!0;let{bytes:W,compressed:Y}=X;if(W.byteLength>$)return{summary:{...j,bytes:W.byteLength,omitted:"too-large"}};return{dataUri:`data:${Y?"application/gzip":"application/json"};base64,${G1(W)}`,filename:Y?m5:h5,summary:{...j,events:Q.length,bytes:W.byteLength,compressed:Y,...Z?{canvasDropped:Z}:{}}}}async function C6(J){let $=new TextEncoder().encode(JSON.stringify({events:J})),z=await u5($);return z?{bytes:z,compressed:!0}:{bytes:$,compressed:!1}}var p5=3,O6=2,d5=9;function L6(J){return J.type===p5&&J.data?.source===d5}function i5(J){return J.some(L6)||J.some(($)=>$.type===O6&&S6($.data.node))}function S6(J){if(!J)return!1;if(J.attributes&&"rr_dataURL"in J.attributes)return!0;return(J.childNodes??[]).some(S6)}function R6(J){if(!J)return;if(J.attributes&&"rr_dataURL"in J.attributes)delete J.attributes.rr_dataURL;for(let $ of J.childNodes??[])R6($)}function c5(J){let $=[];for(let z of J){if(L6(z))continue;if(z.type===O6)R6(z.data.node);$.push(z)}return $}var l5=new Set([502,503,504]);class P0 extends Error{kind;retryAfter;status;constructor(J,$,z,j){super(J);this.kind=$;this.retryAfter=z;this.status=j;this.name="ReportError"}}function r5(J){let{screenshotDataUrl:$,replay:z,...j}=J;return{dataUri:`data:application/json;base64,${G1(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function x2(){let J=N().identity;if(!J)return{};try{let $=await J();return $?{authorization:`Bearer ${$}`}:{}}catch{return{}}}async function T6(J,$){let z=N(),j=F6($,P6),{context:Q,note:X}=j,Z=[];if(j.screenshotDataUrl){let _=await u1(j.screenshotDataUrl);Z.push({dataUri:_,filename:"screenshot.jpg"})}Z.push(r5(j));let W,Y=Q1();if(Y){let _=await I6(j.replay,Y.maxBytes);if(W=_.summary,"dataUri"in _)Z.push({dataUri:_.dataUri,filename:_.filename})}let U=B6(j),C={title:J,description:X.trim()||void 0,appName:B0().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:B0().name,module:Q.module?.label??""},context:{...U?{signature:U}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...W?{replay:W}:{}},attachments:Z,...j.reason.fromChat?{fromChat:!0}:{}},M=await fetch(`${z.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":z.realmKey,...await x2()},body:JSON.stringify(C)}).catch(()=>{throw new P0("report never left the browser","offline")});if(!M.ok)throw await k2(M);return await M.json()}async function k2(J){let $=J.headers.get("retry-after"),z=await J.json().then((j)=>j.error).catch(()=>null);if(J.status===429)return new P0("rate limited","rateLimited",$??void 0);if(l5.has(J.status))return new P0("desk unavailable","unavailable");return new P0(z??`Report failed (${J.status})`,"rejected",void 0,J.status)}var d1=null,U1=null,A6=()=>N().host.replace(/\/$/,"");function f2(){return d1}function c0(){if(U1)return U1;return U1=(async()=>{try{let J=await fetch(`${A6()}/ingest/request-types`,{headers:{"x-realm-key":N().realmKey}}),$=J.ok?await J.json():null;d1=Array.isArray($?.types)?$.types.filter(o5):[]}catch{d1=[],U1=null}return d1??[]})(),U1}function o5(J){let $=J;return!!$&&typeof $.id==="string"&&typeof $.name==="string"}async function E6(J){let $=N(),z={};try{z=$.user?.()??{}}catch{z={}}let j=typeof window>"u"?null:window.location,Q={title:J.title,description:J.description.trim()||void 0,ticketTypeId:J.ticketTypeId,appName:B0().name,category:j?f1(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:z.email??void 0,requesterName:z.fullName??void 0,attachments:J.screenshotDataUrl?[{dataUri:await u1(J.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},X=await fetch(`${A6()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await x2()},body:JSON.stringify(Q)}).catch(()=>{throw new P0("request never left the browser","offline")});if(!X.ok)throw await k2(X);return await X.json()}var q1=Math.PI/6;function x6(J,$,z){let j=$.x-J.x,Q=$.y-J.y,X=Math.hypot(j,Q),Z=Math.atan2(Q,j),W=[{x:$.x,y:$.y},{x:$.x-z*Math.cos(Z-q1),y:$.y-z*Math.sin(Z-q1)},{x:$.x-z*Math.cos(Z+q1),y:$.y-z*Math.sin(Z+q1)}],Y=z*Math.cos(q1)*0.92;if(X<=Y)return{shaft:null,head:W};return{shaft:{from:J,to:{x:$.x-Y*Math.cos(Z),y:$.y-Y*Math.sin(Z)}},head:W}}var w2="#f44336",n5="rgba(250, 204, 21, 0.4)",y2=22,k6="#2563eb",f6=9,w6=11,y6=18,g6=4,i1=8,s5=[{id:"nw",fx:0,fy:0,cursor:"nwse-resize"},{id:"n",fx:0.5,fy:0,cursor:"ns-resize"},{id:"ne",fx:1,fy:0,cursor:"nesw-resize"},{id:"e",fx:1,fy:0.5,cursor:"ew-resize"},{id:"se",fx:1,fy:1,cursor:"nwse-resize"},{id:"s",fx:0.5,fy:1,cursor:"ns-resize"},{id:"sw",fx:0,fy:1,cursor:"nesw-resize"},{id:"w",fx:0,fy:0.5,cursor:"ew-resize"}];function v6(J,$,z){let j=[],Q=null,X=-1,Z=null,W=null,Y=J.getContext("2d");function U(){let V=J.getBoundingClientRect().width;return V>0?J.width/V:1}function C(V){let K=J.getBoundingClientRect();return{x:(V.clientX-K.left)/K.width*J.width,y:(V.clientY-K.top)/K.height*J.height}}function M(V){let K=V.size??y2;if(!Y)return(V.text?.length??0)*K*0.6;Y.save(),Y.font=`600 ${K}px system-ui, sans-serif`;let q=Y.measureText(V.text??"").width;return Y.restore(),q}function _(V){if(V.tool==="text"){let K=V.size??y2;return{left:V.x1,top:V.y1,right:V.x1+M(V),bottom:V.y1+K*1.25}}return{left:Math.min(V.x1,V.x2),top:Math.min(V.y1,V.y2),right:Math.max(V.x1,V.x2),bottom:Math.max(V.y1,V.y2)}}function f(V){if(V.tool==="arrow")return[{id:"tail",x:V.x1,y:V.y1,cursor:"move"},{id:"head",x:V.x2,y:V.y2,cursor:"move"}];let K=_(V);if(V.tool==="text")return[{id:"size",x:K.right,y:K.bottom,cursor:"nwse-resize"}];return s5.map((q)=>({id:q.id,x:K.left+(K.right-K.left)*q.fx,y:K.top+(K.bottom-K.top)*q.fy,cursor:q.cursor}))}function y(V){let K=_(V);return{x:K.right+y6*U(),y:K.top-y6*U()}}function m(V,K,q){let{shaft:G,head:D}=x6({x:K.x1,y:K.y1},{x:K.x2,y:K.y2},Math.max(10,16*q));if(G)V.lineCap="butt",V.beginPath(),V.moveTo(G.from.x,G.from.y),V.lineTo(G.to.x,G.to.y),V.stroke();V.beginPath(),V.moveTo(D[0].x,D[0].y),V.lineTo(D[1].x,D[1].y),V.lineTo(D[2].x,D[2].y),V.closePath(),V.fill()}function s(V,K,q){V.save(),V.lineWidth=Math.max(2,3*q),V.strokeStyle=w2,V.fillStyle=w2;let G=_(K);if(K.tool==="rect")V.strokeRect(G.left,G.top,G.right-G.left,G.bottom-G.top);else if(K.tool==="arrow")m(V,K,q);else if(K.tool==="highlight")V.fillStyle=n5,V.fillRect(G.left,G.top,G.right-G.left,G.bottom-G.top);else if(K.tool==="text"&&K.text){let D=K.size??y2;V.font=`600 ${D}px system-ui, sans-serif`,V.textBaseline="top";let P=D*0.22;V.fillStyle="rgba(255,255,255,0.92)",V.fillRect(G.left-P,G.top-P,G.right-G.left+P*2,G.bottom-G.top+P*2),V.fillStyle=w2,V.fillText(K.text,G.left,G.top)}V.restore()}function B(V,K,q){let G=_(K);V.save(),V.strokeStyle=k6,V.lineWidth=Math.max(1,1.5*q),V.setLineDash([6*q,4*q]),V.strokeRect(G.left,G.top,G.right-G.left,G.bottom-G.top),V.setLineDash([]);let D=f6*q;for(let a of f(K))V.fillStyle="#fff",V.strokeStyle=k6,V.lineWidth=Math.max(1,1.5*q),V.beginPath(),V.rect(a.x-D/2,a.y-D/2,D,D),V.fill(),V.stroke();let P=y(K),A=w6*q;V.beginPath(),V.arc(P.x,P.y,A,0,Math.PI*2),V.fillStyle="#dc2626",V.fill(),V.strokeStyle="#fff",V.lineWidth=Math.max(1.5,2*q),V.beginPath(),V.moveTo(P.x-A*0.4,P.y-A*0.4),V.lineTo(P.x+A*0.4,P.y+A*0.4),V.moveTo(P.x+A*0.4,P.y-A*0.4),V.lineTo(P.x-A*0.4,P.y+A*0.4),V.stroke(),V.restore()}function F(){if(!Y)return;let V=U();if(Y.clearRect(0,0,J.width,J.height),Y.drawImage($,0,0,J.width,J.height),j.forEach((q,G)=>{if(G!==n)s(Y,q,V)}),Z)s(Y,Z,V);let K=j[X];if(K&&!Z)B(Y,K,V)}function w(V,K,q,G,D){return Math.abs(V-q)<=D&&Math.abs(K-G)<=D}function v(V,K){let q=j[X];if(!q)return null;let G=f6*U()/2+3*U();for(let D of f(q))if(w(V,K,D.x,D.y,G))return D.id;return null}function L(V,K){let q=j[X];if(!q)return!1;let G=y(q);return w(V,K,G.x,G.y,w6*U())}function g(V,K){let q=6*U();for(let G=j.length-1;G>=0;G-=1){let D=j[G];if(D.tool==="arrow"){let A=D.x2-D.x1,a=D.y2-D.y1,q0=Math.hypot(A,a)||1,H=Math.max(0,Math.min(1,((V-D.x1)*A+(K-D.y1)*a)/(q0*q0)));if(Math.hypot(V-(D.x1+H*A),K-(D.y1+H*a))<=q+4*U())return G;continue}let P=_(D);if(V>=P.left-q&&V<=P.right+q&&K>=P.top-q&&K<=P.bottom+q)return G}return-1}function I(V,K,q,G,D){if(K==="tail"){V.x1=q.x1+G,V.y1=q.y1+D;return}if(K==="head"){V.x2=q.x2+G,V.y2=q.y2+D;return}if(K==="size"){let E=(q.size??24)+D;V.size=Math.max(10,E);return}let P=_(q),{left:A,top:a,right:q0,bottom:H}=P;if(K.includes("w"))A=Math.min(q0-i1,A+G);if(K.includes("e"))q0=Math.max(A+i1,q0+G);if(K.includes("n"))a=Math.min(H-i1,a+D);if(K.includes("s"))H=Math.max(a+i1,H+D);V.x1=A,V.y1=a,V.x2=q0,V.y2=H}function b(V,K,q,G){V.x1=K.x1+q,V.y1=K.y1+G,V.x2=K.x2+q,V.y2=K.y2+G}let O=null,n=-1,x={x:0,y:0,size:24};function c(){let V=J.getBoundingClientRect().width;return V>0?V/J.width:1}function C0(V,K){if(!Y)return V.length*K*0.6;Y.save(),Y.font=`600 ${K}px system-ui, sans-serif`;let q=Y.measureText(V||" ").width;return Y.restore(),q}function X0(){if(!O)return;let V=J.parentElement;if(!V)return;let K=J.getBoundingClientRect(),q=V.getBoundingClientRect(),G=c(),D=x.size*G;O.style.left=`${K.left-q.left+x.x*G}px`,O.style.top=`${K.top-q.top+x.y*G}px`,O.style.fontSize=`${D}px`,O.style.width=`${Math.max(40,C0(O.value,D)+D)}px`}function l(V){let K=O;if(!K)return;O=null;let q=K.value.trim(),G=n;if(n=-1,K.remove(),V&&q){if(G>=0&&j[G])j[G].text=q,X=G;else j.push({tool:"text",x1:x.x,y1:x.y,x2:x.x,y2:x.y,text:q,size:x.size}),X=j.length-1;z()}else if(G>=0)X=G;J.focus(),F()}function M0(V,K,q=-1){l(!0);let G=J.parentElement;if(!G)return;if(getComputedStyle(G).position==="static")G.style.position="relative";let D=q>=0?j[q]:void 0;n=q,x={x:D?.x1??V,y:D?.y1??K,size:D?.size??Math.round(24*U())};let P=document.createElement("input");P.type="text",P.className="text-edit",P.value=D?.text??"",P.setAttribute("aria-label","ข้อความบนภาพ"),P.placeholder="ข้อความ",O=P,G.append(P),X0(),P.addEventListener("input",X0),P.addEventListener("keydown",(A)=>{if(A.stopPropagation(),A.key==="Enter")l(!0);else if(A.key==="Escape")l(!1)}),requestAnimationFrame(()=>{if(O!==P)return;P.focus(),P.select(),P.addEventListener("blur",()=>l(!0))}),F()}function G0(V){let{x:K,y:q}=C(V);if(J.setPointerCapture(V.pointerId),L(K,q)){U0();return}let G=v(K,q);if(G&&j[X]){W={grip:G,x:K,y:q,start:{...j[X]}};return}if(Q==="text"){if(V.preventDefault(),J.hasPointerCapture(V.pointerId))J.releasePointerCapture(V.pointerId);Q=null,z(),M0(K,q);return}if(Q){Z={tool:Q,x1:K,y1:q,x2:K,y2:q},X=-1;return}let D=g(K,q);X=D,W=D>=0?{grip:"body",x:K,y:q,start:{...j[D]}}:null,F()}function h0(V){let{x:K,y:q}=C(V);if(Z){Z.x2=K,Z.y2=q,F();return}if(W){let D=j[X];if(!D)return;let P=K-W.x,A=q-W.y;if(W.grip==="body")b(D,W.start,P,A);else I(D,W.grip,W.start,P,A);F();return}if(Q){J.style.cursor="crosshair";return}if(L(K,q)){J.style.cursor="pointer";return}let G=v(K,q);if(G){let D=j[X]?f(j[X]).find((P)=>P.id===G):null;J.style.cursor=D?.cursor??"pointer";return}J.style.cursor=g(K,q)>=0?"move":"default"}function f0(){if(Z){if(!(Math.abs(Z.x2-Z.x1)<g6&&Math.abs(Z.y2-Z.y1)<g6))j.push(Z),X=j.length-1,Q=null,z();Z=null}if(W)W=null,z();F()}function I0(V){let K=J.getBoundingClientRect(),q=(V.clientX-K.left)/K.width*J.width,G=(V.clientY-K.top)/K.height*J.height,D=g(q,G),P=j[D];if(!P||P.tool!=="text")return;V.preventDefault(),M0(P.x1,P.y1,D)}function O0(V){if(X<0)return;if(V.key==="Delete"||V.key==="Backspace")V.preventDefault(),U0();else if(V.key==="Escape")V.preventDefault(),X=-1,F()}function U0(){if(X<0)return;j.splice(X,1),X=-1,z(),F()}return J.addEventListener("pointerdown",G0),J.addEventListener("pointermove",h0),J.addEventListener("pointerup",f0),J.addEventListener("pointercancel",f0),J.addEventListener("dblclick",I0),J.tabIndex=0,J.addEventListener("keydown",O0),F(),{setTool(V){Q=V,X=-1,J.style.cursor=V?"crosshair":"default",F()},deleteSelected:U0,clear(){j.length=0,X=-1,z(),F()},hasShapes:()=>j.length>0,hasSelection:()=>X>=0,toDataUrl(){let V=document.createElement("canvas");V.width=$.naturalWidth,V.height=$.naturalHeight;let K=V.getContext("2d");if(!K)return J.toDataURL("image/png");K.drawImage($,0,0);let q=U();for(let G of j)s(K,G,q);return V.toDataURL("image/png")},destroy(){l(!1),J.removeEventListener("pointerdown",G0),J.removeEventListener("pointermove",h0),J.removeEventListener("pointerup",f0),J.removeEventListener("pointercancel",f0),J.removeEventListener("dblclick",I0),J.removeEventListener("keydown",O0)}}}var a5=["keydown","keyup","keypress"];function l0(J){for(let $ of a5)J.addEventListener($,(z)=>z.stopPropagation())}var m6=`
34
34
  :host { all: initial; }
35
35
  * { box-sizing: border-box; }
36
36
 
@@ -181,7 +181,7 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
181
181
  .shot-choice input { width: 16px; height: 16px; margin: 0; accent-color: #2563eb; }
182
182
  .dropped { opacity: 0.35; pointer-events: none; }
183
183
  .draft { margin: -8px 0 0; padding: 8px 12px; border-radius: 10px; background: #eff6ff; font-size: 13px; color: #1e3a8a; }
184
- `;var D1="lw-debug-reporter",S0=null;function o5(J,$){if(J instanceof B0){if(J.kind==="offline")return $.failedOffline;if(J.kind==="unavailable")return $.failedUnavailable;if(J.kind==="rateLimited")return $.failedTooMany.replace("{seconds}",J.retryAfter??"60");return J.message||$.failed}return $.failed}var n5=()=>[];var s5=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function a5(){return class extends HTMLElement{root;stop=null;annotator=null;bundle=null;busy=!1;keep=null;returnFocus=null;constructor(){super();this.root=this.attachShadow({mode:"open"}),l0(this.root),this.root.addEventListener("keydown",($)=>{let z=$;if(z.key!=="Escape"||z.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;z.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=l4(($)=>void this.open($))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open($){if(this.busy)return;this.busy=!0;let z=document.activeElement;this.returnFocus=z instanceof HTMLElement&&z!==document.body?z:null;let j=a(P().locale),Q=k2();if(Q===null)c0();if($.type==="manual"&&Q?.length){this.renderChooser(j,$);return}await this.report($,j)}renderChooser($,z){let j=this.shell($);j.classList.add("narrow"),j.setAttribute("aria-label",$.chooseTitle);let Q=R("div","head"),Z=X0("✕","icon");Z.setAttribute("aria-label",$.close),Z.addEventListener("click",()=>this.close()),Q.append(R("h2","",$.chooseTitle),Z);let X=u6("problem",e5,$.kindProblem,$.chooseProblemHint);X.dataset.choose="problem",X.addEventListener("click",()=>{this.root.replaceChildren(),this.report(z,$)});let W=u6("request",h6,$.kindRequest,$.chooseRequestHint);W.dataset.choose="request",W.addEventListener("click",()=>{this.bundle=b1({reason:z,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:y2()}),this.renderForm($,z,"request")});let Y=R("div","kinds choose");Y.append(X,W),Y.addEventListener("keydown",(q)=>{if(!m6.includes(q.key))return;q.preventDefault(),(this.root.activeElement===X?W:X).focus()}),j.append(Q,Y),X.focus()}async switchToReport($,z,j){this.root.replaceChildren();let Q=await A2();if(Q.method==="cancelled"){this.renderForm($,z,"request",{...j,asking:!0});return}this.bundle=b1({reason:z,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:y2()}),this.renderForm($,z,"problem",j)}async report($,z){let j=await A2();if(j.method==="cancelled"){this.close();return}this.bundle=b1({reason:$,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:y2()}),this.renderForm(z,$,"problem")}close($=!1){if($)S0=null;else if(this.keep)S0=this.keep()??S0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let z=this.returnFocus;if(this.returnFocus=null,z?.isConnected)z.focus()}shell($){let z=document.createElement("style");z.textContent=g6;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",$.title),j.append(Q),this.root.replaceChildren(z,j),Q}renderShell($,z){let j=this.shell($),Q=R("div","head");Q.append(R("h2","",$.title)),j.append(Q,R("p","status",z))}renderForm($,z,j,Q){let Z=this.bundle;if(!Z)return;let X=this.shell($),W=j,Y=j==="problem"||!!Z.screenshotDataUrl,q=null,B=R("div","head"),F=R("h2","",$.title),C=X0("✕","icon");C.setAttribute("aria-label",$.close),C.addEventListener("click",()=>this.close()),B.append(F,C);let g=R("p","door");g.hidden=!0;let v=R("span"),h=X0("","link");h.dataset.switchKind="",h.addEventListener("click",()=>K(W==="problem"?"request":"problem")),g.append(v,h);let _=R("div","ask");_.hidden=!0;let S=document.createElement("input");S.type="search",S.className="type-search",S.placeholder=$.requestTypeSearch,S.setAttribute("aria-label",$.requestTypeSearch),S.dataset.requestTypeSearch="",S.hidden=!0;let N=R("div","types");N.setAttribute("role","radiogroup"),N.setAttribute("aria-label",$.requestTypeLabel);let b=R("p","status",$.requestTypeNone);b.hidden=!0;let T=R("p","status type-count","");T.hidden=!0,_.append(c1($.requestTypeLabel,"",!0),S,N,b,T);let x=[],O=()=>{for(let f of x){let I=f.dataset.requestType===q?.id;f.setAttribute("aria-checked",String(I)),f.tabIndex=I?0:-1}let H=x.find((f)=>f.dataset.requestType===q?.id);if(H&&N.scrollHeight>N.clientHeight){let f=H.offsetTop-N.offsetTop;if(f<N.scrollTop)N.scrollTop=f;else if(f+H.offsetHeight>N.scrollTop+N.clientHeight)N.scrollTop=f+H.offsetHeight-N.clientHeight}},L=document.createElement("input");L.type="text";let m=c1(""),E=document.createElement("textarea"),$0=c1(""),w=R("div","meta"),{context:p}=Z,H0=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${$.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,l=(H,f)=>{let I=document.createElement("div"),y=document.createElement("b");y.textContent=`${H}: `;let d=document.createTextNode(f);return I.append(y,d),w.append(I),{b:y,v:d}};l($.reporter,`${p.user.fullName??"—"} (${p.user.email??"—"})`),l($.page,p.route.href);let _0=l($.captured,H0),M0=document.createElement("label");M0.className="shot-choice",M0.hidden=!0;let K0=document.createElement("input");K0.type="checkbox",K0.checked=!0,K0.dataset.requestShot="",M0.append(K0,document.createTextNode(` ${$.requestWithShot}`));let h0=Z.screenshotDataUrl?this.screenshotSection($,Z.screenshotDataUrl):[R("p","status",$.noScreenshot)],k0=Z.screenshotDataUrl?h0[0]:null;if(!Z.screenshotDataUrl)M0.replaceChildren();let I0=R("p","status",""),C0=X0($.submit,"primary"),Y0=()=>{C0.disabled=L.value.trim().length===0||W==="request"&&!q};L.addEventListener("input",Y0);let V=()=>{let H=W==="request";if(F.textContent=H?$.requestTitle:$.title,X.setAttribute("aria-label",H?$.requestTitle:$.title),v.textContent=`${H?$.problemInstead:$.askInstead} `,h.textContent=H?Y?$.problemInsteadAction:$.problemInsteadShare:$.askInsteadAction,_.hidden=!H,l1(m,H?$.requestSummaryLabel:$.summaryLabel,H?"":$.summaryRequired,!0),L.placeholder=H?$.requestSummaryPlaceholder:$.summaryPlaceholder,l1($0,H?$.requestDetailLabel:$.detailLabel),E.placeholder=H?$.requestDetailPlaceholder:$.detailPlaceholder,_0.b.textContent=`${H?$.requestLeaves:$.captured}: `,_0.v.textContent=H?$.requestLeavesWhat:H0,M0.hidden=!H||!Z.screenshotDataUrl,k0)l1(k0,H?$.requestAnnotateHint:$.annotateHint);for(let f of h0)f.classList.toggle("dropped",H&&!K0.checked),f.hidden=H&&!Z.screenshotDataUrl;C0.textContent=H?$.requestSubmit:$.submit,Y0()};K0.addEventListener("change",V);let K=(H)=>{if(H===W)return;if(H==="problem"&&!Y){this.switchToReport($,z,{title:L.value,detail:E.value,asking:!1,typeId:q?.id??null});return}W=H,V()},U=(H)=>{if(this.bundle!==Z||z.type!=="manual"||!H.length)return;q=H[0],x.length=0;for(let I of H){let y=X0("","type");y.setAttribute("role","radio"),y.dataset.requestType=I.id;let d=R("span","type-body");if(d.append(R("b","",I.name)),I.description)d.append(R("span","type-hint",I.description));if(I.targetHours){let b0=R("span","type-due");b0.append(r1(J9),document.createTextNode($.requestTarget.replace("{time}",t5($,I.targetHours)))),d.append(b0)}y.append(r1(h6),d),y.addEventListener("click",()=>{q=I,O(),Y0()}),x.push(y)}N.replaceChildren(...x),N.onkeydown=(I)=>{if(!m6.includes(I.key)||!q)return;I.preventDefault();let y=H.filter((f0,a8)=>!x[a8].hidden);if(!y.length)return;let d=y.findIndex((f0)=>f0.id===q.id),b0=I.key==="ArrowUp"||I.key==="ArrowLeft"?-1:1;q=y[d<0?0:(d+b0+y.length)%y.length],O(),x.find((f0)=>f0.dataset.requestType===q.id)?.focus()},N.classList.toggle("long",H.length>=v2),S.hidden=H.length<v2;let f=(I)=>{T.hidden=H.length<v2||I===0,T.textContent=$.requestTypeCount.replace("{n}",String(I))};f(H.length),S.oninput=()=>{let I=S.value.trim().toLowerCase(),y=null;if(H.forEach((d,b0)=>{let f0=!I||`${d.name} ${d.description}`.toLowerCase().includes(I);if(x[b0].hidden=!f0,f0&&!y)y=d}),b.hidden=!!y,f(x.filter((d)=>!d.hidden).length),y&&q&&x[H.indexOf(q)].hidden)q=y;O(),Y0()},S.onkeydown=(I)=>{if(I.key==="ArrowDown"||I.key==="Enter")I.preventDefault(),x.find((y)=>y.dataset.requestType===q?.id&&!y.hidden)?.focus()},O(),g.hidden=!1,V()},G=Q??(S0&&(S0.title||S0.detail)?S0:null),D=R("p","draft");if(D.hidden=!G||!!Q,G){L.value=G.title,E.value=G.detail;let H=X0($.draftClear,"link");H.dataset.draftClear="",H.addEventListener("click",()=>{L.value="",E.value="",S0=null,D.hidden=!0,Y0(),L.focus()}),D.append(document.createTextNode(`${$.draftRestored} · `),H)}let M=k2(),k=(H)=>{if(U(H),W!=="request"||g.hidden||!G?.typeId)return;let f=H.find((I)=>I.id===G.typeId);if(f)q=f,O()};if(M)k(M);else if(z.type==="manual")c0().then(k);this.keep=()=>({title:L.value,detail:E.value,asking:W==="request",typeId:q?.id??null}),X.append(B,g,D,_,m,L,$0,E,w,M0,...h0);let n=R("div","foot"),G0=X0($.close);G0.addEventListener("click",()=>this.close()),n.append(G0,I0,R("span","grow"),C0),X.append(n),V(),C0.addEventListener("click",async()=>{C0.disabled=!0,I0.dataset.tone="",I0.textContent=$.submitting;let H=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(W==="request"&&q){let y=await T6({ticketTypeId:q.id,title:L.value.trim(),description:E.value,screenshotDataUrl:K0.checked?H():null}),d=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:y,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),d)i0(`${$.requestSubmitted} — #${y.number}`,"success");return}let f=await R6(L.value.trim(),{...Z,note:E.value,screenshotDataUrl:H()}),I=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:f,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),I)i0(`${$.submitted} — #${f.number}`,"success")}catch(f){let I=o5(f,$);I0.dataset.tone="error",I0.textContent=I,i0(I,"error"),Y0()}}),L.focus()}screenshotSection($,z){let j=c1($.annotateHint),Q=R("div","tools"),Z=document.createElement("canvas"),X=R("div","shot");X.append(Z);let W=[],Y=(C)=>{for(let g of W)g.setAttribute("aria-pressed",String(g===C))};for(let{tool:C,key:g}of s5){let v=X0($[g]);v.setAttribute("aria-pressed","false"),v.addEventListener("click",()=>{let h=v.getAttribute("aria-pressed")==="true";Y(h?null:v),this.annotator?.setTool(h?null:C)}),W.push(v),Q.append(v)}Q.append(R("span","sep"));let q=X0($.deleteSelected);q.addEventListener("click",()=>this.annotator?.deleteSelected());let B=X0($.clearAll);B.addEventListener("click",()=>{this.annotator?.clear(),Y(null)}),Q.append(q,B);let F=new Image;return F.onload=()=>{Z.width=F.naturalWidth,Z.height=F.naturalHeight,this.annotator=v6(Z,F,()=>{Y(null),q.disabled=!this.annotator?.hasSelection()})},F.src=z,[j,Q,R("p","status",$.annotateHelp),X]}}}function y2(){try{return n5()}catch{return[]}}function R(J,$="",z=""){let j=document.createElement(J);if($)j.className=$;if(z)j.textContent=z;return j}function t5(J,$){return $>=24&&$%24===0?J.days.replace("{n}",String($/24)):J.hours.replace("{n}",String($))}var m6=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],v2=7,e5=[["path",{d:"M12 20v-9"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}],["path",{d:"M14.12 3.88 16 2"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}],["path",{d:"M22 13h-4"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}],["path",{d:"M6 13H2"}],["path",{d:"m8 2 1.88 1.88"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"}]],h6=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2"}]],J9=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],$9=[["path",{d:"M20 6 9 17l-5-5"}]],b6="http://www.w3.org/2000/svg";function u6(J,$,z,j){let Q=X0("","kind");Q.dataset.kind=J;let Z=R("span","kind-top");return Z.append(r1($),R("b","",z)),Q.append(Z,R("span","kind-hint",j),r1($9,"tick")),Q}function r1(J,$="icon"){let z=document.createElementNS(b6,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:$}))z.setAttribute(j,Q);for(let[j,Q]of J){let Z=document.createElementNS(b6,j);for(let[X,W]of Object.entries(Q))Z.setAttribute(X,W);z.append(Z)}return z}function X0(J,$=""){let z=document.createElement("button");if(z.type="button",z.textContent=J,$)z.className=$;return z}function c1(J,$="",z=!1){return l1(document.createElement("label"),J,$,z)}function l1(J,$,z="",j=!1){if(J.replaceChildren(document.createTextNode($)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",J.append(Q)}if(z){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${z}`,J.append(Q)}return J}function p6(){if(typeof window>"u"||customElements.get(D1))return;customElements.define(D1,a5())}var z9="lw-portal-handoff",d6=138.23,j9=`
184
+ `;var D1="lw-debug-reporter",R0=null;function t5(J,$){if(J instanceof P0){if(J.kind==="offline")return $.failedOffline;if(J.kind==="unavailable")return $.failedUnavailable;if(J.kind==="rateLimited")return $.failedTooMany.replace("{seconds}",J.retryAfter??"60");return J.message||$.failed}return $.failed}var e5=()=>[];var J9=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function $9(){return class extends HTMLElement{root;stop=null;annotator=null;bundle=null;busy=!1;keep=null;returnFocus=null;constructor(){super();this.root=this.attachShadow({mode:"open"}),l0(this.root),this.root.addEventListener("keydown",($)=>{let z=$;if(z.key!=="Escape"||z.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;z.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=r4(($)=>void this.open($))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open($){if(this.busy)return;this.busy=!0;let z=document.activeElement;this.returnFocus=z instanceof HTMLElement&&z!==document.body?z:null;let j=e(N().locale),Q=f2();if(Q===null)c0();if($.type==="manual"&&Q?.length){this.renderChooser(j,$);return}await this.report($,j)}renderChooser($,z){let j=this.shell($);j.classList.add("narrow"),j.setAttribute("aria-label",$.chooseTitle);let Q=R("div","head"),X=V0("✕","icon");X.setAttribute("aria-label",$.close),X.addEventListener("click",()=>this.close()),Q.append(R("h2","",$.chooseTitle),X);let Z=p6("problem",j9,$.kindProblem,$.chooseProblemHint);Z.dataset.choose="problem",Z.addEventListener("click",()=>{this.root.replaceChildren(),this.report(z,$)});let W=p6("request",b6,$.kindRequest,$.chooseRequestHint);W.dataset.choose="request",W.addEventListener("click",()=>{this.bundle=b1({reason:z,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:g2()}),this.renderForm($,z,"request")});let Y=R("div","kinds choose");Y.append(Z,W),Y.addEventListener("keydown",(U)=>{if(!h6.includes(U.key))return;U.preventDefault(),(this.root.activeElement===Z?W:Z).focus()}),j.append(Q,Y),Z.focus()}async switchToReport($,z,j){this.root.replaceChildren();let Q=await A2();if(Q.method==="cancelled"){this.renderForm($,z,"request",{...j,asking:!0});return}this.bundle=b1({reason:z,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:g2()}),this.renderForm($,z,"problem",j)}async report($,z){let j=await A2();if(j.method==="cancelled"){this.close();return}this.bundle=b1({reason:$,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:g2()}),this.renderForm(z,$,"problem")}close($=!1){if($)R0=null;else if(this.keep)R0=this.keep()??R0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let z=this.returnFocus;if(this.returnFocus=null,z?.isConnected)z.focus()}shell($){let z=document.createElement("style");z.textContent=m6;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",$.title),j.append(Q),this.root.replaceChildren(z,j),Q}renderShell($,z){let j=this.shell($),Q=R("div","head");Q.append(R("h2","",$.title)),j.append(Q,R("p","status",z))}renderForm($,z,j,Q){let X=this.bundle;if(!X)return;let Z=this.shell($),W=j,Y=j==="problem"||!!X.screenshotDataUrl,U=null,C=R("div","head"),M=R("h2","",$.title),_=V0("✕","icon");_.setAttribute("aria-label",$.close),_.addEventListener("click",()=>this.close()),C.append(M,_);let f=R("p","door");f.hidden=!0;let y=R("span"),m=V0("","link");m.dataset.switchKind="",m.addEventListener("click",()=>K(W==="problem"?"request":"problem")),f.append(y,m);let s=R("div","ask");s.hidden=!0;let B=document.createElement("input");B.type="search",B.className="type-search",B.placeholder=$.requestTypeSearch,B.setAttribute("aria-label",$.requestTypeSearch),B.dataset.requestTypeSearch="",B.hidden=!0;let F=R("div","types");F.setAttribute("role","radiogroup"),F.setAttribute("aria-label",$.requestTypeLabel);let w=R("p","status",$.requestTypeNone);w.hidden=!0;let v=R("p","status type-count","");v.hidden=!0,s.append(c1($.requestTypeLabel,"",!0),B,F,w,v);let L=[],g=()=>{for(let E of L){let S=E.dataset.requestType===U?.id;E.setAttribute("aria-checked",String(S)),E.tabIndex=S?0:-1}let H=L.find((E)=>E.dataset.requestType===U?.id);if(H&&F.scrollHeight>F.clientHeight){let E=H.offsetTop-F.offsetTop;if(E<F.scrollTop)F.scrollTop=E;else if(E+H.offsetHeight>F.scrollTop+F.clientHeight)F.scrollTop=E+H.offsetHeight-F.clientHeight}},I=document.createElement("input");I.type="text";let b=c1(""),O=document.createElement("textarea"),n=c1(""),x=R("div","meta"),{context:c}=X,C0=`${X.network.length} network · ${X.console.length} console · ${X.actionTrail.length} actions${X.replay?` · ${$.replay} ${Math.round(X.replay.durationMs/1000)}s`:""}`,X0=(H,E)=>{let S=document.createElement("div"),k=document.createElement("b");k.textContent=`${H}: `;let u=document.createTextNode(E);return S.append(k,u),x.append(S),{b:k,v:u}};X0($.reporter,`${c.user.fullName??"—"} (${c.user.email??"—"})`),X0($.page,c.route.href);let l=X0($.captured,C0),M0=document.createElement("label");M0.className="shot-choice",M0.hidden=!0;let G0=document.createElement("input");G0.type="checkbox",G0.checked=!0,G0.dataset.requestShot="",M0.append(G0,document.createTextNode(` ${$.requestWithShot}`));let h0=X.screenshotDataUrl?this.screenshotSection($,X.screenshotDataUrl):[R("p","status",$.noScreenshot)],f0=X.screenshotDataUrl?h0[0]:null;if(!X.screenshotDataUrl)M0.replaceChildren();let I0=R("p","status",""),O0=V0($.submit,"primary"),U0=()=>{O0.disabled=I.value.trim().length===0||W==="request"&&!U};I.addEventListener("input",U0);let V=()=>{let H=W==="request";if(M.textContent=H?$.requestTitle:$.title,Z.setAttribute("aria-label",H?$.requestTitle:$.title),y.textContent=`${H?$.problemInstead:$.askInstead} `,m.textContent=H?Y?$.problemInsteadAction:$.problemInsteadShare:$.askInsteadAction,s.hidden=!H,l1(b,H?$.requestSummaryLabel:$.summaryLabel,H?"":$.summaryRequired,!0),I.placeholder=H?$.requestSummaryPlaceholder:$.summaryPlaceholder,l1(n,H?$.requestDetailLabel:$.detailLabel),O.placeholder=H?$.requestDetailPlaceholder:$.detailPlaceholder,l.b.textContent=`${H?$.requestLeaves:$.captured}: `,l.v.textContent=H?$.requestLeavesWhat:C0,M0.hidden=!H||!X.screenshotDataUrl,f0)l1(f0,H?$.requestAnnotateHint:$.annotateHint);for(let E of h0)E.classList.toggle("dropped",H&&!G0.checked),E.hidden=H&&!X.screenshotDataUrl;O0.textContent=H?$.requestSubmit:$.submit,U0()};G0.addEventListener("change",V);let K=(H)=>{if(H===W)return;if(H==="problem"&&!Y){this.switchToReport($,z,{title:I.value,detail:O.value,asking:!1,typeId:U?.id??null});return}W=H,V()},q=(H)=>{if(this.bundle!==X||z.type!=="manual"||!H.length)return;U=H[0],L.length=0;for(let S of H){let k=V0("","type");k.setAttribute("role","radio"),k.dataset.requestType=S.id;let u=R("span","type-body");if(u.append(R("b","",S.name)),S.description)u.append(R("span","type-hint",S.description));if(S.targetHours){let b0=R("span","type-due");b0.append(r1(Q9),document.createTextNode($.requestTarget.replace("{time}",z9($,S.targetHours)))),u.append(b0)}k.append(r1(b6),u),k.addEventListener("click",()=>{U=S,g(),U0()}),L.push(k)}F.replaceChildren(...L),F.onkeydown=(S)=>{if(!h6.includes(S.key)||!U)return;S.preventDefault();let k=H.filter((w0,$3)=>!L[$3].hidden);if(!k.length)return;let u=k.findIndex((w0)=>w0.id===U.id),b0=S.key==="ArrowUp"||S.key==="ArrowLeft"?-1:1;U=k[u<0?0:(u+b0+k.length)%k.length],g(),L.find((w0)=>w0.dataset.requestType===U.id)?.focus()},F.classList.toggle("long",H.length>=v2),B.hidden=H.length<v2;let E=(S)=>{v.hidden=H.length<v2||S===0,v.textContent=$.requestTypeCount.replace("{n}",String(S))};E(H.length),B.oninput=()=>{let S=B.value.trim().toLowerCase(),k=null;if(H.forEach((u,b0)=>{let w0=!S||`${u.name} ${u.description}`.toLowerCase().includes(S);if(L[b0].hidden=!w0,w0&&!k)k=u}),w.hidden=!!k,E(L.filter((u)=>!u.hidden).length),k&&U&&L[H.indexOf(U)].hidden)U=k;g(),U0()},B.onkeydown=(S)=>{if(S.key==="ArrowDown"||S.key==="Enter")S.preventDefault(),L.find((k)=>k.dataset.requestType===U?.id&&!k.hidden)?.focus()},g(),f.hidden=!1,V()},G=Q??(R0&&(R0.title||R0.detail)?R0:null),D=R("p","draft");if(D.hidden=!G||!!Q,G){I.value=G.title,O.value=G.detail;let H=V0($.draftClear,"link");H.dataset.draftClear="",H.addEventListener("click",()=>{I.value="",O.value="",R0=null,D.hidden=!0,U0(),I.focus()}),D.append(document.createTextNode(`${$.draftRestored} · `),H)}let P=f2(),A=(H)=>{if(q(H),W!=="request"||f.hidden||!G?.typeId)return;let E=H.find((S)=>S.id===G.typeId);if(E)U=E,g()};if(P)A(P);else if(z.type==="manual")c0().then(A);this.keep=()=>({title:I.value,detail:O.value,asking:W==="request",typeId:U?.id??null}),Z.append(C,f,D,s,b,I,n,O,x,M0,...h0);let a=R("div","foot"),q0=V0($.close);q0.addEventListener("click",()=>this.close()),a.append(q0,I0,R("span","grow"),O0),Z.append(a),V(),O0.addEventListener("click",async()=>{O0.disabled=!0,I0.dataset.tone="",I0.textContent=$.submitting;let H=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():X.screenshotDataUrl;try{if(W==="request"&&U){let k=await E6({ticketTypeId:U.id,title:I.value.trim(),description:O.value,screenshotDataUrl:G0.checked?H():null}),u=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:k,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),u)i0(`${$.requestSubmitted} — #${k.number}`,"success");return}let E=await T6(I.value.trim(),{...X,note:O.value,screenshotDataUrl:H()}),S=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:E,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),S)i0(`${$.submitted} — #${E.number}`,"success")}catch(E){let S=t5(E,$);I0.dataset.tone="error",I0.textContent=S,i0(S,"error"),U0()}}),I.focus()}screenshotSection($,z){let j=c1($.annotateHint),Q=R("div","tools"),X=document.createElement("canvas"),Z=R("div","shot");Z.append(X);let W=[],Y=(_)=>{for(let f of W)f.setAttribute("aria-pressed",String(f===_))};for(let{tool:_,key:f}of J9){let y=V0($[f]);y.setAttribute("aria-pressed","false"),y.addEventListener("click",()=>{let m=y.getAttribute("aria-pressed")==="true";Y(m?null:y),this.annotator?.setTool(m?null:_)}),W.push(y),Q.append(y)}Q.append(R("span","sep"));let U=V0($.deleteSelected);U.addEventListener("click",()=>this.annotator?.deleteSelected());let C=V0($.clearAll);C.addEventListener("click",()=>{this.annotator?.clear(),Y(null)}),Q.append(U,C);let M=new Image;return M.onload=()=>{X.width=M.naturalWidth,X.height=M.naturalHeight,this.annotator=v6(X,M,()=>{Y(null),U.disabled=!this.annotator?.hasSelection()})},M.src=z,[j,Q,R("p","status",$.annotateHelp),Z]}}}function g2(){try{return e5()}catch{return[]}}function R(J,$="",z=""){let j=document.createElement(J);if($)j.className=$;if(z)j.textContent=z;return j}function z9(J,$){return $>=24&&$%24===0?J.days.replace("{n}",String($/24)):J.hours.replace("{n}",String($))}var h6=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],v2=7,j9=[["path",{d:"M12 20v-9"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}],["path",{d:"M14.12 3.88 16 2"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}],["path",{d:"M22 13h-4"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}],["path",{d:"M6 13H2"}],["path",{d:"m8 2 1.88 1.88"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"}]],b6=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2"}]],Q9=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],X9=[["path",{d:"M20 6 9 17l-5-5"}]],u6="http://www.w3.org/2000/svg";function p6(J,$,z,j){let Q=V0("","kind");Q.dataset.kind=J;let X=R("span","kind-top");return X.append(r1($),R("b","",z)),Q.append(X,R("span","kind-hint",j),r1(X9,"tick")),Q}function r1(J,$="icon"){let z=document.createElementNS(u6,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:$}))z.setAttribute(j,Q);for(let[j,Q]of J){let X=document.createElementNS(u6,j);for(let[Z,W]of Object.entries(Q))X.setAttribute(Z,W);z.append(X)}return z}function V0(J,$=""){let z=document.createElement("button");if(z.type="button",z.textContent=J,$)z.className=$;return z}function c1(J,$="",z=!1){return l1(document.createElement("label"),J,$,z)}function l1(J,$,z="",j=!1){if(J.replaceChildren(document.createTextNode($)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",J.append(Q)}if(z){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${z}`,J.append(Q)}return J}function d6(){if(typeof window>"u"||customElements.get(D1))return;customElements.define(D1,$9())}var Z9="lw-portal-handoff",i6=138.23,V9=`
185
185
  :host { all: initial; }
186
186
  .backdrop {
187
187
  position: fixed; inset: 0; z-index: 2147483002;
@@ -211,10 +211,10 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
211
211
  .ring .track { stroke: #e2e8f0; }
212
212
  .ring .bar {
213
213
  stroke: #0ea5e9; transform: rotate(-90deg); transform-origin: 50% 50%;
214
- stroke-dasharray: ${d6}; stroke-dashoffset: 0;
214
+ stroke-dasharray: ${i6}; stroke-dashoffset: 0;
215
215
  animation: deplete var(--secs, 3s) linear forwards;
216
216
  }
217
- @keyframes deplete { to { stroke-dashoffset: ${d6}; } }
217
+ @keyframes deplete { to { stroke-dashoffset: ${i6}; } }
218
218
  .count {
219
219
  position: absolute; inset: 0; display: grid; place-items: center;
220
220
  font-size: 18px; font-weight: 600; color: #0f172a;
@@ -258,7 +258,7 @@ p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
258
258
  .ring .bar { animation: none; stroke-dashoffset: 0; }
259
259
  .spinner { animation-duration: 2s; }
260
260
  }
261
- `;function i6(J){if(typeof document>"u")return J.prepare().then((S)=>void J.go(S),()=>{return});let $=a(P().locale),z=Math.max(1,Math.floor(J.seconds??3)),j=document.createElement(z9),Q=j.attachShadow({mode:"open"});l0(Q);let Z=document.createElement("style");Z.textContent=j9,Q.append(Z);let X=document.createElement("div");X.className="backdrop",X.innerHTML=`
261
+ `;function c6(J){if(typeof document>"u")return J.prepare().then((B)=>void J.go(B),()=>{return});let $=e(N().locale),z=Math.max(1,Math.floor(J.seconds??3)),j=document.createElement(Z9),Q=j.attachShadow({mode:"open"});l0(Q);let X=document.createElement("style");X.textContent=V9,Q.append(X);let Z=document.createElement("div");Z.className="backdrop",Z.innerHTML=`
262
262
  <div class="card" role="dialog" aria-modal="true" aria-labelledby="lw-ho-title">
263
263
  <div class="dial">
264
264
  <svg class="ring" viewBox="0 0 52 52" aria-hidden="true">
@@ -274,7 +274,7 @@ p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
274
274
  <button type="button" class="cancel"></button>
275
275
  <button type="button" class="go"></button>
276
276
  </div>
277
- </div>`,Q.append(X);let W=(S)=>X.querySelector(S),Y=W(".card"),q=W(".bar"),B=W(".count"),F=W("h2"),C=W(".body"),g=W(".host"),v=W(".go"),h=W(".cancel");F.textContent=$.handoffTitle,C.textContent=$.handoffBody;try{g.textContent=new URL(P().host).host}catch{g.textContent=""}v.textContent=$.handoffGo,h.textContent=$.cancel,Y.style.setProperty("--secs",`${z}s`),B.textContent=String(z),document.body.append(j),requestAnimationFrame(()=>X.setAttribute("data-open","1"));let _=document.activeElement;return v.focus({preventScroll:!0}),new Promise((S)=>{let N=!1,b=null,T=!1,x=Date.now()+z*1000,O=window.setInterval(()=>{let w=Math.ceil((x-Date.now())/1000);if(B.textContent=String(Math.max(0,w)),Date.now()>=x)E()},100);function L(w){if(N)return;if(N=!0,window.clearInterval(O),document.removeEventListener("keydown",$0,!0),X.removeAttribute("data-open"),window.setTimeout(()=>j.remove(),200),!w)_?.focus?.({preventScroll:!0});S()}function m(w){window.clearInterval(O),q.classList.remove("spinner"),q.style.animation="none",B.textContent="",F.textContent=$.handoffBlocked,C.textContent=$.handoffBody;let p=document.createElement("a");p.className="go",p.href=w,p.target="_blank",p.rel="noopener noreferrer",p.textContent=$.handoffOpen,p.addEventListener("click",()=>L(!0)),v.replaceWith(p),p.focus({preventScroll:!0})}function E(){if(N||T)return;if(b)return J.go(b)?L(!0):m(b);window.clearInterval(O),B.textContent="",q.classList.add("spinner"),F.textContent=$.handoffPreparing}function $0(w){if(w.key==="Escape")w.stopPropagation(),L(!1)}document.addEventListener("keydown",$0,!0),v.addEventListener("click",E),h.addEventListener("click",()=>L(!1)),X.addEventListener("click",(w)=>{if(w.target===X)L(!1)}),J.prepare().then((w)=>{if(b=w,!N&&Date.now()>=x)E()},()=>{T=!0,window.clearInterval(O),Y.classList.add("error"),q.classList.remove("spinner"),q.style.animation="none",B.textContent="",F.textContent=$.handoffFailed,C.textContent=$.handoffBody,v.remove(),h.textContent=$.close})})}var Q9="/sso";function Z9(J,$,z,j){let Q=new URL(Q9,J.endsWith("/")?J:`${J}/`);if(Q.searchParams.set("realm",$),Q.searchParams.set("token",z),j)Q.searchParams.set("return",j);return Q.toString()}class g2 extends Error{constructor(J="No identity provider is configured, or nobody is signed in"){super(J);this.name="NoIdentityError"}}async function m2(J){let $=P();if(!$.identity)throw new g2;let z=await $.identity();if(!z)throw new g2;return Z9($.host,$.realmKey,z,J)}var l6=m2;function c6(J,$){if($==="_self")return window.location.assign(J),!0;let z=window.open(J,"_blank");if(!z)return!1;try{z.opener=null}catch{}return!0}async function r6(J={}){if(J.announce===!1){c6(await m2(J.returnTo),J.target);return}await i6({seconds:J.seconds,prepare:()=>m2(J.returnTo),go:($)=>c6($,J.target)})}var o1='"Inter Variable", "Noto Sans Thai Variable", "IBM Plex Sans Thai", -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif';function X9(J){let $=(J??"").trim();return!$||/^(?:"?Times New Roman"?|"?Times"?|serif)$/i.test($)?"":$}function n1(J){if(!J||typeof document>"u"||!document.body)return;let $="";try{$=X9(getComputedStyle(document.body).fontFamily)}catch{}if($)J.style.setProperty("--lw-host-font",$);else J.style.removeProperty("--lw-host-font")}var V9="lw-call-ring",W9=`
277
+ </div>`,Q.append(Z);let W=(B)=>Z.querySelector(B),Y=W(".card"),U=W(".bar"),C=W(".count"),M=W("h2"),_=W(".body"),f=W(".host"),y=W(".go"),m=W(".cancel");M.textContent=$.handoffTitle,_.textContent=$.handoffBody;try{f.textContent=new URL(N().host).host}catch{f.textContent=""}y.textContent=$.handoffGo,m.textContent=$.cancel,Y.style.setProperty("--secs",`${z}s`),C.textContent=String(z),document.body.append(j),requestAnimationFrame(()=>Z.setAttribute("data-open","1"));let s=document.activeElement;return y.focus({preventScroll:!0}),new Promise((B)=>{let F=!1,w=null,v=!1,L=Date.now()+z*1000,g=window.setInterval(()=>{let x=Math.ceil((L-Date.now())/1000);if(C.textContent=String(Math.max(0,x)),Date.now()>=L)O()},100);function I(x){if(F)return;if(F=!0,window.clearInterval(g),document.removeEventListener("keydown",n,!0),Z.removeAttribute("data-open"),window.setTimeout(()=>j.remove(),200),!x)s?.focus?.({preventScroll:!0});B()}function b(x){window.clearInterval(g),U.classList.remove("spinner"),U.style.animation="none",C.textContent="",M.textContent=$.handoffBlocked,_.textContent=$.handoffBody;let c=document.createElement("a");c.className="go",c.href=x,c.target="_blank",c.rel="noopener noreferrer",c.textContent=$.handoffOpen,c.addEventListener("click",()=>I(!0)),y.replaceWith(c),c.focus({preventScroll:!0})}function O(){if(F||v)return;if(w)return J.go(w)?I(!0):b(w);window.clearInterval(g),C.textContent="",U.classList.add("spinner"),M.textContent=$.handoffPreparing}function n(x){if(x.key==="Escape")x.stopPropagation(),I(!1)}document.addEventListener("keydown",n,!0),y.addEventListener("click",O),m.addEventListener("click",()=>I(!1)),Z.addEventListener("click",(x)=>{if(x.target===Z)I(!1)}),J.prepare().then((x)=>{if(w=x,!F&&Date.now()>=L)O()},()=>{v=!0,window.clearInterval(g),Y.classList.add("error"),U.classList.remove("spinner"),U.style.animation="none",C.textContent="",M.textContent=$.handoffFailed,_.textContent=$.handoffBody,y.remove(),m.textContent=$.close})})}var W9="/sso";function K9(J,$,z,j){let Q=new URL(W9,J.endsWith("/")?J:`${J}/`);if(Q.searchParams.set("realm",$),Q.searchParams.set("token",z),j)Q.searchParams.set("return",j);return Q.toString()}class m2 extends Error{constructor(J="No identity provider is configured, or nobody is signed in"){super(J);this.name="NoIdentityError"}}async function h2(J){let $=N();if(!$.identity)throw new m2;let z=await $.identity();if(!z)throw new m2;return K9($.host,$.realmKey,z,J)}var r6=h2;function l6(J,$){if($==="_self")return window.location.assign(J),!0;let z=window.open(J,"_blank");if(!z)return!1;try{z.opener=null}catch{}return!0}async function o6(J={}){if(J.announce===!1){l6(await h2(J.returnTo),J.target);return}await c6({seconds:J.seconds,prepare:()=>h2(J.returnTo),go:($)=>l6($,J.target)})}var o1='"Inter Variable", "Noto Sans Thai Variable", "IBM Plex Sans Thai", -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif';function Y9(J){let $=(J??"").trim();return!$||/^(?:"?Times New Roman"?|"?Times"?|serif)$/i.test($)?"":$}function n1(J){if(!J||typeof document>"u"||!document.body)return;let $="";try{$=Y9(getComputedStyle(document.body).fontFamily)}catch{}if($)J.style.setProperty("--lw-host-font",$);else J.style.removeProperty("--lw-host-font")}var G9="lw-call-ring",U9=`
278
278
  :host { all: initial; }
279
279
  .card {
280
280
  position: fixed; right: 16px; bottom: calc(16px + var(--lw-chat-lift, 0px)); z-index: 2147483002;
@@ -325,13 +325,13 @@ h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.5; color: #1a1
325
325
  @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
326
326
  @keyframes spin { to { transform: rotate(360deg); } }
327
327
  @media (prefers-reduced-motion: reduce) { .card { animation: none; } .icon::after { animation: none; opacity: 0; } .spin { animation: none; } }
328
- `,a1=(J)=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${J}</svg>`,o6=a1('<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92z"/>'),K9=a1('<path d="M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"/><line x1="22" x2="2" y1="2" y2="22"/>'),Y9=a1('<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'),G9=a1('<path d="M21 12a9 9 0 1 1-6.219-8.56"/>').replace("<svg ",'<svg class="spin" '),i=null,F0=null,r0=null;function q9(J,$,z){if($.chatId)return z??$.ticketTitle;return J.replace("{key}",$.ticketKey).replace("{title}",$.ticketTitle)}var o0=()=>a(P().locale);function U9(){if(typeof document>"u")return null;if(i?.isConnected)return i.shadowRoot;i=document.createElement(V9),i.dataset.debugReporter="true",n1(i);let J=i.attachShadow({mode:"open"});return l0(J),document.body.append(i),J}function s1(J,$,z,j){let Q=document.createElement("button");return Q.type="button",Q.className=J,Q.innerHTML=$,Q.dataset.lwRing=z,Q.onclick=j,Q}var H1=(J)=>{let $=document.createElement("span");return $.textContent=J,$.outerHTML};function s6(J,$,z,j,Q){let Z=o0();J.innerHTML="";let X=document.createElement("style");X.textContent=W9;let W=document.createElement("div");W.className="card",W.setAttribute("role","alertdialog"),W.setAttribute("aria-label",Z.ringTitle),W.dataset.lwCallRing=$.id,W.dataset.lwRingMode=j;let Y=document.createElement("div");Y.className="head";let q=document.createElement("span");q.className="icon",q.innerHTML=o6;let B=document.createElement("div");B.className="words";let F=document.createElement("h2");F.textContent=Z.ringTitle;let C=document.createElement("p");C.className="about",C.textContent=q9(Z.ringAbout,$,Z.ringChat),C.title=C.textContent,B.append(F,C),Y.append(q,B);let g=document.createElement("p");g.className="how",g.textContent=Q??(j==="frame"?Z.ringHint:Z.ringHow);let v=document.createElement("div");v.className="actions";let h=s1("decline",K9+H1(Z.ringDecline),"decline",()=>z.decline());if(W.append(Y,g),j==="frame"&&z.answer){if(z.voice)W.append(s1("test",Y9+H1(Z.ringTest),"test",()=>z.voice?.()));let _=s1("answer",o6+H1(Z.ringAnswer),"answer",()=>z.answer?.());v.append(h,_)}else v.append(h,s1("open",H1(Z.ringOpen),"open",()=>z.open()));W.append(v),J.append(X,W)}function t1(J,$,z="portal"){if(F0===J.id&&i?.isConnected)return;let j=U9();if(!j)return;if(F0=J.id,s6(j,J,$,z),D9(),r0===null)r0=document.title,document.title=`${o0().ringTab} — ${r0}`}function a6(J){let $=i?.shadowRoot;if(!$||F0!==J)return;let z=$.querySelector(".answer");if(z)z.innerHTML=G9+H1(o0().ringAnswering),z.disabled=!0;let j=$.querySelector(".decline");if(j)j.disabled=!0}function t6(J,$){let z=i?.isConnected?i.shadowRoot:null;if(!z||F0!==J.id)return t1(J,$,"portal");i.style.display="",s6(z,J,$,"portal",o0().ringFallback)}function e1(J){let $=i?.shadowRoot;if(!$)return;b2(),$8();let z=o0(),j=$.querySelector(".how"),Q=$.querySelector(".actions");if(j)if(j.textContent="",J){let Z=document.createElement("a");Z.href=J,Z.target="_blank",Z.rel="noopener",Z.textContent=z.ringBlocked,Z.dataset.lwRing="link",Z.onclick=()=>window.setTimeout(()=>e1(),0),j.append(Z)}else j.textContent=z.ringOpened;if(Q){Q.innerHTML="";let Z=document.createElement("button");Z.type="button",Z.className="close",Z.textContent=z.ringClose,Z.dataset.lwRing="close",Z.onclick=()=>n0(),Q.append(Z)}}function e6(J,$=!0){if(!i?.isConnected||F0!==J)return;let z=i;if(clearTimeout(n6),!$){z.style.display="",z.style.opacity="";return}z.style.transition="opacity 150ms ease-out",z.style.opacity="0",n6=setTimeout(()=>{if(z.style.opacity==="0")z.style.display="none"},160)}var n6;function n0(J){if(J&&F0&&J!==F0)return;b2(),$8(),i?.remove(),i=null,F0=null}function J8(){return i?.isConnected?F0:null}function $8(){if(r0===null||typeof document>"u")return;if(document.title.startsWith(o0().ringTab))document.title=r0;r0=null}var R0=null,h2;function D9(){b2();let J=window,$=J.AudioContext??J.webkitAudioContext;if(!$)return;try{let j=R0??new $;R0=j,j.resume?.().catch(()=>{return})}catch{return}let z=()=>{if(!R0||R0.state!=="running")return;let j=R0.currentTime;for(let[Q,Z]of[660,880].entries()){let X=R0.createOscillator(),W=R0.createGain();X.frequency.value=Z,W.gain.setValueAtTime(0.0001,j+Q*0.22),W.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),W.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),X.connect(W).connect(R0.destination),X.start(j+Q*0.22),X.stop(j+Q*0.22+0.21)}};z(),h2=setInterval(z,2200)}function b2(){clearInterval(h2),h2=void 0}var H9=/^[A-Za-z0-9_-]{1,32}$/,M9=/^#[0-9a-fA-F]{6}$/,P9=["pen","rect","laser"],z8=(J)=>J<0?0:J>1?1:J;function j8(J,$){if(!Array.isArray(J)||J.length<$||J.length>64)return null;let z=[];for(let j of J){if(!Array.isArray(j)||j.length!==2)return null;let[Q,Z]=j;if(typeof Q!=="number"||typeof Z!=="number"||!Number.isFinite(Q)||!Number.isFinite(Z))return null;z.push([z8(Q),z8(Z)])}return z}function J2(J){if(!J||typeof J!=="object")return null;let $=J;if($.op==="clear")return{op:"clear"};if(typeof $.id!=="string"||!H9.test($.id))return null;if($.op==="end")return{op:"end",id:$.id};if($.op==="add"){let z=j8($.pts,1);return z?{op:"add",id:$.id,pts:z}:null}if($.op==="begin"){if(!P9.includes($.kind)||typeof $.color!=="string"||!M9.test($.color))return null;let z=j8($.pts,1);return z?{op:"begin",id:$.id,kind:$.kind,color:$.color,pts:z}:null}return null}function u2(J,$){if(J.endedAt!==null)return J.endedAt;return $-J.lastAt>20000?J.lastAt:null}function Q8(J,$,z){if($===null)return 1;let j=z-$;if(J==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class p2{marks=new Map;apply(J,$=Date.now()){if(J.op==="clear"){this.marks.clear();return}if(J.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete(J.id),this.marks.set(J.id,{kind:J.kind,color:J.color,pts:J.pts.map(([j,Q])=>({x:j,y:Q,t:$})),endedAt:null,lastAt:$});return}let z=this.marks.get(J.id);if(!z||u2(z,$)!==null)return;if(J.op==="end"){z.endedAt=$;return}if(z.lastAt=$,z.kind==="rect"){let[j,Q]=J.pts[J.pts.length-1];z.pts=[z.pts[0],{x:j,y:Q,t:$}];return}for(let[j,Q]of J.pts)z.pts.push({x:j,y:Q,t:$});if(z.pts.length>4000)z.pts.splice(0,z.pts.length-4000)}alive(J=Date.now()){for(let[$,z]of this.marks)if(Q8(z.kind,u2(z,J),J)<=0)this.marks.delete($);return this.marks.size>0}get size(){return this.marks.size}draw(J,$,z,j=Date.now()){J.clearRect(0,0,$,z);let Q=Math.max(1,Math.min($,z));for(let Z of this.marks.values()){let X=Q8(Z.kind,u2(Z,j),j);if(X<=0||!Z.pts.length)continue;if(J.save(),J.lineCap="round",J.lineJoin="round",Z.kind==="pen")F9(J,Z,$,z,Math.max(3,Q*0.0045),X);else if(Z.kind==="rect")N9(J,Z,$,z,Math.max(2.5,Q*0.003),X);else _9(J,Z,$,z,Math.max(6,Q*0.008),X,j);J.restore()}}}function B9(J,$,z,j){if(J.beginPath(),J.moveTo($[0].x*z,$[0].y*j),$.length===1){J.lineTo($[0].x*z+0.01,$[0].y*j);return}for(let Z=1;Z<$.length-1;Z++){let X=$[Z],W=$[Z+1];J.quadraticCurveTo(X.x*z,X.y*j,(X.x+W.x)/2*z,(X.y+W.y)/2*j)}let Q=$[$.length-1];J.lineTo(Q.x*z,Q.y*j)}function F9(J,$,z,j,Q,Z){J.globalAlpha=Z,B9(J,$.pts,z,j),J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=Q+3,J.stroke(),J.strokeStyle=$.color,J.lineWidth=Q,J.stroke()}function N9(J,$,z,j,Q,Z){let X=$.pts[0],W=$.pts[$.pts.length-1],Y=Math.min(X.x,W.x)*z,q=Math.min(X.y,W.y)*j,B=Math.abs(W.x-X.x)*z,F=Math.abs(W.y-X.y)*j;J.globalAlpha=Z,J.fillStyle=$.color,J.globalAlpha=Z*0.14,J.fillRect(Y,q,B,F),J.globalAlpha=Z,J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=Q+3,J.strokeRect(Y,q,B,F),J.strokeStyle=$.color,J.lineWidth=Q,J.strokeRect(Y,q,B,F)}function _9(J,$,z,j,Q,Z,X){let W=$.pts.filter((q)=>X-q.t<=450);for(let q=1;q<W.length;q++){let B=W[q-1],F=W[q];J.globalAlpha=Z*Math.max(0,1-(X-F.t)/450)*0.7,J.strokeStyle=$.color,J.lineWidth=Q*0.9,J.beginPath(),J.moveTo(B.x*z,B.y*j),J.lineTo(F.x*z,F.y*j),J.stroke()}let Y=$.pts[$.pts.length-1];J.globalAlpha=Z,J.shadowColor=$.color,J.shadowBlur=Q*2,J.fillStyle=$.color,J.beginPath(),J.arc(Y.x*z,Y.y*j,Q,0,Math.PI*2),J.fill(),J.shadowBlur=0,J.strokeStyle="rgba(255,255,255,0.95)",J.lineWidth=2,J.stroke()}function I9(J,$,z,j=typeof window>"u"?1:window.devicePixelRatio||1){let Q=Math.max(1,Math.round($*j)),Z=Math.max(1,Math.round(z*j));if(J.width!==Q)J.width=Q;if(J.height!==Z)J.height=Z;let X=J.getContext("2d");return X?.setTransform(j,0,0,j,0,0),X}class d2{canvas;scene;box;frame=0;constructor(J,$,z){this.canvas=J;this.scene=$;this.box=z}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let J=()=>{this.frame=0;let{w:$,h:z}=this.box(),j=I9(this.canvas,$,z),Q=Date.now(),Z=this.scene.alive(Q);if(j)this.scene.draw(j,$,z,Q);if(Z)this.frame=requestAnimationFrame(J)};this.frame=requestAnimationFrame(J)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var C9="lw-call-ink",A0=null,$2=null,M1=null;function O9(){if(A0?.isConnected&&M1)return;A0=document.createElement(C9),A0.dataset.debugReporter="true";let J=A0.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=`:host { all: initial; }
329
- canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let z=document.createElement("canvas");z.setAttribute("aria-hidden","true"),z.dataset.lwCallInk="",J.append($,z),document.body.append(A0),$2=new p2,M1=new d2(z,$2,()=>({w:window.innerWidth,h:window.innerHeight}))}function z2(J){if(typeof document>"u")return;if(J.op==="clear"&&!A0)return;O9(),$2.apply(J),M1.kick()}function j2(){M1?.stop(),A0?.remove(),A0=null,$2=null,M1=null}var L9="lw-call-frame",S9="lw-call",j0=16,o2=368,q0=null,u=null,w0=null,X2="",B1=null,F1="card",n2={width:o2,height:0},s2,N1=!1,a2=null,a0={answer:!1,voice:!1},T0=null,t=null,i2="lw-call-frame-place";function Z8(J,$,z,j){let Q=new URL("embed/call",J.endsWith("/")?J:`${J}/`);if(Q.searchParams.set("realm",$),z)Q.searchParams.set("token",z);else Q.searchParams.set("hand","1");return Q.searchParams.set("call",j),Q.toString()}function s0(J){u?.contentWindow?.postMessage({source:"lw-call-host",...J},X2)}function X8(J){if(w0!==J)return;if(a0.answer=!0,N1)s0({type:"answer"})}function V8(J){if(w0!==J)return;if(a0.voice=!0,N1)s0({type:"voice"})}function W8(J,$,z){return{x:Math.min(Math.max(J.x,j0/2),Math.max(j0/2,z.w-$.w-j0/2)),y:Math.min(Math.max(J.y,j0/2),Math.max(j0/2,z.h-$.h-j0/2))}}function R9(J,$){if(J.origin!==$.origin||J.source!==$.window)return null;let z=J.data;return z&&typeof z==="object"&&z.source===S9&&typeof z.type==="string"?z:null}function e0(){return q0?.isConnected?w0:null}function K8(J,$,z,j=15000,Q=null){if(typeof document>"u")return;if(w0===$&&q0?.isConnected)return;_1(),w0=$,B1=z,N1=!1,a2=Q,a0={answer:!1,voice:!1},F1="card",n2={width:o2,height:0},X2=new URL(J).origin;try{T0=JSON.parse(sessionStorage.getItem(i2)??"null")}catch{T0=null}q0=document.createElement(L9),q0.dataset.debugReporter="true";let Z=q0.attachShadow({mode:"open"}),X=document.createElement("style");X.textContent=`:host { all: initial; }
328
+ `,a1=(J)=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${J}</svg>`,n6=a1('<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92z"/>'),q9=a1('<path d="M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"/><line x1="22" x2="2" y1="2" y2="22"/>'),D9=a1('<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'),H9=a1('<path d="M21 12a9 9 0 1 1-6.219-8.56"/>').replace("<svg ",'<svg class="spin" '),p=null,F0=null,r0=null;function M9(J,$,z){if($.chatId)return z??$.ticketTitle;return J.replace("{key}",$.ticketKey).replace("{title}",$.ticketTitle)}var o0=()=>e(N().locale);function B9(){if(typeof document>"u")return null;if(p?.isConnected)return p.shadowRoot;p=document.createElement(G9),p.dataset.debugReporter="true",n1(p);let J=p.attachShadow({mode:"open"});return l0(J),document.body.append(p),J}function s1(J,$,z,j){let Q=document.createElement("button");return Q.type="button",Q.className=J,Q.innerHTML=$,Q.dataset.lwRing=z,Q.onclick=j,Q}var H1=(J)=>{let $=document.createElement("span");return $.textContent=J,$.outerHTML};function a6(J,$,z,j,Q){let X=o0();J.innerHTML="";let Z=document.createElement("style");Z.textContent=U9;let W=document.createElement("div");W.className="card",W.setAttribute("role","alertdialog"),W.setAttribute("aria-label",X.ringTitle),W.dataset.lwCallRing=$.id,W.dataset.lwRingMode=j;let Y=document.createElement("div");Y.className="head";let U=document.createElement("span");U.className="icon",U.innerHTML=n6;let C=document.createElement("div");C.className="words";let M=document.createElement("h2");M.textContent=X.ringTitle;let _=document.createElement("p");_.className="about",_.textContent=M9(X.ringAbout,$,X.ringChat),_.title=_.textContent,C.append(M,_),Y.append(U,C);let f=document.createElement("p");f.className="how",f.textContent=Q??(j==="frame"?X.ringHint:X.ringHow);let y=document.createElement("div");y.className="actions";let m=s1("decline",q9+H1(X.ringDecline),"decline",()=>z.decline());if(W.append(Y,f),j==="frame"&&z.answer){if(z.voice)W.append(s1("test",D9+H1(X.ringTest),"test",()=>z.voice?.()));let s=s1("answer",n6+H1(X.ringAnswer),"answer",()=>z.answer?.());y.append(m,s)}else y.append(m,s1("open",H1(X.ringOpen),"open",()=>z.open()));W.append(y),J.append(Z,W)}function t1(J,$,z="portal"){if(F0===J.id&&p?.isConnected)return;let j=B9();if(!j)return;if(F0=J.id,a6(j,J,$,z),P9(),r0===null)r0=document.title,document.title=`${o0().ringTab} — ${r0}`}function t6(J){let $=p?.shadowRoot;if(!$||F0!==J)return;let z=$.querySelector(".answer");if(z)z.innerHTML=H9+H1(o0().ringAnswering),z.disabled=!0;let j=$.querySelector(".decline");if(j)j.disabled=!0}function e6(J,$){let z=p?.isConnected?p.shadowRoot:null;if(!z||F0!==J.id)return t1(J,$,"portal");p.style.display="",a6(z,J,$,"portal",o0().ringFallback)}function e1(J){let $=p?.shadowRoot;if(!$)return;u2(),z8();let z=o0(),j=$.querySelector(".how"),Q=$.querySelector(".actions");if(j)if(j.textContent="",J){let X=document.createElement("a");X.href=J,X.target="_blank",X.rel="noopener",X.textContent=z.ringBlocked,X.dataset.lwRing="link",X.onclick=()=>window.setTimeout(()=>e1(),0),j.append(X)}else j.textContent=z.ringOpened;if(Q){Q.innerHTML="";let X=document.createElement("button");X.type="button",X.className="close",X.textContent=z.ringClose,X.dataset.lwRing="close",X.onclick=()=>n0(),Q.append(X)}}function J8(J,$=!0){if(!p?.isConnected||F0!==J)return;let z=p;if(clearTimeout(s6),!$){z.style.display="",z.style.opacity="";return}z.style.transition="opacity 150ms ease-out",z.style.opacity="0",s6=setTimeout(()=>{if(z.style.opacity==="0")z.style.display="none"},160)}var s6;function n0(J){if(J&&F0&&J!==F0)return;u2(),z8(),p?.remove(),p=null,F0=null}function $8(){return p?.isConnected?F0:null}function z8(){if(r0===null||typeof document>"u")return;if(document.title.startsWith(o0().ringTab))document.title=r0;r0=null}var T0=null,b2;function P9(){u2();let J=window,$=J.AudioContext??J.webkitAudioContext;if(!$)return;try{let j=T0??new $;T0=j,j.resume?.().catch(()=>{return})}catch{return}let z=()=>{if(!T0||T0.state!=="running")return;let j=T0.currentTime;for(let[Q,X]of[660,880].entries()){let Z=T0.createOscillator(),W=T0.createGain();Z.frequency.value=X,W.gain.setValueAtTime(0.0001,j+Q*0.22),W.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),W.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),Z.connect(W).connect(T0.destination),Z.start(j+Q*0.22),Z.stop(j+Q*0.22+0.21)}};z(),b2=setInterval(z,2200)}function u2(){clearInterval(b2),b2=void 0}var F9=/^[A-Za-z0-9_-]{1,32}$/,N9=/^#[0-9a-fA-F]{6}$/,_9=["pen","rect","laser"],j8=(J)=>J<0?0:J>1?1:J;function Q8(J,$){if(!Array.isArray(J)||J.length<$||J.length>64)return null;let z=[];for(let j of J){if(!Array.isArray(j)||j.length!==2)return null;let[Q,X]=j;if(typeof Q!=="number"||typeof X!=="number"||!Number.isFinite(Q)||!Number.isFinite(X))return null;z.push([j8(Q),j8(X)])}return z}function J2(J){if(!J||typeof J!=="object")return null;let $=J;if($.op==="clear")return{op:"clear"};if(typeof $.id!=="string"||!F9.test($.id))return null;if($.op==="end")return{op:"end",id:$.id};if($.op==="add"){let z=Q8($.pts,1);return z?{op:"add",id:$.id,pts:z}:null}if($.op==="begin"){if(!_9.includes($.kind)||typeof $.color!=="string"||!N9.test($.color))return null;let z=Q8($.pts,1);return z?{op:"begin",id:$.id,kind:$.kind,color:$.color,pts:z}:null}return null}function p2(J,$){if(J.endedAt!==null)return J.endedAt;return $-J.lastAt>20000?J.lastAt:null}function X8(J,$,z){if($===null)return 1;let j=z-$;if(J==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class d2{marks=new Map;apply(J,$=Date.now()){if(J.op==="clear"){this.marks.clear();return}if(J.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete(J.id),this.marks.set(J.id,{kind:J.kind,color:J.color,pts:J.pts.map(([j,Q])=>({x:j,y:Q,t:$})),endedAt:null,lastAt:$});return}let z=this.marks.get(J.id);if(!z||p2(z,$)!==null)return;if(J.op==="end"){z.endedAt=$;return}if(z.lastAt=$,z.kind==="rect"){let[j,Q]=J.pts[J.pts.length-1];z.pts=[z.pts[0],{x:j,y:Q,t:$}];return}for(let[j,Q]of J.pts)z.pts.push({x:j,y:Q,t:$});if(z.pts.length>4000)z.pts.splice(0,z.pts.length-4000)}alive(J=Date.now()){for(let[$,z]of this.marks)if(X8(z.kind,p2(z,J),J)<=0)this.marks.delete($);return this.marks.size>0}get size(){return this.marks.size}draw(J,$,z,j=Date.now()){J.clearRect(0,0,$,z);let Q=Math.max(1,Math.min($,z));for(let X of this.marks.values()){let Z=X8(X.kind,p2(X,j),j);if(Z<=0||!X.pts.length)continue;if(J.save(),J.lineCap="round",J.lineJoin="round",X.kind==="pen")I9(J,X,$,z,Math.max(3,Q*0.0045),Z);else if(X.kind==="rect")O9(J,X,$,z,Math.max(2.5,Q*0.003),Z);else L9(J,X,$,z,Math.max(6,Q*0.008),Z,j);J.restore()}}}function C9(J,$,z,j){if(J.beginPath(),J.moveTo($[0].x*z,$[0].y*j),$.length===1){J.lineTo($[0].x*z+0.01,$[0].y*j);return}for(let X=1;X<$.length-1;X++){let Z=$[X],W=$[X+1];J.quadraticCurveTo(Z.x*z,Z.y*j,(Z.x+W.x)/2*z,(Z.y+W.y)/2*j)}let Q=$[$.length-1];J.lineTo(Q.x*z,Q.y*j)}function I9(J,$,z,j,Q,X){J.globalAlpha=X,C9(J,$.pts,z,j),J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=Q+3,J.stroke(),J.strokeStyle=$.color,J.lineWidth=Q,J.stroke()}function O9(J,$,z,j,Q,X){let Z=$.pts[0],W=$.pts[$.pts.length-1],Y=Math.min(Z.x,W.x)*z,U=Math.min(Z.y,W.y)*j,C=Math.abs(W.x-Z.x)*z,M=Math.abs(W.y-Z.y)*j;J.globalAlpha=X,J.fillStyle=$.color,J.globalAlpha=X*0.14,J.fillRect(Y,U,C,M),J.globalAlpha=X,J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=Q+3,J.strokeRect(Y,U,C,M),J.strokeStyle=$.color,J.lineWidth=Q,J.strokeRect(Y,U,C,M)}function L9(J,$,z,j,Q,X,Z){let W=$.pts.filter((U)=>Z-U.t<=450);for(let U=1;U<W.length;U++){let C=W[U-1],M=W[U];J.globalAlpha=X*Math.max(0,1-(Z-M.t)/450)*0.7,J.strokeStyle=$.color,J.lineWidth=Q*0.9,J.beginPath(),J.moveTo(C.x*z,C.y*j),J.lineTo(M.x*z,M.y*j),J.stroke()}let Y=$.pts[$.pts.length-1];J.globalAlpha=X,J.shadowColor=$.color,J.shadowBlur=Q*2,J.fillStyle=$.color,J.beginPath(),J.arc(Y.x*z,Y.y*j,Q,0,Math.PI*2),J.fill(),J.shadowBlur=0,J.strokeStyle="rgba(255,255,255,0.95)",J.lineWidth=2,J.stroke()}function S9(J,$,z,j=typeof window>"u"?1:window.devicePixelRatio||1){let Q=Math.max(1,Math.round($*j)),X=Math.max(1,Math.round(z*j));if(J.width!==Q)J.width=Q;if(J.height!==X)J.height=X;let Z=J.getContext("2d");return Z?.setTransform(j,0,0,j,0,0),Z}class i2{canvas;scene;box;frame=0;constructor(J,$,z){this.canvas=J;this.scene=$;this.box=z}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let J=()=>{this.frame=0;let{w:$,h:z}=this.box(),j=S9(this.canvas,$,z),Q=Date.now(),X=this.scene.alive(Q);if(j)this.scene.draw(j,$,z,Q);if(X)this.frame=requestAnimationFrame(J)};this.frame=requestAnimationFrame(J)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var R9="lw-call-ink",A0=null,$2=null,M1=null;function T9(){if(A0?.isConnected&&M1)return;A0=document.createElement(R9),A0.dataset.debugReporter="true";let J=A0.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=`:host { all: initial; }
329
+ canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let z=document.createElement("canvas");z.setAttribute("aria-hidden","true"),z.dataset.lwCallInk="",J.append($,z),document.body.append(A0),$2=new d2,M1=new i2(z,$2,()=>({w:window.innerWidth,h:window.innerHeight}))}function z2(J){if(typeof document>"u")return;if(J.op==="clear"&&!A0)return;T9(),$2.apply(J),M1.kick()}function j2(){M1?.stop(),A0?.remove(),A0=null,$2=null,M1=null}var A9="lw-call-frame",E9="lw-call",j0=16,n2=368,D0=null,h=null,y0=null,Z2="",P1=null,F1="card",s2={width:n2,height:0},a2,N1=!1,t2=null,a0={answer:!1,voice:!1},E0=null,J0=null,c2="lw-call-frame-place";function Z8(J,$,z,j){let Q=new URL("embed/call",J.endsWith("/")?J:`${J}/`);if(Q.searchParams.set("realm",$),z)Q.searchParams.set("token",z);else Q.searchParams.set("hand","1");return Q.searchParams.set("call",j),Q.toString()}function s0(J){h?.contentWindow?.postMessage({source:"lw-call-host",...J},Z2)}function V8(J){if(y0!==J)return;if(a0.answer=!0,N1)s0({type:"answer"})}function W8(J){if(y0!==J)return;if(a0.voice=!0,N1)s0({type:"voice"})}function K8(J,$,z){return{x:Math.min(Math.max(J.x,j0/2),Math.max(j0/2,z.w-$.w-j0/2)),y:Math.min(Math.max(J.y,j0/2),Math.max(j0/2,z.h-$.h-j0/2))}}function x9(J,$){if(J.origin!==$.origin||J.source!==$.window)return null;let z=J.data;return z&&typeof z==="object"&&z.source===E9&&typeof z.type==="string"?z:null}function e0(){return D0?.isConnected?y0:null}function Y8(J,$,z,j=15000,Q=null){if(typeof document>"u")return;if(y0===$&&D0?.isConnected)return;_1(),y0=$,P1=z,N1=!1,t2=Q,a0={answer:!1,voice:!1},F1="card",s2={width:n2,height:0},Z2=new URL(J).origin;try{E0=JSON.parse(sessionStorage.getItem(c2)??"null")}catch{E0=null}D0=document.createElement(A9),D0.dataset.debugReporter="true";let X=D0.attachShadow({mode:"open"}),Z=document.createElement("style");Z.textContent=`:host { all: initial; }
330
330
  iframe { position: fixed; z-index: 2147483003; border: 0; background: transparent; color-scheme: normal; visibility: hidden; }
331
- iframe.on { visibility: visible; }`,u=document.createElement("iframe"),u.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",u.title="สายจากทีมงาน",u.dataset.lwCallFrame=$,u.setAttribute("allowtransparency","true"),u.src=J,Z.append(X,u),document.body.append(q0),t0(),window.addEventListener("message",Y8),window.addEventListener("resize",t0),t2(`lw-call:${$}`),s2=setTimeout(()=>{if(!N1)c2("timeout")},j)}function _1(){if(q0)t2(l2?.handle??null,l2?.readableBy);j2(),clearTimeout(s2),window.removeEventListener("message",Y8),window.removeEventListener("resize",t0),Q2(!1),q0?.remove(),q0=null,u=null,w0=null,B1=null,t=null,a2=null,a0={answer:!1,voice:!1}}function c2(J){let $=B1;_1(),$?.failed(J)}function Y8(J){if(!u)return;let $=R9(J,{origin:X2,window:u.contentWindow});if(!$)return;switch($.type){case"hello":a2?.then((z)=>{if(!u||w0===null)return;if(z)s0({type:"token",token:z});else c2("no_token")});return;case"ready":if(N1=!0,clearTimeout(s2),u.classList.add("on"),B1?.ready(),a0.answer)s0({type:"answer"});if(a0.voice)s0({type:"voice"});return;case"size":if(typeof $.width==="number"&&typeof $.height==="number")n2={width:$.width,height:$.height};if($.layout==="card"||$.layout==="full"){if($.layout==="full"&&F1==="card")A9();F1=$.layout}return t0();case"drag":return r2($);case"home":return T0=null,q8(),t0();case"done":{let z=B1;_1(),z?.done();return}case"failed":return c2($.reason??"failed");case"ink":{let z=J2($.op);if(z)z2(z);return}}}function t2(J,$=X2){let z=typeof navigator>"u"?void 0:navigator.mediaDevices;try{z?.setCaptureHandleConfig?.(J&&$?{handle:J,exposeOrigin:!1,permittedOrigins:[$]}:{})}catch{}}var l2=null;function G8(J,$){if(l2={handle:J,readableBy:$},!q0?.isConnected)t2(J,$)}function r2(J){if(!u||F1!=="card"||typeof J.x!=="number"||typeof J.y!=="number")return;if(J.phase==="start"){let $=u.getBoundingClientRect();t={sx:J.x,sy:J.y,x:$.left,y:$.top,lx:J.x,ly:J.y},Q2(!0);return}if(!t)return;if(t.lx=J.x,t.ly=J.y,T0=W8({x:t.x+(J.x-t.sx),y:t.y+(J.y-t.sy)},U8(),Z2()),t0(),J.phase==="end")t=null,Q2(!1),q8()}var P1=null;function Q2(J){if(P1){for(let $ of["pointermove","pointerup","pointercancel"])window.removeEventListener($,P1,!0);P1=null}if(!J)return;P1=($)=>{if(!t)return Q2(!1);if($.type==="pointermove"&&$.buttons!==0)return r2({type:"drag",phase:"move",x:$.screenX,y:$.screenY});let z=$.type==="pointerup";r2({type:"drag",phase:"end",x:z?$.screenX:t.lx,y:z?$.screenY:t.ly})};for(let $ of["pointermove","pointerup","pointercancel"])window.addEventListener($,P1,!0)}function A9(){if(!u?.contentWindow)return;let J=u.getBoundingClientRect();s0({type:"corner",x:Math.round(J.left),y:Math.round(J.top),width:Math.round(J.width)})}function q8(){try{if(T0)sessionStorage.setItem(i2,JSON.stringify(T0));else sessionStorage.removeItem(i2)}catch{}}var Z2=()=>({w:window.innerWidth,h:window.innerHeight});function U8(){let J=Z2();return{w:Math.min(o2,J.w-j0),h:Math.min(n2.height||0,J.h-j0)}}function t0(){if(!u)return;let J=u.style;if(F1==="full"){Object.assign(J,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let $=U8(),z=Z2().w<480;if(J.width=z?`calc(100vw - ${j0}px)`:`${$.w}px`,J.height=`${$.h}px`,T0&&!z){let j=W8(T0,$,Z2());Object.assign(J,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(J,{left:z?`${j0/2}px`:"",top:"",right:z?"":`${j0/2}px`,bottom:`calc(${j0/2}px + var(--lw-chat-lift, 0px))`})}var V2=[2000,5000,15000,30000,60000],D8=new Set(["ringing","active"]),T9=20000,H8=!1,J1=!1,M8=0,x9=5,e2=null,O8=0,J4,P8,B8,L8=(J)=>J.endsWith("/")?J:`${J}/`;function E9(J,$){let z=new URL("api/presence/ws",L8(J));return z.protocol=z.protocol==="https:"?"wss:":"ws:",z.searchParams.set("t",$),z.toString()}function k9(J){if(J.chatId||!J.ticketId)return`/me/chat?call=${J.id}`;return`/me/tickets/${J.ticketId}?call=${J.id}`}function f9(J){return J.status==="ringing"&&(J.side==="reporter"||J.side===void 0||J.side===null)}var $4=new Set;function S8(J){return $4.add(J),()=>$4.delete(J)}var F8=()=>P().ring!==!1;async function y0(){let J=P().identity;if(!J)return null;try{return await J()??null}catch{return null}}async function Z4(J,$){let z=P();return fetch(new URL(J,L8(z.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":z.realmKey,authorization:`Bearer ${$}`},body:"{}"})}function X4(){if(H8||typeof window>"u"||typeof WebSocket>"u")return;let J=P();if(!J.identity||J.ring===!1&&!J.chat)return;H8=!0,J1=!1,y9(J.host);try{G8(`lw-tab:${A8()}`,new URL(J.host).origin)}catch{}R8()}function I1(J=!1){if(J1)return;let $=J?V2[V2.length-1]:V2[Math.min(O8++,V2.length-1)];clearTimeout(P8),P8=setTimeout(()=>void R8(),$)}async function R8(){if(J1)return;let J=await y0();if(!J){if(++M8>=x9){J1=!0;return}return I1(!0)}M8=0;let $;try{$=await Z4(P().chat?"ingest/live-ticket?chat=1":"ingest/live-ticket",J)}catch{return I1()}if($.status===401||$.status===404||$.status===403){J1=!0;return}if(!$.ok)return I1($.status===429);let z;try{z=await $.json()}catch{return I1()}if(!z.ticket){J1=!0;return}if(z.calls&&z.call&&F8())C8(z.call);let j=new WebSocket(E9(P().host,z.ticket));e2=j,j.onopen=()=>{O8=0,j.send(JSON.stringify({type:"tab",id:A8()})),clearInterval(J4),J4=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},T9)},j.onmessage=(Q)=>{try{let Z=JSON.parse(String(Q.data));if(Z.type==="chat-changed"||Z.type==="ticket-changed"||Z.type==="chat-seen"){for(let X of $4)X(Z);return}if(Z.type==="call-state"&&Z.call&&typeof Z.call==="object"){if(F8())C8(Z.call)}else if(Z.type==="call-ink"&&typeof Z.call==="string"){let X=J2(Z.op);if(X)Q4=Z.call,z2(X)}}catch{}},j.onclose=()=>{if(clearInterval(J4),e2===j)e2=null;I1()}}var z4="lw-call-framed";function w9(){try{return sessionStorage.getItem(z4)}catch{return null}}function W2(J){try{if(J)sessionStorage.setItem(z4,J);else sessionStorage.removeItem(z4)}catch{}}var N8=!1;function y9(J){if(N8||typeof document>"u")return;N8=!0;try{let $=new URL(J).origin;for(let z of["dns-prefetch","preconnect"]){let j=document.createElement("link");if(j.rel=z,j.href=$,z==="preconnect")j.crossOrigin="anonymous";j.dataset.debugReporter="true",document.head.append(j)}}catch{}}function _8(J){let $=P();if($.callFrame===!1||e0()===J.id)return;W2(J.id),K8(Z8($.host,$.realmKey,null,J.id),J.id,{ready:()=>e6(J.id),done:()=>{W2(null),n0(J.id)},failed:()=>{W2(null),t6(J,j4(J))}},15000,y0())}var j4=(J)=>({open:()=>v9(J),decline:()=>void g9(J)}),x0=null;function A8(){if(x0)return x0;try{x0=sessionStorage.getItem(I8)}catch{}if(!x0||!/^[A-Za-z0-9_-]{8,40}$/.test(x0)){let J=new Uint8Array(12);crypto.getRandomValues(J),x0=Array.from(J,($)=>$.toString(16).padStart(2,"0")).join("");try{sessionStorage.setItem(I8,x0)}catch{}}return x0}var I8="lw-tab-id",Q4=null;function C8(J){if(!D8.has(J.status)&&Q4===J.id&&e0()!==J.id)Q4=null,j2();if(!f9(J)){if(n0(J.id),J.status==="active"&&w9()===J.id&&!e0())_8(J);if(!D8.has(J.status)&&e0()===J.id)setTimeout(()=>{if(e0()===J.id)_1(),W2(null)},12000);return}if(P().callFrame===!1)t1(J,j4(J),"portal");else t1(J,{...j4(J),answer:()=>{a6(J.id),X8(J.id)},voice:()=>V8(J.id)},"frame"),_8(J);clearTimeout(B8);let $=new Date(J.ringUntil).getTime()-Date.now();B8=setTimeout(()=>{if(J8()===J.id)n0(J.id)},Math.max(5000,$+5000))}function v9(J){let $=window.open("about:blank","_blank");(async()=>{let z=await y0();if(z)Z4(`ingest/calls/${J.id}/coming`,z).catch(()=>{return});let j;try{j=await l6(k9(J))}catch{$?.close();return}if($&&!$.closed){$.location.href=j;try{$.opener=null}catch{}e1()}else e1(j)})()}async function g9(J){n0(J.id);let $=await y0();if($)await Z4(`ingest/calls/${J.id}/decline`,$).catch(()=>{return})}function W4(J,$,z,j){let Q=[];for(let Z of J){if(Z.right<=$.left||Z.left>=$.right||Z.bottom<=Z.top)continue;Q.push([z-Z.bottom-8-j,z-Z.top+8])}return Q.sort((Z,X)=>Z[0]-X[0])}function V4(J,$,z,j){if(j<z)return null;let Q=(Y)=>$.some(([q,B])=>Y>q&&Y<B),Z=(Y)=>Math.min(Math.max(Y,z),j),X=Z(J);if(!Q(X))return X;let W=[z,j,...$.flatMap(([Y,q])=>[Y,q])].map(Z).filter((Y)=>!Q(Y));if(!W.length)return null;return W.reduce((Y,q)=>{let B=Math.abs(q-X),F=Math.abs(Y-X);return B<F||B===F&&q>Y?q:Y})}function m9(J,$,z,j){let Q=J.side==="right"?"left":"right",Z=V4(J.y,$[J.side],z,j),X=V4(J.y,$[Q],z,j);if(Z===null&&X===null)return J;let W=Z===null?1/0:Math.abs(Z-J.y),Y=X===null?1/0:160+Math.abs(X-J.y);return W<=Y?{side:J.side,y:Z}:{side:Q,y:X}}function x8(J,$,z,j,Q){if(J&&V4(J.y,z[J.side],j,Q)===J.y)return J;return m9($,z,j,Q)}function h9(J){if(typeof J!=="string"||!J.startsWith("/")||J.length>200)return null;let z=(J.length>1?J.replace(/\/+$/,""):"").split(/(\*\*|\*)/).map((j)=>j==="**"?".*":j==="*"?"[^/]*":j.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join("");try{return new RegExp(`^${z}(?:/.*)?$`)}catch{return null}}function E8(J,$){let z=null;for(let j of $??[]){let Q=h9(j.path);if(!Q||!Q.test(J))continue;if(!z||j.path.replace(/\*/g,"").length>z.path.replace(/\*/g,"").length)z=j}return z}var b9=/^LW-/,u9='a[href],button,input,select,textarea,summary,label,[role="button"],[role="link"],[role="tab"],[role="menuitem"],[role="checkbox"],[role="switch"],[role="radio"],[role="option"],[role="slider"],[role="combobox"],[role="textbox"],[contenteditable=""],[contenteditable="true"],[tabindex]:not([tabindex="-1"])',T8=/(auto|scroll|overlay)/;function k8(J,$,z={}){if(typeof document>"u"||typeof document.elementsFromPoint!=="function")return J.map(()=>[]);let j=z.step??12,Q=document.documentElement,Z=document.body,X=new Map,W=(_)=>X.get(_)??(X.set(_,getComputedStyle(_)),X.get(_)),Y=$.w*$.h,q=(_)=>_.width*_.height>0.34*Y||_.width>=$.w*0.9&&_.height>=$.h*0.9,B=(_)=>{let S=W(_);return T8.test(S.overflowY)&&_.scrollHeight>_.clientHeight+1||T8.test(S.overflowX)&&_.scrollWidth>_.clientWidth+1},F=document.scrollingElement??Q,C=F.scrollHeight>F.clientHeight+1&&W(Q).overflowY!=="hidden"&&(!Z||W(Z).overflowY!=="hidden"),g=(_,S)=>{let N={top:0,bottom:$.h};for(let O=_.parentElement;O&&O!==Q&&O!==Z;O=O.parentElement){let L=W(O);if(L.overflowY!=="visible"&&L.overflowY!=="clip"){let m=O.getBoundingClientRect();N={top:m.top,bottom:m.bottom};break}}let b=_.getBoundingClientRect(),T=parseFloat(S.top),x=parseFloat(S.bottom);return!Number.isNaN(x)&&b.bottom>=N.bottom-x-1||!Number.isNaN(T)&&b.top<=N.top+T+1},v=(_)=>{let S=null,N=!1,b=1;for(let T=_;T&&T!==Q&&T!==Z;T=T.parentElement){let x=W(T),O=parseFloat(x.opacity);if(!Number.isNaN(O))b*=O;if(x.position==="fixed"||x.position==="sticky"&&g(T,x)){S=T;break}if(T!==_&&B(T))N=!0}if(!S&&C)N=!0;return{float:S,scrolled:N,opacity:b}},h=new Map;return J.map((_)=>{let S=new Set,N=new Set,b=[],T=(O)=>{if(N.has(O))return;N.add(O);let L=O.getBoundingClientRect();if(L.width>0&&L.height>0)b.push({top:L.top,bottom:L.bottom,left:L.left,right:L.right})},x=[_.left+6,(_.left+_.right)/2,_.right-6];for(let O=j/2;O<$.h;O+=j)for(let L of x){let m=document.elementsFromPoint(L,O).find((l)=>!b9.test(l.tagName));if(!m||m===Q||m===Z||S.has(m))continue;if(S.add(m),z.extra){let l=null;try{l=m.closest(z.extra)}catch{l=null}if(l){T(l);continue}}let{float:E,scrolled:$0,opacity:w}=h.get(m)??(h.set(m,v(m)),h.get(m));if(w<0.05)continue;let p=m.closest(u9),H0=p&&(!E||E.contains(p))?p:null;if(E&&!q(E.getBoundingClientRect())){let l=H0??m;if(!q(l.getBoundingClientRect()))T(l);continue}if($0||!H0||q(H0.getBoundingClientRect()))continue;T(H0)}return b})}var p9="lw-support-chat",d9="lw-support-frame",i9="lw-support-host",r=56,j1=12,c9='<svg viewBox="0 0 24 24" width="26" height="26" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/></svg>',l9=`
331
+ iframe.on { visibility: visible; }`,h=document.createElement("iframe"),h.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",h.title="สายจากทีมงาน",h.dataset.lwCallFrame=$,h.setAttribute("allowtransparency","true"),h.src=J,X.append(Z,h),document.body.append(D0),t0(),window.addEventListener("message",G8),window.addEventListener("resize",t0),e2(`lw-call:${$}`),a2=setTimeout(()=>{if(!N1)l2("timeout")},j)}function _1(){if(D0)e2(r2?.handle??null,r2?.readableBy);j2(),clearTimeout(a2),window.removeEventListener("message",G8),window.removeEventListener("resize",t0),Q2(!1),D0?.remove(),D0=null,h=null,y0=null,P1=null,J0=null,t2=null,a0={answer:!1,voice:!1}}function l2(J){let $=P1;_1(),$?.failed(J)}function G8(J){if(!h)return;let $=x9(J,{origin:Z2,window:h.contentWindow});if(!$)return;switch($.type){case"hello":t2?.then((z)=>{if(!h||y0===null)return;if(z)s0({type:"token",token:z});else l2("no_token")});return;case"ready":if(N1=!0,clearTimeout(a2),h.classList.add("on"),P1?.ready(),a0.answer)s0({type:"answer"});if(a0.voice)s0({type:"voice"});return;case"size":if(typeof $.width==="number"&&typeof $.height==="number")s2={width:$.width,height:$.height};if($.layout==="card"||$.layout==="full"){if($.layout==="full"&&F1==="card")k9();F1=$.layout}return t0();case"drag":return o2($);case"home":return E0=null,q8(),t0();case"done":{let z=P1;_1(),z?.done();return}case"failed":return l2($.reason??"failed");case"ink":{let z=J2($.op);if(z)z2(z);return}}}function e2(J,$=Z2){let z=typeof navigator>"u"?void 0:navigator.mediaDevices;try{z?.setCaptureHandleConfig?.(J&&$?{handle:J,exposeOrigin:!1,permittedOrigins:[$]}:{})}catch{}}var r2=null;function U8(J,$){if(r2={handle:J,readableBy:$},!D0?.isConnected)e2(J,$)}function o2(J){if(!h||F1!=="card"||typeof J.x!=="number"||typeof J.y!=="number")return;if(J.phase==="start"){let $=h.getBoundingClientRect();J0={sx:J.x,sy:J.y,x:$.left,y:$.top,lx:J.x,ly:J.y},Q2(!0);return}if(!J0)return;if(J0.lx=J.x,J0.ly=J.y,E0=K8({x:J0.x+(J.x-J0.sx),y:J0.y+(J.y-J0.sy)},D8(),X2()),t0(),J.phase==="end")J0=null,Q2(!1),q8()}var B1=null;function Q2(J){if(B1){for(let $ of["pointermove","pointerup","pointercancel"])window.removeEventListener($,B1,!0);B1=null}if(!J)return;B1=($)=>{if(!J0)return Q2(!1);if($.type==="pointermove"&&$.buttons!==0)return o2({type:"drag",phase:"move",x:$.screenX,y:$.screenY});let z=$.type==="pointerup";o2({type:"drag",phase:"end",x:z?$.screenX:J0.lx,y:z?$.screenY:J0.ly})};for(let $ of["pointermove","pointerup","pointercancel"])window.addEventListener($,B1,!0)}function k9(){if(!h?.contentWindow)return;let J=h.getBoundingClientRect();s0({type:"corner",x:Math.round(J.left),y:Math.round(J.top),width:Math.round(J.width)})}function q8(){try{if(E0)sessionStorage.setItem(c2,JSON.stringify(E0));else sessionStorage.removeItem(c2)}catch{}}var X2=()=>({w:window.innerWidth,h:window.innerHeight});function D8(){let J=X2();return{w:Math.min(n2,J.w-j0),h:Math.min(s2.height||0,J.h-j0)}}function t0(){if(!h)return;let J=h.style;if(F1==="full"){Object.assign(J,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let $=D8(),z=X2().w<480;if(J.width=z?`calc(100vw - ${j0}px)`:`${$.w}px`,J.height=`${$.h}px`,E0&&!z){let j=K8(E0,$,X2());Object.assign(J,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(J,{left:z?`${j0/2}px`:"",top:"",right:z?"":`${j0/2}px`,bottom:`calc(${j0/2}px + var(--lw-chat-lift, 0px))`})}var V2=[2000,5000,15000,30000,60000],H8=new Set(["ringing","active"]),f9=20000,M8=!1,J1=!1,B8=0,w9=5,J4=null,L8=0,$4,P8,F8,S8=(J)=>J.endsWith("/")?J:`${J}/`;function y9(J,$){let z=new URL("api/presence/ws",S8(J));return z.protocol=z.protocol==="https:"?"wss:":"ws:",z.searchParams.set("t",$),z.toString()}function g9(J){if(J.chatId||!J.ticketId)return`/me/chat?call=${J.id}`;return`/me/tickets/${J.ticketId}?call=${J.id}`}function v9(J){return J.status==="ringing"&&(J.side==="reporter"||J.side===void 0||J.side===null)}var z4=new Set;function R8(J){return z4.add(J),()=>z4.delete(J)}var N8=()=>N().ring!==!1;async function g0(){let J=N().identity;if(!J)return null;try{return await J()??null}catch{return null}}async function Z4(J,$){let z=N();return fetch(new URL(J,S8(z.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":z.realmKey,authorization:`Bearer ${$}`},body:"{}"})}function V4(){if(M8||typeof window>"u"||typeof WebSocket>"u")return;let J=N();if(!J.identity||J.ring===!1&&!J.chat)return;M8=!0,J1=!1,h9(J.host);try{U8(`lw-tab:${A8()}`,new URL(J.host).origin)}catch{}T8()}function C1(J=!1){if(J1)return;let $=J?V2[V2.length-1]:V2[Math.min(L8++,V2.length-1)];clearTimeout(P8),P8=setTimeout(()=>void T8(),$)}async function T8(){if(J1)return;let J=await g0();if(!J){if(++B8>=w9){J1=!0;return}return C1(!0)}B8=0;let $;try{$=await Z4(N().chat?"ingest/live-ticket?chat=1":"ingest/live-ticket",J)}catch{return C1()}if($.status===401||$.status===404||$.status===403){J1=!0;return}if(!$.ok)return C1($.status===429);let z;try{z=await $.json()}catch{return C1()}if(!z.ticket){J1=!0;return}if(z.calls&&z.call&&N8())O8(z.call);let j=new WebSocket(y9(N().host,z.ticket));J4=j,j.onopen=()=>{L8=0,j.send(JSON.stringify({type:"tab",id:A8()})),clearInterval($4),$4=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},f9)},j.onmessage=(Q)=>{try{let X=JSON.parse(String(Q.data));if(X.type==="chat-changed"||X.type==="ticket-changed"||X.type==="chat-seen"){for(let Z of z4)Z(X);return}if(X.type==="call-state"&&X.call&&typeof X.call==="object"){if(N8())O8(X.call)}else if(X.type==="call-ink"&&typeof X.call==="string"){let Z=J2(X.op);if(Z)X4=X.call,z2(Z)}}catch{}},j.onclose=()=>{if(clearInterval($4),J4===j)J4=null;C1()}}var j4="lw-call-framed";function m9(){try{return sessionStorage.getItem(j4)}catch{return null}}function W2(J){try{if(J)sessionStorage.setItem(j4,J);else sessionStorage.removeItem(j4)}catch{}}var _8=!1;function h9(J){if(_8||typeof document>"u")return;_8=!0;try{let $=new URL(J).origin;for(let z of["dns-prefetch","preconnect"]){let j=document.createElement("link");if(j.rel=z,j.href=$,z==="preconnect")j.crossOrigin="anonymous";j.dataset.debugReporter="true",document.head.append(j)}}catch{}}function C8(J){let $=N();if($.callFrame===!1||e0()===J.id)return;W2(J.id),Y8(Z8($.host,$.realmKey,null,J.id),J.id,{ready:()=>J8(J.id),done:()=>{W2(null),n0(J.id)},failed:()=>{W2(null),e6(J,Q4(J))}},15000,g0())}var Q4=(J)=>({open:()=>b9(J),decline:()=>void u9(J)}),x0=null;function A8(){if(x0)return x0;try{x0=sessionStorage.getItem(I8)}catch{}if(!x0||!/^[A-Za-z0-9_-]{8,40}$/.test(x0)){let J=new Uint8Array(12);crypto.getRandomValues(J),x0=Array.from(J,($)=>$.toString(16).padStart(2,"0")).join("");try{sessionStorage.setItem(I8,x0)}catch{}}return x0}var I8="lw-tab-id",X4=null;function O8(J){if(!H8.has(J.status)&&X4===J.id&&e0()!==J.id)X4=null,j2();if(!v9(J)){if(n0(J.id),J.status==="active"&&m9()===J.id&&!e0())C8(J);if(!H8.has(J.status)&&e0()===J.id)setTimeout(()=>{if(e0()===J.id)_1(),W2(null)},12000);return}if(N().callFrame===!1)t1(J,Q4(J),"portal");else t1(J,{...Q4(J),answer:()=>{t6(J.id),V8(J.id)},voice:()=>W8(J.id)},"frame"),C8(J);clearTimeout(F8);let $=new Date(J.ringUntil).getTime()-Date.now();F8=setTimeout(()=>{if($8()===J.id)n0(J.id)},Math.max(5000,$+5000))}function b9(J){let $=window.open("about:blank","_blank");(async()=>{let z=await g0();if(z)Z4(`ingest/calls/${J.id}/coming`,z).catch(()=>{return});let j;try{j=await r6(g9(J))}catch{$?.close();return}if($&&!$.closed){$.location.href=j;try{$.opener=null}catch{}e1()}else e1(j)})()}async function u9(J){n0(J.id);let $=await g0();if($)await Z4(`ingest/calls/${J.id}/decline`,$).catch(()=>{return})}function f8(J,$,z,j){let Q=[];for(let X of J){if(X.right<=$.left||X.left>=$.right||X.bottom<=X.top)continue;Q.push([z-X.bottom-8-j,z-X.top+8])}return Q.sort((X,Z)=>X[0]-Z[0])}function I1(J,$,z,j){if(j<z)return null;let Q=(Y)=>$.some(([U,C])=>Y>U&&Y<C),X=(Y)=>Math.min(Math.max(Y,z),j),Z=X(J);if(!Q(Z))return Z;let W=[z,j,...$.flatMap(([Y,U])=>[Y,U])].map(X).filter((Y)=>!Q(Y));if(!W.length)return null;return W.reduce((Y,U)=>{let C=Math.abs(U-Z),M=Math.abs(Y-Z);return C<M||C===M&&U>Y?U:Y})}function p9(J,$,z,j){let Q=J.side==="right"?"left":"right",X=I1(J.y,$[J.side],z,j),Z=I1(J.y,$[Q],z,j);if(X===null&&Z===null)return J;let W=X===null?1/0:Math.abs(X-J.y),Y=Z===null?1/0:160+Math.abs(Z-J.y);return W<=Y?{side:J.side,y:X}:{side:Q,y:Z}}var E8=(J,$)=>Math.abs(J.y-$.y)+(J.side===$.side?0:160);function w8(J,$,z,j,Q){let X=p9($,z,j,Q);if(J&&I1(J.y,z[J.side],j,Q)===J.y&&E8(J,$)<=E8(X,$)+48)return J;return X}function d9(J){if(typeof J!=="string"||!J.startsWith("/")||J.length>200)return null;let z=(J.length>1?J.replace(/\/+$/,""):"").split(/(\*\*|\*)/).map((j)=>j==="**"?".*":j==="*"?"[^/]*":j.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join("");try{return new RegExp(`^${z}(?:/.*)?$`)}catch{return null}}function y8(J,$){let z=null;for(let j of $??[]){let Q=d9(j.path);if(!Q||!Q.test(J))continue;if(!z||j.path.replace(/\*/g,"").length>z.path.replace(/\*/g,"").length)z=j}return z}var x8=/^LW-/,i9='a[href],button,input,select,textarea,summary,label,[role="button"],[role="link"],[role="tab"],[role="menuitem"],[role="checkbox"],[role="switch"],[role="radio"],[role="option"],[role="slider"],[role="combobox"],[role="textbox"],[contenteditable=""],[contenteditable="true"],[tabindex]:not([tabindex="-1"])',k8=/(auto|scroll|overlay)/;function g8(J,$,z={}){if(typeof document>"u"||typeof document.elementsFromPoint!=="function")return J.map(()=>[]);let j=z.step??16,Q=document.documentElement,X=document.body,Z=new Map,W=(B)=>Z.get(B)??(Z.set(B,getComputedStyle(B)),Z.get(B)),Y=$.w*$.h,U=(B)=>B.width*B.height>0.34*Y||B.width>=$.w*0.9&&B.height>=$.h*0.9,C=(B)=>{let F=W(B);return k8.test(F.overflowY)&&B.scrollHeight>B.clientHeight+1||k8.test(F.overflowX)&&B.scrollWidth>B.clientWidth+1},M=document.scrollingElement??Q,_=M.scrollHeight>M.clientHeight+1&&W(Q).overflowY!=="hidden"&&(!X||W(X).overflowY!=="hidden"),f=(B,F)=>{let w={top:0,bottom:$.h};for(let I=B.parentElement;I&&I!==Q&&I!==X;I=I.parentElement){let b=W(I);if(b.overflowY!=="visible"&&b.overflowY!=="clip"){let O=I.getBoundingClientRect();w={top:O.top,bottom:O.bottom};break}}let v=B.getBoundingClientRect(),L=parseFloat(F.top),g=parseFloat(F.bottom);return!Number.isNaN(g)&&v.bottom>=w.bottom-g-1||!Number.isNaN(L)&&v.top<=w.top+L+1},y=(B)=>{let F=null,w=!1,v=1;for(let L=B;L&&L!==Q&&L!==X;L=L.parentElement){let g=W(L),I=parseFloat(g.opacity);if(!Number.isNaN(I))v*=I;if(g.position==="fixed"||g.position==="sticky"&&f(L,g)){F=L;break}if(L!==B&&C(L))w=!0}if(!F&&_)w=!0;return{float:F,scrolled:w,opacity:v}},m=new Map,s=(B,F)=>{let w=document.elementFromPoint(B,F);if(!w||!x8.test(w.tagName))return w;return document.elementsFromPoint(B,F).find((v)=>!x8.test(v.tagName))??null};return J.map((B)=>{let F=new Set,w=new Set,v=[],L=(I)=>{if(w.has(I))return;w.add(I);let b=I.getBoundingClientRect();if(b.width>0&&b.height>0)v.push({top:b.top,bottom:b.bottom,left:b.left,right:b.right})},g=[B.left+6,(B.left+B.right)/2,B.right-6];for(let I=j/2;I<$.h;I+=j)for(let b of g){let O=s(b,I);if(!O||O===Q||O===X||F.has(O))continue;if(F.add(O),z.extra){let l=null;try{l=O.closest(z.extra)}catch{l=null}if(l){L(l);continue}}let{float:n,scrolled:x,opacity:c}=m.get(O)??(m.set(O,y(O)),m.get(O));if(c<0.05)continue;let C0=O.closest(i9),X0=C0&&(!n||n.contains(C0))?C0:null;if(n&&!U(n.getBoundingClientRect())){let l=X0??O;if(!U(l.getBoundingClientRect()))L(l);continue}if(x||!X0||U(X0.getBoundingClientRect()))continue;L(X0)}return v})}var c9="lw-support-chat",l9="lw-support-frame",r9="lw-support-host",i=56,z1=12,o9='<svg viewBox="0 0 24 24" width="26" height="26" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/></svg>',n9=`
332
332
  :host { all: initial; }
333
333
  .bubble {
334
- position: fixed; z-index: 2147483000; width: ${r}px; height: ${r}px; border-radius: 50%;
334
+ position: fixed; z-index: 2147483000; width: ${i}px; height: ${i}px; border-radius: 50%;
335
335
  display: grid; place-items: center; border: 0; cursor: pointer; padding: 0;
336
336
  background: var(--lw-chat-color, #00468f); color: #fff; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 4px 10px -4px rgba(0, 0, 0, 0.2);
337
337
  transition: transform 150ms ease, background 150ms ease;
@@ -362,7 +362,7 @@ iframe.on { visibility: visible; }`,u=document.createElement("iframe"),u.allow="
362
362
  content: ""; position: absolute; top: 50%; right: -4px; width: 10px; height: 10px; background: #fff; border-radius: 2px;
363
363
  transform: translateY(-50%) rotate(45deg); box-shadow: 1px -1px 0 rgba(0, 0, 0, 0.04);
364
364
  }
365
- .label .text { display: block; max-width: min(240px, calc(100vw - ${r+64}px)); overflow: hidden; text-overflow: ellipsis; }
365
+ .label .text { display: block; max-width: min(240px, calc(100vw - ${i+64}px)); overflow: hidden; text-overflow: ellipsis; }
366
366
  .at-left .label { right: auto; left: calc(100% + 12px); transform: translate(-4px, -50%); }
367
367
  .at-left .label::after { right: auto; left: -4px; }
368
368
  .new .label { color: var(--lw-chat-color, #00468f); }
@@ -370,7 +370,7 @@ iframe.on { visibility: visible; }`,u=document.createElement("iframe"),u.allow="
370
370
  @media (hover: hover) { .bubble:hover .label { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(0, -50%); } }
371
371
  .unlabelled .label, .bubble.dragging .label, .open .label { display: none; }
372
372
  .panel {
373
- position: fixed; z-index: 2147483001; width: min(380px, calc(100vw - 32px)); height: min(640px, calc(100vh - ${r+j1+32}px));
373
+ position: fixed; z-index: 2147483001; width: min(380px, calc(100vw - 32px)); height: min(640px, calc(100vh - ${i+z1+32}px));
374
374
  border-radius: 20px; overflow: hidden; background: #fff; border: 1px solid rgba(15, 23, 42, 0.08);
375
375
  box-shadow: 0 28px 64px -16px rgba(15, 23, 42, 0.3), 0 10px 24px -10px rgba(15, 23, 42, 0.14);
376
376
  animation: in 180ms cubic-bezier(0.16, 1, 0.3, 1);
@@ -383,4 +383,4 @@ iframe.on { visibility: visible; }`,u=document.createElement("iframe"),u.allow="
383
383
  .open .bubble { display: none; }
384
384
  }
385
385
  @media (prefers-reduced-motion: reduce) { .panel { animation: none; } .bubble, .label { transition: none; } }
386
- `,c=null,V0=null,J0=null,U0=null,A=null,q2=null,Y4=null,W0=!1,z1=0,P2=(J)=>J.endsWith("/")?J:`${J}/`,r9=()=>{try{return new URL(P().host).origin}catch{return"*"}};function o9(J,$){let z=new URL("embed/support",P2(J));return z.searchParams.set("realm",$),z.searchParams.set("hand","1"),z.toString()}function n9(J){return/^\/me\/(?:chat|tickets(?:\/[\w-]{1,64})?)$/.test(J)?J:"/me/chat"}function G4(J){return new URL("support-face.webp",P2(J)).toString()}function s9(J){return J+r+j1-16}var e=8,a9=200;function t9(J,$,z,j){return{side:J<z.w/2?"left":"right",x:j,y:p8(z.h-$-r/2,z.h)}}function p8(J,$){return Math.round(Math.min(Math.max(J,e),Math.max(e,$-r-e)))}function e9(J){return J.side==="right"&&J.y<a9?s9(J.y):0}function J7(J,$){let z=$-(J.y+r+j1)-16,j=J.y-j1-16;if(z>=420||z>=j)return{bottom:J.y+r+j1,height:Math.max(240,Math.min(640,z))};return{top:$-J.y+j1,height:Math.max(240,Math.min(640,j))}}function d8(J,$,z){return{x:Math.round(Math.min(Math.max(J.x,e),Math.max(e,z.w-$.w-e))),y:Math.round(Math.min(Math.max(J.y,e),Math.max(e,z.h-$.h-e)))}}function $7(J){return J<=0?"":J>99?"99+":String(J)}function i8(J){if(z1=Math.max(0,Math.floor(J)||0),!q2||!A)return;let $=a(P().locale);q2.textContent=$7(z1),q2.hidden=z1===0,A.setAttribute("aria-label",z1?`${$.chatOpen} · ${$.chatUnread.replace("{n}",String(z1))}`:$.chatOpen),T1()}function z7(J,$){if(J.own===!1)return null;let z=J.unread>0,j=typeof J.own==="string"?J.own.trim().slice(0,60):"";return{text:z?$.chatLabelNew:j||$.chatLabel,shown:!J.open&&(z||!J.opened),isNew:z}}var S1=!1;function T1(){if(!Y4||!A)return;let J=P(),$=J.chat&&J.chat!==!0?J.chat.label:void 0,z=$!==void 0?$:x1?.label,j=z7({own:z,unread:z1,opened:S1,open:W0},a(J.locale));A.classList.toggle("unlabelled",!j),A.classList.toggle("labelled",!!j?.shown),A.classList.toggle("new",!!j?.isNew),A.classList.toggle("at-left",(v0??D0).side==="left"),Y4.querySelector(".text").textContent=j?.text??""}var x1=null;function c8(J,$){if(!$||$.faceUrl===void 0)return G4(J);if($.faceUrl===null)return null;try{return new URL($.faceUrl.replace(/^\//,""),P2(J)).toString()}catch{return G4(J)}}function j7(J){if(x1=J,!c||!A)return;let $=J?.color&&/^#[0-9a-f]{6}$/i.test(J.color)?J.color:null;if($)c.style.setProperty("--lw-chat-color",$);else c.style.removeProperty("--lw-chat-color");let z=V0?.querySelector(".face"),j=c8(P().host,J);if(E0(!0),z){if(!j)A.classList.remove("has-face"),z.removeAttribute("src");else if(z.getAttribute("src")!==j)A.classList.remove("has-face"),z.src=j}T1()}var C1=null;async function U2(){if(C1)return C1;let J=Q7();C1=J;try{await J}finally{if(C1===J)C1=null}}async function Q7(){try{let J=P(),$=J.chat&&J.chat!==!0?J.chat:null;if($?.show&&!$.show())return void K2(!1);let z=await y0();if(!z)return void K2(!1);let j=await fetch(new URL("ingest/support-unread",P2(J.host)).toString(),{headers:{"x-realm-key":J.realmKey,authorization:`Bearer ${z}`}});if(j.status===404||j.status===401||j.status===403)return void K2(!1);if(!j.ok)return;let Q=await j.json();if(Q.look&&typeof Q.look==="object")j7(Q.look);if(K2(!0),!W0)i8(typeof Q.total==="number"?Q.total:0)}catch{}}function K2(J){if(!c)return;if(c.style.display=J?"":"none",J)n1(c);if(N0(),J)E0(!0)}var D0={side:"right",x:16,y:16},m0=null,Z7=380,l8=()=>`lw-support-chat-place:${P().realmKey}`,R1=()=>({w:window.innerWidth,h:window.innerHeight}),A1=!1;function X7(){let J=E1(P().chat);if(J)D0={side:J.side,x:J.x,y:J.y};try{let $=JSON.parse(localStorage.getItem(l8())??"null"),z=$?.bubble;if(A1=!!z&&(z.side==="left"||z.side==="right")&&typeof z.y==="number"&&Number.isFinite(z.y),A1)D0={...D0,side:z.side,y:z.y};let j=$?.panel;m0=j&&typeof j.x==="number"&&typeof j.y==="number"&&Number.isFinite(j.x)&&Number.isFinite(j.y)?{x:j.x,y:j.y,h:typeof j.h==="number"&&j.h>=240?j.h:640}:null,S1=$?.opened===!0}catch{}}function H4(){try{localStorage.setItem(l8(),JSON.stringify({...A1?{bubble:{side:D0.side,y:D0.y}}:{},panel:m0,...S1?{opened:!0}:{}}))}catch{}}var L1=()=>window.location?.pathname??"/",v0=null,f8="",g0=null,r8=!1;function M4(){let J=P().chat,$=J&&J!==!0?J.avoid:void 0;if($===!1||x1?.avoid===!1)return{on:!1,extra:null};return{on:!0,extra:typeof $==="string"&&$.trim()?$.trim():null}}function V7(){let J=E8(L1(),x1?.places);if(r8=J?.show==="hide",A1||!J||J.show==="hide")return D0;return{side:J.show,x:D0.x,y:J.y}}function o8(){if(!A)return;let{on:J,extra:$}=M4();if(!J)return g0=null,N0();let z=R1(),j=D0.x,Q={left:z.w-j-r,right:z.w-j},Z={left:j,right:j+r},[X=[],W=[]]=k8([Q,Z],z,{extra:$}),Y=W4(X,Q,z.h,r),q=W4(W,Z,z.h,r);D2=JSON.stringify([Y,q])===JSON.stringify(g0&&[g0.right,g0.left])?Math.min(D2+1,K7):0,g0={right:Y,left:q},N0()}var W7=400,K7=3,w8=60,$1,y8=0,v8=0,D2=0;function E0(J=!1){if(!c)return;let $=Date.now();if(J){if(D2=0,$1&&y8-$<=w8)return;clearTimeout($1),$1=void 0}if($1)return;let z=J?w8:Math.max(0,W7*2**D2-($-v8));y8=$+z,$1=setTimeout(()=>{if($1=void 0,!c||W0||Q0?.moved||typeof document<"u"&&document.hidden)return;v8=Date.now(),o8()},z)}var Y2=null,K4="",g8,m8=()=>E0(),G2=()=>E0(!0),h8=["popstate","hashchange","pointerup","keyup"];function Y7(J){Y2?.disconnect(),Y2=null,clearInterval(g8);for(let $ of h8)window.removeEventListener($,G2,!0);for(let $ of["scroll","transitionend","animationend"])window.removeEventListener($,m8,!0);if(document.removeEventListener("visibilitychange",G2),!J)return;if(typeof MutationObserver<"u")Y2=new MutationObserver(($)=>{if($.some((j)=>{let Q=j.target;if(Q===document.documentElement&&j.type==="attributes")return!1;return!(Q.nodeType===1&&/^LW-/.test(Q.tagName))&&Q!==c}))E0()}),Y2.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","open","aria-expanded"]});for(let $ of h8)window.addEventListener($,G2,{capture:!0,passive:!0});for(let $ of["scroll","transitionend","animationend"])window.addEventListener($,m8,{capture:!0,passive:!0});document.addEventListener("visibilitychange",G2),K4=L1(),g8=setInterval(()=>{if(L1()===K4)return;K4=L1(),N0(),E0(!0)},1000)}function N0(){if(!A||!J0)return;let J=R1(),$=V7(),z=p8($.y,J.h),j=`${L1()}|${$.side}|${$.x}|${z}`,Q=v0&&f8===j?v0:null,Z=!W0||!v0?g0&&M4().on?x8(Q,{side:$.side,y:z},g0,e,Math.max(e,J.h-r-e)):{side:$.side,y:z}:v0;v0={side:Z.side,x:$.x,y:Z.y},f8=j;let X=v0,W=X.y,Y=X.side==="right"?"left":"right";if(A.style.display=r8&&!W0?"none":"",Object.assign(A.style,{[X.side]:`${X.x}px`,[Y]:"",bottom:`${W}px`,top:""}),m0){let B={w:Math.min(Z7,J.w-32),h:Math.min(m0.h,J.h-2*e)},F=d8(m0,B,J);Object.assign(J0.style,{left:`${F.x}px`,top:`${F.y}px`,right:"",bottom:"",height:`${B.h}px`})}else{let B=J7(X,J.h);Object.assign(J0.style,{[X.side]:`${X.x}px`,[Y]:"",bottom:B.bottom!==void 0?`${B.bottom}px`:"",top:B.top!==void 0?`${B.top}px`:"",height:`${B.height}px`})}let q=c&&c.style.display!=="none"&&A.style.display!=="none"?e9(X):0;if(q)document.documentElement.style.setProperty("--lw-chat-lift",`${q}px`);else document.documentElement.style.removeProperty("--lw-chat-lift");T1()}var Q0=null,q4=!1;function G7(J){if(J.button!==0)return;Q0={id:J.pointerId,sx:J.clientX,sy:J.clientY,moved:!1};try{A?.setPointerCapture(J.pointerId)}catch{}}function q7(J){if(!Q0||J.pointerId!==Q0.id||!A)return;if(!Q0.moved&&Math.hypot(J.clientX-Q0.sx,J.clientY-Q0.sy)<6)return;Q0.moved=!0,A.classList.add("dragging"),Object.assign(A.style,{left:`${J.clientX-r/2}px`,top:`${J.clientY-r/2}px`,right:"",bottom:""})}function b8(J){if(!Q0||J.pointerId!==Q0.id)return;let $=Q0;if(Q0=null,A?.classList.remove("dragging"),!$.moved)return;if(q4=!0,setTimeout(()=>q4=!1,0),J.type==="pointerup")D0=t9(J.clientX,J.clientY,R1(),E1(P().chat)?.x??16),A1=!0,m0=null,H4();if(M4().on)o8();else N0()}var s=null;function U4(J){if(!J0||typeof J.x!=="number"||typeof J.y!=="number"||R1().w<640)return;if(J.phase==="start"){let $=J0.getBoundingClientRect();s={sx:J.x,sy:J.y,x:$.left,y:$.top,lx:J.x,ly:J.y,h:Math.round($.height)||640},D4(!0);return}if(!s)return;if(s.lx=J.x,s.ly=J.y,m0={...d8({x:s.x+(J.x-s.sx),y:s.y+(J.y-s.sy)},{w:J0.offsetWidth,h:s.h},R1()),h:s.h},N0(),J.phase==="end")s=null,D4(!1),H4()}var O1=null;function D4(J){if(O1){for(let $ of["pointermove","pointerup","pointercancel"])window.removeEventListener($,O1,!0);O1=null}if(!J)return;O1=($)=>{if(!s)return D4(!1);if($.type==="pointermove"&&$.buttons!==0)return U4({phase:"move",x:$.screenX,y:$.screenY});let z=$.type==="pointerup";U4({phase:"end",x:z?$.screenX:s.lx,y:z?$.screenY:s.ly})};for(let $ of["pointermove","pointerup","pointercancel"])window.addEventListener($,O1,!0)}var U7=()=>{N0(),E0(!0)};function H2(J){U0?.contentWindow?.postMessage({source:i9,...J},r9())}async function D7(J){if(!U0||J.source!==U0.contentWindow)return;let $=J.data;if(!$||$.source!==d9)return;if($.type==="hello"){let z=await y0();if(z)H2({type:"token",token:z,can:["portal"]});return}if($.type==="portal"){r6({returnTo:n9(typeof $.path==="string"?$.path:"")});return}if($.type==="ready")return H2({type:W0?"shown":"hidden"});if($.type==="close")return M2();if($.type==="drag")return U4($);if($.type==="unread"&&typeof $.total==="number")return i8($.total);if($.type==="report")M2(!1),d0({type:"manual",fromChat:!0})}var H7=(J)=>void D7(J);function M7(J){if(W0&&J.key==="Escape")M2()}function P4(){if(!c||!J0||!V0)B2();if(!J0)return;let J=P();if(!U0)U0=document.createElement("iframe"),U0.src=o9(J.host,J.realmKey),U0.title=a(J.locale).chatTitle,U0.setAttribute("allow","clipboard-write"),J0.append(U0);if(W0=!0,!S1)S1=!0,H4();J0.hidden=!1,V0?.querySelector(".wrap")?.classList.add("open"),A?.setAttribute("aria-expanded","true"),T1(),H2({type:"shown"}),U0.focus()}function M2(J=!0){if(!J0)return;if(W0=!1,J0.hidden=!0,V0?.querySelector(".wrap")?.classList.remove("open"),A?.setAttribute("aria-expanded","false"),T1(),H2({type:"hidden"}),J)A?.focus();U2(),N0(),E0(!0)}var P7=null,u8=0;function B7(){if(Date.now()-u8<30000)return;u8=Date.now(),U2()}function B2(){if(c||typeof document>"u")return;let J=P();if(!E1(J.chat)||!J.identity)return;let z=a(J.locale);c=document.createElement(p9),c.style.display="none",V0=c.attachShadow({mode:"open"}),V0.innerHTML=`<style>${l9}</style><div class="wrap"><div class="panel" role="dialog" aria-label="${z.chatTitle}" hidden></div><button type="button" class="bubble" aria-expanded="false" aria-haspopup="dialog" aria-label="${z.chatOpen}" title="${z.chatMove}">${c9}<img class="face" alt="" draggable="false" decoding="async"><span class="badge" hidden></span><span class="label" aria-hidden="true"><span class="text"></span></span></button></div>`,J0=V0.querySelector(".panel"),A=V0.querySelector(".bubble"),q2=V0.querySelector(".badge"),Y4=V0.querySelector(".label");let j=V0.querySelector(".face");j.addEventListener("load",()=>{if(j.getAttribute("src"))A?.classList.add("has-face")}),j.addEventListener("error",()=>A?.classList.remove("has-face")),j.src=c8(J.host,x1)??G4(J.host),X7(),N0(),A.addEventListener("click",()=>{if(q4)return;if(W0)M2();else P4()}),A.addEventListener("pointerdown",G7),A.addEventListener("pointermove",q7),A.addEventListener("pointerup",b8),A.addEventListener("pointercancel",b8),document.body.append(c),window.addEventListener("message",H7),document.addEventListener("keydown",M7),window.addEventListener("focus",B7),window.addEventListener("resize",U7),Y7(!0);let Q;P7=S8(()=>{if(W0)return;clearTimeout(Q),Q=setTimeout(()=>void U2(),500)}),U2()}var n8=!1;function B4(J={}){if(n8||typeof window>"u")return;if(!k1()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(n8=!0,V6(),b4(),w4(),t4(),q6(),J.ui===!1)return;let $=a(P().locale);if(r4((j)=>{i0(j.message??$.crashed,"error",{label:$.crashAction,onClick:()=>d0(j)})}),p6(),!document.querySelector(D1))document.body.append(document.createElement(D1));let z=window.requestIdleCallback;if(z)z(()=>void c0(),{timeout:5000});else setTimeout(()=>void c0(),2000);if(z)z(()=>X4(),{timeout:8000});else setTimeout(()=>X4(),3000);if(P().chat)if(!P().identity)console.warn("[debug-capture] `chat` needs `identity` — a chat is a signed-in person's; the bubble is not shown");else if(z)z(()=>B2(),{timeout:4000});else setTimeout(()=>B2(),1500)}var s8=document.currentScript,o=s8?.dataset??{},F7="rrweb-record.mjs";G6(()=>import(new URL(F7,s8?.src??location.href).href));function N7(J){if(!J)return{};try{let $=JSON.parse(J);if(!$||typeof $!=="object"||Array.isArray($))return{};return Object.fromEntries(Object.entries($).filter(([,z])=>typeof z==="string"&&z.trim()))}catch{return{}}}if(o.host&&o.realmKey)if(N4({host:o.host,realmKey:o.realmKey,app:{name:o.appName??document.title??"app",version:o.appVersion??"0.0.0",environment:o.environment??"production"},module:C4(N7(o.modules)),locale:o.locale==="en"?"en":"th",...o.replay!==void 0?{replay:{seconds:Number(o.replay)||void 0}}:{},...o.identityUrl?{identity:()=>fetch(o.identityUrl,{credentials:"include"}).then((J)=>J.ok?J.text():null).catch(()=>null)}:{},...o.chat!==void 0&&o.chat!=="false"?{chat:o.chat==="left"?{position:"left"}:!0}:{}}),document.body)B4();else document.addEventListener("DOMContentLoaded",()=>B4(),{once:!0});window.lwReportProblem=d0;window.lwOpenSupportChat=P4;})();
386
+ `,d=null,W0=null,$0=null,H0=null,T=null,q2=null,K4=null,Y0=!1,$1=0,P2=(J)=>J.endsWith("/")?J:`${J}/`,s9=()=>{try{return new URL(N().host).origin}catch{return"*"}};function a9(J,$){let z=new URL("embed/support",P2(J));return z.searchParams.set("realm",$),z.searchParams.set("hand","1"),z.toString()}function t9(J){return/^\/me\/(?:chat|tickets(?:\/[\w-]{1,64})?)$/.test(J)?J:"/me/chat"}function Y4(J){return new URL("support-face.webp",P2(J)).toString()}function e9(J){return J+i+z1-16}var r=8,J7=200;function $7(J,$,z,j){return{side:J<z.w/2?"left":"right",x:j,y:D4(z.h-$-i/2,z.h)}}function D4(J,$){return Math.round(Math.min(Math.max(J,r),Math.max(r,$-i-r)))}function z7(J){return J.side==="right"&&J.y<J7?e9(J.y):0}function j7(J,$){let z=$-(J.y+i+z1)-16,j=J.y-z1-16;if(z>=420||z>=j)return{bottom:J.y+i+z1,height:Math.max(240,Math.min(640,z))};return{top:$-J.y+z1,height:Math.max(240,Math.min(640,j))}}function l8(J,$,z){return{x:Math.round(Math.min(Math.max(J.x,r),Math.max(r,z.w-$.w-r))),y:Math.round(Math.min(Math.max(J.y,r),Math.max(r,z.h-$.h-r)))}}function Q7(J){return J<=0?"":J>99?"99+":String(J)}function r8(J){if($1=Math.max(0,Math.floor(J)||0),!q2||!T)return;let $=e(N().locale);q2.textContent=Q7($1),q2.hidden=$1===0,T.setAttribute("aria-label",$1?`${$.chatOpen} · ${$.chatUnread.replace("{n}",String($1))}`:$.chatOpen),A1()}function X7(J,$){if(J.own===!1)return null;let z=J.unread>0,j=typeof J.own==="string"?J.own.trim().slice(0,60):"";return{text:z?$.chatLabelNew:j||$.chatLabel,shown:!J.open&&(z||!J.opened),isNew:z}}var R1=!1;function A1(){if(!K4||!T)return;let J=N(),$=J.chat&&J.chat!==!0?J.chat.label:void 0,z=$!==void 0?$:E1?.label,j=X7({own:z,unread:$1,opened:R1,open:Y0},e(J.locale));T.classList.toggle("unlabelled",!j),T.classList.toggle("labelled",!!j?.shown),T.classList.toggle("new",!!j?.isNew),T.classList.toggle("at-left",(v0??K0).side==="left"),K4.querySelector(".text").textContent=j?.text??""}var E1=null;function o8(J,$){if(!$||$.faceUrl===void 0)return Y4(J);if($.faceUrl===null)return null;try{return new URL($.faceUrl.replace(/^\//,""),P2(J)).toString()}catch{return Y4(J)}}function Z7(J){if(E1=J,!d||!T)return;let $=J?.color&&/^#[0-9a-f]{6}$/i.test(J.color)?J.color:null;if($)d.style.setProperty("--lw-chat-color",$);else d.style.removeProperty("--lw-chat-color");let z=W0?.querySelector(".face"),j=o8(N().host,J);if(N0("now"),z){if(!j)T.classList.remove("has-face"),z.removeAttribute("src");else if(z.getAttribute("src")!==j)T.classList.remove("has-face"),z.src=j}A1()}var O1=null;async function D2(){if(O1)return O1;let J=V7();O1=J;try{await J}finally{if(O1===J)O1=null}}async function V7(){try{let J=N(),$=J.chat&&J.chat!==!0?J.chat:null;if($?.show&&!$.show())return void K2(!1);let z=await g0();if(!z)return void K2(!1);let j=await fetch(new URL("ingest/support-unread",P2(J.host)).toString(),{headers:{"x-realm-key":J.realmKey,authorization:`Bearer ${z}`}});if(j.status===404||j.status===401||j.status===403)return void K2(!1);if(!j.ok)return;let Q=await j.json();if(Q.look&&typeof Q.look==="object")Z7(Q.look);if(K2(!0),!Y0)r8(typeof Q.total==="number"?Q.total:0)}catch{}}function K2(J){if(!d)return;if(d.style.display=J?"":"none",J)n1(d);if(_0(),J)N0("now")}var K0={side:"right",x:16,y:16},m0=null,W7=380,n8=()=>`lw-support-chat-place:${N().realmKey}`,j1=()=>({w:window.innerWidth,h:window.innerHeight}),T1=!1;function K7(){let J=x1(N().chat);if(J)K0={side:J.side,x:J.x,y:J.y};try{let $=JSON.parse(localStorage.getItem(n8())??"null"),z=$?.bubble;if(T1=!!z&&(z.side==="left"||z.side==="right")&&typeof z.y==="number"&&Number.isFinite(z.y),T1)K0={...K0,side:z.side,y:z.y};let j=$?.panel;m0=j&&typeof j.x==="number"&&typeof j.y==="number"&&Number.isFinite(j.x)&&Number.isFinite(j.y)?{x:j.x,y:j.y,h:typeof j.h==="number"&&j.h>=240?j.h:640}:null,R1=$?.opened===!0}catch{}}function H4(){try{localStorage.setItem(n8(),JSON.stringify({...T1?{bubble:{side:K0.side,y:K0.y}}:{},panel:m0,...R1?{opened:!0}:{}}))}catch{}}var S1=()=>window.location?.pathname??"/",v0=null,v8="",k0=null,s8=!1;function M4(){let J=N().chat,$=J&&J!==!0?J.avoid:void 0;if($===!1||E1?.avoid===!1)return{on:!1,extra:null};return{on:!0,extra:typeof $==="string"&&$.trim()?$.trim():null}}function a8(){let J=y8(S1(),E1?.places);if(s8=J?.show==="hide",T1||!J||J.show==="hide")return K0;return{side:J.show,x:K0.x,y:J.y}}function t8(){if(!T)return;let{on:J,extra:$}=M4();if(!J)return k0=null,_0();let z=j1(),j=K0.x,Q={right:{left:z.w-j-i,right:z.w-j},left:{left:j,right:j+i}},X=(_)=>f8(g8([Q[_]],z,{extra:$})[0]??[],Q[_],z.h,i),Z=a8(),W=D4(Z.y,z.h),Y=Z.side==="right"?"left":"right",U=X(Z.side),C=I1(W,U,r,Math.max(r,z.h-i-r))===W?null:X(Y),M={[Z.side]:U,[Y]:C};H2=JSON.stringify([M.right,M.left])===JSON.stringify(k0&&[k0.right,k0.left])?Math.min(H2+1,G7):0,k0=M,_0()}var Y7=400,G7=3,U7=60,Y2,m8=0,h8=0,H2=0;function N0(J="later"){if(!d)return;let $=Date.now();if(J!=="later")H2=0;let z=J==="now"?U7:Math.max(0,Y7*2**H2-($-h8));if(Y2&&m8<=$+z)return;clearTimeout(Y2),m8=$+z,Y2=setTimeout(()=>{if(Y2=void 0,!d||Y0||Q0?.moved||typeof document<"u"&&document.hidden)return;h8=Date.now(),t8()},z)}var G2=null,W4="",b8,B4=(J)=>J instanceof Element&&(J===d||/^LW-/.test(J.tagName)),u8=(J)=>{if(!B4(J.target))N0()},p8=(J)=>{if(B4(J.target))return;let $=J.target instanceof Element?J.target.getBoundingClientRect():null,z=j1(),j=K0.x,Q=!!$&&$.width>0&&($.left<j+i||$.right>z.w-j-i);N0(Q?"soon":"later")},U2=(J)=>{if(!B4(J.target))N0("now")},d8=["popstate","hashchange","pointerup","keyup"];function q7(J){G2?.disconnect(),G2=null,clearInterval(b8);for(let $ of d8)window.removeEventListener($,U2,!0);window.removeEventListener("scroll",u8,!0);for(let $ of["transitionend","animationend"])window.removeEventListener($,p8,!0);if(document.removeEventListener("visibilitychange",U2),!J)return;if(typeof MutationObserver<"u")G2=new MutationObserver(($)=>{if($.some((j)=>{let Q=j.target;if(Q===document.documentElement&&j.type==="attributes")return!1;return!(Q.nodeType===1&&/^LW-/.test(Q.tagName))&&Q!==d}))N0()}),G2.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","open","aria-expanded"]});for(let $ of d8)window.addEventListener($,U2,{capture:!0,passive:!0});window.addEventListener("scroll",u8,{capture:!0,passive:!0});for(let $ of["transitionend","animationend"])window.addEventListener($,p8,{capture:!0,passive:!0});document.addEventListener("visibilitychange",U2),W4=S1(),b8=setInterval(()=>{if(S1()===W4)return;W4=S1(),_0(),N0("now")},1000)}function _0(){if(!T||!$0)return;let J=j1(),$=a8(),z=D4($.y,J.h),j=`${S1()}|${$.side}|${$.x}|${z}`,Q=v0&&v8===j?v0:null,X=k0&&M4().on?{right:k0.right??[],left:k0.left??[]}:null,Z=!Y0||!v0?X?w8(Q,{side:$.side,y:z},X,r,Math.max(r,J.h-i-r)):{side:$.side,y:z}:v0;v0={side:Z.side,x:$.x,y:Z.y},v8=j;let W=v0,Y=W.y,U=W.side==="right"?"left":"right";if(T.style.display=s8&&!Y0?"none":"",Object.assign(T.style,{[W.side]:`${W.x}px`,[U]:"",bottom:`${Y}px`,top:""}),m0){let _={w:Math.min(W7,J.w-32),h:Math.min(m0.h,J.h-2*r)},f=l8(m0,_,J);Object.assign($0.style,{left:`${f.x}px`,top:`${f.y}px`,right:"",bottom:"",height:`${_.h}px`})}else{let _=j7(W,J.h);Object.assign($0.style,{[W.side]:`${W.x}px`,[U]:"",bottom:_.bottom!==void 0?`${_.bottom}px`:"",top:_.top!==void 0?`${_.top}px`:"",height:`${_.height}px`})}let C=d&&d.style.display!=="none"&&T.style.display!=="none"?z7(W):0,M=C?`${C}px`:"";if(document.documentElement.style.getPropertyValue("--lw-chat-lift")!==M)if(M)document.documentElement.style.setProperty("--lw-chat-lift",M);else document.documentElement.style.removeProperty("--lw-chat-lift");A1()}var Q0=null,G4=!1;function D7(J){if(J.button!==0)return;Q0={id:J.pointerId,sx:J.clientX,sy:J.clientY,moved:!1};try{T?.setPointerCapture(J.pointerId)}catch{}}function H7(J){if(!Q0||J.pointerId!==Q0.id||!T)return;if(!Q0.moved&&Math.hypot(J.clientX-Q0.sx,J.clientY-Q0.sy)<6)return;Q0.moved=!0,T.classList.add("dragging"),Object.assign(T.style,{left:`${J.clientX-i/2}px`,top:`${J.clientY-i/2}px`,right:"",bottom:""})}function i8(J){if(!Q0||J.pointerId!==Q0.id)return;let $=Q0;if(Q0=null,T?.classList.remove("dragging"),!$.moved)return;if(G4=!0,setTimeout(()=>G4=!1,0),J.type==="pointerup")K0=$7(J.clientX,J.clientY,j1(),x1(N().chat)?.x??16),T1=!0,m0=null,H4();if(M4().on)t8();else _0()}var t=null;function U4(J){if(!$0||typeof J.x!=="number"||typeof J.y!=="number"||j1().w<640)return;if(J.phase==="start"){let $=$0.getBoundingClientRect();t={sx:J.x,sy:J.y,x:$.left,y:$.top,lx:J.x,ly:J.y,h:Math.round($.height)||640},q4(!0);return}if(!t)return;if(t.lx=J.x,t.ly=J.y,m0={...l8({x:t.x+(J.x-t.sx),y:t.y+(J.y-t.sy)},{w:$0.offsetWidth,h:t.h},j1()),h:t.h},_0(),J.phase==="end")t=null,q4(!1),H4()}var L1=null;function q4(J){if(L1){for(let $ of["pointermove","pointerup","pointercancel"])window.removeEventListener($,L1,!0);L1=null}if(!J)return;L1=($)=>{if(!t)return q4(!1);if($.type==="pointermove"&&$.buttons!==0)return U4({phase:"move",x:$.screenX,y:$.screenY});let z=$.type==="pointerup";U4({phase:"end",x:z?$.screenX:t.lx,y:z?$.screenY:t.ly})};for(let $ of["pointermove","pointerup","pointercancel"])window.addEventListener($,L1,!0)}var M7=()=>{_0(),N0("now")};function M2(J){H0?.contentWindow?.postMessage({source:r9,...J},s9())}async function B7(J){if(!H0||J.source!==H0.contentWindow)return;let $=J.data;if(!$||$.source!==l9)return;if($.type==="hello"){let z=await g0();if(z)M2({type:"token",token:z,can:["portal"]});return}if($.type==="portal"){o6({returnTo:t9(typeof $.path==="string"?$.path:"")});return}if($.type==="ready")return M2({type:Y0?"shown":"hidden"});if($.type==="close")return B2();if($.type==="drag")return U4($);if($.type==="unread"&&typeof $.total==="number")return r8($.total);if($.type==="report")B2(!1),d0({type:"manual",fromChat:!0})}var P7=(J)=>void B7(J);function F7(J){if(Y0&&J.key==="Escape")B2()}function P4(){if(!d||!$0||!W0)F2();if(!$0)return;let J=N();if(!H0)H0=document.createElement("iframe"),H0.src=a9(J.host,J.realmKey),H0.title=e(J.locale).chatTitle,H0.setAttribute("allow","clipboard-write"),$0.append(H0);if(Y0=!0,!R1)R1=!0,H4();$0.hidden=!1,W0?.querySelector(".wrap")?.classList.add("open"),T?.setAttribute("aria-expanded","true"),A1(),M2({type:"shown"}),H0.focus()}function B2(J=!0){if(!$0)return;if(Y0=!1,$0.hidden=!0,W0?.querySelector(".wrap")?.classList.remove("open"),T?.setAttribute("aria-expanded","false"),A1(),M2({type:"hidden"}),J)T?.focus();D2(),_0(),N0("now")}var N7=null,c8=0;function _7(){if(Date.now()-c8<30000)return;c8=Date.now(),D2()}function F2(){if(d||typeof document>"u")return;let J=N();if(!x1(J.chat)||!J.identity)return;let z=e(J.locale);d=document.createElement(c9),d.style.display="none",W0=d.attachShadow({mode:"open"}),W0.innerHTML=`<style>${n9}</style><div class="wrap"><div class="panel" role="dialog" aria-label="${z.chatTitle}" hidden></div><button type="button" class="bubble" aria-expanded="false" aria-haspopup="dialog" aria-label="${z.chatOpen}" title="${z.chatMove}">${o9}<img class="face" alt="" draggable="false" decoding="async"><span class="badge" hidden></span><span class="label" aria-hidden="true"><span class="text"></span></span></button></div>`,$0=W0.querySelector(".panel"),T=W0.querySelector(".bubble"),q2=W0.querySelector(".badge"),K4=W0.querySelector(".label");let j=W0.querySelector(".face");j.addEventListener("load",()=>{if(j.getAttribute("src"))T?.classList.add("has-face")}),j.addEventListener("error",()=>T?.classList.remove("has-face")),j.src=o8(J.host,E1)??Y4(J.host),K7(),_0(),T.addEventListener("click",()=>{if(G4)return;if(Y0)B2();else P4()}),T.addEventListener("pointerdown",D7),T.addEventListener("pointermove",H7),T.addEventListener("pointerup",i8),T.addEventListener("pointercancel",i8),document.body.append(d),window.addEventListener("message",P7),document.addEventListener("keydown",F7),window.addEventListener("focus",_7),window.addEventListener("resize",M7),q7(!0);let Q;N7=R8(()=>{if(Y0)return;clearTimeout(Q),Q=setTimeout(()=>void D2(),500)}),D2()}var e8=!1;function F4(J={}){if(e8||typeof window>"u")return;if(!k1()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(e8=!0,W6(),u4(),y4(),e4(),q6(),J.ui===!1)return;let $=e(N().locale);if(o4((j)=>{i0(j.message??$.crashed,"error",{label:$.crashAction,onClick:()=>d0(j)})}),d6(),!document.querySelector(D1))document.body.append(document.createElement(D1));let z=window.requestIdleCallback;if(z)z(()=>void c0(),{timeout:5000});else setTimeout(()=>void c0(),2000);if(z)z(()=>V4(),{timeout:8000});else setTimeout(()=>V4(),3000);if(N().chat)if(!N().identity)console.warn("[debug-capture] `chat` needs `identity` — a chat is a signed-in person's; the bubble is not shown");else if(z)z(()=>F2(),{timeout:4000});else setTimeout(()=>F2(),1500)}var J3=document.currentScript,o=J3?.dataset??{},C7="rrweb-record.mjs";U6(()=>import(new URL(C7,J3?.src??location.href).href));function I7(J){if(!J)return{};try{let $=JSON.parse(J);if(!$||typeof $!=="object"||Array.isArray($))return{};return Object.fromEntries(Object.entries($).filter(([,z])=>typeof z==="string"&&z.trim()))}catch{return{}}}if(o.host&&o.realmKey)if(_4({host:o.host,realmKey:o.realmKey,app:{name:o.appName??document.title??"app",version:o.appVersion??"0.0.0",environment:o.environment??"production"},module:O4(I7(o.modules)),locale:o.locale==="en"?"en":"th",...o.replay!==void 0?{replay:{seconds:Number(o.replay)||void 0}}:{},...o.identityUrl?{identity:()=>fetch(o.identityUrl,{credentials:"include"}).then((J)=>J.ok?J.text():null).catch(()=>null)}:{},...o.chat!==void 0&&o.chat!=="false"?{chat:o.chat==="left"?{position:"left"}:!0}:{}}),document.body)F4();else document.addEventListener("DOMContentLoaded",()=>F4(),{once:!0});window.lwReportProblem=d0;window.lwOpenSupportChat=P4;})();