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