@lightworkai.official/debug-capture 0.19.8 → 0.19.9

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 F3=((J)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(J,{get:($,j)=>(typeof require<"u"?require:$)[j]}):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,j=(Q,z)=>typeof Q==="number"&&Number.isFinite(Q)&&Q>=0&&Q<2000?Q:z;return{side:$.position==="left"?"left":"right",x:j($.offset?.x,16),y:j($.offset?.y,16)}}var N3={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},Q0=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.");Q0=J}function C(){if(!Q0)throw Error("[debug-capture] configureDebugCapture() has not been called");return Q0}function D1(){return Q0!==null}function H0(){let J=C().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 R0(J){let $=Q0?.capture?.[J];return typeof $==="number"?$:N3[J]}function u1(J){let $=Q0?.module;if(!$)return null;try{return $(J)??null}catch{return null}}function p1(){let J=Q0?.redact;return{headers:J?.headers??[],queryKeys:(J?.queryKeys??[]).map(($)=>$.toLowerCase()),bodyKeys:(J?.bodyKeys??[]).map(($)=>$.toLowerCase())}}function i4(){return Q0?.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=Q0?.replay;if(!J)return null;let $=J===!0?{}:J,j=(X,Z)=>typeof X==="number"&&X>0?X:Z,Q=$.maskInputs!==!1,z=$.recordCanvas?{fps:j(typeof $.recordCanvas==="object"?$.recordCanvas.fps:void 0,d4.fps),quality:j(typeof $.recordCanvas==="object"?$.recordCanvas.quality:void 0,d4.quality)}:null;return{seconds:j($.seconds,60),maskInputs:Q,maskTextSelector:$.maskTextSelector?.trim()||(Q?I3:O3),maskText:$.maskText===!0,blockSelector:$.blockSelector?.trim()||"[data-lw-private]",maxBytes:j($.maxBytes,4000000),canvas:z}}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(Q0?.capture?.bodyOrigins??[]).some((j)=>{try{return new URL(j).origin===$.origin}catch{return!1}})}function L3(J){if(!Q0?.host)return!1;try{if(new URL(Q0.host).origin!==J.origin)return!1}catch{return!1}return J.pathname.startsWith("/ingest/")}function R3(J){let $=Object.entries(J).map(([j,Q])=>[j.replace(/\/+$/,"")||"/",Q]).sort((j,Q)=>Q[0].length-j[0].length);return(j)=>{let Q=(j||"/").replace(/\/+$/,"")||"/";for(let[z,X]of $)if(Q===z||Q.startsWith(`${z}/`))return{key:z,label:X};return null}}var r0="‹redacted›",S3=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,T3=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),A3=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,E3=/[\w.+-]+@[\w-]+\.[\w.-]+/g,k3=/\d(?:[\d\s-]{7,})\d/g;function o0(J){return J.replace(E3,r0).replace(k3,r0)}function x3(J){if(S3.test(J))return!0;return p1().headers.some((j)=>j.toLowerCase()===J.toLowerCase())}function n0(J){let $={};for(let[j,Q]of Object.entries(J))$[j]=x3(j)?r0:Q;return $}function B0(J){try{let $=/^https?:\/\//i.test(J),j=new URL(J,$?void 0:"http://local.invalid"),Q=!1;if(j.searchParams.forEach((z,X)=>{if(T3.has(X.toLowerCase())||p1().queryKeys.includes(X.toLowerCase()))j.searchParams.set(X,r0),Q=!0}),!Q)return J;return $?j.toString():`${j.pathname}${j.search}`}catch{return J}}function k2(J,$){if($>6||J===null||typeof J!=="object")return J;if(Array.isArray(J))return J.map((Q)=>k2(Q,$+1));let j={};for(let[Q,z]of Object.entries(J)){let X=A3.test(Q)||p1().bodyKeys.some((Z)=>Q.toLowerCase().includes(Z));j[Q]=X?r0:k2(z,$+1)}return j}function s0(J,$){if(J==null)return null;let j=J,Q=J.trim();if(Q.startsWith("{")||Q.startsWith("["))try{let z=JSON.parse(Q);j=JSON.stringify(k2(z,0))}catch{}if(j.length>$)return`${j.slice(0,$)}… [truncated ${j.length-$} chars]`;return j}var x2=120,f2=40,t0=(J,$)=>J.length>$?`${J.slice(0,$)}…`:J,w2=(J)=>{try{return decodeURIComponent(J)}catch{return J}},a0=[],l4=0,r4=!1;function q1(J,$,j,Q){let z=t0($,x2),X=a0[a0.length-1];if(J==="navigate"&&X?.kind==="click"){let K=z.replace(/^ไปที่\s*/,"");if(X.detail.includes(`→ ${K}`))return X.at=new Date().toISOString(),X;let W=K.split(/[?#]/)[0]??K,G=X.source?w2(X.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(G&&(W===G||W.startsWith(G)))return X.detail=t0(`${X.detail} → ${K}`,x2),X.source=void 0,X.at=new Date().toISOString(),X}if(X&&X.kind===J&&X.detail===z){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:z,count:1,source:j,html:i1(Q)};a0.push(Z);while(a0.length>R0("maxActions"))w3(a0.shift());return Z}var f3=200000,M1=0;function i1(J){if(!J)return;if(M1+J.length>f3)return;return M1+=J.length,J}function w3(J){if(!J)return;if(M1-=(J.html?.length??0)+(J.afterHtml?.length??0),M1<0)M1=0}function y2(J){return J&&J>1?` (×${J})`:""}function d1(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 h3(J,$){try{let j=J,Q=0;while(j&&Q<=$){let z=J6(j);if(z&&typeof z.memoizedProps?.onClick==="function")return j;j=j.parentElement,Q+=1}}catch{}return null}function b3(J){let $=J.getAttribute("aria-label")?.trim();if($)return $;let j=J.getAttribute("title")?.trim();if(j)return j;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 Q=(J.textContent??"").replace(/\s+/g," ").trim();if(Q)return Q;if(J instanceof HTMLAnchorElement){let z=J.getAttribute("href");if(z?.startsWith("/"))return w2(z)}return""}function m3(J){if(!(J instanceof Element))return null;let $=J.closest(y3)??h3(J,4);if(!$)return null;let j=$.tagName.toLowerCase();if(j==="html"||j==="body")return null;return $}function u3(J){let $=o0(b3(J));if(!$)return null;return`${v3(J)} “${t0($,f2)}”`}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((z)=>z.remove());let $=[J,...Array.from(J.querySelectorAll("*"))];for(let z of $){for(let Z of Array.from(z.attributes)){let K=Z.name.toLowerCase();if(K.startsWith("on")||K==="srcdoc"||K==="value"||K.startsWith("data-"))z.removeAttribute(Z.name)}if(z instanceof HTMLAnchorElement)z.setAttribute("href","#");if(z instanceof HTMLImageElement)z.removeAttribute("src");let X=z.getAttribute("class");if(X){let Z=X.replace(d3," ").replace(/\s+/g," ").trim();if(Z)z.setAttribute("class",Z);else z.removeAttribute("class")}}let j=document.createTreeWalker(J,NodeFilter.SHOW_TEXT),Q=j.nextNode();while(Q){if(Q.nodeValue)Q.nodeValue=o0(Q.nodeValue);Q=j.nextNode()}}function g2(J,$,j){try{let Q=J.outerHTML;if(!Q||Q.length>$)return;let z=J.cloneNode(!0);i3(z);let X=z.outerHTML;return X&&X.length<=j?X:void 0}catch{return}}var c3=(J)=>g2(J,e4,p3),l3=150000,r3=40000,n4=(J)=>g2(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`ช่อง “${o0($)}”`}var s4=80;function J6(J){let $=Object.keys(J).find((j)=>j.startsWith("__reactFiber$")||j.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 j=J6(J),Q=0;while(j&&Q<30){if(typeof j.memoizedProps?.onClick==="function")return a4(n3(j.memoizedProps.onClick));j=j.return,Q+=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 j=J.getAttribute("aria-labelledby");if(j){let X=j.split(/\s+/).map((Z)=>document.getElementById(Z)?.textContent?.trim()??"").filter(Boolean).join(" ");if(X)return X}let z=J.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(z)return z;return(J.textContent??"").replace(/\s+/g," ").trim()}function $6(J){let $=o0(J5(J)),j=e3(J);return $?`เปิด ${j} “${t0($,f2)}”`:`เปิด ${j}`}var $5='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',j5=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function Q5(J){if(J.querySelector($5))return!0;return j5.test(J.textContent??"")}var z5=400,X5=250,Z5=8000;function V5(J,$){if(typeof MutationObserver>"u"){$.html=i1(n4(J));return}let j=Date.now(),Q=!1,z=()=>{Q=!0,Z.disconnect(),window.clearInterval(K),window.clearTimeout(W)},X=()=>{if(Q)return;if(z(),!J.isConnected)return;$.detail=t0($6(J),x2),$.html=i1(n4(J))},Z=new MutationObserver(()=>{j=Date.now()});Z.observe(J,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let K=window.setInterval(()=>{if(Q)return;if(!J.isConnected){z();return}if(Date.now()-j>=z5&&!Q5(J))X()},X5),W=window.setTimeout(X,Z5)}function K5(J){if(d1(J))return;let $=q1("ui",$6(J));if($)V5(J,$)}function W5(){if(typeof MutationObserver>"u")return;let J=new WeakSet;new MutationObserver((j)=>{for(let Q of j)for(let z of Array.from(Q.addedNodes)){if(!(z instanceof Element))continue;let X=t3(),Z=z.matches(X)?[z]:Array.from(z.querySelectorAll(X));for(let K of Z){if(J.has(K))continue;J.add(K),K5(K)}}}).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:t0((J.textContent??"").replace(/\s+/g," ").trim(),f2)}}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 j=t4(J),Q=!1,z=(K,W)=>{if(Q)return;if(Q=!0,X.disconnect(),window.clearTimeout(Z),$.afterNote=K,W)$.afterHtml=i1(g2(J,e4,G5))},X=new MutationObserver(()=>{if(!J.isConnected){z("องค์ประกอบหายไปจากหน้าจอ",!1);return}let K=U5(j,t4(J));if(K)z(K,!0)});X.observe(J,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let Z=window.setTimeout(()=>{if(!Q&&!J.isConnected){z("องค์ประกอบหายไปจากหน้าจอ",!1);return}Q=!0,X.disconnect()},Y5)}function j6(){if(r4||typeof window>"u")return;r4=!0,document.addEventListener("click",(Q)=>{if(d1(Q.target))return;let z=m3(Q.target);if(!z)return;let X=u3(z);if(!X)return;let Z=q1("click",`คลิก ${X}`,s3(z),c3(z));if(Z)D5(z,Z)},{capture:!0,passive:!0}),document.addEventListener("change",(Q)=>{if(d1(Q.target))return;let z=o3(Q.target);if(z)q1("input",`แก้ไข ${z}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(Q)=>{if(d1(Q.target))return;q1("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let J=()=>q1("navigate",`ไปที่ ${w2(B0(location.pathname+location.search))}`),$=history.pushState.bind(history),j=history.replaceState.bind(history);history.pushState=(...Q)=>{let z=$(...Q);return J(),z},history.replaceState=(...Q)=>{let z=j(...Q);return J(),z},window.addEventListener("popstate",J),W5()}function v2(){return a0.map((J)=>({...J}))}var Q6=2000,c1=[],z6=0,X6=!1;function h2(J,$){z6+=1,c1.push({id:`log_${z6}`,at:new Date().toISOString(),level:J,message:$.length>Q6?`${$.slice(0,Q6)}…`:$});while(c1.length>R0("maxConsoleEntries"))c1.shift()}function H5(){let J=new WeakSet;return($,j)=>{if(typeof j==="object"&&j!==null){if(J.has(j))return"[Circular]";J.add(j)}if(typeof j==="bigint")return j.toString();return j}}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 j=console[$].bind(console);console[$]=(...Q)=>{h2($,Q.map(Z6).join(" ")),j(...Q)}}window.addEventListener("error",($)=>{let j=$.filename?` (${$.filename}:${$.lineno}:${$.colno})`:"";h2("exception",`${$.message}${j}`)}),window.addEventListener("unhandledrejection",($)=>{let j=$.reason instanceof Error?`${$.reason.name}: ${$.reason.message}`:Z6($.reason);h2("unhandledrejection",j)})}function b2(){return c1.map((J)=>({...J}))}var K6=new Set,W6=new Set;function Y6(J,$){return J.add($),()=>J.delete($)}function G6(J,$){for(let j of[...J])j($)}function m2(J){return Y6(K6,J)}function P1(J={type:"manual"}){G6(K6,J)}function u2(J){return Y6(W6,J)}function p2(J){G6(W6,J)}var q5=15000,M5=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],U6=!1,D6=0;function P5(J){return M5.some(($)=>J.includes($))}function H6(J){let $=J.message??"";if(!$||P5($))return;let j=Date.now();if(j-D6<q5)return;D6=j,p2({...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,B5=1e6,F5=1e7,l1=[],M6=0,P6=!1;function N6(J){l1.push(J);while(l1.length>R0("maxRequests"))l1.shift()}function _6(){return M6+=1,`req_${M6}`}function B6(J){let $={};if(!J)return $;if(J instanceof Headers)J.forEach((j,Q)=>{$[Q]=j});else if(Array.isArray(J))for(let[j,Q]of J)$[j]=Q;else Object.assign($,J);return $}function N5(J){let $={};return J.forEach((j,Q)=>{$[Q]=j}),$}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 j="",Q="GET",z={},X=null;if(typeof J==="string")j=J;else if(J instanceof URL)j=J.toString();else j=J.url,Q=J.method||Q,z=B6(J.headers);if($){if($.method)Q=$.method;if($.headers)z={...z,...B6($.headers)};if($.body!==void 0)X=_5($.body)}return{method:Q.toUpperCase(),url:j,headers:z,body:X}}function C6(J){return!c4(J)}function I5(J,$){if(C6($.url)){$.responseSnippet="[body not captured for this origin]";return}let j=J.headers.get("content-type")??"",Q=Number(J.headers.get("content-length")??"0"),z=Q?`, ~${Q} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(j)){$.responseSnippet=`[binary ${j||"unknown"}${z}]`;return}if(Q>B5){$.responseSnippet=`[response ${j||"text"}${z} — omitted]`;return}try{J.clone().text().then((X)=>{$.responseSnippet=s0(X,R0("maxBodyChars"))}).catch(()=>{})}catch{}}function I6(J,$){if(/[?&]_rsc=/.test(J))return!0;for(let j of Object.keys($)){let Q=j.toLowerCase();if(Q==="rsc"||Q==="next-router-prefetch"||Q==="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($,j)=>{let Q=C5($,j);if(I6(Q.url,Q.headers))return J($,j);let z={id:_6(),startedAt:new Date().toISOString(),method:Q.method,url:B0(Q.url),requestHeaders:n0(Q.headers),requestBody:s0(Q.body,F6),status:null,statusText:null,durationMs:null,via:"fetch"};N6(z);let X=performance.now();try{let Z=await J($,j);return z.status=Z.status,z.statusText=Z.statusText,z.durationMs=Math.round(performance.now()-X),z.responseHeaders=n0(N5(Z.headers)),I5(Z,z),Z}catch(Z){throw z.durationMs=Math.round(performance.now()-X),z.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,j=J.send,Q=function(X,Z){let K=typeof Z==="string"?Z:Z.toString();return this.__lwEntry=I6(K,{})?void 0:{id:_6(),startedAt:"",method:(X||"GET").toUpperCase(),url:B0(K),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},$.apply(this,arguments)},z=function(X){let Z=this.__lwEntry;if(Z){Z.startedAt=new Date().toISOString(),Z.requestBody=typeof X==="string"?s0(X,F6):X==null?null:"[non-string body]";let K=performance.now();N6(Z),this.addEventListener("loadend",()=>{if(Z.status=this.status||null,Z.statusText=this.statusText||null,Z.durationMs=Math.round(performance.now()-K),C6(Z.url))Z.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{Z.responseSnippet=s0(this.responseText||"",R0("maxBodyChars"))}catch{}else{let W=this.getResponseHeader("content-type")??this.responseType;Z.responseSnippet=`[binary ${W}]`}})}return j.apply(this,arguments)};J.open=Q,J.send=z}function O6(){if(P6)return;P6=!0,O5(),L5()}function d2(){let J=l1.map((j)=>({...j})),$=0;for(let j=J.length-1;j>=0;j-=1){let Q=J[j],z=Q?.responseSnippet;if(!Q||typeof z!=="string"||z.length===0)continue;if($+z.length>F5)Q.responseSnippet=`[response omitted — report size budget reached (${z.length.toLocaleString()} chars)]`;else $+=z.length}return J}var R5=4,L6=3,S5=4000,T5="[data-debug-reporter]",A5=()=>import("@rrweb/record");var z0=[],e0=null,r1=!1;function R6(){if(typeof window>"u"||e0||r1)return;let J=H1();if(!J)return;r1=!0;let $=()=>void E5(J);if("requestIdleCallback"in window)window.requestIdleCallback($,{timeout:3000});else setTimeout($,1000)}async function E5(J){let $;try{$=(await A5()).record}catch(j){r1=!1,console.warn("[debug-capture] session replay could not start:",j);return}if(e0)return;try{e0=$({emit:(j)=>k5(j),checkoutEveryNms:Math.max(1000,J.seconds*1000/2),checkoutEveryNth:S5,maskAllInputs:J.maskInputs,maskTextSelector:J.maskText?"*":J.maskTextSelector,blockSelector:`${J.blockSelector}, ${T5}`,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(j){console.warn("[debug-capture] session replay could not start:",j)}finally{r1=!1}}function k5(J){if(J.type===R5||z0.length===0){if(z0.push([]),z0.length>L6)z0=z0.slice(-L6)}z0[z0.length-1].push(J)}function i2(J=Date.now()){let $=H1();if(!$||!z0.length)return null;let j=J-$.seconds*1000,Q=z0.length-1;while(Q>0&&(z0[Q][0]?.timestamp??J)>j)Q-=1;let z=z0.slice(Q).flat(),X=z[0]?.timestamp,Z=z[z.length-1]?.timestamp;if(X===void 0||Z===void 0)return null;return{events:z,startedAt:new Date(X).toISOString(),endedAt:new Date(Z).toISOString(),durationMs:Math.max(0,Z-X)}}function x5(){return e0!==null}function f5(){e0?.(),e0=null,z0=[]}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 a(J){return J==="en"?y5:w5}var g5="lw-debug-toasts",v5=6000,h5=`
1
+ var b3=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(J,Q)=>(typeof require<"u"?require:J)[Q]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});function u1($){if(!$)return null;let J=$===!0?{}:$,Q=(j,z)=>typeof j==="number"&&Number.isFinite(j)&&j>=0&&j<2000?j:z;return{side:J.position==="left"?"left":"right",x:Q(J.offset?.x,16),y:Q(J.offset?.y,16)}}var h3={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},j0=null;function m3($){let J=[];if(!$.host?.trim())J.push("host");if(!$.realmKey?.trim())J.push("realmKey");if(!$.app?.name?.trim())J.push("app.name");if(typeof $.module!=="function")J.push("module");if(J.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${J.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");j0=$}function R(){if(!j0)throw Error("[debug-capture] configureDebugCapture() has not been called");return j0}function H1(){return j0!==null}function H0(){let $=R().app;return{name:$.name,version:$.version??"0.0.0",environment:$.environment??u3()}}function u3(){if(typeof window>"u")return"unknown";let $=window.location.hostname;if($==="localhost"||$==="127.0.0.1"||$.endsWith(".local"))return"development";return"production"}function R0($){let J=j0?.capture?.[$];return typeof J==="number"?J:h3[$]}function p1($){let J=j0?.module;if(!J)return null;try{return J($)??null}catch{return null}}function d1(){let $=j0?.redact;return{headers:$?.headers??[],queryKeys:($?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:($?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function t4(){return j0?.capture?.overlaySelectors??[]}var p3='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',d3="[data-lw-mask]",a4={fps:1,quality:0.5};function q1(){let $=j0?.replay;if(!$)return null;let J=$===!0?{}:$,Q=(X,Z)=>typeof X==="number"&&X>0?X:Z,j=J.maskInputs!==!1,z=J.recordCanvas?{fps:Q(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,a4.fps),quality:Q(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,a4.quality)}:null;return{seconds:Q(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?p3:d3),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:Q(J.maxBytes,4000000),canvas:z}}function e4($){if(typeof window>"u")return!1;let J;try{J=new URL($,window.location.href)}catch{return!1}if(c3(J))return!1;if(J.origin===window.location.origin)return!0;return(j0?.capture?.bodyOrigins??[]).some((Q)=>{try{return new URL(Q).origin===J.origin}catch{return!1}})}function c3($){if(!j0?.host)return!1;try{if(new URL(j0.host).origin!==$.origin)return!1}catch{return!1}return $.pathname.startsWith("/ingest/")}function i3($){let J=Object.entries($).map(([Q,j])=>[Q.replace(/\/+$/,"")||"/",j]).sort((Q,j)=>j[0].length-Q[0].length);return(Q)=>{let j=(Q||"/").replace(/\/+$/,"")||"/";for(let[z,X]of J)if(j===z||j.startsWith(`${z}/`))return{key:z,label:X};return null}}var o0="‹redacted›",l3=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,r3=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),o3=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,n3=/[\w.+-]+@[\w-]+\.[\w.-]+/g,s3=/\d(?:[\d\s-]{7,})\d/g;function n0($){return $.replace(n3,o0).replace(s3,o0)}function a3($){if(l3.test($))return!0;return d1().headers.some((Q)=>Q.toLowerCase()===$.toLowerCase())}function s0($){let J={};for(let[Q,j]of Object.entries($))J[Q]=a3(Q)?o0:j;return J}function P0($){try{let J=/^https?:\/\//i.test($),Q=new URL($,J?void 0:"http://local.invalid"),j=!1;if(Q.searchParams.forEach((z,X)=>{if(r3.has(X.toLowerCase())||d1().queryKeys.includes(X.toLowerCase()))Q.searchParams.set(X,o0),j=!0}),!j)return $;return J?Q.toString():`${Q.pathname}${Q.search}`}catch{return $}}function f2($,J){if(J>6||$===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((j)=>f2(j,J+1));let Q={};for(let[j,z]of Object.entries($)){let X=o3.test(j)||d1().bodyKeys.some((Z)=>j.toLowerCase().includes(Z));Q[j]=X?o0:f2(z,J+1)}return Q}function a0($,J){if($==null)return null;let Q=$,j=$.trim();if(j.startsWith("{")||j.startsWith("["))try{let z=JSON.parse(j);Q=JSON.stringify(f2(z,0))}catch{}if(Q.length>J)return`${Q.slice(0,J)}… [truncated ${Q.length-J} chars]`;return Q}var w2=120,y2=40,e0=($,J)=>$.length>J?`${$.slice(0,J)}…`:$,g2=($)=>{try{return decodeURIComponent($)}catch{return $}},t0=[],$6=0,J6=!1;function F1($,J,Q,j){let z=e0(J,w2),X=t0[t0.length-1];if($==="navigate"&&X?.kind==="click"){let K=z.replace(/^ไปที่\s*/,"");if(X.detail.includes(`→ ${K}`))return X.at=new Date().toISOString(),X;let Y=K.split(/[?#]/)[0]??K,W=X.source?g2(X.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(W&&(Y===W||Y.startsWith(W)))return X.detail=e0(`${X.detail} → ${K}`,w2),X.source=void 0,X.at=new Date().toISOString(),X}if(X&&X.kind===$&&X.detail===z){if(X.at=new Date().toISOString(),$!=="navigate")X.count=(X.count??1)+1;return X}$6+=1;let Z={id:`act_${$6}`,at:new Date().toISOString(),kind:$,detail:z,count:1,source:Q,html:i1(j)};t0.push(Z);while(t0.length>R0("maxActions"))e3(t0.shift());return Z}var t3=200000,M1=0;function i1($){if(!$)return;if(M1+$.length>t3)return;return M1+=$.length,$}function e3($){if(!$)return;if(M1-=($.html?.length??0)+($.afterHtml?.length??0),M1<0)M1=0}function v2($){return $&&$>1?` (×${$})`:""}function c1($){return $ instanceof Element&&Boolean($.closest("[data-debug-reporter]"))}var $5='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',J5={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},Q6={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function Q5($){let J=$.getAttribute("role");if(J&&Q6[J])return Q6[J];return J5[$.tagName.toLowerCase()]??"ปุ่ม"}function j5($,J){try{let Q=$,j=0;while(Q&&j<=J){let z=K6(Q);if(z&&typeof z.memoizedProps?.onClick==="function")return Q;Q=Q.parentElement,j+=1}}catch{}return null}function z5($){let J=$.getAttribute("aria-label")?.trim();if(J)return J;let Q=$.getAttribute("title")?.trim();if(Q)return Q;if($ instanceof HTMLInputElement||$ instanceof HTMLTextAreaElement||$ instanceof HTMLSelectElement)return($.getAttribute("placeholder")||$.getAttribute("name")||"").trim();if($ instanceof HTMLImageElement)return($.getAttribute("alt")||"").trim();let j=($.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if($ instanceof HTMLAnchorElement){let z=$.getAttribute("href");if(z?.startsWith("/"))return g2(z)}return""}function X5($){if(!($ instanceof Element))return null;let J=$.closest($5)??j5($,4);if(!J)return null;let Q=J.tagName.toLowerCase();if(Q==="html"||Q==="body")return null;return J}function Z5($){let J=n0(z5($));if(!J)return null;return`${Q5($)} “${e0(J,y2)}”`}var V6=6000,V5=4000,K5=/(?:^|\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 Y5($){$.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((z)=>z.remove());let J=[$,...Array.from($.querySelectorAll("*"))];for(let z of J){for(let Z of Array.from(z.attributes)){let K=Z.name.toLowerCase();if(K.startsWith("on")||K==="srcdoc"||K==="value"||K.startsWith("data-"))z.removeAttribute(Z.name)}if(z instanceof HTMLAnchorElement)z.setAttribute("href","#");if(z instanceof HTMLImageElement)z.removeAttribute("src");let X=z.getAttribute("class");if(X){let Z=X.replace(K5," ").replace(/\s+/g," ").trim();if(Z)z.setAttribute("class",Z);else z.removeAttribute("class")}}let Q=document.createTreeWalker($,NodeFilter.SHOW_TEXT),j=Q.nextNode();while(j){if(j.nodeValue)j.nodeValue=n0(j.nodeValue);j=Q.nextNode()}}function b2($,J,Q){try{let j=$.outerHTML;if(!j||j.length>J)return;let z=$.cloneNode(!0);Y5(z);let X=z.outerHTML;return X&&X.length<=Q?X:void 0}catch{return}}var W5=($)=>b2($,V6,V5),G5=150000,D5=40000,j6=($)=>b2($,G5,D5);function U5($){if(!($ instanceof HTMLInputElement)&&!($ instanceof HTMLTextAreaElement)&&!($ instanceof HTMLSelectElement))return null;let J=$.name||$.id||$.getAttribute("aria-label")||$.getAttribute("placeholder")||$.tagName.toLowerCase();return`ช่อง “${n0(J)}”`}var z6=80;function K6($){let J=Object.keys($).find((Q)=>Q.startsWith("__reactFiber$")||Q.startsWith("__reactInternalInstance$"));return J?$[J]:null}function H5($){if(typeof $!=="function")return null;try{let J=Function.prototype.toString.call($);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function X6($){if(!$)return;return`→ ${$.length>z6?`${$.slice(0,z6)}…`:$}`}function q5($){try{let J=$.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return X6(J);let Q=K6($),j=0;while(Q&&j<30){if(typeof Q.memoizedProps?.onClick==="function")return X6(H5(Q.memoizedProps.onClick));Q=Q.return,j+=1}return}catch{return}}var F5='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function M5(){let $=t4();return $.length?$.join(", "):F5}function P5($){let J=$.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function B5($){let J=$.getAttribute("aria-label")?.trim();if(J)return J;let Q=$.getAttribute("aria-labelledby");if(Q){let X=Q.split(/\s+/).map((Z)=>document.getElementById(Z)?.textContent?.trim()??"").filter(Boolean).join(" ");if(X)return X}let z=$.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(z)return z;return($.textContent??"").replace(/\s+/g," ").trim()}function Y6($){let J=n0(B5($)),Q=P5($);return J?`เปิด ${Q} “${e0(J,y2)}”`:`เปิด ${Q}`}var N5='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',_5=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function C5($){if($.querySelector(N5))return!0;return _5.test($.textContent??"")}var I5=400,O5=250,L5=8000;function R5($,J){if(typeof MutationObserver>"u"){J.html=i1(j6($));return}let Q=Date.now(),j=!1,z=()=>{j=!0,Z.disconnect(),window.clearInterval(K),window.clearTimeout(Y)},X=()=>{if(j)return;if(z(),!$.isConnected)return;J.detail=e0(Y6($),w2),J.html=i1(j6($))},Z=new MutationObserver(()=>{Q=Date.now()});Z.observe($,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let K=window.setInterval(()=>{if(j)return;if(!$.isConnected){z();return}if(Date.now()-Q>=I5&&!C5($))X()},O5),Y=window.setTimeout(X,L5)}function S5($){if(c1($))return;let J=F1("ui",Y6($));if(J)R5($,J)}function A5(){if(typeof MutationObserver>"u")return;let $=new WeakSet;new MutationObserver((Q)=>{for(let j of Q)for(let z of Array.from(j.addedNodes)){if(!(z instanceof Element))continue;let X=M5(),Z=z.matches(X)?[z]:Array.from(z.querySelectorAll(X));for(let K of Z){if($.has(K))continue;$.add(K),S5(K)}}}).observe(document.body,{childList:!0,subtree:!0})}var T5=1600,E5=2500;function Z6($){return{disabled:$.hasAttribute("disabled")||$.getAttribute("aria-disabled")==="true",busy:$.getAttribute("aria-busy")==="true",text:e0(($.textContent??"").replace(/\s+/g," ").trim(),y2)}}function k5($,J){if(!$.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!$.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if($.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function x5($,J){if(typeof MutationObserver>"u")return;let Q=Z6($),j=!1,z=(K,Y)=>{if(j)return;if(j=!0,X.disconnect(),window.clearTimeout(Z),J.afterNote=K,Y)J.afterHtml=i1(b2($,V6,E5))},X=new MutationObserver(()=>{if(!$.isConnected){z("องค์ประกอบหายไปจากหน้าจอ",!1);return}let K=k5(Q,Z6($));if(K)z(K,!0)});X.observe($,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let Z=window.setTimeout(()=>{if(!j&&!$.isConnected){z("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,X.disconnect()},T5)}function W6(){if(J6||typeof window>"u")return;J6=!0,document.addEventListener("click",(j)=>{if(c1(j.target))return;let z=X5(j.target);if(!z)return;let X=Z5(z);if(!X)return;let Z=F1("click",`คลิก ${X}`,q5(z),W5(z));if(Z)x5(z,Z)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(c1(j.target))return;let z=U5(j.target);if(z)F1("input",`แก้ไข ${z}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(c1(j.target))return;F1("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let $=()=>F1("navigate",`ไปที่ ${g2(P0(location.pathname+location.search))}`),J=history.pushState.bind(history),Q=history.replaceState.bind(history);history.pushState=(...j)=>{let z=J(...j);return $(),z},history.replaceState=(...j)=>{let z=Q(...j);return $(),z},window.addEventListener("popstate",$),A5()}function h2(){return t0.map(($)=>({...$}))}var G6=2000,l1=[],D6=0,U6=!1;function m2($,J){D6+=1,l1.push({id:`log_${D6}`,at:new Date().toISOString(),level:$,message:J.length>G6?`${J.slice(0,G6)}…`:J});while(l1.length>R0("maxConsoleEntries"))l1.shift()}function f5(){let $=new WeakSet;return(J,Q)=>{if(typeof Q==="object"&&Q!==null){if($.has(Q))return"[Circular]";$.add(Q)}if(typeof Q==="bigint")return Q.toString();return Q}}function H6($){if(typeof $==="string")return $;if($ instanceof Error)return`${$.name}: ${$.message}`;try{let J=JSON.stringify($,f5());if(J!==void 0)return J}catch{}try{return String($)}catch{}try{return Object.prototype.toString.call($)}catch{return`[${typeof $}]`}}function q6(){if(U6||typeof window>"u")return;U6=!0;let $=["log","info","warn","error","debug"];for(let J of $){let Q=console[J].bind(console);console[J]=(...j)=>{m2(J,j.map(H6).join(" ")),Q(...j)}}window.addEventListener("error",(J)=>{let Q=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";m2("exception",`${J.message}${Q}`)}),window.addEventListener("unhandledrejection",(J)=>{let Q=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:H6(J.reason);m2("unhandledrejection",Q)})}function u2(){return l1.map(($)=>({...$}))}var F6=new Set,M6=new Set;function P6($,J){return $.add(J),()=>$.delete(J)}function B6($,J){for(let Q of[...$])Q(J)}function p2($){return P6(F6,$)}function P1($={type:"manual"}){B6(F6,$)}function d2($){return P6(M6,$)}function c2($){B6(M6,$)}var w5=15000,y5=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],N6=!1,_6=0;function g5($){return y5.some((J)=>$.includes(J))}function C6($){let J=$.message??"";if(!J||g5(J))return;let Q=Date.now();if(Q-_6<w5)return;_6=Q,c2({...$,message:J})}function I6(){if(N6||typeof window>"u")return;N6=!0,window.addEventListener("error",($)=>{if(!$.message&&!$.error)return;let J=$.error instanceof Error?$.error:null;C6({type:"runtime-error",message:$.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",($)=>{let J=$.reason;C6({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var S6=4000,v5=1e6,b5=1e7,r1=[],O6=0,L6=!1;function A6($){r1.push($);while(r1.length>R0("maxRequests"))r1.shift()}function T6(){return O6+=1,`req_${O6}`}function R6($){let J={};if(!$)return J;if($ instanceof Headers)$.forEach((Q,j)=>{J[j]=Q});else if(Array.isArray($))for(let[Q,j]of $)J[Q]=j;else Object.assign(J,$);return J}function h5($){let J={};return $.forEach((Q,j)=>{J[j]=Q}),J}function m5($){if($==null)return null;if(typeof $==="string")return $;if($ instanceof URLSearchParams)return $.toString();if(typeof FormData<"u"&&$ instanceof FormData)return`[FormData: ${Array.from($.keys()).join(", ")}]`;if(typeof Blob<"u"&&$ instanceof Blob)return`[Blob ${$.size} bytes]`;if($ instanceof ArrayBuffer)return`[ArrayBuffer ${$.byteLength} bytes]`;return"[binary]"}function u5($,J){let Q="",j="GET",z={},X=null;if(typeof $==="string")Q=$;else if($ instanceof URL)Q=$.toString();else Q=$.url,j=$.method||j,z=R6($.headers);if(J){if(J.method)j=J.method;if(J.headers)z={...z,...R6(J.headers)};if(J.body!==void 0)X=m5(J.body)}return{method:j.toUpperCase(),url:Q,headers:z,body:X}}function E6($){return!e4($)}function p5($,J){if(E6(J.url)){J.responseSnippet="[body not captured for this origin]";return}let Q=$.headers.get("content-type")??"",j=Number($.headers.get("content-length")??"0"),z=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(Q)){J.responseSnippet=`[binary ${Q||"unknown"}${z}]`;return}if(j>v5){J.responseSnippet=`[response ${Q||"text"}${z} — omitted]`;return}try{$.clone().text().then((X)=>{J.responseSnippet=a0(X,R0("maxBodyChars"))}).catch(()=>{})}catch{}}function k6($,J){if(/[?&]_rsc=/.test($))return!0;for(let Q of Object.keys(J)){let j=Q.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function d5(){if(typeof window>"u"||typeof window.fetch!=="function")return;let $=window.fetch.bind(window);window.fetch=Object.assign(async(J,Q)=>{let j=u5(J,Q);if(k6(j.url,j.headers))return $(J,Q);let z={id:T6(),startedAt:new Date().toISOString(),method:j.method,url:P0(j.url),requestHeaders:s0(j.headers),requestBody:a0(j.body,S6),status:null,statusText:null,durationMs:null,via:"fetch"};A6(z);let X=performance.now();try{let Z=await $(J,Q);return z.status=Z.status,z.statusText=Z.statusText,z.durationMs=Math.round(performance.now()-X),z.responseHeaders=s0(h5(Z.headers)),p5(Z,z),Z}catch(Z){throw z.durationMs=Math.round(performance.now()-X),z.error=Z instanceof Error?`${Z.name}: ${Z.message}`:String(Z),Z}},$)}function c5(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let $=XMLHttpRequest.prototype,J=$.open,Q=$.send,j=function(X,Z){let K=typeof Z==="string"?Z:Z.toString();return this.__lwEntry=k6(K,{})?void 0:{id:T6(),startedAt:"",method:(X||"GET").toUpperCase(),url:P0(K),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},z=function(X){let Z=this.__lwEntry;if(Z){Z.startedAt=new Date().toISOString(),Z.requestBody=typeof X==="string"?a0(X,S6):X==null?null:"[non-string body]";let K=performance.now();A6(Z),this.addEventListener("loadend",()=>{if(Z.status=this.status||null,Z.statusText=this.statusText||null,Z.durationMs=Math.round(performance.now()-K),E6(Z.url))Z.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{Z.responseSnippet=a0(this.responseText||"",R0("maxBodyChars"))}catch{}else{let Y=this.getResponseHeader("content-type")??this.responseType;Z.responseSnippet=`[binary ${Y}]`}})}return Q.apply(this,arguments)};$.open=j,$.send=z}function x6(){if(L6)return;L6=!0,d5(),c5()}function i2(){let $=r1.map((Q)=>({...Q})),J=0;for(let Q=$.length-1;Q>=0;Q-=1){let j=$[Q],z=j?.responseSnippet;if(!j||typeof z!=="string"||z.length===0)continue;if(J+z.length>b5)j.responseSnippet=`[response omitted — report size budget reached (${z.length.toLocaleString()} chars)]`;else J+=z.length}return $}var i5=4,f6=3,l5=4000,r5="[data-debug-reporter]",o5=()=>import("@rrweb/record");var z0=[],$1=null,o1=!1;function w6(){if(typeof window>"u"||$1||o1)return;let $=q1();if(!$)return;o1=!0;let J=()=>void n5($);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function n5($){let J;try{J=(await o5()).record}catch(Q){o1=!1,console.warn("[debug-capture] session replay could not start:",Q);return}if($1)return;try{$1=J({emit:(Q)=>s5(Q),checkoutEveryNms:Math.max(1000,$.seconds*1000/2),checkoutEveryNth:l5,maskAllInputs:$.maskInputs,maskTextSelector:$.maskText?"*":$.maskTextSelector,blockSelector:`${$.blockSelector}, ${r5}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...$.canvas?{canvas:$.canvas.fps}:{}},recordCanvas:$.canvas!==null,...$.canvas?{dataURLOptions:{type:"image/webp",quality:$.canvas.quality}}:{},errorHandler:()=>!0})??null}catch(Q){console.warn("[debug-capture] session replay could not start:",Q)}finally{o1=!1}}function s5($){if($.type===i5||z0.length===0){if(z0.push([]),z0.length>f6)z0=z0.slice(-f6)}z0[z0.length-1].push($)}function l2($=Date.now()){let J=q1();if(!J||!z0.length)return null;let Q=$-J.seconds*1000,j=z0.length-1;while(j>0&&(z0[j][0]?.timestamp??$)>Q)j-=1;let z=z0.slice(j).flat(),X=z[0]?.timestamp,Z=z[z.length-1]?.timestamp;if(X===void 0||Z===void 0)return null;return{events:z,startedAt:new Date(X).toISOString(),endedAt:new Date(Z).toISOString(),durationMs:Math.max(0,Z-X)}}function a5(){return $1!==null}function t5(){$1?.(),$1=null,z0=[]}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:"มีข้อความใหม่จากทีมงาน"},$9={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",failedOffline:"Could not send — the server could not be reached. What you wrote is still here; check your connection and try again.",failedUnavailable:"Could not send — the system is being updated. What you wrote is still here; try again in a moment.",failedTooMany:"Too many reports — try again in {seconds} seconds.",captured:"Captured",reporter:"Reporter",page:"Page",replay:"activity log",handoffTitle:"Opening the support portal",handoffBody:"You will be signed in automatically to see what you reported",handoffGo:"Go now",handoffPreparing:"Preparing…",handoffFailed:"Could not open your reports",handoffBlocked:"Your browser blocked the new tab",handoffOpen:"Open in a new tab",chooseTitle:"How can the team help?",kindProblem:"Report a problem",kindRequest:"Request",askInstead:"Asking for something?",askInsteadAction:"Choose what you need",problemInstead:"Something broken?",problemInsteadAction:"Report a problem instead",problemInsteadShare:"Report a problem instead (with a screenshot)",chooseProblemHint:"Something is broken or not working — with a screenshot",chooseRequestHint:"Ask the team to do something, like access or a data change — no screen sharing",requestTitle:"Ask the team",requestTypeLabel:"What you need",requestTypeSearch:"Search what you need",requestTypeNone:"Nothing matches — try another word",requestTypeCount:"{n} to choose from — scroll or search",requestTarget:"The team aims to finish within {time}",requestSummaryLabel:"Subject",requestSummaryPlaceholder:"What do you need — briefly",requestDetailLabel:"Details (optional)",requestDetailPlaceholder:"What the team needs to know to do it",requestSubmit:"Send request",requestSubmitted:"Request sent",requestWithShot:"Attach this screenshot to the request",requestAnnotateHint:"Mark what you are asking about — box it, point at it, highlight it, or type on it",draftRestored:"What you typed last time, not sent yet",draftClear:"Clear",requestLeaves:"Not sent with a request",requestLeavesWhat:"this page's activity log — it is for problem reports only",days:"{n} days",hours:"{n} hours",ringTitle:"The support team is calling you",ringAbout:"About {key} · {title}",ringChat:"From your chat with support",ringHow:"Answer on your request's page — it opens in a new tab, already signed in",ringOpen:"Open to answer",ringDecline:"Decline",ringOpened:"Opened — press Answer in the new tab",ringBlocked:"Your browser blocked the new tab — open the call here",ringClose:"Close",ringTab:"\uD83D\uDCDE Incoming call",ringHint:"When you answer, your browser asks for the microphone · during the call the team may ask to see your screen — you always choose",ringTest:"Test the microphone and speaker first",ringAnswer:"Answer",ringAnswering:"Answering…",ringFallback:"The call can't open on this page — answer in a new tab instead, already signed in",chatOpen:"Chat with support",chatTitle:"Chat with support",chatUnread:"{n} new from support",chatMove:"Chat with support — drag to move it if it covers something",chatLabel:"Chat with us",chatLabelNew:"New message from support"};function a($){return $==="en"?$9:e5}var J9="lw-debug-toasts",Q9=6000,j9=`
2
2
  :host { all: initial; }
3
3
  .stack {
4
4
  position: fixed; top: 16px; right: 16px; z-index: 2147483001;
@@ -30,15 +30,15 @@ var F3=((J)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(J,{get:($,j)=
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
- `,c2=null;function b5(){if(typeof document>"u")return null;if(c2?.isConnected)return c2;let J=document.createElement(g5);J.dataset.debugReporter="true";let $=J.attachShadow({mode:"open"}),j=document.createElement("style");j.textContent=h5;let Q=document.createElement("div");return Q.className="stack",Q.setAttribute("role","status"),Q.setAttribute("aria-live","polite"),$.append(j,Q),document.body.append(J),c2=Q,Q}function y0(J,$="success",j){let Q=D1()?C().toast:void 0;if(Q){Q({message:J,tone:$,...j?{action:j}:{}});return}let z=b5();if(!z)return;let X=document.createElement("div");X.className="toast",X.dataset.tone=$;let Z=document.createElement("span");Z.className="dot";let K=document.createElement("span");K.textContent=J;let W=document.createElement("button");W.type="button",W.className="close",W.textContent="✕",W.setAttribute("aria-label","ปิด");let G=()=>{window.clearTimeout(I),X.remove()};W.addEventListener("click",G);let I=$==="error"||j?0:window.setTimeout(G,v5);if(X.append(Z,K),j){let B=document.createElement("button");B.type="button",B.className="action",B.textContent=j.label,B.addEventListener("click",()=>{G(),j.onClick()}),X.append(B)}X.append(W),z.append(X)}function S6(J,$,j){let Q=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})),z=$.filter((X)=>X.level==="error"||X.level==="exception"||X.level==="unhandledrejection").slice(-20).map((X)=>X.message);return{failedRequests:Q,errors:z,erroredQueries:j.slice(0,20)}}function T6(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[j]=performance.getEntriesByType("navigation");if(j)J.domContentLoadedMs=Math.round(j.domContentLoadedEventEnd),J.loadEventMs=Math.round(j.loadEventEnd);return J}function l2(J,$){if(!J)return $;try{return J()}catch{return $}}function A6(){let J=C(),{pathname:$,search:j,href:Q}=window.location;return{capturedAt:new Date().toISOString(),route:{href:Q,pathname:$,search:j},module:u1($),user:l2(J.user,{}),apiHeaders:n0(l2(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:l2(J.extra,{})}}var u5=2,p5={manual:"ผู้ใช้แจ้งเอง","runtime-error":"ข้อผิดพลาด runtime (auto)",unhandledrejection:"Promise rejection (auto)","framework-error":"หน้าจอค้าง/พัง (auto)"};function B1(J){let $=d2(),j=b2();return{context:A6(),reason:J.reason,note:J.note,cause:S6($,j,J.erroredQueries),actionTrail:v2(),network:$,console:j,screenshotDataUrl:J.screenshotDataUrl,screenshotMethod:J.screenshotMethod,replay:i2()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:u5}}}function E6(J){return J.replace(/'/g,"'\\''")}function k6(J){let $=[`curl -X ${J.method} '${J.url}'`];for(let[j,Q]of Object.entries(J.requestHeaders))$.push(` -H '${j}: ${E6(Q)}'`);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 j=$.durationMs!=null?`${$.durationMs}ms`:"—",Q=`# [${d5($)}] ${$.method} ${$.url} (${j}, ${$.startedAt})`,z=$.responseSnippet?`
34
- # response: ${$.responseSnippet}`:"";return`${Q}
35
- ${k6($)}${z}`}).join(`
33
+ `,r2=null;function z9(){if(typeof document>"u")return null;if(r2?.isConnected)return r2;let $=document.createElement(J9);$.dataset.debugReporter="true";let J=$.attachShadow({mode:"open"}),Q=document.createElement("style");Q.textContent=j9;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append(Q,j),document.body.append($),r2=j,j}function y0($,J="success",Q){let j=H1()?R().toast:void 0;if(j){j({message:$,tone:J,...Q?{action:Q}:{}});return}let z=z9();if(!z)return;let X=document.createElement("div");X.className="toast",X.dataset.tone=J;let Z=document.createElement("span");Z.className="dot";let K=document.createElement("span");K.textContent=$;let Y=document.createElement("button");Y.type="button",Y.className="close",Y.textContent="✕",Y.setAttribute("aria-label","ปิด");let W=()=>{window.clearTimeout(B),X.remove()};Y.addEventListener("click",W);let B=J==="error"||Q?0:window.setTimeout(W,Q9);if(X.append(Z,K),Q){let F=document.createElement("button");F.type="button",F.className="action",F.textContent=Q.label,F.addEventListener("click",()=>{W(),Q.onClick()}),X.append(F)}X.append(Y),z.append(X)}function y6($,J,Q){let 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})),z=J.filter((X)=>X.level==="error"||X.level==="exception"||X.level==="unhandledrejection").slice(-20).map((X)=>X.message);return{failedRequests:j,errors:z,erroredQueries:Q.slice(0,20)}}function g6($){return $.failedRequests.length+$.errors.length+$.erroredQueries.length}function X9(){let $={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return $;let J=performance.memory;if(J)$.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),$.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[Q]=performance.getEntriesByType("navigation");if(Q)$.domContentLoadedMs=Math.round(Q.domContentLoadedEventEnd),$.loadEventMs=Math.round(Q.loadEventEnd);return $}function o2($,J){if(!$)return J;try{return $()}catch{return J}}function v6(){let $=R(),{pathname:J,search:Q,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:Q},module:p1(J),user:o2($.user,{}),apiHeaders:s0(o2($.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:X9(),extra:o2($.extra,{})}}var Z9=2,V9={manual:"ผู้ใช้แจ้งเอง","runtime-error":"ข้อผิดพลาด runtime (auto)",unhandledrejection:"Promise rejection (auto)","framework-error":"หน้าจอค้าง/พัง (auto)"};function B1($){let J=i2(),Q=u2();return{context:v6(),reason:$.reason,note:$.note,cause:y6(J,Q,$.erroredQueries),actionTrail:h2(),network:J,console:Q,screenshotDataUrl:$.screenshotDataUrl,screenshotMethod:$.screenshotMethod,replay:l2()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:Z9}}}function b6($){return $.replace(/'/g,"'\\''")}function h6($){let J=[`curl -X ${$.method} '${$.url}'`];for(let[Q,j]of Object.entries($.requestHeaders))J.push(` -H '${Q}: ${b6(j)}'`);if($.requestBody)J.push(` --data '${b6($.requestBody)}'`);return J.join(" \\\n")}function K9($){if($.error)return`ERR ${$.error}`;return`${$.status??"—"} ${$.statusText??""}`.trim()}function Y9($){if($.length===0)return"No network activity captured.";return $.map((J)=>{let Q=J.durationMs!=null?`${J.durationMs}ms`:"—",j=`# [${K9(J)}] ${J.method} ${J.url} (${Q}, ${J.startedAt})`,z=J.responseSnippet?`
34
+ # response: ${J.responseSnippet}`:"";return`${j}
35
+ ${h6(J)}${z}`}).join(`
36
36
 
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((j)=>{let Q=j.source?` (${j.source})`:"",z=`${j.detail}${y2(j.count)}${Q}`;if(j.kind==="ui")return` ↳ [${j.at}] ${z}`;$+=1;let X=`${$}. [${j.at}] ${z}`;return j.afterNote?`${X}
39
- ↳ ${j.afterNote}`:X}).join(`
40
- `)}function r5(J){let $=[];for(let j of J.failedRequests)$.push(`✗ ${j.status??j.error??"ERR"} ${j.method} ${j.url}`);for(let j of J.errors)$.push(`⚠ ${j}`);for(let j of J.erroredQueries)$.push(`⚠ React Query error: ${j.key} — ${j.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),j=[`## \uD83D\uDC1E ${J.context.app.name} — Debug Report`,`**Generated:** ${J.context.capturedAt}`,"",...o5(J).map((Q)=>`- ${Q.replace(/\s{2,}:/,":")}`),"",`**หมายเหตุจากผู้แจ้ง:** ${J.note.trim()||"(ไม่มี)"}`];if($.length>0)j.push("","### ⚠ สาเหตุที่น่าจะเป็น","```",...$,"```");return j.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_"),j.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 T6(J.cause)>0}async function o1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let j=await e5();if(j.status==="ok")return{dataUrl:j.dataUrl,method:"display-media"};if(j.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let $=await j9();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 j=await J9(J);return j?{status:"ok",dataUrl:j}:{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 K=!1,W=()=>{if(K)return;K=!0,Z()};$.onloadedmetadata=()=>{$.play().then(W).catch(W)},window.setTimeout(W,1500)}),await $9($);let{videoWidth:j,videoHeight:Q}=$;if(!j||!Q)return null;let z=document.createElement("canvas");z.width=j,z.height=Q;let X=z.getContext("2d");if(!X)return null;X.drawImage($,0,0,j,Q),$.pause(),$.srcObject=null;try{return z.toDataURL("image/png")}catch{return null}}function $9(J){return new Promise(($)=>{let j=!1,Q=()=>{if(j)return;j=!0,$()},z=J;if(typeof z.requestVideoFrameCallback==="function")z.requestVideoFrameCallback(()=>Q()),window.setTimeout(Q,1000);else window.setTimeout(Q,250)})}async function j9(){let J=C().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:(j)=>!(j instanceof HTMLElement&&j.dataset?.debugReporter==="true")})}catch{return null}}var Q9=2000,z9=0.82,X9=3000000;function Z9(J){return new Promise(($,j)=>{let Q=new Image;Q.onload=()=>$(Q),Q.onerror=()=>j(Error("could not read the screenshot")),Q.src=J})}async function n1(J){try{let $=await Z9(J),j=Math.max($.naturalWidth,$.naturalHeight),Q=Math.min(1,Q9/j),z=document.createElement("canvas");z.width=Math.max(1,Math.round($.naturalWidth*Q)),z.height=Math.max(1,Math.round($.naturalHeight*Q));let X=z.getContext("2d");if(!X)return J;X.fillStyle="#fff",X.fillRect(0,0,z.width,z.height),X.drawImage($,0,0,z.width,z.height);let Z=z9,K=z.toDataURL("image/jpeg",Z);while(K.length>X9&&Z>0.4)Z-=0.15,K=z.toDataURL("image/jpeg",Z);return K}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,K9=/^\d+$/,W9=/^[0-9a-f]{16,}$/i;function r2(J){if(J.reason.type==="manual")return null;let $=J.cause?.failedRequests?.[0];if(!$?.url)return null;let j;try{j=new URL($.url,"http://x").pathname}catch{j=$.url}let Q=j.split("/").map((X)=>V9.test(X)||K9.test(X)||W9.test(X)?":id":X).join("/"),z=$.status??($.error?"ERR":"?");return`${$.method??"REQ"} ${Q} ${z}`}var o2=2000000;function s1(J){let{screenshotDataUrl:$,replay:j,...Q}=J;return JSON.stringify(Q).length}function n2(J,$=2000000){if(s1(J)<=$)return J;let j=J.network.map((z)=>({...z})),Q={...J,network:j};for(let z of j){if(s1(Q)<=$)return Q;if(typeof z.responseSnippet==="string"&&z.responseSnippet.length>35)z.responseSnippet="[body dropped — report size budget]";if(typeof z.requestBody==="string"&&z.requestBody.length>35)z.requestBody="[body dropped — report size budget]"}while(Q.network.length>1&&s1(Q)>$)Q.network=Q.network.slice(1);while(Q.console.length>1&&s1(Q)>$)Q.console=Q.console.slice(1);return Q}function F1(J){let $="";for(let j=0;j<J.length;j+=32768)$+=String.fromCharCode(...J.subarray(j,j+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 M9(J,$){let j=J.toLowerCase();if(j.startsWith("on")||j==="srcdoc")return!0;return typeof $==="string"&&q9.test($)}function x6(J,$=!1){if(!J)return;for(let j of Object.keys(J)){let Q=J[j];if(M9(j,Q)){if($)J[j]=null;else delete J[j];continue}if(typeof Q!=="string"||!H9.has(j)||!Q.includes("?"))continue;J[j]=B0(Q)}}function s2(J){if(!J)return;x6(J.attributes);for(let $ of J.childNodes??[])s2($)}function f6(J){let $=JSON.parse(JSON.stringify(J));for(let j of $){let Q=j.data;if(!Q||typeof Q!=="object")continue;if(j.type===Y9&&typeof Q.href==="string")Q.href=B0(Q.href);else if(j.type===G9)s2(Q.node);else if(j.type===U9&&Q.source===D9){for(let z of Q.adds??[])s2(z.node);for(let z of Q.attributes??[])x6(z.attributes,!0)}}return $}var y6="session-replay.json.gz",P9="session-replay.json";function B9(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 a2(J,$){if(!B9(J))return{summary:{omitted:"empty"}};let Q={seconds:Math.round(J.durationMs/1000),events:J.events.length,startedAt:J.startedAt,endedAt:J.endedAt},z=f6(J.events),X=await w6(z),Z=!1;if(X.bytes.byteLength>$&&C9(z))z=I9(z),X=await w6(z),Z=!0;let{bytes:K,compressed:W}=X;if(K.byteLength>$)return{summary:{...Q,bytes:K.byteLength,omitted:"too-large"}};return{dataUri:`data:${W?"application/gzip":"application/json"};base64,${F1(K)}`,filename:W?y6:P9,summary:{...Q,events:z.length,bytes:K.byteLength,compressed:W,...Z?{canvasDropped:Z}:{}}}}async function w6(J){let $=new TextEncoder().encode(JSON.stringify({events:J})),j=await F9($);return j?{bytes:j,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&&h6($.data.node))}function h6(J){if(!J)return!1;if(J.attributes&&"rr_dataURL"in J.attributes)return!0;return(J.childNodes??[]).some(h6)}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 I9(J){let $=[];for(let j of J){if(v6(j))continue;if(j.type===g6)b6(j.data.node);$.push(j)}return $}var O9=new Set([502,503,504]);class F0 extends Error{kind;retryAfter;status;constructor(J,$,j,Q){super(J);this.kind=$;this.retryAfter=j;this.status=Q;this.name="ReportError"}}function L9(J){let{screenshotDataUrl:$,replay:j,...Q}=J;return{dataUri:`data:application/json;base64,${F1(new TextEncoder().encode(JSON.stringify(Q)))}`,filename:"debug-bundle.json"}}async function t2(){let J=C().identity;if(!J)return{};try{let $=await J();return $?{authorization:`Bearer ${$}`}:{}}catch{return{}}}async function e2(J,$){let j=C(),Q=n2($,o2),{context:z,note:X}=Q,Z=[];if(Q.screenshotDataUrl){let O=await n1(Q.screenshotDataUrl);Z.push({dataUri:O,filename:"screenshot.jpg"})}Z.push(L9(Q));let K,W=H1();if(W){let O=await a2(Q.replay,W.maxBytes);if(K=O.summary,"dataUri"in O)Z.push({dataUri:O.dataUri,filename:O.filename})}let G=r2(Q),I={title:J,description:X.trim()||void 0,appName:H0().name,category:z.module?.label,routeUrl:z.route.href,priority:"MEDIUM",requesterEmail:z.user.email??void 0,requesterName:z.user.fullName??void 0,customFields:{unit:z.user.unit??"",appVersion:z.app.version,environment:z.app.environment,reasonType:Q.reason.type,appName:H0().name,module:z.module?.label??""},context:{...G?{signature:G}:{},capturedAt:z.capturedAt,reason:Q.reason,cause:Q.cause,actionTrail:Q.actionTrail,client:z.client,performance:z.performance,apiHeaders:z.apiHeaders,extra:z.extra,counts:{network:Q.network.length,console:Q.console.length,actions:Q.actionTrail.length},screenshotMethod:Q.screenshotMethod,...K?{replay:K}:{}},attachments:Z,...Q.reason.fromChat?{fromChat:!0}:{}},B=await fetch(`${j.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":j.realmKey,...await t2()},body:JSON.stringify(I)}).catch(()=>{throw new F0("report never left the browser","offline")});if(!B.ok)throw await J4(B);return await B.json()}async function J4(J){let $=J.headers.get("retry-after"),j=await J.json().then((Q)=>Q.error).catch(()=>null);if(J.status===429)return new F0("rate limited","rateLimited",$??void 0);if(O9.has(J.status))return new F0("desk unavailable","unavailable");return new F0(j??`Report failed (${J.status})`,"rejected",void 0,J.status)}var a1=null,N1=null,m6=()=>C().host.replace(/\/$/,"");function t1(){return a1}function g0(){if(N1)return N1;return N1=(async()=>{try{let J=await fetch(`${m6()}/ingest/request-types`,{headers:{"x-realm-key":C().realmKey}}),$=J.ok?await J.json():null;a1=Array.isArray($?.types)?$.types.filter(R9):[]}catch{a1=[],N1=null}return a1??[]})(),N1}function R9(J){let $=J;return!!$&&typeof $.id==="string"&&typeof $.name==="string"}async function $4(J){let $=C(),j={};try{j=$.user?.()??{}}catch{j={}}let Q=typeof window>"u"?null:window.location,z={title:J.title,description:J.description.trim()||void 0,ticketTypeId:J.ticketTypeId,appName:H0().name,category:Q?u1(Q.pathname)?.label:void 0,routeUrl:Q?.href,priority:"MEDIUM",requesterEmail:j.email??void 0,requesterName:j.fullName??void 0,attachments:J.screenshotDataUrl?[{dataUri:await n1(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 t2()},body:JSON.stringify(z)}).catch(()=>{throw new F0("request never left the browser","offline")});if(!X.ok)throw await J4(X);return await X.json()}var _1=Math.PI/6;function u6(J,$,j){let Q=$.x-J.x,z=$.y-J.y,X=Math.hypot(Q,z),Z=Math.atan2(z,Q),K=[{x:$.x,y:$.y},{x:$.x-j*Math.cos(Z-_1),y:$.y-j*Math.sin(Z-_1)},{x:$.x-j*Math.cos(Z+_1),y:$.y-j*Math.sin(Z+_1)}],W=j*Math.cos(_1)*0.92;if(X<=W)return{shaft:null,head:K};return{shaft:{from:J,to:{x:$.x-W*Math.cos(Z),y:$.y-W*Math.sin(Z)}},head:K}}var j4="#f44336",S9="rgba(250, 204, 21, 0.4)",Q4=22,p6="#2563eb",d6=9,i6=11,c6=18,l6=4,e1=8,T9=[{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,$,j){let Q=[],z=null,X=-1,Z=null,K=null,W=J.getContext("2d");function G(){let V=J.getBoundingClientRect().width;return V>0?J.width/V:1}function I(V){let Y=J.getBoundingClientRect();return{x:(V.clientX-Y.left)/Y.width*J.width,y:(V.clientY-Y.top)/Y.height*J.height}}function B(V){let Y=V.size??Q4;if(!W)return(V.text?.length??0)*Y*0.6;W.save(),W.font=`600 ${Y}px system-ui, sans-serif`;let H=W.measureText(V.text??"").width;return W.restore(),H}function O(V){if(V.tool==="text"){let Y=V.size??Q4;return{left:V.x1,top:V.y1,right:V.x1+B(V),bottom:V.y1+Y*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 S(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 Y=O(V);if(V.tool==="text")return[{id:"size",x:Y.right,y:Y.bottom,cursor:"nwse-resize"}];return T9.map((H)=>({id:H.id,x:Y.left+(Y.right-Y.left)*H.fx,y:Y.top+(Y.bottom-Y.top)*H.fy,cursor:H.cursor}))}function L(V){let Y=O(V);return{x:Y.right+c6*G(),y:Y.top-c6*G()}}function h(V,Y,H){let{shaft:U,head:q}=u6({x:Y.x1,y:Y.y1},{x:Y.x2,y:Y.y2},Math.max(10,16*H));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(q[0].x,q[0].y),V.lineTo(q[1].x,q[1].y),V.lineTo(q[2].x,q[2].y),V.closePath(),V.fill()}function N(V,Y,H){V.save(),V.lineWidth=Math.max(2,3*H),V.strokeStyle=j4,V.fillStyle=j4;let U=O(Y);if(Y.tool==="rect")V.strokeRect(U.left,U.top,U.right-U.left,U.bottom-U.top);else if(Y.tool==="arrow")h(V,Y,H);else if(Y.tool==="highlight")V.fillStyle=S9,V.fillRect(U.left,U.top,U.right-U.left,U.bottom-U.top);else if(Y.tool==="text"&&Y.text){let q=Y.size??Q4;V.font=`600 ${q}px system-ui, sans-serif`,V.textBaseline="top";let _=q*0.22;V.fillStyle="rgba(255,255,255,0.92)",V.fillRect(U.left-_,U.top-_,U.right-U.left+_*2,U.bottom-U.top+_*2),V.fillStyle=j4,V.fillText(Y.text,U.left,U.top)}V.restore()}function D(V,Y,H){let U=O(Y);V.save(),V.strokeStyle=p6,V.lineWidth=Math.max(1,1.5*H),V.setLineDash([6*H,4*H]),V.strokeRect(U.left,U.top,U.right-U.left,U.bottom-U.top),V.setLineDash([]);let q=d6*H;for(let s of S(Y))V.fillStyle="#fff",V.strokeStyle=p6,V.lineWidth=Math.max(1,1.5*H),V.beginPath(),V.rect(s.x-q/2,s.y-q/2,q,q),V.fill(),V.stroke();let _=L(Y),g=i6*H;V.beginPath(),V.arc(_.x,_.y,g,0,Math.PI*2),V.fillStyle="#dc2626",V.fill(),V.strokeStyle="#fff",V.lineWidth=Math.max(1.5,2*H),V.beginPath(),V.moveTo(_.x-g*0.4,_.y-g*0.4),V.lineTo(_.x+g*0.4,_.y+g*0.4),V.moveTo(_.x+g*0.4,_.y-g*0.4),V.lineTo(_.x-g*0.4,_.y+g*0.4),V.stroke(),V.restore()}function M(){if(!W)return;let V=G();if(W.clearRect(0,0,J.width,J.height),W.drawImage($,0,0,J.width,J.height),Q.forEach((H,U)=>{if(U!==k)N(W,H,V)}),Z)N(W,Z,V);let Y=Q[X];if(Y&&!Z)D(W,Y,V)}function w(V,Y,H,U,q){return Math.abs(V-H)<=q&&Math.abs(Y-U)<=q}function m(V,Y){let H=Q[X];if(!H)return null;let U=d6*G()/2+3*G();for(let q of S(H))if(w(V,Y,q.x,q.y,U))return q.id;return null}function R(V,Y){let H=Q[X];if(!H)return!1;let U=L(H);return w(V,Y,U.x,U.y,i6*G())}function y(V,Y){let H=6*G();for(let U=Q.length-1;U>=0;U-=1){let q=Q[U];if(q.tool==="arrow"){let g=q.x2-q.x1,s=q.y2-q.y1,D0=Math.hypot(g,s)||1,P=Math.max(0,Math.min(1,((V-q.x1)*g+(Y-q.y1)*s)/(D0*D0)));if(Math.hypot(V-(q.x1+P*g),Y-(q.y1+P*s))<=H+4*G())return U;continue}let _=O(q);if(V>=_.left-H&&V<=_.right+H&&Y>=_.top-H&&Y<=_.bottom+H)return U}return-1}function T(V,Y,H,U,q){if(Y==="tail"){V.x1=H.x1+U,V.y1=H.y1+q;return}if(Y==="head"){V.x2=H.x2+U,V.y2=H.y2+q;return}if(Y==="size"){let v=(H.size??24)+q;V.size=Math.max(10,v);return}let _=O(H),{left:g,top:s,right:D0,bottom:P}=_;if(Y.includes("w"))g=Math.min(D0-e1,g+U);if(Y.includes("e"))D0=Math.max(g+e1,D0+U);if(Y.includes("n"))s=Math.min(P-e1,s+q);if(Y.includes("s"))P=Math.max(s+e1,P+q);V.x1=g,V.y1=s,V.x2=D0,V.y2=P}function u(V,Y,H,U){V.x1=Y.x1+H,V.y1=Y.y1+U,V.x2=Y.x2+H,V.y2=Y.y2+U}let F=null,k=-1,A={x:0,y:0,size:24};function p(){let V=J.getBoundingClientRect().width;return V>0?V/J.width:1}function i0(V,Y){if(!W)return V.length*Y*0.6;W.save(),W.font=`600 ${Y}px system-ui, sans-serif`;let H=W.measureText(V||" ").width;return W.restore(),H}function Y0(){if(!F)return;let V=J.parentElement;if(!V)return;let Y=J.getBoundingClientRect(),H=V.getBoundingClientRect(),U=p(),q=A.size*U;F.style.left=`${Y.left-H.left+A.x*U}px`,F.style.top=`${Y.top-H.top+A.y*U}px`,F.style.fontSize=`${q}px`,F.style.width=`${Math.max(40,i0(F.value,q)+q)}px`}function e(V){let Y=F;if(!Y)return;F=null;let H=Y.value.trim(),U=k;if(k=-1,Y.remove(),V&&H){if(U>=0&&Q[U])Q[U].text=H,X=U;else Q.push({tool:"text",x1:A.x,y1:A.y,x2:A.x,y2:A.y,text:H,size:A.size}),X=Q.length-1;j()}else if(U>=0)X=U;J.focus(),M()}function o(V,Y,H=-1){e(!0);let U=J.parentElement;if(!U)return;if(getComputedStyle(U).position==="static")U.style.position="relative";let q=H>=0?Q[H]:void 0;k=H,A={x:q?.x1??V,y:q?.y1??Y,size:q?.size??Math.round(24*G())};let _=document.createElement("input");_.type="text",_.className="text-edit",_.value=q?.text??"",_.setAttribute("aria-label","ข้อความบนภาพ"),_.placeholder="ข้อความ",F=_,U.append(_),Y0(),_.addEventListener("input",Y0),_.addEventListener("keydown",(g)=>{if(g.stopPropagation(),g.key==="Enter")e(!0);else if(g.key==="Escape")e(!1)}),requestAnimationFrame(()=>{if(F!==_)return;_.focus(),_.select(),_.addEventListener("blur",()=>e(!0))}),M()}function G0(V){let{x:Y,y:H}=I(V);if(J.setPointerCapture(V.pointerId),R(Y,H)){U0();return}let U=m(Y,H);if(U&&Q[X]){K={grip:U,x:Y,y:H,start:{...Q[X]}};return}if(z==="text"){if(V.preventDefault(),J.hasPointerCapture(V.pointerId))J.releasePointerCapture(V.pointerId);z=null,j(),o(Y,H);return}if(z){Z={tool:z,x1:Y,y1:H,x2:Y,y2:H},X=-1;return}let q=y(Y,H);X=q,K=q>=0?{grip:"body",x:Y,y:H,start:{...Q[q]}}:null,M()}function c0(V){let{x:Y,y:H}=I(V);if(Z){Z.x2=Y,Z.y2=H,M();return}if(K){let q=Q[X];if(!q)return;let _=Y-K.x,g=H-K.y;if(K.grip==="body")u(q,K.start,_,g);else T(q,K.grip,K.start,_,g);M();return}if(z){J.style.cursor="crosshair";return}if(R(Y,H)){J.style.cursor="pointer";return}let U=m(Y,H);if(U){let q=Q[X]?S(Q[X]).find((_)=>_.id===U):null;J.style.cursor=q?.cursor??"pointer";return}J.style.cursor=y(Y,H)>=0?"move":"default"}function f0(){if(Z){if(!(Math.abs(Z.x2-Z.x1)<l6&&Math.abs(Z.y2-Z.y1)<l6))Q.push(Z),X=Q.length-1,z=null,j();Z=null}if(K)K=null,j();M()}function O0(V){let Y=J.getBoundingClientRect(),H=(V.clientX-Y.left)/Y.width*J.width,U=(V.clientY-Y.top)/Y.height*J.height,q=y(H,U),_=Q[q];if(!_||_.tool!=="text")return;V.preventDefault(),o(_.x1,_.y1,q)}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,M()}function U0(){if(X<0)return;Q.splice(X,1),X=-1,j(),M()}return J.addEventListener("pointerdown",G0),J.addEventListener("pointermove",c0),J.addEventListener("pointerup",f0),J.addEventListener("pointercancel",f0),J.addEventListener("dblclick",O0),J.tabIndex=0,J.addEventListener("keydown",L0),M(),{setTool(V){z=V,X=-1,J.style.cursor=V?"crosshair":"default",M()},deleteSelected:U0,clear(){Q.length=0,X=-1,j(),M()},hasShapes:()=>Q.length>0,hasSelection:()=>X>=0,toDataUrl(){let V=document.createElement("canvas");V.width=$.naturalWidth,V.height=$.naturalHeight;let Y=V.getContext("2d");if(!Y)return J.toDataURL("image/png");Y.drawImage($,0,0);let H=G();for(let U of Q)N(Y,U,H);return V.toDataURL("image/png")},destroy(){e(!1),J.removeEventListener("pointerdown",G0),J.removeEventListener("pointermove",c0),J.removeEventListener("pointerup",f0),J.removeEventListener("pointercancel",f0),J.removeEventListener("dblclick",O0),J.removeEventListener("keydown",L0)}}}var A9=["keydown","keyup","keypress"];function J1(J){for(let $ of A9)J.addEventListener($,(j)=>j.stopPropagation())}var r6=`
37
+ `)}function W9($){if($.length===0)return"No console output captured.";return $.map((J)=>`[${J.at}] ${J.level.toUpperCase()}: ${J.message}`).join(`
38
+ `)}function G9($){if($.length===0)return"No user actions captured.";let J=0;return $.map((Q)=>{let j=Q.source?` (${Q.source})`:"",z=`${Q.detail}${v2(Q.count)}${j}`;if(Q.kind==="ui")return` ↳ [${Q.at}] ${z}`;J+=1;let X=`${J}. [${Q.at}] ${z}`;return Q.afterNote?`${X}
39
+ ↳ ${Q.afterNote}`:X}).join(`
40
+ `)}function D9($){let J=[];for(let Q of $.failedRequests)J.push(`✗ ${Q.status??Q.error??"ERR"} ${Q.method} ${Q.url}`);for(let Q of $.errors)J.push(`⚠ ${Q}`);for(let Q of $.erroredQueries)J.push(`⚠ React Query error: ${Q.key} — ${Q.error}`);return J}function U9($){let{context:J}=$;return[`User : ${J.user.fullName??"—"} (${J.user.email??"—"})`,`Unit : ${J.user.unit??"—"}`,`Roles : ${J.user.roles?.join(", ")||"—"}`,`Route : ${J.route.href}`,`Module : ${J.module?`${J.module.label} (${J.module.key})`:"—"}`,`App : ${J.app.name} v${J.app.version} · ${J.app.environment}`,`Memory : ${J.performance.memoryUsedMb??"—"}/${J.performance.memoryLimitMb??"—"} MB`,`Client : ${J.client.userAgent}`,`Viewport : ${J.client.viewport.width}×${J.client.viewport.height} @${J.client.viewport.dpr}x`,`Reason : ${V9[$.reason.type]}${$.reason.message?` — ${$.reason.message}`:""}`,`Captured : ${$.network.length} requests · ${$.console.length} console · ${$.actionTrail.length} actions · screenshot=${$.screenshotMethod}${$.replay?` · replay=${Math.round($.replay.durationMs/1000)}s`:""}`]}function H9($){let J=D9($.cause),Q=[`## \uD83D\uDC1E ${$.context.app.name} — Debug Report`,`**Generated:** ${$.context.capturedAt}`,"",...U9($).map((j)=>`- ${j.replace(/\s{2,}:/,":")}`),"",`**หมายเหตุจากผู้แจ้ง:** ${$.note.trim()||"(ไม่มี)"}`];if(J.length>0)Q.push("","### ⚠ สาเหตุที่น่าจะเป็น","```",...J,"```");return Q.push("",`<details><summary>ขั้นตอน (${$.actionTrail.length})</summary>`,"","```",G9($.actionTrail),"```","</details>","",`<details><summary>Network (${$.network.length})</summary>`,"","```",Y9($.network),"```","</details>","",`<details><summary>Console (${$.console.length})</summary>`,"","```",W9($.console),"```","</details>","","_ข้อมูลลับ (token, cookie) ถูกปกปิดอัตโนมัติ · ภาพหน้าจออยู่ในไฟล์ .zip_"),Q.join(`
41
+ `)}function q9($){return $.replace(/[:.]/g,"-").replace("T","_").slice(0,19)}function F9($,J){return`debug-report_${q9($.context.capturedAt)}.${J}`}function M9($){return g6($.cause)>0}async function n1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let Q=await P9();if(Q.status==="ok")return{dataUrl:Q.dataUrl,method:"display-media"};if(Q.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await _9();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function P9(){let $=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};$=await navigator.mediaDevices.getDisplayMedia(J);let Q=await B9($);return Q?{status:"ok",dataUrl:Q}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{$?.getTracks().forEach((J)=>J.stop())}}async function B9($){let J=document.createElement("video");J.srcObject=$,J.muted=!0,J.playsInline=!0,await new Promise((Z)=>{let K=!1,Y=()=>{if(K)return;K=!0,Z()};J.onloadedmetadata=()=>{J.play().then(Y).catch(Y)},window.setTimeout(Y,1500)}),await N9(J);let{videoWidth:Q,videoHeight:j}=J;if(!Q||!j)return null;let z=document.createElement("canvas");z.width=Q,z.height=j;let X=z.getContext("2d");if(!X)return null;X.drawImage(J,0,0,Q,j),J.pause(),J.srcObject=null;try{return z.toDataURL("image/png")}catch{return null}}function N9($){return new Promise((J)=>{let Q=!1,j=()=>{if(Q)return;Q=!0,J()},z=$;if(typeof z.requestVideoFrameCallback==="function")z.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function _9(){let $=R().screenshotFallback;if(!$)return null;let J=await $().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:(Q)=>!(Q instanceof HTMLElement&&Q.dataset?.debugReporter==="true")})}catch{return null}}var C9=2000,I9=0.82,O9=3000000;function L9($){return new Promise((J,Q)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>Q(Error("could not read the screenshot")),j.src=$})}async function s1($){try{let J=await L9($),Q=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,C9/Q),z=document.createElement("canvas");z.width=Math.max(1,Math.round(J.naturalWidth*j)),z.height=Math.max(1,Math.round(J.naturalHeight*j));let X=z.getContext("2d");if(!X)return $;X.fillStyle="#fff",X.fillRect(0,0,z.width,z.height),X.drawImage(J,0,0,z.width,z.height);let Z=I9,K=z.toDataURL("image/jpeg",Z);while(K.length>O9&&Z>0.4)Z-=0.15,K=z.toDataURL("image/jpeg",Z);return K}catch{return $}}var R9=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,S9=/^\d+$/,A9=/^[0-9a-f]{16,}$/i;function n2($){if($.reason.type==="manual")return null;let J=$.cause?.failedRequests?.[0];if(!J?.url)return null;let Q;try{Q=new URL(J.url,"http://x").pathname}catch{Q=J.url}let j=Q.split("/").map((X)=>R9.test(X)||S9.test(X)||A9.test(X)?":id":X).join("/"),z=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${z}`}var s2=2000000;function a1($){let{screenshotDataUrl:J,replay:Q,...j}=$;return JSON.stringify(j).length}function a2($,J=2000000){if(a1($)<=J)return $;let Q=$.network.map((z)=>({...z})),j={...$,network:Q};for(let z of Q){if(a1(j)<=J)return j;if(typeof z.responseSnippet==="string"&&z.responseSnippet.length>35)z.responseSnippet="[body dropped — report size budget]";if(typeof z.requestBody==="string"&&z.requestBody.length>35)z.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&a1(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&a1(j)>J)j.console=j.console.slice(1);return j}function g0($){let J="";for(let Q=0;Q<$.length;Q+=32768)J+=String.fromCharCode(...$.subarray(Q,Q+32768));return btoa(J)}var T9=4,E9=2,k9=3,x9=0,f9=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),w9=/^\s*javascript:/i;function y9($,J){let Q=$.toLowerCase();if(Q.startsWith("on")||Q==="srcdoc")return!0;return typeof J==="string"&&w9.test(J)}function m6($,J=!1){if(!$)return;for(let Q of Object.keys($)){let j=$[Q];if(y9(Q,j)){if(J)$[Q]=null;else delete $[Q];continue}if(typeof j!=="string"||!f9.has(Q)||!j.includes("?"))continue;$[Q]=P0(j)}}function t2($){if(!$)return;m6($.attributes);for(let J of $.childNodes??[])t2(J)}function u6($){let J=JSON.parse(JSON.stringify($));for(let Q of J){let j=Q.data;if(!j||typeof j!=="object")continue;if(Q.type===T9&&typeof j.href==="string")j.href=P0(j.href);else if(Q.type===E9)t2(j.node);else if(Q.type===k9&&j.source===x9){for(let z of j.adds??[])t2(z.node);for(let z of j.attributes??[])m6(z.attributes,!0)}}return J}var g9=30000,v9=2,p6=3,b9=0,h9=9,m9=/^data:([^;,]+);base64,/;function e2($,J){if(!$)return;let Q=$.attributes,j=Q?.rr_dataURL;if(Q&&typeof j==="string"){let z=m9.exec(j);if(z)J.push({picture:{type:z[1],base64:j.slice(z[0].length)},put:(X)=>Q.rr_dataURL=`data:${X.type};base64,${X.base64}`})}for(let z of $.childNodes??[])e2(z,J)}function u9($,J){if(!Array.isArray($))return;for(let Q of $)for(let j of Q.args??[]){let z=j;if(z?.rr_type!=="ImageBitmap")continue;let X=z.args?.[0],Z=X?.rr_type==="Blob"?X.data?.[0]:void 0;if(!X||Z?.rr_type!=="ArrayBuffer"||typeof Z.base64!=="string"||typeof X.type!=="string")continue;J.push({picture:{type:X.type,base64:Z.base64},put:(K)=>{X.type=K.type,Z.base64=K.base64}})}}function $4($){let J=[];for(let Q of $){let j=Q.data;if(!j||typeof j!=="object")continue;if(Q.type===v9)e2(j.node,J);else if(Q.type===p6&&j.source===b9)for(let z of j.adds??[])e2(z.node,J);else if(Q.type===p6&&j.source===h9)u9(j.commands,J)}return J}function d6($){return $4($).map((J)=>J.picture.base64)}var c6=($)=>$.picture.type==="image/png"&&$.picture.base64.length>=g9;function i6($){return $4($).some(c6)}async function l6($,J){let Q=new Map,j=0;for(let z of $4($).filter(c6)){let X=z.picture.base64;if(!Q.has(X)){let K=null;try{K=await J(z.picture)}catch{K=null}Q.set(X,K&&K.base64.length<X.length?K:null)}let Z=Q.get(X);if(Z)z.put(Z),j+=1}return j}function p9($){let J=atob($),Q=new Uint8Array(J.length);for(let j=0;j<J.length;j++)Q[j]=J.charCodeAt(j);return Q}function d9($,J){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas($,J);if(typeof document>"u")return null;let Q=document.createElement("canvas");return Q.width=$,Q.height=J,Q}function c9($,J){if("convertToBlob"in $)return $.convertToBlob({type:"image/jpeg",quality:J});return new Promise((Q)=>$.toBlob(Q,"image/jpeg",J))}function r6($){if(typeof createImageBitmap!=="function"||typeof OffscreenCanvas>"u"&&typeof document>"u")return null;return async({base64:J,type:Q})=>{let j=await createImageBitmap(new Blob([p9(J)],{type:Q}));try{let{width:z,height:X}=j,Z=d9(z,X),K=Z?.getContext("2d",{willReadFrequently:!0});if(!Z||!K)return null;K.drawImage(j,0,0);let Y=K.getImageData(0,0,z,X).data;for(let B=3;B<Y.length;B+=4)if(Y[B]!==255)return null;let W=await c9(Z,$);if(!W||W.type!=="image/jpeg")return null;return{base64:g0(new Uint8Array(await W.arrayBuffer())),type:"image/jpeg"}}finally{j.close()}}}var t6="session-replay.json.gz",i9="session-replay.json";function l9($){return Boolean($&&$.events.length>0)}async function e6($){if(typeof CompressionStream>"u")return null;try{let J=new Blob([$]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function N1($){let J=new TextEncoder().encode(JSON.stringify({events:$})),Q=await e6(J);return Q?{bytes:Q,compressed:!0}:{bytes:J,compressed:!1}}var o6=65536,n6=16;async function r9($){let J=d6($),Q=J.reduce((Y,W)=>Y+W.length,0);if(Q===0)return 0;let j=Math.max(1,Math.floor(J.length/n6)),z="";for(let Y=0;Y<J.length&&z.length<o6*n6;Y+=j)z+=J[Y].slice(0,o6);let X=new TextEncoder().encode(z),Z=await e6(X),K=Z?Z.byteLength/X.byteLength:1;return Q*K*0.9}async function Q4($,J,Q={}){if(!l9($))return{summary:{omitted:"empty"}};let j=Math.round($.durationMs/1000),z=u6($.events),X=await o9(z,J,Q);if(!("events"in X))return{summary:{seconds:j,events:$.events.length,startedAt:$.startedAt,endedAt:$.endedAt,bytes:X.bytes,omitted:"too-large"}};let{bytes:Z,compressed:K}=X.encoded,Y=X.events,W=Y[0].timestamp,B=Y[Y.length-1].timestamp,{trimmed:F,...O}=X.cuts,N=Date.parse($.endedAt);return{dataUri:`data:${K?"application/gzip":"application/json"};base64,${g0(Z)}`,filename:K?t6:i9,summary:{seconds:Math.round((B-W)/1000),events:Y.length,startedAt:new Date(W).toISOString(),endedAt:new Date(B).toISOString(),bytes:Z.byteLength,compressed:K,...O,...F?{recordedSeconds:j}:{},...F==="end"&&!Number.isNaN(N)?{endsEarlySeconds:Math.round((N-B)/1000)}:{}}}}async function o9($,J,Q){let j={},z=0,X=async(N)=>{let _=await r9(N);if(_>J)return z||=Math.round(_),null;let A=await N1(N);return z||=A.bytes.byteLength,A.bytes.byteLength<=J?A:null},Z=await X($);if(Z)return{events:$,encoded:Z,cuts:j};let K=Q.lighten===void 0?r6(Q.quality??0.5):Q.lighten;if(K&&i6($)&&await l6($,K)>0){if(Z=await X($),Z)return{events:$,encoded:Z,cuts:j}}let Y=[...new Set($.filter(j8).map((N)=>N.timestamp))].sort((N,_)=>N-_);if(Y.length>1){let N=1,_=Y.length,A=null;while(N<_){let P=Math.floor((N+_)/2),U=t9($,Y[P]),M=await X(U);if(M)A={events:U,encoded:M},_=P;else N=P+1}if(A)return{...A,cuts:{...j,canvasDropped:!0}}}if(e9($)){if(j.canvasDropped=!0,$=$.filter((N)=>!t1(N)),Z=await X($),Z)return{events:$,encoded:Z,cuts:j}}if(Q7($)){if(j.picturesDropped=!0,Z=await X($),Z)return{events:$,encoded:Z,cuts:j}}let W=z7($);if(W.length>1){let N=[];for(let P of W)N.push((await N1(P)).bytes.byteLength);let _=W.length,A=0;while(_>0&&A+N[_-1]<=J)A+=N[--_];for(let P=Math.max(_,1);P<W.length;P++){let U=W.slice(P).flat();if(Z=await N1(U),Z.bytes.byteLength<=J)return{events:U,encoded:Z,cuts:{...j,trimmed:"start"}}}}let B=W[W.length-1],F=await s6(B,J);if(!F&&j7(B))j.simplified=!0,F=await s6(B,J);if(!F)return{bytes:z};let O=F.events.length<B.length?"end":W.length>1?"start":void 0;return{...F,cuts:{...j,...O?{trimmed:O}:{}}}}async function s6($,J){let Q=$.findIndex((X)=>X.type===j4)+1||1,j=$.length,z={events:$.slice(0,Q),encoded:await N1($.slice(0,Q))};if(z.encoded.bytes.byteLength>J)return null;while(Q<j){let X=Math.ceil((Q+j)/2),Z=$.slice(0,X),K=await N1(Z);if(K.bytes.byteLength<=J)Q=X,z={events:Z,encoded:K};else j=X-1}return z}var n9=4,j4=2,$8=3,s9=0,a9=9;function t1($){return $.type===$8&&$.data?.source===a9}function J8($,J){let Q=$.data;if(!Q||typeof Q!=="object")return;if($.type===j4)J(Q.node);else if($.type===$8&&Q.source===s9)for(let j of Q.adds??[])J(j.node)}function Q8($){if(!$)return!1;let J=!1;if($.attributes&&"rr_dataURL"in $.attributes)delete $.attributes.rr_dataURL,J=!0;for(let Q of $.childNodes??[])J=Q8(Q)||J;return J}function z4($){return!!$&&($.attributes!==void 0&&("rr_dataURL"in $.attributes)||($.childNodes??[]).some(z4))}function j8($){if(t1($))return!0;let J=!1;return J8($,(Q)=>J||=z4(Q)),J}function J4($){if(!$||!z4($))return $;let{rr_dataURL:J,...Q}=$.attributes??{};return{...$,...$.attributes?{attributes:Q}:{},...$.childNodes?{childNodes:$.childNodes.map((j)=>J4(j))}:{}}}function t9($,J){let Q=[];for(let j of $)if(j.timestamp>=J||!j8(j))Q.push(j);else if(t1(j))continue;else if(j.type===j4){let z=j.data;Q.push({...j,data:{...z,node:J4(z.node)}})}else{let z=j.data;Q.push({...j,data:{...z,adds:(z.adds??[]).map((X)=>({...X,node:J4(X.node)}))}})}return Q}function e9($){let J=!1;for(let Q of $)if(t1(Q))J=!0;else J8(Q,(j)=>J=Q8(j)||J);return J}var z8=16384,$7="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",J7=new RegExp(`url\\(\\s*(['"]?)data:[^'")]{${z8},}\\1\\s*\\)`,"g");function X4($,J){if(!$||typeof $!=="object")return!1;let Q=!1,j=Array.isArray($)?$.map((z,X)=>[X,z]):Object.entries($);for(let[z,X]of j)if(typeof X==="string"){let Z=J(X);if(Z!==X)$[z]=Z,Q=!0}else if(X&&typeof X==="object")Q=X4(X,J)||Q;return Q}function Q7($){let J=!1;for(let Q of $)J=X4(Q.data,(j)=>{if(j.length<z8)return j;if(j.startsWith("data:"))return j.startsWith("data:image/")?$7:"";return j.includes("data:")?j.replace(J7,"url()"):j})||J;return J}var a6=2000;function j7($){let J=!1;for(let Q of $)J=X4(Q.data,(j)=>j.length>a6?j.slice(0,a6):j)||J;return J}function z7($){let J=[[]],Q=!1;for(let j of $){if(j.type===n9){if(Q)J.push([]);Q=!0}J[J.length-1].push(j)}return J}var X7=new Set([502,503,504]);class B0 extends Error{kind;retryAfter;status;constructor($,J,Q,j){super($);this.kind=J;this.retryAfter=Q;this.status=j;this.name="ReportError"}}function Z7($){let{screenshotDataUrl:J,replay:Q,...j}=$;return{dataUri:`data:application/json;base64,${g0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function Z4(){let $=R().identity;if(!$)return{};try{let J=await $();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function V4($,J){let Q=R(),j=a2(J,s2),{context:z,note:X}=j,Z=[];if(j.screenshotDataUrl){let O=await s1(j.screenshotDataUrl);Z.push({dataUri:O,filename:"screenshot.jpg"})}Z.push(Z7(j));let K,Y=q1();if(Y){let O=await Q4(j.replay,Y.maxBytes,{quality:Y.canvas?.quality});if(K=O.summary,"dataUri"in O)Z.push({dataUri:O.dataUri,filename:O.filename})}let W=n2(j),B={title:$,description:X.trim()||void 0,appName:H0().name,category:z.module?.label,routeUrl:z.route.href,priority:"MEDIUM",requesterEmail:z.user.email??void 0,requesterName:z.user.fullName??void 0,customFields:{unit:z.user.unit??"",appVersion:z.app.version,environment:z.app.environment,reasonType:j.reason.type,appName:H0().name,module:z.module?.label??""},context:{...W?{signature:W}:{},capturedAt:z.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:z.client,performance:z.performance,apiHeaders:z.apiHeaders,extra:z.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...K?{replay:K}:{}},attachments:Z,...j.reason.fromChat?{fromChat:!0}:{}},F=await fetch(`${Q.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":Q.realmKey,...await Z4()},body:JSON.stringify(B)}).catch(()=>{throw new B0("report never left the browser","offline")});if(!F.ok)throw await K4(F);return await F.json()}async function K4($){let J=$.headers.get("retry-after"),Q=await $.json().then((j)=>j.error).catch(()=>null);if($.status===429)return new B0("rate limited","rateLimited",J??void 0);if(X7.has($.status))return new B0("desk unavailable","unavailable");return new B0(Q??`Report failed (${$.status})`,"rejected",void 0,$.status)}var e1=null,_1=null,X8=()=>R().host.replace(/\/$/,"");function $2(){return e1}function v0(){if(_1)return _1;return _1=(async()=>{try{let $=await fetch(`${X8()}/ingest/request-types`,{headers:{"x-realm-key":R().realmKey}}),J=$.ok?await $.json():null;e1=Array.isArray(J?.types)?J.types.filter(V7):[]}catch{e1=[],_1=null}return e1??[]})(),_1}function V7($){let J=$;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function Y4($){let J=R(),Q={};try{Q=J.user?.()??{}}catch{Q={}}let j=typeof window>"u"?null:window.location,z={title:$.title,description:$.description.trim()||void 0,ticketTypeId:$.ticketTypeId,appName:H0().name,category:j?p1(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:Q.email??void 0,requesterName:Q.fullName??void 0,attachments:$.screenshotDataUrl?[{dataUri:await s1($.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},X=await fetch(`${X8()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await Z4()},body:JSON.stringify(z)}).catch(()=>{throw new B0("request never left the browser","offline")});if(!X.ok)throw await K4(X);return await X.json()}var C1=Math.PI/6;function Z8($,J,Q){let j=J.x-$.x,z=J.y-$.y,X=Math.hypot(j,z),Z=Math.atan2(z,j),K=[{x:J.x,y:J.y},{x:J.x-Q*Math.cos(Z-C1),y:J.y-Q*Math.sin(Z-C1)},{x:J.x-Q*Math.cos(Z+C1),y:J.y-Q*Math.sin(Z+C1)}],Y=Q*Math.cos(C1)*0.92;if(X<=Y)return{shaft:null,head:K};return{shaft:{from:$,to:{x:J.x-Y*Math.cos(Z),y:J.y-Y*Math.sin(Z)}},head:K}}var W4="#f44336",K7="rgba(250, 204, 21, 0.4)",G4=22,V8="#2563eb",K8=9,Y8=11,W8=18,G8=4,J2=8,Y7=[{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 D4($,J,Q){let j=[],z=null,X=-1,Z=null,K=null,Y=$.getContext("2d");function W(){let V=$.getBoundingClientRect().width;return V>0?$.width/V:1}function B(V){let G=$.getBoundingClientRect();return{x:(V.clientX-G.left)/G.width*$.width,y:(V.clientY-G.top)/G.height*$.height}}function F(V){let G=V.size??G4;if(!Y)return(V.text?.length??0)*G*0.6;Y.save(),Y.font=`600 ${G}px system-ui, sans-serif`;let H=Y.measureText(V.text??"").width;return Y.restore(),H}function O(V){if(V.tool==="text"){let G=V.size??G4;return{left:V.x1,top:V.y1,right:V.x1+F(V),bottom:V.y1+G*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 N(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 G=O(V);if(V.tool==="text")return[{id:"size",x:G.right,y:G.bottom,cursor:"nwse-resize"}];return Y7.map((H)=>({id:H.id,x:G.left+(G.right-G.left)*H.fx,y:G.top+(G.bottom-G.top)*H.fy,cursor:H.cursor}))}function _(V){let G=O(V);return{x:G.right+W8*W(),y:G.top-W8*W()}}function A(V,G,H){let{shaft:D,head:q}=Z8({x:G.x1,y:G.y1},{x:G.x2,y:G.y2},Math.max(10,16*H));if(D)V.lineCap="butt",V.beginPath(),V.moveTo(D.from.x,D.from.y),V.lineTo(D.to.x,D.to.y),V.stroke();V.beginPath(),V.moveTo(q[0].x,q[0].y),V.lineTo(q[1].x,q[1].y),V.lineTo(q[2].x,q[2].y),V.closePath(),V.fill()}function P(V,G,H){V.save(),V.lineWidth=Math.max(2,3*H),V.strokeStyle=W4,V.fillStyle=W4;let D=O(G);if(G.tool==="rect")V.strokeRect(D.left,D.top,D.right-D.left,D.bottom-D.top);else if(G.tool==="arrow")A(V,G,H);else if(G.tool==="highlight")V.fillStyle=K7,V.fillRect(D.left,D.top,D.right-D.left,D.bottom-D.top);else if(G.tool==="text"&&G.text){let q=G.size??G4;V.font=`600 ${q}px system-ui, sans-serif`,V.textBaseline="top";let L=q*0.22;V.fillStyle="rgba(255,255,255,0.92)",V.fillRect(D.left-L,D.top-L,D.right-D.left+L*2,D.bottom-D.top+L*2),V.fillStyle=W4,V.fillText(G.text,D.left,D.top)}V.restore()}function U(V,G,H){let D=O(G);V.save(),V.strokeStyle=V8,V.lineWidth=Math.max(1,1.5*H),V.setLineDash([6*H,4*H]),V.strokeRect(D.left,D.top,D.right-D.left,D.bottom-D.top),V.setLineDash([]);let q=K8*H;for(let s of N(G))V.fillStyle="#fff",V.strokeStyle=V8,V.lineWidth=Math.max(1,1.5*H),V.beginPath(),V.rect(s.x-q/2,s.y-q/2,q,q),V.fill(),V.stroke();let L=_(G),v=Y8*H;V.beginPath(),V.arc(L.x,L.y,v,0,Math.PI*2),V.fillStyle="#dc2626",V.fill(),V.strokeStyle="#fff",V.lineWidth=Math.max(1.5,2*H),V.beginPath(),V.moveTo(L.x-v*0.4,L.y-v*0.4),V.lineTo(L.x+v*0.4,L.y+v*0.4),V.moveTo(L.x+v*0.4,L.y-v*0.4),V.lineTo(L.x-v*0.4,L.y+v*0.4),V.stroke(),V.restore()}function M(){if(!Y)return;let V=W();if(Y.clearRect(0,0,$.width,$.height),Y.drawImage(J,0,0,$.width,$.height),j.forEach((H,D)=>{if(D!==x)P(Y,H,V)}),Z)P(Y,Z,V);let G=j[X];if(G&&!Z)U(Y,G,V)}function y(V,G,H,D,q){return Math.abs(V-H)<=q&&Math.abs(G-D)<=q}function m(V,G){let H=j[X];if(!H)return null;let D=K8*W()/2+3*W();for(let q of N(H))if(y(V,G,q.x,q.y,D))return q.id;return null}function S(V,G){let H=j[X];if(!H)return!1;let D=_(H);return y(V,G,D.x,D.y,Y8*W())}function g(V,G){let H=6*W();for(let D=j.length-1;D>=0;D-=1){let q=j[D];if(q.tool==="arrow"){let v=q.x2-q.x1,s=q.y2-q.y1,U0=Math.hypot(v,s)||1,C=Math.max(0,Math.min(1,((V-q.x1)*v+(G-q.y1)*s)/(U0*U0)));if(Math.hypot(V-(q.x1+C*v),G-(q.y1+C*s))<=H+4*W())return D;continue}let L=O(q);if(V>=L.left-H&&V<=L.right+H&&G>=L.top-H&&G<=L.bottom+H)return D}return-1}function T(V,G,H,D,q){if(G==="tail"){V.x1=H.x1+D,V.y1=H.y1+q;return}if(G==="head"){V.x2=H.x2+D,V.y2=H.y2+q;return}if(G==="size"){let b=(H.size??24)+q;V.size=Math.max(10,b);return}let L=O(H),{left:v,top:s,right:U0,bottom:C}=L;if(G.includes("w"))v=Math.min(U0-J2,v+D);if(G.includes("e"))U0=Math.max(v+J2,U0+D);if(G.includes("n"))s=Math.min(C-J2,s+q);if(G.includes("s"))C=Math.max(s+J2,C+q);V.x1=v,V.y1=s,V.x2=U0,V.y2=C}function u(V,G,H,D){V.x1=G.x1+H,V.y1=G.y1+D,V.x2=G.x2+H,V.y2=G.y2+D}let I=null,x=-1,E={x:0,y:0,size:24};function p(){let V=$.getBoundingClientRect().width;return V>0?V/$.width:1}function i0(V,G){if(!Y)return V.length*G*0.6;Y.save(),Y.font=`600 ${G}px system-ui, sans-serif`;let H=Y.measureText(V||" ").width;return Y.restore(),H}function W0(){if(!I)return;let V=$.parentElement;if(!V)return;let G=$.getBoundingClientRect(),H=V.getBoundingClientRect(),D=p(),q=E.size*D;I.style.left=`${G.left-H.left+E.x*D}px`,I.style.top=`${G.top-H.top+E.y*D}px`,I.style.fontSize=`${q}px`,I.style.width=`${Math.max(40,i0(I.value,q)+q)}px`}function e(V){let G=I;if(!G)return;I=null;let H=G.value.trim(),D=x;if(x=-1,G.remove(),V&&H){if(D>=0&&j[D])j[D].text=H,X=D;else j.push({tool:"text",x1:E.x,y1:E.y,x2:E.x,y2:E.y,text:H,size:E.size}),X=j.length-1;Q()}else if(D>=0)X=D;$.focus(),M()}function o(V,G,H=-1){e(!0);let D=$.parentElement;if(!D)return;if(getComputedStyle(D).position==="static")D.style.position="relative";let q=H>=0?j[H]:void 0;x=H,E={x:q?.x1??V,y:q?.y1??G,size:q?.size??Math.round(24*W())};let L=document.createElement("input");L.type="text",L.className="text-edit",L.value=q?.text??"",L.setAttribute("aria-label","ข้อความบนภาพ"),L.placeholder="ข้อความ",I=L,D.append(L),W0(),L.addEventListener("input",W0),L.addEventListener("keydown",(v)=>{if(v.stopPropagation(),v.key==="Enter")e(!0);else if(v.key==="Escape")e(!1)}),requestAnimationFrame(()=>{if(I!==L)return;L.focus(),L.select(),L.addEventListener("blur",()=>e(!0))}),M()}function G0(V){let{x:G,y:H}=B(V);if($.setPointerCapture(V.pointerId),S(G,H)){D0();return}let D=m(G,H);if(D&&j[X]){K={grip:D,x:G,y:H,start:{...j[X]}};return}if(z==="text"){if(V.preventDefault(),$.hasPointerCapture(V.pointerId))$.releasePointerCapture(V.pointerId);z=null,Q(),o(G,H);return}if(z){Z={tool:z,x1:G,y1:H,x2:G,y2:H},X=-1;return}let q=g(G,H);X=q,K=q>=0?{grip:"body",x:G,y:H,start:{...j[q]}}:null,M()}function l0(V){let{x:G,y:H}=B(V);if(Z){Z.x2=G,Z.y2=H,M();return}if(K){let q=j[X];if(!q)return;let L=G-K.x,v=H-K.y;if(K.grip==="body")u(q,K.start,L,v);else T(q,K.grip,K.start,L,v);M();return}if(z){$.style.cursor="crosshair";return}if(S(G,H)){$.style.cursor="pointer";return}let D=m(G,H);if(D){let q=j[X]?N(j[X]).find((L)=>L.id===D):null;$.style.cursor=q?.cursor??"pointer";return}$.style.cursor=g(G,H)>=0?"move":"default"}function f0(){if(Z){if(!(Math.abs(Z.x2-Z.x1)<G8&&Math.abs(Z.y2-Z.y1)<G8))j.push(Z),X=j.length-1,z=null,Q();Z=null}if(K)K=null,Q();M()}function O0(V){let G=$.getBoundingClientRect(),H=(V.clientX-G.left)/G.width*$.width,D=(V.clientY-G.top)/G.height*$.height,q=g(H,D),L=j[q];if(!L||L.tool!=="text")return;V.preventDefault(),o(L.x1,L.y1,q)}function L0(V){if(X<0)return;if(V.key==="Delete"||V.key==="Backspace")V.preventDefault(),D0();else if(V.key==="Escape")V.preventDefault(),X=-1,M()}function D0(){if(X<0)return;j.splice(X,1),X=-1,Q(),M()}return $.addEventListener("pointerdown",G0),$.addEventListener("pointermove",l0),$.addEventListener("pointerup",f0),$.addEventListener("pointercancel",f0),$.addEventListener("dblclick",O0),$.tabIndex=0,$.addEventListener("keydown",L0),M(),{setTool(V){z=V,X=-1,$.style.cursor=V?"crosshair":"default",M()},deleteSelected:D0,clear(){j.length=0,X=-1,Q(),M()},hasShapes:()=>j.length>0,hasSelection:()=>X>=0,toDataUrl(){let V=document.createElement("canvas");V.width=J.naturalWidth,V.height=J.naturalHeight;let G=V.getContext("2d");if(!G)return $.toDataURL("image/png");G.drawImage(J,0,0);let H=W();for(let D of j)P(G,D,H);return V.toDataURL("image/png")},destroy(){e(!1),$.removeEventListener("pointerdown",G0),$.removeEventListener("pointermove",l0),$.removeEventListener("pointerup",f0),$.removeEventListener("pointercancel",f0),$.removeEventListener("dblclick",O0),$.removeEventListener("keydown",L0)}}}var W7=["keydown","keyup","keypress"];function J1($){for(let J of W7)$.addEventListener(J,(Q)=>Q.stopPropagation())}var D8=`
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",S0=null;function E9(J,$){if(J instanceof F0){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 k9(J){t6=J}var x9=[{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"}),J1(this.root),this.root.addEventListener("keydown",($)=>{let j=$;if(j.key!=="Escape"||j.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;j.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=m2(($)=>void this.open($))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open($){if(this.busy)return;this.busy=!0;let j=document.activeElement;this.returnFocus=j instanceof HTMLElement&&j!==document.body?j:null;let Q=a(C().locale),z=t1();if(z===null)g0();if($.type==="manual"&&z?.length){this.renderChooser(Q,$);return}await this.report($,Q)}renderChooser($,j){let Q=this.shell($);Q.classList.add("narrow"),Q.setAttribute("aria-label",$.chooseTitle);let z=f("div","head"),X=K0("✕","icon");X.setAttribute("aria-label",$.close),X.addEventListener("click",()=>this.close()),z.append(f("h2","",$.chooseTitle),X);let Z=a6("problem",y9,$.kindProblem,$.chooseProblemHint);Z.dataset.choose="problem",Z.addEventListener("click",()=>{this.root.replaceChildren(),this.report(j,$)});let K=a6("request",n6,$.kindRequest,$.chooseRequestHint);K.dataset.choose="request",K.addEventListener("click",()=>{this.bundle=B1({reason:j,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:X4()}),this.renderForm($,j,"request")});let W=f("div","kinds choose");W.append(Z,K),W.addEventListener("keydown",(G)=>{if(!o6.includes(G.key))return;G.preventDefault(),(this.root.activeElement===Z?K:Z).focus()}),Q.append(z,W),Z.focus()}async switchToReport($,j,Q){this.root.replaceChildren();let z=await o1();if(z.method==="cancelled"){this.renderForm($,j,"request",{...Q,asking:!0});return}this.bundle=B1({reason:j,note:"",screenshotDataUrl:z.dataUrl,screenshotMethod:z.method,erroredQueries:X4()}),this.renderForm($,j,"problem",Q)}async report($,j){let Q=await o1();if(Q.method==="cancelled"){this.close();return}this.bundle=B1({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:X4()}),this.renderForm(j,$,"problem")}close($=!1){if($)S0=null;else if(this.keep)S0=this.keep()??S0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let j=this.returnFocus;if(this.returnFocus=null,j?.isConnected)j.focus()}shell($){let j=document.createElement("style");j.textContent=r6;let Q=document.createElement("div");Q.className="backdrop";let z=document.createElement("div");return z.className="panel",z.setAttribute("role","dialog"),z.setAttribute("aria-modal","true"),z.setAttribute("aria-label",$.title),Q.append(z),this.root.replaceChildren(j,Q),z}renderShell($,j){let Q=this.shell($),z=f("div","head");z.append(f("h2","",$.title)),Q.append(z,f("p","status",j))}renderForm($,j,Q,z){let X=this.bundle;if(!X)return;let Z=this.shell($),K=Q,W=Q==="problem"||!!X.screenshotDataUrl,G=null,I=f("div","head"),B=f("h2","",$.title),O=K0("✕","icon");O.setAttribute("aria-label",$.close),O.addEventListener("click",()=>this.close()),I.append(B,O);let S=f("p","door");S.hidden=!0;let L=f("span"),h=K0("","link");h.dataset.switchKind="",h.addEventListener("click",()=>Y(K==="problem"?"request":"problem")),S.append(L,h);let N=f("div","ask");N.hidden=!0;let D=document.createElement("input");D.type="search",D.className="type-search",D.placeholder=$.requestTypeSearch,D.setAttribute("aria-label",$.requestTypeSearch),D.dataset.requestTypeSearch="",D.hidden=!0;let M=f("div","types");M.setAttribute("role","radiogroup"),M.setAttribute("aria-label",$.requestTypeLabel);let w=f("p","status",$.requestTypeNone);w.hidden=!0;let m=f("p","status type-count","");m.hidden=!0,N.append(J2($.requestTypeLabel,"",!0),D,M,w,m);let R=[],y=()=>{for(let v of R){let E=v.dataset.requestType===G?.id;v.setAttribute("aria-checked",String(E)),v.tabIndex=E?0:-1}let P=R.find((v)=>v.dataset.requestType===G?.id);if(P&&M.scrollHeight>M.clientHeight){let v=P.offsetTop-M.offsetTop;if(v<M.scrollTop)M.scrollTop=v;else if(v+P.offsetHeight>M.scrollTop+M.clientHeight)M.scrollTop=v+P.offsetHeight-M.clientHeight}},T=document.createElement("input");T.type="text";let u=J2(""),F=document.createElement("textarea"),k=J2(""),A=f("div","meta"),{context:p}=X,i0=`${X.network.length} network · ${X.console.length} console · ${X.actionTrail.length} actions${X.replay?` · ${$.replay} ${Math.round(X.replay.durationMs/1000)}s`:""}`,Y0=(P,v)=>{let E=document.createElement("div"),b=document.createElement("b");b.textContent=`${P}: `;let l=document.createTextNode(v);return E.append(b,l),A.append(E),{b,v:l}};Y0($.reporter,`${p.user.fullName??"—"} (${p.user.email??"—"})`),Y0($.page,p.route.href);let e=Y0($.captured,i0),o=document.createElement("label");o.className="shot-choice",o.hidden=!0;let G0=document.createElement("input");G0.type="checkbox",G0.checked=!0,G0.dataset.requestShot="",o.append(G0,document.createTextNode(` ${$.requestWithShot}`));let c0=X.screenshotDataUrl?this.screenshotSection($,X.screenshotDataUrl):[f("p","status",$.noScreenshot)],f0=X.screenshotDataUrl?c0[0]:null;if(!X.screenshotDataUrl)o.replaceChildren();let O0=f("p","status",""),L0=K0($.submit,"primary"),U0=()=>{L0.disabled=T.value.trim().length===0||K==="request"&&!G};T.addEventListener("input",U0);let V=()=>{let P=K==="request";if(B.textContent=P?$.requestTitle:$.title,Z.setAttribute("aria-label",P?$.requestTitle:$.title),L.textContent=`${P?$.problemInstead:$.askInstead} `,h.textContent=P?W?$.problemInsteadAction:$.problemInsteadShare:$.askInsteadAction,N.hidden=!P,$2(u,P?$.requestSummaryLabel:$.summaryLabel,P?"":$.summaryRequired,!0),T.placeholder=P?$.requestSummaryPlaceholder:$.summaryPlaceholder,$2(k,P?$.requestDetailLabel:$.detailLabel),F.placeholder=P?$.requestDetailPlaceholder:$.detailPlaceholder,e.b.textContent=`${P?$.requestLeaves:$.captured}: `,e.v.textContent=P?$.requestLeavesWhat:i0,o.hidden=!P||!X.screenshotDataUrl,f0)$2(f0,P?$.requestAnnotateHint:$.annotateHint);for(let v of c0)v.classList.toggle("dropped",P&&!G0.checked),v.hidden=P&&!X.screenshotDataUrl;L0.textContent=P?$.requestSubmit:$.submit,U0()};G0.addEventListener("change",V);let Y=(P)=>{if(P===K)return;if(P==="problem"&&!W){this.switchToReport($,j,{title:T.value,detail:F.value,asking:!1,typeId:G?.id??null});return}K=P,V()},H=(P)=>{if(this.bundle!==X||j.type!=="manual"||!P.length)return;G=P[0],R.length=0;for(let E of P){let b=K0("","type");b.setAttribute("role","radio"),b.dataset.requestType=E.id;let l=f("span","type-body");if(l.append(f("b","",E.name)),E.description)l.append(f("span","type-hint",E.description));if(E.targetHours){let l0=f("span","type-due");l0.append(j2(g9),document.createTextNode($.requestTarget.replace("{time}",w9($,E.targetHours)))),l.append(l0)}b.append(j2(n6),l),b.addEventListener("click",()=>{G=E,y(),U0()}),R.push(b)}M.replaceChildren(...R),M.onkeydown=(E)=>{if(!o6.includes(E.key)||!G)return;E.preventDefault();let b=P.filter((w0,B3)=>!R[B3].hidden);if(!b.length)return;let l=b.findIndex((w0)=>w0.id===G.id),l0=E.key==="ArrowUp"||E.key==="ArrowLeft"?-1:1;G=b[l<0?0:(l+l0+b.length)%b.length],y(),R.find((w0)=>w0.dataset.requestType===G.id)?.focus()},M.classList.toggle("long",P.length>=Z4),D.hidden=P.length<Z4;let v=(E)=>{m.hidden=P.length<Z4||E===0,m.textContent=$.requestTypeCount.replace("{n}",String(E))};v(P.length),D.oninput=()=>{let E=D.value.trim().toLowerCase(),b=null;if(P.forEach((l,l0)=>{let w0=!E||`${l.name} ${l.description}`.toLowerCase().includes(E);if(R[l0].hidden=!w0,w0&&!b)b=l}),w.hidden=!!b,v(R.filter((l)=>!l.hidden).length),b&&G&&R[P.indexOf(G)].hidden)G=b;y(),U0()},D.onkeydown=(E)=>{if(E.key==="ArrowDown"||E.key==="Enter")E.preventDefault(),R.find((b)=>b.dataset.requestType===G?.id&&!b.hidden)?.focus()},y(),S.hidden=!1,V()},U=z??(S0&&(S0.title||S0.detail)?S0:null),q=f("p","draft");if(q.hidden=!U||!!z,U){T.value=U.title,F.value=U.detail;let P=K0($.draftClear,"link");P.dataset.draftClear="",P.addEventListener("click",()=>{T.value="",F.value="",S0=null,q.hidden=!0,U0(),T.focus()}),q.append(document.createTextNode(`${$.draftRestored} · `),P)}let _=t1(),g=(P)=>{if(H(P),K!=="request"||S.hidden||!U?.typeId)return;let v=P.find((E)=>E.id===U.typeId);if(v)G=v,y()};if(_)g(_);else if(j.type==="manual")g0().then(g);this.keep=()=>({title:T.value,detail:F.value,asking:K==="request",typeId:G?.id??null}),Z.append(I,S,q,N,u,T,k,F,A,o,...c0);let s=f("div","foot"),D0=K0($.close);D0.addEventListener("click",()=>this.close()),s.append(D0,O0,f("span","grow"),L0),Z.append(s),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(K==="request"&&G){let b=await $4({ticketTypeId:G.id,title:T.value.trim(),description:F.value,screenshotDataUrl:G0.checked?P():null}),l=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:b,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),l)y0(`${$.requestSubmitted} — #${b.number}`,"success");return}let v=await e2(T.value.trim(),{...X,note:F.value,screenshotDataUrl:P()}),E=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:v,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),E)y0(`${$.submitted} — #${v.number}`,"success")}catch(v){let E=E9(v,$);O0.dataset.tone="error",O0.textContent=E,y0(E,"error"),U0()}}),T.focus()}screenshotSection($,j){let Q=J2($.annotateHint),z=f("div","tools"),X=document.createElement("canvas"),Z=f("div","shot");Z.append(X);let K=[],W=(O)=>{for(let S of K)S.setAttribute("aria-pressed",String(S===O))};for(let{tool:O,key:S}of x9){let L=K0($[S]);L.setAttribute("aria-pressed","false"),L.addEventListener("click",()=>{let h=L.getAttribute("aria-pressed")==="true";W(h?null:L),this.annotator?.setTool(h?null:O)}),K.push(L),z.append(L)}z.append(f("span","sep"));let G=K0($.deleteSelected);G.addEventListener("click",()=>this.annotator?.deleteSelected());let I=K0($.clearAll);I.addEventListener("click",()=>{this.annotator?.clear(),W(null)}),z.append(G,I);let B=new Image;return B.onload=()=>{X.width=B.naturalWidth,X.height=B.naturalHeight,this.annotator=z4(X,B,()=>{W(null),G.disabled=!this.annotator?.hasSelection()})},B.src=j,[Q,z,f("p","status",$.annotateHelp),Z]}}}function X4(){try{return t6()}catch{return[]}}function f(J,$="",j=""){let Q=document.createElement(J);if($)Q.className=$;if(j)Q.textContent=j;return Q}function w9(J,$){return $>=24&&$%24===0?J.days.replace("{n}",String($/24)):J.hours.replace("{n}",String($))}var o6=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],Z4=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,$,j,Q){let z=K0("","kind");z.dataset.kind=J;let X=f("span","kind-top");return X.append(j2($),f("b","",j)),z.append(X,f("span","kind-hint",Q),j2(v9,"tick")),z}function j2(J,$="icon"){let j=document.createElementNS(s6,"svg");for(let[Q,z]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:$}))j.setAttribute(Q,z);for(let[Q,z]of J){let X=document.createElementNS(s6,Q);for(let[Z,K]of Object.entries(z))X.setAttribute(Z,K);j.append(X)}return j}function K0(J,$=""){let j=document.createElement("button");if(j.type="button",j.textContent=J,$)j.className=$;return j}function J2(J,$="",j=!1){return $2(document.createElement("label"),J,$,j)}function $2(J,$,j="",Q=!1){if(J.replaceChildren(document.createTextNode($)),Q){let z=document.createElement("span");z.className="req",z.textContent=" *",J.append(z)}if(j){let z=document.createElement("span");z.className="hint",z.textContent=` ${j}`,J.append(z)}return J}function V4(){if(typeof window>"u"||customElements.get($1))return;customElements.define($1,f9())}var h9="lw-portal-handoff",e6=138.23,b9=`
192
+ `;var Q1="lw-debug-reporter",S0=null;function G7($,J){if($ instanceof B0){if($.kind==="offline")return J.failedOffline;if($.kind==="unavailable")return J.failedUnavailable;if($.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",$.retryAfter??"60");return $.message||J.failed}return J.failed}var M8=()=>[];function D7($){M8=$}var U7=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function H7(){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",(J)=>{let Q=J;if(Q.key!=="Escape"||Q.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;Q.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=p2((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let Q=document.activeElement;this.returnFocus=Q instanceof HTMLElement&&Q!==document.body?Q:null;let j=a(R().locale),z=$2();if(z===null)v0();if(J.type==="manual"&&z?.length){this.renderChooser(j,J);return}await this.report(J,j)}renderChooser(J,Q){let j=this.shell(J);j.classList.add("narrow"),j.setAttribute("aria-label",J.chooseTitle);let z=w("div","head"),X=K0("✕","icon");X.setAttribute("aria-label",J.close),X.addEventListener("click",()=>this.close()),z.append(w("h2","",J.chooseTitle),X);let Z=F8("problem",F7,J.kindProblem,J.chooseProblemHint);Z.dataset.choose="problem",Z.addEventListener("click",()=>{this.root.replaceChildren(),this.report(Q,J)});let K=F8("request",H8,J.kindRequest,J.chooseRequestHint);K.dataset.choose="request",K.addEventListener("click",()=>{this.bundle=B1({reason:Q,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:U4()}),this.renderForm(J,Q,"request")});let Y=w("div","kinds choose");Y.append(Z,K),Y.addEventListener("keydown",(W)=>{if(!U8.includes(W.key))return;W.preventDefault(),(this.root.activeElement===Z?K:Z).focus()}),j.append(z,Y),Z.focus()}async switchToReport(J,Q,j){this.root.replaceChildren();let z=await n1();if(z.method==="cancelled"){this.renderForm(J,Q,"request",{...j,asking:!0});return}this.bundle=B1({reason:Q,note:"",screenshotDataUrl:z.dataUrl,screenshotMethod:z.method,erroredQueries:U4()}),this.renderForm(J,Q,"problem",j)}async report(J,Q){let j=await n1();if(j.method==="cancelled"){this.close();return}this.bundle=B1({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:U4()}),this.renderForm(Q,J,"problem")}close(J=!1){if(J)S0=null;else if(this.keep)S0=this.keep()??S0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let Q=this.returnFocus;if(this.returnFocus=null,Q?.isConnected)Q.focus()}shell(J){let Q=document.createElement("style");Q.textContent=D8;let j=document.createElement("div");j.className="backdrop";let z=document.createElement("div");return z.className="panel",z.setAttribute("role","dialog"),z.setAttribute("aria-modal","true"),z.setAttribute("aria-label",J.title),j.append(z),this.root.replaceChildren(Q,j),z}renderShell(J,Q){let j=this.shell(J),z=w("div","head");z.append(w("h2","",J.title)),j.append(z,w("p","status",Q))}renderForm(J,Q,j,z){let X=this.bundle;if(!X)return;let Z=this.shell(J),K=j,Y=j==="problem"||!!X.screenshotDataUrl,W=null,B=w("div","head"),F=w("h2","",J.title),O=K0("✕","icon");O.setAttribute("aria-label",J.close),O.addEventListener("click",()=>this.close()),B.append(F,O);let N=w("p","door");N.hidden=!0;let _=w("span"),A=K0("","link");A.dataset.switchKind="",A.addEventListener("click",()=>G(K==="problem"?"request":"problem")),N.append(_,A);let P=w("div","ask");P.hidden=!0;let U=document.createElement("input");U.type="search",U.className="type-search",U.placeholder=J.requestTypeSearch,U.setAttribute("aria-label",J.requestTypeSearch),U.dataset.requestTypeSearch="",U.hidden=!0;let M=w("div","types");M.setAttribute("role","radiogroup"),M.setAttribute("aria-label",J.requestTypeLabel);let y=w("p","status",J.requestTypeNone);y.hidden=!0;let m=w("p","status type-count","");m.hidden=!0,P.append(Q2(J.requestTypeLabel,"",!0),U,M,y,m);let S=[],g=()=>{for(let b of S){let k=b.dataset.requestType===W?.id;b.setAttribute("aria-checked",String(k)),b.tabIndex=k?0:-1}let C=S.find((b)=>b.dataset.requestType===W?.id);if(C&&M.scrollHeight>M.clientHeight){let b=C.offsetTop-M.offsetTop;if(b<M.scrollTop)M.scrollTop=b;else if(b+C.offsetHeight>M.scrollTop+M.clientHeight)M.scrollTop=b+C.offsetHeight-M.clientHeight}},T=document.createElement("input");T.type="text";let u=Q2(""),I=document.createElement("textarea"),x=Q2(""),E=w("div","meta"),{context:p}=X,i0=`${X.network.length} network · ${X.console.length} console · ${X.actionTrail.length} actions${X.replay?` · ${J.replay} ${Math.round(X.replay.durationMs/1000)}s`:""}`,W0=(C,b)=>{let k=document.createElement("div"),h=document.createElement("b");h.textContent=`${C}: `;let l=document.createTextNode(b);return k.append(h,l),E.append(k),{b:h,v:l}};W0(J.reporter,`${p.user.fullName??"—"} (${p.user.email??"—"})`),W0(J.page,p.route.href);let e=W0(J.captured,i0),o=document.createElement("label");o.className="shot-choice",o.hidden=!0;let G0=document.createElement("input");G0.type="checkbox",G0.checked=!0,G0.dataset.requestShot="",o.append(G0,document.createTextNode(` ${J.requestWithShot}`));let l0=X.screenshotDataUrl?this.screenshotSection(J,X.screenshotDataUrl):[w("p","status",J.noScreenshot)],f0=X.screenshotDataUrl?l0[0]:null;if(!X.screenshotDataUrl)o.replaceChildren();let O0=w("p","status",""),L0=K0(J.submit,"primary"),D0=()=>{L0.disabled=T.value.trim().length===0||K==="request"&&!W};T.addEventListener("input",D0);let V=()=>{let C=K==="request";if(F.textContent=C?J.requestTitle:J.title,Z.setAttribute("aria-label",C?J.requestTitle:J.title),_.textContent=`${C?J.problemInstead:J.askInstead} `,A.textContent=C?Y?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,P.hidden=!C,j2(u,C?J.requestSummaryLabel:J.summaryLabel,C?"":J.summaryRequired,!0),T.placeholder=C?J.requestSummaryPlaceholder:J.summaryPlaceholder,j2(x,C?J.requestDetailLabel:J.detailLabel),I.placeholder=C?J.requestDetailPlaceholder:J.detailPlaceholder,e.b.textContent=`${C?J.requestLeaves:J.captured}: `,e.v.textContent=C?J.requestLeavesWhat:i0,o.hidden=!C||!X.screenshotDataUrl,f0)j2(f0,C?J.requestAnnotateHint:J.annotateHint);for(let b of l0)b.classList.toggle("dropped",C&&!G0.checked),b.hidden=C&&!X.screenshotDataUrl;L0.textContent=C?J.requestSubmit:J.submit,D0()};G0.addEventListener("change",V);let G=(C)=>{if(C===K)return;if(C==="problem"&&!Y){this.switchToReport(J,Q,{title:T.value,detail:I.value,asking:!1,typeId:W?.id??null});return}K=C,V()},H=(C)=>{if(this.bundle!==X||Q.type!=="manual"||!C.length)return;W=C[0],S.length=0;for(let k of C){let h=K0("","type");h.setAttribute("role","radio"),h.dataset.requestType=k.id;let l=w("span","type-body");if(l.append(w("b","",k.name)),k.description)l.append(w("span","type-hint",k.description));if(k.targetHours){let r0=w("span","type-due");r0.append(z2(M7),document.createTextNode(J.requestTarget.replace("{time}",q7(J,k.targetHours)))),l.append(r0)}h.append(z2(H8),l),h.addEventListener("click",()=>{W=k,g(),D0()}),S.push(h)}M.replaceChildren(...S),M.onkeydown=(k)=>{if(!U8.includes(k.key)||!W)return;k.preventDefault();let h=C.filter((w0,v3)=>!S[v3].hidden);if(!h.length)return;let l=h.findIndex((w0)=>w0.id===W.id),r0=k.key==="ArrowUp"||k.key==="ArrowLeft"?-1:1;W=h[l<0?0:(l+r0+h.length)%h.length],g(),S.find((w0)=>w0.dataset.requestType===W.id)?.focus()},M.classList.toggle("long",C.length>=H4),U.hidden=C.length<H4;let b=(k)=>{m.hidden=C.length<H4||k===0,m.textContent=J.requestTypeCount.replace("{n}",String(k))};b(C.length),U.oninput=()=>{let k=U.value.trim().toLowerCase(),h=null;if(C.forEach((l,r0)=>{let w0=!k||`${l.name} ${l.description}`.toLowerCase().includes(k);if(S[r0].hidden=!w0,w0&&!h)h=l}),y.hidden=!!h,b(S.filter((l)=>!l.hidden).length),h&&W&&S[C.indexOf(W)].hidden)W=h;g(),D0()},U.onkeydown=(k)=>{if(k.key==="ArrowDown"||k.key==="Enter")k.preventDefault(),S.find((h)=>h.dataset.requestType===W?.id&&!h.hidden)?.focus()},g(),N.hidden=!1,V()},D=z??(S0&&(S0.title||S0.detail)?S0:null),q=w("p","draft");if(q.hidden=!D||!!z,D){T.value=D.title,I.value=D.detail;let C=K0(J.draftClear,"link");C.dataset.draftClear="",C.addEventListener("click",()=>{T.value="",I.value="",S0=null,q.hidden=!0,D0(),T.focus()}),q.append(document.createTextNode(`${J.draftRestored} · `),C)}let L=$2(),v=(C)=>{if(H(C),K!=="request"||N.hidden||!D?.typeId)return;let b=C.find((k)=>k.id===D.typeId);if(b)W=b,g()};if(L)v(L);else if(Q.type==="manual")v0().then(v);this.keep=()=>({title:T.value,detail:I.value,asking:K==="request",typeId:W?.id??null}),Z.append(B,N,q,P,u,T,x,I,E,o,...l0);let s=w("div","foot"),U0=K0(J.close);U0.addEventListener("click",()=>this.close()),s.append(U0,O0,w("span","grow"),L0),Z.append(s),V(),L0.addEventListener("click",async()=>{L0.disabled=!0,O0.dataset.tone="",O0.textContent=J.submitting;let C=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():X.screenshotDataUrl;try{if(K==="request"&&W){let h=await Y4({ticketTypeId:W.id,title:T.value.trim(),description:I.value,screenshotDataUrl:G0.checked?C():null}),l=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:h,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),l)y0(`${J.requestSubmitted} — #${h.number}`,"success");return}let b=await V4(T.value.trim(),{...X,note:I.value,screenshotDataUrl:C()}),k=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:b,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),k)y0(`${J.submitted} — #${b.number}`,"success")}catch(b){let k=G7(b,J);O0.dataset.tone="error",O0.textContent=k,y0(k,"error"),D0()}}),T.focus()}screenshotSection(J,Q){let j=Q2(J.annotateHint),z=w("div","tools"),X=document.createElement("canvas"),Z=w("div","shot");Z.append(X);let K=[],Y=(O)=>{for(let N of K)N.setAttribute("aria-pressed",String(N===O))};for(let{tool:O,key:N}of U7){let _=K0(J[N]);_.setAttribute("aria-pressed","false"),_.addEventListener("click",()=>{let A=_.getAttribute("aria-pressed")==="true";Y(A?null:_),this.annotator?.setTool(A?null:O)}),K.push(_),z.append(_)}z.append(w("span","sep"));let W=K0(J.deleteSelected);W.addEventListener("click",()=>this.annotator?.deleteSelected());let B=K0(J.clearAll);B.addEventListener("click",()=>{this.annotator?.clear(),Y(null)}),z.append(W,B);let F=new Image;return F.onload=()=>{X.width=F.naturalWidth,X.height=F.naturalHeight,this.annotator=D4(X,F,()=>{Y(null),W.disabled=!this.annotator?.hasSelection()})},F.src=Q,[j,z,w("p","status",J.annotateHelp),Z]}}}function U4(){try{return M8()}catch{return[]}}function w($,J="",Q=""){let j=document.createElement($);if(J)j.className=J;if(Q)j.textContent=Q;return j}function q7($,J){return J>=24&&J%24===0?$.days.replace("{n}",String(J/24)):$.hours.replace("{n}",String(J))}var U8=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],H4=7,F7=[["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"}]],H8=[["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"}]],M7=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],P7=[["path",{d:"M20 6 9 17l-5-5"}]],q8="http://www.w3.org/2000/svg";function F8($,J,Q,j){let z=K0("","kind");z.dataset.kind=$;let X=w("span","kind-top");return X.append(z2(J),w("b","",Q)),z.append(X,w("span","kind-hint",j),z2(P7,"tick")),z}function z2($,J="icon"){let Q=document.createElementNS(q8,"svg");for(let[j,z]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:J}))Q.setAttribute(j,z);for(let[j,z]of $){let X=document.createElementNS(q8,j);for(let[Z,K]of Object.entries(z))X.setAttribute(Z,K);Q.append(X)}return Q}function K0($,J=""){let Q=document.createElement("button");if(Q.type="button",Q.textContent=$,J)Q.className=J;return Q}function Q2($,J="",Q=!1){return j2(document.createElement("label"),$,J,Q)}function j2($,J,Q="",j=!1){if($.replaceChildren(document.createTextNode(J)),j){let z=document.createElement("span");z.className="req",z.textContent=" *",$.append(z)}if(Q){let z=document.createElement("span");z.className="hint",z.textContent=` ${Q}`,$.append(z)}return $}function q4(){if(typeof window>"u"||customElements.get(Q1))return;customElements.define(Q1,H7())}var B7="lw-portal-handoff",P8=138.23,N7=`
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: ${e6}; stroke-dashoffset: 0;
222
+ stroke-dasharray: ${P8}; stroke-dashoffset: 0;
223
223
  animation: deplete var(--secs, 3s) linear forwards;
224
224
  }
225
- @keyframes deplete { to { stroke-dashoffset: ${e6}; } }
225
+ @keyframes deplete { to { stroke-dashoffset: ${P8}; } }
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 J8(J){if(typeof document>"u")return J.prepare().then((D)=>void J.go(D),()=>{return});let $=a(C().locale),j=Math.max(1,Math.floor(J.seconds??3)),Q=document.createElement(h9),z=Q.attachShadow({mode:"open"});J1(z);let X=document.createElement("style");X.textContent=b9,z.append(X);let Z=document.createElement("div");Z.className="backdrop",Z.innerHTML=`
269
+ `;function B8($){if(typeof document>"u")return $.prepare().then((U)=>void $.go(U),()=>{return});let J=a(R().locale),Q=Math.max(1,Math.floor($.seconds??3)),j=document.createElement(B7),z=j.attachShadow({mode:"open"});J1(z);let X=document.createElement("style");X.textContent=N7,z.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>`,z.append(Z);let K=(D)=>Z.querySelector(D),W=K(".card"),G=K(".bar"),I=K(".count"),B=K("h2"),O=K(".body"),S=K(".host"),L=K(".go"),h=K(".cancel");B.textContent=$.handoffTitle,O.textContent=$.handoffBody;try{S.textContent=new URL(C().host).host}catch{S.textContent=""}L.textContent=$.handoffGo,h.textContent=$.cancel,W.style.setProperty("--secs",`${j}s`),I.textContent=String(j),document.body.append(Q),requestAnimationFrame(()=>Z.setAttribute("data-open","1"));let N=document.activeElement;return L.focus({preventScroll:!0}),new Promise((D)=>{let M=!1,w=null,m=!1,R=Date.now()+j*1000,y=window.setInterval(()=>{let A=Math.ceil((R-Date.now())/1000);if(I.textContent=String(Math.max(0,A)),Date.now()>=R)F()},100);function T(A){if(M)return;if(M=!0,window.clearInterval(y),document.removeEventListener("keydown",k,!0),Z.removeAttribute("data-open"),window.setTimeout(()=>Q.remove(),200),!A)N?.focus?.({preventScroll:!0});D()}function u(A){window.clearInterval(y),G.classList.remove("spinner"),G.style.animation="none",I.textContent="",B.textContent=$.handoffBlocked,O.textContent=$.handoffBody;let p=document.createElement("a");p.className="go",p.href=A,p.target="_blank",p.rel="noopener noreferrer",p.textContent=$.handoffOpen,p.addEventListener("click",()=>T(!0)),L.replaceWith(p),p.focus({preventScroll:!0})}function F(){if(M||m)return;if(w)return J.go(w)?T(!0):u(w);window.clearInterval(y),I.textContent="",G.classList.add("spinner"),B.textContent=$.handoffPreparing}function k(A){if(A.key==="Escape")A.stopPropagation(),T(!1)}document.addEventListener("keydown",k,!0),L.addEventListener("click",F),h.addEventListener("click",()=>T(!1)),Z.addEventListener("click",(A)=>{if(A.target===Z)T(!1)}),J.prepare().then((A)=>{if(w=A,!M&&Date.now()>=R)F()},()=>{m=!0,window.clearInterval(y),W.classList.add("error"),G.classList.remove("spinner"),G.style.animation="none",I.textContent="",B.textContent=$.handoffFailed,O.textContent=$.handoffBody,L.remove(),h.textContent=$.close})})}var m9="/sso";function j8(J,$,j,Q){let z=new URL(m9,J.endsWith("/")?J:`${J}/`);if(z.searchParams.set("realm",$),z.searchParams.set("token",j),Q)z.searchParams.set("return",Q);return z.toString()}class Q2 extends Error{constructor(J="No identity provider is configured, or nobody is signed in"){super(J);this.name="NoIdentityError"}}async function K4(J){let $=C();if(!$.identity)throw new Q2;let j=await $.identity();if(!j)throw new Q2;return j8($.host,$.realmKey,j,J)}var Q8=K4;function $8(J,$){if($==="_self")return window.location.assign(J),!0;let j=window.open(J,"_blank");if(!j)return!1;try{j.opener=null}catch{}return!0}async function W4(J={}){if(J.announce===!1){$8(await K4(J.returnTo),J.target);return}await J8({seconds:J.seconds,prepare:()=>K4(J.returnTo),go:($)=>$8($,J.target)})}var z2='"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 X2(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=`
285
+ </div>`,z.append(Z);let K=(U)=>Z.querySelector(U),Y=K(".card"),W=K(".bar"),B=K(".count"),F=K("h2"),O=K(".body"),N=K(".host"),_=K(".go"),A=K(".cancel");F.textContent=J.handoffTitle,O.textContent=J.handoffBody;try{N.textContent=new URL(R().host).host}catch{N.textContent=""}_.textContent=J.handoffGo,A.textContent=J.cancel,Y.style.setProperty("--secs",`${Q}s`),B.textContent=String(Q),document.body.append(j),requestAnimationFrame(()=>Z.setAttribute("data-open","1"));let P=document.activeElement;return _.focus({preventScroll:!0}),new Promise((U)=>{let M=!1,y=null,m=!1,S=Date.now()+Q*1000,g=window.setInterval(()=>{let E=Math.ceil((S-Date.now())/1000);if(B.textContent=String(Math.max(0,E)),Date.now()>=S)I()},100);function T(E){if(M)return;if(M=!0,window.clearInterval(g),document.removeEventListener("keydown",x,!0),Z.removeAttribute("data-open"),window.setTimeout(()=>j.remove(),200),!E)P?.focus?.({preventScroll:!0});U()}function u(E){window.clearInterval(g),W.classList.remove("spinner"),W.style.animation="none",B.textContent="",F.textContent=J.handoffBlocked,O.textContent=J.handoffBody;let p=document.createElement("a");p.className="go",p.href=E,p.target="_blank",p.rel="noopener noreferrer",p.textContent=J.handoffOpen,p.addEventListener("click",()=>T(!0)),_.replaceWith(p),p.focus({preventScroll:!0})}function I(){if(M||m)return;if(y)return $.go(y)?T(!0):u(y);window.clearInterval(g),B.textContent="",W.classList.add("spinner"),F.textContent=J.handoffPreparing}function x(E){if(E.key==="Escape")E.stopPropagation(),T(!1)}document.addEventListener("keydown",x,!0),_.addEventListener("click",I),A.addEventListener("click",()=>T(!1)),Z.addEventListener("click",(E)=>{if(E.target===Z)T(!1)}),$.prepare().then((E)=>{if(y=E,!M&&Date.now()>=S)I()},()=>{m=!0,window.clearInterval(g),Y.classList.add("error"),W.classList.remove("spinner"),W.style.animation="none",B.textContent="",F.textContent=J.handoffFailed,O.textContent=J.handoffBody,_.remove(),A.textContent=J.close})})}var _7="/sso";function _8($,J,Q,j){let z=new URL(_7,$.endsWith("/")?$:`${$}/`);if(z.searchParams.set("realm",J),z.searchParams.set("token",Q),j)z.searchParams.set("return",j);return z.toString()}class X2 extends Error{constructor($="No identity provider is configured, or nobody is signed in"){super($);this.name="NoIdentityError"}}async function F4($){let J=R();if(!J.identity)throw new X2;let Q=await J.identity();if(!Q)throw new X2;return _8(J.host,J.realmKey,Q,$)}var C8=F4;function N8($,J){if(J==="_self")return window.location.assign($),!0;let Q=window.open($,"_blank");if(!Q)return!1;try{Q.opener=null}catch{}return!0}async function M4($={}){if($.announce===!1){N8(await F4($.returnTo),$.target);return}await B8({seconds:$.seconds,prepare:()=>F4($.returnTo),go:(J)=>N8(J,$.target)})}var Z2='"Inter Variable", "Noto Sans Thai Variable", "IBM Plex Sans Thai", -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif';function C7($){let J=($??"").trim();return!J||/^(?:"?Times New Roman"?|"?Times"?|serif)$/i.test(J)?"":J}function V2($){if(!$||typeof document>"u"||!document.body)return;let J="";try{J=C7(getComputedStyle(document.body).fontFamily)}catch{}if(J)$.style.setProperty("--lw-host-font",J);else $.style.removeProperty("--lw-host-font")}var I7="lw-call-ring",O7=`
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, ${z2});
292
+ font-family: var(--lw-host-font, ${Z2});
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>`,z8=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"/>'),i9=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"/>'),c9=V2('<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'),l9=V2('<path d="M21 12a9 9 0 1 1-6.219-8.56"/>').replace("<svg ",'<svg class="spin" '),r=null,N0=null,j1=null;function r9(J,$,j){if($.chatId)return j??$.ticketTitle;return J.replace("{key}",$.ticketKey).replace("{title}",$.ticketTitle)}var Q1=()=>a(C().locale);function o9(){if(typeof document>"u")return null;if(r?.isConnected)return r.shadowRoot;r=document.createElement(p9),r.dataset.debugReporter="true",X2(r);let J=r.attachShadow({mode:"open"});return J1(J),document.body.append(r),J}function Z2(J,$,j,Q){let z=document.createElement("button");return z.type="button",z.className=J,z.innerHTML=$,z.dataset.lwRing=j,z.onclick=Q,z}var C1=(J)=>{let $=document.createElement("span");return $.textContent=J,$.outerHTML};function Z8(J,$,j,Q,z){let X=Q1();J.innerHTML="";let Z=document.createElement("style");Z.textContent=d9;let K=document.createElement("div");K.className="card",K.setAttribute("role","alertdialog"),K.setAttribute("aria-label",X.ringTitle),K.dataset.lwCallRing=$.id,K.dataset.lwRingMode=Q;let W=document.createElement("div");W.className="head";let G=document.createElement("span");G.className="icon",G.innerHTML=z8;let I=document.createElement("div");I.className="words";let B=document.createElement("h2");B.textContent=X.ringTitle;let O=document.createElement("p");O.className="about",O.textContent=r9(X.ringAbout,$,X.ringChat),O.title=O.textContent,I.append(B,O),W.append(G,I);let S=document.createElement("p");S.className="how",S.textContent=z??(Q==="frame"?X.ringHint:X.ringHow);let L=document.createElement("div");L.className="actions";let h=Z2("decline",i9+C1(X.ringDecline),"decline",()=>j.decline());if(K.append(W,S),Q==="frame"&&j.answer){if(j.voice)K.append(Z2("test",c9+C1(X.ringTest),"test",()=>j.voice?.()));let N=Z2("answer",z8+C1(X.ringAnswer),"answer",()=>j.answer?.());L.append(h,N)}else L.append(h,Z2("open",C1(X.ringOpen),"open",()=>j.open()));K.append(L),J.append(Z,K)}function K2(J,$,j="portal"){if(N0===J.id&&r?.isConnected)return;let Q=o9();if(!Q)return;if(N0=J.id,Z8(Q,J,$,j),n9(),j1===null)j1=document.title,document.title=`${Q1().ringTab} — ${j1}`}function V8(J){let $=r?.shadowRoot;if(!$||N0!==J)return;let j=$.querySelector(".answer");if(j)j.innerHTML=l9+C1(Q1().ringAnswering),j.disabled=!0;let Q=$.querySelector(".decline");if(Q)Q.disabled=!0}function K8(J,$){let j=r?.isConnected?r.shadowRoot:null;if(!j||N0!==J.id)return K2(J,$,"portal");r.style.display="",Z8(j,J,$,"portal",Q1().ringFallback)}function W2(J){let $=r?.shadowRoot;if(!$)return;G4(),G8();let j=Q1(),Q=$.querySelector(".how"),z=$.querySelector(".actions");if(Q)if(Q.textContent="",J){let X=document.createElement("a");X.href=J,X.target="_blank",X.rel="noopener",X.textContent=j.ringBlocked,X.dataset.lwRing="link",X.onclick=()=>window.setTimeout(()=>W2(),0),Q.append(X)}else Q.textContent=j.ringOpened;if(z){z.innerHTML="";let X=document.createElement("button");X.type="button",X.className="close",X.textContent=j.ringClose,X.dataset.lwRing="close",X.onclick=()=>v0(),z.append(X)}}function W8(J,$=!0){if(!r?.isConnected||N0!==J)return;let j=r;if(clearTimeout(X8),!$){j.style.display="",j.style.opacity="";return}j.style.transition="opacity 150ms ease-out",j.style.opacity="0",X8=setTimeout(()=>{if(j.style.opacity==="0")j.style.display="none"},160)}var X8;function v0(J){if(J&&N0&&J!==N0)return;G4(),G8(),r?.remove(),r=null,N0=null}function Y8(){return r?.isConnected?N0:null}function G8(){if(j1===null||typeof document>"u")return;if(document.title.startsWith(Q1().ringTab))document.title=j1;j1=null}var T0=null,Y4;function n9(){G4();let J=window,$=J.AudioContext??J.webkitAudioContext;if(!$)return;try{let Q=T0??new $;T0=Q,Q.resume?.().catch(()=>{return})}catch{return}let j=()=>{if(!T0||T0.state!=="running")return;let Q=T0.currentTime;for(let[z,X]of[660,880].entries()){let Z=T0.createOscillator(),K=T0.createGain();Z.frequency.value=X,K.gain.setValueAtTime(0.0001,Q+z*0.22),K.gain.exponentialRampToValueAtTime(0.08,Q+z*0.22+0.02),K.gain.exponentialRampToValueAtTime(0.0001,Q+z*0.22+0.2),Z.connect(K).connect(T0.destination),Z.start(Q+z*0.22),Z.stop(Q+z*0.22+0.21)}};j(),Y4=setInterval(j,2200)}function G4(){clearInterval(Y4),Y4=void 0}var s9=64,a9=3500,t9=700,e9=450,J7=900,$7=20000,q8={pen:"#ef4444",rect:"#f59e0b",laser:"#ef4444"};var j7=/^[A-Za-z0-9_-]{1,32}$/,Q7=/^#[0-9a-fA-F]{6}$/,z7=["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 j=[];for(let Q of J){if(!Array.isArray(Q)||Q.length!==2)return null;let[z,X]=Q;if(typeof z!=="number"||typeof X!=="number"||!Number.isFinite(z)||!Number.isFinite(X))return null;j.push([U8(z),U8(X)])}return j}function I1(J){if(!J||typeof J!=="object")return null;let $=J;if($.op==="clear")return{op:"clear"};if(typeof $.id!=="string"||!j7.test($.id))return null;if($.op==="end")return{op:"end",id:$.id};if($.op==="add"){let j=D8($.pts,1);return j?{op:"add",id:$.id,pts:j}:null}if($.op==="begin"){if(!z7.includes($.kind)||typeof $.color!=="string"||!Q7.test($.color))return null;let j=D8($.pts,1);return j?{op:"begin",id:$.id,kind:$.kind,color:$.color,pts:j}:null}return null}function U4(J,$){if(J.endedAt!==null)return J.endedAt;return $-J.lastAt>20000?J.lastAt:null}function D4(J,$,j){if($===null)return 1;let Q=j-$;if(J==="laser")return Q>=900?0:1-Q/900;if(Q<=3500)return 1;return Math.max(0,1-(Q-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(([Q,z])=>({x:Q,y:z,t:$})),endedAt:null,lastAt:$});return}let j=this.marks.get(J.id);if(!j||U4(j,$)!==null)return;if(J.op==="end"){j.endedAt=$;return}if(j.lastAt=$,j.kind==="rect"){let[Q,z]=J.pts[J.pts.length-1];j.pts=[j.pts[0],{x:Q,y:z,t:$}];return}for(let[Q,z]of J.pts)j.pts.push({x:Q,y:z,t:$});if(j.pts.length>4000)j.pts.splice(0,j.pts.length-4000)}alive(J=Date.now()){for(let[$,j]of this.marks)if(D4(j.kind,U4(j,J),J)<=0)this.marks.delete($);return this.marks.size>0}get size(){return this.marks.size}draw(J,$,j,Q=Date.now()){J.clearRect(0,0,$,j);let z=Math.max(1,Math.min($,j));for(let X of this.marks.values()){let Z=D4(X.kind,U4(X,Q),Q);if(Z<=0||!X.pts.length)continue;if(J.save(),J.lineCap="round",J.lineJoin="round",X.kind==="pen")Z7(J,X,$,j,Math.max(3,z*0.0045),Z);else if(X.kind==="rect")V7(J,X,$,j,Math.max(2.5,z*0.003),Z);else K7(J,X,$,j,Math.max(6,z*0.008),Z,Q);J.restore()}}}function X7(J,$,j,Q){if(J.beginPath(),J.moveTo($[0].x*j,$[0].y*Q),$.length===1){J.lineTo($[0].x*j+0.01,$[0].y*Q);return}for(let X=1;X<$.length-1;X++){let Z=$[X],K=$[X+1];J.quadraticCurveTo(Z.x*j,Z.y*Q,(Z.x+K.x)/2*j,(Z.y+K.y)/2*Q)}let z=$[$.length-1];J.lineTo(z.x*j,z.y*Q)}function Z7(J,$,j,Q,z,X){J.globalAlpha=X,X7(J,$.pts,j,Q),J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=z+3,J.stroke(),J.strokeStyle=$.color,J.lineWidth=z,J.stroke()}function V7(J,$,j,Q,z,X){let Z=$.pts[0],K=$.pts[$.pts.length-1],W=Math.min(Z.x,K.x)*j,G=Math.min(Z.y,K.y)*Q,I=Math.abs(K.x-Z.x)*j,B=Math.abs(K.y-Z.y)*Q;J.globalAlpha=X,J.fillStyle=$.color,J.globalAlpha=X*0.14,J.fillRect(W,G,I,B),J.globalAlpha=X,J.strokeStyle="rgba(255,255,255,0.92)",J.lineWidth=z+3,J.strokeRect(W,G,I,B),J.strokeStyle=$.color,J.lineWidth=z,J.strokeRect(W,G,I,B)}function K7(J,$,j,Q,z,X,Z){let K=$.pts.filter((G)=>Z-G.t<=450);for(let G=1;G<K.length;G++){let I=K[G-1],B=K[G];J.globalAlpha=X*Math.max(0,1-(Z-B.t)/450)*0.7,J.strokeStyle=$.color,J.lineWidth=z*0.9,J.beginPath(),J.moveTo(I.x*j,I.y*Q),J.lineTo(B.x*j,B.y*Q),J.stroke()}let W=$.pts[$.pts.length-1];J.globalAlpha=X,J.shadowColor=$.color,J.shadowBlur=z*2,J.fillStyle=$.color,J.beginPath(),J.arc(W.x*j,W.y*Q,z,0,Math.PI*2),J.fill(),J.shadowBlur=0,J.strokeStyle="rgba(255,255,255,0.95)",J.lineWidth=2,J.stroke()}function M8(J,$,j,Q=typeof window>"u"?1:window.devicePixelRatio||1){let z=Math.max(1,Math.round($*Q)),X=Math.max(1,Math.round(j*Q));if(J.width!==z)J.width=z;if(J.height!==X)J.height=X;let Z=J.getContext("2d");return Z?.setTransform(Q,0,0,Q,0,0),Z}class G2{canvas;scene;box;frame=0;constructor(J,$,j){this.canvas=J;this.scene=$;this.box=j}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let J=()=>{this.frame=0;let{w:$,h:j}=this.box(),Q=M8(this.canvas,$,j),z=Date.now(),X=this.scene.alive(z);if(Q)this.scene.draw(Q,$,j,z);if(X)this.frame=requestAnimationFrame(J)};this.frame=requestAnimationFrame(J)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var P8=33,H4=5000,H8=0.0012,W7=0,Y7=()=>`${Date.now().toString(36)}${(W7++).toString(36)}${Math.random().toString(36).slice(2,6)}`.slice(0,32);class B8{send;scene;onChange;id=null;kind=null;pending=[];last=null;lastSent=0;timer;keep;constructor(J,$,j=()=>{return}){this.send=J;this.scene=$;this.onChange=j}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 j={op:"begin",id:this.id,kind:J,color:q8[J],pts:[$]};this.scene.apply(j),this.send(j),this.keep=setInterval(()=>this.stillHere(),H4),this.onChange()}stillHere(){if(!this.id||!this.last||Date.now()-this.lastSent<H4)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,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 G7="lw-call-ink",A0=null,U2=null,O1=null;function U7(){if(A0?.isConnected&&O1)return;A0=document.createElement(G7),A0.dataset.debugReporter="true";let J=A0.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 j=document.createElement("canvas");j.setAttribute("aria-hidden","true"),j.dataset.lwCallInk="",J.append($,j),document.body.append(A0),U2=new Y2,O1=new G2(j,U2,()=>({w:window.innerWidth,h:window.innerHeight}))}function D2(J){if(typeof document>"u")return;if(J.op==="clear"&&!A0)return;U7(),U2.apply(J),O1.kick()}function H2(){O1?.stop(),A0?.remove(),A0=null,U2=null,O1=null}var D7="lw-call-frame",H7="lw-call",X0=16,F4=368,q0=null,c=null,h0=null,P2="",R1=null,S1="card",N4={width:F4,height:0},_4,T1=!1,C4=null,X1={answer:!1,voice:!1},E0=null,J0=null,q4="lw-call-frame-place";function F8(J,$,j,Q){let z=new URL("embed/call",J.endsWith("/")?J:`${J}/`);if(z.searchParams.set("realm",$),j)z.searchParams.set("token",j);else z.searchParams.set("hand","1");return z.searchParams.set("call",Q),z.toString()}function z1(J){c?.contentWindow?.postMessage({source:"lw-call-host",...J},P2)}function N8(J){if(h0!==J)return;if(X1.answer=!0,T1)z1({type:"answer"})}function _8(J){if(h0!==J)return;if(X1.voice=!0,T1)z1({type:"voice"})}function C8(J,$,j){return{x:Math.min(Math.max(J.x,X0/2),Math.max(X0/2,j.w-$.w-X0/2)),y:Math.min(Math.max(J.y,X0/2),Math.max(X0/2,j.h-$.h-X0/2))}}function q7(J,$){if(J.origin!==$.origin||J.source!==$.window)return null;let j=J.data;return j&&typeof j==="object"&&j.source===H7&&typeof j.type==="string"?j:null}function V1(){return q0?.isConnected?h0:null}function I8(J,$,j,Q=15000,z=null){if(typeof document>"u")return;if(h0===$&&q0?.isConnected)return;K1(),h0=$,R1=j,T1=!1,C4=z,X1={answer:!1,voice:!1},S1="card",N4={width:F4,height:0},P2=new URL(J).origin;try{E0=JSON.parse(sessionStorage.getItem(q4)??"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; }
336
+ `,Y2=($)=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${$}</svg>`,I8=Y2('<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"/>'),L7=Y2('<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"/>'),R7=Y2('<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'),S7=Y2('<path d="M21 12a9 9 0 1 1-6.219-8.56"/>').replace("<svg ",'<svg class="spin" '),r=null,N0=null,j1=null;function A7($,J,Q){if(J.chatId)return Q??J.ticketTitle;return $.replace("{key}",J.ticketKey).replace("{title}",J.ticketTitle)}var z1=()=>a(R().locale);function T7(){if(typeof document>"u")return null;if(r?.isConnected)return r.shadowRoot;r=document.createElement(I7),r.dataset.debugReporter="true",V2(r);let $=r.attachShadow({mode:"open"});return J1($),document.body.append(r),$}function K2($,J,Q,j){let z=document.createElement("button");return z.type="button",z.className=$,z.innerHTML=J,z.dataset.lwRing=Q,z.onclick=j,z}var I1=($)=>{let J=document.createElement("span");return J.textContent=$,J.outerHTML};function L8($,J,Q,j,z){let X=z1();$.innerHTML="";let Z=document.createElement("style");Z.textContent=O7;let K=document.createElement("div");K.className="card",K.setAttribute("role","alertdialog"),K.setAttribute("aria-label",X.ringTitle),K.dataset.lwCallRing=J.id,K.dataset.lwRingMode=j;let Y=document.createElement("div");Y.className="head";let W=document.createElement("span");W.className="icon",W.innerHTML=I8;let B=document.createElement("div");B.className="words";let F=document.createElement("h2");F.textContent=X.ringTitle;let O=document.createElement("p");O.className="about",O.textContent=A7(X.ringAbout,J,X.ringChat),O.title=O.textContent,B.append(F,O),Y.append(W,B);let N=document.createElement("p");N.className="how",N.textContent=z??(j==="frame"?X.ringHint:X.ringHow);let _=document.createElement("div");_.className="actions";let A=K2("decline",L7+I1(X.ringDecline),"decline",()=>Q.decline());if(K.append(Y,N),j==="frame"&&Q.answer){if(Q.voice)K.append(K2("test",R7+I1(X.ringTest),"test",()=>Q.voice?.()));let P=K2("answer",I8+I1(X.ringAnswer),"answer",()=>Q.answer?.());_.append(A,P)}else _.append(A,K2("open",I1(X.ringOpen),"open",()=>Q.open()));K.append(_),$.append(Z,K)}function W2($,J,Q="portal"){if(N0===$.id&&r?.isConnected)return;let j=T7();if(!j)return;if(N0=$.id,L8(j,$,J,Q),E7(),j1===null)j1=document.title,document.title=`${z1().ringTab} — ${j1}`}function R8($){let J=r?.shadowRoot;if(!J||N0!==$)return;let Q=J.querySelector(".answer");if(Q)Q.innerHTML=S7+I1(z1().ringAnswering),Q.disabled=!0;let j=J.querySelector(".decline");if(j)j.disabled=!0}function S8($,J){let Q=r?.isConnected?r.shadowRoot:null;if(!Q||N0!==$.id)return W2($,J,"portal");r.style.display="",L8(Q,$,J,"portal",z1().ringFallback)}function G2($){let J=r?.shadowRoot;if(!J)return;B4(),E8();let Q=z1(),j=J.querySelector(".how"),z=J.querySelector(".actions");if(j)if(j.textContent="",$){let X=document.createElement("a");X.href=$,X.target="_blank",X.rel="noopener",X.textContent=Q.ringBlocked,X.dataset.lwRing="link",X.onclick=()=>window.setTimeout(()=>G2(),0),j.append(X)}else j.textContent=Q.ringOpened;if(z){z.innerHTML="";let X=document.createElement("button");X.type="button",X.className="close",X.textContent=Q.ringClose,X.dataset.lwRing="close",X.onclick=()=>b0(),z.append(X)}}function A8($,J=!0){if(!r?.isConnected||N0!==$)return;let Q=r;if(clearTimeout(O8),!J){Q.style.display="",Q.style.opacity="";return}Q.style.transition="opacity 150ms ease-out",Q.style.opacity="0",O8=setTimeout(()=>{if(Q.style.opacity==="0")Q.style.display="none"},160)}var O8;function b0($){if($&&N0&&$!==N0)return;B4(),E8(),r?.remove(),r=null,N0=null}function T8(){return r?.isConnected?N0:null}function E8(){if(j1===null||typeof document>"u")return;if(document.title.startsWith(z1().ringTab))document.title=j1;j1=null}var A0=null,P4;function E7(){B4();let $=window,J=$.AudioContext??$.webkitAudioContext;if(!J)return;try{let j=A0??new J;A0=j,j.resume?.().catch(()=>{return})}catch{return}let Q=()=>{if(!A0||A0.state!=="running")return;let j=A0.currentTime;for(let[z,X]of[660,880].entries()){let Z=A0.createOscillator(),K=A0.createGain();Z.frequency.value=X,K.gain.setValueAtTime(0.0001,j+z*0.22),K.gain.exponentialRampToValueAtTime(0.08,j+z*0.22+0.02),K.gain.exponentialRampToValueAtTime(0.0001,j+z*0.22+0.2),Z.connect(K).connect(A0.destination),Z.start(j+z*0.22),Z.stop(j+z*0.22+0.21)}};Q(),P4=setInterval(Q,2200)}function B4(){clearInterval(P4),P4=void 0}var k7=64,x7=3500,f7=700,w7=450,y7=900,g7=20000,w8={pen:"#ef4444",rect:"#f59e0b",laser:"#ef4444"};var v7=/^[A-Za-z0-9_-]{1,32}$/,b7=/^#[0-9a-fA-F]{6}$/,h7=["pen","rect","laser"],k8=($)=>$<0?0:$>1?1:$;function x8($,J){if(!Array.isArray($)||$.length<J||$.length>64)return null;let Q=[];for(let j of $){if(!Array.isArray(j)||j.length!==2)return null;let[z,X]=j;if(typeof z!=="number"||typeof X!=="number"||!Number.isFinite(z)||!Number.isFinite(X))return null;Q.push([k8(z),k8(X)])}return Q}function O1($){if(!$||typeof $!=="object")return null;let J=$;if(J.op==="clear")return{op:"clear"};if(typeof J.id!=="string"||!v7.test(J.id))return null;if(J.op==="end")return{op:"end",id:J.id};if(J.op==="add"){let Q=x8(J.pts,1);return Q?{op:"add",id:J.id,pts:Q}:null}if(J.op==="begin"){if(!h7.includes(J.kind)||typeof J.color!=="string"||!b7.test(J.color))return null;let Q=x8(J.pts,1);return Q?{op:"begin",id:J.id,kind:J.kind,color:J.color,pts:Q}:null}return null}function N4($,J){if($.endedAt!==null)return $.endedAt;return J-$.lastAt>20000?$.lastAt:null}function _4($,J,Q){if(J===null)return 1;let j=Q-J;if($==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class D2{marks=new Map;apply($,J=Date.now()){if($.op==="clear"){this.marks.clear();return}if($.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete($.id),this.marks.set($.id,{kind:$.kind,color:$.color,pts:$.pts.map(([j,z])=>({x:j,y:z,t:J})),endedAt:null,lastAt:J});return}let Q=this.marks.get($.id);if(!Q||N4(Q,J)!==null)return;if($.op==="end"){Q.endedAt=J;return}if(Q.lastAt=J,Q.kind==="rect"){let[j,z]=$.pts[$.pts.length-1];Q.pts=[Q.pts[0],{x:j,y:z,t:J}];return}for(let[j,z]of $.pts)Q.pts.push({x:j,y:z,t:J});if(Q.pts.length>4000)Q.pts.splice(0,Q.pts.length-4000)}alive($=Date.now()){for(let[J,Q]of this.marks)if(_4(Q.kind,N4(Q,$),$)<=0)this.marks.delete(J);return this.marks.size>0}get size(){return this.marks.size}draw($,J,Q,j=Date.now()){$.clearRect(0,0,J,Q);let z=Math.max(1,Math.min(J,Q));for(let X of this.marks.values()){let Z=_4(X.kind,N4(X,j),j);if(Z<=0||!X.pts.length)continue;if($.save(),$.lineCap="round",$.lineJoin="round",X.kind==="pen")u7($,X,J,Q,Math.max(3,z*0.0045),Z);else if(X.kind==="rect")p7($,X,J,Q,Math.max(2.5,z*0.003),Z);else d7($,X,J,Q,Math.max(6,z*0.008),Z,j);$.restore()}}}function m7($,J,Q,j){if($.beginPath(),$.moveTo(J[0].x*Q,J[0].y*j),J.length===1){$.lineTo(J[0].x*Q+0.01,J[0].y*j);return}for(let X=1;X<J.length-1;X++){let Z=J[X],K=J[X+1];$.quadraticCurveTo(Z.x*Q,Z.y*j,(Z.x+K.x)/2*Q,(Z.y+K.y)/2*j)}let z=J[J.length-1];$.lineTo(z.x*Q,z.y*j)}function u7($,J,Q,j,z,X){$.globalAlpha=X,m7($,J.pts,Q,j),$.strokeStyle="rgba(255,255,255,0.92)",$.lineWidth=z+3,$.stroke(),$.strokeStyle=J.color,$.lineWidth=z,$.stroke()}function p7($,J,Q,j,z,X){let Z=J.pts[0],K=J.pts[J.pts.length-1],Y=Math.min(Z.x,K.x)*Q,W=Math.min(Z.y,K.y)*j,B=Math.abs(K.x-Z.x)*Q,F=Math.abs(K.y-Z.y)*j;$.globalAlpha=X,$.fillStyle=J.color,$.globalAlpha=X*0.14,$.fillRect(Y,W,B,F),$.globalAlpha=X,$.strokeStyle="rgba(255,255,255,0.92)",$.lineWidth=z+3,$.strokeRect(Y,W,B,F),$.strokeStyle=J.color,$.lineWidth=z,$.strokeRect(Y,W,B,F)}function d7($,J,Q,j,z,X,Z){let K=J.pts.filter((W)=>Z-W.t<=450);for(let W=1;W<K.length;W++){let B=K[W-1],F=K[W];$.globalAlpha=X*Math.max(0,1-(Z-F.t)/450)*0.7,$.strokeStyle=J.color,$.lineWidth=z*0.9,$.beginPath(),$.moveTo(B.x*Q,B.y*j),$.lineTo(F.x*Q,F.y*j),$.stroke()}let Y=J.pts[J.pts.length-1];$.globalAlpha=X,$.shadowColor=J.color,$.shadowBlur=z*2,$.fillStyle=J.color,$.beginPath(),$.arc(Y.x*Q,Y.y*j,z,0,Math.PI*2),$.fill(),$.shadowBlur=0,$.strokeStyle="rgba(255,255,255,0.95)",$.lineWidth=2,$.stroke()}function y8($,J,Q,j=typeof window>"u"?1:window.devicePixelRatio||1){let z=Math.max(1,Math.round(J*j)),X=Math.max(1,Math.round(Q*j));if($.width!==z)$.width=z;if($.height!==X)$.height=X;let Z=$.getContext("2d");return Z?.setTransform(j,0,0,j,0,0),Z}class U2{canvas;scene;box;frame=0;constructor($,J,Q){this.canvas=$;this.scene=J;this.box=Q}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let $=()=>{this.frame=0;let{w:J,h:Q}=this.box(),j=y8(this.canvas,J,Q),z=Date.now(),X=this.scene.alive(z);if(j)this.scene.draw(j,J,Q,z);if(X)this.frame=requestAnimationFrame($)};this.frame=requestAnimationFrame($)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var g8=33,C4=5000,f8=0.0012,c7=0,i7=()=>`${Date.now().toString(36)}${(c7++).toString(36)}${Math.random().toString(36).slice(2,6)}`.slice(0,32);class v8{send;scene;onChange;id=null;kind=null;pending=[];last=null;lastSent=0;timer;keep;constructor($,J,Q=()=>{return}){this.send=$;this.scene=J;this.onChange=Q}get drawing(){return this.id?this.kind:null}begin($,J){this.end(),this.id=i7(),this.kind=$,this.last=J,this.lastSent=Date.now();let Q={op:"begin",id:this.id,kind:$,color:w8[$],pts:[J]};this.scene.apply(Q),this.send(Q),this.keep=setInterval(()=>this.stillHere(),C4),this.onChange()}stillHere(){if(!this.id||!this.last||Date.now()-this.lastSent<C4)return;this.flush();let $={op:"add",id:this.id,pts:[this.last]};this.scene.apply($),this.send($),this.lastSent=Date.now()}move($){if(!this.id||!this.kind)return;if(Date.now()-this.lastSent>1e4)return this.begin(this.kind,$);if(this.last&&Math.abs($[0]-this.last[0])<f8&&Math.abs($[1]-this.last[1])<f8)return;if(this.last=$,this.scene.apply({op:"add",id:this.id,pts:[$]}),this.onChange(),this.kind==="rect")this.pending=[$];else this.pending.push($);if(this.pending.length>=64)this.flush();else if(!this.timer)this.timer=setTimeout(()=>this.flush(),Math.max(0,g8-(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 $={op:"end",id:this.id};this.scene.apply($),this.send($),this.id=null,this.kind=null,this.last=null,this.onChange()}clear(){this.end();let $={op:"clear"};this.scene.apply($),this.send($),this.onChange()}}var l7="lw-call-ink",T0=null,H2=null,L1=null;function r7(){if(T0?.isConnected&&L1)return;T0=document.createElement(l7),T0.dataset.debugReporter="true";let $=T0.attachShadow({mode:"open"}),J=document.createElement("style");J.textContent=`:host { all: initial; }
337
+ canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let Q=document.createElement("canvas");Q.setAttribute("aria-hidden","true"),Q.dataset.lwCallInk="",$.append(J,Q),document.body.append(T0),H2=new D2,L1=new U2(Q,H2,()=>({w:window.innerWidth,h:window.innerHeight}))}function q2($){if(typeof document>"u")return;if($.op==="clear"&&!T0)return;r7(),H2.apply($),L1.kick()}function F2(){L1?.stop(),T0?.remove(),T0=null,H2=null,L1=null}var o7="lw-call-frame",n7="lw-call",X0=16,S4=368,q0=null,i=null,h0=null,B2="",S1=null,A1="card",A4={width:S4,height:0},T4,T1=!1,E4=null,Z1={answer:!1,voice:!1},E0=null,$0=null,I4="lw-call-frame-place";function b8($,J,Q,j){let z=new URL("embed/call",$.endsWith("/")?$:`${$}/`);if(z.searchParams.set("realm",J),Q)z.searchParams.set("token",Q);else z.searchParams.set("hand","1");return z.searchParams.set("call",j),z.toString()}function X1($){i?.contentWindow?.postMessage({source:"lw-call-host",...$},B2)}function h8($){if(h0!==$)return;if(Z1.answer=!0,T1)X1({type:"answer"})}function m8($){if(h0!==$)return;if(Z1.voice=!0,T1)X1({type:"voice"})}function u8($,J,Q){return{x:Math.min(Math.max($.x,X0/2),Math.max(X0/2,Q.w-J.w-X0/2)),y:Math.min(Math.max($.y,X0/2),Math.max(X0/2,Q.h-J.h-X0/2))}}function s7($,J){if($.origin!==J.origin||$.source!==J.window)return null;let Q=$.data;return Q&&typeof Q==="object"&&Q.source===n7&&typeof Q.type==="string"?Q:null}function K1(){return q0?.isConnected?h0:null}function p8($,J,Q,j=15000,z=null){if(typeof document>"u")return;if(h0===J&&q0?.isConnected)return;Y1(),h0=J,S1=Q,T1=!1,E4=z,Z1={answer:!1,voice:!1},A1="card",A4={width:S4,height:0},B2=new URL($).origin;try{E0=JSON.parse(sessionStorage.getItem(I4)??"null")}catch{E0=null}q0=document.createElement(o7),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; }`,c=document.createElement("iframe"),c.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",c.title="สายจากทีมงาน",c.dataset.lwCallFrame=$,c.setAttribute("allowtransparency","true"),c.src=J,X.append(Z,c),document.body.append(q0),Z1(),window.addEventListener("message",O8),window.addEventListener("resize",Z1),I4(`lw-call:${$}`),_4=setTimeout(()=>{if(!T1)M4("timeout")},Q)}function K1(){if(q0)I4(P4?.handle??null,P4?.readableBy);H2(),clearTimeout(_4),window.removeEventListener("message",O8),window.removeEventListener("resize",Z1),q2(!1),q0?.remove(),q0=null,c=null,h0=null,R1=null,J0=null,C4=null,X1={answer:!1,voice:!1}}function M4(J){let $=R1;K1(),$?.failed(J)}function O8(J){if(!c)return;let $=q7(J,{origin:P2,window:c.contentWindow});if(!$)return;switch($.type){case"hello":C4?.then((j)=>{if(!c||h0===null)return;if(j)z1({type:"token",token:j});else M4("no_token")});return;case"ready":if(T1=!0,clearTimeout(_4),c.classList.add("on"),R1?.ready(),X1.answer)z1({type:"answer"});if(X1.voice)z1({type:"voice"});return;case"size":if(typeof $.width==="number"&&typeof $.height==="number")N4={width:$.width,height:$.height};if($.layout==="card"||$.layout==="full"){if($.layout==="full"&&S1==="card")M7();S1=$.layout}return Z1();case"drag":return B4($);case"home":return E0=null,R8(),Z1();case"done":{let j=R1;K1(),j?.done();return}case"failed":return M4($.reason??"failed");case"ink":{let j=I1($.op);if(j)D2(j);return}}}function I4(J,$=P2){let j=typeof navigator>"u"?void 0:navigator.mediaDevices;try{j?.setCaptureHandleConfig?.(J&&$?{handle:J,exposeOrigin:!1,permittedOrigins:[$]}:{})}catch{}}var P4=null;function L8(J,$){if(P4={handle:J,readableBy:$},!q0?.isConnected)I4(J,$)}function B4(J){if(!c||S1!=="card"||typeof J.x!=="number"||typeof J.y!=="number")return;if(J.phase==="start"){let $=c.getBoundingClientRect();J0={sx:J.x,sy:J.y,x:$.left,y:$.top,lx:J.x,ly:J.y},q2(!0);return}if(!J0)return;if(J0.lx=J.x,J0.ly=J.y,E0=C8({x:J0.x+(J.x-J0.sx),y:J0.y+(J.y-J0.sy)},S8(),M2()),Z1(),J.phase==="end")J0=null,q2(!1),R8()}var L1=null;function q2(J){if(L1){for(let $ of["pointermove","pointerup","pointercancel"])window.removeEventListener($,L1,!0);L1=null}if(!J)return;L1=($)=>{if(!J0)return q2(!1);if($.type==="pointermove"&&$.buttons!==0)return B4({type:"drag",phase:"move",x:$.screenX,y:$.screenY});let j=$.type==="pointerup";B4({type:"drag",phase:"end",x:j?$.screenX:J0.lx,y:j?$.screenY:J0.ly})};for(let $ of["pointermove","pointerup","pointercancel"])window.addEventListener($,L1,!0)}function M7(){if(!c?.contentWindow)return;let J=c.getBoundingClientRect();z1({type:"corner",x:Math.round(J.left),y:Math.round(J.top),width:Math.round(J.width)})}function R8(){try{if(E0)sessionStorage.setItem(q4,JSON.stringify(E0));else sessionStorage.removeItem(q4)}catch{}}var M2=()=>({w:window.innerWidth,h:window.innerHeight});function S8(){let J=M2();return{w:Math.min(F4,J.w-X0),h:Math.min(N4.height||0,J.h-X0)}}function Z1(){if(!c)return;let J=c.style;if(S1==="full"){Object.assign(J,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let $=S8(),j=M2().w<480;if(J.width=j?`calc(100vw - ${X0}px)`:`${$.w}px`,J.height=`${$.h}px`,E0&&!j){let Q=C8(E0,$,M2());Object.assign(J,{left:`${Q.x}px`,top:`${Q.y}px`,right:"",bottom:""})}else Object.assign(J,{left:j?`${X0/2}px`:"",top:"",right:j?"":`${X0/2}px`,bottom:`calc(${X0/2}px + var(--lw-chat-lift, 0px))`})}var B2=[2000,5000,15000,30000,60000],T8=new Set(["ringing","active"]),P7=20000,O4=!1,b0=!1,A8=0,B7=5,E1=null,y8=0,F2,L4,R4,g8=(J)=>J.endsWith("/")?J:`${J}/`;function F7(J,$){let j=new URL("api/presence/ws",g8(J));return j.protocol=j.protocol==="https:"?"wss:":"ws:",j.searchParams.set("t",$),j.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=()=>C().ring!==!1;async function m0(){let J=C().identity;if(!J)return null;try{return await J()??null}catch{return null}}async function k4(J,$){let j=C();return fetch(new URL(J,g8(j.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":j.realmKey,authorization:`Bearer ${$}`},body:"{}"})}function _2(){if(O4||typeof window>"u"||typeof WebSocket>"u")return;let J=C();if(!J.identity||J.ring===!1&&!J.chat)return;O4=!0,b0=!1,O7(J.host);try{L8(`lw-tab:${b8()}`,new URL(J.host).origin)}catch{}h8()}function C7(){b0=!0,O4=!1,clearTimeout(L4),clearInterval(F2),clearTimeout(R4);try{E1?.close(1000,"bye")}catch{}E1=null,v0(),K1()}function A1(J=!1){if(b0)return;let $=J?B2[B2.length-1]:B2[Math.min(y8++,B2.length-1)];clearTimeout(L4),L4=setTimeout(()=>void h8(),$)}async function h8(){if(b0)return;let J=await m0();if(!J){if(++A8>=B7){b0=!0;return}return A1(!0)}A8=0;let $;try{$=await k4(C().chat?"ingest/live-ticket?chat=1":"ingest/live-ticket",J)}catch{return A1()}if($.status===401||$.status===404||$.status===403){b0=!0;return}if(!$.ok)return A1($.status===429);let j;try{j=await $.json()}catch{return A1()}if(!j.ticket){b0=!0;return}if(j.calls&&j.call&&E8())w8(j.call);let Q=new WebSocket(F7(C().host,j.ticket));E1=Q,Q.onopen=()=>{y8=0,Q.send(JSON.stringify({type:"tab",id:b8()})),clearInterval(F2),F2=setInterval(()=>{if(Q.readyState===WebSocket.OPEN)Q.send(JSON.stringify({type:"ping"}))},P7)},Q.onmessage=(z)=>{try{let X=JSON.parse(String(z.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)E4=X.call,D2(Z)}}catch{}},Q.onclose=()=>{if(clearInterval(F2),E1===Q)E1=null;A1()}}var T4="lw-call-framed";function I7(){try{return sessionStorage.getItem(T4)}catch{return null}}function N2(J){try{if(J)sessionStorage.setItem(T4,J);else sessionStorage.removeItem(T4)}catch{}}var k8=!1;function O7(J){if(k8||typeof document>"u")return;k8=!0;try{let $=new URL(J).origin;for(let j of["dns-prefetch","preconnect"]){let Q=document.createElement("link");if(Q.rel=j,Q.href=$,j==="preconnect")Q.crossOrigin="anonymous";Q.dataset.debugReporter="true",document.head.append(Q)}}catch{}}function x8(J){let $=C();if($.callFrame===!1||V1()===J.id)return;N2(J.id),I8(F8($.host,$.realmKey,null,J.id),J.id,{ready:()=>W8(J.id),done:()=>{N2(null),v0(J.id)},failed:()=>{N2(null),K8(J,A4(J))}},15000,m0())}var A4=(J)=>({open:()=>L7(J),decline:()=>void R7(J)}),k0=null;function b8(){if(k0)return k0;try{k0=sessionStorage.getItem(f8)}catch{}if(!k0||!/^[A-Za-z0-9_-]{8,40}$/.test(k0)){let J=new Uint8Array(12);crypto.getRandomValues(J),k0=Array.from(J,($)=>$.toString(16).padStart(2,"0")).join("");try{sessionStorage.setItem(f8,k0)}catch{}}return k0}var f8="lw-tab-id",E4=null;function w8(J){if(!T8.has(J.status)&&E4===J.id&&V1()!==J.id)E4=null,H2();if(!_7(J)){if(v0(J.id),J.status==="active"&&I7()===J.id&&!V1())x8(J);if(!T8.has(J.status)&&V1()===J.id)setTimeout(()=>{if(V1()===J.id)K1(),N2(null)},12000);return}if(C().callFrame===!1)K2(J,A4(J),"portal");else K2(J,{...A4(J),answer:()=>{V8(J.id),N8(J.id)},voice:()=>_8(J.id)},"frame"),x8(J);clearTimeout(R4);let $=new Date(J.ringUntil).getTime()-Date.now();R4=setTimeout(()=>{if(Y8()===J.id)v0(J.id)},Math.max(5000,$+5000))}function L7(J){let $=window.open("about:blank","_blank");(async()=>{let j=await m0();if(j)k4(`ingest/calls/${J.id}/coming`,j).catch(()=>{return});let Q;try{Q=await Q8(N7(J))}catch{$?.close();return}if($&&!$.closed){$.location.href=Q;try{$.opener=null}catch{}W2()}else W2(Q)})()}async function R7(J){v0(J.id);let $=await m0();if($)await k4(`ingest/calls/${J.id}/decline`,$).catch(()=>{return})}function x4(J,$,j,Q){let z=[];for(let X of J){if(X.right<=$.left||X.left>=$.right||X.bottom<=X.top)continue;z.push([j-X.bottom-8-Q,j-X.top+8])}return z.sort((X,Z)=>X[0]-Z[0])}function m8(J,$,j,Q){if(Q<j)return null;let z=(W)=>$.some(([G,I])=>W>G&&W<I),X=(W)=>Math.min(Math.max(W,j),Q),Z=X(J);if(!z(Z))return Z;let K=[j,Q,...$.flatMap(([W,G])=>[W,G])].map(X).filter((W)=>!z(W));if(!K.length)return null;return K.reduce((W,G)=>{let I=Math.abs(G-Z),B=Math.abs(W-Z);return I<B||I===B&&G>W?G:W})}var S7=3;function d8(J,$,j,Q,z,X,Z=null){let K=new Map,W=(N,D)=>{let M=`${N}:${D}`;if(!K.has(M))K.set(M,$(N,D));return K.get(M)},G=(N,D)=>N==="right"?{left:j.w-D-Q,right:j.w-D}:{left:D,right:D+Q},I=(N,D)=>x4(W(N,D),G(N,D),j.h,Q),B=(N)=>Math.abs(N.y-J.y)+Math.abs(N.x-J.x)+(N.side===J.side?0:160),O=(N)=>m8(N.y,I(N.side,N.x),z,X)===N.y,S=(N)=>Z&&(Z.side!==N.side||Z.x!==N.x||Z.y!==N.y)&&B(Z)<=B(N)+48&&O(Z)?Z:N;if(O(J))return S(J);let L=null,h=J.side==="right"?"left":"right";for(let N of[J.side,h]){let D=N===J.side?0:160;if(L&&D>=B(L))break;let M=J.x;for(let w=0;w<=S7;w++){let m=m8(J.y,I(N,M),z,X);if(m!==null&&(!L||B({side:N,x:M,y:m})<B(L)))L={side:N,x:M,y:m};let R=G(N,M),y={top:j.h-J.y-Q-8,bottom:j.h-J.y+8},T=W(N,M).filter((F)=>F.top<y.bottom&&F.bottom>y.top&&F.left<R.right&&F.right>R.left);if(!T.length)break;let u=Math.round(N==="right"?Math.max(...T.map((F)=>j.w-F.left+8)):Math.max(...T.map((F)=>F.right+8)));if(u<=M||u+Q>j.w/2||L&&D+u-J.x>=B(L))break;M=u}}return L?S(L):J}function T7(J){if(typeof J!=="string"||!J.startsWith("/")||J.length>200)return null;let j=(J.length>1?J.replace(/\/+$/,""):"").split(/(\*\*|\*)/).map((Q)=>Q==="**"?".*":Q==="*"?"[^/]*":Q.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join("");try{return new RegExp(`^${j}(?:/.*)?$`)}catch{return null}}function i8(J,$){let j=null;for(let Q of $??[]){let z=T7(Q.path);if(!z||!z.test(J))continue;if(!j||Q.path.replace(/\*/g,"").length>j.path.replace(/\*/g,"").length)j=Q}return j}var u8=/^LW-/,A7='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)/,E7='button:disabled,input:disabled,select:disabled,textarea:disabled,[aria-disabled="true"]';function c8(J,$,j={}){if(typeof document>"u"||typeof document.elementsFromPoint!=="function")return J.map(()=>[]);let Q=j.step??16,z=document.documentElement,X=document.body,Z=new Map,K=(D)=>Z.get(D)??(Z.set(D,getComputedStyle(D)),Z.get(D)),W=$.w*$.h,G=(D)=>D.width*D.height>0.34*W||D.width>=$.w*0.9&&D.height>=$.h*0.9,I=(D)=>{let M=K(D);return p8.test(M.overflowY)&&D.scrollHeight>D.clientHeight+1||p8.test(M.overflowX)&&D.scrollWidth>D.clientWidth+1},B=document.scrollingElement??z,O=B.scrollHeight>B.clientHeight+1&&K(z).overflowY!=="hidden"&&(!X||K(X).overflowY!=="hidden"),S=(D,M)=>{let w={top:0,bottom:$.h};for(let T=D.parentElement;T&&T!==z&&T!==X;T=T.parentElement){let u=K(T);if(u.overflowY!=="visible"&&u.overflowY!=="clip"){let F=T.getBoundingClientRect();w={top:F.top,bottom:F.bottom};break}}let m=D.getBoundingClientRect(),R=parseFloat(M.top),y=parseFloat(M.bottom);return!Number.isNaN(y)&&m.bottom>=w.bottom-y-1||!Number.isNaN(R)&&m.top<=w.top+R+1},L=(D)=>{let M=null,w=!1,m=1;for(let R=D;R&&R!==z&&R!==X;R=R.parentElement){let y=K(R),T=parseFloat(y.opacity);if(!Number.isNaN(T))m*=T;if(y.position==="fixed"||y.position==="sticky"&&S(R,y)){M=R;break}if(R!==D&&I(R))w=!0}if(!M&&O)w=!0;return{float:M,scrolled:w,opacity:m}},h=new Map,N=(D,M)=>{let w=document.elementFromPoint(D,M);if(!w||!u8.test(w.tagName))return w;return document.elementsFromPoint(D,M).find((m)=>!u8.test(m.tagName))??null};return J.map((D)=>{let M=new Set,w=new Set,m=[],R=(u)=>{if(w.has(u))return;w.add(u);let F=u.getBoundingClientRect();if(F.width>0&&F.height>0)m.push({top:F.top,bottom:F.bottom,left:F.left,right:F.right})},y=new Set,T=[D.left+6,(D.left+D.right)/2,D.right-6];for(let u=Q/2;u<$.h;u+=Q)for(let F of T){let k=N(F,u);if(!k||k===z||k===X||M.has(k))continue;if(M.add(k),j.extra){let o=null;try{o=k.closest(j.extra)}catch{o=null}if(o){R(o);continue}}let{float:A,scrolled:p,opacity:i0}=h.get(k)??(h.set(k,L(k)),h.get(k));if(i0<0.05)continue;let Y0=k.closest(A7),e=Y0&&(!A||A.contains(Y0))?Y0:null;if(A&&!G(A.getBoundingClientRect())){let o=e??k;if(!G(o.getBoundingClientRect()))R(o);continue}if(!p&&(A||!O))y.add(A);if(p||!e||G(e.getBoundingClientRect()))continue;R(e)}for(let u of y)for(let F of(u??X)?.querySelectorAll(E7)??[]){let k=F.getBoundingClientRect();if(!k.width||!k.height||k.right<=D.left||k.left>=D.right||G(k)||K(F).visibility==="hidden")continue;let A=h.get(F)??(h.set(F,L(F)),h.get(F));if(A.float!==u||A.scrolled||A.opacity<0.05)continue;let p=N(Math.min(Math.max((k.left+k.right)/2,D.left+6),D.right-6),(k.top+k.bottom)/2);if(p&&p!==F&&!F.contains(p)&&!p.contains(F))continue;R(F)}return m})}var k7="lw-support-chat",x7="lw-support-frame",f7="lw-support-host",d=56,p0=12,w7='<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>',y7=`
339
+ iframe.on { visibility: visible; }`,i=document.createElement("iframe"),i.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",i.title="สายจากทีมงาน",i.dataset.lwCallFrame=J,i.setAttribute("allowtransparency","true"),i.src=$,X.append(Z,i),document.body.append(q0),V1(),window.addEventListener("message",d8),window.addEventListener("resize",V1),k4(`lw-call:${J}`),T4=setTimeout(()=>{if(!T1)O4("timeout")},j)}function Y1(){if(q0)k4(L4?.handle??null,L4?.readableBy);F2(),clearTimeout(T4),window.removeEventListener("message",d8),window.removeEventListener("resize",V1),M2(!1),q0?.remove(),q0=null,i=null,h0=null,S1=null,$0=null,E4=null,Z1={answer:!1,voice:!1}}function O4($){let J=S1;Y1(),J?.failed($)}function d8($){if(!i)return;let J=s7($,{origin:B2,window:i.contentWindow});if(!J)return;switch(J.type){case"hello":E4?.then((Q)=>{if(!i||h0===null)return;if(Q)X1({type:"token",token:Q});else O4("no_token")});return;case"ready":if(T1=!0,clearTimeout(T4),i.classList.add("on"),S1?.ready(),Z1.answer)X1({type:"answer"});if(Z1.voice)X1({type:"voice"});return;case"size":if(typeof J.width==="number"&&typeof J.height==="number")A4={width:J.width,height:J.height};if(J.layout==="card"||J.layout==="full"){if(J.layout==="full"&&A1==="card")a7();A1=J.layout}return V1();case"drag":return R4(J);case"home":return E0=null,i8(),V1();case"done":{let Q=S1;Y1(),Q?.done();return}case"failed":return O4(J.reason??"failed");case"ink":{let Q=O1(J.op);if(Q)q2(Q);return}}}function k4($,J=B2){let Q=typeof navigator>"u"?void 0:navigator.mediaDevices;try{Q?.setCaptureHandleConfig?.($&&J?{handle:$,exposeOrigin:!1,permittedOrigins:[J]}:{})}catch{}}var L4=null;function c8($,J){if(L4={handle:$,readableBy:J},!q0?.isConnected)k4($,J)}function R4($){if(!i||A1!=="card"||typeof $.x!=="number"||typeof $.y!=="number")return;if($.phase==="start"){let J=i.getBoundingClientRect();$0={sx:$.x,sy:$.y,x:J.left,y:J.top,lx:$.x,ly:$.y},M2(!0);return}if(!$0)return;if($0.lx=$.x,$0.ly=$.y,E0=u8({x:$0.x+($.x-$0.sx),y:$0.y+($.y-$0.sy)},l8(),P2()),V1(),$.phase==="end")$0=null,M2(!1),i8()}var R1=null;function M2($){if(R1){for(let J of["pointermove","pointerup","pointercancel"])window.removeEventListener(J,R1,!0);R1=null}if(!$)return;R1=(J)=>{if(!$0)return M2(!1);if(J.type==="pointermove"&&J.buttons!==0)return R4({type:"drag",phase:"move",x:J.screenX,y:J.screenY});let Q=J.type==="pointerup";R4({type:"drag",phase:"end",x:Q?J.screenX:$0.lx,y:Q?J.screenY:$0.ly})};for(let J of["pointermove","pointerup","pointercancel"])window.addEventListener(J,R1,!0)}function a7(){if(!i?.contentWindow)return;let $=i.getBoundingClientRect();X1({type:"corner",x:Math.round($.left),y:Math.round($.top),width:Math.round($.width)})}function i8(){try{if(E0)sessionStorage.setItem(I4,JSON.stringify(E0));else sessionStorage.removeItem(I4)}catch{}}var P2=()=>({w:window.innerWidth,h:window.innerHeight});function l8(){let $=P2();return{w:Math.min(S4,$.w-X0),h:Math.min(A4.height||0,$.h-X0)}}function V1(){if(!i)return;let $=i.style;if(A1==="full"){Object.assign($,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let J=l8(),Q=P2().w<480;if($.width=Q?`calc(100vw - ${X0}px)`:`${J.w}px`,$.height=`${J.h}px`,E0&&!Q){let j=u8(E0,J,P2());Object.assign($,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign($,{left:Q?`${X0/2}px`:"",top:"",right:Q?"":`${X0/2}px`,bottom:`calc(${X0/2}px + var(--lw-chat-lift, 0px))`})}var N2=[2000,5000,15000,30000,60000],r8=new Set(["ringing","active"]),t7=20000,x4=!1,m0=!1,o8=0,e7=5,k1=null,$3=0,_2,f4,w4,J3=($)=>$.endsWith("/")?$:`${$}/`;function $$($,J){let Q=new URL("api/presence/ws",J3($));return Q.protocol=Q.protocol==="https:"?"wss:":"ws:",Q.searchParams.set("t",J),Q.toString()}function J$($){if($.chatId||!$.ticketId)return`/me/chat?call=${$.id}`;return`/me/tickets/${$.ticketId}?call=${$.id}`}function Q$($){return $.status==="ringing"&&($.side==="reporter"||$.side===void 0||$.side===null)}var y4=new Set;function Q3($){return y4.add($),()=>y4.delete($)}var n8=()=>R().ring!==!1;async function u0(){let $=R().identity;if(!$)return null;try{return await $()??null}catch{return null}}async function h4($,J){let Q=R();return fetch(new URL($,J3(Q.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":Q.realmKey,authorization:`Bearer ${J}`},body:"{}"})}function I2(){if(x4||typeof window>"u"||typeof WebSocket>"u")return;let $=R();if(!$.identity||$.ring===!1&&!$.chat)return;x4=!0,m0=!1,X$($.host);try{c8(`lw-tab:${z3()}`,new URL($.host).origin)}catch{}j3()}function j$(){m0=!0,x4=!1,clearTimeout(f4),clearInterval(_2),clearTimeout(w4);try{k1?.close(1000,"bye")}catch{}k1=null,b0(),Y1()}function E1($=!1){if(m0)return;let J=$?N2[N2.length-1]:N2[Math.min($3++,N2.length-1)];clearTimeout(f4),f4=setTimeout(()=>void j3(),J)}async function j3(){if(m0)return;let $=await u0();if(!$){if(++o8>=e7){m0=!0;return}return E1(!0)}o8=0;let J;try{J=await h4(R().chat?"ingest/live-ticket?chat=1":"ingest/live-ticket",$)}catch{return E1()}if(J.status===401||J.status===404||J.status===403){m0=!0;return}if(!J.ok)return E1(J.status===429);let Q;try{Q=await J.json()}catch{return E1()}if(!Q.ticket){m0=!0;return}if(Q.calls&&Q.call&&n8())e8(Q.call);let j=new WebSocket($$(R().host,Q.ticket));k1=j,j.onopen=()=>{$3=0,j.send(JSON.stringify({type:"tab",id:z3()})),clearInterval(_2),_2=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},t7)},j.onmessage=(z)=>{try{let X=JSON.parse(String(z.data));if(X.type==="chat-changed"||X.type==="ticket-changed"||X.type==="chat-seen"){for(let Z of y4)Z(X);return}if(X.type==="call-state"&&X.call&&typeof X.call==="object"){if(n8())e8(X.call)}else if(X.type==="call-ink"&&typeof X.call==="string"){let Z=O1(X.op);if(Z)b4=X.call,q2(Z)}}catch{}},j.onclose=()=>{if(clearInterval(_2),k1===j)k1=null;E1()}}var g4="lw-call-framed";function z$(){try{return sessionStorage.getItem(g4)}catch{return null}}function C2($){try{if($)sessionStorage.setItem(g4,$);else sessionStorage.removeItem(g4)}catch{}}var s8=!1;function X$($){if(s8||typeof document>"u")return;s8=!0;try{let J=new URL($).origin;for(let Q of["dns-prefetch","preconnect"]){let j=document.createElement("link");if(j.rel=Q,j.href=J,Q==="preconnect")j.crossOrigin="anonymous";j.dataset.debugReporter="true",document.head.append(j)}}catch{}}function a8($){let J=R();if(J.callFrame===!1||K1()===$.id)return;C2($.id),p8(b8(J.host,J.realmKey,null,$.id),$.id,{ready:()=>A8($.id),done:()=>{C2(null),b0($.id)},failed:()=>{C2(null),S8($,v4($))}},15000,u0())}var v4=($)=>({open:()=>Z$($),decline:()=>void V$($)}),k0=null;function z3(){if(k0)return k0;try{k0=sessionStorage.getItem(t8)}catch{}if(!k0||!/^[A-Za-z0-9_-]{8,40}$/.test(k0)){let $=new Uint8Array(12);crypto.getRandomValues($),k0=Array.from($,(J)=>J.toString(16).padStart(2,"0")).join("");try{sessionStorage.setItem(t8,k0)}catch{}}return k0}var t8="lw-tab-id",b4=null;function e8($){if(!r8.has($.status)&&b4===$.id&&K1()!==$.id)b4=null,F2();if(!Q$($)){if(b0($.id),$.status==="active"&&z$()===$.id&&!K1())a8($);if(!r8.has($.status)&&K1()===$.id)setTimeout(()=>{if(K1()===$.id)Y1(),C2(null)},12000);return}if(R().callFrame===!1)W2($,v4($),"portal");else W2($,{...v4($),answer:()=>{R8($.id),h8($.id)},voice:()=>m8($.id)},"frame"),a8($);clearTimeout(w4);let J=new Date($.ringUntil).getTime()-Date.now();w4=setTimeout(()=>{if(T8()===$.id)b0($.id)},Math.max(5000,J+5000))}function Z$($){let J=window.open("about:blank","_blank");(async()=>{let Q=await u0();if(Q)h4(`ingest/calls/${$.id}/coming`,Q).catch(()=>{return});let j;try{j=await C8(J$($))}catch{J?.close();return}if(J&&!J.closed){J.location.href=j;try{J.opener=null}catch{}G2()}else G2(j)})()}async function V$($){b0($.id);let J=await u0();if(J)await h4(`ingest/calls/${$.id}/decline`,J).catch(()=>{return})}function m4($,J,Q,j){let z=[];for(let X of $){if(X.right<=J.left||X.left>=J.right||X.bottom<=X.top)continue;z.push([Q-X.bottom-8-j,Q-X.top+8])}return z.sort((X,Z)=>X[0]-Z[0])}function X3($,J,Q,j){if(j<Q)return null;let z=(Y)=>J.some(([W,B])=>Y>W&&Y<B),X=(Y)=>Math.min(Math.max(Y,Q),j),Z=X($);if(!z(Z))return Z;let K=[Q,j,...J.flatMap(([Y,W])=>[Y,W])].map(X).filter((Y)=>!z(Y));if(!K.length)return null;return K.reduce((Y,W)=>{let B=Math.abs(W-Z),F=Math.abs(Y-Z);return B<F||B===F&&W>Y?W:Y})}var K$=3;function K3($,J,Q,j,z,X,Z=null){let K=new Map,Y=(P,U)=>{let M=`${P}:${U}`;if(!K.has(M))K.set(M,J(P,U));return K.get(M)},W=(P,U)=>P==="right"?{left:Q.w-U-j,right:Q.w-U}:{left:U,right:U+j},B=(P,U)=>m4(Y(P,U),W(P,U),Q.h,j),F=(P)=>Math.abs(P.y-$.y)+Math.abs(P.x-$.x)+(P.side===$.side?0:160),O=(P)=>X3(P.y,B(P.side,P.x),z,X)===P.y,N=(P)=>Z&&(Z.side!==P.side||Z.x!==P.x||Z.y!==P.y)&&F(Z)<=F(P)+48&&O(Z)?Z:P;if(O($))return N($);let _=null,A=$.side==="right"?"left":"right";for(let P of[$.side,A]){let U=P===$.side?0:160;if(_&&U>=F(_))break;let M=$.x;for(let y=0;y<=K$;y++){let m=X3($.y,B(P,M),z,X);if(m!==null&&(!_||F({side:P,x:M,y:m})<F(_)))_={side:P,x:M,y:m};let S=W(P,M),g={top:Q.h-$.y-j-8,bottom:Q.h-$.y+8},T=Y(P,M).filter((I)=>I.top<g.bottom&&I.bottom>g.top&&I.left<S.right&&I.right>S.left);if(!T.length)break;let u=Math.round(P==="right"?Math.max(...T.map((I)=>Q.w-I.left+8)):Math.max(...T.map((I)=>I.right+8)));if(u<=M||u+j>Q.w/2||_&&U+u-$.x>=F(_))break;M=u}}return _?N(_):$}function Y$($){if(typeof $!=="string"||!$.startsWith("/")||$.length>200)return null;let Q=($.length>1?$.replace(/\/+$/,""):"").split(/(\*\*|\*)/).map((j)=>j==="**"?".*":j==="*"?"[^/]*":j.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join("");try{return new RegExp(`^${Q}(?:/.*)?$`)}catch{return null}}function Y3($,J){let Q=null;for(let j of J??[]){let z=Y$(j.path);if(!z||!z.test($))continue;if(!Q||j.path.replace(/\*/g,"").length>Q.path.replace(/\*/g,"").length)Q=j}return Q}var Z3=/^LW-/,W$='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"])',V3=/(auto|scroll|overlay)/,G$='button:disabled,input:disabled,select:disabled,textarea:disabled,[aria-disabled="true"]';function W3($,J,Q={}){if(typeof document>"u"||typeof document.elementsFromPoint!=="function")return $.map(()=>[]);let j=Q.step??16,z=document.documentElement,X=document.body,Z=new Map,K=(U)=>Z.get(U)??(Z.set(U,getComputedStyle(U)),Z.get(U)),Y=J.w*J.h,W=(U)=>U.width*U.height>0.34*Y||U.width>=J.w*0.9&&U.height>=J.h*0.9,B=(U)=>{let M=K(U);return V3.test(M.overflowY)&&U.scrollHeight>U.clientHeight+1||V3.test(M.overflowX)&&U.scrollWidth>U.clientWidth+1},F=document.scrollingElement??z,O=F.scrollHeight>F.clientHeight+1&&K(z).overflowY!=="hidden"&&(!X||K(X).overflowY!=="hidden"),N=(U,M)=>{let y={top:0,bottom:J.h};for(let T=U.parentElement;T&&T!==z&&T!==X;T=T.parentElement){let u=K(T);if(u.overflowY!=="visible"&&u.overflowY!=="clip"){let I=T.getBoundingClientRect();y={top:I.top,bottom:I.bottom};break}}let m=U.getBoundingClientRect(),S=parseFloat(M.top),g=parseFloat(M.bottom);return!Number.isNaN(g)&&m.bottom>=y.bottom-g-1||!Number.isNaN(S)&&m.top<=y.top+S+1},_=(U)=>{let M=null,y=!1,m=1;for(let S=U;S&&S!==z&&S!==X;S=S.parentElement){let g=K(S),T=parseFloat(g.opacity);if(!Number.isNaN(T))m*=T;if(g.position==="fixed"||g.position==="sticky"&&N(S,g)){M=S;break}if(S!==U&&B(S))y=!0}if(!M&&O)y=!0;return{float:M,scrolled:y,opacity:m}},A=new Map,P=(U,M)=>{let y=document.elementFromPoint(U,M);if(!y||!Z3.test(y.tagName))return y;return document.elementsFromPoint(U,M).find((m)=>!Z3.test(m.tagName))??null};return $.map((U)=>{let M=new Set,y=new Set,m=[],S=(u)=>{if(y.has(u))return;y.add(u);let I=u.getBoundingClientRect();if(I.width>0&&I.height>0)m.push({top:I.top,bottom:I.bottom,left:I.left,right:I.right})},g=new Set,T=[U.left+6,(U.left+U.right)/2,U.right-6];for(let u=j/2;u<J.h;u+=j)for(let I of T){let x=P(I,u);if(!x||x===z||x===X||M.has(x))continue;if(M.add(x),Q.extra){let o=null;try{o=x.closest(Q.extra)}catch{o=null}if(o){S(o);continue}}let{float:E,scrolled:p,opacity:i0}=A.get(x)??(A.set(x,_(x)),A.get(x));if(i0<0.05)continue;let W0=x.closest(W$),e=W0&&(!E||E.contains(W0))?W0:null;if(E&&!W(E.getBoundingClientRect())){let o=e??x;if(!W(o.getBoundingClientRect()))S(o);continue}if(!p&&(E||!O))g.add(E);if(p||!e||W(e.getBoundingClientRect()))continue;S(e)}for(let u of g)for(let I of(u??X)?.querySelectorAll(G$)??[]){let x=I.getBoundingClientRect();if(!x.width||!x.height||x.right<=U.left||x.left>=U.right||W(x)||K(I).visibility==="hidden")continue;let E=A.get(I)??(A.set(I,_(I)),A.get(I));if(E.float!==u||E.scrolled||E.opacity<0.05)continue;let p=P(Math.min(Math.max((x.left+x.right)/2,U.left+6),U.right-6),(x.top+x.bottom)/2);if(p&&p!==I&&!I.contains(p)&&!p.contains(I))continue;S(I)}return m})}var D$="lw-support-chat",U$="lw-support-frame",H$="lw-support-host",d=56,d0=12,q$='<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>',F$=`
340
340
  :host { all: initial; }
