@lightworkai.official/debug-capture 0.19.0 → 0.19.1

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