@lightworkai.official/debug-capture 0.19.6 → 0.19.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var q3=((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 m1(J){if(!J)return null;let $=J===!0?{}:J,z=(j,Q)=>typeof j==="number"&&Number.isFinite(j)&&j>=0&&j<2000?j:Q;return{side:$.position==="left"?"left":"right",x:z($.offset?.x,16),y:z($.offset?.y,16)}}var P3={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},z0=null;function M3(J){let $=[];if(!J.host?.trim())$.push("host");if(!J.realmKey?.trim())$.push("realmKey");if(!J.app?.name?.trim())$.push("app.name");if(typeof J.module!=="function")$.push("module");if($.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${$.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");z0=J}function M(){if(!z0)throw Error("[debug-capture] configureDebugCapture() has not been called");return z0}function U1(){return z0!==null}function U0(){let J=M().app;return{name:J.name,version:J.version??"0.0.0",environment:J.environment??B3()}}function B3(){if(typeof window>"u")return"unknown";let J=window.location.hostname;if(J==="localhost"||J==="127.0.0.1"||J.endsWith(".local"))return"development";return"production"}function O0(J){let $=z0?.capture?.[J];return typeof $==="number"?$:P3[J]}function u1(J){let $=z0?.module;if(!$)return null;try{return $(J)??null}catch{return null}}function p1(){let J=z0?.redact;return{headers:J?.headers??[],queryKeys:(J?.queryKeys??[]).map(($)=>$.toLowerCase()),bodyKeys:(J?.bodyKeys??[]).map(($)=>$.toLowerCase())}}function d4(){return z0?.capture?.overlaySelectors??[]}var F3='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',N3="[data-lw-mask]",p4={fps:1,quality:0.5};function D1(){let J=z0?.replay;if(!J)return null;let $=J===!0?{}:J,z=(Z,X)=>typeof Z==="number"&&Z>0?Z:X,j=$.maskInputs!==!1,Q=$.recordCanvas?{fps:z(typeof $.recordCanvas==="object"?$.recordCanvas.fps:void 0,p4.fps),quality:z(typeof $.recordCanvas==="object"?$.recordCanvas.quality:void 0,p4.quality)}:null;return{seconds:z($.seconds,60),maskInputs:j,maskTextSelector:$.maskTextSelector?.trim()||(j?F3:N3),maskText:$.maskText===!0,blockSelector:$.blockSelector?.trim()||"[data-lw-private]",maxBytes:z($.maxBytes,4000000),canvas:Q}}function i4(J){if(typeof window>"u")return!1;let $;try{$=new URL(J,window.location.href)}catch{return!1}if(_3($))return!1;if($.origin===window.location.origin)return!0;return(z0?.capture?.bodyOrigins??[]).some((z)=>{try{return new URL(z).origin===$.origin}catch{return!1}})}function _3(J){if(!z0?.host)return!1;try{if(new URL(z0.host).origin!==J.origin)return!1}catch{return!1}return J.pathname.startsWith("/ingest/")}function I3(J){let $=Object.entries(J).map(([z,j])=>[z.replace(/\/+$/,"")||"/",j]).sort((z,j)=>j[0].length-z[0].length);return(z)=>{let j=(z||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of $)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var r0="‹redacted›",C3=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,O3=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),L3=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,S3=/[\w.+-]+@[\w-]+\.[\w.-]+/g,R3=/\d(?:[\d\s-]{7,})\d/g;function o0(J){return J.replace(S3,r0).replace(R3,r0)}function A3(J){if(C3.test(J))return!0;return p1().headers.some((z)=>z.toLowerCase()===J.toLowerCase())}function n0(J){let $={};for(let[z,j]of Object.entries(J))$[z]=A3(z)?r0:j;return $}function M0(J){try{let $=/^https?:\/\//i.test(J),z=new URL(J,$?void 0:"http://local.invalid"),j=!1;if(z.searchParams.forEach((Q,Z)=>{if(O3.has(Z.toLowerCase())||p1().queryKeys.includes(Z.toLowerCase()))z.searchParams.set(Z,r0),j=!0}),!j)return J;return $?z.toString():`${z.pathname}${z.search}`}catch{return J}}function T2(J,$){if($>6||J===null||typeof J!=="object")return J;if(Array.isArray(J))return J.map((j)=>T2(j,$+1));let z={};for(let[j,Q]of Object.entries(J)){let Z=L3.test(j)||p1().bodyKeys.some((X)=>j.toLowerCase().includes(X));z[j]=Z?r0:T2(Q,$+1)}return z}function s0(J,$){if(J==null)return null;let z=J,j=J.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);z=JSON.stringify(T2(Q,0))}catch{}if(z.length>$)return`${z.slice(0,$)}… [truncated ${z.length-$} chars]`;return z}var E2=120,x2=40,t0=(J,$)=>J.length>$?`${J.slice(0,$)}…`:J,k2=(J)=>{try{return decodeURIComponent(J)}catch{return J}},a0=[],c4=0,l4=!1;function H1(J,$,z,j){let Q=t0($,E2),Z=a0[a0.length-1];if(J==="navigate"&&Z?.kind==="click"){let W=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${W}`))return Z.at=new Date().toISOString(),Z;let Y=W.split(/[?#]/)[0]??W,G=Z.source?k2(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(G&&(Y===G||Y.startsWith(G)))return Z.detail=t0(`${Z.detail} → ${W}`,E2),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}c4+=1;let X={id:`act_${c4}`,at:new Date().toISOString(),kind:J,detail:Q,count:1,source:z,html:i1(j)};a0.push(X);while(a0.length>O0("maxActions"))E3(a0.shift());return X}var T3=200000,q1=0;function i1(J){if(!J)return;if(q1+J.length>T3)return;return q1+=J.length,J}function E3(J){if(!J)return;if(q1-=(J.html?.length??0)+(J.afterHtml?.length??0),q1<0)q1=0}function f2(J){return J&&J>1?` (×${J})`:""}function d1(J){return J instanceof Element&&Boolean(J.closest("[data-debug-reporter]"))}var x3='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',k3={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},r4={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function f3(J){let $=J.getAttribute("role");if($&&r4[$])return r4[$];return k3[J.tagName.toLowerCase()]??"ปุ่ม"}function w3(J,$){try{let z=J,j=0;while(z&&j<=$){let Q=e4(z);if(Q&&typeof Q.memoizedProps?.onClick==="function")return z;z=z.parentElement,j+=1}}catch{}return null}function y3(J){let $=J.getAttribute("aria-label")?.trim();if($)return $;let z=J.getAttribute("title")?.trim();if(z)return z;if(J instanceof HTMLInputElement||J instanceof HTMLTextAreaElement||J instanceof HTMLSelectElement)return(J.getAttribute("placeholder")||J.getAttribute("name")||"").trim();if(J instanceof HTMLImageElement)return(J.getAttribute("alt")||"").trim();let j=(J.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(J instanceof HTMLAnchorElement){let Q=J.getAttribute("href");if(Q?.startsWith("/"))return k2(Q)}return""}function v3(J){if(!(J instanceof Element))return null;let $=J.closest(x3)??w3(J,4);if(!$)return null;let z=$.tagName.toLowerCase();if(z==="html"||z==="body")return null;return $}function g3(J){let $=o0(y3(J));if(!$)return null;return`${f3(J)} “${t0($,x2)}”`}var t4=6000,b3=4000,h3=/(?:^|\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 m3(J){J.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let $=[J,...Array.from(J.querySelectorAll("*"))];for(let Q of $){for(let X of Array.from(Q.attributes)){let W=X.name.toLowerCase();if(W.startsWith("on")||W==="srcdoc"||W==="value"||W.startsWith("data-"))Q.removeAttribute(X.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let X=Z.replace(h3," ").replace(/\s+/g," ").trim();if(X)Q.setAttribute("class",X);else Q.removeAttribute("class")}}let z=document.createTreeWalker(J,NodeFilter.SHOW_TEXT),j=z.nextNode();while(j){if(j.nodeValue)j.nodeValue=o0(j.nodeValue);j=z.nextNode()}}function w2(J,$,z){try{let j=J.outerHTML;if(!j||j.length>$)return;let Q=J.cloneNode(!0);m3(Q);let Z=Q.outerHTML;return Z&&Z.length<=z?Z:void 0}catch{return}}var u3=(J)=>w2(J,t4,b3),p3=150000,d3=40000,o4=(J)=>w2(J,p3,d3);function i3(J){if(!(J instanceof HTMLInputElement)&&!(J instanceof HTMLTextAreaElement)&&!(J instanceof HTMLSelectElement))return null;let $=J.name||J.id||J.getAttribute("aria-label")||J.getAttribute("placeholder")||J.tagName.toLowerCase();return`ช่อง “${o0($)}”`}var n4=80;function e4(J){let $=Object.keys(J).find((z)=>z.startsWith("__reactFiber$")||z.startsWith("__reactInternalInstance$"));return $?J[$]:null}function c3(J){if(typeof J!=="function")return null;try{let $=Function.prototype.toString.call(J);return($.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??$.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function s4(J){if(!J)return;return`→ ${J.length>n4?`${J.slice(0,n4)}…`:J}`}function l3(J){try{let $=J.closest("a[href]")?.getAttribute("href");if($&&$.startsWith("/"))return s4($);let z=e4(J),j=0;while(z&&j<30){if(typeof z.memoizedProps?.onClick==="function")return s4(c3(z.memoizedProps.onClick));z=z.return,j+=1}return}catch{return}}var r3='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function o3(){let J=d4();return J.length?J.join(", "):r3}function n3(J){let $=J.getAttribute("role");if($==="status"||$==="alert")return"ข้อความแจ้งเตือน";if($==="menu")return"เมนู";if($==="listbox")return"รายการตัวเลือก";if($==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function s3(J){let $=J.getAttribute("aria-label")?.trim();if($)return $;let z=J.getAttribute("aria-labelledby");if(z){let Z=z.split(/\s+/).map((X)=>document.getElementById(X)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=J.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(J.textContent??"").replace(/\s+/g," ").trim()}function J6(J){let $=o0(s3(J)),z=n3(J);return $?`เปิด ${z} “${t0($,x2)}”`:`เปิด ${z}`}var a3='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',t3=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function e3(J){if(J.querySelector(a3))return!0;return t3.test(J.textContent??"")}var J5=400,$5=250,z5=8000;function j5(J,$){if(typeof MutationObserver>"u"){$.html=i1(o4(J));return}let z=Date.now(),j=!1,Q=()=>{j=!0,X.disconnect(),window.clearInterval(W),window.clearTimeout(Y)},Z=()=>{if(j)return;if(Q(),!J.isConnected)return;$.detail=t0(J6(J),E2),$.html=i1(o4(J))},X=new MutationObserver(()=>{z=Date.now()});X.observe(J,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let W=window.setInterval(()=>{if(j)return;if(!J.isConnected){Q();return}if(Date.now()-z>=J5&&!e3(J))Z()},$5),Y=window.setTimeout(Z,z5)}function Q5(J){if(d1(J))return;let $=H1("ui",J6(J));if($)j5(J,$)}function Z5(){if(typeof MutationObserver>"u")return;let J=new WeakSet;new MutationObserver((z)=>{for(let j of z)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=o3(),X=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let W of X){if(J.has(W))continue;J.add(W),Q5(W)}}}).observe(document.body,{childList:!0,subtree:!0})}var X5=1600,V5=2500;function a4(J){return{disabled:J.hasAttribute("disabled")||J.getAttribute("aria-disabled")==="true",busy:J.getAttribute("aria-busy")==="true",text:t0((J.textContent??"").replace(/\s+/g," ").trim(),x2)}}function W5(J,$){if(!J.disabled&&$.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!J.busy&&$.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(J.text!==$.text&&$.text)return`ข้อความเปลี่ยนเป็น “${$.text}”`;return null}function K5(J,$){if(typeof MutationObserver>"u")return;let z=a4(J),j=!1,Q=(W,Y)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(X),$.afterNote=W,Y)$.afterHtml=i1(w2(J,t4,V5))},Z=new MutationObserver(()=>{if(!J.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let W=W5(z,a4(J));if(W)Q(W,!0)});Z.observe(J,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let X=window.setTimeout(()=>{if(!j&&!J.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},X5)}function $6(){if(l4||typeof window>"u")return;l4=!0,document.addEventListener("click",(j)=>{if(d1(j.target))return;let Q=v3(j.target);if(!Q)return;let Z=g3(Q);if(!Z)return;let X=H1("click",`คลิก ${Z}`,l3(Q),u3(Q));if(X)K5(Q,X)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(d1(j.target))return;let Q=i3(j.target);if(Q)H1("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(d1(j.target))return;H1("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let J=()=>H1("navigate",`ไปที่ ${k2(M0(location.pathname+location.search))}`),$=history.pushState.bind(history),z=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=$(...j);return J(),Q},history.replaceState=(...j)=>{let Q=z(...j);return J(),Q},window.addEventListener("popstate",J),Z5()}function y2(){return a0.map((J)=>({...J}))}var z6=2000,c1=[],j6=0,Q6=!1;function v2(J,$){j6+=1,c1.push({id:`log_${j6}`,at:new Date().toISOString(),level:J,message:$.length>z6?`${$.slice(0,z6)}…`:$});while(c1.length>O0("maxConsoleEntries"))c1.shift()}function Y5(){let J=new WeakSet;return($,z)=>{if(typeof z==="object"&&z!==null){if(J.has(z))return"[Circular]";J.add(z)}if(typeof z==="bigint")return z.toString();return z}}function Z6(J){if(typeof J==="string")return J;if(J instanceof Error)return`${J.name}: ${J.message}`;try{let $=JSON.stringify(J,Y5());if($!==void 0)return $}catch{}try{return String(J)}catch{}try{return Object.prototype.toString.call(J)}catch{return`[${typeof J}]`}}function X6(){if(Q6||typeof window>"u")return;Q6=!0;let J=["log","info","warn","error","debug"];for(let $ of J){let z=console[$].bind(console);console[$]=(...j)=>{v2($,j.map(Z6).join(" ")),z(...j)}}window.addEventListener("error",($)=>{let z=$.filename?` (${$.filename}:${$.lineno}:${$.colno})`:"";v2("exception",`${$.message}${z}`)}),window.addEventListener("unhandledrejection",($)=>{let z=$.reason instanceof Error?`${$.reason.name}: ${$.reason.message}`:Z6($.reason);v2("unhandledrejection",z)})}function g2(){return c1.map((J)=>({...J}))}var V6=new Set,W6=new Set;function K6(J,$){return J.add($),()=>J.delete($)}function Y6(J,$){for(let z of[...J])z($)}function b2(J){return K6(V6,J)}function P1(J={type:"manual"}){Y6(V6,J)}function h2(J){return K6(W6,J)}function m2(J){Y6(W6,J)}var G5=15000,U5=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],G6=!1,U6=0;function D5(J){return U5.some(($)=>J.includes($))}function D6(J){let $=J.message??"";if(!$||D5($))return;let z=Date.now();if(z-U6<G5)return;U6=z,m2({...J,message:$})}function H6(){if(G6||typeof window>"u")return;G6=!0,window.addEventListener("error",(J)=>{if(!J.message&&!J.error)return;let $=J.error instanceof Error?J.error:null;D6({type:"runtime-error",message:J.message||($?$.message:"Unknown error"),stack:$?.stack})}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason;D6({type:"unhandledrejection",message:$ instanceof Error?$.message:String($),stack:$ instanceof Error?$.stack:void 0})})}var B6=4000,H5=1e6,q5=1e7,l1=[],q6=0,P6=!1;function F6(J){l1.push(J);while(l1.length>O0("maxRequests"))l1.shift()}function N6(){return q6+=1,`req_${q6}`}function M6(J){let $={};if(!J)return $;if(J instanceof Headers)J.forEach((z,j)=>{$[j]=z});else if(Array.isArray(J))for(let[z,j]of J)$[z]=j;else Object.assign($,J);return $}function P5(J){let $={};return J.forEach((z,j)=>{$[j]=z}),$}function M5(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 B5(J,$){let z="",j="GET",Q={},Z=null;if(typeof J==="string")z=J;else if(J instanceof URL)z=J.toString();else z=J.url,j=J.method||j,Q=M6(J.headers);if($){if($.method)j=$.method;if($.headers)Q={...Q,...M6($.headers)};if($.body!==void 0)Z=M5($.body)}return{method:j.toUpperCase(),url:z,headers:Q,body:Z}}function _6(J){return!i4(J)}function F5(J,$){if(_6($.url)){$.responseSnippet="[body not captured for this origin]";return}let z=J.headers.get("content-type")??"",j=Number(J.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(z)){$.responseSnippet=`[binary ${z||"unknown"}${Q}]`;return}if(j>H5){$.responseSnippet=`[response ${z||"text"}${Q} — omitted]`;return}try{J.clone().text().then((Z)=>{$.responseSnippet=s0(Z,O0("maxBodyChars"))}).catch(()=>{})}catch{}}function I6(J,$){if(/[?&]_rsc=/.test(J))return!0;for(let z of Object.keys($)){let j=z.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function N5(){if(typeof window>"u"||typeof window.fetch!=="function")return;let J=window.fetch.bind(window);window.fetch=Object.assign(async($,z)=>{let j=B5($,z);if(I6(j.url,j.headers))return J($,z);let Q={id:N6(),startedAt:new Date().toISOString(),method:j.method,url:M0(j.url),requestHeaders:n0(j.headers),requestBody:s0(j.body,B6),status:null,statusText:null,durationMs:null,via:"fetch"};F6(Q);let Z=performance.now();try{let X=await J($,z);return Q.status=X.status,Q.statusText=X.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=n0(P5(X.headers)),F5(X,Q),X}catch(X){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=X instanceof Error?`${X.name}: ${X.message}`:String(X),X}},J)}function _5(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let J=XMLHttpRequest.prototype,$=J.open,z=J.send,j=function(Z,X){let W=typeof X==="string"?X:X.toString();return this.__lwEntry=I6(W,{})?void 0:{id:N6(),startedAt:"",method:(Z||"GET").toUpperCase(),url:M0(W),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},$.apply(this,arguments)},Q=function(Z){let X=this.__lwEntry;if(X){X.startedAt=new Date().toISOString(),X.requestBody=typeof Z==="string"?s0(Z,B6):Z==null?null:"[non-string body]";let W=performance.now();F6(X),this.addEventListener("loadend",()=>{if(X.status=this.status||null,X.statusText=this.statusText||null,X.durationMs=Math.round(performance.now()-W),_6(X.url))X.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{X.responseSnippet=s0(this.responseText||"",O0("maxBodyChars"))}catch{}else{let Y=this.getResponseHeader("content-type")??this.responseType;X.responseSnippet=`[binary ${Y}]`}})}return z.apply(this,arguments)};J.open=j,J.send=Q}function C6(){if(P6)return;P6=!0,N5(),_5()}function u2(){let J=l1.map((z)=>({...z})),$=0;for(let z=J.length-1;z>=0;z-=1){let j=J[z],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if($+Q.length>q5)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else $+=Q.length}return J}var I5=4,O6=3,C5=4000,O5="[data-debug-reporter]",L5=()=>import("@rrweb/record");var j0=[],e0=null,r1=!1;function L6(){if(typeof window>"u"||e0||r1)return;let J=D1();if(!J)return;r1=!0;let $=()=>void S5(J);if("requestIdleCallback"in window)window.requestIdleCallback($,{timeout:3000});else setTimeout($,1000)}async function S5(J){let $;try{$=(await L5()).record}catch(z){r1=!1,console.warn("[debug-capture] session replay could not start:",z);return}if(e0)return;try{e0=$({emit:(z)=>R5(z),checkoutEveryNms:Math.max(1000,J.seconds*1000/2),checkoutEveryNth:C5,maskAllInputs:J.maskInputs,maskTextSelector:J.maskText?"*":J.maskTextSelector,blockSelector:`${J.blockSelector}, ${O5}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...J.canvas?{canvas:J.canvas.fps}:{}},recordCanvas:J.canvas!==null,...J.canvas?{dataURLOptions:{type:"image/webp",quality:J.canvas.quality}}:{},errorHandler:()=>!0})??null}catch(z){console.warn("[debug-capture] session replay could not start:",z)}finally{r1=!1}}function R5(J){if(J.type===I5||j0.length===0){if(j0.push([]),j0.length>O6)j0=j0.slice(-O6)}j0[j0.length-1].push(J)}function p2(J=Date.now()){let $=D1();if(!$||!j0.length)return null;let z=J-$.seconds*1000,j=j0.length-1;while(j>0&&(j0[j][0]?.timestamp??J)>z)j-=1;let Q=j0.slice(j).flat(),Z=Q[0]?.timestamp,X=Q[Q.length-1]?.timestamp;if(Z===void 0||X===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(X).toISOString(),durationMs:Math.max(0,X-Z)}}function A5(){return e0!==null}function T5(){e0?.(),e0=null,j0=[]}var E5={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindRequest:"คำขอ",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",problemInsteadShare:"แจ้งปัญหาแทน (แนบภาพหน้าจอ)",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTypeSearch:"ค้นหาเรื่องที่ขอ",requestTypeNone:"ไม่พบเรื่องที่ขอ — ลองคำอื่น",requestTypeCount:"{n} เรื่อง — เลื่อนดูหรือพิมพ์ค้นหา",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง",ringTitle:"ทีมงานกำลังโทรหาคุณ",ringAbout:"เรื่อง {key} · {title}",ringChat:"จากแชทกับทีมงาน",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า",ringHint:"เมื่อรับสาย เบราว์เซอร์จะขอใช้ไมโครโฟน · ระหว่างคุย ทีมงานอาจขอดูหน้าจอ — คุณเลือกได้เสมอว่าจะให้ดูหรือไม่",ringTest:"ทดสอบไมค์และลำโพงก่อนรับสาย",ringAnswer:"รับสาย",ringAnswering:"กำลังรับสาย…",ringFallback:"เปิดสายในหน้านี้ไม่ได้ — รับสายในแท็บใหม่แทน ไม่ต้องเข้าสู่ระบบอีก",chatOpen:"แชทกับทีมงาน",chatTitle:"แชทกับทีมงาน",chatUnread:"{n} ข้อความใหม่จากทีมงาน",chatMove:"แชทกับทีมงาน — ลากเพื่อย้ายไปที่อื่นได้ถ้าบังอะไรอยู่",chatLabel:"แชทกับทีมงาน",chatLabelNew:"มีข้อความใหม่จากทีมงาน"},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}",ringChat:"From your chat with support",ringHow:"Answer on your request's page — it opens in a new tab, already signed in",ringOpen:"Open to answer",ringDecline:"Decline",ringOpened:"Opened — press Answer in the new tab",ringBlocked:"Your browser blocked the new tab — open the call here",ringClose:"Close",ringTab:"\uD83D\uDCDE Incoming call",ringHint:"When you answer, your browser asks for the microphone · during the call the team may ask to see your screen — you always choose",ringTest:"Test the microphone and speaker first",ringAnswer:"Answer",ringAnswering:"Answering…",ringFallback:"The call can't open on this page — answer in a new tab instead, already signed in",chatOpen:"Chat with support",chatTitle:"Chat with support",chatUnread:"{n} new from support",chatMove:"Chat with support — drag to move it if it covers something",chatLabel:"Chat with us",chatLabelNew:"New message from support"};function s(J){return J==="en"?x5:E5}var k5="lw-debug-toasts",f5=6000,w5=`
1
+ var F3=((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 u1(J){if(!J)return null;let $=J===!0?{}:J,z=(j,Q)=>typeof j==="number"&&Number.isFinite(j)&&j>=0&&j<2000?j:Q;return{side:$.position==="left"?"left":"right",x:z($.offset?.x,16),y:z($.offset?.y,16)}}var N3={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},z0=null;function _3(J){let $=[];if(!J.host?.trim())$.push("host");if(!J.realmKey?.trim())$.push("realmKey");if(!J.app?.name?.trim())$.push("app.name");if(typeof J.module!=="function")$.push("module");if($.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${$.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");z0=J}function F(){if(!z0)throw Error("[debug-capture] configureDebugCapture() has not been called");return z0}function D1(){return z0!==null}function H0(){let J=F().app;return{name:J.name,version:J.version??"0.0.0",environment:J.environment??C3()}}function C3(){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 S0(J){let $=z0?.capture?.[J];return typeof $==="number"?$:N3[J]}function p1(J){let $=z0?.module;if(!$)return null;try{return $(J)??null}catch{return null}}function d1(){let J=z0?.redact;return{headers:J?.headers??[],queryKeys:(J?.queryKeys??[]).map(($)=>$.toLowerCase()),bodyKeys:(J?.bodyKeys??[]).map(($)=>$.toLowerCase())}}function i4(){return z0?.capture?.overlaySelectors??[]}var I3='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',O3="[data-lw-mask]",d4={fps:1,quality:0.5};function H1(){let J=z0?.replay;if(!J)return null;let $=J===!0?{}:J,z=(X,Z)=>typeof X==="number"&&X>0?X:Z,j=$.maskInputs!==!1,Q=$.recordCanvas?{fps:z(typeof $.recordCanvas==="object"?$.recordCanvas.fps:void 0,d4.fps),quality:z(typeof $.recordCanvas==="object"?$.recordCanvas.quality:void 0,d4.quality)}:null;return{seconds:z($.seconds,60),maskInputs:j,maskTextSelector:$.maskTextSelector?.trim()||(j?I3:O3),maskText:$.maskText===!0,blockSelector:$.blockSelector?.trim()||"[data-lw-private]",maxBytes:z($.maxBytes,4000000),canvas:Q}}function c4(J){if(typeof window>"u")return!1;let $;try{$=new URL(J,window.location.href)}catch{return!1}if(L3($))return!1;if($.origin===window.location.origin)return!0;return(z0?.capture?.bodyOrigins??[]).some((z)=>{try{return new URL(z).origin===$.origin}catch{return!1}})}function L3(J){if(!z0?.host)return!1;try{if(new URL(z0.host).origin!==J.origin)return!1}catch{return!1}return J.pathname.startsWith("/ingest/")}function S3(J){let $=Object.entries(J).map(([z,j])=>[z.replace(/\/+$/,"")||"/",j]).sort((z,j)=>j[0].length-z[0].length);return(z)=>{let j=(z||"/").replace(/\/+$/,"")||"/";for(let[Q,X]of $)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:X};return null}}var l0="‹redacted›",R3=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,A3=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),T3=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,E3=/[\w.+-]+@[\w-]+\.[\w.-]+/g,x3=/\d(?:[\d\s-]{7,})\d/g;function r0(J){return J.replace(E3,l0).replace(x3,l0)}function k3(J){if(R3.test(J))return!0;return d1().headers.some((z)=>z.toLowerCase()===J.toLowerCase())}function o0(J){let $={};for(let[z,j]of Object.entries(J))$[z]=k3(z)?l0:j;return $}function B0(J){try{let $=/^https?:\/\//i.test(J),z=new URL(J,$?void 0:"http://local.invalid"),j=!1;if(z.searchParams.forEach((Q,X)=>{if(A3.has(X.toLowerCase())||d1().queryKeys.includes(X.toLowerCase()))z.searchParams.set(X,l0),j=!0}),!j)return J;return $?z.toString():`${z.pathname}${z.search}`}catch{return J}}function E2(J,$){if($>6||J===null||typeof J!=="object")return J;if(Array.isArray(J))return J.map((j)=>E2(j,$+1));let z={};for(let[j,Q]of Object.entries(J)){let X=T3.test(j)||d1().bodyKeys.some((Z)=>j.toLowerCase().includes(Z));z[j]=X?l0:E2(Q,$+1)}return z}function n0(J,$){if(J==null)return null;let z=J,j=J.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);z=JSON.stringify(E2(Q,0))}catch{}if(z.length>$)return`${z.slice(0,$)}… [truncated ${z.length-$} chars]`;return z}var x2=120,k2=40,a0=(J,$)=>J.length>$?`${J.slice(0,$)}…`:J,f2=(J)=>{try{return decodeURIComponent(J)}catch{return J}},s0=[],l4=0,r4=!1;function q1(J,$,z,j){let Q=a0($,x2),X=s0[s0.length-1];if(J==="navigate"&&X?.kind==="click"){let W=Q.replace(/^ไปที่\s*/,"");if(X.detail.includes(`→ ${W}`))return X.at=new Date().toISOString(),X;let Y=W.split(/[?#]/)[0]??W,G=X.source?f2(X.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(G&&(Y===G||Y.startsWith(G)))return X.detail=a0(`${X.detail} → ${W}`,x2),X.source=void 0,X.at=new Date().toISOString(),X}if(X&&X.kind===J&&X.detail===Q){if(X.at=new Date().toISOString(),J!=="navigate")X.count=(X.count??1)+1;return X}l4+=1;let Z={id:`act_${l4}`,at:new Date().toISOString(),kind:J,detail:Q,count:1,source:z,html:c1(j)};s0.push(Z);while(s0.length>S0("maxActions"))w3(s0.shift());return Z}var f3=200000,P1=0;function c1(J){if(!J)return;if(P1+J.length>f3)return;return P1+=J.length,J}function w3(J){if(!J)return;if(P1-=(J.html?.length??0)+(J.afterHtml?.length??0),P1<0)P1=0}function w2(J){return J&&J>1?` (×${J})`:""}function i1(J){return J instanceof Element&&Boolean(J.closest("[data-debug-reporter]"))}var y3='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',g3={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},o4={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function v3(J){let $=J.getAttribute("role");if($&&o4[$])return o4[$];return g3[J.tagName.toLowerCase()]??"ปุ่ม"}function b3(J,$){try{let z=J,j=0;while(z&&j<=$){let Q=J6(z);if(Q&&typeof Q.memoizedProps?.onClick==="function")return z;z=z.parentElement,j+=1}}catch{}return null}function h3(J){let $=J.getAttribute("aria-label")?.trim();if($)return $;let z=J.getAttribute("title")?.trim();if(z)return z;if(J instanceof HTMLInputElement||J instanceof HTMLTextAreaElement||J instanceof HTMLSelectElement)return(J.getAttribute("placeholder")||J.getAttribute("name")||"").trim();if(J instanceof HTMLImageElement)return(J.getAttribute("alt")||"").trim();let j=(J.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(J instanceof HTMLAnchorElement){let Q=J.getAttribute("href");if(Q?.startsWith("/"))return f2(Q)}return""}function m3(J){if(!(J instanceof Element))return null;let $=J.closest(y3)??b3(J,4);if(!$)return null;let z=$.tagName.toLowerCase();if(z==="html"||z==="body")return null;return $}function u3(J){let $=r0(h3(J));if(!$)return null;return`${v3(J)} “${a0($,k2)}”`}var e4=6000,p3=4000,d3=/(?:^|\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 i3(J){J.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let $=[J,...Array.from(J.querySelectorAll("*"))];for(let Q of $){for(let Z of Array.from(Q.attributes)){let W=Z.name.toLowerCase();if(W.startsWith("on")||W==="srcdoc"||W==="value"||W.startsWith("data-"))Q.removeAttribute(Z.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let X=Q.getAttribute("class");if(X){let Z=X.replace(d3," ").replace(/\s+/g," ").trim();if(Z)Q.setAttribute("class",Z);else Q.removeAttribute("class")}}let z=document.createTreeWalker(J,NodeFilter.SHOW_TEXT),j=z.nextNode();while(j){if(j.nodeValue)j.nodeValue=r0(j.nodeValue);j=z.nextNode()}}function y2(J,$,z){try{let j=J.outerHTML;if(!j||j.length>$)return;let Q=J.cloneNode(!0);i3(Q);let X=Q.outerHTML;return X&&X.length<=z?X:void 0}catch{return}}var c3=(J)=>y2(J,e4,p3),l3=150000,r3=40000,n4=(J)=>y2(J,l3,r3);function o3(J){if(!(J instanceof HTMLInputElement)&&!(J instanceof HTMLTextAreaElement)&&!(J instanceof HTMLSelectElement))return null;let $=J.name||J.id||J.getAttribute("aria-label")||J.getAttribute("placeholder")||J.tagName.toLowerCase();return`ช่อง “${r0($)}”`}var s4=80;function J6(J){let $=Object.keys(J).find((z)=>z.startsWith("__reactFiber$")||z.startsWith("__reactInternalInstance$"));return $?J[$]:null}function n3(J){if(typeof J!=="function")return null;try{let $=Function.prototype.toString.call(J);return($.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??$.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function a4(J){if(!J)return;return`→ ${J.length>s4?`${J.slice(0,s4)}…`:J}`}function s3(J){try{let $=J.closest("a[href]")?.getAttribute("href");if($&&$.startsWith("/"))return a4($);let z=J6(J),j=0;while(z&&j<30){if(typeof z.memoizedProps?.onClick==="function")return a4(n3(z.memoizedProps.onClick));z=z.return,j+=1}return}catch{return}}var a3='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function t3(){let J=i4();return J.length?J.join(", "):a3}function e3(J){let $=J.getAttribute("role");if($==="status"||$==="alert")return"ข้อความแจ้งเตือน";if($==="menu")return"เมนู";if($==="listbox")return"รายการตัวเลือก";if($==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function J5(J){let $=J.getAttribute("aria-label")?.trim();if($)return $;let z=J.getAttribute("aria-labelledby");if(z){let X=z.split(/\s+/).map((Z)=>document.getElementById(Z)?.textContent?.trim()??"").filter(Boolean).join(" ");if(X)return X}let Q=J.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(J.textContent??"").replace(/\s+/g," ").trim()}function $6(J){let $=r0(J5(J)),z=e3(J);return $?`เปิด ${z} “${a0($,k2)}”`:`เปิด ${z}`}var $5='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',z5=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function j5(J){if(J.querySelector($5))return!0;return z5.test(J.textContent??"")}var Q5=400,X5=250,Z5=8000;function V5(J,$){if(typeof MutationObserver>"u"){$.html=c1(n4(J));return}let z=Date.now(),j=!1,Q=()=>{j=!0,Z.disconnect(),window.clearInterval(W),window.clearTimeout(Y)},X=()=>{if(j)return;if(Q(),!J.isConnected)return;$.detail=a0($6(J),x2),$.html=c1(n4(J))},Z=new MutationObserver(()=>{z=Date.now()});Z.observe(J,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let W=window.setInterval(()=>{if(j)return;if(!J.isConnected){Q();return}if(Date.now()-z>=Q5&&!j5(J))X()},X5),Y=window.setTimeout(X,Z5)}function W5(J){if(i1(J))return;let $=q1("ui",$6(J));if($)V5(J,$)}function K5(){if(typeof MutationObserver>"u")return;let J=new WeakSet;new MutationObserver((z)=>{for(let j of z)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let X=t3(),Z=Q.matches(X)?[Q]:Array.from(Q.querySelectorAll(X));for(let W of Z){if(J.has(W))continue;J.add(W),W5(W)}}}).observe(document.body,{childList:!0,subtree:!0})}var Y5=1600,G5=2500;function t4(J){return{disabled:J.hasAttribute("disabled")||J.getAttribute("aria-disabled")==="true",busy:J.getAttribute("aria-busy")==="true",text:a0((J.textContent??"").replace(/\s+/g," ").trim(),k2)}}function U5(J,$){if(!J.disabled&&$.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!J.busy&&$.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(J.text!==$.text&&$.text)return`ข้อความเปลี่ยนเป็น “${$.text}”`;return null}function D5(J,$){if(typeof MutationObserver>"u")return;let z=t4(J),j=!1,Q=(W,Y)=>{if(j)return;if(j=!0,X.disconnect(),window.clearTimeout(Z),$.afterNote=W,Y)$.afterHtml=c1(y2(J,e4,G5))},X=new MutationObserver(()=>{if(!J.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let W=U5(z,t4(J));if(W)Q(W,!0)});X.observe(J,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let Z=window.setTimeout(()=>{if(!j&&!J.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,X.disconnect()},Y5)}function z6(){if(r4||typeof window>"u")return;r4=!0,document.addEventListener("click",(j)=>{if(i1(j.target))return;let Q=m3(j.target);if(!Q)return;let X=u3(Q);if(!X)return;let Z=q1("click",`คลิก ${X}`,s3(Q),c3(Q));if(Z)D5(Q,Z)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(i1(j.target))return;let Q=o3(j.target);if(Q)q1("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(i1(j.target))return;q1("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let J=()=>q1("navigate",`ไปที่ ${f2(B0(location.pathname+location.search))}`),$=history.pushState.bind(history),z=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=$(...j);return J(),Q},history.replaceState=(...j)=>{let Q=z(...j);return J(),Q},window.addEventListener("popstate",J),K5()}function g2(){return s0.map((J)=>({...J}))}var j6=2000,l1=[],Q6=0,X6=!1;function v2(J,$){Q6+=1,l1.push({id:`log_${Q6}`,at:new Date().toISOString(),level:J,message:$.length>j6?`${$.slice(0,j6)}…`:$});while(l1.length>S0("maxConsoleEntries"))l1.shift()}function H5(){let J=new WeakSet;return($,z)=>{if(typeof z==="object"&&z!==null){if(J.has(z))return"[Circular]";J.add(z)}if(typeof z==="bigint")return z.toString();return z}}function Z6(J){if(typeof J==="string")return J;if(J instanceof Error)return`${J.name}: ${J.message}`;try{let $=JSON.stringify(J,H5());if($!==void 0)return $}catch{}try{return String(J)}catch{}try{return Object.prototype.toString.call(J)}catch{return`[${typeof J}]`}}function V6(){if(X6||typeof window>"u")return;X6=!0;let J=["log","info","warn","error","debug"];for(let $ of J){let z=console[$].bind(console);console[$]=(...j)=>{v2($,j.map(Z6).join(" ")),z(...j)}}window.addEventListener("error",($)=>{let z=$.filename?` (${$.filename}:${$.lineno}:${$.colno})`:"";v2("exception",`${$.message}${z}`)}),window.addEventListener("unhandledrejection",($)=>{let z=$.reason instanceof Error?`${$.reason.name}: ${$.reason.message}`:Z6($.reason);v2("unhandledrejection",z)})}function b2(){return l1.map((J)=>({...J}))}var W6=new Set,K6=new Set;function Y6(J,$){return J.add($),()=>J.delete($)}function G6(J,$){for(let z of[...J])z($)}function h2(J){return Y6(W6,J)}function B1(J={type:"manual"}){G6(W6,J)}function m2(J){return Y6(K6,J)}function u2(J){G6(K6,J)}var q5=15000,P5=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],U6=!1,D6=0;function B5(J){return P5.some(($)=>J.includes($))}function H6(J){let $=J.message??"";if(!$||B5($))return;let z=Date.now();if(z-D6<q5)return;D6=z,u2({...J,message:$})}function q6(){if(U6||typeof window>"u")return;U6=!0,window.addEventListener("error",(J)=>{if(!J.message&&!J.error)return;let $=J.error instanceof Error?J.error:null;H6({type:"runtime-error",message:J.message||($?$.message:"Unknown error"),stack:$?.stack})}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason;H6({type:"unhandledrejection",message:$ instanceof Error?$.message:String($),stack:$ instanceof Error?$.stack:void 0})})}var F6=4000,M5=1e6,F5=1e7,r1=[],P6=0,B6=!1;function N6(J){r1.push(J);while(r1.length>S0("maxRequests"))r1.shift()}function _6(){return P6+=1,`req_${P6}`}function M6(J){let $={};if(!J)return $;if(J instanceof Headers)J.forEach((z,j)=>{$[j]=z});else if(Array.isArray(J))for(let[z,j]of J)$[z]=j;else Object.assign($,J);return $}function N5(J){let $={};return J.forEach((z,j)=>{$[j]=z}),$}function _5(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 C5(J,$){let z="",j="GET",Q={},X=null;if(typeof J==="string")z=J;else if(J instanceof URL)z=J.toString();else z=J.url,j=J.method||j,Q=M6(J.headers);if($){if($.method)j=$.method;if($.headers)Q={...Q,...M6($.headers)};if($.body!==void 0)X=_5($.body)}return{method:j.toUpperCase(),url:z,headers:Q,body:X}}function C6(J){return!c4(J)}function I5(J,$){if(C6($.url)){$.responseSnippet="[body not captured for this origin]";return}let z=J.headers.get("content-type")??"",j=Number(J.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(z)){$.responseSnippet=`[binary ${z||"unknown"}${Q}]`;return}if(j>M5){$.responseSnippet=`[response ${z||"text"}${Q} — omitted]`;return}try{J.clone().text().then((X)=>{$.responseSnippet=n0(X,S0("maxBodyChars"))}).catch(()=>{})}catch{}}function I6(J,$){if(/[?&]_rsc=/.test(J))return!0;for(let z of Object.keys($)){let j=z.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function O5(){if(typeof window>"u"||typeof window.fetch!=="function")return;let J=window.fetch.bind(window);window.fetch=Object.assign(async($,z)=>{let j=C5($,z);if(I6(j.url,j.headers))return J($,z);let Q={id:_6(),startedAt:new Date().toISOString(),method:j.method,url:B0(j.url),requestHeaders:o0(j.headers),requestBody:n0(j.body,F6),status:null,statusText:null,durationMs:null,via:"fetch"};N6(Q);let X=performance.now();try{let Z=await J($,z);return Q.status=Z.status,Q.statusText=Z.statusText,Q.durationMs=Math.round(performance.now()-X),Q.responseHeaders=o0(N5(Z.headers)),I5(Z,Q),Z}catch(Z){throw Q.durationMs=Math.round(performance.now()-X),Q.error=Z instanceof Error?`${Z.name}: ${Z.message}`:String(Z),Z}},J)}function L5(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let J=XMLHttpRequest.prototype,$=J.open,z=J.send,j=function(X,Z){let W=typeof Z==="string"?Z:Z.toString();return this.__lwEntry=I6(W,{})?void 0:{id:_6(),startedAt:"",method:(X||"GET").toUpperCase(),url:B0(W),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},$.apply(this,arguments)},Q=function(X){let Z=this.__lwEntry;if(Z){Z.startedAt=new Date().toISOString(),Z.requestBody=typeof X==="string"?n0(X,F6):X==null?null:"[non-string body]";let W=performance.now();N6(Z),this.addEventListener("loadend",()=>{if(Z.status=this.status||null,Z.statusText=this.statusText||null,Z.durationMs=Math.round(performance.now()-W),C6(Z.url))Z.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{Z.responseSnippet=n0(this.responseText||"",S0("maxBodyChars"))}catch{}else{let Y=this.getResponseHeader("content-type")??this.responseType;Z.responseSnippet=`[binary ${Y}]`}})}return z.apply(this,arguments)};J.open=j,J.send=Q}function O6(){if(B6)return;B6=!0,O5(),L5()}function p2(){let J=r1.map((z)=>({...z})),$=0;for(let z=J.length-1;z>=0;z-=1){let j=J[z],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if($+Q.length>F5)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else $+=Q.length}return J}var S5=4,L6=3,R5=4000,A5="[data-debug-reporter]",T5=()=>import("@rrweb/record");var j0=[],t0=null,o1=!1;function S6(){if(typeof window>"u"||t0||o1)return;let J=H1();if(!J)return;o1=!0;let $=()=>void E5(J);if("requestIdleCallback"in window)window.requestIdleCallback($,{timeout:3000});else setTimeout($,1000)}async function E5(J){let $;try{$=(await T5()).record}catch(z){o1=!1,console.warn("[debug-capture] session replay could not start:",z);return}if(t0)return;try{t0=$({emit:(z)=>x5(z),checkoutEveryNms:Math.max(1000,J.seconds*1000/2),checkoutEveryNth:R5,maskAllInputs:J.maskInputs,maskTextSelector:J.maskText?"*":J.maskTextSelector,blockSelector:`${J.blockSelector}, ${A5}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...J.canvas?{canvas:J.canvas.fps}:{}},recordCanvas:J.canvas!==null,...J.canvas?{dataURLOptions:{type:"image/webp",quality:J.canvas.quality}}:{},errorHandler:()=>!0})??null}catch(z){console.warn("[debug-capture] session replay could not start:",z)}finally{o1=!1}}function x5(J){if(J.type===S5||j0.length===0){if(j0.push([]),j0.length>L6)j0=j0.slice(-L6)}j0[j0.length-1].push(J)}function d2(J=Date.now()){let $=H1();if(!$||!j0.length)return null;let z=J-$.seconds*1000,j=j0.length-1;while(j>0&&(j0[j][0]?.timestamp??J)>z)j-=1;let Q=j0.slice(j).flat(),X=Q[0]?.timestamp,Z=Q[Q.length-1]?.timestamp;if(X===void 0||Z===void 0)return null;return{events:Q,startedAt:new Date(X).toISOString(),endedAt:new Date(Z).toISOString(),durationMs:Math.max(0,Z-X)}}function k5(){return t0!==null}function f5(){t0?.(),t0=null,j0=[]}var w5={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindRequest:"คำขอ",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",problemInsteadShare:"แจ้งปัญหาแทน (แนบภาพหน้าจอ)",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTypeSearch:"ค้นหาเรื่องที่ขอ",requestTypeNone:"ไม่พบเรื่องที่ขอ — ลองคำอื่น",requestTypeCount:"{n} เรื่อง — เลื่อนดูหรือพิมพ์ค้นหา",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง",ringTitle:"ทีมงานกำลังโทรหาคุณ",ringAbout:"เรื่อง {key} · {title}",ringChat:"จากแชทกับทีมงาน",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า",ringHint:"เมื่อรับสาย เบราว์เซอร์จะขอใช้ไมโครโฟน · ระหว่างคุย ทีมงานอาจขอดูหน้าจอ — คุณเลือกได้เสมอว่าจะให้ดูหรือไม่",ringTest:"ทดสอบไมค์และลำโพงก่อนรับสาย",ringAnswer:"รับสาย",ringAnswering:"กำลังรับสาย…",ringFallback:"เปิดสายในหน้านี้ไม่ได้ — รับสายในแท็บใหม่แทน ไม่ต้องเข้าสู่ระบบอีก",chatOpen:"แชทกับทีมงาน",chatTitle:"แชทกับทีมงาน",chatUnread:"{n} ข้อความใหม่จากทีมงาน",chatMove:"แชทกับทีมงาน — ลากเพื่อย้ายไปที่อื่นได้ถ้าบังอะไรอยู่",chatLabel:"แชทกับทีมงาน",chatLabelNew:"มีข้อความใหม่จากทีมงาน"},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}",ringChat:"From your chat with support",ringHow:"Answer on your request's page — it opens in a new tab, already signed in",ringOpen:"Open to answer",ringDecline:"Decline",ringOpened:"Opened — press Answer in the new tab",ringBlocked:"Your browser blocked the new tab — open the call here",ringClose:"Close",ringTab:"\uD83D\uDCDE Incoming call",ringHint:"When you answer, your browser asks for the microphone · during the call the team may ask to see your screen — you always choose",ringTest:"Test the microphone and speaker first",ringAnswer:"Answer",ringAnswering:"Answering…",ringFallback:"The call can't open on this page — answer in a new tab instead, already signed in",chatOpen:"Chat with support",chatTitle:"Chat with support",chatUnread:"{n} new from support",chatMove:"Chat with support — drag to move it if it covers something",chatLabel:"Chat with us",chatLabelNew:"New message from support"};function t(J){return J==="en"?y5:w5}var g5="lw-debug-toasts",v5=6000,b5=`
2
2
  :host { all: initial; }
3
3
  .stack {
4
4
  position: fixed; top: 16px; right: 16px; z-index: 2147483001;
@@ -30,15 +30,15 @@ var q3=((J)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(J,{get:($,z)=
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
- `,d2=null;function y5(){if(typeof document>"u")return null;if(d2?.isConnected)return d2;let J=document.createElement(k5);J.dataset.debugReporter="true";let $=J.attachShadow({mode:"open"}),z=document.createElement("style");z.textContent=w5;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),$.append(z,j),document.body.append(J),d2=j,j}function g0(J,$="success",z){let j=U1()?M().toast:void 0;if(j){j({message:J,tone:$,...z?{action:z}:{}});return}let Q=y5();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=$;let X=document.createElement("span");X.className="dot";let W=document.createElement("span");W.textContent=J;let Y=document.createElement("button");Y.type="button",Y.className="close",Y.textContent="✕",Y.setAttribute("aria-label","ปิด");let G=()=>{window.clearTimeout(B),Z.remove()};Y.addEventListener("click",G);let B=$==="error"||z?0:window.setTimeout(G,f5);if(Z.append(X,W),z){let F=document.createElement("button");F.type="button",F.className="action",F.textContent=z.label,F.addEventListener("click",()=>{G(),z.onClick()}),Z.append(F)}Z.append(Y),Q.append(Z)}function S6(J,$,z){let j=J.filter((Z)=>Boolean(Z.error)||Z.status!=null&&Z.status>=400).slice(-20).map((Z)=>({method:Z.method,url:Z.url,status:Z.status,error:Z.error,at:Z.startedAt})),Q=$.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:z.slice(0,20)}}function R6(J){return J.failedRequests.length+J.errors.length+J.erroredQueries.length}function v5(){let J={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return J;let $=performance.memory;if($)J.memoryUsedMb=Math.round($.usedJSHeapSize/1024/1024),J.memoryLimitMb=Math.round($.jsHeapSizeLimit/1024/1024);let[z]=performance.getEntriesByType("navigation");if(z)J.domContentLoadedMs=Math.round(z.domContentLoadedEventEnd),J.loadEventMs=Math.round(z.loadEventEnd);return J}function i2(J,$){if(!J)return $;try{return J()}catch{return $}}function A6(){let J=M(),{pathname:$,search:z,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:$,search:z},module:u1($),user:i2(J.user,{}),apiHeaders:n0(i2(J.headers,{})),app:{name:U0().name,version:U0().version,environment:U0().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:v5(),extra:i2(J.extra,{})}}var g5=2,b5={manual:"ผู้ใช้แจ้งเอง","runtime-error":"ข้อผิดพลาด runtime (auto)",unhandledrejection:"Promise rejection (auto)","framework-error":"หน้าจอค้าง/พัง (auto)"};function M1(J){let $=u2(),z=g2();return{context:A6(),reason:J.reason,note:J.note,cause:S6($,z,J.erroredQueries),actionTrail:y2(),network:$,console:z,screenshotDataUrl:J.screenshotDataUrl,screenshotMethod:J.screenshotMethod,replay:p2()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:g5}}}function T6(J){return J.replace(/'/g,"'\\''")}function E6(J){let $=[`curl -X ${J.method} '${J.url}'`];for(let[z,j]of Object.entries(J.requestHeaders))$.push(` -H '${z}: ${T6(j)}'`);if(J.requestBody)$.push(` --data '${T6(J.requestBody)}'`);return $.join(" \\\n")}function h5(J){if(J.error)return`ERR ${J.error}`;return`${J.status??"—"} ${J.statusText??""}`.trim()}function m5(J){if(J.length===0)return"No network activity captured.";return J.map(($)=>{let z=$.durationMs!=null?`${$.durationMs}ms`:"—",j=`# [${h5($)}] ${$.method} ${$.url} (${z}, ${$.startedAt})`,Q=$.responseSnippet?`
33
+ `,i2=null;function h5(){if(typeof document>"u")return null;if(i2?.isConnected)return i2;let J=document.createElement(g5);J.dataset.debugReporter="true";let $=J.attachShadow({mode:"open"}),z=document.createElement("style");z.textContent=b5;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),$.append(z,j),document.body.append(J),i2=j,j}function g0(J,$="success",z){let j=D1()?F().toast:void 0;if(j){j({message:J,tone:$,...z?{action:z}:{}});return}let Q=h5();if(!Q)return;let X=document.createElement("div");X.className="toast",X.dataset.tone=$;let Z=document.createElement("span");Z.className="dot";let W=document.createElement("span");W.textContent=J;let Y=document.createElement("button");Y.type="button",Y.className="close",Y.textContent="✕",Y.setAttribute("aria-label","ปิด");let G=()=>{window.clearTimeout(C),X.remove()};Y.addEventListener("click",G);let C=$==="error"||z?0:window.setTimeout(G,v5);if(X.append(Z,W),z){let B=document.createElement("button");B.type="button",B.className="action",B.textContent=z.label,B.addEventListener("click",()=>{G(),z.onClick()}),X.append(B)}X.append(Y),Q.append(X)}function R6(J,$,z){let j=J.filter((X)=>Boolean(X.error)||X.status!=null&&X.status>=400).slice(-20).map((X)=>({method:X.method,url:X.url,status:X.status,error:X.error,at:X.startedAt})),Q=$.filter((X)=>X.level==="error"||X.level==="exception"||X.level==="unhandledrejection").slice(-20).map((X)=>X.message);return{failedRequests:j,errors:Q,erroredQueries:z.slice(0,20)}}function A6(J){return J.failedRequests.length+J.errors.length+J.erroredQueries.length}function m5(){let J={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return J;let $=performance.memory;if($)J.memoryUsedMb=Math.round($.usedJSHeapSize/1024/1024),J.memoryLimitMb=Math.round($.jsHeapSizeLimit/1024/1024);let[z]=performance.getEntriesByType("navigation");if(z)J.domContentLoadedMs=Math.round(z.domContentLoadedEventEnd),J.loadEventMs=Math.round(z.loadEventEnd);return J}function c2(J,$){if(!J)return $;try{return J()}catch{return $}}function T6(){let J=F(),{pathname:$,search:z,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:$,search:z},module:p1($),user:c2(J.user,{}),apiHeaders:o0(c2(J.headers,{})),app:{name:H0().name,version:H0().version,environment:H0().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:m5(),extra:c2(J.extra,{})}}var u5=2,p5={manual:"ผู้ใช้แจ้งเอง","runtime-error":"ข้อผิดพลาด runtime (auto)",unhandledrejection:"Promise rejection (auto)","framework-error":"หน้าจอค้าง/พัง (auto)"};function M1(J){let $=p2(),z=b2();return{context:T6(),reason:J.reason,note:J.note,cause:R6($,z,J.erroredQueries),actionTrail:g2(),network:$,console:z,screenshotDataUrl:J.screenshotDataUrl,screenshotMethod:J.screenshotMethod,replay:d2()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:u5}}}function E6(J){return J.replace(/'/g,"'\\''")}function x6(J){let $=[`curl -X ${J.method} '${J.url}'`];for(let[z,j]of Object.entries(J.requestHeaders))$.push(` -H '${z}: ${E6(j)}'`);if(J.requestBody)$.push(` --data '${E6(J.requestBody)}'`);return $.join(" \\\n")}function d5(J){if(J.error)return`ERR ${J.error}`;return`${J.status??"—"} ${J.statusText??""}`.trim()}function i5(J){if(J.length===0)return"No network activity captured.";return J.map(($)=>{let z=$.durationMs!=null?`${$.durationMs}ms`:"—",j=`# [${d5($)}] ${$.method} ${$.url} (${z}, ${$.startedAt})`,Q=$.responseSnippet?`
34
34
  # response: ${$.responseSnippet}`:"";return`${j}
35
- ${E6($)}${Q}`}).join(`
35
+ ${x6($)}${Q}`}).join(`
36
36
 
37
- `)}function u5(J){if(J.length===0)return"No console output captured.";return J.map(($)=>`[${$.at}] ${$.level.toUpperCase()}: ${$.message}`).join(`
38
- `)}function p5(J){if(J.length===0)return"No user actions captured.";let $=0;return J.map((z)=>{let j=z.source?` (${z.source})`:"",Q=`${z.detail}${f2(z.count)}${j}`;if(z.kind==="ui")return` ↳ [${z.at}] ${Q}`;$+=1;let Z=`${$}. [${z.at}] ${Q}`;return z.afterNote?`${Z}
39
- ↳ ${z.afterNote}`:Z}).join(`
40
- `)}function d5(J){let $=[];for(let z of J.failedRequests)$.push(`✗ ${z.status??z.error??"ERR"} ${z.method} ${z.url}`);for(let z of J.errors)$.push(`⚠ ${z}`);for(let z of J.erroredQueries)$.push(`⚠ React Query error: ${z.key} — ${z.error}`);return $}function i5(J){let{context:$}=J;return[`User : ${$.user.fullName??"—"} (${$.user.email??"—"})`,`Unit : ${$.user.unit??"—"}`,`Roles : ${$.user.roles?.join(", ")||"—"}`,`Route : ${$.route.href}`,`Module : ${$.module?`${$.module.label} (${$.module.key})`:"—"}`,`App : ${$.app.name} v${$.app.version} · ${$.app.environment}`,`Memory : ${$.performance.memoryUsedMb??"—"}/${$.performance.memoryLimitMb??"—"} MB`,`Client : ${$.client.userAgent}`,`Viewport : ${$.client.viewport.width}×${$.client.viewport.height} @${$.client.viewport.dpr}x`,`Reason : ${b5[J.reason.type]}${J.reason.message?` — ${J.reason.message}`:""}`,`Captured : ${J.network.length} requests · ${J.console.length} console · ${J.actionTrail.length} actions · screenshot=${J.screenshotMethod}${J.replay?` · replay=${Math.round(J.replay.durationMs/1000)}s`:""}`]}function c5(J){let $=d5(J.cause),z=[`## \uD83D\uDC1E ${J.context.app.name} — Debug Report`,`**Generated:** ${J.context.capturedAt}`,"",...i5(J).map((j)=>`- ${j.replace(/\s{2,}:/,":")}`),"",`**หมายเหตุจากผู้แจ้ง:** ${J.note.trim()||"(ไม่มี)"}`];if($.length>0)z.push("","### ⚠ สาเหตุที่น่าจะเป็น","```",...$,"```");return z.push("",`<details><summary>ขั้นตอน (${J.actionTrail.length})</summary>`,"","```",p5(J.actionTrail),"```","</details>","",`<details><summary>Network (${J.network.length})</summary>`,"","```",m5(J.network),"```","</details>","",`<details><summary>Console (${J.console.length})</summary>`,"","```",u5(J.console),"```","</details>","","_ข้อมูลลับ (token, cookie) ถูกปกปิดอัตโนมัติ · ภาพหน้าจออยู่ในไฟล์ .zip_"),z.join(`
41
- `)}function l5(J){return J.replace(/[:.]/g,"-").replace("T","_").slice(0,19)}function r5(J,$){return`debug-report_${l5(J.context.capturedAt)}.${$}`}function o5(J){return R6(J.cause)>0}async function o1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let z=await n5();if(z.status==="ok")return{dataUrl:z.dataUrl,method:"display-media"};if(z.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let $=await t5();if($)return{dataUrl:$,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function n5(){let J=null;try{let $={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};J=await navigator.mediaDevices.getDisplayMedia($);let z=await s5(J);return z?{status:"ok",dataUrl:z}:{status:"error"}}catch($){if($ instanceof DOMException&&($.name==="NotAllowedError"||$.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{J?.getTracks().forEach(($)=>$.stop())}}async function s5(J){let $=document.createElement("video");$.srcObject=J,$.muted=!0,$.playsInline=!0,await new Promise((X)=>{let W=!1,Y=()=>{if(W)return;W=!0,X()};$.onloadedmetadata=()=>{$.play().then(Y).catch(Y)},window.setTimeout(Y,1500)}),await a5($);let{videoWidth:z,videoHeight:j}=$;if(!z||!j)return null;let Q=document.createElement("canvas");Q.width=z,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage($,0,0,z,j),$.pause(),$.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function a5(J){return new Promise(($)=>{let z=!1,j=()=>{if(z)return;z=!0,$()},Q=J;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function t5(){let J=M().screenshotFallback;if(!J)return null;let $=await J().catch(()=>null);if(!$)return null;try{return await $(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:(z)=>!(z instanceof HTMLElement&&z.dataset?.debugReporter==="true")})}catch{return null}}var e5=2000,J9=0.82,$9=3000000;function z9(J){return new Promise(($,z)=>{let j=new Image;j.onload=()=>$(j),j.onerror=()=>z(Error("could not read the screenshot")),j.src=J})}async function n1(J){try{let $=await z9(J),z=Math.max($.naturalWidth,$.naturalHeight),j=Math.min(1,e5/z),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round($.naturalWidth*j)),Q.height=Math.max(1,Math.round($.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return J;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage($,0,0,Q.width,Q.height);let X=J9,W=Q.toDataURL("image/jpeg",X);while(W.length>$9&&X>0.4)X-=0.15,W=Q.toDataURL("image/jpeg",X);return W}catch{return J}}var j9=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Q9=/^\d+$/,Z9=/^[0-9a-f]{16,}$/i;function c2(J){if(J.reason.type==="manual")return null;let $=J.cause?.failedRequests?.[0];if(!$?.url)return null;let z;try{z=new URL($.url,"http://x").pathname}catch{z=$.url}let j=z.split("/").map((Z)=>j9.test(Z)||Q9.test(Z)||Z9.test(Z)?":id":Z).join("/"),Q=$.status??($.error?"ERR":"?");return`${$.method??"REQ"} ${j} ${Q}`}var l2=2000000;function s1(J){let{screenshotDataUrl:$,replay:z,...j}=J;return JSON.stringify(j).length}function r2(J,$=2000000){if(s1(J)<=$)return J;let z=J.network.map((Q)=>({...Q})),j={...J,network:z};for(let Q of z){if(s1(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&&s1(j)>$)j.network=j.network.slice(1);while(j.console.length>1&&s1(j)>$)j.console=j.console.slice(1);return j}function B1(J){let $="";for(let z=0;z<J.length;z+=32768)$+=String.fromCharCode(...J.subarray(z,z+32768));return btoa($)}var X9=4,V9=2,W9=3,K9=0,Y9=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),G9=/^\s*javascript:/i;function U9(J,$){let z=J.toLowerCase();if(z.startsWith("on")||z==="srcdoc")return!0;return typeof $==="string"&&G9.test($)}function x6(J,$=!1){if(!J)return;for(let z of Object.keys(J)){let j=J[z];if(U9(z,j)){if($)J[z]=null;else delete J[z];continue}if(typeof j!=="string"||!Y9.has(z)||!j.includes("?"))continue;J[z]=M0(j)}}function o2(J){if(!J)return;x6(J.attributes);for(let $ of J.childNodes??[])o2($)}function k6(J){let $=JSON.parse(JSON.stringify(J));for(let z of $){let j=z.data;if(!j||typeof j!=="object")continue;if(z.type===X9&&typeof j.href==="string")j.href=M0(j.href);else if(z.type===V9)o2(j.node);else if(z.type===W9&&j.source===K9){for(let Q of j.adds??[])o2(Q.node);for(let Q of j.attributes??[])x6(Q.attributes,!0)}}return $}var w6="session-replay.json.gz",D9="session-replay.json";function H9(J){return Boolean(J&&J.events.length>0)}async function q9(J){if(typeof CompressionStream>"u")return null;try{let $=new Blob([J]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response($).arrayBuffer())}catch{return null}}async function n2(J,$){if(!H9(J))return{summary:{omitted:"empty"}};let j={seconds:Math.round(J.durationMs/1000),events:J.events.length,startedAt:J.startedAt,endedAt:J.endedAt},Q=k6(J.events),Z=await f6(Q),X=!1;if(Z.bytes.byteLength>$&&B9(Q))Q=F9(Q),Z=await f6(Q),X=!0;let{bytes:W,compressed:Y}=Z;if(W.byteLength>$)return{summary:{...j,bytes:W.byteLength,omitted:"too-large"}};return{dataUri:`data:${Y?"application/gzip":"application/json"};base64,${B1(W)}`,filename:Y?w6:D9,summary:{...j,events:Q.length,bytes:W.byteLength,compressed:Y,...X?{canvasDropped:X}:{}}}}async function f6(J){let $=new TextEncoder().encode(JSON.stringify({events:J})),z=await q9($);return z?{bytes:z,compressed:!0}:{bytes:$,compressed:!1}}var P9=3,y6=2,M9=9;function v6(J){return J.type===P9&&J.data?.source===M9}function B9(J){return J.some(v6)||J.some(($)=>$.type===y6&&g6($.data.node))}function g6(J){if(!J)return!1;if(J.attributes&&"rr_dataURL"in J.attributes)return!0;return(J.childNodes??[]).some(g6)}function b6(J){if(!J)return;if(J.attributes&&"rr_dataURL"in J.attributes)delete J.attributes.rr_dataURL;for(let $ of J.childNodes??[])b6($)}function F9(J){let $=[];for(let z of J){if(v6(z))continue;if(z.type===y6)b6(z.data.node);$.push(z)}return $}var N9=new Set([502,503,504]);class B0 extends Error{kind;retryAfter;status;constructor(J,$,z,j){super(J);this.kind=$;this.retryAfter=z;this.status=j;this.name="ReportError"}}function _9(J){let{screenshotDataUrl:$,replay:z,...j}=J;return{dataUri:`data:application/json;base64,${B1(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function s2(){let J=M().identity;if(!J)return{};try{let $=await J();return $?{authorization:`Bearer ${$}`}:{}}catch{return{}}}async function a2(J,$){let z=M(),j=r2($,l2),{context:Q,note:Z}=j,X=[];if(j.screenshotDataUrl){let C=await n1(j.screenshotDataUrl);X.push({dataUri:C,filename:"screenshot.jpg"})}X.push(_9(j));let W,Y=D1();if(Y){let C=await n2(j.replay,Y.maxBytes);if(W=C.summary,"dataUri"in C)X.push({dataUri:C.dataUri,filename:C.filename})}let G=c2(j),B={title:J,description:Z.trim()||void 0,appName:U0().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:U0().name,module:Q.module?.label??""},context:{...G?{signature:G}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...W?{replay:W}:{}},attachments:X,...j.reason.fromChat?{fromChat:!0}:{}},F=await fetch(`${z.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":z.realmKey,...await s2()},body:JSON.stringify(B)}).catch(()=>{throw new B0("report never left the browser","offline")});if(!F.ok)throw await t2(F);return await F.json()}async function t2(J){let $=J.headers.get("retry-after"),z=await J.json().then((j)=>j.error).catch(()=>null);if(J.status===429)return new B0("rate limited","rateLimited",$??void 0);if(N9.has(J.status))return new B0("desk unavailable","unavailable");return new B0(z??`Report failed (${J.status})`,"rejected",void 0,J.status)}var a1=null,F1=null,h6=()=>M().host.replace(/\/$/,"");function t1(){return a1}function b0(){if(F1)return F1;return F1=(async()=>{try{let J=await fetch(`${h6()}/ingest/request-types`,{headers:{"x-realm-key":M().realmKey}}),$=J.ok?await J.json():null;a1=Array.isArray($?.types)?$.types.filter(I9):[]}catch{a1=[],F1=null}return a1??[]})(),F1}function I9(J){let $=J;return!!$&&typeof $.id==="string"&&typeof $.name==="string"}async function e2(J){let $=M(),z={};try{z=$.user?.()??{}}catch{z={}}let j=typeof window>"u"?null:window.location,Q={title:J.title,description:J.description.trim()||void 0,ticketTypeId:J.ticketTypeId,appName:U0().name,category:j?u1(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:z.email??void 0,requesterName:z.fullName??void 0,attachments:J.screenshotDataUrl?[{dataUri:await n1(J.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${h6()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await s2()},body:JSON.stringify(Q)}).catch(()=>{throw new B0("request never left the browser","offline")});if(!Z.ok)throw await t2(Z);return await Z.json()}var N1=Math.PI/6;function m6(J,$,z){let j=$.x-J.x,Q=$.y-J.y,Z=Math.hypot(j,Q),X=Math.atan2(Q,j),W=[{x:$.x,y:$.y},{x:$.x-z*Math.cos(X-N1),y:$.y-z*Math.sin(X-N1)},{x:$.x-z*Math.cos(X+N1),y:$.y-z*Math.sin(X+N1)}],Y=z*Math.cos(N1)*0.92;if(Z<=Y)return{shaft:null,head:W};return{shaft:{from:J,to:{x:$.x-Y*Math.cos(X),y:$.y-Y*Math.sin(X)}},head:W}}var J4="#f44336",C9="rgba(250, 204, 21, 0.4)",$4=22,u6="#2563eb",p6=9,d6=11,i6=18,c6=4,e1=8,O9=[{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 z4(J,$,z){let j=[],Q=null,Z=-1,X=null,W=null,Y=J.getContext("2d");function G(){let V=J.getBoundingClientRect().width;return V>0?J.width/V:1}function B(V){let K=J.getBoundingClientRect();return{x:(V.clientX-K.left)/K.width*J.width,y:(V.clientY-K.top)/K.height*J.height}}function F(V){let K=V.size??$4;if(!Y)return(V.text?.length??0)*K*0.6;Y.save(),Y.font=`600 ${K}px system-ui, sans-serif`;let D=Y.measureText(V.text??"").width;return Y.restore(),D}function C(V){if(V.tool==="text"){let K=V.size??$4;return{left:V.x1,top:V.y1,right:V.x1+F(V),bottom:V.y1+K*1.25}}return{left:Math.min(V.x1,V.x2),top:Math.min(V.y1,V.y2),right:Math.max(V.x1,V.x2),bottom:Math.max(V.y1,V.y2)}}function g(V){if(V.tool==="arrow")return[{id:"tail",x:V.x1,y:V.y1,cursor:"move"},{id:"head",x:V.x2,y:V.y2,cursor:"move"}];let K=C(V);if(V.tool==="text")return[{id:"size",x:K.right,y:K.bottom,cursor:"nwse-resize"}];return O9.map((D)=>({id:D.id,x:K.left+(K.right-K.left)*D.fx,y:K.top+(K.bottom-K.top)*D.fy,cursor:D.cursor}))}function T(V){let K=C(V);return{x:K.right+i6*G(),y:K.top-i6*G()}}function b(V,K,D){let{shaft:U,head:H}=m6({x:K.x1,y:K.y1},{x:K.x2,y:K.y2},Math.max(10,16*D));if(U)V.lineCap="butt",V.beginPath(),V.moveTo(U.from.x,U.from.y),V.lineTo(U.to.x,U.to.y),V.stroke();V.beginPath(),V.moveTo(H[0].x,H[0].y),V.lineTo(H[1].x,H[1].y),V.lineTo(H[2].x,H[2].y),V.closePath(),V.fill()}function I(V,K,D){V.save(),V.lineWidth=Math.max(2,3*D),V.strokeStyle=J4,V.fillStyle=J4;let U=C(K);if(K.tool==="rect")V.strokeRect(U.left,U.top,U.right-U.left,U.bottom-U.top);else if(K.tool==="arrow")b(V,K,D);else if(K.tool==="highlight")V.fillStyle=C9,V.fillRect(U.left,U.top,U.right-U.left,U.bottom-U.top);else if(K.tool==="text"&&K.text){let H=K.size??$4;V.font=`600 ${H}px system-ui, sans-serif`,V.textBaseline="top";let P=H*0.22;V.fillStyle="rgba(255,255,255,0.92)",V.fillRect(U.left-P,U.top-P,U.right-U.left+P*2,U.bottom-U.top+P*2),V.fillStyle=J4,V.fillText(K.text,U.left,U.top)}V.restore()}function N(V,K,D){let U=C(K);V.save(),V.strokeStyle=u6,V.lineWidth=Math.max(1,1.5*D),V.setLineDash([6*D,4*D]),V.strokeRect(U.left,U.top,U.right-U.left,U.bottom-U.top),V.setLineDash([]);let H=p6*D;for(let n of g(K))V.fillStyle="#fff",V.strokeStyle=u6,V.lineWidth=Math.max(1,1.5*D),V.beginPath(),V.rect(n.x-H/2,n.y-H/2,H,H),V.fill(),V.stroke();let P=T(K),f=d6*D;V.beginPath(),V.arc(P.x,P.y,f,0,Math.PI*2),V.fillStyle="#dc2626",V.fill(),V.strokeStyle="#fff",V.lineWidth=Math.max(1.5,2*D),V.beginPath(),V.moveTo(P.x-f*0.4,P.y-f*0.4),V.lineTo(P.x+f*0.4,P.y+f*0.4),V.moveTo(P.x+f*0.4,P.y-f*0.4),V.lineTo(P.x-f*0.4,P.y+f*0.4),V.stroke(),V.restore()}function _(){if(!Y)return;let V=G();if(Y.clearRect(0,0,J.width,J.height),Y.drawImage($,0,0,J.width,J.height),j.forEach((D,U)=>{if(U!==$0)I(Y,D,V)}),X)I(Y,X,V);let K=j[Z];if(K&&!X)N(Y,K,V)}function m(V,K,D,U,H){return Math.abs(V-D)<=H&&Math.abs(K-U)<=H}function E(V,K){let D=j[Z];if(!D)return null;let U=p6*G()/2+3*G();for(let H of g(D))if(m(V,K,H.x,H.y,U))return H.id;return null}function x(V,K){let D=j[Z];if(!D)return!1;let U=T(D);return m(V,K,U.x,U.y,d6*G())}function L(V,K){let D=6*G();for(let U=j.length-1;U>=0;U-=1){let H=j[U];if(H.tool==="arrow"){let f=H.x2-H.x1,n=H.y2-H.y1,G0=Math.hypot(f,n)||1,q=Math.max(0,Math.min(1,((V-H.x1)*f+(K-H.y1)*n)/(G0*G0)));if(Math.hypot(V-(H.x1+q*f),K-(H.y1+q*n))<=D+4*G())return U;continue}let P=C(H);if(V>=P.left-D&&V<=P.right+D&&K>=P.top-D&&K<=P.bottom+D)return U}return-1}function S(V,K,D,U,H){if(K==="tail"){V.x1=D.x1+U,V.y1=D.y1+H;return}if(K==="head"){V.x2=D.x2+U,V.y2=D.y2+H;return}if(K==="size"){let w=(D.size??24)+H;V.size=Math.max(10,w);return}let P=C(D),{left:f,top:n,right:G0,bottom:q}=P;if(K.includes("w"))f=Math.min(G0-e1,f+U);if(K.includes("e"))G0=Math.max(f+e1,G0+U);if(K.includes("n"))n=Math.min(q-e1,n+H);if(K.includes("s"))q=Math.max(n+e1,q+H);V.x1=f,V.y1=n,V.x2=G0,V.y2=q}function h(V,K,D,U){V.x1=K.x1+D,V.y1=K.y1+U,V.x2=K.x2+D,V.y2=K.y2+U}let k=null,$0=-1,y={x:0,y:0,size:24};function d(){let V=J.getBoundingClientRect().width;return V>0?V/J.width:1}function q0(V,K){if(!Y)return V.length*K*0.6;Y.save(),Y.font=`600 ${K}px system-ui, sans-serif`;let D=Y.measureText(V||" ").width;return Y.restore(),D}function r(){if(!k)return;let V=J.parentElement;if(!V)return;let K=J.getBoundingClientRect(),D=V.getBoundingClientRect(),U=d(),H=y.size*U;k.style.left=`${K.left-D.left+y.x*U}px`,k.style.top=`${K.top-D.top+y.y*U}px`,k.style.fontSize=`${H}px`,k.style.width=`${Math.max(40,q0(k.value,H)+H)}px`}function _0(V){let K=k;if(!K)return;k=null;let D=K.value.trim(),U=$0;if($0=-1,K.remove(),V&&D){if(U>=0&&j[U])j[U].text=D,Z=U;else j.push({tool:"text",x1:y.x,y1:y.y,x2:y.x,y2:y.y,text:D,size:y.size}),Z=j.length-1;z()}else if(U>=0)Z=U;J.focus(),_()}function P0(V,K,D=-1){_0(!0);let U=J.parentElement;if(!U)return;if(getComputedStyle(U).position==="static")U.style.position="relative";let H=D>=0?j[D]:void 0;$0=D,y={x:H?.x1??V,y:H?.y1??K,size:H?.size??Math.round(24*G())};let P=document.createElement("input");P.type="text",P.className="text-edit",P.value=H?.text??"",P.setAttribute("aria-label","ข้อความบนภาพ"),P.placeholder="ข้อความ",k=P,U.append(P),r(),P.addEventListener("input",r),P.addEventListener("keydown",(f)=>{if(f.stopPropagation(),f.key==="Enter")_0(!0);else if(f.key==="Escape")_0(!1)}),requestAnimationFrame(()=>{if(k!==P)return;P.focus(),P.select(),P.addEventListener("blur",()=>_0(!0))}),_()}function K0(V){let{x:K,y:D}=B(V);if(J.setPointerCapture(V.pointerId),x(K,D)){Y0();return}let U=E(K,D);if(U&&j[Z]){W={grip:U,x:K,y:D,start:{...j[Z]}};return}if(Q==="text"){if(V.preventDefault(),J.hasPointerCapture(V.pointerId))J.releasePointerCapture(V.pointerId);Q=null,z(),P0(K,D);return}if(Q){X={tool:Q,x1:K,y1:D,x2:K,y2:D},Z=-1;return}let H=L(K,D);Z=H,W=H>=0?{grip:"body",x:K,y:D,start:{...j[H]}}:null,_()}function c0(V){let{x:K,y:D}=B(V);if(X){X.x2=K,X.y2=D,_();return}if(W){let H=j[Z];if(!H)return;let P=K-W.x,f=D-W.y;if(W.grip==="body")h(H,W.start,P,f);else S(H,W.grip,W.start,P,f);_();return}if(Q){J.style.cursor="crosshair";return}if(x(K,D)){J.style.cursor="pointer";return}let U=E(K,D);if(U){let H=j[Z]?g(j[Z]).find((P)=>P.id===U):null;J.style.cursor=H?.cursor??"pointer";return}J.style.cursor=L(K,D)>=0?"move":"default"}function y0(){if(X){if(!(Math.abs(X.x2-X.x1)<c6&&Math.abs(X.y2-X.y1)<c6))j.push(X),Z=j.length-1,Q=null,z();X=null}if(W)W=null,z();_()}function I0(V){let K=J.getBoundingClientRect(),D=(V.clientX-K.left)/K.width*J.width,U=(V.clientY-K.top)/K.height*J.height,H=L(D,U),P=j[H];if(!P||P.tool!=="text")return;V.preventDefault(),P0(P.x1,P.y1,H)}function C0(V){if(Z<0)return;if(V.key==="Delete"||V.key==="Backspace")V.preventDefault(),Y0();else if(V.key==="Escape")V.preventDefault(),Z=-1,_()}function Y0(){if(Z<0)return;j.splice(Z,1),Z=-1,z(),_()}return J.addEventListener("pointerdown",K0),J.addEventListener("pointermove",c0),J.addEventListener("pointerup",y0),J.addEventListener("pointercancel",y0),J.addEventListener("dblclick",I0),J.tabIndex=0,J.addEventListener("keydown",C0),_(),{setTool(V){Q=V,Z=-1,J.style.cursor=V?"crosshair":"default",_()},deleteSelected:Y0,clear(){j.length=0,Z=-1,z(),_()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let V=document.createElement("canvas");V.width=$.naturalWidth,V.height=$.naturalHeight;let K=V.getContext("2d");if(!K)return J.toDataURL("image/png");K.drawImage($,0,0);let D=G();for(let U of j)I(K,U,D);return V.toDataURL("image/png")},destroy(){_0(!1),J.removeEventListener("pointerdown",K0),J.removeEventListener("pointermove",c0),J.removeEventListener("pointerup",y0),J.removeEventListener("pointercancel",y0),J.removeEventListener("dblclick",I0),J.removeEventListener("keydown",C0)}}}var L9=["keydown","keyup","keypress"];function J1(J){for(let $ of L9)J.addEventListener($,(z)=>z.stopPropagation())}var l6=`
37
+ `)}function c5(J){if(J.length===0)return"No console output captured.";return J.map(($)=>`[${$.at}] ${$.level.toUpperCase()}: ${$.message}`).join(`
38
+ `)}function l5(J){if(J.length===0)return"No user actions captured.";let $=0;return J.map((z)=>{let j=z.source?` (${z.source})`:"",Q=`${z.detail}${w2(z.count)}${j}`;if(z.kind==="ui")return` ↳ [${z.at}] ${Q}`;$+=1;let X=`${$}. [${z.at}] ${Q}`;return z.afterNote?`${X}
39
+ ↳ ${z.afterNote}`:X}).join(`
40
+ `)}function r5(J){let $=[];for(let z of J.failedRequests)$.push(`✗ ${z.status??z.error??"ERR"} ${z.method} ${z.url}`);for(let z of J.errors)$.push(`⚠ ${z}`);for(let z of J.erroredQueries)$.push(`⚠ React Query error: ${z.key} — ${z.error}`);return $}function o5(J){let{context:$}=J;return[`User : ${$.user.fullName??"—"} (${$.user.email??"—"})`,`Unit : ${$.user.unit??"—"}`,`Roles : ${$.user.roles?.join(", ")||"—"}`,`Route : ${$.route.href}`,`Module : ${$.module?`${$.module.label} (${$.module.key})`:"—"}`,`App : ${$.app.name} v${$.app.version} · ${$.app.environment}`,`Memory : ${$.performance.memoryUsedMb??"—"}/${$.performance.memoryLimitMb??"—"} MB`,`Client : ${$.client.userAgent}`,`Viewport : ${$.client.viewport.width}×${$.client.viewport.height} @${$.client.viewport.dpr}x`,`Reason : ${p5[J.reason.type]}${J.reason.message?` — ${J.reason.message}`:""}`,`Captured : ${J.network.length} requests · ${J.console.length} console · ${J.actionTrail.length} actions · screenshot=${J.screenshotMethod}${J.replay?` · replay=${Math.round(J.replay.durationMs/1000)}s`:""}`]}function n5(J){let $=r5(J.cause),z=[`## \uD83D\uDC1E ${J.context.app.name} — Debug Report`,`**Generated:** ${J.context.capturedAt}`,"",...o5(J).map((j)=>`- ${j.replace(/\s{2,}:/,":")}`),"",`**หมายเหตุจากผู้แจ้ง:** ${J.note.trim()||"(ไม่มี)"}`];if($.length>0)z.push("","### ⚠ สาเหตุที่น่าจะเป็น","```",...$,"```");return z.push("",`<details><summary>ขั้นตอน (${J.actionTrail.length})</summary>`,"","```",l5(J.actionTrail),"```","</details>","",`<details><summary>Network (${J.network.length})</summary>`,"","```",i5(J.network),"```","</details>","",`<details><summary>Console (${J.console.length})</summary>`,"","```",c5(J.console),"```","</details>","","_ข้อมูลลับ (token, cookie) ถูกปกปิดอัตโนมัติ · ภาพหน้าจออยู่ในไฟล์ .zip_"),z.join(`
41
+ `)}function s5(J){return J.replace(/[:.]/g,"-").replace("T","_").slice(0,19)}function a5(J,$){return`debug-report_${s5(J.context.capturedAt)}.${$}`}function t5(J){return A6(J.cause)>0}async function n1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let z=await e5();if(z.status==="ok")return{dataUrl:z.dataUrl,method:"display-media"};if(z.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let $=await z9();if($)return{dataUrl:$,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function e5(){let J=null;try{let $={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};J=await navigator.mediaDevices.getDisplayMedia($);let z=await J9(J);return z?{status:"ok",dataUrl:z}:{status:"error"}}catch($){if($ instanceof DOMException&&($.name==="NotAllowedError"||$.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{J?.getTracks().forEach(($)=>$.stop())}}async function J9(J){let $=document.createElement("video");$.srcObject=J,$.muted=!0,$.playsInline=!0,await new Promise((Z)=>{let W=!1,Y=()=>{if(W)return;W=!0,Z()};$.onloadedmetadata=()=>{$.play().then(Y).catch(Y)},window.setTimeout(Y,1500)}),await $9($);let{videoWidth:z,videoHeight:j}=$;if(!z||!j)return null;let Q=document.createElement("canvas");Q.width=z,Q.height=j;let X=Q.getContext("2d");if(!X)return null;X.drawImage($,0,0,z,j),$.pause(),$.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function $9(J){return new Promise(($)=>{let z=!1,j=()=>{if(z)return;z=!0,$()},Q=J;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function z9(){let J=F().screenshotFallback;if(!J)return null;let $=await J().catch(()=>null);if(!$)return null;try{return await $(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:(z)=>!(z instanceof HTMLElement&&z.dataset?.debugReporter==="true")})}catch{return null}}var j9=2000,Q9=0.82,X9=3000000;function Z9(J){return new Promise(($,z)=>{let j=new Image;j.onload=()=>$(j),j.onerror=()=>z(Error("could not read the screenshot")),j.src=J})}async function s1(J){try{let $=await Z9(J),z=Math.max($.naturalWidth,$.naturalHeight),j=Math.min(1,j9/z),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round($.naturalWidth*j)),Q.height=Math.max(1,Math.round($.naturalHeight*j));let X=Q.getContext("2d");if(!X)return J;X.fillStyle="#fff",X.fillRect(0,0,Q.width,Q.height),X.drawImage($,0,0,Q.width,Q.height);let Z=Q9,W=Q.toDataURL("image/jpeg",Z);while(W.length>X9&&Z>0.4)Z-=0.15,W=Q.toDataURL("image/jpeg",Z);return W}catch{return J}}var V9=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,W9=/^\d+$/,K9=/^[0-9a-f]{16,}$/i;function l2(J){if(J.reason.type==="manual")return null;let $=J.cause?.failedRequests?.[0];if(!$?.url)return null;let z;try{z=new URL($.url,"http://x").pathname}catch{z=$.url}let j=z.split("/").map((X)=>V9.test(X)||W9.test(X)||K9.test(X)?":id":X).join("/"),Q=$.status??($.error?"ERR":"?");return`${$.method??"REQ"} ${j} ${Q}`}var r2=2000000;function a1(J){let{screenshotDataUrl:$,replay:z,...j}=J;return JSON.stringify(j).length}function o2(J,$=2000000){if(a1(J)<=$)return J;let z=J.network.map((Q)=>({...Q})),j={...J,network:z};for(let Q of z){if(a1(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&&a1(j)>$)j.network=j.network.slice(1);while(j.console.length>1&&a1(j)>$)j.console=j.console.slice(1);return j}function F1(J){let $="";for(let z=0;z<J.length;z+=32768)$+=String.fromCharCode(...J.subarray(z,z+32768));return btoa($)}var Y9=4,G9=2,U9=3,D9=0,H9=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),q9=/^\s*javascript:/i;function P9(J,$){let z=J.toLowerCase();if(z.startsWith("on")||z==="srcdoc")return!0;return typeof $==="string"&&q9.test($)}function k6(J,$=!1){if(!J)return;for(let z of Object.keys(J)){let j=J[z];if(P9(z,j)){if($)J[z]=null;else delete J[z];continue}if(typeof j!=="string"||!H9.has(z)||!j.includes("?"))continue;J[z]=B0(j)}}function n2(J){if(!J)return;k6(J.attributes);for(let $ of J.childNodes??[])n2($)}function f6(J){let $=JSON.parse(JSON.stringify(J));for(let z of $){let j=z.data;if(!j||typeof j!=="object")continue;if(z.type===Y9&&typeof j.href==="string")j.href=B0(j.href);else if(z.type===G9)n2(j.node);else if(z.type===U9&&j.source===D9){for(let Q of j.adds??[])n2(Q.node);for(let Q of j.attributes??[])k6(Q.attributes,!0)}}return $}var y6="session-replay.json.gz",B9="session-replay.json";function M9(J){return Boolean(J&&J.events.length>0)}async function F9(J){if(typeof CompressionStream>"u")return null;try{let $=new Blob([J]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response($).arrayBuffer())}catch{return null}}async function s2(J,$){if(!M9(J))return{summary:{omitted:"empty"}};let j={seconds:Math.round(J.durationMs/1000),events:J.events.length,startedAt:J.startedAt,endedAt:J.endedAt},Q=f6(J.events),X=await w6(Q),Z=!1;if(X.bytes.byteLength>$&&C9(Q))Q=I9(Q),X=await w6(Q),Z=!0;let{bytes:W,compressed:Y}=X;if(W.byteLength>$)return{summary:{...j,bytes:W.byteLength,omitted:"too-large"}};return{dataUri:`data:${Y?"application/gzip":"application/json"};base64,${F1(W)}`,filename:Y?y6:B9,summary:{...j,events:Q.length,bytes:W.byteLength,compressed:Y,...Z?{canvasDropped:Z}:{}}}}async function w6(J){let $=new TextEncoder().encode(JSON.stringify({events:J})),z=await F9($);return z?{bytes:z,compressed:!0}:{bytes:$,compressed:!1}}var N9=3,g6=2,_9=9;function v6(J){return J.type===N9&&J.data?.source===_9}function C9(J){return J.some(v6)||J.some(($)=>$.type===g6&&b6($.data.node))}function b6(J){if(!J)return!1;if(J.attributes&&"rr_dataURL"in J.attributes)return!0;return(J.childNodes??[]).some(b6)}function h6(J){if(!J)return;if(J.attributes&&"rr_dataURL"in J.attributes)delete J.attributes.rr_dataURL;for(let $ of J.childNodes??[])h6($)}function I9(J){let $=[];for(let z of J){if(v6(z))continue;if(z.type===g6)h6(z.data.node);$.push(z)}return $}var O9=new Set([502,503,504]);class M0 extends Error{kind;retryAfter;status;constructor(J,$,z,j){super(J);this.kind=$;this.retryAfter=z;this.status=j;this.name="ReportError"}}function L9(J){let{screenshotDataUrl:$,replay:z,...j}=J;return{dataUri:`data:application/json;base64,${F1(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function a2(){let J=F().identity;if(!J)return{};try{let $=await J();return $?{authorization:`Bearer ${$}`}:{}}catch{return{}}}async function t2(J,$){let z=F(),j=o2($,r2),{context:Q,note:X}=j,Z=[];if(j.screenshotDataUrl){let N=await s1(j.screenshotDataUrl);Z.push({dataUri:N,filename:"screenshot.jpg"})}Z.push(L9(j));let W,Y=H1();if(Y){let N=await s2(j.replay,Y.maxBytes);if(W=N.summary,"dataUri"in N)Z.push({dataUri:N.dataUri,filename:N.filename})}let G=l2(j),C={title:J,description:X.trim()||void 0,appName:H0().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:H0().name,module:Q.module?.label??""},context:{...G?{signature:G}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...W?{replay:W}:{}},attachments:Z,...j.reason.fromChat?{fromChat:!0}:{}},B=await fetch(`${z.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":z.realmKey,...await a2()},body:JSON.stringify(C)}).catch(()=>{throw new M0("report never left the browser","offline")});if(!B.ok)throw await e2(B);return await B.json()}async function e2(J){let $=J.headers.get("retry-after"),z=await J.json().then((j)=>j.error).catch(()=>null);if(J.status===429)return new M0("rate limited","rateLimited",$??void 0);if(O9.has(J.status))return new M0("desk unavailable","unavailable");return new M0(z??`Report failed (${J.status})`,"rejected",void 0,J.status)}var t1=null,N1=null,m6=()=>F().host.replace(/\/$/,"");function e1(){return t1}function v0(){if(N1)return N1;return N1=(async()=>{try{let J=await fetch(`${m6()}/ingest/request-types`,{headers:{"x-realm-key":F().realmKey}}),$=J.ok?await J.json():null;t1=Array.isArray($?.types)?$.types.filter(S9):[]}catch{t1=[],N1=null}return t1??[]})(),N1}function S9(J){let $=J;return!!$&&typeof $.id==="string"&&typeof $.name==="string"}async function J4(J){let $=F(),z={};try{z=$.user?.()??{}}catch{z={}}let j=typeof window>"u"?null:window.location,Q={title:J.title,description:J.description.trim()||void 0,ticketTypeId:J.ticketTypeId,appName:H0().name,category:j?p1(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:z.email??void 0,requesterName:z.fullName??void 0,attachments:J.screenshotDataUrl?[{dataUri:await s1(J.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},X=await fetch(`${m6()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await a2()},body:JSON.stringify(Q)}).catch(()=>{throw new M0("request never left the browser","offline")});if(!X.ok)throw await e2(X);return await X.json()}var _1=Math.PI/6;function u6(J,$,z){let j=$.x-J.x,Q=$.y-J.y,X=Math.hypot(j,Q),Z=Math.atan2(Q,j),W=[{x:$.x,y:$.y},{x:$.x-z*Math.cos(Z-_1),y:$.y-z*Math.sin(Z-_1)},{x:$.x-z*Math.cos(Z+_1),y:$.y-z*Math.sin(Z+_1)}],Y=z*Math.cos(_1)*0.92;if(X<=Y)return{shaft:null,head:W};return{shaft:{from:J,to:{x:$.x-Y*Math.cos(Z),y:$.y-Y*Math.sin(Z)}},head:W}}var $4="#f44336",R9="rgba(250, 204, 21, 0.4)",z4=22,p6="#2563eb",d6=9,i6=11,c6=18,l6=4,J2=8,A9=[{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 j4(J,$,z){let j=[],Q=null,X=-1,Z=null,W=null,Y=J.getContext("2d");function G(){let V=J.getBoundingClientRect().width;return V>0?J.width/V:1}function C(V){let K=J.getBoundingClientRect();return{x:(V.clientX-K.left)/K.width*J.width,y:(V.clientY-K.top)/K.height*J.height}}function B(V){let K=V.size??z4;if(!Y)return(V.text?.length??0)*K*0.6;Y.save(),Y.font=`600 ${K}px system-ui, sans-serif`;let D=Y.measureText(V.text??"").width;return Y.restore(),D}function N(V){if(V.tool==="text"){let K=V.size??z4;return{left:V.x1,top:V.y1,right:V.x1+B(V),bottom:V.y1+K*1.25}}return{left:Math.min(V.x1,V.x2),top:Math.min(V.y1,V.y2),right:Math.max(V.x1,V.x2),bottom:Math.max(V.y1,V.y2)}}function T(V){if(V.tool==="arrow")return[{id:"tail",x:V.x1,y:V.y1,cursor:"move"},{id:"head",x:V.x2,y:V.y2,cursor:"move"}];let K=N(V);if(V.tool==="text")return[{id:"size",x:K.right,y:K.bottom,cursor:"nwse-resize"}];return A9.map((D)=>({id:D.id,x:K.left+(K.right-K.left)*D.fx,y:K.top+(K.bottom-K.top)*D.fy,cursor:D.cursor}))}function E(V){let K=N(V);return{x:K.right+c6*G(),y:K.top-c6*G()}}function v(V,K,D){let{shaft:U,head:H}=u6({x:K.x1,y:K.y1},{x:K.x2,y:K.y2},Math.max(10,16*D));if(U)V.lineCap="butt",V.beginPath(),V.moveTo(U.from.x,U.from.y),V.lineTo(U.to.x,U.to.y),V.stroke();V.beginPath(),V.moveTo(H[0].x,H[0].y),V.lineTo(H[1].x,H[1].y),V.lineTo(H[2].x,H[2].y),V.closePath(),V.fill()}function c(V,K,D){V.save(),V.lineWidth=Math.max(2,3*D),V.strokeStyle=$4,V.fillStyle=$4;let U=N(K);if(K.tool==="rect")V.strokeRect(U.left,U.top,U.right-U.left,U.bottom-U.top);else if(K.tool==="arrow")v(V,K,D);else if(K.tool==="highlight")V.fillStyle=R9,V.fillRect(U.left,U.top,U.right-U.left,U.bottom-U.top);else if(K.tool==="text"&&K.text){let H=K.size??z4;V.font=`600 ${H}px system-ui, sans-serif`,V.textBaseline="top";let M=H*0.22;V.fillStyle="rgba(255,255,255,0.92)",V.fillRect(U.left-M,U.top-M,U.right-U.left+M*2,U.bottom-U.top+M*2),V.fillStyle=$4,V.fillText(K.text,U.left,U.top)}V.restore()}function q(V,K,D){let U=N(K);V.save(),V.strokeStyle=p6,V.lineWidth=Math.max(1,1.5*D),V.setLineDash([6*D,4*D]),V.strokeRect(U.left,U.top,U.right-U.left,U.bottom-U.top),V.setLineDash([]);let H=d6*D;for(let a of T(K))V.fillStyle="#fff",V.strokeStyle=p6,V.lineWidth=Math.max(1,1.5*D),V.beginPath(),V.rect(a.x-H/2,a.y-H/2,H,H),V.fill(),V.stroke();let M=E(K),x=i6*D;V.beginPath(),V.arc(M.x,M.y,x,0,Math.PI*2),V.fillStyle="#dc2626",V.fill(),V.strokeStyle="#fff",V.lineWidth=Math.max(1.5,2*D),V.beginPath(),V.moveTo(M.x-x*0.4,M.y-x*0.4),V.lineTo(M.x+x*0.4,M.y+x*0.4),V.moveTo(M.x+x*0.4,M.y-x*0.4),V.lineTo(M.x-x*0.4,M.y+x*0.4),V.stroke(),V.restore()}function _(){if(!Y)return;let V=G();if(Y.clearRect(0,0,J.width,J.height),Y.drawImage($,0,0,J.width,J.height),j.forEach((D,U)=>{if(U!==n)c(Y,D,V)}),Z)c(Y,Z,V);let K=j[X];if(K&&!Z)q(Y,K,V)}function y(V,K,D,U,H){return Math.abs(V-D)<=H&&Math.abs(K-U)<=H}function b(V,K){let D=j[X];if(!D)return null;let U=d6*G()/2+3*G();for(let H of T(D))if(y(V,K,H.x,H.y,U))return H.id;return null}function L(V,K){let D=j[X];if(!D)return!1;let U=E(D);return y(V,K,U.x,U.y,i6*G())}function g(V,K){let D=6*G();for(let U=j.length-1;U>=0;U-=1){let H=j[U];if(H.tool==="arrow"){let x=H.x2-H.x1,a=H.y2-H.y1,D0=Math.hypot(x,a)||1,P=Math.max(0,Math.min(1,((V-H.x1)*x+(K-H.y1)*a)/(D0*D0)));if(Math.hypot(V-(H.x1+P*x),K-(H.y1+P*a))<=D+4*G())return U;continue}let M=N(H);if(V>=M.left-D&&V<=M.right+D&&K>=M.top-D&&K<=M.bottom+D)return U}return-1}function I(V,K,D,U,H){if(K==="tail"){V.x1=D.x1+U,V.y1=D.y1+H;return}if(K==="head"){V.x2=D.x2+U,V.y2=D.y2+H;return}if(K==="size"){let k=(D.size??24)+H;V.size=Math.max(10,k);return}let M=N(D),{left:x,top:a,right:D0,bottom:P}=M;if(K.includes("w"))x=Math.min(D0-J2,x+U);if(K.includes("e"))D0=Math.max(x+J2,D0+U);if(K.includes("n"))a=Math.min(P-J2,a+H);if(K.includes("s"))P=Math.max(a+J2,P+H);V.x1=x,V.y1=a,V.x2=D0,V.y2=P}function p(V,K,D,U){V.x1=K.x1+D,V.y1=K.y1+U,V.x2=K.x2+D,V.y2=K.y2+U}let O=null,n=-1,f={x:0,y:0,size:24};function l(){let V=J.getBoundingClientRect().width;return V>0?V/J.width:1}function I0(V,K){if(!Y)return V.length*K*0.6;Y.save(),Y.font=`600 ${K}px system-ui, sans-serif`;let D=Y.measureText(V||" ").width;return Y.restore(),D}function V0(){if(!O)return;let V=J.parentElement;if(!V)return;let K=J.getBoundingClientRect(),D=V.getBoundingClientRect(),U=l(),H=f.size*U;O.style.left=`${K.left-D.left+f.x*U}px`,O.style.top=`${K.top-D.top+f.y*U}px`,O.style.fontSize=`${H}px`,O.style.width=`${Math.max(40,I0(O.value,H)+H)}px`}function r(V){let K=O;if(!K)return;O=null;let D=K.value.trim(),U=n;if(n=-1,K.remove(),V&&D){if(U>=0&&j[U])j[U].text=D,X=U;else j.push({tool:"text",x1:f.x,y1:f.y,x2:f.x,y2:f.y,text:D,size:f.size}),X=j.length-1;z()}else if(U>=0)X=U;J.focus(),_()}function P0(V,K,D=-1){r(!0);let U=J.parentElement;if(!U)return;if(getComputedStyle(U).position==="static")U.style.position="relative";let H=D>=0?j[D]:void 0;n=D,f={x:H?.x1??V,y:H?.y1??K,size:H?.size??Math.round(24*G())};let M=document.createElement("input");M.type="text",M.className="text-edit",M.value=H?.text??"",M.setAttribute("aria-label","ข้อความบนภาพ"),M.placeholder="ข้อความ",O=M,U.append(M),V0(),M.addEventListener("input",V0),M.addEventListener("keydown",(x)=>{if(x.stopPropagation(),x.key==="Enter")r(!0);else if(x.key==="Escape")r(!1)}),requestAnimationFrame(()=>{if(O!==M)return;M.focus(),M.select(),M.addEventListener("blur",()=>r(!0))}),_()}function G0(V){let{x:K,y:D}=C(V);if(J.setPointerCapture(V.pointerId),L(K,D)){U0();return}let U=b(K,D);if(U&&j[X]){W={grip:U,x:K,y:D,start:{...j[X]}};return}if(Q==="text"){if(V.preventDefault(),J.hasPointerCapture(V.pointerId))J.releasePointerCapture(V.pointerId);Q=null,z(),P0(K,D);return}if(Q){Z={tool:Q,x1:K,y1:D,x2:K,y2:D},X=-1;return}let H=g(K,D);X=H,W=H>=0?{grip:"body",x:K,y:D,start:{...j[H]}}:null,_()}function i0(V){let{x:K,y:D}=C(V);if(Z){Z.x2=K,Z.y2=D,_();return}if(W){let H=j[X];if(!H)return;let M=K-W.x,x=D-W.y;if(W.grip==="body")p(H,W.start,M,x);else I(H,W.grip,W.start,M,x);_();return}if(Q){J.style.cursor="crosshair";return}if(L(K,D)){J.style.cursor="pointer";return}let U=b(K,D);if(U){let H=j[X]?T(j[X]).find((M)=>M.id===U):null;J.style.cursor=H?.cursor??"pointer";return}J.style.cursor=g(K,D)>=0?"move":"default"}function w0(){if(Z){if(!(Math.abs(Z.x2-Z.x1)<l6&&Math.abs(Z.y2-Z.y1)<l6))j.push(Z),X=j.length-1,Q=null,z();Z=null}if(W)W=null,z();_()}function O0(V){let K=J.getBoundingClientRect(),D=(V.clientX-K.left)/K.width*J.width,U=(V.clientY-K.top)/K.height*J.height,H=g(D,U),M=j[H];if(!M||M.tool!=="text")return;V.preventDefault(),P0(M.x1,M.y1,H)}function L0(V){if(X<0)return;if(V.key==="Delete"||V.key==="Backspace")V.preventDefault(),U0();else if(V.key==="Escape")V.preventDefault(),X=-1,_()}function U0(){if(X<0)return;j.splice(X,1),X=-1,z(),_()}return J.addEventListener("pointerdown",G0),J.addEventListener("pointermove",i0),J.addEventListener("pointerup",w0),J.addEventListener("pointercancel",w0),J.addEventListener("dblclick",O0),J.tabIndex=0,J.addEventListener("keydown",L0),_(),{setTool(V){Q=V,X=-1,J.style.cursor=V?"crosshair":"default",_()},deleteSelected:U0,clear(){j.length=0,X=-1,z(),_()},hasShapes:()=>j.length>0,hasSelection:()=>X>=0,toDataUrl(){let V=document.createElement("canvas");V.width=$.naturalWidth,V.height=$.naturalHeight;let K=V.getContext("2d");if(!K)return J.toDataURL("image/png");K.drawImage($,0,0);let D=G();for(let U of j)c(K,U,D);return V.toDataURL("image/png")},destroy(){r(!1),J.removeEventListener("pointerdown",G0),J.removeEventListener("pointermove",i0),J.removeEventListener("pointerup",w0),J.removeEventListener("pointercancel",w0),J.removeEventListener("dblclick",O0),J.removeEventListener("keydown",L0)}}}var T9=["keydown","keyup","keypress"];function e0(J){for(let $ of T9)J.addEventListener($,(z)=>z.stopPropagation())}var r6=`
42
42
  :host { all: initial; }
43
43
  * { box-sizing: border-box; }
44
44
 
@@ -189,7 +189,7 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
189
189
  .shot-choice input { width: 16px; height: 16px; margin: 0; accent-color: #2563eb; }
190
190
  .dropped { opacity: 0.35; pointer-events: none; }
191
191
  .draft { margin: -8px 0 0; padding: 8px 12px; border-radius: 10px; background: #eff6ff; font-size: 13px; color: #1e3a8a; }
192
- `;var $1="lw-debug-reporter",L0=null;function S9(J,$){if(J instanceof B0){if(J.kind==="offline")return $.failedOffline;if(J.kind==="unavailable")return $.failedUnavailable;if(J.kind==="rateLimited")return $.failedTooMany.replace("{seconds}",J.retryAfter??"60");return J.message||$.failed}return $.failed}var a6=()=>[];function R9(J){a6=J}var A9=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function T9(){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"}),J1(this.root),this.root.addEventListener("keydown",($)=>{let z=$;if(z.key!=="Escape"||z.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;z.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=b2(($)=>void this.open($))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open($){if(this.busy)return;this.busy=!0;let z=document.activeElement;this.returnFocus=z instanceof HTMLElement&&z!==document.body?z:null;let j=s(M().locale),Q=t1();if(Q===null)b0();if($.type==="manual"&&Q?.length){this.renderChooser(j,$);return}await this.report($,j)}renderChooser($,z){let j=this.shell($);j.classList.add("narrow"),j.setAttribute("aria-label",$.chooseTitle);let Q=A("div","head"),Z=V0("✕","icon");Z.setAttribute("aria-label",$.close),Z.addEventListener("click",()=>this.close()),Q.append(A("h2","",$.chooseTitle),Z);let X=s6("problem",x9,$.kindProblem,$.chooseProblemHint);X.dataset.choose="problem",X.addEventListener("click",()=>{this.root.replaceChildren(),this.report(z,$)});let W=s6("request",o6,$.kindRequest,$.chooseRequestHint);W.dataset.choose="request",W.addEventListener("click",()=>{this.bundle=M1({reason:z,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:j4()}),this.renderForm($,z,"request")});let Y=A("div","kinds choose");Y.append(X,W),Y.addEventListener("keydown",(G)=>{if(!r6.includes(G.key))return;G.preventDefault(),(this.root.activeElement===X?W:X).focus()}),j.append(Q,Y),X.focus()}async switchToReport($,z,j){this.root.replaceChildren();let Q=await o1();if(Q.method==="cancelled"){this.renderForm($,z,"request",{...j,asking:!0});return}this.bundle=M1({reason:z,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:j4()}),this.renderForm($,z,"problem",j)}async report($,z){let j=await o1();if(j.method==="cancelled"){this.close();return}this.bundle=M1({reason:$,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:j4()}),this.renderForm(z,$,"problem")}close($=!1){if($)L0=null;else if(this.keep)L0=this.keep()??L0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let z=this.returnFocus;if(this.returnFocus=null,z?.isConnected)z.focus()}shell($){let z=document.createElement("style");z.textContent=l6;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",$.title),j.append(Q),this.root.replaceChildren(z,j),Q}renderShell($,z){let j=this.shell($),Q=A("div","head");Q.append(A("h2","",$.title)),j.append(Q,A("p","status",z))}renderForm($,z,j,Q){let Z=this.bundle;if(!Z)return;let X=this.shell($),W=j,Y=j==="problem"||!!Z.screenshotDataUrl,G=null,B=A("div","head"),F=A("h2","",$.title),C=V0("✕","icon");C.setAttribute("aria-label",$.close),C.addEventListener("click",()=>this.close()),B.append(F,C);let g=A("p","door");g.hidden=!0;let T=A("span"),b=V0("","link");b.dataset.switchKind="",b.addEventListener("click",()=>K(W==="problem"?"request":"problem")),g.append(T,b);let I=A("div","ask");I.hidden=!0;let N=document.createElement("input");N.type="search",N.className="type-search",N.placeholder=$.requestTypeSearch,N.setAttribute("aria-label",$.requestTypeSearch),N.dataset.requestTypeSearch="",N.hidden=!0;let _=A("div","types");_.setAttribute("role","radiogroup"),_.setAttribute("aria-label",$.requestTypeLabel);let m=A("p","status",$.requestTypeNone);m.hidden=!0;let E=A("p","status type-count","");E.hidden=!0,I.append(J2($.requestTypeLabel,"",!0),N,_,m,E);let x=[],L=()=>{for(let w of x){let O=w.dataset.requestType===G?.id;w.setAttribute("aria-checked",String(O)),w.tabIndex=O?0:-1}let q=x.find((w)=>w.dataset.requestType===G?.id);if(q&&_.scrollHeight>_.clientHeight){let w=q.offsetTop-_.offsetTop;if(w<_.scrollTop)_.scrollTop=w;else if(w+q.offsetHeight>_.scrollTop+_.clientHeight)_.scrollTop=w+q.offsetHeight-_.clientHeight}},S=document.createElement("input");S.type="text";let h=J2(""),k=document.createElement("textarea"),$0=J2(""),y=A("div","meta"),{context:d}=Z,q0=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${$.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,r=(q,w)=>{let O=document.createElement("div"),v=document.createElement("b");v.textContent=`${q}: `;let i=document.createTextNode(w);return O.append(v,i),y.append(O),{b:v,v:i}};r($.reporter,`${d.user.fullName??"—"} (${d.user.email??"—"})`),r($.page,d.route.href);let _0=r($.captured,q0),P0=document.createElement("label");P0.className="shot-choice",P0.hidden=!0;let K0=document.createElement("input");K0.type="checkbox",K0.checked=!0,K0.dataset.requestShot="",P0.append(K0,document.createTextNode(` ${$.requestWithShot}`));let c0=Z.screenshotDataUrl?this.screenshotSection($,Z.screenshotDataUrl):[A("p","status",$.noScreenshot)],y0=Z.screenshotDataUrl?c0[0]:null;if(!Z.screenshotDataUrl)P0.replaceChildren();let I0=A("p","status",""),C0=V0($.submit,"primary"),Y0=()=>{C0.disabled=S.value.trim().length===0||W==="request"&&!G};S.addEventListener("input",Y0);let V=()=>{let q=W==="request";if(F.textContent=q?$.requestTitle:$.title,X.setAttribute("aria-label",q?$.requestTitle:$.title),T.textContent=`${q?$.problemInstead:$.askInstead} `,b.textContent=q?Y?$.problemInsteadAction:$.problemInsteadShare:$.askInsteadAction,I.hidden=!q,$2(h,q?$.requestSummaryLabel:$.summaryLabel,q?"":$.summaryRequired,!0),S.placeholder=q?$.requestSummaryPlaceholder:$.summaryPlaceholder,$2($0,q?$.requestDetailLabel:$.detailLabel),k.placeholder=q?$.requestDetailPlaceholder:$.detailPlaceholder,_0.b.textContent=`${q?$.requestLeaves:$.captured}: `,_0.v.textContent=q?$.requestLeavesWhat:q0,P0.hidden=!q||!Z.screenshotDataUrl,y0)$2(y0,q?$.requestAnnotateHint:$.annotateHint);for(let w of c0)w.classList.toggle("dropped",q&&!K0.checked),w.hidden=q&&!Z.screenshotDataUrl;C0.textContent=q?$.requestSubmit:$.submit,Y0()};K0.addEventListener("change",V);let K=(q)=>{if(q===W)return;if(q==="problem"&&!Y){this.switchToReport($,z,{title:S.value,detail:k.value,asking:!1,typeId:G?.id??null});return}W=q,V()},D=(q)=>{if(this.bundle!==Z||z.type!=="manual"||!q.length)return;G=q[0],x.length=0;for(let O of q){let v=V0("","type");v.setAttribute("role","radio"),v.dataset.requestType=O.id;let i=A("span","type-body");if(i.append(A("b","",O.name)),O.description)i.append(A("span","type-hint",O.description));if(O.targetHours){let l0=A("span","type-due");l0.append(z2(k9),document.createTextNode($.requestTarget.replace("{time}",E9($,O.targetHours)))),i.append(l0)}v.append(z2(o6),i),v.addEventListener("click",()=>{G=O,L(),Y0()}),x.push(v)}_.replaceChildren(...x),_.onkeydown=(O)=>{if(!r6.includes(O.key)||!G)return;O.preventDefault();let v=q.filter((v0,H3)=>!x[H3].hidden);if(!v.length)return;let i=v.findIndex((v0)=>v0.id===G.id),l0=O.key==="ArrowUp"||O.key==="ArrowLeft"?-1:1;G=v[i<0?0:(i+l0+v.length)%v.length],L(),x.find((v0)=>v0.dataset.requestType===G.id)?.focus()},_.classList.toggle("long",q.length>=Q4),N.hidden=q.length<Q4;let w=(O)=>{E.hidden=q.length<Q4||O===0,E.textContent=$.requestTypeCount.replace("{n}",String(O))};w(q.length),N.oninput=()=>{let O=N.value.trim().toLowerCase(),v=null;if(q.forEach((i,l0)=>{let v0=!O||`${i.name} ${i.description}`.toLowerCase().includes(O);if(x[l0].hidden=!v0,v0&&!v)v=i}),m.hidden=!!v,w(x.filter((i)=>!i.hidden).length),v&&G&&x[q.indexOf(G)].hidden)G=v;L(),Y0()},N.onkeydown=(O)=>{if(O.key==="ArrowDown"||O.key==="Enter")O.preventDefault(),x.find((v)=>v.dataset.requestType===G?.id&&!v.hidden)?.focus()},L(),g.hidden=!1,V()},U=Q??(L0&&(L0.title||L0.detail)?L0:null),H=A("p","draft");if(H.hidden=!U||!!Q,U){S.value=U.title,k.value=U.detail;let q=V0($.draftClear,"link");q.dataset.draftClear="",q.addEventListener("click",()=>{S.value="",k.value="",L0=null,H.hidden=!0,Y0(),S.focus()}),H.append(document.createTextNode(`${$.draftRestored} · `),q)}let P=t1(),f=(q)=>{if(D(q),W!=="request"||g.hidden||!U?.typeId)return;let w=q.find((O)=>O.id===U.typeId);if(w)G=w,L()};if(P)f(P);else if(z.type==="manual")b0().then(f);this.keep=()=>({title:S.value,detail:k.value,asking:W==="request",typeId:G?.id??null}),X.append(B,g,H,I,h,S,$0,k,y,P0,...c0);let n=A("div","foot"),G0=V0($.close);G0.addEventListener("click",()=>this.close()),n.append(G0,I0,A("span","grow"),C0),X.append(n),V(),C0.addEventListener("click",async()=>{C0.disabled=!0,I0.dataset.tone="",I0.textContent=$.submitting;let q=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(W==="request"&&G){let v=await e2({ticketTypeId:G.id,title:S.value.trim(),description:k.value,screenshotDataUrl:K0.checked?q():null}),i=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:v,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),i)g0(`${$.requestSubmitted} — #${v.number}`,"success");return}let w=await a2(S.value.trim(),{...Z,note:k.value,screenshotDataUrl:q()}),O=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:w,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),O)g0(`${$.submitted} — #${w.number}`,"success")}catch(w){let O=S9(w,$);I0.dataset.tone="error",I0.textContent=O,g0(O,"error"),Y0()}}),S.focus()}screenshotSection($,z){let j=J2($.annotateHint),Q=A("div","tools"),Z=document.createElement("canvas"),X=A("div","shot");X.append(Z);let W=[],Y=(C)=>{for(let g of W)g.setAttribute("aria-pressed",String(g===C))};for(let{tool:C,key:g}of A9){let T=V0($[g]);T.setAttribute("aria-pressed","false"),T.addEventListener("click",()=>{let b=T.getAttribute("aria-pressed")==="true";Y(b?null:T),this.annotator?.setTool(b?null:C)}),W.push(T),Q.append(T)}Q.append(A("span","sep"));let G=V0($.deleteSelected);G.addEventListener("click",()=>this.annotator?.deleteSelected());let B=V0($.clearAll);B.addEventListener("click",()=>{this.annotator?.clear(),Y(null)}),Q.append(G,B);let F=new Image;return F.onload=()=>{Z.width=F.naturalWidth,Z.height=F.naturalHeight,this.annotator=z4(Z,F,()=>{Y(null),G.disabled=!this.annotator?.hasSelection()})},F.src=z,[j,Q,A("p","status",$.annotateHelp),X]}}}function j4(){try{return a6()}catch{return[]}}function A(J,$="",z=""){let j=document.createElement(J);if($)j.className=$;if(z)j.textContent=z;return j}function E9(J,$){return $>=24&&$%24===0?J.days.replace("{n}",String($/24)):J.hours.replace("{n}",String($))}var r6=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],Q4=7,x9=[["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"}]],k9=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],f9=[["path",{d:"M20 6 9 17l-5-5"}]],n6="http://www.w3.org/2000/svg";function s6(J,$,z,j){let Q=V0("","kind");Q.dataset.kind=J;let Z=A("span","kind-top");return Z.append(z2($),A("b","",z)),Q.append(Z,A("span","kind-hint",j),z2(f9,"tick")),Q}function z2(J,$="icon"){let z=document.createElementNS(n6,"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(n6,j);for(let[X,W]of Object.entries(Q))Z.setAttribute(X,W);z.append(Z)}return z}function V0(J,$=""){let z=document.createElement("button");if(z.type="button",z.textContent=J,$)z.className=$;return z}function J2(J,$="",z=!1){return $2(document.createElement("label"),J,$,z)}function $2(J,$,z="",j=!1){if(J.replaceChildren(document.createTextNode($)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",J.append(Q)}if(z){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${z}`,J.append(Q)}return J}function Z4(){if(typeof window>"u"||customElements.get($1))return;customElements.define($1,T9())}var w9="lw-portal-handoff",t6=138.23,y9=`
192
+ `;var J1="lw-debug-reporter",R0=null;function E9(J,$){if(J instanceof M0){if(J.kind==="offline")return $.failedOffline;if(J.kind==="unavailable")return $.failedUnavailable;if(J.kind==="rateLimited")return $.failedTooMany.replace("{seconds}",J.retryAfter??"60");return J.message||$.failed}return $.failed}var t6=()=>[];function x9(J){t6=J}var k9=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function f9(){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",($)=>{let z=$;if(z.key!=="Escape"||z.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;z.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=h2(($)=>void this.open($))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open($){if(this.busy)return;this.busy=!0;let z=document.activeElement;this.returnFocus=z instanceof HTMLElement&&z!==document.body?z:null;let j=t(F().locale),Q=e1();if(Q===null)v0();if($.type==="manual"&&Q?.length){this.renderChooser(j,$);return}await this.report($,j)}renderChooser($,z){let j=this.shell($);j.classList.add("narrow"),j.setAttribute("aria-label",$.chooseTitle);let Q=A("div","head"),X=W0("✕","icon");X.setAttribute("aria-label",$.close),X.addEventListener("click",()=>this.close()),Q.append(A("h2","",$.chooseTitle),X);let Z=a6("problem",y9,$.kindProblem,$.chooseProblemHint);Z.dataset.choose="problem",Z.addEventListener("click",()=>{this.root.replaceChildren(),this.report(z,$)});let W=a6("request",n6,$.kindRequest,$.chooseRequestHint);W.dataset.choose="request",W.addEventListener("click",()=>{this.bundle=M1({reason:z,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:Q4()}),this.renderForm($,z,"request")});let Y=A("div","kinds choose");Y.append(Z,W),Y.addEventListener("keydown",(G)=>{if(!o6.includes(G.key))return;G.preventDefault(),(this.root.activeElement===Z?W:Z).focus()}),j.append(Q,Y),Z.focus()}async switchToReport($,z,j){this.root.replaceChildren();let Q=await n1();if(Q.method==="cancelled"){this.renderForm($,z,"request",{...j,asking:!0});return}this.bundle=M1({reason:z,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:Q4()}),this.renderForm($,z,"problem",j)}async report($,z){let j=await n1();if(j.method==="cancelled"){this.close();return}this.bundle=M1({reason:$,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:Q4()}),this.renderForm(z,$,"problem")}close($=!1){if($)R0=null;else if(this.keep)R0=this.keep()??R0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let z=this.returnFocus;if(this.returnFocus=null,z?.isConnected)z.focus()}shell($){let z=document.createElement("style");z.textContent=r6;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",$.title),j.append(Q),this.root.replaceChildren(z,j),Q}renderShell($,z){let j=this.shell($),Q=A("div","head");Q.append(A("h2","",$.title)),j.append(Q,A("p","status",z))}renderForm($,z,j,Q){let X=this.bundle;if(!X)return;let Z=this.shell($),W=j,Y=j==="problem"||!!X.screenshotDataUrl,G=null,C=A("div","head"),B=A("h2","",$.title),N=W0("✕","icon");N.setAttribute("aria-label",$.close),N.addEventListener("click",()=>this.close()),C.append(B,N);let T=A("p","door");T.hidden=!0;let E=A("span"),v=W0("","link");v.dataset.switchKind="",v.addEventListener("click",()=>K(W==="problem"?"request":"problem")),T.append(E,v);let c=A("div","ask");c.hidden=!0;let q=document.createElement("input");q.type="search",q.className="type-search",q.placeholder=$.requestTypeSearch,q.setAttribute("aria-label",$.requestTypeSearch),q.dataset.requestTypeSearch="",q.hidden=!0;let _=A("div","types");_.setAttribute("role","radiogroup"),_.setAttribute("aria-label",$.requestTypeLabel);let y=A("p","status",$.requestTypeNone);y.hidden=!0;let b=A("p","status type-count","");b.hidden=!0,c.append($2($.requestTypeLabel,"",!0),q,_,y,b);let L=[],g=()=>{for(let k of L){let S=k.dataset.requestType===G?.id;k.setAttribute("aria-checked",String(S)),k.tabIndex=S?0:-1}let P=L.find((k)=>k.dataset.requestType===G?.id);if(P&&_.scrollHeight>_.clientHeight){let k=P.offsetTop-_.offsetTop;if(k<_.scrollTop)_.scrollTop=k;else if(k+P.offsetHeight>_.scrollTop+_.clientHeight)_.scrollTop=k+P.offsetHeight-_.clientHeight}},I=document.createElement("input");I.type="text";let p=$2(""),O=document.createElement("textarea"),n=$2(""),f=A("div","meta"),{context:l}=X,I0=`${X.network.length} network · ${X.console.length} console · ${X.actionTrail.length} actions${X.replay?` · ${$.replay} ${Math.round(X.replay.durationMs/1000)}s`:""}`,V0=(P,k)=>{let S=document.createElement("div"),w=document.createElement("b");w.textContent=`${P}: `;let d=document.createTextNode(k);return S.append(w,d),f.append(S),{b:w,v:d}};V0($.reporter,`${l.user.fullName??"—"} (${l.user.email??"—"})`),V0($.page,l.route.href);let r=V0($.captured,I0),P0=document.createElement("label");P0.className="shot-choice",P0.hidden=!0;let G0=document.createElement("input");G0.type="checkbox",G0.checked=!0,G0.dataset.requestShot="",P0.append(G0,document.createTextNode(` ${$.requestWithShot}`));let i0=X.screenshotDataUrl?this.screenshotSection($,X.screenshotDataUrl):[A("p","status",$.noScreenshot)],w0=X.screenshotDataUrl?i0[0]:null;if(!X.screenshotDataUrl)P0.replaceChildren();let O0=A("p","status",""),L0=W0($.submit,"primary"),U0=()=>{L0.disabled=I.value.trim().length===0||W==="request"&&!G};I.addEventListener("input",U0);let V=()=>{let P=W==="request";if(B.textContent=P?$.requestTitle:$.title,Z.setAttribute("aria-label",P?$.requestTitle:$.title),E.textContent=`${P?$.problemInstead:$.askInstead} `,v.textContent=P?Y?$.problemInsteadAction:$.problemInsteadShare:$.askInsteadAction,c.hidden=!P,z2(p,P?$.requestSummaryLabel:$.summaryLabel,P?"":$.summaryRequired,!0),I.placeholder=P?$.requestSummaryPlaceholder:$.summaryPlaceholder,z2(n,P?$.requestDetailLabel:$.detailLabel),O.placeholder=P?$.requestDetailPlaceholder:$.detailPlaceholder,r.b.textContent=`${P?$.requestLeaves:$.captured}: `,r.v.textContent=P?$.requestLeavesWhat:I0,P0.hidden=!P||!X.screenshotDataUrl,w0)z2(w0,P?$.requestAnnotateHint:$.annotateHint);for(let k of i0)k.classList.toggle("dropped",P&&!G0.checked),k.hidden=P&&!X.screenshotDataUrl;L0.textContent=P?$.requestSubmit:$.submit,U0()};G0.addEventListener("change",V);let K=(P)=>{if(P===W)return;if(P==="problem"&&!Y){this.switchToReport($,z,{title:I.value,detail:O.value,asking:!1,typeId:G?.id??null});return}W=P,V()},D=(P)=>{if(this.bundle!==X||z.type!=="manual"||!P.length)return;G=P[0],L.length=0;for(let S of P){let w=W0("","type");w.setAttribute("role","radio"),w.dataset.requestType=S.id;let d=A("span","type-body");if(d.append(A("b","",S.name)),S.description)d.append(A("span","type-hint",S.description));if(S.targetHours){let c0=A("span","type-due");c0.append(j2(g9),document.createTextNode($.requestTarget.replace("{time}",w9($,S.targetHours)))),d.append(c0)}w.append(j2(n6),d),w.addEventListener("click",()=>{G=S,g(),U0()}),L.push(w)}_.replaceChildren(...L),_.onkeydown=(S)=>{if(!o6.includes(S.key)||!G)return;S.preventDefault();let w=P.filter((y0,M3)=>!L[M3].hidden);if(!w.length)return;let d=w.findIndex((y0)=>y0.id===G.id),c0=S.key==="ArrowUp"||S.key==="ArrowLeft"?-1:1;G=w[d<0?0:(d+c0+w.length)%w.length],g(),L.find((y0)=>y0.dataset.requestType===G.id)?.focus()},_.classList.toggle("long",P.length>=X4),q.hidden=P.length<X4;let k=(S)=>{b.hidden=P.length<X4||S===0,b.textContent=$.requestTypeCount.replace("{n}",String(S))};k(P.length),q.oninput=()=>{let S=q.value.trim().toLowerCase(),w=null;if(P.forEach((d,c0)=>{let y0=!S||`${d.name} ${d.description}`.toLowerCase().includes(S);if(L[c0].hidden=!y0,y0&&!w)w=d}),y.hidden=!!w,k(L.filter((d)=>!d.hidden).length),w&&G&&L[P.indexOf(G)].hidden)G=w;g(),U0()},q.onkeydown=(S)=>{if(S.key==="ArrowDown"||S.key==="Enter")S.preventDefault(),L.find((w)=>w.dataset.requestType===G?.id&&!w.hidden)?.focus()},g(),T.hidden=!1,V()},U=Q??(R0&&(R0.title||R0.detail)?R0:null),H=A("p","draft");if(H.hidden=!U||!!Q,U){I.value=U.title,O.value=U.detail;let P=W0($.draftClear,"link");P.dataset.draftClear="",P.addEventListener("click",()=>{I.value="",O.value="",R0=null,H.hidden=!0,U0(),I.focus()}),H.append(document.createTextNode(`${$.draftRestored} · `),P)}let M=e1(),x=(P)=>{if(D(P),W!=="request"||T.hidden||!U?.typeId)return;let k=P.find((S)=>S.id===U.typeId);if(k)G=k,g()};if(M)x(M);else if(z.type==="manual")v0().then(x);this.keep=()=>({title:I.value,detail:O.value,asking:W==="request",typeId:G?.id??null}),Z.append(C,T,H,c,p,I,n,O,f,P0,...i0);let a=A("div","foot"),D0=W0($.close);D0.addEventListener("click",()=>this.close()),a.append(D0,O0,A("span","grow"),L0),Z.append(a),V(),L0.addEventListener("click",async()=>{L0.disabled=!0,O0.dataset.tone="",O0.textContent=$.submitting;let P=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():X.screenshotDataUrl;try{if(W==="request"&&G){let w=await J4({ticketTypeId:G.id,title:I.value.trim(),description:O.value,screenshotDataUrl:G0.checked?P():null}),d=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:w,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),d)g0(`${$.requestSubmitted} — #${w.number}`,"success");return}let k=await t2(I.value.trim(),{...X,note:O.value,screenshotDataUrl:P()}),S=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:k,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),S)g0(`${$.submitted} — #${k.number}`,"success")}catch(k){let S=E9(k,$);O0.dataset.tone="error",O0.textContent=S,g0(S,"error"),U0()}}),I.focus()}screenshotSection($,z){let j=$2($.annotateHint),Q=A("div","tools"),X=document.createElement("canvas"),Z=A("div","shot");Z.append(X);let W=[],Y=(N)=>{for(let T of W)T.setAttribute("aria-pressed",String(T===N))};for(let{tool:N,key:T}of k9){let E=W0($[T]);E.setAttribute("aria-pressed","false"),E.addEventListener("click",()=>{let v=E.getAttribute("aria-pressed")==="true";Y(v?null:E),this.annotator?.setTool(v?null:N)}),W.push(E),Q.append(E)}Q.append(A("span","sep"));let G=W0($.deleteSelected);G.addEventListener("click",()=>this.annotator?.deleteSelected());let C=W0($.clearAll);C.addEventListener("click",()=>{this.annotator?.clear(),Y(null)}),Q.append(G,C);let B=new Image;return B.onload=()=>{X.width=B.naturalWidth,X.height=B.naturalHeight,this.annotator=j4(X,B,()=>{Y(null),G.disabled=!this.annotator?.hasSelection()})},B.src=z,[j,Q,A("p","status",$.annotateHelp),Z]}}}function Q4(){try{return t6()}catch{return[]}}function A(J,$="",z=""){let j=document.createElement(J);if($)j.className=$;if(z)j.textContent=z;return j}function w9(J,$){return $>=24&&$%24===0?J.days.replace("{n}",String($/24)):J.hours.replace("{n}",String($))}var o6=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],X4=7,y9=[["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"}]],n6=[["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"}]],g9=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],v9=[["path",{d:"M20 6 9 17l-5-5"}]],s6="http://www.w3.org/2000/svg";function a6(J,$,z,j){let Q=W0("","kind");Q.dataset.kind=J;let X=A("span","kind-top");return X.append(j2($),A("b","",z)),Q.append(X,A("span","kind-hint",j),j2(v9,"tick")),Q}function j2(J,$="icon"){let z=document.createElementNS(s6,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:$}))z.setAttribute(j,Q);for(let[j,Q]of J){let X=document.createElementNS(s6,j);for(let[Z,W]of Object.entries(Q))X.setAttribute(Z,W);z.append(X)}return z}function W0(J,$=""){let z=document.createElement("button");if(z.type="button",z.textContent=J,$)z.className=$;return z}function $2(J,$="",z=!1){return z2(document.createElement("label"),J,$,z)}function z2(J,$,z="",j=!1){if(J.replaceChildren(document.createTextNode($)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",J.append(Q)}if(z){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${z}`,J.append(Q)}return J}function Z4(){if(typeof window>"u"||customElements.get(J1))return;customElements.define(J1,f9())}var b9="lw-portal-handoff",e6=138.23,h9=`
193
193
  :host { all: initial; }
194
194
  .backdrop {
195
195
  position: fixed; inset: 0; z-index: 2147483002;
@@ -219,10 +219,10 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
219
219
  .ring .track { stroke: #e2e8f0; }
220
220
  .ring .bar {
221
221
  stroke: #0ea5e9; transform: rotate(-90deg); transform-origin: 50% 50%;
222
- stroke-dasharray: ${t6}; stroke-dashoffset: 0;
222
+ stroke-dasharray: ${e6}; stroke-dashoffset: 0;
223
223
  animation: deplete var(--secs, 3s) linear forwards;
224
224
  }
225
- @keyframes deplete { to { stroke-dashoffset: ${t6}; } }
225
+ @keyframes deplete { to { stroke-dashoffset: ${e6}; } }
226
226
  .count {
227
227
  position: absolute; inset: 0; display: grid; place-items: center;
228
228
  font-size: 18px; font-weight: 600; color: #0f172a;
@@ -266,7 +266,7 @@ p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
266
266
  .ring .bar { animation: none; stroke-dashoffset: 0; }
267
267
  .spinner { animation-duration: 2s; }
268
268
  }
269
- `;function e6(J){if(typeof document>"u")return J.prepare().then((N)=>void J.go(N),()=>{return});let $=s(M().locale),z=Math.max(1,Math.floor(J.seconds??3)),j=document.createElement(w9),Q=j.attachShadow({mode:"open"});J1(Q);let Z=document.createElement("style");Z.textContent=y9,Q.append(Z);let X=document.createElement("div");X.className="backdrop",X.innerHTML=`
269
+ `;function J8(J){if(typeof document>"u")return J.prepare().then((q)=>void J.go(q),()=>{return});let $=t(F().locale),z=Math.max(1,Math.floor(J.seconds??3)),j=document.createElement(b9),Q=j.attachShadow({mode:"open"});e0(Q);let X=document.createElement("style");X.textContent=h9,Q.append(X);let Z=document.createElement("div");Z.className="backdrop",Z.innerHTML=`
270
270
  <div class="card" role="dialog" aria-modal="true" aria-labelledby="lw-ho-title">
271
271
  <div class="dial">
272
272
  <svg class="ring" viewBox="0 0 52 52" aria-hidden="true">
@@ -282,14 +282,14 @@ p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
282
282
  <button type="button" class="cancel"></button>
283
283
  <button type="button" class="go"></button>
284
284
  </div>
285
- </div>`,Q.append(X);let W=(N)=>X.querySelector(N),Y=W(".card"),G=W(".bar"),B=W(".count"),F=W("h2"),C=W(".body"),g=W(".host"),T=W(".go"),b=W(".cancel");F.textContent=$.handoffTitle,C.textContent=$.handoffBody;try{g.textContent=new URL(M().host).host}catch{g.textContent=""}T.textContent=$.handoffGo,b.textContent=$.cancel,Y.style.setProperty("--secs",`${z}s`),B.textContent=String(z),document.body.append(j),requestAnimationFrame(()=>X.setAttribute("data-open","1"));let I=document.activeElement;return T.focus({preventScroll:!0}),new Promise((N)=>{let _=!1,m=null,E=!1,x=Date.now()+z*1000,L=window.setInterval(()=>{let y=Math.ceil((x-Date.now())/1000);if(B.textContent=String(Math.max(0,y)),Date.now()>=x)k()},100);function S(y){if(_)return;if(_=!0,window.clearInterval(L),document.removeEventListener("keydown",$0,!0),X.removeAttribute("data-open"),window.setTimeout(()=>j.remove(),200),!y)I?.focus?.({preventScroll:!0});N()}function h(y){window.clearInterval(L),G.classList.remove("spinner"),G.style.animation="none",B.textContent="",F.textContent=$.handoffBlocked,C.textContent=$.handoffBody;let d=document.createElement("a");d.className="go",d.href=y,d.target="_blank",d.rel="noopener noreferrer",d.textContent=$.handoffOpen,d.addEventListener("click",()=>S(!0)),T.replaceWith(d),d.focus({preventScroll:!0})}function k(){if(_||E)return;if(m)return J.go(m)?S(!0):h(m);window.clearInterval(L),B.textContent="",G.classList.add("spinner"),F.textContent=$.handoffPreparing}function $0(y){if(y.key==="Escape")y.stopPropagation(),S(!1)}document.addEventListener("keydown",$0,!0),T.addEventListener("click",k),b.addEventListener("click",()=>S(!1)),X.addEventListener("click",(y)=>{if(y.target===X)S(!1)}),J.prepare().then((y)=>{if(m=y,!_&&Date.now()>=x)k()},()=>{E=!0,window.clearInterval(L),Y.classList.add("error"),G.classList.remove("spinner"),G.style.animation="none",B.textContent="",F.textContent=$.handoffFailed,C.textContent=$.handoffBody,T.remove(),b.textContent=$.close})})}var v9="/sso";function $8(J,$,z,j){let Q=new URL(v9,J.endsWith("/")?J:`${J}/`);if(Q.searchParams.set("realm",$),Q.searchParams.set("token",z),j)Q.searchParams.set("return",j);return Q.toString()}class j2 extends Error{constructor(J="No identity provider is configured, or nobody is signed in"){super(J);this.name="NoIdentityError"}}async function X4(J){let $=M();if(!$.identity)throw new j2;let z=await $.identity();if(!z)throw new j2;return $8($.host,$.realmKey,z,J)}var z8=X4;function J8(J,$){if($==="_self")return window.location.assign(J),!0;let z=window.open(J,"_blank");if(!z)return!1;try{z.opener=null}catch{}return!0}async function V4(J={}){if(J.announce===!1){J8(await X4(J.returnTo),J.target);return}await e6({seconds:J.seconds,prepare:()=>X4(J.returnTo),go:($)=>J8($,J.target)})}var Q2='"Inter Variable", "Noto Sans Thai Variable", "IBM Plex Sans Thai", -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif';function g9(J){let $=(J??"").trim();return!$||/^(?:"?Times New Roman"?|"?Times"?|serif)$/i.test($)?"":$}function Z2(J){if(!J||typeof document>"u"||!document.body)return;let $="";try{$=g9(getComputedStyle(document.body).fontFamily)}catch{}if($)J.style.setProperty("--lw-host-font",$);else J.style.removeProperty("--lw-host-font")}var b9="lw-call-ring",h9=`
285
+ </div>`,Q.append(Z);let W=(q)=>Z.querySelector(q),Y=W(".card"),G=W(".bar"),C=W(".count"),B=W("h2"),N=W(".body"),T=W(".host"),E=W(".go"),v=W(".cancel");B.textContent=$.handoffTitle,N.textContent=$.handoffBody;try{T.textContent=new URL(F().host).host}catch{T.textContent=""}E.textContent=$.handoffGo,v.textContent=$.cancel,Y.style.setProperty("--secs",`${z}s`),C.textContent=String(z),document.body.append(j),requestAnimationFrame(()=>Z.setAttribute("data-open","1"));let c=document.activeElement;return E.focus({preventScroll:!0}),new Promise((q)=>{let _=!1,y=null,b=!1,L=Date.now()+z*1000,g=window.setInterval(()=>{let f=Math.ceil((L-Date.now())/1000);if(C.textContent=String(Math.max(0,f)),Date.now()>=L)O()},100);function I(f){if(_)return;if(_=!0,window.clearInterval(g),document.removeEventListener("keydown",n,!0),Z.removeAttribute("data-open"),window.setTimeout(()=>j.remove(),200),!f)c?.focus?.({preventScroll:!0});q()}function p(f){window.clearInterval(g),G.classList.remove("spinner"),G.style.animation="none",C.textContent="",B.textContent=$.handoffBlocked,N.textContent=$.handoffBody;let l=document.createElement("a");l.className="go",l.href=f,l.target="_blank",l.rel="noopener noreferrer",l.textContent=$.handoffOpen,l.addEventListener("click",()=>I(!0)),E.replaceWith(l),l.focus({preventScroll:!0})}function O(){if(_||b)return;if(y)return J.go(y)?I(!0):p(y);window.clearInterval(g),C.textContent="",G.classList.add("spinner"),B.textContent=$.handoffPreparing}function n(f){if(f.key==="Escape")f.stopPropagation(),I(!1)}document.addEventListener("keydown",n,!0),E.addEventListener("click",O),v.addEventListener("click",()=>I(!1)),Z.addEventListener("click",(f)=>{if(f.target===Z)I(!1)}),J.prepare().then((f)=>{if(y=f,!_&&Date.now()>=L)O()},()=>{b=!0,window.clearInterval(g),Y.classList.add("error"),G.classList.remove("spinner"),G.style.animation="none",C.textContent="",B.textContent=$.handoffFailed,N.textContent=$.handoffBody,E.remove(),v.textContent=$.close})})}var m9="/sso";function z8(J,$,z,j){let Q=new URL(m9,J.endsWith("/")?J:`${J}/`);if(Q.searchParams.set("realm",$),Q.searchParams.set("token",z),j)Q.searchParams.set("return",j);return Q.toString()}class Q2 extends Error{constructor(J="No identity provider is configured, or nobody is signed in"){super(J);this.name="NoIdentityError"}}async function V4(J){let $=F();if(!$.identity)throw new Q2;let z=await $.identity();if(!z)throw new Q2;return z8($.host,$.realmKey,z,J)}var j8=V4;function $8(J,$){if($==="_self")return window.location.assign(J),!0;let z=window.open(J,"_blank");if(!z)return!1;try{z.opener=null}catch{}return!0}async function W4(J={}){if(J.announce===!1){$8(await V4(J.returnTo),J.target);return}await J8({seconds:J.seconds,prepare:()=>V4(J.returnTo),go:($)=>$8($,J.target)})}var X2='"Inter Variable", "Noto Sans Thai Variable", "IBM Plex Sans Thai", -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif';function u9(J){let $=(J??"").trim();return!$||/^(?:"?Times New Roman"?|"?Times"?|serif)$/i.test($)?"":$}function Z2(J){if(!J||typeof document>"u"||!document.body)return;let $="";try{$=u9(getComputedStyle(document.body).fontFamily)}catch{}if($)J.style.setProperty("--lw-host-font",$);else J.style.removeProperty("--lw-host-font")}var p9="lw-call-ring",d9=`
286
286
  :host { all: initial; }
287
287
  .card {
288
288
  position: fixed; right: 16px; bottom: calc(16px + var(--lw-chat-lift, 0px)); z-index: 2147483002;
289
289
  width: min(352px, calc(100vw - 32px)); box-sizing: border-box;
290
290
  padding: 16px; border-radius: 16px; background: #fff; color: #1a1a1e;
291
291
  border: 1px solid #e8e8ec; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
292
- font-family: var(--lw-host-font, ${Q2});
292
+ font-family: var(--lw-host-font, ${X2});
293
293
  animation: in 200ms cubic-bezier(0.16, 1, 0.3, 1);
294
294
  }
295
295
  @media (max-width: 639px) { .card { right: 8px; left: 8px; bottom: calc(8px + var(--lw-chat-lift, 0px)); width: auto; } }
@@ -333,17 +333,17 @@ h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.5; color: #1a1
333
333
  @keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
334
334
  @keyframes spin { to { transform: rotate(360deg); } }
335
335
  @media (prefers-reduced-motion: reduce) { .card { animation: none; } .icon::after { animation: none; opacity: 0; } .spin { animation: none; } }
336
- `,V2=(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>`,j8=V2('<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"/>'),m9=V2('<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"/>'),u9=V2('<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'),p9=V2('<path d="M21 12a9 9 0 1 1-6.219-8.56"/>').replace("<svg ",'<svg class="spin" '),c=null,F0=null,z1=null;function d9(J,$,z){if($.chatId)return z??$.ticketTitle;return J.replace("{key}",$.ticketKey).replace("{title}",$.ticketTitle)}var j1=()=>s(M().locale);function i9(){if(typeof document>"u")return null;if(c?.isConnected)return c.shadowRoot;c=document.createElement(b9),c.dataset.debugReporter="true",Z2(c);let J=c.attachShadow({mode:"open"});return J1(J),document.body.append(c),J}function X2(J,$,z,j){let Q=document.createElement("button");return Q.type="button",Q.className=J,Q.innerHTML=$,Q.dataset.lwRing=z,Q.onclick=j,Q}var _1=(J)=>{let $=document.createElement("span");return $.textContent=J,$.outerHTML};function Z8(J,$,z,j,Q){let Z=j1();J.innerHTML="";let X=document.createElement("style");X.textContent=h9;let W=document.createElement("div");W.className="card",W.setAttribute("role","alertdialog"),W.setAttribute("aria-label",Z.ringTitle),W.dataset.lwCallRing=$.id,W.dataset.lwRingMode=j;let Y=document.createElement("div");Y.className="head";let G=document.createElement("span");G.className="icon",G.innerHTML=j8;let B=document.createElement("div");B.className="words";let F=document.createElement("h2");F.textContent=Z.ringTitle;let C=document.createElement("p");C.className="about",C.textContent=d9(Z.ringAbout,$,Z.ringChat),C.title=C.textContent,B.append(F,C),Y.append(G,B);let g=document.createElement("p");g.className="how",g.textContent=Q??(j==="frame"?Z.ringHint:Z.ringHow);let T=document.createElement("div");T.className="actions";let b=X2("decline",m9+_1(Z.ringDecline),"decline",()=>z.decline());if(W.append(Y,g),j==="frame"&&z.answer){if(z.voice)W.append(X2("test",u9+_1(Z.ringTest),"test",()=>z.voice?.()));let I=X2("answer",j8+_1(Z.ringAnswer),"answer",()=>z.answer?.());T.append(b,I)}else T.append(b,X2("open",_1(Z.ringOpen),"open",()=>z.open()));W.append(T),J.append(X,W)}function W2(J,$,z="portal"){if(F0===J.id&&c?.isConnected)return;let j=i9();if(!j)return;if(F0=J.id,Z8(j,J,$,z),c9(),z1===null)z1=document.title,document.title=`${j1().ringTab} — ${z1}`}function X8(J){let $=c?.shadowRoot;if(!$||F0!==J)return;let z=$.querySelector(".answer");if(z)z.innerHTML=p9+_1(j1().ringAnswering),z.disabled=!0;let j=$.querySelector(".decline");if(j)j.disabled=!0}function V8(J,$){let z=c?.isConnected?c.shadowRoot:null;if(!z||F0!==J.id)return W2(J,$,"portal");c.style.display="",Z8(z,J,$,"portal",j1().ringFallback)}function K2(J){let $=c?.shadowRoot;if(!$)return;K4(),Y8();let z=j1(),j=$.querySelector(".how"),Q=$.querySelector(".actions");if(j)if(j.textContent="",J){let Z=document.createElement("a");Z.href=J,Z.target="_blank",Z.rel="noopener",Z.textContent=z.ringBlocked,Z.dataset.lwRing="link",Z.onclick=()=>window.setTimeout(()=>K2(),0),j.append(Z)}else j.textContent=z.ringOpened;if(Q){Q.innerHTML="";let Z=document.createElement("button");Z.type="button",Z.className="close",Z.textContent=z.ringClose,Z.dataset.lwRing="close",Z.onclick=()=>h0(),Q.append(Z)}}function W8(J,$=!0){if(!c?.isConnected||F0!==J)return;let z=c;if(clearTimeout(Q8),!$){z.style.display="",z.style.opacity="";return}z.style.transition="opacity 150ms ease-out",z.style.opacity="0",Q8=setTimeout(()=>{if(z.style.opacity==="0")z.style.display="none"},160)}var Q8;function h0(J){if(J&&F0&&J!==F0)return;K4(),Y8(),c?.remove(),c=null,F0=null}function K8(){return c?.isConnected?F0:null}function Y8(){if(z1===null||typeof document>"u")return;if(document.title.startsWith(j1().ringTab))document.title=z1;z1=null}var S0=null,W4;function c9(){K4();let J=window,$=J.AudioContext??J.webkitAudioContext;if(!$)return;try{let j=S0??new $;S0=j,j.resume?.().catch(()=>{return})}catch{return}let z=()=>{if(!S0||S0.state!=="running")return;let j=S0.currentTime;for(let[Q,Z]of[660,880].entries()){let X=S0.createOscillator(),W=S0.createGain();X.frequency.value=Z,W.gain.setValueAtTime(0.0001,j+Q*0.22),W.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),W.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),X.connect(W).connect(S0.destination),X.start(j+Q*0.22),X.stop(j+Q*0.22+0.21)}};z(),W4=setInterval(z,2200)}function K4(){clearInterval(W4),W4=void 0}var l9=64,r9=3500,o9=700,n9=450,s9=900,a9=20000,H8={pen:"#ef4444",rect:"#f59e0b",laser:"#ef4444"};var t9=/^[A-Za-z0-9_-]{1,32}$/,e9=/^#[0-9a-fA-F]{6}$/,J7=["pen","rect","laser"],G8=(J)=>J<0?0:J>1?1:J;function U8(J,$){if(!Array.isArray(J)||J.length<$||J.length>64)return null;let z=[];for(let j of J){if(!Array.isArray(j)||j.length!==2)return null;let[Q,Z]=j;if(typeof Q!=="number"||typeof Z!=="number"||!Number.isFinite(Q)||!Number.isFinite(Z))return null;z.push([G8(Q),G8(Z)])}return z}function I1(J){if(!J||typeof J!=="object")return null;let $=J;if($.op==="clear")return{op:"clear"};if(typeof $.id!=="string"||!t9.test($.id))return null;if($.op==="end")return{op:"end",id:$.id};if($.op==="add"){let z=U8($.pts,1);return z?{op:"add",id:$.id,pts:z}:null}if($.op==="begin"){if(!J7.includes($.kind)||typeof $.color!=="string"||!e9.test($.color))return null;let z=U8($.pts,1);return z?{op:"begin",id:$.id,kind:$.kind,color:$.color,pts:z}:null}return null}function Y4(J,$){if(J.endedAt!==null)return J.endedAt;return $-J.lastAt>20000?J.lastAt:null}function G4(J,$,z){if($===null)return 1;let j=z-$;if(J==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class Y2{marks=new Map;apply(J,$=Date.now()){if(J.op==="clear"){this.marks.clear();return}if(J.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete(J.id),this.marks.set(J.id,{kind:J.kind,color:J.color,pts:J.pts.map(([j,Q])=>({x:j,y:Q,t:$})),endedAt:null,lastAt:$});return}let z=this.marks.get(J.id);if(!z||Y4(z,$)!==null)return;if(J.op==="end"){z.endedAt=$;return}if(z.lastAt=$,z.kind==="rect"){let[j,Q]=J.pts[J.pts.length-1];z.pts=[z.pts[0],{x:j,y:Q,t:$}];return}for(let[j,Q]of J.pts)z.pts.push({x:j,y:Q,t:$});if(z.pts.length>4000)z.pts.splice(0,z.pts.length-4000)}alive(J=Date.now()){for(let[$,z]of this.marks)if(G4(z.kind,Y4(z,J),J)<=0)this.marks.delete($);return this.marks.size>0}get size(){return this.marks.size}draw(J,$,z,j=Date.now()){J.clearRect(0,0,$,z);let Q=Math.max(1,Math.min($,z));for(let Z of this.marks.values()){let X=G4(Z.kind,Y4(Z,j),j);if(X<=0||!Z.pts.length)continue;if(J.save(),J.lineCap="round",J.lineJoin="round",Z.kind==="pen")z7(J,Z,$,z,Math.max(3,Q*0.0045),X);else if(Z.kind==="rect")j7(J,Z,$,z,Math.max(2.5,Q*0.003),X);else Q7(J,Z,$,z,Math.max(6,Q*0.008),X,j);J.restore()}}}function $7(J,$,z,j){if(J.beginPath(),J.moveTo($[0].x*z,$[0].y*j),$.length===1){J.lineTo($[0].x*z+0.01,$[0].y*j);return}for(let Z=1;Z<$.length-1;Z++){let X=$[Z],W=$[Z+1];J.quadraticCurveTo(X.x*z,X.y*j,(X.x+W.x)/2*z,(X.y+W.y)/2*j)}let Q=$[$.length-1];J.lineTo(Q.x*z,Q.y*j)}function z7(J,$,z,j,Q,Z){J.globalAlpha=Z,$7(J,$.pts,z,j),J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=Q+3,J.stroke(),J.strokeStyle=$.color,J.lineWidth=Q,J.stroke()}function j7(J,$,z,j,Q,Z){let X=$.pts[0],W=$.pts[$.pts.length-1],Y=Math.min(X.x,W.x)*z,G=Math.min(X.y,W.y)*j,B=Math.abs(W.x-X.x)*z,F=Math.abs(W.y-X.y)*j;J.globalAlpha=Z,J.fillStyle=$.color,J.globalAlpha=Z*0.14,J.fillRect(Y,G,B,F),J.globalAlpha=Z,J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=Q+3,J.strokeRect(Y,G,B,F),J.strokeStyle=$.color,J.lineWidth=Q,J.strokeRect(Y,G,B,F)}function Q7(J,$,z,j,Q,Z,X){let W=$.pts.filter((G)=>X-G.t<=450);for(let G=1;G<W.length;G++){let B=W[G-1],F=W[G];J.globalAlpha=Z*Math.max(0,1-(X-F.t)/450)*0.7,J.strokeStyle=$.color,J.lineWidth=Q*0.9,J.beginPath(),J.moveTo(B.x*z,B.y*j),J.lineTo(F.x*z,F.y*j),J.stroke()}let Y=$.pts[$.pts.length-1];J.globalAlpha=Z,J.shadowColor=$.color,J.shadowBlur=Q*2,J.fillStyle=$.color,J.beginPath(),J.arc(Y.x*z,Y.y*j,Q,0,Math.PI*2),J.fill(),J.shadowBlur=0,J.strokeStyle="rgba(255,255,255,0.95)",J.lineWidth=2,J.stroke()}function q8(J,$,z,j=typeof window>"u"?1:window.devicePixelRatio||1){let Q=Math.max(1,Math.round($*j)),Z=Math.max(1,Math.round(z*j));if(J.width!==Q)J.width=Q;if(J.height!==Z)J.height=Z;let X=J.getContext("2d");return X?.setTransform(j,0,0,j,0,0),X}class G2{canvas;scene;box;frame=0;constructor(J,$,z){this.canvas=J;this.scene=$;this.box=z}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let J=()=>{this.frame=0;let{w:$,h:z}=this.box(),j=q8(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 P8=33,U4=5000,D8=0.0012,Z7=0,X7=()=>`${Date.now().toString(36)}${(Z7++).toString(36)}${Math.random().toString(36).slice(2,6)}`.slice(0,32);class M8{send;scene;onChange;id=null;kind=null;pending=[];last=null;lastSent=0;timer;keep;constructor(J,$,z=()=>{return}){this.send=J;this.scene=$;this.onChange=z}get drawing(){return this.id?this.kind:null}begin(J,$){this.end(),this.id=X7(),this.kind=J,this.last=$,this.lastSent=Date.now();let z={op:"begin",id:this.id,kind:J,color:H8[J],pts:[$]};this.scene.apply(z),this.send(z),this.keep=setInterval(()=>this.stillHere(),U4),this.onChange()}stillHere(){if(!this.id||!this.last||Date.now()-this.lastSent<U4)return;this.flush();let J={op:"add",id:this.id,pts:[this.last]};this.scene.apply(J),this.send(J),this.lastSent=Date.now()}move(J){if(!this.id||!this.kind)return;if(Date.now()-this.lastSent>1e4)return this.begin(this.kind,J);if(this.last&&Math.abs(J[0]-this.last[0])<D8&&Math.abs(J[1]-this.last[1])<D8)return;if(this.last=J,this.scene.apply({op:"add",id:this.id,pts:[J]}),this.onChange(),this.kind==="rect")this.pending=[J];else this.pending.push(J);if(this.pending.length>=64)this.flush();else if(!this.timer)this.timer=setTimeout(()=>this.flush(),Math.max(0,P8-(Date.now()-this.lastSent)))}flush(){if(clearTimeout(this.timer),this.timer=void 0,!this.id||!this.pending.length)return;this.send({op:"add",id:this.id,pts:this.pending}),this.pending=[],this.lastSent=Date.now()}end(){if(!this.id)return;clearInterval(this.keep),this.keep=void 0,this.flush();let J={op:"end",id:this.id};this.scene.apply(J),this.send(J),this.id=null,this.kind=null,this.last=null,this.onChange()}clear(){this.end();let J={op:"clear"};this.scene.apply(J),this.send(J),this.onChange()}}var V7="lw-call-ink",R0=null,U2=null,C1=null;function W7(){if(R0?.isConnected&&C1)return;R0=document.createElement(V7),R0.dataset.debugReporter="true";let J=R0.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=`:host { all: initial; }
337
- canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let z=document.createElement("canvas");z.setAttribute("aria-hidden","true"),z.dataset.lwCallInk="",J.append($,z),document.body.append(R0),U2=new Y2,C1=new G2(z,U2,()=>({w:window.innerWidth,h:window.innerHeight}))}function D2(J){if(typeof document>"u")return;if(J.op==="clear"&&!R0)return;W7(),U2.apply(J),C1.kick()}function H2(){C1?.stop(),R0?.remove(),R0=null,U2=null,C1=null}var K7="lw-call-frame",Y7="lw-call",Q0=16,M4=368,D0=null,p=null,m0=null,M2="",L1=null,S1="card",B4={width:M4,height:0},F4,R1=!1,N4=null,Z1={answer:!1,voice:!1},A0=null,t=null,D4="lw-call-frame-place";function B8(J,$,z,j){let Q=new URL("embed/call",J.endsWith("/")?J:`${J}/`);if(Q.searchParams.set("realm",$),z)Q.searchParams.set("token",z);else Q.searchParams.set("hand","1");return Q.searchParams.set("call",j),Q.toString()}function Q1(J){p?.contentWindow?.postMessage({source:"lw-call-host",...J},M2)}function F8(J){if(m0!==J)return;if(Z1.answer=!0,R1)Q1({type:"answer"})}function N8(J){if(m0!==J)return;if(Z1.voice=!0,R1)Q1({type:"voice"})}function _8(J,$,z){return{x:Math.min(Math.max(J.x,Q0/2),Math.max(Q0/2,z.w-$.w-Q0/2)),y:Math.min(Math.max(J.y,Q0/2),Math.max(Q0/2,z.h-$.h-Q0/2))}}function G7(J,$){if(J.origin!==$.origin||J.source!==$.window)return null;let z=J.data;return z&&typeof z==="object"&&z.source===Y7&&typeof z.type==="string"?z:null}function V1(){return D0?.isConnected?m0:null}function I8(J,$,z,j=15000,Q=null){if(typeof document>"u")return;if(m0===$&&D0?.isConnected)return;W1(),m0=$,L1=z,R1=!1,N4=Q,Z1={answer:!1,voice:!1},S1="card",B4={width:M4,height:0},M2=new URL(J).origin;try{A0=JSON.parse(sessionStorage.getItem(D4)??"null")}catch{A0=null}D0=document.createElement(K7),D0.dataset.debugReporter="true";let Z=D0.attachShadow({mode:"open"}),X=document.createElement("style");X.textContent=`:host { all: initial; }
336
+ `,W2=(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>`,Q8=W2('<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"/>'),i9=W2('<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"/>'),c9=W2('<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'),l9=W2('<path d="M21 12a9 9 0 1 1-6.219-8.56"/>').replace("<svg ",'<svg class="spin" '),i=null,F0=null,$1=null;function r9(J,$,z){if($.chatId)return z??$.ticketTitle;return J.replace("{key}",$.ticketKey).replace("{title}",$.ticketTitle)}var z1=()=>t(F().locale);function o9(){if(typeof document>"u")return null;if(i?.isConnected)return i.shadowRoot;i=document.createElement(p9),i.dataset.debugReporter="true",Z2(i);let J=i.attachShadow({mode:"open"});return e0(J),document.body.append(i),J}function V2(J,$,z,j){let Q=document.createElement("button");return Q.type="button",Q.className=J,Q.innerHTML=$,Q.dataset.lwRing=z,Q.onclick=j,Q}var C1=(J)=>{let $=document.createElement("span");return $.textContent=J,$.outerHTML};function Z8(J,$,z,j,Q){let X=z1();J.innerHTML="";let Z=document.createElement("style");Z.textContent=d9;let W=document.createElement("div");W.className="card",W.setAttribute("role","alertdialog"),W.setAttribute("aria-label",X.ringTitle),W.dataset.lwCallRing=$.id,W.dataset.lwRingMode=j;let Y=document.createElement("div");Y.className="head";let G=document.createElement("span");G.className="icon",G.innerHTML=Q8;let C=document.createElement("div");C.className="words";let B=document.createElement("h2");B.textContent=X.ringTitle;let N=document.createElement("p");N.className="about",N.textContent=r9(X.ringAbout,$,X.ringChat),N.title=N.textContent,C.append(B,N),Y.append(G,C);let T=document.createElement("p");T.className="how",T.textContent=Q??(j==="frame"?X.ringHint:X.ringHow);let E=document.createElement("div");E.className="actions";let v=V2("decline",i9+C1(X.ringDecline),"decline",()=>z.decline());if(W.append(Y,T),j==="frame"&&z.answer){if(z.voice)W.append(V2("test",c9+C1(X.ringTest),"test",()=>z.voice?.()));let c=V2("answer",Q8+C1(X.ringAnswer),"answer",()=>z.answer?.());E.append(v,c)}else E.append(v,V2("open",C1(X.ringOpen),"open",()=>z.open()));W.append(E),J.append(Z,W)}function K2(J,$,z="portal"){if(F0===J.id&&i?.isConnected)return;let j=o9();if(!j)return;if(F0=J.id,Z8(j,J,$,z),n9(),$1===null)$1=document.title,document.title=`${z1().ringTab} — ${$1}`}function V8(J){let $=i?.shadowRoot;if(!$||F0!==J)return;let z=$.querySelector(".answer");if(z)z.innerHTML=l9+C1(z1().ringAnswering),z.disabled=!0;let j=$.querySelector(".decline");if(j)j.disabled=!0}function W8(J,$){let z=i?.isConnected?i.shadowRoot:null;if(!z||F0!==J.id)return K2(J,$,"portal");i.style.display="",Z8(z,J,$,"portal",z1().ringFallback)}function Y2(J){let $=i?.shadowRoot;if(!$)return;Y4(),G8();let z=z1(),j=$.querySelector(".how"),Q=$.querySelector(".actions");if(j)if(j.textContent="",J){let X=document.createElement("a");X.href=J,X.target="_blank",X.rel="noopener",X.textContent=z.ringBlocked,X.dataset.lwRing="link",X.onclick=()=>window.setTimeout(()=>Y2(),0),j.append(X)}else j.textContent=z.ringOpened;if(Q){Q.innerHTML="";let X=document.createElement("button");X.type="button",X.className="close",X.textContent=z.ringClose,X.dataset.lwRing="close",X.onclick=()=>b0(),Q.append(X)}}function K8(J,$=!0){if(!i?.isConnected||F0!==J)return;let z=i;if(clearTimeout(X8),!$){z.style.display="",z.style.opacity="";return}z.style.transition="opacity 150ms ease-out",z.style.opacity="0",X8=setTimeout(()=>{if(z.style.opacity==="0")z.style.display="none"},160)}var X8;function b0(J){if(J&&F0&&J!==F0)return;Y4(),G8(),i?.remove(),i=null,F0=null}function Y8(){return i?.isConnected?F0:null}function G8(){if($1===null||typeof document>"u")return;if(document.title.startsWith(z1().ringTab))document.title=$1;$1=null}var A0=null,K4;function n9(){Y4();let J=window,$=J.AudioContext??J.webkitAudioContext;if(!$)return;try{let j=A0??new $;A0=j,j.resume?.().catch(()=>{return})}catch{return}let z=()=>{if(!A0||A0.state!=="running")return;let j=A0.currentTime;for(let[Q,X]of[660,880].entries()){let Z=A0.createOscillator(),W=A0.createGain();Z.frequency.value=X,W.gain.setValueAtTime(0.0001,j+Q*0.22),W.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),W.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),Z.connect(W).connect(A0.destination),Z.start(j+Q*0.22),Z.stop(j+Q*0.22+0.21)}};z(),K4=setInterval(z,2200)}function Y4(){clearInterval(K4),K4=void 0}var s9=64,a9=3500,t9=700,e9=450,J7=900,$7=20000,q8={pen:"#ef4444",rect:"#f59e0b",laser:"#ef4444"};var z7=/^[A-Za-z0-9_-]{1,32}$/,j7=/^#[0-9a-fA-F]{6}$/,Q7=["pen","rect","laser"],U8=(J)=>J<0?0:J>1?1:J;function D8(J,$){if(!Array.isArray(J)||J.length<$||J.length>64)return null;let z=[];for(let j of J){if(!Array.isArray(j)||j.length!==2)return null;let[Q,X]=j;if(typeof Q!=="number"||typeof X!=="number"||!Number.isFinite(Q)||!Number.isFinite(X))return null;z.push([U8(Q),U8(X)])}return z}function I1(J){if(!J||typeof J!=="object")return null;let $=J;if($.op==="clear")return{op:"clear"};if(typeof $.id!=="string"||!z7.test($.id))return null;if($.op==="end")return{op:"end",id:$.id};if($.op==="add"){let z=D8($.pts,1);return z?{op:"add",id:$.id,pts:z}:null}if($.op==="begin"){if(!Q7.includes($.kind)||typeof $.color!=="string"||!j7.test($.color))return null;let z=D8($.pts,1);return z?{op:"begin",id:$.id,kind:$.kind,color:$.color,pts:z}:null}return null}function G4(J,$){if(J.endedAt!==null)return J.endedAt;return $-J.lastAt>20000?J.lastAt:null}function U4(J,$,z){if($===null)return 1;let j=z-$;if(J==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class G2{marks=new Map;apply(J,$=Date.now()){if(J.op==="clear"){this.marks.clear();return}if(J.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete(J.id),this.marks.set(J.id,{kind:J.kind,color:J.color,pts:J.pts.map(([j,Q])=>({x:j,y:Q,t:$})),endedAt:null,lastAt:$});return}let z=this.marks.get(J.id);if(!z||G4(z,$)!==null)return;if(J.op==="end"){z.endedAt=$;return}if(z.lastAt=$,z.kind==="rect"){let[j,Q]=J.pts[J.pts.length-1];z.pts=[z.pts[0],{x:j,y:Q,t:$}];return}for(let[j,Q]of J.pts)z.pts.push({x:j,y:Q,t:$});if(z.pts.length>4000)z.pts.splice(0,z.pts.length-4000)}alive(J=Date.now()){for(let[$,z]of this.marks)if(U4(z.kind,G4(z,J),J)<=0)this.marks.delete($);return this.marks.size>0}get size(){return this.marks.size}draw(J,$,z,j=Date.now()){J.clearRect(0,0,$,z);let Q=Math.max(1,Math.min($,z));for(let X of this.marks.values()){let Z=U4(X.kind,G4(X,j),j);if(Z<=0||!X.pts.length)continue;if(J.save(),J.lineCap="round",J.lineJoin="round",X.kind==="pen")Z7(J,X,$,z,Math.max(3,Q*0.0045),Z);else if(X.kind==="rect")V7(J,X,$,z,Math.max(2.5,Q*0.003),Z);else W7(J,X,$,z,Math.max(6,Q*0.008),Z,j);J.restore()}}}function X7(J,$,z,j){if(J.beginPath(),J.moveTo($[0].x*z,$[0].y*j),$.length===1){J.lineTo($[0].x*z+0.01,$[0].y*j);return}for(let X=1;X<$.length-1;X++){let Z=$[X],W=$[X+1];J.quadraticCurveTo(Z.x*z,Z.y*j,(Z.x+W.x)/2*z,(Z.y+W.y)/2*j)}let Q=$[$.length-1];J.lineTo(Q.x*z,Q.y*j)}function Z7(J,$,z,j,Q,X){J.globalAlpha=X,X7(J,$.pts,z,j),J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=Q+3,J.stroke(),J.strokeStyle=$.color,J.lineWidth=Q,J.stroke()}function V7(J,$,z,j,Q,X){let Z=$.pts[0],W=$.pts[$.pts.length-1],Y=Math.min(Z.x,W.x)*z,G=Math.min(Z.y,W.y)*j,C=Math.abs(W.x-Z.x)*z,B=Math.abs(W.y-Z.y)*j;J.globalAlpha=X,J.fillStyle=$.color,J.globalAlpha=X*0.14,J.fillRect(Y,G,C,B),J.globalAlpha=X,J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=Q+3,J.strokeRect(Y,G,C,B),J.strokeStyle=$.color,J.lineWidth=Q,J.strokeRect(Y,G,C,B)}function W7(J,$,z,j,Q,X,Z){let W=$.pts.filter((G)=>Z-G.t<=450);for(let G=1;G<W.length;G++){let C=W[G-1],B=W[G];J.globalAlpha=X*Math.max(0,1-(Z-B.t)/450)*0.7,J.strokeStyle=$.color,J.lineWidth=Q*0.9,J.beginPath(),J.moveTo(C.x*z,C.y*j),J.lineTo(B.x*z,B.y*j),J.stroke()}let Y=$.pts[$.pts.length-1];J.globalAlpha=X,J.shadowColor=$.color,J.shadowBlur=Q*2,J.fillStyle=$.color,J.beginPath(),J.arc(Y.x*z,Y.y*j,Q,0,Math.PI*2),J.fill(),J.shadowBlur=0,J.strokeStyle="rgba(255,255,255,0.95)",J.lineWidth=2,J.stroke()}function P8(J,$,z,j=typeof window>"u"?1:window.devicePixelRatio||1){let Q=Math.max(1,Math.round($*j)),X=Math.max(1,Math.round(z*j));if(J.width!==Q)J.width=Q;if(J.height!==X)J.height=X;let Z=J.getContext("2d");return Z?.setTransform(j,0,0,j,0,0),Z}class U2{canvas;scene;box;frame=0;constructor(J,$,z){this.canvas=J;this.scene=$;this.box=z}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let J=()=>{this.frame=0;let{w:$,h:z}=this.box(),j=P8(this.canvas,$,z),Q=Date.now(),X=this.scene.alive(Q);if(j)this.scene.draw(j,$,z,Q);if(X)this.frame=requestAnimationFrame(J)};this.frame=requestAnimationFrame(J)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var B8=33,D4=5000,H8=0.0012,K7=0,Y7=()=>`${Date.now().toString(36)}${(K7++).toString(36)}${Math.random().toString(36).slice(2,6)}`.slice(0,32);class M8{send;scene;onChange;id=null;kind=null;pending=[];last=null;lastSent=0;timer;keep;constructor(J,$,z=()=>{return}){this.send=J;this.scene=$;this.onChange=z}get drawing(){return this.id?this.kind:null}begin(J,$){this.end(),this.id=Y7(),this.kind=J,this.last=$,this.lastSent=Date.now();let z={op:"begin",id:this.id,kind:J,color:q8[J],pts:[$]};this.scene.apply(z),this.send(z),this.keep=setInterval(()=>this.stillHere(),D4),this.onChange()}stillHere(){if(!this.id||!this.last||Date.now()-this.lastSent<D4)return;this.flush();let J={op:"add",id:this.id,pts:[this.last]};this.scene.apply(J),this.send(J),this.lastSent=Date.now()}move(J){if(!this.id||!this.kind)return;if(Date.now()-this.lastSent>1e4)return this.begin(this.kind,J);if(this.last&&Math.abs(J[0]-this.last[0])<H8&&Math.abs(J[1]-this.last[1])<H8)return;if(this.last=J,this.scene.apply({op:"add",id:this.id,pts:[J]}),this.onChange(),this.kind==="rect")this.pending=[J];else this.pending.push(J);if(this.pending.length>=64)this.flush();else if(!this.timer)this.timer=setTimeout(()=>this.flush(),Math.max(0,B8-(Date.now()-this.lastSent)))}flush(){if(clearTimeout(this.timer),this.timer=void 0,!this.id||!this.pending.length)return;this.send({op:"add",id:this.id,pts:this.pending}),this.pending=[],this.lastSent=Date.now()}end(){if(!this.id)return;clearInterval(this.keep),this.keep=void 0,this.flush();let J={op:"end",id:this.id};this.scene.apply(J),this.send(J),this.id=null,this.kind=null,this.last=null,this.onChange()}clear(){this.end();let J={op:"clear"};this.scene.apply(J),this.send(J),this.onChange()}}var G7="lw-call-ink",T0=null,D2=null,O1=null;function U7(){if(T0?.isConnected&&O1)return;T0=document.createElement(G7),T0.dataset.debugReporter="true";let J=T0.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=`:host { all: initial; }
337
+ canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let z=document.createElement("canvas");z.setAttribute("aria-hidden","true"),z.dataset.lwCallInk="",J.append($,z),document.body.append(T0),D2=new G2,O1=new U2(z,D2,()=>({w:window.innerWidth,h:window.innerHeight}))}function H2(J){if(typeof document>"u")return;if(J.op==="clear"&&!T0)return;U7(),D2.apply(J),O1.kick()}function q2(){O1?.stop(),T0?.remove(),T0=null,D2=null,O1=null}var D7="lw-call-frame",H7="lw-call",Q0=16,M4=368,q0=null,m=null,h0=null,M2="",S1=null,R1="card",F4={width:M4,height:0},N4,A1=!1,_4=null,Q1={answer:!1,voice:!1},E0=null,J0=null,H4="lw-call-frame-place";function F8(J,$,z,j){let Q=new URL("embed/call",J.endsWith("/")?J:`${J}/`);if(Q.searchParams.set("realm",$),z)Q.searchParams.set("token",z);else Q.searchParams.set("hand","1");return Q.searchParams.set("call",j),Q.toString()}function j1(J){m?.contentWindow?.postMessage({source:"lw-call-host",...J},M2)}function N8(J){if(h0!==J)return;if(Q1.answer=!0,A1)j1({type:"answer"})}function _8(J){if(h0!==J)return;if(Q1.voice=!0,A1)j1({type:"voice"})}function C8(J,$,z){return{x:Math.min(Math.max(J.x,Q0/2),Math.max(Q0/2,z.w-$.w-Q0/2)),y:Math.min(Math.max(J.y,Q0/2),Math.max(Q0/2,z.h-$.h-Q0/2))}}function q7(J,$){if(J.origin!==$.origin||J.source!==$.window)return null;let z=J.data;return z&&typeof z==="object"&&z.source===H7&&typeof z.type==="string"?z:null}function Z1(){return q0?.isConnected?h0:null}function I8(J,$,z,j=15000,Q=null){if(typeof document>"u")return;if(h0===$&&q0?.isConnected)return;V1(),h0=$,S1=z,A1=!1,_4=Q,Q1={answer:!1,voice:!1},R1="card",F4={width:M4,height:0},M2=new URL(J).origin;try{E0=JSON.parse(sessionStorage.getItem(H4)??"null")}catch{E0=null}q0=document.createElement(D7),q0.dataset.debugReporter="true";let X=q0.attachShadow({mode:"open"}),Z=document.createElement("style");Z.textContent=`:host { all: initial; }
338
338
  iframe { position: fixed; z-index: 2147483003; border: 0; background: transparent; color-scheme: normal; visibility: hidden; }
339
- iframe.on { visibility: visible; }`,p=document.createElement("iframe"),p.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",p.title="สายจากทีมงาน",p.dataset.lwCallFrame=$,p.setAttribute("allowtransparency","true"),p.src=J,Z.append(X,p),document.body.append(D0),X1(),window.addEventListener("message",C8),window.addEventListener("resize",X1),_4(`lw-call:${$}`),F4=setTimeout(()=>{if(!R1)H4("timeout")},j)}function W1(){if(D0)_4(q4?.handle??null,q4?.readableBy);H2(),clearTimeout(F4),window.removeEventListener("message",C8),window.removeEventListener("resize",X1),q2(!1),D0?.remove(),D0=null,p=null,m0=null,L1=null,t=null,N4=null,Z1={answer:!1,voice:!1}}function H4(J){let $=L1;W1(),$?.failed(J)}function C8(J){if(!p)return;let $=G7(J,{origin:M2,window:p.contentWindow});if(!$)return;switch($.type){case"hello":N4?.then((z)=>{if(!p||m0===null)return;if(z)Q1({type:"token",token:z});else H4("no_token")});return;case"ready":if(R1=!0,clearTimeout(F4),p.classList.add("on"),L1?.ready(),Z1.answer)Q1({type:"answer"});if(Z1.voice)Q1({type:"voice"});return;case"size":if(typeof $.width==="number"&&typeof $.height==="number")B4={width:$.width,height:$.height};if($.layout==="card"||$.layout==="full"){if($.layout==="full"&&S1==="card")U7();S1=$.layout}return X1();case"drag":return P4($);case"home":return A0=null,L8(),X1();case"done":{let z=L1;W1(),z?.done();return}case"failed":return H4($.reason??"failed");case"ink":{let z=I1($.op);if(z)D2(z);return}}}function _4(J,$=M2){let z=typeof navigator>"u"?void 0:navigator.mediaDevices;try{z?.setCaptureHandleConfig?.(J&&$?{handle:J,exposeOrigin:!1,permittedOrigins:[$]}:{})}catch{}}var q4=null;function O8(J,$){if(q4={handle:J,readableBy:$},!D0?.isConnected)_4(J,$)}function P4(J){if(!p||S1!=="card"||typeof J.x!=="number"||typeof J.y!=="number")return;if(J.phase==="start"){let $=p.getBoundingClientRect();t={sx:J.x,sy:J.y,x:$.left,y:$.top,lx:J.x,ly:J.y},q2(!0);return}if(!t)return;if(t.lx=J.x,t.ly=J.y,A0=_8({x:t.x+(J.x-t.sx),y:t.y+(J.y-t.sy)},S8(),P2()),X1(),J.phase==="end")t=null,q2(!1),L8()}var O1=null;function q2(J){if(O1){for(let $ of["pointermove","pointerup","pointercancel"])window.removeEventListener($,O1,!0);O1=null}if(!J)return;O1=($)=>{if(!t)return q2(!1);if($.type==="pointermove"&&$.buttons!==0)return P4({type:"drag",phase:"move",x:$.screenX,y:$.screenY});let z=$.type==="pointerup";P4({type:"drag",phase:"end",x:z?$.screenX:t.lx,y:z?$.screenY:t.ly})};for(let $ of["pointermove","pointerup","pointercancel"])window.addEventListener($,O1,!0)}function U7(){if(!p?.contentWindow)return;let J=p.getBoundingClientRect();Q1({type:"corner",x:Math.round(J.left),y:Math.round(J.top),width:Math.round(J.width)})}function L8(){try{if(A0)sessionStorage.setItem(D4,JSON.stringify(A0));else sessionStorage.removeItem(D4)}catch{}}var P2=()=>({w:window.innerWidth,h:window.innerHeight});function S8(){let J=P2();return{w:Math.min(M4,J.w-Q0),h:Math.min(B4.height||0,J.h-Q0)}}function X1(){if(!p)return;let J=p.style;if(S1==="full"){Object.assign(J,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let $=S8(),z=P2().w<480;if(J.width=z?`calc(100vw - ${Q0}px)`:`${$.w}px`,J.height=`${$.h}px`,A0&&!z){let j=_8(A0,$,P2());Object.assign(J,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(J,{left:z?`${Q0/2}px`:"",top:"",right:z?"":`${Q0/2}px`,bottom:`calc(${Q0/2}px + var(--lw-chat-lift, 0px))`})}var B2=[2000,5000,15000,30000,60000],R8=new Set(["ringing","active"]),D7=20000,I4=!1,u0=!1,A8=0,H7=5,T1=null,w8=0,F2,C4,O4,y8=(J)=>J.endsWith("/")?J:`${J}/`;function q7(J,$){let z=new URL("api/presence/ws",y8(J));return z.protocol=z.protocol==="https:"?"wss:":"ws:",z.searchParams.set("t",$),z.toString()}function P7(J){if(J.chatId||!J.ticketId)return`/me/chat?call=${J.id}`;return`/me/tickets/${J.ticketId}?call=${J.id}`}function M7(J){return J.status==="ringing"&&(J.side==="reporter"||J.side===void 0||J.side===null)}var L4=new Set;function v8(J){return L4.add(J),()=>L4.delete(J)}var T8=()=>M().ring!==!1;async function p0(){let J=M().identity;if(!J)return null;try{return await J()??null}catch{return null}}async function T4(J,$){let z=M();return fetch(new URL(J,y8(z.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":z.realmKey,authorization:`Bearer ${$}`},body:"{}"})}function _2(){if(I4||typeof window>"u"||typeof WebSocket>"u")return;let J=M();if(!J.identity||J.ring===!1&&!J.chat)return;I4=!0,u0=!1,N7(J.host);try{O8(`lw-tab:${b8()}`,new URL(J.host).origin)}catch{}g8()}function B7(){u0=!0,I4=!1,clearTimeout(C4),clearInterval(F2),clearTimeout(O4);try{T1?.close(1000,"bye")}catch{}T1=null,h0(),W1()}function A1(J=!1){if(u0)return;let $=J?B2[B2.length-1]:B2[Math.min(w8++,B2.length-1)];clearTimeout(C4),C4=setTimeout(()=>void g8(),$)}async function g8(){if(u0)return;let J=await p0();if(!J){if(++A8>=H7){u0=!0;return}return A1(!0)}A8=0;let $;try{$=await T4(M().chat?"ingest/live-ticket?chat=1":"ingest/live-ticket",J)}catch{return A1()}if($.status===401||$.status===404||$.status===403){u0=!0;return}if(!$.ok)return A1($.status===429);let z;try{z=await $.json()}catch{return A1()}if(!z.ticket){u0=!0;return}if(z.calls&&z.call&&T8())f8(z.call);let j=new WebSocket(q7(M().host,z.ticket));T1=j,j.onopen=()=>{w8=0,j.send(JSON.stringify({type:"tab",id:b8()})),clearInterval(F2),F2=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},D7)},j.onmessage=(Q)=>{try{let Z=JSON.parse(String(Q.data));if(Z.type==="chat-changed"||Z.type==="ticket-changed"||Z.type==="chat-seen"){for(let X of L4)X(Z);return}if(Z.type==="call-state"&&Z.call&&typeof Z.call==="object"){if(T8())f8(Z.call)}else if(Z.type==="call-ink"&&typeof Z.call==="string"){let X=I1(Z.op);if(X)A4=Z.call,D2(X)}}catch{}},j.onclose=()=>{if(clearInterval(F2),T1===j)T1=null;A1()}}var S4="lw-call-framed";function F7(){try{return sessionStorage.getItem(S4)}catch{return null}}function N2(J){try{if(J)sessionStorage.setItem(S4,J);else sessionStorage.removeItem(S4)}catch{}}var E8=!1;function N7(J){if(E8||typeof document>"u")return;E8=!0;try{let $=new URL(J).origin;for(let z of["dns-prefetch","preconnect"]){let j=document.createElement("link");if(j.rel=z,j.href=$,z==="preconnect")j.crossOrigin="anonymous";j.dataset.debugReporter="true",document.head.append(j)}}catch{}}function x8(J){let $=M();if($.callFrame===!1||V1()===J.id)return;N2(J.id),I8(B8($.host,$.realmKey,null,J.id),J.id,{ready:()=>W8(J.id),done:()=>{N2(null),h0(J.id)},failed:()=>{N2(null),V8(J,R4(J))}},15000,p0())}var R4=(J)=>({open:()=>_7(J),decline:()=>void I7(J)}),T0=null;function b8(){if(T0)return T0;try{T0=sessionStorage.getItem(k8)}catch{}if(!T0||!/^[A-Za-z0-9_-]{8,40}$/.test(T0)){let J=new Uint8Array(12);crypto.getRandomValues(J),T0=Array.from(J,($)=>$.toString(16).padStart(2,"0")).join("");try{sessionStorage.setItem(k8,T0)}catch{}}return T0}var k8="lw-tab-id",A4=null;function f8(J){if(!R8.has(J.status)&&A4===J.id&&V1()!==J.id)A4=null,H2();if(!M7(J)){if(h0(J.id),J.status==="active"&&F7()===J.id&&!V1())x8(J);if(!R8.has(J.status)&&V1()===J.id)setTimeout(()=>{if(V1()===J.id)W1(),N2(null)},12000);return}if(M().callFrame===!1)W2(J,R4(J),"portal");else W2(J,{...R4(J),answer:()=>{X8(J.id),F8(J.id)},voice:()=>N8(J.id)},"frame"),x8(J);clearTimeout(O4);let $=new Date(J.ringUntil).getTime()-Date.now();O4=setTimeout(()=>{if(K8()===J.id)h0(J.id)},Math.max(5000,$+5000))}function _7(J){let $=window.open("about:blank","_blank");(async()=>{let z=await p0();if(z)T4(`ingest/calls/${J.id}/coming`,z).catch(()=>{return});let j;try{j=await z8(P7(J))}catch{$?.close();return}if($&&!$.closed){$.location.href=j;try{$.opener=null}catch{}K2()}else K2(j)})()}async function I7(J){h0(J.id);let $=await p0();if($)await T4(`ingest/calls/${J.id}/decline`,$).catch(()=>{return})}function x4(J,$,z,j){let Q=[];for(let Z of J){if(Z.right<=$.left||Z.left>=$.right||Z.bottom<=Z.top)continue;Q.push([z-Z.bottom-8-j,z-Z.top+8])}return Q.sort((Z,X)=>Z[0]-X[0])}function E4(J,$,z,j){if(j<z)return null;let Q=(Y)=>$.some(([G,B])=>Y>G&&Y<B),Z=(Y)=>Math.min(Math.max(Y,z),j),X=Z(J);if(!Q(X))return X;let W=[z,j,...$.flatMap(([Y,G])=>[Y,G])].map(Z).filter((Y)=>!Q(Y));if(!W.length)return null;return W.reduce((Y,G)=>{let B=Math.abs(G-X),F=Math.abs(Y-X);return B<F||B===F&&G>Y?G:Y})}function C7(J,$,z,j){let Q=J.side==="right"?"left":"right",Z=E4(J.y,$[J.side],z,j),X=E4(J.y,$[Q],z,j);if(Z===null&&X===null)return J;let W=Z===null?1/0:Math.abs(Z-J.y),Y=X===null?1/0:160+Math.abs(X-J.y);return W<=Y?{side:J.side,y:Z}:{side:Q,y:X}}function m8(J,$,z,j,Q){if(J&&E4(J.y,z[J.side],j,Q)===J.y)return J;return C7($,z,j,Q)}function O7(J){if(typeof J!=="string"||!J.startsWith("/")||J.length>200)return null;let z=(J.length>1?J.replace(/\/+$/,""):"").split(/(\*\*|\*)/).map((j)=>j==="**"?".*":j==="*"?"[^/]*":j.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join("");try{return new RegExp(`^${z}(?:/.*)?$`)}catch{return null}}function u8(J,$){let z=null;for(let j of $??[]){let Q=O7(j.path);if(!Q||!Q.test(J))continue;if(!z||j.path.replace(/\*/g,"").length>z.path.replace(/\*/g,"").length)z=j}return z}var L7=/^LW-/,S7='a[href],button,input,select,textarea,summary,label,[role="button"],[role="link"],[role="tab"],[role="menuitem"],[role="checkbox"],[role="switch"],[role="radio"],[role="option"],[role="slider"],[role="combobox"],[role="textbox"],[contenteditable=""],[contenteditable="true"],[tabindex]:not([tabindex="-1"])',h8=/(auto|scroll|overlay)/;function p8(J,$,z={}){if(typeof document>"u"||typeof document.elementsFromPoint!=="function")return J.map(()=>[]);let j=z.step??12,Q=document.documentElement,Z=document.body,X=new Map,W=(I)=>X.get(I)??(X.set(I,getComputedStyle(I)),X.get(I)),Y=$.w*$.h,G=(I)=>I.width*I.height>0.34*Y||I.width>=$.w*0.9&&I.height>=$.h*0.9,B=(I)=>{let N=W(I);return h8.test(N.overflowY)&&I.scrollHeight>I.clientHeight+1||h8.test(N.overflowX)&&I.scrollWidth>I.clientWidth+1},F=document.scrollingElement??Q,C=F.scrollHeight>F.clientHeight+1&&W(Q).overflowY!=="hidden"&&(!Z||W(Z).overflowY!=="hidden"),g=(I,N)=>{let _={top:0,bottom:$.h};for(let L=I.parentElement;L&&L!==Q&&L!==Z;L=L.parentElement){let S=W(L);if(S.overflowY!=="visible"&&S.overflowY!=="clip"){let h=L.getBoundingClientRect();_={top:h.top,bottom:h.bottom};break}}let m=I.getBoundingClientRect(),E=parseFloat(N.top),x=parseFloat(N.bottom);return!Number.isNaN(x)&&m.bottom>=_.bottom-x-1||!Number.isNaN(E)&&m.top<=_.top+E+1},T=(I)=>{let N=null,_=!1,m=1;for(let E=I;E&&E!==Q&&E!==Z;E=E.parentElement){let x=W(E),L=parseFloat(x.opacity);if(!Number.isNaN(L))m*=L;if(x.position==="fixed"||x.position==="sticky"&&g(E,x)){N=E;break}if(E!==I&&B(E))_=!0}if(!N&&C)_=!0;return{float:N,scrolled:_,opacity:m}},b=new Map;return J.map((I)=>{let N=new Set,_=new Set,m=[],E=(L)=>{if(_.has(L))return;_.add(L);let S=L.getBoundingClientRect();if(S.width>0&&S.height>0)m.push({top:S.top,bottom:S.bottom,left:S.left,right:S.right})},x=[I.left+6,(I.left+I.right)/2,I.right-6];for(let L=j/2;L<$.h;L+=j)for(let S of x){let h=document.elementsFromPoint(S,L).find((r)=>!L7.test(r.tagName));if(!h||h===Q||h===Z||N.has(h))continue;if(N.add(h),z.extra){let r=null;try{r=h.closest(z.extra)}catch{r=null}if(r){E(r);continue}}let{float:k,scrolled:$0,opacity:y}=b.get(h)??(b.set(h,T(h)),b.get(h));if(y<0.05)continue;let d=h.closest(S7),q0=d&&(!k||k.contains(d))?d:null;if(k&&!G(k.getBoundingClientRect())){let r=q0??h;if(!G(r.getBoundingClientRect()))E(r);continue}if($0||!q0||G(q0.getBoundingClientRect()))continue;E(q0)}return m})}var R7="lw-support-chat",A7="lw-support-frame",T7="lw-support-host",l=56,i0=12,E7='<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>',x7=`
339
+ iframe.on { visibility: visible; }`,m=document.createElement("iframe"),m.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",m.title="สายจากทีมงาน",m.dataset.lwCallFrame=$,m.setAttribute("allowtransparency","true"),m.src=J,X.append(Z,m),document.body.append(q0),X1(),window.addEventListener("message",O8),window.addEventListener("resize",X1),C4(`lw-call:${$}`),N4=setTimeout(()=>{if(!A1)q4("timeout")},j)}function V1(){if(q0)C4(P4?.handle??null,P4?.readableBy);q2(),clearTimeout(N4),window.removeEventListener("message",O8),window.removeEventListener("resize",X1),P2(!1),q0?.remove(),q0=null,m=null,h0=null,S1=null,J0=null,_4=null,Q1={answer:!1,voice:!1}}function q4(J){let $=S1;V1(),$?.failed(J)}function O8(J){if(!m)return;let $=q7(J,{origin:M2,window:m.contentWindow});if(!$)return;switch($.type){case"hello":_4?.then((z)=>{if(!m||h0===null)return;if(z)j1({type:"token",token:z});else q4("no_token")});return;case"ready":if(A1=!0,clearTimeout(N4),m.classList.add("on"),S1?.ready(),Q1.answer)j1({type:"answer"});if(Q1.voice)j1({type:"voice"});return;case"size":if(typeof $.width==="number"&&typeof $.height==="number")F4={width:$.width,height:$.height};if($.layout==="card"||$.layout==="full"){if($.layout==="full"&&R1==="card")P7();R1=$.layout}return X1();case"drag":return B4($);case"home":return E0=null,S8(),X1();case"done":{let z=S1;V1(),z?.done();return}case"failed":return q4($.reason??"failed");case"ink":{let z=I1($.op);if(z)H2(z);return}}}function C4(J,$=M2){let z=typeof navigator>"u"?void 0:navigator.mediaDevices;try{z?.setCaptureHandleConfig?.(J&&$?{handle:J,exposeOrigin:!1,permittedOrigins:[$]}:{})}catch{}}var P4=null;function L8(J,$){if(P4={handle:J,readableBy:$},!q0?.isConnected)C4(J,$)}function B4(J){if(!m||R1!=="card"||typeof J.x!=="number"||typeof J.y!=="number")return;if(J.phase==="start"){let $=m.getBoundingClientRect();J0={sx:J.x,sy:J.y,x:$.left,y:$.top,lx:J.x,ly:J.y},P2(!0);return}if(!J0)return;if(J0.lx=J.x,J0.ly=J.y,E0=C8({x:J0.x+(J.x-J0.sx),y:J0.y+(J.y-J0.sy)},R8(),B2()),X1(),J.phase==="end")J0=null,P2(!1),S8()}var L1=null;function P2(J){if(L1){for(let $ of["pointermove","pointerup","pointercancel"])window.removeEventListener($,L1,!0);L1=null}if(!J)return;L1=($)=>{if(!J0)return P2(!1);if($.type==="pointermove"&&$.buttons!==0)return B4({type:"drag",phase:"move",x:$.screenX,y:$.screenY});let z=$.type==="pointerup";B4({type:"drag",phase:"end",x:z?$.screenX:J0.lx,y:z?$.screenY:J0.ly})};for(let $ of["pointermove","pointerup","pointercancel"])window.addEventListener($,L1,!0)}function P7(){if(!m?.contentWindow)return;let J=m.getBoundingClientRect();j1({type:"corner",x:Math.round(J.left),y:Math.round(J.top),width:Math.round(J.width)})}function S8(){try{if(E0)sessionStorage.setItem(H4,JSON.stringify(E0));else sessionStorage.removeItem(H4)}catch{}}var B2=()=>({w:window.innerWidth,h:window.innerHeight});function R8(){let J=B2();return{w:Math.min(M4,J.w-Q0),h:Math.min(F4.height||0,J.h-Q0)}}function X1(){if(!m)return;let J=m.style;if(R1==="full"){Object.assign(J,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let $=R8(),z=B2().w<480;if(J.width=z?`calc(100vw - ${Q0}px)`:`${$.w}px`,J.height=`${$.h}px`,E0&&!z){let j=C8(E0,$,B2());Object.assign(J,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(J,{left:z?`${Q0/2}px`:"",top:"",right:z?"":`${Q0/2}px`,bottom:`calc(${Q0/2}px + var(--lw-chat-lift, 0px))`})}var F2=[2000,5000,15000,30000,60000],A8=new Set(["ringing","active"]),B7=20000,I4=!1,m0=!1,T8=0,M7=5,E1=null,y8=0,N2,O4,L4,g8=(J)=>J.endsWith("/")?J:`${J}/`;function F7(J,$){let z=new URL("api/presence/ws",g8(J));return z.protocol=z.protocol==="https:"?"wss:":"ws:",z.searchParams.set("t",$),z.toString()}function N7(J){if(J.chatId||!J.ticketId)return`/me/chat?call=${J.id}`;return`/me/tickets/${J.ticketId}?call=${J.id}`}function _7(J){return J.status==="ringing"&&(J.side==="reporter"||J.side===void 0||J.side===null)}var S4=new Set;function v8(J){return S4.add(J),()=>S4.delete(J)}var E8=()=>F().ring!==!1;async function u0(){let J=F().identity;if(!J)return null;try{return await J()??null}catch{return null}}async function E4(J,$){let z=F();return fetch(new URL(J,g8(z.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":z.realmKey,authorization:`Bearer ${$}`},body:"{}"})}function C2(){if(I4||typeof window>"u"||typeof WebSocket>"u")return;let J=F();if(!J.identity||J.ring===!1&&!J.chat)return;I4=!0,m0=!1,O7(J.host);try{L8(`lw-tab:${h8()}`,new URL(J.host).origin)}catch{}b8()}function C7(){m0=!0,I4=!1,clearTimeout(O4),clearInterval(N2),clearTimeout(L4);try{E1?.close(1000,"bye")}catch{}E1=null,b0(),V1()}function T1(J=!1){if(m0)return;let $=J?F2[F2.length-1]:F2[Math.min(y8++,F2.length-1)];clearTimeout(O4),O4=setTimeout(()=>void b8(),$)}async function b8(){if(m0)return;let J=await u0();if(!J){if(++T8>=M7){m0=!0;return}return T1(!0)}T8=0;let $;try{$=await E4(F().chat?"ingest/live-ticket?chat=1":"ingest/live-ticket",J)}catch{return T1()}if($.status===401||$.status===404||$.status===403){m0=!0;return}if(!$.ok)return T1($.status===429);let z;try{z=await $.json()}catch{return T1()}if(!z.ticket){m0=!0;return}if(z.calls&&z.call&&E8())w8(z.call);let j=new WebSocket(F7(F().host,z.ticket));E1=j,j.onopen=()=>{y8=0,j.send(JSON.stringify({type:"tab",id:h8()})),clearInterval(N2),N2=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},B7)},j.onmessage=(Q)=>{try{let X=JSON.parse(String(Q.data));if(X.type==="chat-changed"||X.type==="ticket-changed"||X.type==="chat-seen"){for(let Z of S4)Z(X);return}if(X.type==="call-state"&&X.call&&typeof X.call==="object"){if(E8())w8(X.call)}else if(X.type==="call-ink"&&typeof X.call==="string"){let Z=I1(X.op);if(Z)T4=X.call,H2(Z)}}catch{}},j.onclose=()=>{if(clearInterval(N2),E1===j)E1=null;T1()}}var R4="lw-call-framed";function I7(){try{return sessionStorage.getItem(R4)}catch{return null}}function _2(J){try{if(J)sessionStorage.setItem(R4,J);else sessionStorage.removeItem(R4)}catch{}}var x8=!1;function O7(J){if(x8||typeof document>"u")return;x8=!0;try{let $=new URL(J).origin;for(let z of["dns-prefetch","preconnect"]){let j=document.createElement("link");if(j.rel=z,j.href=$,z==="preconnect")j.crossOrigin="anonymous";j.dataset.debugReporter="true",document.head.append(j)}}catch{}}function k8(J){let $=F();if($.callFrame===!1||Z1()===J.id)return;_2(J.id),I8(F8($.host,$.realmKey,null,J.id),J.id,{ready:()=>K8(J.id),done:()=>{_2(null),b0(J.id)},failed:()=>{_2(null),W8(J,A4(J))}},15000,u0())}var A4=(J)=>({open:()=>L7(J),decline:()=>void S7(J)}),x0=null;function h8(){if(x0)return x0;try{x0=sessionStorage.getItem(f8)}catch{}if(!x0||!/^[A-Za-z0-9_-]{8,40}$/.test(x0)){let J=new Uint8Array(12);crypto.getRandomValues(J),x0=Array.from(J,($)=>$.toString(16).padStart(2,"0")).join("");try{sessionStorage.setItem(f8,x0)}catch{}}return x0}var f8="lw-tab-id",T4=null;function w8(J){if(!A8.has(J.status)&&T4===J.id&&Z1()!==J.id)T4=null,q2();if(!_7(J)){if(b0(J.id),J.status==="active"&&I7()===J.id&&!Z1())k8(J);if(!A8.has(J.status)&&Z1()===J.id)setTimeout(()=>{if(Z1()===J.id)V1(),_2(null)},12000);return}if(F().callFrame===!1)K2(J,A4(J),"portal");else K2(J,{...A4(J),answer:()=>{V8(J.id),N8(J.id)},voice:()=>_8(J.id)},"frame"),k8(J);clearTimeout(L4);let $=new Date(J.ringUntil).getTime()-Date.now();L4=setTimeout(()=>{if(Y8()===J.id)b0(J.id)},Math.max(5000,$+5000))}function L7(J){let $=window.open("about:blank","_blank");(async()=>{let z=await u0();if(z)E4(`ingest/calls/${J.id}/coming`,z).catch(()=>{return});let j;try{j=await j8(N7(J))}catch{$?.close();return}if($&&!$.closed){$.location.href=j;try{$.opener=null}catch{}Y2()}else Y2(j)})()}async function S7(J){b0(J.id);let $=await u0();if($)await E4(`ingest/calls/${J.id}/decline`,$).catch(()=>{return})}function d8(J,$,z,j){let Q=[];for(let X of J){if(X.right<=$.left||X.left>=$.right||X.bottom<=X.top)continue;Q.push([z-X.bottom-8-j,z-X.top+8])}return Q.sort((X,Z)=>X[0]-Z[0])}function x1(J,$,z,j){if(j<z)return null;let Q=(Y)=>$.some(([G,C])=>Y>G&&Y<C),X=(Y)=>Math.min(Math.max(Y,z),j),Z=X(J);if(!Q(Z))return Z;let W=[z,j,...$.flatMap(([Y,G])=>[Y,G])].map(X).filter((Y)=>!Q(Y));if(!W.length)return null;return W.reduce((Y,G)=>{let C=Math.abs(G-Z),B=Math.abs(Y-Z);return C<B||C===B&&G>Y?G:Y})}function R7(J,$,z,j){let Q=J.side==="right"?"left":"right",X=x1(J.y,$[J.side],z,j),Z=x1(J.y,$[Q],z,j);if(X===null&&Z===null)return J;let W=X===null?1/0:Math.abs(X-J.y),Y=Z===null?1/0:160+Math.abs(Z-J.y);return W<=Y?{side:J.side,y:X}:{side:Q,y:Z}}var m8=(J,$)=>Math.abs(J.y-$.y)+(J.side===$.side?0:160);function i8(J,$,z,j,Q){let X=R7($,z,j,Q);if(J&&x1(J.y,z[J.side],j,Q)===J.y&&m8(J,$)<=m8(X,$)+48)return J;return X}function A7(J){if(typeof J!=="string"||!J.startsWith("/")||J.length>200)return null;let z=(J.length>1?J.replace(/\/+$/,""):"").split(/(\*\*|\*)/).map((j)=>j==="**"?".*":j==="*"?"[^/]*":j.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join("");try{return new RegExp(`^${z}(?:/.*)?$`)}catch{return null}}function c8(J,$){let z=null;for(let j of $??[]){let Q=A7(j.path);if(!Q||!Q.test(J))continue;if(!z||j.path.replace(/\*/g,"").length>z.path.replace(/\*/g,"").length)z=j}return z}var u8=/^LW-/,T7='a[href],button,input,select,textarea,summary,label,[role="button"],[role="link"],[role="tab"],[role="menuitem"],[role="checkbox"],[role="switch"],[role="radio"],[role="option"],[role="slider"],[role="combobox"],[role="textbox"],[contenteditable=""],[contenteditable="true"],[tabindex]:not([tabindex="-1"])',p8=/(auto|scroll|overlay)/;function l8(J,$,z={}){if(typeof document>"u"||typeof document.elementsFromPoint!=="function")return J.map(()=>[]);let j=z.step??16,Q=document.documentElement,X=document.body,Z=new Map,W=(q)=>Z.get(q)??(Z.set(q,getComputedStyle(q)),Z.get(q)),Y=$.w*$.h,G=(q)=>q.width*q.height>0.34*Y||q.width>=$.w*0.9&&q.height>=$.h*0.9,C=(q)=>{let _=W(q);return p8.test(_.overflowY)&&q.scrollHeight>q.clientHeight+1||p8.test(_.overflowX)&&q.scrollWidth>q.clientWidth+1},B=document.scrollingElement??Q,N=B.scrollHeight>B.clientHeight+1&&W(Q).overflowY!=="hidden"&&(!X||W(X).overflowY!=="hidden"),T=(q,_)=>{let y={top:0,bottom:$.h};for(let I=q.parentElement;I&&I!==Q&&I!==X;I=I.parentElement){let p=W(I);if(p.overflowY!=="visible"&&p.overflowY!=="clip"){let O=I.getBoundingClientRect();y={top:O.top,bottom:O.bottom};break}}let b=q.getBoundingClientRect(),L=parseFloat(_.top),g=parseFloat(_.bottom);return!Number.isNaN(g)&&b.bottom>=y.bottom-g-1||!Number.isNaN(L)&&b.top<=y.top+L+1},E=(q)=>{let _=null,y=!1,b=1;for(let L=q;L&&L!==Q&&L!==X;L=L.parentElement){let g=W(L),I=parseFloat(g.opacity);if(!Number.isNaN(I))b*=I;if(g.position==="fixed"||g.position==="sticky"&&T(L,g)){_=L;break}if(L!==q&&C(L))y=!0}if(!_&&N)y=!0;return{float:_,scrolled:y,opacity:b}},v=new Map,c=(q,_)=>{let y=document.elementFromPoint(q,_);if(!y||!u8.test(y.tagName))return y;return document.elementsFromPoint(q,_).find((b)=>!u8.test(b.tagName))??null};return J.map((q)=>{let _=new Set,y=new Set,b=[],L=(I)=>{if(y.has(I))return;y.add(I);let p=I.getBoundingClientRect();if(p.width>0&&p.height>0)b.push({top:p.top,bottom:p.bottom,left:p.left,right:p.right})},g=[q.left+6,(q.left+q.right)/2,q.right-6];for(let I=j/2;I<$.h;I+=j)for(let p of g){let O=c(p,I);if(!O||O===Q||O===X||_.has(O))continue;if(_.add(O),z.extra){let r=null;try{r=O.closest(z.extra)}catch{r=null}if(r){L(r);continue}}let{float:n,scrolled:f,opacity:l}=v.get(O)??(v.set(O,E(O)),v.get(O));if(l<0.05)continue;let I0=O.closest(T7),V0=I0&&(!n||n.contains(I0))?I0:null;if(n&&!G(n.getBoundingClientRect())){let r=V0??O;if(!G(r.getBoundingClientRect()))L(r);continue}if(f||!V0||G(V0.getBoundingClientRect()))continue;L(V0)}return b})}var E7="lw-support-chat",x7="lw-support-frame",k7="lw-support-host",u=56,d0=12,f7='<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>',w7=`
340
340
  :host { all: initial; }
341
341
  .bubble {
342
- position: fixed; z-index: 2147483000; width: ${l}px; height: ${l}px; border-radius: 50%;
342
+ position: fixed; z-index: 2147483000; width: ${u}px; height: ${u}px; border-radius: 50%;
343
343
  display: grid; place-items: center; border: 0; cursor: pointer; padding: 0;
344
344
  background: var(--lw-chat-color, #00468f); color: #fff; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 4px 10px -4px rgba(0, 0, 0, 0.2);
345
345
  transition: transform 150ms ease, background 150ms ease;
346
- font-family: var(--lw-host-font, ${Q2});
346
+ font-family: var(--lw-host-font, ${X2});
347
347
  }
348
348
  .bubble:hover { filter: brightness(0.92); transform: translateY(-1px); }
349
349
  .bubble { touch-action: none; }
@@ -370,7 +370,7 @@ iframe.on { visibility: visible; }`,p=document.createElement("iframe"),p.allow="
370
370
  content: ""; position: absolute; top: 50%; right: -4px; width: 10px; height: 10px; background: #fff; border-radius: 2px;
371
371
  transform: translateY(-50%) rotate(45deg); box-shadow: 1px -1px 0 rgba(0, 0, 0, 0.04);
372
372
  }
373
- .label .text { display: block; max-width: min(240px, calc(100vw - ${l+64}px)); overflow: hidden; text-overflow: ellipsis; }
373
+ .label .text { display: block; max-width: min(240px, calc(100vw - ${u+64}px)); overflow: hidden; text-overflow: ellipsis; }
374
374
  .at-left .label { right: auto; left: calc(100% + 12px); transform: translate(-4px, -50%); }
375
375
  .at-left .label::after { right: auto; left: -4px; }
376
376
  .new .label { color: var(--lw-chat-color, #00468f); }
@@ -378,7 +378,7 @@ iframe.on { visibility: visible; }`,p=document.createElement("iframe"),p.allow="
378
378
  @media (hover: hover) { .bubble:hover .label { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(0, -50%); } }
379
379
  .unlabelled .label, .bubble.dragging .label, .open .label { display: none; }
380
380
  .panel {
381
- position: fixed; z-index: 2147483001; width: min(380px, calc(100vw - 32px)); height: min(640px, calc(100vh - ${l+i0+32}px));
381
+ position: fixed; z-index: 2147483001; width: min(380px, calc(100vw - 32px)); height: min(640px, calc(100vh - ${u+d0+32}px));
382
382
  border-radius: 20px; overflow: hidden; background: #fff; border: 1px solid rgba(15, 23, 42, 0.08);
383
383
  box-shadow: 0 28px 64px -16px rgba(15, 23, 42, 0.3), 0 10px 24px -10px rgba(15, 23, 42, 0.14);
384
384
  animation: in 180ms cubic-bezier(0.16, 1, 0.3, 1);
@@ -391,4 +391,4 @@ iframe.on { visibility: visible; }`,p=document.createElement("iframe"),p.allow="
391
391
  .open .bubble { display: none; }
392
392
  }
393
393
  @media (prefers-reduced-motion: reduce) { .panel { animation: none; } .bubble, .label { transition: none; } }
394
- `,u=null,Z0=null,a=null,W0=null,R=null,k1=null,L2=null,X0=!1,d0=0,A2=(J)=>J.endsWith("/")?J:`${J}/`,k7=()=>{try{return new URL(M().host).origin}catch{return"*"}};function a8(J,$){let z=new URL("embed/support",A2(J));return z.searchParams.set("realm",$),z.searchParams.set("hand","1"),z.toString()}function f7(J){return/^\/me\/(?:chat|tickets(?:\/[\w-]{1,64})?)$/.test(J)?J:"/me/chat"}function f4(J){return new URL("support-face.webp",A2(J)).toString()}function t8(J){return J+l+i0-16}function w7(J){return`min(640px, calc(100vh - ${J+l+i0+16}px))`}var e=8,y7=200;function v7(J,$,z,j){return{side:J<z.w/2?"left":"right",x:j,y:e8(z.h-$-l/2,z.h)}}function e8(J,$){return Math.round(Math.min(Math.max(J,e),Math.max(e,$-l-e)))}function g7(J){return J.side==="right"&&J.y<y7?t8(J.y):0}function b7(J,$){let z=$-(J.y+l+i0)-16,j=J.y-i0-16;if(z>=420||z>=j)return{bottom:J.y+l+i0,height:Math.max(240,Math.min(640,z))};return{top:$-J.y+i0,height:Math.max(240,Math.min(640,j))}}function J3(J,$,z){return{x:Math.round(Math.min(Math.max(J.x,e),Math.max(e,z.w-$.w-e))),y:Math.round(Math.min(Math.max(J.y,e),Math.max(e,z.h-$.h-e)))}}function $3(J){return J<=0?"":J>99?"99+":String(J)}function z3(J){if(d0=Math.max(0,Math.floor(J)||0),!k1||!R)return;let $=s(M().locale);k1.textContent=$3(d0),k1.hidden=d0===0,R.setAttribute("aria-label",d0?`${$.chatOpen} · ${$.chatUnread.replace("{n}",String(d0))}`:$.chatOpen),b1()}function h7(J,$){if(J.own===!1)return null;let z=J.unread>0,j=typeof J.own==="string"?J.own.trim().slice(0,60):"";return{text:z?$.chatLabelNew:j||$.chatLabel,shown:!J.open&&(z||!J.opened),isNew:z}}var K1=!1;function b1(){if(!L2||!R)return;let J=M(),$=J.chat&&J.chat!==!0?J.chat.label:void 0,z=$!==void 0?$:G1?.label,j=h7({own:z,unread:d0,opened:K1,open:X0},s(J.locale));R.classList.toggle("unlabelled",!j),R.classList.toggle("labelled",!!j?.shown),R.classList.toggle("new",!!j?.isNew),R.classList.toggle("at-left",(E0??H0).side==="left"),L2.querySelector(".text").textContent=j?.text??""}var G1=null;function j3(J,$){if(!$||$.faceUrl===void 0)return f4(J);if($.faceUrl===null)return null;try{return new URL($.faceUrl.replace(/^\//,""),A2(J)).toString()}catch{return f4(J)}}function m7(J){if(G1=J,!u||!R)return;let $=J?.color&&/^#[0-9a-f]{6}$/i.test(J.color)?J.color:null;if($)u.style.setProperty("--lw-chat-color",$);else u.style.removeProperty("--lw-chat-color");let z=Z0?.querySelector(".face"),j=j3(M().host,J);if(w0(!0),z){if(!j)R.classList.remove("has-face"),z.removeAttribute("src");else if(z.getAttribute("src")!==j)R.classList.remove("has-face"),z.src=j}b1()}var E1=null;async function w1(){if(E1)return E1;let J=u7();E1=J;try{await J}finally{if(E1===J)E1=null}}async function u7(){try{let J=M(),$=J.chat&&J.chat!==!0?J.chat:null;if($?.show&&!$.show())return void I2(!1);let z=await p0();if(!z)return void I2(!1);let j=await fetch(new URL("ingest/support-unread",A2(J.host)).toString(),{headers:{"x-realm-key":J.realmKey,authorization:`Bearer ${z}`}});if(j.status===404||j.status===401||j.status===403)return void I2(!1);if(!j.ok)return;let Q=await j.json();if(Q.look&&typeof Q.look==="object")m7(Q.look);if(I2(!0),!X0)z3(typeof Q.total==="number"?Q.total:0)}catch{}}function I2(J){if(!u)return;if(u.style.display=J?"":"none",J)Z2(u);if(N0(),J)w0(!0)}var H0={side:"right",x:16,y:16},f0=null,p7=380,Q3=()=>`lw-support-chat-place:${M().realmKey}`,y1=()=>({w:window.innerWidth,h:window.innerHeight}),Y1=!1;function d7(){let J=m1(M().chat);if(J)H0={side:J.side,x:J.x,y:J.y};try{let $=JSON.parse(localStorage.getItem(Q3())??"null"),z=$?.bubble;if(Y1=!!z&&(z.side==="left"||z.side==="right")&&typeof z.y==="number"&&Number.isFinite(z.y),Y1)H0={...H0,side:z.side,y:z.y};let j=$?.panel;f0=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,K1=$?.opened===!0}catch{}}function b4(){try{localStorage.setItem(Q3(),JSON.stringify({...Y1?{bubble:{side:H0.side,y:H0.y}}:{},panel:f0,...K1?{opened:!0}:{}}))}catch{}}var f1=()=>window.location?.pathname??"/",E0=null,w4="",k0=null,h4=!1;function m4(){let J=M().chat,$=J&&J!==!0?J.avoid:void 0;if($===!1||G1?.avoid===!1)return{on:!1,extra:null};return{on:!0,extra:typeof $==="string"&&$.trim()?$.trim():null}}function i7(){let J=u8(f1(),G1?.places);if(h4=J?.show==="hide",Y1||!J||J.show==="hide")return H0;return{side:J.show,x:H0.x,y:J.y}}function Z3(){if(!R)return;let{on:J,extra:$}=m4();if(!J)return k0=null,N0();let z=y1(),j=H0.x,Q={left:z.w-j-l,right:z.w-j},Z={left:j,right:j+l},[X=[],W=[]]=p8([Q,Z],z,{extra:$}),Y=x4(X,Q,z.h,l),G=x4(W,Z,z.h,l);v1=JSON.stringify([Y,G])===JSON.stringify(k0&&[k0.right,k0.left])?Math.min(v1+1,l7):0,k0={right:Y,left:G},N0()}var c7=400,l7=3,d8=60,x0,i8=0,c8=0,v1=0;function w0(J=!1){if(!u)return;let $=Date.now();if(J){if(v1=0,x0&&i8-$<=d8)return;clearTimeout(x0),x0=void 0}if(x0)return;let z=J?d8:Math.max(0,c7*2**v1-($-c8));i8=$+z,x0=setTimeout(()=>{if(x0=void 0,!u||X0||J0?.moved||typeof document<"u"&&document.hidden)return;c8=Date.now(),Z3()},z)}var C2=null,k4="",l8,r8=()=>w0(),O2=()=>w0(!0),o8=["popstate","hashchange","pointerup","keyup"];function X3(J){C2?.disconnect(),C2=null,clearInterval(l8);for(let $ of o8)window.removeEventListener($,O2,!0);for(let $ of["scroll","transitionend","animationend"])window.removeEventListener($,r8,!0);if(document.removeEventListener("visibilitychange",O2),!J)return;if(typeof MutationObserver<"u")C2=new MutationObserver(($)=>{if($.some((j)=>{let Q=j.target;if(Q===document.documentElement&&j.type==="attributes")return!1;return!(Q.nodeType===1&&/^LW-/.test(Q.tagName))&&Q!==u}))w0()}),C2.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","open","aria-expanded"]});for(let $ of o8)window.addEventListener($,O2,{capture:!0,passive:!0});for(let $ of["scroll","transitionend","animationend"])window.addEventListener($,r8,{capture:!0,passive:!0});document.addEventListener("visibilitychange",O2),k4=f1(),l8=setInterval(()=>{if(f1()===k4)return;k4=f1(),N0(),w0(!0)},1000)}function N0(){if(!R||!a)return;let J=y1(),$=i7(),z=e8($.y,J.h),j=`${f1()}|${$.side}|${$.x}|${z}`,Q=E0&&w4===j?E0:null,Z=!X0||!E0?k0&&m4().on?m8(Q,{side:$.side,y:z},k0,e,Math.max(e,J.h-l-e)):{side:$.side,y:z}:E0;E0={side:Z.side,x:$.x,y:Z.y},w4=j;let X=E0,W=X.y,Y=X.side==="right"?"left":"right";if(R.style.display=h4&&!X0?"none":"",Object.assign(R.style,{[X.side]:`${X.x}px`,[Y]:"",bottom:`${W}px`,top:""}),f0){let B={w:Math.min(p7,J.w-32),h:Math.min(f0.h,J.h-2*e)},F=J3(f0,B,J);Object.assign(a.style,{left:`${F.x}px`,top:`${F.y}px`,right:"",bottom:"",height:`${B.h}px`})}else{let B=b7(X,J.h);Object.assign(a.style,{[X.side]:`${X.x}px`,[Y]:"",bottom:B.bottom!==void 0?`${B.bottom}px`:"",top:B.top!==void 0?`${B.top}px`:"",height:`${B.height}px`})}let G=u&&u.style.display!=="none"&&R.style.display!=="none"?g7(X):0;if(G)document.documentElement.style.setProperty("--lw-chat-lift",`${G}px`);else document.documentElement.style.removeProperty("--lw-chat-lift");b1()}var J0=null,y4=!1;function r7(J){if(J.button!==0)return;J0={id:J.pointerId,sx:J.clientX,sy:J.clientY,moved:!1};try{R?.setPointerCapture(J.pointerId)}catch{}}function o7(J){if(!J0||J.pointerId!==J0.id||!R)return;if(!J0.moved&&Math.hypot(J.clientX-J0.sx,J.clientY-J0.sy)<6)return;J0.moved=!0,R.classList.add("dragging"),Object.assign(R.style,{left:`${J.clientX-l/2}px`,top:`${J.clientY-l/2}px`,right:"",bottom:""})}function n8(J){if(!J0||J.pointerId!==J0.id)return;let $=J0;if(J0=null,R?.classList.remove("dragging"),!$.moved)return;if(y4=!0,setTimeout(()=>y4=!1,0),J.type==="pointerup")H0=v7(J.clientX,J.clientY,y1(),m1(M().chat)?.x??16),Y1=!0,f0=null,b4();if(m4().on)Z3();else N0()}var o=null;function v4(J){if(!a||typeof J.x!=="number"||typeof J.y!=="number"||y1().w<640)return;if(J.phase==="start"){let $=a.getBoundingClientRect();o={sx:J.x,sy:J.y,x:$.left,y:$.top,lx:J.x,ly:J.y,h:Math.round($.height)||640},S2(!0);return}if(!o)return;if(o.lx=J.x,o.ly=J.y,f0={...J3({x:o.x+(J.x-o.sx),y:o.y+(J.y-o.sy)},{w:a.offsetWidth,h:o.h},y1()),h:o.h},N0(),J.phase==="end")o=null,S2(!1),b4()}var x1=null;function S2(J){if(x1){for(let $ of["pointermove","pointerup","pointercancel"])window.removeEventListener($,x1,!0);x1=null}if(!J)return;x1=($)=>{if(!o)return S2(!1);if($.type==="pointermove"&&$.buttons!==0)return v4({phase:"move",x:$.screenX,y:$.screenY});let z=$.type==="pointerup";v4({phase:"end",x:z?$.screenX:o.lx,y:z?$.screenY:o.ly})};for(let $ of["pointermove","pointerup","pointercancel"])window.addEventListener($,x1,!0)}var V3=()=>{N0(),w0(!0)};function R2(J){W0?.contentWindow?.postMessage({source:T7,...J},k7())}async function n7(J){if(!W0||J.source!==W0.contentWindow)return;let $=J.data;if(!$||$.source!==A7)return;if($.type==="hello"){let z=await p0();if(z)R2({type:"token",token:z,can:["portal"]});return}if($.type==="portal"){V4({returnTo:f7(typeof $.path==="string"?$.path:"")});return}if($.type==="ready")return R2({type:X0?"shown":"hidden"});if($.type==="close")return g1();if($.type==="drag")return v4($);if($.type==="unread"&&typeof $.total==="number")return z3($.total);if($.type==="report")g1(!1),P1({type:"manual",fromChat:!0})}var W3=(J)=>void n7(J);function K3(J){if(X0&&J.key==="Escape")g1()}function Y3(){if(!u||!a||!Z0)h1();if(!a)return;let J=M();if(!W0)W0=document.createElement("iframe"),W0.src=a8(J.host,J.realmKey),W0.title=s(J.locale).chatTitle,W0.setAttribute("allow","clipboard-write"),a.append(W0);if(X0=!0,!K1)K1=!0,b4();a.hidden=!1,Z0?.querySelector(".wrap")?.classList.add("open"),R?.setAttribute("aria-expanded","true"),b1(),R2({type:"shown"}),W0.focus()}function g1(J=!0){if(!a)return;if(X0=!1,a.hidden=!0,Z0?.querySelector(".wrap")?.classList.remove("open"),R?.setAttribute("aria-expanded","false"),b1(),R2({type:"hidden"}),J)R?.focus();w1(),N0(),w0(!0)}var g4=null,s8=0;function G3(){if(Date.now()-s8<30000)return;s8=Date.now(),w1()}function h1(){if(u||typeof document>"u")return;let J=M();if(!m1(J.chat)||!J.identity)return;let z=s(J.locale);u=document.createElement(R7),u.style.display="none",Z0=u.attachShadow({mode:"open"}),Z0.innerHTML=`<style>${x7}</style><div class="wrap"><div class="panel" role="dialog" aria-label="${z.chatTitle}" hidden></div><button type="button" class="bubble" aria-expanded="false" aria-haspopup="dialog" aria-label="${z.chatOpen}" title="${z.chatMove}">${E7}<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>`,a=Z0.querySelector(".panel"),R=Z0.querySelector(".bubble"),k1=Z0.querySelector(".badge"),L2=Z0.querySelector(".label");let j=Z0.querySelector(".face");j.addEventListener("load",()=>{if(j.getAttribute("src"))R?.classList.add("has-face")}),j.addEventListener("error",()=>R?.classList.remove("has-face")),j.src=j3(J.host,G1)??f4(J.host),d7(),N0(),R.addEventListener("click",()=>{if(y4)return;if(X0)g1();else Y3()}),R.addEventListener("pointerdown",r7),R.addEventListener("pointermove",o7),R.addEventListener("pointerup",n8),R.addEventListener("pointercancel",n8),document.body.append(u),window.addEventListener("message",W3),document.addEventListener("keydown",K3),window.addEventListener("focus",G3),window.addEventListener("resize",V3),X3(!0);let Q;g4=v8(()=>{if(X0)return;clearTimeout(Q),Q=setTimeout(()=>void w1(),500)}),w1()}function s7(){return u?w1():Promise.resolve()}function a7(){G1=null,g4?.(),g4=null,window.removeEventListener("message",W3),document.removeEventListener("keydown",K3),window.removeEventListener("focus",G3),window.removeEventListener("resize",V3),X3(!1),clearTimeout(x0),x0=void 0,v1=0,E0=null,w4="",k0=null,h4=!1,S2(!1),u?.remove(),u=Z0=a=W0=R=k1=L2=null,X0=!1,J0=o=null,f0=null,Y1=K1=!1,d0=0,document.documentElement.style.removeProperty("--lw-chat-lift")}var U3=!1;function t7(J={}){if(U3||typeof window>"u")return;if(!U1()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(U3=!0,C6(),X6(),$6(),H6(),L6(),J.ui===!1)return;let $=s(M().locale);if(h2((j)=>{g0(j.message??$.crashed,"error",{label:$.crashAction,onClick:()=>P1(j)})}),Z4(),!document.querySelector($1))document.body.append(document.createElement($1));let z=window.requestIdleCallback;if(z)z(()=>void b0(),{timeout:5000});else setTimeout(()=>void b0(),2000);if(z)z(()=>_2(),{timeout:8000});else setTimeout(()=>_2(),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(z)z(()=>h1(),{timeout:4000});else setTimeout(()=>h1(),1500)}var e7=new Set(["error","exception","unhandledrejection"]);function D3(J){if(J.error)return!0;return J.status!==null&&J.status>=400}function u4(J){if(!J)return null;let $=Date.parse(J);return Number.isNaN($)?null:$}function JJ(J){try{let{pathname:$}=new URL(J,"http://x");try{return decodeURIComponent($)}catch{return $}}catch{return J.split(/[?#]/)[0]??J}}function $J(J,$,z){let j=(X)=>({elapsedMs:X,requests:[],failedRequests:[],consoleErrors:[],slowestMs:null});if(J.length===0)return[];let Q=J.map((X)=>u4(X.at)),Z=(X)=>{for(let W=X+1;W<Q.length;W+=1){let Y=Q[W];if(Y!=null)return Y}return Number.POSITIVE_INFINITY};return J.map((X,W)=>{let Y=Q[W]??null,G=(W>0?Q[W-1]:null)??null,B=Y!==null&&G!==null?Math.max(0,Y-G):null;if(Y===null)return j(B);let F=Y,C=Math.max(F,Z(W)),g=(N)=>N!==null&&N>=F&&(N<C||C===Number.POSITIVE_INFINITY),T=$.filter((N)=>g(u4(N.startedAt))),b=z.filter((N)=>e7.has(N.level)&&g(u4(N.at))),I=T.map((N)=>N.durationMs).filter((N)=>typeof N==="number");return{elapsedMs:B,requests:T,failedRequests:T.filter(D3),consoleErrors:b,slowestMs:I.length>0?Math.max(...I):null}})}function zJ(J,$){return J.requests.length===0&&J.consoleErrors.length===0&&(J.elapsedMs===null||J.elapsedMs<$)}function jJ(J){if(J<1000)return`${Math.round(J)} มิลลิวินาที`;let $=J/1000;if($<10)return`${$.toFixed(1)} วิ`;if($<60)return`${Math.round($)} วิ`;let z=Math.floor($/60),j=Math.round($%60);return j===0?`${z} นาที`:`${z} นาที ${j} วิ`}export{a7 as unmountSupportChat,r2 as trimToBudget,E6 as toCurl,p2 as takeReplay,$8 as supportPortalUrl,a8 as supportFrameUrl,e2 as submitRequest,a2 as submitBundle,T5 as stopReplay,B7 as stopLiveRing,_2 as startLiveRing,q8 as sizeInkCanvas,g0 as showToast,R9 as setErroredQueriesSource,t1 as requestTypesNow,JJ as requestPath,s as reporterStrings,s7 as refreshSupportChat,M0 as redactUrl,o0 as redactLabel,n0 as redactHeaders,s0 as redactBody,I1 as readInkOp,w7 as panelHeight,n2 as packReplay,V4 as openSupportPortal,Y3 as openSupportChat,b2 as onLaunch,h2 as onCrash,h1 as mountSupportChat,I3 as moduleResolver,b0 as loadRequestTypes,P1 as launch,A5 as isReplayRecording,zJ as isQuietStep,D3 as isFailedRequest,U1 as isConfigured,t7 as installDebugCapture,G4 as inkAlpha,o5 as hasCause,u2 as getNetworkLog,g2 as getConsoleLog,M as getConfig,y2 as getActionTrail,jJ as formatDuration,c2 as errorSignature,m2 as emitCrash,Z4 as defineReporterElement,z4 as createAnnotator,$J as correlateActionTrail,M3 as configureDebugCapture,g1 as closeSupportChat,t8 as chatLift,o1 as captureScreen,c5 as bundleToMarkdown,r5 as bundleFileName,M1 as buildBundle,$3 as badgeText,U0 as appInfo,f2 as actionCountSuffix,$1 as REPORTER_TAG,w6 as REPLAY_FILENAME,r0 as REDACTED,j2 as NoIdentityError,n9 as LASER_TRAIL_MS,s9 as LASER_LINGER_MS,M8 as InkSender,Y2 as InkScene,G2 as InkPainter,a9 as INK_STALE_MS,P8 as INK_SEND_EVERY_MS,l9 as INK_MAX_POINTS_PER_OP,U4 as INK_KEEP_MS,r9 as INK_HOLD_MS,o9 as INK_FADE_MS,H8 as INK_COLORS,l2 as BUNDLE_BUDGET_BYTES};
394
+ `,h=null,X0=null,e=null,K0=null,R=null,w1=null,S2=null,Z0=!1,p0=0,T2=(J)=>J.endsWith("/")?J:`${J}/`,y7=()=>{try{return new URL(F().host).origin}catch{return"*"}};function $3(J,$){let z=new URL("embed/support",T2(J));return z.searchParams.set("realm",$),z.searchParams.set("hand","1"),z.toString()}function g7(J){return/^\/me\/(?:chat|tickets(?:\/[\w-]{1,64})?)$/.test(J)?J:"/me/chat"}function k4(J){return new URL("support-face.webp",T2(J)).toString()}function z3(J){return J+u+d0-16}function v7(J){return`min(640px, calc(100vh - ${J+u+d0+16}px))`}var o=8,b7=200;function h7(J,$,z,j){return{side:J<z.w/2?"left":"right",x:j,y:v4(z.h-$-u/2,z.h)}}function v4(J,$){return Math.round(Math.min(Math.max(J,o),Math.max(o,$-u-o)))}function m7(J){return J.side==="right"&&J.y<b7?z3(J.y):0}function u7(J,$){let z=$-(J.y+u+d0)-16,j=J.y-d0-16;if(z>=420||z>=j)return{bottom:J.y+u+d0,height:Math.max(240,Math.min(640,z))};return{top:$-J.y+d0,height:Math.max(240,Math.min(640,j))}}function j3(J,$,z){return{x:Math.round(Math.min(Math.max(J.x,o),Math.max(o,z.w-$.w-o))),y:Math.round(Math.min(Math.max(J.y,o),Math.max(o,z.h-$.h-o)))}}function Q3(J){return J<=0?"":J>99?"99+":String(J)}function X3(J){if(p0=Math.max(0,Math.floor(J)||0),!w1||!R)return;let $=t(F().locale);w1.textContent=Q3(p0),w1.hidden=p0===0,R.setAttribute("aria-label",p0?`${$.chatOpen} · ${$.chatUnread.replace("{n}",String(p0))}`:$.chatOpen),h1()}function p7(J,$){if(J.own===!1)return null;let z=J.unread>0,j=typeof J.own==="string"?J.own.trim().slice(0,60):"";return{text:z?$.chatLabelNew:j||$.chatLabel,shown:!J.open&&(z||!J.opened),isNew:z}}var K1=!1;function h1(){if(!S2||!R)return;let J=F(),$=J.chat&&J.chat!==!0?J.chat.label:void 0,z=$!==void 0?$:U1?.label,j=p7({own:z,unread:p0,opened:K1,open:Z0},t(J.locale));R.classList.toggle("unlabelled",!j),R.classList.toggle("labelled",!!j?.shown),R.classList.toggle("new",!!j?.isNew),R.classList.toggle("at-left",(k0??Y0).side==="left"),S2.querySelector(".text").textContent=j?.text??""}var U1=null;function Z3(J,$){if(!$||$.faceUrl===void 0)return k4(J);if($.faceUrl===null)return null;try{return new URL($.faceUrl.replace(/^\//,""),T2(J)).toString()}catch{return k4(J)}}function d7(J){if(U1=J,!h||!R)return;let $=J?.color&&/^#[0-9a-f]{6}$/i.test(J.color)?J.color:null;if($)h.style.setProperty("--lw-chat-color",$);else h.style.removeProperty("--lw-chat-color");let z=X0?.querySelector(".face"),j=Z3(F().host,J);if(_0("now"),z){if(!j)R.classList.remove("has-face"),z.removeAttribute("src");else if(z.getAttribute("src")!==j)R.classList.remove("has-face"),z.src=j}h1()}var k1=null;async function g1(){if(k1)return k1;let J=i7();k1=J;try{await J}finally{if(k1===J)k1=null}}async function i7(){try{let J=F(),$=J.chat&&J.chat!==!0?J.chat:null;if($?.show&&!$.show())return void I2(!1);let z=await u0();if(!z)return void I2(!1);let j=await fetch(new URL("ingest/support-unread",T2(J.host)).toString(),{headers:{"x-realm-key":J.realmKey,authorization:`Bearer ${z}`}});if(j.status===404||j.status===401||j.status===403)return void I2(!1);if(!j.ok)return;let Q=await j.json();if(Q.look&&typeof Q.look==="object")d7(Q.look);if(I2(!0),!Z0)X3(typeof Q.total==="number"?Q.total:0)}catch{}}function I2(J){if(!h)return;if(h.style.display=J?"":"none",J)Z2(h);if(C0(),J)_0("now")}var Y0={side:"right",x:16,y:16},f0=null,c7=380,V3=()=>`lw-support-chat-place:${F().realmKey}`,Y1=()=>({w:window.innerWidth,h:window.innerHeight}),G1=!1;function l7(){let J=u1(F().chat);if(J)Y0={side:J.side,x:J.x,y:J.y};try{let $=JSON.parse(localStorage.getItem(V3())??"null"),z=$?.bubble;if(G1=!!z&&(z.side==="left"||z.side==="right")&&typeof z.y==="number"&&Number.isFinite(z.y),G1)Y0={...Y0,side:z.side,y:z.y};let j=$?.panel;f0=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,K1=$?.opened===!0}catch{}}function b4(){try{localStorage.setItem(V3(),JSON.stringify({...G1?{bubble:{side:Y0.side,y:Y0.y}}:{},panel:f0,...K1?{opened:!0}:{}}))}catch{}}var y1=()=>window.location?.pathname??"/",k0=null,f4="",N0=null,h4=!1;function m4(){let J=F().chat,$=J&&J!==!0?J.avoid:void 0;if($===!1||U1?.avoid===!1)return{on:!1,extra:null};return{on:!0,extra:typeof $==="string"&&$.trim()?$.trim():null}}function W3(){let J=c8(y1(),U1?.places);if(h4=J?.show==="hide",G1||!J||J.show==="hide")return Y0;return{side:J.show,x:Y0.x,y:J.y}}function K3(){if(!R)return;let{on:J,extra:$}=m4();if(!J)return N0=null,C0();let z=Y1(),j=Y0.x,Q={right:{left:z.w-j-u,right:z.w-j},left:{left:j,right:j+u}},X=(N)=>d8(l8([Q[N]],z,{extra:$})[0]??[],Q[N],z.h,u),Z=W3(),W=v4(Z.y,z.h),Y=Z.side==="right"?"left":"right",G=X(Z.side),C=x1(W,G,o,Math.max(o,z.h-u-o))===W?null:X(Y),B={[Z.side]:G,[Y]:C};v1=JSON.stringify([B.right,B.left])===JSON.stringify(N0&&[N0.right,N0.left])?Math.min(v1+1,o7):0,N0=B,C0()}var r7=400,o7=3,n7=60,W1,r8=0,o8=0,v1=0;function _0(J="later"){if(!h)return;let $=Date.now();if(J!=="later")v1=0;let z=J==="now"?n7:Math.max(0,r7*2**v1-($-o8));if(W1&&r8<=$+z)return;clearTimeout(W1),r8=$+z,W1=setTimeout(()=>{if(W1=void 0,!h||Z0||$0?.moved||typeof document<"u"&&document.hidden)return;o8=Date.now(),K3()},z)}var O2=null,x4="",n8,u4=(J)=>J instanceof Element&&(J===h||/^LW-/.test(J.tagName)),s8=(J)=>{if(!u4(J.target))_0()},a8=(J)=>{if(u4(J.target))return;let $=J.target instanceof Element?J.target.getBoundingClientRect():null,z=Y1(),j=Y0.x,Q=!!$&&$.width>0&&($.left<j+u||$.right>z.w-j-u);_0(Q?"soon":"later")},L2=(J)=>{if(!u4(J.target))_0("now")},t8=["popstate","hashchange","pointerup","keyup"];function Y3(J){O2?.disconnect(),O2=null,clearInterval(n8);for(let $ of t8)window.removeEventListener($,L2,!0);window.removeEventListener("scroll",s8,!0);for(let $ of["transitionend","animationend"])window.removeEventListener($,a8,!0);if(document.removeEventListener("visibilitychange",L2),!J)return;if(typeof MutationObserver<"u")O2=new MutationObserver(($)=>{if($.some((j)=>{let Q=j.target;if(Q===document.documentElement&&j.type==="attributes")return!1;return!(Q.nodeType===1&&/^LW-/.test(Q.tagName))&&Q!==h}))_0()}),O2.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","open","aria-expanded"]});for(let $ of t8)window.addEventListener($,L2,{capture:!0,passive:!0});window.addEventListener("scroll",s8,{capture:!0,passive:!0});for(let $ of["transitionend","animationend"])window.addEventListener($,a8,{capture:!0,passive:!0});document.addEventListener("visibilitychange",L2),x4=y1(),n8=setInterval(()=>{if(y1()===x4)return;x4=y1(),C0(),_0("now")},1000)}function C0(){if(!R||!e)return;let J=Y1(),$=W3(),z=v4($.y,J.h),j=`${y1()}|${$.side}|${$.x}|${z}`,Q=k0&&f4===j?k0:null,X=N0&&m4().on?{right:N0.right??[],left:N0.left??[]}:null,Z=!Z0||!k0?X?i8(Q,{side:$.side,y:z},X,o,Math.max(o,J.h-u-o)):{side:$.side,y:z}:k0;k0={side:Z.side,x:$.x,y:Z.y},f4=j;let W=k0,Y=W.y,G=W.side==="right"?"left":"right";if(R.style.display=h4&&!Z0?"none":"",Object.assign(R.style,{[W.side]:`${W.x}px`,[G]:"",bottom:`${Y}px`,top:""}),f0){let N={w:Math.min(c7,J.w-32),h:Math.min(f0.h,J.h-2*o)},T=j3(f0,N,J);Object.assign(e.style,{left:`${T.x}px`,top:`${T.y}px`,right:"",bottom:"",height:`${N.h}px`})}else{let N=u7(W,J.h);Object.assign(e.style,{[W.side]:`${W.x}px`,[G]:"",bottom:N.bottom!==void 0?`${N.bottom}px`:"",top:N.top!==void 0?`${N.top}px`:"",height:`${N.height}px`})}let C=h&&h.style.display!=="none"&&R.style.display!=="none"?m7(W):0,B=C?`${C}px`:"";if(document.documentElement.style.getPropertyValue("--lw-chat-lift")!==B)if(B)document.documentElement.style.setProperty("--lw-chat-lift",B);else document.documentElement.style.removeProperty("--lw-chat-lift");h1()}var $0=null,w4=!1;function s7(J){if(J.button!==0)return;$0={id:J.pointerId,sx:J.clientX,sy:J.clientY,moved:!1};try{R?.setPointerCapture(J.pointerId)}catch{}}function a7(J){if(!$0||J.pointerId!==$0.id||!R)return;if(!$0.moved&&Math.hypot(J.clientX-$0.sx,J.clientY-$0.sy)<6)return;$0.moved=!0,R.classList.add("dragging"),Object.assign(R.style,{left:`${J.clientX-u/2}px`,top:`${J.clientY-u/2}px`,right:"",bottom:""})}function e8(J){if(!$0||J.pointerId!==$0.id)return;let $=$0;if($0=null,R?.classList.remove("dragging"),!$.moved)return;if(w4=!0,setTimeout(()=>w4=!1,0),J.type==="pointerup")Y0=h7(J.clientX,J.clientY,Y1(),u1(F().chat)?.x??16),G1=!0,f0=null,b4();if(m4().on)K3();else C0()}var s=null;function y4(J){if(!e||typeof J.x!=="number"||typeof J.y!=="number"||Y1().w<640)return;if(J.phase==="start"){let $=e.getBoundingClientRect();s={sx:J.x,sy:J.y,x:$.left,y:$.top,lx:J.x,ly:J.y,h:Math.round($.height)||640},R2(!0);return}if(!s)return;if(s.lx=J.x,s.ly=J.y,f0={...j3({x:s.x+(J.x-s.sx),y:s.y+(J.y-s.sy)},{w:e.offsetWidth,h:s.h},Y1()),h:s.h},C0(),J.phase==="end")s=null,R2(!1),b4()}var f1=null;function R2(J){if(f1){for(let $ of["pointermove","pointerup","pointercancel"])window.removeEventListener($,f1,!0);f1=null}if(!J)return;f1=($)=>{if(!s)return R2(!1);if($.type==="pointermove"&&$.buttons!==0)return y4({phase:"move",x:$.screenX,y:$.screenY});let z=$.type==="pointerup";y4({phase:"end",x:z?$.screenX:s.lx,y:z?$.screenY:s.ly})};for(let $ of["pointermove","pointerup","pointercancel"])window.addEventListener($,f1,!0)}var G3=()=>{C0(),_0("now")};function A2(J){K0?.contentWindow?.postMessage({source:k7,...J},y7())}async function t7(J){if(!K0||J.source!==K0.contentWindow)return;let $=J.data;if(!$||$.source!==x7)return;if($.type==="hello"){let z=await u0();if(z)A2({type:"token",token:z,can:["portal"]});return}if($.type==="portal"){W4({returnTo:g7(typeof $.path==="string"?$.path:"")});return}if($.type==="ready")return A2({type:Z0?"shown":"hidden"});if($.type==="close")return b1();if($.type==="drag")return y4($);if($.type==="unread"&&typeof $.total==="number")return X3($.total);if($.type==="report")b1(!1),B1({type:"manual",fromChat:!0})}var U3=(J)=>void t7(J);function D3(J){if(Z0&&J.key==="Escape")b1()}function H3(){if(!h||!e||!X0)m1();if(!e)return;let J=F();if(!K0)K0=document.createElement("iframe"),K0.src=$3(J.host,J.realmKey),K0.title=t(J.locale).chatTitle,K0.setAttribute("allow","clipboard-write"),e.append(K0);if(Z0=!0,!K1)K1=!0,b4();e.hidden=!1,X0?.querySelector(".wrap")?.classList.add("open"),R?.setAttribute("aria-expanded","true"),h1(),A2({type:"shown"}),K0.focus()}function b1(J=!0){if(!e)return;if(Z0=!1,e.hidden=!0,X0?.querySelector(".wrap")?.classList.remove("open"),R?.setAttribute("aria-expanded","false"),h1(),A2({type:"hidden"}),J)R?.focus();g1(),C0(),_0("now")}var g4=null,J3=0;function q3(){if(Date.now()-J3<30000)return;J3=Date.now(),g1()}function m1(){if(h||typeof document>"u")return;let J=F();if(!u1(J.chat)||!J.identity)return;let z=t(J.locale);h=document.createElement(E7),h.style.display="none",X0=h.attachShadow({mode:"open"}),X0.innerHTML=`<style>${w7}</style><div class="wrap"><div class="panel" role="dialog" aria-label="${z.chatTitle}" hidden></div><button type="button" class="bubble" aria-expanded="false" aria-haspopup="dialog" aria-label="${z.chatOpen}" title="${z.chatMove}">${f7}<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>`,e=X0.querySelector(".panel"),R=X0.querySelector(".bubble"),w1=X0.querySelector(".badge"),S2=X0.querySelector(".label");let j=X0.querySelector(".face");j.addEventListener("load",()=>{if(j.getAttribute("src"))R?.classList.add("has-face")}),j.addEventListener("error",()=>R?.classList.remove("has-face")),j.src=Z3(J.host,U1)??k4(J.host),l7(),C0(),R.addEventListener("click",()=>{if(w4)return;if(Z0)b1();else H3()}),R.addEventListener("pointerdown",s7),R.addEventListener("pointermove",a7),R.addEventListener("pointerup",e8),R.addEventListener("pointercancel",e8),document.body.append(h),window.addEventListener("message",U3),document.addEventListener("keydown",D3),window.addEventListener("focus",q3),window.addEventListener("resize",G3),Y3(!0);let Q;g4=v8(()=>{if(Z0)return;clearTimeout(Q),Q=setTimeout(()=>void g1(),500)}),g1()}function e7(){return h?g1():Promise.resolve()}function JJ(){U1=null,g4?.(),g4=null,window.removeEventListener("message",U3),document.removeEventListener("keydown",D3),window.removeEventListener("focus",q3),window.removeEventListener("resize",G3),Y3(!1),clearTimeout(W1),W1=void 0,v1=0,k0=null,f4="",N0=null,h4=!1,R2(!1),h?.remove(),h=X0=e=K0=R=w1=S2=null,Z0=!1,$0=s=null,f0=null,G1=K1=!1,p0=0,document.documentElement.style.removeProperty("--lw-chat-lift")}var P3=!1;function $J(J={}){if(P3||typeof window>"u")return;if(!D1()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(P3=!0,O6(),V6(),z6(),q6(),S6(),J.ui===!1)return;let $=t(F().locale);if(m2((j)=>{g0(j.message??$.crashed,"error",{label:$.crashAction,onClick:()=>B1(j)})}),Z4(),!document.querySelector(J1))document.body.append(document.createElement(J1));let z=window.requestIdleCallback;if(z)z(()=>void v0(),{timeout:5000});else setTimeout(()=>void v0(),2000);if(z)z(()=>C2(),{timeout:8000});else setTimeout(()=>C2(),3000);if(F().chat)if(!F().identity)console.warn("[debug-capture] `chat` needs `identity` — a chat is a signed-in person's; the bubble is not shown");else if(z)z(()=>m1(),{timeout:4000});else setTimeout(()=>m1(),1500)}var zJ=new Set(["error","exception","unhandledrejection"]);function B3(J){if(J.error)return!0;return J.status!==null&&J.status>=400}function p4(J){if(!J)return null;let $=Date.parse(J);return Number.isNaN($)?null:$}function jJ(J){try{let{pathname:$}=new URL(J,"http://x");try{return decodeURIComponent($)}catch{return $}}catch{return J.split(/[?#]/)[0]??J}}function QJ(J,$,z){let j=(Z)=>({elapsedMs:Z,requests:[],failedRequests:[],consoleErrors:[],slowestMs:null});if(J.length===0)return[];let Q=J.map((Z)=>p4(Z.at)),X=(Z)=>{for(let W=Z+1;W<Q.length;W+=1){let Y=Q[W];if(Y!=null)return Y}return Number.POSITIVE_INFINITY};return J.map((Z,W)=>{let Y=Q[W]??null,G=(W>0?Q[W-1]:null)??null,C=Y!==null&&G!==null?Math.max(0,Y-G):null;if(Y===null)return j(C);let B=Y,N=Math.max(B,X(W)),T=(q)=>q!==null&&q>=B&&(q<N||N===Number.POSITIVE_INFINITY),E=$.filter((q)=>T(p4(q.startedAt))),v=z.filter((q)=>zJ.has(q.level)&&T(p4(q.at))),c=E.map((q)=>q.durationMs).filter((q)=>typeof q==="number");return{elapsedMs:C,requests:E,failedRequests:E.filter(B3),consoleErrors:v,slowestMs:c.length>0?Math.max(...c):null}})}function XJ(J,$){return J.requests.length===0&&J.consoleErrors.length===0&&(J.elapsedMs===null||J.elapsedMs<$)}function ZJ(J){if(J<1000)return`${Math.round(J)} มิลลิวินาที`;let $=J/1000;if($<10)return`${$.toFixed(1)} วิ`;if($<60)return`${Math.round($)} วิ`;let z=Math.floor($/60),j=Math.round($%60);return j===0?`${z} นาที`:`${z} นาที ${j} วิ`}export{JJ as unmountSupportChat,o2 as trimToBudget,x6 as toCurl,d2 as takeReplay,z8 as supportPortalUrl,$3 as supportFrameUrl,J4 as submitRequest,t2 as submitBundle,f5 as stopReplay,C7 as stopLiveRing,C2 as startLiveRing,P8 as sizeInkCanvas,g0 as showToast,x9 as setErroredQueriesSource,e1 as requestTypesNow,jJ as requestPath,t as reporterStrings,e7 as refreshSupportChat,B0 as redactUrl,r0 as redactLabel,o0 as redactHeaders,n0 as redactBody,I1 as readInkOp,v7 as panelHeight,s2 as packReplay,W4 as openSupportPortal,H3 as openSupportChat,h2 as onLaunch,m2 as onCrash,m1 as mountSupportChat,S3 as moduleResolver,v0 as loadRequestTypes,B1 as launch,k5 as isReplayRecording,XJ as isQuietStep,B3 as isFailedRequest,D1 as isConfigured,$J as installDebugCapture,U4 as inkAlpha,t5 as hasCause,p2 as getNetworkLog,b2 as getConsoleLog,F as getConfig,g2 as getActionTrail,ZJ as formatDuration,l2 as errorSignature,u2 as emitCrash,Z4 as defineReporterElement,j4 as createAnnotator,QJ as correlateActionTrail,_3 as configureDebugCapture,b1 as closeSupportChat,z3 as chatLift,n1 as captureScreen,n5 as bundleToMarkdown,a5 as bundleFileName,M1 as buildBundle,Q3 as badgeText,H0 as appInfo,w2 as actionCountSuffix,J1 as REPORTER_TAG,y6 as REPLAY_FILENAME,l0 as REDACTED,Q2 as NoIdentityError,e9 as LASER_TRAIL_MS,J7 as LASER_LINGER_MS,M8 as InkSender,G2 as InkScene,U2 as InkPainter,$7 as INK_STALE_MS,B8 as INK_SEND_EVERY_MS,s9 as INK_MAX_POINTS_PER_OP,D4 as INK_KEEP_MS,a9 as INK_HOLD_MS,t9 as INK_FADE_MS,q8 as INK_COLORS,r2 as BUNDLE_BUDGET_BYTES};