341
341
  .bubble {
342
342
  position: fixed; z-index: 2147483000; width: ${d}px; height: ${d}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, ${z2});
346
+ font-family: var(--lw-host-font, ${Z2});
347
347
  }
348
348
  .bubble:hover { filter: brightness(0.92); transform: translateY(-1px); }
349
349
  .bubble { touch-action: none; }
@@ -378,7 +378,7 @@ iframe.on { visibility: visible; }`,c=document.createElement("iframe"),c.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 - ${d+p0+32}px));
381
+ position: fixed; z-index: 2147483001; width: min(380px, calc(100vw - 32px)); height: min(640px, calc(100vh - ${d+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; }`,c=document.createElement("iframe"),c.allow="
391
391
  .open .bubble { display: none; }
392
392
  }
393
393
  @media (prefers-reduced-motion: reduce) { .panel { animation: none; } .bubble, .label { transition: none; } }
394
- `,i=null,Z0=null,t=null,W0=null,x=null,f1=null,L2=null,V0=!1,u0=0,A2=(J)=>J.endsWith("/")?J:`${J}/`,g7=()=>{try{return new URL(C().host).origin}catch{return"*"}};function $3(J,$){let j=new URL("embed/support",A2(J));return j.searchParams.set("realm",$),j.searchParams.set("hand","1"),j.toString()}function v7(J){return/^\/me\/(?:chat|tickets(?:\/[\w-]{1,64})?)$/.test(J)?J:"/me/chat"}function w4(J){return new URL("support-face.webp",A2(J)).toString()}function j3(J){return J+d+p0-16}function h7(J){return`min(640px, calc(100vh - ${J+d+p0+16}px))`}var $0=8,b7=200;function m7(J,$,j,Q){return{side:J<j.w/2?"left":"right",x:Q,y:Q3(j.h-$-d/2,j.h)}}function Q3(J,$){return Math.round(Math.min(Math.max(J,$0),Math.max($0,$-d-$0)))}function u7(J){return J.side==="right"&&J.y<b7?j3(J.y):0}function p7(J,$){let j=$-(J.y+d+p0)-16,Q=J.y-p0-16;if(j>=420||j>=Q)return{bottom:J.y+d+p0,height:Math.max(240,Math.min(640,j))};return{top:$-J.y+p0,height:Math.max(240,Math.min(640,Q))}}function z3(J,$,j){return{x:Math.round(Math.min(Math.max(J.x,$0),Math.max($0,j.w-$.w-$0))),y:Math.round(Math.min(Math.max(J.y,$0),Math.max($0,j.h-$.h-$0)))}}function X3(J){return J<=0?"":J>99?"99+":String(J)}function Z3(J){if(u0=Math.max(0,Math.floor(J)||0),!f1||!x)return;let $=a(C().locale);f1.textContent=X3(u0),f1.hidden=u0===0,x.setAttribute("aria-label",u0?`${$.chatOpen} · ${$.chatUnread.replace("{n}",String(u0))}`:$.chatOpen),h1()}function d7(J,$){if(J.own===!1)return null;let j=J.unread>0,Q=typeof J.own==="string"?J.own.trim().slice(0,60):"";return{text:j?$.chatLabelNew:Q||$.chatLabel,shown:!J.open&&(j||!J.opened),isNew:j}}var Y1=!1;function h1(){if(!L2||!x)return;let J=C(),$=J.chat&&J.chat!==!0?J.chat.label:void 0,j=$!==void 0?$:U1?.label,Q=d7({own:j,unread:u0,opened:Y1,open:V0},a(J.locale));x.classList.toggle("unlabelled",!Q),x.classList.toggle("labelled",!!Q?.shown),x.classList.toggle("new",!!Q?.isNew),x.classList.toggle("at-left",(_0??P0).side==="left"),L2.querySelector(".text").textContent=Q?.text??""}var U1=null;function V3(J,$){if(!$||$.faceUrl===void 0)return w4(J);if($.faceUrl===null)return null;try{return new URL($.faceUrl.replace(/^\//,""),A2(J)).toString()}catch{return w4(J)}}function i7(J){if(U1=J,!i||!x)return;let $=J?.color&&/^#[0-9a-f]{6}$/i.test(J.color)?J.color:null;if($)i.style.setProperty("--lw-chat-color",$);else i.style.removeProperty("--lw-chat-color");let j=Z0?.querySelector(".face"),Q=V3(C().host,J);if(C0("now"),j){if(!Q)x.classList.remove("has-face"),j.removeAttribute("src");else if(j.getAttribute("src")!==Q)x.classList.remove("has-face"),j.src=Q}h1()}var k1=null;async function y1(){if(k1)return k1;let J=c7();k1=J;try{await J}finally{if(k1===J)k1=null}}async function c7(){try{let J=C(),$=J.chat&&J.chat!==!0?J.chat:null;if($?.show&&!$.show())return void C2(!1);let j=await m0();if(!j)return void C2(!1);let Q=await fetch(new URL("ingest/support-unread",A2(J.host)).toString(),{headers:{"x-realm-key":J.realmKey,authorization:`Bearer ${j}`}});if(Q.status===404||Q.status===401||Q.status===403)return void C2(!1);if(!Q.ok)return;let z=await Q.json();if(z.look&&typeof z.look==="object")i7(z.look);if(C2(!0),!V0)Z3(typeof z.total==="number"?z.total:0)}catch{}}function C2(J){if(!i)return;if(i.style.display=J?"":"none",J)X2(i);if(I0(),J)C0("now")}var P0={side:"right",x:16,y:16},x0=null,l7=380,K3=()=>`lw-support-chat-place:${C().realmKey}`,d0=()=>({w:window.innerWidth,h:window.innerHeight}),G1=!1;function r7(){let J=m1(C().chat);if(J)P0={side:J.side,x:J.x,y:J.y};try{let $=JSON.parse(localStorage.getItem(K3())??"null"),j=$?.bubble;if(G1=!!j&&(j.side==="left"||j.side==="right")&&typeof j.y==="number"&&Number.isFinite(j.y),G1)P0={...P0,side:j.side,y:j.y};let Q=$?.panel;x0=Q&&typeof Q.x==="number"&&typeof Q.y==="number"&&Number.isFinite(Q.x)&&Number.isFinite(Q.y)?{x:Q.x,y:Q.y,h:typeof Q.h==="number"&&Q.h>=240?Q.h:640}:null,Y1=$?.opened===!0}catch{}}function b4(){try{localStorage.setItem(K3(),JSON.stringify({...G1?{bubble:{side:P0.side,y:P0.y}}:{},panel:x0,...Y1?{opened:!0}:{}}))}catch{}}var w1=()=>window.location?.pathname??"/",_0=null,y4="",M0=null,R2="";function l8(J,$){let j=d0();if(!M0||M0.w!==j.w||M0.h!==j.h)M0={w:j.w,h:j.h,boxes:new Map};let Q=`${J}:${$}`,z=M0.boxes.get(Q);if(!z){let X=J==="right"?{left:j.w-$-d,right:j.w-$}:{left:$,right:$+d};z=c8([X],j,{extra:E2().extra})[0]??[],M0.boxes.set(Q,z)}return z}var m4=!1;function E2(){let J=C().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 o7(){let J=i8(w1(),U1?.places);if(m4=J?.show==="hide",G1||!J||J.show==="hide")return P0;return{side:J.show,x:P0.x,y:J.y}}function W3(){if(!x)return;if(!E2().on)return M0=null,I0();let J=R2,$=d0();M0={w:$.w,h:$.h,boxes:new Map},I0(),g1=R2===J?Math.min(g1+1,s7):0}var n7=400,s7=3,a7=60,W1,r8=0,o8=0,g1=0;function C0(J="later"){if(!i)return;let $=Date.now();if(J!=="later")g1=0;let j=J==="now"?a7:Math.max(0,n7*2**g1-($-o8));if(W1&&r8<=$+j)return;clearTimeout(W1),r8=$+j,W1=setTimeout(()=>{if(W1=void 0,!i||V0||j0?.moved||typeof document<"u"&&document.hidden)return;o8=Date.now(),W3()},j)}var I2=null,f4="",n8,u4=(J)=>J instanceof Element&&(J===i||/^LW-/.test(J.tagName)),s8=(J)=>{if(!u4(J.target))C0()},a8=(J)=>{if(u4(J.target))return;let $=J.target instanceof Element?J.target.getBoundingClientRect():null,j=d0(),Q=P0.x,z=!!$&&$.width>0&&($.left<Q+d||$.right>j.w-Q-d);C0(z?"soon":"later")},O2=(J)=>{if(!u4(J.target))C0("now")},t8=["popstate","hashchange","pointerup","keyup"];function Y3(J){I2?.disconnect(),I2=null,clearInterval(n8);for(let $ of t8)window.removeEventListener($,O2,!0);window.removeEventListener("scroll",s8,!0);for(let $ of["transitionend","animationend"])window.removeEventListener($,a8,!0);if(document.removeEventListener("visibilitychange",O2),!J)return;if(typeof MutationObserver<"u")I2=new MutationObserver(($)=>{if($.some((Q)=>{let z=Q.target;if(z===document.documentElement&&Q.type==="attributes")return!1;return!(z.nodeType===1&&/^LW-/.test(z.tagName))&&z!==i}))C0()}),I2.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","open","aria-expanded","disabled","aria-disabled"]});for(let $ of t8)window.addEventListener($,O2,{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",O2),f4=w1(),n8=setInterval(()=>{if(w1()===f4)return;f4=w1(),I0(),C0("now")},1000)}function I0(){if(!x||!t)return;let J=d0(),$=o7(),j=Q3($.y,J.h),Q=`${w1()}|${$.side}|${$.x}|${j}`,z=_0&&y4===Q?_0:null,X={side:$.side,x:$.x,y:j},Z=!!M0&&E2().on,K=!V0||!_0?Z?d8(X,l8,J,d,$0,Math.max($0,J.h-d-$0),z):X:_0;if(_0={side:K.side,x:K.x,y:K.y},y4=Q,Z)R2=JSON.stringify([x4(l8(X.side,X.x),X.side==="right"?{left:J.w-X.x-d,right:J.w-X.x}:{left:X.x,right:X.x+d},J.h,d),_0]);let W=_0,G=W.y,I=W.side==="right"?"left":"right";if(x.style.display=m4&&!V0?"none":"",Object.assign(x.style,{[W.side]:`${W.x}px`,[I]:"",bottom:`${G}px`,top:""}),x0){let S={w:Math.min(l7,J.w-32),h:Math.min(x0.h,J.h-2*$0)},L=z3(x0,S,J);Object.assign(t.style,{left:`${L.x}px`,top:`${L.y}px`,right:"",bottom:"",height:`${S.h}px`})}else{let S=p7(W,J.h);Object.assign(t.style,{[W.side]:`${W.x}px`,[I]:"",bottom:S.bottom!==void 0?`${S.bottom}px`:"",top:S.top!==void 0?`${S.top}px`:"",height:`${S.height}px`})}let B=i&&i.style.display!=="none"&&x.style.display!=="none"?u7(W):0,O=B?`${B}px`:"";if(document.documentElement.style.getPropertyValue("--lw-chat-lift")!==O)if(O)document.documentElement.style.setProperty("--lw-chat-lift",O);else document.documentElement.style.removeProperty("--lw-chat-lift");h1()}var j0=null,g4=!1;function t7(J){if(J.button!==0)return;j0={id:J.pointerId,sx:J.clientX,sy:J.clientY,moved:!1};try{x?.setPointerCapture(J.pointerId)}catch{}}function e7(J){if(!j0||J.pointerId!==j0.id||!x)return;if(!j0.moved&&Math.hypot(J.clientX-j0.sx,J.clientY-j0.sy)<6)return;j0.moved=!0,x.classList.add("dragging"),Object.assign(x.style,{left:`${J.clientX-d/2}px`,top:`${J.clientY-d/2}px`,right:"",bottom:""})}function e8(J){if(!j0||J.pointerId!==j0.id)return;let $=j0;if(j0=null,x?.classList.remove("dragging"),!$.moved)return;if(g4=!0,setTimeout(()=>g4=!1,0),J.type==="pointerup")P0=m7(J.clientX,J.clientY,d0(),m1(C().chat)?.x??16),G1=!0,x0=null,b4();if(E2().on)W3();else I0()}var n=null;function v4(J){if(!t||typeof J.x!=="number"||typeof J.y!=="number"||d0().w<640)return;if(J.phase==="start"){let $=t.getBoundingClientRect();n={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(!n)return;if(n.lx=J.x,n.ly=J.y,x0={...z3({x:n.x+(J.x-n.sx),y:n.y+(J.y-n.sy)},{w:t.offsetWidth,h:n.h},d0()),h:n.h},I0(),J.phase==="end")n=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(!n)return S2(!1);if($.type==="pointermove"&&$.buttons!==0)return v4({phase:"move",x:$.screenX,y:$.screenY});let j=$.type==="pointerup";v4({phase:"end",x:j?$.screenX:n.lx,y:j?$.screenY:n.ly})};for(let $ of["pointermove","pointerup","pointercancel"])window.addEventListener($,x1,!0)}var G3=()=>{I0(),C0("now")};function T2(J){W0?.contentWindow?.postMessage({source:f7,...J},g7())}async function JJ(J){if(!W0||J.source!==W0.contentWindow)return;let $=J.data;if(!$||$.source!==x7)return;if($.type==="hello"){let j=await m0();if(j)T2({type:"token",token:j,can:["portal"]});return}if($.type==="portal"){W4({returnTo:v7(typeof $.path==="string"?$.path:"")});return}if($.type==="ready")return T2({type:V0?"shown":"hidden"});if($.type==="close")return v1();if($.type==="drag")return v4($);if($.type==="unread"&&typeof $.total==="number")return Z3($.total);if($.type==="report")v1(!1),P1({type:"manual",fromChat:!0})}var U3=(J)=>void JJ(J);function D3(J){if(V0&&J.key==="Escape")v1()}function H3(){if(!i||!t||!Z0)b1();if(!t)return;let J=C();if(!W0)W0=document.createElement("iframe"),W0.src=$3(J.host,J.realmKey),W0.title=a(J.locale).chatTitle,W0.setAttribute("allow","clipboard-write"),t.append(W0);if(V0=!0,!Y1)Y1=!0,b4();t.hidden=!1,Z0?.querySelector(".wrap")?.classList.add("open"),x?.setAttribute("aria-expanded","true"),h1(),T2({type:"shown"}),W0.focus()}function v1(J=!0){if(!t)return;if(V0=!1,t.hidden=!0,Z0?.querySelector(".wrap")?.classList.remove("open"),x?.setAttribute("aria-expanded","false"),h1(),T2({type:"hidden"}),J)x?.focus();y1(),I0(),C0("now")}var h4=null,J3=0;function q3(){if(Date.now()-J3<30000)return;J3=Date.now(),y1()}function b1(){if(i||typeof document>"u")return;let J=C();if(!m1(J.chat)||!J.identity)return;let j=a(J.locale);i=document.createElement(k7),i.style.display="none",Z0=i.attachShadow({mode:"open"}),Z0.innerHTML=`<style>${y7}</style><div class="wrap"><div class="panel" role="dialog" aria-label="${j.chatTitle}" hidden></div><button type="button" class="bubble" aria-expanded="false" aria-haspopup="dialog" aria-label="${j.chatOpen}" title="${j.chatMove}">${w7}<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>`,t=Z0.querySelector(".panel"),x=Z0.querySelector(".bubble"),f1=Z0.querySelector(".badge"),L2=Z0.querySelector(".label");let Q=Z0.querySelector(".face");Q.addEventListener("load",()=>{if(Q.getAttribute("src"))x?.classList.add("has-face")}),Q.addEventListener("error",()=>x?.classList.remove("has-face")),Q.src=V3(J.host,U1)??w4(J.host),r7(),I0(),x.addEventListener("click",()=>{if(g4)return;if(V0)v1();else H3()}),x.addEventListener("pointerdown",t7),x.addEventListener("pointermove",e7),x.addEventListener("pointerup",e8),x.addEventListener("pointercancel",e8),document.body.append(i),window.addEventListener("message",U3),document.addEventListener("keydown",D3),window.addEventListener("focus",q3),window.addEventListener("resize",G3),Y3(!0);let z;h4=v8(()=>{if(V0)return;clearTimeout(z),z=setTimeout(()=>void y1(),500)}),y1()}function $J(){return i?y1():Promise.resolve()}function jJ(){U1=null,h4?.(),h4=null,window.removeEventListener("message",U3),document.removeEventListener("keydown",D3),window.removeEventListener("focus",q3),window.removeEventListener("resize",G3),Y3(!1),clearTimeout(W1),W1=void 0,g1=0,_0=null,y4="",M0=null,R2="",m4=!1,S2(!1),i?.remove(),i=Z0=t=W0=x=f1=L2=null,V0=!1,j0=n=null,x0=null,G1=Y1=!1,u0=0,document.documentElement.style.removeProperty("--lw-chat-lift")}var M3=!1;function QJ(J={}){if(M3||typeof window>"u")return;if(!D1()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(M3=!0,O6(),V6(),j6(),q6(),R6(),J.ui===!1)return;let $=a(C().locale);if(u2((Q)=>{y0(Q.message??$.crashed,"error",{label:$.crashAction,onClick:()=>P1(Q)})}),V4(),!document.querySelector($1))document.body.append(document.createElement($1));let j=window.requestIdleCallback;if(j)j(()=>void g0(),{timeout:5000});else setTimeout(()=>void g0(),2000);if(j)j(()=>_2(),{timeout:8000});else setTimeout(()=>_2(),3000);if(C().chat)if(!C().identity)console.warn("[debug-capture] `chat` needs `identity` — a chat is a signed-in person's; the bubble is not shown");else if(j)j(()=>b1(),{timeout:4000});else setTimeout(()=>b1(),1500)}var zJ=new Set(["error","exception","unhandledrejection"]);function P3(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 XJ(J){try{let{pathname:$}=new URL(J,"http://x");try{return decodeURIComponent($)}catch{return $}}catch{return J.split(/[?#]/)[0]??J}}function ZJ(J,$,j){let Q=(Z)=>({elapsedMs:Z,requests:[],failedRequests:[],consoleErrors:[],slowestMs:null});if(J.length===0)return[];let z=J.map((Z)=>p4(Z.at)),X=(Z)=>{for(let K=Z+1;K<z.length;K+=1){let W=z[K];if(W!=null)return W}return Number.POSITIVE_INFINITY};return J.map((Z,K)=>{let W=z[K]??null,G=(K>0?z[K-1]:null)??null,I=W!==null&&G!==null?Math.max(0,W-G):null;if(W===null)return Q(I);let B=W,O=Math.max(B,X(K)),S=(D)=>D!==null&&D>=B&&(D<O||O===Number.POSITIVE_INFINITY),L=$.filter((D)=>S(p4(D.startedAt))),h=j.filter((D)=>zJ.has(D.level)&&S(p4(D.at))),N=L.map((D)=>D.durationMs).filter((D)=>typeof D==="number");return{elapsedMs:I,requests:L,failedRequests:L.filter(P3),consoleErrors:h,slowestMs:N.length>0?Math.max(...N):null}})}function VJ(J,$){return J.requests.length===0&&J.consoleErrors.length===0&&(J.elapsedMs===null||J.elapsedMs<$)}function KJ(J){if(J<1000)return`${Math.round(J)} มิลลิวินาที`;let $=J/1000;if($<10)return`${$.toFixed(1)} วิ`;if($<60)return`${Math.round($)} วิ`;let j=Math.floor($/60),Q=Math.round($%60);return Q===0?`${j} นาที`:`${j} นาที ${Q} วิ`}export{jJ as unmountSupportChat,n2 as trimToBudget,k6 as toCurl,i2 as takeReplay,j8 as supportPortalUrl,$3 as supportFrameUrl,$4 as submitRequest,e2 as submitBundle,f5 as stopReplay,C7 as stopLiveRing,_2 as startLiveRing,M8 as sizeInkCanvas,y0 as showToast,k9 as setErroredQueriesSource,t1 as requestTypesNow,XJ as requestPath,a as reporterStrings,$J as refreshSupportChat,B0 as redactUrl,o0 as redactLabel,n0 as redactHeaders,s0 as redactBody,I1 as readInkOp,h7 as panelHeight,a2 as packReplay,W4 as openSupportPortal,H3 as openSupportChat,m2 as onLaunch,u2 as onCrash,b1 as mountSupportChat,R3 as moduleResolver,g0 as loadRequestTypes,P1 as launch,x5 as isReplayRecording,VJ as isQuietStep,P3 as isFailedRequest,D1 as isConfigured,QJ as installDebugCapture,D4 as inkAlpha,t5 as hasCause,d2 as getNetworkLog,b2 as getConsoleLog,C as getConfig,v2 as getActionTrail,KJ as formatDuration,r2 as errorSignature,p2 as emitCrash,V4 as defineReporterElement,z4 as createAnnotator,ZJ as correlateActionTrail,_3 as configureDebugCapture,v1 as closeSupportChat,j3 as chatLift,o1 as captureScreen,n5 as bundleToMarkdown,a5 as bundleFileName,B1 as buildBundle,X3 as badgeText,H0 as appInfo,y2 as actionCountSuffix,$1 as REPORTER_TAG,y6 as REPLAY_FILENAME,r0 as REDACTED,Q2 as NoIdentityError,e9 as LASER_TRAIL_MS,J7 as LASER_LINGER_MS,B8 as InkSender,Y2 as InkScene,G2 as InkPainter,$7 as INK_STALE_MS,P8 as INK_SEND_EVERY_MS,s9 as INK_MAX_POINTS_PER_OP,H4 as INK_KEEP_MS,a9 as INK_HOLD_MS,t9 as INK_FADE_MS,q8 as INK_COLORS,o2 as BUNDLE_BUDGET_BYTES};
394
+ `,c=null,Z0=null,t=null,Y0=null,f=null,w1=null,S2=null,V0=!1,p0=0,k2=($)=>$.endsWith("/")?$:`${$}/`,M$=()=>{try{return new URL(R().host).origin}catch{return"*"}};function N3($,J){let Q=new URL("embed/support",k2($));return Q.searchParams.set("realm",J),Q.searchParams.set("hand","1"),Q.toString()}function P$($){return/^\/me\/(?:chat|tickets(?:\/[\w-]{1,64})?)$/.test($)?$:"/me/chat"}function p4($){return new URL("support-face.webp",k2($)).toString()}function _3($){return $+d+d0-16}function B$($){return`min(640px, calc(100vh - ${$+d+d0+16}px))`}var J0=8,N$=200;function _$($,J,Q,j){return{side:$<Q.w/2?"left":"right",x:j,y:C3(Q.h-J-d/2,Q.h)}}function C3($,J){return Math.round(Math.min(Math.max($,J0),Math.max(J0,J-d-J0)))}function C$($){return $.side==="right"&&$.y<N$?_3($.y):0}function I$($,J){let Q=J-($.y+d+d0)-16,j=$.y-d0-16;if(Q>=420||Q>=j)return{bottom:$.y+d+d0,height:Math.max(240,Math.min(640,Q))};return{top:J-$.y+d0,height:Math.max(240,Math.min(640,j))}}function I3($,J,Q){return{x:Math.round(Math.min(Math.max($.x,J0),Math.max(J0,Q.w-J.w-J0))),y:Math.round(Math.min(Math.max($.y,J0),Math.max(J0,Q.h-J.h-J0)))}}function O3($){return $<=0?"":$>99?"99+":String($)}function L3($){if(p0=Math.max(0,Math.floor($)||0),!w1||!f)return;let J=a(R().locale);w1.textContent=O3(p0),w1.hidden=p0===0,f.setAttribute("aria-label",p0?`${J.chatOpen} · ${J.chatUnread.replace("{n}",String(p0))}`:J.chatOpen),h1()}function O$($,J){if($.own===!1)return null;let Q=$.unread>0,j=typeof $.own==="string"?$.own.trim().slice(0,60):"";return{text:Q?J.chatLabelNew:j||J.chatLabel,shown:!$.open&&(Q||!$.opened),isNew:Q}}var G1=!1;function h1(){if(!S2||!f)return;let $=R(),J=$.chat&&$.chat!==!0?$.chat.label:void 0,Q=J!==void 0?J:U1?.label,j=O$({own:Q,unread:p0,opened:G1,open:V0},a($.locale));f.classList.toggle("unlabelled",!j),f.classList.toggle("labelled",!!j?.shown),f.classList.toggle("new",!!j?.isNew),f.classList.toggle("at-left",(_0??M0).side==="left"),S2.querySelector(".text").textContent=j?.text??""}var U1=null;function R3($,J){if(!J||J.faceUrl===void 0)return p4($);if(J.faceUrl===null)return null;try{return new URL(J.faceUrl.replace(/^\//,""),k2($)).toString()}catch{return p4($)}}function L$($){if(U1=$,!c||!f)return;let J=$?.color&&/^#[0-9a-f]{6}$/i.test($.color)?$.color:null;if(J)c.style.setProperty("--lw-chat-color",J);else c.style.removeProperty("--lw-chat-color");let Q=Z0?.querySelector(".face"),j=R3(R().host,$);if(C0("now"),Q){if(!j)f.classList.remove("has-face"),Q.removeAttribute("src");else if(Q.getAttribute("src")!==j)f.classList.remove("has-face"),Q.src=j}h1()}var x1=null;async function g1(){if(x1)return x1;let $=R$();x1=$;try{await $}finally{if(x1===$)x1=null}}async function R$(){try{let $=R(),J=$.chat&&$.chat!==!0?$.chat:null;if(J?.show&&!J.show())return void O2(!1);let Q=await u0();if(!Q)return void O2(!1);let j=await fetch(new URL("ingest/support-unread",k2($.host)).toString(),{headers:{"x-realm-key":$.realmKey,authorization:`Bearer ${Q}`}});if(j.status===404||j.status===401||j.status===403)return void O2(!1);if(!j.ok)return;let z=await j.json();if(z.look&&typeof z.look==="object")L$(z.look);if(O2(!0),!V0)L3(typeof z.total==="number"?z.total:0)}catch{}}function O2($){if(!c)return;if(c.style.display=$?"":"none",$)V2(c);if(I0(),$)C0("now")}var M0={side:"right",x:16,y:16},x0=null,S$=380,S3=()=>`lw-support-chat-place:${R().realmKey}`,c0=()=>({w:window.innerWidth,h:window.innerHeight}),D1=!1;function A$(){let $=u1(R().chat);if($)M0={side:$.side,x:$.x,y:$.y};try{let J=JSON.parse(localStorage.getItem(S3())??"null"),Q=J?.bubble;if(D1=!!Q&&(Q.side==="left"||Q.side==="right")&&typeof Q.y==="number"&&Number.isFinite(Q.y),D1)M0={...M0,side:Q.side,y:Q.y};let j=J?.panel;x0=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,G1=J?.opened===!0}catch{}}function r4(){try{localStorage.setItem(S3(),JSON.stringify({...D1?{bubble:{side:M0.side,y:M0.y}}:{},panel:x0,...G1?{opened:!0}:{}}))}catch{}}var y1=()=>window.location?.pathname??"/",_0=null,d4="",F0=null,A2="";function G3($,J){let Q=c0();if(!F0||F0.w!==Q.w||F0.h!==Q.h)F0={w:Q.w,h:Q.h,boxes:new Map};let j=`${$}:${J}`,z=F0.boxes.get(j);if(!z){let X=$==="right"?{left:Q.w-J-d,right:Q.w-J}:{left:J,right:J+d};z=W3([X],Q,{extra:x2().extra})[0]??[],F0.boxes.set(j,z)}return z}var o4=!1;function x2(){let $=R().chat,J=$&&$!==!0?$.avoid:void 0;if(J===!1||U1?.avoid===!1)return{on:!1,extra:null};return{on:!0,extra:typeof J==="string"&&J.trim()?J.trim():null}}function T$(){let $=Y3(y1(),U1?.places);if(o4=$?.show==="hide",D1||!$||$.show==="hide")return M0;return{side:$.show,x:M0.x,y:$.y}}function A3(){if(!f)return;if(!x2().on)return F0=null,I0();let $=A2,J=c0();F0={w:J.w,h:J.h,boxes:new Map},I0(),v1=A2===$?Math.min(v1+1,k$):0}var E$=400,k$=3,x$=60,W1,D3=0,U3=0,v1=0;function C0($="later"){if(!c)return;let J=Date.now();if($!=="later")v1=0;let Q=$==="now"?x$:Math.max(0,E$*2**v1-(J-U3));if(W1&&D3<=J+Q)return;clearTimeout(W1),D3=J+Q,W1=setTimeout(()=>{if(W1=void 0,!c||V0||Q0?.moved||typeof document<"u"&&document.hidden)return;U3=Date.now(),A3()},Q)}var L2=null,u4="",H3,n4=($)=>$ instanceof Element&&($===c||/^LW-/.test($.tagName)),q3=($)=>{if(!n4($.target))C0()},F3=($)=>{if(n4($.target))return;let J=$.target instanceof Element?$.target.getBoundingClientRect():null,Q=c0(),j=M0.x,z=!!J&&J.width>0&&(J.left<j+d||J.right>Q.w-j-d);C0(z?"soon":"later")},R2=($)=>{if(!n4($.target))C0("now")},M3=["popstate","hashchange","pointerup","keyup"];function T3($){L2?.disconnect(),L2=null,clearInterval(H3);for(let J of M3)window.removeEventListener(J,R2,!0);window.removeEventListener("scroll",q3,!0);for(let J of["transitionend","animationend"])window.removeEventListener(J,F3,!0);if(document.removeEventListener("visibilitychange",R2),!$)return;if(typeof MutationObserver<"u")L2=new MutationObserver((J)=>{if(J.some((j)=>{let z=j.target;if(z===document.documentElement&&j.type==="attributes")return!1;return!(z.nodeType===1&&/^LW-/.test(z.tagName))&&z!==c}))C0()}),L2.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","open","aria-expanded","disabled","aria-disabled"]});for(let J of M3)window.addEventListener(J,R2,{capture:!0,passive:!0});window.addEventListener("scroll",q3,{capture:!0,passive:!0});for(let J of["transitionend","animationend"])window.addEventListener(J,F3,{capture:!0,passive:!0});document.addEventListener("visibilitychange",R2),u4=y1(),H3=setInterval(()=>{if(y1()===u4)return;u4=y1(),I0(),C0("now")},1000)}function I0(){if(!f||!t)return;let $=c0(),J=T$(),Q=C3(J.y,$.h),j=`${y1()}|${J.side}|${J.x}|${Q}`,z=_0&&d4===j?_0:null,X={side:J.side,x:J.x,y:Q},Z=!!F0&&x2().on,K=!V0||!_0?Z?K3(X,G3,$,d,J0,Math.max(J0,$.h-d-J0),z):X:_0;if(_0={side:K.side,x:K.x,y:K.y},d4=j,Z)A2=JSON.stringify([m4(G3(X.side,X.x),X.side==="right"?{left:$.w-X.x-d,right:$.w-X.x}:{left:X.x,right:X.x+d},$.h,d),_0]);let Y=_0,W=Y.y,B=Y.side==="right"?"left":"right";if(f.style.display=o4&&!V0?"none":"",Object.assign(f.style,{[Y.side]:`${Y.x}px`,[B]:"",bottom:`${W}px`,top:""}),x0){let N={w:Math.min(S$,$.w-32),h:Math.min(x0.h,$.h-2*J0)},_=I3(x0,N,$);Object.assign(t.style,{left:`${_.x}px`,top:`${_.y}px`,right:"",bottom:"",height:`${N.h}px`})}else{let N=I$(Y,$.h);Object.assign(t.style,{[Y.side]:`${Y.x}px`,[B]:"",bottom:N.bottom!==void 0?`${N.bottom}px`:"",top:N.top!==void 0?`${N.top}px`:"",height:`${N.height}px`})}let F=c&&c.style.display!=="none"&&f.style.display!=="none"?C$(Y):0,O=F?`${F}px`:"";if(document.documentElement.style.getPropertyValue("--lw-chat-lift")!==O)if(O)document.documentElement.style.setProperty("--lw-chat-lift",O);else document.documentElement.style.removeProperty("--lw-chat-lift");h1()}var Q0=null,c4=!1;function f$($){if($.button!==0)return;Q0={id:$.pointerId,sx:$.clientX,sy:$.clientY,moved:!1};try{f?.setPointerCapture($.pointerId)}catch{}}function w$($){if(!Q0||$.pointerId!==Q0.id||!f)return;if(!Q0.moved&&Math.hypot($.clientX-Q0.sx,$.clientY-Q0.sy)<6)return;Q0.moved=!0,f.classList.add("dragging"),Object.assign(f.style,{left:`${$.clientX-d/2}px`,top:`${$.clientY-d/2}px`,right:"",bottom:""})}function P3($){if(!Q0||$.pointerId!==Q0.id)return;let J=Q0;if(Q0=null,f?.classList.remove("dragging"),!J.moved)return;if(c4=!0,setTimeout(()=>c4=!1,0),$.type==="pointerup")M0=_$($.clientX,$.clientY,c0(),u1(R().chat)?.x??16),D1=!0,x0=null,r4();if(x2().on)A3();else I0()}var n=null;function i4($){if(!t||typeof $.x!=="number"||typeof $.y!=="number"||c0().w<640)return;if($.phase==="start"){let J=t.getBoundingClientRect();n={sx:$.x,sy:$.y,x:J.left,y:J.top,lx:$.x,ly:$.y,h:Math.round(J.height)||640},T2(!0);return}if(!n)return;if(n.lx=$.x,n.ly=$.y,x0={...I3({x:n.x+($.x-n.sx),y:n.y+($.y-n.sy)},{w:t.offsetWidth,h:n.h},c0()),h:n.h},I0(),$.phase==="end")n=null,T2(!1),r4()}var f1=null;function T2($){if(f1){for(let J of["pointermove","pointerup","pointercancel"])window.removeEventListener(J,f1,!0);f1=null}if(!$)return;f1=(J)=>{if(!n)return T2(!1);if(J.type==="pointermove"&&J.buttons!==0)return i4({phase:"move",x:J.screenX,y:J.screenY});let Q=J.type==="pointerup";i4({phase:"end",x:Q?J.screenX:n.lx,y:Q?J.screenY:n.ly})};for(let J of["pointermove","pointerup","pointercancel"])window.addEventListener(J,f1,!0)}var E3=()=>{I0(),C0("now")};function E2($){Y0?.contentWindow?.postMessage({source:H$,...$},M$())}async function y$($){if(!Y0||$.source!==Y0.contentWindow)return;let J=$.data;if(!J||J.source!==U$)return;if(J.type==="hello"){let Q=await u0();if(Q)E2({type:"token",token:Q,can:["portal"]});return}if(J.type==="portal"){M4({returnTo:P$(typeof J.path==="string"?J.path:"")});return}if(J.type==="ready")return E2({type:V0?"shown":"hidden"});if(J.type==="close")return b1();if(J.type==="drag")return i4(J);if(J.type==="unread"&&typeof J.total==="number")return L3(J.total);if(J.type==="report")b1(!1),P1({type:"manual",fromChat:!0})}var k3=($)=>void y$($);function x3($){if(V0&&$.key==="Escape")b1()}function f3(){if(!c||!t||!Z0)m1();if(!t)return;let $=R();if(!Y0)Y0=document.createElement("iframe"),Y0.src=N3($.host,$.realmKey),Y0.title=a($.locale).chatTitle,Y0.setAttribute("allow","clipboard-write"),t.append(Y0);if(V0=!0,!G1)G1=!0,r4();t.hidden=!1,Z0?.querySelector(".wrap")?.classList.add("open"),f?.setAttribute("aria-expanded","true"),h1(),E2({type:"shown"}),Y0.focus()}function b1($=!0){if(!t)return;if(V0=!1,t.hidden=!0,Z0?.querySelector(".wrap")?.classList.remove("open"),f?.setAttribute("aria-expanded","false"),h1(),E2({type:"hidden"}),$)f?.focus();g1(),I0(),C0("now")}var l4=null,B3=0;function w3(){if(Date.now()-B3<30000)return;B3=Date.now(),g1()}function m1(){if(c||typeof document>"u")return;let $=R();if(!u1($.chat)||!$.identity)return;let Q=a($.locale);c=document.createElement(D$),c.style.display="none",Z0=c.attachShadow({mode:"open"}),Z0.innerHTML=`<style>${F$}</style><div class="wrap"><div class="panel" role="dialog" aria-label="${Q.chatTitle}" hidden></div><button type="button" class="bubble" aria-expanded="false" aria-haspopup="dialog" aria-label="${Q.chatOpen}" title="${Q.chatMove}">${q$}<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>`,t=Z0.querySelector(".panel"),f=Z0.querySelector(".bubble"),w1=Z0.querySelector(".badge"),S2=Z0.querySelector(".label");let j=Z0.querySelector(".face");j.addEventListener("load",()=>{if(j.getAttribute("src"))f?.classList.add("has-face")}),j.addEventListener("error",()=>f?.classList.remove("has-face")),j.src=R3($.host,U1)??p4($.host),A$(),I0(),f.addEventListener("click",()=>{if(c4)return;if(V0)b1();else f3()}),f.addEventListener("pointerdown",f$),f.addEventListener("pointermove",w$),f.addEventListener("pointerup",P3),f.addEventListener("pointercancel",P3),document.body.append(c),window.addEventListener("message",k3),document.addEventListener("keydown",x3),window.addEventListener("focus",w3),window.addEventListener("resize",E3),T3(!0);let z;l4=Q3(()=>{if(V0)return;clearTimeout(z),z=setTimeout(()=>void g1(),500)}),g1()}function g$(){return c?g1():Promise.resolve()}function v$(){U1=null,l4?.(),l4=null,window.removeEventListener("message",k3),document.removeEventListener("keydown",x3),window.removeEventListener("focus",w3),window.removeEventListener("resize",E3),T3(!1),clearTimeout(W1),W1=void 0,v1=0,_0=null,d4="",F0=null,A2="",o4=!1,T2(!1),c?.remove(),c=Z0=t=Y0=f=w1=S2=null,V0=!1,Q0=n=null,x0=null,D1=G1=!1,p0=0,document.documentElement.style.removeProperty("--lw-chat-lift")}var y3=!1;function b$($={}){if(y3||typeof window>"u")return;if(!H1()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(y3=!0,x6(),q6(),W6(),I6(),w6(),$.ui===!1)return;let J=a(R().locale);if(d2((j)=>{y0(j.message??J.crashed,"error",{label:J.crashAction,onClick:()=>P1(j)})}),q4(),!document.querySelector(Q1))document.body.append(document.createElement(Q1));let Q=window.requestIdleCallback;if(Q)Q(()=>void v0(),{timeout:5000});else setTimeout(()=>void v0(),2000);if(Q)Q(()=>I2(),{timeout:8000});else setTimeout(()=>I2(),3000);if(R().chat)if(!R().identity)console.warn("[debug-capture] `chat` needs `identity` — a chat is a signed-in person's; the bubble is not shown");else if(Q)Q(()=>m1(),{timeout:4000});else setTimeout(()=>m1(),1500)}var h$=new Set(["error","exception","unhandledrejection"]);function g3($){if($.error)return!0;return $.status!==null&&$.status>=400}function s4($){if(!$)return null;let J=Date.parse($);return Number.isNaN(J)?null:J}function m$($){try{let{pathname:J}=new URL($,"http://x");try{return decodeURIComponent(J)}catch{return J}}catch{return $.split(/[?#]/)[0]??$}}function u$($,J,Q){let j=(Z)=>({elapsedMs:Z,requests:[],failedRequests:[],consoleErrors:[],slowestMs:null});if($.length===0)return[];let z=$.map((Z)=>s4(Z.at)),X=(Z)=>{for(let K=Z+1;K<z.length;K+=1){let Y=z[K];if(Y!=null)return Y}return Number.POSITIVE_INFINITY};return $.map((Z,K)=>{let Y=z[K]??null,W=(K>0?z[K-1]:null)??null,B=Y!==null&&W!==null?Math.max(0,Y-W):null;if(Y===null)return j(B);let F=Y,O=Math.max(F,X(K)),N=(U)=>U!==null&&U>=F&&(U<O||O===Number.POSITIVE_INFINITY),_=J.filter((U)=>N(s4(U.startedAt))),A=Q.filter((U)=>h$.has(U.level)&&N(s4(U.at))),P=_.map((U)=>U.durationMs).filter((U)=>typeof U==="number");return{elapsedMs:B,requests:_,failedRequests:_.filter(g3),consoleErrors:A,slowestMs:P.length>0?Math.max(...P):null}})}function p$($,J){return $.requests.length===0&&$.consoleErrors.length===0&&($.elapsedMs===null||$.elapsedMs<J)}function d$($){if($<1000)return`${Math.round($)} มิลลิวินาที`;let J=$/1000;if(J<10)return`${J.toFixed(1)} วิ`;if(J<60)return`${Math.round(J)} วิ`;let Q=Math.floor(J/60),j=Math.round(J%60);return j===0?`${Q} นาที`:`${Q} นาที ${j} วิ`}export{v$ as unmountSupportChat,a2 as trimToBudget,h6 as toCurl,l2 as takeReplay,_8 as supportPortalUrl,N3 as supportFrameUrl,Y4 as submitRequest,V4 as submitBundle,t5 as stopReplay,j$ as stopLiveRing,I2 as startLiveRing,y8 as sizeInkCanvas,y0 as showToast,D7 as setErroredQueriesSource,$2 as requestTypesNow,m$ as requestPath,a as reporterStrings,g$ as refreshSupportChat,P0 as redactUrl,n0 as redactLabel,s0 as redactHeaders,a0 as redactBody,O1 as readInkOp,B$ as panelHeight,Q4 as packReplay,M4 as openSupportPortal,f3 as openSupportChat,p2 as onLaunch,d2 as onCrash,m1 as mountSupportChat,i3 as moduleResolver,v0 as loadRequestTypes,P1 as launch,a5 as isReplayRecording,p$ as isQuietStep,g3 as isFailedRequest,H1 as isConfigured,b$ as installDebugCapture,_4 as inkAlpha,M9 as hasCause,i2 as getNetworkLog,u2 as getConsoleLog,R as getConfig,h2 as getActionTrail,d$ as formatDuration,n2 as errorSignature,c2 as emitCrash,q4 as defineReporterElement,D4 as createAnnotator,u$ as correlateActionTrail,m3 as configureDebugCapture,b1 as closeSupportChat,_3 as chatLift,n1 as captureScreen,H9 as bundleToMarkdown,F9 as bundleFileName,B1 as buildBundle,O3 as badgeText,H0 as appInfo,v2 as actionCountSuffix,Q1 as REPORTER_TAG,t6 as REPLAY_FILENAME,o0 as REDACTED,X2 as NoIdentityError,w7 as LASER_TRAIL_MS,y7 as LASER_LINGER_MS,v8 as InkSender,D2 as InkScene,U2 as InkPainter,g7 as INK_STALE_MS,g8 as INK_SEND_EVERY_MS,k7 as INK_MAX_POINTS_PER_OP,C4 as INK_KEEP_MS,x7 as INK_HOLD_MS,f7 as INK_FADE_MS,w8 as INK_COLORS,s2 as BUNDLE_BUDGET_BYTES};