@lightworkai.official/debug-capture 0.12.8 → 0.14.0

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
@@ -77,6 +77,23 @@ the problem.
77
77
  | Screenshot | `getDisplayMedia` (captures cross-origin iframes), annotated by the user |
78
78
  | Replay | opt-in: the last minute of the page as [rrweb](https://github.com/rrweb-io/rrweb) events, played back on the desk |
79
79
 
80
+ ## Asking the team, in the same dialog
81
+
82
+ Where the support desk opens request types to its reporters (ใครขอได้ =
83
+ ผู้แจ้งด้วย, set on the desk), the report form says **เป็นคำขอ?
84
+ เลือกเรื่องที่ขอ** under its heading. Pressed, the same dialog becomes a
85
+ request: the person picks what they need, and the title, the details, the
86
+ marked screenshot and the page's address carry across. A request leaves the
87
+ page's logs behind (network, console, actions, replay) and can drop the
88
+ picture. It is filed typed, its steps begun on the desk, and never folded into
89
+ someone else's report as a duplicate.
90
+
91
+ Nothing to configure: the widget reads the desk's offer once the page is idle
92
+ (`GET /ingest/request-types`). The press always takes the screen first — a
93
+ desk that opens nothing, or an older desk, shows the report form as it always
94
+ was. A request sent fires `lw-request-submitted` (cancelable, like
95
+ `lw-report-submitted`) with `{ id, number, status }`.
96
+
80
97
  ## Session replay
81
98
 
82
99
  ```ts
@@ -1,4 +1,4 @@
1
- (()=>{var U2=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(J,Q)=>(typeof require<"u"?require:J)[Q]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var M2={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},S=null;function b0($){let J=[];if(!$.host?.trim())J.push("host");if(!$.realmKey?.trim())J.push("realmKey");if(!$.app?.name?.trim())J.push("app.name");if(typeof $.module!=="function")J.push("module");if(J.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${J.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");S=$}function C(){if(!S)throw Error("[debug-capture] configureDebugCapture() has not been called");return S}function j0(){return S!==null}function g(){let $=C().app;return{name:$.name,version:$.version??"0.0.0",environment:$.environment??I2()}}function I2(){if(typeof window>"u")return"unknown";let $=window.location.hostname;if($==="localhost"||$==="127.0.0.1"||$.endsWith(".local"))return"development";return"production"}function h($){let J=S?.capture?.[$];return typeof J==="number"?J:M2[$]}function p0($){let J=S?.module;if(!J)return null;try{return J($)??null}catch{return null}}function z0(){let $=S?.redact;return{headers:$?.headers??[],queryKeys:($?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:($?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function v0(){return S?.capture?.overlaySelectors??[]}var q2='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',w2="[data-lw-mask]",y0={fps:1,quality:0.5};function d(){let $=S?.replay;if(!$)return null;let J=$===!0?{}:$,Q=(K,W)=>typeof K==="number"&&K>0?K:W,j=J.maskInputs!==!1,z=J.recordCanvas?{fps:Q(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,y0.fps),quality:Q(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,y0.quality)}:null;return{seconds:Q(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?q2:w2),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:Q(J.maxBytes,4000000),canvas:z}}function u0($){if(typeof window>"u")return!1;let J;try{J=new URL($,window.location.href)}catch{return!1}if(B2(J))return!1;if(J.origin===window.location.origin)return!0;return(S?.capture?.bodyOrigins??[]).some((Q)=>{try{return new URL(Q).origin===J.origin}catch{return!1}})}function B2($){if(!S?.host)return!1;try{if(new URL(S.host).origin!==$.origin)return!1}catch{return!1}return $.pathname.startsWith("/ingest/")}function d0($){let J=Object.entries($).map(([Q,j])=>[Q.replace(/\/+$/,"")||"/",j]).sort((Q,j)=>j[0].length-Q[0].length);return(Q)=>{let j=(Q||"/").replace(/\/+$/,"")||"/";for(let[z,K]of J)if(j===z||j.startsWith(`${z}/`))return{key:z,label:K};return null}}var i="‹redacted›",C2=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,D2=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),N2=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,k2=/[\w.+-]+@[\w-]+\.[\w.-]+/g,S2=/\d(?:[\d\s-]{7,})\d/g;function c($){return $.replace(k2,i).replace(S2,i)}function O2($){if(C2.test($))return!0;return z0().headers.some((Q)=>Q.toLowerCase()===$.toLowerCase())}function o($){let J={};for(let[Q,j]of Object.entries($))J[Q]=O2(Q)?i:j;return J}function x($){try{let J=/^https?:\/\//i.test($),Q=new URL($,J?void 0:"http://local.invalid"),j=!1;if(Q.searchParams.forEach((z,K)=>{if(D2.has(K.toLowerCase())||z0().queryKeys.includes(K.toLowerCase()))Q.searchParams.set(K,i),j=!0}),!j)return $;return J?Q.toString():`${Q.pathname}${Q.search}`}catch{return $}}function M0($,J){if(J>6||$===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((j)=>M0(j,J+1));let Q={};for(let[j,z]of Object.entries($)){let K=N2.test(j)||z0().bodyKeys.some((W)=>j.toLowerCase().includes(W));Q[j]=K?i:M0(z,J+1)}return Q}function l($,J){if($==null)return null;let Q=$,j=$.trim();if(j.startsWith("{")||j.startsWith("["))try{let z=JSON.parse(j);Q=JSON.stringify(M0(z,0))}catch{}if(Q.length>J)return`${Q.slice(0,J)}… [truncated ${Q.length-J} chars]`;return Q}var I0=120,q0=40,p=($,J)=>$.length>J?`${$.slice(0,J)}…`:$,w0=($)=>{try{return decodeURIComponent($)}catch{return $}},b=[],i0=0,c0=!1;function s($,J,Q,j){let z=p(J,I0),K=b[b.length-1];if($==="navigate"&&K?.kind==="click"){let X=z.replace(/^ไปที่\s*/,"");if(K.detail.includes(`→ ${X}`))return K.at=new Date().toISOString(),K;let H=X.split(/[?#]/)[0]??X,U=K.source?w0(K.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(U&&(H===U||H.startsWith(U)))return K.detail=p(`${K.detail} → ${X}`,I0),K.source=void 0,K.at=new Date().toISOString(),K}if(K&&K.kind===$&&K.detail===z){if(K.at=new Date().toISOString(),$!=="navigate")K.count=(K.count??1)+1;return K}i0+=1;let W={id:`act_${i0}`,at:new Date().toISOString(),kind:$,detail:z,count:1,source:Q,html:K0(j)};b.push(W);while(b.length>h("maxActions"))_2(b.shift());return W}var R2=200000,r=0;function K0($){if(!$)return;if(r+$.length>R2)return;return r+=$.length,$}function _2($){if(!$)return;if(r-=($.html?.length??0)+($.afterHtml?.length??0),r<0)r=0}function Z0($){return $ instanceof Element&&Boolean($.closest("[data-debug-reporter]"))}var T2='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',L2={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},o0={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function f2($){let J=$.getAttribute("role");if(J&&o0[J])return o0[J];return L2[$.tagName.toLowerCase()]??"ปุ่ม"}function A2($,J){try{let Q=$,j=0;while(Q&&j<=J){let z=t0(Q);if(z&&typeof z.memoizedProps?.onClick==="function")return Q;Q=Q.parentElement,j+=1}}catch{}return null}function h2($){let J=$.getAttribute("aria-label")?.trim();if(J)return J;let Q=$.getAttribute("title")?.trim();if(Q)return Q;if($ instanceof HTMLInputElement||$ instanceof HTMLTextAreaElement||$ instanceof HTMLSelectElement)return($.getAttribute("placeholder")||$.getAttribute("name")||"").trim();if($ instanceof HTMLImageElement)return($.getAttribute("alt")||"").trim();let j=($.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if($ instanceof HTMLAnchorElement){let z=$.getAttribute("href");if(z?.startsWith("/"))return w0(z)}return""}function x2($){if(!($ instanceof Element))return null;let J=$.closest(T2)??A2($,4);if(!J)return null;let Q=J.tagName.toLowerCase();if(Q==="html"||Q==="body")return null;return J}function E2($){let J=c(h2($));if(!J)return null;return`${f2($)} “${p(J,q0)}”`}var a0=6000,m2=4000,g2=/(?:^|\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 y2($){$.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((z)=>z.remove());let J=[$,...Array.from($.querySelectorAll("*"))];for(let z of J){for(let W of Array.from(z.attributes)){let X=W.name.toLowerCase();if(X.startsWith("on")||X==="srcdoc"||X==="value"||X.startsWith("data-"))z.removeAttribute(W.name)}if(z instanceof HTMLAnchorElement)z.setAttribute("href","#");if(z instanceof HTMLImageElement)z.removeAttribute("src");let K=z.getAttribute("class");if(K){let W=K.replace(g2," ").replace(/\s+/g," ").trim();if(W)z.setAttribute("class",W);else z.removeAttribute("class")}}let Q=document.createTreeWalker($,NodeFilter.SHOW_TEXT),j=Q.nextNode();while(j){if(j.nodeValue)j.nodeValue=c(j.nodeValue);j=Q.nextNode()}}function B0($,J,Q){try{let j=$.outerHTML;if(!j||j.length>J)return;let z=$.cloneNode(!0);y2(z);let K=z.outerHTML;return K&&K.length<=Q?K:void 0}catch{return}}var b2=($)=>B0($,a0,m2),p2=150000,v2=40000,l0=($)=>B0($,p2,v2);function u2($){if(!($ instanceof HTMLInputElement)&&!($ instanceof HTMLTextAreaElement)&&!($ instanceof HTMLSelectElement))return null;let J=$.name||$.id||$.getAttribute("aria-label")||$.getAttribute("placeholder")||$.tagName.toLowerCase();return`ช่อง “${c(J)}”`}var s0=80;function t0($){let J=Object.keys($).find((Q)=>Q.startsWith("__reactFiber$")||Q.startsWith("__reactInternalInstance$"));return J?$[J]:null}function d2($){if(typeof $!=="function")return null;try{let J=Function.prototype.toString.call($);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function r0($){if(!$)return;return`→ ${$.length>s0?`${$.slice(0,s0)}…`:$}`}function i2($){try{let J=$.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return r0(J);let Q=t0($),j=0;while(Q&&j<30){if(typeof Q.memoizedProps?.onClick==="function")return r0(d2(Q.memoizedProps.onClick));Q=Q.return,j+=1}return}catch{return}}var c2='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function o2(){let $=v0();return $.length?$.join(", "):c2}function l2($){let J=$.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function s2($){let J=$.getAttribute("aria-label")?.trim();if(J)return J;let Q=$.getAttribute("aria-labelledby");if(Q){let K=Q.split(/\s+/).map((W)=>document.getElementById(W)?.textContent?.trim()??"").filter(Boolean).join(" ");if(K)return K}let z=$.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(z)return z;return($.textContent??"").replace(/\s+/g," ").trim()}function e0($){let J=c(s2($)),Q=l2($);return J?`เปิด ${Q} “${p(J,q0)}”`:`เปิด ${Q}`}var r2='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',n2=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function a2($){if($.querySelector(r2))return!0;return n2.test($.textContent??"")}var t2=400,e2=250,$4=8000;function J4($,J){if(typeof MutationObserver>"u"){J.html=K0(l0($));return}let Q=Date.now(),j=!1,z=()=>{j=!0,W.disconnect(),window.clearInterval(X),window.clearTimeout(H)},K=()=>{if(j)return;if(z(),!$.isConnected)return;J.detail=p(e0($),I0),J.html=K0(l0($))},W=new MutationObserver(()=>{Q=Date.now()});W.observe($,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let X=window.setInterval(()=>{if(j)return;if(!$.isConnected){z();return}if(Date.now()-Q>=t2&&!a2($))K()},e2),H=window.setTimeout(K,$4)}function Q4($){if(Z0($))return;let J=s("ui",e0($));if(J)J4($,J)}function j4(){if(typeof MutationObserver>"u")return;let $=new WeakSet;new MutationObserver((Q)=>{for(let j of Q)for(let z of Array.from(j.addedNodes)){if(!(z instanceof Element))continue;let K=o2(),W=z.matches(K)?[z]:Array.from(z.querySelectorAll(K));for(let X of W){if($.has(X))continue;$.add(X),Q4(X)}}}).observe(document.body,{childList:!0,subtree:!0})}var z4=1600,Z4=2500;function n0($){return{disabled:$.hasAttribute("disabled")||$.getAttribute("aria-disabled")==="true",busy:$.getAttribute("aria-busy")==="true",text:p(($.textContent??"").replace(/\s+/g," ").trim(),q0)}}function K4($,J){if(!$.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!$.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if($.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function W4($,J){if(typeof MutationObserver>"u")return;let Q=n0($),j=!1,z=(X,H)=>{if(j)return;if(j=!0,K.disconnect(),window.clearTimeout(W),J.afterNote=X,H)J.afterHtml=K0(B0($,a0,Z4))},K=new MutationObserver(()=>{if(!$.isConnected){z("องค์ประกอบหายไปจากหน้าจอ",!1);return}let X=K4(Q,n0($));if(X)z(X,!0)});K.observe($,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let W=window.setTimeout(()=>{if(!j&&!$.isConnected){z("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,K.disconnect()},z4)}function $1(){if(c0||typeof window>"u")return;c0=!0,document.addEventListener("click",(j)=>{if(Z0(j.target))return;let z=x2(j.target);if(!z)return;let K=E2(z);if(!K)return;let W=s("click",`คลิก ${K}`,i2(z),b2(z));if(W)W4(z,W)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(Z0(j.target))return;let z=u2(j.target);if(z)s("input",`แก้ไข ${z}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(Z0(j.target))return;s("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let $=()=>s("navigate",`ไปที่ ${w0(x(location.pathname+location.search))}`),J=history.pushState.bind(history),Q=history.replaceState.bind(history);history.pushState=(...j)=>{let z=J(...j);return $(),z},history.replaceState=(...j)=>{let z=Q(...j);return $(),z},window.addEventListener("popstate",$),j4()}function J1(){return b.map(($)=>({...$}))}var Q1=2000,W0=[],j1=0,z1=!1;function C0($,J){j1+=1,W0.push({id:`log_${j1}`,at:new Date().toISOString(),level:$,message:J.length>Q1?`${J.slice(0,Q1)}…`:J});while(W0.length>h("maxConsoleEntries"))W0.shift()}function Y4(){let $=new WeakSet;return(J,Q)=>{if(typeof Q==="object"&&Q!==null){if($.has(Q))return"[Circular]";$.add(Q)}if(typeof Q==="bigint")return Q.toString();return Q}}function Z1($){if(typeof $==="string")return $;if($ instanceof Error)return`${$.name}: ${$.message}`;try{let J=JSON.stringify($,Y4());if(J!==void 0)return J}catch{}try{return String($)}catch{}try{return Object.prototype.toString.call($)}catch{return`[${typeof $}]`}}function K1(){if(z1||typeof window>"u")return;z1=!0;let $=["log","info","warn","error","debug"];for(let J of $){let Q=console[J].bind(console);console[J]=(...j)=>{C0(J,j.map(Z1).join(" ")),Q(...j)}}window.addEventListener("error",(J)=>{let Q=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";C0("exception",`${J.message}${Q}`)}),window.addEventListener("unhandledrejection",(J)=>{let Q=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:Z1(J.reason);C0("unhandledrejection",Q)})}function W1(){return W0.map(($)=>({...$}))}var Y1=new Set,G1=new Set;function V1($,J){return $.add(J),()=>$.delete(J)}function X1($,J){for(let Q of[...$])Q(J)}function F1($){return V1(Y1,$)}function Y0($={type:"manual"}){X1(Y1,$)}function H1($){return V1(G1,$)}function P1($){X1(G1,$)}var G4=15000,V4=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],U1=!1,M1=0;function X4($){return V4.some((J)=>$.includes(J))}function I1($){let J=$.message??"";if(!J||X4(J))return;let Q=Date.now();if(Q-M1<G4)return;M1=Q,P1({...$,message:J})}function q1(){if(U1||typeof window>"u")return;U1=!0,window.addEventListener("error",($)=>{if(!$.message&&!$.error)return;let J=$.error instanceof Error?$.error:null;I1({type:"runtime-error",message:$.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",($)=>{let J=$.reason;I1({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var D1=4000,F4=1e6,H4=1e7,G0=[],w1=0,B1=!1;function N1($){G0.push($);while(G0.length>h("maxRequests"))G0.shift()}function k1(){return w1+=1,`req_${w1}`}function C1($){let J={};if(!$)return J;if($ instanceof Headers)$.forEach((Q,j)=>{J[j]=Q});else if(Array.isArray($))for(let[Q,j]of $)J[Q]=j;else Object.assign(J,$);return J}function P4($){let J={};return $.forEach((Q,j)=>{J[j]=Q}),J}function U4($){if($==null)return null;if(typeof $==="string")return $;if($ instanceof URLSearchParams)return $.toString();if(typeof FormData<"u"&&$ instanceof FormData)return`[FormData: ${Array.from($.keys()).join(", ")}]`;if(typeof Blob<"u"&&$ instanceof Blob)return`[Blob ${$.size} bytes]`;if($ instanceof ArrayBuffer)return`[ArrayBuffer ${$.byteLength} bytes]`;return"[binary]"}function M4($,J){let Q="",j="GET",z={},K=null;if(typeof $==="string")Q=$;else if($ instanceof URL)Q=$.toString();else Q=$.url,j=$.method||j,z=C1($.headers);if(J){if(J.method)j=J.method;if(J.headers)z={...z,...C1(J.headers)};if(J.body!==void 0)K=U4(J.body)}return{method:j.toUpperCase(),url:Q,headers:z,body:K}}function S1($){return!u0($)}function I4($,J){if(S1(J.url)){J.responseSnippet="[body not captured for this origin]";return}let Q=$.headers.get("content-type")??"",j=Number($.headers.get("content-length")??"0"),z=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(Q)){J.responseSnippet=`[binary ${Q||"unknown"}${z}]`;return}if(j>F4){J.responseSnippet=`[response ${Q||"text"}${z} — omitted]`;return}try{$.clone().text().then((K)=>{J.responseSnippet=l(K,h("maxBodyChars"))}).catch(()=>{})}catch{}}function O1($,J){if(/[?&]_rsc=/.test($))return!0;for(let Q of Object.keys(J)){let j=Q.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function q4(){if(typeof window>"u"||typeof window.fetch!=="function")return;let $=window.fetch.bind(window);window.fetch=Object.assign(async(J,Q)=>{let j=M4(J,Q);if(O1(j.url,j.headers))return $(J,Q);let z={id:k1(),startedAt:new Date().toISOString(),method:j.method,url:x(j.url),requestHeaders:o(j.headers),requestBody:l(j.body,D1),status:null,statusText:null,durationMs:null,via:"fetch"};N1(z);let K=performance.now();try{let W=await $(J,Q);return z.status=W.status,z.statusText=W.statusText,z.durationMs=Math.round(performance.now()-K),z.responseHeaders=o(P4(W.headers)),I4(W,z),W}catch(W){throw z.durationMs=Math.round(performance.now()-K),z.error=W instanceof Error?`${W.name}: ${W.message}`:String(W),W}},$)}function w4(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let $=XMLHttpRequest.prototype,J=$.open,Q=$.send,j=function(K,W){let X=typeof W==="string"?W:W.toString();return this.__lwEntry=O1(X,{})?void 0:{id:k1(),startedAt:"",method:(K||"GET").toUpperCase(),url:x(X),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},z=function(K){let W=this.__lwEntry;if(W){W.startedAt=new Date().toISOString(),W.requestBody=typeof K==="string"?l(K,D1):K==null?null:"[non-string body]";let X=performance.now();N1(W),this.addEventListener("loadend",()=>{if(W.status=this.status||null,W.statusText=this.statusText||null,W.durationMs=Math.round(performance.now()-X),S1(W.url))W.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{W.responseSnippet=l(this.responseText||"",h("maxBodyChars"))}catch{}else{let H=this.getResponseHeader("content-type")??this.responseType;W.responseSnippet=`[binary ${H}]`}})}return Q.apply(this,arguments)};$.open=j,$.send=z}function R1(){if(B1)return;B1=!0,q4(),w4()}function _1(){let $=G0.map((Q)=>({...Q})),J=0;for(let Q=$.length-1;Q>=0;Q-=1){let j=$[Q],z=j?.responseSnippet;if(!j||typeof z!=="string"||z.length===0)continue;if(J+z.length>H4)j.responseSnippet=`[response omitted — report size budget reached (${z.length.toLocaleString()} chars)]`;else J+=z.length}return $}var B4=4,T1=3,C4=4000,D4="[data-debug-reporter]",L1=()=>import("@rrweb/record");function f1($){L1=$}var _=[],D0=null,V0=!1;function A1(){if(typeof window>"u"||D0||V0)return;let $=d();if(!$)return;V0=!0;let J=()=>void N4($);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function N4($){let J;try{J=(await L1()).record}catch(Q){V0=!1,console.warn("[debug-capture] session replay could not start:",Q);return}if(D0)return;try{D0=J({emit:(Q)=>k4(Q),checkoutEveryNms:Math.max(1000,$.seconds*1000/2),checkoutEveryNth:C4,maskAllInputs:$.maskInputs,maskTextSelector:$.maskText?"*":$.maskTextSelector,blockSelector:`${$.blockSelector}, ${D4}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...$.canvas?{canvas:$.canvas.fps}:{}},recordCanvas:$.canvas!==null,...$.canvas?{dataURLOptions:{type:"image/webp",quality:$.canvas.quality}}:{},errorHandler:()=>!0})??null}catch(Q){console.warn("[debug-capture] session replay could not start:",Q)}finally{V0=!1}}function k4($){if($.type===B4||_.length===0){if(_.push([]),_.length>T1)_=_.slice(-T1)}_[_.length-1].push($)}function h1($=Date.now()){let J=d();if(!J||!_.length)return null;let Q=$-J.seconds*1000,j=_.length-1;while(j>0&&(_[j][0]?.timestamp??$)>Q)j-=1;let z=_.slice(j).flat(),K=z[0]?.timestamp,W=z[z.length-1]?.timestamp;if(K===void 0||W===void 0)return null;return{events:z,startedAt:new Date(K).toISOString(),endedAt:new Date(W).toISOString(),durationMs:Math.max(0,W-K)}}var S4={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:"เปิดในแท็บใหม่"},O4={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"};function X0($){return $==="en"?O4:S4}var R4="lw-debug-toasts",_4=6000,T4=`
1
+ (()=>{var S2=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(J,z)=>(typeof require<"u"?require:J)[z]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var k2={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},R=null;function $1($){let J=[];if(!$.host?.trim())J.push("host");if(!$.realmKey?.trim())J.push("realmKey");if(!$.app?.name?.trim())J.push("app.name");if(typeof $.module!=="function")J.push("module");if(J.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${J.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");R=$}function N(){if(!R)throw Error("[debug-capture] configureDebugCapture() has not been called");return R}function N0(){return R!==null}function h(){let $=N().app;return{name:$.name,version:$.version??"0.0.0",environment:$.environment??_2()}}function _2(){if(typeof window>"u")return"unknown";let $=window.location.hostname;if($==="localhost"||$==="127.0.0.1"||$.endsWith(".local"))return"development";return"production"}function b($){let J=R?.capture?.[$];return typeof J==="number"?J:k2[$]}function C0($){let J=R?.module;if(!J)return null;try{return J($)??null}catch{return null}}function w0(){let $=R?.redact;return{headers:$?.headers??[],queryKeys:($?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:($?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function J1(){return R?.capture?.overlaySelectors??[]}var R2='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',T2="[data-lw-mask]",e0={fps:1,quality:0.5};function Y0(){let $=R?.replay;if(!$)return null;let J=$===!0?{}:$,z=(K,G)=>typeof K==="number"&&K>0?K:G,Q=J.maskInputs!==!1,j=J.recordCanvas?{fps:z(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,e0.fps),quality:z(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,e0.quality)}:null;return{seconds:z(J.seconds,60),maskInputs:Q,maskTextSelector:J.maskTextSelector?.trim()||(Q?R2:T2),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:z(J.maxBytes,4000000),canvas:j}}function z1($){if(typeof window>"u")return!1;let J;try{J=new URL($,window.location.href)}catch{return!1}if(L2(J))return!1;if(J.origin===window.location.origin)return!0;return(R?.capture?.bodyOrigins??[]).some((z)=>{try{return new URL(z).origin===J.origin}catch{return!1}})}function L2($){if(!R?.host)return!1;try{if(new URL(R.host).origin!==$.origin)return!1}catch{return!1}return $.pathname.startsWith("/ingest/")}function Q1($){let J=Object.entries($).map(([z,Q])=>[z.replace(/\/+$/,"")||"/",Q]).sort((z,Q)=>Q[0].length-z[0].length);return(z)=>{let Q=(z||"/").replace(/\/+$/,"")||"/";for(let[j,K]of J)if(Q===j||Q.startsWith(`${j}/`))return{key:j,label:K};return null}}var V0="‹redacted›",A2=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,x2=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),f2=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,E2=/[\w.+-]+@[\w-]+\.[\w.-]+/g,h2=/\d(?:[\d\s-]{7,})\d/g;function X0($){return $.replace(E2,V0).replace(h2,V0)}function m2($){if(A2.test($))return!0;return w0().headers.some((z)=>z.toLowerCase()===$.toLowerCase())}function F0($){let J={};for(let[z,Q]of Object.entries($))J[z]=m2(z)?V0:Q;return J}function p($){try{let J=/^https?:\/\//i.test($),z=new URL($,J?void 0:"http://local.invalid"),Q=!1;if(z.searchParams.forEach((j,K)=>{if(x2.has(K.toLowerCase())||w0().queryKeys.includes(K.toLowerCase()))z.searchParams.set(K,V0),Q=!0}),!Q)return $;return J?z.toString():`${z.pathname}${z.search}`}catch{return $}}function g0($,J){if(J>6||$===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Q)=>g0(Q,J+1));let z={};for(let[Q,j]of Object.entries($)){let K=f2.test(Q)||w0().bodyKeys.some((G)=>Q.toLowerCase().includes(G));z[Q]=K?V0:g0(j,J+1)}return z}function H0($,J){if($==null)return null;let z=$,Q=$.trim();if(Q.startsWith("{")||Q.startsWith("["))try{let j=JSON.parse(Q);z=JSON.stringify(g0(j,0))}catch{}if(z.length>J)return`${z.slice(0,J)}… [truncated ${z.length-J} chars]`;return z}var y0=120,b0=40,$0=($,J)=>$.length>J?`${$.slice(0,J)}…`:$,p0=($)=>{try{return decodeURIComponent($)}catch{return $}},e=[],j1=0,Z1=!1;function P0($,J,z,Q){let j=$0(J,y0),K=e[e.length-1];if($==="navigate"&&K?.kind==="click"){let F=j.replace(/^ไปที่\s*/,"");if(K.detail.includes(`→ ${F}`))return K.at=new Date().toISOString(),K;let P=F.split(/[?#]/)[0]??F,M=K.source?p0(K.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(M&&(P===M||P.startsWith(M)))return K.detail=$0(`${K.detail} → ${F}`,y0),K.source=void 0,K.at=new Date().toISOString(),K}if(K&&K.kind===$&&K.detail===j){if(K.at=new Date().toISOString(),$!=="navigate")K.count=(K.count??1)+1;return K}j1+=1;let G={id:`act_${j1}`,at:new Date().toISOString(),kind:$,detail:j,count:1,source:z,html:S0(Q)};e.push(G);while(e.length>b("maxActions"))y2(e.shift());return G}var g2=200000,U0=0;function S0($){if(!$)return;if(U0+$.length>g2)return;return U0+=$.length,$}function y2($){if(!$)return;if(U0-=($.html?.length??0)+($.afterHtml?.length??0),U0<0)U0=0}function O0($){return $ instanceof Element&&Boolean($.closest("[data-debug-reporter]"))}var b2='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',p2={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},K1={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function v2($){let J=$.getAttribute("role");if(J&&K1[J])return K1[J];return p2[$.tagName.toLowerCase()]??"ปุ่ม"}function u2($,J){try{let z=$,Q=0;while(z&&Q<=J){let j=F1(z);if(j&&typeof j.memoizedProps?.onClick==="function")return z;z=z.parentElement,Q+=1}}catch{}return null}function d2($){let J=$.getAttribute("aria-label")?.trim();if(J)return J;let z=$.getAttribute("title")?.trim();if(z)return z;if($ instanceof HTMLInputElement||$ instanceof HTMLTextAreaElement||$ instanceof HTMLSelectElement)return($.getAttribute("placeholder")||$.getAttribute("name")||"").trim();if($ instanceof HTMLImageElement)return($.getAttribute("alt")||"").trim();let Q=($.textContent??"").replace(/\s+/g," ").trim();if(Q)return Q;if($ instanceof HTMLAnchorElement){let j=$.getAttribute("href");if(j?.startsWith("/"))return p0(j)}return""}function i2($){if(!($ instanceof Element))return null;let J=$.closest(b2)??u2($,4);if(!J)return null;let z=J.tagName.toLowerCase();if(z==="html"||z==="body")return null;return J}function c2($){let J=X0(d2($));if(!J)return null;return`${v2($)} “${$0(J,b0)}”`}var X1=6000,o2=4000,l2=/(?:^|\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 r2($){$.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((j)=>j.remove());let J=[$,...Array.from($.querySelectorAll("*"))];for(let j of J){for(let G of Array.from(j.attributes)){let F=G.name.toLowerCase();if(F.startsWith("on")||F==="srcdoc"||F==="value"||F.startsWith("data-"))j.removeAttribute(G.name)}if(j instanceof HTMLAnchorElement)j.setAttribute("href","#");if(j instanceof HTMLImageElement)j.removeAttribute("src");let K=j.getAttribute("class");if(K){let G=K.replace(l2," ").replace(/\s+/g," ").trim();if(G)j.setAttribute("class",G);else j.removeAttribute("class")}}let z=document.createTreeWalker($,NodeFilter.SHOW_TEXT),Q=z.nextNode();while(Q){if(Q.nodeValue)Q.nodeValue=X0(Q.nodeValue);Q=z.nextNode()}}function v0($,J,z){try{let Q=$.outerHTML;if(!Q||Q.length>J)return;let j=$.cloneNode(!0);r2(j);let K=j.outerHTML;return K&&K.length<=z?K:void 0}catch{return}}var n2=($)=>v0($,X1,o2),s2=150000,a2=40000,W1=($)=>v0($,s2,a2);function t2($){if(!($ instanceof HTMLInputElement)&&!($ instanceof HTMLTextAreaElement)&&!($ instanceof HTMLSelectElement))return null;let J=$.name||$.id||$.getAttribute("aria-label")||$.getAttribute("placeholder")||$.tagName.toLowerCase();return`ช่อง “${X0(J)}”`}var G1=80;function F1($){let J=Object.keys($).find((z)=>z.startsWith("__reactFiber$")||z.startsWith("__reactInternalInstance$"));return J?$[J]:null}function e2($){if(typeof $!=="function")return null;try{let J=Function.prototype.toString.call($);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function Y1($){if(!$)return;return`→ ${$.length>G1?`${$.slice(0,G1)}…`:$}`}function $4($){try{let J=$.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return Y1(J);let z=F1($),Q=0;while(z&&Q<30){if(typeof z.memoizedProps?.onClick==="function")return Y1(e2(z.memoizedProps.onClick));z=z.return,Q+=1}return}catch{return}}var J4='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function z4(){let $=J1();return $.length?$.join(", "):J4}function Q4($){let J=$.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function j4($){let J=$.getAttribute("aria-label")?.trim();if(J)return J;let z=$.getAttribute("aria-labelledby");if(z){let K=z.split(/\s+/).map((G)=>document.getElementById(G)?.textContent?.trim()??"").filter(Boolean).join(" ");if(K)return K}let j=$.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(j)return j;return($.textContent??"").replace(/\s+/g," ").trim()}function H1($){let J=X0(j4($)),z=Q4($);return J?`เปิด ${z} “${$0(J,b0)}”`:`เปิด ${z}`}var Z4='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',K4=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function W4($){if($.querySelector(Z4))return!0;return K4.test($.textContent??"")}var G4=400,Y4=250,V4=8000;function X4($,J){if(typeof MutationObserver>"u"){J.html=S0(W1($));return}let z=Date.now(),Q=!1,j=()=>{Q=!0,G.disconnect(),window.clearInterval(F),window.clearTimeout(P)},K=()=>{if(Q)return;if(j(),!$.isConnected)return;J.detail=$0(H1($),y0),J.html=S0(W1($))},G=new MutationObserver(()=>{z=Date.now()});G.observe($,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let F=window.setInterval(()=>{if(Q)return;if(!$.isConnected){j();return}if(Date.now()-z>=G4&&!W4($))K()},Y4),P=window.setTimeout(K,V4)}function F4($){if(O0($))return;let J=P0("ui",H1($));if(J)X4($,J)}function H4(){if(typeof MutationObserver>"u")return;let $=new WeakSet;new MutationObserver((z)=>{for(let Q of z)for(let j of Array.from(Q.addedNodes)){if(!(j instanceof Element))continue;let K=z4(),G=j.matches(K)?[j]:Array.from(j.querySelectorAll(K));for(let F of G){if($.has(F))continue;$.add(F),F4(F)}}}).observe(document.body,{childList:!0,subtree:!0})}var P4=1600,U4=2500;function V1($){return{disabled:$.hasAttribute("disabled")||$.getAttribute("aria-disabled")==="true",busy:$.getAttribute("aria-busy")==="true",text:$0(($.textContent??"").replace(/\s+/g," ").trim(),b0)}}function M4($,J){if(!$.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!$.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if($.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function I4($,J){if(typeof MutationObserver>"u")return;let z=V1($),Q=!1,j=(F,P)=>{if(Q)return;if(Q=!0,K.disconnect(),window.clearTimeout(G),J.afterNote=F,P)J.afterHtml=S0(v0($,X1,U4))},K=new MutationObserver(()=>{if(!$.isConnected){j("องค์ประกอบหายไปจากหน้าจอ",!1);return}let F=M4(z,V1($));if(F)j(F,!0)});K.observe($,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let G=window.setTimeout(()=>{if(!Q&&!$.isConnected){j("องค์ประกอบหายไปจากหน้าจอ",!1);return}Q=!0,K.disconnect()},P4)}function P1(){if(Z1||typeof window>"u")return;Z1=!0,document.addEventListener("click",(Q)=>{if(O0(Q.target))return;let j=i2(Q.target);if(!j)return;let K=c2(j);if(!K)return;let G=P0("click",`คลิก ${K}`,$4(j),n2(j));if(G)I4(j,G)},{capture:!0,passive:!0}),document.addEventListener("change",(Q)=>{if(O0(Q.target))return;let j=t2(Q.target);if(j)P0("input",`แก้ไข ${j}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(Q)=>{if(O0(Q.target))return;P0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let $=()=>P0("navigate",`ไปที่ ${p0(p(location.pathname+location.search))}`),J=history.pushState.bind(history),z=history.replaceState.bind(history);history.pushState=(...Q)=>{let j=J(...Q);return $(),j},history.replaceState=(...Q)=>{let j=z(...Q);return $(),j},window.addEventListener("popstate",$),H4()}function U1(){return e.map(($)=>({...$}))}var M1=2000,k0=[],I1=0,B1=!1;function u0($,J){I1+=1,k0.push({id:`log_${I1}`,at:new Date().toISOString(),level:$,message:J.length>M1?`${J.slice(0,M1)}…`:J});while(k0.length>b("maxConsoleEntries"))k0.shift()}function B4(){let $=new WeakSet;return(J,z)=>{if(typeof z==="object"&&z!==null){if($.has(z))return"[Circular]";$.add(z)}if(typeof z==="bigint")return z.toString();return z}}function q1($){if(typeof $==="string")return $;if($ instanceof Error)return`${$.name}: ${$.message}`;try{let J=JSON.stringify($,B4());if(J!==void 0)return J}catch{}try{return String($)}catch{}try{return Object.prototype.toString.call($)}catch{return`[${typeof $}]`}}function D1(){if(B1||typeof window>"u")return;B1=!0;let $=["log","info","warn","error","debug"];for(let J of $){let z=console[J].bind(console);console[J]=(...Q)=>{u0(J,Q.map(q1).join(" ")),z(...Q)}}window.addEventListener("error",(J)=>{let z=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";u0("exception",`${J.message}${z}`)}),window.addEventListener("unhandledrejection",(J)=>{let z=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:q1(J.reason);u0("unhandledrejection",z)})}function N1(){return k0.map(($)=>({...$}))}var C1=new Set,w1=new Set;function O1($,J){return $.add(J),()=>$.delete(J)}function S1($,J){for(let z of[...$])z(J)}function k1($){return O1(C1,$)}function _0($={type:"manual"}){S1(C1,$)}function _1($){return O1(w1,$)}function R1($){S1(w1,$)}var q4=15000,D4=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],T1=!1,L1=0;function N4($){return D4.some((J)=>$.includes(J))}function A1($){let J=$.message??"";if(!J||N4(J))return;let z=Date.now();if(z-L1<q4)return;L1=z,R1({...$,message:J})}function x1(){if(T1||typeof window>"u")return;T1=!0,window.addEventListener("error",($)=>{if(!$.message&&!$.error)return;let J=$.error instanceof Error?$.error:null;A1({type:"runtime-error",message:$.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",($)=>{let J=$.reason;A1({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var m1=4000,C4=1e6,w4=1e7,R0=[],f1=0,E1=!1;function g1($){R0.push($);while(R0.length>b("maxRequests"))R0.shift()}function y1(){return f1+=1,`req_${f1}`}function h1($){let J={};if(!$)return J;if($ instanceof Headers)$.forEach((z,Q)=>{J[Q]=z});else if(Array.isArray($))for(let[z,Q]of $)J[z]=Q;else Object.assign(J,$);return J}function O4($){let J={};return $.forEach((z,Q)=>{J[Q]=z}),J}function S4($){if($==null)return null;if(typeof $==="string")return $;if($ instanceof URLSearchParams)return $.toString();if(typeof FormData<"u"&&$ instanceof FormData)return`[FormData: ${Array.from($.keys()).join(", ")}]`;if(typeof Blob<"u"&&$ instanceof Blob)return`[Blob ${$.size} bytes]`;if($ instanceof ArrayBuffer)return`[ArrayBuffer ${$.byteLength} bytes]`;return"[binary]"}function k4($,J){let z="",Q="GET",j={},K=null;if(typeof $==="string")z=$;else if($ instanceof URL)z=$.toString();else z=$.url,Q=$.method||Q,j=h1($.headers);if(J){if(J.method)Q=J.method;if(J.headers)j={...j,...h1(J.headers)};if(J.body!==void 0)K=S4(J.body)}return{method:Q.toUpperCase(),url:z,headers:j,body:K}}function b1($){return!z1($)}function _4($,J){if(b1(J.url)){J.responseSnippet="[body not captured for this origin]";return}let z=$.headers.get("content-type")??"",Q=Number($.headers.get("content-length")??"0"),j=Q?`, ~${Q} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(z)){J.responseSnippet=`[binary ${z||"unknown"}${j}]`;return}if(Q>C4){J.responseSnippet=`[response ${z||"text"}${j} — omitted]`;return}try{$.clone().text().then((K)=>{J.responseSnippet=H0(K,b("maxBodyChars"))}).catch(()=>{})}catch{}}function p1($,J){if(/[?&]_rsc=/.test($))return!0;for(let z of Object.keys(J)){let Q=z.toLowerCase();if(Q==="rsc"||Q==="next-router-prefetch"||Q==="next-router-state-tree")return!0}return!1}function R4(){if(typeof window>"u"||typeof window.fetch!=="function")return;let $=window.fetch.bind(window);window.fetch=Object.assign(async(J,z)=>{let Q=k4(J,z);if(p1(Q.url,Q.headers))return $(J,z);let j={id:y1(),startedAt:new Date().toISOString(),method:Q.method,url:p(Q.url),requestHeaders:F0(Q.headers),requestBody:H0(Q.body,m1),status:null,statusText:null,durationMs:null,via:"fetch"};g1(j);let K=performance.now();try{let G=await $(J,z);return j.status=G.status,j.statusText=G.statusText,j.durationMs=Math.round(performance.now()-K),j.responseHeaders=F0(O4(G.headers)),_4(G,j),G}catch(G){throw j.durationMs=Math.round(performance.now()-K),j.error=G instanceof Error?`${G.name}: ${G.message}`:String(G),G}},$)}function T4(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let $=XMLHttpRequest.prototype,J=$.open,z=$.send,Q=function(K,G){let F=typeof G==="string"?G:G.toString();return this.__lwEntry=p1(F,{})?void 0:{id:y1(),startedAt:"",method:(K||"GET").toUpperCase(),url:p(F),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},j=function(K){let G=this.__lwEntry;if(G){G.startedAt=new Date().toISOString(),G.requestBody=typeof K==="string"?H0(K,m1):K==null?null:"[non-string body]";let F=performance.now();g1(G),this.addEventListener("loadend",()=>{if(G.status=this.status||null,G.statusText=this.statusText||null,G.durationMs=Math.round(performance.now()-F),b1(G.url))G.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{G.responseSnippet=H0(this.responseText||"",b("maxBodyChars"))}catch{}else{let P=this.getResponseHeader("content-type")??this.responseType;G.responseSnippet=`[binary ${P}]`}})}return z.apply(this,arguments)};$.open=Q,$.send=j}function v1(){if(E1)return;E1=!0,R4(),T4()}function u1(){let $=R0.map((z)=>({...z})),J=0;for(let z=$.length-1;z>=0;z-=1){let Q=$[z],j=Q?.responseSnippet;if(!Q||typeof j!=="string"||j.length===0)continue;if(J+j.length>w4)Q.responseSnippet=`[response omitted — report size budget reached (${j.length.toLocaleString()} chars)]`;else J+=j.length}return $}var L4=4,d1=3,A4=4000,x4="[data-debug-reporter]",i1=()=>import("@rrweb/record");function c1($){i1=$}var L=[],d0=null,T0=!1;function o1(){if(typeof window>"u"||d0||T0)return;let $=Y0();if(!$)return;T0=!0;let J=()=>void f4($);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function f4($){let J;try{J=(await i1()).record}catch(z){T0=!1,console.warn("[debug-capture] session replay could not start:",z);return}if(d0)return;try{d0=J({emit:(z)=>E4(z),checkoutEveryNms:Math.max(1000,$.seconds*1000/2),checkoutEveryNth:A4,maskAllInputs:$.maskInputs,maskTextSelector:$.maskText?"*":$.maskTextSelector,blockSelector:`${$.blockSelector}, ${x4}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...$.canvas?{canvas:$.canvas.fps}:{}},recordCanvas:$.canvas!==null,...$.canvas?{dataURLOptions:{type:"image/webp",quality:$.canvas.quality}}:{},errorHandler:()=>!0})??null}catch(z){console.warn("[debug-capture] session replay could not start:",z)}finally{T0=!1}}function E4($){if($.type===L4||L.length===0){if(L.push([]),L.length>d1)L=L.slice(-d1)}L[L.length-1].push($)}function l1($=Date.now()){let J=Y0();if(!J||!L.length)return null;let z=$-J.seconds*1000,Q=L.length-1;while(Q>0&&(L[Q][0]?.timestamp??$)>z)Q-=1;let j=L.slice(Q).flat(),K=j[0]?.timestamp,G=j[j.length-1]?.timestamp;if(K===void 0||G===void 0)return null;return{events:j,startedAt:new Date(K).toISOString(),endedAt:new Date(G).toISOString(),durationMs:Math.max(0,G-K)}}var h4={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:"เปิดในแท็บใหม่",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง"},m4={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",askInstead:"Asking for something?",askInsteadAction:"Choose what you need",problemInstead:"Something broken?",problemInsteadAction:"Report a problem instead",requestTitle:"Ask the team",requestTypeLabel:"What you need",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"};function L0($){return $==="en"?m4:h4}var g4="lw-debug-toasts",y4=6000,b4=`
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
- `,N0=null;function L4(){if(typeof document>"u")return null;if(N0?.isConnected)return N0;let $=document.createElement(R4);$.dataset.debugReporter="true";let J=$.attachShadow({mode:"open"}),Q=document.createElement("style");Q.textContent=T4;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append(Q,j),document.body.append($),N0=j,j}function n($,J="success",Q){let j=j0()?C().toast:void 0;if(j){j({message:$,tone:J,...Q?{action:Q}:{}});return}let z=L4();if(!z)return;let K=document.createElement("div");K.className="toast",K.dataset.tone=J;let W=document.createElement("span");W.className="dot";let X=document.createElement("span");X.textContent=$;let H=document.createElement("button");H.type="button",H.className="close",H.textContent="✕",H.setAttribute("aria-label","ปิด");let U=()=>{window.clearTimeout(N),K.remove()};H.addEventListener("click",U);let N=J==="error"||Q?0:window.setTimeout(U,_4);if(K.append(W,X),Q){let M=document.createElement("button");M.type="button",M.className="action",M.textContent=Q.label,M.addEventListener("click",()=>{U(),Q.onClick()}),K.append(M)}K.append(H),z.append(K)}function x1($,J,Q){let j=$.filter((K)=>Boolean(K.error)||K.status!=null&&K.status>=400).slice(-20).map((K)=>({method:K.method,url:K.url,status:K.status,error:K.error,at:K.startedAt})),z=J.filter((K)=>K.level==="error"||K.level==="exception"||K.level==="unhandledrejection").slice(-20).map((K)=>K.message);return{failedRequests:j,errors:z,erroredQueries:Q.slice(0,20)}}function f4(){let $={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return $;let J=performance.memory;if(J)$.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),$.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[Q]=performance.getEntriesByType("navigation");if(Q)$.domContentLoadedMs=Math.round(Q.domContentLoadedEventEnd),$.loadEventMs=Math.round(Q.loadEventEnd);return $}function k0($,J){if(!$)return J;try{return $()}catch{return J}}function E1(){let $=C(),{pathname:J,search:Q,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:Q},module:p0(J),user:k0($.user,{}),apiHeaders:o(k0($.headers,{})),app:{name:g().name,version:g().version,environment:g().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:f4(),extra:k0($.extra,{})}}var A4=2;function m1($){let J=_1(),Q=W1();return{context:E1(),reason:$.reason,note:$.note,cause:x1(J,Q,$.erroredQueries),actionTrail:J1(),network:J,console:Q,screenshotDataUrl:$.screenshotDataUrl,screenshotMethod:$.screenshotMethod,replay:h1()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:A4}}}async function g1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let Q=await h4();if(Q.status==="ok")return{dataUrl:Q.dataUrl,method:"display-media"};if(Q.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await m4();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function h4(){let $=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};$=await navigator.mediaDevices.getDisplayMedia(J);let Q=await x4($);return Q?{status:"ok",dataUrl:Q}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{$?.getTracks().forEach((J)=>J.stop())}}async function x4($){let J=document.createElement("video");J.srcObject=$,J.muted=!0,J.playsInline=!0,await new Promise((W)=>{let X=!1,H=()=>{if(X)return;X=!0,W()};J.onloadedmetadata=()=>{J.play().then(H).catch(H)},window.setTimeout(H,1500)}),await E4(J);let{videoWidth:Q,videoHeight:j}=J;if(!Q||!j)return null;let z=document.createElement("canvas");z.width=Q,z.height=j;let K=z.getContext("2d");if(!K)return null;K.drawImage(J,0,0,Q,j),J.pause(),J.srcObject=null;try{return z.toDataURL("image/png")}catch{return null}}function E4($){return new Promise((J)=>{let Q=!1,j=()=>{if(Q)return;Q=!0,J()},z=$;if(typeof z.requestVideoFrameCallback==="function")z.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function m4(){let $=C().screenshotFallback;if(!$)return null;let J=await $().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:(Q)=>!(Q instanceof HTMLElement&&Q.dataset?.debugReporter==="true")})}catch{return null}}var g4=2000,y4=0.82,b4=3000000;function p4($){return new Promise((J,Q)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>Q(Error("could not read the screenshot")),j.src=$})}async function y1($){try{let J=await p4($),Q=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,g4/Q),z=document.createElement("canvas");z.width=Math.max(1,Math.round(J.naturalWidth*j)),z.height=Math.max(1,Math.round(J.naturalHeight*j));let K=z.getContext("2d");if(!K)return $;K.fillStyle="#fff",K.fillRect(0,0,z.width,z.height),K.drawImage(J,0,0,z.width,z.height);let W=y4,X=z.toDataURL("image/jpeg",W);while(X.length>b4&&W>0.4)W-=0.15,X=z.toDataURL("image/jpeg",W);return X}catch{return $}}var v4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,u4=/^\d+$/,d4=/^[0-9a-f]{16,}$/i;function b1($){if($.reason.type==="manual")return null;let J=$.cause?.failedRequests?.[0];if(!J?.url)return null;let Q;try{Q=new URL(J.url,"http://x").pathname}catch{Q=J.url}let j=Q.split("/").map((K)=>v4.test(K)||u4.test(K)||d4.test(K)?":id":K).join("/"),z=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${z}`}var p1=2000000;function F0($){let{screenshotDataUrl:J,replay:Q,...j}=$;return JSON.stringify(j).length}function v1($,J=2000000){if(F0($)<=J)return $;let Q=$.network.map((z)=>({...z})),j={...$,network:Q};for(let z of Q){if(F0(j)<=J)return j;if(typeof z.responseSnippet==="string"&&z.responseSnippet.length>35)z.responseSnippet="[body dropped — report size budget]";if(typeof z.requestBody==="string"&&z.requestBody.length>35)z.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&F0(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&F0(j)>J)j.console=j.console.slice(1);return j}function a($){let J="";for(let Q=0;Q<$.length;Q+=32768)J+=String.fromCharCode(...$.subarray(Q,Q+32768));return btoa(J)}var i4=4,c4=2,o4=3,l4=0,s4=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),r4=/^\s*javascript:/i;function n4($,J){let Q=$.toLowerCase();if(Q.startsWith("on")||Q==="srcdoc")return!0;return typeof J==="string"&&r4.test(J)}function u1($,J=!1){if(!$)return;for(let Q of Object.keys($)){let j=$[Q];if(n4(Q,j)){if(J)$[Q]=null;else delete $[Q];continue}if(typeof j!=="string"||!s4.has(Q)||!j.includes("?"))continue;$[Q]=x(j)}}function S0($){if(!$)return;u1($.attributes);for(let J of $.childNodes??[])S0(J)}function d1($){let J=JSON.parse(JSON.stringify($));for(let Q of J){let j=Q.data;if(!j||typeof j!=="object")continue;if(Q.type===i4&&typeof j.href==="string")j.href=x(j.href);else if(Q.type===c4)S0(j.node);else if(Q.type===o4&&j.source===l4){for(let z of j.adds??[])S0(z.node);for(let z of j.attributes??[])u1(z.attributes,!0)}}return J}var a4="session-replay.json.gz",t4="session-replay.json";function e4($){return Boolean($&&$.events.length>0)}async function $6($){if(typeof CompressionStream>"u")return null;try{let J=new Blob([$]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function c1($,J){if(!e4($))return{summary:{omitted:"empty"}};let j={seconds:Math.round($.durationMs/1000),events:$.events.length,startedAt:$.startedAt,endedAt:$.endedAt},z=d1($.events),K=await i1(z),W=!1;if(K.bytes.byteLength>J&&j6(z))z=z6(z),K=await i1(z),W=!0;let{bytes:X,compressed:H}=K;if(X.byteLength>J)return{summary:{...j,bytes:X.byteLength,omitted:"too-large"}};return{dataUri:`data:${H?"application/gzip":"application/json"};base64,${a(X)}`,filename:H?a4:t4,summary:{...j,events:z.length,bytes:X.byteLength,compressed:H,...W?{canvasDropped:W}:{}}}}async function i1($){let J=new TextEncoder().encode(JSON.stringify({events:$})),Q=await $6(J);return Q?{bytes:Q,compressed:!0}:{bytes:J,compressed:!1}}var J6=3,o1=2,Q6=9;function l1($){return $.type===J6&&$.data?.source===Q6}function j6($){return $.some(l1)||$.some((J)=>J.type===o1&&s1(J.data.node))}function s1($){if(!$)return!1;if($.attributes&&"rr_dataURL"in $.attributes)return!0;return($.childNodes??[]).some(s1)}function r1($){if(!$)return;if($.attributes&&"rr_dataURL"in $.attributes)delete $.attributes.rr_dataURL;for(let J of $.childNodes??[])r1(J)}function z6($){let J=[];for(let Q of $){if(l1(Q))continue;if(Q.type===o1)r1(Q.data.node);J.push(Q)}return J}var Z6=new Set([502,503,504]);class y extends Error{kind;retryAfter;status;constructor($,J,Q,j){super($);this.kind=J;this.retryAfter=Q;this.status=j;this.name="ReportError"}}function K6($){let{screenshotDataUrl:J,replay:Q,...j}=$;return{dataUri:`data:application/json;base64,${a(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function W6(){let $=C().identity;if(!$)return{};try{let J=await $();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function n1($,J){let Q=C(),j=v1(J,p1),{context:z,note:K}=j,W=[];if(j.screenshotDataUrl){let I=await y1(j.screenshotDataUrl);W.push({dataUri:I,filename:"screenshot.jpg"})}W.push(K6(j));let X,H=d();if(H){let I=await c1(j.replay,H.maxBytes);if(X=I.summary,"dataUri"in I)W.push({dataUri:I.dataUri,filename:I.filename})}let U=b1(j),N={title:$,description:K.trim()||void 0,appName:g().name,category:z.module?.label,routeUrl:z.route.href,priority:"MEDIUM",requesterEmail:z.user.email??void 0,requesterName:z.user.fullName??void 0,customFields:{unit:z.user.unit??"",appVersion:z.app.version,environment:z.app.environment,reasonType:j.reason.type,appName:g().name,module:z.module?.label??""},context:{...U?{signature:U}:{},capturedAt:z.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:z.client,performance:z.performance,apiHeaders:z.apiHeaders,extra:z.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...X?{replay:X}:{}},attachments:W},M=await fetch(`${Q.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":Q.realmKey,...await W6()},body:JSON.stringify(N)}).catch(()=>{throw new y("report never left the browser","offline")});if(!M.ok){let I=M.headers.get("retry-after"),k=await M.json().then((w)=>w.error).catch(()=>null);if(M.status===429)throw new y("rate limited","rateLimited",I??void 0);if(Z6.has(M.status))throw new y("desk unavailable","unavailable");throw new y(k??`Report failed (${M.status})`,"rejected",void 0,M.status)}return await M.json()}var t=Math.PI/6;function a1($,J,Q){let j=J.x-$.x,z=J.y-$.y,K=Math.hypot(j,z),W=Math.atan2(z,j),X=[{x:J.x,y:J.y},{x:J.x-Q*Math.cos(W-t),y:J.y-Q*Math.sin(W-t)},{x:J.x-Q*Math.cos(W+t),y:J.y-Q*Math.sin(W+t)}],H=Q*Math.cos(t)*0.92;if(K<=H)return{shaft:null,head:X};return{shaft:{from:$,to:{x:J.x-H*Math.cos(W),y:J.y-H*Math.sin(W)}},head:X}}var O0="#f44336",Y6="rgba(250, 204, 21, 0.4)",R0=22,t1="#2563eb",e1=9,$2=11,J2=18,Q2=4,H0=8,G6=[{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 j2($,J,Q){let j=[],z=null,K=-1,W=null,X=null,H=$.getContext("2d");function U(){let Z=$.getBoundingClientRect().width;return Z>0?$.width/Z:1}function N(Z){let Y=$.getBoundingClientRect();return{x:(Z.clientX-Y.left)/Y.width*$.width,y:(Z.clientY-Y.top)/Y.height*$.height}}function M(Z){let Y=Z.size??R0;if(!H)return(Z.text?.length??0)*Y*0.6;H.save(),H.font=`600 ${Y}px system-ui, sans-serif`;let V=H.measureText(Z.text??"").width;return H.restore(),V}function I(Z){if(Z.tool==="text"){let Y=Z.size??R0;return{left:Z.x1,top:Z.y1,right:Z.x1+M(Z),bottom:Z.y1+Y*1.25}}return{left:Math.min(Z.x1,Z.x2),top:Math.min(Z.y1,Z.y2),right:Math.max(Z.x1,Z.x2),bottom:Math.max(Z.y1,Z.y2)}}function k(Z){if(Z.tool==="arrow")return[{id:"tail",x:Z.x1,y:Z.y1,cursor:"move"},{id:"head",x:Z.x2,y:Z.y2,cursor:"move"}];let Y=I(Z);if(Z.tool==="text")return[{id:"size",x:Y.right,y:Y.bottom,cursor:"nwse-resize"}];return G6.map((V)=>({id:V.id,x:Y.left+(Y.right-Y.left)*V.fx,y:Y.top+(Y.bottom-Y.top)*V.fy,cursor:V.cursor}))}function w(Z){let Y=I(Z);return{x:Y.right+J2*U(),y:Y.top-J2*U()}}function O(Z,Y,V){let{shaft:G,head:F}=a1({x:Y.x1,y:Y.y1},{x:Y.x2,y:Y.y2},Math.max(10,16*V));if(G)Z.lineCap="butt",Z.beginPath(),Z.moveTo(G.from.x,G.from.y),Z.lineTo(G.to.x,G.to.y),Z.stroke();Z.beginPath(),Z.moveTo(F[0].x,F[0].y),Z.lineTo(F[1].x,F[1].y),Z.lineTo(F[2].x,F[2].y),Z.closePath(),Z.fill()}function L(Z,Y,V){Z.save(),Z.lineWidth=Math.max(2,3*V),Z.strokeStyle=O0,Z.fillStyle=O0;let G=I(Y);if(Y.tool==="rect")Z.strokeRect(G.left,G.top,G.right-G.left,G.bottom-G.top);else if(Y.tool==="arrow")O(Z,Y,V);else if(Y.tool==="highlight")Z.fillStyle=Y6,Z.fillRect(G.left,G.top,G.right-G.left,G.bottom-G.top);else if(Y.tool==="text"&&Y.text){let F=Y.size??R0;Z.font=`600 ${F}px system-ui, sans-serif`,Z.textBaseline="top";let P=F*0.22;Z.fillStyle="rgba(255,255,255,0.92)",Z.fillRect(G.left-P,G.top-P,G.right-G.left+P*2,G.bottom-G.top+P*2),Z.fillStyle=O0,Z.fillText(Y.text,G.left,G.top)}Z.restore()}function $0(Z,Y,V){let G=I(Y);Z.save(),Z.strokeStyle=t1,Z.lineWidth=Math.max(1,1.5*V),Z.setLineDash([6*V,4*V]),Z.strokeRect(G.left,G.top,G.right-G.left,G.bottom-G.top),Z.setLineDash([]);let F=e1*V;for(let R of k(Y))Z.fillStyle="#fff",Z.strokeStyle=t1,Z.lineWidth=Math.max(1,1.5*V),Z.beginPath(),Z.rect(R.x-F/2,R.y-F/2,F,F),Z.fill(),Z.stroke();let P=w(Y),q=$2*V;Z.beginPath(),Z.arc(P.x,P.y,q,0,Math.PI*2),Z.fillStyle="#dc2626",Z.fill(),Z.strokeStyle="#fff",Z.lineWidth=Math.max(1.5,2*V),Z.beginPath(),Z.moveTo(P.x-q*0.4,P.y-q*0.4),Z.lineTo(P.x+q*0.4,P.y+q*0.4),Z.moveTo(P.x+q*0.4,P.y-q*0.4),Z.lineTo(P.x-q*0.4,P.y+q*0.4),Z.stroke(),Z.restore()}function B(){if(!H)return;let Z=U();if(H.clearRect(0,0,$.width,$.height),H.drawImage(J,0,0,$.width,$.height),j.forEach((V,G)=>{if(G!==J0)L(H,V,Z)}),W)L(H,W,Z);let Y=j[K];if(Y&&!W)$0(H,Y,Z)}function T0(Z,Y,V,G,F){return Math.abs(Z-V)<=F&&Math.abs(Y-G)<=F}function L0(Z,Y){let V=j[K];if(!V)return null;let G=e1*U()/2+3*U();for(let F of k(V))if(T0(Z,Y,F.x,F.y,G))return F.id;return null}function f0(Z,Y){let V=j[K];if(!V)return!1;let G=w(V);return T0(Z,Y,G.x,G.y,$2*U())}function P0(Z,Y){let V=6*U();for(let G=j.length-1;G>=0;G-=1){let F=j[G];if(F.tool==="arrow"){let q=F.x2-F.x1,R=F.y2-F.y1,E=Math.hypot(q,R)||1,m=Math.max(0,Math.min(1,((Z-F.x1)*q+(Y-F.y1)*R)/(E*E)));if(Math.hypot(Z-(F.x1+m*q),Y-(F.y1+m*R))<=V+4*U())return G;continue}let P=I(F);if(Z>=P.left-V&&Z<=P.right+V&&Y>=P.top-V&&Y<=P.bottom+V)return G}return-1}function V2(Z,Y,V,G,F){if(Y==="tail"){Z.x1=V.x1+G,Z.y1=V.y1+F;return}if(Y==="head"){Z.x2=V.x2+G,Z.y2=V.y2+F;return}if(Y==="size"){let P2=(V.size??24)+F;Z.size=Math.max(10,P2);return}let P=I(V),{left:q,top:R,right:E,bottom:m}=P;if(Y.includes("w"))q=Math.min(E-H0,q+G);if(Y.includes("e"))E=Math.max(q+H0,E+G);if(Y.includes("n"))R=Math.min(m-H0,R+F);if(Y.includes("s"))m=Math.max(R+H0,m+F);Z.x1=q,Z.y1=R,Z.x2=E,Z.y2=m}function X2(Z,Y,V,G){Z.x1=Y.x1+V,Z.y1=Y.y1+G,Z.x2=Y.x2+V,Z.y2=Y.y2+G}let f=null,J0=-1,A={x:0,y:0,size:24};function F2(){let Z=$.getBoundingClientRect().width;return Z>0?Z/$.width:1}function H2(Z,Y){if(!H)return Z.length*Y*0.6;H.save(),H.font=`600 ${Y}px system-ui, sans-serif`;let V=H.measureText(Z||" ").width;return H.restore(),V}function A0(){if(!f)return;let Z=$.parentElement;if(!Z)return;let Y=$.getBoundingClientRect(),V=Z.getBoundingClientRect(),G=F2(),F=A.size*G;f.style.left=`${Y.left-V.left+A.x*G}px`,f.style.top=`${Y.top-V.top+A.y*G}px`,f.style.fontSize=`${F}px`,f.style.width=`${Math.max(40,H2(f.value,F)+F)}px`}function u(Z){let Y=f;if(!Y)return;f=null;let V=Y.value.trim(),G=J0;if(J0=-1,Y.remove(),Z&&V){if(G>=0&&j[G])j[G].text=V,K=G;else j.push({tool:"text",x1:A.x,y1:A.y,x2:A.x,y2:A.y,text:V,size:A.size}),K=j.length-1;Q()}else if(G>=0)K=G;$.focus(),B()}function h0(Z,Y,V=-1){u(!0);let G=$.parentElement;if(!G)return;if(getComputedStyle(G).position==="static")G.style.position="relative";let F=V>=0?j[V]:void 0;J0=V,A={x:F?.x1??Z,y:F?.y1??Y,size:F?.size??Math.round(24*U())};let P=document.createElement("input");P.type="text",P.className="text-edit",P.value=F?.text??"",P.setAttribute("aria-label","ข้อความบนภาพ"),P.placeholder="ข้อความ",f=P,G.append(P),A0(),P.addEventListener("input",A0),P.addEventListener("keydown",(q)=>{if(q.stopPropagation(),q.key==="Enter")u(!0);else if(q.key==="Escape")u(!1)}),requestAnimationFrame(()=>{if(f!==P)return;P.focus(),P.select(),P.addEventListener("blur",()=>u(!0))}),B()}function x0(Z){let{x:Y,y:V}=N(Z);if($.setPointerCapture(Z.pointerId),f0(Y,V)){U0();return}let G=L0(Y,V);if(G&&j[K]){X={grip:G,x:Y,y:V,start:{...j[K]}};return}if(z==="text"){if(Z.preventDefault(),$.hasPointerCapture(Z.pointerId))$.releasePointerCapture(Z.pointerId);z=null,Q(),h0(Y,V);return}if(z){W={tool:z,x1:Y,y1:V,x2:Y,y2:V},K=-1;return}let F=P0(Y,V);K=F,X=F>=0?{grip:"body",x:Y,y:V,start:{...j[F]}}:null,B()}function E0(Z){let{x:Y,y:V}=N(Z);if(W){W.x2=Y,W.y2=V,B();return}if(X){let F=j[K];if(!F)return;let P=Y-X.x,q=V-X.y;if(X.grip==="body")X2(F,X.start,P,q);else V2(F,X.grip,X.start,P,q);B();return}if(z){$.style.cursor="crosshair";return}if(f0(Y,V)){$.style.cursor="pointer";return}let G=L0(Y,V);if(G){let F=j[K]?k(j[K]).find((P)=>P.id===G):null;$.style.cursor=F?.cursor??"pointer";return}$.style.cursor=P0(Y,V)>=0?"move":"default"}function Q0(){if(W){if(!(Math.abs(W.x2-W.x1)<Q2&&Math.abs(W.y2-W.y1)<Q2))j.push(W),K=j.length-1,z=null,Q();W=null}if(X)X=null,Q();B()}function m0(Z){let Y=$.getBoundingClientRect(),V=(Z.clientX-Y.left)/Y.width*$.width,G=(Z.clientY-Y.top)/Y.height*$.height,F=P0(V,G),P=j[F];if(!P||P.tool!=="text")return;Z.preventDefault(),h0(P.x1,P.y1,F)}function g0(Z){if(K<0)return;if(Z.key==="Delete"||Z.key==="Backspace")Z.preventDefault(),U0();else if(Z.key==="Escape")K=-1,B()}function U0(){if(K<0)return;j.splice(K,1),K=-1,Q(),B()}return $.addEventListener("pointerdown",x0),$.addEventListener("pointermove",E0),$.addEventListener("pointerup",Q0),$.addEventListener("pointercancel",Q0),$.addEventListener("dblclick",m0),$.tabIndex=0,$.addEventListener("keydown",g0),B(),{setTool(Z){z=Z,K=-1,$.style.cursor=Z?"crosshair":"default",B()},deleteSelected:U0,clear(){j.length=0,K=-1,Q(),B()},hasShapes:()=>j.length>0,hasSelection:()=>K>=0,toDataUrl(){let Z=document.createElement("canvas");Z.width=J.naturalWidth,Z.height=J.naturalHeight;let Y=Z.getContext("2d");if(!Y)return $.toDataURL("image/png");Y.drawImage(J,0,0);let V=U();for(let G of j)L(Y,G,V);return Z.toDataURL("image/png")},destroy(){u(!1),$.removeEventListener("pointerdown",x0),$.removeEventListener("pointermove",E0),$.removeEventListener("pointerup",Q0),$.removeEventListener("pointercancel",Q0),$.removeEventListener("dblclick",m0),$.removeEventListener("keydown",g0)}}}var V6=["keydown","keyup","keypress"];function z2($){for(let J of V6)$.addEventListener(J,(Q)=>Q.stopPropagation())}var Z2=`
33
+ `,i0=null;function p4(){if(typeof document>"u")return null;if(i0?.isConnected)return i0;let $=document.createElement(g4);$.dataset.debugReporter="true";let J=$.attachShadow({mode:"open"}),z=document.createElement("style");z.textContent=b4;let Q=document.createElement("div");return Q.className="stack",Q.setAttribute("role","status"),Q.setAttribute("aria-live","polite"),J.append(z,Q),document.body.append($),i0=Q,Q}function J0($,J="success",z){let Q=N0()?N().toast:void 0;if(Q){Q({message:$,tone:J,...z?{action:z}:{}});return}let j=p4();if(!j)return;let K=document.createElement("div");K.className="toast",K.dataset.tone=J;let G=document.createElement("span");G.className="dot";let F=document.createElement("span");F.textContent=$;let P=document.createElement("button");P.type="button",P.className="close",P.textContent="✕",P.setAttribute("aria-label","ปิด");let M=()=>{window.clearTimeout(k),K.remove()};P.addEventListener("click",M);let k=J==="error"||z?0:window.setTimeout(M,y4);if(K.append(G,F),z){let B=document.createElement("button");B.type="button",B.className="action",B.textContent=z.label,B.addEventListener("click",()=>{M(),z.onClick()}),K.append(B)}K.append(P),j.append(K)}function r1($,J,z){let Q=$.filter((K)=>Boolean(K.error)||K.status!=null&&K.status>=400).slice(-20).map((K)=>({method:K.method,url:K.url,status:K.status,error:K.error,at:K.startedAt})),j=J.filter((K)=>K.level==="error"||K.level==="exception"||K.level==="unhandledrejection").slice(-20).map((K)=>K.message);return{failedRequests:Q,errors:j,erroredQueries:z.slice(0,20)}}function v4(){let $={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return $;let J=performance.memory;if(J)$.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),$.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[z]=performance.getEntriesByType("navigation");if(z)$.domContentLoadedMs=Math.round(z.domContentLoadedEventEnd),$.loadEventMs=Math.round(z.loadEventEnd);return $}function c0($,J){if(!$)return J;try{return $()}catch{return J}}function n1(){let $=N(),{pathname:J,search:z,href:Q}=window.location;return{capturedAt:new Date().toISOString(),route:{href:Q,pathname:J,search:z},module:C0(J),user:c0($.user,{}),apiHeaders:F0(c0($.headers,{})),app:{name:h().name,version:h().version,environment:h().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:v4(),extra:c0($.extra,{})}}var u4=2;function s1($){let J=u1(),z=N1();return{context:n1(),reason:$.reason,note:$.note,cause:r1(J,z,$.erroredQueries),actionTrail:U1(),network:J,console:z,screenshotDataUrl:$.screenshotDataUrl,screenshotMethod:$.screenshotMethod,replay:l1()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:u4}}}async function a1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let z=await d4();if(z.status==="ok")return{dataUrl:z.dataUrl,method:"display-media"};if(z.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await o4();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function d4(){let $=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};$=await navigator.mediaDevices.getDisplayMedia(J);let z=await i4($);return z?{status:"ok",dataUrl:z}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{$?.getTracks().forEach((J)=>J.stop())}}async function i4($){let J=document.createElement("video");J.srcObject=$,J.muted=!0,J.playsInline=!0,await new Promise((G)=>{let F=!1,P=()=>{if(F)return;F=!0,G()};J.onloadedmetadata=()=>{J.play().then(P).catch(P)},window.setTimeout(P,1500)}),await c4(J);let{videoWidth:z,videoHeight:Q}=J;if(!z||!Q)return null;let j=document.createElement("canvas");j.width=z,j.height=Q;let K=j.getContext("2d");if(!K)return null;K.drawImage(J,0,0,z,Q),J.pause(),J.srcObject=null;try{return j.toDataURL("image/png")}catch{return null}}function c4($){return new Promise((J)=>{let z=!1,Q=()=>{if(z)return;z=!0,J()},j=$;if(typeof j.requestVideoFrameCallback==="function")j.requestVideoFrameCallback(()=>Q()),window.setTimeout(Q,1000);else window.setTimeout(Q,250)})}async function o4(){let $=N().screenshotFallback;if(!$)return null;let J=await $().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:(z)=>!(z instanceof HTMLElement&&z.dataset?.debugReporter==="true")})}catch{return null}}var l4=2000,r4=0.82,n4=3000000;function s4($){return new Promise((J,z)=>{let Q=new Image;Q.onload=()=>J(Q),Q.onerror=()=>z(Error("could not read the screenshot")),Q.src=$})}async function A0($){try{let J=await s4($),z=Math.max(J.naturalWidth,J.naturalHeight),Q=Math.min(1,l4/z),j=document.createElement("canvas");j.width=Math.max(1,Math.round(J.naturalWidth*Q)),j.height=Math.max(1,Math.round(J.naturalHeight*Q));let K=j.getContext("2d");if(!K)return $;K.fillStyle="#fff",K.fillRect(0,0,j.width,j.height),K.drawImage(J,0,0,j.width,j.height);let G=r4,F=j.toDataURL("image/jpeg",G);while(F.length>n4&&G>0.4)G-=0.15,F=j.toDataURL("image/jpeg",G);return F}catch{return $}}var a4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,t4=/^\d+$/,e4=/^[0-9a-f]{16,}$/i;function t1($){if($.reason.type==="manual")return null;let J=$.cause?.failedRequests?.[0];if(!J?.url)return null;let z;try{z=new URL(J.url,"http://x").pathname}catch{z=J.url}let Q=z.split("/").map((K)=>a4.test(K)||t4.test(K)||e4.test(K)?":id":K).join("/"),j=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${Q} ${j}`}var e1=2000000;function x0($){let{screenshotDataUrl:J,replay:z,...Q}=$;return JSON.stringify(Q).length}function $2($,J=2000000){if(x0($)<=J)return $;let z=$.network.map((j)=>({...j})),Q={...$,network:z};for(let j of z){if(x0(Q)<=J)return Q;if(typeof j.responseSnippet==="string"&&j.responseSnippet.length>35)j.responseSnippet="[body dropped — report size budget]";if(typeof j.requestBody==="string"&&j.requestBody.length>35)j.requestBody="[body dropped — report size budget]"}while(Q.network.length>1&&x0(Q)>J)Q.network=Q.network.slice(1);while(Q.console.length>1&&x0(Q)>J)Q.console=Q.console.slice(1);return Q}function M0($){let J="";for(let z=0;z<$.length;z+=32768)J+=String.fromCharCode(...$.subarray(z,z+32768));return btoa(J)}var $6=4,J6=2,z6=3,Q6=0,j6=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),Z6=/^\s*javascript:/i;function K6($,J){let z=$.toLowerCase();if(z.startsWith("on")||z==="srcdoc")return!0;return typeof J==="string"&&Z6.test(J)}function J2($,J=!1){if(!$)return;for(let z of Object.keys($)){let Q=$[z];if(K6(z,Q)){if(J)$[z]=null;else delete $[z];continue}if(typeof Q!=="string"||!j6.has(z)||!Q.includes("?"))continue;$[z]=p(Q)}}function o0($){if(!$)return;J2($.attributes);for(let J of $.childNodes??[])o0(J)}function z2($){let J=JSON.parse(JSON.stringify($));for(let z of J){let Q=z.data;if(!Q||typeof Q!=="object")continue;if(z.type===$6&&typeof Q.href==="string")Q.href=p(Q.href);else if(z.type===J6)o0(Q.node);else if(z.type===z6&&Q.source===Q6){for(let j of Q.adds??[])o0(j.node);for(let j of Q.attributes??[])J2(j.attributes,!0)}}return J}var W6="session-replay.json.gz",G6="session-replay.json";function Y6($){return Boolean($&&$.events.length>0)}async function V6($){if(typeof CompressionStream>"u")return null;try{let J=new Blob([$]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function j2($,J){if(!Y6($))return{summary:{omitted:"empty"}};let Q={seconds:Math.round($.durationMs/1000),events:$.events.length,startedAt:$.startedAt,endedAt:$.endedAt},j=z2($.events),K=await Q2(j),G=!1;if(K.bytes.byteLength>J&&H6(j))j=P6(j),K=await Q2(j),G=!0;let{bytes:F,compressed:P}=K;if(F.byteLength>J)return{summary:{...Q,bytes:F.byteLength,omitted:"too-large"}};return{dataUri:`data:${P?"application/gzip":"application/json"};base64,${M0(F)}`,filename:P?W6:G6,summary:{...Q,events:j.length,bytes:F.byteLength,compressed:P,...G?{canvasDropped:G}:{}}}}async function Q2($){let J=new TextEncoder().encode(JSON.stringify({events:$})),z=await V6(J);return z?{bytes:z,compressed:!0}:{bytes:J,compressed:!1}}var X6=3,Z2=2,F6=9;function K2($){return $.type===X6&&$.data?.source===F6}function H6($){return $.some(K2)||$.some((J)=>J.type===Z2&&W2(J.data.node))}function W2($){if(!$)return!1;if($.attributes&&"rr_dataURL"in $.attributes)return!0;return($.childNodes??[]).some(W2)}function G2($){if(!$)return;if($.attributes&&"rr_dataURL"in $.attributes)delete $.attributes.rr_dataURL;for(let J of $.childNodes??[])G2(J)}function P6($){let J=[];for(let z of $){if(K2(z))continue;if(z.type===Z2)G2(z.data.node);J.push(z)}return J}var U6=new Set([502,503,504]);class m extends Error{kind;retryAfter;status;constructor($,J,z,Q){super($);this.kind=J;this.retryAfter=z;this.status=Q;this.name="ReportError"}}function M6($){let{screenshotDataUrl:J,replay:z,...Q}=$;return{dataUri:`data:application/json;base64,${M0(new TextEncoder().encode(JSON.stringify(Q)))}`,filename:"debug-bundle.json"}}async function l0(){let $=N().identity;if(!$)return{};try{let J=await $();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function Y2($,J){let z=N(),Q=$2(J,e1),{context:j,note:K}=Q,G=[];if(Q.screenshotDataUrl){let D=await A0(Q.screenshotDataUrl);G.push({dataUri:D,filename:"screenshot.jpg"})}G.push(M6(Q));let F,P=Y0();if(P){let D=await j2(Q.replay,P.maxBytes);if(F=D.summary,"dataUri"in D)G.push({dataUri:D.dataUri,filename:D.filename})}let M=t1(Q),k={title:$,description:K.trim()||void 0,appName:h().name,category:j.module?.label,routeUrl:j.route.href,priority:"MEDIUM",requesterEmail:j.user.email??void 0,requesterName:j.user.fullName??void 0,customFields:{unit:j.user.unit??"",appVersion:j.app.version,environment:j.app.environment,reasonType:Q.reason.type,appName:h().name,module:j.module?.label??""},context:{...M?{signature:M}:{},capturedAt:j.capturedAt,reason:Q.reason,cause:Q.cause,actionTrail:Q.actionTrail,client:j.client,performance:j.performance,apiHeaders:j.apiHeaders,extra:j.extra,counts:{network:Q.network.length,console:Q.console.length,actions:Q.actionTrail.length},screenshotMethod:Q.screenshotMethod,...F?{replay:F}:{}},attachments:G},B=await fetch(`${z.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":z.realmKey,...await l0()},body:JSON.stringify(k)}).catch(()=>{throw new m("report never left the browser","offline")});if(!B.ok)throw await r0(B);return await B.json()}async function r0($){let J=$.headers.get("retry-after"),z=await $.json().then((Q)=>Q.error).catch(()=>null);if($.status===429)return new m("rate limited","rateLimited",J??void 0);if(U6.has($.status))return new m("desk unavailable","unavailable");return new m(z??`Report failed (${$.status})`,"rejected",void 0,$.status)}var f0=null,I0=null,V2=()=>N().host.replace(/\/$/,"");function n0(){return f0}function z0(){if(I0)return I0;return I0=(async()=>{try{let $=await fetch(`${V2()}/ingest/request-types`,{headers:{"x-realm-key":N().realmKey}}),J=$.ok?await $.json():null;f0=Array.isArray(J?.types)?J.types.filter(I6):[]}catch{f0=[],I0=null}return f0??[]})(),I0}function I6($){let J=$;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function X2($){let J=N(),z={};try{z=J.user?.()??{}}catch{z={}}let Q=typeof window>"u"?null:window.location,j={title:$.title,description:$.description.trim()||void 0,ticketTypeId:$.ticketTypeId,appName:h().name,category:Q?C0(Q.pathname)?.label:void 0,routeUrl:Q?.href,priority:"MEDIUM",requesterEmail:z.email??void 0,requesterName:z.fullName??void 0,attachments:$.screenshotDataUrl?[{dataUri:await A0($.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},K=await fetch(`${V2()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await l0()},body:JSON.stringify(j)}).catch(()=>{throw new m("request never left the browser","offline")});if(!K.ok)throw await r0(K);return await K.json()}var B0=Math.PI/6;function F2($,J,z){let Q=J.x-$.x,j=J.y-$.y,K=Math.hypot(Q,j),G=Math.atan2(j,Q),F=[{x:J.x,y:J.y},{x:J.x-z*Math.cos(G-B0),y:J.y-z*Math.sin(G-B0)},{x:J.x-z*Math.cos(G+B0),y:J.y-z*Math.sin(G+B0)}],P=z*Math.cos(B0)*0.92;if(K<=P)return{shaft:null,head:F};return{shaft:{from:$,to:{x:J.x-P*Math.cos(G),y:J.y-P*Math.sin(G)}},head:F}}var s0="#f44336",B6="rgba(250, 204, 21, 0.4)",a0=22,H2="#2563eb",P2=9,U2=11,M2=18,I2=4,E0=8,q6=[{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 B2($,J,z){let Q=[],j=null,K=-1,G=null,F=null,P=$.getContext("2d");function M(){let Z=$.getBoundingClientRect().width;return Z>0?$.width/Z:1}function k(Z){let Y=$.getBoundingClientRect();return{x:(Z.clientX-Y.left)/Y.width*$.width,y:(Z.clientY-Y.top)/Y.height*$.height}}function B(Z){let Y=Z.size??a0;if(!P)return(Z.text?.length??0)*Y*0.6;P.save(),P.font=`600 ${Y}px system-ui, sans-serif`;let V=P.measureText(Z.text??"").width;return P.restore(),V}function D(Z){if(Z.tool==="text"){let Y=Z.size??a0;return{left:Z.x1,top:Z.y1,right:Z.x1+B(Z),bottom:Z.y1+Y*1.25}}return{left:Math.min(Z.x1,Z.x2),top:Math.min(Z.y1,Z.y2),right:Math.max(Z.x1,Z.x2),bottom:Math.max(Z.y1,Z.y2)}}function _(Z){if(Z.tool==="arrow")return[{id:"tail",x:Z.x1,y:Z.y1,cursor:"move"},{id:"head",x:Z.x2,y:Z.y2,cursor:"move"}];let Y=D(Z);if(Z.tool==="text")return[{id:"size",x:Y.right,y:Y.bottom,cursor:"nwse-resize"}];return q6.map((V)=>({id:V.id,x:Y.left+(Y.right-Y.left)*V.fx,y:Y.top+(Y.bottom-Y.top)*V.fy,cursor:V.cursor}))}function O(Z){let Y=D(Z);return{x:Y.right+M2*M(),y:Y.top-M2*M()}}function g(Z,Y,V){let{shaft:W,head:X}=F2({x:Y.x1,y:Y.y1},{x:Y.x2,y:Y.y2},Math.max(10,16*V));if(W)Z.lineCap="butt",Z.beginPath(),Z.moveTo(W.from.x,W.from.y),Z.lineTo(W.to.x,W.to.y),Z.stroke();Z.beginPath(),Z.moveTo(X[0].x,X[0].y),Z.lineTo(X[1].x,X[1].y),Z.lineTo(X[2].x,X[2].y),Z.closePath(),Z.fill()}function n(Z,Y,V){Z.save(),Z.lineWidth=Math.max(2,3*V),Z.strokeStyle=s0,Z.fillStyle=s0;let W=D(Y);if(Y.tool==="rect")Z.strokeRect(W.left,W.top,W.right-W.left,W.bottom-W.top);else if(Y.tool==="arrow")g(Z,Y,V);else if(Y.tool==="highlight")Z.fillStyle=B6,Z.fillRect(W.left,W.top,W.right-W.left,W.bottom-W.top);else if(Y.tool==="text"&&Y.text){let X=Y.size??a0;Z.font=`600 ${X}px system-ui, sans-serif`,Z.textBaseline="top";let H=X*0.22;Z.fillStyle="rgba(255,255,255,0.92)",Z.fillRect(W.left-H,W.top-H,W.right-W.left+H*2,W.bottom-W.top+H*2),Z.fillStyle=s0,Z.fillText(Y.text,W.left,W.top)}Z.restore()}function Q0(Z,Y,V){let W=D(Y);Z.save(),Z.strokeStyle=H2,Z.lineWidth=Math.max(1,1.5*V),Z.setLineDash([6*V,4*V]),Z.strokeRect(W.left,W.top,W.right-W.left,W.bottom-W.top),Z.setLineDash([]);let X=P2*V;for(let w of _(Y))Z.fillStyle="#fff",Z.strokeStyle=H2,Z.lineWidth=Math.max(1,1.5*V),Z.beginPath(),Z.rect(w.x-X/2,w.y-X/2,X,X),Z.fill(),Z.stroke();let H=O(Y),U=U2*V;Z.beginPath(),Z.arc(H.x,H.y,U,0,Math.PI*2),Z.fillStyle="#dc2626",Z.fill(),Z.strokeStyle="#fff",Z.lineWidth=Math.max(1.5,2*V),Z.beginPath(),Z.moveTo(H.x-U*0.4,H.y-U*0.4),Z.lineTo(H.x+U*0.4,H.y+U*0.4),Z.moveTo(H.x+U*0.4,H.y-U*0.4),Z.lineTo(H.x-U*0.4,H.y+U*0.4),Z.stroke(),Z.restore()}function I(){if(!P)return;let Z=M();if(P.clearRect(0,0,$.width,$.height),P.drawImage(J,0,0,$.width,$.height),Q.forEach((V,W)=>{if(W!==d)n(P,V,Z)}),G)n(P,G,Z);let Y=Q[K];if(Y&&!G)Q0(P,Y,Z)}function j0(Z,Y,V,W,X){return Math.abs(Z-V)<=X&&Math.abs(Y-W)<=X}function x(Z,Y){let V=Q[K];if(!V)return null;let W=P2*M()/2+3*M();for(let X of _(V))if(j0(Z,Y,X.x,X.y,W))return X.id;return null}function Z0(Z,Y){let V=Q[K];if(!V)return!1;let W=O(V);return j0(Z,Y,W.x,W.y,U2*M())}function s(Z,Y){let V=6*M();for(let W=Q.length-1;W>=0;W-=1){let X=Q[W];if(X.tool==="arrow"){let U=X.x2-X.x1,w=X.y2-X.y1,l=Math.hypot(U,w)||1,r=Math.max(0,Math.min(1,((Z-X.x1)*U+(Y-X.y1)*w)/(l*l)));if(Math.hypot(Z-(X.x1+r*U),Y-(X.y1+r*w))<=V+4*M())return W;continue}let H=D(X);if(Z>=H.left-V&&Z<=H.right+V&&Y>=H.top-V&&Y<=H.bottom+V)return W}return-1}function K0(Z,Y,V,W,X){if(Y==="tail"){Z.x1=V.x1+W,Z.y1=V.y1+X;return}if(Y==="head"){Z.x2=V.x2+W,Z.y2=V.y2+X;return}if(Y==="size"){let O2=(V.size??24)+X;Z.size=Math.max(10,O2);return}let H=D(V),{left:U,top:w,right:l,bottom:r}=H;if(Y.includes("w"))U=Math.min(l-E0,U+W);if(Y.includes("e"))l=Math.max(U+E0,l+W);if(Y.includes("n"))w=Math.min(r-E0,w+X);if(Y.includes("s"))r=Math.max(w+E0,r+X);Z.x1=U,Z.y1=w,Z.x2=l,Z.y2=r}function D0(Z,Y,V,W){Z.x1=Y.x1+V,Z.y1=Y.y1+W,Z.x2=Y.x2+V,Z.y2=Y.y2+W}let S=null,d=-1,C={x:0,y:0,size:24};function f(){let Z=$.getBoundingClientRect().width;return Z>0?Z/$.width:1}function W0(Z,Y){if(!P)return Z.length*Y*0.6;P.save(),P.font=`600 ${Y}px system-ui, sans-serif`;let V=P.measureText(Z||" ").width;return P.restore(),V}function G0(){if(!S)return;let Z=$.parentElement;if(!Z)return;let Y=$.getBoundingClientRect(),V=Z.getBoundingClientRect(),W=f(),X=C.size*W;S.style.left=`${Y.left-V.left+C.x*W}px`,S.style.top=`${Y.top-V.top+C.y*W}px`,S.style.fontSize=`${X}px`,S.style.width=`${Math.max(40,W0(S.value,X)+X)}px`}function T(Z){let Y=S;if(!Y)return;S=null;let V=Y.value.trim(),W=d;if(d=-1,Y.remove(),Z&&V){if(W>=0&&Q[W])Q[W].text=V,K=W;else Q.push({tool:"text",x1:C.x,y1:C.y,x2:C.x,y2:C.y,text:V,size:C.size}),K=Q.length-1;z()}else if(W>=0)K=W;$.focus(),I()}function y(Z,Y,V=-1){T(!0);let W=$.parentElement;if(!W)return;if(getComputedStyle(W).position==="static")W.style.position="relative";let X=V>=0?Q[V]:void 0;d=V,C={x:X?.x1??Z,y:X?.y1??Y,size:X?.size??Math.round(24*M())};let H=document.createElement("input");H.type="text",H.className="text-edit",H.value=X?.text??"",H.setAttribute("aria-label","ข้อความบนภาพ"),H.placeholder="ข้อความ",S=H,W.append(H),G0(),H.addEventListener("input",G0),H.addEventListener("keydown",(U)=>{if(U.stopPropagation(),U.key==="Enter")T(!0);else if(U.key==="Escape")T(!1)}),requestAnimationFrame(()=>{if(S!==H)return;H.focus(),H.select(),H.addEventListener("blur",()=>T(!0))}),I()}function i(Z){let{x:Y,y:V}=k(Z);if($.setPointerCapture(Z.pointerId),Z0(Y,V)){t();return}let W=x(Y,V);if(W&&Q[K]){F={grip:W,x:Y,y:V,start:{...Q[K]}};return}if(j==="text"){if(Z.preventDefault(),$.hasPointerCapture(Z.pointerId))$.releasePointerCapture(Z.pointerId);j=null,z(),y(Y,V);return}if(j){G={tool:j,x1:Y,y1:V,x2:Y,y2:V},K=-1;return}let X=s(Y,V);K=X,F=X>=0?{grip:"body",x:Y,y:V,start:{...Q[X]}}:null,I()}function c(Z){let{x:Y,y:V}=k(Z);if(G){G.x2=Y,G.y2=V,I();return}if(F){let X=Q[K];if(!X)return;let H=Y-F.x,U=V-F.y;if(F.grip==="body")D0(X,F.start,H,U);else K0(X,F.grip,F.start,H,U);I();return}if(j){$.style.cursor="crosshair";return}if(Z0(Y,V)){$.style.cursor="pointer";return}let W=x(Y,V);if(W){let X=Q[K]?_(Q[K]).find((H)=>H.id===W):null;$.style.cursor=X?.cursor??"pointer";return}$.style.cursor=s(Y,V)>=0?"move":"default"}function a(){if(G){if(!(Math.abs(G.x2-G.x1)<I2&&Math.abs(G.y2-G.y1)<I2))Q.push(G),K=Q.length-1,j=null,z();G=null}if(F)F=null,z();I()}function E(Z){let Y=$.getBoundingClientRect(),V=(Z.clientX-Y.left)/Y.width*$.width,W=(Z.clientY-Y.top)/Y.height*$.height,X=s(V,W),H=Q[X];if(!H||H.tool!=="text")return;Z.preventDefault(),y(H.x1,H.y1,X)}function o(Z){if(K<0)return;if(Z.key==="Delete"||Z.key==="Backspace")Z.preventDefault(),t();else if(Z.key==="Escape")Z.preventDefault(),K=-1,I()}function t(){if(K<0)return;Q.splice(K,1),K=-1,z(),I()}return $.addEventListener("pointerdown",i),$.addEventListener("pointermove",c),$.addEventListener("pointerup",a),$.addEventListener("pointercancel",a),$.addEventListener("dblclick",E),$.tabIndex=0,$.addEventListener("keydown",o),I(),{setTool(Z){j=Z,K=-1,$.style.cursor=Z?"crosshair":"default",I()},deleteSelected:t,clear(){Q.length=0,K=-1,z(),I()},hasShapes:()=>Q.length>0,hasSelection:()=>K>=0,toDataUrl(){let Z=document.createElement("canvas");Z.width=J.naturalWidth,Z.height=J.naturalHeight;let Y=Z.getContext("2d");if(!Y)return $.toDataURL("image/png");Y.drawImage(J,0,0);let V=M();for(let W of Q)n(Y,W,V);return Z.toDataURL("image/png")},destroy(){T(!1),$.removeEventListener("pointerdown",i),$.removeEventListener("pointermove",c),$.removeEventListener("pointerup",a),$.removeEventListener("pointercancel",a),$.removeEventListener("dblclick",E),$.removeEventListener("keydown",o)}}}var D6=["keydown","keyup","keypress"];function q2($){for(let J of D6)$.addEventListener(J,(z)=>z.stopPropagation())}var D2=`
34
34
  :host { all: initial; }
35
35
  * { box-sizing: border-box; }
36
36
 
@@ -54,11 +54,11 @@ h2 { margin: 0; font-size: 20px; font-weight: 700; flex: 1; }
54
54
  label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
55
55
  .req { color: #dc2626; }
56
56
  .hint { font-weight: 400; color: #64748b; }
57
- input[type="text"], textarea {
57
+ input[type="text"], textarea, select {
58
58
  width: 100%; padding: 10px 12px; font: inherit; font-size: 14px;
59
59
  border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: inherit;
60
60
  }
61
- input[type="text"]:focus, textarea:focus {
61
+ input[type="text"]:focus, textarea:focus, select:focus {
62
62
  outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
63
63
  }
64
64
  textarea { min-height: 88px; resize: vertical; }
@@ -113,4 +113,24 @@ canvas { width: 100%; height: auto; display: block; border: 1px solid #e2e8f0; b
113
113
  border-radius: 0 0 16px 16px;
114
114
  }
115
115
  .foot .grow { flex: 1; }
116
- `;var e="lw-debug-reporter";function X6($,J){if($ instanceof y){if($.kind==="offline")return J.failedOffline;if($.kind==="unavailable")return J.failedUnavailable;if($.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",$.retryAfter??"60");return $.message||J.failed}return J.failed}var F6=()=>[];var H6=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function P6(){return class extends HTMLElement{root;stop=null;annotator=null;bundle=null;busy=!1;constructor(){super();this.root=this.attachShadow({mode:"open"}),z2(this.root)}connectedCallback(){this.dataset.debugReporter="true",this.stop=F1((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let Q=X0(C().locale),j=await g1();if(j.method==="cancelled"){this.close();return}this.bundle=m1({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:U6()}),this.renderForm(Q)}close(){this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren()}shell(J){let Q=document.createElement("style");Q.textContent=Z2;let j=document.createElement("div");j.className="backdrop";let z=document.createElement("div");return z.className="panel",z.setAttribute("role","dialog"),z.setAttribute("aria-modal","true"),z.setAttribute("aria-label",J.title),j.append(z),this.root.replaceChildren(Q,j),z}renderShell(J,Q){let j=this.shell(J),z=D("div","head");z.append(D("h2","",J.title)),j.append(z,D("p","status",Q))}renderForm(J){let Q=this.bundle;if(!Q)return;let j=this.shell(J),z=D("div","head"),K=v("✕","icon");K.setAttribute("aria-label",J.close),K.addEventListener("click",()=>this.close()),z.append(D("h2","",J.title),K);let W=document.createElement("input");W.type="text",W.placeholder=J.summaryPlaceholder;let X=_0(J.summaryLabel,J.summaryRequired,!0),H=document.createElement("textarea");H.placeholder=J.detailPlaceholder;let U=D("div","meta");U.innerHTML="";let{context:N}=Q;for(let[O,L]of[[J.reporter,`${N.user.fullName??"—"} (${N.user.email??"—"})`],[J.page,N.route.href],[J.captured,`${Q.network.length} network · ${Q.console.length} console · ${Q.actionTrail.length} actions${Q.replay?` · ${J.replay} ${Math.round(Q.replay.durationMs/1000)}s`:""}`]]){let $0=document.createElement("div"),B=document.createElement("b");B.textContent=`${O}: `,$0.append(B,document.createTextNode(L)),U.append($0)}let M=D("p","status",""),I=v(J.submit,"primary");if(I.disabled=!0,W.addEventListener("input",()=>{I.disabled=W.value.trim().length===0}),j.append(z,X,W,_0(J.detailLabel),H,U),Q.screenshotDataUrl)j.append(...this.screenshotSection(J,Q.screenshotDataUrl));else j.append(D("p","status",J.noScreenshot));let k=D("div","foot"),w=v(J.close);w.addEventListener("click",()=>this.close()),k.append(w,M,D("span","grow"),I),j.append(k),I.addEventListener("click",async()=>{I.disabled=!0,M.dataset.tone="",M.textContent=J.submitting;try{let O=await n1(W.value.trim(),{...Q,note:H.value,screenshotDataUrl:this.annotator?.hasShapes()?this.annotator.toDataUrl():Q.screenshotDataUrl}),L=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:O,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(),L)n(`${J.submitted} — #${O.number}`,"success")}catch(O){let L=X6(O,J);M.dataset.tone="error",M.textContent=L,n(L,"error"),I.disabled=!1}}),W.focus()}screenshotSection(J,Q){let j=_0(J.annotateHint),z=D("div","tools"),K=document.createElement("canvas"),W=D("div","shot");W.append(K);let X=[],H=(I)=>{for(let k of X)k.setAttribute("aria-pressed",String(k===I))};for(let{tool:I,key:k}of H6){let w=v(J[k]);w.setAttribute("aria-pressed","false"),w.addEventListener("click",()=>{let O=w.getAttribute("aria-pressed")==="true";H(O?null:w),this.annotator?.setTool(O?null:I)}),X.push(w),z.append(w)}z.append(D("span","sep"));let U=v(J.deleteSelected);U.addEventListener("click",()=>this.annotator?.deleteSelected());let N=v(J.clearAll);N.addEventListener("click",()=>{this.annotator?.clear(),H(null)}),z.append(U,N);let M=new Image;return M.onload=()=>{K.width=M.naturalWidth,K.height=M.naturalHeight,this.annotator=j2(K,M,()=>{H(null),U.disabled=!this.annotator?.hasSelection()})},M.src=Q,[j,z,D("p","status",J.annotateHelp),W]}}}function U6(){try{return F6()}catch{return[]}}function D($,J="",Q=""){let j=document.createElement($);if(J)j.className=J;if(Q)j.textContent=Q;return j}function v($,J=""){let Q=document.createElement("button");if(Q.type="button",Q.textContent=$,J)Q.className=J;return Q}function _0($,J="",Q=!1){let j=document.createElement("label");if(j.append(document.createTextNode($)),Q){let z=document.createElement("span");z.className="req",z.textContent=" *",j.append(z)}if(J){let z=document.createElement("span");z.className="hint",z.textContent=` ${J}`,j.append(z)}return j}function K2(){if(typeof window>"u"||customElements.get(e))return;customElements.define(e,P6())}var W2=!1;function Y2($={}){if(W2||typeof window>"u")return;if(!j0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(W2=!0,R1(),K1(),$1(),q1(),A1(),$.ui===!1)return;let J=X0(C().locale);if(H1((Q)=>{n(Q.message??J.crashed,"error",{label:J.crashAction,onClick:()=>Y0(Q)})}),K2(),!document.querySelector(e))document.body.append(document.createElement(e))}var G2=document.currentScript,T=G2?.dataset??{},M6="rrweb-record.mjs";f1(()=>import(new URL(M6,G2?.src??location.href).href));function I6($){if(!$)return{};try{let J=JSON.parse($);if(!J||typeof J!=="object"||Array.isArray(J))return{};return Object.fromEntries(Object.entries(J).filter(([,Q])=>typeof Q==="string"&&Q.trim()))}catch{return{}}}if(T.host&&T.realmKey)b0({host:T.host,realmKey:T.realmKey,app:{name:T.appName??document.title??"app",version:T.appVersion??"0.0.0",environment:T.environment??"production"},module:d0(I6(T.modules)),locale:T.locale==="en"?"en":"th",...T.replay!==void 0?{replay:{seconds:Number(T.replay)||void 0}}:{}}),Y2();window.lwReportProblem=Y0;})();
116
+
117
+ /* ขอให้ทีมดำเนินการ — the same dialog turned into a request (docs/WIDGET-ASK-PLAN.md).
118
+ The door is a quiet line under the heading: read by the one who asks,
119
+ costing nothing to the many who report. */
120
+ [hidden] { display: none !important; }
121
+ .door { margin: -8px 0 0; font-size: 13px; color: #64748b; }
122
+ button.link {
123
+ display: inline; padding: 0; border: 0; border-radius: 4px; background: none;
124
+ font-size: 13px; font-weight: 600; color: #2563eb;
125
+ text-decoration: underline; text-underline-offset: 3px;
126
+ }
127
+ button.link:hover:not(:disabled) { background: none; color: #1d4ed8; }
128
+ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
129
+ .ask p { margin: 0; }
130
+ .draft { margin: -8px 0 0; padding: 8px 12px; border-radius: 10px; background: #eff6ff; font-size: 13px; color: #1e3a8a; }
131
+ .ask .status { margin-top: 6px; }
132
+ .ask-type { font-size: 14px; font-weight: 600; }
133
+ .shot-choice { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; }
134
+ .shot-choice input { width: 16px; height: 16px; margin: 0; accent-color: #2563eb; }
135
+ .dropped { opacity: 0.35; pointer-events: none; }
136
+ `;var q0="lw-debug-reporter",v=null;function N6($,J){if($ instanceof m){if($.kind==="offline")return J.failedOffline;if($.kind==="unavailable")return J.failedUnavailable;if($.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",$.retryAfter??"60");return $.message||J.failed}return J.failed}var C6=()=>[];var w6=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function O6(){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"}),q2(this.root),this.root.addEventListener("keydown",(J)=>{let z=J;if(z.key!=="Escape"||z.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;z.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=k1((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let z=document.activeElement;this.returnFocus=z instanceof HTMLElement&&z!==document.body?z:null;let Q=L0(N().locale);if(n0()===null)z0();await this.report(J,Q)}async report(J,z){let Q=await a1();if(Q.method==="cancelled"){this.close();return}this.bundle=s1({reason:J,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:S6()}),this.renderForm(z,J)}close(J=!1){if(J)v=null;else if(this.keep)v=this.keep()??v;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let z=this.returnFocus;if(this.returnFocus=null,z?.isConnected)z.focus()}shell(J){let z=document.createElement("style");z.textContent=D2;let Q=document.createElement("div");Q.className="backdrop";let j=document.createElement("div");return j.className="panel",j.setAttribute("role","dialog"),j.setAttribute("aria-modal","true"),j.setAttribute("aria-label",J.title),Q.append(j),this.root.replaceChildren(z,Q),j}renderShell(J,z){let Q=this.shell(J),j=q("div","head");j.append(q("h2","",J.title)),Q.append(j,q("p","status",z))}renderForm(J,z){let Q=this.bundle;if(!Q)return;let j=this.shell(J),K="problem",G=null,F=null,P=q("div","head"),M=q("h2","",J.title),k=u("✕","icon");k.setAttribute("aria-label",J.close),k.addEventListener("click",()=>this.close()),P.append(M,k);let B=q("p","door");B.hidden=!0;let D=q("span"),_=u("","link");_.dataset.switchKind="",B.append(D,_);let O=q("div","ask");O.hidden=!0;let g=q("div"),n=q("p","status","");O.append(h0(J.requestTypeLabel,"",!0),g,n);let Q0=()=>{if(!G)return;n.textContent=[G.description,G.targetHours?J.requestTarget.replace("{time}",k6(J,G.targetHours)):""].filter(Boolean).join(" · ")},I=document.createElement("input");I.type="text";let j0=h0(""),x=document.createElement("textarea"),Z0=h0(""),s=q("div","meta"),{context:K0}=Q,D0=`${Q.network.length} network · ${Q.console.length} console · ${Q.actionTrail.length} actions${Q.replay?` · ${J.replay} ${Math.round(Q.replay.durationMs/1000)}s`:""}`,S=(W,X)=>{let H=document.createElement("div"),U=document.createElement("b");U.textContent=`${W}: `;let w=document.createTextNode(X);return H.append(U,w),s.append(H),{b:U,v:w}};S(J.reporter,`${K0.user.fullName??"—"} (${K0.user.email??"—"})`),S(J.page,K0.route.href);let d=S(J.captured,D0),C=document.createElement("label");C.className="shot-choice",C.hidden=!0;let f=document.createElement("input");f.type="checkbox",f.checked=!0,f.dataset.requestShot="",C.append(f,document.createTextNode(` ${J.requestWithShot}`));let W0=Q.screenshotDataUrl?this.screenshotSection(J,Q.screenshotDataUrl):[q("p","status",J.noScreenshot)],G0=Q.screenshotDataUrl?W0[0]:null;if(!Q.screenshotDataUrl)C.replaceChildren();let T=q("p","status",""),y=u(J.submit,"primary"),i=()=>{y.disabled=I.value.trim().length===0||K==="request"&&!G};I.addEventListener("input",i);let c=()=>{let W=K==="request";if(M.textContent=W?J.requestTitle:J.title,j.setAttribute("aria-label",W?J.requestTitle:J.title),D.textContent=`${W?J.problemInstead:J.askInstead} `,_.textContent=W?J.problemInsteadAction:J.askInsteadAction,O.hidden=!W,m0(j0,W?J.requestSummaryLabel:J.summaryLabel,W?"":J.summaryRequired,!0),I.placeholder=W?J.requestSummaryPlaceholder:J.summaryPlaceholder,m0(Z0,W?J.requestDetailLabel:J.detailLabel),x.placeholder=W?J.requestDetailPlaceholder:J.detailPlaceholder,d.b.textContent=`${W?J.requestLeaves:J.captured}: `,d.v.textContent=W?J.requestLeavesWhat:D0,C.hidden=!W||!Q.screenshotDataUrl,G0)m0(G0,W?J.requestAnnotateHint:J.annotateHint);for(let X of W0)X.classList.toggle("dropped",W&&!f.checked);y.textContent=W?J.requestSubmit:J.submit,i()};f.addEventListener("change",c),_.addEventListener("click",()=>{K=K==="problem"?"request":"problem",c(),(K==="request"?F??I:I).focus()});let a=(W)=>{if(this.bundle!==Q||z.type!=="manual"||!W.length)return;if(G=W[0],W.length>1){F=document.createElement("select"),F.dataset.requestType="";for(let X of W){let H=document.createElement("option");H.value=X.id,H.textContent=X.name,F.append(H)}F.addEventListener("change",()=>{G=W.find((X)=>X.id===F.value)??G,Q0()}),g.replaceChildren(F)}else g.replaceChildren(q("p","ask-type",G.name));Q0(),B.hidden=!1},E=v&&(v.title||v.detail)?v:null,o=q("p","draft");if(o.hidden=!E,E){I.value=E.title,x.value=E.detail;let W=u(J.draftClear,"link");W.dataset.draftClear="",W.addEventListener("click",()=>{I.value="",x.value="",v=null,o.hidden=!0,i(),I.focus()}),o.append(document.createTextNode(`${J.draftRestored} · `),W)}let t=n0(),Z=(W)=>{if(a(W),!E?.asking||B.hidden)return;let X=W.find((H)=>H.id===E.typeId);if(X){if(G=X,F)F.value=X.id;Q0()}K="request",c()};if(t)Z(t);else if(z.type==="manual")z0().then(Z);this.keep=()=>({title:I.value,detail:x.value,asking:K==="request",typeId:G?.id??null}),j.append(P,B,o,O,j0,I,Z0,x,s,C,...W0);let Y=q("div","foot"),V=u(J.close);V.addEventListener("click",()=>this.close()),Y.append(V,T,q("span","grow"),y),j.append(Y),c(),y.addEventListener("click",async()=>{y.disabled=!0,T.dataset.tone="",T.textContent=J.submitting;let W=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Q.screenshotDataUrl;try{if(K==="request"&&G){let U=await X2({ticketTypeId:G.id,title:I.value.trim(),description:x.value,screenshotDataUrl:f.checked?W():null}),w=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:U,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),w)J0(`${J.requestSubmitted} — #${U.number}`,"success");return}let X=await Y2(I.value.trim(),{...Q,note:x.value,screenshotDataUrl:W()}),H=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:X,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),H)J0(`${J.submitted} — #${X.number}`,"success")}catch(X){let H=N6(X,J);T.dataset.tone="error",T.textContent=H,J0(H,"error"),i()}}),I.focus()}screenshotSection(J,z){let Q=h0(J.annotateHint),j=q("div","tools"),K=document.createElement("canvas"),G=q("div","shot");G.append(K);let F=[],P=(D)=>{for(let _ of F)_.setAttribute("aria-pressed",String(_===D))};for(let{tool:D,key:_}of w6){let O=u(J[_]);O.setAttribute("aria-pressed","false"),O.addEventListener("click",()=>{let g=O.getAttribute("aria-pressed")==="true";P(g?null:O),this.annotator?.setTool(g?null:D)}),F.push(O),j.append(O)}j.append(q("span","sep"));let M=u(J.deleteSelected);M.addEventListener("click",()=>this.annotator?.deleteSelected());let k=u(J.clearAll);k.addEventListener("click",()=>{this.annotator?.clear(),P(null)}),j.append(M,k);let B=new Image;return B.onload=()=>{K.width=B.naturalWidth,K.height=B.naturalHeight,this.annotator=B2(K,B,()=>{P(null),M.disabled=!this.annotator?.hasSelection()})},B.src=z,[Q,j,q("p","status",J.annotateHelp),G]}}}function S6(){try{return C6()}catch{return[]}}function q($,J="",z=""){let Q=document.createElement($);if(J)Q.className=J;if(z)Q.textContent=z;return Q}function k6($,J){return J>=24&&J%24===0?$.days.replace("{n}",String(J/24)):$.hours.replace("{n}",String(J))}function u($,J=""){let z=document.createElement("button");if(z.type="button",z.textContent=$,J)z.className=J;return z}function h0($,J="",z=!1){return m0(document.createElement("label"),$,J,z)}function m0($,J,z="",Q=!1){if($.replaceChildren(document.createTextNode(J)),Q){let j=document.createElement("span");j.className="req",j.textContent=" *",$.append(j)}if(z){let j=document.createElement("span");j.className="hint",j.textContent=` ${z}`,$.append(j)}return $}function N2(){if(typeof window>"u"||customElements.get(q0))return;customElements.define(q0,O6())}var C2=!1;function t0($={}){if(C2||typeof window>"u")return;if(!N0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(C2=!0,v1(),D1(),P1(),x1(),o1(),$.ui===!1)return;let J=L0(N().locale);if(_1((Q)=>{J0(Q.message??J.crashed,"error",{label:J.crashAction,onClick:()=>_0(Q)})}),N2(),!document.querySelector(q0))document.body.append(document.createElement(q0));let z=window.requestIdleCallback;if(z)z(()=>void z0(),{timeout:5000});else setTimeout(()=>void z0(),2000)}var w2=document.currentScript,A=w2?.dataset??{},_6="rrweb-record.mjs";c1(()=>import(new URL(_6,w2?.src??location.href).href));function R6($){if(!$)return{};try{let J=JSON.parse($);if(!J||typeof J!=="object"||Array.isArray(J))return{};return Object.fromEntries(Object.entries(J).filter(([,z])=>typeof z==="string"&&z.trim()))}catch{return{}}}if(A.host&&A.realmKey)if($1({host:A.host,realmKey:A.realmKey,app:{name:A.appName??document.title??"app",version:A.appVersion??"0.0.0",environment:A.environment??"production"},module:Q1(R6(A.modules)),locale:A.locale==="en"?"en":"th",...A.replay!==void 0?{replay:{seconds:Number(A.replay)||void 0}}:{}}),document.body)t0();else document.addEventListener("DOMContentLoaded",()=>t0(),{once:!0});window.lwReportProblem=_0;})();
package/dist/index.d.ts CHANGED
@@ -19,6 +19,8 @@ export { launch, onLaunch, onCrash, emitCrash } from "./reporter";
19
19
  export { buildBundle, bundleToMarkdown, hasCause, bundleFileName, toCurl } from "./bundle";
20
20
  export { submitBundle } from "./submit";
21
21
  export type { FiledTicket } from "./submit";
22
+ export { loadRequestTypes, requestTypesNow, submitRequest } from "./requests";
23
+ export type { RequestTypeOption } from "./requests";
22
24
  export { errorSignature } from "./signature";
23
25
  export { trimToBudget, BUNDLE_BUDGET_BYTES } from "./budget";
24
26
  export { captureScreen } from "./screenshot";