sutty-jekyll-theme 0.4.2 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/_data/actions.yml +9 -0
- data/_data/en.yml +69 -0
- data/_data/es.yml +70 -0
- data/_data/manifest.json +679 -7
- data/_includes/activity_pub/actor.html +11 -0
- data/_includes/activity_pub/actor_mention.html +28 -0
- data/_includes/activity_pub/button.html +22 -0
- data/_includes/activity_pub/button_bar.html +16 -0
- data/_includes/activity_pub/cards.html +28 -0
- data/_includes/activity_pub/fediverse_interactions.html +2 -0
- data/_includes/activity_pub/generic_modal.html +55 -0
- data/_includes/activity_pub/image_modal.html +27 -0
- data/_includes/activity_pub/interactions.html +78 -0
- data/_includes/activity_pub/login_modal.html +70 -0
- data/_includes/activity_pub/reaction.html +45 -0
- data/_includes/activity_pub/reactions.html +17 -0
- data/_includes/activity_pub/replying_to.html +23 -0
- data/_includes/activity_pub/text_modal.html +16 -0
- data/_includes/activity_pub/toot_card.html +95 -0
- data/_includes/activity_pub/url.html +8 -0
- data/_includes/activity_pub/video_modal.html +20 -0
- data/_includes/bootstrap/custom_select.html +18 -0
- data/_includes/date.html +12 -0
- data/_includes/external_link.html +15 -0
- data/_includes/fa.html +11 -0
- data/_includes/page.html +12 -0
- data/_layouts/default.html +1 -0
- data/assets/css/styles.scss +6 -0
- data/assets/fonts/forkawesome-webfont.woff2 +0 -0
- data/assets/js/env.js +8 -0
- data/assets/js/pack.FXJZFZ4Z.js +41 -0
- data/assets/js/pack.FXJZFZ4Z.js.map +7 -0
- data.tar.gz.sig +0 -0
- metadata +41 -3
- metadata.gz.sig +0 -0
- data/assets/js/pack.3XNALAB2.js +0 -27
- data/assets/js/pack.3XNALAB2.js.map +0 -7
data/_layouts/default.html
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
|
12
12
|
<link href="assets/css/styles.css?{{ site.time | date: '%s' }}" rel="stylesheet" data-turbo-track="reload">
|
13
13
|
|
14
|
+
{%- include_cached script.html src="assets/js/env.js" -%}
|
14
15
|
{%- for pack in site.data.manifest.outputs -%}
|
15
16
|
{%- unless pack[1].entryPoint -%}{%- continue -%}{%- endunless -%}
|
16
17
|
{%- assign src = pack[0] -%}
|
data/assets/css/styles.scss
CHANGED
@@ -7,9 +7,11 @@
|
|
7
7
|
{{ theme | yaml_to_scss: site.data.layouts.theme }}
|
8
8
|
{% endif %}
|
9
9
|
|
10
|
+
|
10
11
|
@import "fonts";
|
11
12
|
@import "variables";
|
12
13
|
@import "bootstrap/scss/bootstrap";
|
14
|
+
@import "fork-awesome/scss/fork-awesome";
|
13
15
|
@import "selection";
|
14
16
|
@import "buttons";
|
15
17
|
@import "crypto";
|
@@ -33,3 +35,7 @@
|
|
33
35
|
}
|
34
36
|
}
|
35
37
|
}
|
38
|
+
|
39
|
+
.turbo-progress-bar { background-color: $primary; }
|
40
|
+
.zindex-modal-backdrop { z-index: 1040; }
|
41
|
+
.zindex-modal { z-index: 1050; }
|
Binary file
|
data/assets/js/env.js
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
(()=>{var as=Object.create;var yt=Object.defineProperty;var cs=Object.getOwnPropertyDescriptor;var ls=Object.getOwnPropertyNames;var hs=Object.getPrototypeOf,us=Object.prototype.hasOwnProperty;var ds=(r,e,t)=>e in r?yt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var z=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var fs=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ls(e))!us.call(r,s)&&s!==t&&yt(r,s,{get:()=>e[s],enumerable:!(i=cs(e,s))||i.enumerable});return r};var Sr=(r,e,t)=>(t=r!=null?as(hs(r)):{},fs(e||!r||!r.__esModule?yt(t,"default",{value:r,enumerable:!0}):t,r));var J=(r,e,t)=>(ds(r,typeof e!="symbol"?e+"":e,t),t);var Ir=z((_t,Br)=>{(function(r,e){"use strict";typeof define=="function"&&define.amd?define("stackframe",[],e):typeof _t=="object"?Br.exports=e():r.StackFrame=e()})(_t,function(){"use strict";function r(p){return!isNaN(parseFloat(p))&&isFinite(p)}function e(p){return p.charAt(0).toUpperCase()+p.substring(1)}function t(p){return function(){return this[p]}}var i=["isConstructor","isEval","isNative","isToplevel"],s=["columnNumber","lineNumber"],n=["fileName","functionName","source"],o=["args"],c=["evalOrigin"],a=i.concat(s,n,o,c);function h(p){if(p)for(var y=0;y<a.length;y++)p[a[y]]!==void 0&&this["set"+e(a[y])](p[a[y]])}h.prototype={getArgs:function(){return this.args},setArgs:function(p){if(Object.prototype.toString.call(p)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=p},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(p){if(p instanceof h)this.evalOrigin=p;else if(p instanceof Object)this.evalOrigin=new h(p);else throw new TypeError("Eval Origin must be an Object or StackFrame")},toString:function(){var p=this.getFileName()||"",y=this.getLineNumber()||"",A=this.getColumnNumber()||"",k=this.getFunctionName()||"";return this.getIsEval()?p?"[eval] ("+p+":"+y+":"+A+")":"[eval]:"+y+":"+A:k?k+" ("+p+":"+y+":"+A+")":p+":"+y+":"+A}},h.fromString=function(y){var A=y.indexOf("("),k=y.lastIndexOf(")"),re=y.substring(0,A),W=y.substring(A+1,k).split(","),ie=y.substring(k+1);if(ie.indexOf("@")===0)var K=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(ie,""),D=K[1],pt=K[2],mt=K[3];return new h({functionName:re,args:W||void 0,fileName:D,lineNumber:pt||void 0,columnNumber:mt||void 0})};for(var d=0;d<i.length;d++)h.prototype["get"+e(i[d])]=t(i[d]),h.prototype["set"+e(i[d])]=function(p){return function(y){this[p]=!!y}}(i[d]);for(var f=0;f<s.length;f++)h.prototype["get"+e(s[f])]=t(s[f]),h.prototype["set"+e(s[f])]=function(p){return function(y){if(!r(y))throw new TypeError(p+" must be a Number");this[p]=Number(y)}}(s[f]);for(var m=0;m<n.length;m++)h.prototype["get"+e(n[m])]=t(n[m]),h.prototype["set"+e(n[m])]=function(p){return function(y){this[p]=String(y)}}(n[m]);return h})});var jr=z((St,Dr)=>{(function(r,e){"use strict";typeof define=="function"&&define.amd?define("error-stack-parser",["stackframe"],e):typeof St=="object"?Dr.exports=e(Ir()):r.ErrorStackParser=e(r.StackFrame)})(St,function(e){"use strict";var t=/(^|@)\S+:\d+/,i=/^\s*at .*(\S+:\d+|\(native\))/m,s=/^(eval@)?(\[native code])?$/;return{parse:function(o){if(typeof o.stacktrace<"u"||typeof o["opera#sourceloc"]<"u")return this.parseOpera(o);if(o.stack&&o.stack.match(i))return this.parseV8OrIE(o);if(o.stack)return this.parseFFOrSafari(o);throw new Error("Cannot parse given Error object")},extractLocation:function(o){if(o.indexOf(":")===-1)return[o];var c=/(.+?)(?::(\d+))?(?::(\d+))?$/,a=c.exec(o.replace(/[()]/g,""));return[a[1],a[2]||void 0,a[3]||void 0]},parseV8OrIE:function(o){var c=o.stack.split(`
|
2
|
+
`).filter(function(a){return!!a.match(i)},this);return c.map(function(a){a.indexOf("(eval ")>-1&&(a=a.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var h=a.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),d=h.match(/ (\(.+\)$)/);h=d?h.replace(d[0],""):h;var f=this.extractLocation(d?d[1]:h),m=d&&h||void 0,p=["eval","<anonymous>"].indexOf(f[0])>-1?void 0:f[0];return new e({functionName:m,fileName:p,lineNumber:f[1],columnNumber:f[2],source:a})},this)},parseFFOrSafari:function(o){var c=o.stack.split(`
|
3
|
+
`).filter(function(a){return!a.match(s)},this);return c.map(function(a){if(a.indexOf(" > eval")>-1&&(a=a.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),a.indexOf("@")===-1&&a.indexOf(":")===-1)return new e({functionName:a});var h=/((.*".+"[^@]*)?[^@]*)(?:@)/,d=a.match(h),f=d&&d[1]?d[1]:void 0,m=this.extractLocation(a.replace(h,""));return new e({functionName:f,fileName:m[0],lineNumber:m[1],columnNumber:m[2],source:a})},this)},parseOpera:function(o){return!o.stacktrace||o.message.indexOf(`
|
4
|
+
`)>-1&&o.message.split(`
|
5
|
+
`).length>o.stacktrace.split(`
|
6
|
+
`).length?this.parseOpera9(o):o.stack?this.parseOpera11(o):this.parseOpera10(o)},parseOpera9:function(o){for(var c=/Line (\d+).*script (?:in )?(\S+)/i,a=o.message.split(`
|
7
|
+
`),h=[],d=2,f=a.length;d<f;d+=2){var m=c.exec(a[d]);m&&h.push(new e({fileName:m[2],lineNumber:m[1],source:a[d]}))}return h},parseOpera10:function(o){for(var c=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,a=o.stacktrace.split(`
|
8
|
+
`),h=[],d=0,f=a.length;d<f;d+=2){var m=c.exec(a[d]);m&&h.push(new e({functionName:m[3]||void 0,fileName:m[2],lineNumber:m[1],source:a[d]}))}return h},parseOpera11:function(o){var c=o.stack.split(`
|
9
|
+
`).filter(function(a){return!!a.match(t)&&!a.match(/^Error created at/)},this);return c.map(function(a){var h=a.split("@"),d=this.extractLocation(h.pop()),f=h.shift()||"",m=f.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,p;f.match(/\(([^)]*)\)/)&&(p=f.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var y=p===void 0||p==="[arguments not available]"?void 0:p.split(",");return new e({functionName:m,args:y,fileName:d[0],lineNumber:d[1],columnNumber:d[2],source:a})},this)}}})});var Jr=z((X,zr)=>{var je=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global,qe=function(){function r(){this.fetch=!1,this.DOMException=je.DOMException}return r.prototype=je,new r}();(function(r){var e=function(t){var i=typeof r<"u"&&r||typeof self<"u"&&self||typeof global<"u"&&global||{},s={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};function n(l){return l&&DataView.prototype.isPrototypeOf(l)}if(s.arrayBuffer)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(l){return l&&o.indexOf(Object.prototype.toString.call(l))>-1};function a(l){if(typeof l!="string"&&(l=String(l)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(l)||l==="")throw new TypeError('Invalid character in header field name: "'+l+'"');return l.toLowerCase()}function h(l){return typeof l!="string"&&(l=String(l)),l}function d(l){var u={next:function(){var g=l.shift();return{done:g===void 0,value:g}}};return s.iterable&&(u[Symbol.iterator]=function(){return u}),u}function f(l){this.map={},l instanceof f?l.forEach(function(u,g){this.append(g,u)},this):Array.isArray(l)?l.forEach(function(u){if(u.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+u.length);this.append(u[0],u[1])},this):l&&Object.getOwnPropertyNames(l).forEach(function(u){this.append(u,l[u])},this)}f.prototype.append=function(l,u){l=a(l),u=h(u);var g=this.map[l];this.map[l]=g?g+", "+u:u},f.prototype.delete=function(l){delete this.map[a(l)]},f.prototype.get=function(l){return l=a(l),this.has(l)?this.map[l]:null},f.prototype.has=function(l){return this.map.hasOwnProperty(a(l))},f.prototype.set=function(l,u){this.map[a(l)]=h(u)},f.prototype.forEach=function(l,u){for(var g in this.map)this.map.hasOwnProperty(g)&&l.call(u,this.map[g],g,this)},f.prototype.keys=function(){var l=[];return this.forEach(function(u,g){l.push(g)}),d(l)},f.prototype.values=function(){var l=[];return this.forEach(function(u){l.push(u)}),d(l)},f.prototype.entries=function(){var l=[];return this.forEach(function(u,g){l.push([g,u])}),d(l)},s.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function m(l){if(!l._noBody){if(l.bodyUsed)return Promise.reject(new TypeError("Already read"));l.bodyUsed=!0}}function p(l){return new Promise(function(u,g){l.onload=function(){u(l.result)},l.onerror=function(){g(l.error)}})}function y(l){var u=new FileReader,g=p(u);return u.readAsArrayBuffer(l),g}function A(l){var u=new FileReader,g=p(u),b=/charset=([A-Za-z0-9_-]+)/.exec(l.type),E=b?b[1]:"utf-8";return u.readAsText(l,E),g}function k(l){for(var u=new Uint8Array(l),g=new Array(u.length),b=0;b<u.length;b++)g[b]=String.fromCharCode(u[b]);return g.join("")}function re(l){if(l.slice)return l.slice(0);var u=new Uint8Array(l.byteLength);return u.set(new Uint8Array(l)),u.buffer}function W(){return this.bodyUsed=!1,this._initBody=function(l){this.bodyUsed=this.bodyUsed,this._bodyInit=l,l?typeof l=="string"?this._bodyText=l:s.blob&&Blob.prototype.isPrototypeOf(l)?this._bodyBlob=l:s.formData&&FormData.prototype.isPrototypeOf(l)?this._bodyFormData=l:s.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)?this._bodyText=l.toString():s.arrayBuffer&&s.blob&&n(l)?(this._bodyArrayBuffer=re(l.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(l)||c(l))?this._bodyArrayBuffer=re(l):this._bodyText=l=Object.prototype.toString.call(l):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof l=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):s.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s.blob&&(this.blob=function(){var l=m(this);if(l)return l;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var l=m(this);return l||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(s.blob)return this.blob().then(y);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var l=m(this);if(l)return l;if(this._bodyBlob)return A(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(k(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s.formData&&(this.formData=function(){return this.text().then(pt)}),this.json=function(){return this.text().then(JSON.parse)},this}var ie=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function K(l){var u=l.toUpperCase();return ie.indexOf(u)>-1?u:l}function D(l,u){if(!(this instanceof D))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');u=u||{};var g=u.body;if(l instanceof D){if(l.bodyUsed)throw new TypeError("Already read");this.url=l.url,this.credentials=l.credentials,u.headers||(this.headers=new f(l.headers)),this.method=l.method,this.mode=l.mode,this.signal=l.signal,!g&&l._bodyInit!=null&&(g=l._bodyInit,l.bodyUsed=!0)}else this.url=String(l);if(this.credentials=u.credentials||this.credentials||"same-origin",(u.headers||!this.headers)&&(this.headers=new f(u.headers)),this.method=K(u.method||this.method||"GET"),this.mode=u.mode||this.mode||null,this.signal=u.signal||this.signal||function(){if("AbortController"in i){var v=new AbortController;return v.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&g)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(g),(this.method==="GET"||this.method==="HEAD")&&(u.cache==="no-store"||u.cache==="no-cache")){var b=/([?&])_=[^&]*/;if(b.test(this.url))this.url=this.url.replace(b,"$1_="+new Date().getTime());else{var E=/\?/;this.url+=(E.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}D.prototype.clone=function(){return new D(this,{body:this._bodyInit})};function pt(l){var u=new FormData;return l.trim().split("&").forEach(function(g){if(g){var b=g.split("="),E=b.shift().replace(/\+/g," "),v=b.join("=").replace(/\+/g," ");u.append(decodeURIComponent(E),decodeURIComponent(v))}}),u}function mt(l){var u=new f,g=l.replace(/\r?\n[\t ]+/g," ");return g.split("\r").map(function(b){return b.indexOf(`
|
10
|
+
`)===0?b.substr(1,b.length):b}).forEach(function(b){var E=b.split(":"),v=E.shift().trim();if(v){var Be=E.join(":").trim();try{u.append(v,Be)}catch(vt){console.warn("Response "+vt.message)}}}),u}W.call(D.prototype);function x(l,u){if(!(this instanceof x))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(u||(u={}),this.type="default",this.status=u.status===void 0?200:u.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=u.statusText===void 0?"":""+u.statusText,this.headers=new f(u.headers),this.url=u.url||"",this._initBody(l)}W.call(x.prototype),x.prototype.clone=function(){return new x(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},x.error=function(){var l=new x(null,{status:200,statusText:""});return l.ok=!1,l.status=0,l.type="error",l};var os=[301,302,303,307,308];x.redirect=function(l,u){if(os.indexOf(u)===-1)throw new RangeError("Invalid status code");return new x(null,{status:u,headers:{location:l}})},t.DOMException=i.DOMException;try{new t.DOMException}catch{t.DOMException=function(u,g){this.message=u,this.name=g;var b=Error(u);this.stack=b.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function gt(l,u){return new Promise(function(g,b){var E=new D(l,u);if(E.signal&&E.signal.aborted)return b(new t.DOMException("Aborted","AbortError"));var v=new XMLHttpRequest;function Be(){v.abort()}v.onload=function(){var T={statusText:v.statusText,headers:mt(v.getAllResponseHeaders()||"")};E.url.indexOf("file://")===0&&(v.status<200||v.status>599)?T.status=200:T.status=v.status,T.url="responseURL"in v?v.responseURL:T.headers.get("X-Request-URL");var se="response"in v?v.response:v.responseText;setTimeout(function(){g(new x(se,T))},0)},v.onerror=function(){setTimeout(function(){b(new TypeError("Network request failed"))},0)},v.ontimeout=function(){setTimeout(function(){b(new TypeError("Network request timed out"))},0)},v.onabort=function(){setTimeout(function(){b(new t.DOMException("Aborted","AbortError"))},0)};function vt(T){try{return T===""&&i.location.href?i.location.href:T}catch{return T}}if(v.open(E.method,vt(E.url),!0),E.credentials==="include"?v.withCredentials=!0:E.credentials==="omit"&&(v.withCredentials=!1),"responseType"in v&&(s.blob?v.responseType="blob":s.arrayBuffer&&(v.responseType="arraybuffer")),u&&typeof u.headers=="object"&&!(u.headers instanceof f||i.Headers&&u.headers instanceof i.Headers)){var _r=[];Object.getOwnPropertyNames(u.headers).forEach(function(T){_r.push(a(T)),v.setRequestHeader(T,h(u.headers[T]))}),E.headers.forEach(function(T,se){_r.indexOf(se)===-1&&v.setRequestHeader(se,T)})}else E.headers.forEach(function(T,se){v.setRequestHeader(se,T)});E.signal&&(E.signal.addEventListener("abort",Be),v.onreadystatechange=function(){v.readyState===4&&E.signal.removeEventListener("abort",Be)}),v.send(typeof E._bodyInit>"u"?null:E._bodyInit)})}return gt.polyfill=!0,i.fetch||(i.fetch=gt,i.Headers=f,i.Request=D,i.Response=x),t.Headers=f,t.Request=D,t.Response=x,t.fetch=gt,Object.defineProperty(t,"__esModule",{value:!0}),t}({})})(qe);qe.fetch.ponyfill=!0;delete qe.fetch.polyfill;var ce=je.fetch?je:qe;X=ce.fetch;X.default=ce.fetch;X.fetch=ce.fetch;X.Headers=ce.Headers;X.Request=ce.Request;X.Response=ce.Response;zr.exports=X});var At=z((ya,ei)=>{function N(){}N.prototype.clear=function(){this._root=null,this.size=0};N.prototype.find=function(r){for(var e=this._root;e!==null;){var t=this._comparator(r,e.data);if(t===0)return e.data;e=e.get_child(t>0)}return null};N.prototype.findIter=function(r){for(var e=this._root,t=this.iterator();e!==null;){var i=this._comparator(r,e.data);if(i===0)return t._cursor=e,t;t._ancestors.push(e),e=e.get_child(i>0)}return null};N.prototype.lowerBound=function(r){for(var e=this._root,t=this.iterator(),i=this._comparator;e!==null;){var s=i(r,e.data);if(s===0)return t._cursor=e,t;t._ancestors.push(e),e=e.get_child(s>0)}for(var n=t._ancestors.length-1;n>=0;--n)if(e=t._ancestors[n],i(r,e.data)<0)return t._cursor=e,t._ancestors.length=n,t;return t._ancestors.length=0,t};N.prototype.upperBound=function(r){for(var e=this.lowerBound(r),t=this._comparator;e.data()!==null&&t(e.data(),r)===0;)e.next();return e};N.prototype.min=function(){var r=this._root;if(r===null)return null;for(;r.left!==null;)r=r.left;return r.data};N.prototype.max=function(){var r=this._root;if(r===null)return null;for(;r.right!==null;)r=r.right;return r.data};N.prototype.iterator=function(){return new le(this)};N.prototype.each=function(r){for(var e=this.iterator(),t;(t=e.next())!==null;)if(r(t)===!1)return};N.prototype.reach=function(r){for(var e=this.iterator(),t;(t=e.prev())!==null;)if(r(t)===!1)return};function le(r){this._tree=r,this._ancestors=[],this._cursor=null}le.prototype.data=function(){return this._cursor!==null?this._cursor.data:null};le.prototype.next=function(){if(this._cursor===null){var r=this._tree._root;r!==null&&this._minNode(r)}else if(this._cursor.right===null){var e;do if(e=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.right===e)}else this._ancestors.push(this._cursor),this._minNode(this._cursor.right);return this._cursor!==null?this._cursor.data:null};le.prototype.prev=function(){if(this._cursor===null){var r=this._tree._root;r!==null&&this._maxNode(r)}else if(this._cursor.left===null){var e;do if(e=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.left===e)}else this._ancestors.push(this._cursor),this._maxNode(this._cursor.left);return this._cursor!==null?this._cursor.data:null};le.prototype._minNode=function(r){for(;r.left!==null;)this._ancestors.push(r),r=r.left;this._cursor=r};le.prototype._maxNode=function(r){for(;r.right!==null;)this._ancestors.push(r),r=r.right;this._cursor=r};ei.exports=N});var ii=z((ba,ri)=>{var Fs=At();function he(r){this.data=r,this.left=null,this.right=null,this.red=!0}he.prototype.get_child=function(r){return r?this.right:this.left};he.prototype.set_child=function(r,e){r?this.right=e:this.left=e};function He(r){this._root=null,this._comparator=r,this.size=0}He.prototype=new Fs;He.prototype.insert=function(r){var e=!1;if(this._root===null)this._root=new he(r),e=!0,this.size++;else{var t=new he(void 0),i=0,s=0,n=null,o=t,c=null,a=this._root;for(o.right=this._root;;){if(a===null?(a=new he(r),c.set_child(i,a),e=!0,this.size++):F(a.left)&&F(a.right)&&(a.red=!0,a.left.red=!1,a.right.red=!1),F(a)&&F(c)){var h=o.right===n;a===c.get_child(s)?o.set_child(h,we(n,!s)):o.set_child(h,ti(n,!s))}var d=this._comparator(a.data,r);if(d===0)break;s=i,i=d<0,n!==null&&(o=n),n=c,c=a,a=a.get_child(i)}this._root=t.right}return this._root.red=!1,e};He.prototype.remove=function(r){if(this._root===null)return!1;var e=new he(void 0),t=e;t.right=this._root;for(var i=null,s=null,n=null,o=1;t.get_child(o)!==null;){var c=o;s=i,i=t,t=t.get_child(o);var a=this._comparator(r,t.data);if(o=a>0,a===0&&(n=t),!F(t)&&!F(t.get_child(o))){if(F(t.get_child(!o))){var h=we(t,o);i.set_child(c,h),i=h}else if(!F(t.get_child(!o))){var d=i.get_child(!c);if(d!==null)if(!F(d.get_child(!c))&&!F(d.get_child(c)))i.red=!1,d.red=!0,t.red=!0;else{var f=s.right===i;F(d.get_child(c))?s.set_child(f,ti(i,c)):F(d.get_child(!c))&&s.set_child(f,we(i,c));var m=s.get_child(f);m.red=!0,t.red=!0,m.left.red=!1,m.right.red=!1}}}}return n!==null&&(n.data=t.data,i.set_child(i.right===t,t.get_child(t.left===null)),this.size--),this._root=e.right,this._root!==null&&(this._root.red=!1),n!==null};function F(r){return r!==null&&r.red}function we(r,e){var t=r.get_child(!e);return r.set_child(!e,t.get_child(e)),t.set_child(e,r),r.red=!0,t.red=!1,t}function ti(r,e){return r.set_child(!e,we(r.get_child(!e),!e)),we(r,e)}ri.exports=He});var ni=z((wa,si)=>{var Ms=At();function Ee(r){this.data=r,this.left=null,this.right=null}Ee.prototype.get_child=function(r){return r?this.right:this.left};Ee.prototype.set_child=function(r,e){r?this.right=e:this.left=e};function Ve(r){this._root=null,this._comparator=r,this.size=0}Ve.prototype=new Ms;Ve.prototype.insert=function(r){if(this._root===null)return this._root=new Ee(r),this.size++,!0;for(var e=0,t=null,i=this._root;;){if(i===null)return i=new Ee(r),t.set_child(e,i),ret=!0,this.size++,!0;if(this._comparator(i.data,r)===0)return!1;e=this._comparator(i.data,r)<0,t=i,i=i.get_child(e)}};Ve.prototype.remove=function(r){if(this._root===null)return!1;var e=new Ee(void 0),t=e;t.right=this._root;for(var i=null,s=null,n=1;t.get_child(n)!==null;){i=t,t=t.get_child(n);var o=this._comparator(r,t.data);n=o>0,o===0&&(s=t)}return s!==null?(s.data=t.data,i.set_child(i.right===t,t.get_child(t.left===null)),this._root=e.right,this.size--,!0):!1};si.exports=Ve});var ai=z((Ea,oi)=>{oi.exports={RBTree:ii(),BinTree:ni()}});var hi=z((_a,li)=>{var xs=ai().RBTree;function w(r,e,t){this.discrete=r===!1,this.delta=r||.01,this.K=e===void 0?25:e,this.CX=t===void 0?1.1:t,this.centroids=new xs(ci),this.nreset=0,this.reset()}w.prototype.reset=function(){this.centroids.clear(),this.n=0,this.nreset+=1,this.last_cumulate=0};w.prototype.size=function(){return this.centroids.size};w.prototype.toArray=function(r){var e=[];return r?(this._cumulate(!0),this.centroids.each(function(t){e.push(t)})):this.centroids.each(function(t){e.push({mean:t.mean,n:t.n})}),e};w.prototype.summary=function(){var r=this.discrete?"exact ":"approximating ",e=[r+this.n+" samples using "+this.size()+" centroids","min = "+this.percentile(0),"Q1 = "+this.percentile(.25),"Q2 = "+this.percentile(.5),"Q3 = "+this.percentile(.75),"max = "+this.percentile(1)];return e.join(`
|
11
|
+
`)};function ci(r,e){return r.mean>e.mean?1:r.mean<e.mean?-1:0}function Ns(r,e){return r.mean_cumn-e.mean_cumn}w.prototype.push=function(r,e){e=e||1,r=Array.isArray(r)?r:[r];for(var t=0;t<r.length;t++)this._digest(r[t],e)};w.prototype.push_centroid=function(r){r=Array.isArray(r)?r:[r];for(var e=0;e<r.length;e++)this._digest(r[e].mean,r[e].n)};w.prototype._cumulate=function(r){if(!(this.n===this.last_cumulate||!r&&this.CX&&this.CX>this.n/this.last_cumulate)){var e=0;this.centroids.each(function(t){t.mean_cumn=e+t.n/2,e=t.cumn=e+t.n}),this.n=this.last_cumulate=e}};w.prototype.find_nearest=function(r){if(this.size()===0)return null;var e=this.centroids.lowerBound({mean:r}),t=e.data()===null?e.prev():e.data();if(t.mean===r||this.discrete)return t;var i=e.prev();return i&&Math.abs(i.mean-r)<Math.abs(t.mean-r)?i:t};w.prototype._new_centroid=function(r,e,t){var i={mean:r,n:e,cumn:t};return this.centroids.insert(i),this.n+=e,i};w.prototype._addweight=function(r,e,t){e!==r.mean&&(r.mean+=t*(e-r.mean)/(r.n+t)),r.cumn+=t,r.mean_cumn+=t/2,r.n+=t,this.n+=t};w.prototype._digest=function(r,e){var t=this.centroids.min(),i=this.centroids.max(),s=this.find_nearest(r);if(s&&s.mean===r)this._addweight(s,r,e);else if(s===t)this._new_centroid(r,e,0);else if(s===i)this._new_centroid(r,e,this.n);else if(this.discrete)this._new_centroid(r,e,s.cumn);else{var n=s.mean_cumn/this.n,o=Math.floor(4*this.n*this.delta*n*(1-n));o-s.n>=e?this._addweight(s,r,e):this._new_centroid(r,e,s.cumn)}this._cumulate(!1),!this.discrete&&this.K&&this.size()>this.K/this.delta&&this.compress()};w.prototype.bound_mean=function(r){var e=this.centroids.upperBound({mean:r}),t=e.prev(),i=t.mean===r?t:e.next();return[t,i]};w.prototype.p_rank=function(r){var e=Array.isArray(r)?r:[r],t=e.map(this._p_rank,this);return Array.isArray(r)?t:t[0]};w.prototype._p_rank=function(r){if(this.size()!==0){{if(r<this.centroids.min().mean)return 0;if(r>this.centroids.max().mean)return 1}this._cumulate(!0);var e=this.bound_mean(r),t=e[0],i=e[1];if(this.discrete)return t.cumn/this.n;var s=t.mean_cumn;return t!==i&&(s+=(r-t.mean)*(i.mean_cumn-t.mean_cumn)/(i.mean-t.mean)),s/this.n}};w.prototype.bound_mean_cumn=function(r){this.centroids._comparator=Ns;var e=this.centroids.upperBound({mean_cumn:r});this.centroids._comparator=ci;var t=e.prev(),i=t&&t.mean_cumn===r?t:e.next();return[t,i]};w.prototype.percentile=function(r){var e=Array.isArray(r)?r:[r],t=e.map(this._percentile,this);return Array.isArray(r)?t:t[0]};w.prototype._percentile=function(r){if(this.size()!==0){this._cumulate(!0);var e=this.n*r,t=this.bound_mean_cumn(e),i=t[0],s=t[1];return s===i||i===null||s===null?(i||s).mean:this.discrete?e<=i.cumn?i.mean:s.mean:i.mean+(e-i.mean_cumn)*(s.mean-i.mean)/(s.mean_cumn-i.mean_cumn)}};function Ps(r){var e=Math.floor(Math.random()*r.length);return r.splice(e,1)[0]}w.prototype.compress=function(){if(!this.compressing){var r=this.toArray();for(this.reset(),this.compressing=!0;r.length>0;)this.push_centroid(Ps(r));this._cumulate(!0),this.compressing=!1}};function G(r){this.config=r||{},this.mode=this.config.mode||"auto",w.call(this,this.mode==="cont"?r.delta:!1),this.digest_ratio=this.config.ratio||.9,this.digest_thresh=this.config.thresh||1e3,this.n_unique=0}G.prototype=Object.create(w.prototype);G.prototype.constructor=G;G.prototype.push=function(r){w.prototype.push.call(this,r),this.check_continuous()};G.prototype._new_centroid=function(r,e,t){this.n_unique+=1,w.prototype._new_centroid.call(this,r,e,t)};G.prototype._addweight=function(r,e,t){r.n===1&&(this.n_unique-=1),w.prototype._addweight.call(this,r,e,t)};G.prototype.check_continuous=function(){return this.mode!=="auto"||this.size()<this.digest_thresh?!1:this.n_unique/this.size()>this.digest_ratio?(this.mode="cont",this.discrete=!1,this.delta=this.config.delta||.01,this.compress(),!0):!1};li.exports={TDigest:w,Digest:G}});function ps(r){var e=this.constructor;return this.then(function(t){return e.resolve(r()).then(function(){return t})},function(t){return e.resolve(r()).then(function(){return e.reject(t)})})}var Ar=ps;function ms(r){var e=this;return new e(function(t,i){if(!(r&&typeof r.length<"u"))return i(new TypeError(typeof r+" "+r+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var s=Array.prototype.slice.call(r);if(s.length===0)return t([]);var n=s.length;function o(a,h){if(h&&(typeof h=="object"||typeof h=="function")){var d=h.then;if(typeof d=="function"){d.call(h,function(f){o(a,f)},function(f){s[a]={status:"rejected",reason:f},--n===0&&t(s)});return}}s[a]={status:"fulfilled",value:h},--n===0&&t(s)}for(var c=0;c<s.length;c++)o(c,s[c])})}var Tr=ms;function Or(r,e){this.name="AggregateError",this.errors=r,this.message=e||""}Or.prototype=Error.prototype;function gs(r){var e=this;return new e(function(t,i){if(!(r&&typeof r.length<"u"))return i(new TypeError("Promise.any accepts an array"));var s=Array.prototype.slice.call(r);if(s.length===0)return i();for(var n=[],o=0;o<s.length;o++)try{e.resolve(s[o]).then(t).catch(function(c){n.push(c),n.length===s.length&&i(new Or(n,"All promises were rejected"))})}catch(c){i(c)}})}var Lr=gs;var vs=setTimeout;function Cr(r){return!!(r&&typeof r.length<"u")}function ys(){}function bs(r,e){return function(){r.apply(e,arguments)}}function _(r){if(!(this instanceof _))throw new TypeError("Promises must be constructed via new");if(typeof r!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],Rr(r,this)}function kr(r,e){for(;r._state===3;)r=r._value;if(r._state===0){r._deferreds.push(e);return}r._handled=!0,_._immediateFn(function(){var t=r._state===1?e.onFulfilled:e.onRejected;if(t===null){(r._state===1?bt:be)(e.promise,r._value);return}var i;try{i=t(r._value)}catch(s){be(e.promise,s);return}bt(e.promise,i)})}function bt(r,e){try{if(e===r)throw new TypeError("A promise cannot be resolved with itself.");if(e&&(typeof e=="object"||typeof e=="function")){var t=e.then;if(e instanceof _){r._state=3,r._value=e,wt(r);return}else if(typeof t=="function"){Rr(bs(t,e),r);return}}r._state=1,r._value=e,wt(r)}catch(i){be(r,i)}}function be(r,e){r._state=2,r._value=e,wt(r)}function wt(r){r._state===2&&r._deferreds.length===0&&_._immediateFn(function(){r._handled||_._unhandledRejectionFn(r._value)});for(var e=0,t=r._deferreds.length;e<t;e++)kr(r,r._deferreds[e]);r._deferreds=null}function ws(r,e,t){this.onFulfilled=typeof r=="function"?r:null,this.onRejected=typeof e=="function"?e:null,this.promise=t}function Rr(r,e){var t=!1;try{r(function(i){t||(t=!0,bt(e,i))},function(i){t||(t=!0,be(e,i))})}catch(i){if(t)return;t=!0,be(e,i)}}_.prototype.catch=function(r){return this.then(null,r)};_.prototype.then=function(r,e){var t=new this.constructor(ys);return kr(this,new ws(r,e,t)),t};_.prototype.finally=Ar;_.all=function(r){return new _(function(e,t){if(!Cr(r))return t(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(r);if(i.length===0)return e([]);var s=i.length;function n(c,a){try{if(a&&(typeof a=="object"||typeof a=="function")){var h=a.then;if(typeof h=="function"){h.call(a,function(d){n(c,d)},t);return}}i[c]=a,--s===0&&e(i)}catch(d){t(d)}}for(var o=0;o<i.length;o++)n(o,i[o])})};_.any=Lr;_.allSettled=Tr;_.resolve=function(r){return r&&typeof r=="object"&&r.constructor===_?r:new _(function(e){e(r)})};_.reject=function(r){return new _(function(e,t){t(r)})};_.race=function(r){return new _(function(e,t){if(!Cr(r))return t(new TypeError("Promise.race accepts an array"));for(var i=0,s=r.length;i<s;i++)_.resolve(r[i]).then(e,t)})};_._immediateFn=typeof setImmediate=="function"&&function(r){setImmediate(r)}||function(r){vs(r,0)};_._unhandledRejectionFn=function(e){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var j=_;var Es="[Filtered]",Fr=128;function xr(r,e){var t=e===void 0?{}:e,i=t.maxLength,s=i===void 0?64e3:i,n=t.keysBlocklist,o=n===void 0?[]:n;if(r.errors)for(var c=0;c<r.errors.length;c++){var a=new Nr({keysBlocklist:o});r.errors[c]=a.truncate(r.errors[c])}for(var h="",d=["context","params","environment","session"],f=0;f<8;f++){for(var m={level:f,keysBlocklist:o},p=0,y=d;p<y.length;p++){var A=y[p],k=r[A];k&&(r[A]=_s(k,m))}if(h=JSON.stringify(r),h.length<s)return h}var re={json:h.slice(0,Math.floor(s/2))+"..."};d.push("errors");for(var W=0,ie=d;W<ie.length;W++){var A=ie[W],k=r[A];k&&(h=JSON.stringify(k),re[A]=h.length)}var K=new Error("airbrake: notice exceeds max length and can't be truncated");throw K.params=re,K}function Ie(r,e){return r>>e||1}var Nr=function(){function r(e){this.maxStringLength=1024,this.maxObjectLength=Fr,this.maxArrayLength=Fr,this.maxDepth=8,this.keys=[],this.keysBlocklist=[],this.seen=[];var t=e.level||0;this.keysBlocklist=e.keysBlocklist||[],this.maxStringLength=Ie(this.maxStringLength,t),this.maxObjectLength=Ie(this.maxObjectLength,t),this.maxArrayLength=Ie(this.maxArrayLength,t),this.maxDepth=Ie(this.maxDepth,t)}return r.prototype.truncate=function(e,t,i){if(t===void 0&&(t=""),i===void 0&&(i=0),e==null)return e;switch(typeof e){case"boolean":case"number":case"function":return e;case"string":return this.truncateString(e);case"object":break;default:return this.truncateString(String(e))}if(e instanceof String)return this.truncateString(e.toString());if(e instanceof Boolean||e instanceof Number||e instanceof Date||e instanceof RegExp)return e;if(e instanceof Error)return this.truncateString(e.toString());if(this.seen.indexOf(e)>=0)return"[Circular "+this.getPath(e)+"]";var s=Ss(e);if(i++,i>this.maxDepth)return"[Truncated "+s+"]";switch(this.keys.push(t),this.seen.push(e),s){case"Array":return this.truncateArray(e,i);case"Object":return this.truncateObject(e,i);default:var n=this.maxDepth;this.maxDepth=0;var o=this.truncateObject(e,i);return o.__type=s,this.maxDepth=n,o}},r.prototype.getPath=function(e){for(var t=this.seen.indexOf(e),i=[this.keys[t]],s=t;s>=0;s--){var n=this.seen[s];n&&Mr(n,i[0])===e&&(e=n,i.unshift(this.keys[s]))}return"~"+i.join(".")},r.prototype.truncateString=function(e){return e.length>this.maxStringLength?e.slice(0,this.maxStringLength)+"...":e},r.prototype.truncateArray=function(e,t){t===void 0&&(t=0);for(var i=0,s=[],n=0;n<e.length;n++){var o=e[n];if(s.push(this.truncate(o,n.toString(),t)),i++,i>=this.maxArrayLength)break}return s},r.prototype.truncateObject=function(e,t){t===void 0&&(t=0);var i=0,s={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(As(n,this.keysBlocklist)){s[n]=Es;continue}var o=Mr(e,n);if(!(o===void 0||typeof o=="function")&&(s[n]=this.truncate(o,n,t),i++,i>=this.maxObjectLength))break}return s},r}();function _s(r,e){e===void 0&&(e={});var t=new Nr(e);return t.truncate(r)}function Mr(r,e){try{return r[e]}catch{return}}function Ss(r){var e=Object.prototype.toString.apply(r);return e.slice(8,-1)}function As(r,e){for(var t=0,i=e;t<i.length;t++){var s=i[t];if(s===r||s instanceof RegExp&&r.match(s))return!0}return!1}var Ts=function(){function r(e,t,i){this._dur=0,this._level=0,this._metric=e,this.name=t,this.startTime=i||new Date}return r.prototype.end=function(e){this.endTime=e||new Date,this._dur+=this.endTime.getTime()-this.startTime.getTime(),this._metric._incGroup(this.name,this._dur),this._metric=null},r.prototype._pause=function(){if(!this._paused()){var e=new Date;this._dur+=e.getTime()-this.startTime.getTime(),this.startTime=null}},r.prototype._resume=function(){this._paused()&&(this.startTime=new Date)},r.prototype._paused=function(){return this.startTime==null},r}();var De=function(){function r(){this._spans={},this._groups={},this.startTime=new Date}return r.prototype.end=function(e){this.endTime||(this.endTime=e||new Date)},r.prototype.isRecording=function(){return!0},r.prototype.startSpan=function(e,t){var i=this._spans[e];i?i._level++:(i=new Ts(this,e,t),this._spans[e]=i)},r.prototype.endSpan=function(e,t){var i=this._spans[e];if(!i){console.error("airbrake: span=%s does not exist",e);return}i._level>0?i._level--:(i.end(t),delete this._spans[i.name])},r.prototype._incGroup=function(e,t){this._groups[e]=(this._groups[e]||0)+t},r.prototype._duration=function(){return this.endTime||(this.endTime=new Date),this.endTime.getTime()-this.startTime.getTime()},r}();var Pr=function(){function r(){}return r.prototype.isRecording=function(){return!1},r.prototype.startSpan=function(e,t){},r.prototype.endSpan=function(e,t){},r.prototype._incGroup=function(e,t){},r}();var ae=function(){return ae=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},ae.apply(this,arguments)},Et=function(){function r(){this._noopMetric=new Pr,this._context={},this._historyMaxLen=20,this._history=[]}return r.prototype.clone=function(){var e=new r;return e._context=ae({},this._context),e._history=this._history.slice(),e},r.prototype.setContext=function(e){this._context=ae(ae({},this._context),e)},r.prototype.context=function(){var e=ae({},this._context);return this._history.length>0&&(e.history=this._history.slice()),e},r.prototype.pushHistory=function(e){if(this._isDupState(e)){this._lastRecord.num?this._lastRecord.num++:this._lastRecord.num=2;return}e.date||(e.date=new Date),this._history.push(e),this._lastRecord=e,this._history.length>this._historyMaxLen&&(this._history=this._history.slice(-this._historyMaxLen))},r.prototype._isDupState=function(e){if(!this._lastRecord)return!1;for(var t in e)if(!(!e.hasOwnProperty(t)||t==="date")&&e[t]!==this._lastRecord[t])return!1;return!0},r.prototype.routeMetric=function(){return this._routeMetric||this._noopMetric},r.prototype.setRouteMetric=function(e){this._routeMetric=e},r.prototype.queueMetric=function(){return this._queueMetric||this._noopMetric},r.prototype.setQueueMetric=function(e){this._queueMetric=e},r}();var Hr=Sr(jr()),Os=typeof console=="object"&&console.warn;function qr(r){try{return Hr.default.parse(r)}catch(e){Os&&r.stack&&console.warn("ErrorStackParser:",e.toString(),r.stack)}return r.fileName?[r]:[]}function Vr(r){var e=[];if(r.noStack)e.push({function:r.functionName||"",file:r.fileName||"",line:r.lineNumber||0,column:r.columnNumber||0});else{var t=qr(r);if(t.length===0)try{throw new Error("fake")}catch(a){t=qr(a),t.shift(),t.shift()}for(var i=0,s=t;i<s.length;i++){var n=s[i];e.push({function:n.functionName||"",file:n.fileName||"",line:n.lineNumber||0,column:n.columnNumber||0})}}var o=r.name?r.name:"",c=r.message?String(r.message):String(r);return{type:o,message:c,backtrace:e}}var Ls=new RegExp(["^","\\[(\\$.+)\\]","\\s","([\\s\\S]+)","$"].join(""));function $r(r){var e=r.errors[0];if(e.type!==""&&e.type!=="Error")return r;var t=e.message.match(Ls);return t!==null&&(e.type=t[1],e.message=t[2]),r}function Ur(){var r,e;return function(t){var i=JSON.stringify(t.errors);return i===r?null:(e&&clearTimeout(e),r=i,e=setTimeout(function(){r=""},1e3),t)}}var Cs=["Script error","Script error.","InvalidAccessError"];function Wr(r){var e=r.errors[0];if(e.type===""&&Cs.indexOf(e.message)!==-1)return null;if(e.backtrace&&e.backtrace.length>0){var t=e.backtrace[0];if(t.file==="<anonymous>")return null}return r}var ks=new RegExp(["^","Uncaught\\s","(.+?)",":\\s","(.+)","$"].join(""));function Kr(r){var e=r.errors[0];if(e.type!==""&&e.type!=="Error")return r;var t=e.message.match(ks);return t!==null&&(e.type=t[1],e.message=t[2]),r}var Gr=Sr(Jr());var q={unauthorized:new Error("airbrake: unauthorized: project id or key are wrong"),ipRateLimited:new Error("airbrake: IP is rate limited")};var Xr=0;function Qr(r){var e=Date.now()/1e3;if(e<Xr)return j.reject(q.ipRateLimited);var t={method:r.method,body:r.body};return(0,Gr.default)(r.url,t).then(function(i){if(i.status===401)throw q.unauthorized;if(i.status===429){var s=i.headers.get("X-RateLimit-Delay");if(!s)throw q.ipRateLimited;var n=parseInt(s,10);throw n>0&&(Xr=Date.now()/1e3+n),q.ipRateLimited}if(i.status===204)return{json:null};if(i.status===404)throw new Error("404 Not Found");return i.status>=200&&i.status<300?i.json().then(function(o){return{json:o}}):i.status>=400&&i.status<500?i.json().then(function(o){var c=new Error(o.message);throw c}):i.text().then(function(o){var c=new Error("airbrake: fetch: unexpected response: code="+i.status+" body='"+o+"'");throw c})})}function Zr(r){return function(e){return Rs(e,r)}}var Yr=0;function Rs(r,e){var t=Date.now()/1e3;return t<Yr?j.reject(q.ipRateLimited):new j(function(i,s){e({url:r.url,method:r.method,body:r.body,headers:{"content-type":"application/json"},timeout:r.timeout},function(n,o,c){if(n){s(n);return}if(!o.statusCode){n=new Error("airbrake: request: response statusCode is "+o.statusCode),s(n);return}if(o.statusCode===401){s(q.unauthorized);return}if(o.statusCode===429){s(q.ipRateLimited);var a=o.headers["x-ratelimit-delay"];if(!a)return;var h=void 0;if(typeof a=="string")h=a;else if(a instanceof Array)h=a[0];else return;var d=parseInt(h,10);d>0&&(Yr=Date.now()/1e3+d);return}if(o.statusCode===204){i({json:null});return}if(o.statusCode>=200&&o.statusCode<300){var f=void 0;try{f=JSON.parse(c)}catch(m){s(m);return}i(f);return}if(o.statusCode>=400&&o.statusCode<500){var f=void 0;try{f=JSON.parse(c)}catch(p){s(p);return}n=new Error(f.message),s(n);return}c=c.trim(),n=new Error("airbrake: node: unexpected response: code="+o.statusCode+" body='"+c+"'"),s(n)})})}function H(r){return r.request?Zr(r.request):Qr}var Bs=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,s){i.__proto__=s}||function(i,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i[n]=s[n])},r(e,t)};return function(e,t){r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}(),ui,Q=!1;try{ui=hi(),Q=!0}catch{}var ue=function(){function r(){this.count=0,this.sum=0,this.sumsq=0,this._td=new ui.Digest}return r.prototype.add=function(e){e===0&&(e=1e-5),this.count+=1,this.sum+=e,this.sumsq+=e*e,this._td&&this._td.push(e)},r.prototype.toJSON=function(){return{count:this.count,sum:this.sum,sumsq:this.sumsq,tdigestCentroids:di(this._td)}},r}();var $e=function(r){Bs(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.groups={},t}return e.prototype.addGroups=function(t,i){this.add(t);for(var s in i)i.hasOwnProperty(s)&&this.addGroup(s,i[s])},e.prototype.addGroup=function(t,i){var s=this.groups[t];s||(s=new ue,this.groups[t]=s),s.add(i)},e.prototype.toJSON=function(){return{count:this.count,sum:this.sum,sumsq:this.sumsq,tdigestCentroids:di(this._td),groups:this.groups}},e}(ue);function di(r){var e=[],t=[];return r.centroids.each(function(i){e.push(i.mean),t.push(i.n)}),{mean:e,count:t}}var Ue=function(){return Ue=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},Ue.apply(this,arguments)},Is=15e3,fi=function(){function r(e){e===void 0&&(e=""),this.method="",this.route="",this.query="",this.func="",this.file="",this.line=0,this.startTime=new Date,this.query=e}return r.prototype._duration=function(){return this.endTime||(this.endTime=new Date),this.endTime.getTime()-this.startTime.getTime()},r}();var pi=function(){function r(e){this._m={},this._opt=e,this._url=e.host+"/api/v5/projects/"+e.projectId+"/queries-stats?key="+e.projectKey,this._requester=H(e)}return r.prototype.start=function(e){return e===void 0&&(e=""),new fi(e)},r.prototype.notify=function(e){var t=this;if(Q){var i=e._duration(),s=60*1e3,n=new Date(Math.floor(e.startTime.getTime()/s)*s),o={method:e.method,route:e.route,query:e.query,func:e.func,file:e.file,line:e.line,time:n},c=JSON.stringify(o),a=this._m[c];a||(a=new ue,this._m[c]=a),a.add(i),!this._timer&&(this._timer=setTimeout(function(){t._flush()},Is))}},r.prototype._flush=function(){var e=[];for(var t in this._m)if(this._m.hasOwnProperty(t)){var i=JSON.parse(t),s=Ue(Ue({},i),this._m[t].toJSON());e.push(s)}this._m={},this._timer=null;var n=JSON.stringify({environment:this._opt.environment,queries:e}),o={method:"POST",url:this._url,body:n};this._requester(o).then(function(c){}).catch(function(c){console.error&&console.error("can not report queries stats",c)})},r}();var Ds=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,s){i.__proto__=s}||function(i,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i[n]=s[n])},r(e,t)};return function(e,t){r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}(),We=function(){return We=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},We.apply(this,arguments)},js=15e3,mi=function(r){Ds(e,r);function e(t){var i=r.call(this)||this;return i.queue=t,i.startTime=new Date,i}return e}(De);var gi=function(){function r(e){this._m={},this._opt=e,this._url=e.host+"/api/v5/projects/"+e.projectId+"/queues-stats?key="+e.projectKey,this._requester=H(e)}return r.prototype.notify=function(e){var t=this;if(Q){var i=e._duration();i===0&&(i=1e-5);var s=60*1e3,n=new Date(Math.floor(e.startTime.getTime()/s)*s),o={queue:e.queue,time:n},c=JSON.stringify(o),a=this._m[c];a||(a=new $e,this._m[c]=a),a.addGroups(i,e._groups),!this._timer&&(this._timer=setTimeout(function(){t._flush()},js))}},r.prototype._flush=function(){var e=[];for(var t in this._m)if(this._m.hasOwnProperty(t)){var i=JSON.parse(t),s=We(We({},i),this._m[t].toJSON());e.push(s)}this._m={},this._timer=null;var n=JSON.stringify({environment:this._opt.environment,queues:e}),o={method:"POST",url:this._url,body:n};this._requester(o).then(function(c){}).catch(function(c){console.error&&console.error("can not report queues breakdowns",c)})},r}();var qs=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,s){i.__proto__=s}||function(i,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i[n]=s[n])},r(e,t)};return function(e,t){r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}(),de=function(){return de=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},de.apply(this,arguments)},vi=15e3,yi=function(r){qs(e,r);function e(t,i,s,n){t===void 0&&(t=""),i===void 0&&(i=""),s===void 0&&(s=0),n===void 0&&(n="");var o=r.call(this)||this;return o.method=t,o.route=i,o.statusCode=s,o.contentType=n,o.startTime=new Date,o}return e}(De);var bi=function(){function r(e){this._m={},this._opt=e,this._url=e.host+"/api/v5/projects/"+e.projectId+"/routes-stats?key="+e.projectKey,this._requester=H(e)}return r.prototype.notify=function(e){var t=this;if(Q){var i=e._duration(),s=60*1e3,n=new Date(Math.floor(e.startTime.getTime()/s)*s),o={method:e.method,route:e.route,statusCode:e.statusCode,time:n},c=JSON.stringify(o),a=this._m[c];a||(a=new ue,this._m[c]=a),a.add(i),!this._timer&&(this._timer=setTimeout(function(){t._flush()},vi))}},r.prototype._flush=function(){var e=[];for(var t in this._m)if(this._m.hasOwnProperty(t)){var i=JSON.parse(t),s=de(de({},i),this._m[t].toJSON());e.push(s)}this._m={},this._timer=null;var n=JSON.stringify({environment:this._opt.environment,routes:e}),o={method:"POST",url:this._url,body:n};this._requester(o).then(function(c){}).catch(function(c){console.error&&console.error("can not report routes stats",c)})},r}();var wi=function(){function r(e){this._m={},this._opt=e,this._url=e.host+"/api/v5/projects/"+e.projectId+"/routes-breakdowns?key="+e.projectKey,this._requester=H(e)}return r.prototype.notify=function(e){var t=this;if(Q&&!(e.statusCode<200||e.statusCode>=300&&e.statusCode<400||e.statusCode===404||Object.keys(e._groups).length===0)){var i=e._duration();i===0&&(i=1e-5);var s=60*1e3,n=new Date(Math.floor(e.startTime.getTime()/s)*s),o={method:e.method,route:e.route,responseType:this._responseType(e),time:n},c=JSON.stringify(o),a=this._m[c];a||(a=new $e,this._m[c]=a),a.addGroups(i,e._groups),!this._timer&&(this._timer=setTimeout(function(){t._flush()},vi))}},r.prototype._flush=function(){var e=[];for(var t in this._m)if(this._m.hasOwnProperty(t)){var i=JSON.parse(t),s=de(de({},i),this._m[t].toJSON());e.push(s)}this._m={},this._timer=null;var n=JSON.stringify({environment:this._opt.environment,routes:e}),o={method:"POST",url:this._url,body:n};this._requester(o).then(function(c){}).catch(function(c){console.error&&console.error("can not report routes breakdowns",c)})},r.prototype._responseType=function(e){return e.statusCode>=500?"5xx":e.statusCode>=400?"4xx":e.contentType?e.contentType.split(";")[0].split("/")[-1]:""},r}();var Ei="airbrake-js/browser",_i="1.4.2",Si="https://github.com/airbrake/airbrake-js/tree/master/packages/browser";var Ke=function(){return Ke=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},Ke.apply(this,arguments)},Tt=function(){function r(e){var t=this;if(this._filters=[],this._performanceFilters=[],this._scope=new Et,this._onClose=[],!e.projectId||!e.projectKey)throw new Error("airbrake: projectId and projectKey are required");this._opt=e,this._opt.host=this._opt.host||"https://api.airbrake.io",this._opt.timeout=this._opt.timeout||1e4,this._opt.keysBlocklist=this._opt.keysBlocklist||this._opt.keysBlacklist||[/password/,/secret/],this._url=this._opt.host+"/api/v3/projects/"+this._opt.projectId+"/notices?key="+this._opt.projectKey,this._processor=this._opt.processor||Vr,this._requester=H(this._opt),this.addFilter(Wr),this.addFilter(Ur()),this.addFilter(Kr),this.addFilter($r),this.addFilter(function(i){return i.context.notifier={name:Ei,version:_i,url:Si},t._opt.environment&&(i.context.environment=t._opt.environment),i}),this.routes=new Hs(this),this.queues=new Vs(this),this.queries=new pi(this._opt)}return r.prototype.close=function(){for(var e=0,t=this._onClose;e<t.length;e++){var i=t[e];i()}},r.prototype.scope=function(){return this._scope},r.prototype.setActiveScope=function(e){this._scope=e},r.prototype.addFilter=function(e){this._filters.push(e)},r.prototype.addPerformanceFilter=function(e){this._performanceFilters.push(e)},r.prototype.notify=function(e){var t={errors:[],context:Ke(Ke({severity:"error"},this.scope().context()),e.context),params:e.params||{},environment:e.environment||{},session:e.session||{}};if((typeof e!="object"||e.error===void 0)&&(e={error:e}),!e.error)return t.error=new Error("airbrake: got err="+JSON.stringify(e.error)+", wanted an Error"),j.resolve(t);var i=this._processor(e.error);t.errors.push(i);for(var s=0,n=this._filters;s<n.length;s++){var o=n[s],c=o(t);if(c===null)return t.error=new Error("airbrake: error is filtered"),j.resolve(t);t=c}return t.context||(t.context={}),t.context.language="JavaScript",this._sendNotice(t)},r.prototype._sendNotice=function(e){var t=xr(e,{keysBlocklist:this._opt.keysBlocklist});if(this._opt.reporter){if(typeof this._opt.reporter=="function")return this._opt.reporter(e);console.warn("airbrake: options.reporter must be a function")}var i={method:"POST",url:this._url,body:t};return this._requester(i).then(function(s){return e.id=s.json.id,e.url=s.json.url,e}).catch(function(s){return e.error=s,e})},r.prototype.wrap=function(e,t){if(t===void 0&&(t=[]),e._airbrake)return e;var i=this,s=function(){var a=Array.prototype.slice.call(arguments),h=i._wrapArguments(a);try{return e.apply(this,h)}catch(d){throw i.notify({error:d,params:{arguments:a}}),this._ignoreNextWindowError(),d}};for(var n in e)e.hasOwnProperty(n)&&(s[n]=e[n]);for(var o=0,c=t;o<c.length;o++){var n=c[o];e.hasOwnProperty(n)&&(s[n]=e[n])}return s._airbrake=!0,s.inner=e,s},r.prototype._wrapArguments=function(e){for(var t=0;t<e.length;t++){var i=e[t];typeof i=="function"&&(e[t]=this.wrap(i))}return e},r.prototype._ignoreNextWindowError=function(){},r.prototype.call=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];var s=this.wrap(e);return s.apply(this,Array.prototype.slice.call(arguments,1))},r}();var Hs=function(){function r(e){this._notifier=e,this._routes=new bi(e._opt),this._breakdowns=new wi(e._opt)}return r.prototype.start=function(e,t,i,s){e===void 0&&(e=""),t===void 0&&(t=""),i===void 0&&(i=0),s===void 0&&(s="");var n=new yi(e,t,i,s),o=this._notifier.scope().clone();return o.setContext({httpMethod:e,route:t}),o.setRouteMetric(n),this._notifier.setActiveScope(o),n},r.prototype.notify=function(e){e.end();for(var t=0,i=this._notifier._performanceFilters;t<i.length;t++){var s=i[t];if(s(e)===null)return}this._routes.notify(e),this._breakdowns.notify(e)},r}(),Vs=function(){function r(e){this._notifier=e,this._queues=new gi(e._opt)}return r.prototype.start=function(e){var t=new mi(e),i=this._notifier.scope().clone();return i.setContext({queue:e}),i.setQueueMetric(t),this._notifier.setActiveScope(i),t},r.prototype.notify=function(e){e.end(),this._queues.notify(e)},r}();function Ai(r){return window.navigator&&window.navigator.userAgent&&(r.context.userAgent=window.navigator.userAgent),window.location&&(r.context.url=String(window.location),r.context.rootDirectory=window.location.protocol+"//"+window.location.host),r}var $s=["debug","log","info","warn","error"];function Ti(r){for(var e=function(n){if(!(n in console))return"continue";var o=console[n],c=function(){for(var a=[],h=0;h<arguments.length;h++)a[h]=arguments[h];o.apply(console,a),r.scope().pushHistory({type:"log",severity:n,arguments:a})};c.inner=o,console[n]=c},t=0,i=$s;t<i.length;t++){var s=i[t];e(s)}}var Us=["type","name","src"];function Oi(r){var e=Ws(r);window.addEventListener&&(window.addEventListener("load",e),window.addEventListener("error",function(t){Li(t,"error")||e(t)},!0)),typeof document=="object"&&document.addEventListener&&(document.addEventListener("DOMContentLoaded",e),document.addEventListener("click",e),document.addEventListener("keypress",e))}function Ws(r){return function(e){var t=Li(e,"target");if(t){var i={type:e.type};try{i.target=Js(t)}catch(s){i.target="<"+String(s)+">"}r.scope().pushHistory(i)}}}function Ks(r){if(!r)return"";var e=[];if(r.tagName&&e.push(r.tagName.toLowerCase()),r.id&&(e.push("#"),e.push(r.id)),r.classList&&Array.from)e.push("."),e.push(Array.from(r.classList).join("."));else if(r.className){var t=zs(r.className);t!==""&&(e.push("."),e.push(t))}if(r.getAttribute)for(var i=0,s=Us;i<s.length;i++){var n=s[i],o=r.getAttribute(n);o&&e.push("["+n+'="'+o+'"]')}return e.join("")}function zs(r){return r.split?r.split(" ").join("."):r.baseVal&&r.baseVal.split?r.baseVal.split(" ").join("."):(console.error("unsupported HTMLElement.className type",typeof r),"")}function Js(r){for(var e=10,t=[],i=r;i;){var s=Ks(i);if(s!==""&&(t.push(s),t.length>e))break;i=i.parentNode}return t.length===0?String(r):t.reverse().join(" > ")}function Li(r,e){try{return r[e]}catch{return null}}function Ci(r){var e=window.fetch;window.fetch=function(t,i){var s={type:"xhr",date:new Date};return s.method=i&&i.method?i.method:"GET",typeof t=="string"?s.url=t:(s.method=t.method,s.url=t.url),r._ignoreNextXHR++,setTimeout(function(){return r._ignoreNextXHR--}),e.apply(this,arguments).then(function(n){return s.statusCode=n.status,s.duration=new Date().getTime()-s.date.getTime(),r.scope().pushHistory(s),n}).catch(function(n){throw s.error=n,s.duration=new Date().getTime()-s.date.getTime(),r.scope().pushHistory(s),n})}}var Ot="";function ki(){return document.location&&document.location.pathname}function Fi(r){Ot=ki();var e=window.onpopstate;window.onpopstate=function(s){var n=ki();if(n&&Ri(r,n),e)return e.apply(this,arguments)};var t=history.pushState;history.pushState=function(s,n,o){o&&Ri(r,o.toString()),t.apply(this,arguments)}}function Ri(r,e){var t=e.indexOf("://");t>=0?(e=e.slice(t+3),t=e.indexOf("/"),e=t>=0?e.slice(t):"/"):e.charAt(0)!=="/"&&(e="/"+e),r.scope().pushHistory({type:"location",from:Ot,to:e}),Ot=e}function Mi(r){function e(s){var n=s.__state;n.statusCode=s.status,n.duration=new Date().getTime()-n.date.getTime(),r.scope().pushHistory(n)}var t=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(n,o,c,a,h){r._ignoreNextXHR===0&&(this.__state={type:"xhr",method:n,url:o}),t.apply(this,arguments)};var i=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(n){var o=this.onreadystatechange;return this.onreadystatechange=function(c){if(this.readyState===4&&this.__state&&e(this),o)return o.apply(this,arguments)},this.__state&&(this.__state.date=new Date),i.apply(this,arguments)}}var Xs=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,s){i.__proto__=s}||function(i,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i[n]=s[n])},r(e,t)};return function(e,t){r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}(),ze=function(){return ze=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},ze.apply(this,arguments)},Lt=function(r){Xs(e,r);function e(t){var i=r.call(this,t)||this;return i.offline=!1,i.todo=[],i._ignoreWindowError=0,i._ignoreNextXHR=0,typeof window>"u"||(i.addFilter(Ai),window.addEventListener&&(i.onOnline=i.onOnline.bind(i),window.addEventListener("online",i.onOnline),i.onOffline=i.onOffline.bind(i),window.addEventListener("offline",i.onOffline),i.onUnhandledrejection=i.onUnhandledrejection.bind(i),window.addEventListener("unhandledrejection",i.onUnhandledrejection),i._onClose.push(function(){window.removeEventListener("online",i.onOnline),window.removeEventListener("offline",i.onOffline),window.removeEventListener("unhandledrejection",i.onUnhandledrejection)})),i._opt.ignoreWindowError&&(t.instrumentation.onerror=!1),i._instrument(t.instrumentation)),i}return e.prototype._instrument=function(t){if(t===void 0&&(t={}),t.console===void 0&&(t.console=!Gs(this._opt.environment)),_e(t.onerror)){var i=this,s=window.onerror;window.onerror=function(){s&&s.apply(this,arguments),i.onerror.apply(i,arguments)}}Oi(this),_e(t.fetch)&&typeof fetch=="function"&&Ci(this),_e(t.history)&&typeof history=="object"&&Fi(this),_e(t.console)&&typeof console=="object"&&Ti(this),_e(t.xhr)&&typeof XMLHttpRequest<"u"&&Mi(this)},e.prototype.notify=function(t){var i=this;return this.offline?new j(function(s,n){for(i.todo.push({err:t,resolve:s,reject:n});i.todo.length>100;){var o=i.todo.shift();if(o===void 0)break;o.resolve({error:new Error("airbrake: offline queue is too large")})}}):r.prototype.notify.call(this,t)},e.prototype.onOnline=function(){this.offline=!1;for(var t=function(c){i.notify(c.err).then(function(a){c.resolve(a)})},i=this,s=0,n=this.todo;s<n.length;s++){var o=n[s];t(o)}this.todo=[]},e.prototype.onOffline=function(){this.offline=!0},e.prototype.onUnhandledrejection=function(t){var i=t.reason||t.detail&&t.detail.reason;if(i){var s=i.message||String(i);if(!(s.indexOf&&s.indexOf("airbrake: ")===0)){if(typeof i!="object"||i.error===void 0){this.notify({error:i,context:{unhandledRejection:!0}});return}this.notify(ze(ze({},i),{context:{unhandledRejection:!0}}))}}},e.prototype.onerror=function(t,i,s,n,o){if(!(this._ignoreWindowError>0)){if(o){this.notify({error:o,context:{windowError:!0}});return}!i||!s||this.notify({error:{message:t,fileName:i,lineNumber:s,columnNumber:n,noStack:!0},context:{windowError:!0}})}},e.prototype._ignoreNextWindowError=function(){var t=this;this._ignoreWindowError++,setTimeout(function(){return t._ignoreWindowError--})},e}(Tt);function Gs(r){return r&&r.startsWith&&r.startsWith("dev")}function _e(r){return r===void 0||r===!0}(function(){if(window.Reflect===void 0||window.customElements===void 0||window.customElements.polyfillWrapFlushCallback)return;let r=HTMLElement,e={HTMLElement:function(){return Reflect.construct(r,[],this.constructor)}};window.HTMLElement=e.HTMLElement,HTMLElement.prototype=r.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,r)})();(function(r){if(typeof r.requestSubmit=="function")return;r.requestSubmit=function(i){i?(e(i,this),i.click()):(i=document.createElement("input"),i.type="submit",i.hidden=!0,this.appendChild(i),i.click(),this.removeChild(i))};function e(i,s){i instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),i.type=="submit"||t(TypeError,"The specified element is not a submit button"),i.form==s||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(i,s,n){throw new i("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+s+".",n)}})(HTMLFormElement.prototype);var Ii=new WeakMap;function Qs(r){let e=r instanceof Element?r:r instanceof Node?r.parentElement:null,t=e?e.closest("input, button"):null;return t?.type=="submit"?t:null}function Ys(r){let e=Qs(r.target);e&&e.form&&Ii.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let r=window.Event.prototype;if("SubmitEvent"in window&&/Apple Computer/.test(navigator.vendor))r=window.SubmitEvent.prototype;else if("SubmitEvent"in window)return;addEventListener("click",Ys,!0),Object.defineProperty(r,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return Ii.get(this.target)}})})();var ee;(function(r){r.eager="eager",r.lazy="lazy"})(ee||(ee={}));var I=class extends HTMLElement{static get observedAttributes(){return["disabled","complete","loading","src"]}constructor(){super(),this.loaded=Promise.resolve(),this.delegate=new I.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="complete"?this.delegate.completeChanged():e=="src"?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get loading(){return Zs(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var e,t;return(t=(e=this.ownerDocument)===null||e===void 0?void 0:e.documentElement)===null||t===void 0?void 0:t.hasAttribute("data-turbo-preview")}};function Zs(r){switch(r.toLowerCase()){case"lazy":return ee.lazy;default:return ee.eager}}function L(r){return new URL(r.toString(),document.baseURI)}function ne(r){let e;if(r.hash)return r.hash.slice(1);if(e=r.href.match(/#(.*)$/))return e[1]}function Yt(r,e){let t=e?.getAttribute("formaction")||r.getAttribute("action")||r.action;return L(t)}function en(r){return(on(r).match(/\.[^.]*$/)||[])[0]||""}function tn(r){return!!en(r).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function rn(r,e){let t=an(e);return r.href===L(t).href||r.href.startsWith(t)}function pe(r,e){return rn(r,e)&&tn(r)}function Ct(r){let e=ne(r);return e!=null?r.href.slice(0,-(e.length+1)):r.href}function Je(r){return Ct(r)}function sn(r,e){return L(r).href==L(e).href}function nn(r){return r.pathname.split("/").slice(1)}function on(r){return nn(r).slice(-1)[0]}function an(r){return cn(r.origin+r.pathname)}function cn(r){return r.endsWith("/")?r:r+"/"}var Se=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return L(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}};function Ae(r){if(r.getAttribute("data-turbo-eval")=="false")return r;{let e=document.createElement("script"),t=Qe("csp-nonce");return t&&(e.nonce=t),e.textContent=r.textContent,e.async=!1,ln(e,r),e}}function ln(r,e){for(let{name:t,value:i}of e.attributes)r.setAttribute(t,i)}function hn(r){let e=document.createElement("template");return e.innerHTML=r,e.content}function O(r,{target:e,cancelable:t,detail:i}={}){let s=new CustomEvent(r,{cancelable:t,bubbles:!0,composed:!0,detail:i});return e&&e.isConnected?e.dispatchEvent(s):document.documentElement.dispatchEvent(s),s}function Xe(){return new Promise(r=>requestAnimationFrame(()=>r()))}function un(){return new Promise(r=>setTimeout(()=>r(),0))}function dn(){return Promise.resolve()}function Di(r=""){return new DOMParser().parseFromString(r,"text/html")}function ji(r,...e){let t=fn(r,e).replace(/^\n/,"").split(`
|
12
|
+
`),i=t[0].match(/^\s+/),s=i?i[0].length:0;return t.map(n=>n.slice(s)).join(`
|
13
|
+
`)}function fn(r,e){return r.reduce((t,i,s)=>{let n=e[s]==null?"":e[s];return t+i+n},"")}function me(){return Array.from({length:36}).map((r,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}function Ge(r,...e){for(let t of e.map(i=>i?.getAttribute(r)))if(typeof t=="string")return t;return null}function pn(r,...e){return e.some(t=>t&&t.hasAttribute(r))}function kt(...r){for(let e of r)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function Rt(...r){for(let e of r)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function mn(r,e=2e3){return new Promise(t=>{let i=()=>{r.removeEventListener("error",i),r.removeEventListener("load",i),t()};r.addEventListener("load",i,{once:!0}),r.addEventListener("error",i,{once:!0}),setTimeout(t,e)})}function qi(r){switch(r){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function gn(r){return r=="advance"||r=="replace"||r=="restore"}function nt(...r){let e=Ge("data-turbo-action",...r);return gn(e)?e:null}function Hi(r){return document.querySelector(`meta[name="${r}"]`)}function Qe(r){let e=Hi(r);return e&&e.content}function vn(r,e){let t=Hi(r);return t||(t=document.createElement("meta"),t.setAttribute("name",r),document.head.appendChild(t)),t.setAttribute("content",e),t}function Ye(r,e){var t;if(r instanceof Element)return r.closest(e)||Ye(r.assignedSlot||((t=r.getRootNode())===null||t===void 0?void 0:t.host),e)}var C;(function(r){r[r.get=0]="get",r[r.post=1]="post",r[r.put=2]="put",r[r.patch=3]="patch",r[r.delete=4]="delete"})(C||(C={}));function yn(r){switch(r.toLowerCase()){case"get":return C.get;case"post":return C.post;case"put":return C.put;case"patch":return C.patch;case"delete":return C.delete}}var Te=class{constructor(e,t,i,s=new URLSearchParams,n=null){this.abortController=new AbortController,this.resolveRequestPromise=o=>{},this.delegate=e,this.method=t,this.headers=this.defaultHeaders,this.body=s,this.url=i,this.target=n}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this),await this.allowRequestToBeIntercepted(e);try{this.delegate.requestStarted(this);let t=await fetch(this.url.href,e);return await this.receive(t)}catch(t){if(t.name!=="AbortError")throw this.willDelegateErrorHandling(t)&&this.delegate.requestErrored(this,t),t}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new Se(e);return O("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get fetchOptions(){var e;return{method:C[this.method].toUpperCase(),credentials:"same-origin",headers:this.headers,redirect:"follow",body:this.isSafe?null:this.body,signal:this.abortSignal,referrer:(e=this.delegate.referrer)===null||e===void 0?void 0:e.href}}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return this.method===C.get}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async allowRequestToBeIntercepted(e){let t=new Promise(s=>this.resolveRequestPromise=s);O("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.resolveRequestPromise},target:this.target}).defaultPrevented&&await t}willDelegateErrorHandling(e){return!O("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}},Ft=class{constructor(e,t){this.started=!1,this.intersect=i=>{let s=i.slice(-1)[0];s?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)},this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}},$=class{static wrap(e){return typeof e=="string"?new this(hn(e)):e}constructor(e){this.fragment=bn(e)}};$.contentType="text/vnd.turbo-stream.html";function bn(r){for(let e of r.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let i of t.templateElement.content.querySelectorAll("script"))i.replaceWith(Ae(i));e.replaceWith(t)}return r}var Y;(function(r){r[r.initialized=0]="initialized",r[r.requesting=1]="requesting",r[r.waiting=2]="waiting",r[r.receiving=3]="receiving",r[r.stopping=4]="stopping",r[r.stopped=5]="stopped"})(Y||(Y={}));var Z;(function(r){r.urlEncoded="application/x-www-form-urlencoded",r.multipart="multipart/form-data",r.plain="text/plain"})(Z||(Z={}));function wn(r){switch(r.toLowerCase()){case Z.multipart:return Z.multipart;case Z.plain:return Z.plain;default:return Z.urlEncoded}}var oe=class{static confirmMethod(e,t,i){return Promise.resolve(confirm(e))}constructor(e,t,i,s=!1){this.state=Y.initialized,this.delegate=e,this.formElement=t,this.submitter=i,this.formData=En(t,i),this.location=L(this.action),this.method==C.get&&An(this.location,[...this.body.entries()]),this.fetchRequest=new Te(this,this.method,this.location,this.body,this.formElement),this.mustRedirect=s}get method(){var e;let t=((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formmethod"))||this.formElement.getAttribute("method")||"";return yn(t.toLowerCase())||C.get}get action(){var e;let t=typeof this.formElement.action=="string"?this.formElement.action:null;return!((e=this.submitter)===null||e===void 0)&&e.hasAttribute("formaction")?this.submitter.getAttribute("formaction")||"":this.formElement.getAttribute("action")||t||""}get body(){return this.enctype==Z.urlEncoded||this.method==C.get?new URLSearchParams(this.stringFormData):this.formData}get enctype(){var e;return wn(((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formenctype"))||this.formElement.enctype)}get isSafe(){return this.fetchRequest.isSafe}get stringFormData(){return[...this.formData].reduce((e,[t,i])=>e.concat(typeof i=="string"?[[t,i]]:[]),[])}async start(){let{initialized:e,requesting:t}=Y,i=Ge("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof i=="string"&&!await oe.confirmMethod(i,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=Y;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=_n(Qe("csrf-param"))||Qe("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType($.contentType)}requestStarted(e){var t;this.state=Y.waiting,(t=this.submitter)===null||t===void 0||t.setAttribute("disabled",""),this.setSubmitsWith(),O("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError)this.delegate.formSubmissionFailedWithResponse(this,t);else if(this.requestMustRedirect(e)&&Sn(t)){let i=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,i)}else this.state=Y.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){var t;this.state=Y.stopped,(t=this.submitter)===null||t===void 0||t.removeAttribute("disabled"),this.resetSubmitterText(),O("turbo:submit-end",{target:this.formElement,detail:Object.assign({formSubmission:this},this.result)}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||pn("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){var e;return(e=this.submitter)===null||e===void 0?void 0:e.getAttribute("data-turbo-submits-with")}};function En(r,e){let t=new FormData(r),i=e?.getAttribute("name"),s=e?.getAttribute("value");return i&&t.append(i,s||""),t}function _n(r){if(r!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(i=>i.startsWith(r));if(t){let i=t.split("=").slice(1).join("=");return i?decodeURIComponent(i):void 0}}}function Sn(r){return r.statusCode==200&&!r.redirected}function An(r,e){let t=new URLSearchParams;for(let[i,s]of e)s instanceof File||t.append(i,s);return r.search=t.toString(),r}var ge=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){let e="[inert], :disabled, [hidden], details:not([open]), dialog:not([open])";for(let t of this.element.querySelectorAll("[autofocus]"))if(t.closest(e)==null)return t;return null}get permanentElements(){return $i(this.element)}getPermanentElementById(e){return Vi(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let i of this.permanentElements){let{id:s}=i,n=e.getPermanentElementById(s);n&&(t[s]=[i,n])}return t}};function Vi(r,e){return r.querySelector(`#${e}[data-turbo-permanent]`)}function $i(r){return r.querySelectorAll("[id][data-turbo-permanent]")}var Oe=class{constructor(e,t){this.started=!1,this.submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)},this.submitBubbled=i=>{if(!i.defaultPrevented){let s=i.target instanceof HTMLFormElement?i.target:void 0,n=i.submitter||void 0;s&&Tn(s,n)&&On(s,n)&&this.delegate.willSubmitForm(s,n)&&(i.preventDefault(),i.stopImmediatePropagation(),this.delegate.formSubmitted(s,n))}},this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}};function Tn(r,e){return(e?.getAttribute("formmethod")||r.getAttribute("method"))!="dialog"}function On(r,e){if(e?.hasAttribute("formtarget")||r.hasAttribute("target")){let t=e?.getAttribute("formtarget")||r.target;for(let i of document.getElementsByName(t))if(i instanceof HTMLIFrameElement)return!1;return!0}else return!0}var Ze=class{constructor(e,t){this.resolveRenderPromise=i=>{},this.resolveInterceptionPromise=i=>{},this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(ne(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:i,newSnapshot:s}=e;if(i)try{this.renderPromise=new Promise(a=>this.resolveRenderPromise=a),this.renderer=e,await this.prepareToRenderSnapshot(e);let n=new Promise(a=>this.resolveInterceptionPromise=a),o={resume:this.resolveInterceptionPromise,render:this.renderer.renderElement};this.delegate.allowsImmediateRender(s,o)||await n,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(s,t),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.resolveRenderPromise(void 0),delete this.renderPromise}else this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},Mt=class extends Ze{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new ge(this.element)}},et=class{constructor(e,t){this.clickBubbled=i=>{this.respondsToEventTarget(i.target)?this.clickEvent=i:delete this.clickEvent},this.linkClicked=i=>{this.clickEvent&&this.respondsToEventTarget(i.target)&&i.target instanceof Element&&this.delegate.shouldInterceptLinkClick(i.target,i.detail.url,i.detail.originalEvent)&&(this.clickEvent.preventDefault(),i.preventDefault(),this.delegate.linkClickIntercepted(i.target,i.detail.url,i.detail.originalEvent)),delete this.clickEvent},this.willVisit=i=>{delete this.clickEvent},this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}respondsToEventTarget(e){let t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}},tt=class{constructor(e,t){this.started=!1,this.clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)},this.clickBubbled=i=>{if(i instanceof MouseEvent&&this.clickEventIsSignificant(i)){let s=i.composedPath&&i.composedPath()[0]||i.target,n=this.findLinkFromClickTarget(s);if(n&&Ln(n)){let o=this.getLocationForLink(n);this.delegate.willFollowLinkToLocation(n,o,i)&&(i.preventDefault(),this.delegate.followedLinkToLocation(n,o))}}},this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}findLinkFromClickTarget(e){return Ye(e,"a[href]:not([target^=_]):not([download])")}getLocationForLink(e){return L(e.getAttribute("href")||"")}};function Ln(r){if(r.hasAttribute("target")){for(let e of document.getElementsByName(r.target))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}var rt=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new tt(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}willFollowLinkToLocation(e,t,i){return this.delegate.willSubmitFormLinkToLocation(e,t,i)&&e.hasAttribute("data-turbo-method")}followedLinkToLocation(e,t){let i=document.createElement("form"),s="hidden";for(let[f,m]of t.searchParams)i.append(Object.assign(document.createElement("input"),{type:s,name:f,value:m}));let n=Object.assign(t,{search:""});i.setAttribute("data-turbo","true"),i.setAttribute("action",n.href),i.setAttribute("hidden","");let o=e.getAttribute("data-turbo-method");o&&i.setAttribute("method",o);let c=e.getAttribute("data-turbo-frame");c&&i.setAttribute("data-turbo-frame",c);let a=nt(e);a&&i.setAttribute("data-turbo-action",a);let h=e.getAttribute("data-turbo-confirm");h&&i.setAttribute("data-turbo-confirm",h),e.hasAttribute("data-turbo-stream")&&i.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,i),document.body.appendChild(i),i.addEventListener("turbo:submit-end",()=>i.remove(),{once:!0}),requestAnimationFrame(()=>i.requestSubmit())}},it=class{static async preservingPermanentElements(e,t,i){let s=new this(e,t);s.enter(),await i(),s.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,i]=this.permanentElementMap[e];this.delegate.enteringBardo(t,i),this.replaceNewPermanentElementWithPlaceholder(i)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=Cn(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){let t=this.getPlaceholderById(e.id);t?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function Cn(r){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",r.id),e}var Le=class{constructor(e,t,i,s,n=!0){this.activeElement=null,this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=s,this.willRender=n,this.renderElement=i,this.promise=new Promise((o,c)=>this.resolvingFunctions={resolve:o,reject:c})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await it.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){let e=this.connectedSnapshot.firstAutofocusableElement;kn(e)&&e.focus()}enteringBardo(e){this.activeElement||e.contains(this.currentSnapshot.activeElement)&&(this.activeElement=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.activeElement)&&this.activeElement instanceof HTMLElement&&(this.activeElement.focus(),this.activeElement=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}};function kn(r){return r&&typeof r.focus=="function"}var Ce=class extends Le{static renderElement(e,t){var i;let s=document.createRange();s.selectNodeContents(e),s.deleteContents();let n=t,o=(i=n.ownerDocument)===null||i===void 0?void 0:i.createRange();o&&(o.selectNodeContents(n),e.appendChild(o.extractContents()))}constructor(e,t,i,s,n,o=!0){super(t,i,s,n,o),this.delegate=e}get shouldRender(){return!0}async render(){await Xe(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await Xe(),this.focusFirstAutofocusableElement(),await Xe(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=Rn(this.currentElement.getAttribute("data-autoscroll-block"),"end"),i=Fn(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:i}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=Ae(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function Rn(r,e){return r=="end"||r=="start"||r=="center"||r=="nearest"?r:e}function Fn(r,e){return r=="auto"||r=="smooth"?r:e}var B=class{static get defaultCSS(){return ji`
|
14
|
+
.turbo-progress-bar {
|
15
|
+
position: fixed;
|
16
|
+
display: block;
|
17
|
+
top: 0;
|
18
|
+
left: 0;
|
19
|
+
height: 3px;
|
20
|
+
background: #0076ff;
|
21
|
+
z-index: 2147483647;
|
22
|
+
transition:
|
23
|
+
width ${B.animationDuration}ms ease-out,
|
24
|
+
opacity ${B.animationDuration/2}ms ${B.animationDuration/2}ms ease-in;
|
25
|
+
transform: translate3d(0, 0, 0);
|
26
|
+
}
|
27
|
+
`}constructor(){this.hiding=!1,this.value=0,this.visible=!1,this.trickle=()=>{this.setValue(this.value+Math.random()/100)},this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,B.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,B.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");return e.type="text/css",e.textContent=B.defaultCSS,this.cspNonce&&(e.nonce=this.cspNonce),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}get cspNonce(){return Qe("csp-nonce")}};B.animationDuration=300;var xt=class extends ge{constructor(){super(...arguments),this.detailsByOuterHTML=this.children.filter(e=>!Pn(e)).map(e=>Dn(e)).reduce((e,t)=>{let{outerHTML:i}=t,s=i in e?e[i]:{type:Mn(t),tracked:xn(t),elements:[]};return Object.assign(Object.assign({},e),{[i]:Object.assign(Object.assign({},s),{elements:[...s.elements,t]})})},{})}get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(i=>!(i in t.detailsByOuterHTML)).map(i=>this.detailsByOuterHTML[i]).filter(({type:i})=>i==e).map(({elements:[i]})=>i)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:i,tracked:s,elements:n}=this.detailsByOuterHTML[t];return i==null&&!s?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,i)=>{let{elements:[s]}=this.detailsByOuterHTML[i];return In(s,e)?s:t},void 0)}};function Mn(r){if(Nn(r))return"script";if(Bn(r))return"stylesheet"}function xn(r){return r.getAttribute("data-turbo-track")=="reload"}function Nn(r){return r.localName=="script"}function Pn(r){return r.localName=="noscript"}function Bn(r){let e=r.localName;return e=="style"||e=="link"&&r.getAttribute("rel")=="stylesheet"}function In(r,e){return r.localName=="meta"&&r.getAttribute("name")==e}function Dn(r){return r.hasAttribute("nonce")&&r.setAttribute("nonce",""),r}var R=class extends ge{static fromHTMLString(e=""){return this.fromDocument(Di(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({head:e,body:t}){return new this(t,new xt(e))}constructor(e,t){super(e),this.headSnapshot=t}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),i=e.querySelectorAll("select");for(let[s,n]of t.entries()){let o=i[s];for(let c of o.selectedOptions)c.selected=!1;for(let c of n.selectedOptions)o.options[c.index].selected=!0}for(let s of e.querySelectorAll('input[type="password"]'))s.value="";return new R(e,this.headSnapshot)}get headElement(){return this.headSnapshot.element}get rootLocation(){var e;let t=(e=this.getSetting("root"))!==null&&e!==void 0?e:"/";return L(t)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},fe;(function(r){r.visitStart="visitStart",r.requestStart="requestStart",r.requestEnd="requestEnd",r.visitEnd="visitEnd"})(fe||(fe={}));var P;(function(r){r.initialized="initialized",r.started="started",r.canceled="canceled",r.failed="failed",r.completed="completed"})(P||(P={}));var jn={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},te;(function(r){r[r.networkFailure=0]="networkFailure",r[r.timeoutFailure=-1]="timeoutFailure",r[r.contentTypeMismatch=-2]="contentTypeMismatch"})(te||(te={}));var Nt=class{constructor(e,t,i,s={}){this.identifier=me(),this.timingMetrics={},this.followedRedirect=!1,this.historyChanged=!1,this.scrolled=!1,this.shouldCacheSnapshot=!0,this.acceptsStreamResponse=!1,this.snapshotCached=!1,this.state=P.initialized,this.delegate=e,this.location=t,this.restorationIdentifier=i||me();let{action:n,historyChanged:o,referrer:c,snapshot:a,snapshotHTML:h,response:d,visitCachedSnapshot:f,willRender:m,updateHistory:p,shouldCacheSnapshot:y,acceptsStreamResponse:A}=Object.assign(Object.assign({},jn),s);this.action=n,this.historyChanged=o,this.referrer=c,this.snapshot=a,this.snapshotHTML=h,this.response=d,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.visitCachedSnapshot=f,this.willRender=m,this.updateHistory=p,this.scrolled=!m,this.shouldCacheSnapshot=y,this.acceptsStreamResponse=A}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}get silent(){return this.isSamePage}start(){this.state==P.initialized&&(this.recordTimingMetric(fe.visitStart),this.state=P.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==P.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=P.canceled)}complete(){this.state==P.started&&(this.recordTimingMetric(fe.visitEnd),this.state=P.completed,this.followRedirect(),this.followedRedirect||(this.adapter.visitCompleted(this),this.delegate.visitCompleted(this)))}fail(){this.state==P.started&&(this.state=P.failed,this.adapter.visitFailed(this))}changeHistory(){var e;if(!this.historyChanged&&this.updateHistory){let t=this.location.href===((e=this.referrer)===null||e===void 0?void 0:e.href)?"replace":this.action,i=qi(t);this.history.update(i,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new Te(this,C.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(fe.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;xi(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(fe.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,xi(e)&&t!=null?(await this.view.renderPage(R.fromHTMLString(t),!1,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),this.complete()):(await this.view.renderError(R.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail())})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!ne(this.location)||e.hasAnchor(ne(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return R.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.view.renderPage(e,t,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){var e;this.redirectedToLocation&&!this.followedRedirect&&(!((e=this.response)===null||e===void 0)&&e.redirected)&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)})}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType($.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let i=await t.responseHTML,{redirected:s,statusCode:n}=t;i==null?this.recordResponse({statusCode:te.contentTypeMismatch,redirected:s}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:i,redirected:s}))}async requestFailedWithResponse(e,t){let i=await t.responseHTML,{redirected:s,statusCode:n}=t;i==null?this.recordResponse({statusCode:te.contentTypeMismatch,redirected:s}):this.recordResponse({statusCode:n,responseHTML:i,redirected:s})}requestErrored(e,t){this.recordResponse({statusCode:te.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=ne(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return Object.assign({},this.timingMetrics)}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=requestAnimationFrame(()=>t())}),await e(),delete this.frame}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function xi(r){return r>=200&&r<300}var Pt=class{constructor(e){this.progressBar=new B,this.showProgressBar=()=>{this.progressBar.show()},this.session=e}visitProposedToLocation(e,t){this.navigator.startVisit(e,t?.restorationIdentifier||me(),t)}visitStarted(e){this.location=e.location,e.loadCachedSnapshot(),e.issueRequest(),e.goToSamePageAnchor()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse()}visitRequestFailedWithStatusCode(e,t){switch(t){case te.networkFailure:case te.timeoutFailure:case te.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitCompleted(e){}pageInvalidated(e){this.reload(e)}visitFailed(e){}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}reload(e){var t;O("turbo:reload",{detail:e}),window.location.href=((t=this.location)===null||t===void 0?void 0:t.toString())||window.location.href}get navigator(){return this.session.navigator}},Bt=class{constructor(){this.selector="[data-turbo-temporary]",this.deprecatedSelector="[data-turbo-cache=false]",this.started=!1,this.removeTemporaryElements=e=>{for(let t of this.temporaryElements)t.remove()}}start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){let e=document.querySelectorAll(this.deprecatedSelector);return e.length&&console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`),[...e]}},It=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new et(this,t),this.formSubmitObserver=new Oe(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,i){return this.shouldRedirect(e)}linkClickIntercepted(e,t,i){let s=this.findFrameElement(e);s&&s.delegate.linkClickIntercepted(e,t,i)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.shouldSubmit(e,t)&&this.shouldRedirect(e,t)}formSubmitted(e,t){let i=this.findFrameElement(e,t);i&&i.delegate.formSubmitted(e,t)}shouldSubmit(e,t){var i;let s=Yt(e,t),n=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),o=L((i=n?.content)!==null&&i!==void 0?i:"/");return this.shouldRedirect(e,t)&&pe(s,o)}shouldRedirect(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let s=this.findFrameElement(e,t);return s?s!=e.closest("turbo-frame"):!1}else return!1}findFrameElement(e,t){let i=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(i&&i!="_top"){let s=this.element.querySelector(`#${i}:not([disabled])`);if(s instanceof I)return s}}},Dt=class{constructor(e){this.restorationIdentifier=me(),this.restorationData={},this.started=!1,this.pageLoaded=!1,this.onPopState=t=>{if(this.shouldHandlePopState()){let{turbo:i}=t.state||{};if(i){this.location=new URL(window.location.href);let{restorationIdentifier:s}=i;this.restorationIdentifier=s,this.delegate.historyPoppedToLocationWithRestorationIdentifier(this.location,s)}}},this.onPageLoad=async t=>{await dn(),this.pageLoaded=!0},this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,i=me()){let s={turbo:{restorationIdentifier:i}};e.call(history,s,"",t.href),this.location=t,this.restorationIdentifier=i}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,i=this.restorationData[t];this.restorationData[t]=Object.assign(Object.assign({},i),e)}assumeControlOfScrollRestoration(){var e;this.previousScrollRestoration||(this.previousScrollRestoration=(e=history.scrollRestoration)!==null&&e!==void 0?e:"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},jt=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&(pe(e,this.view.snapshot.rootLocation)?this.delegate.visitProposedToLocation(e,t):window.location.href=e.toString())}startVisit(e,t,i={}){this.stop(),this.currentVisit=new Nt(this,L(e),t,Object.assign({referrer:this.location},i)),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new oe(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let i=await t.responseHTML;if(i){let s=e.isSafe;s||this.view.clearSnapshotCache();let{statusCode:n,redirected:o}=t,a={action:this.getActionForFormSubmission(e),shouldCacheSnapshot:s,response:{statusCode:n,responseHTML:i,redirected:o}};this.proposeVisit(t.location,a)}}}async formSubmissionFailedWithResponse(e,t){let i=await t.responseHTML;if(i){let s=R.fromHTMLString(i);t.serverError?await this.view.renderError(s,this.currentVisit):await this.view.renderPage(s,!1,!0,this.currentVisit),this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e)}locationWithActionIsSamePage(e,t){let i=ne(e),s=ne(this.view.lastRenderedLocation),n=t==="restore"&&typeof i>"u";return t!=="replace"&&Ct(e)===Ct(this.view.lastRenderedLocation)&&(n||i!=null&&i!==s)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}getActionForFormSubmission({submitter:e,formElement:t}){return nt(e,t)||"advance"}},V;(function(r){r[r.initial=0]="initial",r[r.loading=1]="loading",r[r.interactive=2]="interactive",r[r.complete=3]="complete"})(V||(V={}));var qt=class{constructor(e){this.stage=V.initial,this.started=!1,this.interpretReadyState=()=>{let{readyState:t}=this;t=="interactive"?this.pageIsInteractive():t=="complete"&&this.pageIsComplete()},this.pageWillUnload=()=>{this.delegate.pageWillUnload()},this.delegate=e}start(){this.started||(this.stage==V.initial&&(this.stage=V.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}pageIsInteractive(){this.stage==V.loading&&(this.stage=V.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==V.interactive&&(this.stage=V.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}},Ht=class{constructor(e){this.started=!1,this.onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})},this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}updatePosition(e){this.delegate.scrollPositionChanged(e)}},Vt=class{render({fragment:e}){it.preservingPermanentElements(this,qn(e),()=>document.documentElement.appendChild(e))}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function qn(r){let e=$i(document.documentElement),t={};for(let i of e){let{id:s}=i;for(let n of r.querySelectorAll("turbo-stream")){let o=Vi(n.templateElement.content,s);o&&(t[s]=[i,o])}}return t}var $t=class{constructor(e){this.sources=new Set,this.started=!1,this.inspectFetchResponse=t=>{let i=Hn(t);i&&Vn(i)&&(t.preventDefault(),this.receiveMessageResponse(i))},this.receiveMessageEvent=t=>{this.started&&typeof t.data=="string"&&this.receiveMessageHTML(t.data)},this.delegate=e}start(){this.started||(this.started=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream($.wrap(e))}};function Hn(r){var e;let t=(e=r.detail)===null||e===void 0?void 0:e.fetchResponse;if(t instanceof Se)return t}function Vn(r){var e;return((e=r.contentType)!==null&&e!==void 0?e:"").startsWith($.contentType)}var st=class extends Le{static renderElement(e,t){let{documentElement:i,body:s}=document;i.replaceChild(t,s)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let i=Ae(e);t.replaceChild(i,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},ke=class extends Le{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(mn(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(Ae(e))}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[i,s]of t.entries()){if(e.tagName=="TITLE"){if(s.tagName!="TITLE")continue;if(e.innerHTML==s.innerHTML)return t.splice(i,1),!0}if(s.isEqualNode(e))return t.splice(i,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=Ae(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},Ut=class{constructor(e){this.keys=[],this.snapshots={},this.size=e}has(e){return Je(e)in this.snapshots}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){this.snapshots={}}read(e){return this.snapshots[Je(e)]}write(e,t){this.snapshots[Je(e)]=t}touch(e){let t=Je(e),i=this.keys.indexOf(t);i>-1&&this.keys.splice(i,1),this.keys.unshift(t),this.trim()}trim(){for(let e of this.keys.splice(this.size))delete this.snapshots[e]}},Wt=class extends Ze{constructor(){super(...arguments),this.snapshotCache=new Ut(10),this.lastRenderedLocation=new URL(location.href),this.forceReloaded=!1}renderPage(e,t=!1,i=!0,s){let n=new ke(this.snapshot,e,ke.renderElement,t,i);return n.shouldRender?s?.changeHistory():this.forceReloaded=!0,this.render(n)}renderError(e,t){t?.changeHistory();let i=new st(this.snapshot,e,st.renderElement,!1);return this.render(i)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await un();let i=e.clone();return this.snapshotCache.put(t,i),i}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}get snapshot(){return R.fromElement(this.element)}},Kt=class{constructor(e){this.selector="a[data-turbo-preload]",this.delegate=e}get snapshotCache(){return this.delegate.navigator.view.snapshotCache}start(){if(document.readyState==="loading")return document.addEventListener("DOMContentLoaded",()=>{this.preloadOnLoadLinksForView(document.body)});this.preloadOnLoadLinksForView(document.body)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(!this.snapshotCache.has(t))try{let s=await(await fetch(t.toString(),{headers:{"VND.PREFETCH":"true",Accept:"text/html"}})).text(),n=R.fromHTMLString(s);this.snapshotCache.put(t,n)}catch{}}},zt=class{constructor(){this.navigator=new jt(this),this.history=new Dt(this),this.preloader=new Kt(this),this.view=new Wt(this,document.documentElement),this.adapter=new Pt(this),this.pageObserver=new qt(this),this.cacheObserver=new Bt,this.linkClickObserver=new tt(this,window),this.formSubmitObserver=new Oe(this,document),this.scrollObserver=new Ht(this),this.streamObserver=new $t(this),this.formLinkClickObserver=new rt(this,document.documentElement),this.frameRedirector=new It(this,document.documentElement),this.streamMessageRenderer=new Vt,this.drive=!0,this.enabled=!0,this.progressBarDelay=500,this.started=!1,this.formMode="on"}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let i=t.frame?document.getElementById(t.frame):null;i instanceof I?(i.src=e.toString(),i.loaded):this.navigator.proposeVisit(L(e),t)}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render($.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}setFormMode(e){this.formMode=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}historyPoppedToLocationWithRestorationIdentifier(e,t){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&pe(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}willFollowLinkToLocation(e,t,i){return this.elementIsNavigatable(e)&&pe(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,i)}followedLinkToLocation(e,t){let i=this.getActionForLink(e),s=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:i,acceptsStreamResponse:s})}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Ni(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||kt(document.documentElement),Ni(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){Rt(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}locationWithActionIsSamePage(e,t){return this.navigator.locationWithActionIsSamePage(e,t)}visitScrolledToSamePageLocation(e,t){this.notifyApplicationAfterVisitingSamePageLocation(e,t)}willSubmitForm(e,t){let i=Yt(e,t);return this.submissionIsNavigatable(e,t)&&pe(L(i),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){var e;!((e=this.navigator.currentVisit)===null||e===void 0)&&e.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let i=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:s,detail:{render:n}}=i;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender()}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,i){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,i).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,i){return O("turbo:click",{target:e,detail:{url:t.href,originalEvent:i},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return O("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return O("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return O("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return O("turbo:before-render",{detail:Object.assign({newBody:e},t),cancelable:!0})}notifyApplicationAfterRender(){return O("turbo:render")}notifyApplicationAfterPageLoad(e={}){return O("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterVisitingSamePageLocation(e,t){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:e.toString(),newURL:t.toString()}))}notifyApplicationAfterFrameLoad(e){return O("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return O("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(this.formMode=="off")return!1;{let i=t?this.elementIsNavigatable(t):!0;return this.formMode=="optin"?i&&e.closest('[data-turbo="true"]')!=null:i&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=Ye(e,"[data-turbo]"),i=Ye(e,"turbo-frame");return this.drive||i?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return nt(e)||"advance"}get snapshot(){return this.view.snapshot}};function Ni(r){Object.defineProperties(r,$n)}var $n={absoluteURL:{get(){return this.toString()}}},Jt=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.setCacheControl("")}exemptPageFromCache(){this.setCacheControl("no-cache")}exemptPageFromPreview(){this.setCacheControl("no-preview")}setCacheControl(e){vn("turbo-cache-control",e)}},Ui={after(){this.targetElements.forEach(r=>{var e;return(e=r.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,r.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.append(this.templateContent))},before(){this.targetElements.forEach(r=>{var e;return(e=r.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,r)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.prepend(this.templateContent))},remove(){this.targetElements.forEach(r=>r.remove())},replace(){this.targetElements.forEach(r=>r.replaceWith(this.templateContent))},update(){this.targetElements.forEach(r=>{r.innerHTML="",r.append(this.templateContent)})}},S=new zt,Un=new Jt(S),{navigator:Wn}=S;function ot(){S.start()}function Kn(r){S.registerAdapter(r)}function zn(r,e){S.visit(r,e)}function Wi(r){S.connectStreamSource(r)}function Ki(r){S.disconnectStreamSource(r)}function Jn(r){S.renderStreamMessage(r)}function Xn(){console.warn("Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),S.clearCache()}function Gn(r){S.setProgressBarDelay(r)}function Qn(r){oe.confirmMethod=r}function Yn(r){S.setFormMode(r)}var Zn=Object.freeze({__proto__:null,navigator:Wn,session:S,cache:Un,PageRenderer:ke,PageSnapshot:R,FrameRenderer:Ce,start:ot,registerAdapter:Kn,visit:zn,connectStreamSource:Wi,disconnectStreamSource:Ki,renderStreamMessage:Jn,clearCache:Xn,setProgressBarDelay:Gn,setConfirmMethod:Qn,setFormMode:Yn,StreamActions:Ui}),Xt=class extends Error{},Gt=class{constructor(e){this.fetchResponseLoaded=t=>{},this.currentFetchRequest=null,this.resolveVisitPromise=()=>{},this.connected=!1,this.hasBeenLoaded=!1,this.ignoredAttributes=new Set,this.action=null,this.visitCachedSnapshot=({element:t})=>{let i=t.querySelector("#"+this.element.id);i&&this.previousFrameElement&&i.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement},this.element=e,this.view=new Mt(this,this.element),this.appearanceObserver=new Ft(this,this.element),this.formLinkClickObserver=new rt(this,this.element),this.linkInterceptor=new et(this,this.element),this.restorationIdentifier=me(),this.formSubmitObserver=new Oe(this,this.element)}connect(){this.connected||(this.connected=!0,this.loadingStyle==ee.lazy?this.appearanceObserver.start():this.loadSourceURL(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.connected&&(this.connected=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==ee.eager&&this.loadSourceURL()}sourceURLChanged(){this.isIgnoringChangesTo("src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==ee.eager||this.hasBeenLoaded)&&this.loadSourceURL())}sourceURLReloaded(){let{src:e}=this.element;return this.ignoringChangesToAttribute("complete",()=>{this.element.removeAttribute("complete")}),this.element.src=null,this.element.src=e,this.element.loaded}completeChanged(){this.isIgnoringChangesTo("complete")||this.loadSourceURL()}loadingStyleChanged(){this.loadingStyle==ee.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.loadSourceURL())}async loadSourceURL(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.visit(L(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.hasBeenLoaded=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let i=Di(t);R.fromDocument(i).isVisitable?await this.loadFrameResponse(e,i):await this.handleUnvisitableFrameResponse(e)}}finally{this.fetchResponseLoaded=()=>{}}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,e),this.loadSourceURL()}willSubmitFormLinkToLocation(e){return this.shouldInterceptNavigation(e)}submittedFormLinkToLocation(e,t,i){let s=this.findFrameElement(e);s&&i.setAttribute("data-turbo-frame",s.id)}shouldInterceptLinkClick(e,t,i){return this.shouldInterceptNavigation(e)}linkClickIntercepted(e,t){this.navigateFrame(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.shouldInterceptNavigation(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new oe(this,e,t);let{fetchRequest:i}=this.formSubmission;this.prepareRequest(i),this.formSubmission.start()}prepareRequest(e){var t;e.headers["Turbo-Frame"]=this.id,!((t=this.currentNavigationElement)===null||t===void 0)&&t.hasAttribute("data-turbo-stream")&&e.acceptResponseType($.contentType)}requestStarted(e){kt(this.element)}requestPreventedHandlingResponse(e,t){this.resolveVisitPromise()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.resolveVisitPromise()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.resolveVisitPromise()}requestErrored(e,t){console.error(t),this.resolveVisitPromise()}requestFinished(e){Rt(this.element)}formSubmissionStarted({formElement:e}){kt(e,this.findFrameElement(e))}formSubmissionSucceededWithResponse(e,t){let i=this.findFrameElement(e.formElement,e.submitter);i.delegate.proposeVisitIfNavigatedWithAction(i,e.formElement,e.submitter),i.delegate.loadResponse(t),e.isSafe||S.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),S.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){Rt(e,this.findFrameElement(e))}allowsImmediateRender({element:e},t){let i=O("turbo:before-frame-render",{target:this.element,detail:Object.assign({newFrame:e},t),cancelable:!0}),{defaultPrevented:s,detail:{render:n}}=i;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t){}preloadOnLoadLinksForView(e){S.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}async loadFrameResponse(e,t){let i=await this.extractForeignFrameElement(t.body);if(i){let s=new ge(i),n=new Ce(this,this.view.snapshot,s,Ce.renderElement,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(n),this.complete=!0,S.frameRendered(e,this.element),S.frameLoaded(this.element),this.fetchResponseLoaded(e)}else this.willHandleFrameMissingFromResponse(e)&&this.handleFrameMissingFromResponse(e)}async visit(e){var t;let i=new Te(this,C.get,e,new URLSearchParams,this.element);return(t=this.currentFetchRequest)===null||t===void 0||t.cancel(),this.currentFetchRequest=i,new Promise(s=>{this.resolveVisitPromise=()=>{this.resolveVisitPromise=()=>{},this.currentFetchRequest=null,s()},i.perform()})}navigateFrame(e,t,i){let s=this.findFrameElement(e,i);s.delegate.proposeVisitIfNavigatedWithAction(s,e,i),this.withCurrentNavigationElement(e,()=>{s.src=t})}proposeVisitIfNavigatedWithAction(e,t,i){if(this.action=nt(i,t,e),this.action){let s=R.fromElement(e).clone(),{visitCachedSnapshot:n}=e.delegate;e.delegate.fetchResponseLoaded=o=>{if(e.src){let{statusCode:c,redirected:a}=o,h=e.ownerDocument.documentElement.outerHTML,f={response:{statusCode:c,redirected:a,responseHTML:h},visitCachedSnapshot:n,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:s};this.action&&(f.action=this.action),S.visit(e.src,f)}}}}changeHistory(){if(this.action){let e=qi(this.action);S.history.update(e,L(this.element.src||""),this.restorationIdentifier)}}async handleUnvisitableFrameResponse(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.visitResponse(e.response)}willHandleFrameMissingFromResponse(e){this.element.setAttribute("complete","");let t=e.response,i=async(n,o={})=>{n instanceof Response?this.visitResponse(n):S.visit(n,o)};return!O("turbo:frame-missing",{target:this.element,detail:{response:t,visit:i},cancelable:!0}).defaultPrevented}handleFrameMissingFromResponse(e){this.view.missing(),this.throwFrameMissingError(e)}throwFrameMissingError(e){let t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new Xt(t)}async visitResponse(e){let t=new Se(e),i=await t.responseHTML,{location:s,redirected:n,statusCode:o}=t;return S.visit(s,{response:{redirected:n,statusCode:o,responseHTML:i}})}findFrameElement(e,t){var i;let s=Ge("data-turbo-frame",t,e)||this.element.getAttribute("target");return(i=Pi(s))!==null&&i!==void 0?i:this.element}async extractForeignFrameElement(e){let t,i=CSS.escape(this.id);try{if(t=Bi(e.querySelector(`turbo-frame#${i}`),this.sourceURL),t)return t;if(t=Bi(e.querySelector(`turbo-frame[src][recurse~=${i}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(s){return console.error(s),new I}return null}formActionIsVisitable(e,t){let i=Yt(e,t);return pe(L(i),this.rootLocation)}shouldInterceptNavigation(e,t){let i=Ge("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.formActionIsVisitable(e,t)||!this.enabled||i=="_top")return!1;if(i){let s=Pi(i);if(s)return!s.disabled}return!(!S.elementIsNavigatable(e)||t&&!S.elementIsNavigatable(t))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.ignoringChangesToAttribute("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.resolveVisitPromise()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){this.ignoringChangesToAttribute("complete",()=>{e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")})}get isActive(){return this.element.isActive&&this.connected}get rootLocation(){var e;let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),i=(e=t?.content)!==null&&e!==void 0?e:"/";return L(i)}isIgnoringChangesTo(e){return this.ignoredAttributes.has(e)}ignoringChangesToAttribute(e,t){this.ignoredAttributes.add(e),t(),this.ignoredAttributes.delete(e)}withCurrentNavigationElement(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}};function Pi(r){if(r!=null){let e=document.getElementById(r);if(e instanceof I)return e}}function Bi(r,e){if(r){let t=r.getAttribute("src");if(t!=null&&e!=null&&sn(t,e))throw new Error(`Matching <turbo-frame id="${r.id}"> element has a source URL which references itself`);if(r.ownerDocument!==document&&(r=document.importNode(r,!0)),r instanceof I)return r.connectedCallback(),r.disconnectedCallback(),r}}var Re=class extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){var e;return(e=this.renderPromise)!==null&&e!==void 0?e:this.renderPromise=(async()=>{let t=this.beforeRenderEvent;this.dispatchEvent(t)&&(await Xe(),await t.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){var e;let t=this.targetElements.flatMap(s=>[...s.children]).filter(s=>!!s.id),i=[...((e=this.templateContent)===null||e===void 0?void 0:e.children)||[]].filter(s=>!!s.id).map(s=>s.id);return t.filter(s=>i.includes(s.id))}get performAction(){if(this.action){let e=Ui[this.action];if(e)return e;this.raise("unknown action")}this.raise("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.raise("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.raise("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}raise(e){throw new Error(`${this.description}: ${e}`)}get description(){var e,t;return(t=((e=this.outerHTML.match(/<[^>]+>/))!==null&&e!==void 0?e:[])[0])!==null&&t!==void 0?t:"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:Re.renderElement}})}get targetElementsById(){var e;let t=(e=this.ownerDocument)===null||e===void 0?void 0:e.getElementById(this.target);return t!==null?[t]:[]}get targetElementsByQuery(){var e;let t=(e=this.ownerDocument)===null||e===void 0?void 0:e.querySelectorAll(this.targets);return t.length!==0?Array.prototype.slice.call(t):[]}},Qt=class extends HTMLElement{constructor(){super(...arguments),this.streamSource=null}connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),Wi(this.streamSource)}disconnectedCallback(){this.streamSource&&Ki(this.streamSource)}get src(){return this.getAttribute("src")||""}};I.delegateConstructor=Gt;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",I);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",Re);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",Qt);(()=>{let r=document.currentScript;if(r&&!r.hasAttribute("data-turbo-suppress-warning"))for(r=r.parentElement;r;){if(r==document.body)return console.warn(ji`
|
28
|
+
You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
|
29
|
+
|
30
|
+
Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.
|
31
|
+
|
32
|
+
For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements
|
33
|
+
|
34
|
+
——
|
35
|
+
Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s
|
36
|
+
`,r.outerHTML);r=r.parentElement}})();window.Turbo=Zn;ot();var Zt=class{constructor(e,t,i){this.eventTarget=e,this.eventName=t,this.eventOptions=i,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){let t=to(e);for(let i of this.bindings){if(t.immediatePropagationStopped)break;i.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{let i=e.index,s=t.index;return i<s?-1:i>s?1:0})}};function to(r){if("immediatePropagationStopped"in r)return r;{let{stopImmediatePropagation:e}=r;return Object.assign(r,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}var er=class{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(e=>e.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(e=>e.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((e,t)=>e.concat(Array.from(t.values())),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,i={}){this.application.handleError(e,`Error ${t}`,i)}clearEventListenersForBinding(e){let t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){let{eventTarget:t,eventName:i,eventOptions:s}=e,n=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(i,s);n.delete(o),n.size==0&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){let{eventTarget:t,eventName:i,eventOptions:s}=e;return this.fetchEventListener(t,i,s)}fetchEventListener(e,t,i){let s=this.fetchEventListenerMapForEventTarget(e),n=this.cacheKey(t,i),o=s.get(n);return o||(o=this.createEventListener(e,t,i),s.set(n,o)),o}createEventListener(e,t,i){let s=new Zt(e,t,i);return this.started&&s.connect(),s}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){let i=[e];return Object.keys(t).sort().forEach(s=>{i.push(`${t[s]?"":"!"}${s}`)}),i.join(":")}},ro={stop({event:r,value:e}){return e&&r.stopPropagation(),!0},prevent({event:r,value:e}){return e&&r.preventDefault(),!0},self({event:r,value:e,element:t}){return e?t===r.target:!0}},io=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function so(r){let t=r.trim().match(io)||[],i=t[2],s=t[3];return s&&!["keydown","keyup","keypress"].includes(i)&&(i+=`.${s}`,s=""),{eventTarget:no(t[4]),eventName:i,eventOptions:t[7]?oo(t[7]):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||s}}function no(r){if(r=="window")return window;if(r=="document")return document}function oo(r){return r.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function ao(r){if(r==window)return"window";if(r==document)return"document"}function Er(r){return r.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function tr(r){return Er(r.replace(/--/g,"-").replace(/__/g,"_"))}function xe(r){return r.charAt(0).toUpperCase()+r.slice(1)}function rs(r){return r.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function co(r){return r.match(/[^\s]+/g)||[]}function zi(r){return r!=null}function rr(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var Ji=["meta","ctrl","alt","shift"],ir=class{constructor(e,t,i,s){this.element=e,this.index=t,this.eventTarget=i.eventTarget||e,this.eventName=i.eventName||lo(e)||at("missing event name"),this.eventOptions=i.eventOptions||{},this.identifier=i.identifier||at("missing identifier"),this.methodName=i.methodName||at("missing method name"),this.keyFilter=i.keyFilter||"",this.schema=s}static forToken(e,t){return new this(e.element,e.index,so(e.content),t)}toString(){let e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return!1;let t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return!0;let i=t.filter(s=>!Ji.includes(s))[0];return i?(rr(this.keyMappings,i)||at(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[i].toLowerCase()!==e.key.toLowerCase()):!1}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return!1;let t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){let e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:i,value:s}of Array.from(this.element.attributes)){let n=i.match(t),o=n&&n[1];o&&(e[Er(o)]=ho(s))}return e}get eventTargetName(){return ao(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){let[i,s,n,o]=Ji.map(c=>t.includes(c));return e.metaKey!==i||e.ctrlKey!==s||e.altKey!==n||e.shiftKey!==o}},Xi={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:r=>r.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function lo(r){let e=r.tagName.toLowerCase();if(e in Xi)return Xi[e](r)}function at(r){throw new Error(r)}function ho(r){try{return JSON.parse(r)}catch{return r}}var sr=class{constructor(e,t){this.context=e,this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){let t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){let e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){let{element:t}=this.action,{actionDescriptorFilters:i}=this.context.application,{controller:s}=this.context,n=!0;for(let[o,c]of Object.entries(this.eventOptions))if(o in i){let a=i[o];n=n&&a({name:o,value:c,event:e,element:t,controller:s})}else continue;return n}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){let{target:t,currentTarget:i}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:i,action:this.methodName})}catch(s){let{identifier:n,controller:o,element:c,index:a}=this,h={identifier:n,controller:o,element:c,index:a,event:e};this.context.handleError(s,`invoking action "${this.action}"`,h)}}willBeInvokedByEvent(e){let t=e.target;return e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e)||e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e)?!1:this.element===t?!0:t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}},ct=class{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver(i=>this.processMutations(i))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){let e=new Set(this.matchElementsInTree());for(let t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(let t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(let t of Array.from(e)){let i=this.elementFromNode(t);i&&this.processTree(i,this.removeElement)}}processAddedNodes(e){for(let t of Array.from(e)){let i=this.elementFromNode(t);i&&this.elementIsActive(i)&&this.processTree(i,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(let i of this.matchElementsInTree(e))t.call(this,i)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected!=this.element.isConnected?!1:this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}},lt=class{constructor(e,t,i){this.attributeName=t,this.delegate=i,this.elementObserver=new ct(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){let t=this.matchElement(e)?[e]:[],i=Array.from(e.querySelectorAll(this.selector));return t.concat(i)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}};function uo(r,e,t){is(r,e).add(t)}function fo(r,e,t){is(r,e).delete(t),po(r,e)}function is(r,e){let t=r.get(e);return t||(t=new Set,r.set(e,t)),t}function po(r,e){let t=r.get(e);t!=null&&t.size==0&&r.delete(e)}var U=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((t,i)=>t.concat(Array.from(i)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((t,i)=>t+i.size,0)}add(e,t){uo(this.valuesByKey,e,t)}delete(e,t){fo(this.valuesByKey,e,t)}has(e,t){let i=this.valuesByKey.get(e);return i!=null&&i.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(i=>i.has(e))}getValuesForKey(e){let t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,i])=>i.has(e)).map(([t,i])=>t)}};var nr=class{constructor(e,t,i,s){this._selector=t,this.details=s,this.elementObserver=new ct(e,this),this.delegate=i,this.matchesByElement=new U}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e,this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){let{selector:t}=this;if(t){let i=e.matches(t);return this.delegate.selectorMatchElement?i&&this.delegate.selectorMatchElement(e,this.details):i}else return!1}matchElementsInTree(e){let{selector:t}=this;if(t){let i=this.matchElement(e)?[e]:[],s=Array.from(e.querySelectorAll(t)).filter(n=>this.matchElement(n));return i.concat(s)}else return[]}elementMatched(e){let{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){let t=this.matchesByElement.getKeysForValue(e);for(let i of t)this.selectorUnmatched(e,i)}elementAttributeChanged(e,t){let{selector:i}=this;if(i){let s=this.matchElement(e),n=this.matchesByElement.has(i,e);s&&!n?this.selectorMatched(e,i):!s&&n&&this.selectorUnmatched(e,i)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details),this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details),this.matchesByElement.delete(t,e)}},or=class{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(i=>this.processMutations(i))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(let e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){let t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){let i=this.delegate.getStringMapKeyForAttribute(e);if(i!=null){this.stringMap.has(e)||this.stringMapKeyAdded(i,e);let s=this.element.getAttribute(e);if(this.stringMap.get(e)!=s&&this.stringMapValueChanged(s,i,t),s==null){let n=this.stringMap.get(e);this.stringMap.delete(e),n&&this.stringMapKeyRemoved(i,e,n)}else this.stringMap.set(e,s)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,i){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,i)}stringMapKeyRemoved(e,t,i){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,i)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(e=>e.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}},ht=class{constructor(e,t,i){this.attributeObserver=new lt(e,t,this),this.delegate=i,this.tokensByElement=new U}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){let[t,i]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(i)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(t=>this.tokenMatched(t))}tokensUnmatched(e){e.forEach(t=>this.tokenUnmatched(t))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){let t=this.tokensByElement.getValuesForKey(e),i=this.readTokensForElement(e),s=go(t,i).findIndex(([n,o])=>!vo(n,o));return s==-1?[[],[]]:[t.slice(s),i.slice(s)]}readTokensForElement(e){let t=this.attributeName,i=e.getAttribute(t)||"";return mo(i,e,t)}};function mo(r,e,t){return r.trim().split(/\s+/).filter(i=>i.length).map((i,s)=>({element:e,attributeName:t,content:i,index:s}))}function go(r,e){let t=Math.max(r.length,e.length);return Array.from({length:t},(i,s)=>[r[s],e[s]])}function vo(r,e){return r&&e&&r.index==e.index&&r.content==e.content}var ut=class{constructor(e,t,i){this.tokenListObserver=new ht(e,t,this),this.delegate=i,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){let{element:t}=e,{value:i}=this.fetchParseResultForToken(e);i&&(this.fetchValuesByTokenForElement(t).set(e,i),this.delegate.elementMatchedValue(t,i))}tokenUnmatched(e){let{element:t}=e,{value:i}=this.fetchParseResultForToken(e);i&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,i))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(t){return{error:t}}}},ar=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new ut(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){let t=new sr(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){let t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach(e=>this.delegate.bindingDisconnected(e,!0)),this.bindingsByAction.clear()}parseValueForToken(e){let t=ir.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},cr=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new or(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){let i=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,i.writer(this.receiver[e]),i.writer(i.defaultValue))}stringMapValueChanged(e,t,i){let s=this.valueDescriptorNameMap[t];e!==null&&(i===null&&(i=s.writer(s.defaultValue)),this.invokeChangedCallback(t,e,i))}stringMapKeyRemoved(e,t,i){let s=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,s.writer(this.receiver[e]),i):this.invokeChangedCallback(e,s.writer(s.defaultValue),i)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:t,defaultValue:i,writer:s}of this.valueDescriptors)i!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(t,s(i),void 0)}invokeChangedCallback(e,t,i){let s=`${e}Changed`,n=this.receiver[s];if(typeof n=="function"){let o=this.valueDescriptorNameMap[e];try{let c=o.reader(t),a=i;i&&(a=o.reader(i)),n.call(this.receiver,c,a)}catch(c){throw c instanceof TypeError&&(c.message=`Stimulus Value "${this.context.identifier}.${o.name}" - ${c.message}`),c}}}get valueDescriptors(){let{valueDescriptorMap:e}=this;return Object.keys(e).map(t=>e[t])}get valueDescriptorNameMap(){let e={};return Object.keys(this.valueDescriptorMap).forEach(t=>{let i=this.valueDescriptorMap[t];e[i.name]=i}),e}hasValue(e){let t=this.valueDescriptorNameMap[e],i=`has${xe(t.name)}`;return this.receiver[i]}},lr=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new U}start(){this.tokenListObserver||(this.tokenListObserver=new ht(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var i;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),(i=this.tokenListObserver)===null||i===void 0||i.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var i;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),(i=this.tokenListObserver)===null||i===void 0||i.pause(()=>this.delegate.targetDisconnected(e,t)))}disconnectAllTargets(){for(let e of this.targetsByName.keys)for(let t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}};function Ne(r,e){let t=ss(r);return Array.from(t.reduce((i,s)=>(bo(s,e).forEach(n=>i.add(n)),i),new Set))}function yo(r,e){return ss(r).reduce((i,s)=>(i.push(...wo(s,e)),i),[])}function ss(r){let e=[];for(;r;)e.push(r),r=Object.getPrototypeOf(r);return e.reverse()}function bo(r,e){let t=r[e];return Array.isArray(t)?t:[]}function wo(r,e){let t=r[e];return t?Object.keys(t).map(i=>[i,t[i]]):[]}var hr=class{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new U,this.outletElementsByName=new U,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(e=>{this.setupSelectorObserverForOutlet(e),this.setupAttributeObserverForOutlet(e)}),this.started=!0,this.dependentContexts.forEach(e=>e.refresh()))}refresh(){this.selectorObserverMap.forEach(e=>e.refresh()),this.attributeObserverMap.forEach(e=>e.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(e=>e.stop()),this.attributeObserverMap.clear())}selectorMatched(e,t,{outletName:i}){let s=this.getOutlet(e,i);s&&this.connectOutlet(s,e,i)}selectorUnmatched(e,t,{outletName:i}){let s=this.getOutletFromMap(e,i);s&&this.disconnectOutlet(s,e,i)}selectorMatchElement(e,{outletName:t}){let i=this.selector(t),s=this.hasOutlet(e,t),n=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return i?s&&n&&e.matches(i):!1}elementMatchedAttribute(e,t){let i=this.getOutletNameFromOutletAttributeName(t);i&&this.updateSelectorObserverForOutlet(i)}elementAttributeValueChanged(e,t){let i=this.getOutletNameFromOutletAttributeName(t);i&&this.updateSelectorObserverForOutlet(i)}elementUnmatchedAttribute(e,t){let i=this.getOutletNameFromOutletAttributeName(t);i&&this.updateSelectorObserverForOutlet(i)}connectOutlet(e,t,i){var s;this.outletElementsByName.has(i,t)||(this.outletsByName.add(i,e),this.outletElementsByName.add(i,t),(s=this.selectorObserverMap.get(i))===null||s===void 0||s.pause(()=>this.delegate.outletConnected(e,t,i)))}disconnectOutlet(e,t,i){var s;this.outletElementsByName.has(i,t)&&(this.outletsByName.delete(i,e),this.outletElementsByName.delete(i,t),(s=this.selectorObserverMap.get(i))===null||s===void 0||s.pause(()=>this.delegate.outletDisconnected(e,t,i)))}disconnectAllOutlets(){for(let e of this.outletElementsByName.keys)for(let t of this.outletElementsByName.getValuesForKey(e))for(let i of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(i,t,e)}updateSelectorObserverForOutlet(e){let t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){let t=this.selector(e),i=new nr(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,i),i.start()}setupAttributeObserverForOutlet(e){let t=this.attributeNameForOutletName(e),i=new lt(this.scope.element,t,this);this.attributeObserverMap.set(e,i),i.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find(t=>this.attributeNameForOutletName(t)===e)}get outletDependencies(){let e=new U;return this.router.modules.forEach(t=>{let i=t.definition.controllerConstructor;Ne(i,"outlets").forEach(n=>e.add(n,t.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let e=this.dependentControllerIdentifiers;return this.router.contexts.filter(t=>e.includes(t.identifier))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find(i=>i.element===e)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}},ur=class{constructor(e,t){this.logDebugActivity=(i,s={})=>{let{identifier:n,controller:o,element:c}=this;s=Object.assign({identifier:n,controller:o,element:c},s),this.application.logDebugActivity(this.identifier,i,s)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new ar(this,this.dispatcher),this.valueObserver=new cr(this,this.controller),this.targetObserver=new lr(this,this),this.outletObserver=new hr(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(i){this.handleError(i,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,i={}){let{identifier:s,controller:n,element:o}=this;i=Object.assign({identifier:s,controller:n,element:o},i),this.application.handleError(e,`Error ${t}`,i)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,i){this.invokeControllerMethod(`${tr(i)}OutletConnected`,e,t)}outletDisconnected(e,t,i){this.invokeControllerMethod(`${tr(i)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let i=this.controller;typeof i[e]=="function"&&i[e](...t)}};function Eo(r){return _o(r,So(r))}function _o(r,e){let t=Lo(r),i=Ao(r.prototype,e);return Object.defineProperties(t.prototype,i),t}function So(r){return Ne(r,"blessings").reduce((t,i)=>{let s=i(r);for(let n in s){let o=t[n]||{};t[n]=Object.assign(o,s[n])}return t},{})}function Ao(r,e){return Oo(e).reduce((t,i)=>{let s=To(r,e,i);return s&&Object.assign(t,{[i]:s}),t},{})}function To(r,e,t){let i=Object.getOwnPropertyDescriptor(r,t);if(!(i&&"value"in i)){let n=Object.getOwnPropertyDescriptor(e,t).value;return i&&(n.get=i.get||n.get,n.set=i.set||n.set),n}}var Oo=(()=>typeof Object.getOwnPropertySymbols=="function"?r=>[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)]:Object.getOwnPropertyNames)(),Lo=(()=>{function r(t){function i(){return Reflect.construct(t,arguments,new.target)}return i.prototype=Object.create(t.prototype,{constructor:{value:i}}),Reflect.setPrototypeOf(i,t),i}function e(){let i=r(function(){this.a.call(this)});return i.prototype.a=function(){},new i}try{return e(),r}catch{return i=>class extends i{}}})();function Co(r){return{identifier:r.identifier,controllerConstructor:Eo(r.controllerConstructor)}}var dr=class{constructor(e,t){this.application=e,this.definition=Co(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){let t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){let t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new ur(this,e),this.contextsByScope.set(e,t)),t}},fr=class{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){let t=this.data.get(this.getDataKey(e))||"";return co(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},pr=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){let t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){let i=this.getAttributeNameForKey(e);return this.element.setAttribute(i,t),this.get(e)}has(e){let t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){let t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}else return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${rs(e)}`}},mr=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,i){let s=this.warnedKeysByObject.get(e);s||(s=new Set,this.warnedKeysByObject.set(e,s)),s.has(t)||(s.add(t),this.logger.warn(i,e))}};function gr(r,e){return`[${r}~="${e}"]`}var vr=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,i)=>t||this.findTarget(i)||this.findLegacyTarget(i),void 0)}findAll(...e){return e.reduce((t,i)=>[...t,...this.findAllTargets(i),...this.findAllLegacyTargets(i)],[])}findTarget(e){let t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){let t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){let t=this.schema.targetAttributeForScope(this.identifier);return gr(t,e)}findLegacyTarget(e){let t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){let t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map(i=>this.deprecate(i,e))}getLegacySelectorForTargetName(e){let t=`${this.identifier}.${e}`;return gr(this.schema.targetAttribute,t)}deprecate(e,t){if(e){let{identifier:i}=this,s=this.schema.targetAttribute,n=this.schema.targetAttributeForScope(i);this.guide.warn(e,`target:${t}`,`Please replace ${s}="${i}.${t}" with ${n}="${t}". The ${s} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},yr=class{constructor(e,t){this.scope=e,this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,i)=>t||this.findOutlet(i),void 0)}findAll(...e){return e.reduce((t,i)=>[...t,...this.findAllOutlets(i)],[])}getSelectorForOutletName(e){let t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){let t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){let t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))}matchesElement(e,t,i){let s=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&s.split(" ").includes(i)}},Fe=class{constructor(e,t,i,s){this.targets=new vr(this),this.classes=new fr(this),this.data=new pr(this),this.containsElement=n=>n.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=i,this.guide=new mr(s),this.outlets=new yr(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return gr(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new Fe(this.schema,document.documentElement,this.identifier,this.guide.logger)}},br=class{constructor(e,t,i){this.element=e,this.schema=t,this.delegate=i,this.valueListObserver=new ut(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){let{element:t,content:i}=e;return this.parseValueForElementAndIdentifier(t,i)}parseValueForElementAndIdentifier(e,t){let i=this.fetchScopesByIdentifierForElement(e),s=i.get(t);return s||(s=this.delegate.createScopeForElementAndIdentifier(e,t),i.set(t,s)),s}elementMatchedValue(e,t){let i=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,i),i==1&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){let i=this.scopeReferenceCounts.get(t);i&&(this.scopeReferenceCounts.set(t,i-1),i==1&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}},wr=class{constructor(e){this.application=e,this.scopeObserver=new br(this.element,this.schema,this),this.scopesByIdentifier=new U,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((e,t)=>e.concat(t.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);let t=new dr(this.application,e);this.connectModule(t);let i=e.controllerConstructor.afterLoad;i&&i.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){let t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){let i=this.modulesByIdentifier.get(t);if(i)return i.contexts.find(s=>s.element==e)}proposeToConnectScopeForElementAndIdentifier(e,t){let i=this.scopeObserver.parseValueForElementAndIdentifier(e,t);i?this.scopeObserver.elementMatchedValue(i.element,i):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,i){this.application.handleError(e,t,i)}createScopeForElementAndIdentifier(e,t){return new Fe(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(i=>e.connectContextForScope(i))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(i=>e.disconnectContextForScope(i))}},ko={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:r=>`data-${r}-target`,outletAttributeForScope:(r,e)=>`data-${r}-${e}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},Gi("abcdefghijklmnopqrstuvwxyz".split("").map(r=>[r,r]))),Gi("0123456789".split("").map(r=>[r,r])))};function Gi(r){return r.reduce((e,[t,i])=>Object.assign(Object.assign({},e),{[t]:i}),{})}var dt=class{constructor(e=document.documentElement,t=ko){this.logger=console,this.debug=!1,this.logDebugActivity=(i,s,n={})=>{this.debug&&this.logFormattedMessage(i,s,n)},this.element=e,this.schema=t,this.dispatcher=new er(this),this.router=new wr(this),this.actionDescriptorFilters=Object.assign({},ro)}static start(e,t){let i=new this(e,t);return i.start(),i}async start(){await Ro(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>{s.controllerConstructor.shouldLoad&&this.router.loadDefinition(s)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>this.router.unloadIdentifier(s))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){let i=this.router.getContextForElementAndIdentifier(e,t);return i?i.controller:null}handleError(e,t,i){var s;this.logger.error(`%s
|
37
|
+
|
38
|
+
%o
|
39
|
+
|
40
|
+
%o`,t,e,i),(s=window.onerror)===null||s===void 0||s.call(window,t,"",0,0,e)}logFormattedMessage(e,t,i={}){i=Object.assign({application:this},i),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},i)),this.logger.groupEnd()}};function Ro(){return new Promise(r=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>r()):r()})}function Fo(r){return Ne(r,"classes").reduce((t,i)=>Object.assign(t,Mo(i)),{})}function Mo(r){return{[`${r}Class`]:{get(){let{classes:e}=this;if(e.has(r))return e.get(r);{let t=e.getAttributeName(r);throw new Error(`Missing attribute "${t}"`)}}},[`${r}Classes`]:{get(){return this.classes.getAll(r)}},[`has${xe(r)}Class`]:{get(){return this.classes.has(r)}}}}function xo(r){return Ne(r,"outlets").reduce((t,i)=>Object.assign(t,No(i)),{})}function Qi(r,e,t){return r.application.getControllerForElementAndIdentifier(e,t)}function Yi(r,e,t){let i=Qi(r,e,t);if(i||(r.application.router.proposeToConnectScopeForElementAndIdentifier(e,t),i=Qi(r,e,t),i))return i}function No(r){let e=tr(r);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(r),i=this.outlets.getSelectorForOutletName(r);if(t){let s=Yi(this,t,r);if(s)return s;throw new Error(`The provided outlet element is missing an outlet controller "${r}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${r}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${i}".`)}},[`${e}Outlets`]:{get(){let t=this.outlets.findAll(r);return t.length>0?t.map(i=>{let s=Yi(this,i,r);if(s)return s;console.warn(`The provided outlet element is missing an outlet controller "${r}" instance for host controller "${this.identifier}"`,i)}).filter(i=>i):[]}},[`${e}OutletElement`]:{get(){let t=this.outlets.find(r),i=this.outlets.getSelectorForOutletName(r);if(t)return t;throw new Error(`Missing outlet element "${r}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${i}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(r)}},[`has${xe(e)}Outlet`]:{get(){return this.outlets.has(r)}}}}function Po(r){return Ne(r,"targets").reduce((t,i)=>Object.assign(t,Bo(i)),{})}function Bo(r){return{[`${r}Target`]:{get(){let e=this.targets.find(r);if(e)return e;throw new Error(`Missing target element "${r}" for "${this.identifier}" controller`)}},[`${r}Targets`]:{get(){return this.targets.findAll(r)}},[`has${xe(r)}Target`]:{get(){return this.targets.has(r)}}}}function Io(r){let e=yo(r,"values"),t={valueDescriptorMap:{get(){return e.reduce((i,s)=>{let n=ns(s,this.identifier),o=this.data.getAttributeNameForKey(n.key);return Object.assign(i,{[o]:n})},{})}}};return e.reduce((i,s)=>Object.assign(i,Do(s)),t)}function Do(r,e){let t=ns(r,e),{key:i,name:s,reader:n,writer:o}=t;return{[s]:{get(){let c=this.data.get(i);return c!==null?n(c):t.defaultValue},set(c){c===void 0?this.data.delete(i):this.data.set(i,o(c))}},[`has${xe(s)}`]:{get(){return this.data.has(i)||t.hasCustomDefaultValue}}}}function ns([r,e],t){return Vo({controller:t,token:r,typeDefinition:e})}function ft(r){switch(r){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Me(r){switch(typeof r){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(r))return"array";if(Object.prototype.toString.call(r)==="[object Object]")return"object"}function jo(r){let{controller:e,token:t,typeObject:i}=r,s=zi(i.type),n=zi(i.default),o=s&&n,c=s&&!n,a=!s&&n,h=ft(i.type),d=Me(r.typeObject.default);if(c)return h;if(a)return d;if(h!==d){let f=e?`${e}.${t}`:t;throw new Error(`The specified default value for the Stimulus Value "${f}" must match the defined type "${h}". The provided default value of "${i.default}" is of type "${d}".`)}if(o)return h}function qo(r){let{controller:e,token:t,typeDefinition:i}=r,n=jo({controller:e,token:t,typeObject:i}),o=Me(i),c=ft(i),a=n||o||c;if(a)return a;let h=e?`${e}.${i}`:t;throw new Error(`Unknown value type "${h}" for "${t}" value`)}function Ho(r){let e=ft(r);if(e)return Zi[e];let t=rr(r,"default"),i=rr(r,"type"),s=r;if(t)return s.default;if(i){let{type:n}=s,o=ft(n);if(o)return Zi[o]}return r}function Vo(r){let{token:e,typeDefinition:t}=r,i=`${rs(e)}-value`,s=qo(r);return{type:s,key:i,name:Er(i),get defaultValue(){return Ho(t)},get hasCustomDefaultValue(){return Me(t)!==void 0},reader:$o[s],writer:es[s]||es.default}}var Zi={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},$o={array(r){let e=JSON.parse(r);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${r}" of type "${Me(e)}"`);return e},boolean(r){return!(r=="0"||String(r).toLowerCase()=="false")},number(r){return Number(r.replace(/_/g,""))},object(r){let e=JSON.parse(r);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${r}" of type "${Me(e)}"`);return e},string(r){return r}},es={default:Uo,array:ts,object:ts};function ts(r){return JSON.stringify(r)}function Uo(r){return`${r}`}var M=class{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:i={},prefix:s=this.identifier,bubbles:n=!0,cancelable:o=!0}={}){let c=s?`${s}:${e}`:e,a=new CustomEvent(c,{detail:i,bubbles:n,cancelable:o});return t.dispatchEvent(a),a}};M.blessings=[Fo,Po,Io,xo];M.targets=[];M.outlets=[];M.values={};var Pe=class extends M{showAnother(r=void 0){if(r?.preventDefault(),!r.params.show){console.error("data-modal-show-param attribute missing",r.target);return}r.target.id||console.error("id attribute missing, focus won't be re-assigned when modal is closed",r.target),window.dispatchEvent(new CustomEvent("modal:show",{detail:{id:r.params.show,previousFocus:r.target.id}}))}show(r=void 0){r?.preventDefault();let e=r?.detail?.id;e&&this.element.id!==e||(this.modalTarget.style.display="block",this.backdropTarget.style.display="block",this.modalTarget.setAttribute("role","dialog"),this.modalTarget.setAttribute("aria-modal",!0),this.modalTarget.removeAttribute("aria-hidden"),window.document.body.classList.add("modal-open"),r?.detail?.previousFocus?this.previousFocus=window.document.getElementById(r.detail.previousFocus):this.previousFocus=r?.target,setTimeout(()=>{this.modalTarget.classList.add("show"),this.backdropTarget.classList.add("show"),this.modalTarget.focus()},1))}hideWithEscape(r){r?.key==="Escape"&&this.hide()}hide(r=void 0){r?.preventDefault();let e=r?.detail?.id;e&&this.element.id!==e||(this.backdropTarget.classList.remove("show"),this.modalTarget.classList.remove("show"),this.modalTarget.setAttribute("aria-hidden",!0),this.modalTarget.removeAttribute("role"),this.modalTarget.removeAttribute("aria-modal"),this.previousFocus?.focus(),this.modalTarget.querySelectorAll("video,audio").forEach(t=>t.pause()),setTimeout(()=>{this.modalTarget.style.display="",this.backdropTarget.style.display=""},500),window.document.body.classList.remove("modal-open"))}};J(Pe,"targets",["modal","backdrop"]);var ve=class extends M{revalid(r){this.instanceTarget.classList.remove("is-invalid")}async submit(r){this.toggle();let e=this.instanceTarget.value.split(/[@ ]/).map(o=>o.trim()).filter(o=>o.length),t=e.length===1?e[0]:e[e.length-1],i=`https://${t}/.well-known/webfinger?resource=https://${t}`,s=AbortSignal.any([window.abortController?.signal,AbortSignal.timeout(3e3)]),n={Accept:"application/json"};try{let a=(await(await fetch(i,{headers:n,signal:s})).json())?.links?.find(d=>d?.rel==="http://ostatus.org/schema/1.0/subscribe")?.template;if(!a)throw new Error(`Webfinger ${i} doesn't support remote interaction`);let h=a.replaceAll("{uri}",encodeURIComponent(this.uriValue));setTimeout(()=>Turbo.visit(h),100)}catch(o){console.error(o),this.instanceTarget.classList.add("is-invalid")}this.toggle()}toggle(){for(let r of this.element.elements)r.disabled=!r.disabled}};J(ve,"targets",["instance"]),J(ve,"values",{uri:String});var ye=class extends M{valueTargetConnected(r){this.toggle()}toggle(r=void 0){let e=this.valueTarget.value?.trim();for(let t of this.tabTargets)e===t.id?(t.classList.remove("d-none",...this.hideClasses),setTimeout(()=>t.classList.add(...this.showClasses),1)):(t.classList.add("d-none",...this.hideClasses),setTimeout(()=>t.classList.remove(...this.showClasses),1))}};J(ye,"targets",["tab","value"]),J(ye,"classes",["hide","show"]);try{window.env.JEKYLL_ENV==="production"&&(window.airbrake=new Lt({projectId:window.env.AIRBRAKE_PROJECT_ID,projectKey:window.env.AIRBRAKE_PROJECT_KEY,host:"https://panel.sutty.nl"}),console.originalError=console.error,console.error=(...r)=>(window.airbrake.notify(r.join(" ")),console.originalError(...r)))}catch(r){console.error(r)}ot();window.Stimulus=dt.start();window.abortController=void 0;Stimulus.debug=window.env.JEKYLL_ENV!=="production";Stimulus.register("modal",Pe);Stimulus.register("authorize-interaction",ve);Stimulus.register("tabs",ye);document.addEventListener("turbo:load",r=>{window.abortController=new AbortController});document.addEventListener("turbo:visit",r=>{window.abortController.abort()});})();
|
41
|
+
//# sourceMappingURL=pack.FXJZFZ4Z.js.map
|