@lightworkai.official/debug-capture 0.17.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -412,6 +412,14 @@ nothing is drawn here, and the team is told that only they see the marks.
412
412
  Nothing to configure. Hosts on 0.16 still get the call; only the marks are
413
413
  missing there.
414
414
 
415
+ **0.17.1** — dragging the call is sturdier. While the call is moved by its top
416
+ line, the widget also follows the pointer on your page, so a quick drag that
417
+ leaves the call's frame on its first move still moves it, and a release your
418
+ page never heard no longer leaves the call following the pointer afterwards.
419
+ While the person shares their screen, the call itself folds to a single bar,
420
+ so it covers very little of your page; that comes from the support host and
421
+ needs no update here.
422
+
415
423
 
416
424
  ## Installing
417
425
 
@@ -1,4 +1,4 @@
1
- (()=>{var Q6=((z)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(z,{get:(J,$)=>(typeof require<"u"?require:J)[$]}):z)(function(z){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+z+'" is not supported')});var Z6={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},y=null;function Q2(z){let J=[];if(!z.host?.trim())J.push("host");if(!z.realmKey?.trim())J.push("realmKey");if(!z.app?.name?.trim())J.push("app.name");if(typeof z.module!=="function")J.push("module");if(J.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${J.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");y=z}function N(){if(!y)throw Error("[debug-capture] configureDebugCapture() has not been called");return y}function r0(){return y!==null}function n(){let z=N().app;return{name:z.name,version:z.version??"0.0.0",environment:z.environment??V6()}}function V6(){if(typeof window>"u")return"unknown";let z=window.location.hostname;if(z==="localhost"||z==="127.0.0.1"||z.endsWith(".local"))return"development";return"production"}function $0(z){let J=y?.capture?.[z];return typeof J==="number"?J:Z6[z]}function n0(z){let J=y?.module;if(!J)return null;try{return J(z)??null}catch{return null}}function s0(){let z=y?.redact;return{headers:z?.headers??[],queryKeys:(z?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:(z?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function Z2(){return y?.capture?.overlaySelectors??[]}var X6='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',W6="[data-lw-mask]",j2={fps:1,quality:0.5};function k0(){let z=y?.replay;if(!z)return null;let J=z===!0?{}:z,$=(Z,X)=>typeof Z==="number"&&Z>0?Z:X,j=J.maskInputs!==!1,Q=J.recordCanvas?{fps:$(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,j2.fps),quality:$(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,j2.quality)}:null;return{seconds:$(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?X6:W6),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(J.maxBytes,4000000),canvas:Q}}function V2(z){if(typeof window>"u")return!1;let J;try{J=new URL(z,window.location.href)}catch{return!1}if(Y6(J))return!1;if(J.origin===window.location.origin)return!0;return(y?.capture?.bodyOrigins??[]).some(($)=>{try{return new URL($).origin===J.origin}catch{return!1}})}function Y6(z){if(!y?.host)return!1;try{if(new URL(y.host).origin!==z.origin)return!1}catch{return!1}return z.pathname.startsWith("/ingest/")}function X2(z){let J=Object.entries(z).map(([$,j])=>[$.replace(/\/+$/,"")||"/",j]).sort(($,j)=>j[0].length-$[0].length);return($)=>{let j=($||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of J)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var A0="‹redacted›",K6=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,G6=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),H6=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,U6=/[\w.+-]+@[\w-]+\.[\w.-]+/g,F6=/\d(?:[\d\s-]{7,})\d/g;function T0(z){return z.replace(U6,A0).replace(F6,A0)}function P6(z){if(K6.test(z))return!0;return s0().headers.some(($)=>$.toLowerCase()===z.toLowerCase())}function f0(z){let J={};for(let[$,j]of Object.entries(z))J[$]=P6($)?A0:j;return J}function j0(z){try{let J=/^https?:\/\//i.test(z),$=new URL(z,J?void 0:"http://local.invalid"),j=!1;if($.searchParams.forEach((Q,Z)=>{if(G6.has(Z.toLowerCase())||s0().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,A0),j=!0}),!j)return z;return J?$.toString():`${$.pathname}${$.search}`}catch{return z}}function M1(z,J){if(J>6||z===null||typeof z!=="object")return z;if(Array.isArray(z))return z.map((j)=>M1(j,J+1));let $={};for(let[j,Q]of Object.entries(z)){let Z=H6.test(j)||s0().bodyKeys.some((X)=>j.toLowerCase().includes(X));$[j]=Z?A0:M1(Q,J+1)}return $}function w0(z,J){if(z==null)return null;let $=z,j=z.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);$=JSON.stringify(M1(Q,0))}catch{}if($.length>J)return`${$.slice(0,J)}… [truncated ${$.length-J} chars]`;return $}var N1=120,I1=40,N0=(z,J)=>z.length>J?`${z.slice(0,J)}…`:z,C1=(z)=>{try{return decodeURIComponent(z)}catch{return z}},M0=[],W2=0,Y2=!1;function x0(z,J,$,j){let Q=N0(J,N1),Z=M0[M0.length-1];if(z==="navigate"&&Z?.kind==="click"){let Y=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${Y}`))return Z.at=new Date().toISOString(),Z;let H=Y.split(/[?#]/)[0]??Y,F=Z.source?C1(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(F&&(H===F||H.startsWith(F)))return Z.detail=N0(`${Z.detail} → ${Y}`,N1),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===z&&Z.detail===Q){if(Z.at=new Date().toISOString(),z!=="navigate")Z.count=(Z.count??1)+1;return Z}W2+=1;let X={id:`act_${W2}`,at:new Date().toISOString(),kind:z,detail:Q,count:1,source:$,html:t0(j)};M0.push(X);while(M0.length>$0("maxActions"))D6(M0.shift());return X}var q6=200000,E0=0;function t0(z){if(!z)return;if(E0+z.length>q6)return;return E0+=z.length,z}function D6(z){if(!z)return;if(E0-=(z.html?.length??0)+(z.afterHtml?.length??0),E0<0)E0=0}function a0(z){return z instanceof Element&&Boolean(z.closest("[data-debug-reporter]"))}var B6='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',M6={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},K2={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function N6(z){let J=z.getAttribute("role");if(J&&K2[J])return K2[J];return M6[z.tagName.toLowerCase()]??"ปุ่ม"}function I6(z,J){try{let $=z,j=0;while($&&j<=J){let Q=q2($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function C6(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("title")?.trim();if($)return $;if(z instanceof HTMLInputElement||z instanceof HTMLTextAreaElement||z instanceof HTMLSelectElement)return(z.getAttribute("placeholder")||z.getAttribute("name")||"").trim();if(z instanceof HTMLImageElement)return(z.getAttribute("alt")||"").trim();let j=(z.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(z instanceof HTMLAnchorElement){let Q=z.getAttribute("href");if(Q?.startsWith("/"))return C1(Q)}return""}function O6(z){if(!(z instanceof Element))return null;let J=z.closest(B6)??I6(z,4);if(!J)return null;let $=J.tagName.toLowerCase();if($==="html"||$==="body")return null;return J}function _6(z){let J=T0(C6(z));if(!J)return null;return`${N6(z)} “${N0(J,I1)}”`}var P2=6000,S6=4000,L6=/(?:^|\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 R6(z){z.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let J=[z,...Array.from(z.querySelectorAll("*"))];for(let Q of J){for(let X of Array.from(Q.attributes)){let Y=X.name.toLowerCase();if(Y.startsWith("on")||Y==="srcdoc"||Y==="value"||Y.startsWith("data-"))Q.removeAttribute(X.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let X=Z.replace(L6," ").replace(/\s+/g," ").trim();if(X)Q.setAttribute("class",X);else Q.removeAttribute("class")}}let $=document.createTreeWalker(z,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=T0(j.nodeValue);j=$.nextNode()}}function O1(z,J,$){try{let j=z.outerHTML;if(!j||j.length>J)return;let Q=z.cloneNode(!0);R6(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var k6=(z)=>O1(z,P2,S6),A6=150000,T6=40000,G2=(z)=>O1(z,A6,T6);function f6(z){if(!(z instanceof HTMLInputElement)&&!(z instanceof HTMLTextAreaElement)&&!(z instanceof HTMLSelectElement))return null;let J=z.name||z.id||z.getAttribute("aria-label")||z.getAttribute("placeholder")||z.tagName.toLowerCase();return`ช่อง “${T0(J)}”`}var H2=80;function q2(z){let J=Object.keys(z).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return J?z[J]:null}function w6(z){if(typeof z!=="function")return null;try{let J=Function.prototype.toString.call(z);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function U2(z){if(!z)return;return`→ ${z.length>H2?`${z.slice(0,H2)}…`:z}`}function x6(z){try{let J=z.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return U2(J);let $=q2(z),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return U2(w6($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var E6='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function b6(){let z=Z2();return z.length?z.join(", "):E6}function g6(z){let J=z.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function h6(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((X)=>document.getElementById(X)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=z.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(z.textContent??"").replace(/\s+/g," ").trim()}function D2(z){let J=T0(h6(z)),$=g6(z);return J?`เปิด ${$} “${N0(J,I1)}”`:`เปิด ${$}`}var y6='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',m6=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function v6(z){if(z.querySelector(y6))return!0;return m6.test(z.textContent??"")}var u6=400,p6=250,d6=8000;function i6(z,J){if(typeof MutationObserver>"u"){J.html=t0(G2(z));return}let $=Date.now(),j=!1,Q=()=>{j=!0,X.disconnect(),window.clearInterval(Y),window.clearTimeout(H)},Z=()=>{if(j)return;if(Q(),!z.isConnected)return;J.detail=N0(D2(z),N1),J.html=t0(G2(z))},X=new MutationObserver(()=>{$=Date.now()});X.observe(z,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let Y=window.setInterval(()=>{if(j)return;if(!z.isConnected){Q();return}if(Date.now()-$>=u6&&!v6(z))Z()},p6),H=window.setTimeout(Z,d6)}function c6(z){if(a0(z))return;let J=x0("ui",D2(z));if(J)i6(z,J)}function l6(){if(typeof MutationObserver>"u")return;let z=new WeakSet;new MutationObserver(($)=>{for(let j of $)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=b6(),X=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let Y of X){if(z.has(Y))continue;z.add(Y),c6(Y)}}}).observe(document.body,{childList:!0,subtree:!0})}var o6=1600,r6=2500;function F2(z){return{disabled:z.hasAttribute("disabled")||z.getAttribute("aria-disabled")==="true",busy:z.getAttribute("aria-busy")==="true",text:N0((z.textContent??"").replace(/\s+/g," ").trim(),I1)}}function n6(z,J){if(!z.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!z.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(z.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function s6(z,J){if(typeof MutationObserver>"u")return;let $=F2(z),j=!1,Q=(Y,H)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(X),J.afterNote=Y,H)J.afterHtml=t0(O1(z,P2,r6))},Z=new MutationObserver(()=>{if(!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let Y=n6($,F2(z));if(Y)Q(Y,!0)});Z.observe(z,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let X=window.setTimeout(()=>{if(!j&&!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},o6)}function B2(){if(Y2||typeof window>"u")return;Y2=!0,document.addEventListener("click",(j)=>{if(a0(j.target))return;let Q=O6(j.target);if(!Q)return;let Z=_6(Q);if(!Z)return;let X=x0("click",`คลิก ${Z}`,x6(Q),k6(Q));if(X)s6(Q,X)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(a0(j.target))return;let Q=f6(j.target);if(Q)x0("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(a0(j.target))return;x0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let z=()=>x0("navigate",`ไปที่ ${C1(j0(location.pathname+location.search))}`),J=history.pushState.bind(history),$=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=J(...j);return z(),Q},history.replaceState=(...j)=>{let Q=$(...j);return z(),Q},window.addEventListener("popstate",z),l6()}function M2(){return M0.map((z)=>({...z}))}var N2=2000,e0=[],I2=0,C2=!1;function _1(z,J){I2+=1,e0.push({id:`log_${I2}`,at:new Date().toISOString(),level:z,message:J.length>N2?`${J.slice(0,N2)}…`:J});while(e0.length>$0("maxConsoleEntries"))e0.shift()}function a6(){let z=new WeakSet;return(J,$)=>{if(typeof $==="object"&&$!==null){if(z.has($))return"[Circular]";z.add($)}if(typeof $==="bigint")return $.toString();return $}}function O2(z){if(typeof z==="string")return z;if(z instanceof Error)return`${z.name}: ${z.message}`;try{let J=JSON.stringify(z,a6());if(J!==void 0)return J}catch{}try{return String(z)}catch{}try{return Object.prototype.toString.call(z)}catch{return`[${typeof z}]`}}function _2(){if(C2||typeof window>"u")return;C2=!0;let z=["log","info","warn","error","debug"];for(let J of z){let $=console[J].bind(console);console[J]=(...j)=>{_1(J,j.map(O2).join(" ")),$(...j)}}window.addEventListener("error",(J)=>{let $=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";_1("exception",`${J.message}${$}`)}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:O2(J.reason);_1("unhandledrejection",$)})}function S2(){return e0.map((z)=>({...z}))}var L2=new Set,R2=new Set;function k2(z,J){return z.add(J),()=>z.delete(J)}function A2(z,J){for(let $ of[...z])$(J)}function T2(z){return k2(L2,z)}function z1(z={type:"manual"}){A2(L2,z)}function f2(z){return k2(R2,z)}function w2(z){A2(R2,z)}var t6=15000,e6=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],x2=!1,E2=0;function z8(z){return e6.some((J)=>z.includes(J))}function b2(z){let J=z.message??"";if(!J||z8(J))return;let $=Date.now();if($-E2<t6)return;E2=$,w2({...z,message:J})}function g2(){if(x2||typeof window>"u")return;x2=!0,window.addEventListener("error",(z)=>{if(!z.message&&!z.error)return;let J=z.error instanceof Error?z.error:null;b2({type:"runtime-error",message:z.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",(z)=>{let J=z.reason;b2({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var v2=4000,J8=1e6,$8=1e7,J1=[],h2=0,y2=!1;function u2(z){J1.push(z);while(J1.length>$0("maxRequests"))J1.shift()}function p2(){return h2+=1,`req_${h2}`}function m2(z){let J={};if(!z)return J;if(z instanceof Headers)z.forEach(($,j)=>{J[j]=$});else if(Array.isArray(z))for(let[$,j]of z)J[$]=j;else Object.assign(J,z);return J}function j8(z){let J={};return z.forEach(($,j)=>{J[j]=$}),J}function Q8(z){if(z==null)return null;if(typeof z==="string")return z;if(z instanceof URLSearchParams)return z.toString();if(typeof FormData<"u"&&z instanceof FormData)return`[FormData: ${Array.from(z.keys()).join(", ")}]`;if(typeof Blob<"u"&&z instanceof Blob)return`[Blob ${z.size} bytes]`;if(z instanceof ArrayBuffer)return`[ArrayBuffer ${z.byteLength} bytes]`;return"[binary]"}function Z8(z,J){let $="",j="GET",Q={},Z=null;if(typeof z==="string")$=z;else if(z instanceof URL)$=z.toString();else $=z.url,j=z.method||j,Q=m2(z.headers);if(J){if(J.method)j=J.method;if(J.headers)Q={...Q,...m2(J.headers)};if(J.body!==void 0)Z=Q8(J.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function d2(z){return!V2(z)}function V8(z,J){if(d2(J.url)){J.responseSnippet="[body not captured for this origin]";return}let $=z.headers.get("content-type")??"",j=Number(z.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test($)){J.responseSnippet=`[binary ${$||"unknown"}${Q}]`;return}if(j>J8){J.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{z.clone().text().then((Z)=>{J.responseSnippet=w0(Z,$0("maxBodyChars"))}).catch(()=>{})}catch{}}function i2(z,J){if(/[?&]_rsc=/.test(z))return!0;for(let $ of Object.keys(J)){let j=$.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function X8(){if(typeof window>"u"||typeof window.fetch!=="function")return;let z=window.fetch.bind(window);window.fetch=Object.assign(async(J,$)=>{let j=Z8(J,$);if(i2(j.url,j.headers))return z(J,$);let Q={id:p2(),startedAt:new Date().toISOString(),method:j.method,url:j0(j.url),requestHeaders:f0(j.headers),requestBody:w0(j.body,v2),status:null,statusText:null,durationMs:null,via:"fetch"};u2(Q);let Z=performance.now();try{let X=await z(J,$);return Q.status=X.status,Q.statusText=X.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=f0(j8(X.headers)),V8(X,Q),X}catch(X){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=X instanceof Error?`${X.name}: ${X.message}`:String(X),X}},z)}function W8(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let z=XMLHttpRequest.prototype,J=z.open,$=z.send,j=function(Z,X){let Y=typeof X==="string"?X:X.toString();return this.__lwEntry=i2(Y,{})?void 0:{id:p2(),startedAt:"",method:(Z||"GET").toUpperCase(),url:j0(Y),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},Q=function(Z){let X=this.__lwEntry;if(X){X.startedAt=new Date().toISOString(),X.requestBody=typeof Z==="string"?w0(Z,v2):Z==null?null:"[non-string body]";let Y=performance.now();u2(X),this.addEventListener("loadend",()=>{if(X.status=this.status||null,X.statusText=this.statusText||null,X.durationMs=Math.round(performance.now()-Y),d2(X.url))X.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{X.responseSnippet=w0(this.responseText||"",$0("maxBodyChars"))}catch{}else{let H=this.getResponseHeader("content-type")??this.responseType;X.responseSnippet=`[binary ${H}]`}})}return $.apply(this,arguments)};z.open=j,z.send=Q}function c2(){if(y2)return;y2=!0,X8(),W8()}function l2(){let z=J1.map(($)=>({...$})),J=0;for(let $=z.length-1;$>=0;$-=1){let j=z[$],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(J+Q.length>$8)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else J+=Q.length}return z}var Y8=4,o2=3,K8=4000,G8="[data-debug-reporter]",r2=()=>import("@rrweb/record");function n2(z){r2=z}var v=[],S1=null,$1=!1;function s2(){if(typeof window>"u"||S1||$1)return;let z=k0();if(!z)return;$1=!0;let J=()=>void H8(z);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function H8(z){let J;try{J=(await r2()).record}catch($){$1=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(S1)return;try{S1=J({emit:($)=>U8($),checkoutEveryNms:Math.max(1000,z.seconds*1000/2),checkoutEveryNth:K8,maskAllInputs:z.maskInputs,maskTextSelector:z.maskText?"*":z.maskTextSelector,blockSelector:`${z.blockSelector}, ${G8}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...z.canvas?{canvas:z.canvas.fps}:{}},recordCanvas:z.canvas!==null,...z.canvas?{dataURLOptions:{type:"image/webp",quality:z.canvas.quality}}:{},errorHandler:()=>!0})??null}catch($){console.warn("[debug-capture] session replay could not start:",$)}finally{$1=!1}}function U8(z){if(z.type===Y8||v.length===0){if(v.push([]),v.length>o2)v=v.slice(-o2)}v[v.length-1].push(z)}function a2(z=Date.now()){let J=k0();if(!J||!v.length)return null;let $=z-J.seconds*1000,j=v.length-1;while(j>0&&(v[j][0]?.timestamp??z)>$)j-=1;let Q=v.slice(j).flat(),Z=Q[0]?.timestamp,X=Q[Q.length-1]?.timestamp;if(Z===void 0||X===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(X).toISOString(),durationMs:Math.max(0,X-Z)}}var F8={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindRequest:"คำขอ",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",problemInsteadShare:"แจ้งปัญหาแทน (แนบภาพหน้าจอ)",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTypeSearch:"ค้นหาเรื่องที่ขอ",requestTypeNone:"ไม่พบเรื่องที่ขอ — ลองคำอื่น",requestTypeCount:"{n} เรื่อง — เลื่อนดูหรือพิมพ์ค้นหา",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง",ringTitle:"ทีมงานกำลังโทรหาคุณ",ringAbout:"เรื่อง {key} · {title}",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า"},P8={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",failedOffline:"Could not send — the server could not be reached. What you wrote is still here; check your connection and try again.",failedUnavailable:"Could not send — the system is being updated. What you wrote is still here; try again in a moment.",failedTooMany:"Too many reports — try again in {seconds} seconds.",captured:"Captured",reporter:"Reporter",page:"Page",replay:"activity log",handoffTitle:"Opening the support portal",handoffBody:"You will be signed in automatically to see what you reported",handoffGo:"Go now",handoffPreparing:"Preparing…",handoffFailed:"Could not open your reports",handoffBlocked:"Your browser blocked the new tab",handoffOpen:"Open in a new tab",chooseTitle:"How can the team help?",kindProblem:"Report a problem",kindRequest:"Request",askInstead:"Asking for something?",askInsteadAction:"Choose what you need",problemInstead:"Something broken?",problemInsteadAction:"Report a problem instead",problemInsteadShare:"Report a problem instead (with a screenshot)",chooseProblemHint:"Something is broken or not working — with a screenshot",chooseRequestHint:"Ask the team to do something, like access or a data change — no screen sharing",requestTitle:"Ask the team",requestTypeLabel:"What you need",requestTypeSearch:"Search what you need",requestTypeNone:"Nothing matches — try another word",requestTypeCount:"{n} to choose from — scroll or search",requestTarget:"The team aims to finish within {time}",requestSummaryLabel:"Subject",requestSummaryPlaceholder:"What do you need — briefly",requestDetailLabel:"Details (optional)",requestDetailPlaceholder:"What the team needs to know to do it",requestSubmit:"Send request",requestSubmitted:"Request sent",requestWithShot:"Attach this screenshot to the request",requestAnnotateHint:"Mark what you are asking about — box it, point at it, highlight it, or type on it",draftRestored:"What you typed last time, not sent yet",draftClear:"Clear",requestLeaves:"Not sent with a request",requestLeavesWhat:"this page's activity log — it is for problem reports only",days:"{n} days",hours:"{n} hours",ringTitle:"The support team is calling you",ringAbout:"About {key} · {title}",ringHow:"Answer on your request's page — it opens in a new tab, already signed in",ringOpen:"Open to answer",ringDecline:"Decline",ringOpened:"Opened — press Answer in the new tab",ringBlocked:"Your browser blocked the new tab — open the call here",ringClose:"Close",ringTab:"\uD83D\uDCDE Incoming call"};function U0(z){return z==="en"?P8:F8}var q8="lw-debug-toasts",D8=6000,B8=`
1
+ (()=>{var X6=((z)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(z,{get:(J,$)=>(typeof require<"u"?require:J)[$]}):z)(function(z){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+z+'" is not supported')});var W6={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},v=null;function X2(z){let J=[];if(!z.host?.trim())J.push("host");if(!z.realmKey?.trim())J.push("realmKey");if(!z.app?.name?.trim())J.push("app.name");if(typeof z.module!=="function")J.push("module");if(J.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${J.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");v=z}function N(){if(!v)throw Error("[debug-capture] configureDebugCapture() has not been called");return v}function n0(){return v!==null}function s(){let z=N().app;return{name:z.name,version:z.version??"0.0.0",environment:z.environment??Y6()}}function Y6(){if(typeof window>"u")return"unknown";let z=window.location.hostname;if(z==="localhost"||z==="127.0.0.1"||z.endsWith(".local"))return"development";return"production"}function j0(z){let J=v?.capture?.[z];return typeof J==="number"?J:W6[z]}function s0(z){let J=v?.module;if(!J)return null;try{return J(z)??null}catch{return null}}function a0(){let z=v?.redact;return{headers:z?.headers??[],queryKeys:(z?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:(z?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function W2(){return v?.capture?.overlaySelectors??[]}var K6='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',G6="[data-lw-mask]",V2={fps:1,quality:0.5};function k0(){let z=v?.replay;if(!z)return null;let J=z===!0?{}:z,$=(Z,X)=>typeof Z==="number"&&Z>0?Z:X,j=J.maskInputs!==!1,Q=J.recordCanvas?{fps:$(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,V2.fps),quality:$(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,V2.quality)}:null;return{seconds:$(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?K6:G6),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(J.maxBytes,4000000),canvas:Q}}function Y2(z){if(typeof window>"u")return!1;let J;try{J=new URL(z,window.location.href)}catch{return!1}if(H6(J))return!1;if(J.origin===window.location.origin)return!0;return(v?.capture?.bodyOrigins??[]).some(($)=>{try{return new URL($).origin===J.origin}catch{return!1}})}function H6(z){if(!v?.host)return!1;try{if(new URL(v.host).origin!==z.origin)return!1}catch{return!1}return z.pathname.startsWith("/ingest/")}function K2(z){let J=Object.entries(z).map(([$,j])=>[$.replace(/\/+$/,"")||"/",j]).sort(($,j)=>j[0].length-$[0].length);return($)=>{let j=($||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of J)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var A0="‹redacted›",U6=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,P6=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),F6=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,q6=/[\w.+-]+@[\w-]+\.[\w.-]+/g,D6=/\d(?:[\d\s-]{7,})\d/g;function T0(z){return z.replace(q6,A0).replace(D6,A0)}function B6(z){if(U6.test(z))return!0;return a0().headers.some(($)=>$.toLowerCase()===z.toLowerCase())}function x0(z){let J={};for(let[$,j]of Object.entries(z))J[$]=B6($)?A0:j;return J}function Q0(z){try{let J=/^https?:\/\//i.test(z),$=new URL(z,J?void 0:"http://local.invalid"),j=!1;if($.searchParams.forEach((Q,Z)=>{if(P6.has(Z.toLowerCase())||a0().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,A0),j=!0}),!j)return z;return J?$.toString():`${$.pathname}${$.search}`}catch{return z}}function I1(z,J){if(J>6||z===null||typeof z!=="object")return z;if(Array.isArray(z))return z.map((j)=>I1(j,J+1));let $={};for(let[j,Q]of Object.entries(z)){let Z=F6.test(j)||a0().bodyKeys.some((X)=>j.toLowerCase().includes(X));$[j]=Z?A0:I1(Q,J+1)}return $}function E0(z,J){if(z==null)return null;let $=z,j=z.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);$=JSON.stringify(I1(Q,0))}catch{}if($.length>J)return`${$.slice(0,J)}… [truncated ${$.length-J} chars]`;return $}var C1=120,O1=40,N0=(z,J)=>z.length>J?`${z.slice(0,J)}…`:z,_1=(z)=>{try{return decodeURIComponent(z)}catch{return z}},M0=[],G2=0,H2=!1;function f0(z,J,$,j){let Q=N0(J,C1),Z=M0[M0.length-1];if(z==="navigate"&&Z?.kind==="click"){let Y=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${Y}`))return Z.at=new Date().toISOString(),Z;let H=Y.split(/[?#]/)[0]??Y,P=Z.source?_1(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(P&&(H===P||H.startsWith(P)))return Z.detail=N0(`${Z.detail} → ${Y}`,C1),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===z&&Z.detail===Q){if(Z.at=new Date().toISOString(),z!=="navigate")Z.count=(Z.count??1)+1;return Z}G2+=1;let X={id:`act_${G2}`,at:new Date().toISOString(),kind:z,detail:Q,count:1,source:$,html:e0(j)};M0.push(X);while(M0.length>j0("maxActions"))N6(M0.shift());return X}var M6=200000,w0=0;function e0(z){if(!z)return;if(w0+z.length>M6)return;return w0+=z.length,z}function N6(z){if(!z)return;if(w0-=(z.html?.length??0)+(z.afterHtml?.length??0),w0<0)w0=0}function t0(z){return z instanceof Element&&Boolean(z.closest("[data-debug-reporter]"))}var I6='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',C6={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},U2={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function O6(z){let J=z.getAttribute("role");if(J&&U2[J])return U2[J];return C6[z.tagName.toLowerCase()]??"ปุ่ม"}function _6(z,J){try{let $=z,j=0;while($&&j<=J){let Q=M2($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function S6(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("title")?.trim();if($)return $;if(z instanceof HTMLInputElement||z instanceof HTMLTextAreaElement||z instanceof HTMLSelectElement)return(z.getAttribute("placeholder")||z.getAttribute("name")||"").trim();if(z instanceof HTMLImageElement)return(z.getAttribute("alt")||"").trim();let j=(z.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(z instanceof HTMLAnchorElement){let Q=z.getAttribute("href");if(Q?.startsWith("/"))return _1(Q)}return""}function L6(z){if(!(z instanceof Element))return null;let J=z.closest(I6)??_6(z,4);if(!J)return null;let $=J.tagName.toLowerCase();if($==="html"||$==="body")return null;return J}function R6(z){let J=T0(S6(z));if(!J)return null;return`${O6(z)} “${N0(J,O1)}”`}var B2=6000,k6=4000,A6=/(?:^|\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 T6(z){z.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let J=[z,...Array.from(z.querySelectorAll("*"))];for(let Q of J){for(let X of Array.from(Q.attributes)){let Y=X.name.toLowerCase();if(Y.startsWith("on")||Y==="srcdoc"||Y==="value"||Y.startsWith("data-"))Q.removeAttribute(X.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let X=Z.replace(A6," ").replace(/\s+/g," ").trim();if(X)Q.setAttribute("class",X);else Q.removeAttribute("class")}}let $=document.createTreeWalker(z,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=T0(j.nodeValue);j=$.nextNode()}}function S1(z,J,$){try{let j=z.outerHTML;if(!j||j.length>J)return;let Q=z.cloneNode(!0);T6(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var x6=(z)=>S1(z,B2,k6),E6=150000,f6=40000,P2=(z)=>S1(z,E6,f6);function w6(z){if(!(z instanceof HTMLInputElement)&&!(z instanceof HTMLTextAreaElement)&&!(z instanceof HTMLSelectElement))return null;let J=z.name||z.id||z.getAttribute("aria-label")||z.getAttribute("placeholder")||z.tagName.toLowerCase();return`ช่อง “${T0(J)}”`}var F2=80;function M2(z){let J=Object.keys(z).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return J?z[J]:null}function b6(z){if(typeof z!=="function")return null;try{let J=Function.prototype.toString.call(z);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function q2(z){if(!z)return;return`→ ${z.length>F2?`${z.slice(0,F2)}…`:z}`}function g6(z){try{let J=z.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return q2(J);let $=M2(z),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return q2(b6($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var h6='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function y6(){let z=W2();return z.length?z.join(", "):h6}function v6(z){let J=z.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function m6(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((X)=>document.getElementById(X)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=z.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(z.textContent??"").replace(/\s+/g," ").trim()}function N2(z){let J=T0(m6(z)),$=v6(z);return J?`เปิด ${$} “${N0(J,O1)}”`:`เปิด ${$}`}var u6='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',p6=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function d6(z){if(z.querySelector(u6))return!0;return p6.test(z.textContent??"")}var i6=400,c6=250,l6=8000;function o6(z,J){if(typeof MutationObserver>"u"){J.html=e0(P2(z));return}let $=Date.now(),j=!1,Q=()=>{j=!0,X.disconnect(),window.clearInterval(Y),window.clearTimeout(H)},Z=()=>{if(j)return;if(Q(),!z.isConnected)return;J.detail=N0(N2(z),C1),J.html=e0(P2(z))},X=new MutationObserver(()=>{$=Date.now()});X.observe(z,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let Y=window.setInterval(()=>{if(j)return;if(!z.isConnected){Q();return}if(Date.now()-$>=i6&&!d6(z))Z()},c6),H=window.setTimeout(Z,l6)}function r6(z){if(t0(z))return;let J=f0("ui",N2(z));if(J)o6(z,J)}function n6(){if(typeof MutationObserver>"u")return;let z=new WeakSet;new MutationObserver(($)=>{for(let j of $)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=y6(),X=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let Y of X){if(z.has(Y))continue;z.add(Y),r6(Y)}}}).observe(document.body,{childList:!0,subtree:!0})}var s6=1600,a6=2500;function D2(z){return{disabled:z.hasAttribute("disabled")||z.getAttribute("aria-disabled")==="true",busy:z.getAttribute("aria-busy")==="true",text:N0((z.textContent??"").replace(/\s+/g," ").trim(),O1)}}function t6(z,J){if(!z.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!z.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(z.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function e6(z,J){if(typeof MutationObserver>"u")return;let $=D2(z),j=!1,Q=(Y,H)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(X),J.afterNote=Y,H)J.afterHtml=e0(S1(z,B2,a6))},Z=new MutationObserver(()=>{if(!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let Y=t6($,D2(z));if(Y)Q(Y,!0)});Z.observe(z,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let X=window.setTimeout(()=>{if(!j&&!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},s6)}function I2(){if(H2||typeof window>"u")return;H2=!0,document.addEventListener("click",(j)=>{if(t0(j.target))return;let Q=L6(j.target);if(!Q)return;let Z=R6(Q);if(!Z)return;let X=f0("click",`คลิก ${Z}`,g6(Q),x6(Q));if(X)e6(Q,X)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(t0(j.target))return;let Q=w6(j.target);if(Q)f0("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(t0(j.target))return;f0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let z=()=>f0("navigate",`ไปที่ ${_1(Q0(location.pathname+location.search))}`),J=history.pushState.bind(history),$=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=J(...j);return z(),Q},history.replaceState=(...j)=>{let Q=$(...j);return z(),Q},window.addEventListener("popstate",z),n6()}function C2(){return M0.map((z)=>({...z}))}var O2=2000,z1=[],_2=0,S2=!1;function L1(z,J){_2+=1,z1.push({id:`log_${_2}`,at:new Date().toISOString(),level:z,message:J.length>O2?`${J.slice(0,O2)}…`:J});while(z1.length>j0("maxConsoleEntries"))z1.shift()}function z8(){let z=new WeakSet;return(J,$)=>{if(typeof $==="object"&&$!==null){if(z.has($))return"[Circular]";z.add($)}if(typeof $==="bigint")return $.toString();return $}}function L2(z){if(typeof z==="string")return z;if(z instanceof Error)return`${z.name}: ${z.message}`;try{let J=JSON.stringify(z,z8());if(J!==void 0)return J}catch{}try{return String(z)}catch{}try{return Object.prototype.toString.call(z)}catch{return`[${typeof z}]`}}function R2(){if(S2||typeof window>"u")return;S2=!0;let z=["log","info","warn","error","debug"];for(let J of z){let $=console[J].bind(console);console[J]=(...j)=>{L1(J,j.map(L2).join(" ")),$(...j)}}window.addEventListener("error",(J)=>{let $=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";L1("exception",`${J.message}${$}`)}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:L2(J.reason);L1("unhandledrejection",$)})}function k2(){return z1.map((z)=>({...z}))}var A2=new Set,T2=new Set;function x2(z,J){return z.add(J),()=>z.delete(J)}function E2(z,J){for(let $ of[...z])$(J)}function f2(z){return x2(A2,z)}function J1(z={type:"manual"}){E2(A2,z)}function w2(z){return x2(T2,z)}function b2(z){E2(T2,z)}var J8=15000,$8=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],g2=!1,h2=0;function j8(z){return $8.some((J)=>z.includes(J))}function y2(z){let J=z.message??"";if(!J||j8(J))return;let $=Date.now();if($-h2<J8)return;h2=$,b2({...z,message:J})}function v2(){if(g2||typeof window>"u")return;g2=!0,window.addEventListener("error",(z)=>{if(!z.message&&!z.error)return;let J=z.error instanceof Error?z.error:null;y2({type:"runtime-error",message:z.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",(z)=>{let J=z.reason;y2({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var d2=4000,Q8=1e6,Z8=1e7,$1=[],m2=0,u2=!1;function i2(z){$1.push(z);while($1.length>j0("maxRequests"))$1.shift()}function c2(){return m2+=1,`req_${m2}`}function p2(z){let J={};if(!z)return J;if(z instanceof Headers)z.forEach(($,j)=>{J[j]=$});else if(Array.isArray(z))for(let[$,j]of z)J[$]=j;else Object.assign(J,z);return J}function V8(z){let J={};return z.forEach(($,j)=>{J[j]=$}),J}function X8(z){if(z==null)return null;if(typeof z==="string")return z;if(z instanceof URLSearchParams)return z.toString();if(typeof FormData<"u"&&z instanceof FormData)return`[FormData: ${Array.from(z.keys()).join(", ")}]`;if(typeof Blob<"u"&&z instanceof Blob)return`[Blob ${z.size} bytes]`;if(z instanceof ArrayBuffer)return`[ArrayBuffer ${z.byteLength} bytes]`;return"[binary]"}function W8(z,J){let $="",j="GET",Q={},Z=null;if(typeof z==="string")$=z;else if(z instanceof URL)$=z.toString();else $=z.url,j=z.method||j,Q=p2(z.headers);if(J){if(J.method)j=J.method;if(J.headers)Q={...Q,...p2(J.headers)};if(J.body!==void 0)Z=X8(J.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function l2(z){return!Y2(z)}function Y8(z,J){if(l2(J.url)){J.responseSnippet="[body not captured for this origin]";return}let $=z.headers.get("content-type")??"",j=Number(z.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test($)){J.responseSnippet=`[binary ${$||"unknown"}${Q}]`;return}if(j>Q8){J.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{z.clone().text().then((Z)=>{J.responseSnippet=E0(Z,j0("maxBodyChars"))}).catch(()=>{})}catch{}}function o2(z,J){if(/[?&]_rsc=/.test(z))return!0;for(let $ of Object.keys(J)){let j=$.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function K8(){if(typeof window>"u"||typeof window.fetch!=="function")return;let z=window.fetch.bind(window);window.fetch=Object.assign(async(J,$)=>{let j=W8(J,$);if(o2(j.url,j.headers))return z(J,$);let Q={id:c2(),startedAt:new Date().toISOString(),method:j.method,url:Q0(j.url),requestHeaders:x0(j.headers),requestBody:E0(j.body,d2),status:null,statusText:null,durationMs:null,via:"fetch"};i2(Q);let Z=performance.now();try{let X=await z(J,$);return Q.status=X.status,Q.statusText=X.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=x0(V8(X.headers)),Y8(X,Q),X}catch(X){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=X instanceof Error?`${X.name}: ${X.message}`:String(X),X}},z)}function G8(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let z=XMLHttpRequest.prototype,J=z.open,$=z.send,j=function(Z,X){let Y=typeof X==="string"?X:X.toString();return this.__lwEntry=o2(Y,{})?void 0:{id:c2(),startedAt:"",method:(Z||"GET").toUpperCase(),url:Q0(Y),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},Q=function(Z){let X=this.__lwEntry;if(X){X.startedAt=new Date().toISOString(),X.requestBody=typeof Z==="string"?E0(Z,d2):Z==null?null:"[non-string body]";let Y=performance.now();i2(X),this.addEventListener("loadend",()=>{if(X.status=this.status||null,X.statusText=this.statusText||null,X.durationMs=Math.round(performance.now()-Y),l2(X.url))X.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{X.responseSnippet=E0(this.responseText||"",j0("maxBodyChars"))}catch{}else{let H=this.getResponseHeader("content-type")??this.responseType;X.responseSnippet=`[binary ${H}]`}})}return $.apply(this,arguments)};z.open=j,z.send=Q}function r2(){if(u2)return;u2=!0,K8(),G8()}function n2(){let z=$1.map(($)=>({...$})),J=0;for(let $=z.length-1;$>=0;$-=1){let j=z[$],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(J+Q.length>Z8)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else J+=Q.length}return z}var H8=4,s2=3,U8=4000,P8="[data-debug-reporter]",a2=()=>import("@rrweb/record");function t2(z){a2=z}var u=[],R1=null,j1=!1;function e2(){if(typeof window>"u"||R1||j1)return;let z=k0();if(!z)return;j1=!0;let J=()=>void F8(z);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function F8(z){let J;try{J=(await a2()).record}catch($){j1=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(R1)return;try{R1=J({emit:($)=>q8($),checkoutEveryNms:Math.max(1000,z.seconds*1000/2),checkoutEveryNth:U8,maskAllInputs:z.maskInputs,maskTextSelector:z.maskText?"*":z.maskTextSelector,blockSelector:`${z.blockSelector}, ${P8}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...z.canvas?{canvas:z.canvas.fps}:{}},recordCanvas:z.canvas!==null,...z.canvas?{dataURLOptions:{type:"image/webp",quality:z.canvas.quality}}:{},errorHandler:()=>!0})??null}catch($){console.warn("[debug-capture] session replay could not start:",$)}finally{j1=!1}}function q8(z){if(z.type===H8||u.length===0){if(u.push([]),u.length>s2)u=u.slice(-s2)}u[u.length-1].push(z)}function z4(z=Date.now()){let J=k0();if(!J||!u.length)return null;let $=z-J.seconds*1000,j=u.length-1;while(j>0&&(u[j][0]?.timestamp??z)>$)j-=1;let Q=u.slice(j).flat(),Z=Q[0]?.timestamp,X=Q[Q.length-1]?.timestamp;if(Z===void 0||X===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(X).toISOString(),durationMs:Math.max(0,X-Z)}}var D8={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindRequest:"คำขอ",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",problemInsteadShare:"แจ้งปัญหาแทน (แนบภาพหน้าจอ)",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTypeSearch:"ค้นหาเรื่องที่ขอ",requestTypeNone:"ไม่พบเรื่องที่ขอ — ลองคำอื่น",requestTypeCount:"{n} เรื่อง — เลื่อนดูหรือพิมพ์ค้นหา",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง",ringTitle:"ทีมงานกำลังโทรหาคุณ",ringAbout:"เรื่อง {key} · {title}",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า"},B8={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",failedOffline:"Could not send — the server could not be reached. What you wrote is still here; check your connection and try again.",failedUnavailable:"Could not send — the system is being updated. What you wrote is still here; try again in a moment.",failedTooMany:"Too many reports — try again in {seconds} seconds.",captured:"Captured",reporter:"Reporter",page:"Page",replay:"activity log",handoffTitle:"Opening the support portal",handoffBody:"You will be signed in automatically to see what you reported",handoffGo:"Go now",handoffPreparing:"Preparing…",handoffFailed:"Could not open your reports",handoffBlocked:"Your browser blocked the new tab",handoffOpen:"Open in a new tab",chooseTitle:"How can the team help?",kindProblem:"Report a problem",kindRequest:"Request",askInstead:"Asking for something?",askInsteadAction:"Choose what you need",problemInstead:"Something broken?",problemInsteadAction:"Report a problem instead",problemInsteadShare:"Report a problem instead (with a screenshot)",chooseProblemHint:"Something is broken or not working — with a screenshot",chooseRequestHint:"Ask the team to do something, like access or a data change — no screen sharing",requestTitle:"Ask the team",requestTypeLabel:"What you need",requestTypeSearch:"Search what you need",requestTypeNone:"Nothing matches — try another word",requestTypeCount:"{n} to choose from — scroll or search",requestTarget:"The team aims to finish within {time}",requestSummaryLabel:"Subject",requestSummaryPlaceholder:"What do you need — briefly",requestDetailLabel:"Details (optional)",requestDetailPlaceholder:"What the team needs to know to do it",requestSubmit:"Send request",requestSubmitted:"Request sent",requestWithShot:"Attach this screenshot to the request",requestAnnotateHint:"Mark what you are asking about — box it, point at it, highlight it, or type on it",draftRestored:"What you typed last time, not sent yet",draftClear:"Clear",requestLeaves:"Not sent with a request",requestLeavesWhat:"this page's activity log — it is for problem reports only",days:"{n} days",hours:"{n} hours",ringTitle:"The support team is calling you",ringAbout:"About {key} · {title}",ringHow:"Answer on your request's page — it opens in a new tab, already signed in",ringOpen:"Open to answer",ringDecline:"Decline",ringOpened:"Opened — press Answer in the new tab",ringBlocked:"Your browser blocked the new tab — open the call here",ringClose:"Close",ringTab:"\uD83D\uDCDE Incoming call"};function U0(z){return z==="en"?B8:D8}var M8="lw-debug-toasts",N8=6000,I8=`
2
2
  :host { all: initial; }
3
3
  .stack {
4
4
  position: fixed; top: 16px; right: 16px; z-index: 2147483001;
@@ -30,7 +30,7 @@
30
30
  }
31
31
  @keyframes in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
32
32
  @media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
33
- `,L1=null;function M8(){if(typeof document>"u")return null;if(L1?.isConnected)return L1;let z=document.createElement(q8);z.dataset.debugReporter="true";let J=z.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=B8;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append($,j),document.body.append(z),L1=j,j}function I0(z,J="success",$){let j=r0()?N().toast:void 0;if(j){j({message:z,tone:J,...$?{action:$}:{}});return}let Q=M8();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=J;let X=document.createElement("span");X.className="dot";let Y=document.createElement("span");Y.textContent=z;let H=document.createElement("button");H.type="button",H.className="close",H.textContent="✕",H.setAttribute("aria-label","ปิด");let F=()=>{window.clearTimeout(S),Z.remove()};H.addEventListener("click",F);let S=J==="error"||$?0:window.setTimeout(F,D8);if(Z.append(X,Y),$){let B=document.createElement("button");B.type="button",B.className="action",B.textContent=$.label,B.addEventListener("click",()=>{F(),$.onClick()}),Z.append(B)}Z.append(H),Q.append(Z)}function t2(z,J,$){let j=z.filter((Z)=>Boolean(Z.error)||Z.status!=null&&Z.status>=400).slice(-20).map((Z)=>({method:Z.method,url:Z.url,status:Z.status,error:Z.error,at:Z.startedAt})),Q=J.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:$.slice(0,20)}}function N8(){let z={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return z;let J=performance.memory;if(J)z.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),z.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[$]=performance.getEntriesByType("navigation");if($)z.domContentLoadedMs=Math.round($.domContentLoadedEventEnd),z.loadEventMs=Math.round($.loadEventEnd);return z}function R1(z,J){if(!z)return J;try{return z()}catch{return J}}function e2(){let z=N(),{pathname:J,search:$,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:$},module:n0(J),user:R1(z.user,{}),apiHeaders:f0(R1(z.headers,{})),app:{name:n().name,version:n().version,environment:n().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:N8(),extra:R1(z.extra,{})}}var I8=2;function j1(z){let J=l2(),$=S2();return{context:e2(),reason:z.reason,note:z.note,cause:t2(J,$,z.erroredQueries),actionTrail:M2(),network:J,console:$,screenshotDataUrl:z.screenshotDataUrl,screenshotMethod:z.screenshotMethod,replay:a2()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:I8}}}async function k1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await C8();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await S8();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function C8(){let z=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};z=await navigator.mediaDevices.getDisplayMedia(J);let $=await O8(z);return $?{status:"ok",dataUrl:$}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{z?.getTracks().forEach((J)=>J.stop())}}async function O8(z){let J=document.createElement("video");J.srcObject=z,J.muted=!0,J.playsInline=!0,await new Promise((X)=>{let Y=!1,H=()=>{if(Y)return;Y=!0,X()};J.onloadedmetadata=()=>{J.play().then(H).catch(H)},window.setTimeout(H,1500)}),await _8(J);let{videoWidth:$,videoHeight:j}=J;if(!$||!j)return null;let Q=document.createElement("canvas");Q.width=$,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(J,0,0,$,j),J.pause(),J.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function _8(z){return new Promise((J)=>{let $=!1,j=()=>{if($)return;$=!0,J()},Q=z;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function S8(){let z=N().screenshotFallback;if(!z)return null;let J=await z().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:($)=>!($ instanceof HTMLElement&&$.dataset?.debugReporter==="true")})}catch{return null}}var L8=2000,R8=0.82,k8=3000000;function A8(z){return new Promise((J,$)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>$(Error("could not read the screenshot")),j.src=z})}async function Q1(z){try{let J=await A8(z),$=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,L8/$),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(J.naturalWidth*j)),Q.height=Math.max(1,Math.round(J.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return z;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(J,0,0,Q.width,Q.height);let X=R8,Y=Q.toDataURL("image/jpeg",X);while(Y.length>k8&&X>0.4)X-=0.15,Y=Q.toDataURL("image/jpeg",X);return Y}catch{return z}}var T8=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,f8=/^\d+$/,w8=/^[0-9a-f]{16,}$/i;function z4(z){if(z.reason.type==="manual")return null;let J=z.cause?.failedRequests?.[0];if(!J?.url)return null;let $;try{$=new URL(J.url,"http://x").pathname}catch{$=J.url}let j=$.split("/").map((Z)=>T8.test(Z)||f8.test(Z)||w8.test(Z)?":id":Z).join("/"),Q=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${Q}`}var J4=2000000;function Z1(z){let{screenshotDataUrl:J,replay:$,...j}=z;return JSON.stringify(j).length}function $4(z,J=2000000){if(Z1(z)<=J)return z;let $=z.network.map((Q)=>({...Q})),j={...z,network:$};for(let Q of $){if(Z1(j)<=J)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&Z1(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&Z1(j)>J)j.console=j.console.slice(1);return j}function b0(z){let J="";for(let $=0;$<z.length;$+=32768)J+=String.fromCharCode(...z.subarray($,$+32768));return btoa(J)}var x8=4,E8=2,b8=3,g8=0,h8=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),y8=/^\s*javascript:/i;function m8(z,J){let $=z.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof J==="string"&&y8.test(J)}function j4(z,J=!1){if(!z)return;for(let $ of Object.keys(z)){let j=z[$];if(m8($,j)){if(J)z[$]=null;else delete z[$];continue}if(typeof j!=="string"||!h8.has($)||!j.includes("?"))continue;z[$]=j0(j)}}function A1(z){if(!z)return;j4(z.attributes);for(let J of z.childNodes??[])A1(J)}function Q4(z){let J=JSON.parse(JSON.stringify(z));for(let $ of J){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===x8&&typeof j.href==="string")j.href=j0(j.href);else if($.type===E8)A1(j.node);else if($.type===b8&&j.source===g8){for(let Q of j.adds??[])A1(Q.node);for(let Q of j.attributes??[])j4(Q.attributes,!0)}}return J}var v8="session-replay.json.gz",u8="session-replay.json";function p8(z){return Boolean(z&&z.events.length>0)}async function d8(z){if(typeof CompressionStream>"u")return null;try{let J=new Blob([z]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function V4(z,J){if(!p8(z))return{summary:{omitted:"empty"}};let j={seconds:Math.round(z.durationMs/1000),events:z.events.length,startedAt:z.startedAt,endedAt:z.endedAt},Q=Q4(z.events),Z=await Z4(Q),X=!1;if(Z.bytes.byteLength>J&&l8(Q))Q=o8(Q),Z=await Z4(Q),X=!0;let{bytes:Y,compressed:H}=Z;if(Y.byteLength>J)return{summary:{...j,bytes:Y.byteLength,omitted:"too-large"}};return{dataUri:`data:${H?"application/gzip":"application/json"};base64,${b0(Y)}`,filename:H?v8:u8,summary:{...j,events:Q.length,bytes:Y.byteLength,compressed:H,...X?{canvasDropped:X}:{}}}}async function Z4(z){let J=new TextEncoder().encode(JSON.stringify({events:z})),$=await d8(J);return $?{bytes:$,compressed:!0}:{bytes:J,compressed:!1}}var i8=3,X4=2,c8=9;function W4(z){return z.type===i8&&z.data?.source===c8}function l8(z){return z.some(W4)||z.some((J)=>J.type===X4&&Y4(J.data.node))}function Y4(z){if(!z)return!1;if(z.attributes&&"rr_dataURL"in z.attributes)return!0;return(z.childNodes??[]).some(Y4)}function K4(z){if(!z)return;if(z.attributes&&"rr_dataURL"in z.attributes)delete z.attributes.rr_dataURL;for(let J of z.childNodes??[])K4(J)}function o8(z){let J=[];for(let $ of z){if(W4($))continue;if($.type===X4)K4($.data.node);J.push($)}return J}var r8=new Set([502,503,504]);class s extends Error{kind;retryAfter;status;constructor(z,J,$,j){super(z);this.kind=J;this.retryAfter=$;this.status=j;this.name="ReportError"}}function n8(z){let{screenshotDataUrl:J,replay:$,...j}=z;return{dataUri:`data:application/json;base64,${b0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function T1(){let z=N().identity;if(!z)return{};try{let J=await z();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function G4(z,J){let $=N(),j=$4(J,J4),{context:Q,note:Z}=j,X=[];if(j.screenshotDataUrl){let L=await Q1(j.screenshotDataUrl);X.push({dataUri:L,filename:"screenshot.jpg"})}X.push(n8(j));let Y,H=k0();if(H){let L=await V4(j.replay,H.maxBytes);if(Y=L.summary,"dataUri"in L)X.push({dataUri:L.dataUri,filename:L.filename})}let F=z4(j),S={title:z,description:Z.trim()||void 0,appName:n().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:n().name,module:Q.module?.label??""},context:{...F?{signature:F}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...Y?{replay:Y}:{}},attachments:X},B=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await T1()},body:JSON.stringify(S)}).catch(()=>{throw new s("report never left the browser","offline")});if(!B.ok)throw await f1(B);return await B.json()}async function f1(z){let J=z.headers.get("retry-after"),$=await z.json().then((j)=>j.error).catch(()=>null);if(z.status===429)return new s("rate limited","rateLimited",J??void 0);if(r8.has(z.status))return new s("desk unavailable","unavailable");return new s($??`Report failed (${z.status})`,"rejected",void 0,z.status)}var V1=null,g0=null,H4=()=>N().host.replace(/\/$/,"");function w1(){return V1}function C0(){if(g0)return g0;return g0=(async()=>{try{let z=await fetch(`${H4()}/ingest/request-types`,{headers:{"x-realm-key":N().realmKey}}),J=z.ok?await z.json():null;V1=Array.isArray(J?.types)?J.types.filter(s8):[]}catch{V1=[],g0=null}return V1??[]})(),g0}function s8(z){let J=z;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function U4(z){let J=N(),$={};try{$=J.user?.()??{}}catch{$={}}let j=typeof window>"u"?null:window.location,Q={title:z.title,description:z.description.trim()||void 0,ticketTypeId:z.ticketTypeId,appName:n().name,category:j?n0(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:z.screenshotDataUrl?[{dataUri:await Q1(z.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${H4()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await T1()},body:JSON.stringify(Q)}).catch(()=>{throw new s("request never left the browser","offline")});if(!Z.ok)throw await f1(Z);return await Z.json()}var h0=Math.PI/6;function F4(z,J,$){let j=J.x-z.x,Q=J.y-z.y,Z=Math.hypot(j,Q),X=Math.atan2(Q,j),Y=[{x:J.x,y:J.y},{x:J.x-$*Math.cos(X-h0),y:J.y-$*Math.sin(X-h0)},{x:J.x-$*Math.cos(X+h0),y:J.y-$*Math.sin(X+h0)}],H=$*Math.cos(h0)*0.92;if(Z<=H)return{shaft:null,head:Y};return{shaft:{from:z,to:{x:J.x-H*Math.cos(X),y:J.y-H*Math.sin(X)}},head:Y}}var x1="#f44336",a8="rgba(250, 204, 21, 0.4)",E1=22,P4="#2563eb",q4=9,D4=11,B4=18,M4=4,X1=8,t8=[{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 N4(z,J,$){let j=[],Q=null,Z=-1,X=null,Y=null,H=z.getContext("2d");function F(){let V=z.getBoundingClientRect().width;return V>0?z.width/V:1}function S(V){let W=z.getBoundingClientRect();return{x:(V.clientX-W.left)/W.width*z.width,y:(V.clientY-W.top)/W.height*z.height}}function B(V){let W=V.size??E1;if(!H)return(V.text?.length??0)*W*0.6;H.save(),H.font=`600 ${W}px system-ui, sans-serif`;let G=H.measureText(V.text??"").width;return H.restore(),G}function L(V){if(V.tool==="text"){let W=V.size??E1;return{left:V.x1,top:V.y1,right:V.x1+B(V),bottom:V.y1+W*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 R(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 W=L(V);if(V.tool==="text")return[{id:"size",x:W.right,y:W.bottom,cursor:"nwse-resize"}];return t8.map((G)=>({id:G.id,x:W.left+(W.right-W.left)*G.fx,y:W.top+(W.bottom-W.top)*G.fy,cursor:G.cursor}))}function k(V){let W=L(V);return{x:W.right+B4*F(),y:W.top-B4*F()}}function l(V,W,G){let{shaft:K,head:U}=F4({x:W.x1,y:W.y1},{x:W.x2,y:W.y2},Math.max(10,16*G));if(K)V.lineCap="butt",V.beginPath(),V.moveTo(K.from.x,K.from.y),V.lineTo(K.to.x,K.to.y),V.stroke();V.beginPath(),V.moveTo(U[0].x,U[0].y),V.lineTo(U[1].x,U[1].y),V.lineTo(U[2].x,U[2].y),V.closePath(),V.fill()}function t(V,W,G){V.save(),V.lineWidth=Math.max(2,3*G),V.strokeStyle=x1,V.fillStyle=x1;let K=L(W);if(W.tool==="rect")V.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(W.tool==="arrow")l(V,W,G);else if(W.tool==="highlight")V.fillStyle=a8,V.fillRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(W.tool==="text"&&W.text){let U=W.size??E1;V.font=`600 ${U}px system-ui, sans-serif`,V.textBaseline="top";let q=U*0.22;V.fillStyle="rgba(255,255,255,0.92)",V.fillRect(K.left-q,K.top-q,K.right-K.left+q*2,K.bottom-K.top+q*2),V.fillStyle=x1,V.fillText(W.text,K.left,K.top)}V.restore()}function b(V,W,G){let K=L(W);V.save(),V.strokeStyle=P4,V.lineWidth=Math.max(1,1.5*G),V.setLineDash([6*G,4*G]),V.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top),V.setLineDash([]);let U=q4*G;for(let E of R(W))V.fillStyle="#fff",V.strokeStyle=P4,V.lineWidth=Math.max(1,1.5*G),V.beginPath(),V.rect(E.x-U/2,E.y-U/2,U,U),V.fill(),V.stroke();let q=k(W),I=D4*G;V.beginPath(),V.arc(q.x,q.y,I,0,Math.PI*2),V.fillStyle="#dc2626",V.fill(),V.strokeStyle="#fff",V.lineWidth=Math.max(1.5,2*G),V.beginPath(),V.moveTo(q.x-I*0.4,q.y-I*0.4),V.lineTo(q.x+I*0.4,q.y+I*0.4),V.moveTo(q.x+I*0.4,q.y-I*0.4),V.lineTo(q.x-I*0.4,q.y+I*0.4),V.stroke(),V.restore()}function O(){if(!H)return;let V=F();if(H.clearRect(0,0,z.width,z.height),H.drawImage(J,0,0,z.width,z.height),j.forEach((G,K)=>{if(K!==K0)t(H,G,V)}),X)t(H,X,V);let W=j[Z];if(W&&!X)b(H,W,V)}function P0(V,W,G,K,U){return Math.abs(V-G)<=U&&Math.abs(W-K)<=U}function Y0(V,W){let G=j[Z];if(!G)return null;let K=q4*F()/2+3*F();for(let U of R(G))if(P0(V,W,U.x,U.y,K))return U.id;return null}function x(V,W){let G=j[Z];if(!G)return!1;let K=k(G);return P0(V,W,K.x,K.y,D4*F())}function o(V,W){let G=6*F();for(let K=j.length-1;K>=0;K-=1){let U=j[K];if(U.tool==="arrow"){let I=U.x2-U.x1,E=U.y2-U.y1,c=Math.hypot(I,E)||1,P=Math.max(0,Math.min(1,((V-U.x1)*I+(W-U.y1)*E)/(c*c)));if(Math.hypot(V-(U.x1+P*I),W-(U.y1+P*E))<=G+4*F())return K;continue}let q=L(U);if(V>=q.left-G&&V<=q.right+G&&W>=q.top-G&&W<=q.bottom+G)return K}return-1}function w(V,W,G,K,U){if(W==="tail"){V.x1=G.x1+K,V.y1=G.y1+U;return}if(W==="head"){V.x2=G.x2+K,V.y2=G.y2+U;return}if(W==="size"){let C=(G.size??24)+U;V.size=Math.max(10,C);return}let q=L(G),{left:I,top:E,right:c,bottom:P}=q;if(W.includes("w"))I=Math.min(c-X1,I+K);if(W.includes("e"))c=Math.max(I+X1,c+K);if(W.includes("n"))E=Math.min(P-X1,E+U);if(W.includes("s"))P=Math.max(E+X1,P+U);V.x1=I,V.y1=E,V.x2=c,V.y2=P}function l0(V,W,G,K){V.x1=W.x1+G,V.y1=W.y1+K,V.x2=W.x2+G,V.y2=W.y2+K}let A=null,K0=-1,h={x:0,y:0,size:24};function R0(){let V=z.getBoundingClientRect().width;return V>0?V/z.width:1}function o0(V,W){if(!H)return V.length*W*0.6;H.save(),H.font=`600 ${W}px system-ui, sans-serif`;let G=H.measureText(V||" ").width;return H.restore(),G}function q0(){if(!A)return;let V=z.parentElement;if(!V)return;let W=z.getBoundingClientRect(),G=V.getBoundingClientRect(),K=R0(),U=h.size*K;A.style.left=`${W.left-G.left+h.x*K}px`,A.style.top=`${W.top-G.top+h.y*K}px`,A.style.fontSize=`${U}px`,A.style.width=`${Math.max(40,o0(A.value,U)+U)}px`}function e(V){let W=A;if(!W)return;A=null;let G=W.value.trim(),K=K0;if(K0=-1,W.remove(),V&&G){if(K>=0&&j[K])j[K].text=G,Z=K;else j.push({tool:"text",x1:h.x,y1:h.y,x2:h.x,y2:h.y,text:G,size:h.size}),Z=j.length-1;$()}else if(K>=0)Z=K;z.focus(),O()}function r(V,W,G=-1){e(!0);let K=z.parentElement;if(!K)return;if(getComputedStyle(K).position==="static")K.style.position="relative";let U=G>=0?j[G]:void 0;K0=G,h={x:U?.x1??V,y:U?.y1??W,size:U?.size??Math.round(24*F())};let q=document.createElement("input");q.type="text",q.className="text-edit",q.value=U?.text??"",q.setAttribute("aria-label","ข้อความบนภาพ"),q.placeholder="ข้อความ",A=q,K.append(q),q0(),q.addEventListener("input",q0),q.addEventListener("keydown",(I)=>{if(I.stopPropagation(),I.key==="Enter")e(!0);else if(I.key==="Escape")e(!1)}),requestAnimationFrame(()=>{if(A!==q)return;q.focus(),q.select(),q.addEventListener("blur",()=>e(!0))}),O()}function d(V){let{x:W,y:G}=S(V);if(z.setPointerCapture(V.pointerId),x(W,G)){i();return}let K=Y0(W,G);if(K&&j[Z]){Y={grip:K,x:W,y:G,start:{...j[Z]}};return}if(Q==="text"){if(V.preventDefault(),z.hasPointerCapture(V.pointerId))z.releasePointerCapture(V.pointerId);Q=null,$(),r(W,G);return}if(Q){X={tool:Q,x1:W,y1:G,x2:W,y2:G},Z=-1;return}let U=o(W,G);Z=U,Y=U>=0?{grip:"body",x:W,y:G,start:{...j[U]}}:null,O()}function D0(V){let{x:W,y:G}=S(V);if(X){X.x2=W,X.y2=G,O();return}if(Y){let U=j[Z];if(!U)return;let q=W-Y.x,I=G-Y.y;if(Y.grip==="body")l0(U,Y.start,q,I);else w(U,Y.grip,Y.start,q,I);O();return}if(Q){z.style.cursor="crosshair";return}if(x(W,G)){z.style.cursor="pointer";return}let K=Y0(W,G);if(K){let U=j[Z]?R(j[Z]).find((q)=>q.id===K):null;z.style.cursor=U?.cursor??"pointer";return}z.style.cursor=o(W,G)>=0?"move":"default"}function G0(){if(X){if(!(Math.abs(X.x2-X.x1)<M4&&Math.abs(X.y2-X.y1)<M4))j.push(X),Z=j.length-1,Q=null,$();X=null}if(Y)Y=null,$();O()}function z0(V){let W=z.getBoundingClientRect(),G=(V.clientX-W.left)/W.width*z.width,K=(V.clientY-W.top)/W.height*z.height,U=o(G,K),q=j[U];if(!q||q.tool!=="text")return;V.preventDefault(),r(q.x1,q.y1,U)}function J0(V){if(Z<0)return;if(V.key==="Delete"||V.key==="Backspace")V.preventDefault(),i();else if(V.key==="Escape")V.preventDefault(),Z=-1,O()}function i(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),O()}return z.addEventListener("pointerdown",d),z.addEventListener("pointermove",D0),z.addEventListener("pointerup",G0),z.addEventListener("pointercancel",G0),z.addEventListener("dblclick",z0),z.tabIndex=0,z.addEventListener("keydown",J0),O(),{setTool(V){Q=V,Z=-1,z.style.cursor=V?"crosshair":"default",O()},deleteSelected:i,clear(){j.length=0,Z=-1,$(),O()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let V=document.createElement("canvas");V.width=J.naturalWidth,V.height=J.naturalHeight;let W=V.getContext("2d");if(!W)return z.toDataURL("image/png");W.drawImage(J,0,0);let G=F();for(let K of j)t(W,K,G);return V.toDataURL("image/png")},destroy(){e(!1),z.removeEventListener("pointerdown",d),z.removeEventListener("pointermove",D0),z.removeEventListener("pointerup",G0),z.removeEventListener("pointercancel",G0),z.removeEventListener("dblclick",z0),z.removeEventListener("keydown",J0)}}}var e8=["keydown","keyup","keypress"];function y0(z){for(let J of e8)z.addEventListener(J,($)=>$.stopPropagation())}var I4=`
33
+ `,k1=null;function C8(){if(typeof document>"u")return null;if(k1?.isConnected)return k1;let z=document.createElement(M8);z.dataset.debugReporter="true";let J=z.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=I8;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append($,j),document.body.append(z),k1=j,j}function I0(z,J="success",$){let j=n0()?N().toast:void 0;if(j){j({message:z,tone:J,...$?{action:$}:{}});return}let Q=C8();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=J;let X=document.createElement("span");X.className="dot";let Y=document.createElement("span");Y.textContent=z;let H=document.createElement("button");H.type="button",H.className="close",H.textContent="✕",H.setAttribute("aria-label","ปิด");let P=()=>{window.clearTimeout(S),Z.remove()};H.addEventListener("click",P);let S=J==="error"||$?0:window.setTimeout(P,N8);if(Z.append(X,Y),$){let B=document.createElement("button");B.type="button",B.className="action",B.textContent=$.label,B.addEventListener("click",()=>{P(),$.onClick()}),Z.append(B)}Z.append(H),Q.append(Z)}function J4(z,J,$){let j=z.filter((Z)=>Boolean(Z.error)||Z.status!=null&&Z.status>=400).slice(-20).map((Z)=>({method:Z.method,url:Z.url,status:Z.status,error:Z.error,at:Z.startedAt})),Q=J.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:$.slice(0,20)}}function O8(){let z={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return z;let J=performance.memory;if(J)z.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),z.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[$]=performance.getEntriesByType("navigation");if($)z.domContentLoadedMs=Math.round($.domContentLoadedEventEnd),z.loadEventMs=Math.round($.loadEventEnd);return z}function A1(z,J){if(!z)return J;try{return z()}catch{return J}}function $4(){let z=N(),{pathname:J,search:$,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:$},module:s0(J),user:A1(z.user,{}),apiHeaders:x0(A1(z.headers,{})),app:{name:s().name,version:s().version,environment:s().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:O8(),extra:A1(z.extra,{})}}var _8=2;function Q1(z){let J=n2(),$=k2();return{context:$4(),reason:z.reason,note:z.note,cause:J4(J,$,z.erroredQueries),actionTrail:C2(),network:J,console:$,screenshotDataUrl:z.screenshotDataUrl,screenshotMethod:z.screenshotMethod,replay:z4()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:_8}}}async function T1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await S8();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await k8();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function S8(){let z=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};z=await navigator.mediaDevices.getDisplayMedia(J);let $=await L8(z);return $?{status:"ok",dataUrl:$}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{z?.getTracks().forEach((J)=>J.stop())}}async function L8(z){let J=document.createElement("video");J.srcObject=z,J.muted=!0,J.playsInline=!0,await new Promise((X)=>{let Y=!1,H=()=>{if(Y)return;Y=!0,X()};J.onloadedmetadata=()=>{J.play().then(H).catch(H)},window.setTimeout(H,1500)}),await R8(J);let{videoWidth:$,videoHeight:j}=J;if(!$||!j)return null;let Q=document.createElement("canvas");Q.width=$,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(J,0,0,$,j),J.pause(),J.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function R8(z){return new Promise((J)=>{let $=!1,j=()=>{if($)return;$=!0,J()},Q=z;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function k8(){let z=N().screenshotFallback;if(!z)return null;let J=await z().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:($)=>!($ instanceof HTMLElement&&$.dataset?.debugReporter==="true")})}catch{return null}}var A8=2000,T8=0.82,x8=3000000;function E8(z){return new Promise((J,$)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>$(Error("could not read the screenshot")),j.src=z})}async function Z1(z){try{let J=await E8(z),$=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,A8/$),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(J.naturalWidth*j)),Q.height=Math.max(1,Math.round(J.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return z;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(J,0,0,Q.width,Q.height);let X=T8,Y=Q.toDataURL("image/jpeg",X);while(Y.length>x8&&X>0.4)X-=0.15,Y=Q.toDataURL("image/jpeg",X);return Y}catch{return z}}var f8=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,w8=/^\d+$/,b8=/^[0-9a-f]{16,}$/i;function j4(z){if(z.reason.type==="manual")return null;let J=z.cause?.failedRequests?.[0];if(!J?.url)return null;let $;try{$=new URL(J.url,"http://x").pathname}catch{$=J.url}let j=$.split("/").map((Z)=>f8.test(Z)||w8.test(Z)||b8.test(Z)?":id":Z).join("/"),Q=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${Q}`}var Q4=2000000;function V1(z){let{screenshotDataUrl:J,replay:$,...j}=z;return JSON.stringify(j).length}function Z4(z,J=2000000){if(V1(z)<=J)return z;let $=z.network.map((Q)=>({...Q})),j={...z,network:$};for(let Q of $){if(V1(j)<=J)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&V1(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&V1(j)>J)j.console=j.console.slice(1);return j}function b0(z){let J="";for(let $=0;$<z.length;$+=32768)J+=String.fromCharCode(...z.subarray($,$+32768));return btoa(J)}var g8=4,h8=2,y8=3,v8=0,m8=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),u8=/^\s*javascript:/i;function p8(z,J){let $=z.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof J==="string"&&u8.test(J)}function V4(z,J=!1){if(!z)return;for(let $ of Object.keys(z)){let j=z[$];if(p8($,j)){if(J)z[$]=null;else delete z[$];continue}if(typeof j!=="string"||!m8.has($)||!j.includes("?"))continue;z[$]=Q0(j)}}function x1(z){if(!z)return;V4(z.attributes);for(let J of z.childNodes??[])x1(J)}function X4(z){let J=JSON.parse(JSON.stringify(z));for(let $ of J){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===g8&&typeof j.href==="string")j.href=Q0(j.href);else if($.type===h8)x1(j.node);else if($.type===y8&&j.source===v8){for(let Q of j.adds??[])x1(Q.node);for(let Q of j.attributes??[])V4(Q.attributes,!0)}}return J}var d8="session-replay.json.gz",i8="session-replay.json";function c8(z){return Boolean(z&&z.events.length>0)}async function l8(z){if(typeof CompressionStream>"u")return null;try{let J=new Blob([z]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function Y4(z,J){if(!c8(z))return{summary:{omitted:"empty"}};let j={seconds:Math.round(z.durationMs/1000),events:z.events.length,startedAt:z.startedAt,endedAt:z.endedAt},Q=X4(z.events),Z=await W4(Q),X=!1;if(Z.bytes.byteLength>J&&n8(Q))Q=s8(Q),Z=await W4(Q),X=!0;let{bytes:Y,compressed:H}=Z;if(Y.byteLength>J)return{summary:{...j,bytes:Y.byteLength,omitted:"too-large"}};return{dataUri:`data:${H?"application/gzip":"application/json"};base64,${b0(Y)}`,filename:H?d8:i8,summary:{...j,events:Q.length,bytes:Y.byteLength,compressed:H,...X?{canvasDropped:X}:{}}}}async function W4(z){let J=new TextEncoder().encode(JSON.stringify({events:z})),$=await l8(J);return $?{bytes:$,compressed:!0}:{bytes:J,compressed:!1}}var o8=3,K4=2,r8=9;function G4(z){return z.type===o8&&z.data?.source===r8}function n8(z){return z.some(G4)||z.some((J)=>J.type===K4&&H4(J.data.node))}function H4(z){if(!z)return!1;if(z.attributes&&"rr_dataURL"in z.attributes)return!0;return(z.childNodes??[]).some(H4)}function U4(z){if(!z)return;if(z.attributes&&"rr_dataURL"in z.attributes)delete z.attributes.rr_dataURL;for(let J of z.childNodes??[])U4(J)}function s8(z){let J=[];for(let $ of z){if(G4($))continue;if($.type===K4)U4($.data.node);J.push($)}return J}var a8=new Set([502,503,504]);class a extends Error{kind;retryAfter;status;constructor(z,J,$,j){super(z);this.kind=J;this.retryAfter=$;this.status=j;this.name="ReportError"}}function t8(z){let{screenshotDataUrl:J,replay:$,...j}=z;return{dataUri:`data:application/json;base64,${b0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function E1(){let z=N().identity;if(!z)return{};try{let J=await z();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function P4(z,J){let $=N(),j=Z4(J,Q4),{context:Q,note:Z}=j,X=[];if(j.screenshotDataUrl){let L=await Z1(j.screenshotDataUrl);X.push({dataUri:L,filename:"screenshot.jpg"})}X.push(t8(j));let Y,H=k0();if(H){let L=await Y4(j.replay,H.maxBytes);if(Y=L.summary,"dataUri"in L)X.push({dataUri:L.dataUri,filename:L.filename})}let P=j4(j),S={title:z,description:Z.trim()||void 0,appName:s().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:s().name,module:Q.module?.label??""},context:{...P?{signature:P}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...Y?{replay:Y}:{}},attachments:X},B=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await E1()},body:JSON.stringify(S)}).catch(()=>{throw new a("report never left the browser","offline")});if(!B.ok)throw await f1(B);return await B.json()}async function f1(z){let J=z.headers.get("retry-after"),$=await z.json().then((j)=>j.error).catch(()=>null);if(z.status===429)return new a("rate limited","rateLimited",J??void 0);if(a8.has(z.status))return new a("desk unavailable","unavailable");return new a($??`Report failed (${z.status})`,"rejected",void 0,z.status)}var X1=null,g0=null,F4=()=>N().host.replace(/\/$/,"");function w1(){return X1}function C0(){if(g0)return g0;return g0=(async()=>{try{let z=await fetch(`${F4()}/ingest/request-types`,{headers:{"x-realm-key":N().realmKey}}),J=z.ok?await z.json():null;X1=Array.isArray(J?.types)?J.types.filter(e8):[]}catch{X1=[],g0=null}return X1??[]})(),g0}function e8(z){let J=z;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function q4(z){let J=N(),$={};try{$=J.user?.()??{}}catch{$={}}let j=typeof window>"u"?null:window.location,Q={title:z.title,description:z.description.trim()||void 0,ticketTypeId:z.ticketTypeId,appName:s().name,category:j?s0(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:z.screenshotDataUrl?[{dataUri:await Z1(z.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${F4()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await E1()},body:JSON.stringify(Q)}).catch(()=>{throw new a("request never left the browser","offline")});if(!Z.ok)throw await f1(Z);return await Z.json()}var h0=Math.PI/6;function D4(z,J,$){let j=J.x-z.x,Q=J.y-z.y,Z=Math.hypot(j,Q),X=Math.atan2(Q,j),Y=[{x:J.x,y:J.y},{x:J.x-$*Math.cos(X-h0),y:J.y-$*Math.sin(X-h0)},{x:J.x-$*Math.cos(X+h0),y:J.y-$*Math.sin(X+h0)}],H=$*Math.cos(h0)*0.92;if(Z<=H)return{shaft:null,head:Y};return{shaft:{from:z,to:{x:J.x-H*Math.cos(X),y:J.y-H*Math.sin(X)}},head:Y}}var b1="#f44336",z5="rgba(250, 204, 21, 0.4)",g1=22,B4="#2563eb",M4=9,N4=11,I4=18,C4=4,W1=8,J5=[{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 O4(z,J,$){let j=[],Q=null,Z=-1,X=null,Y=null,H=z.getContext("2d");function P(){let V=z.getBoundingClientRect().width;return V>0?z.width/V:1}function S(V){let W=z.getBoundingClientRect();return{x:(V.clientX-W.left)/W.width*z.width,y:(V.clientY-W.top)/W.height*z.height}}function B(V){let W=V.size??g1;if(!H)return(V.text?.length??0)*W*0.6;H.save(),H.font=`600 ${W}px system-ui, sans-serif`;let G=H.measureText(V.text??"").width;return H.restore(),G}function L(V){if(V.tool==="text"){let W=V.size??g1;return{left:V.x1,top:V.y1,right:V.x1+B(V),bottom:V.y1+W*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 R(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 W=L(V);if(V.tool==="text")return[{id:"size",x:W.right,y:W.bottom,cursor:"nwse-resize"}];return J5.map((G)=>({id:G.id,x:W.left+(W.right-W.left)*G.fx,y:W.top+(W.bottom-W.top)*G.fy,cursor:G.cursor}))}function k(V){let W=L(V);return{x:W.right+I4*P(),y:W.top-I4*P()}}function o(V,W,G){let{shaft:K,head:U}=D4({x:W.x1,y:W.y1},{x:W.x2,y:W.y2},Math.max(10,16*G));if(K)V.lineCap="butt",V.beginPath(),V.moveTo(K.from.x,K.from.y),V.lineTo(K.to.x,K.to.y),V.stroke();V.beginPath(),V.moveTo(U[0].x,U[0].y),V.lineTo(U[1].x,U[1].y),V.lineTo(U[2].x,U[2].y),V.closePath(),V.fill()}function e(V,W,G){V.save(),V.lineWidth=Math.max(2,3*G),V.strokeStyle=b1,V.fillStyle=b1;let K=L(W);if(W.tool==="rect")V.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(W.tool==="arrow")o(V,W,G);else if(W.tool==="highlight")V.fillStyle=z5,V.fillRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(W.tool==="text"&&W.text){let U=W.size??g1;V.font=`600 ${U}px system-ui, sans-serif`,V.textBaseline="top";let q=U*0.22;V.fillStyle="rgba(255,255,255,0.92)",V.fillRect(K.left-q,K.top-q,K.right-K.left+q*2,K.bottom-K.top+q*2),V.fillStyle=b1,V.fillText(W.text,K.left,K.top)}V.restore()}function b(V,W,G){let K=L(W);V.save(),V.strokeStyle=B4,V.lineWidth=Math.max(1,1.5*G),V.setLineDash([6*G,4*G]),V.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top),V.setLineDash([]);let U=M4*G;for(let w of R(W))V.fillStyle="#fff",V.strokeStyle=B4,V.lineWidth=Math.max(1,1.5*G),V.beginPath(),V.rect(w.x-U/2,w.y-U/2,U,U),V.fill(),V.stroke();let q=k(W),I=N4*G;V.beginPath(),V.arc(q.x,q.y,I,0,Math.PI*2),V.fillStyle="#dc2626",V.fill(),V.strokeStyle="#fff",V.lineWidth=Math.max(1.5,2*G),V.beginPath(),V.moveTo(q.x-I*0.4,q.y-I*0.4),V.lineTo(q.x+I*0.4,q.y+I*0.4),V.moveTo(q.x+I*0.4,q.y-I*0.4),V.lineTo(q.x-I*0.4,q.y+I*0.4),V.stroke(),V.restore()}function O(){if(!H)return;let V=P();if(H.clearRect(0,0,z.width,z.height),H.drawImage(J,0,0,z.width,z.height),j.forEach((G,K)=>{if(K!==K0)e(H,G,V)}),X)e(H,X,V);let W=j[Z];if(W&&!X)b(H,W,V)}function F0(V,W,G,K,U){return Math.abs(V-G)<=U&&Math.abs(W-K)<=U}function Y0(V,W){let G=j[Z];if(!G)return null;let K=M4*P()/2+3*P();for(let U of R(G))if(F0(V,W,U.x,U.y,K))return U.id;return null}function f(V,W){let G=j[Z];if(!G)return!1;let K=k(G);return F0(V,W,K.x,K.y,N4*P())}function r(V,W){let G=6*P();for(let K=j.length-1;K>=0;K-=1){let U=j[K];if(U.tool==="arrow"){let I=U.x2-U.x1,w=U.y2-U.y1,l=Math.hypot(I,w)||1,F=Math.max(0,Math.min(1,((V-U.x1)*I+(W-U.y1)*w)/(l*l)));if(Math.hypot(V-(U.x1+F*I),W-(U.y1+F*w))<=G+4*P())return K;continue}let q=L(U);if(V>=q.left-G&&V<=q.right+G&&W>=q.top-G&&W<=q.bottom+G)return K}return-1}function E(V,W,G,K,U){if(W==="tail"){V.x1=G.x1+K,V.y1=G.y1+U;return}if(W==="head"){V.x2=G.x2+K,V.y2=G.y2+U;return}if(W==="size"){let C=(G.size??24)+U;V.size=Math.max(10,C);return}let q=L(G),{left:I,top:w,right:l,bottom:F}=q;if(W.includes("w"))I=Math.min(l-W1,I+K);if(W.includes("e"))l=Math.max(I+W1,l+K);if(W.includes("n"))w=Math.min(F-W1,w+U);if(W.includes("s"))F=Math.max(w+W1,F+U);V.x1=I,V.y1=w,V.x2=l,V.y2=F}function o0(V,W,G,K){V.x1=W.x1+G,V.y1=W.y1+K,V.x2=W.x2+G,V.y2=W.y2+K}let A=null,K0=-1,y={x:0,y:0,size:24};function R0(){let V=z.getBoundingClientRect().width;return V>0?V/z.width:1}function r0(V,W){if(!H)return V.length*W*0.6;H.save(),H.font=`600 ${W}px system-ui, sans-serif`;let G=H.measureText(V||" ").width;return H.restore(),G}function q0(){if(!A)return;let V=z.parentElement;if(!V)return;let W=z.getBoundingClientRect(),G=V.getBoundingClientRect(),K=R0(),U=y.size*K;A.style.left=`${W.left-G.left+y.x*K}px`,A.style.top=`${W.top-G.top+y.y*K}px`,A.style.fontSize=`${U}px`,A.style.width=`${Math.max(40,r0(A.value,U)+U)}px`}function z0(V){let W=A;if(!W)return;A=null;let G=W.value.trim(),K=K0;if(K0=-1,W.remove(),V&&G){if(K>=0&&j[K])j[K].text=G,Z=K;else j.push({tool:"text",x1:y.x,y1:y.y,x2:y.x,y2:y.y,text:G,size:y.size}),Z=j.length-1;$()}else if(K>=0)Z=K;z.focus(),O()}function n(V,W,G=-1){z0(!0);let K=z.parentElement;if(!K)return;if(getComputedStyle(K).position==="static")K.style.position="relative";let U=G>=0?j[G]:void 0;K0=G,y={x:U?.x1??V,y:U?.y1??W,size:U?.size??Math.round(24*P())};let q=document.createElement("input");q.type="text",q.className="text-edit",q.value=U?.text??"",q.setAttribute("aria-label","ข้อความบนภาพ"),q.placeholder="ข้อความ",A=q,K.append(q),q0(),q.addEventListener("input",q0),q.addEventListener("keydown",(I)=>{if(I.stopPropagation(),I.key==="Enter")z0(!0);else if(I.key==="Escape")z0(!1)}),requestAnimationFrame(()=>{if(A!==q)return;q.focus(),q.select(),q.addEventListener("blur",()=>z0(!0))}),O()}function i(V){let{x:W,y:G}=S(V);if(z.setPointerCapture(V.pointerId),f(W,G)){c();return}let K=Y0(W,G);if(K&&j[Z]){Y={grip:K,x:W,y:G,start:{...j[Z]}};return}if(Q==="text"){if(V.preventDefault(),z.hasPointerCapture(V.pointerId))z.releasePointerCapture(V.pointerId);Q=null,$(),n(W,G);return}if(Q){X={tool:Q,x1:W,y1:G,x2:W,y2:G},Z=-1;return}let U=r(W,G);Z=U,Y=U>=0?{grip:"body",x:W,y:G,start:{...j[U]}}:null,O()}function D0(V){let{x:W,y:G}=S(V);if(X){X.x2=W,X.y2=G,O();return}if(Y){let U=j[Z];if(!U)return;let q=W-Y.x,I=G-Y.y;if(Y.grip==="body")o0(U,Y.start,q,I);else E(U,Y.grip,Y.start,q,I);O();return}if(Q){z.style.cursor="crosshair";return}if(f(W,G)){z.style.cursor="pointer";return}let K=Y0(W,G);if(K){let U=j[Z]?R(j[Z]).find((q)=>q.id===K):null;z.style.cursor=U?.cursor??"pointer";return}z.style.cursor=r(W,G)>=0?"move":"default"}function G0(){if(X){if(!(Math.abs(X.x2-X.x1)<C4&&Math.abs(X.y2-X.y1)<C4))j.push(X),Z=j.length-1,Q=null,$();X=null}if(Y)Y=null,$();O()}function J0(V){let W=z.getBoundingClientRect(),G=(V.clientX-W.left)/W.width*z.width,K=(V.clientY-W.top)/W.height*z.height,U=r(G,K),q=j[U];if(!q||q.tool!=="text")return;V.preventDefault(),n(q.x1,q.y1,U)}function $0(V){if(Z<0)return;if(V.key==="Delete"||V.key==="Backspace")V.preventDefault(),c();else if(V.key==="Escape")V.preventDefault(),Z=-1,O()}function c(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),O()}return z.addEventListener("pointerdown",i),z.addEventListener("pointermove",D0),z.addEventListener("pointerup",G0),z.addEventListener("pointercancel",G0),z.addEventListener("dblclick",J0),z.tabIndex=0,z.addEventListener("keydown",$0),O(),{setTool(V){Q=V,Z=-1,z.style.cursor=V?"crosshair":"default",O()},deleteSelected:c,clear(){j.length=0,Z=-1,$(),O()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let V=document.createElement("canvas");V.width=J.naturalWidth,V.height=J.naturalHeight;let W=V.getContext("2d");if(!W)return z.toDataURL("image/png");W.drawImage(J,0,0);let G=P();for(let K of j)e(W,K,G);return V.toDataURL("image/png")},destroy(){z0(!1),z.removeEventListener("pointerdown",i),z.removeEventListener("pointermove",D0),z.removeEventListener("pointerup",G0),z.removeEventListener("pointercancel",G0),z.removeEventListener("dblclick",J0),z.removeEventListener("keydown",$0)}}}var $5=["keydown","keyup","keypress"];function y0(z){for(let J of $5)z.addEventListener(J,($)=>$.stopPropagation())}var _4=`
34
34
  :host { all: initial; }
35
35
  * { box-sizing: border-box; }
36
36
 
@@ -181,7 +181,7 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
181
181
  .shot-choice input { width: 16px; height: 16px; margin: 0; accent-color: #2563eb; }
182
182
  .dropped { opacity: 0.35; pointer-events: none; }
183
183
  .draft { margin: -8px 0 0; padding: 8px 12px; border-radius: 10px; background: #eff6ff; font-size: 13px; color: #1e3a8a; }
184
- `;var m0="lw-debug-reporter",Q0=null;function z5(z,J){if(z instanceof s){if(z.kind==="offline")return J.failedOffline;if(z.kind==="unavailable")return J.failedUnavailable;if(z.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",z.retryAfter??"60");return z.message||J.failed}return J.failed}var J5=()=>[];var $5=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function j5(){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"}),y0(this.root),this.root.addEventListener("keydown",(J)=>{let $=J;if($.key!=="Escape"||$.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;$.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=T2((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let $=document.activeElement;this.returnFocus=$ instanceof HTMLElement&&$!==document.body?$:null;let j=U0(N().locale),Q=w1();if(Q===null)C0();if(J.type==="manual"&&Q?.length){this.renderChooser(j,J);return}await this.report(J,j)}renderChooser(J,$){let j=this.shell(J);j.classList.add("narrow"),j.setAttribute("aria-label",J.chooseTitle);let Q=M("div","head"),Z=u("✕","icon");Z.setAttribute("aria-label",J.close),Z.addEventListener("click",()=>this.close()),Q.append(M("h2","",J.chooseTitle),Z);let X=S4("problem",Z5,J.kindProblem,J.chooseProblemHint);X.dataset.choose="problem",X.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,J)});let Y=S4("request",O4,J.kindRequest,J.chooseRequestHint);Y.dataset.choose="request",Y.addEventListener("click",()=>{this.bundle=j1({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:b1()}),this.renderForm(J,$,"request")});let H=M("div","kinds choose");H.append(X,Y),H.addEventListener("keydown",(F)=>{if(!C4.includes(F.key))return;F.preventDefault(),(this.root.activeElement===X?Y:X).focus()}),j.append(Q,H),X.focus()}async switchToReport(J,$,j){this.root.replaceChildren();let Q=await k1();if(Q.method==="cancelled"){this.renderForm(J,$,"request",{...j,asking:!0});return}this.bundle=j1({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:b1()}),this.renderForm(J,$,"problem",j)}async report(J,$){let j=await k1();if(j.method==="cancelled"){this.close();return}this.bundle=j1({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:b1()}),this.renderForm($,J,"problem")}close(J=!1){if(J)Q0=null;else if(this.keep)Q0=this.keep()??Q0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let $=this.returnFocus;if(this.returnFocus=null,$?.isConnected)$.focus()}shell(J){let $=document.createElement("style");$.textContent=I4;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",J.title),j.append(Q),this.root.replaceChildren($,j),Q}renderShell(J,$){let j=this.shell(J),Q=M("div","head");Q.append(M("h2","",J.title)),j.append(Q,M("p","status",$))}renderForm(J,$,j,Q){let Z=this.bundle;if(!Z)return;let X=this.shell(J),Y=j,H=j==="problem"||!!Z.screenshotDataUrl,F=null,S=M("div","head"),B=M("h2","",J.title),L=u("✕","icon");L.setAttribute("aria-label",J.close),L.addEventListener("click",()=>this.close()),S.append(B,L);let R=M("p","door");R.hidden=!0;let k=M("span"),l=u("","link");l.dataset.switchKind="",l.addEventListener("click",()=>W(Y==="problem"?"request":"problem")),R.append(k,l);let t=M("div","ask");t.hidden=!0;let b=document.createElement("input");b.type="search",b.className="type-search",b.placeholder=J.requestTypeSearch,b.setAttribute("aria-label",J.requestTypeSearch),b.dataset.requestTypeSearch="",b.hidden=!0;let O=M("div","types");O.setAttribute("role","radiogroup"),O.setAttribute("aria-label",J.requestTypeLabel);let P0=M("p","status",J.requestTypeNone);P0.hidden=!0;let Y0=M("p","status type-count","");Y0.hidden=!0,t.append(W1(J.requestTypeLabel,"",!0),b,O,P0,Y0);let x=[],o=()=>{for(let C of x){let D=C.dataset.requestType===F?.id;C.setAttribute("aria-checked",String(D)),C.tabIndex=D?0:-1}let P=x.find((C)=>C.dataset.requestType===F?.id);if(P&&O.scrollHeight>O.clientHeight){let C=P.offsetTop-O.offsetTop;if(C<O.scrollTop)O.scrollTop=C;else if(C+P.offsetHeight>O.scrollTop+O.clientHeight)O.scrollTop=C+P.offsetHeight-O.clientHeight}},w=document.createElement("input");w.type="text";let l0=W1(""),A=document.createElement("textarea"),K0=W1(""),h=M("div","meta"),{context:R0}=Z,o0=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${J.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,q0=(P,C)=>{let D=document.createElement("div"),_=document.createElement("b");_.textContent=`${P}: `;let T=document.createTextNode(C);return D.append(_,T),h.append(D),{b:_,v:T}};q0(J.reporter,`${R0.user.fullName??"—"} (${R0.user.email??"—"})`),q0(J.page,R0.route.href);let e=q0(J.captured,o0),r=document.createElement("label");r.className="shot-choice",r.hidden=!0;let d=document.createElement("input");d.type="checkbox",d.checked=!0,d.dataset.requestShot="",r.append(d,document.createTextNode(` ${J.requestWithShot}`));let D0=Z.screenshotDataUrl?this.screenshotSection(J,Z.screenshotDataUrl):[M("p","status",J.noScreenshot)],G0=Z.screenshotDataUrl?D0[0]:null;if(!Z.screenshotDataUrl)r.replaceChildren();let z0=M("p","status",""),J0=u(J.submit,"primary"),i=()=>{J0.disabled=w.value.trim().length===0||Y==="request"&&!F};w.addEventListener("input",i);let V=()=>{let P=Y==="request";if(B.textContent=P?J.requestTitle:J.title,X.setAttribute("aria-label",P?J.requestTitle:J.title),k.textContent=`${P?J.problemInstead:J.askInstead} `,l.textContent=P?H?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,t.hidden=!P,Y1(l0,P?J.requestSummaryLabel:J.summaryLabel,P?"":J.summaryRequired,!0),w.placeholder=P?J.requestSummaryPlaceholder:J.summaryPlaceholder,Y1(K0,P?J.requestDetailLabel:J.detailLabel),A.placeholder=P?J.requestDetailPlaceholder:J.detailPlaceholder,e.b.textContent=`${P?J.requestLeaves:J.captured}: `,e.v.textContent=P?J.requestLeavesWhat:o0,r.hidden=!P||!Z.screenshotDataUrl,G0)Y1(G0,P?J.requestAnnotateHint:J.annotateHint);for(let C of D0)C.classList.toggle("dropped",P&&!d.checked),C.hidden=P&&!Z.screenshotDataUrl;J0.textContent=P?J.requestSubmit:J.submit,i()};d.addEventListener("change",V);let W=(P)=>{if(P===Y)return;if(P==="problem"&&!H){this.switchToReport(J,$,{title:w.value,detail:A.value,asking:!1,typeId:F?.id??null});return}Y=P,V()},G=(P)=>{if(this.bundle!==Z||$.type!=="manual"||!P.length)return;F=P[0],x.length=0;for(let D of P){let _=u("","type");_.setAttribute("role","radio"),_.dataset.requestType=D.id;let T=M("span","type-body");if(T.append(M("b","",D.name)),D.description)T.append(M("span","type-hint",D.description));if(D.targetHours){let B0=M("span","type-due");B0.append(K1(V5),document.createTextNode(J.requestTarget.replace("{time}",Q5(J,D.targetHours)))),T.append(B0)}_.append(K1(O4),T),_.addEventListener("click",()=>{F=D,o(),i()}),x.push(_)}O.replaceChildren(...x),O.onkeydown=(D)=>{if(!C4.includes(D.key)||!F)return;D.preventDefault();let _=P.filter((H0,j6)=>!x[j6].hidden);if(!_.length)return;let T=_.findIndex((H0)=>H0.id===F.id),B0=D.key==="ArrowUp"||D.key==="ArrowLeft"?-1:1;F=_[T<0?0:(T+B0+_.length)%_.length],o(),x.find((H0)=>H0.dataset.requestType===F.id)?.focus()},O.classList.toggle("long",P.length>=g1),b.hidden=P.length<g1;let C=(D)=>{Y0.hidden=P.length<g1||D===0,Y0.textContent=J.requestTypeCount.replace("{n}",String(D))};C(P.length),b.oninput=()=>{let D=b.value.trim().toLowerCase(),_=null;if(P.forEach((T,B0)=>{let H0=!D||`${T.name} ${T.description}`.toLowerCase().includes(D);if(x[B0].hidden=!H0,H0&&!_)_=T}),P0.hidden=!!_,C(x.filter((T)=>!T.hidden).length),_&&F&&x[P.indexOf(F)].hidden)F=_;o(),i()},b.onkeydown=(D)=>{if(D.key==="ArrowDown"||D.key==="Enter")D.preventDefault(),x.find((_)=>_.dataset.requestType===F?.id&&!_.hidden)?.focus()},o(),R.hidden=!1,V()},K=Q??(Q0&&(Q0.title||Q0.detail)?Q0:null),U=M("p","draft");if(U.hidden=!K||!!Q,K){w.value=K.title,A.value=K.detail;let P=u(J.draftClear,"link");P.dataset.draftClear="",P.addEventListener("click",()=>{w.value="",A.value="",Q0=null,U.hidden=!0,i(),w.focus()}),U.append(document.createTextNode(`${J.draftRestored} · `),P)}let q=w1(),I=(P)=>{if(G(P),Y!=="request"||R.hidden||!K?.typeId)return;let C=P.find((D)=>D.id===K.typeId);if(C)F=C,o()};if(q)I(q);else if($.type==="manual")C0().then(I);this.keep=()=>({title:w.value,detail:A.value,asking:Y==="request",typeId:F?.id??null}),X.append(S,R,U,t,l0,w,K0,A,h,r,...D0);let E=M("div","foot"),c=u(J.close);c.addEventListener("click",()=>this.close()),E.append(c,z0,M("span","grow"),J0),X.append(E),V(),J0.addEventListener("click",async()=>{J0.disabled=!0,z0.dataset.tone="",z0.textContent=J.submitting;let P=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(Y==="request"&&F){let _=await U4({ticketTypeId:F.id,title:w.value.trim(),description:A.value,screenshotDataUrl:d.checked?P():null}),T=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:_,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),T)I0(`${J.requestSubmitted} — #${_.number}`,"success");return}let C=await G4(w.value.trim(),{...Z,note:A.value,screenshotDataUrl:P()}),D=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:C,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),D)I0(`${J.submitted} — #${C.number}`,"success")}catch(C){let D=z5(C,J);z0.dataset.tone="error",z0.textContent=D,I0(D,"error"),i()}}),w.focus()}screenshotSection(J,$){let j=W1(J.annotateHint),Q=M("div","tools"),Z=document.createElement("canvas"),X=M("div","shot");X.append(Z);let Y=[],H=(L)=>{for(let R of Y)R.setAttribute("aria-pressed",String(R===L))};for(let{tool:L,key:R}of $5){let k=u(J[R]);k.setAttribute("aria-pressed","false"),k.addEventListener("click",()=>{let l=k.getAttribute("aria-pressed")==="true";H(l?null:k),this.annotator?.setTool(l?null:L)}),Y.push(k),Q.append(k)}Q.append(M("span","sep"));let F=u(J.deleteSelected);F.addEventListener("click",()=>this.annotator?.deleteSelected());let S=u(J.clearAll);S.addEventListener("click",()=>{this.annotator?.clear(),H(null)}),Q.append(F,S);let B=new Image;return B.onload=()=>{Z.width=B.naturalWidth,Z.height=B.naturalHeight,this.annotator=N4(Z,B,()=>{H(null),F.disabled=!this.annotator?.hasSelection()})},B.src=$,[j,Q,M("p","status",J.annotateHelp),X]}}}function b1(){try{return J5()}catch{return[]}}function M(z,J="",$=""){let j=document.createElement(z);if(J)j.className=J;if($)j.textContent=$;return j}function Q5(z,J){return J>=24&&J%24===0?z.days.replace("{n}",String(J/24)):z.hours.replace("{n}",String(J))}var C4=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],g1=7,Z5=[["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"}]],O4=[["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"}]],V5=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],X5=[["path",{d:"M20 6 9 17l-5-5"}]],_4="http://www.w3.org/2000/svg";function S4(z,J,$,j){let Q=u("","kind");Q.dataset.kind=z;let Z=M("span","kind-top");return Z.append(K1(J),M("b","",$)),Q.append(Z,M("span","kind-hint",j),K1(X5,"tick")),Q}function K1(z,J="icon"){let $=document.createElementNS(_4,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:J}))$.setAttribute(j,Q);for(let[j,Q]of z){let Z=document.createElementNS(_4,j);for(let[X,Y]of Object.entries(Q))Z.setAttribute(X,Y);$.append(Z)}return $}function u(z,J=""){let $=document.createElement("button");if($.type="button",$.textContent=z,J)$.className=J;return $}function W1(z,J="",$=!1){return Y1(document.createElement("label"),z,J,$)}function Y1(z,J,$="",j=!1){if(z.replaceChildren(document.createTextNode(J)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",z.append(Q)}if($){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${$}`,z.append(Q)}return z}function L4(){if(typeof window>"u"||customElements.get(m0))return;customElements.define(m0,j5())}var R4=138.23,G9=`
184
+ `;var v0="lw-debug-reporter",Z0=null;function j5(z,J){if(z instanceof a){if(z.kind==="offline")return J.failedOffline;if(z.kind==="unavailable")return J.failedUnavailable;if(z.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",z.retryAfter??"60");return z.message||J.failed}return J.failed}var Q5=()=>[];var Z5=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function V5(){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"}),y0(this.root),this.root.addEventListener("keydown",(J)=>{let $=J;if($.key!=="Escape"||$.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;$.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=f2((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let $=document.activeElement;this.returnFocus=$ instanceof HTMLElement&&$!==document.body?$:null;let j=U0(N().locale),Q=w1();if(Q===null)C0();if(J.type==="manual"&&Q?.length){this.renderChooser(j,J);return}await this.report(J,j)}renderChooser(J,$){let j=this.shell(J);j.classList.add("narrow"),j.setAttribute("aria-label",J.chooseTitle);let Q=M("div","head"),Z=p("✕","icon");Z.setAttribute("aria-label",J.close),Z.addEventListener("click",()=>this.close()),Q.append(M("h2","",J.chooseTitle),Z);let X=k4("problem",W5,J.kindProblem,J.chooseProblemHint);X.dataset.choose="problem",X.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,J)});let Y=k4("request",L4,J.kindRequest,J.chooseRequestHint);Y.dataset.choose="request",Y.addEventListener("click",()=>{this.bundle=Q1({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:h1()}),this.renderForm(J,$,"request")});let H=M("div","kinds choose");H.append(X,Y),H.addEventListener("keydown",(P)=>{if(!S4.includes(P.key))return;P.preventDefault(),(this.root.activeElement===X?Y:X).focus()}),j.append(Q,H),X.focus()}async switchToReport(J,$,j){this.root.replaceChildren();let Q=await T1();if(Q.method==="cancelled"){this.renderForm(J,$,"request",{...j,asking:!0});return}this.bundle=Q1({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:h1()}),this.renderForm(J,$,"problem",j)}async report(J,$){let j=await T1();if(j.method==="cancelled"){this.close();return}this.bundle=Q1({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:h1()}),this.renderForm($,J,"problem")}close(J=!1){if(J)Z0=null;else if(this.keep)Z0=this.keep()??Z0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let $=this.returnFocus;if(this.returnFocus=null,$?.isConnected)$.focus()}shell(J){let $=document.createElement("style");$.textContent=_4;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",J.title),j.append(Q),this.root.replaceChildren($,j),Q}renderShell(J,$){let j=this.shell(J),Q=M("div","head");Q.append(M("h2","",J.title)),j.append(Q,M("p","status",$))}renderForm(J,$,j,Q){let Z=this.bundle;if(!Z)return;let X=this.shell(J),Y=j,H=j==="problem"||!!Z.screenshotDataUrl,P=null,S=M("div","head"),B=M("h2","",J.title),L=p("✕","icon");L.setAttribute("aria-label",J.close),L.addEventListener("click",()=>this.close()),S.append(B,L);let R=M("p","door");R.hidden=!0;let k=M("span"),o=p("","link");o.dataset.switchKind="",o.addEventListener("click",()=>W(Y==="problem"?"request":"problem")),R.append(k,o);let e=M("div","ask");e.hidden=!0;let b=document.createElement("input");b.type="search",b.className="type-search",b.placeholder=J.requestTypeSearch,b.setAttribute("aria-label",J.requestTypeSearch),b.dataset.requestTypeSearch="",b.hidden=!0;let O=M("div","types");O.setAttribute("role","radiogroup"),O.setAttribute("aria-label",J.requestTypeLabel);let F0=M("p","status",J.requestTypeNone);F0.hidden=!0;let Y0=M("p","status type-count","");Y0.hidden=!0,e.append(Y1(J.requestTypeLabel,"",!0),b,O,F0,Y0);let f=[],r=()=>{for(let C of f){let D=C.dataset.requestType===P?.id;C.setAttribute("aria-checked",String(D)),C.tabIndex=D?0:-1}let F=f.find((C)=>C.dataset.requestType===P?.id);if(F&&O.scrollHeight>O.clientHeight){let C=F.offsetTop-O.offsetTop;if(C<O.scrollTop)O.scrollTop=C;else if(C+F.offsetHeight>O.scrollTop+O.clientHeight)O.scrollTop=C+F.offsetHeight-O.clientHeight}},E=document.createElement("input");E.type="text";let o0=Y1(""),A=document.createElement("textarea"),K0=Y1(""),y=M("div","meta"),{context:R0}=Z,r0=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${J.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,q0=(F,C)=>{let D=document.createElement("div"),_=document.createElement("b");_.textContent=`${F}: `;let T=document.createTextNode(C);return D.append(_,T),y.append(D),{b:_,v:T}};q0(J.reporter,`${R0.user.fullName??"—"} (${R0.user.email??"—"})`),q0(J.page,R0.route.href);let z0=q0(J.captured,r0),n=document.createElement("label");n.className="shot-choice",n.hidden=!0;let i=document.createElement("input");i.type="checkbox",i.checked=!0,i.dataset.requestShot="",n.append(i,document.createTextNode(` ${J.requestWithShot}`));let D0=Z.screenshotDataUrl?this.screenshotSection(J,Z.screenshotDataUrl):[M("p","status",J.noScreenshot)],G0=Z.screenshotDataUrl?D0[0]:null;if(!Z.screenshotDataUrl)n.replaceChildren();let J0=M("p","status",""),$0=p(J.submit,"primary"),c=()=>{$0.disabled=E.value.trim().length===0||Y==="request"&&!P};E.addEventListener("input",c);let V=()=>{let F=Y==="request";if(B.textContent=F?J.requestTitle:J.title,X.setAttribute("aria-label",F?J.requestTitle:J.title),k.textContent=`${F?J.problemInstead:J.askInstead} `,o.textContent=F?H?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,e.hidden=!F,K1(o0,F?J.requestSummaryLabel:J.summaryLabel,F?"":J.summaryRequired,!0),E.placeholder=F?J.requestSummaryPlaceholder:J.summaryPlaceholder,K1(K0,F?J.requestDetailLabel:J.detailLabel),A.placeholder=F?J.requestDetailPlaceholder:J.detailPlaceholder,z0.b.textContent=`${F?J.requestLeaves:J.captured}: `,z0.v.textContent=F?J.requestLeavesWhat:r0,n.hidden=!F||!Z.screenshotDataUrl,G0)K1(G0,F?J.requestAnnotateHint:J.annotateHint);for(let C of D0)C.classList.toggle("dropped",F&&!i.checked),C.hidden=F&&!Z.screenshotDataUrl;$0.textContent=F?J.requestSubmit:J.submit,c()};i.addEventListener("change",V);let W=(F)=>{if(F===Y)return;if(F==="problem"&&!H){this.switchToReport(J,$,{title:E.value,detail:A.value,asking:!1,typeId:P?.id??null});return}Y=F,V()},G=(F)=>{if(this.bundle!==Z||$.type!=="manual"||!F.length)return;P=F[0],f.length=0;for(let D of F){let _=p("","type");_.setAttribute("role","radio"),_.dataset.requestType=D.id;let T=M("span","type-body");if(T.append(M("b","",D.name)),D.description)T.append(M("span","type-hint",D.description));if(D.targetHours){let B0=M("span","type-due");B0.append(G1(Y5),document.createTextNode(J.requestTarget.replace("{time}",X5(J,D.targetHours)))),T.append(B0)}_.append(G1(L4),T),_.addEventListener("click",()=>{P=D,r(),c()}),f.push(_)}O.replaceChildren(...f),O.onkeydown=(D)=>{if(!S4.includes(D.key)||!P)return;D.preventDefault();let _=F.filter((H0,V6)=>!f[V6].hidden);if(!_.length)return;let T=_.findIndex((H0)=>H0.id===P.id),B0=D.key==="ArrowUp"||D.key==="ArrowLeft"?-1:1;P=_[T<0?0:(T+B0+_.length)%_.length],r(),f.find((H0)=>H0.dataset.requestType===P.id)?.focus()},O.classList.toggle("long",F.length>=y1),b.hidden=F.length<y1;let C=(D)=>{Y0.hidden=F.length<y1||D===0,Y0.textContent=J.requestTypeCount.replace("{n}",String(D))};C(F.length),b.oninput=()=>{let D=b.value.trim().toLowerCase(),_=null;if(F.forEach((T,B0)=>{let H0=!D||`${T.name} ${T.description}`.toLowerCase().includes(D);if(f[B0].hidden=!H0,H0&&!_)_=T}),F0.hidden=!!_,C(f.filter((T)=>!T.hidden).length),_&&P&&f[F.indexOf(P)].hidden)P=_;r(),c()},b.onkeydown=(D)=>{if(D.key==="ArrowDown"||D.key==="Enter")D.preventDefault(),f.find((_)=>_.dataset.requestType===P?.id&&!_.hidden)?.focus()},r(),R.hidden=!1,V()},K=Q??(Z0&&(Z0.title||Z0.detail)?Z0:null),U=M("p","draft");if(U.hidden=!K||!!Q,K){E.value=K.title,A.value=K.detail;let F=p(J.draftClear,"link");F.dataset.draftClear="",F.addEventListener("click",()=>{E.value="",A.value="",Z0=null,U.hidden=!0,c(),E.focus()}),U.append(document.createTextNode(`${J.draftRestored} · `),F)}let q=w1(),I=(F)=>{if(G(F),Y!=="request"||R.hidden||!K?.typeId)return;let C=F.find((D)=>D.id===K.typeId);if(C)P=C,r()};if(q)I(q);else if($.type==="manual")C0().then(I);this.keep=()=>({title:E.value,detail:A.value,asking:Y==="request",typeId:P?.id??null}),X.append(S,R,U,e,o0,E,K0,A,y,n,...D0);let w=M("div","foot"),l=p(J.close);l.addEventListener("click",()=>this.close()),w.append(l,J0,M("span","grow"),$0),X.append(w),V(),$0.addEventListener("click",async()=>{$0.disabled=!0,J0.dataset.tone="",J0.textContent=J.submitting;let F=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(Y==="request"&&P){let _=await q4({ticketTypeId:P.id,title:E.value.trim(),description:A.value,screenshotDataUrl:i.checked?F():null}),T=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:_,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),T)I0(`${J.requestSubmitted} — #${_.number}`,"success");return}let C=await P4(E.value.trim(),{...Z,note:A.value,screenshotDataUrl:F()}),D=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:C,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),D)I0(`${J.submitted} — #${C.number}`,"success")}catch(C){let D=j5(C,J);J0.dataset.tone="error",J0.textContent=D,I0(D,"error"),c()}}),E.focus()}screenshotSection(J,$){let j=Y1(J.annotateHint),Q=M("div","tools"),Z=document.createElement("canvas"),X=M("div","shot");X.append(Z);let Y=[],H=(L)=>{for(let R of Y)R.setAttribute("aria-pressed",String(R===L))};for(let{tool:L,key:R}of Z5){let k=p(J[R]);k.setAttribute("aria-pressed","false"),k.addEventListener("click",()=>{let o=k.getAttribute("aria-pressed")==="true";H(o?null:k),this.annotator?.setTool(o?null:L)}),Y.push(k),Q.append(k)}Q.append(M("span","sep"));let P=p(J.deleteSelected);P.addEventListener("click",()=>this.annotator?.deleteSelected());let S=p(J.clearAll);S.addEventListener("click",()=>{this.annotator?.clear(),H(null)}),Q.append(P,S);let B=new Image;return B.onload=()=>{Z.width=B.naturalWidth,Z.height=B.naturalHeight,this.annotator=O4(Z,B,()=>{H(null),P.disabled=!this.annotator?.hasSelection()})},B.src=$,[j,Q,M("p","status",J.annotateHelp),X]}}}function h1(){try{return Q5()}catch{return[]}}function M(z,J="",$=""){let j=document.createElement(z);if(J)j.className=J;if($)j.textContent=$;return j}function X5(z,J){return J>=24&&J%24===0?z.days.replace("{n}",String(J/24)):z.hours.replace("{n}",String(J))}var S4=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],y1=7,W5=[["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"}]],L4=[["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"}]],Y5=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],K5=[["path",{d:"M20 6 9 17l-5-5"}]],R4="http://www.w3.org/2000/svg";function k4(z,J,$,j){let Q=p("","kind");Q.dataset.kind=z;let Z=M("span","kind-top");return Z.append(G1(J),M("b","",$)),Q.append(Z,M("span","kind-hint",j),G1(K5,"tick")),Q}function G1(z,J="icon"){let $=document.createElementNS(R4,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:J}))$.setAttribute(j,Q);for(let[j,Q]of z){let Z=document.createElementNS(R4,j);for(let[X,Y]of Object.entries(Q))Z.setAttribute(X,Y);$.append(Z)}return $}function p(z,J=""){let $=document.createElement("button");if($.type="button",$.textContent=z,J)$.className=J;return $}function Y1(z,J="",$=!1){return K1(document.createElement("label"),z,J,$)}function K1(z,J,$="",j=!1){if(z.replaceChildren(document.createTextNode(J)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",z.append(Q)}if($){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${$}`,z.append(Q)}return z}function A4(){if(typeof window>"u"||customElements.get(v0))return;customElements.define(v0,V5())}var T4=138.23,U9=`
185
185
  :host { all: initial; }
186
186
  .backdrop {
187
187
  position: fixed; inset: 0; z-index: 2147483002;
@@ -211,10 +211,10 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
211
211
  .ring .track { stroke: #e2e8f0; }
212
212
  .ring .bar {
213
213
  stroke: #0ea5e9; transform: rotate(-90deg); transform-origin: 50% 50%;
214
- stroke-dasharray: ${R4}; stroke-dashoffset: 0;
214
+ stroke-dasharray: ${T4}; stroke-dashoffset: 0;
215
215
  animation: deplete var(--secs, 3s) linear forwards;
216
216
  }
217
- @keyframes deplete { to { stroke-dashoffset: ${R4}; } }
217
+ @keyframes deplete { to { stroke-dashoffset: ${T4}; } }
218
218
  .count {
219
219
  position: absolute; inset: 0; display: grid; place-items: center;
220
220
  font-size: 18px; font-weight: 600; color: #0f172a;
@@ -258,7 +258,7 @@ p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
258
258
  .ring .bar { animation: none; stroke-dashoffset: 0; }
259
259
  .spinner { animation-duration: 2s; }
260
260
  }
261
- `;var W5="/sso";function Y5(z,J,$,j){let Q=new URL(W5,z.endsWith("/")?z:`${z}/`);if(Q.searchParams.set("realm",J),Q.searchParams.set("token",$),j)Q.searchParams.set("return",j);return Q.toString()}class h1 extends Error{constructor(z="No identity provider is configured, or nobody is signed in"){super(z);this.name="NoIdentityError"}}async function K5(z){let J=N();if(!J.identity)throw new h1;let $=await J.identity();if(!$)throw new h1;return Y5(J.host,J.realmKey,$,z)}var k4=K5;var G5="lw-call-ring",H5=`
261
+ `;var G5="/sso";function H5(z,J,$,j){let Q=new URL(G5,z.endsWith("/")?z:`${z}/`);if(Q.searchParams.set("realm",J),Q.searchParams.set("token",$),j)Q.searchParams.set("return",j);return Q.toString()}class v1 extends Error{constructor(z="No identity provider is configured, or nobody is signed in"){super(z);this.name="NoIdentityError"}}async function U5(z){let J=N();if(!J.identity)throw new v1;let $=await J.identity();if(!$)throw new v1;return H5(J.host,J.realmKey,$,z)}var x4=U5;var P5="lw-call-ring",F5=`
262
262
  :host { all: initial; }
263
263
  .card {
264
264
  position: fixed; right: 16px; bottom: 16px; z-index: 2147483002;
@@ -297,7 +297,7 @@ h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; }
297
297
  @keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
298
298
  @keyframes ping { from { transform: scale(1); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
299
299
  @media (prefers-reduced-motion: reduce) { .card { animation: none; } .icon::after { animation: none; opacity: 0; } }
300
- `,U5='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><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"/></svg>',g=null,F0=null,O0=null;function F5(z,J){return z.replace("{key}",J.ticketKey).replace("{title}",J.ticketTitle)}var m1=()=>U0(N().locale);function P5(){if(typeof document>"u")return null;if(g?.isConnected)return g.shadowRoot;g=document.createElement(G5),g.dataset.debugReporter="true";let z=g.attachShadow({mode:"open"});return y0(z),document.body.append(g),z}function A4(z,J){if(F0===z.id&&g?.isConnected)return;let $=P5();if(!$)return;F0=z.id;let j=m1();$.innerHTML="";let Q=document.createElement("style");Q.textContent=H5;let Z=document.createElement("div");Z.className="card",Z.setAttribute("role","alertdialog"),Z.setAttribute("aria-label",j.ringTitle),Z.dataset.lwCallRing=z.id;let X=document.createElement("div");X.className="head";let Y=document.createElement("span");Y.className="icon",Y.innerHTML=U5;let H=document.createElement("div"),F=document.createElement("h2");F.textContent=j.ringTitle;let S=document.createElement("p");S.className="about",S.textContent=F5(j.ringAbout,z),S.title=S.textContent,H.append(F,S),X.append(Y,H);let B=document.createElement("p");B.className="how",B.textContent=j.ringHow;let L=document.createElement("div");L.className="actions";let R=document.createElement("button");R.type="button",R.className="decline",R.textContent=j.ringDecline,R.dataset.lwRing="decline",R.onclick=()=>J.decline();let k=document.createElement("button");if(k.type="button",k.className="open",k.textContent=j.ringOpen,k.dataset.lwRing="open",k.onclick=()=>J.open(),L.append(R,k),Z.append(X,B,L),$.append(Q,Z),q5(),O0===null)O0=document.title,document.title=`${j.ringTab} — ${O0}`;k.focus({preventScroll:!0})}function G1(z){let J=g?.shadowRoot;if(!J)return;u1(),f4();let $=m1(),j=J.querySelector(".how"),Q=J.querySelector(".actions");if(j)if(j.textContent="",z){let Z=document.createElement("a");Z.href=z,Z.target="_blank",Z.rel="noopener",Z.textContent=$.ringBlocked,Z.dataset.lwRing="link",Z.onclick=()=>window.setTimeout(()=>G1(),0),j.append(Z)}else j.textContent=$.ringOpened;if(Q){Q.innerHTML="";let Z=document.createElement("button");Z.type="button",Z.className="close",Z.textContent=$.ringClose,Z.dataset.lwRing="close",Z.onclick=()=>_0(),Q.append(Z)}}function v1(z,J=!0){if(!g?.isConnected||F0!==z)return;g.style.display=J?"none":""}function _0(z){if(z&&F0&&z!==F0)return;u1(),f4(),g?.remove(),g=null,F0=null}function T4(){return g?.isConnected?F0:null}function f4(){if(O0===null||typeof document>"u")return;if(document.title.startsWith(m1().ringTab))document.title=O0;O0=null}var Z0=null,y1;function q5(){u1();let z=window,J=z.AudioContext??z.webkitAudioContext;if(!J)return;try{let j=Z0??new J;Z0=j,j.resume?.().catch(()=>{return})}catch{return}let $=()=>{if(!Z0||Z0.state!=="running")return;let j=Z0.currentTime;for(let[Q,Z]of[660,880].entries()){let X=Z0.createOscillator(),Y=Z0.createGain();X.frequency.value=Z,Y.gain.setValueAtTime(0.0001,j+Q*0.22),Y.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),Y.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),X.connect(Y).connect(Z0.destination),X.start(j+Q*0.22),X.stop(j+Q*0.22+0.21)}};$(),y1=setInterval($,2200)}function u1(){clearInterval(y1),y1=void 0}var D5=/^[A-Za-z0-9_-]{1,32}$/,B5=/^#[0-9a-fA-F]{6}$/,M5=["pen","rect","laser"],w4=(z)=>z<0?0:z>1?1:z;function x4(z,J){if(!Array.isArray(z)||z.length<J||z.length>64)return null;let $=[];for(let j of z){if(!Array.isArray(j)||j.length!==2)return null;let[Q,Z]=j;if(typeof Q!=="number"||typeof Z!=="number"||!Number.isFinite(Q)||!Number.isFinite(Z))return null;$.push([w4(Q),w4(Z)])}return $}function b4(z){if(!z||typeof z!=="object")return null;let J=z;if(J.op==="clear")return{op:"clear"};if(typeof J.id!=="string"||!D5.test(J.id))return null;if(J.op==="end")return{op:"end",id:J.id};if(J.op==="add"){let $=x4(J.pts,1);return $?{op:"add",id:J.id,pts:$}:null}if(J.op==="begin"){if(!M5.includes(J.kind)||typeof J.color!=="string"||!B5.test(J.color))return null;let $=x4(J.pts,1);return $?{op:"begin",id:J.id,kind:J.kind,color:J.color,pts:$}:null}return null}function p1(z,J){if(z.endedAt!==null)return z.endedAt;return J-z.lastAt>20000?z.lastAt:null}function E4(z,J,$){if(J===null)return 1;let j=$-J;if(z==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class d1{marks=new Map;apply(z,J=Date.now()){if(z.op==="clear"){this.marks.clear();return}if(z.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete(z.id),this.marks.set(z.id,{kind:z.kind,color:z.color,pts:z.pts.map(([j,Q])=>({x:j,y:Q,t:J})),endedAt:null,lastAt:J});return}let $=this.marks.get(z.id);if(!$||p1($,J)!==null)return;if(z.op==="end"){$.endedAt=J;return}if($.lastAt=J,$.kind==="rect"){let[j,Q]=z.pts[z.pts.length-1];$.pts=[$.pts[0],{x:j,y:Q,t:J}];return}for(let[j,Q]of z.pts)$.pts.push({x:j,y:Q,t:J});if($.pts.length>4000)$.pts.splice(0,$.pts.length-4000)}alive(z=Date.now()){for(let[J,$]of this.marks)if(E4($.kind,p1($,z),z)<=0)this.marks.delete(J);return this.marks.size>0}get size(){return this.marks.size}draw(z,J,$,j=Date.now()){z.clearRect(0,0,J,$);let Q=Math.max(1,Math.min(J,$));for(let Z of this.marks.values()){let X=E4(Z.kind,p1(Z,j),j);if(X<=0||!Z.pts.length)continue;if(z.save(),z.lineCap="round",z.lineJoin="round",Z.kind==="pen")I5(z,Z,J,$,Math.max(3,Q*0.0045),X);else if(Z.kind==="rect")C5(z,Z,J,$,Math.max(2.5,Q*0.003),X);else O5(z,Z,J,$,Math.max(6,Q*0.008),X,j);z.restore()}}}function N5(z,J,$,j){if(z.beginPath(),z.moveTo(J[0].x*$,J[0].y*j),J.length===1){z.lineTo(J[0].x*$+0.01,J[0].y*j);return}for(let Z=1;Z<J.length-1;Z++){let X=J[Z],Y=J[Z+1];z.quadraticCurveTo(X.x*$,X.y*j,(X.x+Y.x)/2*$,(X.y+Y.y)/2*j)}let Q=J[J.length-1];z.lineTo(Q.x*$,Q.y*j)}function I5(z,J,$,j,Q,Z){z.globalAlpha=Z,N5(z,J.pts,$,j),z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.stroke(),z.strokeStyle=J.color,z.lineWidth=Q,z.stroke()}function C5(z,J,$,j,Q,Z){let X=J.pts[0],Y=J.pts[J.pts.length-1],H=Math.min(X.x,Y.x)*$,F=Math.min(X.y,Y.y)*j,S=Math.abs(Y.x-X.x)*$,B=Math.abs(Y.y-X.y)*j;z.globalAlpha=Z,z.fillStyle=J.color,z.globalAlpha=Z*0.14,z.fillRect(H,F,S,B),z.globalAlpha=Z,z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.strokeRect(H,F,S,B),z.strokeStyle=J.color,z.lineWidth=Q,z.strokeRect(H,F,S,B)}function O5(z,J,$,j,Q,Z,X){let Y=J.pts.filter((F)=>X-F.t<=450);for(let F=1;F<Y.length;F++){let S=Y[F-1],B=Y[F];z.globalAlpha=Z*Math.max(0,1-(X-B.t)/450)*0.7,z.strokeStyle=J.color,z.lineWidth=Q*0.9,z.beginPath(),z.moveTo(S.x*$,S.y*j),z.lineTo(B.x*$,B.y*j),z.stroke()}let H=J.pts[J.pts.length-1];z.globalAlpha=Z,z.shadowColor=J.color,z.shadowBlur=Q*2,z.fillStyle=J.color,z.beginPath(),z.arc(H.x*$,H.y*j,Q,0,Math.PI*2),z.fill(),z.shadowBlur=0,z.strokeStyle="rgba(255,255,255,0.95)",z.lineWidth=2,z.stroke()}function _5(z,J,$,j=typeof window>"u"?1:window.devicePixelRatio||1){let Q=Math.max(1,Math.round(J*j)),Z=Math.max(1,Math.round($*j));if(z.width!==Q)z.width=Q;if(z.height!==Z)z.height=Z;let X=z.getContext("2d");return X?.setTransform(j,0,0,j,0,0),X}class i1{canvas;scene;box;frame=0;constructor(z,J,$){this.canvas=z;this.scene=J;this.box=$}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let z=()=>{this.frame=0;let{w:J,h:$}=this.box(),j=_5(this.canvas,J,$),Q=Date.now(),Z=this.scene.alive(Q);if(j)this.scene.draw(j,J,$,Q);if(Z)this.frame=requestAnimationFrame(z)};this.frame=requestAnimationFrame(z)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var S5="lw-call-ink",V0=null,H1=null,v0=null;function L5(){if(V0?.isConnected&&v0)return;V0=document.createElement(S5),V0.dataset.debugReporter="true";let z=V0.attachShadow({mode:"open"}),J=document.createElement("style");J.textContent=`:host { all: initial; }
301
- canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let $=document.createElement("canvas");$.setAttribute("aria-hidden","true"),$.dataset.lwCallInk="",z.append(J,$),document.body.append(V0),H1=new d1,v0=new i1($,H1,()=>({w:window.innerWidth,h:window.innerHeight}))}function g4(z){if(typeof document>"u")return;if(z.op==="clear"&&!V0)return;L5(),H1.apply(z),v0.kick()}function h4(){v0?.stop(),V0?.remove(),V0=null,H1=null,v0=null}var R5="lw-call-frame",k5="lw-call",m=16,o1=368,a=null,f=null,U1=null,P1="",u0=null,p0="card",r1={width:o1,height:0},n1,c1=!1,W0=null,X0=null,l1="lw-call-frame-place";function y4(z,J,$,j){let Q=new URL("embed/call",z.endsWith("/")?z:`${z}/`);return Q.searchParams.set("realm",J),Q.searchParams.set("token",$),Q.searchParams.set("call",j),Q.toString()}function m4(z,J,$){return{x:Math.min(Math.max(z.x,m/2),Math.max(m/2,$.w-J.w-m/2)),y:Math.min(Math.max(z.y,m/2),Math.max(m/2,$.h-J.h-m/2))}}function A5(z,J){if(z.origin!==J.origin||z.source!==J.window)return null;let $=z.data;return $&&typeof $==="object"&&$.source===k5&&typeof $.type==="string"?$:null}function d0(){return a?.isConnected?U1:null}function v4(z,J,$,j=15000){if(typeof document>"u")return;if(U1===J&&a?.isConnected)return;i0(),U1=J,u0=$,c1=!1,p0="card",r1={width:o1,height:0},P1=new URL(z).origin;try{W0=JSON.parse(sessionStorage.getItem(l1)??"null")}catch{W0=null}a=document.createElement(R5),a.dataset.debugReporter="true";let Q=a.attachShadow({mode:"open"}),Z=document.createElement("style");Z.textContent=`:host { all: initial; }
300
+ `,q5='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><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"/></svg>',g=null,P0=null,O0=null;function D5(z,J){return z.replace("{key}",J.ticketKey).replace("{title}",J.ticketTitle)}var u1=()=>U0(N().locale);function B5(){if(typeof document>"u")return null;if(g?.isConnected)return g.shadowRoot;g=document.createElement(P5),g.dataset.debugReporter="true";let z=g.attachShadow({mode:"open"});return y0(z),document.body.append(g),z}function E4(z,J){if(P0===z.id&&g?.isConnected)return;let $=B5();if(!$)return;P0=z.id;let j=u1();$.innerHTML="";let Q=document.createElement("style");Q.textContent=F5;let Z=document.createElement("div");Z.className="card",Z.setAttribute("role","alertdialog"),Z.setAttribute("aria-label",j.ringTitle),Z.dataset.lwCallRing=z.id;let X=document.createElement("div");X.className="head";let Y=document.createElement("span");Y.className="icon",Y.innerHTML=q5;let H=document.createElement("div"),P=document.createElement("h2");P.textContent=j.ringTitle;let S=document.createElement("p");S.className="about",S.textContent=D5(j.ringAbout,z),S.title=S.textContent,H.append(P,S),X.append(Y,H);let B=document.createElement("p");B.className="how",B.textContent=j.ringHow;let L=document.createElement("div");L.className="actions";let R=document.createElement("button");R.type="button",R.className="decline",R.textContent=j.ringDecline,R.dataset.lwRing="decline",R.onclick=()=>J.decline();let k=document.createElement("button");if(k.type="button",k.className="open",k.textContent=j.ringOpen,k.dataset.lwRing="open",k.onclick=()=>J.open(),L.append(R,k),Z.append(X,B,L),$.append(Q,Z),M5(),O0===null)O0=document.title,document.title=`${j.ringTab} — ${O0}`;k.focus({preventScroll:!0})}function H1(z){let J=g?.shadowRoot;if(!J)return;d1(),w4();let $=u1(),j=J.querySelector(".how"),Q=J.querySelector(".actions");if(j)if(j.textContent="",z){let Z=document.createElement("a");Z.href=z,Z.target="_blank",Z.rel="noopener",Z.textContent=$.ringBlocked,Z.dataset.lwRing="link",Z.onclick=()=>window.setTimeout(()=>H1(),0),j.append(Z)}else j.textContent=$.ringOpened;if(Q){Q.innerHTML="";let Z=document.createElement("button");Z.type="button",Z.className="close",Z.textContent=$.ringClose,Z.dataset.lwRing="close",Z.onclick=()=>_0(),Q.append(Z)}}function p1(z,J=!0){if(!g?.isConnected||P0!==z)return;g.style.display=J?"none":""}function _0(z){if(z&&P0&&z!==P0)return;d1(),w4(),g?.remove(),g=null,P0=null}function f4(){return g?.isConnected?P0:null}function w4(){if(O0===null||typeof document>"u")return;if(document.title.startsWith(u1().ringTab))document.title=O0;O0=null}var V0=null,m1;function M5(){d1();let z=window,J=z.AudioContext??z.webkitAudioContext;if(!J)return;try{let j=V0??new J;V0=j,j.resume?.().catch(()=>{return})}catch{return}let $=()=>{if(!V0||V0.state!=="running")return;let j=V0.currentTime;for(let[Q,Z]of[660,880].entries()){let X=V0.createOscillator(),Y=V0.createGain();X.frequency.value=Z,Y.gain.setValueAtTime(0.0001,j+Q*0.22),Y.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),Y.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),X.connect(Y).connect(V0.destination),X.start(j+Q*0.22),X.stop(j+Q*0.22+0.21)}};$(),m1=setInterval($,2200)}function d1(){clearInterval(m1),m1=void 0}var N5=/^[A-Za-z0-9_-]{1,32}$/,I5=/^#[0-9a-fA-F]{6}$/,C5=["pen","rect","laser"],b4=(z)=>z<0?0:z>1?1:z;function g4(z,J){if(!Array.isArray(z)||z.length<J||z.length>64)return null;let $=[];for(let j of z){if(!Array.isArray(j)||j.length!==2)return null;let[Q,Z]=j;if(typeof Q!=="number"||typeof Z!=="number"||!Number.isFinite(Q)||!Number.isFinite(Z))return null;$.push([b4(Q),b4(Z)])}return $}function y4(z){if(!z||typeof z!=="object")return null;let J=z;if(J.op==="clear")return{op:"clear"};if(typeof J.id!=="string"||!N5.test(J.id))return null;if(J.op==="end")return{op:"end",id:J.id};if(J.op==="add"){let $=g4(J.pts,1);return $?{op:"add",id:J.id,pts:$}:null}if(J.op==="begin"){if(!C5.includes(J.kind)||typeof J.color!=="string"||!I5.test(J.color))return null;let $=g4(J.pts,1);return $?{op:"begin",id:J.id,kind:J.kind,color:J.color,pts:$}:null}return null}function i1(z,J){if(z.endedAt!==null)return z.endedAt;return J-z.lastAt>20000?z.lastAt:null}function h4(z,J,$){if(J===null)return 1;let j=$-J;if(z==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class c1{marks=new Map;apply(z,J=Date.now()){if(z.op==="clear"){this.marks.clear();return}if(z.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete(z.id),this.marks.set(z.id,{kind:z.kind,color:z.color,pts:z.pts.map(([j,Q])=>({x:j,y:Q,t:J})),endedAt:null,lastAt:J});return}let $=this.marks.get(z.id);if(!$||i1($,J)!==null)return;if(z.op==="end"){$.endedAt=J;return}if($.lastAt=J,$.kind==="rect"){let[j,Q]=z.pts[z.pts.length-1];$.pts=[$.pts[0],{x:j,y:Q,t:J}];return}for(let[j,Q]of z.pts)$.pts.push({x:j,y:Q,t:J});if($.pts.length>4000)$.pts.splice(0,$.pts.length-4000)}alive(z=Date.now()){for(let[J,$]of this.marks)if(h4($.kind,i1($,z),z)<=0)this.marks.delete(J);return this.marks.size>0}get size(){return this.marks.size}draw(z,J,$,j=Date.now()){z.clearRect(0,0,J,$);let Q=Math.max(1,Math.min(J,$));for(let Z of this.marks.values()){let X=h4(Z.kind,i1(Z,j),j);if(X<=0||!Z.pts.length)continue;if(z.save(),z.lineCap="round",z.lineJoin="round",Z.kind==="pen")_5(z,Z,J,$,Math.max(3,Q*0.0045),X);else if(Z.kind==="rect")S5(z,Z,J,$,Math.max(2.5,Q*0.003),X);else L5(z,Z,J,$,Math.max(6,Q*0.008),X,j);z.restore()}}}function O5(z,J,$,j){if(z.beginPath(),z.moveTo(J[0].x*$,J[0].y*j),J.length===1){z.lineTo(J[0].x*$+0.01,J[0].y*j);return}for(let Z=1;Z<J.length-1;Z++){let X=J[Z],Y=J[Z+1];z.quadraticCurveTo(X.x*$,X.y*j,(X.x+Y.x)/2*$,(X.y+Y.y)/2*j)}let Q=J[J.length-1];z.lineTo(Q.x*$,Q.y*j)}function _5(z,J,$,j,Q,Z){z.globalAlpha=Z,O5(z,J.pts,$,j),z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.stroke(),z.strokeStyle=J.color,z.lineWidth=Q,z.stroke()}function S5(z,J,$,j,Q,Z){let X=J.pts[0],Y=J.pts[J.pts.length-1],H=Math.min(X.x,Y.x)*$,P=Math.min(X.y,Y.y)*j,S=Math.abs(Y.x-X.x)*$,B=Math.abs(Y.y-X.y)*j;z.globalAlpha=Z,z.fillStyle=J.color,z.globalAlpha=Z*0.14,z.fillRect(H,P,S,B),z.globalAlpha=Z,z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.strokeRect(H,P,S,B),z.strokeStyle=J.color,z.lineWidth=Q,z.strokeRect(H,P,S,B)}function L5(z,J,$,j,Q,Z,X){let Y=J.pts.filter((P)=>X-P.t<=450);for(let P=1;P<Y.length;P++){let S=Y[P-1],B=Y[P];z.globalAlpha=Z*Math.max(0,1-(X-B.t)/450)*0.7,z.strokeStyle=J.color,z.lineWidth=Q*0.9,z.beginPath(),z.moveTo(S.x*$,S.y*j),z.lineTo(B.x*$,B.y*j),z.stroke()}let H=J.pts[J.pts.length-1];z.globalAlpha=Z,z.shadowColor=J.color,z.shadowBlur=Q*2,z.fillStyle=J.color,z.beginPath(),z.arc(H.x*$,H.y*j,Q,0,Math.PI*2),z.fill(),z.shadowBlur=0,z.strokeStyle="rgba(255,255,255,0.95)",z.lineWidth=2,z.stroke()}function R5(z,J,$,j=typeof window>"u"?1:window.devicePixelRatio||1){let Q=Math.max(1,Math.round(J*j)),Z=Math.max(1,Math.round($*j));if(z.width!==Q)z.width=Q;if(z.height!==Z)z.height=Z;let X=z.getContext("2d");return X?.setTransform(j,0,0,j,0,0),X}class l1{canvas;scene;box;frame=0;constructor(z,J,$){this.canvas=z;this.scene=J;this.box=$}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let z=()=>{this.frame=0;let{w:J,h:$}=this.box(),j=R5(this.canvas,J,$),Q=Date.now(),Z=this.scene.alive(Q);if(j)this.scene.draw(j,J,$,Q);if(Z)this.frame=requestAnimationFrame(z)};this.frame=requestAnimationFrame(z)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var k5="lw-call-ink",X0=null,U1=null,m0=null;function A5(){if(X0?.isConnected&&m0)return;X0=document.createElement(k5),X0.dataset.debugReporter="true";let z=X0.attachShadow({mode:"open"}),J=document.createElement("style");J.textContent=`:host { all: initial; }
301
+ canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let $=document.createElement("canvas");$.setAttribute("aria-hidden","true"),$.dataset.lwCallInk="",z.append(J,$),document.body.append(X0),U1=new c1,m0=new l1($,U1,()=>({w:window.innerWidth,h:window.innerHeight}))}function v4(z){if(typeof document>"u")return;if(z.op==="clear"&&!X0)return;A5(),U1.apply(z),m0.kick()}function m4(){m0?.stop(),X0?.remove(),X0=null,U1=null,m0=null}var T5="lw-call-frame",x5="lw-call",m=16,s1=368,t=null,x=null,P1=null,D1="",p0=null,d0="card",a1={width:s1,height:0},t1,o1=!1,W0=null,h=null,r1="lw-call-frame-place";function u4(z,J,$,j){let Q=new URL("embed/call",z.endsWith("/")?z:`${z}/`);return Q.searchParams.set("realm",J),Q.searchParams.set("token",$),Q.searchParams.set("call",j),Q.toString()}function p4(z,J,$){return{x:Math.min(Math.max(z.x,m/2),Math.max(m/2,$.w-J.w-m/2)),y:Math.min(Math.max(z.y,m/2),Math.max(m/2,$.h-J.h-m/2))}}function E5(z,J){if(z.origin!==J.origin||z.source!==J.window)return null;let $=z.data;return $&&typeof $==="object"&&$.source===x5&&typeof $.type==="string"?$:null}function i0(){return t?.isConnected?P1:null}function d4(z,J,$,j=15000){if(typeof document>"u")return;if(P1===J&&t?.isConnected)return;c0(),P1=J,p0=$,o1=!1,d0="card",a1={width:s1,height:0},D1=new URL(z).origin;try{W0=JSON.parse(sessionStorage.getItem(r1)??"null")}catch{W0=null}t=document.createElement(T5),t.dataset.debugReporter="true";let Q=t.attachShadow({mode:"open"}),Z=document.createElement("style");Z.textContent=`:host { all: initial; }
302
302
  iframe { position: fixed; z-index: 2147483003; border: 0; background: transparent; color-scheme: normal; visibility: hidden; }
303
- iframe.on { visibility: visible; }`,f=document.createElement("iframe"),f.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",f.title="สายจากทีมงาน",f.dataset.lwCallFrame=J,f.setAttribute("allowtransparency","true"),f.src=z,Q.append(Z,f),document.body.append(a),S0(),window.addEventListener("message",p4),window.addEventListener("resize",S0),d4(`lw-call:${J}`),n1=setTimeout(()=>{if(!c1)u4("timeout")},j)}function i0(){if(a)d4(null);h4(),clearTimeout(n1),window.removeEventListener("message",p4),window.removeEventListener("resize",S0),a?.remove(),a=null,f=null,U1=null,u0=null,X0=null}function u4(z){let J=u0;i0(),J?.failed(z)}function p4(z){if(!f)return;let J=A5(z,{origin:P1,window:f.contentWindow});if(!J)return;switch(J.type){case"ready":c1=!0,clearTimeout(n1),f.classList.add("on"),u0?.ready();return;case"size":if(typeof J.width==="number"&&typeof J.height==="number")r1={width:J.width,height:J.height};if(J.layout==="card"||J.layout==="full"){if(J.layout==="full"&&p0==="card")f5();p0=J.layout}return S0();case"drag":return T5(J);case"home":return W0=null,i4(),S0();case"done":{let $=u0;i0(),$?.done();return}case"failed":return u4(J.reason??"failed");case"ink":{let $=b4(J.op);if($)g4($);return}}}function d4(z){let J=typeof navigator>"u"?void 0:navigator.mediaDevices;try{J?.setCaptureHandleConfig?.(z?{handle:z,exposeOrigin:!1,permittedOrigins:[P1]}:{})}catch{}}function T5(z){if(!f||p0!=="card"||typeof z.x!=="number"||typeof z.y!=="number")return;if(z.phase==="start"){let J=f.getBoundingClientRect();X0={sx:z.x,sy:z.y,x:J.left,y:J.top};return}if(!X0)return;if(W0=m4({x:X0.x+(z.x-X0.sx),y:X0.y+(z.y-X0.sy)},c4(),F1()),S0(),z.phase==="end")X0=null,i4()}function f5(){if(!f?.contentWindow)return;let z=f.getBoundingClientRect();f.contentWindow.postMessage({source:"lw-call-host",type:"corner",x:Math.round(z.left),y:Math.round(z.top),width:Math.round(z.width)},P1)}function i4(){try{if(W0)sessionStorage.setItem(l1,JSON.stringify(W0));else sessionStorage.removeItem(l1)}catch{}}var F1=()=>({w:window.innerWidth,h:window.innerHeight});function c4(){let z=F1();return{w:Math.min(o1,z.w-m),h:Math.min(r1.height||0,z.h-m)}}function S0(){if(!f)return;let z=f.style;if(p0==="full"){Object.assign(z,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let J=c4(),$=F1().w<480;if(z.width=$?`calc(100vw - ${m}px)`:`${J.w}px`,z.height=`${J.h}px`,W0&&!$){let j=m4(W0,J,F1());Object.assign(z,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(z,{left:$?`${m/2}px`:"",top:"",right:$?"":`${m/2}px`,bottom:`${m/2}px`})}var q1=[2000,5000,15000,30000,60000],w5=new Set(["ringing","active"]),x5=20000,l4=!1,L0=!1,o4=0,E5=5,s1=null,t4=0,a1,r4,n4,e4=(z)=>z.endsWith("/")?z:`${z}/`;function b5(z,J){let $=new URL("api/presence/ws",e4(z));return $.protocol=$.protocol==="https:"?"wss:":"ws:",$.searchParams.set("t",J),$.toString()}function g5(z){return`/me/tickets/${z.ticketId}?call=${z.id}`}function h5(z){return z.status==="ringing"&&(z.side==="reporter"||z.side===void 0||z.side===null)}async function B1(){let z=N().identity;if(!z)return null;try{return await z()??null}catch{return null}}async function z2(z,J){let $=N();return fetch(new URL(z,e4($.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,authorization:`Bearer ${J}`},body:"{}"})}function J2(){if(l4||typeof window>"u"||typeof WebSocket>"u")return;let z=N();if(!z.identity||z.ring===!1)return;l4=!0,L0=!1,z6()}function c0(z=!1){if(L0)return;let J=z?q1[q1.length-1]:q1[Math.min(t4++,q1.length-1)];clearTimeout(r4),r4=setTimeout(()=>void z6(),J)}async function z6(){if(L0)return;let z=await B1();if(!z){if(++o4>=E5){L0=!0;return}return c0(!0)}o4=0;let J;try{J=await z2("ingest/live-ticket",z)}catch{return c0()}if(J.status===401||J.status===404||J.status===403){L0=!0;return}if(!J.ok)return c0(J.status===429);let $;try{$=await J.json()}catch{return c0()}if(!$.calls||!$.ticket){L0=!0;return}if($.call)a4($.call);let j=new WebSocket(b5(N().host,$.ticket));s1=j,j.onopen=()=>{t4=0,clearInterval(a1),a1=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},x5)},j.onmessage=(Q)=>{try{let Z=JSON.parse(String(Q.data));if(Z.type==="call-state"&&Z.call)a4(Z.call)}catch{}},j.onclose=()=>{if(clearInterval(a1),s1===j)s1=null;c0()}}var e1="lw-call-framed";function y5(){try{return sessionStorage.getItem(e1)}catch{return null}}function D1(z){try{if(z)sessionStorage.setItem(e1,z);else sessionStorage.removeItem(e1)}catch{}}var t1=null;async function s4(z){let J=N();if(J.callFrame===!1||d0()===z.id||t1===z.id)return;t1=z.id;let $=await B1();if(t1=null,!$)return;D1(z.id),v4(y4(J.host,J.realmKey,$,z.id),z.id,{ready:()=>v1(z.id),done:()=>{D1(null),_0(z.id)},failed:()=>{D1(null),v1(z.id,!1)}})}function a4(z){if(!h5(z)){if(_0(z.id),z.status==="active"&&y5()===z.id&&!d0())s4(z);if(!w5.has(z.status)&&d0()===z.id)setTimeout(()=>{if(d0()===z.id)i0(),D1(null)},12000);return}A4(z,{open:()=>m5(z),decline:()=>void v5(z)}),s4(z),clearTimeout(n4);let J=new Date(z.ringUntil).getTime()-Date.now();n4=setTimeout(()=>{if(T4()===z.id)_0(z.id)},Math.max(5000,J+5000))}function m5(z){let J=window.open("about:blank","_blank");(async()=>{let $=await B1();if($)z2(`ingest/calls/${z.id}/coming`,$).catch(()=>{return});let j;try{j=await k4(g5(z))}catch{J?.close();return}if(J&&!J.closed){J.location.href=j;try{J.opener=null}catch{}G1()}else G1(j)})()}async function v5(z){_0(z.id);let J=await B1();if(J)await z2(`ingest/calls/${z.id}/decline`,J).catch(()=>{return})}var J6=!1;function $2(z={}){if(J6||typeof window>"u")return;if(!r0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(J6=!0,c2(),_2(),B2(),g2(),s2(),z.ui===!1)return;let J=U0(N().locale);if(f2((j)=>{I0(j.message??J.crashed,"error",{label:J.crashAction,onClick:()=>z1(j)})}),L4(),!document.querySelector(m0))document.body.append(document.createElement(m0));let $=window.requestIdleCallback;if($)$(()=>void C0(),{timeout:5000});else setTimeout(()=>void C0(),2000);if($)$(()=>J2(),{timeout:8000});else setTimeout(()=>J2(),3000)}var $6=document.currentScript,p=$6?.dataset??{},u5="rrweb-record.mjs";n2(()=>import(new URL(u5,$6?.src??location.href).href));function p5(z){if(!z)return{};try{let J=JSON.parse(z);if(!J||typeof J!=="object"||Array.isArray(J))return{};return Object.fromEntries(Object.entries(J).filter(([,$])=>typeof $==="string"&&$.trim()))}catch{return{}}}if(p.host&&p.realmKey)if(Q2({host:p.host,realmKey:p.realmKey,app:{name:p.appName??document.title??"app",version:p.appVersion??"0.0.0",environment:p.environment??"production"},module:X2(p5(p.modules)),locale:p.locale==="en"?"en":"th",...p.replay!==void 0?{replay:{seconds:Number(p.replay)||void 0}}:{}}),document.body)$2();else document.addEventListener("DOMContentLoaded",()=>$2(),{once:!0});window.lwReportProblem=z1;})();
303
+ iframe.on { visibility: visible; }`,x=document.createElement("iframe"),x.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",x.title="สายจากทีมงาน",x.dataset.lwCallFrame=J,x.setAttribute("allowtransparency","true"),x.src=z,Q.append(Z,x),document.body.append(t),S0(),window.addEventListener("message",c4),window.addEventListener("resize",S0),l4(`lw-call:${J}`),t1=setTimeout(()=>{if(!o1)i4("timeout")},j)}function c0(){if(t)l4(null);m4(),clearTimeout(t1),window.removeEventListener("message",c4),window.removeEventListener("resize",S0),F1(!1),t?.remove(),t=null,x=null,P1=null,p0=null,h=null}function i4(z){let J=p0;c0(),J?.failed(z)}function c4(z){if(!x)return;let J=E5(z,{origin:D1,window:x.contentWindow});if(!J)return;switch(J.type){case"ready":o1=!0,clearTimeout(t1),x.classList.add("on"),p0?.ready();return;case"size":if(typeof J.width==="number"&&typeof J.height==="number")a1={width:J.width,height:J.height};if(J.layout==="card"||J.layout==="full"){if(J.layout==="full"&&d0==="card")f5();d0=J.layout}return S0();case"drag":return n1(J);case"home":return W0=null,o4(),S0();case"done":{let $=p0;c0(),$?.done();return}case"failed":return i4(J.reason??"failed");case"ink":{let $=y4(J.op);if($)v4($);return}}}function l4(z){let J=typeof navigator>"u"?void 0:navigator.mediaDevices;try{J?.setCaptureHandleConfig?.(z?{handle:z,exposeOrigin:!1,permittedOrigins:[D1]}:{})}catch{}}function n1(z){if(!x||d0!=="card"||typeof z.x!=="number"||typeof z.y!=="number")return;if(z.phase==="start"){let J=x.getBoundingClientRect();h={sx:z.x,sy:z.y,x:J.left,y:J.top,lx:z.x,ly:z.y},F1(!0);return}if(!h)return;if(h.lx=z.x,h.ly=z.y,W0=p4({x:h.x+(z.x-h.sx),y:h.y+(z.y-h.sy)},r4(),q1()),S0(),z.phase==="end")h=null,F1(!1),o4()}var u0=null;function F1(z){if(u0){for(let J of["pointermove","pointerup","pointercancel"])window.removeEventListener(J,u0,!0);u0=null}if(!z)return;u0=(J)=>{if(!h)return F1(!1);if(J.type==="pointermove"&&J.buttons!==0)return n1({type:"drag",phase:"move",x:J.screenX,y:J.screenY});let $=J.type==="pointerup";n1({type:"drag",phase:"end",x:$?J.screenX:h.lx,y:$?J.screenY:h.ly})};for(let J of["pointermove","pointerup","pointercancel"])window.addEventListener(J,u0,!0)}function f5(){if(!x?.contentWindow)return;let z=x.getBoundingClientRect();x.contentWindow.postMessage({source:"lw-call-host",type:"corner",x:Math.round(z.left),y:Math.round(z.top),width:Math.round(z.width)},D1)}function o4(){try{if(W0)sessionStorage.setItem(r1,JSON.stringify(W0));else sessionStorage.removeItem(r1)}catch{}}var q1=()=>({w:window.innerWidth,h:window.innerHeight});function r4(){let z=q1();return{w:Math.min(s1,z.w-m),h:Math.min(a1.height||0,z.h-m)}}function S0(){if(!x)return;let z=x.style;if(d0==="full"){Object.assign(z,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let J=r4(),$=q1().w<480;if(z.width=$?`calc(100vw - ${m}px)`:`${J.w}px`,z.height=`${J.h}px`,W0&&!$){let j=p4(W0,J,q1());Object.assign(z,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(z,{left:$?`${m/2}px`:"",top:"",right:$?"":`${m/2}px`,bottom:`${m/2}px`})}var B1=[2000,5000,15000,30000,60000],w5=new Set(["ringing","active"]),b5=20000,n4=!1,L0=!1,s4=0,g5=5,e1=null,J6=0,z2,a4,t4,$6=(z)=>z.endsWith("/")?z:`${z}/`;function h5(z,J){let $=new URL("api/presence/ws",$6(z));return $.protocol=$.protocol==="https:"?"wss:":"ws:",$.searchParams.set("t",J),$.toString()}function y5(z){return`/me/tickets/${z.ticketId}?call=${z.id}`}function v5(z){return z.status==="ringing"&&(z.side==="reporter"||z.side===void 0||z.side===null)}async function N1(){let z=N().identity;if(!z)return null;try{return await z()??null}catch{return null}}async function j2(z,J){let $=N();return fetch(new URL(z,$6($.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,authorization:`Bearer ${J}`},body:"{}"})}function Q2(){if(n4||typeof window>"u"||typeof WebSocket>"u")return;let z=N();if(!z.identity||z.ring===!1)return;n4=!0,L0=!1,j6()}function l0(z=!1){if(L0)return;let J=z?B1[B1.length-1]:B1[Math.min(J6++,B1.length-1)];clearTimeout(a4),a4=setTimeout(()=>void j6(),J)}async function j6(){if(L0)return;let z=await N1();if(!z){if(++s4>=g5){L0=!0;return}return l0(!0)}s4=0;let J;try{J=await j2("ingest/live-ticket",z)}catch{return l0()}if(J.status===401||J.status===404||J.status===403){L0=!0;return}if(!J.ok)return l0(J.status===429);let $;try{$=await J.json()}catch{return l0()}if(!$.calls||!$.ticket){L0=!0;return}if($.call)z6($.call);let j=new WebSocket(h5(N().host,$.ticket));e1=j,j.onopen=()=>{J6=0,clearInterval(z2),z2=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},b5)},j.onmessage=(Q)=>{try{let Z=JSON.parse(String(Q.data));if(Z.type==="call-state"&&Z.call)z6(Z.call)}catch{}},j.onclose=()=>{if(clearInterval(z2),e1===j)e1=null;l0()}}var $2="lw-call-framed";function m5(){try{return sessionStorage.getItem($2)}catch{return null}}function M1(z){try{if(z)sessionStorage.setItem($2,z);else sessionStorage.removeItem($2)}catch{}}var J2=null;async function e4(z){let J=N();if(J.callFrame===!1||i0()===z.id||J2===z.id)return;J2=z.id;let $=await N1();if(J2=null,!$)return;M1(z.id),d4(u4(J.host,J.realmKey,$,z.id),z.id,{ready:()=>p1(z.id),done:()=>{M1(null),_0(z.id)},failed:()=>{M1(null),p1(z.id,!1)}})}function z6(z){if(!v5(z)){if(_0(z.id),z.status==="active"&&m5()===z.id&&!i0())e4(z);if(!w5.has(z.status)&&i0()===z.id)setTimeout(()=>{if(i0()===z.id)c0(),M1(null)},12000);return}E4(z,{open:()=>u5(z),decline:()=>void p5(z)}),e4(z),clearTimeout(t4);let J=new Date(z.ringUntil).getTime()-Date.now();t4=setTimeout(()=>{if(f4()===z.id)_0(z.id)},Math.max(5000,J+5000))}function u5(z){let J=window.open("about:blank","_blank");(async()=>{let $=await N1();if($)j2(`ingest/calls/${z.id}/coming`,$).catch(()=>{return});let j;try{j=await x4(y5(z))}catch{J?.close();return}if(J&&!J.closed){J.location.href=j;try{J.opener=null}catch{}H1()}else H1(j)})()}async function p5(z){_0(z.id);let J=await N1();if(J)await j2(`ingest/calls/${z.id}/decline`,J).catch(()=>{return})}var Q6=!1;function Z2(z={}){if(Q6||typeof window>"u")return;if(!n0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(Q6=!0,r2(),R2(),I2(),v2(),e2(),z.ui===!1)return;let J=U0(N().locale);if(w2((j)=>{I0(j.message??J.crashed,"error",{label:J.crashAction,onClick:()=>J1(j)})}),A4(),!document.querySelector(v0))document.body.append(document.createElement(v0));let $=window.requestIdleCallback;if($)$(()=>void C0(),{timeout:5000});else setTimeout(()=>void C0(),2000);if($)$(()=>Q2(),{timeout:8000});else setTimeout(()=>Q2(),3000)}var Z6=document.currentScript,d=Z6?.dataset??{},d5="rrweb-record.mjs";t2(()=>import(new URL(d5,Z6?.src??location.href).href));function i5(z){if(!z)return{};try{let J=JSON.parse(z);if(!J||typeof J!=="object"||Array.isArray(J))return{};return Object.fromEntries(Object.entries(J).filter(([,$])=>typeof $==="string"&&$.trim()))}catch{return{}}}if(d.host&&d.realmKey)if(X2({host:d.host,realmKey:d.realmKey,app:{name:d.appName??document.title??"app",version:d.appVersion??"0.0.0",environment:d.environment??"production"},module:K2(i5(d.modules)),locale:d.locale==="en"?"en":"th",...d.replay!==void 0?{replay:{seconds:Number(d.replay)||void 0}}:{}}),document.body)Z2();else document.addEventListener("DOMContentLoaded",()=>Z2(),{once:!0});window.lwReportProblem=J1;})();
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var P6=((z)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(z,{get:(J,$)=>(typeof require<"u"?require:J)[$]}):z)(function(z){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+z+'" is not supported')});var D6={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},p=null;function B6(z){let J=[];if(!z.host?.trim())J.push("host");if(!z.realmKey?.trim())J.push("realmKey");if(!z.app?.name?.trim())J.push("app.name");if(typeof z.module!=="function")J.push("module");if(J.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${J.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");p=z}function O(){if(!p)throw Error("[debug-capture] configureDebugCapture() has not been called");return p}function g0(){return p!==null}function t(){let z=O().app;return{name:z.name,version:z.version??"0.0.0",environment:z.environment??q6()}}function q6(){if(typeof window>"u")return"unknown";let z=window.location.hostname;if(z==="localhost"||z==="127.0.0.1"||z.endsWith(".local"))return"development";return"production"}function V0(z){let J=p?.capture?.[z];return typeof J==="number"?J:D6[z]}function a0(z){let J=p?.module;if(!J)return null;try{return J(z)??null}catch{return null}}function t0(){let z=p?.redact;return{headers:z?.headers??[],queryKeys:(z?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:(z?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function L2(){return p?.capture?.overlaySelectors??[]}var M6='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',N6="[data-lw-mask]",S2={fps:1,quality:0.5};function h0(){let z=p?.replay;if(!z)return null;let J=z===!0?{}:z,$=(Z,V)=>typeof Z==="number"&&Z>0?Z:V,j=J.maskInputs!==!1,Q=J.recordCanvas?{fps:$(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,S2.fps),quality:$(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,S2.quality)}:null;return{seconds:$(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?M6:N6),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(J.maxBytes,4000000),canvas:Q}}function R2(z){if(typeof window>"u")return!1;let J;try{J=new URL(z,window.location.href)}catch{return!1}if(I6(J))return!1;if(J.origin===window.location.origin)return!0;return(p?.capture?.bodyOrigins??[]).some(($)=>{try{return new URL($).origin===J.origin}catch{return!1}})}function I6(z){if(!p?.host)return!1;try{if(new URL(p.host).origin!==z.origin)return!1}catch{return!1}return z.pathname.startsWith("/ingest/")}function C6(z){let J=Object.entries(z).map(([$,j])=>[$.replace(/\/+$/,"")||"/",j]).sort(($,j)=>j[0].length-$[0].length);return($)=>{let j=($||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of J)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var _0="‹redacted›",O6=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,_6=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),S6=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,L6=/[\w.+-]+@[\w-]+\.[\w.-]+/g,R6=/\d(?:[\d\s-]{7,})\d/g;function S0(z){return z.replace(L6,_0).replace(R6,_0)}function A6(z){if(O6.test(z))return!0;return t0().headers.some(($)=>$.toLowerCase()===z.toLowerCase())}function L0(z){let J={};for(let[$,j]of Object.entries(z))J[$]=A6($)?_0:j;return J}function z0(z){try{let J=/^https?:\/\//i.test(z),$=new URL(z,J?void 0:"http://local.invalid"),j=!1;if($.searchParams.forEach((Q,Z)=>{if(_6.has(Z.toLowerCase())||t0().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,_0),j=!0}),!j)return z;return J?$.toString():`${$.pathname}${$.search}`}catch{return z}}function L1(z,J){if(J>6||z===null||typeof z!=="object")return z;if(Array.isArray(z))return z.map((j)=>L1(j,J+1));let $={};for(let[j,Q]of Object.entries(z)){let Z=S6.test(j)||t0().bodyKeys.some((V)=>j.toLowerCase().includes(V));$[j]=Z?_0:L1(Q,J+1)}return $}function R0(z,J){if(z==null)return null;let $=z,j=z.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);$=JSON.stringify(L1(Q,0))}catch{}if($.length>J)return`${$.slice(0,J)}… [truncated ${$.length-J} chars]`;return $}var R1=120,A1=40,k0=(z,J)=>z.length>J?`${z.slice(0,J)}…`:z,k1=(z)=>{try{return decodeURIComponent(z)}catch{return z}},A0=[],A2=0,k2=!1;function y0(z,J,$,j){let Q=k0(J,R1),Z=A0[A0.length-1];if(z==="navigate"&&Z?.kind==="click"){let W=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${W}`))return Z.at=new Date().toISOString(),Z;let G=W.split(/[?#]/)[0]??W,U=Z.source?k1(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(U&&(G===U||G.startsWith(U)))return Z.detail=k0(`${Z.detail} → ${W}`,R1),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===z&&Z.detail===Q){if(Z.at=new Date().toISOString(),z!=="navigate")Z.count=(Z.count??1)+1;return Z}A2+=1;let V={id:`act_${A2}`,at:new Date().toISOString(),kind:z,detail:Q,count:1,source:$,html:z1(j)};A0.push(V);while(A0.length>V0("maxActions"))T6(A0.shift());return V}var k6=200000,v0=0;function z1(z){if(!z)return;if(v0+z.length>k6)return;return v0+=z.length,z}function T6(z){if(!z)return;if(v0-=(z.html?.length??0)+(z.afterHtml?.length??0),v0<0)v0=0}function T1(z){return z&&z>1?` (×${z})`:""}function e0(z){return z instanceof Element&&Boolean(z.closest("[data-debug-reporter]"))}var E6='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',f6={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},T2={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function w6(z){let J=z.getAttribute("role");if(J&&T2[J])return T2[J];return f6[z.tagName.toLowerCase()]??"ปุ่ม"}function x6(z,J){try{let $=z,j=0;while($&&j<=J){let Q=g2($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function b6(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("title")?.trim();if($)return $;if(z instanceof HTMLInputElement||z instanceof HTMLTextAreaElement||z instanceof HTMLSelectElement)return(z.getAttribute("placeholder")||z.getAttribute("name")||"").trim();if(z instanceof HTMLImageElement)return(z.getAttribute("alt")||"").trim();let j=(z.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(z instanceof HTMLAnchorElement){let Q=z.getAttribute("href");if(Q?.startsWith("/"))return k1(Q)}return""}function g6(z){if(!(z instanceof Element))return null;let J=z.closest(E6)??x6(z,4);if(!J)return null;let $=J.tagName.toLowerCase();if($==="html"||$==="body")return null;return J}function h6(z){let J=S0(b6(z));if(!J)return null;return`${w6(z)} “${k0(J,A1)}”`}var b2=6000,y6=4000,v6=/(?:^|\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 m6(z){z.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let J=[z,...Array.from(z.querySelectorAll("*"))];for(let Q of J){for(let V of Array.from(Q.attributes)){let W=V.name.toLowerCase();if(W.startsWith("on")||W==="srcdoc"||W==="value"||W.startsWith("data-"))Q.removeAttribute(V.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let V=Z.replace(v6," ").replace(/\s+/g," ").trim();if(V)Q.setAttribute("class",V);else Q.removeAttribute("class")}}let $=document.createTreeWalker(z,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=S0(j.nodeValue);j=$.nextNode()}}function E1(z,J,$){try{let j=z.outerHTML;if(!j||j.length>J)return;let Q=z.cloneNode(!0);m6(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var u6=(z)=>E1(z,b2,y6),p6=150000,d6=40000,E2=(z)=>E1(z,p6,d6);function i6(z){if(!(z instanceof HTMLInputElement)&&!(z instanceof HTMLTextAreaElement)&&!(z instanceof HTMLSelectElement))return null;let J=z.name||z.id||z.getAttribute("aria-label")||z.getAttribute("placeholder")||z.tagName.toLowerCase();return`ช่อง “${S0(J)}”`}var f2=80;function g2(z){let J=Object.keys(z).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return J?z[J]:null}function c6(z){if(typeof z!=="function")return null;try{let J=Function.prototype.toString.call(z);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function w2(z){if(!z)return;return`→ ${z.length>f2?`${z.slice(0,f2)}…`:z}`}function l6(z){try{let J=z.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return w2(J);let $=g2(z),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return w2(c6($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var o6='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function r6(){let z=L2();return z.length?z.join(", "):o6}function n6(z){let J=z.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function s6(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((V)=>document.getElementById(V)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=z.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(z.textContent??"").replace(/\s+/g," ").trim()}function h2(z){let J=S0(s6(z)),$=n6(z);return J?`เปิด ${$} “${k0(J,A1)}”`:`เปิด ${$}`}var a6='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',t6=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function e6(z){if(z.querySelector(a6))return!0;return t6.test(z.textContent??"")}var z8=400,J8=250,$8=8000;function j8(z,J){if(typeof MutationObserver>"u"){J.html=z1(E2(z));return}let $=Date.now(),j=!1,Q=()=>{j=!0,V.disconnect(),window.clearInterval(W),window.clearTimeout(G)},Z=()=>{if(j)return;if(Q(),!z.isConnected)return;J.detail=k0(h2(z),R1),J.html=z1(E2(z))},V=new MutationObserver(()=>{$=Date.now()});V.observe(z,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let W=window.setInterval(()=>{if(j)return;if(!z.isConnected){Q();return}if(Date.now()-$>=z8&&!e6(z))Z()},J8),G=window.setTimeout(Z,$8)}function Q8(z){if(e0(z))return;let J=y0("ui",h2(z));if(J)j8(z,J)}function Z8(){if(typeof MutationObserver>"u")return;let z=new WeakSet;new MutationObserver(($)=>{for(let j of $)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=r6(),V=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let W of V){if(z.has(W))continue;z.add(W),Q8(W)}}}).observe(document.body,{childList:!0,subtree:!0})}var X8=1600,V8=2500;function x2(z){return{disabled:z.hasAttribute("disabled")||z.getAttribute("aria-disabled")==="true",busy:z.getAttribute("aria-busy")==="true",text:k0((z.textContent??"").replace(/\s+/g," ").trim(),A1)}}function W8(z,J){if(!z.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!z.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(z.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function Y8(z,J){if(typeof MutationObserver>"u")return;let $=x2(z),j=!1,Q=(W,G)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(V),J.afterNote=W,G)J.afterHtml=z1(E1(z,b2,V8))},Z=new MutationObserver(()=>{if(!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let W=W8($,x2(z));if(W)Q(W,!0)});Z.observe(z,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let V=window.setTimeout(()=>{if(!j&&!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},X8)}function y2(){if(k2||typeof window>"u")return;k2=!0,document.addEventListener("click",(j)=>{if(e0(j.target))return;let Q=g6(j.target);if(!Q)return;let Z=h6(Q);if(!Z)return;let V=y0("click",`คลิก ${Z}`,l6(Q),u6(Q));if(V)Y8(Q,V)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(e0(j.target))return;let Q=i6(j.target);if(Q)y0("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(e0(j.target))return;y0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let z=()=>y0("navigate",`ไปที่ ${k1(z0(location.pathname+location.search))}`),J=history.pushState.bind(history),$=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=J(...j);return z(),Q},history.replaceState=(...j)=>{let Q=$(...j);return z(),Q},window.addEventListener("popstate",z),Z8()}function f1(){return A0.map((z)=>({...z}))}var v2=2000,J1=[],m2=0,u2=!1;function w1(z,J){m2+=1,J1.push({id:`log_${m2}`,at:new Date().toISOString(),level:z,message:J.length>v2?`${J.slice(0,v2)}…`:J});while(J1.length>V0("maxConsoleEntries"))J1.shift()}function K8(){let z=new WeakSet;return(J,$)=>{if(typeof $==="object"&&$!==null){if(z.has($))return"[Circular]";z.add($)}if(typeof $==="bigint")return $.toString();return $}}function p2(z){if(typeof z==="string")return z;if(z instanceof Error)return`${z.name}: ${z.message}`;try{let J=JSON.stringify(z,K8());if(J!==void 0)return J}catch{}try{return String(z)}catch{}try{return Object.prototype.toString.call(z)}catch{return`[${typeof z}]`}}function d2(){if(u2||typeof window>"u")return;u2=!0;let z=["log","info","warn","error","debug"];for(let J of z){let $=console[J].bind(console);console[J]=(...j)=>{w1(J,j.map(p2).join(" ")),$(...j)}}window.addEventListener("error",(J)=>{let $=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";w1("exception",`${J.message}${$}`)}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:p2(J.reason);w1("unhandledrejection",$)})}function x1(){return J1.map((z)=>({...z}))}var i2=new Set,c2=new Set;function l2(z,J){return z.add(J),()=>z.delete(J)}function o2(z,J){for(let $ of[...z])$(J)}function b1(z){return l2(i2,z)}function g1(z={type:"manual"}){o2(i2,z)}function h1(z){return l2(c2,z)}function y1(z){o2(c2,z)}var G8=15000,H8=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],r2=!1,n2=0;function U8(z){return H8.some((J)=>z.includes(J))}function s2(z){let J=z.message??"";if(!J||U8(J))return;let $=Date.now();if($-n2<G8)return;n2=$,y1({...z,message:J})}function a2(){if(r2||typeof window>"u")return;r2=!0,window.addEventListener("error",(z)=>{if(!z.message&&!z.error)return;let J=z.error instanceof Error?z.error:null;s2({type:"runtime-error",message:z.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",(z)=>{let J=z.reason;s2({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var J4=4000,F8=1e6,P8=1e7,$1=[],t2=0,e2=!1;function $4(z){$1.push(z);while($1.length>V0("maxRequests"))$1.shift()}function j4(){return t2+=1,`req_${t2}`}function z4(z){let J={};if(!z)return J;if(z instanceof Headers)z.forEach(($,j)=>{J[j]=$});else if(Array.isArray(z))for(let[$,j]of z)J[$]=j;else Object.assign(J,z);return J}function D8(z){let J={};return z.forEach(($,j)=>{J[j]=$}),J}function B8(z){if(z==null)return null;if(typeof z==="string")return z;if(z instanceof URLSearchParams)return z.toString();if(typeof FormData<"u"&&z instanceof FormData)return`[FormData: ${Array.from(z.keys()).join(", ")}]`;if(typeof Blob<"u"&&z instanceof Blob)return`[Blob ${z.size} bytes]`;if(z instanceof ArrayBuffer)return`[ArrayBuffer ${z.byteLength} bytes]`;return"[binary]"}function q8(z,J){let $="",j="GET",Q={},Z=null;if(typeof z==="string")$=z;else if(z instanceof URL)$=z.toString();else $=z.url,j=z.method||j,Q=z4(z.headers);if(J){if(J.method)j=J.method;if(J.headers)Q={...Q,...z4(J.headers)};if(J.body!==void 0)Z=B8(J.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function Q4(z){return!R2(z)}function M8(z,J){if(Q4(J.url)){J.responseSnippet="[body not captured for this origin]";return}let $=z.headers.get("content-type")??"",j=Number(z.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test($)){J.responseSnippet=`[binary ${$||"unknown"}${Q}]`;return}if(j>F8){J.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{z.clone().text().then((Z)=>{J.responseSnippet=R0(Z,V0("maxBodyChars"))}).catch(()=>{})}catch{}}function Z4(z,J){if(/[?&]_rsc=/.test(z))return!0;for(let $ of Object.keys(J)){let j=$.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function N8(){if(typeof window>"u"||typeof window.fetch!=="function")return;let z=window.fetch.bind(window);window.fetch=Object.assign(async(J,$)=>{let j=q8(J,$);if(Z4(j.url,j.headers))return z(J,$);let Q={id:j4(),startedAt:new Date().toISOString(),method:j.method,url:z0(j.url),requestHeaders:L0(j.headers),requestBody:R0(j.body,J4),status:null,statusText:null,durationMs:null,via:"fetch"};$4(Q);let Z=performance.now();try{let V=await z(J,$);return Q.status=V.status,Q.statusText=V.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=L0(D8(V.headers)),M8(V,Q),V}catch(V){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=V instanceof Error?`${V.name}: ${V.message}`:String(V),V}},z)}function I8(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let z=XMLHttpRequest.prototype,J=z.open,$=z.send,j=function(Z,V){let W=typeof V==="string"?V:V.toString();return this.__lwEntry=Z4(W,{})?void 0:{id:j4(),startedAt:"",method:(Z||"GET").toUpperCase(),url:z0(W),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},Q=function(Z){let V=this.__lwEntry;if(V){V.startedAt=new Date().toISOString(),V.requestBody=typeof Z==="string"?R0(Z,J4):Z==null?null:"[non-string body]";let W=performance.now();$4(V),this.addEventListener("loadend",()=>{if(V.status=this.status||null,V.statusText=this.statusText||null,V.durationMs=Math.round(performance.now()-W),Q4(V.url))V.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{V.responseSnippet=R0(this.responseText||"",V0("maxBodyChars"))}catch{}else{let G=this.getResponseHeader("content-type")??this.responseType;V.responseSnippet=`[binary ${G}]`}})}return $.apply(this,arguments)};z.open=j,z.send=Q}function X4(){if(e2)return;e2=!0,N8(),I8()}function v1(){let z=$1.map(($)=>({...$})),J=0;for(let $=z.length-1;$>=0;$-=1){let j=z[$],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(J+Q.length>P8)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else J+=Q.length}return z}var C8=4,V4=3,O8=4000,_8="[data-debug-reporter]",S8=()=>import("@rrweb/record");var d=[],T0=null,j1=!1;function W4(){if(typeof window>"u"||T0||j1)return;let z=h0();if(!z)return;j1=!0;let J=()=>void L8(z);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function L8(z){let J;try{J=(await S8()).record}catch($){j1=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(T0)return;try{T0=J({emit:($)=>R8($),checkoutEveryNms:Math.max(1000,z.seconds*1000/2),checkoutEveryNth:O8,maskAllInputs:z.maskInputs,maskTextSelector:z.maskText?"*":z.maskTextSelector,blockSelector:`${z.blockSelector}, ${_8}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...z.canvas?{canvas:z.canvas.fps}:{}},recordCanvas:z.canvas!==null,...z.canvas?{dataURLOptions:{type:"image/webp",quality:z.canvas.quality}}:{},errorHandler:()=>!0})??null}catch($){console.warn("[debug-capture] session replay could not start:",$)}finally{j1=!1}}function R8(z){if(z.type===C8||d.length===0){if(d.push([]),d.length>V4)d=d.slice(-V4)}d[d.length-1].push(z)}function m1(z=Date.now()){let J=h0();if(!J||!d.length)return null;let $=z-J.seconds*1000,j=d.length-1;while(j>0&&(d[j][0]?.timestamp??z)>$)j-=1;let Q=d.slice(j).flat(),Z=Q[0]?.timestamp,V=Q[Q.length-1]?.timestamp;if(Z===void 0||V===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(V).toISOString(),durationMs:Math.max(0,V-Z)}}function A8(){return T0!==null}function k8(){T0?.(),T0=null,d=[]}var T8={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindRequest:"คำขอ",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",problemInsteadShare:"แจ้งปัญหาแทน (แนบภาพหน้าจอ)",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTypeSearch:"ค้นหาเรื่องที่ขอ",requestTypeNone:"ไม่พบเรื่องที่ขอ — ลองคำอื่น",requestTypeCount:"{n} เรื่อง — เลื่อนดูหรือพิมพ์ค้นหา",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง",ringTitle:"ทีมงานกำลังโทรหาคุณ",ringAbout:"เรื่อง {key} · {title}",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า"},E8={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",failedOffline:"Could not send — the server could not be reached. What you wrote is still here; check your connection and try again.",failedUnavailable:"Could not send — the system is being updated. What you wrote is still here; try again in a moment.",failedTooMany:"Too many reports — try again in {seconds} seconds.",captured:"Captured",reporter:"Reporter",page:"Page",replay:"activity log",handoffTitle:"Opening the support portal",handoffBody:"You will be signed in automatically to see what you reported",handoffGo:"Go now",handoffPreparing:"Preparing…",handoffFailed:"Could not open your reports",handoffBlocked:"Your browser blocked the new tab",handoffOpen:"Open in a new tab",chooseTitle:"How can the team help?",kindProblem:"Report a problem",kindRequest:"Request",askInstead:"Asking for something?",askInsteadAction:"Choose what you need",problemInstead:"Something broken?",problemInsteadAction:"Report a problem instead",problemInsteadShare:"Report a problem instead (with a screenshot)",chooseProblemHint:"Something is broken or not working — with a screenshot",chooseRequestHint:"Ask the team to do something, like access or a data change — no screen sharing",requestTitle:"Ask the team",requestTypeLabel:"What you need",requestTypeSearch:"Search what you need",requestTypeNone:"Nothing matches — try another word",requestTypeCount:"{n} to choose from — scroll or search",requestTarget:"The team aims to finish within {time}",requestSummaryLabel:"Subject",requestSummaryPlaceholder:"What do you need — briefly",requestDetailLabel:"Details (optional)",requestDetailPlaceholder:"What the team needs to know to do it",requestSubmit:"Send request",requestSubmitted:"Request sent",requestWithShot:"Attach this screenshot to the request",requestAnnotateHint:"Mark what you are asking about — box it, point at it, highlight it, or type on it",draftRestored:"What you typed last time, not sent yet",draftClear:"Clear",requestLeaves:"Not sent with a request",requestLeavesWhat:"this page's activity log — it is for problem reports only",days:"{n} days",hours:"{n} hours",ringTitle:"The support team is calling you",ringAbout:"About {key} · {title}",ringHow:"Answer on your request's page — it opens in a new tab, already signed in",ringOpen:"Open to answer",ringDecline:"Decline",ringOpened:"Opened — press Answer in the new tab",ringBlocked:"Your browser blocked the new tab — open the call here",ringClose:"Close",ringTab:"\uD83D\uDCDE Incoming call"};function J0(z){return z==="en"?E8:T8}var f8="lw-debug-toasts",w8=6000,x8=`
1
+ var q6=((z)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(z,{get:(J,$)=>(typeof require<"u"?require:J)[$]}):z)(function(z){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+z+'" is not supported')});var M6={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},d=null;function N6(z){let J=[];if(!z.host?.trim())J.push("host");if(!z.realmKey?.trim())J.push("realmKey");if(!z.app?.name?.trim())J.push("app.name");if(typeof z.module!=="function")J.push("module");if(J.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${J.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");d=z}function O(){if(!d)throw Error("[debug-capture] configureDebugCapture() has not been called");return d}function g0(){return d!==null}function e(){let z=O().app;return{name:z.name,version:z.version??"0.0.0",environment:z.environment??I6()}}function I6(){if(typeof window>"u")return"unknown";let z=window.location.hostname;if(z==="localhost"||z==="127.0.0.1"||z.endsWith(".local"))return"development";return"production"}function W0(z){let J=d?.capture?.[z];return typeof J==="number"?J:M6[z]}function t0(z){let J=d?.module;if(!J)return null;try{return J(z)??null}catch{return null}}function e0(){let z=d?.redact;return{headers:z?.headers??[],queryKeys:(z?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:(z?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function k2(){return d?.capture?.overlaySelectors??[]}var C6='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',O6="[data-lw-mask]",A2={fps:1,quality:0.5};function h0(){let z=d?.replay;if(!z)return null;let J=z===!0?{}:z,$=(Z,V)=>typeof Z==="number"&&Z>0?Z:V,j=J.maskInputs!==!1,Q=J.recordCanvas?{fps:$(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,A2.fps),quality:$(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,A2.quality)}:null;return{seconds:$(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?C6:O6),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(J.maxBytes,4000000),canvas:Q}}function T2(z){if(typeof window>"u")return!1;let J;try{J=new URL(z,window.location.href)}catch{return!1}if(_6(J))return!1;if(J.origin===window.location.origin)return!0;return(d?.capture?.bodyOrigins??[]).some(($)=>{try{return new URL($).origin===J.origin}catch{return!1}})}function _6(z){if(!d?.host)return!1;try{if(new URL(d.host).origin!==z.origin)return!1}catch{return!1}return z.pathname.startsWith("/ingest/")}function S6(z){let J=Object.entries(z).map(([$,j])=>[$.replace(/\/+$/,"")||"/",j]).sort(($,j)=>j[0].length-$[0].length);return($)=>{let j=($||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of J)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var _0="‹redacted›",L6=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,R6=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),A6=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,k6=/[\w.+-]+@[\w-]+\.[\w.-]+/g,T6=/\d(?:[\d\s-]{7,})\d/g;function S0(z){return z.replace(k6,_0).replace(T6,_0)}function E6(z){if(L6.test(z))return!0;return e0().headers.some(($)=>$.toLowerCase()===z.toLowerCase())}function L0(z){let J={};for(let[$,j]of Object.entries(z))J[$]=E6($)?_0:j;return J}function J0(z){try{let J=/^https?:\/\//i.test(z),$=new URL(z,J?void 0:"http://local.invalid"),j=!1;if($.searchParams.forEach((Q,Z)=>{if(R6.has(Z.toLowerCase())||e0().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,_0),j=!0}),!j)return z;return J?$.toString():`${$.pathname}${$.search}`}catch{return z}}function A1(z,J){if(J>6||z===null||typeof z!=="object")return z;if(Array.isArray(z))return z.map((j)=>A1(j,J+1));let $={};for(let[j,Q]of Object.entries(z)){let Z=A6.test(j)||e0().bodyKeys.some((V)=>j.toLowerCase().includes(V));$[j]=Z?_0:A1(Q,J+1)}return $}function R0(z,J){if(z==null)return null;let $=z,j=z.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);$=JSON.stringify(A1(Q,0))}catch{}if($.length>J)return`${$.slice(0,J)}… [truncated ${$.length-J} chars]`;return $}var k1=120,T1=40,k0=(z,J)=>z.length>J?`${z.slice(0,J)}…`:z,E1=(z)=>{try{return decodeURIComponent(z)}catch{return z}},A0=[],E2=0,f2=!1;function y0(z,J,$,j){let Q=k0(J,k1),Z=A0[A0.length-1];if(z==="navigate"&&Z?.kind==="click"){let W=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${W}`))return Z.at=new Date().toISOString(),Z;let G=W.split(/[?#]/)[0]??W,U=Z.source?E1(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(U&&(G===U||G.startsWith(U)))return Z.detail=k0(`${Z.detail} → ${W}`,k1),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===z&&Z.detail===Q){if(Z.at=new Date().toISOString(),z!=="navigate")Z.count=(Z.count??1)+1;return Z}E2+=1;let V={id:`act_${E2}`,at:new Date().toISOString(),kind:z,detail:Q,count:1,source:$,html:J1(j)};A0.push(V);while(A0.length>W0("maxActions"))x6(A0.shift());return V}var f6=200000,v0=0;function J1(z){if(!z)return;if(v0+z.length>f6)return;return v0+=z.length,z}function x6(z){if(!z)return;if(v0-=(z.html?.length??0)+(z.afterHtml?.length??0),v0<0)v0=0}function f1(z){return z&&z>1?` (×${z})`:""}function z1(z){return z instanceof Element&&Boolean(z.closest("[data-debug-reporter]"))}var w6='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',b6={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},x2={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function g6(z){let J=z.getAttribute("role");if(J&&x2[J])return x2[J];return b6[z.tagName.toLowerCase()]??"ปุ่ม"}function h6(z,J){try{let $=z,j=0;while($&&j<=J){let Q=v2($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function y6(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("title")?.trim();if($)return $;if(z instanceof HTMLInputElement||z instanceof HTMLTextAreaElement||z instanceof HTMLSelectElement)return(z.getAttribute("placeholder")||z.getAttribute("name")||"").trim();if(z instanceof HTMLImageElement)return(z.getAttribute("alt")||"").trim();let j=(z.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(z instanceof HTMLAnchorElement){let Q=z.getAttribute("href");if(Q?.startsWith("/"))return E1(Q)}return""}function v6(z){if(!(z instanceof Element))return null;let J=z.closest(w6)??h6(z,4);if(!J)return null;let $=J.tagName.toLowerCase();if($==="html"||$==="body")return null;return J}function m6(z){let J=S0(y6(z));if(!J)return null;return`${g6(z)} “${k0(J,T1)}”`}var y2=6000,u6=4000,p6=/(?:^|\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 d6(z){z.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let J=[z,...Array.from(z.querySelectorAll("*"))];for(let Q of J){for(let V of Array.from(Q.attributes)){let W=V.name.toLowerCase();if(W.startsWith("on")||W==="srcdoc"||W==="value"||W.startsWith("data-"))Q.removeAttribute(V.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let V=Z.replace(p6," ").replace(/\s+/g," ").trim();if(V)Q.setAttribute("class",V);else Q.removeAttribute("class")}}let $=document.createTreeWalker(z,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=S0(j.nodeValue);j=$.nextNode()}}function x1(z,J,$){try{let j=z.outerHTML;if(!j||j.length>J)return;let Q=z.cloneNode(!0);d6(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var i6=(z)=>x1(z,y2,u6),c6=150000,l6=40000,w2=(z)=>x1(z,c6,l6);function o6(z){if(!(z instanceof HTMLInputElement)&&!(z instanceof HTMLTextAreaElement)&&!(z instanceof HTMLSelectElement))return null;let J=z.name||z.id||z.getAttribute("aria-label")||z.getAttribute("placeholder")||z.tagName.toLowerCase();return`ช่อง “${S0(J)}”`}var b2=80;function v2(z){let J=Object.keys(z).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return J?z[J]:null}function r6(z){if(typeof z!=="function")return null;try{let J=Function.prototype.toString.call(z);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function g2(z){if(!z)return;return`→ ${z.length>b2?`${z.slice(0,b2)}…`:z}`}function n6(z){try{let J=z.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return g2(J);let $=v2(z),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return g2(r6($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var s6='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function a6(){let z=k2();return z.length?z.join(", "):s6}function t6(z){let J=z.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function e6(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((V)=>document.getElementById(V)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=z.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(z.textContent??"").replace(/\s+/g," ").trim()}function m2(z){let J=S0(e6(z)),$=t6(z);return J?`เปิด ${$} “${k0(J,T1)}”`:`เปิด ${$}`}var z8='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',J8=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function $8(z){if(z.querySelector(z8))return!0;return J8.test(z.textContent??"")}var j8=400,Q8=250,Z8=8000;function X8(z,J){if(typeof MutationObserver>"u"){J.html=J1(w2(z));return}let $=Date.now(),j=!1,Q=()=>{j=!0,V.disconnect(),window.clearInterval(W),window.clearTimeout(G)},Z=()=>{if(j)return;if(Q(),!z.isConnected)return;J.detail=k0(m2(z),k1),J.html=J1(w2(z))},V=new MutationObserver(()=>{$=Date.now()});V.observe(z,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let W=window.setInterval(()=>{if(j)return;if(!z.isConnected){Q();return}if(Date.now()-$>=j8&&!$8(z))Z()},Q8),G=window.setTimeout(Z,Z8)}function V8(z){if(z1(z))return;let J=y0("ui",m2(z));if(J)X8(z,J)}function W8(){if(typeof MutationObserver>"u")return;let z=new WeakSet;new MutationObserver(($)=>{for(let j of $)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=a6(),V=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let W of V){if(z.has(W))continue;z.add(W),V8(W)}}}).observe(document.body,{childList:!0,subtree:!0})}var Y8=1600,K8=2500;function h2(z){return{disabled:z.hasAttribute("disabled")||z.getAttribute("aria-disabled")==="true",busy:z.getAttribute("aria-busy")==="true",text:k0((z.textContent??"").replace(/\s+/g," ").trim(),T1)}}function G8(z,J){if(!z.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!z.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(z.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function H8(z,J){if(typeof MutationObserver>"u")return;let $=h2(z),j=!1,Q=(W,G)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(V),J.afterNote=W,G)J.afterHtml=J1(x1(z,y2,K8))},Z=new MutationObserver(()=>{if(!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let W=G8($,h2(z));if(W)Q(W,!0)});Z.observe(z,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let V=window.setTimeout(()=>{if(!j&&!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},Y8)}function u2(){if(f2||typeof window>"u")return;f2=!0,document.addEventListener("click",(j)=>{if(z1(j.target))return;let Q=v6(j.target);if(!Q)return;let Z=m6(Q);if(!Z)return;let V=y0("click",`คลิก ${Z}`,n6(Q),i6(Q));if(V)H8(Q,V)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(z1(j.target))return;let Q=o6(j.target);if(Q)y0("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(z1(j.target))return;y0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let z=()=>y0("navigate",`ไปที่ ${E1(J0(location.pathname+location.search))}`),J=history.pushState.bind(history),$=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=J(...j);return z(),Q},history.replaceState=(...j)=>{let Q=$(...j);return z(),Q},window.addEventListener("popstate",z),W8()}function w1(){return A0.map((z)=>({...z}))}var p2=2000,$1=[],d2=0,i2=!1;function b1(z,J){d2+=1,$1.push({id:`log_${d2}`,at:new Date().toISOString(),level:z,message:J.length>p2?`${J.slice(0,p2)}…`:J});while($1.length>W0("maxConsoleEntries"))$1.shift()}function U8(){let z=new WeakSet;return(J,$)=>{if(typeof $==="object"&&$!==null){if(z.has($))return"[Circular]";z.add($)}if(typeof $==="bigint")return $.toString();return $}}function c2(z){if(typeof z==="string")return z;if(z instanceof Error)return`${z.name}: ${z.message}`;try{let J=JSON.stringify(z,U8());if(J!==void 0)return J}catch{}try{return String(z)}catch{}try{return Object.prototype.toString.call(z)}catch{return`[${typeof z}]`}}function l2(){if(i2||typeof window>"u")return;i2=!0;let z=["log","info","warn","error","debug"];for(let J of z){let $=console[J].bind(console);console[J]=(...j)=>{b1(J,j.map(c2).join(" ")),$(...j)}}window.addEventListener("error",(J)=>{let $=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";b1("exception",`${J.message}${$}`)}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:c2(J.reason);b1("unhandledrejection",$)})}function g1(){return $1.map((z)=>({...z}))}var o2=new Set,r2=new Set;function n2(z,J){return z.add(J),()=>z.delete(J)}function s2(z,J){for(let $ of[...z])$(J)}function h1(z){return n2(o2,z)}function y1(z={type:"manual"}){s2(o2,z)}function v1(z){return n2(r2,z)}function m1(z){s2(r2,z)}var F8=15000,P8=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],a2=!1,t2=0;function D8(z){return P8.some((J)=>z.includes(J))}function e2(z){let J=z.message??"";if(!J||D8(J))return;let $=Date.now();if($-t2<F8)return;t2=$,m1({...z,message:J})}function z4(){if(a2||typeof window>"u")return;a2=!0,window.addEventListener("error",(z)=>{if(!z.message&&!z.error)return;let J=z.error instanceof Error?z.error:null;e2({type:"runtime-error",message:z.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",(z)=>{let J=z.reason;e2({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var Q4=4000,B8=1e6,q8=1e7,j1=[],J4=0,$4=!1;function Z4(z){j1.push(z);while(j1.length>W0("maxRequests"))j1.shift()}function X4(){return J4+=1,`req_${J4}`}function j4(z){let J={};if(!z)return J;if(z instanceof Headers)z.forEach(($,j)=>{J[j]=$});else if(Array.isArray(z))for(let[$,j]of z)J[$]=j;else Object.assign(J,z);return J}function M8(z){let J={};return z.forEach(($,j)=>{J[j]=$}),J}function N8(z){if(z==null)return null;if(typeof z==="string")return z;if(z instanceof URLSearchParams)return z.toString();if(typeof FormData<"u"&&z instanceof FormData)return`[FormData: ${Array.from(z.keys()).join(", ")}]`;if(typeof Blob<"u"&&z instanceof Blob)return`[Blob ${z.size} bytes]`;if(z instanceof ArrayBuffer)return`[ArrayBuffer ${z.byteLength} bytes]`;return"[binary]"}function I8(z,J){let $="",j="GET",Q={},Z=null;if(typeof z==="string")$=z;else if(z instanceof URL)$=z.toString();else $=z.url,j=z.method||j,Q=j4(z.headers);if(J){if(J.method)j=J.method;if(J.headers)Q={...Q,...j4(J.headers)};if(J.body!==void 0)Z=N8(J.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function V4(z){return!T2(z)}function C8(z,J){if(V4(J.url)){J.responseSnippet="[body not captured for this origin]";return}let $=z.headers.get("content-type")??"",j=Number(z.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test($)){J.responseSnippet=`[binary ${$||"unknown"}${Q}]`;return}if(j>B8){J.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{z.clone().text().then((Z)=>{J.responseSnippet=R0(Z,W0("maxBodyChars"))}).catch(()=>{})}catch{}}function W4(z,J){if(/[?&]_rsc=/.test(z))return!0;for(let $ of Object.keys(J)){let j=$.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function O8(){if(typeof window>"u"||typeof window.fetch!=="function")return;let z=window.fetch.bind(window);window.fetch=Object.assign(async(J,$)=>{let j=I8(J,$);if(W4(j.url,j.headers))return z(J,$);let Q={id:X4(),startedAt:new Date().toISOString(),method:j.method,url:J0(j.url),requestHeaders:L0(j.headers),requestBody:R0(j.body,Q4),status:null,statusText:null,durationMs:null,via:"fetch"};Z4(Q);let Z=performance.now();try{let V=await z(J,$);return Q.status=V.status,Q.statusText=V.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=L0(M8(V.headers)),C8(V,Q),V}catch(V){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=V instanceof Error?`${V.name}: ${V.message}`:String(V),V}},z)}function _8(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let z=XMLHttpRequest.prototype,J=z.open,$=z.send,j=function(Z,V){let W=typeof V==="string"?V:V.toString();return this.__lwEntry=W4(W,{})?void 0:{id:X4(),startedAt:"",method:(Z||"GET").toUpperCase(),url:J0(W),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},Q=function(Z){let V=this.__lwEntry;if(V){V.startedAt=new Date().toISOString(),V.requestBody=typeof Z==="string"?R0(Z,Q4):Z==null?null:"[non-string body]";let W=performance.now();Z4(V),this.addEventListener("loadend",()=>{if(V.status=this.status||null,V.statusText=this.statusText||null,V.durationMs=Math.round(performance.now()-W),V4(V.url))V.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{V.responseSnippet=R0(this.responseText||"",W0("maxBodyChars"))}catch{}else{let G=this.getResponseHeader("content-type")??this.responseType;V.responseSnippet=`[binary ${G}]`}})}return $.apply(this,arguments)};z.open=j,z.send=Q}function Y4(){if($4)return;$4=!0,O8(),_8()}function u1(){let z=j1.map(($)=>({...$})),J=0;for(let $=z.length-1;$>=0;$-=1){let j=z[$],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(J+Q.length>q8)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else J+=Q.length}return z}var S8=4,K4=3,L8=4000,R8="[data-debug-reporter]",A8=()=>import("@rrweb/record");var i=[],T0=null,Q1=!1;function G4(){if(typeof window>"u"||T0||Q1)return;let z=h0();if(!z)return;Q1=!0;let J=()=>void k8(z);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function k8(z){let J;try{J=(await A8()).record}catch($){Q1=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(T0)return;try{T0=J({emit:($)=>T8($),checkoutEveryNms:Math.max(1000,z.seconds*1000/2),checkoutEveryNth:L8,maskAllInputs:z.maskInputs,maskTextSelector:z.maskText?"*":z.maskTextSelector,blockSelector:`${z.blockSelector}, ${R8}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...z.canvas?{canvas:z.canvas.fps}:{}},recordCanvas:z.canvas!==null,...z.canvas?{dataURLOptions:{type:"image/webp",quality:z.canvas.quality}}:{},errorHandler:()=>!0})??null}catch($){console.warn("[debug-capture] session replay could not start:",$)}finally{Q1=!1}}function T8(z){if(z.type===S8||i.length===0){if(i.push([]),i.length>K4)i=i.slice(-K4)}i[i.length-1].push(z)}function p1(z=Date.now()){let J=h0();if(!J||!i.length)return null;let $=z-J.seconds*1000,j=i.length-1;while(j>0&&(i[j][0]?.timestamp??z)>$)j-=1;let Q=i.slice(j).flat(),Z=Q[0]?.timestamp,V=Q[Q.length-1]?.timestamp;if(Z===void 0||V===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(V).toISOString(),durationMs:Math.max(0,V-Z)}}function E8(){return T0!==null}function f8(){T0?.(),T0=null,i=[]}var x8={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindRequest:"คำขอ",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",problemInsteadShare:"แจ้งปัญหาแทน (แนบภาพหน้าจอ)",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTypeSearch:"ค้นหาเรื่องที่ขอ",requestTypeNone:"ไม่พบเรื่องที่ขอ — ลองคำอื่น",requestTypeCount:"{n} เรื่อง — เลื่อนดูหรือพิมพ์ค้นหา",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง",ringTitle:"ทีมงานกำลังโทรหาคุณ",ringAbout:"เรื่อง {key} · {title}",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า"},w8={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",failedOffline:"Could not send — the server could not be reached. What you wrote is still here; check your connection and try again.",failedUnavailable:"Could not send — the system is being updated. What you wrote is still here; try again in a moment.",failedTooMany:"Too many reports — try again in {seconds} seconds.",captured:"Captured",reporter:"Reporter",page:"Page",replay:"activity log",handoffTitle:"Opening the support portal",handoffBody:"You will be signed in automatically to see what you reported",handoffGo:"Go now",handoffPreparing:"Preparing…",handoffFailed:"Could not open your reports",handoffBlocked:"Your browser blocked the new tab",handoffOpen:"Open in a new tab",chooseTitle:"How can the team help?",kindProblem:"Report a problem",kindRequest:"Request",askInstead:"Asking for something?",askInsteadAction:"Choose what you need",problemInstead:"Something broken?",problemInsteadAction:"Report a problem instead",problemInsteadShare:"Report a problem instead (with a screenshot)",chooseProblemHint:"Something is broken or not working — with a screenshot",chooseRequestHint:"Ask the team to do something, like access or a data change — no screen sharing",requestTitle:"Ask the team",requestTypeLabel:"What you need",requestTypeSearch:"Search what you need",requestTypeNone:"Nothing matches — try another word",requestTypeCount:"{n} to choose from — scroll or search",requestTarget:"The team aims to finish within {time}",requestSummaryLabel:"Subject",requestSummaryPlaceholder:"What do you need — briefly",requestDetailLabel:"Details (optional)",requestDetailPlaceholder:"What the team needs to know to do it",requestSubmit:"Send request",requestSubmitted:"Request sent",requestWithShot:"Attach this screenshot to the request",requestAnnotateHint:"Mark what you are asking about — box it, point at it, highlight it, or type on it",draftRestored:"What you typed last time, not sent yet",draftClear:"Clear",requestLeaves:"Not sent with a request",requestLeavesWhat:"this page's activity log — it is for problem reports only",days:"{n} days",hours:"{n} hours",ringTitle:"The support team is calling you",ringAbout:"About {key} · {title}",ringHow:"Answer on your request's page — it opens in a new tab, already signed in",ringOpen:"Open to answer",ringDecline:"Decline",ringOpened:"Opened — press Answer in the new tab",ringBlocked:"Your browser blocked the new tab — open the call here",ringClose:"Close",ringTab:"\uD83D\uDCDE Incoming call"};function $0(z){return z==="en"?w8:x8}var b8="lw-debug-toasts",g8=6000,h8=`
2
2
  :host { all: initial; }
3
3
  .stack {
4
4
  position: fixed; top: 16px; right: 16px; z-index: 2147483001;
@@ -30,15 +30,15 @@ var P6=((z)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(z,{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
- `,u1=null;function b8(){if(typeof document>"u")return null;if(u1?.isConnected)return u1;let z=document.createElement(f8);z.dataset.debugReporter="true";let J=z.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=x8;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append($,j),document.body.append(z),u1=j,j}function P0(z,J="success",$){let j=g0()?O().toast:void 0;if(j){j({message:z,tone:J,...$?{action:$}:{}});return}let Q=b8();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=J;let V=document.createElement("span");V.className="dot";let W=document.createElement("span");W.textContent=z;let G=document.createElement("button");G.type="button",G.className="close",G.textContent="✕",G.setAttribute("aria-label","ปิด");let U=()=>{window.clearTimeout(M),Z.remove()};G.addEventListener("click",U);let M=J==="error"||$?0:window.setTimeout(U,w8);if(Z.append(V,W),$){let B=document.createElement("button");B.type="button",B.className="action",B.textContent=$.label,B.addEventListener("click",()=>{U(),$.onClick()}),Z.append(B)}Z.append(G),Q.append(Z)}function Y4(z,J,$){let j=z.filter((Z)=>Boolean(Z.error)||Z.status!=null&&Z.status>=400).slice(-20).map((Z)=>({method:Z.method,url:Z.url,status:Z.status,error:Z.error,at:Z.startedAt})),Q=J.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:$.slice(0,20)}}function K4(z){return z.failedRequests.length+z.errors.length+z.erroredQueries.length}function g8(){let z={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return z;let J=performance.memory;if(J)z.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),z.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[$]=performance.getEntriesByType("navigation");if($)z.domContentLoadedMs=Math.round($.domContentLoadedEventEnd),z.loadEventMs=Math.round($.loadEventEnd);return z}function p1(z,J){if(!z)return J;try{return z()}catch{return J}}function G4(){let z=O(),{pathname:J,search:$,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:$},module:a0(J),user:p1(z.user,{}),apiHeaders:L0(p1(z.headers,{})),app:{name:t().name,version:t().version,environment:t().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:g8(),extra:p1(z.extra,{})}}var h8=2,y8={manual:"ผู้ใช้แจ้งเอง","runtime-error":"ข้อผิดพลาด runtime (auto)",unhandledrejection:"Promise rejection (auto)","framework-error":"หน้าจอค้าง/พัง (auto)"};function m0(z){let J=v1(),$=x1();return{context:G4(),reason:z.reason,note:z.note,cause:Y4(J,$,z.erroredQueries),actionTrail:f1(),network:J,console:$,screenshotDataUrl:z.screenshotDataUrl,screenshotMethod:z.screenshotMethod,replay:m1()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:h8}}}function H4(z){return z.replace(/'/g,"'\\''")}function U4(z){let J=[`curl -X ${z.method} '${z.url}'`];for(let[$,j]of Object.entries(z.requestHeaders))J.push(` -H '${$}: ${H4(j)}'`);if(z.requestBody)J.push(` --data '${H4(z.requestBody)}'`);return J.join(" \\\n")}function v8(z){if(z.error)return`ERR ${z.error}`;return`${z.status??"—"} ${z.statusText??""}`.trim()}function m8(z){if(z.length===0)return"No network activity captured.";return z.map((J)=>{let $=J.durationMs!=null?`${J.durationMs}ms`:"—",j=`# [${v8(J)}] ${J.method} ${J.url} (${$}, ${J.startedAt})`,Q=J.responseSnippet?`
33
+ `,d1=null;function y8(){if(typeof document>"u")return null;if(d1?.isConnected)return d1;let z=document.createElement(b8);z.dataset.debugReporter="true";let J=z.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=h8;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append($,j),document.body.append(z),d1=j,j}function P0(z,J="success",$){let j=g0()?O().toast:void 0;if(j){j({message:z,tone:J,...$?{action:$}:{}});return}let Q=y8();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=J;let V=document.createElement("span");V.className="dot";let W=document.createElement("span");W.textContent=z;let G=document.createElement("button");G.type="button",G.className="close",G.textContent="✕",G.setAttribute("aria-label","ปิด");let U=()=>{window.clearTimeout(M),Z.remove()};G.addEventListener("click",U);let M=J==="error"||$?0:window.setTimeout(U,g8);if(Z.append(V,W),$){let B=document.createElement("button");B.type="button",B.className="action",B.textContent=$.label,B.addEventListener("click",()=>{U(),$.onClick()}),Z.append(B)}Z.append(G),Q.append(Z)}function H4(z,J,$){let j=z.filter((Z)=>Boolean(Z.error)||Z.status!=null&&Z.status>=400).slice(-20).map((Z)=>({method:Z.method,url:Z.url,status:Z.status,error:Z.error,at:Z.startedAt})),Q=J.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:$.slice(0,20)}}function U4(z){return z.failedRequests.length+z.errors.length+z.erroredQueries.length}function v8(){let z={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return z;let J=performance.memory;if(J)z.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),z.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[$]=performance.getEntriesByType("navigation");if($)z.domContentLoadedMs=Math.round($.domContentLoadedEventEnd),z.loadEventMs=Math.round($.loadEventEnd);return z}function i1(z,J){if(!z)return J;try{return z()}catch{return J}}function F4(){let z=O(),{pathname:J,search:$,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:$},module:t0(J),user:i1(z.user,{}),apiHeaders:L0(i1(z.headers,{})),app:{name:e().name,version:e().version,environment:e().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:v8(),extra:i1(z.extra,{})}}var m8=2,u8={manual:"ผู้ใช้แจ้งเอง","runtime-error":"ข้อผิดพลาด runtime (auto)",unhandledrejection:"Promise rejection (auto)","framework-error":"หน้าจอค้าง/พัง (auto)"};function m0(z){let J=u1(),$=g1();return{context:F4(),reason:z.reason,note:z.note,cause:H4(J,$,z.erroredQueries),actionTrail:w1(),network:J,console:$,screenshotDataUrl:z.screenshotDataUrl,screenshotMethod:z.screenshotMethod,replay:p1()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:m8}}}function P4(z){return z.replace(/'/g,"'\\''")}function D4(z){let J=[`curl -X ${z.method} '${z.url}'`];for(let[$,j]of Object.entries(z.requestHeaders))J.push(` -H '${$}: ${P4(j)}'`);if(z.requestBody)J.push(` --data '${P4(z.requestBody)}'`);return J.join(" \\\n")}function p8(z){if(z.error)return`ERR ${z.error}`;return`${z.status??"—"} ${z.statusText??""}`.trim()}function d8(z){if(z.length===0)return"No network activity captured.";return z.map((J)=>{let $=J.durationMs!=null?`${J.durationMs}ms`:"—",j=`# [${p8(J)}] ${J.method} ${J.url} (${$}, ${J.startedAt})`,Q=J.responseSnippet?`
34
34
  # response: ${J.responseSnippet}`:"";return`${j}
35
- ${U4(J)}${Q}`}).join(`
35
+ ${D4(J)}${Q}`}).join(`
36
36
 
37
- `)}function u8(z){if(z.length===0)return"No console output captured.";return z.map((J)=>`[${J.at}] ${J.level.toUpperCase()}: ${J.message}`).join(`
38
- `)}function p8(z){if(z.length===0)return"No user actions captured.";let J=0;return z.map(($)=>{let j=$.source?` (${$.source})`:"",Q=`${$.detail}${T1($.count)}${j}`;if($.kind==="ui")return` ↳ [${$.at}] ${Q}`;J+=1;let Z=`${J}. [${$.at}] ${Q}`;return $.afterNote?`${Z}
37
+ `)}function i8(z){if(z.length===0)return"No console output captured.";return z.map((J)=>`[${J.at}] ${J.level.toUpperCase()}: ${J.message}`).join(`
38
+ `)}function c8(z){if(z.length===0)return"No user actions captured.";let J=0;return z.map(($)=>{let j=$.source?` (${$.source})`:"",Q=`${$.detail}${f1($.count)}${j}`;if($.kind==="ui")return` ↳ [${$.at}] ${Q}`;J+=1;let Z=`${J}. [${$.at}] ${Q}`;return $.afterNote?`${Z}
39
39
  ↳ ${$.afterNote}`:Z}).join(`
40
- `)}function d8(z){let J=[];for(let $ of z.failedRequests)J.push(`✗ ${$.status??$.error??"ERR"} ${$.method} ${$.url}`);for(let $ of z.errors)J.push(`⚠ ${$}`);for(let $ of z.erroredQueries)J.push(`⚠ React Query error: ${$.key} — ${$.error}`);return J}function i8(z){let{context:J}=z;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 : ${y8[z.reason.type]}${z.reason.message?` — ${z.reason.message}`:""}`,`Captured : ${z.network.length} requests · ${z.console.length} console · ${z.actionTrail.length} actions · screenshot=${z.screenshotMethod}${z.replay?` · replay=${Math.round(z.replay.durationMs/1000)}s`:""}`]}function c8(z){let J=d8(z.cause),$=[`## \uD83D\uDC1E ${z.context.app.name} — Debug Report`,`**Generated:** ${z.context.capturedAt}`,"",...i8(z).map((j)=>`- ${j.replace(/\s{2,}:/,":")}`),"",`**หมายเหตุจากผู้แจ้ง:** ${z.note.trim()||"(ไม่มี)"}`];if(J.length>0)$.push("","### ⚠ สาเหตุที่น่าจะเป็น","```",...J,"```");return $.push("",`<details><summary>ขั้นตอน (${z.actionTrail.length})</summary>`,"","```",p8(z.actionTrail),"```","</details>","",`<details><summary>Network (${z.network.length})</summary>`,"","```",m8(z.network),"```","</details>","",`<details><summary>Console (${z.console.length})</summary>`,"","```",u8(z.console),"```","</details>","","_ข้อมูลลับ (token, cookie) ถูกปกปิดอัตโนมัติ · ภาพหน้าจออยู่ในไฟล์ .zip_"),$.join(`
41
- `)}function l8(z){return z.replace(/[:.]/g,"-").replace("T","_").slice(0,19)}function o8(z,J){return`debug-report_${l8(z.context.capturedAt)}.${J}`}function r8(z){return K4(z.cause)>0}async function Q1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await n8();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await t8();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function n8(){let z=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};z=await navigator.mediaDevices.getDisplayMedia(J);let $=await s8(z);return $?{status:"ok",dataUrl:$}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{z?.getTracks().forEach((J)=>J.stop())}}async function s8(z){let J=document.createElement("video");J.srcObject=z,J.muted=!0,J.playsInline=!0,await new Promise((V)=>{let W=!1,G=()=>{if(W)return;W=!0,V()};J.onloadedmetadata=()=>{J.play().then(G).catch(G)},window.setTimeout(G,1500)}),await a8(J);let{videoWidth:$,videoHeight:j}=J;if(!$||!j)return null;let Q=document.createElement("canvas");Q.width=$,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(J,0,0,$,j),J.pause(),J.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function a8(z){return new Promise((J)=>{let $=!1,j=()=>{if($)return;$=!0,J()},Q=z;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function t8(){let z=O().screenshotFallback;if(!z)return null;let J=await z().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:($)=>!($ instanceof HTMLElement&&$.dataset?.debugReporter==="true")})}catch{return null}}var e8=2000,z3=0.82,J3=3000000;function $3(z){return new Promise((J,$)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>$(Error("could not read the screenshot")),j.src=z})}async function Z1(z){try{let J=await $3(z),$=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,e8/$),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(J.naturalWidth*j)),Q.height=Math.max(1,Math.round(J.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return z;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(J,0,0,Q.width,Q.height);let V=z3,W=Q.toDataURL("image/jpeg",V);while(W.length>J3&&V>0.4)V-=0.15,W=Q.toDataURL("image/jpeg",V);return W}catch{return z}}var j3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Q3=/^\d+$/,Z3=/^[0-9a-f]{16,}$/i;function d1(z){if(z.reason.type==="manual")return null;let J=z.cause?.failedRequests?.[0];if(!J?.url)return null;let $;try{$=new URL(J.url,"http://x").pathname}catch{$=J.url}let j=$.split("/").map((Z)=>j3.test(Z)||Q3.test(Z)||Z3.test(Z)?":id":Z).join("/"),Q=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${Q}`}var i1=2000000;function X1(z){let{screenshotDataUrl:J,replay:$,...j}=z;return JSON.stringify(j).length}function c1(z,J=2000000){if(X1(z)<=J)return z;let $=z.network.map((Q)=>({...Q})),j={...z,network:$};for(let Q of $){if(X1(j)<=J)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&X1(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&X1(j)>J)j.console=j.console.slice(1);return j}function u0(z){let J="";for(let $=0;$<z.length;$+=32768)J+=String.fromCharCode(...z.subarray($,$+32768));return btoa(J)}var X3=4,V3=2,W3=3,Y3=0,K3=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),G3=/^\s*javascript:/i;function H3(z,J){let $=z.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof J==="string"&&G3.test(J)}function F4(z,J=!1){if(!z)return;for(let $ of Object.keys(z)){let j=z[$];if(H3($,j)){if(J)z[$]=null;else delete z[$];continue}if(typeof j!=="string"||!K3.has($)||!j.includes("?"))continue;z[$]=z0(j)}}function l1(z){if(!z)return;F4(z.attributes);for(let J of z.childNodes??[])l1(J)}function P4(z){let J=JSON.parse(JSON.stringify(z));for(let $ of J){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===X3&&typeof j.href==="string")j.href=z0(j.href);else if($.type===V3)l1(j.node);else if($.type===W3&&j.source===Y3){for(let Q of j.adds??[])l1(Q.node);for(let Q of j.attributes??[])F4(Q.attributes,!0)}}return J}var B4="session-replay.json.gz",U3="session-replay.json";function F3(z){return Boolean(z&&z.events.length>0)}async function P3(z){if(typeof CompressionStream>"u")return null;try{let J=new Blob([z]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function o1(z,J){if(!F3(z))return{summary:{omitted:"empty"}};let j={seconds:Math.round(z.durationMs/1000),events:z.events.length,startedAt:z.startedAt,endedAt:z.endedAt},Q=P4(z.events),Z=await D4(Q),V=!1;if(Z.bytes.byteLength>J&&q3(Q))Q=M3(Q),Z=await D4(Q),V=!0;let{bytes:W,compressed:G}=Z;if(W.byteLength>J)return{summary:{...j,bytes:W.byteLength,omitted:"too-large"}};return{dataUri:`data:${G?"application/gzip":"application/json"};base64,${u0(W)}`,filename:G?B4:U3,summary:{...j,events:Q.length,bytes:W.byteLength,compressed:G,...V?{canvasDropped:V}:{}}}}async function D4(z){let J=new TextEncoder().encode(JSON.stringify({events:z})),$=await P3(J);return $?{bytes:$,compressed:!0}:{bytes:J,compressed:!1}}var D3=3,q4=2,B3=9;function M4(z){return z.type===D3&&z.data?.source===B3}function q3(z){return z.some(M4)||z.some((J)=>J.type===q4&&N4(J.data.node))}function N4(z){if(!z)return!1;if(z.attributes&&"rr_dataURL"in z.attributes)return!0;return(z.childNodes??[]).some(N4)}function I4(z){if(!z)return;if(z.attributes&&"rr_dataURL"in z.attributes)delete z.attributes.rr_dataURL;for(let J of z.childNodes??[])I4(J)}function M3(z){let J=[];for(let $ of z){if(M4($))continue;if($.type===q4)I4($.data.node);J.push($)}return J}var N3=new Set([502,503,504]);class $0 extends Error{kind;retryAfter;status;constructor(z,J,$,j){super(z);this.kind=J;this.retryAfter=$;this.status=j;this.name="ReportError"}}function I3(z){let{screenshotDataUrl:J,replay:$,...j}=z;return{dataUri:`data:application/json;base64,${u0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function r1(){let z=O().identity;if(!z)return{};try{let J=await z();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function n1(z,J){let $=O(),j=c1(J,i1),{context:Q,note:Z}=j,V=[];if(j.screenshotDataUrl){let N=await Z1(j.screenshotDataUrl);V.push({dataUri:N,filename:"screenshot.jpg"})}V.push(I3(j));let W,G=h0();if(G){let N=await o1(j.replay,G.maxBytes);if(W=N.summary,"dataUri"in N)V.push({dataUri:N.dataUri,filename:N.filename})}let U=d1(j),M={title:z,description:Z.trim()||void 0,appName:t().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:t().name,module:Q.module?.label??""},context:{...U?{signature:U}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...W?{replay:W}:{}},attachments:V},B=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await r1()},body:JSON.stringify(M)}).catch(()=>{throw new $0("report never left the browser","offline")});if(!B.ok)throw await s1(B);return await B.json()}async function s1(z){let J=z.headers.get("retry-after"),$=await z.json().then((j)=>j.error).catch(()=>null);if(z.status===429)return new $0("rate limited","rateLimited",J??void 0);if(N3.has(z.status))return new $0("desk unavailable","unavailable");return new $0($??`Report failed (${z.status})`,"rejected",void 0,z.status)}var V1=null,p0=null,C4=()=>O().host.replace(/\/$/,"");function W1(){return V1}function D0(){if(p0)return p0;return p0=(async()=>{try{let z=await fetch(`${C4()}/ingest/request-types`,{headers:{"x-realm-key":O().realmKey}}),J=z.ok?await z.json():null;V1=Array.isArray(J?.types)?J.types.filter(C3):[]}catch{V1=[],p0=null}return V1??[]})(),p0}function C3(z){let J=z;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function a1(z){let J=O(),$={};try{$=J.user?.()??{}}catch{$={}}let j=typeof window>"u"?null:window.location,Q={title:z.title,description:z.description.trim()||void 0,ticketTypeId:z.ticketTypeId,appName:t().name,category:j?a0(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:z.screenshotDataUrl?[{dataUri:await Z1(z.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${C4()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await r1()},body:JSON.stringify(Q)}).catch(()=>{throw new $0("request never left the browser","offline")});if(!Z.ok)throw await s1(Z);return await Z.json()}var d0=Math.PI/6;function O4(z,J,$){let j=J.x-z.x,Q=J.y-z.y,Z=Math.hypot(j,Q),V=Math.atan2(Q,j),W=[{x:J.x,y:J.y},{x:J.x-$*Math.cos(V-d0),y:J.y-$*Math.sin(V-d0)},{x:J.x-$*Math.cos(V+d0),y:J.y-$*Math.sin(V+d0)}],G=$*Math.cos(d0)*0.92;if(Z<=G)return{shaft:null,head:W};return{shaft:{from:z,to:{x:J.x-G*Math.cos(V),y:J.y-G*Math.sin(V)}},head:W}}var t1="#f44336",O3="rgba(250, 204, 21, 0.4)",e1=22,_4="#2563eb",S4=9,L4=11,R4=18,A4=4,Y1=8,_3=[{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 z2(z,J,$){let j=[],Q=null,Z=-1,V=null,W=null,G=z.getContext("2d");function U(){let X=z.getBoundingClientRect().width;return X>0?z.width/X:1}function M(X){let Y=z.getBoundingClientRect();return{x:(X.clientX-Y.left)/Y.width*z.width,y:(X.clientY-Y.top)/Y.height*z.height}}function B(X){let Y=X.size??e1;if(!G)return(X.text?.length??0)*Y*0.6;G.save(),G.font=`600 ${Y}px system-ui, sans-serif`;let H=G.measureText(X.text??"").width;return G.restore(),H}function N(X){if(X.tool==="text"){let Y=X.size??e1;return{left:X.x1,top:X.y1,right:X.x1+B(X),bottom:X.y1+Y*1.25}}return{left:Math.min(X.x1,X.x2),top:Math.min(X.y1,X.y2),right:Math.max(X.x1,X.x2),bottom:Math.max(X.y1,X.y2)}}function A(X){if(X.tool==="arrow")return[{id:"tail",x:X.x1,y:X.y1,cursor:"move"},{id:"head",x:X.x2,y:X.y2,cursor:"move"}];let Y=N(X);if(X.tool==="text")return[{id:"size",x:Y.right,y:Y.bottom,cursor:"nwse-resize"}];return _3.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 S(X){let Y=N(X);return{x:Y.right+R4*U(),y:Y.top-R4*U()}}function g(X,Y,H){let{shaft:K,head:F}=O4({x:Y.x1,y:Y.y1},{x:Y.x2,y:Y.y2},Math.max(10,16*H));if(K)X.lineCap="butt",X.beginPath(),X.moveTo(K.from.x,K.from.y),X.lineTo(K.to.x,K.to.y),X.stroke();X.beginPath(),X.moveTo(F[0].x,F[0].y),X.lineTo(F[1].x,F[1].y),X.lineTo(F[2].x,F[2].y),X.closePath(),X.fill()}function m(X,Y,H){X.save(),X.lineWidth=Math.max(2,3*H),X.strokeStyle=t1,X.fillStyle=t1;let K=N(Y);if(Y.tool==="rect")X.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(Y.tool==="arrow")g(X,Y,H);else if(Y.tool==="highlight")X.fillStyle=O3,X.fillRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(Y.tool==="text"&&Y.text){let F=Y.size??e1;X.font=`600 ${F}px system-ui, sans-serif`,X.textBaseline="top";let D=F*0.22;X.fillStyle="rgba(255,255,255,0.92)",X.fillRect(K.left-D,K.top-D,K.right-K.left+D*2,K.bottom-K.top+D*2),X.fillStyle=t1,X.fillText(Y.text,K.left,K.top)}X.restore()}function I(X,Y,H){let K=N(Y);X.save(),X.strokeStyle=_4,X.lineWidth=Math.max(1,1.5*H),X.setLineDash([6*H,4*H]),X.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top),X.setLineDash([]);let F=S4*H;for(let v of A(Y))X.fillStyle="#fff",X.strokeStyle=_4,X.lineWidth=Math.max(1,1.5*H),X.beginPath(),X.rect(v.x-F/2,v.y-F/2,F,F),X.fill(),X.stroke();let D=S(Y),L=L4*H;X.beginPath(),X.arc(D.x,D.y,L,0,Math.PI*2),X.fillStyle="#dc2626",X.fill(),X.strokeStyle="#fff",X.lineWidth=Math.max(1.5,2*H),X.beginPath(),X.moveTo(D.x-L*0.4,D.y-L*0.4),X.lineTo(D.x+L*0.4,D.y+L*0.4),X.moveTo(D.x+L*0.4,D.y-L*0.4),X.lineTo(D.x-L*0.4,D.y+L*0.4),X.stroke(),X.restore()}function C(){if(!G)return;let X=U();if(G.clearRect(0,0,z.width,z.height),G.drawImage(J,0,0,z.width,z.height),j.forEach((H,K)=>{if(K!==r)m(G,H,X)}),V)m(G,V,X);let Y=j[Z];if(Y&&!V)I(G,Y,X)}function c(X,Y,H,K,F){return Math.abs(X-H)<=F&&Math.abs(Y-K)<=F}function o(X,Y){let H=j[Z];if(!H)return null;let K=S4*U()/2+3*U();for(let F of A(H))if(c(X,Y,F.x,F.y,K))return F.id;return null}function w(X,Y){let H=j[Z];if(!H)return!1;let K=S(H);return c(X,Y,K.x,K.y,L4*U())}function h(X,Y){let H=6*U();for(let K=j.length-1;K>=0;K-=1){let F=j[K];if(F.tool==="arrow"){let L=F.x2-F.x1,v=F.y2-F.y1,a=Math.hypot(L,v)||1,P=Math.max(0,Math.min(1,((X-F.x1)*L+(Y-F.y1)*v)/(a*a)));if(Math.hypot(X-(F.x1+P*L),Y-(F.y1+P*v))<=H+4*U())return K;continue}let D=N(F);if(X>=D.left-H&&X<=D.right+H&&Y>=D.top-H&&Y<=D.bottom+H)return K}return-1}function f(X,Y,H,K,F){if(Y==="tail"){X.x1=H.x1+K,X.y1=H.y1+F;return}if(Y==="head"){X.x2=H.x2+K,X.y2=H.y2+F;return}if(Y==="size"){let R=(H.size??24)+F;X.size=Math.max(10,R);return}let D=N(H),{left:L,top:v,right:a,bottom:P}=D;if(Y.includes("w"))L=Math.min(a-Y1,L+K);if(Y.includes("e"))a=Math.max(L+Y1,a+K);if(Y.includes("n"))v=Math.min(P-Y1,v+F);if(Y.includes("s"))P=Math.max(v+Y1,P+F);X.x1=L,X.y1=v,X.x2=a,X.y2=P}function N0(X,Y,H,K){X.x1=Y.x1+H,X.y1=Y.y1+K,X.x2=Y.x2+H,X.y2=Y.y2+K}let E=null,r=-1,T={x:0,y:0,size:24};function y(){let X=z.getBoundingClientRect().width;return X>0?X/z.width:1}function s0(X,Y){if(!G)return X.length*Y*0.6;G.save(),G.font=`600 ${Y}px system-ui, sans-serif`;let H=G.measureText(X||" ").width;return G.restore(),H}function I0(){if(!E)return;let X=z.parentElement;if(!X)return;let Y=z.getBoundingClientRect(),H=X.getBoundingClientRect(),K=y(),F=T.size*K;E.style.left=`${Y.left-H.left+T.x*K}px`,E.style.top=`${Y.top-H.top+T.y*K}px`,E.style.fontSize=`${F}px`,E.style.width=`${Math.max(40,s0(E.value,F)+F)}px`}function Q0(X){let Y=E;if(!Y)return;E=null;let H=Y.value.trim(),K=r;if(r=-1,Y.remove(),X&&H){if(K>=0&&j[K])j[K].text=H,Z=K;else j.push({tool:"text",x1:T.x,y1:T.y,x2:T.x,y2:T.y,text:H,size:T.size}),Z=j.length-1;$()}else if(K>=0)Z=K;z.focus(),C()}function e(X,Y,H=-1){Q0(!0);let K=z.parentElement;if(!K)return;if(getComputedStyle(K).position==="static")K.style.position="relative";let F=H>=0?j[H]:void 0;r=H,T={x:F?.x1??X,y:F?.y1??Y,size:F?.size??Math.round(24*U())};let D=document.createElement("input");D.type="text",D.className="text-edit",D.value=F?.text??"",D.setAttribute("aria-label","ข้อความบนภาพ"),D.placeholder="ข้อความ",E=D,K.append(D),I0(),D.addEventListener("input",I0),D.addEventListener("keydown",(L)=>{if(L.stopPropagation(),L.key==="Enter")Q0(!0);else if(L.key==="Escape")Q0(!1)}),requestAnimationFrame(()=>{if(E!==D)return;D.focus(),D.select(),D.addEventListener("blur",()=>Q0(!0))}),C()}function n(X){let{x:Y,y:H}=M(X);if(z.setPointerCapture(X.pointerId),w(Y,H)){s();return}let K=o(Y,H);if(K&&j[Z]){W={grip:K,x:Y,y:H,start:{...j[Z]}};return}if(Q==="text"){if(X.preventDefault(),z.hasPointerCapture(X.pointerId))z.releasePointerCapture(X.pointerId);Q=null,$(),e(Y,H);return}if(Q){V={tool:Q,x1:Y,y1:H,x2:Y,y2:H},Z=-1;return}let F=h(Y,H);Z=F,W=F>=0?{grip:"body",x:Y,y:H,start:{...j[F]}}:null,C()}function C0(X){let{x:Y,y:H}=M(X);if(V){V.x2=Y,V.y2=H,C();return}if(W){let F=j[Z];if(!F)return;let D=Y-W.x,L=H-W.y;if(W.grip==="body")N0(F,W.start,D,L);else f(F,W.grip,W.start,D,L);C();return}if(Q){z.style.cursor="crosshair";return}if(w(Y,H)){z.style.cursor="pointer";return}let K=o(Y,H);if(K){let F=j[Z]?A(j[Z]).find((D)=>D.id===K):null;z.style.cursor=F?.cursor??"pointer";return}z.style.cursor=h(Y,H)>=0?"move":"default"}function U0(){if(V){if(!(Math.abs(V.x2-V.x1)<A4&&Math.abs(V.y2-V.y1)<A4))j.push(V),Z=j.length-1,Q=null,$();V=null}if(W)W=null,$();C()}function Z0(X){let Y=z.getBoundingClientRect(),H=(X.clientX-Y.left)/Y.width*z.width,K=(X.clientY-Y.top)/Y.height*z.height,F=h(H,K),D=j[F];if(!D||D.tool!=="text")return;X.preventDefault(),e(D.x1,D.y1,F)}function X0(X){if(Z<0)return;if(X.key==="Delete"||X.key==="Backspace")X.preventDefault(),s();else if(X.key==="Escape")X.preventDefault(),Z=-1,C()}function s(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),C()}return z.addEventListener("pointerdown",n),z.addEventListener("pointermove",C0),z.addEventListener("pointerup",U0),z.addEventListener("pointercancel",U0),z.addEventListener("dblclick",Z0),z.tabIndex=0,z.addEventListener("keydown",X0),C(),{setTool(X){Q=X,Z=-1,z.style.cursor=X?"crosshair":"default",C()},deleteSelected:s,clear(){j.length=0,Z=-1,$(),C()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let X=document.createElement("canvas");X.width=J.naturalWidth,X.height=J.naturalHeight;let Y=X.getContext("2d");if(!Y)return z.toDataURL("image/png");Y.drawImage(J,0,0);let H=U();for(let K of j)m(Y,K,H);return X.toDataURL("image/png")},destroy(){Q0(!1),z.removeEventListener("pointerdown",n),z.removeEventListener("pointermove",C0),z.removeEventListener("pointerup",U0),z.removeEventListener("pointercancel",U0),z.removeEventListener("dblclick",Z0),z.removeEventListener("keydown",X0)}}}var S3=["keydown","keyup","keypress"];function E0(z){for(let J of S3)z.addEventListener(J,($)=>$.stopPropagation())}var k4=`
40
+ `)}function l8(z){let J=[];for(let $ of z.failedRequests)J.push(`✗ ${$.status??$.error??"ERR"} ${$.method} ${$.url}`);for(let $ of z.errors)J.push(`⚠ ${$}`);for(let $ of z.erroredQueries)J.push(`⚠ React Query error: ${$.key} — ${$.error}`);return J}function o8(z){let{context:J}=z;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 : ${u8[z.reason.type]}${z.reason.message?` — ${z.reason.message}`:""}`,`Captured : ${z.network.length} requests · ${z.console.length} console · ${z.actionTrail.length} actions · screenshot=${z.screenshotMethod}${z.replay?` · replay=${Math.round(z.replay.durationMs/1000)}s`:""}`]}function r8(z){let J=l8(z.cause),$=[`## \uD83D\uDC1E ${z.context.app.name} — Debug Report`,`**Generated:** ${z.context.capturedAt}`,"",...o8(z).map((j)=>`- ${j.replace(/\s{2,}:/,":")}`),"",`**หมายเหตุจากผู้แจ้ง:** ${z.note.trim()||"(ไม่มี)"}`];if(J.length>0)$.push("","### ⚠ สาเหตุที่น่าจะเป็น","```",...J,"```");return $.push("",`<details><summary>ขั้นตอน (${z.actionTrail.length})</summary>`,"","```",c8(z.actionTrail),"```","</details>","",`<details><summary>Network (${z.network.length})</summary>`,"","```",d8(z.network),"```","</details>","",`<details><summary>Console (${z.console.length})</summary>`,"","```",i8(z.console),"```","</details>","","_ข้อมูลลับ (token, cookie) ถูกปกปิดอัตโนมัติ · ภาพหน้าจออยู่ในไฟล์ .zip_"),$.join(`
41
+ `)}function n8(z){return z.replace(/[:.]/g,"-").replace("T","_").slice(0,19)}function s8(z,J){return`debug-report_${n8(z.context.capturedAt)}.${J}`}function a8(z){return U4(z.cause)>0}async function Z1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await t8();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await J3();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function t8(){let z=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};z=await navigator.mediaDevices.getDisplayMedia(J);let $=await e8(z);return $?{status:"ok",dataUrl:$}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{z?.getTracks().forEach((J)=>J.stop())}}async function e8(z){let J=document.createElement("video");J.srcObject=z,J.muted=!0,J.playsInline=!0,await new Promise((V)=>{let W=!1,G=()=>{if(W)return;W=!0,V()};J.onloadedmetadata=()=>{J.play().then(G).catch(G)},window.setTimeout(G,1500)}),await z3(J);let{videoWidth:$,videoHeight:j}=J;if(!$||!j)return null;let Q=document.createElement("canvas");Q.width=$,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(J,0,0,$,j),J.pause(),J.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function z3(z){return new Promise((J)=>{let $=!1,j=()=>{if($)return;$=!0,J()},Q=z;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function J3(){let z=O().screenshotFallback;if(!z)return null;let J=await z().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:($)=>!($ instanceof HTMLElement&&$.dataset?.debugReporter==="true")})}catch{return null}}var $3=2000,j3=0.82,Q3=3000000;function Z3(z){return new Promise((J,$)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>$(Error("could not read the screenshot")),j.src=z})}async function X1(z){try{let J=await Z3(z),$=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,$3/$),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(J.naturalWidth*j)),Q.height=Math.max(1,Math.round(J.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return z;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(J,0,0,Q.width,Q.height);let V=j3,W=Q.toDataURL("image/jpeg",V);while(W.length>Q3&&V>0.4)V-=0.15,W=Q.toDataURL("image/jpeg",V);return W}catch{return z}}var X3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,V3=/^\d+$/,W3=/^[0-9a-f]{16,}$/i;function c1(z){if(z.reason.type==="manual")return null;let J=z.cause?.failedRequests?.[0];if(!J?.url)return null;let $;try{$=new URL(J.url,"http://x").pathname}catch{$=J.url}let j=$.split("/").map((Z)=>X3.test(Z)||V3.test(Z)||W3.test(Z)?":id":Z).join("/"),Q=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${Q}`}var l1=2000000;function V1(z){let{screenshotDataUrl:J,replay:$,...j}=z;return JSON.stringify(j).length}function o1(z,J=2000000){if(V1(z)<=J)return z;let $=z.network.map((Q)=>({...Q})),j={...z,network:$};for(let Q of $){if(V1(j)<=J)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&V1(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&V1(j)>J)j.console=j.console.slice(1);return j}function u0(z){let J="";for(let $=0;$<z.length;$+=32768)J+=String.fromCharCode(...z.subarray($,$+32768));return btoa(J)}var Y3=4,K3=2,G3=3,H3=0,U3=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),F3=/^\s*javascript:/i;function P3(z,J){let $=z.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof J==="string"&&F3.test(J)}function B4(z,J=!1){if(!z)return;for(let $ of Object.keys(z)){let j=z[$];if(P3($,j)){if(J)z[$]=null;else delete z[$];continue}if(typeof j!=="string"||!U3.has($)||!j.includes("?"))continue;z[$]=J0(j)}}function r1(z){if(!z)return;B4(z.attributes);for(let J of z.childNodes??[])r1(J)}function q4(z){let J=JSON.parse(JSON.stringify(z));for(let $ of J){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===Y3&&typeof j.href==="string")j.href=J0(j.href);else if($.type===K3)r1(j.node);else if($.type===G3&&j.source===H3){for(let Q of j.adds??[])r1(Q.node);for(let Q of j.attributes??[])B4(Q.attributes,!0)}}return J}var N4="session-replay.json.gz",D3="session-replay.json";function B3(z){return Boolean(z&&z.events.length>0)}async function q3(z){if(typeof CompressionStream>"u")return null;try{let J=new Blob([z]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function n1(z,J){if(!B3(z))return{summary:{omitted:"empty"}};let j={seconds:Math.round(z.durationMs/1000),events:z.events.length,startedAt:z.startedAt,endedAt:z.endedAt},Q=q4(z.events),Z=await M4(Q),V=!1;if(Z.bytes.byteLength>J&&I3(Q))Q=C3(Q),Z=await M4(Q),V=!0;let{bytes:W,compressed:G}=Z;if(W.byteLength>J)return{summary:{...j,bytes:W.byteLength,omitted:"too-large"}};return{dataUri:`data:${G?"application/gzip":"application/json"};base64,${u0(W)}`,filename:G?N4:D3,summary:{...j,events:Q.length,bytes:W.byteLength,compressed:G,...V?{canvasDropped:V}:{}}}}async function M4(z){let J=new TextEncoder().encode(JSON.stringify({events:z})),$=await q3(J);return $?{bytes:$,compressed:!0}:{bytes:J,compressed:!1}}var M3=3,I4=2,N3=9;function C4(z){return z.type===M3&&z.data?.source===N3}function I3(z){return z.some(C4)||z.some((J)=>J.type===I4&&O4(J.data.node))}function O4(z){if(!z)return!1;if(z.attributes&&"rr_dataURL"in z.attributes)return!0;return(z.childNodes??[]).some(O4)}function _4(z){if(!z)return;if(z.attributes&&"rr_dataURL"in z.attributes)delete z.attributes.rr_dataURL;for(let J of z.childNodes??[])_4(J)}function C3(z){let J=[];for(let $ of z){if(C4($))continue;if($.type===I4)_4($.data.node);J.push($)}return J}var O3=new Set([502,503,504]);class j0 extends Error{kind;retryAfter;status;constructor(z,J,$,j){super(z);this.kind=J;this.retryAfter=$;this.status=j;this.name="ReportError"}}function _3(z){let{screenshotDataUrl:J,replay:$,...j}=z;return{dataUri:`data:application/json;base64,${u0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function s1(){let z=O().identity;if(!z)return{};try{let J=await z();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function a1(z,J){let $=O(),j=o1(J,l1),{context:Q,note:Z}=j,V=[];if(j.screenshotDataUrl){let N=await X1(j.screenshotDataUrl);V.push({dataUri:N,filename:"screenshot.jpg"})}V.push(_3(j));let W,G=h0();if(G){let N=await n1(j.replay,G.maxBytes);if(W=N.summary,"dataUri"in N)V.push({dataUri:N.dataUri,filename:N.filename})}let U=c1(j),M={title:z,description:Z.trim()||void 0,appName:e().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:e().name,module:Q.module?.label??""},context:{...U?{signature:U}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...W?{replay:W}:{}},attachments:V},B=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await s1()},body:JSON.stringify(M)}).catch(()=>{throw new j0("report never left the browser","offline")});if(!B.ok)throw await t1(B);return await B.json()}async function t1(z){let J=z.headers.get("retry-after"),$=await z.json().then((j)=>j.error).catch(()=>null);if(z.status===429)return new j0("rate limited","rateLimited",J??void 0);if(O3.has(z.status))return new j0("desk unavailable","unavailable");return new j0($??`Report failed (${z.status})`,"rejected",void 0,z.status)}var W1=null,p0=null,S4=()=>O().host.replace(/\/$/,"");function Y1(){return W1}function D0(){if(p0)return p0;return p0=(async()=>{try{let z=await fetch(`${S4()}/ingest/request-types`,{headers:{"x-realm-key":O().realmKey}}),J=z.ok?await z.json():null;W1=Array.isArray(J?.types)?J.types.filter(S3):[]}catch{W1=[],p0=null}return W1??[]})(),p0}function S3(z){let J=z;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function e1(z){let J=O(),$={};try{$=J.user?.()??{}}catch{$={}}let j=typeof window>"u"?null:window.location,Q={title:z.title,description:z.description.trim()||void 0,ticketTypeId:z.ticketTypeId,appName:e().name,category:j?t0(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:z.screenshotDataUrl?[{dataUri:await X1(z.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${S4()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await s1()},body:JSON.stringify(Q)}).catch(()=>{throw new j0("request never left the browser","offline")});if(!Z.ok)throw await t1(Z);return await Z.json()}var d0=Math.PI/6;function L4(z,J,$){let j=J.x-z.x,Q=J.y-z.y,Z=Math.hypot(j,Q),V=Math.atan2(Q,j),W=[{x:J.x,y:J.y},{x:J.x-$*Math.cos(V-d0),y:J.y-$*Math.sin(V-d0)},{x:J.x-$*Math.cos(V+d0),y:J.y-$*Math.sin(V+d0)}],G=$*Math.cos(d0)*0.92;if(Z<=G)return{shaft:null,head:W};return{shaft:{from:z,to:{x:J.x-G*Math.cos(V),y:J.y-G*Math.sin(V)}},head:W}}var z2="#f44336",L3="rgba(250, 204, 21, 0.4)",J2=22,R4="#2563eb",A4=9,k4=11,T4=18,E4=4,K1=8,R3=[{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 $2(z,J,$){let j=[],Q=null,Z=-1,V=null,W=null,G=z.getContext("2d");function U(){let X=z.getBoundingClientRect().width;return X>0?z.width/X:1}function M(X){let Y=z.getBoundingClientRect();return{x:(X.clientX-Y.left)/Y.width*z.width,y:(X.clientY-Y.top)/Y.height*z.height}}function B(X){let Y=X.size??J2;if(!G)return(X.text?.length??0)*Y*0.6;G.save(),G.font=`600 ${Y}px system-ui, sans-serif`;let H=G.measureText(X.text??"").width;return G.restore(),H}function N(X){if(X.tool==="text"){let Y=X.size??J2;return{left:X.x1,top:X.y1,right:X.x1+B(X),bottom:X.y1+Y*1.25}}return{left:Math.min(X.x1,X.x2),top:Math.min(X.y1,X.y2),right:Math.max(X.x1,X.x2),bottom:Math.max(X.y1,X.y2)}}function A(X){if(X.tool==="arrow")return[{id:"tail",x:X.x1,y:X.y1,cursor:"move"},{id:"head",x:X.x2,y:X.y2,cursor:"move"}];let Y=N(X);if(X.tool==="text")return[{id:"size",x:Y.right,y:Y.bottom,cursor:"nwse-resize"}];return R3.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 S(X){let Y=N(X);return{x:Y.right+T4*U(),y:Y.top-T4*U()}}function g(X,Y,H){let{shaft:K,head:F}=L4({x:Y.x1,y:Y.y1},{x:Y.x2,y:Y.y2},Math.max(10,16*H));if(K)X.lineCap="butt",X.beginPath(),X.moveTo(K.from.x,K.from.y),X.lineTo(K.to.x,K.to.y),X.stroke();X.beginPath(),X.moveTo(F[0].x,F[0].y),X.lineTo(F[1].x,F[1].y),X.lineTo(F[2].x,F[2].y),X.closePath(),X.fill()}function m(X,Y,H){X.save(),X.lineWidth=Math.max(2,3*H),X.strokeStyle=z2,X.fillStyle=z2;let K=N(Y);if(Y.tool==="rect")X.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(Y.tool==="arrow")g(X,Y,H);else if(Y.tool==="highlight")X.fillStyle=L3,X.fillRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(Y.tool==="text"&&Y.text){let F=Y.size??J2;X.font=`600 ${F}px system-ui, sans-serif`,X.textBaseline="top";let D=F*0.22;X.fillStyle="rgba(255,255,255,0.92)",X.fillRect(K.left-D,K.top-D,K.right-K.left+D*2,K.bottom-K.top+D*2),X.fillStyle=z2,X.fillText(Y.text,K.left,K.top)}X.restore()}function I(X,Y,H){let K=N(Y);X.save(),X.strokeStyle=R4,X.lineWidth=Math.max(1,1.5*H),X.setLineDash([6*H,4*H]),X.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top),X.setLineDash([]);let F=A4*H;for(let v of A(Y))X.fillStyle="#fff",X.strokeStyle=R4,X.lineWidth=Math.max(1,1.5*H),X.beginPath(),X.rect(v.x-F/2,v.y-F/2,F,F),X.fill(),X.stroke();let D=S(Y),L=k4*H;X.beginPath(),X.arc(D.x,D.y,L,0,Math.PI*2),X.fillStyle="#dc2626",X.fill(),X.strokeStyle="#fff",X.lineWidth=Math.max(1.5,2*H),X.beginPath(),X.moveTo(D.x-L*0.4,D.y-L*0.4),X.lineTo(D.x+L*0.4,D.y+L*0.4),X.moveTo(D.x+L*0.4,D.y-L*0.4),X.lineTo(D.x-L*0.4,D.y+L*0.4),X.stroke(),X.restore()}function C(){if(!G)return;let X=U();if(G.clearRect(0,0,z.width,z.height),G.drawImage(J,0,0,z.width,z.height),j.forEach((H,K)=>{if(K!==n)m(G,H,X)}),V)m(G,V,X);let Y=j[Z];if(Y&&!V)I(G,Y,X)}function l(X,Y,H,K,F){return Math.abs(X-H)<=F&&Math.abs(Y-K)<=F}function r(X,Y){let H=j[Z];if(!H)return null;let K=A4*U()/2+3*U();for(let F of A(H))if(l(X,Y,F.x,F.y,K))return F.id;return null}function x(X,Y){let H=j[Z];if(!H)return!1;let K=S(H);return l(X,Y,K.x,K.y,k4*U())}function h(X,Y){let H=6*U();for(let K=j.length-1;K>=0;K-=1){let F=j[K];if(F.tool==="arrow"){let L=F.x2-F.x1,v=F.y2-F.y1,t=Math.hypot(L,v)||1,P=Math.max(0,Math.min(1,((X-F.x1)*L+(Y-F.y1)*v)/(t*t)));if(Math.hypot(X-(F.x1+P*L),Y-(F.y1+P*v))<=H+4*U())return K;continue}let D=N(F);if(X>=D.left-H&&X<=D.right+H&&Y>=D.top-H&&Y<=D.bottom+H)return K}return-1}function f(X,Y,H,K,F){if(Y==="tail"){X.x1=H.x1+K,X.y1=H.y1+F;return}if(Y==="head"){X.x2=H.x2+K,X.y2=H.y2+F;return}if(Y==="size"){let R=(H.size??24)+F;X.size=Math.max(10,R);return}let D=N(H),{left:L,top:v,right:t,bottom:P}=D;if(Y.includes("w"))L=Math.min(t-K1,L+K);if(Y.includes("e"))t=Math.max(L+K1,t+K);if(Y.includes("n"))v=Math.min(P-K1,v+F);if(Y.includes("s"))P=Math.max(v+K1,P+F);X.x1=L,X.y1=v,X.x2=t,X.y2=P}function N0(X,Y,H,K){X.x1=Y.x1+H,X.y1=Y.y1+K,X.x2=Y.x2+H,X.y2=Y.y2+K}let E=null,n=-1,T={x:0,y:0,size:24};function y(){let X=z.getBoundingClientRect().width;return X>0?X/z.width:1}function a0(X,Y){if(!G)return X.length*Y*0.6;G.save(),G.font=`600 ${Y}px system-ui, sans-serif`;let H=G.measureText(X||" ").width;return G.restore(),H}function I0(){if(!E)return;let X=z.parentElement;if(!X)return;let Y=z.getBoundingClientRect(),H=X.getBoundingClientRect(),K=y(),F=T.size*K;E.style.left=`${Y.left-H.left+T.x*K}px`,E.style.top=`${Y.top-H.top+T.y*K}px`,E.style.fontSize=`${F}px`,E.style.width=`${Math.max(40,a0(E.value,F)+F)}px`}function Z0(X){let Y=E;if(!Y)return;E=null;let H=Y.value.trim(),K=n;if(n=-1,Y.remove(),X&&H){if(K>=0&&j[K])j[K].text=H,Z=K;else j.push({tool:"text",x1:T.x,y1:T.y,x2:T.x,y2:T.y,text:H,size:T.size}),Z=j.length-1;$()}else if(K>=0)Z=K;z.focus(),C()}function z0(X,Y,H=-1){Z0(!0);let K=z.parentElement;if(!K)return;if(getComputedStyle(K).position==="static")K.style.position="relative";let F=H>=0?j[H]:void 0;n=H,T={x:F?.x1??X,y:F?.y1??Y,size:F?.size??Math.round(24*U())};let D=document.createElement("input");D.type="text",D.className="text-edit",D.value=F?.text??"",D.setAttribute("aria-label","ข้อความบนภาพ"),D.placeholder="ข้อความ",E=D,K.append(D),I0(),D.addEventListener("input",I0),D.addEventListener("keydown",(L)=>{if(L.stopPropagation(),L.key==="Enter")Z0(!0);else if(L.key==="Escape")Z0(!1)}),requestAnimationFrame(()=>{if(E!==D)return;D.focus(),D.select(),D.addEventListener("blur",()=>Z0(!0))}),C()}function s(X){let{x:Y,y:H}=M(X);if(z.setPointerCapture(X.pointerId),x(Y,H)){a();return}let K=r(Y,H);if(K&&j[Z]){W={grip:K,x:Y,y:H,start:{...j[Z]}};return}if(Q==="text"){if(X.preventDefault(),z.hasPointerCapture(X.pointerId))z.releasePointerCapture(X.pointerId);Q=null,$(),z0(Y,H);return}if(Q){V={tool:Q,x1:Y,y1:H,x2:Y,y2:H},Z=-1;return}let F=h(Y,H);Z=F,W=F>=0?{grip:"body",x:Y,y:H,start:{...j[F]}}:null,C()}function C0(X){let{x:Y,y:H}=M(X);if(V){V.x2=Y,V.y2=H,C();return}if(W){let F=j[Z];if(!F)return;let D=Y-W.x,L=H-W.y;if(W.grip==="body")N0(F,W.start,D,L);else f(F,W.grip,W.start,D,L);C();return}if(Q){z.style.cursor="crosshair";return}if(x(Y,H)){z.style.cursor="pointer";return}let K=r(Y,H);if(K){let F=j[Z]?A(j[Z]).find((D)=>D.id===K):null;z.style.cursor=F?.cursor??"pointer";return}z.style.cursor=h(Y,H)>=0?"move":"default"}function U0(){if(V){if(!(Math.abs(V.x2-V.x1)<E4&&Math.abs(V.y2-V.y1)<E4))j.push(V),Z=j.length-1,Q=null,$();V=null}if(W)W=null,$();C()}function X0(X){let Y=z.getBoundingClientRect(),H=(X.clientX-Y.left)/Y.width*z.width,K=(X.clientY-Y.top)/Y.height*z.height,F=h(H,K),D=j[F];if(!D||D.tool!=="text")return;X.preventDefault(),z0(D.x1,D.y1,F)}function V0(X){if(Z<0)return;if(X.key==="Delete"||X.key==="Backspace")X.preventDefault(),a();else if(X.key==="Escape")X.preventDefault(),Z=-1,C()}function a(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),C()}return z.addEventListener("pointerdown",s),z.addEventListener("pointermove",C0),z.addEventListener("pointerup",U0),z.addEventListener("pointercancel",U0),z.addEventListener("dblclick",X0),z.tabIndex=0,z.addEventListener("keydown",V0),C(),{setTool(X){Q=X,Z=-1,z.style.cursor=X?"crosshair":"default",C()},deleteSelected:a,clear(){j.length=0,Z=-1,$(),C()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let X=document.createElement("canvas");X.width=J.naturalWidth,X.height=J.naturalHeight;let Y=X.getContext("2d");if(!Y)return z.toDataURL("image/png");Y.drawImage(J,0,0);let H=U();for(let K of j)m(Y,K,H);return X.toDataURL("image/png")},destroy(){Z0(!1),z.removeEventListener("pointerdown",s),z.removeEventListener("pointermove",C0),z.removeEventListener("pointerup",U0),z.removeEventListener("pointercancel",U0),z.removeEventListener("dblclick",X0),z.removeEventListener("keydown",V0)}}}var A3=["keydown","keyup","keypress"];function E0(z){for(let J of A3)z.addEventListener(J,($)=>$.stopPropagation())}var f4=`
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 f0="lw-debug-reporter",W0=null;function L3(z,J){if(z instanceof $0){if(z.kind==="offline")return J.failedOffline;if(z.kind==="unavailable")return J.failedUnavailable;if(z.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",z.retryAfter??"60");return z.message||J.failed}return J.failed}var x4=()=>[];function R3(z){x4=z}var A3=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function k3(){return class extends HTMLElement{root;stop=null;annotator=null;bundle=null;busy=!1;keep=null;returnFocus=null;constructor(){super();this.root=this.attachShadow({mode:"open"}),E0(this.root),this.root.addEventListener("keydown",(J)=>{let $=J;if($.key!=="Escape"||$.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;$.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=b1((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let $=document.activeElement;this.returnFocus=$ instanceof HTMLElement&&$!==document.body?$:null;let j=J0(O().locale),Q=W1();if(Q===null)D0();if(J.type==="manual"&&Q?.length){this.renderChooser(j,J);return}await this.report(J,j)}renderChooser(J,$){let j=this.shell(J);j.classList.add("narrow"),j.setAttribute("aria-label",J.chooseTitle);let Q=_("div","head"),Z=l("✕","icon");Z.setAttribute("aria-label",J.close),Z.addEventListener("click",()=>this.close()),Q.append(_("h2","",J.chooseTitle),Z);let V=w4("problem",E3,J.kindProblem,J.chooseProblemHint);V.dataset.choose="problem",V.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,J)});let W=w4("request",E4,J.kindRequest,J.chooseRequestHint);W.dataset.choose="request",W.addEventListener("click",()=>{this.bundle=m0({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:J2()}),this.renderForm(J,$,"request")});let G=_("div","kinds choose");G.append(V,W),G.addEventListener("keydown",(U)=>{if(!T4.includes(U.key))return;U.preventDefault(),(this.root.activeElement===V?W:V).focus()}),j.append(Q,G),V.focus()}async switchToReport(J,$,j){this.root.replaceChildren();let Q=await Q1();if(Q.method==="cancelled"){this.renderForm(J,$,"request",{...j,asking:!0});return}this.bundle=m0({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:J2()}),this.renderForm(J,$,"problem",j)}async report(J,$){let j=await Q1();if(j.method==="cancelled"){this.close();return}this.bundle=m0({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:J2()}),this.renderForm($,J,"problem")}close(J=!1){if(J)W0=null;else if(this.keep)W0=this.keep()??W0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let $=this.returnFocus;if(this.returnFocus=null,$?.isConnected)$.focus()}shell(J){let $=document.createElement("style");$.textContent=k4;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",J.title),j.append(Q),this.root.replaceChildren($,j),Q}renderShell(J,$){let j=this.shell(J),Q=_("div","head");Q.append(_("h2","",J.title)),j.append(Q,_("p","status",$))}renderForm(J,$,j,Q){let Z=this.bundle;if(!Z)return;let V=this.shell(J),W=j,G=j==="problem"||!!Z.screenshotDataUrl,U=null,M=_("div","head"),B=_("h2","",J.title),N=l("✕","icon");N.setAttribute("aria-label",J.close),N.addEventListener("click",()=>this.close()),M.append(B,N);let A=_("p","door");A.hidden=!0;let S=_("span"),g=l("","link");g.dataset.switchKind="",g.addEventListener("click",()=>Y(W==="problem"?"request":"problem")),A.append(S,g);let m=_("div","ask");m.hidden=!0;let I=document.createElement("input");I.type="search",I.className="type-search",I.placeholder=J.requestTypeSearch,I.setAttribute("aria-label",J.requestTypeSearch),I.dataset.requestTypeSearch="",I.hidden=!0;let C=_("div","types");C.setAttribute("role","radiogroup"),C.setAttribute("aria-label",J.requestTypeLabel);let c=_("p","status",J.requestTypeNone);c.hidden=!0;let o=_("p","status type-count","");o.hidden=!0,m.append(K1(J.requestTypeLabel,"",!0),I,C,c,o);let w=[],h=()=>{for(let R of w){let q=R.dataset.requestType===U?.id;R.setAttribute("aria-checked",String(q)),R.tabIndex=q?0:-1}let P=w.find((R)=>R.dataset.requestType===U?.id);if(P&&C.scrollHeight>C.clientHeight){let R=P.offsetTop-C.offsetTop;if(R<C.scrollTop)C.scrollTop=R;else if(R+P.offsetHeight>C.scrollTop+C.clientHeight)C.scrollTop=R+P.offsetHeight-C.clientHeight}},f=document.createElement("input");f.type="text";let N0=K1(""),E=document.createElement("textarea"),r=K1(""),T=_("div","meta"),{context:y}=Z,s0=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${J.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,I0=(P,R)=>{let q=document.createElement("div"),k=document.createElement("b");k.textContent=`${P}: `;let x=document.createTextNode(R);return q.append(k,x),T.append(q),{b:k,v:x}};I0(J.reporter,`${y.user.fullName??"—"} (${y.user.email??"—"})`),I0(J.page,y.route.href);let Q0=I0(J.captured,s0),e=document.createElement("label");e.className="shot-choice",e.hidden=!0;let n=document.createElement("input");n.type="checkbox",n.checked=!0,n.dataset.requestShot="",e.append(n,document.createTextNode(` ${J.requestWithShot}`));let C0=Z.screenshotDataUrl?this.screenshotSection(J,Z.screenshotDataUrl):[_("p","status",J.noScreenshot)],U0=Z.screenshotDataUrl?C0[0]:null;if(!Z.screenshotDataUrl)e.replaceChildren();let Z0=_("p","status",""),X0=l(J.submit,"primary"),s=()=>{X0.disabled=f.value.trim().length===0||W==="request"&&!U};f.addEventListener("input",s);let X=()=>{let P=W==="request";if(B.textContent=P?J.requestTitle:J.title,V.setAttribute("aria-label",P?J.requestTitle:J.title),S.textContent=`${P?J.problemInstead:J.askInstead} `,g.textContent=P?G?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,m.hidden=!P,G1(N0,P?J.requestSummaryLabel:J.summaryLabel,P?"":J.summaryRequired,!0),f.placeholder=P?J.requestSummaryPlaceholder:J.summaryPlaceholder,G1(r,P?J.requestDetailLabel:J.detailLabel),E.placeholder=P?J.requestDetailPlaceholder:J.detailPlaceholder,Q0.b.textContent=`${P?J.requestLeaves:J.captured}: `,Q0.v.textContent=P?J.requestLeavesWhat:s0,e.hidden=!P||!Z.screenshotDataUrl,U0)G1(U0,P?J.requestAnnotateHint:J.annotateHint);for(let R of C0)R.classList.toggle("dropped",P&&!n.checked),R.hidden=P&&!Z.screenshotDataUrl;X0.textContent=P?J.requestSubmit:J.submit,s()};n.addEventListener("change",X);let Y=(P)=>{if(P===W)return;if(P==="problem"&&!G){this.switchToReport(J,$,{title:f.value,detail:E.value,asking:!1,typeId:U?.id??null});return}W=P,X()},H=(P)=>{if(this.bundle!==Z||$.type!=="manual"||!P.length)return;U=P[0],w.length=0;for(let q of P){let k=l("","type");k.setAttribute("role","radio"),k.dataset.requestType=q.id;let x=_("span","type-body");if(x.append(_("b","",q.name)),q.description)x.append(_("span","type-hint",q.description));if(q.targetHours){let O0=_("span","type-due");O0.append(H1(f3),document.createTextNode(J.requestTarget.replace("{time}",T3(J,q.targetHours)))),x.append(O0)}k.append(H1(E4),x),k.addEventListener("click",()=>{U=q,h(),s()}),w.push(k)}C.replaceChildren(...w),C.onkeydown=(q)=>{if(!T4.includes(q.key)||!U)return;q.preventDefault();let k=P.filter((F0,F6)=>!w[F6].hidden);if(!k.length)return;let x=k.findIndex((F0)=>F0.id===U.id),O0=q.key==="ArrowUp"||q.key==="ArrowLeft"?-1:1;U=k[x<0?0:(x+O0+k.length)%k.length],h(),w.find((F0)=>F0.dataset.requestType===U.id)?.focus()},C.classList.toggle("long",P.length>=$2),I.hidden=P.length<$2;let R=(q)=>{o.hidden=P.length<$2||q===0,o.textContent=J.requestTypeCount.replace("{n}",String(q))};R(P.length),I.oninput=()=>{let q=I.value.trim().toLowerCase(),k=null;if(P.forEach((x,O0)=>{let F0=!q||`${x.name} ${x.description}`.toLowerCase().includes(q);if(w[O0].hidden=!F0,F0&&!k)k=x}),c.hidden=!!k,R(w.filter((x)=>!x.hidden).length),k&&U&&w[P.indexOf(U)].hidden)U=k;h(),s()},I.onkeydown=(q)=>{if(q.key==="ArrowDown"||q.key==="Enter")q.preventDefault(),w.find((k)=>k.dataset.requestType===U?.id&&!k.hidden)?.focus()},h(),A.hidden=!1,X()},K=Q??(W0&&(W0.title||W0.detail)?W0:null),F=_("p","draft");if(F.hidden=!K||!!Q,K){f.value=K.title,E.value=K.detail;let P=l(J.draftClear,"link");P.dataset.draftClear="",P.addEventListener("click",()=>{f.value="",E.value="",W0=null,F.hidden=!0,s(),f.focus()}),F.append(document.createTextNode(`${J.draftRestored} · `),P)}let D=W1(),L=(P)=>{if(H(P),W!=="request"||A.hidden||!K?.typeId)return;let R=P.find((q)=>q.id===K.typeId);if(R)U=R,h()};if(D)L(D);else if($.type==="manual")D0().then(L);this.keep=()=>({title:f.value,detail:E.value,asking:W==="request",typeId:U?.id??null}),V.append(M,A,F,m,N0,f,r,E,T,e,...C0);let v=_("div","foot"),a=l(J.close);a.addEventListener("click",()=>this.close()),v.append(a,Z0,_("span","grow"),X0),V.append(v),X(),X0.addEventListener("click",async()=>{X0.disabled=!0,Z0.dataset.tone="",Z0.textContent=J.submitting;let P=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(W==="request"&&U){let k=await a1({ticketTypeId:U.id,title:f.value.trim(),description:E.value,screenshotDataUrl:n.checked?P():null}),x=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:k,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),x)P0(`${J.requestSubmitted} — #${k.number}`,"success");return}let R=await n1(f.value.trim(),{...Z,note:E.value,screenshotDataUrl:P()}),q=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:R,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),q)P0(`${J.submitted} — #${R.number}`,"success")}catch(R){let q=L3(R,J);Z0.dataset.tone="error",Z0.textContent=q,P0(q,"error"),s()}}),f.focus()}screenshotSection(J,$){let j=K1(J.annotateHint),Q=_("div","tools"),Z=document.createElement("canvas"),V=_("div","shot");V.append(Z);let W=[],G=(N)=>{for(let A of W)A.setAttribute("aria-pressed",String(A===N))};for(let{tool:N,key:A}of A3){let S=l(J[A]);S.setAttribute("aria-pressed","false"),S.addEventListener("click",()=>{let g=S.getAttribute("aria-pressed")==="true";G(g?null:S),this.annotator?.setTool(g?null:N)}),W.push(S),Q.append(S)}Q.append(_("span","sep"));let U=l(J.deleteSelected);U.addEventListener("click",()=>this.annotator?.deleteSelected());let M=l(J.clearAll);M.addEventListener("click",()=>{this.annotator?.clear(),G(null)}),Q.append(U,M);let B=new Image;return B.onload=()=>{Z.width=B.naturalWidth,Z.height=B.naturalHeight,this.annotator=z2(Z,B,()=>{G(null),U.disabled=!this.annotator?.hasSelection()})},B.src=$,[j,Q,_("p","status",J.annotateHelp),V]}}}function J2(){try{return x4()}catch{return[]}}function _(z,J="",$=""){let j=document.createElement(z);if(J)j.className=J;if($)j.textContent=$;return j}function T3(z,J){return J>=24&&J%24===0?z.days.replace("{n}",String(J/24)):z.hours.replace("{n}",String(J))}var T4=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],$2=7,E3=[["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"}]],E4=[["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"}]],f3=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],w3=[["path",{d:"M20 6 9 17l-5-5"}]],f4="http://www.w3.org/2000/svg";function w4(z,J,$,j){let Q=l("","kind");Q.dataset.kind=z;let Z=_("span","kind-top");return Z.append(H1(J),_("b","",$)),Q.append(Z,_("span","kind-hint",j),H1(w3,"tick")),Q}function H1(z,J="icon"){let $=document.createElementNS(f4,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:J}))$.setAttribute(j,Q);for(let[j,Q]of z){let Z=document.createElementNS(f4,j);for(let[V,W]of Object.entries(Q))Z.setAttribute(V,W);$.append(Z)}return $}function l(z,J=""){let $=document.createElement("button");if($.type="button",$.textContent=z,J)$.className=J;return $}function K1(z,J="",$=!1){return G1(document.createElement("label"),z,J,$)}function G1(z,J,$="",j=!1){if(z.replaceChildren(document.createTextNode(J)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",z.append(Q)}if($){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${$}`,z.append(Q)}return z}function j2(){if(typeof window>"u"||customElements.get(f0))return;customElements.define(f0,k3())}var x3="lw-portal-handoff",b4=138.23,b3=`
192
+ `;var f0="lw-debug-reporter",Y0=null;function k3(z,J){if(z instanceof j0){if(z.kind==="offline")return J.failedOffline;if(z.kind==="unavailable")return J.failedUnavailable;if(z.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",z.retryAfter??"60");return z.message||J.failed}return J.failed}var h4=()=>[];function T3(z){h4=z}var E3=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function f3(){return class extends HTMLElement{root;stop=null;annotator=null;bundle=null;busy=!1;keep=null;returnFocus=null;constructor(){super();this.root=this.attachShadow({mode:"open"}),E0(this.root),this.root.addEventListener("keydown",(J)=>{let $=J;if($.key!=="Escape"||$.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;$.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=h1((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let $=document.activeElement;this.returnFocus=$ instanceof HTMLElement&&$!==document.body?$:null;let j=$0(O().locale),Q=Y1();if(Q===null)D0();if(J.type==="manual"&&Q?.length){this.renderChooser(j,J);return}await this.report(J,j)}renderChooser(J,$){let j=this.shell(J);j.classList.add("narrow"),j.setAttribute("aria-label",J.chooseTitle);let Q=_("div","head"),Z=o("✕","icon");Z.setAttribute("aria-label",J.close),Z.addEventListener("click",()=>this.close()),Q.append(_("h2","",J.chooseTitle),Z);let V=g4("problem",w3,J.kindProblem,J.chooseProblemHint);V.dataset.choose="problem",V.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,J)});let W=g4("request",w4,J.kindRequest,J.chooseRequestHint);W.dataset.choose="request",W.addEventListener("click",()=>{this.bundle=m0({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:j2()}),this.renderForm(J,$,"request")});let G=_("div","kinds choose");G.append(V,W),G.addEventListener("keydown",(U)=>{if(!x4.includes(U.key))return;U.preventDefault(),(this.root.activeElement===V?W:V).focus()}),j.append(Q,G),V.focus()}async switchToReport(J,$,j){this.root.replaceChildren();let Q=await Z1();if(Q.method==="cancelled"){this.renderForm(J,$,"request",{...j,asking:!0});return}this.bundle=m0({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:j2()}),this.renderForm(J,$,"problem",j)}async report(J,$){let j=await Z1();if(j.method==="cancelled"){this.close();return}this.bundle=m0({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:j2()}),this.renderForm($,J,"problem")}close(J=!1){if(J)Y0=null;else if(this.keep)Y0=this.keep()??Y0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let $=this.returnFocus;if(this.returnFocus=null,$?.isConnected)$.focus()}shell(J){let $=document.createElement("style");$.textContent=f4;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",J.title),j.append(Q),this.root.replaceChildren($,j),Q}renderShell(J,$){let j=this.shell(J),Q=_("div","head");Q.append(_("h2","",J.title)),j.append(Q,_("p","status",$))}renderForm(J,$,j,Q){let Z=this.bundle;if(!Z)return;let V=this.shell(J),W=j,G=j==="problem"||!!Z.screenshotDataUrl,U=null,M=_("div","head"),B=_("h2","",J.title),N=o("✕","icon");N.setAttribute("aria-label",J.close),N.addEventListener("click",()=>this.close()),M.append(B,N);let A=_("p","door");A.hidden=!0;let S=_("span"),g=o("","link");g.dataset.switchKind="",g.addEventListener("click",()=>Y(W==="problem"?"request":"problem")),A.append(S,g);let m=_("div","ask");m.hidden=!0;let I=document.createElement("input");I.type="search",I.className="type-search",I.placeholder=J.requestTypeSearch,I.setAttribute("aria-label",J.requestTypeSearch),I.dataset.requestTypeSearch="",I.hidden=!0;let C=_("div","types");C.setAttribute("role","radiogroup"),C.setAttribute("aria-label",J.requestTypeLabel);let l=_("p","status",J.requestTypeNone);l.hidden=!0;let r=_("p","status type-count","");r.hidden=!0,m.append(G1(J.requestTypeLabel,"",!0),I,C,l,r);let x=[],h=()=>{for(let R of x){let q=R.dataset.requestType===U?.id;R.setAttribute("aria-checked",String(q)),R.tabIndex=q?0:-1}let P=x.find((R)=>R.dataset.requestType===U?.id);if(P&&C.scrollHeight>C.clientHeight){let R=P.offsetTop-C.offsetTop;if(R<C.scrollTop)C.scrollTop=R;else if(R+P.offsetHeight>C.scrollTop+C.clientHeight)C.scrollTop=R+P.offsetHeight-C.clientHeight}},f=document.createElement("input");f.type="text";let N0=G1(""),E=document.createElement("textarea"),n=G1(""),T=_("div","meta"),{context:y}=Z,a0=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${J.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,I0=(P,R)=>{let q=document.createElement("div"),k=document.createElement("b");k.textContent=`${P}: `;let w=document.createTextNode(R);return q.append(k,w),T.append(q),{b:k,v:w}};I0(J.reporter,`${y.user.fullName??"—"} (${y.user.email??"—"})`),I0(J.page,y.route.href);let Z0=I0(J.captured,a0),z0=document.createElement("label");z0.className="shot-choice",z0.hidden=!0;let s=document.createElement("input");s.type="checkbox",s.checked=!0,s.dataset.requestShot="",z0.append(s,document.createTextNode(` ${J.requestWithShot}`));let C0=Z.screenshotDataUrl?this.screenshotSection(J,Z.screenshotDataUrl):[_("p","status",J.noScreenshot)],U0=Z.screenshotDataUrl?C0[0]:null;if(!Z.screenshotDataUrl)z0.replaceChildren();let X0=_("p","status",""),V0=o(J.submit,"primary"),a=()=>{V0.disabled=f.value.trim().length===0||W==="request"&&!U};f.addEventListener("input",a);let X=()=>{let P=W==="request";if(B.textContent=P?J.requestTitle:J.title,V.setAttribute("aria-label",P?J.requestTitle:J.title),S.textContent=`${P?J.problemInstead:J.askInstead} `,g.textContent=P?G?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,m.hidden=!P,H1(N0,P?J.requestSummaryLabel:J.summaryLabel,P?"":J.summaryRequired,!0),f.placeholder=P?J.requestSummaryPlaceholder:J.summaryPlaceholder,H1(n,P?J.requestDetailLabel:J.detailLabel),E.placeholder=P?J.requestDetailPlaceholder:J.detailPlaceholder,Z0.b.textContent=`${P?J.requestLeaves:J.captured}: `,Z0.v.textContent=P?J.requestLeavesWhat:a0,z0.hidden=!P||!Z.screenshotDataUrl,U0)H1(U0,P?J.requestAnnotateHint:J.annotateHint);for(let R of C0)R.classList.toggle("dropped",P&&!s.checked),R.hidden=P&&!Z.screenshotDataUrl;V0.textContent=P?J.requestSubmit:J.submit,a()};s.addEventListener("change",X);let Y=(P)=>{if(P===W)return;if(P==="problem"&&!G){this.switchToReport(J,$,{title:f.value,detail:E.value,asking:!1,typeId:U?.id??null});return}W=P,X()},H=(P)=>{if(this.bundle!==Z||$.type!=="manual"||!P.length)return;U=P[0],x.length=0;for(let q of P){let k=o("","type");k.setAttribute("role","radio"),k.dataset.requestType=q.id;let w=_("span","type-body");if(w.append(_("b","",q.name)),q.description)w.append(_("span","type-hint",q.description));if(q.targetHours){let O0=_("span","type-due");O0.append(U1(b3),document.createTextNode(J.requestTarget.replace("{time}",x3(J,q.targetHours)))),w.append(O0)}k.append(U1(w4),w),k.addEventListener("click",()=>{U=q,h(),a()}),x.push(k)}C.replaceChildren(...x),C.onkeydown=(q)=>{if(!x4.includes(q.key)||!U)return;q.preventDefault();let k=P.filter((F0,B6)=>!x[B6].hidden);if(!k.length)return;let w=k.findIndex((F0)=>F0.id===U.id),O0=q.key==="ArrowUp"||q.key==="ArrowLeft"?-1:1;U=k[w<0?0:(w+O0+k.length)%k.length],h(),x.find((F0)=>F0.dataset.requestType===U.id)?.focus()},C.classList.toggle("long",P.length>=Q2),I.hidden=P.length<Q2;let R=(q)=>{r.hidden=P.length<Q2||q===0,r.textContent=J.requestTypeCount.replace("{n}",String(q))};R(P.length),I.oninput=()=>{let q=I.value.trim().toLowerCase(),k=null;if(P.forEach((w,O0)=>{let F0=!q||`${w.name} ${w.description}`.toLowerCase().includes(q);if(x[O0].hidden=!F0,F0&&!k)k=w}),l.hidden=!!k,R(x.filter((w)=>!w.hidden).length),k&&U&&x[P.indexOf(U)].hidden)U=k;h(),a()},I.onkeydown=(q)=>{if(q.key==="ArrowDown"||q.key==="Enter")q.preventDefault(),x.find((k)=>k.dataset.requestType===U?.id&&!k.hidden)?.focus()},h(),A.hidden=!1,X()},K=Q??(Y0&&(Y0.title||Y0.detail)?Y0:null),F=_("p","draft");if(F.hidden=!K||!!Q,K){f.value=K.title,E.value=K.detail;let P=o(J.draftClear,"link");P.dataset.draftClear="",P.addEventListener("click",()=>{f.value="",E.value="",Y0=null,F.hidden=!0,a(),f.focus()}),F.append(document.createTextNode(`${J.draftRestored} · `),P)}let D=Y1(),L=(P)=>{if(H(P),W!=="request"||A.hidden||!K?.typeId)return;let R=P.find((q)=>q.id===K.typeId);if(R)U=R,h()};if(D)L(D);else if($.type==="manual")D0().then(L);this.keep=()=>({title:f.value,detail:E.value,asking:W==="request",typeId:U?.id??null}),V.append(M,A,F,m,N0,f,n,E,T,z0,...C0);let v=_("div","foot"),t=o(J.close);t.addEventListener("click",()=>this.close()),v.append(t,X0,_("span","grow"),V0),V.append(v),X(),V0.addEventListener("click",async()=>{V0.disabled=!0,X0.dataset.tone="",X0.textContent=J.submitting;let P=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(W==="request"&&U){let k=await e1({ticketTypeId:U.id,title:f.value.trim(),description:E.value,screenshotDataUrl:s.checked?P():null}),w=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:k,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),w)P0(`${J.requestSubmitted} — #${k.number}`,"success");return}let R=await a1(f.value.trim(),{...Z,note:E.value,screenshotDataUrl:P()}),q=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:R,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),q)P0(`${J.submitted} — #${R.number}`,"success")}catch(R){let q=k3(R,J);X0.dataset.tone="error",X0.textContent=q,P0(q,"error"),a()}}),f.focus()}screenshotSection(J,$){let j=G1(J.annotateHint),Q=_("div","tools"),Z=document.createElement("canvas"),V=_("div","shot");V.append(Z);let W=[],G=(N)=>{for(let A of W)A.setAttribute("aria-pressed",String(A===N))};for(let{tool:N,key:A}of E3){let S=o(J[A]);S.setAttribute("aria-pressed","false"),S.addEventListener("click",()=>{let g=S.getAttribute("aria-pressed")==="true";G(g?null:S),this.annotator?.setTool(g?null:N)}),W.push(S),Q.append(S)}Q.append(_("span","sep"));let U=o(J.deleteSelected);U.addEventListener("click",()=>this.annotator?.deleteSelected());let M=o(J.clearAll);M.addEventListener("click",()=>{this.annotator?.clear(),G(null)}),Q.append(U,M);let B=new Image;return B.onload=()=>{Z.width=B.naturalWidth,Z.height=B.naturalHeight,this.annotator=$2(Z,B,()=>{G(null),U.disabled=!this.annotator?.hasSelection()})},B.src=$,[j,Q,_("p","status",J.annotateHelp),V]}}}function j2(){try{return h4()}catch{return[]}}function _(z,J="",$=""){let j=document.createElement(z);if(J)j.className=J;if($)j.textContent=$;return j}function x3(z,J){return J>=24&&J%24===0?z.days.replace("{n}",String(J/24)):z.hours.replace("{n}",String(J))}var x4=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],Q2=7,w3=[["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"}]],w4=[["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"}]],b3=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],g3=[["path",{d:"M20 6 9 17l-5-5"}]],b4="http://www.w3.org/2000/svg";function g4(z,J,$,j){let Q=o("","kind");Q.dataset.kind=z;let Z=_("span","kind-top");return Z.append(U1(J),_("b","",$)),Q.append(Z,_("span","kind-hint",j),U1(g3,"tick")),Q}function U1(z,J="icon"){let $=document.createElementNS(b4,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:J}))$.setAttribute(j,Q);for(let[j,Q]of z){let Z=document.createElementNS(b4,j);for(let[V,W]of Object.entries(Q))Z.setAttribute(V,W);$.append(Z)}return $}function o(z,J=""){let $=document.createElement("button");if($.type="button",$.textContent=z,J)$.className=J;return $}function G1(z,J="",$=!1){return H1(document.createElement("label"),z,J,$)}function H1(z,J,$="",j=!1){if(z.replaceChildren(document.createTextNode(J)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",z.append(Q)}if($){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${$}`,z.append(Q)}return z}function Z2(){if(typeof window>"u"||customElements.get(f0))return;customElements.define(f0,f3())}var h3="lw-portal-handoff",y4=138.23,y3=`
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: ${b4}; stroke-dashoffset: 0;
222
+ stroke-dasharray: ${y4}; stroke-dashoffset: 0;
223
223
  animation: deplete var(--secs, 3s) linear forwards;
224
224
  }
225
- @keyframes deplete { to { stroke-dashoffset: ${b4}; } }
225
+ @keyframes deplete { to { stroke-dashoffset: ${y4}; } }
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 g4(z){if(typeof document>"u")return z.prepare().then((I)=>void z.go(I),()=>{return});let J=J0(O().locale),$=Math.max(1,Math.floor(z.seconds??3)),j=document.createElement(x3),Q=j.attachShadow({mode:"open"});E0(Q);let Z=document.createElement("style");Z.textContent=b3,Q.append(Z);let V=document.createElement("div");V.className="backdrop",V.innerHTML=`
269
+ `;function v4(z){if(typeof document>"u")return z.prepare().then((I)=>void z.go(I),()=>{return});let J=$0(O().locale),$=Math.max(1,Math.floor(z.seconds??3)),j=document.createElement(h3),Q=j.attachShadow({mode:"open"});E0(Q);let Z=document.createElement("style");Z.textContent=y3,Q.append(Z);let V=document.createElement("div");V.className="backdrop",V.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,7 +282,7 @@ p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
282
282
  <button type="button" class="cancel"></button>
283
283
  <button type="button" class="go"></button>
284
284
  </div>
285
- </div>`,Q.append(V);let W=(I)=>V.querySelector(I),G=W(".card"),U=W(".bar"),M=W(".count"),B=W("h2"),N=W(".body"),A=W(".host"),S=W(".go"),g=W(".cancel");B.textContent=J.handoffTitle,N.textContent=J.handoffBody;try{A.textContent=new URL(O().host).host}catch{A.textContent=""}S.textContent=J.handoffGo,g.textContent=J.cancel,G.style.setProperty("--secs",`${$}s`),M.textContent=String($),document.body.append(j),requestAnimationFrame(()=>V.setAttribute("data-open","1"));let m=document.activeElement;return S.focus({preventScroll:!0}),new Promise((I)=>{let C=!1,c=null,o=!1,w=Date.now()+$*1000,h=window.setInterval(()=>{let T=Math.ceil((w-Date.now())/1000);if(M.textContent=String(Math.max(0,T)),Date.now()>=w)E()},100);function f(T){if(C)return;if(C=!0,window.clearInterval(h),document.removeEventListener("keydown",r,!0),V.removeAttribute("data-open"),window.setTimeout(()=>j.remove(),200),!T)m?.focus?.({preventScroll:!0});I()}function N0(T){window.clearInterval(h),U.classList.remove("spinner"),U.style.animation="none",M.textContent="",B.textContent=J.handoffBlocked,N.textContent=J.handoffBody;let y=document.createElement("a");y.className="go",y.href=T,y.target="_blank",y.rel="noopener noreferrer",y.textContent=J.handoffOpen,y.addEventListener("click",()=>f(!0)),S.replaceWith(y),y.focus({preventScroll:!0})}function E(){if(C||o)return;if(c)return z.go(c)?f(!0):N0(c);window.clearInterval(h),M.textContent="",U.classList.add("spinner"),B.textContent=J.handoffPreparing}function r(T){if(T.key==="Escape")T.stopPropagation(),f(!1)}document.addEventListener("keydown",r,!0),S.addEventListener("click",E),g.addEventListener("click",()=>f(!1)),V.addEventListener("click",(T)=>{if(T.target===V)f(!1)}),z.prepare().then((T)=>{if(c=T,!C&&Date.now()>=w)E()},()=>{o=!0,window.clearInterval(h),G.classList.add("error"),U.classList.remove("spinner"),U.style.animation="none",M.textContent="",B.textContent=J.handoffFailed,N.textContent=J.handoffBody,S.remove(),g.textContent=J.close})})}var g3="/sso";function y4(z,J,$,j){let Q=new URL(g3,z.endsWith("/")?z:`${z}/`);if(Q.searchParams.set("realm",J),Q.searchParams.set("token",$),j)Q.searchParams.set("return",j);return Q.toString()}class U1 extends Error{constructor(z="No identity provider is configured, or nobody is signed in"){super(z);this.name="NoIdentityError"}}async function Q2(z){let J=O();if(!J.identity)throw new U1;let $=await J.identity();if(!$)throw new U1;return y4(J.host,J.realmKey,$,z)}var v4=Q2;function h4(z,J){if(J==="_self")return window.location.assign(z),!0;let $=window.open(z,"_blank");if(!$)return!1;try{$.opener=null}catch{}return!0}async function h3(z={}){if(z.announce===!1){h4(await Q2(z.returnTo),z.target);return}await g4({seconds:z.seconds,prepare:()=>Q2(z.returnTo),go:(J)=>h4(J,z.target)})}var y3="lw-call-ring",v3=`
285
+ </div>`,Q.append(V);let W=(I)=>V.querySelector(I),G=W(".card"),U=W(".bar"),M=W(".count"),B=W("h2"),N=W(".body"),A=W(".host"),S=W(".go"),g=W(".cancel");B.textContent=J.handoffTitle,N.textContent=J.handoffBody;try{A.textContent=new URL(O().host).host}catch{A.textContent=""}S.textContent=J.handoffGo,g.textContent=J.cancel,G.style.setProperty("--secs",`${$}s`),M.textContent=String($),document.body.append(j),requestAnimationFrame(()=>V.setAttribute("data-open","1"));let m=document.activeElement;return S.focus({preventScroll:!0}),new Promise((I)=>{let C=!1,l=null,r=!1,x=Date.now()+$*1000,h=window.setInterval(()=>{let T=Math.ceil((x-Date.now())/1000);if(M.textContent=String(Math.max(0,T)),Date.now()>=x)E()},100);function f(T){if(C)return;if(C=!0,window.clearInterval(h),document.removeEventListener("keydown",n,!0),V.removeAttribute("data-open"),window.setTimeout(()=>j.remove(),200),!T)m?.focus?.({preventScroll:!0});I()}function N0(T){window.clearInterval(h),U.classList.remove("spinner"),U.style.animation="none",M.textContent="",B.textContent=J.handoffBlocked,N.textContent=J.handoffBody;let y=document.createElement("a");y.className="go",y.href=T,y.target="_blank",y.rel="noopener noreferrer",y.textContent=J.handoffOpen,y.addEventListener("click",()=>f(!0)),S.replaceWith(y),y.focus({preventScroll:!0})}function E(){if(C||r)return;if(l)return z.go(l)?f(!0):N0(l);window.clearInterval(h),M.textContent="",U.classList.add("spinner"),B.textContent=J.handoffPreparing}function n(T){if(T.key==="Escape")T.stopPropagation(),f(!1)}document.addEventListener("keydown",n,!0),S.addEventListener("click",E),g.addEventListener("click",()=>f(!1)),V.addEventListener("click",(T)=>{if(T.target===V)f(!1)}),z.prepare().then((T)=>{if(l=T,!C&&Date.now()>=x)E()},()=>{r=!0,window.clearInterval(h),G.classList.add("error"),U.classList.remove("spinner"),U.style.animation="none",M.textContent="",B.textContent=J.handoffFailed,N.textContent=J.handoffBody,S.remove(),g.textContent=J.close})})}var v3="/sso";function u4(z,J,$,j){let Q=new URL(v3,z.endsWith("/")?z:`${z}/`);if(Q.searchParams.set("realm",J),Q.searchParams.set("token",$),j)Q.searchParams.set("return",j);return Q.toString()}class F1 extends Error{constructor(z="No identity provider is configured, or nobody is signed in"){super(z);this.name="NoIdentityError"}}async function X2(z){let J=O();if(!J.identity)throw new F1;let $=await J.identity();if(!$)throw new F1;return u4(J.host,J.realmKey,$,z)}var p4=X2;function m4(z,J){if(J==="_self")return window.location.assign(z),!0;let $=window.open(z,"_blank");if(!$)return!1;try{$.opener=null}catch{}return!0}async function m3(z={}){if(z.announce===!1){m4(await X2(z.returnTo),z.target);return}await v4({seconds:z.seconds,prepare:()=>X2(z.returnTo),go:(J)=>m4(J,z.target)})}var u3="lw-call-ring",p3=`
286
286
  :host { all: initial; }
287
287
  .card {
288
288
  position: fixed; right: 16px; bottom: 16px; z-index: 2147483002;
@@ -321,7 +321,7 @@ h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; }
321
321
  @keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
322
322
  @keyframes ping { from { transform: scale(1); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
323
323
  @media (prefers-reduced-motion: reduce) { .card { animation: none; } .icon::after { animation: none; opacity: 0; } }
324
- `,m3='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><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"/></svg>',u=null,B0=null,w0=null;function u3(z,J){return z.replace("{key}",J.ticketKey).replace("{title}",J.ticketTitle)}var X2=()=>J0(O().locale);function p3(){if(typeof document>"u")return null;if(u?.isConnected)return u.shadowRoot;u=document.createElement(y3),u.dataset.debugReporter="true";let z=u.attachShadow({mode:"open"});return E0(z),document.body.append(u),z}function m4(z,J){if(B0===z.id&&u?.isConnected)return;let $=p3();if(!$)return;B0=z.id;let j=X2();$.innerHTML="";let Q=document.createElement("style");Q.textContent=v3;let Z=document.createElement("div");Z.className="card",Z.setAttribute("role","alertdialog"),Z.setAttribute("aria-label",j.ringTitle),Z.dataset.lwCallRing=z.id;let V=document.createElement("div");V.className="head";let W=document.createElement("span");W.className="icon",W.innerHTML=m3;let G=document.createElement("div"),U=document.createElement("h2");U.textContent=j.ringTitle;let M=document.createElement("p");M.className="about",M.textContent=u3(j.ringAbout,z),M.title=M.textContent,G.append(U,M),V.append(W,G);let B=document.createElement("p");B.className="how",B.textContent=j.ringHow;let N=document.createElement("div");N.className="actions";let A=document.createElement("button");A.type="button",A.className="decline",A.textContent=j.ringDecline,A.dataset.lwRing="decline",A.onclick=()=>J.decline();let S=document.createElement("button");if(S.type="button",S.className="open",S.textContent=j.ringOpen,S.dataset.lwRing="open",S.onclick=()=>J.open(),N.append(A,S),Z.append(V,B,N),$.append(Q,Z),d3(),w0===null)w0=document.title,document.title=`${j.ringTab} — ${w0}`;S.focus({preventScroll:!0})}function F1(z){let J=u?.shadowRoot;if(!J)return;W2(),p4();let $=X2(),j=J.querySelector(".how"),Q=J.querySelector(".actions");if(j)if(j.textContent="",z){let Z=document.createElement("a");Z.href=z,Z.target="_blank",Z.rel="noopener",Z.textContent=$.ringBlocked,Z.dataset.lwRing="link",Z.onclick=()=>window.setTimeout(()=>F1(),0),j.append(Z)}else j.textContent=$.ringOpened;if(Q){Q.innerHTML="";let Z=document.createElement("button");Z.type="button",Z.className="close",Z.textContent=$.ringClose,Z.dataset.lwRing="close",Z.onclick=()=>q0(),Q.append(Z)}}function V2(z,J=!0){if(!u?.isConnected||B0!==z)return;u.style.display=J?"none":""}function q0(z){if(z&&B0&&z!==B0)return;W2(),p4(),u?.remove(),u=null,B0=null}function u4(){return u?.isConnected?B0:null}function p4(){if(w0===null||typeof document>"u")return;if(document.title.startsWith(X2().ringTab))document.title=w0;w0=null}var Y0=null,Z2;function d3(){W2();let z=window,J=z.AudioContext??z.webkitAudioContext;if(!J)return;try{let j=Y0??new J;Y0=j,j.resume?.().catch(()=>{return})}catch{return}let $=()=>{if(!Y0||Y0.state!=="running")return;let j=Y0.currentTime;for(let[Q,Z]of[660,880].entries()){let V=Y0.createOscillator(),W=Y0.createGain();V.frequency.value=Z,W.gain.setValueAtTime(0.0001,j+Q*0.22),W.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),W.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),V.connect(W).connect(Y0.destination),V.start(j+Q*0.22),V.stop(j+Q*0.22+0.21)}};$(),Z2=setInterval($,2200)}function W2(){clearInterval(Z2),Z2=void 0}var i3=64,c3=3500,l3=700,o3=450,r3=900,n3=20000,l4={pen:"#ef4444",rect:"#f59e0b",laser:"#ef4444"};var s3=/^[A-Za-z0-9_-]{1,32}$/,a3=/^#[0-9a-fA-F]{6}$/,t3=["pen","rect","laser"],d4=(z)=>z<0?0:z>1?1:z;function i4(z,J){if(!Array.isArray(z)||z.length<J||z.length>64)return null;let $=[];for(let j of z){if(!Array.isArray(j)||j.length!==2)return null;let[Q,Z]=j;if(typeof Q!=="number"||typeof Z!=="number"||!Number.isFinite(Q)||!Number.isFinite(Z))return null;$.push([d4(Q),d4(Z)])}return $}function H2(z){if(!z||typeof z!=="object")return null;let J=z;if(J.op==="clear")return{op:"clear"};if(typeof J.id!=="string"||!s3.test(J.id))return null;if(J.op==="end")return{op:"end",id:J.id};if(J.op==="add"){let $=i4(J.pts,1);return $?{op:"add",id:J.id,pts:$}:null}if(J.op==="begin"){if(!t3.includes(J.kind)||typeof J.color!=="string"||!a3.test(J.color))return null;let $=i4(J.pts,1);return $?{op:"begin",id:J.id,kind:J.kind,color:J.color,pts:$}:null}return null}function Y2(z,J){if(z.endedAt!==null)return z.endedAt;return J-z.lastAt>20000?z.lastAt:null}function K2(z,J,$){if(J===null)return 1;let j=$-J;if(z==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class P1{marks=new Map;apply(z,J=Date.now()){if(z.op==="clear"){this.marks.clear();return}if(z.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete(z.id),this.marks.set(z.id,{kind:z.kind,color:z.color,pts:z.pts.map(([j,Q])=>({x:j,y:Q,t:J})),endedAt:null,lastAt:J});return}let $=this.marks.get(z.id);if(!$||Y2($,J)!==null)return;if(z.op==="end"){$.endedAt=J;return}if($.lastAt=J,$.kind==="rect"){let[j,Q]=z.pts[z.pts.length-1];$.pts=[$.pts[0],{x:j,y:Q,t:J}];return}for(let[j,Q]of z.pts)$.pts.push({x:j,y:Q,t:J});if($.pts.length>4000)$.pts.splice(0,$.pts.length-4000)}alive(z=Date.now()){for(let[J,$]of this.marks)if(K2($.kind,Y2($,z),z)<=0)this.marks.delete(J);return this.marks.size>0}get size(){return this.marks.size}draw(z,J,$,j=Date.now()){z.clearRect(0,0,J,$);let Q=Math.max(1,Math.min(J,$));for(let Z of this.marks.values()){let V=K2(Z.kind,Y2(Z,j),j);if(V<=0||!Z.pts.length)continue;if(z.save(),z.lineCap="round",z.lineJoin="round",Z.kind==="pen")z5(z,Z,J,$,Math.max(3,Q*0.0045),V);else if(Z.kind==="rect")J5(z,Z,J,$,Math.max(2.5,Q*0.003),V);else $5(z,Z,J,$,Math.max(6,Q*0.008),V,j);z.restore()}}}function e3(z,J,$,j){if(z.beginPath(),z.moveTo(J[0].x*$,J[0].y*j),J.length===1){z.lineTo(J[0].x*$+0.01,J[0].y*j);return}for(let Z=1;Z<J.length-1;Z++){let V=J[Z],W=J[Z+1];z.quadraticCurveTo(V.x*$,V.y*j,(V.x+W.x)/2*$,(V.y+W.y)/2*j)}let Q=J[J.length-1];z.lineTo(Q.x*$,Q.y*j)}function z5(z,J,$,j,Q,Z){z.globalAlpha=Z,e3(z,J.pts,$,j),z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.stroke(),z.strokeStyle=J.color,z.lineWidth=Q,z.stroke()}function J5(z,J,$,j,Q,Z){let V=J.pts[0],W=J.pts[J.pts.length-1],G=Math.min(V.x,W.x)*$,U=Math.min(V.y,W.y)*j,M=Math.abs(W.x-V.x)*$,B=Math.abs(W.y-V.y)*j;z.globalAlpha=Z,z.fillStyle=J.color,z.globalAlpha=Z*0.14,z.fillRect(G,U,M,B),z.globalAlpha=Z,z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.strokeRect(G,U,M,B),z.strokeStyle=J.color,z.lineWidth=Q,z.strokeRect(G,U,M,B)}function $5(z,J,$,j,Q,Z,V){let W=J.pts.filter((U)=>V-U.t<=450);for(let U=1;U<W.length;U++){let M=W[U-1],B=W[U];z.globalAlpha=Z*Math.max(0,1-(V-B.t)/450)*0.7,z.strokeStyle=J.color,z.lineWidth=Q*0.9,z.beginPath(),z.moveTo(M.x*$,M.y*j),z.lineTo(B.x*$,B.y*j),z.stroke()}let G=J.pts[J.pts.length-1];z.globalAlpha=Z,z.shadowColor=J.color,z.shadowBlur=Q*2,z.fillStyle=J.color,z.beginPath(),z.arc(G.x*$,G.y*j,Q,0,Math.PI*2),z.fill(),z.shadowBlur=0,z.strokeStyle="rgba(255,255,255,0.95)",z.lineWidth=2,z.stroke()}function o4(z,J,$,j=typeof window>"u"?1:window.devicePixelRatio||1){let Q=Math.max(1,Math.round(J*j)),Z=Math.max(1,Math.round($*j));if(z.width!==Q)z.width=Q;if(z.height!==Z)z.height=Z;let V=z.getContext("2d");return V?.setTransform(j,0,0,j,0,0),V}class D1{canvas;scene;box;frame=0;constructor(z,J,$){this.canvas=z;this.scene=J;this.box=$}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let z=()=>{this.frame=0;let{w:J,h:$}=this.box(),j=o4(this.canvas,J,$),Q=Date.now(),Z=this.scene.alive(Q);if(j)this.scene.draw(j,J,$,Q);if(Z)this.frame=requestAnimationFrame(z)};this.frame=requestAnimationFrame(z)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var r4=33,G2=5000,c4=0.0012,j5=0,Q5=()=>`${Date.now().toString(36)}${(j5++).toString(36)}${Math.random().toString(36).slice(2,6)}`.slice(0,32);class n4{send;scene;onChange;id=null;kind=null;pending=[];last=null;lastSent=0;timer;keep;constructor(z,J,$=()=>{return}){this.send=z;this.scene=J;this.onChange=$}get drawing(){return this.id?this.kind:null}begin(z,J){this.end(),this.id=Q5(),this.kind=z,this.last=J,this.lastSent=Date.now();let $={op:"begin",id:this.id,kind:z,color:l4[z],pts:[J]};this.scene.apply($),this.send($),this.keep=setInterval(()=>this.stillHere(),G2),this.onChange()}stillHere(){if(!this.id||!this.last||Date.now()-this.lastSent<G2)return;this.flush();let z={op:"add",id:this.id,pts:[this.last]};this.scene.apply(z),this.send(z),this.lastSent=Date.now()}move(z){if(!this.id||!this.kind)return;if(Date.now()-this.lastSent>1e4)return this.begin(this.kind,z);if(this.last&&Math.abs(z[0]-this.last[0])<c4&&Math.abs(z[1]-this.last[1])<c4)return;if(this.last=z,this.scene.apply({op:"add",id:this.id,pts:[z]}),this.onChange(),this.kind==="rect")this.pending=[z];else this.pending.push(z);if(this.pending.length>=64)this.flush();else if(!this.timer)this.timer=setTimeout(()=>this.flush(),Math.max(0,r4-(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 z={op:"end",id:this.id};this.scene.apply(z),this.send(z),this.id=null,this.kind=null,this.last=null,this.onChange()}clear(){this.end();let z={op:"clear"};this.scene.apply(z),this.send(z),this.onChange()}}var Z5="lw-call-ink",K0=null,B1=null,i0=null;function X5(){if(K0?.isConnected&&i0)return;K0=document.createElement(Z5),K0.dataset.debugReporter="true";let z=K0.attachShadow({mode:"open"}),J=document.createElement("style");J.textContent=`:host { all: initial; }
325
- canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let $=document.createElement("canvas");$.setAttribute("aria-hidden","true"),$.dataset.lwCallInk="",z.append(J,$),document.body.append(K0),B1=new P1,i0=new D1($,B1,()=>({w:window.innerWidth,h:window.innerHeight}))}function s4(z){if(typeof document>"u")return;if(z.op==="clear"&&!K0)return;X5(),B1.apply(z),i0.kick()}function a4(){i0?.stop(),K0?.remove(),K0=null,B1=null,i0=null}var V5="lw-call-frame",W5="lw-call",i=16,P2=368,j0=null,b=null,q1=null,N1="",c0=null,l0="card",D2={width:P2,height:0},B2,U2=!1,H0=null,G0=null,F2="lw-call-frame-place";function t4(z,J,$,j){let Q=new URL("embed/call",z.endsWith("/")?z:`${z}/`);return Q.searchParams.set("realm",J),Q.searchParams.set("token",$),Q.searchParams.set("call",j),Q.toString()}function e4(z,J,$){return{x:Math.min(Math.max(z.x,i/2),Math.max(i/2,$.w-J.w-i/2)),y:Math.min(Math.max(z.y,i/2),Math.max(i/2,$.h-J.h-i/2))}}function Y5(z,J){if(z.origin!==J.origin||z.source!==J.window)return null;let $=z.data;return $&&typeof $==="object"&&$.source===W5&&typeof $.type==="string"?$:null}function o0(){return j0?.isConnected?q1:null}function z6(z,J,$,j=15000){if(typeof document>"u")return;if(q1===J&&j0?.isConnected)return;b0(),q1=J,c0=$,U2=!1,l0="card",D2={width:P2,height:0},N1=new URL(z).origin;try{H0=JSON.parse(sessionStorage.getItem(F2)??"null")}catch{H0=null}j0=document.createElement(V5),j0.dataset.debugReporter="true";let Q=j0.attachShadow({mode:"open"}),Z=document.createElement("style");Z.textContent=`:host { all: initial; }
324
+ `,d3='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><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"/></svg>',u=null,B0=null,x0=null;function i3(z,J){return z.replace("{key}",J.ticketKey).replace("{title}",J.ticketTitle)}var W2=()=>$0(O().locale);function c3(){if(typeof document>"u")return null;if(u?.isConnected)return u.shadowRoot;u=document.createElement(u3),u.dataset.debugReporter="true";let z=u.attachShadow({mode:"open"});return E0(z),document.body.append(u),z}function d4(z,J){if(B0===z.id&&u?.isConnected)return;let $=c3();if(!$)return;B0=z.id;let j=W2();$.innerHTML="";let Q=document.createElement("style");Q.textContent=p3;let Z=document.createElement("div");Z.className="card",Z.setAttribute("role","alertdialog"),Z.setAttribute("aria-label",j.ringTitle),Z.dataset.lwCallRing=z.id;let V=document.createElement("div");V.className="head";let W=document.createElement("span");W.className="icon",W.innerHTML=d3;let G=document.createElement("div"),U=document.createElement("h2");U.textContent=j.ringTitle;let M=document.createElement("p");M.className="about",M.textContent=i3(j.ringAbout,z),M.title=M.textContent,G.append(U,M),V.append(W,G);let B=document.createElement("p");B.className="how",B.textContent=j.ringHow;let N=document.createElement("div");N.className="actions";let A=document.createElement("button");A.type="button",A.className="decline",A.textContent=j.ringDecline,A.dataset.lwRing="decline",A.onclick=()=>J.decline();let S=document.createElement("button");if(S.type="button",S.className="open",S.textContent=j.ringOpen,S.dataset.lwRing="open",S.onclick=()=>J.open(),N.append(A,S),Z.append(V,B,N),$.append(Q,Z),l3(),x0===null)x0=document.title,document.title=`${j.ringTab} — ${x0}`;S.focus({preventScroll:!0})}function P1(z){let J=u?.shadowRoot;if(!J)return;K2(),c4();let $=W2(),j=J.querySelector(".how"),Q=J.querySelector(".actions");if(j)if(j.textContent="",z){let Z=document.createElement("a");Z.href=z,Z.target="_blank",Z.rel="noopener",Z.textContent=$.ringBlocked,Z.dataset.lwRing="link",Z.onclick=()=>window.setTimeout(()=>P1(),0),j.append(Z)}else j.textContent=$.ringOpened;if(Q){Q.innerHTML="";let Z=document.createElement("button");Z.type="button",Z.className="close",Z.textContent=$.ringClose,Z.dataset.lwRing="close",Z.onclick=()=>q0(),Q.append(Z)}}function Y2(z,J=!0){if(!u?.isConnected||B0!==z)return;u.style.display=J?"none":""}function q0(z){if(z&&B0&&z!==B0)return;K2(),c4(),u?.remove(),u=null,B0=null}function i4(){return u?.isConnected?B0:null}function c4(){if(x0===null||typeof document>"u")return;if(document.title.startsWith(W2().ringTab))document.title=x0;x0=null}var K0=null,V2;function l3(){K2();let z=window,J=z.AudioContext??z.webkitAudioContext;if(!J)return;try{let j=K0??new J;K0=j,j.resume?.().catch(()=>{return})}catch{return}let $=()=>{if(!K0||K0.state!=="running")return;let j=K0.currentTime;for(let[Q,Z]of[660,880].entries()){let V=K0.createOscillator(),W=K0.createGain();V.frequency.value=Z,W.gain.setValueAtTime(0.0001,j+Q*0.22),W.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),W.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),V.connect(W).connect(K0.destination),V.start(j+Q*0.22),V.stop(j+Q*0.22+0.21)}};$(),V2=setInterval($,2200)}function K2(){clearInterval(V2),V2=void 0}var o3=64,r3=3500,n3=700,s3=450,a3=900,t3=20000,n4={pen:"#ef4444",rect:"#f59e0b",laser:"#ef4444"};var e3=/^[A-Za-z0-9_-]{1,32}$/,z5=/^#[0-9a-fA-F]{6}$/,J5=["pen","rect","laser"],l4=(z)=>z<0?0:z>1?1:z;function o4(z,J){if(!Array.isArray(z)||z.length<J||z.length>64)return null;let $=[];for(let j of z){if(!Array.isArray(j)||j.length!==2)return null;let[Q,Z]=j;if(typeof Q!=="number"||typeof Z!=="number"||!Number.isFinite(Q)||!Number.isFinite(Z))return null;$.push([l4(Q),l4(Z)])}return $}function F2(z){if(!z||typeof z!=="object")return null;let J=z;if(J.op==="clear")return{op:"clear"};if(typeof J.id!=="string"||!e3.test(J.id))return null;if(J.op==="end")return{op:"end",id:J.id};if(J.op==="add"){let $=o4(J.pts,1);return $?{op:"add",id:J.id,pts:$}:null}if(J.op==="begin"){if(!J5.includes(J.kind)||typeof J.color!=="string"||!z5.test(J.color))return null;let $=o4(J.pts,1);return $?{op:"begin",id:J.id,kind:J.kind,color:J.color,pts:$}:null}return null}function G2(z,J){if(z.endedAt!==null)return z.endedAt;return J-z.lastAt>20000?z.lastAt:null}function H2(z,J,$){if(J===null)return 1;let j=$-J;if(z==="laser")return j>=900?0:1-j/900;if(j<=3500)return 1;return Math.max(0,1-(j-3500)/700)}class D1{marks=new Map;apply(z,J=Date.now()){if(z.op==="clear"){this.marks.clear();return}if(z.op==="begin"){while(this.marks.size>=120)this.marks.delete(this.marks.keys().next().value);this.marks.delete(z.id),this.marks.set(z.id,{kind:z.kind,color:z.color,pts:z.pts.map(([j,Q])=>({x:j,y:Q,t:J})),endedAt:null,lastAt:J});return}let $=this.marks.get(z.id);if(!$||G2($,J)!==null)return;if(z.op==="end"){$.endedAt=J;return}if($.lastAt=J,$.kind==="rect"){let[j,Q]=z.pts[z.pts.length-1];$.pts=[$.pts[0],{x:j,y:Q,t:J}];return}for(let[j,Q]of z.pts)$.pts.push({x:j,y:Q,t:J});if($.pts.length>4000)$.pts.splice(0,$.pts.length-4000)}alive(z=Date.now()){for(let[J,$]of this.marks)if(H2($.kind,G2($,z),z)<=0)this.marks.delete(J);return this.marks.size>0}get size(){return this.marks.size}draw(z,J,$,j=Date.now()){z.clearRect(0,0,J,$);let Q=Math.max(1,Math.min(J,$));for(let Z of this.marks.values()){let V=H2(Z.kind,G2(Z,j),j);if(V<=0||!Z.pts.length)continue;if(z.save(),z.lineCap="round",z.lineJoin="round",Z.kind==="pen")j5(z,Z,J,$,Math.max(3,Q*0.0045),V);else if(Z.kind==="rect")Q5(z,Z,J,$,Math.max(2.5,Q*0.003),V);else Z5(z,Z,J,$,Math.max(6,Q*0.008),V,j);z.restore()}}}function $5(z,J,$,j){if(z.beginPath(),z.moveTo(J[0].x*$,J[0].y*j),J.length===1){z.lineTo(J[0].x*$+0.01,J[0].y*j);return}for(let Z=1;Z<J.length-1;Z++){let V=J[Z],W=J[Z+1];z.quadraticCurveTo(V.x*$,V.y*j,(V.x+W.x)/2*$,(V.y+W.y)/2*j)}let Q=J[J.length-1];z.lineTo(Q.x*$,Q.y*j)}function j5(z,J,$,j,Q,Z){z.globalAlpha=Z,$5(z,J.pts,$,j),z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.stroke(),z.strokeStyle=J.color,z.lineWidth=Q,z.stroke()}function Q5(z,J,$,j,Q,Z){let V=J.pts[0],W=J.pts[J.pts.length-1],G=Math.min(V.x,W.x)*$,U=Math.min(V.y,W.y)*j,M=Math.abs(W.x-V.x)*$,B=Math.abs(W.y-V.y)*j;z.globalAlpha=Z,z.fillStyle=J.color,z.globalAlpha=Z*0.14,z.fillRect(G,U,M,B),z.globalAlpha=Z,z.strokeStyle="rgba(255,255,255,0.92)",z.lineWidth=Q+3,z.strokeRect(G,U,M,B),z.strokeStyle=J.color,z.lineWidth=Q,z.strokeRect(G,U,M,B)}function Z5(z,J,$,j,Q,Z,V){let W=J.pts.filter((U)=>V-U.t<=450);for(let U=1;U<W.length;U++){let M=W[U-1],B=W[U];z.globalAlpha=Z*Math.max(0,1-(V-B.t)/450)*0.7,z.strokeStyle=J.color,z.lineWidth=Q*0.9,z.beginPath(),z.moveTo(M.x*$,M.y*j),z.lineTo(B.x*$,B.y*j),z.stroke()}let G=J.pts[J.pts.length-1];z.globalAlpha=Z,z.shadowColor=J.color,z.shadowBlur=Q*2,z.fillStyle=J.color,z.beginPath(),z.arc(G.x*$,G.y*j,Q,0,Math.PI*2),z.fill(),z.shadowBlur=0,z.strokeStyle="rgba(255,255,255,0.95)",z.lineWidth=2,z.stroke()}function s4(z,J,$,j=typeof window>"u"?1:window.devicePixelRatio||1){let Q=Math.max(1,Math.round(J*j)),Z=Math.max(1,Math.round($*j));if(z.width!==Q)z.width=Q;if(z.height!==Z)z.height=Z;let V=z.getContext("2d");return V?.setTransform(j,0,0,j,0,0),V}class B1{canvas;scene;box;frame=0;constructor(z,J,$){this.canvas=z;this.scene=J;this.box=$}kick(){if(this.frame||typeof requestAnimationFrame>"u")return;let z=()=>{this.frame=0;let{w:J,h:$}=this.box(),j=s4(this.canvas,J,$),Q=Date.now(),Z=this.scene.alive(Q);if(j)this.scene.draw(j,J,$,Q);if(Z)this.frame=requestAnimationFrame(z)};this.frame=requestAnimationFrame(z)}stop(){if(this.frame&&typeof cancelAnimationFrame<"u")cancelAnimationFrame(this.frame);this.frame=0}}var a4=33,U2=5000,r4=0.0012,X5=0,V5=()=>`${Date.now().toString(36)}${(X5++).toString(36)}${Math.random().toString(36).slice(2,6)}`.slice(0,32);class t4{send;scene;onChange;id=null;kind=null;pending=[];last=null;lastSent=0;timer;keep;constructor(z,J,$=()=>{return}){this.send=z;this.scene=J;this.onChange=$}get drawing(){return this.id?this.kind:null}begin(z,J){this.end(),this.id=V5(),this.kind=z,this.last=J,this.lastSent=Date.now();let $={op:"begin",id:this.id,kind:z,color:n4[z],pts:[J]};this.scene.apply($),this.send($),this.keep=setInterval(()=>this.stillHere(),U2),this.onChange()}stillHere(){if(!this.id||!this.last||Date.now()-this.lastSent<U2)return;this.flush();let z={op:"add",id:this.id,pts:[this.last]};this.scene.apply(z),this.send(z),this.lastSent=Date.now()}move(z){if(!this.id||!this.kind)return;if(Date.now()-this.lastSent>1e4)return this.begin(this.kind,z);if(this.last&&Math.abs(z[0]-this.last[0])<r4&&Math.abs(z[1]-this.last[1])<r4)return;if(this.last=z,this.scene.apply({op:"add",id:this.id,pts:[z]}),this.onChange(),this.kind==="rect")this.pending=[z];else this.pending.push(z);if(this.pending.length>=64)this.flush();else if(!this.timer)this.timer=setTimeout(()=>this.flush(),Math.max(0,a4-(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 z={op:"end",id:this.id};this.scene.apply(z),this.send(z),this.id=null,this.kind=null,this.last=null,this.onChange()}clear(){this.end();let z={op:"clear"};this.scene.apply(z),this.send(z),this.onChange()}}var W5="lw-call-ink",G0=null,q1=null,i0=null;function Y5(){if(G0?.isConnected&&i0)return;G0=document.createElement(W5),G0.dataset.debugReporter="true";let z=G0.attachShadow({mode:"open"}),J=document.createElement("style");J.textContent=`:host { all: initial; }
325
+ canvas { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483002; }`;let $=document.createElement("canvas");$.setAttribute("aria-hidden","true"),$.dataset.lwCallInk="",z.append(J,$),document.body.append(G0),q1=new D1,i0=new B1($,q1,()=>({w:window.innerWidth,h:window.innerHeight}))}function e4(z){if(typeof document>"u")return;if(z.op==="clear"&&!G0)return;Y5(),q1.apply(z),i0.kick()}function z6(){i0?.stop(),G0?.remove(),G0=null,q1=null,i0=null}var K5="lw-call-frame",G5="lw-call",c=16,q2=368,Q0=null,b=null,M1=null,C1="",l0=null,o0="card",M2={width:q2,height:0},N2,P2=!1,H0=null,p=null,D2="lw-call-frame-place";function J6(z,J,$,j){let Q=new URL("embed/call",z.endsWith("/")?z:`${z}/`);return Q.searchParams.set("realm",J),Q.searchParams.set("token",$),Q.searchParams.set("call",j),Q.toString()}function $6(z,J,$){return{x:Math.min(Math.max(z.x,c/2),Math.max(c/2,$.w-J.w-c/2)),y:Math.min(Math.max(z.y,c/2),Math.max(c/2,$.h-J.h-c/2))}}function H5(z,J){if(z.origin!==J.origin||z.source!==J.window)return null;let $=z.data;return $&&typeof $==="object"&&$.source===G5&&typeof $.type==="string"?$:null}function r0(){return Q0?.isConnected?M1:null}function j6(z,J,$,j=15000){if(typeof document>"u")return;if(M1===J&&Q0?.isConnected)return;b0(),M1=J,l0=$,P2=!1,o0="card",M2={width:q2,height:0},C1=new URL(z).origin;try{H0=JSON.parse(sessionStorage.getItem(D2)??"null")}catch{H0=null}Q0=document.createElement(K5),Q0.dataset.debugReporter="true";let Q=Q0.attachShadow({mode:"open"}),Z=document.createElement("style");Z.textContent=`:host { all: initial; }
326
326
  iframe { position: fixed; z-index: 2147483003; border: 0; background: transparent; color-scheme: normal; visibility: hidden; }
327
- iframe.on { visibility: visible; }`,b=document.createElement("iframe"),b.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",b.title="สายจากทีมงาน",b.dataset.lwCallFrame=J,b.setAttribute("allowtransparency","true"),b.src=z,Q.append(Z,b),document.body.append(j0),x0(),window.addEventListener("message",$6),window.addEventListener("resize",x0),j6(`lw-call:${J}`),B2=setTimeout(()=>{if(!U2)J6("timeout")},j)}function b0(){if(j0)j6(null);a4(),clearTimeout(B2),window.removeEventListener("message",$6),window.removeEventListener("resize",x0),j0?.remove(),j0=null,b=null,q1=null,c0=null,G0=null}function J6(z){let J=c0;b0(),J?.failed(z)}function $6(z){if(!b)return;let J=Y5(z,{origin:N1,window:b.contentWindow});if(!J)return;switch(J.type){case"ready":U2=!0,clearTimeout(B2),b.classList.add("on"),c0?.ready();return;case"size":if(typeof J.width==="number"&&typeof J.height==="number")D2={width:J.width,height:J.height};if(J.layout==="card"||J.layout==="full"){if(J.layout==="full"&&l0==="card")G5();l0=J.layout}return x0();case"drag":return K5(J);case"home":return H0=null,Q6(),x0();case"done":{let $=c0;b0(),$?.done();return}case"failed":return J6(J.reason??"failed");case"ink":{let $=H2(J.op);if($)s4($);return}}}function j6(z){let J=typeof navigator>"u"?void 0:navigator.mediaDevices;try{J?.setCaptureHandleConfig?.(z?{handle:z,exposeOrigin:!1,permittedOrigins:[N1]}:{})}catch{}}function K5(z){if(!b||l0!=="card"||typeof z.x!=="number"||typeof z.y!=="number")return;if(z.phase==="start"){let J=b.getBoundingClientRect();G0={sx:z.x,sy:z.y,x:J.left,y:J.top};return}if(!G0)return;if(H0=e4({x:G0.x+(z.x-G0.sx),y:G0.y+(z.y-G0.sy)},Z6(),M1()),x0(),z.phase==="end")G0=null,Q6()}function G5(){if(!b?.contentWindow)return;let z=b.getBoundingClientRect();b.contentWindow.postMessage({source:"lw-call-host",type:"corner",x:Math.round(z.left),y:Math.round(z.top),width:Math.round(z.width)},N1)}function Q6(){try{if(H0)sessionStorage.setItem(F2,JSON.stringify(H0));else sessionStorage.removeItem(F2)}catch{}}var M1=()=>({w:window.innerWidth,h:window.innerHeight});function Z6(){let z=M1();return{w:Math.min(P2,z.w-i),h:Math.min(D2.height||0,z.h-i)}}function x0(){if(!b)return;let z=b.style;if(l0==="full"){Object.assign(z,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let J=Z6(),$=M1().w<480;if(z.width=$?`calc(100vw - ${i}px)`:`${J.w}px`,z.height=`${J.h}px`,H0&&!$){let j=e4(H0,J,M1());Object.assign(z,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(z,{left:$?`${i/2}px`:"",top:"",right:$?"":`${i/2}px`,bottom:`${i/2}px`})}var I1=[2000,5000,15000,30000,60000],H5=new Set(["ringing","active"]),U5=20000,M2=!1,M0=!1,X6=0,F5=5,n0=null,Y6=0,C1,N2,I2,K6=(z)=>z.endsWith("/")?z:`${z}/`;function P5(z,J){let $=new URL("api/presence/ws",K6(z));return $.protocol=$.protocol==="https:"?"wss:":"ws:",$.searchParams.set("t",J),$.toString()}function D5(z){return`/me/tickets/${z.ticketId}?call=${z.id}`}function B5(z){return z.status==="ringing"&&(z.side==="reporter"||z.side===void 0||z.side===null)}async function _1(){let z=O().identity;if(!z)return null;try{return await z()??null}catch{return null}}async function O2(z,J){let $=O();return fetch(new URL(z,K6($.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,authorization:`Bearer ${J}`},body:"{}"})}function S1(){if(M2||typeof window>"u"||typeof WebSocket>"u")return;let z=O();if(!z.identity||z.ring===!1)return;M2=!0,M0=!1,G6()}function q5(){M0=!0,M2=!1,clearTimeout(N2),clearInterval(C1),clearTimeout(I2);try{n0?.close(1000,"bye")}catch{}n0=null,q0(),b0()}function r0(z=!1){if(M0)return;let J=z?I1[I1.length-1]:I1[Math.min(Y6++,I1.length-1)];clearTimeout(N2),N2=setTimeout(()=>void G6(),J)}async function G6(){if(M0)return;let z=await _1();if(!z){if(++X6>=F5){M0=!0;return}return r0(!0)}X6=0;let J;try{J=await O2("ingest/live-ticket",z)}catch{return r0()}if(J.status===401||J.status===404||J.status===403){M0=!0;return}if(!J.ok)return r0(J.status===429);let $;try{$=await J.json()}catch{return r0()}if(!$.calls||!$.ticket){M0=!0;return}if($.call)W6($.call);let j=new WebSocket(P5(O().host,$.ticket));n0=j,j.onopen=()=>{Y6=0,clearInterval(C1),C1=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},U5)},j.onmessage=(Q)=>{try{let Z=JSON.parse(String(Q.data));if(Z.type==="call-state"&&Z.call)W6(Z.call)}catch{}},j.onclose=()=>{if(clearInterval(C1),n0===j)n0=null;r0()}}var C2="lw-call-framed";function M5(){try{return sessionStorage.getItem(C2)}catch{return null}}function O1(z){try{if(z)sessionStorage.setItem(C2,z);else sessionStorage.removeItem(C2)}catch{}}var q2=null;async function V6(z){let J=O();if(J.callFrame===!1||o0()===z.id||q2===z.id)return;q2=z.id;let $=await _1();if(q2=null,!$)return;O1(z.id),z6(t4(J.host,J.realmKey,$,z.id),z.id,{ready:()=>V2(z.id),done:()=>{O1(null),q0(z.id)},failed:()=>{O1(null),V2(z.id,!1)}})}function W6(z){if(!B5(z)){if(q0(z.id),z.status==="active"&&M5()===z.id&&!o0())V6(z);if(!H5.has(z.status)&&o0()===z.id)setTimeout(()=>{if(o0()===z.id)b0(),O1(null)},12000);return}m4(z,{open:()=>N5(z),decline:()=>void I5(z)}),V6(z),clearTimeout(I2);let J=new Date(z.ringUntil).getTime()-Date.now();I2=setTimeout(()=>{if(u4()===z.id)q0(z.id)},Math.max(5000,J+5000))}function N5(z){let J=window.open("about:blank","_blank");(async()=>{let $=await _1();if($)O2(`ingest/calls/${z.id}/coming`,$).catch(()=>{return});let j;try{j=await v4(D5(z))}catch{J?.close();return}if(J&&!J.closed){J.location.href=j;try{J.opener=null}catch{}F1()}else F1(j)})()}async function I5(z){q0(z.id);let J=await _1();if(J)await O2(`ingest/calls/${z.id}/decline`,J).catch(()=>{return})}var H6=!1;function C5(z={}){if(H6||typeof window>"u")return;if(!g0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(H6=!0,X4(),d2(),y2(),a2(),W4(),z.ui===!1)return;let J=J0(O().locale);if(h1((j)=>{P0(j.message??J.crashed,"error",{label:J.crashAction,onClick:()=>g1(j)})}),j2(),!document.querySelector(f0))document.body.append(document.createElement(f0));let $=window.requestIdleCallback;if($)$(()=>void D0(),{timeout:5000});else setTimeout(()=>void D0(),2000);if($)$(()=>S1(),{timeout:8000});else setTimeout(()=>S1(),3000)}var O5=new Set(["error","exception","unhandledrejection"]);function U6(z){if(z.error)return!0;return z.status!==null&&z.status>=400}function _2(z){if(!z)return null;let J=Date.parse(z);return Number.isNaN(J)?null:J}function _5(z){try{let{pathname:J}=new URL(z,"http://x");try{return decodeURIComponent(J)}catch{return J}}catch{return z.split(/[?#]/)[0]??z}}function S5(z,J,$){let j=(V)=>({elapsedMs:V,requests:[],failedRequests:[],consoleErrors:[],slowestMs:null});if(z.length===0)return[];let Q=z.map((V)=>_2(V.at)),Z=(V)=>{for(let W=V+1;W<Q.length;W+=1){let G=Q[W];if(G!=null)return G}return Number.POSITIVE_INFINITY};return z.map((V,W)=>{let G=Q[W]??null,U=(W>0?Q[W-1]:null)??null,M=G!==null&&U!==null?Math.max(0,G-U):null;if(G===null)return j(M);let B=G,N=Math.max(B,Z(W)),A=(I)=>I!==null&&I>=B&&(I<N||N===Number.POSITIVE_INFINITY),S=J.filter((I)=>A(_2(I.startedAt))),g=$.filter((I)=>O5.has(I.level)&&A(_2(I.at))),m=S.map((I)=>I.durationMs).filter((I)=>typeof I==="number");return{elapsedMs:M,requests:S,failedRequests:S.filter(U6),consoleErrors:g,slowestMs:m.length>0?Math.max(...m):null}})}function L5(z,J){return z.requests.length===0&&z.consoleErrors.length===0&&(z.elapsedMs===null||z.elapsedMs<J)}function R5(z){if(z<1000)return`${Math.round(z)} มิลลิวินาที`;let J=z/1000;if(J<10)return`${J.toFixed(1)} วิ`;if(J<60)return`${Math.round(J)} วิ`;let $=Math.floor(J/60),j=Math.round(J%60);return j===0?`${$} นาที`:`${$} นาที ${j} วิ`}export{c1 as trimToBudget,U4 as toCurl,m1 as takeReplay,y4 as supportPortalUrl,a1 as submitRequest,n1 as submitBundle,k8 as stopReplay,q5 as stopLiveRing,S1 as startLiveRing,o4 as sizeInkCanvas,P0 as showToast,R3 as setErroredQueriesSource,W1 as requestTypesNow,_5 as requestPath,J0 as reporterStrings,z0 as redactUrl,S0 as redactLabel,L0 as redactHeaders,R0 as redactBody,H2 as readInkOp,o1 as packReplay,h3 as openSupportPortal,b1 as onLaunch,h1 as onCrash,C6 as moduleResolver,D0 as loadRequestTypes,g1 as launch,A8 as isReplayRecording,L5 as isQuietStep,U6 as isFailedRequest,g0 as isConfigured,C5 as installDebugCapture,K2 as inkAlpha,r8 as hasCause,v1 as getNetworkLog,x1 as getConsoleLog,O as getConfig,f1 as getActionTrail,R5 as formatDuration,d1 as errorSignature,y1 as emitCrash,j2 as defineReporterElement,z2 as createAnnotator,S5 as correlateActionTrail,B6 as configureDebugCapture,Q1 as captureScreen,c8 as bundleToMarkdown,o8 as bundleFileName,m0 as buildBundle,t as appInfo,T1 as actionCountSuffix,f0 as REPORTER_TAG,B4 as REPLAY_FILENAME,_0 as REDACTED,U1 as NoIdentityError,o3 as LASER_TRAIL_MS,r3 as LASER_LINGER_MS,n4 as InkSender,P1 as InkScene,D1 as InkPainter,n3 as INK_STALE_MS,r4 as INK_SEND_EVERY_MS,i3 as INK_MAX_POINTS_PER_OP,G2 as INK_KEEP_MS,c3 as INK_HOLD_MS,l3 as INK_FADE_MS,l4 as INK_COLORS,i1 as BUNDLE_BUDGET_BYTES};
327
+ iframe.on { visibility: visible; }`,b=document.createElement("iframe"),b.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",b.title="สายจากทีมงาน",b.dataset.lwCallFrame=J,b.setAttribute("allowtransparency","true"),b.src=z,Q.append(Z,b),document.body.append(Q0),w0(),window.addEventListener("message",Z6),window.addEventListener("resize",w0),X6(`lw-call:${J}`),N2=setTimeout(()=>{if(!P2)Q6("timeout")},j)}function b0(){if(Q0)X6(null);z6(),clearTimeout(N2),window.removeEventListener("message",Z6),window.removeEventListener("resize",w0),N1(!1),Q0?.remove(),Q0=null,b=null,M1=null,l0=null,p=null}function Q6(z){let J=l0;b0(),J?.failed(z)}function Z6(z){if(!b)return;let J=H5(z,{origin:C1,window:b.contentWindow});if(!J)return;switch(J.type){case"ready":P2=!0,clearTimeout(N2),b.classList.add("on"),l0?.ready();return;case"size":if(typeof J.width==="number"&&typeof J.height==="number")M2={width:J.width,height:J.height};if(J.layout==="card"||J.layout==="full"){if(J.layout==="full"&&o0==="card")U5();o0=J.layout}return w0();case"drag":return B2(J);case"home":return H0=null,V6(),w0();case"done":{let $=l0;b0(),$?.done();return}case"failed":return Q6(J.reason??"failed");case"ink":{let $=F2(J.op);if($)e4($);return}}}function X6(z){let J=typeof navigator>"u"?void 0:navigator.mediaDevices;try{J?.setCaptureHandleConfig?.(z?{handle:z,exposeOrigin:!1,permittedOrigins:[C1]}:{})}catch{}}function B2(z){if(!b||o0!=="card"||typeof z.x!=="number"||typeof z.y!=="number")return;if(z.phase==="start"){let J=b.getBoundingClientRect();p={sx:z.x,sy:z.y,x:J.left,y:J.top,lx:z.x,ly:z.y},N1(!0);return}if(!p)return;if(p.lx=z.x,p.ly=z.y,H0=$6({x:p.x+(z.x-p.sx),y:p.y+(z.y-p.sy)},W6(),I1()),w0(),z.phase==="end")p=null,N1(!1),V6()}var c0=null;function N1(z){if(c0){for(let J of["pointermove","pointerup","pointercancel"])window.removeEventListener(J,c0,!0);c0=null}if(!z)return;c0=(J)=>{if(!p)return N1(!1);if(J.type==="pointermove"&&J.buttons!==0)return B2({type:"drag",phase:"move",x:J.screenX,y:J.screenY});let $=J.type==="pointerup";B2({type:"drag",phase:"end",x:$?J.screenX:p.lx,y:$?J.screenY:p.ly})};for(let J of["pointermove","pointerup","pointercancel"])window.addEventListener(J,c0,!0)}function U5(){if(!b?.contentWindow)return;let z=b.getBoundingClientRect();b.contentWindow.postMessage({source:"lw-call-host",type:"corner",x:Math.round(z.left),y:Math.round(z.top),width:Math.round(z.width)},C1)}function V6(){try{if(H0)sessionStorage.setItem(D2,JSON.stringify(H0));else sessionStorage.removeItem(D2)}catch{}}var I1=()=>({w:window.innerWidth,h:window.innerHeight});function W6(){let z=I1();return{w:Math.min(q2,z.w-c),h:Math.min(M2.height||0,z.h-c)}}function w0(){if(!b)return;let z=b.style;if(o0==="full"){Object.assign(z,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let J=W6(),$=I1().w<480;if(z.width=$?`calc(100vw - ${c}px)`:`${J.w}px`,z.height=`${J.h}px`,H0&&!$){let j=$6(H0,J,I1());Object.assign(z,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(z,{left:$?`${c/2}px`:"",top:"",right:$?"":`${c/2}px`,bottom:`${c/2}px`})}var O1=[2000,5000,15000,30000,60000],F5=new Set(["ringing","active"]),P5=20000,C2=!1,M0=!1,Y6=0,D5=5,s0=null,H6=0,_1,O2,_2,U6=(z)=>z.endsWith("/")?z:`${z}/`;function B5(z,J){let $=new URL("api/presence/ws",U6(z));return $.protocol=$.protocol==="https:"?"wss:":"ws:",$.searchParams.set("t",J),$.toString()}function q5(z){return`/me/tickets/${z.ticketId}?call=${z.id}`}function M5(z){return z.status==="ringing"&&(z.side==="reporter"||z.side===void 0||z.side===null)}async function L1(){let z=O().identity;if(!z)return null;try{return await z()??null}catch{return null}}async function L2(z,J){let $=O();return fetch(new URL(z,U6($.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,authorization:`Bearer ${J}`},body:"{}"})}function R1(){if(C2||typeof window>"u"||typeof WebSocket>"u")return;let z=O();if(!z.identity||z.ring===!1)return;C2=!0,M0=!1,F6()}function N5(){M0=!0,C2=!1,clearTimeout(O2),clearInterval(_1),clearTimeout(_2);try{s0?.close(1000,"bye")}catch{}s0=null,q0(),b0()}function n0(z=!1){if(M0)return;let J=z?O1[O1.length-1]:O1[Math.min(H6++,O1.length-1)];clearTimeout(O2),O2=setTimeout(()=>void F6(),J)}async function F6(){if(M0)return;let z=await L1();if(!z){if(++Y6>=D5){M0=!0;return}return n0(!0)}Y6=0;let J;try{J=await L2("ingest/live-ticket",z)}catch{return n0()}if(J.status===401||J.status===404||J.status===403){M0=!0;return}if(!J.ok)return n0(J.status===429);let $;try{$=await J.json()}catch{return n0()}if(!$.calls||!$.ticket){M0=!0;return}if($.call)G6($.call);let j=new WebSocket(B5(O().host,$.ticket));s0=j,j.onopen=()=>{H6=0,clearInterval(_1),_1=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},P5)},j.onmessage=(Q)=>{try{let Z=JSON.parse(String(Q.data));if(Z.type==="call-state"&&Z.call)G6(Z.call)}catch{}},j.onclose=()=>{if(clearInterval(_1),s0===j)s0=null;n0()}}var S2="lw-call-framed";function I5(){try{return sessionStorage.getItem(S2)}catch{return null}}function S1(z){try{if(z)sessionStorage.setItem(S2,z);else sessionStorage.removeItem(S2)}catch{}}var I2=null;async function K6(z){let J=O();if(J.callFrame===!1||r0()===z.id||I2===z.id)return;I2=z.id;let $=await L1();if(I2=null,!$)return;S1(z.id),j6(J6(J.host,J.realmKey,$,z.id),z.id,{ready:()=>Y2(z.id),done:()=>{S1(null),q0(z.id)},failed:()=>{S1(null),Y2(z.id,!1)}})}function G6(z){if(!M5(z)){if(q0(z.id),z.status==="active"&&I5()===z.id&&!r0())K6(z);if(!F5.has(z.status)&&r0()===z.id)setTimeout(()=>{if(r0()===z.id)b0(),S1(null)},12000);return}d4(z,{open:()=>C5(z),decline:()=>void O5(z)}),K6(z),clearTimeout(_2);let J=new Date(z.ringUntil).getTime()-Date.now();_2=setTimeout(()=>{if(i4()===z.id)q0(z.id)},Math.max(5000,J+5000))}function C5(z){let J=window.open("about:blank","_blank");(async()=>{let $=await L1();if($)L2(`ingest/calls/${z.id}/coming`,$).catch(()=>{return});let j;try{j=await p4(q5(z))}catch{J?.close();return}if(J&&!J.closed){J.location.href=j;try{J.opener=null}catch{}P1()}else P1(j)})()}async function O5(z){q0(z.id);let J=await L1();if(J)await L2(`ingest/calls/${z.id}/decline`,J).catch(()=>{return})}var P6=!1;function _5(z={}){if(P6||typeof window>"u")return;if(!g0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(P6=!0,Y4(),l2(),u2(),z4(),G4(),z.ui===!1)return;let J=$0(O().locale);if(v1((j)=>{P0(j.message??J.crashed,"error",{label:J.crashAction,onClick:()=>y1(j)})}),Z2(),!document.querySelector(f0))document.body.append(document.createElement(f0));let $=window.requestIdleCallback;if($)$(()=>void D0(),{timeout:5000});else setTimeout(()=>void D0(),2000);if($)$(()=>R1(),{timeout:8000});else setTimeout(()=>R1(),3000)}var S5=new Set(["error","exception","unhandledrejection"]);function D6(z){if(z.error)return!0;return z.status!==null&&z.status>=400}function R2(z){if(!z)return null;let J=Date.parse(z);return Number.isNaN(J)?null:J}function L5(z){try{let{pathname:J}=new URL(z,"http://x");try{return decodeURIComponent(J)}catch{return J}}catch{return z.split(/[?#]/)[0]??z}}function R5(z,J,$){let j=(V)=>({elapsedMs:V,requests:[],failedRequests:[],consoleErrors:[],slowestMs:null});if(z.length===0)return[];let Q=z.map((V)=>R2(V.at)),Z=(V)=>{for(let W=V+1;W<Q.length;W+=1){let G=Q[W];if(G!=null)return G}return Number.POSITIVE_INFINITY};return z.map((V,W)=>{let G=Q[W]??null,U=(W>0?Q[W-1]:null)??null,M=G!==null&&U!==null?Math.max(0,G-U):null;if(G===null)return j(M);let B=G,N=Math.max(B,Z(W)),A=(I)=>I!==null&&I>=B&&(I<N||N===Number.POSITIVE_INFINITY),S=J.filter((I)=>A(R2(I.startedAt))),g=$.filter((I)=>S5.has(I.level)&&A(R2(I.at))),m=S.map((I)=>I.durationMs).filter((I)=>typeof I==="number");return{elapsedMs:M,requests:S,failedRequests:S.filter(D6),consoleErrors:g,slowestMs:m.length>0?Math.max(...m):null}})}function A5(z,J){return z.requests.length===0&&z.consoleErrors.length===0&&(z.elapsedMs===null||z.elapsedMs<J)}function k5(z){if(z<1000)return`${Math.round(z)} มิลลิวินาที`;let J=z/1000;if(J<10)return`${J.toFixed(1)} วิ`;if(J<60)return`${Math.round(J)} วิ`;let $=Math.floor(J/60),j=Math.round(J%60);return j===0?`${$} นาที`:`${$} นาที ${j} วิ`}export{o1 as trimToBudget,D4 as toCurl,p1 as takeReplay,u4 as supportPortalUrl,e1 as submitRequest,a1 as submitBundle,f8 as stopReplay,N5 as stopLiveRing,R1 as startLiveRing,s4 as sizeInkCanvas,P0 as showToast,T3 as setErroredQueriesSource,Y1 as requestTypesNow,L5 as requestPath,$0 as reporterStrings,J0 as redactUrl,S0 as redactLabel,L0 as redactHeaders,R0 as redactBody,F2 as readInkOp,n1 as packReplay,m3 as openSupportPortal,h1 as onLaunch,v1 as onCrash,S6 as moduleResolver,D0 as loadRequestTypes,y1 as launch,E8 as isReplayRecording,A5 as isQuietStep,D6 as isFailedRequest,g0 as isConfigured,_5 as installDebugCapture,H2 as inkAlpha,a8 as hasCause,u1 as getNetworkLog,g1 as getConsoleLog,O as getConfig,w1 as getActionTrail,k5 as formatDuration,c1 as errorSignature,m1 as emitCrash,Z2 as defineReporterElement,$2 as createAnnotator,R5 as correlateActionTrail,N6 as configureDebugCapture,Z1 as captureScreen,r8 as bundleToMarkdown,s8 as bundleFileName,m0 as buildBundle,e as appInfo,f1 as actionCountSuffix,f0 as REPORTER_TAG,N4 as REPLAY_FILENAME,_0 as REDACTED,F1 as NoIdentityError,s3 as LASER_TRAIL_MS,a3 as LASER_LINGER_MS,t4 as InkSender,D1 as InkScene,B1 as InkPainter,t3 as INK_STALE_MS,a4 as INK_SEND_EVERY_MS,o3 as INK_MAX_POINTS_PER_OP,U2 as INK_KEEP_MS,r3 as INK_HOLD_MS,n3 as INK_FADE_MS,n4 as INK_COLORS,l1 as BUNDLE_BUDGET_BYTES};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightworkai.official/debug-capture",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "Report-a-problem widget: rolling network/console/action capture, optional rrweb session replay, annotated screenshot, and submission to a Lightwork Support host",
5
5
  "type": "module",
6
6
  "module": "./dist/index.mjs",
@@ -59,7 +59,8 @@ let readyTimer: ReturnType<typeof setTimeout> | undefined;
59
59
  let isReady = false;
60
60
  /** Where the corner was moved to (left, top), or null: bottom right. Kept for this tab. */
61
61
  let placed: { x: number; y: number } | null = null;
62
- let drag: { sx: number; sy: number; x: number; y: number } | null = null;
62
+ /** A drag of the call's top line: where the press began (screen), where the frame was, and the last place it was moved to. */
63
+ let drag: { sx: number; sy: number; x: number; y: number; lx: number; ly: number } | null = null;
63
64
  const PLACE_KEY = "lw-call-frame-place";
64
65
 
65
66
  /** The support host's page for this call. Pure, for the tests. */
@@ -138,6 +139,7 @@ export function closeCallFrame(): void {
138
139
  clearTimeout(readyTimer);
139
140
  window.removeEventListener("message", onMessage);
140
141
  window.removeEventListener("resize", place);
142
+ followHere(false);
141
143
  host?.remove();
142
144
  host = null;
143
145
  frame = null;
@@ -214,18 +216,46 @@ function onDrag(m: FrameMessage): void {
214
216
  if (!frame || layout !== "card" || typeof m.x !== "number" || typeof m.y !== "number") return;
215
217
  if (m.phase === "start") {
216
218
  const r = frame.getBoundingClientRect();
217
- drag = { sx: m.x, sy: m.y, x: r.left, y: r.top };
219
+ drag = { sx: m.x, sy: m.y, x: r.left, y: r.top, lx: m.x, ly: m.y };
220
+ followHere(true);
218
221
  return;
219
222
  }
220
223
  if (!drag) return;
224
+ drag.lx = m.x;
225
+ drag.ly = m.y;
221
226
  placed = clampTo({ x: drag.x + (m.x - drag.sx), y: drag.y + (m.y - drag.sy) }, boxOf(), viewOf());
222
227
  place();
223
228
  if (m.phase === "end") {
224
229
  drag = null;
230
+ followHere(false);
225
231
  savePlace();
226
232
  }
227
233
  }
228
234
 
235
+ /**
236
+ * This page's own pointer, while the call is dragged (0.17.1). The press is in the frame and the frame hears the moves
237
+ * — until a quick flick leaves it on the first one (measured on the folded call, 62 px tall: a 30 px first step), and
238
+ * from then on only this page hears the pointer. So it is followed here too, in the same screen coordinates; whichever
239
+ * hears a move, the frame goes there. A move with no button down is a release this page never heard: the drag ends
240
+ * where it last was — never where the pointer happens to be.
241
+ */
242
+ let hostFollow: ((e: PointerEvent) => void) | null = null;
243
+ function followHere(on: boolean): void {
244
+ if (hostFollow) {
245
+ for (const t of ["pointermove", "pointerup", "pointercancel"] as const) window.removeEventListener(t, hostFollow, true);
246
+ hostFollow = null;
247
+ }
248
+ if (!on) return;
249
+ hostFollow = (e: PointerEvent) => {
250
+ if (!drag) return followHere(false);
251
+ if (e.type === "pointermove" && e.buttons !== 0) return onDrag({ type: "drag", phase: "move", x: e.screenX, y: e.screenY });
252
+ // Let go here — or let go somewhere unheard and only hovering now: ended where it last was, unless released here.
253
+ const released = e.type === "pointerup";
254
+ onDrag({ type: "drag", phase: "end", x: released ? e.screenX : drag.lx, y: released ? e.screenY : drag.ly });
255
+ };
256
+ for (const t of ["pointermove", "pointerup", "pointercancel"] as const) window.addEventListener(t, hostFollow, true);
257
+ }
258
+
229
259
  /** Where the corner is on the page — the frame asks nothing else of us, and is told nothing else. */
230
260
  function tellCorner(): void {
231
261
  if (!frame?.contentWindow) return;