|
1 | | -var x=Object.create;var{defineProperty:g,getPrototypeOf:E,getOwnPropertyNames:F}=Object;var I=Object.prototype.hasOwnProperty;var w=(e,i,u)=>{u=e!=null?x(E(e)):{};const t=i||!e||!e.__esModule?g(u,"default",{value:e,enumerable:!0}):u;for(let o of F(e))if(!I.call(t,o))g(t,o,{get:()=>e[o],enumerable:!0});return t};var A=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports);var m=A((y,f)=>{(function(e,i){function u(){t.width=e.innerWidth,t.height=5*r.barThickness;var n=t.getContext("2d");n.shadowBlur=r.shadowBlur,n.shadowColor=r.shadowColor;var s,a=n.createLinearGradient(0,0,t.width,0);for(s in r.barColors)a.addColorStop(s,r.barColors[s]);n.lineWidth=r.barThickness,n.beginPath(),n.moveTo(0,r.barThickness/2),n.lineTo(Math.ceil(o*t.width),r.barThickness/2),n.strokeStyle=a,n.stroke()}var t,o,c,d=null,p=null,h=null,r={autoRun:!0,barThickness:3,barColors:{0:"rgba(26, 188, 156, .9)",".25":"rgba(52, 152, 219, .9)",".50":"rgba(241, 196, 15, .9)",".75":"rgba(230, 126, 34, .9)","1.0":"rgba(211, 84, 0, .9)"},shadowBlur:10,shadowColor:"rgba(0, 0, 0, .6)",className:null},l={config:function(n){for(var s in n)r.hasOwnProperty(s)&&(r[s]=n[s])},show:function(n){var s,a;c||(n?h=h||setTimeout(()=>l.show(),n):(c=!0,p!==null&&e.cancelAnimationFrame(p),t||((a=(t=i.createElement("canvas")).style).position="fixed",a.top=a.left=a.right=a.margin=a.padding=0,a.zIndex=100001,a.display="none",r.className&&t.classList.add(r.className),s="resize",n=u,(a=e).addEventListener?a.addEventListener(s,n,!1):a.attachEvent?a.attachEvent("on"+s,n):a["on"+s]=n),t.parentElement||i.body.appendChild(t),t.style.opacity=1,t.style.display="block",l.progress(0),r.autoRun&&function T(){d=e.requestAnimationFrame(T),l.progress("+"+0.05*Math.pow(1-Math.sqrt(o),2))}()))},progress:function(n){return n===void 0||(typeof n=="string"&&(n=(0<=n.indexOf("+")||0<=n.indexOf("-")?o:0)+parseFloat(n)),o=1<n?1:n,u()),o},hide:function(){clearTimeout(h),h=null,c&&(c=!1,d!=null&&(e.cancelAnimationFrame(d),d=null),function n(){return 1<=l.progress("+.1")&&(t.style.opacity-=0.05,t.style.opacity<=0.05)?(t.style.display="none",void(p=null)):void(p=e.requestAnimationFrame(n))}())}};typeof f=="object"&&typeof y=="object"?f.exports=l:typeof define=="function"&&define.amd?define(function(){return l}):this.topbar=l}).call(y,window,document)});var b=w(m(),1),B=document.querySelector("meta[name='csrf-token']").getAttribute("content"),M=document.querySelector("meta[name='live-path']").getAttribute("content"),N=document.querySelector("meta[name='live-transport']").getAttribute("content"),v={STORAGE_KEY:"error-tracker-theme",init(){if(localStorage.getItem(this.STORAGE_KEY)==="light")document.body.classList.add("light-theme")},toggle(){const e=document.body.classList.toggle("light-theme");localStorage.setItem(this.STORAGE_KEY,e?"light":"dark")},isLight(){return document.body.classList.contains("light-theme")}},q={JsonPrettyPrint:{mounted(){this.formatJson()},updated(){this.formatJson()},formatJson(){try{const e=this.el.textContent.trim(),i=JSON.stringify(JSON.parse(e),null,2);this.el.textContent=i}catch(e){console.error("Error formatting JSON:",e)}}},ThemeInit:{mounted(){v.init()}}},C=new LiveView.LiveSocket(M,Phoenix.Socket,{transport:N==="longpoll"?Phoenix.LongPoll:WebSocket,params:{_csrf_token:B},hooks:q});b.default.config({barColors:{0:"#29d"},shadowColor:"rgba(0, 0, 0, .3)"});window.addEventListener("phx:page-loading-start",(e)=>b.default.show(300));window.addEventListener("phx:page-loading-stop",(e)=>b.default.hide());document.addEventListener("click",function(e){var i=e.target.closest("[data-theme-toggle]");if(i)v.toggle()});C.connect();window.liveSocket=C; |
| 1 | +var __create = Object.create; |
| 2 | +var __getProtoOf = Object.getPrototypeOf; |
| 3 | +var __defProp = Object.defineProperty; |
| 4 | +var __getOwnPropNames = Object.getOwnPropertyNames; |
| 5 | +var __hasOwnProp = Object.prototype.hasOwnProperty; |
| 6 | +var __toESM = (mod, isNodeMode, target) => { |
| 7 | + target = mod != null ? __create(__getProtoOf(mod)) : {}; |
| 8 | + const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target; |
| 9 | + for (let key of __getOwnPropNames(mod)) |
| 10 | + if (!__hasOwnProp.call(to, key)) |
| 11 | + __defProp(to, key, { |
| 12 | + get: () => mod[key], |
| 13 | + enumerable: true |
| 14 | + }); |
| 15 | + return to; |
| 16 | +}; |
| 17 | +var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports); |
| 18 | + |
| 19 | +// ../node_modules/topbar/topbar.min.js |
| 20 | +var require_topbar_min = __commonJS((exports, module) => { |
| 21 | + (function(window2, document2) { |
| 22 | + function repaint() { |
| 23 | + canvas.width = window2.innerWidth, canvas.height = 5 * options.barThickness; |
| 24 | + var ctx = canvas.getContext("2d"); |
| 25 | + ctx.shadowBlur = options.shadowBlur, ctx.shadowColor = options.shadowColor; |
| 26 | + var stop, lineGradient = ctx.createLinearGradient(0, 0, canvas.width, 0); |
| 27 | + for (stop in options.barColors) |
| 28 | + lineGradient.addColorStop(stop, options.barColors[stop]); |
| 29 | + ctx.lineWidth = options.barThickness, ctx.beginPath(), ctx.moveTo(0, options.barThickness / 2), ctx.lineTo(Math.ceil(currentProgress * canvas.width), options.barThickness / 2), ctx.strokeStyle = lineGradient, ctx.stroke(); |
| 30 | + } |
| 31 | + var canvas, currentProgress, showing, progressTimerId = null, fadeTimerId = null, delayTimerId = null, options = { autoRun: true, barThickness: 3, barColors: { 0: "rgba(26, 188, 156, .9)", ".25": "rgba(52, 152, 219, .9)", ".50": "rgba(241, 196, 15, .9)", ".75": "rgba(230, 126, 34, .9)", "1.0": "rgba(211, 84, 0, .9)" }, shadowBlur: 10, shadowColor: "rgba(0, 0, 0, .6)", className: null }, topbar = { config: function(opts) { |
| 32 | + for (var key in opts) |
| 33 | + options.hasOwnProperty(key) && (options[key] = opts[key]); |
| 34 | + }, show: function(handler) { |
| 35 | + var type, elem; |
| 36 | + showing || (handler ? delayTimerId = delayTimerId || setTimeout(() => topbar.show(), handler) : (showing = true, fadeTimerId !== null && window2.cancelAnimationFrame(fadeTimerId), canvas || ((elem = (canvas = document2.createElement("canvas")).style).position = "fixed", elem.top = elem.left = elem.right = elem.margin = elem.padding = 0, elem.zIndex = 100001, elem.display = "none", options.className && canvas.classList.add(options.className), type = "resize", handler = repaint, (elem = window2).addEventListener ? elem.addEventListener(type, handler, false) : elem.attachEvent ? elem.attachEvent("on" + type, handler) : elem["on" + type] = handler), canvas.parentElement || document2.body.appendChild(canvas), canvas.style.opacity = 1, canvas.style.display = "block", topbar.progress(0), options.autoRun && function loop() { |
| 37 | + progressTimerId = window2.requestAnimationFrame(loop), topbar.progress("+" + 0.05 * Math.pow(1 - Math.sqrt(currentProgress), 2)); |
| 38 | + }())); |
| 39 | + }, progress: function(to) { |
| 40 | + return to === undefined || (typeof to == "string" && (to = (0 <= to.indexOf("+") || 0 <= to.indexOf("-") ? currentProgress : 0) + parseFloat(to)), currentProgress = 1 < to ? 1 : to, repaint()), currentProgress; |
| 41 | + }, hide: function() { |
| 42 | + clearTimeout(delayTimerId), delayTimerId = null, showing && (showing = false, progressTimerId != null && (window2.cancelAnimationFrame(progressTimerId), progressTimerId = null), function loop() { |
| 43 | + return 1 <= topbar.progress("+.1") && (canvas.style.opacity -= 0.05, canvas.style.opacity <= 0.05) ? (canvas.style.display = "none", void (fadeTimerId = null)) : void (fadeTimerId = window2.requestAnimationFrame(loop)); |
| 44 | + }()); |
| 45 | + } }; |
| 46 | + typeof module == "object" && typeof module.exports == "object" ? module.exports = topbar : typeof define == "function" && define.amd ? define(function() { |
| 47 | + return topbar; |
| 48 | + }) : this.topbar = topbar; |
| 49 | + }).call(exports, window, document); |
| 50 | +}); |
| 51 | + |
| 52 | +// app.js |
| 53 | +var import_topbar = __toESM(require_topbar_min(), 1); |
| 54 | +var csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content"); |
| 55 | +var livePath = document.querySelector("meta[name='live-path']").getAttribute("content"); |
| 56 | +var liveTransport = document.querySelector("meta[name='live-transport']").getAttribute("content"); |
| 57 | +var Theme = { |
| 58 | + STORAGE_KEY: "error-tracker-theme", |
| 59 | + init() { |
| 60 | + const saved = localStorage.getItem(this.STORAGE_KEY); |
| 61 | + if (saved === "light") { |
| 62 | + document.body.classList.add("light-theme"); |
| 63 | + } |
| 64 | + }, |
| 65 | + toggle() { |
| 66 | + const isLight = document.body.classList.toggle("light-theme"); |
| 67 | + localStorage.setItem(this.STORAGE_KEY, isLight ? "light" : "dark"); |
| 68 | + }, |
| 69 | + isLight() { |
| 70 | + return document.body.classList.contains("light-theme"); |
| 71 | + } |
| 72 | +}; |
| 73 | +var Hooks = { |
| 74 | + JsonPrettyPrint: { |
| 75 | + mounted() { |
| 76 | + this.formatJson(); |
| 77 | + }, |
| 78 | + updated() { |
| 79 | + this.formatJson(); |
| 80 | + }, |
| 81 | + formatJson() { |
| 82 | + try { |
| 83 | + const rawJson = this.el.textContent.trim(); |
| 84 | + const formattedJson = JSON.stringify(JSON.parse(rawJson), null, 2); |
| 85 | + this.el.textContent = formattedJson; |
| 86 | + } catch (error) { |
| 87 | + console.error("Error formatting JSON:", error); |
| 88 | + } |
| 89 | + } |
| 90 | + }, |
| 91 | + ThemeInit: { |
| 92 | + mounted() { |
| 93 | + Theme.init(); |
| 94 | + } |
| 95 | + }, |
| 96 | + CopyToClipboard: { |
| 97 | + mounted() { |
| 98 | + this.label = this.el.dataset.copyLabel || this.el.textContent; |
| 99 | + this.copiedLabel = this.el.dataset.copiedLabel || "Copied"; |
| 100 | + this.timeout = null; |
| 101 | + this.onClick = () => this.copy(); |
| 102 | + this.el.addEventListener("click", this.onClick); |
| 103 | + }, |
| 104 | + destroyed() { |
| 105 | + this.el.removeEventListener("click", this.onClick); |
| 106 | + clearTimeout(this.timeout); |
| 107 | + }, |
| 108 | + copy() { |
| 109 | + const target = document.getElementById(this.el.dataset.copyTarget); |
| 110 | + if (!target) |
| 111 | + return; |
| 112 | + const text = target.value || target.textContent; |
| 113 | + if (!text) |
| 114 | + return; |
| 115 | + const writeText = navigator.clipboard ? navigator.clipboard.writeText(text).catch(() => this.writeTextFallback(target)) : this.writeTextFallback(target); |
| 116 | + writeText.then(() => { |
| 117 | + this.el.textContent = this.copiedLabel; |
| 118 | + clearTimeout(this.timeout); |
| 119 | + this.timeout = setTimeout(() => { |
| 120 | + this.el.textContent = this.label; |
| 121 | + }, 2000); |
| 122 | + }); |
| 123 | + }, |
| 124 | + writeTextFallback(target) { |
| 125 | + target.select(); |
| 126 | + document.execCommand("copy"); |
| 127 | + target.blur(); |
| 128 | + return Promise.resolve(); |
| 129 | + } |
| 130 | + } |
| 131 | +}; |
| 132 | +var liveSocket = new LiveView.LiveSocket(livePath, Phoenix.Socket, { |
| 133 | + transport: liveTransport === "longpoll" ? Phoenix.LongPoll : WebSocket, |
| 134 | + params: { _csrf_token: csrfToken }, |
| 135 | + hooks: Hooks |
| 136 | +}); |
| 137 | +import_topbar.default.config({ barColors: { 0: "#29d" }, shadowColor: "rgba(0, 0, 0, .3)" }); |
| 138 | +window.addEventListener("phx:page-loading-start", (_info) => import_topbar.default.show(300)); |
| 139 | +window.addEventListener("phx:page-loading-stop", (_info) => import_topbar.default.hide()); |
| 140 | +document.addEventListener("click", function(e) { |
| 141 | + var toggle = e.target.closest("[data-theme-toggle]"); |
| 142 | + if (toggle) { |
| 143 | + Theme.toggle(); |
| 144 | + } |
| 145 | +}); |
| 146 | +liveSocket.connect(); |
| 147 | +window.liveSocket = liveSocket; |
0 commit comments