@lightworkai.official/debug-capture 0.19.1 → 0.19.2

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 t6=((z)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(z,{get:(J,$)=>(typeof require<"u"?require:J)[$]}):z)(function(z){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+z+'" is not supported')});function o1(z){if(!z)return null;let J=z===!0?{}:z,$=(j,Q)=>typeof j==="number"&&Number.isFinite(j)&&j>=0&&j<2000?j:Q;return{side:J.position==="left"?"left":"right",x:$(J.offset?.x,16),y:$(J.offset?.y,16)}}var e6={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},u=null;function h2(z){let J=[];if(!z.host?.trim())J.push("host");if(!z.realmKey?.trim())J.push("realmKey");if(!z.app?.name?.trim())J.push("app.name");if(typeof z.module!=="function")J.push("module");if(J.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${J.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");u=z}function M(){if(!u)throw Error("[debug-capture] configureDebugCapture() has not been called");return u}function H1(){return u!==null}function z0(){let z=M().app;return{name:z.name,version:z.version??"0.0.0",environment:z.environment??z8()}}function z8(){if(typeof window>"u")return"unknown";let z=window.location.hostname;if(z==="localhost"||z==="127.0.0.1"||z.endsWith(".local"))return"development";return"production"}function X0(z){let J=u?.capture?.[z];return typeof J==="number"?J:e6[z]}function U1(z){let J=u?.module;if(!J)return null;try{return J(z)??null}catch{return null}}function q1(){let z=u?.redact;return{headers:z?.headers??[],queryKeys:(z?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:(z?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function u2(){return u?.capture?.overlaySelectors??[]}var J8='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',$8="[data-lw-mask]",m2={fps:1,quality:0.5};function d0(){let z=u?.replay;if(!z)return null;let J=z===!0?{}:z,$=(Z,V)=>typeof Z==="number"&&Z>0?Z:V,j=J.maskInputs!==!1,Q=J.recordCanvas?{fps:$(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,m2.fps),quality:$(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,m2.quality)}:null;return{seconds:$(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?J8:$8),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(J.maxBytes,4000000),canvas:Q}}function p2(z){if(typeof window>"u")return!1;let J;try{J=new URL(z,window.location.href)}catch{return!1}if(j8(J))return!1;if(J.origin===window.location.origin)return!0;return(u?.capture?.bodyOrigins??[]).some(($)=>{try{return new URL($).origin===J.origin}catch{return!1}})}function j8(z){if(!u?.host)return!1;try{if(new URL(u.host).origin!==z.origin)return!1}catch{return!1}return z.pathname.startsWith("/ingest/")}function d2(z){let J=Object.entries(z).map(([$,j])=>[$.replace(/\/+$/,"")||"/",j]).sort(($,j)=>j[0].length-$[0].length);return($)=>{let j=($||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of J)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var i0="‹redacted›",Q8=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,Z8=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),X8=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,V8=/[\w.+-]+@[\w-]+\.[\w.-]+/g,W8=/\d(?:[\d\s-]{7,})\d/g;function c0(z){return z.replace(V8,i0).replace(W8,i0)}function Y8(z){if(Q8.test(z))return!0;return q1().headers.some(($)=>$.toLowerCase()===z.toLowerCase())}function l0(z){let J={};for(let[$,j]of Object.entries(z))J[$]=Y8($)?i0:j;return J}function V0(z){try{let J=/^https?:\/\//i.test(z),$=new URL(z,J?void 0:"http://local.invalid"),j=!1;if($.searchParams.forEach((Q,Z)=>{if(Z8.has(Z.toLowerCase())||q1().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,i0),j=!0}),!j)return z;return J?$.toString():`${$.pathname}${$.search}`}catch{return z}}function r1(z,J){if(J>6||z===null||typeof z!=="object")return z;if(Array.isArray(z))return z.map((j)=>r1(j,J+1));let $={};for(let[j,Q]of Object.entries(z)){let Z=X8.test(j)||q1().bodyKeys.some((V)=>j.toLowerCase().includes(V));$[j]=Z?i0:r1(Q,J+1)}return $}function o0(z,J){if(z==null)return null;let $=z,j=z.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);$=JSON.stringify(r1(Q,0))}catch{}if($.length>J)return`${$.slice(0,J)}… [truncated ${$.length-J} chars]`;return $}var s1=120,n1=40,T0=(z,J)=>z.length>J?`${z.slice(0,J)}…`:z,a1=(z)=>{try{return decodeURIComponent(z)}catch{return z}},A0=[],i2=0,c2=!1;function r0(z,J,$,j){let Q=T0(J,s1),Z=A0[A0.length-1];if(z==="navigate"&&Z?.kind==="click"){let W=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${W}`))return Z.at=new Date().toISOString(),Z;let H=W.split(/[?#]/)[0]??W,q=Z.source?a1(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(q&&(H===q||H.startsWith(q)))return Z.detail=T0(`${Z.detail} → ${W}`,s1),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===z&&Z.detail===Q){if(Z.at=new Date().toISOString(),z!=="navigate")Z.count=(Z.count??1)+1;return Z}i2+=1;let V={id:`act_${i2}`,at:new Date().toISOString(),kind:z,detail:Q,count:1,source:$,html:D1(j)};A0.push(V);while(A0.length>X0("maxActions"))G8(A0.shift());return V}var K8=200000,s0=0;function D1(z){if(!z)return;if(s0+z.length>K8)return;return s0+=z.length,z}function G8(z){if(!z)return;if(s0-=(z.html?.length??0)+(z.afterHtml?.length??0),s0<0)s0=0}function P1(z){return z instanceof Element&&Boolean(z.closest("[data-debug-reporter]"))}var H8='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',U8={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},l2={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function q8(z){let J=z.getAttribute("role");if(J&&l2[J])return l2[J];return U8[z.tagName.toLowerCase()]??"ปุ่ม"}function P8(z,J){try{let $=z,j=0;while($&&j<=J){let Q=t2($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function D8(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("title")?.trim();if($)return $;if(z instanceof HTMLInputElement||z instanceof HTMLTextAreaElement||z instanceof HTMLSelectElement)return(z.getAttribute("placeholder")||z.getAttribute("name")||"").trim();if(z instanceof HTMLImageElement)return(z.getAttribute("alt")||"").trim();let j=(z.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(z instanceof HTMLAnchorElement){let Q=z.getAttribute("href");if(Q?.startsWith("/"))return a1(Q)}return""}function M8(z){if(!(z instanceof Element))return null;let J=z.closest(H8)??P8(z,4);if(!J)return null;let $=J.tagName.toLowerCase();if($==="html"||$==="body")return null;return J}function F8(z){let J=c0(D8(z));if(!J)return null;return`${q8(z)} “${T0(J,n1)}”`}var a2=6000,B8=4000,N8=/(?:^|\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 I8(z){z.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let J=[z,...Array.from(z.querySelectorAll("*"))];for(let Q of J){for(let V of Array.from(Q.attributes)){let W=V.name.toLowerCase();if(W.startsWith("on")||W==="srcdoc"||W==="value"||W.startsWith("data-"))Q.removeAttribute(V.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let V=Z.replace(N8," ").replace(/\s+/g," ").trim();if(V)Q.setAttribute("class",V);else Q.removeAttribute("class")}}let $=document.createTreeWalker(z,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=c0(j.nodeValue);j=$.nextNode()}}function t1(z,J,$){try{let j=z.outerHTML;if(!j||j.length>J)return;let Q=z.cloneNode(!0);I8(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var _8=(z)=>t1(z,a2,B8),C8=150000,O8=40000,o2=(z)=>t1(z,C8,O8);function L8(z){if(!(z instanceof HTMLInputElement)&&!(z instanceof HTMLTextAreaElement)&&!(z instanceof HTMLSelectElement))return null;let J=z.name||z.id||z.getAttribute("aria-label")||z.getAttribute("placeholder")||z.tagName.toLowerCase();return`ช่อง “${c0(J)}”`}var r2=80;function t2(z){let J=Object.keys(z).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return J?z[J]:null}function S8(z){if(typeof z!=="function")return null;try{let J=Function.prototype.toString.call(z);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function s2(z){if(!z)return;return`→ ${z.length>r2?`${z.slice(0,r2)}…`:z}`}function R8(z){try{let J=z.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return s2(J);let $=t2(z),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return s2(S8($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var A8='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function T8(){let z=u2();return z.length?z.join(", "):A8}function k8(z){let J=z.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function x8(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((V)=>document.getElementById(V)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=z.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(z.textContent??"").replace(/\s+/g," ").trim()}function e2(z){let J=c0(x8(z)),$=k8(z);return J?`เปิด ${$} “${T0(J,n1)}”`:`เปิด ${$}`}var E8='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',w8=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function f8(z){if(z.querySelector(E8))return!0;return w8.test(z.textContent??"")}var y8=400,b8=250,v8=8000;function g8(z,J){if(typeof MutationObserver>"u"){J.html=D1(o2(z));return}let $=Date.now(),j=!1,Q=()=>{j=!0,V.disconnect(),window.clearInterval(W),window.clearTimeout(H)},Z=()=>{if(j)return;if(Q(),!z.isConnected)return;J.detail=T0(e2(z),s1),J.html=D1(o2(z))},V=new MutationObserver(()=>{$=Date.now()});V.observe(z,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let W=window.setInterval(()=>{if(j)return;if(!z.isConnected){Q();return}if(Date.now()-$>=y8&&!f8(z))Z()},b8),H=window.setTimeout(Z,v8)}function m8(z){if(P1(z))return;let J=r0("ui",e2(z));if(J)g8(z,J)}function h8(){if(typeof MutationObserver>"u")return;let z=new WeakSet;new MutationObserver(($)=>{for(let j of $)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=T8(),V=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let W of V){if(z.has(W))continue;z.add(W),m8(W)}}}).observe(document.body,{childList:!0,subtree:!0})}var u8=1600,p8=2500;function n2(z){return{disabled:z.hasAttribute("disabled")||z.getAttribute("aria-disabled")==="true",busy:z.getAttribute("aria-busy")==="true",text:T0((z.textContent??"").replace(/\s+/g," ").trim(),n1)}}function d8(z,J){if(!z.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!z.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(z.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function i8(z,J){if(typeof MutationObserver>"u")return;let $=n2(z),j=!1,Q=(W,H)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(V),J.afterNote=W,H)J.afterHtml=D1(t1(z,a2,p8))},Z=new MutationObserver(()=>{if(!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let W=d8($,n2(z));if(W)Q(W,!0)});Z.observe(z,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let V=window.setTimeout(()=>{if(!j&&!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},u8)}function z4(){if(c2||typeof window>"u")return;c2=!0,document.addEventListener("click",(j)=>{if(P1(j.target))return;let Q=M8(j.target);if(!Q)return;let Z=F8(Q);if(!Z)return;let V=r0("click",`คลิก ${Z}`,R8(Q),_8(Q));if(V)i8(Q,V)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(P1(j.target))return;let Q=L8(j.target);if(Q)r0("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(P1(j.target))return;r0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let z=()=>r0("navigate",`ไปที่ ${a1(V0(location.pathname+location.search))}`),J=history.pushState.bind(history),$=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=J(...j);return z(),Q},history.replaceState=(...j)=>{let Q=$(...j);return z(),Q},window.addEventListener("popstate",z),h8()}function J4(){return A0.map((z)=>({...z}))}var $4=2000,M1=[],j4=0,Q4=!1;function e1(z,J){j4+=1,M1.push({id:`log_${j4}`,at:new Date().toISOString(),level:z,message:J.length>$4?`${J.slice(0,$4)}…`:J});while(M1.length>X0("maxConsoleEntries"))M1.shift()}function c8(){let z=new WeakSet;return(J,$)=>{if(typeof $==="object"&&$!==null){if(z.has($))return"[Circular]";z.add($)}if(typeof $==="bigint")return $.toString();return $}}function Z4(z){if(typeof z==="string")return z;if(z instanceof Error)return`${z.name}: ${z.message}`;try{let J=JSON.stringify(z,c8());if(J!==void 0)return J}catch{}try{return String(z)}catch{}try{return Object.prototype.toString.call(z)}catch{return`[${typeof z}]`}}function X4(){if(Q4||typeof window>"u")return;Q4=!0;let z=["log","info","warn","error","debug"];for(let J of z){let $=console[J].bind(console);console[J]=(...j)=>{e1(J,j.map(Z4).join(" ")),$(...j)}}window.addEventListener("error",(J)=>{let $=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";e1("exception",`${J.message}${$}`)}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:Z4(J.reason);e1("unhandledrejection",$)})}function V4(){return M1.map((z)=>({...z}))}var W4=new Set,Y4=new Set;function K4(z,J){return z.add(J),()=>z.delete(J)}function G4(z,J){for(let $ of[...z])$(J)}function H4(z){return K4(W4,z)}function k0(z={type:"manual"}){G4(W4,z)}function U4(z){return K4(Y4,z)}function q4(z){G4(Y4,z)}var l8=15000,o8=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],P4=!1,D4=0;function r8(z){return o8.some((J)=>z.includes(J))}function M4(z){let J=z.message??"";if(!J||r8(J))return;let $=Date.now();if($-D4<l8)return;D4=$,q4({...z,message:J})}function F4(){if(P4||typeof window>"u")return;P4=!0,window.addEventListener("error",(z)=>{if(!z.message&&!z.error)return;let J=z.error instanceof Error?z.error:null;M4({type:"runtime-error",message:z.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",(z)=>{let J=z.reason;M4({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var _4=4000,s8=1e6,n8=1e7,F1=[],B4=0,N4=!1;function C4(z){F1.push(z);while(F1.length>X0("maxRequests"))F1.shift()}function O4(){return B4+=1,`req_${B4}`}function I4(z){let J={};if(!z)return J;if(z instanceof Headers)z.forEach(($,j)=>{J[j]=$});else if(Array.isArray(z))for(let[$,j]of z)J[$]=j;else Object.assign(J,z);return J}function a8(z){let J={};return z.forEach(($,j)=>{J[j]=$}),J}function t8(z){if(z==null)return null;if(typeof z==="string")return z;if(z instanceof URLSearchParams)return z.toString();if(typeof FormData<"u"&&z instanceof FormData)return`[FormData: ${Array.from(z.keys()).join(", ")}]`;if(typeof Blob<"u"&&z instanceof Blob)return`[Blob ${z.size} bytes]`;if(z instanceof ArrayBuffer)return`[ArrayBuffer ${z.byteLength} bytes]`;return"[binary]"}function e8(z,J){let $="",j="GET",Q={},Z=null;if(typeof z==="string")$=z;else if(z instanceof URL)$=z.toString();else $=z.url,j=z.method||j,Q=I4(z.headers);if(J){if(J.method)j=J.method;if(J.headers)Q={...Q,...I4(J.headers)};if(J.body!==void 0)Z=t8(J.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function L4(z){return!p2(z)}function z5(z,J){if(L4(J.url)){J.responseSnippet="[body not captured for this origin]";return}let $=z.headers.get("content-type")??"",j=Number(z.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test($)){J.responseSnippet=`[binary ${$||"unknown"}${Q}]`;return}if(j>s8){J.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{z.clone().text().then((Z)=>{J.responseSnippet=o0(Z,X0("maxBodyChars"))}).catch(()=>{})}catch{}}function S4(z,J){if(/[?&]_rsc=/.test(z))return!0;for(let $ of Object.keys(J)){let j=$.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function J5(){if(typeof window>"u"||typeof window.fetch!=="function")return;let z=window.fetch.bind(window);window.fetch=Object.assign(async(J,$)=>{let j=e8(J,$);if(S4(j.url,j.headers))return z(J,$);let Q={id:O4(),startedAt:new Date().toISOString(),method:j.method,url:V0(j.url),requestHeaders:l0(j.headers),requestBody:o0(j.body,_4),status:null,statusText:null,durationMs:null,via:"fetch"};C4(Q);let Z=performance.now();try{let V=await z(J,$);return Q.status=V.status,Q.statusText=V.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=l0(a8(V.headers)),z5(V,Q),V}catch(V){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=V instanceof Error?`${V.name}: ${V.message}`:String(V),V}},z)}function $5(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let z=XMLHttpRequest.prototype,J=z.open,$=z.send,j=function(Z,V){let W=typeof V==="string"?V:V.toString();return this.__lwEntry=S4(W,{})?void 0:{id:O4(),startedAt:"",method:(Z||"GET").toUpperCase(),url:V0(W),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},Q=function(Z){let V=this.__lwEntry;if(V){V.startedAt=new Date().toISOString(),V.requestBody=typeof Z==="string"?o0(Z,_4):Z==null?null:"[non-string body]";let W=performance.now();C4(V),this.addEventListener("loadend",()=>{if(V.status=this.status||null,V.statusText=this.statusText||null,V.durationMs=Math.round(performance.now()-W),L4(V.url))V.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{V.responseSnippet=o0(this.responseText||"",X0("maxBodyChars"))}catch{}else{let H=this.getResponseHeader("content-type")??this.responseType;V.responseSnippet=`[binary ${H}]`}})}return $.apply(this,arguments)};z.open=j,z.send=Q}function R4(){if(N4)return;N4=!0,J5(),$5()}function A4(){let z=F1.map(($)=>({...$})),J=0;for(let $=z.length-1;$>=0;$-=1){let j=z[$],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(J+Q.length>n8)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else J+=Q.length}return z}var j5=4,T4=3,Q5=4000,Z5="[data-debug-reporter]",k4=()=>import("@rrweb/record");function x4(z){k4=z}var d=[],z2=null,B1=!1;function E4(){if(typeof window>"u"||z2||B1)return;let z=d0();if(!z)return;B1=!0;let J=()=>void X5(z);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function X5(z){let J;try{J=(await k4()).record}catch($){B1=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(z2)return;try{z2=J({emit:($)=>V5($),checkoutEveryNms:Math.max(1000,z.seconds*1000/2),checkoutEveryNth:Q5,maskAllInputs:z.maskInputs,maskTextSelector:z.maskText?"*":z.maskTextSelector,blockSelector:`${z.blockSelector}, ${Z5}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...z.canvas?{canvas:z.canvas.fps}:{}},recordCanvas:z.canvas!==null,...z.canvas?{dataURLOptions:{type:"image/webp",quality:z.canvas.quality}}:{},errorHandler:()=>!0})??null}catch($){console.warn("[debug-capture] session replay could not start:",$)}finally{B1=!1}}function V5(z){if(z.type===j5||d.length===0){if(d.push([]),d.length>T4)d=d.slice(-T4)}d[d.length-1].push(z)}function w4(z=Date.now()){let J=d0();if(!J||!d.length)return null;let $=z-J.seconds*1000,j=d.length-1;while(j>0&&(d[j][0]?.timestamp??z)>$)j-=1;let Q=d.slice(j).flat(),Z=Q[0]?.timestamp,V=Q[Q.length-1]?.timestamp;if(Z===void 0||V===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(V).toISOString(),durationMs:Math.max(0,V-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}",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า",ringHint:"เมื่อรับสาย เบราว์เซอร์จะขอใช้ไมโครโฟน · ระหว่างคุย ทีมงานอาจขอดูหน้าจอ — คุณเลือกได้เสมอว่าจะให้ดูหรือไม่",ringTest:"ทดสอบไมค์และลำโพงก่อนรับสาย",ringAnswer:"รับสาย",ringAnswering:"กำลังรับสาย…",ringFallback:"เปิดสายในหน้านี้ไม่ได้ — รับสายในแท็บใหม่แทน ไม่ต้องเข้าสู่ระบบอีก",chatOpen:"แชทกับทีมงาน",chatTitle:"แชทกับทีมงาน",chatUnread:"{n} ข้อความใหม่จากทีมงาน"},Y5={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}",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"};function i(z){return z==="en"?Y5:W5}var K5="lw-debug-toasts",G5=6000,H5=`
1
+ (()=>{var N8=((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 _1(J){if(!J)return null;let z=J===!0?{}:J,$=(j,Q)=>typeof j==="number"&&Number.isFinite(j)&&j>=0&&j<2000?j:Q;return{side:z.position==="left"?"left":"right",x:$(z.offset?.x,16),y:$(z.offset?.y,16)}}var _8={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},c=null;function Z4(J){let z=[];if(!J.host?.trim())z.push("host");if(!J.realmKey?.trim())z.push("realmKey");if(!J.app?.name?.trim())z.push("app.name");if(typeof J.module!=="function")z.push("module");if(z.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${z.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");c=J}function M(){if(!c)throw Error("[debug-capture] configureDebugCapture() has not been called");return c}function I1(){return c!==null}function Y0(){let J=M().app;return{name:J.name,version:J.version??"0.0.0",environment:J.environment??I8()}}function I8(){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 D0(J){let z=c?.capture?.[J];return typeof z==="number"?z:_8[J]}function C1(J){let z=c?.module;if(!z)return null;try{return z(J)??null}catch{return null}}function O1(){let J=c?.redact;return{headers:J?.headers??[],queryKeys:(J?.queryKeys??[]).map((z)=>z.toLowerCase()),bodyKeys:(J?.bodyKeys??[]).map((z)=>z.toLowerCase())}}function X4(){return c?.capture?.overlaySelectors??[]}var C8='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',O8="[data-lw-mask]",Q4={fps:1,quality:0.5};function s0(){let J=c?.replay;if(!J)return null;let z=J===!0?{}:J,$=(Z,V)=>typeof Z==="number"&&Z>0?Z:V,j=z.maskInputs!==!1,Q=z.recordCanvas?{fps:$(typeof z.recordCanvas==="object"?z.recordCanvas.fps:void 0,Q4.fps),quality:$(typeof z.recordCanvas==="object"?z.recordCanvas.quality:void 0,Q4.quality)}:null;return{seconds:$(z.seconds,60),maskInputs:j,maskTextSelector:z.maskTextSelector?.trim()||(j?C8:O8),maskText:z.maskText===!0,blockSelector:z.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(z.maxBytes,4000000),canvas:Q}}function V4(J){if(typeof window>"u")return!1;let z;try{z=new URL(J,window.location.href)}catch{return!1}if(L8(z))return!1;if(z.origin===window.location.origin)return!0;return(c?.capture?.bodyOrigins??[]).some(($)=>{try{return new URL($).origin===z.origin}catch{return!1}})}function L8(J){if(!c?.host)return!1;try{if(new URL(c.host).origin!==J.origin)return!1}catch{return!1}return J.pathname.startsWith("/ingest/")}function W4(J){let z=Object.entries(J).map(([$,j])=>[$.replace(/\/+$/,"")||"/",j]).sort(($,j)=>j[0].length-$[0].length);return($)=>{let j=($||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of z)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var a0="‹redacted›",S8=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,R8=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),T8=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,A8=/[\w.+-]+@[\w-]+\.[\w.-]+/g,k8=/\d(?:[\d\s-]{7,})\d/g;function t0(J){return J.replace(A8,a0).replace(k8,a0)}function x8(J){if(S8.test(J))return!0;return O1().headers.some(($)=>$.toLowerCase()===J.toLowerCase())}function e0(J){let z={};for(let[$,j]of Object.entries(J))z[$]=x8($)?a0:j;return z}function P0(J){try{let z=/^https?:\/\//i.test(J),$=new URL(J,z?void 0:"http://local.invalid"),j=!1;if($.searchParams.forEach((Q,Z)=>{if(R8.has(Z.toLowerCase())||O1().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,a0),j=!0}),!j)return J;return z?$.toString():`${$.pathname}${$.search}`}catch{return J}}function V2(J,z){if(z>6||J===null||typeof J!=="object")return J;if(Array.isArray(J))return J.map((j)=>V2(j,z+1));let $={};for(let[j,Q]of Object.entries(J)){let Z=T8.test(j)||O1().bodyKeys.some((V)=>j.toLowerCase().includes(V));$[j]=Z?a0:V2(Q,z+1)}return $}function J1(J,z){if(J==null)return null;let $=J,j=J.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);$=JSON.stringify(V2(Q,0))}catch{}if($.length>z)return`${$.slice(0,z)}… [truncated ${$.length-z} chars]`;return $}var W2=120,Y2=40,y0=(J,z)=>J.length>z?`${J.slice(0,z)}…`:J,K2=(J)=>{try{return decodeURIComponent(J)}catch{return J}},w0=[],Y4=0,K4=!1;function z1(J,z,$,j){let Q=y0(z,W2),Z=w0[w0.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 U=W.split(/[?#]/)[0]??W,H=Z.source?K2(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(H&&(U===H||U.startsWith(H)))return Z.detail=y0(`${Z.detail} → ${W}`,W2),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}Y4+=1;let V={id:`act_${Y4}`,at:new Date().toISOString(),kind:J,detail:Q,count:1,source:$,html:S1(j)};w0.push(V);while(w0.length>D0("maxActions"))f8(w0.shift());return V}var E8=200000,$1=0;function S1(J){if(!J)return;if($1+J.length>E8)return;return $1+=J.length,J}function f8(J){if(!J)return;if($1-=(J.html?.length??0)+(J.afterHtml?.length??0),$1<0)$1=0}function L1(J){return J instanceof Element&&Boolean(J.closest("[data-debug-reporter]"))}var w8='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',y8={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},G4={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function g8(J){let z=J.getAttribute("role");if(z&&G4[z])return G4[z];return y8[J.tagName.toLowerCase()]??"ปุ่ม"}function v8(J,z){try{let $=J,j=0;while($&&j<=z){let Q=M4($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function h8(J){let z=J.getAttribute("aria-label")?.trim();if(z)return z;let $=J.getAttribute("title")?.trim();if($)return $;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 K2(Q)}return""}function m8(J){if(!(J instanceof Element))return null;let z=J.closest(w8)??v8(J,4);if(!z)return null;let $=z.tagName.toLowerCase();if($==="html"||$==="body")return null;return z}function b8(J){let z=t0(h8(J));if(!z)return null;return`${g8(J)} “${y0(z,Y2)}”`}var P4=6000,u8=4000,p8=/(?:^|\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 i8(J){J.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let z=[J,...Array.from(J.querySelectorAll("*"))];for(let Q of z){for(let V of Array.from(Q.attributes)){let W=V.name.toLowerCase();if(W.startsWith("on")||W==="srcdoc"||W==="value"||W.startsWith("data-"))Q.removeAttribute(V.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let V=Z.replace(p8," ").replace(/\s+/g," ").trim();if(V)Q.setAttribute("class",V);else Q.removeAttribute("class")}}let $=document.createTreeWalker(J,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=t0(j.nodeValue);j=$.nextNode()}}function G2(J,z,$){try{let j=J.outerHTML;if(!j||j.length>z)return;let Q=J.cloneNode(!0);i8(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var d8=(J)=>G2(J,P4,u8),c8=150000,l8=40000,U4=(J)=>G2(J,c8,l8);function o8(J){if(!(J instanceof HTMLInputElement)&&!(J instanceof HTMLTextAreaElement)&&!(J instanceof HTMLSelectElement))return null;let z=J.name||J.id||J.getAttribute("aria-label")||J.getAttribute("placeholder")||J.tagName.toLowerCase();return`ช่อง “${t0(z)}”`}var q4=80;function M4(J){let z=Object.keys(J).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return z?J[z]:null}function r8(J){if(typeof J!=="function")return null;try{let z=Function.prototype.toString.call(J);return(z.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??z.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function H4(J){if(!J)return;return`→ ${J.length>q4?`${J.slice(0,q4)}…`:J}`}function n8(J){try{let z=J.closest("a[href]")?.getAttribute("href");if(z&&z.startsWith("/"))return H4(z);let $=M4(J),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return H4(r8($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var s8='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function a8(){let J=X4();return J.length?J.join(", "):s8}function t8(J){let z=J.getAttribute("role");if(z==="status"||z==="alert")return"ข้อความแจ้งเตือน";if(z==="menu")return"เมนู";if(z==="listbox")return"รายการตัวเลือก";if(z==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function e8(J){let z=J.getAttribute("aria-label")?.trim();if(z)return z;let $=J.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((V)=>document.getElementById(V)?.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 z=t0(e8(J)),$=t8(J);return z?`เปิด ${$} “${y0(z,Y2)}”`:`เปิด ${$}`}var J5='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',z5=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function $5(J){if(J.querySelector(J5))return!0;return z5.test(J.textContent??"")}var j5=400,Q5=250,Z5=8000;function X5(J,z){if(typeof MutationObserver>"u"){z.html=S1(U4(J));return}let $=Date.now(),j=!1,Q=()=>{j=!0,V.disconnect(),window.clearInterval(W),window.clearTimeout(U)},Z=()=>{if(j)return;if(Q(),!J.isConnected)return;z.detail=y0(F4(J),W2),z.html=S1(U4(J))},V=new MutationObserver(()=>{$=Date.now()});V.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()-$>=j5&&!$5(J))Z()},Q5),U=window.setTimeout(Z,Z5)}function V5(J){if(L1(J))return;let z=z1("ui",F4(J));if(z)X5(J,z)}function W5(){if(typeof MutationObserver>"u")return;let J=new WeakSet;new MutationObserver(($)=>{for(let j of $)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=a8(),V=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let W of V){if(J.has(W))continue;J.add(W),V5(W)}}}).observe(document.body,{childList:!0,subtree:!0})}var Y5=1600,K5=2500;function D4(J){return{disabled:J.hasAttribute("disabled")||J.getAttribute("aria-disabled")==="true",busy:J.getAttribute("aria-busy")==="true",text:y0((J.textContent??"").replace(/\s+/g," ").trim(),Y2)}}function G5(J,z){if(!J.disabled&&z.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!J.busy&&z.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(J.text!==z.text&&z.text)return`ข้อความเปลี่ยนเป็น “${z.text}”`;return null}function U5(J,z){if(typeof MutationObserver>"u")return;let $=D4(J),j=!1,Q=(W,U)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(V),z.afterNote=W,U)z.afterHtml=S1(G2(J,P4,K5))},Z=new MutationObserver(()=>{if(!J.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let W=G5($,D4(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 V=window.setTimeout(()=>{if(!j&&!J.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},Y5)}function B4(){if(K4||typeof window>"u")return;K4=!0,document.addEventListener("click",(j)=>{if(L1(j.target))return;let Q=m8(j.target);if(!Q)return;let Z=b8(Q);if(!Z)return;let V=z1("click",`คลิก ${Z}`,n8(Q),d8(Q));if(V)U5(Q,V)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(L1(j.target))return;let Q=o8(j.target);if(Q)z1("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(L1(j.target))return;z1("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let J=()=>z1("navigate",`ไปที่ ${K2(P0(location.pathname+location.search))}`),z=history.pushState.bind(history),$=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=z(...j);return J(),Q},history.replaceState=(...j)=>{let Q=$(...j);return J(),Q},window.addEventListener("popstate",J),W5()}function N4(){return w0.map((J)=>({...J}))}var _4=2000,R1=[],I4=0,C4=!1;function U2(J,z){I4+=1,R1.push({id:`log_${I4}`,at:new Date().toISOString(),level:J,message:z.length>_4?`${z.slice(0,_4)}…`:z});while(R1.length>D0("maxConsoleEntries"))R1.shift()}function q5(){let J=new WeakSet;return(z,$)=>{if(typeof $==="object"&&$!==null){if(J.has($))return"[Circular]";J.add($)}if(typeof $==="bigint")return $.toString();return $}}function O4(J){if(typeof J==="string")return J;if(J instanceof Error)return`${J.name}: ${J.message}`;try{let z=JSON.stringify(J,q5());if(z!==void 0)return z}catch{}try{return String(J)}catch{}try{return Object.prototype.toString.call(J)}catch{return`[${typeof J}]`}}function L4(){if(C4||typeof window>"u")return;C4=!0;let J=["log","info","warn","error","debug"];for(let z of J){let $=console[z].bind(console);console[z]=(...j)=>{U2(z,j.map(O4).join(" ")),$(...j)}}window.addEventListener("error",(z)=>{let $=z.filename?` (${z.filename}:${z.lineno}:${z.colno})`:"";U2("exception",`${z.message}${$}`)}),window.addEventListener("unhandledrejection",(z)=>{let $=z.reason instanceof Error?`${z.reason.name}: ${z.reason.message}`:O4(z.reason);U2("unhandledrejection",$)})}function S4(){return R1.map((J)=>({...J}))}var R4=new Set,T4=new Set;function A4(J,z){return J.add(z),()=>J.delete(z)}function k4(J,z){for(let $ of[...J])$(z)}function x4(J){return A4(R4,J)}function g0(J={type:"manual"}){k4(R4,J)}function E4(J){return A4(T4,J)}function f4(J){k4(T4,J)}var H5=15000,D5=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],w4=!1,y4=0;function P5(J){return D5.some((z)=>J.includes(z))}function g4(J){let z=J.message??"";if(!z||P5(z))return;let $=Date.now();if($-y4<H5)return;y4=$,f4({...J,message:z})}function v4(){if(w4||typeof window>"u")return;w4=!0,window.addEventListener("error",(J)=>{if(!J.message&&!J.error)return;let z=J.error instanceof Error?J.error:null;g4({type:"runtime-error",message:J.message||(z?z.message:"Unknown error"),stack:z?.stack})}),window.addEventListener("unhandledrejection",(J)=>{let z=J.reason;g4({type:"unhandledrejection",message:z instanceof Error?z.message:String(z),stack:z instanceof Error?z.stack:void 0})})}var u4=4000,M5=1e6,F5=1e7,T1=[],h4=0,m4=!1;function p4(J){T1.push(J);while(T1.length>D0("maxRequests"))T1.shift()}function i4(){return h4+=1,`req_${h4}`}function b4(J){let z={};if(!J)return z;if(J instanceof Headers)J.forEach(($,j)=>{z[j]=$});else if(Array.isArray(J))for(let[$,j]of J)z[$]=j;else Object.assign(z,J);return z}function B5(J){let z={};return J.forEach(($,j)=>{z[j]=$}),z}function N5(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 _5(J,z){let $="",j="GET",Q={},Z=null;if(typeof J==="string")$=J;else if(J instanceof URL)$=J.toString();else $=J.url,j=J.method||j,Q=b4(J.headers);if(z){if(z.method)j=z.method;if(z.headers)Q={...Q,...b4(z.headers)};if(z.body!==void 0)Z=N5(z.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function d4(J){return!V4(J)}function I5(J,z){if(d4(z.url)){z.responseSnippet="[body not captured for this origin]";return}let $=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 ${$||"unknown"}${Q}]`;return}if(j>M5){z.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{J.clone().text().then((Z)=>{z.responseSnippet=J1(Z,D0("maxBodyChars"))}).catch(()=>{})}catch{}}function c4(J,z){if(/[?&]_rsc=/.test(J))return!0;for(let $ of Object.keys(z)){let j=$.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function C5(){if(typeof window>"u"||typeof window.fetch!=="function")return;let J=window.fetch.bind(window);window.fetch=Object.assign(async(z,$)=>{let j=_5(z,$);if(c4(j.url,j.headers))return J(z,$);let Q={id:i4(),startedAt:new Date().toISOString(),method:j.method,url:P0(j.url),requestHeaders:e0(j.headers),requestBody:J1(j.body,u4),status:null,statusText:null,durationMs:null,via:"fetch"};p4(Q);let Z=performance.now();try{let V=await J(z,$);return Q.status=V.status,Q.statusText=V.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=e0(B5(V.headers)),I5(V,Q),V}catch(V){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=V instanceof Error?`${V.name}: ${V.message}`:String(V),V}},J)}function O5(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let J=XMLHttpRequest.prototype,z=J.open,$=J.send,j=function(Z,V){let W=typeof V==="string"?V:V.toString();return this.__lwEntry=c4(W,{})?void 0:{id:i4(),startedAt:"",method:(Z||"GET").toUpperCase(),url:P0(W),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},z.apply(this,arguments)},Q=function(Z){let V=this.__lwEntry;if(V){V.startedAt=new Date().toISOString(),V.requestBody=typeof Z==="string"?J1(Z,u4):Z==null?null:"[non-string body]";let W=performance.now();p4(V),this.addEventListener("loadend",()=>{if(V.status=this.status||null,V.statusText=this.statusText||null,V.durationMs=Math.round(performance.now()-W),d4(V.url))V.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{V.responseSnippet=J1(this.responseText||"",D0("maxBodyChars"))}catch{}else{let U=this.getResponseHeader("content-type")??this.responseType;V.responseSnippet=`[binary ${U}]`}})}return $.apply(this,arguments)};J.open=j,J.send=Q}function l4(){if(m4)return;m4=!0,C5(),O5()}function o4(){let J=T1.map(($)=>({...$})),z=0;for(let $=J.length-1;$>=0;$-=1){let j=J[$],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(z+Q.length>F5)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else z+=Q.length}return J}var L5=4,r4=3,S5=4000,R5="[data-debug-reporter]",n4=()=>import("@rrweb/record");function s4(J){n4=J}var r=[],q2=null,A1=!1;function a4(){if(typeof window>"u"||q2||A1)return;let J=s0();if(!J)return;A1=!0;let z=()=>void T5(J);if("requestIdleCallback"in window)window.requestIdleCallback(z,{timeout:3000});else setTimeout(z,1000)}async function T5(J){let z;try{z=(await n4()).record}catch($){A1=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(q2)return;try{q2=z({emit:($)=>A5($),checkoutEveryNms:Math.max(1000,J.seconds*1000/2),checkoutEveryNth:S5,maskAllInputs:J.maskInputs,maskTextSelector:J.maskText?"*":J.maskTextSelector,blockSelector:`${J.blockSelector}, ${R5}`,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($){console.warn("[debug-capture] session replay could not start:",$)}finally{A1=!1}}function A5(J){if(J.type===L5||r.length===0){if(r.push([]),r.length>r4)r=r.slice(-r4)}r[r.length-1].push(J)}function t4(J=Date.now()){let z=s0();if(!z||!r.length)return null;let $=J-z.seconds*1000,j=r.length-1;while(j>0&&(r[j][0]?.timestamp??J)>$)j-=1;let Q=r.slice(j).flat(),Z=Q[0]?.timestamp,V=Q[Q.length-1]?.timestamp;if(Z===void 0||V===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(V).toISOString(),durationMs:Math.max(0,V-Z)}}var k5={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}",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า",ringHint:"เมื่อรับสาย เบราว์เซอร์จะขอใช้ไมโครโฟน · ระหว่างคุย ทีมงานอาจขอดูหน้าจอ — คุณเลือกได้เสมอว่าจะให้ดูหรือไม่",ringTest:"ทดสอบไมค์และลำโพงก่อนรับสาย",ringAnswer:"รับสาย",ringAnswering:"กำลังรับสาย…",ringFallback:"เปิดสายในหน้านี้ไม่ได้ — รับสายในแท็บใหม่แทน ไม่ต้องเข้าสู่ระบบอีก",chatOpen:"แชทกับทีมงาน",chatTitle:"แชทกับทีมงาน",chatUnread:"{n} ข้อความใหม่จากทีมงาน",chatMove:"แชทกับทีมงาน — ลากเพื่อย้ายไปที่อื่นได้ถ้าบังอะไรอยู่",chatLabel:"แชทกับทีมงาน",chatLabelNew:"มีข้อความใหม่จากทีมงาน"},x5={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}",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 l(J){return J==="en"?x5:k5}var E5="lw-debug-toasts",f5=6000,w5=`
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
- `,J2=null;function U5(){if(typeof document>"u")return null;if(J2?.isConnected)return J2;let z=document.createElement(K5);z.dataset.debugReporter="true";let J=z.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=H5;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append($,j),document.body.append(z),J2=j,j}function x0(z,J="success",$){let j=H1()?M().toast:void 0;if(j){j({message:z,tone:J,...$?{action:$}:{}});return}let Q=U5();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=J;let V=document.createElement("span");V.className="dot";let W=document.createElement("span");W.textContent=z;let H=document.createElement("button");H.type="button",H.className="close",H.textContent="✕",H.setAttribute("aria-label","ปิด");let q=()=>{window.clearTimeout(S),Z.remove()};H.addEventListener("click",q);let S=J==="error"||$?0:window.setTimeout(q,G5);if(Z.append(V,W),$){let B=document.createElement("button");B.type="button",B.className="action",B.textContent=$.label,B.addEventListener("click",()=>{q(),$.onClick()}),Z.append(B)}Z.append(H),Q.append(Z)}function f4(z,J,$){let j=z.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=J.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:$.slice(0,20)}}function q5(){let z={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return z;let J=performance.memory;if(J)z.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),z.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[$]=performance.getEntriesByType("navigation");if($)z.domContentLoadedMs=Math.round($.domContentLoadedEventEnd),z.loadEventMs=Math.round($.loadEventEnd);return z}function $2(z,J){if(!z)return J;try{return z()}catch{return J}}function y4(){let z=M(),{pathname:J,search:$,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:$},module:U1(J),user:$2(z.user,{}),apiHeaders:l0($2(z.headers,{})),app:{name:z0().name,version:z0().version,environment:z0().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:q5(),extra:$2(z.extra,{})}}var P5=2;function N1(z){let J=A4(),$=V4();return{context:y4(),reason:z.reason,note:z.note,cause:f4(J,$,z.erroredQueries),actionTrail:J4(),network:J,console:$,screenshotDataUrl:z.screenshotDataUrl,screenshotMethod:z.screenshotMethod,replay:w4()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:P5}}}async function j2(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await D5();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await B5();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function D5(){let z=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};z=await navigator.mediaDevices.getDisplayMedia(J);let $=await M5(z);return $?{status:"ok",dataUrl:$}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{z?.getTracks().forEach((J)=>J.stop())}}async function M5(z){let J=document.createElement("video");J.srcObject=z,J.muted=!0,J.playsInline=!0,await new Promise((V)=>{let W=!1,H=()=>{if(W)return;W=!0,V()};J.onloadedmetadata=()=>{J.play().then(H).catch(H)},window.setTimeout(H,1500)}),await F5(J);let{videoWidth:$,videoHeight:j}=J;if(!$||!j)return null;let Q=document.createElement("canvas");Q.width=$,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(J,0,0,$,j),J.pause(),J.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function F5(z){return new Promise((J)=>{let $=!1,j=()=>{if($)return;$=!0,J()},Q=z;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function B5(){let z=M().screenshotFallback;if(!z)return null;let J=await z().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:($)=>!($ instanceof HTMLElement&&$.dataset?.debugReporter==="true")})}catch{return null}}var N5=2000,I5=0.82,_5=3000000;function C5(z){return new Promise((J,$)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>$(Error("could not read the screenshot")),j.src=z})}async function I1(z){try{let J=await C5(z),$=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,N5/$),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(J.naturalWidth*j)),Q.height=Math.max(1,Math.round(J.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return z;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(J,0,0,Q.width,Q.height);let V=I5,W=Q.toDataURL("image/jpeg",V);while(W.length>_5&&V>0.4)V-=0.15,W=Q.toDataURL("image/jpeg",V);return W}catch{return z}}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 b4(z){if(z.reason.type==="manual")return null;let J=z.cause?.failedRequests?.[0];if(!J?.url)return null;let $;try{$=new URL(J.url,"http://x").pathname}catch{$=J.url}let j=$.split("/").map((Z)=>O5.test(Z)||L5.test(Z)||S5.test(Z)?":id":Z).join("/"),Q=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${Q}`}var v4=2000000;function _1(z){let{screenshotDataUrl:J,replay:$,...j}=z;return JSON.stringify(j).length}function g4(z,J=2000000){if(_1(z)<=J)return z;let $=z.network.map((Q)=>({...Q})),j={...z,network:$};for(let Q of $){if(_1(j)<=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&&_1(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&_1(j)>J)j.console=j.console.slice(1);return j}function n0(z){let J="";for(let $=0;$<z.length;$+=32768)J+=String.fromCharCode(...z.subarray($,$+32768));return btoa(J)}var R5=4,A5=2,T5=3,k5=0,x5=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),E5=/^\s*javascript:/i;function w5(z,J){let $=z.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof J==="string"&&E5.test(J)}function m4(z,J=!1){if(!z)return;for(let $ of Object.keys(z)){let j=z[$];if(w5($,j)){if(J)z[$]=null;else delete z[$];continue}if(typeof j!=="string"||!x5.has($)||!j.includes("?"))continue;z[$]=V0(j)}}function Q2(z){if(!z)return;m4(z.attributes);for(let J of z.childNodes??[])Q2(J)}function h4(z){let J=JSON.parse(JSON.stringify(z));for(let $ of J){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===R5&&typeof j.href==="string")j.href=V0(j.href);else if($.type===A5)Q2(j.node);else if($.type===T5&&j.source===k5){for(let Q of j.adds??[])Q2(Q.node);for(let Q of j.attributes??[])m4(Q.attributes,!0)}}return J}var f5="session-replay.json.gz",y5="session-replay.json";function b5(z){return Boolean(z&&z.events.length>0)}async function v5(z){if(typeof CompressionStream>"u")return null;try{let J=new Blob([z]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function p4(z,J){if(!b5(z))return{summary:{omitted:"empty"}};let j={seconds:Math.round(z.durationMs/1000),events:z.events.length,startedAt:z.startedAt,endedAt:z.endedAt},Q=h4(z.events),Z=await u4(Q),V=!1;if(Z.bytes.byteLength>J&&h5(Q))Q=u5(Q),Z=await u4(Q),V=!0;let{bytes:W,compressed:H}=Z;if(W.byteLength>J)return{summary:{...j,bytes:W.byteLength,omitted:"too-large"}};return{dataUri:`data:${H?"application/gzip":"application/json"};base64,${n0(W)}`,filename:H?f5:y5,summary:{...j,events:Q.length,bytes:W.byteLength,compressed:H,...V?{canvasDropped:V}:{}}}}async function u4(z){let J=new TextEncoder().encode(JSON.stringify({events:z})),$=await v5(J);return $?{bytes:$,compressed:!0}:{bytes:J,compressed:!1}}var g5=3,d4=2,m5=9;function i4(z){return z.type===g5&&z.data?.source===m5}function h5(z){return z.some(i4)||z.some((J)=>J.type===d4&&c4(J.data.node))}function c4(z){if(!z)return!1;if(z.attributes&&"rr_dataURL"in z.attributes)return!0;return(z.childNodes??[]).some(c4)}function l4(z){if(!z)return;if(z.attributes&&"rr_dataURL"in z.attributes)delete z.attributes.rr_dataURL;for(let J of z.childNodes??[])l4(J)}function u5(z){let J=[];for(let $ of z){if(i4($))continue;if($.type===d4)l4($.data.node);J.push($)}return J}var p5=new Set([502,503,504]);class J0 extends Error{kind;retryAfter;status;constructor(z,J,$,j){super(z);this.kind=J;this.retryAfter=$;this.status=j;this.name="ReportError"}}function d5(z){let{screenshotDataUrl:J,replay:$,...j}=z;return{dataUri:`data:application/json;base64,${n0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function Z2(){let z=M().identity;if(!z)return{};try{let J=await z();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function o4(z,J){let $=M(),j=g4(J,v4),{context:Q,note:Z}=j,V=[];if(j.screenshotDataUrl){let C=await I1(j.screenshotDataUrl);V.push({dataUri:C,filename:"screenshot.jpg"})}V.push(d5(j));let W,H=d0();if(H){let C=await p4(j.replay,H.maxBytes);if(W=C.summary,"dataUri"in C)V.push({dataUri:C.dataUri,filename:C.filename})}let q=b4(j),S={title:z,description:Z.trim()||void 0,appName:z0().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:z0().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:V,...j.reason.fromChat?{fromChat:!0}:{}},B=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await Z2()},body:JSON.stringify(S)}).catch(()=>{throw new J0("report never left the browser","offline")});if(!B.ok)throw await X2(B);return await B.json()}async function X2(z){let J=z.headers.get("retry-after"),$=await z.json().then((j)=>j.error).catch(()=>null);if(z.status===429)return new J0("rate limited","rateLimited",J??void 0);if(p5.has(z.status))return new J0("desk unavailable","unavailable");return new J0($??`Report failed (${z.status})`,"rejected",void 0,z.status)}var C1=null,a0=null,r4=()=>M().host.replace(/\/$/,"");function V2(){return C1}function E0(){if(a0)return a0;return a0=(async()=>{try{let z=await fetch(`${r4()}/ingest/request-types`,{headers:{"x-realm-key":M().realmKey}}),J=z.ok?await z.json():null;C1=Array.isArray(J?.types)?J.types.filter(i5):[]}catch{C1=[],a0=null}return C1??[]})(),a0}function i5(z){let J=z;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function s4(z){let J=M(),$={};try{$=J.user?.()??{}}catch{$={}}let j=typeof window>"u"?null:window.location,Q={title:z.title,description:z.description.trim()||void 0,ticketTypeId:z.ticketTypeId,appName:z0().name,category:j?U1(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:z.screenshotDataUrl?[{dataUri:await I1(z.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${r4()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await Z2()},body:JSON.stringify(Q)}).catch(()=>{throw new J0("request never left the browser","offline")});if(!Z.ok)throw await X2(Z);return await Z.json()}var t0=Math.PI/6;function n4(z,J,$){let j=J.x-z.x,Q=J.y-z.y,Z=Math.hypot(j,Q),V=Math.atan2(Q,j),W=[{x:J.x,y:J.y},{x:J.x-$*Math.cos(V-t0),y:J.y-$*Math.sin(V-t0)},{x:J.x-$*Math.cos(V+t0),y:J.y-$*Math.sin(V+t0)}],H=$*Math.cos(t0)*0.92;if(Z<=H)return{shaft:null,head:W};return{shaft:{from:z,to:{x:J.x-H*Math.cos(V),y:J.y-H*Math.sin(V)}},head:W}}var W2="#f44336",c5="rgba(250, 204, 21, 0.4)",Y2=22,a4="#2563eb",t4=9,e4=11,z6=18,J6=4,O1=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 $6(z,J,$){let j=[],Q=null,Z=-1,V=null,W=null,H=z.getContext("2d");function q(){let X=z.getBoundingClientRect().width;return X>0?z.width/X:1}function S(X){let Y=z.getBoundingClientRect();return{x:(X.clientX-Y.left)/Y.width*z.width,y:(X.clientY-Y.top)/Y.height*z.height}}function B(X){let Y=X.size??Y2;if(!H)return(X.text?.length??0)*Y*0.6;H.save(),H.font=`600 ${Y}px system-ui, sans-serif`;let G=H.measureText(X.text??"").width;return H.restore(),G}function C(X){if(X.tool==="text"){let Y=X.size??Y2;return{left:X.x1,top:X.y1,right:X.x1+B(X),bottom:X.y1+Y*1.25}}return{left:Math.min(X.x1,X.x2),top:Math.min(X.y1,X.y2),right:Math.max(X.x1,X.x2),bottom:Math.max(X.y1,X.y2)}}function T(X){if(X.tool==="arrow")return[{id:"tail",x:X.x1,y:X.y1,cursor:"move"},{id:"head",x:X.x2,y:X.y2,cursor:"move"}];let Y=C(X);if(X.tool==="text")return[{id:"size",x:Y.right,y:Y.bottom,cursor:"nwse-resize"}];return l5.map((G)=>({id:G.id,x:Y.left+(Y.right-Y.left)*G.fx,y:Y.top+(Y.bottom-Y.top)*G.fy,cursor:G.cursor}))}function x(X){let Y=C(X);return{x:Y.right+z6*q(),y:Y.top-z6*q()}}function m(X,Y,G){let{shaft:K,head:U}=n4({x:Y.x1,y:Y.y1},{x:Y.x2,y:Y.y2},Math.max(10,16*G));if(K)X.lineCap="butt",X.beginPath(),X.moveTo(K.from.x,K.from.y),X.lineTo(K.to.x,K.to.y),X.stroke();X.beginPath(),X.moveTo(U[0].x,U[0].y),X.lineTo(U[1].x,U[1].y),X.lineTo(U[2].x,U[2].y),X.closePath(),X.fill()}function l(X,Y,G){X.save(),X.lineWidth=Math.max(2,3*G),X.strokeStyle=W2,X.fillStyle=W2;let K=C(Y);if(Y.tool==="rect")X.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(Y.tool==="arrow")m(X,Y,G);else if(Y.tool==="highlight")X.fillStyle=c5,X.fillRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(Y.tool==="text"&&Y.text){let U=Y.size??Y2;X.font=`600 ${U}px system-ui, sans-serif`,X.textBaseline="top";let D=U*0.22;X.fillStyle="rgba(255,255,255,0.92)",X.fillRect(K.left-D,K.top-D,K.right-K.left+D*2,K.bottom-K.top+D*2),X.fillStyle=W2,X.fillText(Y.text,K.left,K.top)}X.restore()}function v(X,Y,G){let K=C(Y);X.save(),X.strokeStyle=a4,X.lineWidth=Math.max(1,1.5*G),X.setLineDash([6*G,4*G]),X.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top),X.setLineDash([]);let U=t4*G;for(let b of T(Y))X.fillStyle="#fff",X.strokeStyle=a4,X.lineWidth=Math.max(1,1.5*G),X.beginPath(),X.rect(b.x-U/2,b.y-U/2,U,U),X.fill(),X.stroke();let D=x(Y),I=e4*G;X.beginPath(),X.arc(D.x,D.y,I,0,Math.PI*2),X.fillStyle="#dc2626",X.fill(),X.strokeStyle="#fff",X.lineWidth=Math.max(1.5,2*G),X.beginPath(),X.moveTo(D.x-I*0.4,D.y-I*0.4),X.lineTo(D.x+I*0.4,D.y+I*0.4),X.moveTo(D.x+I*0.4,D.y-I*0.4),X.lineTo(D.x-I*0.4,D.y+I*0.4),X.stroke(),X.restore()}function O(){if(!H)return;let X=q();if(H.clearRect(0,0,z.width,z.height),H.drawImage(J,0,0,z.width,z.height),j.forEach((G,K)=>{if(K!==F0)l(H,G,X)}),V)l(H,V,X);let Y=j[Z];if(Y&&!V)v(H,Y,X)}function O0(X,Y,G,K,U){return Math.abs(X-G)<=U&&Math.abs(Y-K)<=U}function M0(X,Y){let G=j[Z];if(!G)return null;let K=t4*q()/2+3*q();for(let U of T(G))if(O0(X,Y,U.x,U.y,K))return U.id;return null}function y(X,Y){let G=j[Z];if(!G)return!1;let K=x(G);return O0(X,Y,K.x,K.y,e4*q())}function t(X,Y){let G=6*q();for(let K=j.length-1;K>=0;K-=1){let U=j[K];if(U.tool==="arrow"){let I=U.x2-U.x1,b=U.y2-U.y1,s=Math.hypot(I,b)||1,P=Math.max(0,Math.min(1,((X-U.x1)*I+(Y-U.y1)*b)/(s*s)));if(Math.hypot(X-(U.x1+P*I),Y-(U.y1+P*b))<=G+4*q())return K;continue}let D=C(U);if(X>=D.left-G&&X<=D.right+G&&Y>=D.top-G&&Y<=D.bottom+G)return K}return-1}function f(X,Y,G,K,U){if(Y==="tail"){X.x1=G.x1+K,X.y1=G.y1+U;return}if(Y==="head"){X.x2=G.x2+K,X.y2=G.y2+U;return}if(Y==="size"){let _=(G.size??24)+U;X.size=Math.max(10,_);return}let D=C(G),{left:I,top:b,right:s,bottom:P}=D;if(Y.includes("w"))I=Math.min(s-O1,I+K);if(Y.includes("e"))s=Math.max(I+O1,s+K);if(Y.includes("n"))b=Math.min(P-O1,b+U);if(Y.includes("s"))P=Math.max(b+O1,P+U);X.x1=I,X.y1=b,X.x2=s,X.y2=P}function K1(X,Y,G,K){X.x1=Y.x1+G,X.y1=Y.y1+K,X.x2=Y.x2+G,X.y2=Y.y2+K}let R=null,F0=-1,h={x:0,y:0,size:24};function p0(){let X=z.getBoundingClientRect().width;return X>0?X/z.width:1}function G1(X,Y){if(!H)return X.length*Y*0.6;H.save(),H.font=`600 ${Y}px system-ui, sans-serif`;let G=H.measureText(X||" ").width;return H.restore(),G}function L0(){if(!R)return;let X=z.parentElement;if(!X)return;let Y=z.getBoundingClientRect(),G=X.getBoundingClientRect(),K=p0(),U=h.size*K;R.style.left=`${Y.left-G.left+h.x*K}px`,R.style.top=`${Y.top-G.top+h.y*K}px`,R.style.fontSize=`${U}px`,R.style.width=`${Math.max(40,G1(R.value,U)+U)}px`}function j0(X){let Y=R;if(!Y)return;R=null;let G=Y.value.trim(),K=F0;if(F0=-1,Y.remove(),X&&G){if(K>=0&&j[K])j[K].text=G,Z=K;else j.push({tool:"text",x1:h.x,y1:h.y,x2:h.x,y2:h.y,text:G,size:h.size}),Z=j.length-1;$()}else if(K>=0)Z=K;z.focus(),O()}function e(X,Y,G=-1){j0(!0);let K=z.parentElement;if(!K)return;if(getComputedStyle(K).position==="static")K.style.position="relative";let U=G>=0?j[G]:void 0;F0=G,h={x:U?.x1??X,y:U?.y1??Y,size:U?.size??Math.round(24*q())};let D=document.createElement("input");D.type="text",D.className="text-edit",D.value=U?.text??"",D.setAttribute("aria-label","ข้อความบนภาพ"),D.placeholder="ข้อความ",R=D,K.append(D),L0(),D.addEventListener("input",L0),D.addEventListener("keydown",(I)=>{if(I.stopPropagation(),I.key==="Enter")j0(!0);else if(I.key==="Escape")j0(!1)}),requestAnimationFrame(()=>{if(R!==D)return;D.focus(),D.select(),D.addEventListener("blur",()=>j0(!0))}),O()}function o(X){let{x:Y,y:G}=S(X);if(z.setPointerCapture(X.pointerId),y(Y,G)){r();return}let K=M0(Y,G);if(K&&j[Z]){W={grip:K,x:Y,y:G,start:{...j[Z]}};return}if(Q==="text"){if(X.preventDefault(),z.hasPointerCapture(X.pointerId))z.releasePointerCapture(X.pointerId);Q=null,$(),e(Y,G);return}if(Q){V={tool:Q,x1:Y,y1:G,x2:Y,y2:G},Z=-1;return}let U=t(Y,G);Z=U,W=U>=0?{grip:"body",x:Y,y:G,start:{...j[U]}}:null,O()}function S0(X){let{x:Y,y:G}=S(X);if(V){V.x2=Y,V.y2=G,O();return}if(W){let U=j[Z];if(!U)return;let D=Y-W.x,I=G-W.y;if(W.grip==="body")K1(U,W.start,D,I);else f(U,W.grip,W.start,D,I);O();return}if(Q){z.style.cursor="crosshair";return}if(y(Y,G)){z.style.cursor="pointer";return}let K=M0(Y,G);if(K){let U=j[Z]?T(j[Z]).find((D)=>D.id===K):null;z.style.cursor=U?.cursor??"pointer";return}z.style.cursor=t(Y,G)>=0?"move":"default"}function B0(){if(V){if(!(Math.abs(V.x2-V.x1)<J6&&Math.abs(V.y2-V.y1)<J6))j.push(V),Z=j.length-1,Q=null,$();V=null}if(W)W=null,$();O()}function Q0(X){let Y=z.getBoundingClientRect(),G=(X.clientX-Y.left)/Y.width*z.width,K=(X.clientY-Y.top)/Y.height*z.height,U=t(G,K),D=j[U];if(!D||D.tool!=="text")return;X.preventDefault(),e(D.x1,D.y1,U)}function Z0(X){if(Z<0)return;if(X.key==="Delete"||X.key==="Backspace")X.preventDefault(),r();else if(X.key==="Escape")X.preventDefault(),Z=-1,O()}function r(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),O()}return z.addEventListener("pointerdown",o),z.addEventListener("pointermove",S0),z.addEventListener("pointerup",B0),z.addEventListener("pointercancel",B0),z.addEventListener("dblclick",Q0),z.tabIndex=0,z.addEventListener("keydown",Z0),O(),{setTool(X){Q=X,Z=-1,z.style.cursor=X?"crosshair":"default",O()},deleteSelected:r,clear(){j.length=0,Z=-1,$(),O()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let X=document.createElement("canvas");X.width=J.naturalWidth,X.height=J.naturalHeight;let Y=X.getContext("2d");if(!Y)return z.toDataURL("image/png");Y.drawImage(J,0,0);let G=q();for(let K of j)l(Y,K,G);return X.toDataURL("image/png")},destroy(){j0(!1),z.removeEventListener("pointerdown",o),z.removeEventListener("pointermove",S0),z.removeEventListener("pointerup",B0),z.removeEventListener("pointercancel",B0),z.removeEventListener("dblclick",Q0),z.removeEventListener("keydown",Z0)}}}var o5=["keydown","keyup","keypress"];function e0(z){for(let J of o5)z.addEventListener(J,($)=>$.stopPropagation())}var j6=`
33
+ `,H2=null;function y5(){if(typeof document>"u")return null;if(H2?.isConnected)return H2;let J=document.createElement(E5);J.dataset.debugReporter="true";let z=J.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=w5;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),z.append($,j),document.body.append(J),H2=j,j}function v0(J,z="success",$){let j=I1()?M().toast:void 0;if(j){j({message:J,tone:z,...$?{action:$}:{}});return}let Q=y5();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=z;let V=document.createElement("span");V.className="dot";let W=document.createElement("span");W.textContent=J;let U=document.createElement("button");U.type="button",U.className="close",U.textContent="✕",U.setAttribute("aria-label","ปิด");let H=()=>{window.clearTimeout(R),Z.remove()};U.addEventListener("click",H);let R=z==="error"||$?0:window.setTimeout(H,f5);if(Z.append(V,W),$){let B=document.createElement("button");B.type="button",B.className="action",B.textContent=$.label,B.addEventListener("click",()=>{H(),$.onClick()}),Z.append(B)}Z.append(U),Q.append(Z)}function e4(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=z.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:$.slice(0,20)}}function g5(){let J={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return J;let z=performance.memory;if(z)J.memoryUsedMb=Math.round(z.usedJSHeapSize/1024/1024),J.memoryLimitMb=Math.round(z.jsHeapSizeLimit/1024/1024);let[$]=performance.getEntriesByType("navigation");if($)J.domContentLoadedMs=Math.round($.domContentLoadedEventEnd),J.loadEventMs=Math.round($.loadEventEnd);return J}function D2(J,z){if(!J)return z;try{return J()}catch{return z}}function J6(){let J=M(),{pathname:z,search:$,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:z,search:$},module:C1(z),user:D2(J.user,{}),apiHeaders:e0(D2(J.headers,{})),app:{name:Y0().name,version:Y0().version,environment:Y0().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:g5(),extra:D2(J.extra,{})}}var v5=2;function k1(J){let z=o4(),$=S4();return{context:J6(),reason:J.reason,note:J.note,cause:e4(z,$,J.erroredQueries),actionTrail:N4(),network:z,console:$,screenshotDataUrl:J.screenshotDataUrl,screenshotMethod:J.screenshotMethod,replay:t4()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:v5}}}async function P2(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await h5();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let z=await u5();if(z)return{dataUrl:z,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function h5(){let J=null;try{let z={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};J=await navigator.mediaDevices.getDisplayMedia(z);let $=await m5(J);return $?{status:"ok",dataUrl:$}:{status:"error"}}catch(z){if(z instanceof DOMException&&(z.name==="NotAllowedError"||z.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{J?.getTracks().forEach((z)=>z.stop())}}async function m5(J){let z=document.createElement("video");z.srcObject=J,z.muted=!0,z.playsInline=!0,await new Promise((V)=>{let W=!1,U=()=>{if(W)return;W=!0,V()};z.onloadedmetadata=()=>{z.play().then(U).catch(U)},window.setTimeout(U,1500)}),await b5(z);let{videoWidth:$,videoHeight:j}=z;if(!$||!j)return null;let Q=document.createElement("canvas");Q.width=$,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(z,0,0,$,j),z.pause(),z.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function b5(J){return new Promise((z)=>{let $=!1,j=()=>{if($)return;$=!0,z()},Q=J;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function u5(){let J=M().screenshotFallback;if(!J)return null;let z=await J().catch(()=>null);if(!z)return null;try{return await z(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:($)=>!($ instanceof HTMLElement&&$.dataset?.debugReporter==="true")})}catch{return null}}var p5=2000,i5=0.82,d5=3000000;function c5(J){return new Promise((z,$)=>{let j=new Image;j.onload=()=>z(j),j.onerror=()=>$(Error("could not read the screenshot")),j.src=J})}async function x1(J){try{let z=await c5(J),$=Math.max(z.naturalWidth,z.naturalHeight),j=Math.min(1,p5/$),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(z.naturalWidth*j)),Q.height=Math.max(1,Math.round(z.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return J;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(z,0,0,Q.width,Q.height);let V=i5,W=Q.toDataURL("image/jpeg",V);while(W.length>d5&&V>0.4)V-=0.15,W=Q.toDataURL("image/jpeg",V);return W}catch{return J}}var l5=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,o5=/^\d+$/,r5=/^[0-9a-f]{16,}$/i;function z6(J){if(J.reason.type==="manual")return null;let z=J.cause?.failedRequests?.[0];if(!z?.url)return null;let $;try{$=new URL(z.url,"http://x").pathname}catch{$=z.url}let j=$.split("/").map((Z)=>l5.test(Z)||o5.test(Z)||r5.test(Z)?":id":Z).join("/"),Q=z.status??(z.error?"ERR":"?");return`${z.method??"REQ"} ${j} ${Q}`}var $6=2000000;function E1(J){let{screenshotDataUrl:z,replay:$,...j}=J;return JSON.stringify(j).length}function j6(J,z=2000000){if(E1(J)<=z)return J;let $=J.network.map((Q)=>({...Q})),j={...J,network:$};for(let Q of $){if(E1(j)<=z)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&&E1(j)>z)j.network=j.network.slice(1);while(j.console.length>1&&E1(j)>z)j.console=j.console.slice(1);return j}function j1(J){let z="";for(let $=0;$<J.length;$+=32768)z+=String.fromCharCode(...J.subarray($,$+32768));return btoa(z)}var n5=4,s5=2,a5=3,t5=0,e5=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),J3=/^\s*javascript:/i;function z3(J,z){let $=J.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof z==="string"&&J3.test(z)}function Q6(J,z=!1){if(!J)return;for(let $ of Object.keys(J)){let j=J[$];if(z3($,j)){if(z)J[$]=null;else delete J[$];continue}if(typeof j!=="string"||!e5.has($)||!j.includes("?"))continue;J[$]=P0(j)}}function M2(J){if(!J)return;Q6(J.attributes);for(let z of J.childNodes??[])M2(z)}function Z6(J){let z=JSON.parse(JSON.stringify(J));for(let $ of z){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===n5&&typeof j.href==="string")j.href=P0(j.href);else if($.type===s5)M2(j.node);else if($.type===a5&&j.source===t5){for(let Q of j.adds??[])M2(Q.node);for(let Q of j.attributes??[])Q6(Q.attributes,!0)}}return z}var $3="session-replay.json.gz",j3="session-replay.json";function Q3(J){return Boolean(J&&J.events.length>0)}async function Z3(J){if(typeof CompressionStream>"u")return null;try{let z=new Blob([J]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(z).arrayBuffer())}catch{return null}}async function V6(J,z){if(!Q3(J))return{summary:{omitted:"empty"}};let j={seconds:Math.round(J.durationMs/1000),events:J.events.length,startedAt:J.startedAt,endedAt:J.endedAt},Q=Z6(J.events),Z=await X6(Q),V=!1;if(Z.bytes.byteLength>z&&W3(Q))Q=Y3(Q),Z=await X6(Q),V=!0;let{bytes:W,compressed:U}=Z;if(W.byteLength>z)return{summary:{...j,bytes:W.byteLength,omitted:"too-large"}};return{dataUri:`data:${U?"application/gzip":"application/json"};base64,${j1(W)}`,filename:U?$3:j3,summary:{...j,events:Q.length,bytes:W.byteLength,compressed:U,...V?{canvasDropped:V}:{}}}}async function X6(J){let z=new TextEncoder().encode(JSON.stringify({events:J})),$=await Z3(z);return $?{bytes:$,compressed:!0}:{bytes:z,compressed:!1}}var X3=3,W6=2,V3=9;function Y6(J){return J.type===X3&&J.data?.source===V3}function W3(J){return J.some(Y6)||J.some((z)=>z.type===W6&&K6(z.data.node))}function K6(J){if(!J)return!1;if(J.attributes&&"rr_dataURL"in J.attributes)return!0;return(J.childNodes??[]).some(K6)}function G6(J){if(!J)return;if(J.attributes&&"rr_dataURL"in J.attributes)delete J.attributes.rr_dataURL;for(let z of J.childNodes??[])G6(z)}function Y3(J){let z=[];for(let $ of J){if(Y6($))continue;if($.type===W6)G6($.data.node);z.push($)}return z}var K3=new Set([502,503,504]);class K0 extends Error{kind;retryAfter;status;constructor(J,z,$,j){super(J);this.kind=z;this.retryAfter=$;this.status=j;this.name="ReportError"}}function G3(J){let{screenshotDataUrl:z,replay:$,...j}=J;return{dataUri:`data:application/json;base64,${j1(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function F2(){let J=M().identity;if(!J)return{};try{let z=await J();return z?{authorization:`Bearer ${z}`}:{}}catch{return{}}}async function U6(J,z){let $=M(),j=j6(z,$6),{context:Q,note:Z}=j,V=[];if(j.screenshotDataUrl){let C=await x1(j.screenshotDataUrl);V.push({dataUri:C,filename:"screenshot.jpg"})}V.push(G3(j));let W,U=s0();if(U){let C=await V6(j.replay,U.maxBytes);if(W=C.summary,"dataUri"in C)V.push({dataUri:C.dataUri,filename:C.filename})}let H=z6(j),R={title:J,description:Z.trim()||void 0,appName:Y0().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:Y0().name,module:Q.module?.label??""},context:{...H?{signature:H}:{},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:V,...j.reason.fromChat?{fromChat:!0}:{}},B=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await F2()},body:JSON.stringify(R)}).catch(()=>{throw new K0("report never left the browser","offline")});if(!B.ok)throw await B2(B);return await B.json()}async function B2(J){let z=J.headers.get("retry-after"),$=await J.json().then((j)=>j.error).catch(()=>null);if(J.status===429)return new K0("rate limited","rateLimited",z??void 0);if(K3.has(J.status))return new K0("desk unavailable","unavailable");return new K0($??`Report failed (${J.status})`,"rejected",void 0,J.status)}var f1=null,Q1=null,q6=()=>M().host.replace(/\/$/,"");function N2(){return f1}function h0(){if(Q1)return Q1;return Q1=(async()=>{try{let J=await fetch(`${q6()}/ingest/request-types`,{headers:{"x-realm-key":M().realmKey}}),z=J.ok?await J.json():null;f1=Array.isArray(z?.types)?z.types.filter(U3):[]}catch{f1=[],Q1=null}return f1??[]})(),Q1}function U3(J){let z=J;return!!z&&typeof z.id==="string"&&typeof z.name==="string"}async function H6(J){let z=M(),$={};try{$=z.user?.()??{}}catch{$={}}let j=typeof window>"u"?null:window.location,Q={title:J.title,description:J.description.trim()||void 0,ticketTypeId:J.ticketTypeId,appName:Y0().name,category:j?C1(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:J.screenshotDataUrl?[{dataUri:await x1(J.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${q6()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":z.realmKey,...await F2()},body:JSON.stringify(Q)}).catch(()=>{throw new K0("request never left the browser","offline")});if(!Z.ok)throw await B2(Z);return await Z.json()}var Z1=Math.PI/6;function D6(J,z,$){let j=z.x-J.x,Q=z.y-J.y,Z=Math.hypot(j,Q),V=Math.atan2(Q,j),W=[{x:z.x,y:z.y},{x:z.x-$*Math.cos(V-Z1),y:z.y-$*Math.sin(V-Z1)},{x:z.x-$*Math.cos(V+Z1),y:z.y-$*Math.sin(V+Z1)}],U=$*Math.cos(Z1)*0.92;if(Z<=U)return{shaft:null,head:W};return{shaft:{from:J,to:{x:z.x-U*Math.cos(V),y:z.y-U*Math.sin(V)}},head:W}}var _2="#f44336",q3="rgba(250, 204, 21, 0.4)",I2=22,P6="#2563eb",M6=9,F6=11,B6=18,N6=4,w1=8,H3=[{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 _6(J,z,$){let j=[],Q=null,Z=-1,V=null,W=null,U=J.getContext("2d");function H(){let X=J.getBoundingClientRect().width;return X>0?J.width/X:1}function R(X){let Y=J.getBoundingClientRect();return{x:(X.clientX-Y.left)/Y.width*J.width,y:(X.clientY-Y.top)/Y.height*J.height}}function B(X){let Y=X.size??I2;if(!U)return(X.text?.length??0)*Y*0.6;U.save(),U.font=`600 ${Y}px system-ui, sans-serif`;let G=U.measureText(X.text??"").width;return U.restore(),G}function C(X){if(X.tool==="text"){let Y=X.size??I2;return{left:X.x1,top:X.y1,right:X.x1+B(X),bottom:X.y1+Y*1.25}}return{left:Math.min(X.x1,X.x2),top:Math.min(X.y1,X.y2),right:Math.max(X.x1,X.x2),bottom:Math.max(X.y1,X.y2)}}function k(X){if(X.tool==="arrow")return[{id:"tail",x:X.x1,y:X.y1,cursor:"move"},{id:"head",x:X.x2,y:X.y2,cursor:"move"}];let Y=C(X);if(X.tool==="text")return[{id:"size",x:Y.right,y:Y.bottom,cursor:"nwse-resize"}];return H3.map((G)=>({id:G.id,x:Y.left+(Y.right-Y.left)*G.fx,y:Y.top+(Y.bottom-Y.top)*G.fy,cursor:G.cursor}))}function f(X){let Y=C(X);return{x:Y.right+B6*H(),y:Y.top-B6*H()}}function i(X,Y,G){let{shaft:K,head:q}=D6({x:Y.x1,y:Y.y1},{x:Y.x2,y:Y.y2},Math.max(10,16*G));if(K)X.lineCap="butt",X.beginPath(),X.moveTo(K.from.x,K.from.y),X.lineTo(K.to.x,K.to.y),X.stroke();X.beginPath(),X.moveTo(q[0].x,q[0].y),X.lineTo(q[1].x,q[1].y),X.lineTo(q[2].x,q[2].y),X.closePath(),X.fill()}function e(X,Y,G){X.save(),X.lineWidth=Math.max(2,3*G),X.strokeStyle=_2,X.fillStyle=_2;let K=C(Y);if(Y.tool==="rect")X.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(Y.tool==="arrow")i(X,Y,G);else if(Y.tool==="highlight")X.fillStyle=q3,X.fillRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(Y.tool==="text"&&Y.text){let q=Y.size??I2;X.font=`600 ${q}px system-ui, sans-serif`,X.textBaseline="top";let P=q*0.22;X.fillStyle="rgba(255,255,255,0.92)",X.fillRect(K.left-P,K.top-P,K.right-K.left+P*2,K.bottom-K.top+P*2),X.fillStyle=_2,X.fillText(Y.text,K.left,K.top)}X.restore()}function b(X,Y,G){let K=C(Y);X.save(),X.strokeStyle=P6,X.lineWidth=Math.max(1,1.5*G),X.setLineDash([6*G,4*G]),X.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top),X.setLineDash([]);let q=M6*G;for(let h of k(Y))X.fillStyle="#fff",X.strokeStyle=P6,X.lineWidth=Math.max(1,1.5*G),X.beginPath(),X.rect(h.x-q/2,h.y-q/2,q,q),X.fill(),X.stroke();let P=f(Y),_=F6*G;X.beginPath(),X.arc(P.x,P.y,_,0,Math.PI*2),X.fillStyle="#dc2626",X.fill(),X.strokeStyle="#fff",X.lineWidth=Math.max(1.5,2*G),X.beginPath(),X.moveTo(P.x-_*0.4,P.y-_*0.4),X.lineTo(P.x+_*0.4,P.y+_*0.4),X.moveTo(P.x+_*0.4,P.y-_*0.4),X.lineTo(P.x-_*0.4,P.y+_*0.4),X.stroke(),X.restore()}function O(){if(!U)return;let X=H();if(U.clearRect(0,0,J.width,J.height),U.drawImage(z,0,0,J.width,J.height),j.forEach((G,K)=>{if(K!==O0)e(U,G,X)}),V)e(U,V,X);let Y=j[Z];if(Y&&!V)b(U,Y,X)}function k0(X,Y,G,K,q){return Math.abs(X-G)<=q&&Math.abs(Y-K)<=q}function C0(X,Y){let G=j[Z];if(!G)return null;let K=M6*H()/2+3*H();for(let q of k(G))if(k0(X,Y,q.x,q.y,K))return q.id;return null}function v(X,Y){let G=j[Z];if(!G)return!1;let K=f(G);return k0(X,Y,K.x,K.y,F6*H())}function V0(X,Y){let G=6*H();for(let K=j.length-1;K>=0;K-=1){let q=j[K];if(q.tool==="arrow"){let _=q.x2-q.x1,h=q.y2-q.y1,$0=Math.hypot(_,h)||1,D=Math.max(0,Math.min(1,((X-q.x1)*_+(Y-q.y1)*h)/($0*$0)));if(Math.hypot(X-(q.x1+D*_),Y-(q.y1+D*h))<=G+4*H())return K;continue}let P=C(q);if(X>=P.left-G&&X<=P.right+G&&Y>=P.top-G&&Y<=P.bottom+G)return K}return-1}function y(X,Y,G,K,q){if(Y==="tail"){X.x1=G.x1+K,X.y1=G.y1+q;return}if(Y==="head"){X.x2=G.x2+K,X.y2=G.y2+q;return}if(Y==="size"){let I=(G.size??24)+q;X.size=Math.max(10,I);return}let P=C(G),{left:_,top:h,right:$0,bottom:D}=P;if(Y.includes("w"))_=Math.min($0-w1,_+K);if(Y.includes("e"))$0=Math.max(_+w1,$0+K);if(Y.includes("n"))h=Math.min(D-w1,h+q);if(Y.includes("s"))D=Math.max(h+w1,D+q);X.x1=_,X.y1=h,X.x2=$0,X.y2=D}function B1(X,Y,G,K){X.x1=Y.x1+G,X.y1=Y.y1+K,X.x2=Y.x2+G,X.y2=Y.y2+K}let T=null,O0=-1,d={x:0,y:0,size:24};function n0(){let X=J.getBoundingClientRect().width;return X>0?X/J.width:1}function N1(X,Y){if(!U)return X.length*Y*0.6;U.save(),U.font=`600 ${Y}px system-ui, sans-serif`;let G=U.measureText(X||" ").width;return U.restore(),G}function x0(){if(!T)return;let X=J.parentElement;if(!X)return;let Y=J.getBoundingClientRect(),G=X.getBoundingClientRect(),K=n0(),q=d.size*K;T.style.left=`${Y.left-G.left+d.x*K}px`,T.style.top=`${Y.top-G.top+d.y*K}px`,T.style.fontSize=`${q}px`,T.style.width=`${Math.max(40,N1(T.value,q)+q)}px`}function U0(X){let Y=T;if(!Y)return;T=null;let G=Y.value.trim(),K=O0;if(O0=-1,Y.remove(),X&&G){if(K>=0&&j[K])j[K].text=G,Z=K;else j.push({tool:"text",x1:d.x,y1:d.y,x2:d.x,y2:d.y,text:G,size:d.size}),Z=j.length-1;$()}else if(K>=0)Z=K;J.focus(),O()}function W0(X,Y,G=-1){U0(!0);let K=J.parentElement;if(!K)return;if(getComputedStyle(K).position==="static")K.style.position="relative";let q=G>=0?j[G]:void 0;O0=G,d={x:q?.x1??X,y:q?.y1??Y,size:q?.size??Math.round(24*H())};let P=document.createElement("input");P.type="text",P.className="text-edit",P.value=q?.text??"",P.setAttribute("aria-label","ข้อความบนภาพ"),P.placeholder="ข้อความ",T=P,K.append(P),x0(),P.addEventListener("input",x0),P.addEventListener("keydown",(_)=>{if(_.stopPropagation(),_.key==="Enter")U0(!0);else if(_.key==="Escape")U0(!1)}),requestAnimationFrame(()=>{if(T!==P)return;P.focus(),P.select(),P.addEventListener("blur",()=>U0(!0))}),O()}function J0(X){let{x:Y,y:G}=R(X);if(J.setPointerCapture(X.pointerId),v(Y,G)){z0();return}let K=C0(Y,G);if(K&&j[Z]){W={grip:K,x:Y,y:G,start:{...j[Z]}};return}if(Q==="text"){if(X.preventDefault(),J.hasPointerCapture(X.pointerId))J.releasePointerCapture(X.pointerId);Q=null,$(),W0(Y,G);return}if(Q){V={tool:Q,x1:Y,y1:G,x2:Y,y2:G},Z=-1;return}let q=V0(Y,G);Z=q,W=q>=0?{grip:"body",x:Y,y:G,start:{...j[q]}}:null,O()}function E0(X){let{x:Y,y:G}=R(X);if(V){V.x2=Y,V.y2=G,O();return}if(W){let q=j[Z];if(!q)return;let P=Y-W.x,_=G-W.y;if(W.grip==="body")B1(q,W.start,P,_);else y(q,W.grip,W.start,P,_);O();return}if(Q){J.style.cursor="crosshair";return}if(v(Y,G)){J.style.cursor="pointer";return}let K=C0(Y,G);if(K){let q=j[Z]?k(j[Z]).find((P)=>P.id===K):null;J.style.cursor=q?.cursor??"pointer";return}J.style.cursor=V0(Y,G)>=0?"move":"default"}function L0(){if(V){if(!(Math.abs(V.x2-V.x1)<N6&&Math.abs(V.y2-V.y1)<N6))j.push(V),Z=j.length-1,Q=null,$();V=null}if(W)W=null,$();O()}function q0(X){let Y=J.getBoundingClientRect(),G=(X.clientX-Y.left)/Y.width*J.width,K=(X.clientY-Y.top)/Y.height*J.height,q=V0(G,K),P=j[q];if(!P||P.tool!=="text")return;X.preventDefault(),W0(P.x1,P.y1,q)}function H0(X){if(Z<0)return;if(X.key==="Delete"||X.key==="Backspace")X.preventDefault(),z0();else if(X.key==="Escape")X.preventDefault(),Z=-1,O()}function z0(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),O()}return J.addEventListener("pointerdown",J0),J.addEventListener("pointermove",E0),J.addEventListener("pointerup",L0),J.addEventListener("pointercancel",L0),J.addEventListener("dblclick",q0),J.tabIndex=0,J.addEventListener("keydown",H0),O(),{setTool(X){Q=X,Z=-1,J.style.cursor=X?"crosshair":"default",O()},deleteSelected:z0,clear(){j.length=0,Z=-1,$(),O()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let X=document.createElement("canvas");X.width=z.naturalWidth,X.height=z.naturalHeight;let Y=X.getContext("2d");if(!Y)return J.toDataURL("image/png");Y.drawImage(z,0,0);let G=H();for(let K of j)e(Y,K,G);return X.toDataURL("image/png")},destroy(){U0(!1),J.removeEventListener("pointerdown",J0),J.removeEventListener("pointermove",E0),J.removeEventListener("pointerup",L0),J.removeEventListener("pointercancel",L0),J.removeEventListener("dblclick",q0),J.removeEventListener("keydown",H0)}}}var D3=["keydown","keyup","keypress"];function X1(J){for(let z of D3)J.addEventListener(z,($)=>$.stopPropagation())}var I6=`
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 z1="lw-debug-reporter",W0=null;function r5(z,J){if(z instanceof J0){if(z.kind==="offline")return J.failedOffline;if(z.kind==="unavailable")return J.failedUnavailable;if(z.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",z.retryAfter??"60");return z.message||J.failed}return J.failed}var s5=()=>[];var n5=[{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"}),e0(this.root),this.root.addEventListener("keydown",(J)=>{let $=J;if($.key!=="Escape"||$.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;$.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=H4((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let $=document.activeElement;this.returnFocus=$ instanceof HTMLElement&&$!==document.body?$:null;let j=i(M().locale),Q=V2();if(Q===null)E0();if(J.type==="manual"&&Q?.length){this.renderChooser(j,J);return}await this.report(J,j)}renderChooser(J,$){let j=this.shell(J);j.classList.add("narrow"),j.setAttribute("aria-label",J.chooseTitle);let Q=N("div","head"),Z=c("✕","icon");Z.setAttribute("aria-label",J.close),Z.addEventListener("click",()=>this.close()),Q.append(N("h2","",J.chooseTitle),Z);let V=V6("problem",e5,J.kindProblem,J.chooseProblemHint);V.dataset.choose="problem",V.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,J)});let W=V6("request",Z6,J.kindRequest,J.chooseRequestHint);W.dataset.choose="request",W.addEventListener("click",()=>{this.bundle=N1({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:K2()}),this.renderForm(J,$,"request")});let H=N("div","kinds choose");H.append(V,W),H.addEventListener("keydown",(q)=>{if(!Q6.includes(q.key))return;q.preventDefault(),(this.root.activeElement===V?W:V).focus()}),j.append(Q,H),V.focus()}async switchToReport(J,$,j){this.root.replaceChildren();let Q=await j2();if(Q.method==="cancelled"){this.renderForm(J,$,"request",{...j,asking:!0});return}this.bundle=N1({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:K2()}),this.renderForm(J,$,"problem",j)}async report(J,$){let j=await j2();if(j.method==="cancelled"){this.close();return}this.bundle=N1({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:K2()}),this.renderForm($,J,"problem")}close(J=!1){if(J)W0=null;else if(this.keep)W0=this.keep()??W0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let $=this.returnFocus;if(this.returnFocus=null,$?.isConnected)$.focus()}shell(J){let $=document.createElement("style");$.textContent=j6;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",J.title),j.append(Q),this.root.replaceChildren($,j),Q}renderShell(J,$){let j=this.shell(J),Q=N("div","head");Q.append(N("h2","",J.title)),j.append(Q,N("p","status",$))}renderForm(J,$,j,Q){let Z=this.bundle;if(!Z)return;let V=this.shell(J),W=j,H=j==="problem"||!!Z.screenshotDataUrl,q=null,S=N("div","head"),B=N("h2","",J.title),C=c("✕","icon");C.setAttribute("aria-label",J.close),C.addEventListener("click",()=>this.close()),S.append(B,C);let T=N("p","door");T.hidden=!0;let x=N("span"),m=c("","link");m.dataset.switchKind="",m.addEventListener("click",()=>Y(W==="problem"?"request":"problem")),T.append(x,m);let l=N("div","ask");l.hidden=!0;let v=document.createElement("input");v.type="search",v.className="type-search",v.placeholder=J.requestTypeSearch,v.setAttribute("aria-label",J.requestTypeSearch),v.dataset.requestTypeSearch="",v.hidden=!0;let O=N("div","types");O.setAttribute("role","radiogroup"),O.setAttribute("aria-label",J.requestTypeLabel);let O0=N("p","status",J.requestTypeNone);O0.hidden=!0;let M0=N("p","status type-count","");M0.hidden=!0,l.append(L1(J.requestTypeLabel,"",!0),v,O,O0,M0);let y=[],t=()=>{for(let _ of y){let F=_.dataset.requestType===q?.id;_.setAttribute("aria-checked",String(F)),_.tabIndex=F?0:-1}let P=y.find((_)=>_.dataset.requestType===q?.id);if(P&&O.scrollHeight>O.clientHeight){let _=P.offsetTop-O.offsetTop;if(_<O.scrollTop)O.scrollTop=_;else if(_+P.offsetHeight>O.scrollTop+O.clientHeight)O.scrollTop=_+P.offsetHeight-O.clientHeight}},f=document.createElement("input");f.type="text";let K1=L1(""),R=document.createElement("textarea"),F0=L1(""),h=N("div","meta"),{context:p0}=Z,G1=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${J.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,L0=(P,_)=>{let F=document.createElement("div"),L=document.createElement("b");L.textContent=`${P}: `;let k=document.createTextNode(_);return F.append(L,k),h.append(F),{b:L,v:k}};L0(J.reporter,`${p0.user.fullName??"—"} (${p0.user.email??"—"})`),L0(J.page,p0.route.href);let j0=L0(J.captured,G1),e=document.createElement("label");e.className="shot-choice",e.hidden=!0;let o=document.createElement("input");o.type="checkbox",o.checked=!0,o.dataset.requestShot="",e.append(o,document.createTextNode(` ${J.requestWithShot}`));let S0=Z.screenshotDataUrl?this.screenshotSection(J,Z.screenshotDataUrl):[N("p","status",J.noScreenshot)],B0=Z.screenshotDataUrl?S0[0]:null;if(!Z.screenshotDataUrl)e.replaceChildren();let Q0=N("p","status",""),Z0=c(J.submit,"primary"),r=()=>{Z0.disabled=f.value.trim().length===0||W==="request"&&!q};f.addEventListener("input",r);let X=()=>{let P=W==="request";if(B.textContent=P?J.requestTitle:J.title,V.setAttribute("aria-label",P?J.requestTitle:J.title),x.textContent=`${P?J.problemInstead:J.askInstead} `,m.textContent=P?H?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,l.hidden=!P,S1(K1,P?J.requestSummaryLabel:J.summaryLabel,P?"":J.summaryRequired,!0),f.placeholder=P?J.requestSummaryPlaceholder:J.summaryPlaceholder,S1(F0,P?J.requestDetailLabel:J.detailLabel),R.placeholder=P?J.requestDetailPlaceholder:J.detailPlaceholder,j0.b.textContent=`${P?J.requestLeaves:J.captured}: `,j0.v.textContent=P?J.requestLeavesWhat:G1,e.hidden=!P||!Z.screenshotDataUrl,B0)S1(B0,P?J.requestAnnotateHint:J.annotateHint);for(let _ of S0)_.classList.toggle("dropped",P&&!o.checked),_.hidden=P&&!Z.screenshotDataUrl;Z0.textContent=P?J.requestSubmit:J.submit,r()};o.addEventListener("change",X);let Y=(P)=>{if(P===W)return;if(P==="problem"&&!H){this.switchToReport(J,$,{title:f.value,detail:R.value,asking:!1,typeId:q?.id??null});return}W=P,X()},G=(P)=>{if(this.bundle!==Z||$.type!=="manual"||!P.length)return;q=P[0],y.length=0;for(let F of P){let L=c("","type");L.setAttribute("role","radio"),L.dataset.requestType=F.id;let k=N("span","type-body");if(k.append(N("b","",F.name)),F.description)k.append(N("span","type-hint",F.description));if(F.targetHours){let R0=N("span","type-due");R0.append(R1(z3),document.createTextNode(J.requestTarget.replace("{time}",t5(J,F.targetHours)))),k.append(R0)}L.append(R1(Z6),k),L.addEventListener("click",()=>{q=F,t(),r()}),y.push(L)}O.replaceChildren(...y),O.onkeydown=(F)=>{if(!Q6.includes(F.key)||!q)return;F.preventDefault();let L=P.filter((N0,a6)=>!y[a6].hidden);if(!L.length)return;let k=L.findIndex((N0)=>N0.id===q.id),R0=F.key==="ArrowUp"||F.key==="ArrowLeft"?-1:1;q=L[k<0?0:(k+R0+L.length)%L.length],t(),y.find((N0)=>N0.dataset.requestType===q.id)?.focus()},O.classList.toggle("long",P.length>=G2),v.hidden=P.length<G2;let _=(F)=>{M0.hidden=P.length<G2||F===0,M0.textContent=J.requestTypeCount.replace("{n}",String(F))};_(P.length),v.oninput=()=>{let F=v.value.trim().toLowerCase(),L=null;if(P.forEach((k,R0)=>{let N0=!F||`${k.name} ${k.description}`.toLowerCase().includes(F);if(y[R0].hidden=!N0,N0&&!L)L=k}),O0.hidden=!!L,_(y.filter((k)=>!k.hidden).length),L&&q&&y[P.indexOf(q)].hidden)q=L;t(),r()},v.onkeydown=(F)=>{if(F.key==="ArrowDown"||F.key==="Enter")F.preventDefault(),y.find((L)=>L.dataset.requestType===q?.id&&!L.hidden)?.focus()},t(),T.hidden=!1,X()},K=Q??(W0&&(W0.title||W0.detail)?W0:null),U=N("p","draft");if(U.hidden=!K||!!Q,K){f.value=K.title,R.value=K.detail;let P=c(J.draftClear,"link");P.dataset.draftClear="",P.addEventListener("click",()=>{f.value="",R.value="",W0=null,U.hidden=!0,r(),f.focus()}),U.append(document.createTextNode(`${J.draftRestored} · `),P)}let D=V2(),I=(P)=>{if(G(P),W!=="request"||T.hidden||!K?.typeId)return;let _=P.find((F)=>F.id===K.typeId);if(_)q=_,t()};if(D)I(D);else if($.type==="manual")E0().then(I);this.keep=()=>({title:f.value,detail:R.value,asking:W==="request",typeId:q?.id??null}),V.append(S,T,U,l,K1,f,F0,R,h,e,...S0);let b=N("div","foot"),s=c(J.close);s.addEventListener("click",()=>this.close()),b.append(s,Q0,N("span","grow"),Z0),V.append(b),X(),Z0.addEventListener("click",async()=>{Z0.disabled=!0,Q0.dataset.tone="",Q0.textContent=J.submitting;let P=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(W==="request"&&q){let L=await s4({ticketTypeId:q.id,title:f.value.trim(),description:R.value,screenshotDataUrl:o.checked?P():null}),k=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:L,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),k)x0(`${J.requestSubmitted} — #${L.number}`,"success");return}let _=await o4(f.value.trim(),{...Z,note:R.value,screenshotDataUrl:P()}),F=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:_,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),F)x0(`${J.submitted} — #${_.number}`,"success")}catch(_){let F=r5(_,J);Q0.dataset.tone="error",Q0.textContent=F,x0(F,"error"),r()}}),f.focus()}screenshotSection(J,$){let j=L1(J.annotateHint),Q=N("div","tools"),Z=document.createElement("canvas"),V=N("div","shot");V.append(Z);let W=[],H=(C)=>{for(let T of W)T.setAttribute("aria-pressed",String(T===C))};for(let{tool:C,key:T}of n5){let x=c(J[T]);x.setAttribute("aria-pressed","false"),x.addEventListener("click",()=>{let m=x.getAttribute("aria-pressed")==="true";H(m?null:x),this.annotator?.setTool(m?null:C)}),W.push(x),Q.append(x)}Q.append(N("span","sep"));let q=c(J.deleteSelected);q.addEventListener("click",()=>this.annotator?.deleteSelected());let S=c(J.clearAll);S.addEventListener("click",()=>{this.annotator?.clear(),H(null)}),Q.append(q,S);let B=new Image;return B.onload=()=>{Z.width=B.naturalWidth,Z.height=B.naturalHeight,this.annotator=$6(Z,B,()=>{H(null),q.disabled=!this.annotator?.hasSelection()})},B.src=$,[j,Q,N("p","status",J.annotateHelp),V]}}}function K2(){try{return s5()}catch{return[]}}function N(z,J="",$=""){let j=document.createElement(z);if(J)j.className=J;if($)j.textContent=$;return j}function t5(z,J){return J>=24&&J%24===0?z.days.replace("{n}",String(J/24)):z.hours.replace("{n}",String(J))}var Q6=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],G2=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"}]],Z6=[["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"}]],z3=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],J3=[["path",{d:"M20 6 9 17l-5-5"}]],X6="http://www.w3.org/2000/svg";function V6(z,J,$,j){let Q=c("","kind");Q.dataset.kind=z;let Z=N("span","kind-top");return Z.append(R1(J),N("b","",$)),Q.append(Z,N("span","kind-hint",j),R1(J3,"tick")),Q}function R1(z,J="icon"){let $=document.createElementNS(X6,"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:J}))$.setAttribute(j,Q);for(let[j,Q]of z){let Z=document.createElementNS(X6,j);for(let[V,W]of Object.entries(Q))Z.setAttribute(V,W);$.append(Z)}return $}function c(z,J=""){let $=document.createElement("button");if($.type="button",$.textContent=z,J)$.className=J;return $}function L1(z,J="",$=!1){return S1(document.createElement("label"),z,J,$)}function S1(z,J,$="",j=!1){if(z.replaceChildren(document.createTextNode(J)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",z.append(Q)}if($){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${$}`,z.append(Q)}return z}function W6(){if(typeof window>"u"||customElements.get(z1))return;customElements.define(z1,a5())}var Y6=138.23,I7=`
184
+ `;var V1="lw-debug-reporter",M0=null;function P3(J,z){if(J instanceof K0){if(J.kind==="offline")return z.failedOffline;if(J.kind==="unavailable")return z.failedUnavailable;if(J.kind==="rateLimited")return z.failedTooMany.replace("{seconds}",J.retryAfter??"60");return J.message||z.failed}return z.failed}var M3=()=>[];var F3=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function B3(){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"}),X1(this.root),this.root.addEventListener("keydown",(z)=>{let $=z;if($.key!=="Escape"||$.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;$.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=x4((z)=>void this.open(z))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(z){if(this.busy)return;this.busy=!0;let $=document.activeElement;this.returnFocus=$ instanceof HTMLElement&&$!==document.body?$:null;let j=l(M().locale),Q=N2();if(Q===null)h0();if(z.type==="manual"&&Q?.length){this.renderChooser(j,z);return}await this.report(z,j)}renderChooser(z,$){let j=this.shell(z);j.classList.add("narrow"),j.setAttribute("aria-label",z.chooseTitle);let Q=N("div","head"),Z=n("✕","icon");Z.setAttribute("aria-label",z.close),Z.addEventListener("click",()=>this.close()),Q.append(N("h2","",z.chooseTitle),Z);let V=S6("problem",_3,z.kindProblem,z.chooseProblemHint);V.dataset.choose="problem",V.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,z)});let W=S6("request",O6,z.kindRequest,z.chooseRequestHint);W.dataset.choose="request",W.addEventListener("click",()=>{this.bundle=k1({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:C2()}),this.renderForm(z,$,"request")});let U=N("div","kinds choose");U.append(V,W),U.addEventListener("keydown",(H)=>{if(!C6.includes(H.key))return;H.preventDefault(),(this.root.activeElement===V?W:V).focus()}),j.append(Q,U),V.focus()}async switchToReport(z,$,j){this.root.replaceChildren();let Q=await P2();if(Q.method==="cancelled"){this.renderForm(z,$,"request",{...j,asking:!0});return}this.bundle=k1({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:C2()}),this.renderForm(z,$,"problem",j)}async report(z,$){let j=await P2();if(j.method==="cancelled"){this.close();return}this.bundle=k1({reason:z,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:C2()}),this.renderForm($,z,"problem")}close(z=!1){if(z)M0=null;else if(this.keep)M0=this.keep()??M0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let $=this.returnFocus;if(this.returnFocus=null,$?.isConnected)$.focus()}shell(z){let $=document.createElement("style");$.textContent=I6;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",z.title),j.append(Q),this.root.replaceChildren($,j),Q}renderShell(z,$){let j=this.shell(z),Q=N("div","head");Q.append(N("h2","",z.title)),j.append(Q,N("p","status",$))}renderForm(z,$,j,Q){let Z=this.bundle;if(!Z)return;let V=this.shell(z),W=j,U=j==="problem"||!!Z.screenshotDataUrl,H=null,R=N("div","head"),B=N("h2","",z.title),C=n("✕","icon");C.setAttribute("aria-label",z.close),C.addEventListener("click",()=>this.close()),R.append(B,C);let k=N("p","door");k.hidden=!0;let f=N("span"),i=n("","link");i.dataset.switchKind="",i.addEventListener("click",()=>Y(W==="problem"?"request":"problem")),k.append(f,i);let e=N("div","ask");e.hidden=!0;let b=document.createElement("input");b.type="search",b.className="type-search",b.placeholder=z.requestTypeSearch,b.setAttribute("aria-label",z.requestTypeSearch),b.dataset.requestTypeSearch="",b.hidden=!0;let O=N("div","types");O.setAttribute("role","radiogroup"),O.setAttribute("aria-label",z.requestTypeLabel);let k0=N("p","status",z.requestTypeNone);k0.hidden=!0;let C0=N("p","status type-count","");C0.hidden=!0,e.append(y1(z.requestTypeLabel,"",!0),b,O,k0,C0);let v=[],V0=()=>{for(let I of v){let F=I.dataset.requestType===H?.id;I.setAttribute("aria-checked",String(F)),I.tabIndex=F?0:-1}let D=v.find((I)=>I.dataset.requestType===H?.id);if(D&&O.scrollHeight>O.clientHeight){let I=D.offsetTop-O.offsetTop;if(I<O.scrollTop)O.scrollTop=I;else if(I+D.offsetHeight>O.scrollTop+O.clientHeight)O.scrollTop=I+D.offsetHeight-O.clientHeight}},y=document.createElement("input");y.type="text";let B1=y1(""),T=document.createElement("textarea"),O0=y1(""),d=N("div","meta"),{context:n0}=Z,N1=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${z.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,x0=(D,I)=>{let F=document.createElement("div"),L=document.createElement("b");L.textContent=`${D}: `;let x=document.createTextNode(I);return F.append(L,x),d.append(F),{b:L,v:x}};x0(z.reporter,`${n0.user.fullName??"—"} (${n0.user.email??"—"})`),x0(z.page,n0.route.href);let U0=x0(z.captured,N1),W0=document.createElement("label");W0.className="shot-choice",W0.hidden=!0;let J0=document.createElement("input");J0.type="checkbox",J0.checked=!0,J0.dataset.requestShot="",W0.append(J0,document.createTextNode(` ${z.requestWithShot}`));let E0=Z.screenshotDataUrl?this.screenshotSection(z,Z.screenshotDataUrl):[N("p","status",z.noScreenshot)],L0=Z.screenshotDataUrl?E0[0]:null;if(!Z.screenshotDataUrl)W0.replaceChildren();let q0=N("p","status",""),H0=n(z.submit,"primary"),z0=()=>{H0.disabled=y.value.trim().length===0||W==="request"&&!H};y.addEventListener("input",z0);let X=()=>{let D=W==="request";if(B.textContent=D?z.requestTitle:z.title,V.setAttribute("aria-label",D?z.requestTitle:z.title),f.textContent=`${D?z.problemInstead:z.askInstead} `,i.textContent=D?U?z.problemInsteadAction:z.problemInsteadShare:z.askInsteadAction,e.hidden=!D,g1(B1,D?z.requestSummaryLabel:z.summaryLabel,D?"":z.summaryRequired,!0),y.placeholder=D?z.requestSummaryPlaceholder:z.summaryPlaceholder,g1(O0,D?z.requestDetailLabel:z.detailLabel),T.placeholder=D?z.requestDetailPlaceholder:z.detailPlaceholder,U0.b.textContent=`${D?z.requestLeaves:z.captured}: `,U0.v.textContent=D?z.requestLeavesWhat:N1,W0.hidden=!D||!Z.screenshotDataUrl,L0)g1(L0,D?z.requestAnnotateHint:z.annotateHint);for(let I of E0)I.classList.toggle("dropped",D&&!J0.checked),I.hidden=D&&!Z.screenshotDataUrl;H0.textContent=D?z.requestSubmit:z.submit,z0()};J0.addEventListener("change",X);let Y=(D)=>{if(D===W)return;if(D==="problem"&&!U){this.switchToReport(z,$,{title:y.value,detail:T.value,asking:!1,typeId:H?.id??null});return}W=D,X()},G=(D)=>{if(this.bundle!==Z||$.type!=="manual"||!D.length)return;H=D[0],v.length=0;for(let F of D){let L=n("","type");L.setAttribute("role","radio"),L.dataset.requestType=F.id;let x=N("span","type-body");if(x.append(N("b","",F.name)),F.description)x.append(N("span","type-hint",F.description));if(F.targetHours){let f0=N("span","type-due");f0.append(v1(I3),document.createTextNode(z.requestTarget.replace("{time}",N3(z,F.targetHours)))),x.append(f0)}L.append(v1(O6),x),L.addEventListener("click",()=>{H=F,V0(),z0()}),v.push(L)}O.replaceChildren(...v),O.onkeydown=(F)=>{if(!C6.includes(F.key)||!H)return;F.preventDefault();let L=D.filter((S0,B8)=>!v[B8].hidden);if(!L.length)return;let x=L.findIndex((S0)=>S0.id===H.id),f0=F.key==="ArrowUp"||F.key==="ArrowLeft"?-1:1;H=L[x<0?0:(x+f0+L.length)%L.length],V0(),v.find((S0)=>S0.dataset.requestType===H.id)?.focus()},O.classList.toggle("long",D.length>=O2),b.hidden=D.length<O2;let I=(F)=>{C0.hidden=D.length<O2||F===0,C0.textContent=z.requestTypeCount.replace("{n}",String(F))};I(D.length),b.oninput=()=>{let F=b.value.trim().toLowerCase(),L=null;if(D.forEach((x,f0)=>{let S0=!F||`${x.name} ${x.description}`.toLowerCase().includes(F);if(v[f0].hidden=!S0,S0&&!L)L=x}),k0.hidden=!!L,I(v.filter((x)=>!x.hidden).length),L&&H&&v[D.indexOf(H)].hidden)H=L;V0(),z0()},b.onkeydown=(F)=>{if(F.key==="ArrowDown"||F.key==="Enter")F.preventDefault(),v.find((L)=>L.dataset.requestType===H?.id&&!L.hidden)?.focus()},V0(),k.hidden=!1,X()},K=Q??(M0&&(M0.title||M0.detail)?M0:null),q=N("p","draft");if(q.hidden=!K||!!Q,K){y.value=K.title,T.value=K.detail;let D=n(z.draftClear,"link");D.dataset.draftClear="",D.addEventListener("click",()=>{y.value="",T.value="",M0=null,q.hidden=!0,z0(),y.focus()}),q.append(document.createTextNode(`${z.draftRestored} · `),D)}let P=N2(),_=(D)=>{if(G(D),W!=="request"||k.hidden||!K?.typeId)return;let I=D.find((F)=>F.id===K.typeId);if(I)H=I,V0()};if(P)_(P);else if($.type==="manual")h0().then(_);this.keep=()=>({title:y.value,detail:T.value,asking:W==="request",typeId:H?.id??null}),V.append(R,k,q,e,B1,y,O0,T,d,W0,...E0);let h=N("div","foot"),$0=n(z.close);$0.addEventListener("click",()=>this.close()),h.append($0,q0,N("span","grow"),H0),V.append(h),X(),H0.addEventListener("click",async()=>{H0.disabled=!0,q0.dataset.tone="",q0.textContent=z.submitting;let D=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(W==="request"&&H){let L=await H6({ticketTypeId:H.id,title:y.value.trim(),description:T.value,screenshotDataUrl:J0.checked?D():null}),x=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:L,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),x)v0(`${z.requestSubmitted} — #${L.number}`,"success");return}let I=await U6(y.value.trim(),{...Z,note:T.value,screenshotDataUrl:D()}),F=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:I,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),F)v0(`${z.submitted} — #${I.number}`,"success")}catch(I){let F=P3(I,z);q0.dataset.tone="error",q0.textContent=F,v0(F,"error"),z0()}}),y.focus()}screenshotSection(z,$){let j=y1(z.annotateHint),Q=N("div","tools"),Z=document.createElement("canvas"),V=N("div","shot");V.append(Z);let W=[],U=(C)=>{for(let k of W)k.setAttribute("aria-pressed",String(k===C))};for(let{tool:C,key:k}of F3){let f=n(z[k]);f.setAttribute("aria-pressed","false"),f.addEventListener("click",()=>{let i=f.getAttribute("aria-pressed")==="true";U(i?null:f),this.annotator?.setTool(i?null:C)}),W.push(f),Q.append(f)}Q.append(N("span","sep"));let H=n(z.deleteSelected);H.addEventListener("click",()=>this.annotator?.deleteSelected());let R=n(z.clearAll);R.addEventListener("click",()=>{this.annotator?.clear(),U(null)}),Q.append(H,R);let B=new Image;return B.onload=()=>{Z.width=B.naturalWidth,Z.height=B.naturalHeight,this.annotator=_6(Z,B,()=>{U(null),H.disabled=!this.annotator?.hasSelection()})},B.src=$,[j,Q,N("p","status",z.annotateHelp),V]}}}function C2(){try{return M3()}catch{return[]}}function N(J,z="",$=""){let j=document.createElement(J);if(z)j.className=z;if($)j.textContent=$;return j}function N3(J,z){return z>=24&&z%24===0?J.days.replace("{n}",String(z/24)):J.hours.replace("{n}",String(z))}var C6=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],O2=7,_3=[["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"}]],O6=[["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"}]],I3=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],C3=[["path",{d:"M20 6 9 17l-5-5"}]],L6="http://www.w3.org/2000/svg";function S6(J,z,$,j){let Q=n("","kind");Q.dataset.kind=J;let Z=N("span","kind-top");return Z.append(v1(z),N("b","",$)),Q.append(Z,N("span","kind-hint",j),v1(C3,"tick")),Q}function v1(J,z="icon"){let $=document.createElementNS(L6,"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(L6,j);for(let[V,W]of Object.entries(Q))Z.setAttribute(V,W);$.append(Z)}return $}function n(J,z=""){let $=document.createElement("button");if($.type="button",$.textContent=J,z)$.className=z;return $}function y1(J,z="",$=!1){return g1(document.createElement("label"),J,z,$)}function g1(J,z,$="",j=!1){if(J.replaceChildren(document.createTextNode(z)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",J.append(Q)}if($){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${$}`,J.append(Q)}return J}function R6(){if(typeof window>"u"||customElements.get(V1))return;customElements.define(V1,B3())}var T6=138.23,JJ=`
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: ${Y6}; stroke-dashoffset: 0;
214
+ stroke-dasharray: ${T6}; stroke-dashoffset: 0;
215
215
  animation: deplete var(--secs, 3s) linear forwards;
216
216
  }
217
- @keyframes deplete { to { stroke-dashoffset: ${Y6}; } }
217
+ @keyframes deplete { to { stroke-dashoffset: ${T6}; } }
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,14 +258,14 @@ 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
- `;var $3="/sso";function j3(z,J,$,j){let Q=new URL($3,z.endsWith("/")?z:`${z}/`);if(Q.searchParams.set("realm",J),Q.searchParams.set("token",$),j)Q.searchParams.set("return",j);return Q.toString()}class H2 extends Error{constructor(z="No identity provider is configured, or nobody is signed in"){super(z);this.name="NoIdentityError"}}async function Q3(z){let J=M();if(!J.identity)throw new H2;let $=await J.identity();if(!$)throw new H2;return j3(J.host,J.realmKey,$,z)}var K6=Q3;var Z3="lw-call-ring",X3=`
261
+ `;var O3="/sso";function L3(J,z,$,j){let Q=new URL(O3,J.endsWith("/")?J:`${J}/`);if(Q.searchParams.set("realm",z),Q.searchParams.set("token",$),j)Q.searchParams.set("return",j);return Q.toString()}class L2 extends Error{constructor(J="No identity provider is configured, or nobody is signed in"){super(J);this.name="NoIdentityError"}}async function S3(J){let z=M();if(!z.identity)throw new L2;let $=await z.identity();if(!$)throw new L2;return L3(z.host,z.realmKey,$,J)}var A6=S3;var h1='"Inter Variable", "Noto Sans Thai Variable", "IBM Plex Sans Thai", -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif';function R3(J){let z=(J??"").trim();return!z||/^(?:"?Times New Roman"?|"?Times"?|serif)$/i.test(z)?"":z}function m1(J){if(!J||typeof document>"u"||!document.body)return;let z="";try{z=R3(getComputedStyle(document.body).fontFamily)}catch{}if(z)J.style.setProperty("--lw-host-font",z);else J.style.removeProperty("--lw-host-font")}var T3="lw-call-ring",A3=`
262
262
  :host { all: initial; }
263
263
  .card {
264
264
  position: fixed; right: 16px; bottom: calc(16px + var(--lw-chat-lift, 0px)); z-index: 2147483002;
265
265
  width: min(352px, calc(100vw - 32px)); box-sizing: border-box;
266
266
  padding: 16px; border-radius: 16px; background: #fff; color: #1a1a1e;
267
267
  border: 1px solid #e8e8ec; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
268
- font-family: "Inter Variable", "Noto Sans Thai Variable", "IBM Plex Sans Thai", -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
268
+ font-family: var(--lw-host-font, ${h1});
269
269
  animation: in 200ms cubic-bezier(0.16, 1, 0.3, 1);
270
270
  }
271
271
  @media (max-width: 639px) { .card { right: 8px; left: 8px; bottom: calc(8px + var(--lw-chat-lift, 0px)); width: auto; } }
@@ -309,30 +309,55 @@ h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.5; color: #1a1
309
309
  @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
310
310
  @keyframes spin { to { transform: rotate(360deg); } }
311
311
  @media (prefers-reduced-motion: reduce) { .card { animation: none; } .icon::after { animation: none; opacity: 0; } .spin { animation: none; } }
312
- `,T1=(z)=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${z}</svg>`,G6=T1('<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"/>'),V3=T1('<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"/>'),W3=T1('<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'),Y3=T1('<path d="M21 12a9 9 0 1 1-6.219-8.56"/>').replace("<svg ",'<svg class="spin" '),E=null,$0=null,w0=null;function K3(z,J){return z.replace("{key}",J.ticketKey).replace("{title}",J.ticketTitle)}var f0=()=>i(M().locale);function G3(){if(typeof document>"u")return null;if(E?.isConnected)return E.shadowRoot;E=document.createElement(Z3),E.dataset.debugReporter="true";let z=E.attachShadow({mode:"open"});return e0(z),document.body.append(E),z}function A1(z,J,$,j){let Q=document.createElement("button");return Q.type="button",Q.className=z,Q.innerHTML=J,Q.dataset.lwRing=$,Q.onclick=j,Q}var J1=(z)=>{let J=document.createElement("span");return J.textContent=z,J.outerHTML};function U6(z,J,$,j,Q){let Z=f0();z.innerHTML="";let V=document.createElement("style");V.textContent=X3;let W=document.createElement("div");W.className="card",W.setAttribute("role","alertdialog"),W.setAttribute("aria-label",Z.ringTitle),W.dataset.lwCallRing=J.id,W.dataset.lwRingMode=j;let H=document.createElement("div");H.className="head";let q=document.createElement("span");q.className="icon",q.innerHTML=G6;let S=document.createElement("div");S.className="words";let B=document.createElement("h2");B.textContent=Z.ringTitle;let C=document.createElement("p");C.className="about",C.textContent=K3(Z.ringAbout,J),C.title=C.textContent,S.append(B,C),H.append(q,S);let T=document.createElement("p");T.className="how",T.textContent=Q??(j==="frame"?Z.ringHint:Z.ringHow);let x=document.createElement("div");x.className="actions";let m=A1("decline",V3+J1(Z.ringDecline),"decline",()=>$.decline());if(W.append(H,T),j==="frame"&&$.answer){if($.voice)W.append(A1("test",W3+J1(Z.ringTest),"test",()=>$.voice?.()));let l=A1("answer",G6+J1(Z.ringAnswer),"answer",()=>$.answer?.());x.append(m,l)}else x.append(m,A1("open",J1(Z.ringOpen),"open",()=>$.open()));W.append(x),z.append(V,W)}function k1(z,J,$="portal"){if($0===z.id&&E?.isConnected)return;let j=G3();if(!j)return;if($0=z.id,U6(j,z,J,$),H3(),w0===null)w0=document.title,document.title=`${f0().ringTab} — ${w0}`}function q6(z){let J=E?.shadowRoot;if(!J||$0!==z)return;let $=J.querySelector(".answer");if($)$.innerHTML=Y3+J1(f0().ringAnswering),$.disabled=!0;let j=J.querySelector(".decline");if(j)j.disabled=!0}function P6(z,J){let $=E?.isConnected?E.shadowRoot:null;if(!$||$0!==z.id)return k1(z,J,"portal");E.style.display="",U6($,z,J,"portal",f0().ringFallback)}function x1(z){let J=E?.shadowRoot;if(!J)return;q2(),F6();let $=f0(),j=J.querySelector(".how"),Q=J.querySelector(".actions");if(j)if(j.textContent="",z){let Z=document.createElement("a");Z.href=z,Z.target="_blank",Z.rel="noopener",Z.textContent=$.ringBlocked,Z.dataset.lwRing="link",Z.onclick=()=>window.setTimeout(()=>x1(),0),j.append(Z)}else j.textContent=$.ringOpened;if(Q){Q.innerHTML="";let Z=document.createElement("button");Z.type="button",Z.className="close",Z.textContent=$.ringClose,Z.dataset.lwRing="close",Z.onclick=()=>y0(),Q.append(Z)}}function D6(z,J=!0){if(!E?.isConnected||$0!==z)return;let $=E;if(clearTimeout(H6),!J){$.style.display="",$.style.opacity="";return}$.style.transition="opacity 150ms ease-out",$.style.opacity="0",H6=setTimeout(()=>{if($.style.opacity==="0")$.style.display="none"},160)}var H6;function y0(z){if(z&&$0&&z!==$0)return;q2(),F6(),E?.remove(),E=null,$0=null}function M6(){return E?.isConnected?$0:null}function F6(){if(w0===null||typeof document>"u")return;if(document.title.startsWith(f0().ringTab))document.title=w0;w0=null}var Y0=null,U2;function H3(){q2();let z=window,J=z.AudioContext??z.webkitAudioContext;if(!J)return;try{let j=Y0??new J;Y0=j,j.resume?.().catch(()=>{return})}catch{return}let $=()=>{if(!Y0||Y0.state!=="running")return;let j=Y0.currentTime;for(let[Q,Z]of[660,880].entries()){let V=Y0.createOscillator(),W=Y0.createGain();V.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),V.connect(W).connect(Y0.destination),V.start(j+Q*0.22),V.stop(j+Q*0.22+0.21)}};$(),U2=setInterval($,2200)}function q2(){clearInterval(U2),U2=void 0}var U3=/^[A-Za-z0-9_-]{1,32}$/,q3=/^#[0-9a-fA-F]{6}$/,P3=["pen","rect","laser"],B6=(z)=>z<0?0:z>1?1:z;function N6(z,J){if(!Array.isArray(z)||z.length<J||z.length>64)return null;let $=[];for(let j of z){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;$.push([B6(Q),B6(Z)])}return $}function E1(z){if(!z||typeof z!=="object")return null;let J=z;if(J.op==="clear")return{op:"clear"};if(typeof J.id!=="string"||!U3.test(J.id))return null;if(J.op==="end")return{op:"end",id:J.id};if(J.op==="add"){let $=N6(J.pts,1);return $?{op:"add",id:J.id,pts:$}:null}if(J.op==="begin"){if(!P3.includes(J.kind)||typeof J.color!=="string"||!q3.test(J.color))return null;let $=N6(J.pts,1);return $?{op:"begin",id:J.id,kind:J.kind,color:J.color,pts:$}:null}return null}function P2(z,J){if(z.endedAt!==null)return z.endedAt;return J-z.lastAt>20000?z.lastAt:null}function I6(z,J,$){if(J===null)return 1;let j=$-J;if(z==="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(z,J=Date.now()){if(z.op==="clear"){this.marks.clear();return}if(z.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete(z.id),this.marks.set(z.id,{kind:z.kind,color:z.color,pts:z.pts.map(([j,Q])=>({x:j,y:Q,t:J})),endedAt:null,lastAt:J});return}let $=this.marks.get(z.id);if(!$||P2($,J)!==null)return;if(z.op==="end"){$.endedAt=J;return}if($.lastAt=J,$.kind==="rect"){let[j,Q]=z.pts[z.pts.length-1];$.pts=[$.pts[0],{x:j,y:Q,t:J}];return}for(let[j,Q]of z.pts)$.pts.push({x:j,y:Q,t:J});if($.pts.length>4000)$.pts.splice(0,$.pts.length-4000)}alive(z=Date.now()){for(let[J,$]of this.marks)if(I6($.kind,P2($,z),z)<=0)this.marks.delete(J);return this.marks.size>0}get size(){return this.marks.size}draw(z,J,$,j=Date.now()){z.clearRect(0,0,J,$);let Q=Math.max(1,Math.min(J,$));for(let Z of this.marks.values()){let V=I6(Z.kind,P2(Z,j),j);if(V<=0||!Z.pts.length)continue;if(z.save(),z.lineCap="round",z.lineJoin="round",Z.kind==="pen")M3(z,Z,J,$,Math.max(3,Q*0.0045),V);else if(Z.kind==="rect")F3(z,Z,J,$,Math.max(2.5,Q*0.003),V);else B3(z,Z,J,$,Math.max(6,Q*0.008),V,j);z.restore()}}}function D3(z,J,$,j){if(z.beginPath(),z.moveTo(J[0].x*$,J[0].y*j),J.length===1){z.lineTo(J[0].x*$+0.01,J[0].y*j);return}for(let Z=1;Z<J.length-1;Z++){let V=J[Z],W=J[Z+1];z.quadraticCurveTo(V.x*$,V.y*j,(V.x+W.x)/2*$,(V.y+W.y)/2*j)}let Q=J[J.length-1];z.lineTo(Q.x*$,Q.y*j)}function M3(z,J,$,j,Q,Z){z.globalAlpha=Z,D3(z,J.pts,$,j),z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.stroke(),z.strokeStyle=J.color,z.lineWidth=Q,z.stroke()}function F3(z,J,$,j,Q,Z){let V=J.pts[0],W=J.pts[J.pts.length-1],H=Math.min(V.x,W.x)*$,q=Math.min(V.y,W.y)*j,S=Math.abs(W.x-V.x)*$,B=Math.abs(W.y-V.y)*j;z.globalAlpha=Z,z.fillStyle=J.color,z.globalAlpha=Z*0.14,z.fillRect(H,q,S,B),z.globalAlpha=Z,z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.strokeRect(H,q,S,B),z.strokeStyle=J.color,z.lineWidth=Q,z.strokeRect(H,q,S,B)}function B3(z,J,$,j,Q,Z,V){let W=J.pts.filter((q)=>V-q.t<=450);for(let q=1;q<W.length;q++){let S=W[q-1],B=W[q];z.globalAlpha=Z*Math.max(0,1-(V-B.t)/450)*0.7,z.strokeStyle=J.color,z.lineWidth=Q*0.9,z.beginPath(),z.moveTo(S.x*$,S.y*j),z.lineTo(B.x*$,B.y*j),z.stroke()}let H=J.pts[J.pts.length-1];z.globalAlpha=Z,z.shadowColor=J.color,z.shadowBlur=Q*2,z.fillStyle=J.color,z.beginPath(),z.arc(H.x*$,H.y*j,Q,0,Math.PI*2),z.fill(),z.shadowBlur=0,z.strokeStyle="rgba(255,255,255,0.95)",z.lineWidth=2,z.stroke()}function N3(z,J,$,j=typeof window>"u"?1:window.devicePixelRatio||1){let Q=Math.max(1,Math.round(J*j)),Z=Math.max(1,Math.round($*j));if(z.width!==Q)z.width=Q;if(z.height!==Z)z.height=Z;let V=z.getContext("2d");return V?.setTransform(j,0,0,j,0,0),V}class M2{canvas;scene;box;frame=0;constructor(z,J,$){this.canvas=z;this.scene=J;this.box=$}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let z=()=>{this.frame=0;let{w:J,h:$}=this.box(),j=N3(this.canvas,J,$),Q=Date.now(),Z=this.scene.alive(Q);if(j)this.scene.draw(j,J,$,Q);if(Z)this.frame=requestAnimationFrame(z)};this.frame=requestAnimationFrame(z)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var I3="lw-call-ink",K0=null,w1=null,$1=null;function _3(){if(K0?.isConnected&&$1)return;K0=document.createElement(I3),K0.dataset.debugReporter="true";let z=K0.attachShadow({mode:"open"}),J=document.createElement("style");J.textContent=`:host { all: initial; }
313
- canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let $=document.createElement("canvas");$.setAttribute("aria-hidden","true"),$.dataset.lwCallInk="",z.append(J,$),document.body.append(K0),w1=new D2,$1=new M2($,w1,()=>({w:window.innerWidth,h:window.innerHeight}))}function f1(z){if(typeof document>"u")return;if(z.op==="clear"&&!K0)return;_3(),w1.apply(z),$1.kick()}function y1(){$1?.stop(),K0?.remove(),K0=null,w1=null,$1=null}var C3="lw-call-frame",O3="lw-call",p=16,_2=368,n=null,A=null,I0=null,g1="",Q1=null,Z1="card",C2={width:_2,height:0},O2,X1=!1,L2=null,v0={answer:!1,voice:!1},G0=null,g=null,F2="lw-call-frame-place";function _6(z,J,$,j){let Q=new URL("embed/call",z.endsWith("/")?z:`${z}/`);if(Q.searchParams.set("realm",J),$)Q.searchParams.set("token",$);else Q.searchParams.set("hand","1");return Q.searchParams.set("call",j),Q.toString()}function b0(z){A?.contentWindow?.postMessage({source:"lw-call-host",...z},g1)}function C6(z){if(I0!==z)return;if(v0.answer=!0,X1)b0({type:"answer"})}function O6(z){if(I0!==z)return;if(v0.voice=!0,X1)b0({type:"voice"})}function L6(z,J,$){return{x:Math.min(Math.max(z.x,p/2),Math.max(p/2,$.w-J.w-p/2)),y:Math.min(Math.max(z.y,p/2),Math.max(p/2,$.h-J.h-p/2))}}function L3(z,J){if(z.origin!==J.origin||z.source!==J.window)return null;let $=z.data;return $&&typeof $==="object"&&$.source===O3&&typeof $.type==="string"?$:null}function m0(){return n?.isConnected?I0:null}function S6(z,J,$,j=15000,Q=null){if(typeof document>"u")return;if(I0===J&&n?.isConnected)return;V1(),I0=J,Q1=$,X1=!1,L2=Q,v0={answer:!1,voice:!1},Z1="card",C2={width:_2,height:0},g1=new URL(z).origin;try{G0=JSON.parse(sessionStorage.getItem(F2)??"null")}catch{G0=null}n=document.createElement(C3),n.dataset.debugReporter="true";let Z=n.attachShadow({mode:"open"}),V=document.createElement("style");V.textContent=`:host { all: initial; }
312
+ `,u1=(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>`,k6=u1('<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"/>'),k3=u1('<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"/>'),x3=u1('<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'),E3=u1('<path d="M21 12a9 9 0 1 1-6.219-8.56"/>').replace("<svg ",'<svg class="spin" '),E=null,G0=null,m0=null;function f3(J,z){return J.replace("{key}",z.ticketKey).replace("{title}",z.ticketTitle)}var b0=()=>l(M().locale);function w3(){if(typeof document>"u")return null;if(E?.isConnected)return E.shadowRoot;E=document.createElement(T3),E.dataset.debugReporter="true",m1(E);let J=E.attachShadow({mode:"open"});return X1(J),document.body.append(E),J}function b1(J,z,$,j){let Q=document.createElement("button");return Q.type="button",Q.className=J,Q.innerHTML=z,Q.dataset.lwRing=$,Q.onclick=j,Q}var W1=(J)=>{let z=document.createElement("span");return z.textContent=J,z.outerHTML};function E6(J,z,$,j,Q){let Z=b0();J.innerHTML="";let V=document.createElement("style");V.textContent=A3;let W=document.createElement("div");W.className="card",W.setAttribute("role","alertdialog"),W.setAttribute("aria-label",Z.ringTitle),W.dataset.lwCallRing=z.id,W.dataset.lwRingMode=j;let U=document.createElement("div");U.className="head";let H=document.createElement("span");H.className="icon",H.innerHTML=k6;let R=document.createElement("div");R.className="words";let B=document.createElement("h2");B.textContent=Z.ringTitle;let C=document.createElement("p");C.className="about",C.textContent=f3(Z.ringAbout,z),C.title=C.textContent,R.append(B,C),U.append(H,R);let k=document.createElement("p");k.className="how",k.textContent=Q??(j==="frame"?Z.ringHint:Z.ringHow);let f=document.createElement("div");f.className="actions";let i=b1("decline",k3+W1(Z.ringDecline),"decline",()=>$.decline());if(W.append(U,k),j==="frame"&&$.answer){if($.voice)W.append(b1("test",x3+W1(Z.ringTest),"test",()=>$.voice?.()));let e=b1("answer",k6+W1(Z.ringAnswer),"answer",()=>$.answer?.());f.append(i,e)}else f.append(i,b1("open",W1(Z.ringOpen),"open",()=>$.open()));W.append(f),J.append(V,W)}function p1(J,z,$="portal"){if(G0===J.id&&E?.isConnected)return;let j=w3();if(!j)return;if(G0=J.id,E6(j,J,z,$),y3(),m0===null)m0=document.title,document.title=`${b0().ringTab} — ${m0}`}function f6(J){let z=E?.shadowRoot;if(!z||G0!==J)return;let $=z.querySelector(".answer");if($)$.innerHTML=E3+W1(b0().ringAnswering),$.disabled=!0;let j=z.querySelector(".decline");if(j)j.disabled=!0}function w6(J,z){let $=E?.isConnected?E.shadowRoot:null;if(!$||G0!==J.id)return p1(J,z,"portal");E.style.display="",E6($,J,z,"portal",b0().ringFallback)}function i1(J){let z=E?.shadowRoot;if(!z)return;R2(),v6();let $=b0(),j=z.querySelector(".how"),Q=z.querySelector(".actions");if(j)if(j.textContent="",J){let Z=document.createElement("a");Z.href=J,Z.target="_blank",Z.rel="noopener",Z.textContent=$.ringBlocked,Z.dataset.lwRing="link",Z.onclick=()=>window.setTimeout(()=>i1(),0),j.append(Z)}else j.textContent=$.ringOpened;if(Q){Q.innerHTML="";let Z=document.createElement("button");Z.type="button",Z.className="close",Z.textContent=$.ringClose,Z.dataset.lwRing="close",Z.onclick=()=>u0(),Q.append(Z)}}function y6(J,z=!0){if(!E?.isConnected||G0!==J)return;let $=E;if(clearTimeout(x6),!z){$.style.display="",$.style.opacity="";return}$.style.transition="opacity 150ms ease-out",$.style.opacity="0",x6=setTimeout(()=>{if($.style.opacity==="0")$.style.display="none"},160)}var x6;function u0(J){if(J&&G0&&J!==G0)return;R2(),v6(),E?.remove(),E=null,G0=null}function g6(){return E?.isConnected?G0:null}function v6(){if(m0===null||typeof document>"u")return;if(document.title.startsWith(b0().ringTab))document.title=m0;m0=null}var F0=null,S2;function y3(){R2();let J=window,z=J.AudioContext??J.webkitAudioContext;if(!z)return;try{let j=F0??new z;F0=j,j.resume?.().catch(()=>{return})}catch{return}let $=()=>{if(!F0||F0.state!=="running")return;let j=F0.currentTime;for(let[Q,Z]of[660,880].entries()){let V=F0.createOscillator(),W=F0.createGain();V.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),V.connect(W).connect(F0.destination),V.start(j+Q*0.22),V.stop(j+Q*0.22+0.21)}};$(),S2=setInterval($,2200)}function R2(){clearInterval(S2),S2=void 0}var g3=/^[A-Za-z0-9_-]{1,32}$/,v3=/^#[0-9a-fA-F]{6}$/,h3=["pen","rect","laser"],h6=(J)=>J<0?0:J>1?1:J;function m6(J,z){if(!Array.isArray(J)||J.length<z||J.length>64)return null;let $=[];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;$.push([h6(Q),h6(Z)])}return $}function d1(J){if(!J||typeof J!=="object")return null;let z=J;if(z.op==="clear")return{op:"clear"};if(typeof z.id!=="string"||!g3.test(z.id))return null;if(z.op==="end")return{op:"end",id:z.id};if(z.op==="add"){let $=m6(z.pts,1);return $?{op:"add",id:z.id,pts:$}:null}if(z.op==="begin"){if(!h3.includes(z.kind)||typeof z.color!=="string"||!v3.test(z.color))return null;let $=m6(z.pts,1);return $?{op:"begin",id:z.id,kind:z.kind,color:z.color,pts:$}:null}return null}function T2(J,z){if(J.endedAt!==null)return J.endedAt;return z-J.lastAt>20000?J.lastAt:null}function b6(J,z,$){if(z===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 A2{marks=new Map;apply(J,z=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:z})),endedAt:null,lastAt:z});return}let $=this.marks.get(J.id);if(!$||T2($,z)!==null)return;if(J.op==="end"){$.endedAt=z;return}if($.lastAt=z,$.kind==="rect"){let[j,Q]=J.pts[J.pts.length-1];$.pts=[$.pts[0],{x:j,y:Q,t:z}];return}for(let[j,Q]of J.pts)$.pts.push({x:j,y:Q,t:z});if($.pts.length>4000)$.pts.splice(0,$.pts.length-4000)}alive(J=Date.now()){for(let[z,$]of this.marks)if(b6($.kind,T2($,J),J)<=0)this.marks.delete(z);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 V=b6(Z.kind,T2(Z,j),j);if(V<=0||!Z.pts.length)continue;if(J.save(),J.lineCap="round",J.lineJoin="round",Z.kind==="pen")b3(J,Z,z,$,Math.max(3,Q*0.0045),V);else if(Z.kind==="rect")u3(J,Z,z,$,Math.max(2.5,Q*0.003),V);else p3(J,Z,z,$,Math.max(6,Q*0.008),V,j);J.restore()}}}function m3(J,z,$,j){if(J.beginPath(),J.moveTo(z[0].x*$,z[0].y*j),z.length===1){J.lineTo(z[0].x*$+0.01,z[0].y*j);return}for(let Z=1;Z<z.length-1;Z++){let V=z[Z],W=z[Z+1];J.quadraticCurveTo(V.x*$,V.y*j,(V.x+W.x)/2*$,(V.y+W.y)/2*j)}let Q=z[z.length-1];J.lineTo(Q.x*$,Q.y*j)}function b3(J,z,$,j,Q,Z){J.globalAlpha=Z,m3(J,z.pts,$,j),J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=Q+3,J.stroke(),J.strokeStyle=z.color,J.lineWidth=Q,J.stroke()}function u3(J,z,$,j,Q,Z){let V=z.pts[0],W=z.pts[z.pts.length-1],U=Math.min(V.x,W.x)*$,H=Math.min(V.y,W.y)*j,R=Math.abs(W.x-V.x)*$,B=Math.abs(W.y-V.y)*j;J.globalAlpha=Z,J.fillStyle=z.color,J.globalAlpha=Z*0.14,J.fillRect(U,H,R,B),J.globalAlpha=Z,J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=Q+3,J.strokeRect(U,H,R,B),J.strokeStyle=z.color,J.lineWidth=Q,J.strokeRect(U,H,R,B)}function p3(J,z,$,j,Q,Z,V){let W=z.pts.filter((H)=>V-H.t<=450);for(let H=1;H<W.length;H++){let R=W[H-1],B=W[H];J.globalAlpha=Z*Math.max(0,1-(V-B.t)/450)*0.7,J.strokeStyle=z.color,J.lineWidth=Q*0.9,J.beginPath(),J.moveTo(R.x*$,R.y*j),J.lineTo(B.x*$,B.y*j),J.stroke()}let U=z.pts[z.pts.length-1];J.globalAlpha=Z,J.shadowColor=z.color,J.shadowBlur=Q*2,J.fillStyle=z.color,J.beginPath(),J.arc(U.x*$,U.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 i3(J,z,$,j=typeof window>"u"?1:window.devicePixelRatio||1){let Q=Math.max(1,Math.round(z*j)),Z=Math.max(1,Math.round($*j));if(J.width!==Q)J.width=Q;if(J.height!==Z)J.height=Z;let V=J.getContext("2d");return V?.setTransform(j,0,0,j,0,0),V}class k2{canvas;scene;box;frame=0;constructor(J,z,$){this.canvas=J;this.scene=z;this.box=$}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let J=()=>{this.frame=0;let{w:z,h:$}=this.box(),j=i3(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 d3="lw-call-ink",B0=null,c1=null,Y1=null;function c3(){if(B0?.isConnected&&Y1)return;B0=document.createElement(d3),B0.dataset.debugReporter="true";let J=B0.attachShadow({mode:"open"}),z=document.createElement("style");z.textContent=`:host { all: initial; }
313
+ canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let $=document.createElement("canvas");$.setAttribute("aria-hidden","true"),$.dataset.lwCallInk="",J.append(z,$),document.body.append(B0),c1=new A2,Y1=new k2($,c1,()=>({w:window.innerWidth,h:window.innerHeight}))}function l1(J){if(typeof document>"u")return;if(J.op==="clear"&&!B0)return;c3(),c1.apply(J),Y1.kick()}function o1(){Y1?.stop(),B0?.remove(),B0=null,c1=null,Y1=null}var l3="lw-call-frame",o3="lw-call",o=16,y2=368,j0=null,A=null,R0=null,s1="",G1=null,U1="card",g2={width:y2,height:0},v2,q1=!1,h2=null,i0={answer:!1,voice:!1},N0=null,u=null,x2="lw-call-frame-place";function u6(J,z,$,j){let Q=new URL("embed/call",J.endsWith("/")?J:`${J}/`);if(Q.searchParams.set("realm",z),$)Q.searchParams.set("token",$);else Q.searchParams.set("hand","1");return Q.searchParams.set("call",j),Q.toString()}function p0(J){A?.contentWindow?.postMessage({source:"lw-call-host",...J},s1)}function p6(J){if(R0!==J)return;if(i0.answer=!0,q1)p0({type:"answer"})}function i6(J){if(R0!==J)return;if(i0.voice=!0,q1)p0({type:"voice"})}function d6(J,z,$){return{x:Math.min(Math.max(J.x,o/2),Math.max(o/2,$.w-z.w-o/2)),y:Math.min(Math.max(J.y,o/2),Math.max(o/2,$.h-z.h-o/2))}}function r3(J,z){if(J.origin!==z.origin||J.source!==z.window)return null;let $=J.data;return $&&typeof $==="object"&&$.source===o3&&typeof $.type==="string"?$:null}function c0(){return j0?.isConnected?R0:null}function c6(J,z,$,j=15000,Q=null){if(typeof document>"u")return;if(R0===z&&j0?.isConnected)return;H1(),R0=z,G1=$,q1=!1,h2=Q,i0={answer:!1,voice:!1},U1="card",g2={width:y2,height:0},s1=new URL(J).origin;try{N0=JSON.parse(sessionStorage.getItem(x2)??"null")}catch{N0=null}j0=document.createElement(l3),j0.dataset.debugReporter="true";let Z=j0.attachShadow({mode:"open"}),V=document.createElement("style");V.textContent=`:host { all: initial; }
314
314
  iframe { position: fixed; z-index: 2147483003; border: 0; background: transparent; color-scheme: normal; visibility: hidden; }
315
- iframe.on { visibility: visible; }`,A=document.createElement("iframe"),A.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",A.title="สายจากทีมงาน",A.dataset.lwCallFrame=J,A.setAttribute("allowtransparency","true"),A.src=z,Z.append(V,A),document.body.append(n),g0(),window.addEventListener("message",R6),window.addEventListener("resize",g0),S2(`lw-call:${J}`),O2=setTimeout(()=>{if(!X1)B2("timeout")},j)}function V1(){if(n)S2(N2?.handle??null,N2?.readableBy);y1(),clearTimeout(O2),window.removeEventListener("message",R6),window.removeEventListener("resize",g0),b1(!1),n?.remove(),n=null,A=null,I0=null,Q1=null,g=null,L2=null,v0={answer:!1,voice:!1}}function B2(z){let J=Q1;V1(),J?.failed(z)}function R6(z){if(!A)return;let J=L3(z,{origin:g1,window:A.contentWindow});if(!J)return;switch(J.type){case"hello":L2?.then(($)=>{if(!A||I0===null)return;if($)b0({type:"token",token:$});else B2("no_token")});return;case"ready":if(X1=!0,clearTimeout(O2),A.classList.add("on"),Q1?.ready(),v0.answer)b0({type:"answer"});if(v0.voice)b0({type:"voice"});return;case"size":if(typeof J.width==="number"&&typeof J.height==="number")C2={width:J.width,height:J.height};if(J.layout==="card"||J.layout==="full"){if(J.layout==="full"&&Z1==="card")S3();Z1=J.layout}return g0();case"drag":return I2(J);case"home":return G0=null,T6(),g0();case"done":{let $=Q1;V1(),$?.done();return}case"failed":return B2(J.reason??"failed");case"ink":{let $=E1(J.op);if($)f1($);return}}}function S2(z,J=g1){let $=typeof navigator>"u"?void 0:navigator.mediaDevices;try{$?.setCaptureHandleConfig?.(z&&J?{handle:z,exposeOrigin:!1,permittedOrigins:[J]}:{})}catch{}}var N2=null;function A6(z,J){if(N2={handle:z,readableBy:J},!n?.isConnected)S2(z,J)}function I2(z){if(!A||Z1!=="card"||typeof z.x!=="number"||typeof z.y!=="number")return;if(z.phase==="start"){let J=A.getBoundingClientRect();g={sx:z.x,sy:z.y,x:J.left,y:J.top,lx:z.x,ly:z.y},b1(!0);return}if(!g)return;if(g.lx=z.x,g.ly=z.y,G0=L6({x:g.x+(z.x-g.sx),y:g.y+(z.y-g.sy)},k6(),v1()),g0(),z.phase==="end")g=null,b1(!1),T6()}var j1=null;function b1(z){if(j1){for(let J of["pointermove","pointerup","pointercancel"])window.removeEventListener(J,j1,!0);j1=null}if(!z)return;j1=(J)=>{if(!g)return b1(!1);if(J.type==="pointermove"&&J.buttons!==0)return I2({type:"drag",phase:"move",x:J.screenX,y:J.screenY});let $=J.type==="pointerup";I2({type:"drag",phase:"end",x:$?J.screenX:g.lx,y:$?J.screenY:g.ly})};for(let J of["pointermove","pointerup","pointercancel"])window.addEventListener(J,j1,!0)}function S3(){if(!A?.contentWindow)return;let z=A.getBoundingClientRect();b0({type:"corner",x:Math.round(z.left),y:Math.round(z.top),width:Math.round(z.width)})}function T6(){try{if(G0)sessionStorage.setItem(F2,JSON.stringify(G0));else sessionStorage.removeItem(F2)}catch{}}var v1=()=>({w:window.innerWidth,h:window.innerHeight});function k6(){let z=v1();return{w:Math.min(_2,z.w-p),h:Math.min(C2.height||0,z.h-p)}}function g0(){if(!A)return;let z=A.style;if(Z1==="full"){Object.assign(z,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let J=k6(),$=v1().w<480;if(z.width=$?`calc(100vw - ${p}px)`:`${J.w}px`,z.height=`${J.h}px`,G0&&!$){let j=L6(G0,J,v1());Object.assign(z,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(z,{left:$?`${p/2}px`:"",top:"",right:$?"":`${p/2}px`,bottom:`calc(${p/2}px + var(--lw-chat-lift, 0px))`})}var m1=[2000,5000,15000,30000,60000],x6=new Set(["ringing","active"]),R3=20000,E6=!1,h0=!1,w6=0,A3=5,R2=null,u6=0,A2,f6,y6,p6=(z)=>z.endsWith("/")?z:`${z}/`;function T3(z,J){let $=new URL("api/presence/ws",p6(z));return $.protocol=$.protocol==="https:"?"wss:":"ws:",$.searchParams.set("t",J),$.toString()}function k3(z){return`/me/tickets/${z.ticketId}?call=${z.id}`}function x3(z){return z.status==="ringing"&&(z.side==="reporter"||z.side===void 0||z.side===null)}var T2=new Set;function d6(z){return T2.add(z),()=>T2.delete(z)}var b6=()=>M().ring!==!1;async function _0(){let z=M().identity;if(!z)return null;try{return await z()??null}catch{return null}}async function w2(z,J){let $=M();return fetch(new URL(z,p6($.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,authorization:`Bearer ${J}`},body:"{}"})}function f2(){if(E6||typeof window>"u"||typeof WebSocket>"u")return;let z=M();if(!z.identity||z.ring===!1&&!z.chat)return;E6=!0,h0=!1,w3(z.host);try{A6(`lw-tab:${c6()}`,new URL(z.host).origin)}catch{}i6()}function W1(z=!1){if(h0)return;let J=z?m1[m1.length-1]:m1[Math.min(u6++,m1.length-1)];clearTimeout(f6),f6=setTimeout(()=>void i6(),J)}async function i6(){if(h0)return;let z=await _0();if(!z){if(++w6>=A3){h0=!0;return}return W1(!0)}w6=0;let J;try{J=await w2(M().chat?"ingest/live-ticket?chat=1":"ingest/live-ticket",z)}catch{return W1()}if(J.status===401||J.status===404||J.status===403){h0=!0;return}if(!J.ok)return W1(J.status===429);let $;try{$=await J.json()}catch{return W1()}if(!$.ticket){h0=!0;return}if($.calls&&$.call&&b6())h6($.call);let j=new WebSocket(T3(M().host,$.ticket));R2=j,j.onopen=()=>{u6=0,j.send(JSON.stringify({type:"tab",id:c6()})),clearInterval(A2),A2=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},R3)},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 V of T2)V(Z);return}if(Z.type==="call-state"&&Z.call&&typeof Z.call==="object"){if(b6())h6(Z.call)}else if(Z.type==="call-ink"&&typeof Z.call==="string"){let V=E1(Z.op);if(V)E2=Z.call,f1(V)}}catch{}},j.onclose=()=>{if(clearInterval(A2),R2===j)R2=null;W1()}}var k2="lw-call-framed";function E3(){try{return sessionStorage.getItem(k2)}catch{return null}}function h1(z){try{if(z)sessionStorage.setItem(k2,z);else sessionStorage.removeItem(k2)}catch{}}var v6=!1;function w3(z){if(v6||typeof document>"u")return;v6=!0;try{let J=new URL(z).origin;for(let $ of["dns-prefetch","preconnect"]){let j=document.createElement("link");if(j.rel=$,j.href=J,$==="preconnect")j.crossOrigin="anonymous";j.dataset.debugReporter="true",document.head.append(j)}}catch{}}function g6(z){let J=M();if(J.callFrame===!1||m0()===z.id)return;h1(z.id),S6(_6(J.host,J.realmKey,null,z.id),z.id,{ready:()=>D6(z.id),done:()=>{h1(null),y0(z.id)},failed:()=>{h1(null),P6(z,x2(z))}},15000,_0())}var x2=(z)=>({open:()=>f3(z),decline:()=>void y3(z)}),H0=null;function c6(){if(H0)return H0;try{H0=sessionStorage.getItem(m6)}catch{}if(!H0||!/^[A-Za-z0-9_-]{8,40}$/.test(H0)){let z=new Uint8Array(12);crypto.getRandomValues(z),H0=Array.from(z,(J)=>J.toString(16).padStart(2,"0")).join("");try{sessionStorage.setItem(m6,H0)}catch{}}return H0}var m6="lw-tab-id",E2=null;function h6(z){if(!x6.has(z.status)&&E2===z.id&&m0()!==z.id)E2=null,y1();if(!x3(z)){if(y0(z.id),z.status==="active"&&E3()===z.id&&!m0())g6(z);if(!x6.has(z.status)&&m0()===z.id)setTimeout(()=>{if(m0()===z.id)V1(),h1(null)},12000);return}if(M().callFrame===!1)k1(z,x2(z),"portal");else k1(z,{...x2(z),answer:()=>{q6(z.id),C6(z.id)},voice:()=>O6(z.id)},"frame"),g6(z);clearTimeout(y6);let J=new Date(z.ringUntil).getTime()-Date.now();y6=setTimeout(()=>{if(M6()===z.id)y0(z.id)},Math.max(5000,J+5000))}function f3(z){let J=window.open("about:blank","_blank");(async()=>{let $=await _0();if($)w2(`ingest/calls/${z.id}/coming`,$).catch(()=>{return});let j;try{j=await K6(k3(z))}catch{J?.close();return}if(J&&!J.closed){J.location.href=j;try{J.opener=null}catch{}x1()}else x1(j)})()}async function y3(z){y0(z.id);let J=await _0();if(J)await w2(`ingest/calls/${z.id}/decline`,J).catch(()=>{return})}var b3="lw-support-chat",v3="lw-support-frame",g3="lw-support-host",u0=56,c1=12,m3='<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>',h3=`
315
+ iframe.on { visibility: visible; }`,A=document.createElement("iframe"),A.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",A.title="สายจากทีมงาน",A.dataset.lwCallFrame=z,A.setAttribute("allowtransparency","true"),A.src=J,Z.append(V,A),document.body.append(j0),d0(),window.addEventListener("message",l6),window.addEventListener("resize",d0),m2(`lw-call:${z}`),v2=setTimeout(()=>{if(!q1)E2("timeout")},j)}function H1(){if(j0)m2(f2?.handle??null,f2?.readableBy);o1(),clearTimeout(v2),window.removeEventListener("message",l6),window.removeEventListener("resize",d0),r1(!1),j0?.remove(),j0=null,A=null,R0=null,G1=null,u=null,h2=null,i0={answer:!1,voice:!1}}function E2(J){let z=G1;H1(),z?.failed(J)}function l6(J){if(!A)return;let z=r3(J,{origin:s1,window:A.contentWindow});if(!z)return;switch(z.type){case"hello":h2?.then(($)=>{if(!A||R0===null)return;if($)p0({type:"token",token:$});else E2("no_token")});return;case"ready":if(q1=!0,clearTimeout(v2),A.classList.add("on"),G1?.ready(),i0.answer)p0({type:"answer"});if(i0.voice)p0({type:"voice"});return;case"size":if(typeof z.width==="number"&&typeof z.height==="number")g2={width:z.width,height:z.height};if(z.layout==="card"||z.layout==="full"){if(z.layout==="full"&&U1==="card")n3();U1=z.layout}return d0();case"drag":return w2(z);case"home":return N0=null,r6(),d0();case"done":{let $=G1;H1(),$?.done();return}case"failed":return E2(z.reason??"failed");case"ink":{let $=d1(z.op);if($)l1($);return}}}function m2(J,z=s1){let $=typeof navigator>"u"?void 0:navigator.mediaDevices;try{$?.setCaptureHandleConfig?.(J&&z?{handle:J,exposeOrigin:!1,permittedOrigins:[z]}:{})}catch{}}var f2=null;function o6(J,z){if(f2={handle:J,readableBy:z},!j0?.isConnected)m2(J,z)}function w2(J){if(!A||U1!=="card"||typeof J.x!=="number"||typeof J.y!=="number")return;if(J.phase==="start"){let z=A.getBoundingClientRect();u={sx:J.x,sy:J.y,x:z.left,y:z.top,lx:J.x,ly:J.y},r1(!0);return}if(!u)return;if(u.lx=J.x,u.ly=J.y,N0=d6({x:u.x+(J.x-u.sx),y:u.y+(J.y-u.sy)},n6(),n1()),d0(),J.phase==="end")u=null,r1(!1),r6()}var K1=null;function r1(J){if(K1){for(let z of["pointermove","pointerup","pointercancel"])window.removeEventListener(z,K1,!0);K1=null}if(!J)return;K1=(z)=>{if(!u)return r1(!1);if(z.type==="pointermove"&&z.buttons!==0)return w2({type:"drag",phase:"move",x:z.screenX,y:z.screenY});let $=z.type==="pointerup";w2({type:"drag",phase:"end",x:$?z.screenX:u.lx,y:$?z.screenY:u.ly})};for(let z of["pointermove","pointerup","pointercancel"])window.addEventListener(z,K1,!0)}function n3(){if(!A?.contentWindow)return;let J=A.getBoundingClientRect();p0({type:"corner",x:Math.round(J.left),y:Math.round(J.top),width:Math.round(J.width)})}function r6(){try{if(N0)sessionStorage.setItem(x2,JSON.stringify(N0));else sessionStorage.removeItem(x2)}catch{}}var n1=()=>({w:window.innerWidth,h:window.innerHeight});function n6(){let J=n1();return{w:Math.min(y2,J.w-o),h:Math.min(g2.height||0,J.h-o)}}function d0(){if(!A)return;let J=A.style;if(U1==="full"){Object.assign(J,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let z=n6(),$=n1().w<480;if(J.width=$?`calc(100vw - ${o}px)`:`${z.w}px`,J.height=`${z.h}px`,N0&&!$){let j=d6(N0,z,n1());Object.assign(J,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(J,{left:$?`${o/2}px`:"",top:"",right:$?"":`${o/2}px`,bottom:`calc(${o/2}px + var(--lw-chat-lift, 0px))`})}var a1=[2000,5000,15000,30000,60000],s6=new Set(["ringing","active"]),s3=20000,a6=!1,l0=!1,t6=0,a3=5,b2=null,X8=0,u2,e6,J8,V8=(J)=>J.endsWith("/")?J:`${J}/`;function t3(J,z){let $=new URL("api/presence/ws",V8(J));return $.protocol=$.protocol==="https:"?"wss:":"ws:",$.searchParams.set("t",z),$.toString()}function e3(J){return`/me/tickets/${J.ticketId}?call=${J.id}`}function J9(J){return J.status==="ringing"&&(J.side==="reporter"||J.side===void 0||J.side===null)}var p2=new Set;function W8(J){return p2.add(J),()=>p2.delete(J)}var z8=()=>M().ring!==!1;async function T0(){let J=M().identity;if(!J)return null;try{return await J()??null}catch{return null}}async function l2(J,z){let $=M();return fetch(new URL(J,V8($.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,authorization:`Bearer ${z}`},body:"{}"})}function o2(){if(a6||typeof window>"u"||typeof WebSocket>"u")return;let J=M();if(!J.identity||J.ring===!1&&!J.chat)return;a6=!0,l0=!1,$9(J.host);try{o6(`lw-tab:${K8()}`,new URL(J.host).origin)}catch{}Y8()}function D1(J=!1){if(l0)return;let z=J?a1[a1.length-1]:a1[Math.min(X8++,a1.length-1)];clearTimeout(e6),e6=setTimeout(()=>void Y8(),z)}async function Y8(){if(l0)return;let J=await T0();if(!J){if(++t6>=a3){l0=!0;return}return D1(!0)}t6=0;let z;try{z=await l2(M().chat?"ingest/live-ticket?chat=1":"ingest/live-ticket",J)}catch{return D1()}if(z.status===401||z.status===404||z.status===403){l0=!0;return}if(!z.ok)return D1(z.status===429);let $;try{$=await z.json()}catch{return D1()}if(!$.ticket){l0=!0;return}if($.calls&&$.call&&z8())Z8($.call);let j=new WebSocket(t3(M().host,$.ticket));b2=j,j.onopen=()=>{X8=0,j.send(JSON.stringify({type:"tab",id:K8()})),clearInterval(u2),u2=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},s3)},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 V of p2)V(Z);return}if(Z.type==="call-state"&&Z.call&&typeof Z.call==="object"){if(z8())Z8(Z.call)}else if(Z.type==="call-ink"&&typeof Z.call==="string"){let V=d1(Z.op);if(V)c2=Z.call,l1(V)}}catch{}},j.onclose=()=>{if(clearInterval(u2),b2===j)b2=null;D1()}}var i2="lw-call-framed";function z9(){try{return sessionStorage.getItem(i2)}catch{return null}}function t1(J){try{if(J)sessionStorage.setItem(i2,J);else sessionStorage.removeItem(i2)}catch{}}var $8=!1;function $9(J){if($8||typeof document>"u")return;$8=!0;try{let z=new URL(J).origin;for(let $ of["dns-prefetch","preconnect"]){let j=document.createElement("link");if(j.rel=$,j.href=z,$==="preconnect")j.crossOrigin="anonymous";j.dataset.debugReporter="true",document.head.append(j)}}catch{}}function j8(J){let z=M();if(z.callFrame===!1||c0()===J.id)return;t1(J.id),c6(u6(z.host,z.realmKey,null,J.id),J.id,{ready:()=>y6(J.id),done:()=>{t1(null),u0(J.id)},failed:()=>{t1(null),w6(J,d2(J))}},15000,T0())}var d2=(J)=>({open:()=>j9(J),decline:()=>void Q9(J)}),_0=null;function K8(){if(_0)return _0;try{_0=sessionStorage.getItem(Q8)}catch{}if(!_0||!/^[A-Za-z0-9_-]{8,40}$/.test(_0)){let J=new Uint8Array(12);crypto.getRandomValues(J),_0=Array.from(J,(z)=>z.toString(16).padStart(2,"0")).join("");try{sessionStorage.setItem(Q8,_0)}catch{}}return _0}var Q8="lw-tab-id",c2=null;function Z8(J){if(!s6.has(J.status)&&c2===J.id&&c0()!==J.id)c2=null,o1();if(!J9(J)){if(u0(J.id),J.status==="active"&&z9()===J.id&&!c0())j8(J);if(!s6.has(J.status)&&c0()===J.id)setTimeout(()=>{if(c0()===J.id)H1(),t1(null)},12000);return}if(M().callFrame===!1)p1(J,d2(J),"portal");else p1(J,{...d2(J),answer:()=>{f6(J.id),p6(J.id)},voice:()=>i6(J.id)},"frame"),j8(J);clearTimeout(J8);let z=new Date(J.ringUntil).getTime()-Date.now();J8=setTimeout(()=>{if(g6()===J.id)u0(J.id)},Math.max(5000,z+5000))}function j9(J){let z=window.open("about:blank","_blank");(async()=>{let $=await T0();if($)l2(`ingest/calls/${J.id}/coming`,$).catch(()=>{return});let j;try{j=await A6(e3(J))}catch{z?.close();return}if(z&&!z.closed){z.location.href=j;try{z.opener=null}catch{}i1()}else i1(j)})()}async function Q9(J){u0(J.id);let z=await T0();if(z)await l2(`ingest/calls/${J.id}/decline`,z).catch(()=>{return})}var Z9="lw-support-chat",X9="lw-support-frame",V9="lw-support-host",t=56,r0=12,W9='<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>',Y9=`
316
316
  :host { all: initial; }
317
317
  .bubble {
318
- position: fixed; z-index: 2147483000; width: ${u0}px; height: ${u0}px; border-radius: 50%;
318
+ position: fixed; z-index: 2147483000; width: ${t}px; height: ${t}px; border-radius: 50%;
319
319
  display: grid; place-items: center; border: 0; cursor: pointer; padding: 0;
320
320
  background: #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);
321
321
  transition: transform 150ms ease, background 150ms ease;
322
- font-family: "Inter Variable", "Noto Sans Thai Variable", "IBM Plex Sans Thai", -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
322
+ font-family: var(--lw-host-font, ${h1});
323
323
  }
324
324
  .bubble:hover { background: #003a78; transform: translateY(-1px); }
325
+ .bubble { touch-action: none; }
326
+ .bubble.dragging { cursor: grabbing; transform: scale(1.06); transition: none; box-shadow: 0 18px 35px -8px rgba(0, 0, 0, 0.4); }
325
327
  .bubble:focus-visible { outline: 3px solid rgba(0, 70, 143, 0.35); outline-offset: 3px; }
328
+ .face { display: none; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; pointer-events: none; user-select: none; -webkit-user-drag: none; }
329
+ .bubble.has-face, .bubble.has-face:hover { background: #fff; }
330
+ .has-face .face { display: block; }
331
+ .has-face > svg { display: none; }
326
332
  .badge {
327
333
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box;
328
- border-radius: 10px; background: #dc2626; color: #fff; font: 700 11px/20px "Inter Variable", -apple-system, sans-serif;
334
+ border-radius: 10px; background: #dc2626; color: #fff; font-family: inherit; font-size: 11px; font-weight: 700; line-height: 20px;
329
335
  text-align: center; box-shadow: 0 0 0 2px #fff;
330
336
  }
331
337
  .badge[hidden] { display: none; }
338
+ .label {
339
+ position: absolute; top: 50%; right: calc(100% + 12px); transform: translate(4px, -50%);
340
+ padding: 9px 15px; border-radius: 999px; background: #fff; color: #1f2937; white-space: nowrap;
341
+ font-family: inherit; font-size: 13px; font-weight: 600; line-height: 18px;
342
+ box-shadow: 0 8px 22px -6px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.05);
343
+ opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 150ms ease, transform 150ms ease, visibility 150ms;
344
+ }
345
+ .label::after {
346
+ content: ""; position: absolute; top: 50%; right: -4px; width: 10px; height: 10px; background: #fff; border-radius: 2px;
347
+ transform: translateY(-50%) rotate(45deg); box-shadow: 1px -1px 0 rgba(0, 0, 0, 0.04);
348
+ }
349
+ .label .text { display: block; max-width: min(240px, calc(100vw - ${t+64}px)); overflow: hidden; text-overflow: ellipsis; }
350
+ .at-left .label { right: auto; left: calc(100% + 12px); transform: translate(-4px, -50%); }
351
+ .at-left .label::after { right: auto; left: -4px; }
352
+ .new .label { color: #00468f; }
353
+ .labelled .label { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(0, -50%); }
354
+ @media (hover: hover) { .bubble:hover .label { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(0, -50%); } }
355
+ .unlabelled .label, .bubble.dragging .label, .open .label { display: none; }
332
356
  .panel {
333
- position: fixed; z-index: 2147483001; width: min(380px, calc(100vw - 32px)); height: min(640px, calc(100vh - ${u0+c1+32}px));
334
- border-radius: 16px; overflow: hidden; background: #fff; border: 1px solid #e8e8ec;
335
- box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3); animation: in 180ms cubic-bezier(0.16, 1, 0.3, 1);
357
+ position: fixed; z-index: 2147483001; width: min(380px, calc(100vw - 32px)); height: min(640px, calc(100vh - ${t+r0+32}px));
358
+ border-radius: 20px; overflow: hidden; background: #fff; border: 1px solid rgba(15, 23, 42, 0.08);
359
+ box-shadow: 0 28px 64px -16px rgba(15, 23, 42, 0.3), 0 10px 24px -10px rgba(15, 23, 42, 0.14);
360
+ animation: in 180ms cubic-bezier(0.16, 1, 0.3, 1);
336
361
  }
337
362
  .panel[hidden] { display: none; }
338
363
  .panel iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
@@ -341,5 +366,5 @@ iframe.on { visibility: visible; }`,A=document.createElement("iframe"),A.allow="
341
366
  .panel { inset: 0 !important; width: 100vw !important; height: 100dvh !important; border-radius: 0; border: 0; }
342
367
  .open .bubble { display: none; }
343
368
  }
344
- @media (prefers-reduced-motion: reduce) { .panel { animation: none; } .bubble { transition: none; } }
345
- `,U0=null,q0=null,P0=null,a=null,D0=null,u1=null,C0=!1,Y1=0,o6=(z)=>z.endsWith("/")?z:`${z}/`,u3=()=>{try{return new URL(M().host).origin}catch{return"*"}};function p3(z,J){let $=new URL("embed/support",o6(z));return $.searchParams.set("realm",J),$.searchParams.set("hand","1"),$.toString()}function d3(z){return z+u0+c1-16}function i3(z){return`min(640px, calc(100vh - ${z+u0+c1+16}px))`}function c3(z){return z<=0?"":z>99?"99+":String(z)}function r6(z){if(Y1=Math.max(0,Math.floor(z)||0),!u1||!D0)return;let J=i(M().locale);u1.textContent=c3(Y1),u1.hidden=Y1===0,D0.setAttribute("aria-label",Y1?`${J.chatOpen} · ${J.chatUnread.replace("{n}",String(Y1))}`:J.chatOpen)}var y2=null;async function p1(){return y2??=(async()=>{try{let z=await _0();if(!z)return void b2(!1);let J=M(),$=await fetch(new URL("ingest/support-unread",o6(J.host)).toString(),{headers:{"x-realm-key":J.realmKey,authorization:`Bearer ${z}`}});if($.status===404||$.status===401||$.status===403)return void b2(!1);if(!$.ok)return;b2(!0);let j=await $.json();if(!C0)r6(typeof j.total==="number"?j.total:0)}catch{}finally{y2=null}})(),y2}function b2(z){if(!U0)return;U0.style.display=z?"":"none";let J=o1(M().chat);if(z&&J?.side==="right")document.documentElement.style.setProperty("--lw-chat-lift",`${d3(J.y)}px`);else document.documentElement.style.removeProperty("--lw-chat-lift")}function d1(z){a?.contentWindow?.postMessage({source:g3,...z},u3())}async function l3(z){if(!a||z.source!==a.contentWindow)return;let J=z.data;if(!J||J.source!==v3)return;if(J.type==="hello"){let $=await _0();if($)d1({type:"token",token:$});return}if(J.type==="ready")return d1({type:C0?"shown":"hidden"});if(J.type==="close")return i1();if(J.type==="unread"&&typeof J.total==="number")return r6(J.total);if(J.type==="report")i1(!1),k0({type:"manual",fromChat:!0})}var o3=(z)=>void l3(z);function r3(z){if(C0&&z.key==="Escape")i1()}function v2(){if(!U0||!P0||!q0)l1();if(!P0)return;let z=M();if(!a)a=document.createElement("iframe"),a.src=p3(z.host,z.realmKey),a.title=i(z.locale).chatTitle,a.setAttribute("allow","clipboard-write"),P0.append(a);C0=!0,P0.hidden=!1,q0?.querySelector(".wrap")?.classList.add("open"),D0?.setAttribute("aria-expanded","true"),d1({type:"shown"}),a.focus()}function i1(z=!0){if(!P0)return;if(C0=!1,P0.hidden=!0,q0?.querySelector(".wrap")?.classList.remove("open"),D0?.setAttribute("aria-expanded","false"),d1({type:"hidden"}),z)D0?.focus();p1()}var s3=null,l6=0;function n3(){if(Date.now()-l6<30000)return;l6=Date.now(),p1()}function l1(){if(U0||typeof document>"u")return;let z=M(),J=o1(z.chat);if(!J||!z.identity)return;let $=i(z.locale);U0=document.createElement(b3),U0.style.display="none",q0=U0.attachShadow({mode:"open"});let j=J.side;q0.innerHTML=`<style>${h3}</style><div class="wrap"><div class="panel" role="dialog" aria-label="${$.chatTitle}" hidden></div><button type="button" class="bubble" aria-expanded="false" aria-haspopup="dialog" aria-label="${$.chatOpen}" title="${$.chatOpen}">${m3}<span class="badge" hidden></span></button></div>`,P0=q0.querySelector(".panel"),D0=q0.querySelector(".bubble"),u1=q0.querySelector(".badge"),Object.assign(D0.style,{[j]:`${J.x}px`,bottom:`${J.y}px`}),Object.assign(P0.style,{[j]:`${J.x}px`,bottom:`${J.y+u0+c1}px`,height:i3(J.y)}),D0.addEventListener("click",()=>C0?i1():v2()),document.body.append(U0),window.addEventListener("message",o3),document.addEventListener("keydown",r3),window.addEventListener("focus",n3);let Q;s3=d6(()=>{if(C0)return;clearTimeout(Q),Q=setTimeout(()=>void p1(),500)}),p1()}var s6=!1;function g2(z={}){if(s6||typeof window>"u")return;if(!H1()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(s6=!0,R4(),X4(),z4(),F4(),E4(),z.ui===!1)return;let J=i(M().locale);if(U4((j)=>{x0(j.message??J.crashed,"error",{label:J.crashAction,onClick:()=>k0(j)})}),W6(),!document.querySelector(z1))document.body.append(document.createElement(z1));let $=window.requestIdleCallback;if($)$(()=>void E0(),{timeout:5000});else setTimeout(()=>void E0(),2000);if($)$(()=>f2(),{timeout:8000});else setTimeout(()=>f2(),3000);if(M().chat)if(!M().identity)console.warn("[debug-capture] `chat` needs `identity` — a chat is a signed-in person's; the bubble is not shown");else if($)$(()=>l1(),{timeout:4000});else setTimeout(()=>l1(),1500)}var n6=document.currentScript,w=n6?.dataset??{},a3="rrweb-record.mjs";x4(()=>import(new URL(a3,n6?.src??location.href).href));function t3(z){if(!z)return{};try{let J=JSON.parse(z);if(!J||typeof J!=="object"||Array.isArray(J))return{};return Object.fromEntries(Object.entries(J).filter(([,$])=>typeof $==="string"&&$.trim()))}catch{return{}}}if(w.host&&w.realmKey)if(h2({host:w.host,realmKey:w.realmKey,app:{name:w.appName??document.title??"app",version:w.appVersion??"0.0.0",environment:w.environment??"production"},module:d2(t3(w.modules)),locale:w.locale==="en"?"en":"th",...w.replay!==void 0?{replay:{seconds:Number(w.replay)||void 0}}:{},...w.identityUrl?{identity:()=>fetch(w.identityUrl,{credentials:"include"}).then((z)=>z.ok?z.text():null).catch(()=>null)}:{},...w.chat!==void 0&&w.chat!=="false"?{chat:w.chat==="left"?{position:"left"}:!0}:{}}),document.body)g2();else document.addEventListener("DOMContentLoaded",()=>g2(),{once:!0});window.lwReportProblem=k0;window.lwOpenSupportChat=v2;})();
369
+ @media (prefers-reduced-motion: reduce) { .panel { animation: none; } .bubble, .label { transition: none; } }
370
+ `,a=null,Q0=null,p=null,Z0=null,S=null,e1=null,s2=null,I0=!1,o0=0,J4=(J)=>J.endsWith("/")?J:`${J}/`,K9=()=>{try{return new URL(M().host).origin}catch{return"*"}};function G9(J,z){let $=new URL("embed/support",J4(J));return $.searchParams.set("realm",z),$.searchParams.set("hand","1"),$.toString()}function U9(J){return new URL("support-face.webp",J4(J)).toString()}function q9(J){return J+t+r0-16}var X0=8,H9=200;function D9(J,z,$,j){return{side:J<$.w/2?"left":"right",x:j,y:q8($.h-z-t/2,$.h)}}function q8(J,z){return Math.round(Math.min(Math.max(J,X0),Math.max(X0,z-t-X0)))}function P9(J){return J.side==="right"&&J.y<H9?q9(J.y):0}function M9(J,z){let $=z-(J.y+t+r0)-16,j=J.y-r0-16;if($>=420||$>=j)return{bottom:J.y+t+r0,height:Math.max(240,Math.min(640,$))};return{top:z-J.y+r0,height:Math.max(240,Math.min(640,j))}}function H8(J,z,$){return{x:Math.round(Math.min(Math.max(J.x,X0),Math.max(X0,$.w-z.w-X0))),y:Math.round(Math.min(Math.max(J.y,X0),Math.max(X0,$.h-z.h-X0)))}}function F9(J){return J<=0?"":J>99?"99+":String(J)}function D8(J){if(o0=Math.max(0,Math.floor(J)||0),!e1||!S)return;let z=l(M().locale);e1.textContent=F9(o0),e1.hidden=o0===0,S.setAttribute("aria-label",o0?`${z.chatOpen} · ${z.chatUnread.replace("{n}",String(o0))}`:z.chatOpen),Z2()}function B9(J,z){if(J.own===!1)return null;let $=J.unread>0,j=typeof J.own==="string"?J.own.trim().slice(0,60):"";return{text:$?z.chatLabelNew:j||z.chatLabel,shown:!J.open&&($||!J.opened),isNew:$}}var M1=!1;function Z2(){if(!s2||!S)return;let J=M(),z=J.chat&&J.chat!==!0?J.chat.label:void 0,$=B9({own:z,unread:o0,opened:M1,open:I0},l(J.locale));S.classList.toggle("unlabelled",!$),S.classList.toggle("labelled",!!$?.shown),S.classList.toggle("new",!!$?.isNew),S.classList.toggle("at-left",g.side==="left"),s2.querySelector(".text").textContent=$?.text??""}var r2=null;async function J2(){return r2??=(async()=>{try{let J=await T0();if(!J)return void n2(!1);let z=M(),$=await fetch(new URL("ingest/support-unread",J4(z.host)).toString(),{headers:{"x-realm-key":z.realmKey,authorization:`Bearer ${J}`}});if($.status===404||$.status===401||$.status===403)return void n2(!1);if(!$.ok)return;n2(!0);let j=await $.json();if(!I0)D8(typeof j.total==="number"?j.total:0)}catch{}finally{r2=null}})(),r2}function n2(J){if(!a)return;if(a.style.display=J?"":"none",J)m1(a);F1()}var g={side:"right",x:16,y:16},A0=null,N9=380,P8=()=>`lw-support-chat-place:${M().realmKey}`,z2=()=>({w:window.innerWidth,h:window.innerHeight}),$2=!1;function _9(){let J=_1(M().chat);if(J)g={side:J.side,x:J.x,y:J.y};try{let z=JSON.parse(localStorage.getItem(P8())??"null"),$=z?.bubble;if($2=!!$&&($.side==="left"||$.side==="right")&&typeof $.y==="number"&&Number.isFinite($.y),$2)g={...g,side:$.side,y:$.y};let j=z?.panel;A0=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,M1=z?.opened===!0}catch{}}function z4(){try{localStorage.setItem(P8(),JSON.stringify({...$2?{bubble:{side:g.side,y:g.y}}:{},panel:A0,...M1?{opened:!0}:{}}))}catch{}}function F1(){if(!S||!p)return;let J=z2(),z=q8(g.y,J.h),$=g.side==="right"?"left":"right";if(Object.assign(S.style,{[g.side]:`${g.x}px`,[$]:"",bottom:`${z}px`,top:""}),A0){let Q={w:Math.min(N9,J.w-32),h:Math.min(A0.h,J.h-2*X0)},Z=H8(A0,Q,J);Object.assign(p.style,{left:`${Z.x}px`,top:`${Z.y}px`,right:"",bottom:"",height:`${Q.h}px`})}else{let Q=M9({...g,y:z},J.h);Object.assign(p.style,{[g.side]:`${g.x}px`,[$]:"",bottom:Q.bottom!==void 0?`${Q.bottom}px`:"",top:Q.top!==void 0?`${Q.top}px`:"",height:`${Q.height}px`})}let j=a&&a.style.display!=="none"?P9({...g,y:z}):0;if(j)document.documentElement.style.setProperty("--lw-chat-lift",`${j}px`);else document.documentElement.style.removeProperty("--lw-chat-lift");Z2()}var s=null,a2=!1;function I9(J){if(J.button!==0)return;s={id:J.pointerId,sx:J.clientX,sy:J.clientY,moved:!1};try{S?.setPointerCapture(J.pointerId)}catch{}}function C9(J){if(!s||J.pointerId!==s.id||!S)return;if(!s.moved&&Math.hypot(J.clientX-s.sx,J.clientY-s.sy)<6)return;s.moved=!0,S.classList.add("dragging"),Object.assign(S.style,{left:`${J.clientX-t/2}px`,top:`${J.clientY-t/2}px`,right:"",bottom:""})}function G8(J){if(!s||J.pointerId!==s.id)return;let z=s;if(s=null,S?.classList.remove("dragging"),!z.moved)return;if(a2=!0,setTimeout(()=>a2=!1,0),J.type==="pointerup")g=D9(J.clientX,J.clientY,z2(),_1(M().chat)?.x??16),$2=!0,A0=null,z4();F1()}var m=null;function t2(J){if(!p||typeof J.x!=="number"||typeof J.y!=="number"||z2().w<640)return;if(J.phase==="start"){let z=p.getBoundingClientRect();m={sx:J.x,sy:J.y,x:z.left,y:z.top,lx:J.x,ly:J.y,h:Math.round(z.height)||640},e2(!0);return}if(!m)return;if(m.lx=J.x,m.ly=J.y,A0={...H8({x:m.x+(J.x-m.sx),y:m.y+(J.y-m.sy)},{w:p.offsetWidth,h:m.h},z2()),h:m.h},F1(),J.phase==="end")m=null,e2(!1),z4()}var P1=null;function e2(J){if(P1){for(let z of["pointermove","pointerup","pointercancel"])window.removeEventListener(z,P1,!0);P1=null}if(!J)return;P1=(z)=>{if(!m)return e2(!1);if(z.type==="pointermove"&&z.buttons!==0)return t2({phase:"move",x:z.screenX,y:z.screenY});let $=z.type==="pointerup";t2({phase:"end",x:$?z.screenX:m.lx,y:$?z.screenY:m.ly})};for(let z of["pointermove","pointerup","pointercancel"])window.addEventListener(z,P1,!0)}var O9=()=>F1();function j2(J){Z0?.contentWindow?.postMessage({source:V9,...J},K9())}async function L9(J){if(!Z0||J.source!==Z0.contentWindow)return;let z=J.data;if(!z||z.source!==X9)return;if(z.type==="hello"){let $=await T0();if($)j2({type:"token",token:$});return}if(z.type==="ready")return j2({type:I0?"shown":"hidden"});if(z.type==="close")return Q2();if(z.type==="drag")return t2(z);if(z.type==="unread"&&typeof z.total==="number")return D8(z.total);if(z.type==="report")Q2(!1),g0({type:"manual",fromChat:!0})}var S9=(J)=>void L9(J);function R9(J){if(I0&&J.key==="Escape")Q2()}function $4(){if(!a||!p||!Q0)X2();if(!p)return;let J=M();if(!Z0)Z0=document.createElement("iframe"),Z0.src=G9(J.host,J.realmKey),Z0.title=l(J.locale).chatTitle,Z0.setAttribute("allow","clipboard-write"),p.append(Z0);if(I0=!0,!M1)M1=!0,z4();p.hidden=!1,Q0?.querySelector(".wrap")?.classList.add("open"),S?.setAttribute("aria-expanded","true"),Z2(),j2({type:"shown"}),Z0.focus()}function Q2(J=!0){if(!p)return;if(I0=!1,p.hidden=!0,Q0?.querySelector(".wrap")?.classList.remove("open"),S?.setAttribute("aria-expanded","false"),Z2(),j2({type:"hidden"}),J)S?.focus();J2()}var T9=null,U8=0;function A9(){if(Date.now()-U8<30000)return;U8=Date.now(),J2()}function X2(){if(a||typeof document>"u")return;let J=M();if(!_1(J.chat)||!J.identity)return;let $=l(J.locale);a=document.createElement(Z9),a.style.display="none",Q0=a.attachShadow({mode:"open"}),Q0.innerHTML=`<style>${Y9}</style><div class="wrap"><div class="panel" role="dialog" aria-label="${$.chatTitle}" hidden></div><button type="button" class="bubble" aria-expanded="false" aria-haspopup="dialog" aria-label="${$.chatOpen}" title="${$.chatMove}">${W9}<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>`,p=Q0.querySelector(".panel"),S=Q0.querySelector(".bubble"),e1=Q0.querySelector(".badge"),s2=Q0.querySelector(".label");let j=Q0.querySelector(".face");j.addEventListener("load",()=>S?.classList.add("has-face"),{once:!0}),j.src=U9(J.host),_9(),F1(),S.addEventListener("click",()=>{if(a2)return;if(I0)Q2();else $4()}),S.addEventListener("pointerdown",I9),S.addEventListener("pointermove",C9),S.addEventListener("pointerup",G8),S.addEventListener("pointercancel",G8),document.body.append(a),window.addEventListener("message",S9),document.addEventListener("keydown",R9),window.addEventListener("focus",A9),window.addEventListener("resize",O9);let Q;T9=W8(()=>{if(I0)return;clearTimeout(Q),Q=setTimeout(()=>void J2(),500)}),J2()}var M8=!1;function j4(J={}){if(M8||typeof window>"u")return;if(!I1()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(M8=!0,l4(),L4(),B4(),v4(),a4(),J.ui===!1)return;let z=l(M().locale);if(E4((j)=>{v0(j.message??z.crashed,"error",{label:z.crashAction,onClick:()=>g0(j)})}),R6(),!document.querySelector(V1))document.body.append(document.createElement(V1));let $=window.requestIdleCallback;if($)$(()=>void h0(),{timeout:5000});else setTimeout(()=>void h0(),2000);if($)$(()=>o2(),{timeout:8000});else setTimeout(()=>o2(),3000);if(M().chat)if(!M().identity)console.warn("[debug-capture] `chat` needs `identity` — a chat is a signed-in person's; the bubble is not shown");else if($)$(()=>X2(),{timeout:4000});else setTimeout(()=>X2(),1500)}var F8=document.currentScript,w=F8?.dataset??{},k9="rrweb-record.mjs";s4(()=>import(new URL(k9,F8?.src??location.href).href));function x9(J){if(!J)return{};try{let z=JSON.parse(J);if(!z||typeof z!=="object"||Array.isArray(z))return{};return Object.fromEntries(Object.entries(z).filter(([,$])=>typeof $==="string"&&$.trim()))}catch{return{}}}if(w.host&&w.realmKey)if(Z4({host:w.host,realmKey:w.realmKey,app:{name:w.appName??document.title??"app",version:w.appVersion??"0.0.0",environment:w.environment??"production"},module:W4(x9(w.modules)),locale:w.locale==="en"?"en":"th",...w.replay!==void 0?{replay:{seconds:Number(w.replay)||void 0}}:{},...w.identityUrl?{identity:()=>fetch(w.identityUrl,{credentials:"include"}).then((J)=>J.ok?J.text():null).catch(()=>null)}:{},...w.chat!==void 0&&w.chat!=="false"?{chat:w.chat==="left"?{position:"left"}:!0}:{}}),document.body)j4();else document.addEventListener("DOMContentLoaded",()=>j4(),{once:!0});window.lwReportProblem=g0;window.lwOpenSupportChat=$4;})();