@lightworkai.official/debug-capture 0.14.2 → 0.15.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 +33 -3
- package/dist/config.d.ts +11 -0
- package/dist/debug-capture.js +135 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +67 -17
- package/dist/live.d.ts +19 -0
- package/dist/portal.d.ts +5 -0
- package/dist/ui/ring.d.ts +19 -0
- package/dist/ui/strings.d.ts +21 -2
- package/dist/ui/styles.d.ts +1 -1
- package/package.json +1 -1
- package/src/config.ts +12 -0
- package/src/index.ts +2 -0
- package/src/install.ts +9 -0
- package/src/live.ts +227 -0
- package/src/portal.ts +3 -0
- package/src/ui/element.ts +84 -38
- package/src/ui/ring.ts +248 -0
- package/src/ui/strings.ts +58 -9
- package/src/ui/styles.ts +16 -5
package/dist/debug-capture.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var L2=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(z,J)=>(typeof require<"u"?require:z)[J]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var h2={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},h=null;function V1($){let z=[];if(!$.host?.trim())z.push("host");if(!$.realmKey?.trim())z.push("realmKey");if(!$.app?.name?.trim())z.push("app.name");if(typeof $.module!=="function")z.push("module");if(z.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${z.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");h=$}function C(){if(!h)throw Error("[debug-capture] configureDebugCapture() has not been called");return h}function x0(){return h!==null}function v(){let $=C().app;return{name:$.name,version:$.version??"0.0.0",environment:$.environment??E2()}}function E2(){if(typeof window>"u")return"unknown";let $=window.location.hostname;if($==="localhost"||$==="127.0.0.1"||$.endsWith(".local"))return"development";return"production"}function n($){let z=h?.capture?.[$];return typeof z==="number"?z:h2[$]}function C0($){let z=h?.module;if(!z)return null;try{return z($)??null}catch{return null}}function k0(){let $=h?.redact;return{headers:$?.headers??[],queryKeys:($?.queryKeys??[]).map((z)=>z.toLowerCase()),bodyKeys:($?.bodyKeys??[]).map((z)=>z.toLowerCase())}}function W1(){return h?.capture?.overlaySelectors??[]}var m2='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',g2="[data-lw-mask]",G1={fps:1,quality:0.5};function W0(){let $=h?.replay;if(!$)return null;let z=$===!0?{}:$,J=(Z,Y)=>typeof Z==="number"&&Z>0?Z:Y,j=z.maskInputs!==!1,Q=z.recordCanvas?{fps:J(typeof z.recordCanvas==="object"?z.recordCanvas.fps:void 0,G1.fps),quality:J(typeof z.recordCanvas==="object"?z.recordCanvas.quality:void 0,G1.quality)}:null;return{seconds:J(z.seconds,60),maskInputs:j,maskTextSelector:z.maskTextSelector?.trim()||(j?m2:g2),maskText:z.maskText===!0,blockSelector:z.blockSelector?.trim()||"[data-lw-private]",maxBytes:J(z.maxBytes,4000000),canvas:Q}}function X1($){if(typeof window>"u")return!1;let z;try{z=new URL($,window.location.href)}catch{return!1}if(b2(z))return!1;if(z.origin===window.location.origin)return!0;return(h?.capture?.bodyOrigins??[]).some((J)=>{try{return new URL(J).origin===z.origin}catch{return!1}})}function b2($){if(!h?.host)return!1;try{if(new URL(h.host).origin!==$.origin)return!1}catch{return!1}return $.pathname.startsWith("/ingest/")}function F1($){let z=Object.entries($).map(([J,j])=>[J.replace(/\/+$/,"")||"/",j]).sort((J,j)=>j[0].length-J[0].length);return(J)=>{let j=(J||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of z)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var X0="‹redacted›",p2=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,y2=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),v2=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,u2=/[\w.+-]+@[\w-]+\.[\w.-]+/g,i2=/\d(?:[\d\s-]{7,})\d/g;function F0($){return $.replace(u2,X0).replace(i2,X0)}function d2($){if(p2.test($))return!0;return k0().headers.some((J)=>J.toLowerCase()===$.toLowerCase())}function H0($){let z={};for(let[J,j]of Object.entries($))z[J]=d2(J)?X0:j;return z}function r($){try{let z=/^https?:\/\//i.test($),J=new URL($,z?void 0:"http://local.invalid"),j=!1;if(J.searchParams.forEach((Q,Z)=>{if(y2.has(Z.toLowerCase())||k0().queryKeys.includes(Z.toLowerCase()))J.searchParams.set(Z,X0),j=!0}),!j)return $;return z?J.toString():`${J.pathname}${J.search}`}catch{return $}}function v0($,z){if(z>6||$===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((j)=>v0(j,z+1));let J={};for(let[j,Q]of Object.entries($)){let Z=v2.test(j)||k0().bodyKeys.some((Y)=>j.toLowerCase().includes(Y));J[j]=Z?X0:v0(Q,z+1)}return J}function P0($,z){if($==null)return null;let J=$,j=$.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);J=JSON.stringify(v0(Q,0))}catch{}if(J.length>z)return`${J.slice(0,z)}… [truncated ${J.length-z} chars]`;return J}var u0=120,i0=40,Z0=($,z)=>$.length>z?`${$.slice(0,z)}…`:$,d0=($)=>{try{return decodeURIComponent($)}catch{return $}},Q0=[],H1=0,P1=!1;function U0($,z,J,j){let Q=Z0(z,u0),Z=Q0[Q0.length-1];if($==="navigate"&&Z?.kind==="click"){let X=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${X}`))return Z.at=new Date().toISOString(),Z;let P=X.split(/[?#]/)[0]??X,w=Z.source?d0(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(w&&(P===w||P.startsWith(w)))return Z.detail=Z0(`${Z.detail} → ${X}`,u0),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===$&&Z.detail===Q){if(Z.at=new Date().toISOString(),$!=="navigate")Z.count=(Z.count??1)+1;return Z}H1+=1;let Y={id:`act_${H1}`,at:new Date().toISOString(),kind:$,detail:Q,count:1,source:J,html:O0(j)};Q0.push(Y);while(Q0.length>n("maxActions"))o2(Q0.shift());return Y}var c2=200000,w0=0;function O0($){if(!$)return;if(w0+$.length>c2)return;return w0+=$.length,$}function o2($){if(!$)return;if(w0-=($.html?.length??0)+($.afterHtml?.length??0),w0<0)w0=0}function S0($){return $ instanceof Element&&Boolean($.closest("[data-debug-reporter]"))}var l2='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',n2={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},U1={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function r2($){let z=$.getAttribute("role");if(z&&U1[z])return U1[z];return n2[$.tagName.toLowerCase()]??"ปุ่ม"}function s2($,z){try{let J=$,j=0;while(J&&j<=z){let Q=q1(J);if(Q&&typeof Q.memoizedProps?.onClick==="function")return J;J=J.parentElement,j+=1}}catch{}return null}function a2($){let z=$.getAttribute("aria-label")?.trim();if(z)return z;let J=$.getAttribute("title")?.trim();if(J)return J;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 Q=$.getAttribute("href");if(Q?.startsWith("/"))return d0(Q)}return""}function t2($){if(!($ instanceof Element))return null;let z=$.closest(l2)??s2($,4);if(!z)return null;let J=z.tagName.toLowerCase();if(J==="html"||J==="body")return null;return z}function e2($){let z=F0(a2($));if(!z)return null;return`${r2($)} “${Z0(z,i0)}”`}var B1=6000,$4=4000,z4=/(?:^|\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 J4($){$.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let z=[$,...Array.from($.querySelectorAll("*"))];for(let Q of z){for(let Y of Array.from(Q.attributes)){let X=Y.name.toLowerCase();if(X.startsWith("on")||X==="srcdoc"||X==="value"||X.startsWith("data-"))Q.removeAttribute(Y.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let Y=Z.replace(z4," ").replace(/\s+/g," ").trim();if(Y)Q.setAttribute("class",Y);else Q.removeAttribute("class")}}let J=document.createTreeWalker($,NodeFilter.SHOW_TEXT),j=J.nextNode();while(j){if(j.nodeValue)j.nodeValue=F0(j.nodeValue);j=J.nextNode()}}function c0($,z,J){try{let j=$.outerHTML;if(!j||j.length>z)return;let Q=$.cloneNode(!0);J4(Q);let Z=Q.outerHTML;return Z&&Z.length<=J?Z:void 0}catch{return}}var j4=($)=>c0($,B1,$4),Q4=150000,Z4=40000,w1=($)=>c0($,Q4,Z4);function K4($){if(!($ instanceof HTMLInputElement)&&!($ instanceof HTMLTextAreaElement)&&!($ instanceof HTMLSelectElement))return null;let z=$.name||$.id||$.getAttribute("aria-label")||$.getAttribute("placeholder")||$.tagName.toLowerCase();return`ช่อง “${F0(z)}”`}var M1=80;function q1($){let z=Object.keys($).find((J)=>J.startsWith("__reactFiber$")||J.startsWith("__reactInternalInstance$"));return z?$[z]:null}function Y4($){if(typeof $!=="function")return null;try{let z=Function.prototype.toString.call($);return(z.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??z.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function I1($){if(!$)return;return`→ ${$.length>M1?`${$.slice(0,M1)}…`:$}`}function G4($){try{let z=$.closest("a[href]")?.getAttribute("href");if(z&&z.startsWith("/"))return I1(z);let J=q1($),j=0;while(J&&j<30){if(typeof J.memoizedProps?.onClick==="function")return I1(Y4(J.memoizedProps.onClick));J=J.return,j+=1}return}catch{return}}var V4='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function W4(){let $=W1();return $.length?$.join(", "):V4}function X4($){let z=$.getAttribute("role");if(z==="status"||z==="alert")return"ข้อความแจ้งเตือน";if(z==="menu")return"เมนู";if(z==="listbox")return"รายการตัวเลือก";if(z==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function F4($){let z=$.getAttribute("aria-label")?.trim();if(z)return z;let J=$.getAttribute("aria-labelledby");if(J){let Z=J.split(/\s+/).map((Y)=>document.getElementById(Y)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=$.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return($.textContent??"").replace(/\s+/g," ").trim()}function N1($){let z=F0(F4($)),J=X4($);return z?`เปิด ${J} “${Z0(z,i0)}”`:`เปิด ${J}`}var H4='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',P4=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function U4($){if($.querySelector(H4))return!0;return P4.test($.textContent??"")}var w4=400,M4=250,I4=8000;function D4($,z){if(typeof MutationObserver>"u"){z.html=O0(w1($));return}let J=Date.now(),j=!1,Q=()=>{j=!0,Y.disconnect(),window.clearInterval(X),window.clearTimeout(P)},Z=()=>{if(j)return;if(Q(),!$.isConnected)return;z.detail=Z0(N1($),u0),z.html=O0(w1($))},Y=new MutationObserver(()=>{J=Date.now()});Y.observe($,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let X=window.setInterval(()=>{if(j)return;if(!$.isConnected){Q();return}if(Date.now()-J>=w4&&!U4($))Z()},M4),P=window.setTimeout(Z,I4)}function B4($){if(S0($))return;let z=U0("ui",N1($));if(z)D4($,z)}function q4(){if(typeof MutationObserver>"u")return;let $=new WeakSet;new MutationObserver((J)=>{for(let j of J)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=W4(),Y=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let X of Y){if($.has(X))continue;$.add(X),B4(X)}}}).observe(document.body,{childList:!0,subtree:!0})}var N4=1600,x4=2500;function D1($){return{disabled:$.hasAttribute("disabled")||$.getAttribute("aria-disabled")==="true",busy:$.getAttribute("aria-busy")==="true",text:Z0(($.textContent??"").replace(/\s+/g," ").trim(),i0)}}function C4($,z){if(!$.disabled&&z.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!$.busy&&z.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if($.text!==z.text&&z.text)return`ข้อความเปลี่ยนเป็น “${z.text}”`;return null}function k4($,z){if(typeof MutationObserver>"u")return;let J=D1($),j=!1,Q=(X,P)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(Y),z.afterNote=X,P)z.afterHtml=O0(c0($,B1,x4))},Z=new MutationObserver(()=>{if(!$.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let X=C4(J,D1($));if(X)Q(X,!0)});Z.observe($,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let Y=window.setTimeout(()=>{if(!j&&!$.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},N4)}function x1(){if(P1||typeof window>"u")return;P1=!0,document.addEventListener("click",(j)=>{if(S0(j.target))return;let Q=t2(j.target);if(!Q)return;let Z=e2(Q);if(!Z)return;let Y=U0("click",`คลิก ${Z}`,G4(Q),j4(Q));if(Y)k4(Q,Y)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(S0(j.target))return;let Q=K4(j.target);if(Q)U0("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(S0(j.target))return;U0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let $=()=>U0("navigate",`ไปที่ ${d0(r(location.pathname+location.search))}`),z=history.pushState.bind(history),J=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=z(...j);return $(),Q},history.replaceState=(...j)=>{let Q=J(...j);return $(),Q},window.addEventListener("popstate",$),q4()}function C1(){return Q0.map(($)=>({...$}))}var k1=2000,_0=[],S1=0,O1=!1;function o0($,z){S1+=1,_0.push({id:`log_${S1}`,at:new Date().toISOString(),level:$,message:z.length>k1?`${z.slice(0,k1)}…`:z});while(_0.length>n("maxConsoleEntries"))_0.shift()}function S4(){let $=new WeakSet;return(z,J)=>{if(typeof J==="object"&&J!==null){if($.has(J))return"[Circular]";$.add(J)}if(typeof J==="bigint")return J.toString();return J}}function _1($){if(typeof $==="string")return $;if($ instanceof Error)return`${$.name}: ${$.message}`;try{let z=JSON.stringify($,S4());if(z!==void 0)return z}catch{}try{return String($)}catch{}try{return Object.prototype.toString.call($)}catch{return`[${typeof $}]`}}function f1(){if(O1||typeof window>"u")return;O1=!0;let $=["log","info","warn","error","debug"];for(let z of $){let J=console[z].bind(console);console[z]=(...j)=>{o0(z,j.map(_1).join(" ")),J(...j)}}window.addEventListener("error",(z)=>{let J=z.filename?` (${z.filename}:${z.lineno}:${z.colno})`:"";o0("exception",`${z.message}${J}`)}),window.addEventListener("unhandledrejection",(z)=>{let J=z.reason instanceof Error?`${z.reason.name}: ${z.reason.message}`:_1(z.reason);o0("unhandledrejection",J)})}function R1(){return _0.map(($)=>({...$}))}var T1=new Set,A1=new Set;function L1($,z){return $.add(z),()=>$.delete(z)}function h1($,z){for(let J of[...$])J(z)}function E1($){return L1(T1,$)}function f0($={type:"manual"}){h1(T1,$)}function m1($){return L1(A1,$)}function g1($){h1(A1,$)}var O4=15000,_4=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],b1=!1,p1=0;function f4($){return _4.some((z)=>$.includes(z))}function y1($){let z=$.message??"";if(!z||f4(z))return;let J=Date.now();if(J-p1<O4)return;p1=J,g1({...$,message:z})}function v1(){if(b1||typeof window>"u")return;b1=!0,window.addEventListener("error",($)=>{if(!$.message&&!$.error)return;let z=$.error instanceof Error?$.error:null;y1({type:"runtime-error",message:$.message||(z?z.message:"Unknown error"),stack:z?.stack})}),window.addEventListener("unhandledrejection",($)=>{let z=$.reason;y1({type:"unhandledrejection",message:z instanceof Error?z.message:String(z),stack:z instanceof Error?z.stack:void 0})})}var c1=4000,R4=1e6,T4=1e7,R0=[],u1=0,i1=!1;function o1($){R0.push($);while(R0.length>n("maxRequests"))R0.shift()}function l1(){return u1+=1,`req_${u1}`}function d1($){let z={};if(!$)return z;if($ instanceof Headers)$.forEach((J,j)=>{z[j]=J});else if(Array.isArray($))for(let[J,j]of $)z[J]=j;else Object.assign(z,$);return z}function A4($){let z={};return $.forEach((J,j)=>{z[j]=J}),z}function L4($){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 h4($,z){let J="",j="GET",Q={},Z=null;if(typeof $==="string")J=$;else if($ instanceof URL)J=$.toString();else J=$.url,j=$.method||j,Q=d1($.headers);if(z){if(z.method)j=z.method;if(z.headers)Q={...Q,...d1(z.headers)};if(z.body!==void 0)Z=L4(z.body)}return{method:j.toUpperCase(),url:J,headers:Q,body:Z}}function n1($){return!X1($)}function E4($,z){if(n1(z.url)){z.responseSnippet="[body not captured for this origin]";return}let J=$.headers.get("content-type")??"",j=Number($.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(J)){z.responseSnippet=`[binary ${J||"unknown"}${Q}]`;return}if(j>R4){z.responseSnippet=`[response ${J||"text"}${Q} — omitted]`;return}try{$.clone().text().then((Z)=>{z.responseSnippet=P0(Z,n("maxBodyChars"))}).catch(()=>{})}catch{}}function r1($,z){if(/[?&]_rsc=/.test($))return!0;for(let J of Object.keys(z)){let j=J.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function m4(){if(typeof window>"u"||typeof window.fetch!=="function")return;let $=window.fetch.bind(window);window.fetch=Object.assign(async(z,J)=>{let j=h4(z,J);if(r1(j.url,j.headers))return $(z,J);let Q={id:l1(),startedAt:new Date().toISOString(),method:j.method,url:r(j.url),requestHeaders:H0(j.headers),requestBody:P0(j.body,c1),status:null,statusText:null,durationMs:null,via:"fetch"};o1(Q);let Z=performance.now();try{let Y=await $(z,J);return Q.status=Y.status,Q.statusText=Y.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=H0(A4(Y.headers)),E4(Y,Q),Y}catch(Y){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=Y instanceof Error?`${Y.name}: ${Y.message}`:String(Y),Y}},$)}function g4(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let $=XMLHttpRequest.prototype,z=$.open,J=$.send,j=function(Z,Y){let X=typeof Y==="string"?Y:Y.toString();return this.__lwEntry=r1(X,{})?void 0:{id:l1(),startedAt:"",method:(Z||"GET").toUpperCase(),url:r(X),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},z.apply(this,arguments)},Q=function(Z){let Y=this.__lwEntry;if(Y){Y.startedAt=new Date().toISOString(),Y.requestBody=typeof Z==="string"?P0(Z,c1):Z==null?null:"[non-string body]";let X=performance.now();o1(Y),this.addEventListener("loadend",()=>{if(Y.status=this.status||null,Y.statusText=this.statusText||null,Y.durationMs=Math.round(performance.now()-X),n1(Y.url))Y.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{Y.responseSnippet=P0(this.responseText||"",n("maxBodyChars"))}catch{}else{let P=this.getResponseHeader("content-type")??this.responseType;Y.responseSnippet=`[binary ${P}]`}})}return J.apply(this,arguments)};$.open=j,$.send=Q}function s1(){if(i1)return;i1=!0,m4(),g4()}function a1(){let $=R0.map((J)=>({...J})),z=0;for(let J=$.length-1;J>=0;J-=1){let j=$[J],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(z+Q.length>T4)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else z+=Q.length}return $}var b4=4,t1=3,p4=4000,y4="[data-debug-reporter]",e1=()=>import("@rrweb/record");function $2($){e1=$}var E=[],l0=null,T0=!1;function z2(){if(typeof window>"u"||l0||T0)return;let $=W0();if(!$)return;T0=!0;let z=()=>void v4($);if("requestIdleCallback"in window)window.requestIdleCallback(z,{timeout:3000});else setTimeout(z,1000)}async function v4($){let z;try{z=(await e1()).record}catch(J){T0=!1,console.warn("[debug-capture] session replay could not start:",J);return}if(l0)return;try{l0=z({emit:(J)=>u4(J),checkoutEveryNms:Math.max(1000,$.seconds*1000/2),checkoutEveryNth:p4,maskAllInputs:$.maskInputs,maskTextSelector:$.maskText?"*":$.maskTextSelector,blockSelector:`${$.blockSelector}, ${y4}`,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(J){console.warn("[debug-capture] session replay could not start:",J)}finally{T0=!1}}function u4($){if($.type===b4||E.length===0){if(E.push([]),E.length>t1)E=E.slice(-t1)}E[E.length-1].push($)}function J2($=Date.now()){let z=W0();if(!z||!E.length)return null;let J=$-z.seconds*1000,j=E.length-1;while(j>0&&(E[j][0]?.timestamp??$)>J)j-=1;let Q=E.slice(j).flat(),Z=Q[0]?.timestamp,Y=Q[Q.length-1]?.timestamp;if(Z===void 0||Y===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(Y).toISOString(),durationMs:Math.max(0,Y-Z)}}var i4={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้",kindRequest:"คำขอ",kindRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง"},d4={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",failedOffline:"Could not send — the server could not be reached. What you wrote is still here; check your connection and try again.",failedUnavailable:"Could not send — the system is being updated. What you wrote is still here; try again in a moment.",failedTooMany:"Too many reports — try again in {seconds} seconds.",captured:"Captured",reporter:"Reporter",page:"Page",replay:"activity log",handoffTitle:"Opening the support portal",handoffBody:"You will be signed in automatically to see what you reported",handoffGo:"Go now",handoffPreparing:"Preparing…",handoffFailed:"Could not open your reports",handoffBlocked:"Your browser blocked the new tab",handoffOpen:"Open in a new tab",chooseTitle:"How can the team help?",kindProblem:"Report a problem",kindProblemHint:"Something is broken or not working",kindRequest:"Request",kindRequestHint:"Ask the team to do something, like access or a data change",chooseProblemHint:"Something is broken or not working — with a screenshot",chooseRequestHint:"Ask the team to do something, like access or a data change — no screen sharing",requestTitle:"Ask the team",requestTypeLabel:"What you need",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 A0($){return $==="en"?d4:i4}var c4="lw-debug-toasts",o4=6000,l4=`
|
|
1
|
+
(()=>{var U4=((z)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(z,{get:(J,$)=>(typeof require<"u"?require:J)[$]}):z)(function(z){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+z+'" is not supported')});var M4={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},h=null;function A1(z){let J=[];if(!z.host?.trim())J.push("host");if(!z.realmKey?.trim())J.push("realmKey");if(!z.app?.name?.trim())J.push("app.name");if(typeof z.module!=="function")J.push("module");if(J.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${J.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");h=z}function B(){if(!h)throw Error("[debug-capture] configureDebugCapture() has not been called");return h}function h0(){return h!==null}function o(){let z=B().app;return{name:z.name,version:z.version??"0.0.0",environment:z.environment??q4()}}function q4(){if(typeof window>"u")return"unknown";let z=window.location.hostname;if(z==="localhost"||z==="127.0.0.1"||z.endsWith(".local"))return"development";return"production"}function e(z){let J=h?.capture?.[z];return typeof J==="number"?J:M4[z]}function b0(z){let J=h?.module;if(!J)return null;try{return J(z)??null}catch{return null}}function g0(){let z=h?.redact;return{headers:z?.headers??[],queryKeys:(z?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:(z?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function L1(){return h?.capture?.overlaySelectors??[]}var D4='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',I4="[data-lw-mask]",k1={fps:1,quality:0.5};function N0(){let z=h?.replay;if(!z)return null;let J=z===!0?{}:z,$=(Z,W)=>typeof Z==="number"&&Z>0?Z:W,j=J.maskInputs!==!1,Q=J.recordCanvas?{fps:$(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,k1.fps),quality:$(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,k1.quality)}:null;return{seconds:$(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?D4:I4),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(J.maxBytes,4000000),canvas:Q}}function T1(z){if(typeof window>"u")return!1;let J;try{J=new URL(z,window.location.href)}catch{return!1}if(N4(J))return!1;if(J.origin===window.location.origin)return!0;return(h?.capture?.bodyOrigins??[]).some(($)=>{try{return new URL($).origin===J.origin}catch{return!1}})}function N4(z){if(!h?.host)return!1;try{if(new URL(h.host).origin!==z.origin)return!1}catch{return!1}return z.pathname.startsWith("/ingest/")}function f1(z){let J=Object.entries(z).map(([$,j])=>[$.replace(/\/+$/,"")||"/",j]).sort(($,j)=>j[0].length-$[0].length);return($)=>{let j=($||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of J)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var B0="‹redacted›",B4=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,x4=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),C4=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,w4=/[\w.+-]+@[\w-]+\.[\w.-]+/g,O4=/\d(?:[\d\s-]{7,})\d/g;function x0(z){return z.replace(w4,B0).replace(O4,B0)}function _4(z){if(B4.test(z))return!0;return g0().headers.some(($)=>$.toLowerCase()===z.toLowerCase())}function C0(z){let J={};for(let[$,j]of Object.entries(z))J[$]=_4($)?B0:j;return J}function z0(z){try{let J=/^https?:\/\//i.test(z),$=new URL(z,J?void 0:"http://local.invalid"),j=!1;if($.searchParams.forEach((Q,Z)=>{if(x4.has(Z.toLowerCase())||g0().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,B0),j=!0}),!j)return z;return J?$.toString():`${$.pathname}${$.search}`}catch{return z}}function J1(z,J){if(J>6||z===null||typeof z!=="object")return z;if(Array.isArray(z))return z.map((j)=>J1(j,J+1));let $={};for(let[j,Q]of Object.entries(z)){let Z=C4.test(j)||g0().bodyKeys.some((W)=>j.toLowerCase().includes(W));$[j]=Z?B0:J1(Q,J+1)}return $}function w0(z,J){if(z==null)return null;let $=z,j=z.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);$=JSON.stringify(J1(Q,0))}catch{}if($.length>J)return`${$.slice(0,J)}… [truncated ${$.length-J} chars]`;return $}var $1=120,j1=40,H0=(z,J)=>z.length>J?`${z.slice(0,J)}…`:z,Q1=(z)=>{try{return decodeURIComponent(z)}catch{return z}},F0=[],E1=0,m1=!1;function O0(z,J,$,j){let Q=H0(J,$1),Z=F0[F0.length-1];if(z==="navigate"&&Z?.kind==="click"){let X=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${X}`))return Z.at=new Date().toISOString(),Z;let H=X.split(/[?#]/)[0]??X,U=Z.source?Q1(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(U&&(H===U||H.startsWith(U)))return Z.detail=H0(`${Z.detail} → ${X}`,$1),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===z&&Z.detail===Q){if(Z.at=new Date().toISOString(),z!=="navigate")Z.count=(Z.count??1)+1;return Z}E1+=1;let W={id:`act_${E1}`,at:new Date().toISOString(),kind:z,detail:Q,count:1,source:$,html:y0(j)};F0.push(W);while(F0.length>e("maxActions"))R4(F0.shift());return W}var S4=200000,_0=0;function y0(z){if(!z)return;if(_0+z.length>S4)return;return _0+=z.length,z}function R4(z){if(!z)return;if(_0-=(z.html?.length??0)+(z.afterHtml?.length??0),_0<0)_0=0}function v0(z){return z instanceof Element&&Boolean(z.closest("[data-debug-reporter]"))}var k4='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',A4={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},h1={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function L4(z){let J=z.getAttribute("role");if(J&&h1[J])return h1[J];return A4[z.tagName.toLowerCase()]??"ปุ่ม"}function T4(z,J){try{let $=z,j=0;while($&&j<=J){let Q=u1($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function f4(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("title")?.trim();if($)return $;if(z instanceof HTMLInputElement||z instanceof HTMLTextAreaElement||z instanceof HTMLSelectElement)return(z.getAttribute("placeholder")||z.getAttribute("name")||"").trim();if(z instanceof HTMLImageElement)return(z.getAttribute("alt")||"").trim();let j=(z.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(z instanceof HTMLAnchorElement){let Q=z.getAttribute("href");if(Q?.startsWith("/"))return Q1(Q)}return""}function E4(z){if(!(z instanceof Element))return null;let J=z.closest(k4)??T4(z,4);if(!J)return null;let $=J.tagName.toLowerCase();if($==="html"||$==="body")return null;return J}function m4(z){let J=x0(f4(z));if(!J)return null;return`${L4(z)} “${H0(J,j1)}”`}var p1=6000,h4=4000,b4=/(?:^|\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 g4(z){z.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let J=[z,...Array.from(z.querySelectorAll("*"))];for(let Q of J){for(let W of Array.from(Q.attributes)){let X=W.name.toLowerCase();if(X.startsWith("on")||X==="srcdoc"||X==="value"||X.startsWith("data-"))Q.removeAttribute(W.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let W=Z.replace(b4," ").replace(/\s+/g," ").trim();if(W)Q.setAttribute("class",W);else Q.removeAttribute("class")}}let $=document.createTreeWalker(z,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=x0(j.nodeValue);j=$.nextNode()}}function Z1(z,J,$){try{let j=z.outerHTML;if(!j||j.length>J)return;let Q=z.cloneNode(!0);g4(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var v4=(z)=>Z1(z,p1,h4),y4=150000,p4=40000,b1=(z)=>Z1(z,y4,p4);function u4(z){if(!(z instanceof HTMLInputElement)&&!(z instanceof HTMLTextAreaElement)&&!(z instanceof HTMLSelectElement))return null;let J=z.name||z.id||z.getAttribute("aria-label")||z.getAttribute("placeholder")||z.tagName.toLowerCase();return`ช่อง “${x0(J)}”`}var g1=80;function u1(z){let J=Object.keys(z).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return J?z[J]:null}function d4(z){if(typeof z!=="function")return null;try{let J=Function.prototype.toString.call(z);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function v1(z){if(!z)return;return`→ ${z.length>g1?`${z.slice(0,g1)}…`:z}`}function i4(z){try{let J=z.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return v1(J);let $=u1(z),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return v1(d4($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var c4='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function l4(){let z=L1();return z.length?z.join(", "):c4}function o4(z){let J=z.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function r4(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((W)=>document.getElementById(W)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=z.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(z.textContent??"").replace(/\s+/g," ").trim()}function d1(z){let J=x0(r4(z)),$=o4(z);return J?`เปิด ${$} “${H0(J,j1)}”`:`เปิด ${$}`}var n4='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',s4=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function a4(z){if(z.querySelector(n4))return!0;return s4.test(z.textContent??"")}var t4=400,e4=250,z6=8000;function J6(z,J){if(typeof MutationObserver>"u"){J.html=y0(b1(z));return}let $=Date.now(),j=!1,Q=()=>{j=!0,W.disconnect(),window.clearInterval(X),window.clearTimeout(H)},Z=()=>{if(j)return;if(Q(),!z.isConnected)return;J.detail=H0(d1(z),$1),J.html=y0(b1(z))},W=new MutationObserver(()=>{$=Date.now()});W.observe(z,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let X=window.setInterval(()=>{if(j)return;if(!z.isConnected){Q();return}if(Date.now()-$>=t4&&!a4(z))Z()},e4),H=window.setTimeout(Z,z6)}function $6(z){if(v0(z))return;let J=O0("ui",d1(z));if(J)J6(z,J)}function j6(){if(typeof MutationObserver>"u")return;let z=new WeakSet;new MutationObserver(($)=>{for(let j of $)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=l4(),W=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let X of W){if(z.has(X))continue;z.add(X),$6(X)}}}).observe(document.body,{childList:!0,subtree:!0})}var Q6=1600,Z6=2500;function y1(z){return{disabled:z.hasAttribute("disabled")||z.getAttribute("aria-disabled")==="true",busy:z.getAttribute("aria-busy")==="true",text:H0((z.textContent??"").replace(/\s+/g," ").trim(),j1)}}function K6(z,J){if(!z.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!z.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(z.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function W6(z,J){if(typeof MutationObserver>"u")return;let $=y1(z),j=!1,Q=(X,H)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(W),J.afterNote=X,H)J.afterHtml=y0(Z1(z,p1,Z6))},Z=new MutationObserver(()=>{if(!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let X=K6($,y1(z));if(X)Q(X,!0)});Z.observe(z,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let W=window.setTimeout(()=>{if(!j&&!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},Q6)}function i1(){if(m1||typeof window>"u")return;m1=!0,document.addEventListener("click",(j)=>{if(v0(j.target))return;let Q=E4(j.target);if(!Q)return;let Z=m4(Q);if(!Z)return;let W=O0("click",`คลิก ${Z}`,i4(Q),v4(Q));if(W)W6(Q,W)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(v0(j.target))return;let Q=u4(j.target);if(Q)O0("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(v0(j.target))return;O0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let z=()=>O0("navigate",`ไปที่ ${Q1(z0(location.pathname+location.search))}`),J=history.pushState.bind(history),$=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=J(...j);return z(),Q},history.replaceState=(...j)=>{let Q=$(...j);return z(),Q},window.addEventListener("popstate",z),j6()}function c1(){return F0.map((z)=>({...z}))}var l1=2000,p0=[],o1=0,r1=!1;function K1(z,J){o1+=1,p0.push({id:`log_${o1}`,at:new Date().toISOString(),level:z,message:J.length>l1?`${J.slice(0,l1)}…`:J});while(p0.length>e("maxConsoleEntries"))p0.shift()}function V6(){let z=new WeakSet;return(J,$)=>{if(typeof $==="object"&&$!==null){if(z.has($))return"[Circular]";z.add($)}if(typeof $==="bigint")return $.toString();return $}}function n1(z){if(typeof z==="string")return z;if(z instanceof Error)return`${z.name}: ${z.message}`;try{let J=JSON.stringify(z,V6());if(J!==void 0)return J}catch{}try{return String(z)}catch{}try{return Object.prototype.toString.call(z)}catch{return`[${typeof z}]`}}function s1(){if(r1||typeof window>"u")return;r1=!0;let z=["log","info","warn","error","debug"];for(let J of z){let $=console[J].bind(console);console[J]=(...j)=>{K1(J,j.map(n1).join(" ")),$(...j)}}window.addEventListener("error",(J)=>{let $=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";K1("exception",`${J.message}${$}`)}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:n1(J.reason);K1("unhandledrejection",$)})}function a1(){return p0.map((z)=>({...z}))}var t1=new Set,e1=new Set;function z2(z,J){return z.add(J),()=>z.delete(J)}function J2(z,J){for(let $ of[...z])$(J)}function $2(z){return z2(t1,z)}function u0(z={type:"manual"}){J2(t1,z)}function j2(z){return z2(e1,z)}function Q2(z){J2(e1,z)}var Y6=15000,X6=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],Z2=!1,K2=0;function G6(z){return X6.some((J)=>z.includes(J))}function W2(z){let J=z.message??"";if(!J||G6(J))return;let $=Date.now();if($-K2<Y6)return;K2=$,Q2({...z,message:J})}function V2(){if(Z2||typeof window>"u")return;Z2=!0,window.addEventListener("error",(z)=>{if(!z.message&&!z.error)return;let J=z.error instanceof Error?z.error:null;W2({type:"runtime-error",message:z.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",(z)=>{let J=z.reason;W2({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var F2=4000,F6=1e6,H6=1e7,d0=[],Y2=0,X2=!1;function H2(z){d0.push(z);while(d0.length>e("maxRequests"))d0.shift()}function P2(){return Y2+=1,`req_${Y2}`}function G2(z){let J={};if(!z)return J;if(z instanceof Headers)z.forEach(($,j)=>{J[j]=$});else if(Array.isArray(z))for(let[$,j]of z)J[$]=j;else Object.assign(J,z);return J}function P6(z){let J={};return z.forEach(($,j)=>{J[j]=$}),J}function U6(z){if(z==null)return null;if(typeof z==="string")return z;if(z instanceof URLSearchParams)return z.toString();if(typeof FormData<"u"&&z instanceof FormData)return`[FormData: ${Array.from(z.keys()).join(", ")}]`;if(typeof Blob<"u"&&z instanceof Blob)return`[Blob ${z.size} bytes]`;if(z instanceof ArrayBuffer)return`[ArrayBuffer ${z.byteLength} bytes]`;return"[binary]"}function M6(z,J){let $="",j="GET",Q={},Z=null;if(typeof z==="string")$=z;else if(z instanceof URL)$=z.toString();else $=z.url,j=z.method||j,Q=G2(z.headers);if(J){if(J.method)j=J.method;if(J.headers)Q={...Q,...G2(J.headers)};if(J.body!==void 0)Z=U6(J.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function U2(z){return!T1(z)}function q6(z,J){if(U2(J.url)){J.responseSnippet="[body not captured for this origin]";return}let $=z.headers.get("content-type")??"",j=Number(z.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test($)){J.responseSnippet=`[binary ${$||"unknown"}${Q}]`;return}if(j>F6){J.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{z.clone().text().then((Z)=>{J.responseSnippet=w0(Z,e("maxBodyChars"))}).catch(()=>{})}catch{}}function M2(z,J){if(/[?&]_rsc=/.test(z))return!0;for(let $ of Object.keys(J)){let j=$.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function D6(){if(typeof window>"u"||typeof window.fetch!=="function")return;let z=window.fetch.bind(window);window.fetch=Object.assign(async(J,$)=>{let j=M6(J,$);if(M2(j.url,j.headers))return z(J,$);let Q={id:P2(),startedAt:new Date().toISOString(),method:j.method,url:z0(j.url),requestHeaders:C0(j.headers),requestBody:w0(j.body,F2),status:null,statusText:null,durationMs:null,via:"fetch"};H2(Q);let Z=performance.now();try{let W=await z(J,$);return Q.status=W.status,Q.statusText=W.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=C0(P6(W.headers)),q6(W,Q),W}catch(W){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=W instanceof Error?`${W.name}: ${W.message}`:String(W),W}},z)}function I6(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let z=XMLHttpRequest.prototype,J=z.open,$=z.send,j=function(Z,W){let X=typeof W==="string"?W:W.toString();return this.__lwEntry=M2(X,{})?void 0:{id:P2(),startedAt:"",method:(Z||"GET").toUpperCase(),url:z0(X),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},Q=function(Z){let W=this.__lwEntry;if(W){W.startedAt=new Date().toISOString(),W.requestBody=typeof Z==="string"?w0(Z,F2):Z==null?null:"[non-string body]";let X=performance.now();H2(W),this.addEventListener("loadend",()=>{if(W.status=this.status||null,W.statusText=this.statusText||null,W.durationMs=Math.round(performance.now()-X),U2(W.url))W.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{W.responseSnippet=w0(this.responseText||"",e("maxBodyChars"))}catch{}else{let H=this.getResponseHeader("content-type")??this.responseType;W.responseSnippet=`[binary ${H}]`}})}return $.apply(this,arguments)};z.open=j,z.send=Q}function q2(){if(X2)return;X2=!0,D6(),I6()}function D2(){let z=d0.map(($)=>({...$})),J=0;for(let $=z.length-1;$>=0;$-=1){let j=z[$],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(J+Q.length>H6)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else J+=Q.length}return z}var N6=4,I2=3,B6=4000,x6="[data-debug-reporter]",N2=()=>import("@rrweb/record");function B2(z){N2=z}var b=[],W1=null,i0=!1;function x2(){if(typeof window>"u"||W1||i0)return;let z=N0();if(!z)return;i0=!0;let J=()=>void C6(z);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function C6(z){let J;try{J=(await N2()).record}catch($){i0=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(W1)return;try{W1=J({emit:($)=>w6($),checkoutEveryNms:Math.max(1000,z.seconds*1000/2),checkoutEveryNth:B6,maskAllInputs:z.maskInputs,maskTextSelector:z.maskText?"*":z.maskTextSelector,blockSelector:`${z.blockSelector}, ${x6}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...z.canvas?{canvas:z.canvas.fps}:{}},recordCanvas:z.canvas!==null,...z.canvas?{dataURLOptions:{type:"image/webp",quality:z.canvas.quality}}:{},errorHandler:()=>!0})??null}catch($){console.warn("[debug-capture] session replay could not start:",$)}finally{i0=!1}}function w6(z){if(z.type===N6||b.length===0){if(b.push([]),b.length>I2)b=b.slice(-I2)}b[b.length-1].push(z)}function C2(z=Date.now()){let J=N0();if(!J||!b.length)return null;let $=z-J.seconds*1000,j=b.length-1;while(j>0&&(b[j][0]?.timestamp??z)>$)j-=1;let Q=b.slice(j).flat(),Z=Q[0]?.timestamp,W=Q[Q.length-1]?.timestamp;if(Z===void 0||W===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(W).toISOString(),durationMs:Math.max(0,W-Z)}}var O6={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindRequest:"คำขอ",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",problemInsteadShare:"แจ้งปัญหาแทน (แนบภาพหน้าจอ)",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTypeSearch:"ค้นหาเรื่องที่ขอ",requestTypeNone:"ไม่พบเรื่องที่ขอ — ลองคำอื่น",requestTypeCount:"{n} เรื่อง — เลื่อนดูหรือพิมพ์ค้นหา",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง",ringTitle:"ทีมงานกำลังโทรหาคุณ",ringAbout:"เรื่อง {key} · {title}",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า"},_6={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",failedOffline:"Could not send — the server could not be reached. What you wrote is still here; check your connection and try again.",failedUnavailable:"Could not send — the system is being updated. What you wrote is still here; try again in a moment.",failedTooMany:"Too many reports — try again in {seconds} seconds.",captured:"Captured",reporter:"Reporter",page:"Page",replay:"activity log",handoffTitle:"Opening the support portal",handoffBody:"You will be signed in automatically to see what you reported",handoffGo:"Go now",handoffPreparing:"Preparing…",handoffFailed:"Could not open your reports",handoffBlocked:"Your browser blocked the new tab",handoffOpen:"Open in a new tab",chooseTitle:"How can the team help?",kindProblem:"Report a problem",kindRequest:"Request",askInstead:"Asking for something?",askInsteadAction:"Choose what you need",problemInstead:"Something broken?",problemInsteadAction:"Report a problem instead",problemInsteadShare:"Report a problem instead (with a screenshot)",chooseProblemHint:"Something is broken or not working — with a screenshot",chooseRequestHint:"Ask the team to do something, like access or a data change — no screen sharing",requestTitle:"Ask the team",requestTypeLabel:"What you need",requestTypeSearch:"Search what you need",requestTypeNone:"Nothing matches — try another word",requestTypeCount:"{n} to choose from — scroll or search",requestTarget:"The team aims to finish within {time}",requestSummaryLabel:"Subject",requestSummaryPlaceholder:"What do you need — briefly",requestDetailLabel:"Details (optional)",requestDetailPlaceholder:"What the team needs to know to do it",requestSubmit:"Send request",requestSubmitted:"Request sent",requestWithShot:"Attach this screenshot to the request",requestAnnotateHint:"Mark what you are asking about — box it, point at it, highlight it, or type on it",draftRestored:"What you typed last time, not sent yet",draftClear:"Clear",requestLeaves:"Not sent with a request",requestLeavesWhat:"this page's activity log — it is for problem reports only",days:"{n} days",hours:"{n} hours",ringTitle:"The support team is calling you",ringAbout:"About {key} · {title}",ringHow:"Answer on your request's page — it opens in a new tab, already signed in",ringOpen:"Open to answer",ringDecline:"Decline",ringOpened:"Opened — press Answer in the new tab",ringBlocked:"Your browser blocked the new tab — open the call here",ringClose:"Close",ringTab:"\uD83D\uDCDE Incoming call"};function W0(z){return z==="en"?_6:O6}var S6="lw-debug-toasts",R6=6000,k6=`
|
|
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 n4(){if(typeof document>"u")return null;if(n0?.isConnected)return n0;let $=document.createElement(c4);$.dataset.debugReporter="true";let z=$.attachShadow({mode:"open"}),J=document.createElement("style");J.textContent=l4;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),z.append(J,j),document.body.append($),n0=j,j}function K0($,z="success",J){let j=x0()?C().toast:void 0;if(j){j({message:$,tone:z,...J?{action:J}:{}});return}let Q=n4();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=z;let Y=document.createElement("span");Y.className="dot";let X=document.createElement("span");X.textContent=$;let P=document.createElement("button");P.type="button",P.className="close",P.textContent="✕",P.setAttribute("aria-label","ปิด");let w=()=>{window.clearTimeout(T),Z.remove()};P.addEventListener("click",w);let T=z==="error"||J?0:window.setTimeout(w,o4);if(Z.append(Y,X),J){let N=document.createElement("button");N.type="button",N.className="action",N.textContent=J.label,N.addEventListener("click",()=>{w(),J.onClick()}),Z.append(N)}Z.append(P),Q.append(Z)}function j2($,z,J){let j=$.filter((Z)=>Boolean(Z.error)||Z.status!=null&&Z.status>=400).slice(-20).map((Z)=>({method:Z.method,url:Z.url,status:Z.status,error:Z.error,at:Z.startedAt})),Q=z.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:J.slice(0,20)}}function r4(){let $={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return $;let z=performance.memory;if(z)$.memoryUsedMb=Math.round(z.usedJSHeapSize/1024/1024),$.memoryLimitMb=Math.round(z.jsHeapSizeLimit/1024/1024);let[J]=performance.getEntriesByType("navigation");if(J)$.domContentLoadedMs=Math.round(J.domContentLoadedEventEnd),$.loadEventMs=Math.round(J.loadEventEnd);return $}function r0($,z){if(!$)return z;try{return $()}catch{return z}}function Q2(){let $=C(),{pathname:z,search:J,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:z,search:J},module:C0(z),user:r0($.user,{}),apiHeaders:H0(r0($.headers,{})),app:{name:v().name,version:v().version,environment:v().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:r4(),extra:r0($.extra,{})}}var s4=2;function L0($){let z=a1(),J=R1();return{context:Q2(),reason:$.reason,note:$.note,cause:j2(z,J,$.erroredQueries),actionTrail:C1(),network:z,console:J,screenshotDataUrl:$.screenshotDataUrl,screenshotMethod:$.screenshotMethod,replay:J2()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:s4}}}async function s0(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let J=await a4();if(J.status==="ok")return{dataUrl:J.dataUrl,method:"display-media"};if(J.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let z=await $6();if(z)return{dataUrl:z,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function a4(){let $=null;try{let z={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};$=await navigator.mediaDevices.getDisplayMedia(z);let J=await t4($);return J?{status:"ok",dataUrl:J}:{status:"error"}}catch(z){if(z instanceof DOMException&&(z.name==="NotAllowedError"||z.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{$?.getTracks().forEach((z)=>z.stop())}}async function t4($){let z=document.createElement("video");z.srcObject=$,z.muted=!0,z.playsInline=!0,await new Promise((Y)=>{let X=!1,P=()=>{if(X)return;X=!0,Y()};z.onloadedmetadata=()=>{z.play().then(P).catch(P)},window.setTimeout(P,1500)}),await e4(z);let{videoWidth:J,videoHeight:j}=z;if(!J||!j)return null;let Q=document.createElement("canvas");Q.width=J,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(z,0,0,J,j),z.pause(),z.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function e4($){return new Promise((z)=>{let J=!1,j=()=>{if(J)return;J=!0,z()},Q=$;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function $6(){let $=C().screenshotFallback;if(!$)return null;let z=await $().catch(()=>null);if(!z)return null;try{return await z(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:(J)=>!(J instanceof HTMLElement&&J.dataset?.debugReporter==="true")})}catch{return null}}var z6=2000,J6=0.82,j6=3000000;function Q6($){return new Promise((z,J)=>{let j=new Image;j.onload=()=>z(j),j.onerror=()=>J(Error("could not read the screenshot")),j.src=$})}async function h0($){try{let z=await Q6($),J=Math.max(z.naturalWidth,z.naturalHeight),j=Math.min(1,z6/J),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(z.naturalWidth*j)),Q.height=Math.max(1,Math.round(z.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return $;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(z,0,0,Q.width,Q.height);let Y=J6,X=Q.toDataURL("image/jpeg",Y);while(X.length>j6&&Y>0.4)Y-=0.15,X=Q.toDataURL("image/jpeg",Y);return X}catch{return $}}var Z6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,K6=/^\d+$/,Y6=/^[0-9a-f]{16,}$/i;function Z2($){if($.reason.type==="manual")return null;let z=$.cause?.failedRequests?.[0];if(!z?.url)return null;let J;try{J=new URL(z.url,"http://x").pathname}catch{J=z.url}let j=J.split("/").map((Z)=>Z6.test(Z)||K6.test(Z)||Y6.test(Z)?":id":Z).join("/"),Q=z.status??(z.error?"ERR":"?");return`${z.method??"REQ"} ${j} ${Q}`}var K2=2000000;function E0($){let{screenshotDataUrl:z,replay:J,...j}=$;return JSON.stringify(j).length}function Y2($,z=2000000){if(E0($)<=z)return $;let J=$.network.map((Q)=>({...Q})),j={...$,network:J};for(let Q of J){if(E0(j)<=z)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&E0(j)>z)j.network=j.network.slice(1);while(j.console.length>1&&E0(j)>z)j.console=j.console.slice(1);return j}function M0($){let z="";for(let J=0;J<$.length;J+=32768)z+=String.fromCharCode(...$.subarray(J,J+32768));return btoa(z)}var G6=4,V6=2,W6=3,X6=0,F6=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),H6=/^\s*javascript:/i;function P6($,z){let J=$.toLowerCase();if(J.startsWith("on")||J==="srcdoc")return!0;return typeof z==="string"&&H6.test(z)}function G2($,z=!1){if(!$)return;for(let J of Object.keys($)){let j=$[J];if(P6(J,j)){if(z)$[J]=null;else delete $[J];continue}if(typeof j!=="string"||!F6.has(J)||!j.includes("?"))continue;$[J]=r(j)}}function a0($){if(!$)return;G2($.attributes);for(let z of $.childNodes??[])a0(z)}function V2($){let z=JSON.parse(JSON.stringify($));for(let J of z){let j=J.data;if(!j||typeof j!=="object")continue;if(J.type===G6&&typeof j.href==="string")j.href=r(j.href);else if(J.type===V6)a0(j.node);else if(J.type===W6&&j.source===X6){for(let Q of j.adds??[])a0(Q.node);for(let Q of j.attributes??[])G2(Q.attributes,!0)}}return z}var U6="session-replay.json.gz",w6="session-replay.json";function M6($){return Boolean($&&$.events.length>0)}async function I6($){if(typeof CompressionStream>"u")return null;try{let z=new Blob([$]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(z).arrayBuffer())}catch{return null}}async function X2($,z){if(!M6($))return{summary:{omitted:"empty"}};let j={seconds:Math.round($.durationMs/1000),events:$.events.length,startedAt:$.startedAt,endedAt:$.endedAt},Q=V2($.events),Z=await W2(Q),Y=!1;if(Z.bytes.byteLength>z&&q6(Q))Q=N6(Q),Z=await W2(Q),Y=!0;let{bytes:X,compressed:P}=Z;if(X.byteLength>z)return{summary:{...j,bytes:X.byteLength,omitted:"too-large"}};return{dataUri:`data:${P?"application/gzip":"application/json"};base64,${M0(X)}`,filename:P?U6:w6,summary:{...j,events:Q.length,bytes:X.byteLength,compressed:P,...Y?{canvasDropped:Y}:{}}}}async function W2($){let z=new TextEncoder().encode(JSON.stringify({events:$})),J=await I6(z);return J?{bytes:J,compressed:!0}:{bytes:z,compressed:!1}}var D6=3,F2=2,B6=9;function H2($){return $.type===D6&&$.data?.source===B6}function q6($){return $.some(H2)||$.some((z)=>z.type===F2&&P2(z.data.node))}function P2($){if(!$)return!1;if($.attributes&&"rr_dataURL"in $.attributes)return!0;return($.childNodes??[]).some(P2)}function U2($){if(!$)return;if($.attributes&&"rr_dataURL"in $.attributes)delete $.attributes.rr_dataURL;for(let z of $.childNodes??[])U2(z)}function N6($){let z=[];for(let J of $){if(H2(J))continue;if(J.type===F2)U2(J.data.node);z.push(J)}return z}var x6=new Set([502,503,504]);class u extends Error{kind;retryAfter;status;constructor($,z,J,j){super($);this.kind=z;this.retryAfter=J;this.status=j;this.name="ReportError"}}function C6($){let{screenshotDataUrl:z,replay:J,...j}=$;return{dataUri:`data:application/json;base64,${M0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function t0(){let $=C().identity;if(!$)return{};try{let z=await $();return z?{authorization:`Bearer ${z}`}:{}}catch{return{}}}async function w2($,z){let J=C(),j=Y2(z,K2),{context:Q,note:Z}=j,Y=[];if(j.screenshotDataUrl){let q=await h0(j.screenshotDataUrl);Y.push({dataUri:q,filename:"screenshot.jpg"})}Y.push(C6(j));let X,P=W0();if(P){let q=await X2(j.replay,P.maxBytes);if(X=q.summary,"dataUri"in q)Y.push({dataUri:q.dataUri,filename:q.filename})}let w=Z2(j),T={title:$,description:Z.trim()||void 0,appName:v().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:v().name,module:Q.module?.label??""},context:{...w?{signature:w}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...X?{replay:X}:{}},attachments:Y},N=await fetch(`${J.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await t0()},body:JSON.stringify(T)}).catch(()=>{throw new u("report never left the browser","offline")});if(!N.ok)throw await e0(N);return await N.json()}async function e0($){let z=$.headers.get("retry-after"),J=await $.json().then((j)=>j.error).catch(()=>null);if($.status===429)return new u("rate limited","rateLimited",z??void 0);if(x6.has($.status))return new u("desk unavailable","unavailable");return new u(J??`Report failed (${$.status})`,"rejected",void 0,$.status)}var m0=null,I0=null,M2=()=>C().host.replace(/\/$/,"");function $1(){return m0}function Y0(){if(I0)return I0;return I0=(async()=>{try{let $=await fetch(`${M2()}/ingest/request-types`,{headers:{"x-realm-key":C().realmKey}}),z=$.ok?await $.json():null;m0=Array.isArray(z?.types)?z.types.filter(k6):[]}catch{m0=[],I0=null}return m0??[]})(),I0}function k6($){let z=$;return!!z&&typeof z.id==="string"&&typeof z.name==="string"}async function I2($){let z=C(),J={};try{J=z.user?.()??{}}catch{J={}}let j=typeof window>"u"?null:window.location,Q={title:$.title,description:$.description.trim()||void 0,ticketTypeId:$.ticketTypeId,appName:v().name,category:j?C0(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:J.email??void 0,requesterName:J.fullName??void 0,attachments:$.screenshotDataUrl?[{dataUri:await h0($.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${M2()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":z.realmKey,...await t0()},body:JSON.stringify(Q)}).catch(()=>{throw new u("request never left the browser","offline")});if(!Z.ok)throw await e0(Z);return await Z.json()}var D0=Math.PI/6;function D2($,z,J){let j=z.x-$.x,Q=z.y-$.y,Z=Math.hypot(j,Q),Y=Math.atan2(Q,j),X=[{x:z.x,y:z.y},{x:z.x-J*Math.cos(Y-D0),y:z.y-J*Math.sin(Y-D0)},{x:z.x-J*Math.cos(Y+D0),y:z.y-J*Math.sin(Y+D0)}],P=J*Math.cos(D0)*0.92;if(Z<=P)return{shaft:null,head:X};return{shaft:{from:$,to:{x:z.x-P*Math.cos(Y),y:z.y-P*Math.sin(Y)}},head:X}}var z1="#f44336",S6="rgba(250, 204, 21, 0.4)",J1=22,B2="#2563eb",q2=9,N2=11,x2=18,C2=4,g0=8,O6=[{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 k2($,z,J){let j=[],Q=null,Z=-1,Y=null,X=null,P=$.getContext("2d");function w(){let K=$.getBoundingClientRect().width;return K>0?$.width/K:1}function T(K){let G=$.getBoundingClientRect();return{x:(K.clientX-G.left)/G.width*$.width,y:(K.clientY-G.top)/G.height*$.height}}function N(K){let G=K.size??J1;if(!P)return(K.text?.length??0)*G*0.6;P.save(),P.font=`600 ${G}px system-ui, sans-serif`;let W=P.measureText(K.text??"").width;return P.restore(),W}function q(K){if(K.tool==="text"){let G=K.size??J1;return{left:K.x1,top:K.y1,right:K.x1+N(K),bottom:K.y1+G*1.25}}return{left:Math.min(K.x1,K.x2),top:Math.min(K.y1,K.y2),right:Math.max(K.x1,K.x2),bottom:Math.max(K.y1,K.y2)}}function x(K){if(K.tool==="arrow")return[{id:"tail",x:K.x1,y:K.y1,cursor:"move"},{id:"head",x:K.x2,y:K.y2,cursor:"move"}];let G=q(K);if(K.tool==="text")return[{id:"size",x:G.right,y:G.bottom,cursor:"nwse-resize"}];return O6.map((W)=>({id:W.id,x:G.left+(G.right-G.left)*W.fx,y:G.top+(G.bottom-G.top)*W.fy,cursor:W.cursor}))}function A(K){let G=q(K);return{x:G.right+x2*w(),y:G.top-x2*w()}}function i(K,G,W){let{shaft:V,head:F}=D2({x:G.x1,y:G.y1},{x:G.x2,y:G.y2},Math.max(10,16*W));if(V)K.lineCap="butt",K.beginPath(),K.moveTo(V.from.x,V.from.y),K.lineTo(V.to.x,V.to.y),K.stroke();K.beginPath(),K.moveTo(F[0].x,F[0].y),K.lineTo(F[1].x,F[1].y),K.lineTo(F[2].x,F[2].y),K.closePath(),K.fill()}function a(K,G,W){K.save(),K.lineWidth=Math.max(2,3*W),K.strokeStyle=z1,K.fillStyle=z1;let V=q(G);if(G.tool==="rect")K.strokeRect(V.left,V.top,V.right-V.left,V.bottom-V.top);else if(G.tool==="arrow")i(K,G,W);else if(G.tool==="highlight")K.fillStyle=S6,K.fillRect(V.left,V.top,V.right-V.left,V.bottom-V.top);else if(G.tool==="text"&&G.text){let F=G.size??J1;K.font=`600 ${F}px system-ui, sans-serif`,K.textBaseline="top";let U=F*0.22;K.fillStyle="rgba(255,255,255,0.92)",K.fillRect(V.left-U,V.top-U,V.right-V.left+U*2,V.bottom-V.top+U*2),K.fillStyle=z1,K.fillText(G.text,V.left,V.top)}K.restore()}function $0(K,G,W){let V=q(G);K.save(),K.strokeStyle=B2,K.lineWidth=Math.max(1,1.5*W),K.setLineDash([6*W,4*W]),K.strokeRect(V.left,V.top,V.right-V.left,V.bottom-V.top),K.setLineDash([]);let F=q2*W;for(let H of x(G))K.fillStyle="#fff",K.strokeStyle=B2,K.lineWidth=Math.max(1,1.5*W),K.beginPath(),K.rect(H.x-F/2,H.y-F/2,F,F),K.fill(),K.stroke();let U=A(G),D=N2*W;K.beginPath(),K.arc(U.x,U.y,D,0,Math.PI*2),K.fillStyle="#dc2626",K.fill(),K.strokeStyle="#fff",K.lineWidth=Math.max(1.5,2*W),K.beginPath(),K.moveTo(U.x-D*0.4,U.y-D*0.4),K.lineTo(U.x+D*0.4,U.y+D*0.4),K.moveTo(U.x+D*0.4,U.y-D*0.4),K.lineTo(U.x-D*0.4,U.y+D*0.4),K.stroke(),K.restore()}function k(){if(!P)return;let K=w();if(P.clearRect(0,0,$.width,$.height),P.drawImage(z,0,0,$.width,$.height),j.forEach((W,V)=>{if(V!==c)a(P,W,K)}),Y)a(P,Y,K);let G=j[Z];if(G&&!Y)$0(P,G,K)}function d(K,G,W,V,F){return Math.abs(K-W)<=F&&Math.abs(G-V)<=F}function t(K,G){let W=j[Z];if(!W)return null;let V=q2*w()/2+3*w();for(let F of x(W))if(d(K,G,F.x,F.y,V))return F.id;return null}function O(K,G){let W=j[Z];if(!W)return!1;let V=A(W);return d(K,G,V.x,V.y,N2*w())}function z0(K,G){let W=6*w();for(let V=j.length-1;V>=0;V-=1){let F=j[V];if(F.tool==="arrow"){let D=F.x2-F.x1,H=F.y2-F.y1,M=Math.hypot(D,H)||1,I=Math.max(0,Math.min(1,((K-F.x1)*D+(G-F.y1)*H)/(M*M)));if(Math.hypot(K-(F.x1+I*D),G-(F.y1+I*H))<=W+4*w())return V;continue}let U=q(F);if(K>=U.left-W&&K<=U.right+W&&G>=U.top-W&&G<=U.bottom+W)return V}return-1}function g(K,G,W,V,F){if(G==="tail"){K.x1=W.x1+V,K.y1=W.y1+F;return}if(G==="head"){K.x2=W.x2+V,K.y2=W.y2+F;return}if(G==="size"){let S=(W.size??24)+F;K.size=Math.max(10,S);return}let U=q(W),{left:D,top:H,right:M,bottom:I}=U;if(G.includes("w"))D=Math.min(M-g0,D+V);if(G.includes("e"))M=Math.max(D+g0,M+V);if(G.includes("n"))H=Math.min(I-g0,H+F);if(G.includes("s"))I=Math.max(H+g0,I+F);K.x1=D,K.y1=H,K.x2=M,K.y2=I}function q0(K,G,W,V){K.x1=G.x1+W,K.y1=G.y1+V,K.x2=G.x2+W,K.y2=G.y2+V}let f=null,c=-1,L={x:0,y:0,size:24};function G0(){let K=$.getBoundingClientRect().width;return K>0?K/$.width:1}function N0(K,G){if(!P)return K.length*G*0.6;P.save(),P.font=`600 ${G}px system-ui, sans-serif`;let W=P.measureText(K||" ").width;return P.restore(),W}function y(){if(!f)return;let K=$.parentElement;if(!K)return;let G=$.getBoundingClientRect(),W=K.getBoundingClientRect(),V=G0(),F=L.size*V;f.style.left=`${G.left-W.left+L.x*V}px`,f.style.top=`${G.top-W.top+L.y*V}px`,f.style.fontSize=`${F}px`,f.style.width=`${Math.max(40,N0(f.value,F)+F)}px`}function R(K){let G=f;if(!G)return;f=null;let W=G.value.trim(),V=c;if(c=-1,G.remove(),K&&W){if(V>=0&&j[V])j[V].text=W,Z=V;else j.push({tool:"text",x1:L.x,y1:L.y,x2:L.x,y2:L.y,text:W,size:L.size}),Z=j.length-1;J()}else if(V>=0)Z=V;$.focus(),k()}function J0(K,G,W=-1){R(!0);let V=$.parentElement;if(!V)return;if(getComputedStyle(V).position==="static")V.style.position="relative";let F=W>=0?j[W]:void 0;c=W,L={x:F?.x1??K,y:F?.y1??G,size:F?.size??Math.round(24*w())};let U=document.createElement("input");U.type="text",U.className="text-edit",U.value=F?.text??"",U.setAttribute("aria-label","ข้อความบนภาพ"),U.placeholder="ข้อความ",f=U,V.append(U),y(),U.addEventListener("input",y),U.addEventListener("keydown",(D)=>{if(D.stopPropagation(),D.key==="Enter")R(!0);else if(D.key==="Escape")R(!1)}),requestAnimationFrame(()=>{if(f!==U)return;U.focus(),U.select(),U.addEventListener("blur",()=>R(!0))}),k()}function V0(K){let{x:G,y:W}=T(K);if($.setPointerCapture(K.pointerId),O(G,W)){j0();return}let V=t(G,W);if(V&&j[Z]){X={grip:V,x:G,y:W,start:{...j[Z]}};return}if(Q==="text"){if(K.preventDefault(),$.hasPointerCapture(K.pointerId))$.releasePointerCapture(K.pointerId);Q=null,J(),J0(G,W);return}if(Q){Y={tool:Q,x1:G,y1:W,x2:G,y2:W},Z=-1;return}let F=z0(G,W);Z=F,X=F>=0?{grip:"body",x:G,y:W,start:{...j[F]}}:null,k()}function o(K){let{x:G,y:W}=T(K);if(Y){Y.x2=G,Y.y2=W,k();return}if(X){let F=j[Z];if(!F)return;let U=G-X.x,D=W-X.y;if(X.grip==="body")q0(F,X.start,U,D);else g(F,X.grip,X.start,U,D);k();return}if(Q){$.style.cursor="crosshair";return}if(O(G,W)){$.style.cursor="pointer";return}let V=t(G,W);if(V){let F=j[Z]?x(j[Z]).find((U)=>U.id===V):null;$.style.cursor=F?.cursor??"pointer";return}$.style.cursor=z0(G,W)>=0?"move":"default"}function b(){if(Y){if(!(Math.abs(Y.x2-Y.x1)<C2&&Math.abs(Y.y2-Y.y1)<C2))j.push(Y),Z=j.length-1,Q=null,J();Y=null}if(X)X=null,J();k()}function l(K){let G=$.getBoundingClientRect(),W=(K.clientX-G.left)/G.width*$.width,V=(K.clientY-G.top)/G.height*$.height,F=z0(W,V),U=j[F];if(!U||U.tool!=="text")return;K.preventDefault(),J0(U.x1,U.y1,F)}function e(K){if(Z<0)return;if(K.key==="Delete"||K.key==="Backspace")K.preventDefault(),j0();else if(K.key==="Escape")K.preventDefault(),Z=-1,k()}function j0(){if(Z<0)return;j.splice(Z,1),Z=-1,J(),k()}return $.addEventListener("pointerdown",V0),$.addEventListener("pointermove",o),$.addEventListener("pointerup",b),$.addEventListener("pointercancel",b),$.addEventListener("dblclick",l),$.tabIndex=0,$.addEventListener("keydown",e),k(),{setTool(K){Q=K,Z=-1,$.style.cursor=K?"crosshair":"default",k()},deleteSelected:j0,clear(){j.length=0,Z=-1,J(),k()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let K=document.createElement("canvas");K.width=z.naturalWidth,K.height=z.naturalHeight;let G=K.getContext("2d");if(!G)return $.toDataURL("image/png");G.drawImage(z,0,0);let W=w();for(let V of j)a(G,V,W);return K.toDataURL("image/png")},destroy(){R(!1),$.removeEventListener("pointerdown",V0),$.removeEventListener("pointermove",o),$.removeEventListener("pointerup",b),$.removeEventListener("pointercancel",b),$.removeEventListener("dblclick",l),$.removeEventListener("keydown",e)}}}var _6=["keydown","keyup","keypress"];function S2($){for(let z of _6)$.addEventListener(z,(J)=>J.stopPropagation())}var O2=`
|
|
33
|
+
`,V1=null;function A6(){if(typeof document>"u")return null;if(V1?.isConnected)return V1;let z=document.createElement(S6);z.dataset.debugReporter="true";let J=z.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=k6;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append($,j),document.body.append(z),V1=j,j}function P0(z,J="success",$){let j=h0()?B().toast:void 0;if(j){j({message:z,tone:J,...$?{action:$}:{}});return}let Q=A6();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=J;let W=document.createElement("span");W.className="dot";let X=document.createElement("span");X.textContent=z;let H=document.createElement("button");H.type="button",H.className="close",H.textContent="✕",H.setAttribute("aria-label","ปิด");let U=()=>{window.clearTimeout(k),Z.remove()};H.addEventListener("click",U);let k=J==="error"||$?0:window.setTimeout(U,R6);if(Z.append(W,X),$){let O=document.createElement("button");O.type="button",O.className="action",O.textContent=$.label,O.addEventListener("click",()=>{U(),$.onClick()}),Z.append(O)}Z.append(H),Q.append(Z)}function w2(z,J,$){let j=z.filter((Z)=>Boolean(Z.error)||Z.status!=null&&Z.status>=400).slice(-20).map((Z)=>({method:Z.method,url:Z.url,status:Z.status,error:Z.error,at:Z.startedAt})),Q=J.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:$.slice(0,20)}}function L6(){let z={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return z;let J=performance.memory;if(J)z.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),z.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[$]=performance.getEntriesByType("navigation");if($)z.domContentLoadedMs=Math.round($.domContentLoadedEventEnd),z.loadEventMs=Math.round($.loadEventEnd);return z}function Y1(z,J){if(!z)return J;try{return z()}catch{return J}}function O2(){let z=B(),{pathname:J,search:$,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:$},module:b0(J),user:Y1(z.user,{}),apiHeaders:C0(Y1(z.headers,{})),app:{name:o().name,version:o().version,environment:o().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:L6(),extra:Y1(z.extra,{})}}var T6=2;function c0(z){let J=D2(),$=a1();return{context:O2(),reason:z.reason,note:z.note,cause:w2(J,$,z.erroredQueries),actionTrail:c1(),network:J,console:$,screenshotDataUrl:z.screenshotDataUrl,screenshotMethod:z.screenshotMethod,replay:C2()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:T6}}}async function X1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await f6();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await h6();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function f6(){let z=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};z=await navigator.mediaDevices.getDisplayMedia(J);let $=await E6(z);return $?{status:"ok",dataUrl:$}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{z?.getTracks().forEach((J)=>J.stop())}}async function E6(z){let J=document.createElement("video");J.srcObject=z,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 m6(J);let{videoWidth:$,videoHeight:j}=J;if(!$||!j)return null;let Q=document.createElement("canvas");Q.width=$,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(J,0,0,$,j),J.pause(),J.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function m6(z){return new Promise((J)=>{let $=!1,j=()=>{if($)return;$=!0,J()},Q=z;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function h6(){let z=B().screenshotFallback;if(!z)return null;let J=await z().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:($)=>!($ instanceof HTMLElement&&$.dataset?.debugReporter==="true")})}catch{return null}}var b6=2000,g6=0.82,v6=3000000;function y6(z){return new Promise((J,$)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>$(Error("could not read the screenshot")),j.src=z})}async function l0(z){try{let J=await y6(z),$=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,b6/$),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(J.naturalWidth*j)),Q.height=Math.max(1,Math.round(J.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return z;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(J,0,0,Q.width,Q.height);let W=g6,X=Q.toDataURL("image/jpeg",W);while(X.length>v6&&W>0.4)W-=0.15,X=Q.toDataURL("image/jpeg",W);return X}catch{return z}}var p6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,u6=/^\d+$/,d6=/^[0-9a-f]{16,}$/i;function _2(z){if(z.reason.type==="manual")return null;let J=z.cause?.failedRequests?.[0];if(!J?.url)return null;let $;try{$=new URL(J.url,"http://x").pathname}catch{$=J.url}let j=$.split("/").map((Z)=>p6.test(Z)||u6.test(Z)||d6.test(Z)?":id":Z).join("/"),Q=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${Q}`}var S2=2000000;function o0(z){let{screenshotDataUrl:J,replay:$,...j}=z;return JSON.stringify(j).length}function R2(z,J=2000000){if(o0(z)<=J)return z;let $=z.network.map((Q)=>({...Q})),j={...z,network:$};for(let Q of $){if(o0(j)<=J)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&o0(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&o0(j)>J)j.console=j.console.slice(1);return j}function S0(z){let J="";for(let $=0;$<z.length;$+=32768)J+=String.fromCharCode(...z.subarray($,$+32768));return btoa(J)}var i6=4,c6=2,l6=3,o6=0,r6=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),n6=/^\s*javascript:/i;function s6(z,J){let $=z.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof J==="string"&&n6.test(J)}function k2(z,J=!1){if(!z)return;for(let $ of Object.keys(z)){let j=z[$];if(s6($,j)){if(J)z[$]=null;else delete z[$];continue}if(typeof j!=="string"||!r6.has($)||!j.includes("?"))continue;z[$]=z0(j)}}function G1(z){if(!z)return;k2(z.attributes);for(let J of z.childNodes??[])G1(J)}function A2(z){let J=JSON.parse(JSON.stringify(z));for(let $ of J){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===i6&&typeof j.href==="string")j.href=z0(j.href);else if($.type===c6)G1(j.node);else if($.type===l6&&j.source===o6){for(let Q of j.adds??[])G1(Q.node);for(let Q of j.attributes??[])k2(Q.attributes,!0)}}return J}var a6="session-replay.json.gz",t6="session-replay.json";function e6(z){return Boolean(z&&z.events.length>0)}async function z8(z){if(typeof CompressionStream>"u")return null;try{let J=new Blob([z]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function T2(z,J){if(!e6(z))return{summary:{omitted:"empty"}};let j={seconds:Math.round(z.durationMs/1000),events:z.events.length,startedAt:z.startedAt,endedAt:z.endedAt},Q=A2(z.events),Z=await L2(Q),W=!1;if(Z.bytes.byteLength>J&&j8(Q))Q=Q8(Q),Z=await L2(Q),W=!0;let{bytes:X,compressed:H}=Z;if(X.byteLength>J)return{summary:{...j,bytes:X.byteLength,omitted:"too-large"}};return{dataUri:`data:${H?"application/gzip":"application/json"};base64,${S0(X)}`,filename:H?a6:t6,summary:{...j,events:Q.length,bytes:X.byteLength,compressed:H,...W?{canvasDropped:W}:{}}}}async function L2(z){let J=new TextEncoder().encode(JSON.stringify({events:z})),$=await z8(J);return $?{bytes:$,compressed:!0}:{bytes:J,compressed:!1}}var J8=3,f2=2,$8=9;function E2(z){return z.type===J8&&z.data?.source===$8}function j8(z){return z.some(E2)||z.some((J)=>J.type===f2&&m2(J.data.node))}function m2(z){if(!z)return!1;if(z.attributes&&"rr_dataURL"in z.attributes)return!0;return(z.childNodes??[]).some(m2)}function h2(z){if(!z)return;if(z.attributes&&"rr_dataURL"in z.attributes)delete z.attributes.rr_dataURL;for(let J of z.childNodes??[])h2(J)}function Q8(z){let J=[];for(let $ of z){if(E2($))continue;if($.type===f2)h2($.data.node);J.push($)}return J}var Z8=new Set([502,503,504]);class r extends Error{kind;retryAfter;status;constructor(z,J,$,j){super(z);this.kind=J;this.retryAfter=$;this.status=j;this.name="ReportError"}}function K8(z){let{screenshotDataUrl:J,replay:$,...j}=z;return{dataUri:`data:application/json;base64,${S0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function F1(){let z=B().identity;if(!z)return{};try{let J=await z();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function b2(z,J){let $=B(),j=R2(J,S2),{context:Q,note:Z}=j,W=[];if(j.screenshotDataUrl){let w=await l0(j.screenshotDataUrl);W.push({dataUri:w,filename:"screenshot.jpg"})}W.push(K8(j));let X,H=N0();if(H){let w=await T2(j.replay,H.maxBytes);if(X=w.summary,"dataUri"in w)W.push({dataUri:w.dataUri,filename:w.filename})}let U=_2(j),k={title:z,description:Z.trim()||void 0,appName:o().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:o().name,module:Q.module?.label??""},context:{...U?{signature:U}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...X?{replay:X}:{}},attachments:W},O=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await F1()},body:JSON.stringify(k)}).catch(()=>{throw new r("report never left the browser","offline")});if(!O.ok)throw await H1(O);return await O.json()}async function H1(z){let J=z.headers.get("retry-after"),$=await z.json().then((j)=>j.error).catch(()=>null);if(z.status===429)return new r("rate limited","rateLimited",J??void 0);if(Z8.has(z.status))return new r("desk unavailable","unavailable");return new r($??`Report failed (${z.status})`,"rejected",void 0,z.status)}var r0=null,R0=null,g2=()=>B().host.replace(/\/$/,"");function P1(){return r0}function U0(){if(R0)return R0;return R0=(async()=>{try{let z=await fetch(`${g2()}/ingest/request-types`,{headers:{"x-realm-key":B().realmKey}}),J=z.ok?await z.json():null;r0=Array.isArray(J?.types)?J.types.filter(W8):[]}catch{r0=[],R0=null}return r0??[]})(),R0}function W8(z){let J=z;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function v2(z){let J=B(),$={};try{$=J.user?.()??{}}catch{$={}}let j=typeof window>"u"?null:window.location,Q={title:z.title,description:z.description.trim()||void 0,ticketTypeId:z.ticketTypeId,appName:o().name,category:j?b0(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:z.screenshotDataUrl?[{dataUri:await l0(z.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${g2()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await F1()},body:JSON.stringify(Q)}).catch(()=>{throw new r("request never left the browser","offline")});if(!Z.ok)throw await H1(Z);return await Z.json()}var k0=Math.PI/6;function y2(z,J,$){let j=J.x-z.x,Q=J.y-z.y,Z=Math.hypot(j,Q),W=Math.atan2(Q,j),X=[{x:J.x,y:J.y},{x:J.x-$*Math.cos(W-k0),y:J.y-$*Math.sin(W-k0)},{x:J.x-$*Math.cos(W+k0),y:J.y-$*Math.sin(W+k0)}],H=$*Math.cos(k0)*0.92;if(Z<=H)return{shaft:null,head:X};return{shaft:{from:z,to:{x:J.x-H*Math.cos(W),y:J.y-H*Math.sin(W)}},head:X}}var U1="#f44336",V8="rgba(250, 204, 21, 0.4)",M1=22,p2="#2563eb",u2=9,d2=11,i2=18,c2=4,n0=8,Y8=[{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 l2(z,J,$){let j=[],Q=null,Z=-1,W=null,X=null,H=z.getContext("2d");function U(){let K=z.getBoundingClientRect().width;return K>0?z.width/K:1}function k(K){let V=z.getBoundingClientRect();return{x:(K.clientX-V.left)/V.width*z.width,y:(K.clientY-V.top)/V.height*z.height}}function O(K){let V=K.size??M1;if(!H)return(K.text?.length??0)*V*0.6;H.save(),H.font=`600 ${V}px system-ui, sans-serif`;let G=H.measureText(K.text??"").width;return H.restore(),G}function w(K){if(K.tool==="text"){let V=K.size??M1;return{left:K.x1,top:K.y1,right:K.x1+O(K),bottom:K.y1+V*1.25}}return{left:Math.min(K.x1,K.x2),top:Math.min(K.y1,K.y2),right:Math.max(K.x1,K.x2),bottom:Math.max(K.y1,K.y2)}}function _(K){if(K.tool==="arrow")return[{id:"tail",x:K.x1,y:K.y1,cursor:"move"},{id:"head",x:K.x2,y:K.y2,cursor:"move"}];let V=w(K);if(K.tool==="text")return[{id:"size",x:V.right,y:V.bottom,cursor:"nwse-resize"}];return Y8.map((G)=>({id:G.id,x:V.left+(V.right-V.left)*G.fx,y:V.top+(V.bottom-V.top)*G.fy,cursor:G.cursor}))}function S(K){let V=w(K);return{x:V.right+i2*U(),y:V.top-i2*U()}}function i(K,V,G){let{shaft:Y,head:F}=y2({x:V.x1,y:V.y1},{x:V.x2,y:V.y2},Math.max(10,16*G));if(Y)K.lineCap="butt",K.beginPath(),K.moveTo(Y.from.x,Y.from.y),K.lineTo(Y.to.x,Y.to.y),K.stroke();K.beginPath(),K.moveTo(F[0].x,F[0].y),K.lineTo(F[1].x,F[1].y),K.lineTo(F[2].x,F[2].y),K.closePath(),K.fill()}function n(K,V,G){K.save(),K.lineWidth=Math.max(2,3*G),K.strokeStyle=U1,K.fillStyle=U1;let Y=w(V);if(V.tool==="rect")K.strokeRect(Y.left,Y.top,Y.right-Y.left,Y.bottom-Y.top);else if(V.tool==="arrow")i(K,V,G);else if(V.tool==="highlight")K.fillStyle=V8,K.fillRect(Y.left,Y.top,Y.right-Y.left,Y.bottom-Y.top);else if(V.tool==="text"&&V.text){let F=V.size??M1;K.font=`600 ${F}px system-ui, sans-serif`,K.textBaseline="top";let M=F*0.22;K.fillStyle="rgba(255,255,255,0.92)",K.fillRect(Y.left-M,Y.top-M,Y.right-Y.left+M*2,Y.bottom-Y.top+M*2),K.fillStyle=U1,K.fillText(V.text,Y.left,Y.top)}K.restore()}function E(K,V,G){let Y=w(V);K.save(),K.strokeStyle=p2,K.lineWidth=Math.max(1,1.5*G),K.setLineDash([6*G,4*G]),K.strokeRect(Y.left,Y.top,Y.right-Y.left,Y.bottom-Y.top),K.setLineDash([]);let F=u2*G;for(let f of _(V))K.fillStyle="#fff",K.strokeStyle=p2,K.lineWidth=Math.max(1,1.5*G),K.beginPath(),K.rect(f.x-F/2,f.y-F/2,F,F),K.fill(),K.stroke();let M=S(V),I=d2*G;K.beginPath(),K.arc(M.x,M.y,I,0,Math.PI*2),K.fillStyle="#dc2626",K.fill(),K.strokeStyle="#fff",K.lineWidth=Math.max(1.5,2*G),K.beginPath(),K.moveTo(M.x-I*0.4,M.y-I*0.4),K.lineTo(M.x+I*0.4,M.y+I*0.4),K.moveTo(M.x+I*0.4,M.y-I*0.4),K.lineTo(M.x-I*0.4,M.y+I*0.4),K.stroke(),K.restore()}function x(){if(!H)return;let K=U();if(H.clearRect(0,0,z.width,z.height),H.drawImage(J,0,0,z.width,z.height),j.forEach((G,Y)=>{if(Y!==Q0)n(H,G,K)}),W)n(H,W,K);let V=j[Z];if(V&&!W)E(H,V,K)}function V0(K,V,G,Y,F){return Math.abs(K-G)<=F&&Math.abs(V-Y)<=F}function j0(K,V){let G=j[Z];if(!G)return null;let Y=u2*U()/2+3*U();for(let F of _(G))if(V0(K,V,F.x,F.y,Y))return F.id;return null}function T(K,V){let G=j[Z];if(!G)return!1;let Y=S(G);return V0(K,V,Y.x,Y.y,d2*U())}function c(K,V){let G=6*U();for(let Y=j.length-1;Y>=0;Y-=1){let F=j[Y];if(F.tool==="arrow"){let I=F.x2-F.x1,f=F.y2-F.y1,d=Math.hypot(I,f)||1,P=Math.max(0,Math.min(1,((K-F.x1)*I+(V-F.y1)*f)/(d*d)));if(Math.hypot(K-(F.x1+P*I),V-(F.y1+P*f))<=G+4*U())return Y;continue}let M=w(F);if(K>=M.left-G&&K<=M.right+G&&V>=M.top-G&&V<=M.bottom+G)return Y}return-1}function L(K,V,G,Y,F){if(V==="tail"){K.x1=G.x1+Y,K.y1=G.y1+F;return}if(V==="head"){K.x2=G.x2+Y,K.y2=G.y2+F;return}if(V==="size"){let N=(G.size??24)+F;K.size=Math.max(10,N);return}let M=w(G),{left:I,top:f,right:d,bottom:P}=M;if(V.includes("w"))I=Math.min(d-n0,I+Y);if(V.includes("e"))d=Math.max(I+n0,d+Y);if(V.includes("n"))f=Math.min(P-n0,f+F);if(V.includes("s"))P=Math.max(f+n0,P+F);K.x1=I,K.y1=f,K.x2=d,K.y2=P}function E0(K,V,G,Y){K.x1=V.x1+G,K.y1=V.y1+Y,K.x2=V.x2+G,K.y2=V.y2+Y}let R=null,Q0=-1,m={x:0,y:0,size:24};function I0(){let K=z.getBoundingClientRect().width;return K>0?K/z.width:1}function m0(K,V){if(!H)return K.length*V*0.6;H.save(),H.font=`600 ${V}px system-ui, sans-serif`;let G=H.measureText(K||" ").width;return H.restore(),G}function Y0(){if(!R)return;let K=z.parentElement;if(!K)return;let V=z.getBoundingClientRect(),G=K.getBoundingClientRect(),Y=I0(),F=m.size*Y;R.style.left=`${V.left-G.left+m.x*Y}px`,R.style.top=`${V.top-G.top+m.y*Y}px`,R.style.fontSize=`${F}px`,R.style.width=`${Math.max(40,m0(R.value,F)+F)}px`}function s(K){let V=R;if(!V)return;R=null;let G=V.value.trim(),Y=Q0;if(Q0=-1,V.remove(),K&&G){if(Y>=0&&j[Y])j[Y].text=G,Z=Y;else j.push({tool:"text",x1:m.x,y1:m.y,x2:m.x,y2:m.y,text:G,size:m.size}),Z=j.length-1;$()}else if(Y>=0)Z=Y;z.focus(),x()}function l(K,V,G=-1){s(!0);let Y=z.parentElement;if(!Y)return;if(getComputedStyle(Y).position==="static")Y.style.position="relative";let F=G>=0?j[G]:void 0;Q0=G,m={x:F?.x1??K,y:F?.y1??V,size:F?.size??Math.round(24*U())};let M=document.createElement("input");M.type="text",M.className="text-edit",M.value=F?.text??"",M.setAttribute("aria-label","ข้อความบนภาพ"),M.placeholder="ข้อความ",R=M,Y.append(M),Y0(),M.addEventListener("input",Y0),M.addEventListener("keydown",(I)=>{if(I.stopPropagation(),I.key==="Enter")s(!0);else if(I.key==="Escape")s(!1)}),requestAnimationFrame(()=>{if(R!==M)return;M.focus(),M.select(),M.addEventListener("blur",()=>s(!0))}),x()}function p(K){let{x:V,y:G}=k(K);if(z.setPointerCapture(K.pointerId),T(V,G)){u();return}let Y=j0(V,G);if(Y&&j[Z]){X={grip:Y,x:V,y:G,start:{...j[Z]}};return}if(Q==="text"){if(K.preventDefault(),z.hasPointerCapture(K.pointerId))z.releasePointerCapture(K.pointerId);Q=null,$(),l(V,G);return}if(Q){W={tool:Q,x1:V,y1:G,x2:V,y2:G},Z=-1;return}let F=c(V,G);Z=F,X=F>=0?{grip:"body",x:V,y:G,start:{...j[F]}}:null,x()}function X0(K){let{x:V,y:G}=k(K);if(W){W.x2=V,W.y2=G,x();return}if(X){let F=j[Z];if(!F)return;let M=V-X.x,I=G-X.y;if(X.grip==="body")E0(F,X.start,M,I);else L(F,X.grip,X.start,M,I);x();return}if(Q){z.style.cursor="crosshair";return}if(T(V,G)){z.style.cursor="pointer";return}let Y=j0(V,G);if(Y){let F=j[Z]?_(j[Z]).find((M)=>M.id===Y):null;z.style.cursor=F?.cursor??"pointer";return}z.style.cursor=c(V,G)>=0?"move":"default"}function Z0(){if(W){if(!(Math.abs(W.x2-W.x1)<c2&&Math.abs(W.y2-W.y1)<c2))j.push(W),Z=j.length-1,Q=null,$();W=null}if(X)X=null,$();x()}function a(K){let V=z.getBoundingClientRect(),G=(K.clientX-V.left)/V.width*z.width,Y=(K.clientY-V.top)/V.height*z.height,F=c(G,Y),M=j[F];if(!M||M.tool!=="text")return;K.preventDefault(),l(M.x1,M.y1,F)}function t(K){if(Z<0)return;if(K.key==="Delete"||K.key==="Backspace")K.preventDefault(),u();else if(K.key==="Escape")K.preventDefault(),Z=-1,x()}function u(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),x()}return z.addEventListener("pointerdown",p),z.addEventListener("pointermove",X0),z.addEventListener("pointerup",Z0),z.addEventListener("pointercancel",Z0),z.addEventListener("dblclick",a),z.tabIndex=0,z.addEventListener("keydown",t),x(),{setTool(K){Q=K,Z=-1,z.style.cursor=K?"crosshair":"default",x()},deleteSelected:u,clear(){j.length=0,Z=-1,$(),x()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let K=document.createElement("canvas");K.width=J.naturalWidth,K.height=J.naturalHeight;let V=K.getContext("2d");if(!V)return z.toDataURL("image/png");V.drawImage(J,0,0);let G=U();for(let Y of j)n(V,Y,G);return K.toDataURL("image/png")},destroy(){s(!1),z.removeEventListener("pointerdown",p),z.removeEventListener("pointermove",X0),z.removeEventListener("pointerup",Z0),z.removeEventListener("pointercancel",Z0),z.removeEventListener("dblclick",a),z.removeEventListener("keydown",t)}}}var X8=["keydown","keyup","keypress"];function A0(z){for(let J of X8)z.addEventListener(J,($)=>$.stopPropagation())}var o2=`
|
|
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, select {
|
|
57
|
+
input[type="text"], input[type="search"], 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, select:focus {
|
|
61
|
+
input[type="text"]:focus, input[type="search"]: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; }
|
|
@@ -118,8 +118,10 @@ canvas { width: 100%; height: auto; display: block; border: 1px solid #e2e8f0; b
|
|
|
118
118
|
แจ้งปัญหา · คำขอ as two cards under the heading, the way the desk's own
|
|
119
119
|
สร้างเวิร์กโฟลว์ asks it; what is asked for as cards, the way the portal lists it. */
|
|
120
120
|
[hidden] { display: none !important; }
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
/* The press's choice: two cards in a smaller dialog, before anything is asked of the browser. */
|
|
122
|
+
.kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
|
|
123
|
+
/* In the form, the choice is made: one quiet line under the heading to switch. */
|
|
124
|
+
.door { margin: -8px 0 0; font-size: 13px; color: #64748b; }
|
|
123
125
|
.panel.narrow { width: min(560px, 100%); }
|
|
124
126
|
.kinds.choose { margin: 0 0 24px; }
|
|
125
127
|
.kinds.choose button.kind { padding: 16px 18px; gap: 6px; }
|
|
@@ -140,7 +142,16 @@ button.kind[aria-checked="true"], button.kind[aria-checked="true"]:hover:not(:di
|
|
|
140
142
|
button.kind[aria-checked="true"] .tick { opacity: 1; }
|
|
141
143
|
button.kind:focus-visible, button.type:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25); }
|
|
142
144
|
button.kind[aria-checked="true"]:focus-visible { box-shadow: inset 0 0 0 1px #2563eb, 0 0 0 3px rgba(37, 99, 235, 0.25); }
|
|
143
|
-
.types { display: grid; gap:
|
|
145
|
+
.types { display: grid; gap: 6px; }
|
|
146
|
+
/* A long list scrolls in its own height, so the title and ส่งคำขอ stay near. */
|
|
147
|
+
.types.long { max-height: 300px; overflow-y: auto; padding: 2px; margin: -2px; overscroll-behavior: contain; }
|
|
148
|
+
.type-search { margin-bottom: 8px; }
|
|
149
|
+
.ask .type-count { margin: 6px 0 0; font-size: 12px; }
|
|
150
|
+
/* The rest are one line: only the chosen one opens up with its words and the team's time. */
|
|
151
|
+
button.type:not([aria-checked="true"]) { padding: 8px 12px; align-items: center; }
|
|
152
|
+
button.type:not([aria-checked="true"]) .type-hint, button.type:not([aria-checked="true"]) .type-due { display: none; }
|
|
153
|
+
button.type:not([aria-checked="true"]) .type-body b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
154
|
+
button.type:not([aria-checked="true"]) .icon { margin-top: 0; }
|
|
144
155
|
button.type {
|
|
145
156
|
display: flex; align-items: flex-start; gap: 10px; width: 100%;
|
|
146
157
|
padding: 10px 12px; text-align: left; border-radius: 10px;
|
|
@@ -170,4 +181,120 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
|
|
|
170
181
|
.shot-choice input { width: 16px; height: 16px; margin: 0; accent-color: #2563eb; }
|
|
171
182
|
.dropped { opacity: 0.35; pointer-events: none; }
|
|
172
183
|
.draft { margin: -8px 0 0; padding: 8px 12px; border-radius: 10px; background: #eff6ff; font-size: 13px; color: #1e3a8a; }
|
|
173
|
-
`;var B0="lw-debug-reporter",s=null;function f6($,z){if($ instanceof u){if($.kind==="offline")return z.failedOffline;if($.kind==="unavailable")return z.failedUnavailable;if($.kind==="rateLimited")return z.failedTooMany.replace("{seconds}",$.retryAfter??"60");return $.message||z.failed}return z.failed}var R6=()=>[];var T6=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function A6(){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"}),S2(this.root),this.root.addEventListener("keydown",(z)=>{let J=z;if(J.key!=="Escape"||J.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;J.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=E1((z)=>void this.open(z))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(z){if(this.busy)return;this.busy=!0;let J=document.activeElement;this.returnFocus=J instanceof HTMLElement&&J!==document.body?J:null;let j=A0(C().locale),Q=$1();if(Q===null)Y0();if(z.type==="manual"&&Q?.length){this.renderChooser(j,z);return}await this.report(z,j)}renderChooser(z,J){let j=this.shell(z);j.classList.add("narrow"),j.setAttribute("aria-label",z.chooseTitle);let Q=B("div","head"),Z=p("✕","icon");Z.setAttribute("aria-label",z.close),Z.addEventListener("click",()=>this.close()),Q.append(B("h2","",z.chooseTitle),Z);let Y=K1("problem",_2,z.kindProblem,z.chooseProblemHint);Y.dataset.choose="problem",Y.addEventListener("click",()=>{this.root.replaceChildren(),this.report(J,z)});let X=K1("request",Z1,z.kindRequest,z.chooseRequestHint);X.dataset.choose="request",X.addEventListener("click",()=>{this.bundle=L0({reason:J,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:j1()}),this.renderForm(z,J,"request")});let P=B("div","kinds choose");P.append(Y,X),P.addEventListener("keydown",(w)=>{if(!Q1.includes(w.key))return;w.preventDefault(),(this.root.activeElement===Y?X:Y).focus()}),j.append(Q,P),Y.focus()}async switchToReport(z,J,j){this.root.replaceChildren();let Q=await s0();if(Q.method==="cancelled"){this.renderForm(z,J,"request",{...j,asking:!0});return}this.bundle=L0({reason:J,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:j1()}),this.renderForm(z,J,"problem",j)}async report(z,J){let j=await s0();if(j.method==="cancelled"){this.close();return}this.bundle=L0({reason:z,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:j1()}),this.renderForm(J,z,"problem")}close(z=!1){if(z)s=null;else if(this.keep)s=this.keep()??s;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let J=this.returnFocus;if(this.returnFocus=null,J?.isConnected)J.focus()}shell(z){let J=document.createElement("style");J.textContent=O2;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",z.title),j.append(Q),this.root.replaceChildren(J,j),Q}renderShell(z,J){let j=this.shell(z),Q=B("div","head");Q.append(B("h2","",z.title)),j.append(Q,B("p","status",J))}renderForm(z,J,j,Q){let Z=this.bundle;if(!Z)return;let Y=this.shell(z),X=j,P=j==="problem"||!!Z.screenshotDataUrl,w=null,T=B("div","head"),N=B("h2","",z.title),q=p("✕","icon");q.setAttribute("aria-label",z.close),q.addEventListener("click",()=>this.close()),T.append(N,q);let x=B("div","kinds");x.hidden=!0,x.setAttribute("role","radiogroup"),x.setAttribute("aria-label",z.chooseTitle);let A=(H,M,I,S)=>{let _=K1(H,M,I,S);return _.setAttribute("role","radio"),_.addEventListener("click",()=>j0(H)),_},i=A("problem",_2,z.kindProblem,P?z.kindProblemHint:z.chooseProblemHint),a=A("request",Z1,z.kindRequest,z.kindRequestHint);x.append(i,a),x.addEventListener("keydown",(H)=>{if(!Q1.includes(H.key))return;H.preventDefault(),j0(X==="problem"?"request":"problem"),(X==="problem"?i:a).focus()});let $0=B("div","ask");$0.hidden=!0;let k=B("div","types");k.setAttribute("role","radiogroup"),k.setAttribute("aria-label",z.requestTypeLabel),$0.append(b0(z.requestTypeLabel,"",!0),k);let d=[],t=()=>{for(let H of d){let M=H.dataset.requestType===w?.id;H.setAttribute("aria-checked",String(M)),H.tabIndex=M?0:-1}},O=document.createElement("input");O.type="text";let z0=b0(""),g=document.createElement("textarea"),q0=b0(""),f=B("div","meta"),{context:c}=Z,L=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${z.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,G0=(H,M)=>{let I=document.createElement("div"),S=document.createElement("b");S.textContent=`${H}: `;let _=document.createTextNode(M);return I.append(S,_),f.append(I),{b:S,v:_}};G0(z.reporter,`${c.user.fullName??"—"} (${c.user.email??"—"})`),G0(z.page,c.route.href);let N0=G0(z.captured,L),y=document.createElement("label");y.className="shot-choice",y.hidden=!0;let R=document.createElement("input");R.type="checkbox",R.checked=!0,R.dataset.requestShot="",y.append(R,document.createTextNode(` ${z.requestWithShot}`));let J0=Z.screenshotDataUrl?this.screenshotSection(z,Z.screenshotDataUrl):[B("p","status",z.noScreenshot)],V0=Z.screenshotDataUrl?J0[0]:null;if(!Z.screenshotDataUrl)y.replaceChildren();let o=B("p","status",""),b=p(z.submit,"primary"),l=()=>{b.disabled=O.value.trim().length===0||X==="request"&&!w};O.addEventListener("input",l);let e=()=>{let H=X==="request";N.textContent=x.hidden?z.title:z.chooseTitle,Y.setAttribute("aria-label",H?z.requestTitle:z.title);for(let[M,I]of[[i,!H],[a,H]])M.setAttribute("aria-checked",String(I)),M.tabIndex=I?0:-1;if($0.hidden=!H,p0(z0,H?z.requestSummaryLabel:z.summaryLabel,H?"":z.summaryRequired,!0),O.placeholder=H?z.requestSummaryPlaceholder:z.summaryPlaceholder,p0(q0,H?z.requestDetailLabel:z.detailLabel),g.placeholder=H?z.requestDetailPlaceholder:z.detailPlaceholder,N0.b.textContent=`${H?z.requestLeaves:z.captured}: `,N0.v.textContent=H?z.requestLeavesWhat:L,y.hidden=!H||!Z.screenshotDataUrl,V0)p0(V0,H?z.requestAnnotateHint:z.annotateHint);for(let M of J0)M.classList.toggle("dropped",H&&!R.checked),M.hidden=H&&!Z.screenshotDataUrl;b.textContent=H?z.requestSubmit:z.submit,l()};R.addEventListener("change",e);let j0=(H)=>{if(H===X)return;if(H==="problem"&&!P){this.switchToReport(z,J,{title:O.value,detail:g.value,asking:!1,typeId:w?.id??null});return}X=H,e()},K=(H)=>{if(this.bundle!==Z||J.type!=="manual"||!H.length)return;w=H[0],d.length=0;for(let M of H){let I=p("","type");I.setAttribute("role","radio"),I.dataset.requestType=M.id;let S=B("span","type-body");if(S.append(B("b","",M.name)),M.description)S.append(B("span","type-hint",M.description));if(M.targetHours){let _=B("span","type-due");_.append(y0(h6),document.createTextNode(z.requestTarget.replace("{time}",L6(z,M.targetHours)))),S.append(_)}I.append(y0(Z1),S),I.addEventListener("click",()=>{w=M,t(),l()}),d.push(I)}k.replaceChildren(...d),k.onkeydown=(M)=>{if(!Q1.includes(M.key)||!w)return;M.preventDefault();let I=H.findIndex((_)=>_.id===w.id),S=M.key==="ArrowUp"||M.key==="ArrowLeft"?-1:1;w=H[(I+S+H.length)%H.length],t(),d.find((_)=>_.dataset.requestType===w.id)?.focus()},t(),x.hidden=!1,e()},G=Q??(s&&(s.title||s.detail)?s:null),W=B("p","draft");if(W.hidden=!G||!!Q,G){O.value=G.title,g.value=G.detail;let H=p(z.draftClear,"link");H.dataset.draftClear="",H.addEventListener("click",()=>{O.value="",g.value="",s=null,W.hidden=!0,l(),O.focus()}),W.append(document.createTextNode(`${z.draftRestored} · `),H)}let V=$1(),F=(H)=>{if(K(H),X!=="request"||x.hidden||!G?.typeId)return;let M=H.find((I)=>I.id===G.typeId);if(M)w=M,t()};if(V)F(V);else if(J.type==="manual")Y0().then(F);this.keep=()=>({title:O.value,detail:g.value,asking:X==="request",typeId:w?.id??null}),Y.append(T,x,W,$0,z0,O,q0,g,f,y,...J0);let U=B("div","foot"),D=p(z.close);D.addEventListener("click",()=>this.close()),U.append(D,o,B("span","grow"),b),Y.append(U),e(),b.addEventListener("click",async()=>{b.disabled=!0,o.dataset.tone="",o.textContent=z.submitting;let H=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(X==="request"&&w){let S=await I2({ticketTypeId:w.id,title:O.value.trim(),description:g.value,screenshotDataUrl:R.checked?H():null}),_=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:S,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),_)K0(`${z.requestSubmitted} — #${S.number}`,"success");return}let M=await w2(O.value.trim(),{...Z,note:g.value,screenshotDataUrl:H()}),I=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:M,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),I)K0(`${z.submitted} — #${M.number}`,"success")}catch(M){let I=f6(M,z);o.dataset.tone="error",o.textContent=I,K0(I,"error"),l()}}),O.focus()}screenshotSection(z,J){let j=b0(z.annotateHint),Q=B("div","tools"),Z=document.createElement("canvas"),Y=B("div","shot");Y.append(Z);let X=[],P=(q)=>{for(let x of X)x.setAttribute("aria-pressed",String(x===q))};for(let{tool:q,key:x}of T6){let A=p(z[x]);A.setAttribute("aria-pressed","false"),A.addEventListener("click",()=>{let i=A.getAttribute("aria-pressed")==="true";P(i?null:A),this.annotator?.setTool(i?null:q)}),X.push(A),Q.append(A)}Q.append(B("span","sep"));let w=p(z.deleteSelected);w.addEventListener("click",()=>this.annotator?.deleteSelected());let T=p(z.clearAll);T.addEventListener("click",()=>{this.annotator?.clear(),P(null)}),Q.append(w,T);let N=new Image;return N.onload=()=>{Z.width=N.naturalWidth,Z.height=N.naturalHeight,this.annotator=k2(Z,N,()=>{P(null),w.disabled=!this.annotator?.hasSelection()})},N.src=J,[j,Q,B("p","status",z.annotateHelp),Y]}}}function j1(){try{return R6()}catch{return[]}}function B($,z="",J=""){let j=document.createElement($);if(z)j.className=z;if(J)j.textContent=J;return j}function L6($,z){return z>=24&&z%24===0?$.days.replace("{n}",String(z/24)):$.hours.replace("{n}",String(z))}var Q1=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],_2=[["path",{d:"M12 20v-9"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}],["path",{d:"M14.12 3.88 16 2"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}],["path",{d:"M22 13h-4"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}],["path",{d:"M6 13H2"}],["path",{d:"m8 2 1.88 1.88"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"}]],Z1=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2"}]],h6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],E6=[["path",{d:"M20 6 9 17l-5-5"}]],f2="http://www.w3.org/2000/svg";function K1($,z,J,j){let Q=p("","kind");Q.dataset.kind=$;let Z=B("span","kind-top");return Z.append(y0(z),B("b","",J)),Q.append(Z,B("span","kind-hint",j),y0(E6,"tick")),Q}function y0($,z="icon"){let J=document.createElementNS(f2,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:z}))J.setAttribute(j,Q);for(let[j,Q]of $){let Z=document.createElementNS(f2,j);for(let[Y,X]of Object.entries(Q))Z.setAttribute(Y,X);J.append(Z)}return J}function p($,z=""){let J=document.createElement("button");if(J.type="button",J.textContent=$,z)J.className=z;return J}function b0($,z="",J=!1){return p0(document.createElement("label"),$,z,J)}function p0($,z,J="",j=!1){if($.replaceChildren(document.createTextNode(z)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",$.append(Q)}if(J){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${J}`,$.append(Q)}return $}function R2(){if(typeof window>"u"||customElements.get(B0))return;customElements.define(B0,A6())}var T2=!1;function Y1($={}){if(T2||typeof window>"u")return;if(!x0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(T2=!0,s1(),f1(),x1(),v1(),z2(),$.ui===!1)return;let z=A0(C().locale);if(m1((j)=>{K0(j.message??z.crashed,"error",{label:z.crashAction,onClick:()=>f0(j)})}),R2(),!document.querySelector(B0))document.body.append(document.createElement(B0));let J=window.requestIdleCallback;if(J)J(()=>void Y0(),{timeout:5000});else setTimeout(()=>void Y0(),2000)}var A2=document.currentScript,m=A2?.dataset??{},m6="rrweb-record.mjs";$2(()=>import(new URL(m6,A2?.src??location.href).href));function g6($){if(!$)return{};try{let z=JSON.parse($);if(!z||typeof z!=="object"||Array.isArray(z))return{};return Object.fromEntries(Object.entries(z).filter(([,J])=>typeof J==="string"&&J.trim()))}catch{return{}}}if(m.host&&m.realmKey)if(V1({host:m.host,realmKey:m.realmKey,app:{name:m.appName??document.title??"app",version:m.appVersion??"0.0.0",environment:m.environment??"production"},module:F1(g6(m.modules)),locale:m.locale==="en"?"en":"th",...m.replay!==void 0?{replay:{seconds:Number(m.replay)||void 0}}:{}}),document.body)Y1();else document.addEventListener("DOMContentLoaded",()=>Y1(),{once:!0});window.lwReportProblem=f0;})();
|
|
184
|
+
`;var L0="lw-debug-reporter",J0=null;function G8(z,J){if(z instanceof r){if(z.kind==="offline")return J.failedOffline;if(z.kind==="unavailable")return J.failedUnavailable;if(z.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",z.retryAfter??"60");return z.message||J.failed}return J.failed}var F8=()=>[];var H8=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function P8(){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"}),A0(this.root),this.root.addEventListener("keydown",(J)=>{let $=J;if($.key!=="Escape"||$.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;$.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=$2((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let $=document.activeElement;this.returnFocus=$ instanceof HTMLElement&&$!==document.body?$:null;let j=W0(B().locale),Q=P1();if(Q===null)U0();if(J.type==="manual"&&Q?.length){this.renderChooser(j,J);return}await this.report(J,j)}renderChooser(J,$){let j=this.shell(J);j.classList.add("narrow"),j.setAttribute("aria-label",J.chooseTitle);let Q=D("div","head"),Z=g("✕","icon");Z.setAttribute("aria-label",J.close),Z.addEventListener("click",()=>this.close()),Q.append(D("h2","",J.chooseTitle),Z);let W=a2("problem",M8,J.kindProblem,J.chooseProblemHint);W.dataset.choose="problem",W.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,J)});let X=a2("request",n2,J.kindRequest,J.chooseRequestHint);X.dataset.choose="request",X.addEventListener("click",()=>{this.bundle=c0({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:q1()}),this.renderForm(J,$,"request")});let H=D("div","kinds choose");H.append(W,X),H.addEventListener("keydown",(U)=>{if(!r2.includes(U.key))return;U.preventDefault(),(this.root.activeElement===W?X:W).focus()}),j.append(Q,H),W.focus()}async switchToReport(J,$,j){this.root.replaceChildren();let Q=await X1();if(Q.method==="cancelled"){this.renderForm(J,$,"request",{...j,asking:!0});return}this.bundle=c0({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:q1()}),this.renderForm(J,$,"problem",j)}async report(J,$){let j=await X1();if(j.method==="cancelled"){this.close();return}this.bundle=c0({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:q1()}),this.renderForm($,J,"problem")}close(J=!1){if(J)J0=null;else if(this.keep)J0=this.keep()??J0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let $=this.returnFocus;if(this.returnFocus=null,$?.isConnected)$.focus()}shell(J){let $=document.createElement("style");$.textContent=o2;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",J.title),j.append(Q),this.root.replaceChildren($,j),Q}renderShell(J,$){let j=this.shell(J),Q=D("div","head");Q.append(D("h2","",J.title)),j.append(Q,D("p","status",$))}renderForm(J,$,j,Q){let Z=this.bundle;if(!Z)return;let W=this.shell(J),X=j,H=j==="problem"||!!Z.screenshotDataUrl,U=null,k=D("div","head"),O=D("h2","",J.title),w=g("✕","icon");w.setAttribute("aria-label",J.close),w.addEventListener("click",()=>this.close()),k.append(O,w);let _=D("p","door");_.hidden=!0;let S=D("span"),i=g("","link");i.dataset.switchKind="",i.addEventListener("click",()=>V(X==="problem"?"request":"problem")),_.append(S,i);let n=D("div","ask");n.hidden=!0;let E=document.createElement("input");E.type="search",E.className="type-search",E.placeholder=J.requestTypeSearch,E.setAttribute("aria-label",J.requestTypeSearch),E.dataset.requestTypeSearch="",E.hidden=!0;let x=D("div","types");x.setAttribute("role","radiogroup"),x.setAttribute("aria-label",J.requestTypeLabel);let V0=D("p","status",J.requestTypeNone);V0.hidden=!0;let j0=D("p","status type-count","");j0.hidden=!0,n.append(s0(J.requestTypeLabel,"",!0),E,x,V0,j0);let T=[],c=()=>{for(let N of T){let q=N.dataset.requestType===U?.id;N.setAttribute("aria-checked",String(q)),N.tabIndex=q?0:-1}let P=T.find((N)=>N.dataset.requestType===U?.id);if(P&&x.scrollHeight>x.clientHeight){let N=P.offsetTop-x.offsetTop;if(N<x.scrollTop)x.scrollTop=N;else if(N+P.offsetHeight>x.scrollTop+x.clientHeight)x.scrollTop=N+P.offsetHeight-x.clientHeight}},L=document.createElement("input");L.type="text";let E0=s0(""),R=document.createElement("textarea"),Q0=s0(""),m=D("div","meta"),{context:I0}=Z,m0=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${J.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,Y0=(P,N)=>{let q=document.createElement("div"),C=document.createElement("b");C.textContent=`${P}: `;let A=document.createTextNode(N);return q.append(C,A),m.append(q),{b:C,v:A}};Y0(J.reporter,`${I0.user.fullName??"—"} (${I0.user.email??"—"})`),Y0(J.page,I0.route.href);let s=Y0(J.captured,m0),l=document.createElement("label");l.className="shot-choice",l.hidden=!0;let p=document.createElement("input");p.type="checkbox",p.checked=!0,p.dataset.requestShot="",l.append(p,document.createTextNode(` ${J.requestWithShot}`));let X0=Z.screenshotDataUrl?this.screenshotSection(J,Z.screenshotDataUrl):[D("p","status",J.noScreenshot)],Z0=Z.screenshotDataUrl?X0[0]:null;if(!Z.screenshotDataUrl)l.replaceChildren();let a=D("p","status",""),t=g(J.submit,"primary"),u=()=>{t.disabled=L.value.trim().length===0||X==="request"&&!U};L.addEventListener("input",u);let K=()=>{let P=X==="request";if(O.textContent=P?J.requestTitle:J.title,W.setAttribute("aria-label",P?J.requestTitle:J.title),S.textContent=`${P?J.problemInstead:J.askInstead} `,i.textContent=P?H?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,n.hidden=!P,a0(E0,P?J.requestSummaryLabel:J.summaryLabel,P?"":J.summaryRequired,!0),L.placeholder=P?J.requestSummaryPlaceholder:J.summaryPlaceholder,a0(Q0,P?J.requestDetailLabel:J.detailLabel),R.placeholder=P?J.requestDetailPlaceholder:J.detailPlaceholder,s.b.textContent=`${P?J.requestLeaves:J.captured}: `,s.v.textContent=P?J.requestLeavesWhat:m0,l.hidden=!P||!Z.screenshotDataUrl,Z0)a0(Z0,P?J.requestAnnotateHint:J.annotateHint);for(let N of X0)N.classList.toggle("dropped",P&&!p.checked),N.hidden=P&&!Z.screenshotDataUrl;t.textContent=P?J.requestSubmit:J.submit,u()};p.addEventListener("change",K);let V=(P)=>{if(P===X)return;if(P==="problem"&&!H){this.switchToReport(J,$,{title:L.value,detail:R.value,asking:!1,typeId:U?.id??null});return}X=P,K()},G=(P)=>{if(this.bundle!==Z||$.type!=="manual"||!P.length)return;U=P[0],T.length=0;for(let q of P){let C=g("","type");C.setAttribute("role","radio"),C.dataset.requestType=q.id;let A=D("span","type-body");if(A.append(D("b","",q.name)),q.description)A.append(D("span","type-hint",q.description));if(q.targetHours){let G0=D("span","type-due");G0.append(t0(q8),document.createTextNode(J.requestTarget.replace("{time}",U8(J,q.targetHours)))),A.append(G0)}C.append(t0(n2),A),C.addEventListener("click",()=>{U=q,c(),u()}),T.push(C)}x.replaceChildren(...T),x.onkeydown=(q)=>{if(!r2.includes(q.key)||!U)return;q.preventDefault();let C=P.filter((K0,P4)=>!T[P4].hidden);if(!C.length)return;let A=C.findIndex((K0)=>K0.id===U.id),G0=q.key==="ArrowUp"||q.key==="ArrowLeft"?-1:1;U=C[A<0?0:(A+G0+C.length)%C.length],c(),T.find((K0)=>K0.dataset.requestType===U.id)?.focus()},x.classList.toggle("long",P.length>=D1),E.hidden=P.length<D1;let N=(q)=>{j0.hidden=P.length<D1||q===0,j0.textContent=J.requestTypeCount.replace("{n}",String(q))};N(P.length),E.oninput=()=>{let q=E.value.trim().toLowerCase(),C=null;if(P.forEach((A,G0)=>{let K0=!q||`${A.name} ${A.description}`.toLowerCase().includes(q);if(T[G0].hidden=!K0,K0&&!C)C=A}),V0.hidden=!!C,N(T.filter((A)=>!A.hidden).length),C&&U&&T[P.indexOf(U)].hidden)U=C;c(),u()},E.onkeydown=(q)=>{if(q.key==="ArrowDown"||q.key==="Enter")q.preventDefault(),T.find((C)=>C.dataset.requestType===U?.id&&!C.hidden)?.focus()},c(),_.hidden=!1,K()},Y=Q??(J0&&(J0.title||J0.detail)?J0:null),F=D("p","draft");if(F.hidden=!Y||!!Q,Y){L.value=Y.title,R.value=Y.detail;let P=g(J.draftClear,"link");P.dataset.draftClear="",P.addEventListener("click",()=>{L.value="",R.value="",J0=null,F.hidden=!0,u(),L.focus()}),F.append(document.createTextNode(`${J.draftRestored} · `),P)}let M=P1(),I=(P)=>{if(G(P),X!=="request"||_.hidden||!Y?.typeId)return;let N=P.find((q)=>q.id===Y.typeId);if(N)U=N,c()};if(M)I(M);else if($.type==="manual")U0().then(I);this.keep=()=>({title:L.value,detail:R.value,asking:X==="request",typeId:U?.id??null}),W.append(k,_,F,n,E0,L,Q0,R,m,l,...X0);let f=D("div","foot"),d=g(J.close);d.addEventListener("click",()=>this.close()),f.append(d,a,D("span","grow"),t),W.append(f),K(),t.addEventListener("click",async()=>{t.disabled=!0,a.dataset.tone="",a.textContent=J.submitting;let P=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(X==="request"&&U){let C=await v2({ticketTypeId:U.id,title:L.value.trim(),description:R.value,screenshotDataUrl:p.checked?P():null}),A=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:C,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),A)P0(`${J.requestSubmitted} — #${C.number}`,"success");return}let N=await b2(L.value.trim(),{...Z,note:R.value,screenshotDataUrl:P()}),q=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:N,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),q)P0(`${J.submitted} — #${N.number}`,"success")}catch(N){let q=G8(N,J);a.dataset.tone="error",a.textContent=q,P0(q,"error"),u()}}),L.focus()}screenshotSection(J,$){let j=s0(J.annotateHint),Q=D("div","tools"),Z=document.createElement("canvas"),W=D("div","shot");W.append(Z);let X=[],H=(w)=>{for(let _ of X)_.setAttribute("aria-pressed",String(_===w))};for(let{tool:w,key:_}of H8){let S=g(J[_]);S.setAttribute("aria-pressed","false"),S.addEventListener("click",()=>{let i=S.getAttribute("aria-pressed")==="true";H(i?null:S),this.annotator?.setTool(i?null:w)}),X.push(S),Q.append(S)}Q.append(D("span","sep"));let U=g(J.deleteSelected);U.addEventListener("click",()=>this.annotator?.deleteSelected());let k=g(J.clearAll);k.addEventListener("click",()=>{this.annotator?.clear(),H(null)}),Q.append(U,k);let O=new Image;return O.onload=()=>{Z.width=O.naturalWidth,Z.height=O.naturalHeight,this.annotator=l2(Z,O,()=>{H(null),U.disabled=!this.annotator?.hasSelection()})},O.src=$,[j,Q,D("p","status",J.annotateHelp),W]}}}function q1(){try{return F8()}catch{return[]}}function D(z,J="",$=""){let j=document.createElement(z);if(J)j.className=J;if($)j.textContent=$;return j}function U8(z,J){return J>=24&&J%24===0?z.days.replace("{n}",String(J/24)):z.hours.replace("{n}",String(J))}var r2=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],D1=7,M8=[["path",{d:"M12 20v-9"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}],["path",{d:"M14.12 3.88 16 2"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}],["path",{d:"M22 13h-4"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}],["path",{d:"M6 13H2"}],["path",{d:"m8 2 1.88 1.88"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"}]],n2=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2"}]],q8=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],D8=[["path",{d:"M20 6 9 17l-5-5"}]],s2="http://www.w3.org/2000/svg";function a2(z,J,$,j){let Q=g("","kind");Q.dataset.kind=z;let Z=D("span","kind-top");return Z.append(t0(J),D("b","",$)),Q.append(Z,D("span","kind-hint",j),t0(D8,"tick")),Q}function t0(z,J="icon"){let $=document.createElementNS(s2,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:J}))$.setAttribute(j,Q);for(let[j,Q]of z){let Z=document.createElementNS(s2,j);for(let[W,X]of Object.entries(Q))Z.setAttribute(W,X);$.append(Z)}return $}function g(z,J=""){let $=document.createElement("button");if($.type="button",$.textContent=z,J)$.className=J;return $}function s0(z,J="",$=!1){return a0(document.createElement("label"),z,J,$)}function a0(z,J,$="",j=!1){if(z.replaceChildren(document.createTextNode(J)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",z.append(Q)}if($){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${$}`,z.append(Q)}return z}function t2(){if(typeof window>"u"||customElements.get(L0))return;customElements.define(L0,P8())}var e2=138.23,Z3=`
|
|
185
|
+
:host { all: initial; }
|
|
186
|
+
.backdrop {
|
|
187
|
+
position: fixed; inset: 0; z-index: 2147483002;
|
|
188
|
+
display: grid; place-items: center; padding: 20px;
|
|
189
|
+
background: rgba(15, 23, 42, 0.45);
|
|
190
|
+
-webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
|
|
191
|
+
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
|
|
192
|
+
opacity: 0; transition: opacity 180ms ease;
|
|
193
|
+
}
|
|
194
|
+
.backdrop[data-open="1"] { opacity: 1; }
|
|
195
|
+
|
|
196
|
+
.card {
|
|
197
|
+
width: min(360px, 100%); box-sizing: border-box;
|
|
198
|
+
padding: 24px 24px 18px; text-align: center;
|
|
199
|
+
background: #fff; border-radius: 16px;
|
|
200
|
+
box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
|
|
201
|
+
transform: translateY(8px) scale(0.97); opacity: 0;
|
|
202
|
+
transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1), opacity 160ms ease;
|
|
203
|
+
}
|
|
204
|
+
.backdrop[data-open="1"] .card { transform: none; opacity: 1; }
|
|
205
|
+
|
|
206
|
+
/* The number is centred by the box, not by a margin guessed against the
|
|
207
|
+
font's line-height — Thai and Latin digits do not share one. */
|
|
208
|
+
.dial { position: relative; width: 56px; height: 56px; margin: 0 auto 14px; }
|
|
209
|
+
.ring { display: block; width: 100%; height: 100%; }
|
|
210
|
+
.ring circle { fill: none; stroke-width: 4; stroke-linecap: round; }
|
|
211
|
+
.ring .track { stroke: #e2e8f0; }
|
|
212
|
+
.ring .bar {
|
|
213
|
+
stroke: #0ea5e9; transform: rotate(-90deg); transform-origin: 50% 50%;
|
|
214
|
+
stroke-dasharray: ${e2}; stroke-dashoffset: 0;
|
|
215
|
+
animation: deplete var(--secs, 3s) linear forwards;
|
|
216
|
+
}
|
|
217
|
+
@keyframes deplete { to { stroke-dashoffset: ${e2}; } }
|
|
218
|
+
.count {
|
|
219
|
+
position: absolute; inset: 0; display: grid; place-items: center;
|
|
220
|
+
font-size: 18px; font-weight: 600; color: #0f172a;
|
|
221
|
+
font-variant-numeric: tabular-nums; line-height: 1;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/* The spinner replaces the ring once the countdown is over but the token has
|
|
225
|
+
not arrived — rare, and better than a frozen 0. */
|
|
226
|
+
.spinner { animation: spin 900ms linear infinite; }
|
|
227
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
228
|
+
|
|
229
|
+
h2 { margin: 0 0 6px; font-size: 16px; font-weight: 600; color: #0f172a; }
|
|
230
|
+
p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
|
|
231
|
+
.host { margin-top: 8px; font-size: 12px; color: #94a3b8; word-break: break-all; }
|
|
232
|
+
|
|
233
|
+
.actions { display: flex; gap: 8px; margin-top: 20px; }
|
|
234
|
+
/* The anchor too: when a blocked tab turns the primary action into a link, it
|
|
235
|
+
has to be the same object it was a moment ago. Styling only the button left it
|
|
236
|
+
with the dark fill and none of the shape: an underlined black smear. */
|
|
237
|
+
.actions button, .actions a {
|
|
238
|
+
flex: 1; box-sizing: border-box;
|
|
239
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
240
|
+
padding: 9px 12px; border-radius: 9px; font: inherit; font-size: 14px;
|
|
241
|
+
text-decoration: none; cursor: pointer;
|
|
242
|
+
transition: background 120ms ease, border-color 120ms ease;
|
|
243
|
+
}
|
|
244
|
+
.go { border: none; background: #0f172a; color: #fff; font-weight: 600; }
|
|
245
|
+
.go:hover { background: #1e293b; }
|
|
246
|
+
.cancel { border: 1px solid #e2e8f0; background: #fff; color: #334155; }
|
|
247
|
+
.cancel:hover { background: #f8fafc; }
|
|
248
|
+
.actions button:focus-visible, .actions a:focus-visible { outline: 2px solid #0ea5e9; outline-offset: 2px; }
|
|
249
|
+
|
|
250
|
+
.error h2 { color: #b91c1c; }
|
|
251
|
+
|
|
252
|
+
@media (prefers-reduced-motion: reduce) {
|
|
253
|
+
/* Movement goes; the countdown does not — it is information, not decoration,
|
|
254
|
+
and someone who has asked for less motion still needs to know they are
|
|
255
|
+
about to be sent somewhere. */
|
|
256
|
+
.backdrop, .card { transition: opacity 120ms ease; }
|
|
257
|
+
.card { transform: none; }
|
|
258
|
+
.ring .bar { animation: none; stroke-dashoffset: 0; }
|
|
259
|
+
.spinner { animation-duration: 2s; }
|
|
260
|
+
}
|
|
261
|
+
`;var I8="/sso";function N8(z,J,$,j){let Q=new URL(I8,z.endsWith("/")?z:`${z}/`);if(Q.searchParams.set("realm",J),Q.searchParams.set("token",$),j)Q.searchParams.set("return",j);return Q.toString()}class I1 extends Error{constructor(z="No identity provider is configured, or nobody is signed in"){super(z);this.name="NoIdentityError"}}async function B8(z){let J=B();if(!J.identity)throw new I1;let $=await J.identity();if(!$)throw new I1;return N8(J.host,J.realmKey,$,z)}var z4=B8;var x8="lw-call-ring",C8=`
|
|
262
|
+
:host { all: initial; }
|
|
263
|
+
.card {
|
|
264
|
+
position: fixed; right: 16px; bottom: 16px; z-index: 2147483002;
|
|
265
|
+
width: min(340px, calc(100vw - 32px)); box-sizing: border-box;
|
|
266
|
+
padding: 16px; border-radius: 16px; background: #fff; color: #0f172a;
|
|
267
|
+
border: 1px solid #e2e8f0; box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
|
|
268
|
+
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
|
|
269
|
+
animation: in 200ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
270
|
+
}
|
|
271
|
+
@media (max-width: 480px) { .card { right: 8px; left: 8px; bottom: 8px; width: auto; } }
|
|
272
|
+
.head { display: flex; align-items: center; gap: 12px; }
|
|
273
|
+
.icon {
|
|
274
|
+
position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%;
|
|
275
|
+
display: grid; place-items: center; background: #ecfdf5; color: #059669;
|
|
276
|
+
}
|
|
277
|
+
.icon::after {
|
|
278
|
+
content: ""; position: absolute; inset: 0; border-radius: 50%;
|
|
279
|
+
background: rgba(16, 185, 129, 0.25); animation: ping 1.4s ease-out infinite;
|
|
280
|
+
}
|
|
281
|
+
.icon svg { position: relative; width: 20px; height: 20px; }
|
|
282
|
+
h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; }
|
|
283
|
+
.about { margin: 2px 0 0; font-size: 12px; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 250px; }
|
|
284
|
+
.how { margin: 10px 0 0; font-size: 12px; line-height: 1.6; color: #64748b; }
|
|
285
|
+
.how a { color: #0369a1; font-weight: 600; }
|
|
286
|
+
.actions { display: flex; gap: 8px; margin-top: 12px; }
|
|
287
|
+
.actions button {
|
|
288
|
+
flex: 1; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
|
|
289
|
+
height: 40px; padding: 0 12px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
|
|
290
|
+
}
|
|
291
|
+
.decline { border: 1px solid #fecdd3; background: #fff1f2; color: #be123c; }
|
|
292
|
+
.decline:hover { background: #ffe4e6; }
|
|
293
|
+
.open { border: none; background: #059669; color: #fff; }
|
|
294
|
+
.open:hover { background: #047857; }
|
|
295
|
+
.close { border: 1px solid #e2e8f0; background: #fff; color: #334155; }
|
|
296
|
+
.actions button:focus-visible { outline: 2px solid #0ea5e9; outline-offset: 2px; }
|
|
297
|
+
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
|
|
298
|
+
@keyframes ping { from { transform: scale(1); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
|
|
299
|
+
@media (prefers-reduced-motion: reduce) { .card { animation: none; } .icon::after { animation: none; opacity: 0; } }
|
|
300
|
+
`,w8='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92z"/></svg>',v=null,M0=null,q0=null;function O8(z,J){return z.replace("{key}",J.ticketKey).replace("{title}",J.ticketTitle)}var B1=()=>W0(B().locale);function _8(){if(typeof document>"u")return null;if(v?.isConnected)return v.shadowRoot;v=document.createElement(x8),v.dataset.debugReporter="true";let z=v.attachShadow({mode:"open"});return A0(z),document.body.append(v),z}function J4(z,J){if(M0===z.id&&v?.isConnected)return;let $=_8();if(!$)return;M0=z.id;let j=B1();$.innerHTML="";let Q=document.createElement("style");Q.textContent=C8;let Z=document.createElement("div");Z.className="card",Z.setAttribute("role","alertdialog"),Z.setAttribute("aria-label",j.ringTitle),Z.dataset.lwCallRing=z.id;let W=document.createElement("div");W.className="head";let X=document.createElement("span");X.className="icon",X.innerHTML=w8;let H=document.createElement("div"),U=document.createElement("h2");U.textContent=j.ringTitle;let k=document.createElement("p");k.className="about",k.textContent=O8(j.ringAbout,z),k.title=k.textContent,H.append(U,k),W.append(X,H);let O=document.createElement("p");O.className="how",O.textContent=j.ringHow;let w=document.createElement("div");w.className="actions";let _=document.createElement("button");_.type="button",_.className="decline",_.textContent=j.ringDecline,_.dataset.lwRing="decline",_.onclick=()=>J.decline();let S=document.createElement("button");if(S.type="button",S.className="open",S.textContent=j.ringOpen,S.dataset.lwRing="open",S.onclick=()=>J.open(),w.append(_,S),Z.append(W,O,w),$.append(Q,Z),S8(),q0===null)q0=document.title,document.title=`${j.ringTab} — ${q0}`;S.focus({preventScroll:!0})}function e0(z){let J=v?.shadowRoot;if(!J)return;x1(),j4();let $=B1(),j=J.querySelector(".how"),Q=J.querySelector(".actions");if(j)if(j.textContent="",z){let Z=document.createElement("a");Z.href=z,Z.target="_blank",Z.rel="noopener",Z.textContent=$.ringBlocked,Z.dataset.lwRing="link",Z.onclick=()=>window.setTimeout(()=>e0(),0),j.append(Z)}else j.textContent=$.ringOpened;if(Q){Q.innerHTML="";let Z=document.createElement("button");Z.type="button",Z.className="close",Z.textContent=$.ringClose,Z.dataset.lwRing="close",Z.onclick=()=>T0(),Q.append(Z)}}function T0(z){if(z&&M0&&z!==M0)return;x1(),j4(),v?.remove(),v=null,M0=null}function $4(){return v?.isConnected?M0:null}function j4(){if(q0===null||typeof document>"u")return;if(document.title.startsWith(B1().ringTab))document.title=q0;q0=null}var $0=null,N1;function S8(){x1();let z=window,J=z.AudioContext??z.webkitAudioContext;if(!J)return;try{let j=$0??new J;$0=j,j.resume?.().catch(()=>{return})}catch{return}let $=()=>{if(!$0||$0.state!=="running")return;let j=$0.currentTime;for(let[Q,Z]of[660,880].entries()){let W=$0.createOscillator(),X=$0.createGain();W.frequency.value=Z,X.gain.setValueAtTime(0.0001,j+Q*0.22),X.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),X.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),W.connect(X).connect($0.destination),W.start(j+Q*0.22),W.stop(j+Q*0.22+0.21)}};$(),N1=setInterval($,2200)}function x1(){clearInterval(N1),N1=void 0}var z1=[2000,5000,15000,30000,60000],R8=20000,Q4=!1,D0=!1,Z4=0,k8=5,C1=null,Y4=0,w1,K4,W4,X4=(z)=>z.endsWith("/")?z:`${z}/`;function A8(z,J){let $=new URL("api/presence/ws",X4(z));return $.protocol=$.protocol==="https:"?"wss:":"ws:",$.searchParams.set("t",J),$.toString()}function L8(z){return`/me/tickets/${z.ticketId}?call=${z.id}`}function T8(z){return z.status==="ringing"&&(z.side==="reporter"||z.side===void 0||z.side===null)}async function O1(){let z=B().identity;if(!z)return null;try{return await z()??null}catch{return null}}async function _1(z,J){let $=B();return fetch(new URL(z,X4($.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,authorization:`Bearer ${J}`},body:"{}"})}function S1(){if(Q4||typeof window>"u"||typeof WebSocket>"u")return;let z=B();if(!z.identity||z.ring===!1)return;Q4=!0,D0=!1,G4()}function f0(z=!1){if(D0)return;let J=z?z1[z1.length-1]:z1[Math.min(Y4++,z1.length-1)];clearTimeout(K4),K4=setTimeout(()=>void G4(),J)}async function G4(){if(D0)return;let z=await O1();if(!z){if(++Z4>=k8){D0=!0;return}return f0(!0)}Z4=0;let J;try{J=await _1("ingest/live-ticket",z)}catch{return f0()}if(J.status===401||J.status===404||J.status===403){D0=!0;return}if(!J.ok)return f0(J.status===429);let $;try{$=await J.json()}catch{return f0()}if(!$.calls||!$.ticket){D0=!0;return}if($.call)V4($.call);let j=new WebSocket(A8(B().host,$.ticket));C1=j,j.onopen=()=>{Y4=0,clearInterval(w1),w1=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},R8)},j.onmessage=(Q)=>{try{let Z=JSON.parse(String(Q.data));if(Z.type==="call-state"&&Z.call)V4(Z.call)}catch{}},j.onclose=()=>{if(clearInterval(w1),C1===j)C1=null;f0()}}function V4(z){if(!T8(z))return T0(z.id);J4(z,{open:()=>f8(z),decline:()=>void E8(z)}),clearTimeout(W4);let J=new Date(z.ringUntil).getTime()-Date.now();W4=setTimeout(()=>{if($4()===z.id)T0(z.id)},Math.max(5000,J+5000))}function f8(z){let J=window.open("about:blank","_blank");(async()=>{let $=await O1();if($)_1(`ingest/calls/${z.id}/coming`,$).catch(()=>{return});let j;try{j=await z4(L8(z))}catch{J?.close();return}if(J&&!J.closed){J.location.href=j;try{J.opener=null}catch{}e0()}else e0(j)})()}async function E8(z){T0(z.id);let J=await O1();if(J)await _1(`ingest/calls/${z.id}/decline`,J).catch(()=>{return})}var F4=!1;function R1(z={}){if(F4||typeof window>"u")return;if(!h0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(F4=!0,q2(),s1(),i1(),V2(),x2(),z.ui===!1)return;let J=W0(B().locale);if(j2((j)=>{P0(j.message??J.crashed,"error",{label:J.crashAction,onClick:()=>u0(j)})}),t2(),!document.querySelector(L0))document.body.append(document.createElement(L0));let $=window.requestIdleCallback;if($)$(()=>void U0(),{timeout:5000});else setTimeout(()=>void U0(),2000);if($)$(()=>S1(),{timeout:8000});else setTimeout(()=>S1(),3000)}var H4=document.currentScript,y=H4?.dataset??{},m8="rrweb-record.mjs";B2(()=>import(new URL(m8,H4?.src??location.href).href));function h8(z){if(!z)return{};try{let J=JSON.parse(z);if(!J||typeof J!=="object"||Array.isArray(J))return{};return Object.fromEntries(Object.entries(J).filter(([,$])=>typeof $==="string"&&$.trim()))}catch{return{}}}if(y.host&&y.realmKey)if(A1({host:y.host,realmKey:y.realmKey,app:{name:y.appName??document.title??"app",version:y.appVersion??"0.0.0",environment:y.environment??"production"},module:f1(h8(y.modules)),locale:y.locale==="en"?"en":"th",...y.replay!==void 0?{replay:{seconds:Number(y.replay)||void 0}}:{}}),document.body)R1();else document.addEventListener("DOMContentLoaded",()=>R1(),{once:!0});window.lwReportProblem=u0;})();
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export type { StepActivity } from "./capture/stepCorrelation";
|
|
|
34
34
|
export { redactBody, redactHeaders, redactLabel, redactUrl, REDACTED } from "./capture/redact";
|
|
35
35
|
export { defineReporterElement, setErroredQueriesSource, REPORTER_TAG } from "./ui/element";
|
|
36
36
|
export { showToast } from "./ui/toast";
|
|
37
|
+
export { startLiveRing, stopLiveRing } from "./live";
|
|
37
38
|
export { createAnnotator } from "./ui/annotator";
|
|
38
39
|
export type { Annotator, AnnotatorTool } from "./ui/annotator";
|
|
39
40
|
export { strings as reporterStrings } from "./ui/strings";
|