disco-jekyll-theme 0.0.7 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/_data/manifest.json +59 -27
- data/_sass/qtkooper.scss +2 -2
- data/assets/js/pack.CO6WJJ2F.js +60 -0
- data/assets/js/pack.CO6WJJ2F.js.map +7 -0
- data.tar.gz.sig +0 -0
- metadata +12 -12
- metadata.gz.sig +0 -0
- data/assets/js/pack.4CCOOFTO.js +0 -49
- data/assets/js/pack.4CCOOFTO.js.map +0 -7
@@ -0,0 +1,60 @@
|
|
1
|
+
(()=>{var vn=Object.create;var Xe=Object.defineProperty;var yn=Object.getOwnPropertyDescriptor;var bn=Object.getOwnPropertyNames;var wn=Object.getPrototypeOf,_n=Object.prototype.hasOwnProperty;var En=(r,e)=>()=>(r&&(e=r(r=0)),e);var ae=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Sn=(r,e)=>{for(var t in e)Xe(r,t,{get:e[t],enumerable:!0})},os=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of bn(e))!_n.call(r,i)&&i!==t&&Xe(r,i,{get:()=>e[i],enumerable:!(s=yn(e,i))||s.enumerable});return r};var as=(r,e,t)=>(t=r!=null?vn(wn(r)):{},os(e||!r||!r.__esModule?Xe(t,"default",{value:r,enumerable:!0}):t,r)),An=r=>os(Xe({},"__esModule",{value:!0}),r);var _s=ae((Nt,ws)=>{(function(r,e){"use strict";typeof define=="function"&&define.amd?define("stackframe",[],e):typeof Nt=="object"?ws.exports=e():r.StackFrame=e()})(Nt,function(){"use strict";function r(E){return!isNaN(parseFloat(E))&&isFinite(E)}function e(E){return E.charAt(0).toUpperCase()+E.substring(1)}function t(E){return function(){return this[E]}}var s=["isConstructor","isEval","isNative","isToplevel"],i=["columnNumber","lineNumber"],n=["fileName","functionName","source"],o=["args"],c=["evalOrigin"],a=s.concat(i,n,o,c);function d(E){if(E)for(var S=0;S<a.length;S++)E[a[S]]!==void 0&&this["set"+e(a[S])](E[a[S]])}d.prototype={getArgs:function(){return this.args},setArgs:function(E){if(Object.prototype.toString.call(E)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=E},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(E){if(E instanceof d)this.evalOrigin=E;else if(E instanceof Object)this.evalOrigin=new d(E);else throw new TypeError("Eval Origin must be an Object or StackFrame")},toString:function(){var E=this.getFileName()||"",S=this.getLineNumber()||"",k=this.getColumnNumber()||"",T=this.getFunctionName()||"";return this.getIsEval()?E?"[eval] ("+E+":"+S+":"+k+")":"[eval]:"+S+":"+k:T?T+" ("+E+":"+S+":"+k+")":E+":"+S+":"+k}},d.fromString=function(S){var k=S.indexOf("("),T=S.lastIndexOf(")"),O=S.substring(0,k),b=S.substring(k+1,T).split(","),w=S.substring(T+1);if(w.indexOf("@")===0)var h=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(w,""),u=h[1],m=h[2],p=h[3];return new d({functionName:O,args:b||void 0,fileName:u,lineNumber:m||void 0,columnNumber:p||void 0})};for(var v=0;v<s.length;v++)d.prototype["get"+e(s[v])]=t(s[v]),d.prototype["set"+e(s[v])]=function(E){return function(S){this[E]=!!S}}(s[v]);for(var y=0;y<i.length;y++)d.prototype["get"+e(i[y])]=t(i[y]),d.prototype["set"+e(i[y])]=function(E){return function(S){if(!r(S))throw new TypeError(E+" must be a Number");this[E]=Number(S)}}(i[y]);for(var _=0;_<n.length;_++)d.prototype["get"+e(n[_])]=t(n[_]),d.prototype["set"+e(n[_])]=function(E){return function(S){this[E]=String(S)}}(n[_]);return d})});var Ss=ae((It,Es)=>{(function(r,e){"use strict";typeof define=="function"&&define.amd?define("error-stack-parser",["stackframe"],e):typeof It=="object"?Es.exports=e(_s()):r.ErrorStackParser=e(r.StackFrame)})(It,function(e){"use strict";var t=/(^|@)\S+:\d+/,s=/^\s*at .*(\S+:\d+|\(native\))/m,i=/^(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(s))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(s)},this);return c.map(function(a){a.indexOf("(eval ")>-1&&(a=a.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var d=a.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),v=d.match(/ (\(.+\)$)/);d=v?d.replace(v[0],""):d;var y=this.extractLocation(v?v[1]:d),_=v&&d||void 0,E=["eval","<anonymous>"].indexOf(y[0])>-1?void 0:y[0];return new e({functionName:_,fileName:E,lineNumber:y[1],columnNumber:y[2],source:a})},this)},parseFFOrSafari:function(o){var c=o.stack.split(`
|
3
|
+
`).filter(function(a){return!a.match(i)},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 d=/((.*".+"[^@]*)?[^@]*)(?:@)/,v=a.match(d),y=v&&v[1]?v[1]:void 0,_=this.extractLocation(a.replace(d,""));return new e({functionName:y,fileName:_[0],lineNumber:_[1],columnNumber:_[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
|
+
`),d=[],v=2,y=a.length;v<y;v+=2){var _=c.exec(a[v]);_&&d.push(new e({fileName:_[2],lineNumber:_[1],source:a[v]}))}return d},parseOpera10:function(o){for(var c=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,a=o.stacktrace.split(`
|
8
|
+
`),d=[],v=0,y=a.length;v<y;v+=2){var _=c.exec(a[v]);_&&d.push(new e({functionName:_[3]||void 0,fileName:_[2],lineNumber:_[1],source:a[v]}))}return d},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 d=a.split("@"),v=this.extractLocation(d.pop()),y=d.shift()||"",_=y.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,E;y.match(/\(([^)]*)\)/)&&(E=y.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var S=E===void 0||E==="[arguments not available]"?void 0:E.split(",");return new e({functionName:_,args:S,fileName:v[0],lineNumber:v[1],columnNumber:v[2],source:a})},this)}}})});var Fs=ae((ce,Ps)=>{var Ze=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global,et=function(){function r(){this.fetch=!1,this.DOMException=Ze.DOMException}return r.prototype=Ze,new r}();(function(r){var e=function(t){var s=typeof r<"u"&&r||typeof self<"u"&&self||typeof global<"u"&&global||{},i={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function n(l){return l&&DataView.prototype.isPrototypeOf(l)}if(i.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 d(l){return typeof l!="string"&&(l=String(l)),l}function v(l){var g={next:function(){var R=l.shift();return{done:R===void 0,value:R}}};return i.iterable&&(g[Symbol.iterator]=function(){return g}),g}function y(l){this.map={},l instanceof y?l.forEach(function(g,R){this.append(R,g)},this):Array.isArray(l)?l.forEach(function(g){if(g.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+g.length);this.append(g[0],g[1])},this):l&&Object.getOwnPropertyNames(l).forEach(function(g){this.append(g,l[g])},this)}y.prototype.append=function(l,g){l=a(l),g=d(g);var R=this.map[l];this.map[l]=R?R+", "+g:g},y.prototype.delete=function(l){delete this.map[a(l)]},y.prototype.get=function(l){return l=a(l),this.has(l)?this.map[l]:null},y.prototype.has=function(l){return this.map.hasOwnProperty(a(l))},y.prototype.set=function(l,g){this.map[a(l)]=d(g)},y.prototype.forEach=function(l,g){for(var R in this.map)this.map.hasOwnProperty(R)&&l.call(g,this.map[R],R,this)},y.prototype.keys=function(){var l=[];return this.forEach(function(g,R){l.push(R)}),v(l)},y.prototype.values=function(){var l=[];return this.forEach(function(g){l.push(g)}),v(l)},y.prototype.entries=function(){var l=[];return this.forEach(function(g,R){l.push([R,g])}),v(l)},i.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function _(l){if(!l._noBody){if(l.bodyUsed)return Promise.reject(new TypeError("Already read"));l.bodyUsed=!0}}function E(l){return new Promise(function(g,R){l.onload=function(){g(l.result)},l.onerror=function(){R(l.error)}})}function S(l){var g=new FileReader,R=E(g);return g.readAsArrayBuffer(l),R}function k(l){var g=new FileReader,R=E(g),M=/charset=([A-Za-z0-9_-]+)/.exec(l.type),F=M?M[1]:"utf-8";return g.readAsText(l,F),R}function T(l){for(var g=new Uint8Array(l),R=new Array(g.length),M=0;M<g.length;M++)R[M]=String.fromCharCode(g[M]);return R.join("")}function O(l){if(l.slice)return l.slice(0);var g=new Uint8Array(l.byteLength);return g.set(new Uint8Array(l)),g.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(l){this.bodyUsed=this.bodyUsed,this._bodyInit=l,l?typeof l=="string"?this._bodyText=l:i.blob&&Blob.prototype.isPrototypeOf(l)?this._bodyBlob=l:i.formData&&FormData.prototype.isPrototypeOf(l)?this._bodyFormData=l:i.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)?this._bodyText=l.toString():i.arrayBuffer&&i.blob&&n(l)?(this._bodyArrayBuffer=O(l.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(l)||c(l))?this._bodyArrayBuffer=O(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):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(l)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var l=_(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=_(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(i.blob)return this.blob().then(S);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var l=_(this);if(l)return l;if(this._bodyBlob)return k(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(T(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}var w=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function h(l){var g=l.toUpperCase();return w.indexOf(g)>-1?g:l}function u(l,g){if(!(this instanceof u))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');g=g||{};var R=g.body;if(l instanceof u){if(l.bodyUsed)throw new TypeError("Already read");this.url=l.url,this.credentials=l.credentials,g.headers||(this.headers=new y(l.headers)),this.method=l.method,this.mode=l.mode,this.signal=l.signal,!R&&l._bodyInit!=null&&(R=l._bodyInit,l.bodyUsed=!0)}else this.url=String(l);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new y(g.headers)),this.method=h(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal||function(){if("AbortController"in s){var P=new AbortController;return P.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&R)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(R),(this.method==="GET"||this.method==="HEAD")&&(g.cache==="no-store"||g.cache==="no-cache")){var M=/([?&])_=[^&]*/;if(M.test(this.url))this.url=this.url.replace(M,"$1_="+new Date().getTime());else{var F=/\?/;this.url+=(F.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}u.prototype.clone=function(){return new u(this,{body:this._bodyInit})};function m(l){var g=new FormData;return l.trim().split("&").forEach(function(R){if(R){var M=R.split("="),F=M.shift().replace(/\+/g," "),P=M.join("=").replace(/\+/g," ");g.append(decodeURIComponent(F),decodeURIComponent(P))}}),g}function p(l){var g=new y,R=l.replace(/\r?\n[\t ]+/g," ");return R.split("\r").map(function(M){return M.indexOf(`
|
10
|
+
`)===0?M.substr(1,M.length):M}).forEach(function(M){var F=M.split(":"),P=F.shift().trim();if(P){var J=F.join(":").trim();try{g.append(P,J)}catch(Z){console.warn("Response "+Z.message)}}}),g}b.call(u.prototype);function f(l,g){if(!(this instanceof f))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(g||(g={}),this.type="default",this.status=g.status===void 0?200:g.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=g.statusText===void 0?"":""+g.statusText,this.headers=new y(g.headers),this.url=g.url||"",this._initBody(l)}b.call(f.prototype),f.prototype.clone=function(){return new f(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},f.error=function(){var l=new f(null,{status:200,statusText:""});return l.ok=!1,l.status=0,l.type="error",l};var A=[301,302,303,307,308];f.redirect=function(l,g){if(A.indexOf(g)===-1)throw new RangeError("Invalid status code");return new f(null,{status:g,headers:{location:l}})},t.DOMException=s.DOMException;try{new t.DOMException}catch{t.DOMException=function(g,R){this.message=g,this.name=R;var M=Error(g);this.stack=M.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function L(l,g){return new Promise(function(R,M){var F=new u(l,g);if(F.signal&&F.signal.aborted)return M(new t.DOMException("Aborted","AbortError"));var P=new XMLHttpRequest;function J(){P.abort()}P.onload=function(){var x={statusText:P.statusText,headers:p(P.getAllResponseHeaders()||"")};F.url.indexOf("file://")===0&&(P.status<200||P.status>599)?x.status=200:x.status=P.status,x.url="responseURL"in P?P.responseURL:x.headers.get("X-Request-URL");var G="response"in P?P.response:P.responseText;setTimeout(function(){R(new f(G,x))},0)},P.onerror=function(){setTimeout(function(){M(new TypeError("Network request failed"))},0)},P.ontimeout=function(){setTimeout(function(){M(new TypeError("Network request timed out"))},0)},P.onabort=function(){setTimeout(function(){M(new t.DOMException("Aborted","AbortError"))},0)};function Z(x){try{return x===""&&s.location.href?s.location.href:x}catch{return x}}if(P.open(F.method,Z(F.url),!0),F.credentials==="include"?P.withCredentials=!0:F.credentials==="omit"&&(P.withCredentials=!1),"responseType"in P&&(i.blob?P.responseType="blob":i.arrayBuffer&&(P.responseType="arraybuffer")),g&&typeof g.headers=="object"&&!(g.headers instanceof y||s.Headers&&g.headers instanceof s.Headers)){var oe=[];Object.getOwnPropertyNames(g.headers).forEach(function(x){oe.push(a(x)),P.setRequestHeader(x,d(g.headers[x]))}),F.headers.forEach(function(x,G){oe.indexOf(G)===-1&&P.setRequestHeader(G,x)})}else F.headers.forEach(function(x,G){P.setRequestHeader(G,x)});F.signal&&(F.signal.addEventListener("abort",J),P.onreadystatechange=function(){P.readyState===4&&F.signal.removeEventListener("abort",J)}),P.send(typeof F._bodyInit>"u"?null:F._bodyInit)})}return L.polyfill=!0,s.fetch||(s.fetch=L,s.Headers=y,s.Request=u,s.Response=f),t.Headers=y,t.Request=u,t.Response=f,t.fetch=L,Object.defineProperty(t,"__esModule",{value:!0}),t}({})})(et);et.fetch.ponyfill=!0;delete et.fetch.polyfill;var _e=Ze.fetch?Ze:et;ce=_e.fetch;ce.default=_e.fetch;ce.fetch=_e.fetch;ce.Headers=_e.Headers;ce.Request=_e.Request;ce.Response=_e.Response;Ps.exports=ce});var Bt=ae((bl,Ds)=>{function U(){}U.prototype.clear=function(){this._root=null,this.size=0};U.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};U.prototype.findIter=function(r){for(var e=this._root,t=this.iterator();e!==null;){var s=this._comparator(r,e.data);if(s===0)return t._cursor=e,t;t._ancestors.push(e),e=e.get_child(s>0)}return null};U.prototype.lowerBound=function(r){for(var e=this._root,t=this.iterator(),s=this._comparator;e!==null;){var i=s(r,e.data);if(i===0)return t._cursor=e,t;t._ancestors.push(e),e=e.get_child(i>0)}for(var n=t._ancestors.length-1;n>=0;--n)if(e=t._ancestors[n],s(r,e.data)<0)return t._cursor=e,t._ancestors.length=n,t;return t._ancestors.length=0,t};U.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};U.prototype.min=function(){var r=this._root;if(r===null)return null;for(;r.left!==null;)r=r.left;return r.data};U.prototype.max=function(){var r=this._root;if(r===null)return null;for(;r.right!==null;)r=r.right;return r.data};U.prototype.iterator=function(){return new Ee(this)};U.prototype.each=function(r){for(var e=this.iterator(),t;(t=e.next())!==null;)if(r(t)===!1)return};U.prototype.reach=function(r){for(var e=this.iterator(),t;(t=e.prev())!==null;)if(r(t)===!1)return};function Ee(r){this._tree=r,this._ancestors=[],this._cursor=null}Ee.prototype.data=function(){return this._cursor!==null?this._cursor.data:null};Ee.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};Ee.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};Ee.prototype._minNode=function(r){for(;r.left!==null;)this._ancestors.push(r),r=r.left;this._cursor=r};Ee.prototype._maxNode=function(r){for(;r.right!==null;)this._ancestors.push(r),r=r.right;this._cursor=r};Ds.exports=U});var js=ae((wl,$s)=>{var Hn=Bt();function Se(r){this.data=r,this.left=null,this.right=null,this.red=!0}Se.prototype.get_child=function(r){return r?this.right:this.left};Se.prototype.set_child=function(r,e){r?this.right=e:this.left=e};function tt(r){this._root=null,this._comparator=r,this.size=0}tt.prototype=new Hn;tt.prototype.insert=function(r){var e=!1;if(this._root===null)this._root=new Se(r),e=!0,this.size++;else{var t=new Se(void 0),s=0,i=0,n=null,o=t,c=null,a=this._root;for(o.right=this._root;;){if(a===null?(a=new Se(r),c.set_child(s,a),e=!0,this.size++):H(a.left)&&H(a.right)&&(a.red=!0,a.left.red=!1,a.right.red=!1),H(a)&&H(c)){var d=o.right===n;a===c.get_child(i)?o.set_child(d,Ne(n,!i)):o.set_child(d,qs(n,!i))}var v=this._comparator(a.data,r);if(v===0)break;i=s,s=v<0,n!==null&&(o=n),n=c,c=a,a=a.get_child(s)}this._root=t.right}return this._root.red=!1,e};tt.prototype.remove=function(r){if(this._root===null)return!1;var e=new Se(void 0),t=e;t.right=this._root;for(var s=null,i=null,n=null,o=1;t.get_child(o)!==null;){var c=o;i=s,s=t,t=t.get_child(o);var a=this._comparator(r,t.data);if(o=a>0,a===0&&(n=t),!H(t)&&!H(t.get_child(o))){if(H(t.get_child(!o))){var d=Ne(t,o);s.set_child(c,d),s=d}else if(!H(t.get_child(!o))){var v=s.get_child(!c);if(v!==null)if(!H(v.get_child(!c))&&!H(v.get_child(c)))s.red=!1,v.red=!0,t.red=!0;else{var y=i.right===s;H(v.get_child(c))?i.set_child(y,qs(s,c)):H(v.get_child(!c))&&i.set_child(y,Ne(s,c));var _=i.get_child(y);_.red=!0,t.red=!0,_.left.red=!1,_.right.red=!1}}}}return n!==null&&(n.data=t.data,s.set_child(s.right===t,t.get_child(t.left===null)),this.size--),this._root=e.right,this._root!==null&&(this._root.red=!1),n!==null};function H(r){return r!==null&&r.red}function Ne(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 qs(r,e){return r.set_child(!e,Ne(r.get_child(!e),!e)),Ne(r,e)}$s.exports=tt});var Vs=ae((_l,Hs)=>{var Vn=Bt();function Ie(r){this.data=r,this.left=null,this.right=null}Ie.prototype.get_child=function(r){return r?this.right:this.left};Ie.prototype.set_child=function(r,e){r?this.right=e:this.left=e};function rt(r){this._root=null,this._comparator=r,this.size=0}rt.prototype=new Vn;rt.prototype.insert=function(r){if(this._root===null)return this._root=new Ie(r),this.size++,!0;for(var e=0,t=null,s=this._root;;){if(s===null)return s=new Ie(r),t.set_child(e,s),ret=!0,this.size++,!0;if(this._comparator(s.data,r)===0)return!1;e=this._comparator(s.data,r)<0,t=s,s=s.get_child(e)}};rt.prototype.remove=function(r){if(this._root===null)return!1;var e=new Ie(void 0),t=e;t.right=this._root;for(var s=null,i=null,n=1;t.get_child(n)!==null;){s=t,t=t.get_child(n);var o=this._comparator(r,t.data);n=o>0,o===0&&(i=t)}return i!==null?(i.data=t.data,s.set_child(s.right===t,t.get_child(t.left===null)),this._root=e.right,this.size--,!0):!1};Hs.exports=rt});var Ws=ae((El,Us)=>{Us.exports={RBTree:js(),BinTree:Vs()}});var Js=ae((Sl,zs)=>{var Un=Ws().RBTree;function N(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 Un(Ks),this.nreset=0,this.reset()}N.prototype.reset=function(){this.centroids.clear(),this.n=0,this.nreset+=1,this.last_cumulate=0};N.prototype.size=function(){return this.centroids.size};N.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};N.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 Ks(r,e){return r.mean>e.mean?1:r.mean<e.mean?-1:0}function Wn(r,e){return r.mean_cumn-e.mean_cumn}N.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)};N.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)};N.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}};N.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 s=e.prev();return s&&Math.abs(s.mean-r)<Math.abs(t.mean-r)?s:t};N.prototype._new_centroid=function(r,e,t){var s={mean:r,n:e,cumn:t};return this.centroids.insert(s),this.n+=e,s};N.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};N.prototype._digest=function(r,e){var t=this.centroids.min(),s=this.centroids.max(),i=this.find_nearest(r);if(i&&i.mean===r)this._addweight(i,r,e);else if(i===t)this._new_centroid(r,e,0);else if(i===s)this._new_centroid(r,e,this.n);else if(this.discrete)this._new_centroid(r,e,i.cumn);else{var n=i.mean_cumn/this.n,o=Math.floor(4*this.n*this.delta*n*(1-n));o-i.n>=e?this._addweight(i,r,e):this._new_centroid(r,e,i.cumn)}this._cumulate(!1),!this.discrete&&this.K&&this.size()>this.K/this.delta&&this.compress()};N.prototype.bound_mean=function(r){var e=this.centroids.upperBound({mean:r}),t=e.prev(),s=t.mean===r?t:e.next();return[t,s]};N.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]};N.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],s=e[1];if(this.discrete)return t.cumn/this.n;var i=t.mean_cumn;return t!==s&&(i+=(r-t.mean)*(s.mean_cumn-t.mean_cumn)/(s.mean-t.mean)),i/this.n}};N.prototype.bound_mean_cumn=function(r){this.centroids._comparator=Wn;var e=this.centroids.upperBound({mean_cumn:r});this.centroids._comparator=Ks;var t=e.prev(),s=t&&t.mean_cumn===r?t:e.next();return[t,s]};N.prototype.percentile=function(r){var e=Array.isArray(r)?r:[r],t=e.map(this._percentile,this);return Array.isArray(r)?t:t[0]};N.prototype._percentile=function(r){if(this.size()!==0){this._cumulate(!0);var e=this.n*r,t=this.bound_mean_cumn(e),s=t[0],i=t[1];return i===s||s===null||i===null?(s||i).mean:this.discrete?e<=s.cumn?s.mean:i.mean:s.mean+(e-s.mean_cumn)*(i.mean-s.mean)/(i.mean_cumn-s.mean_cumn)}};function Kn(r){var e=Math.floor(Math.random()*r.length);return r.splice(e,1)[0]}N.prototype.compress=function(){if(!this.compressing){var r=this.toArray();for(this.reset(),this.compressing=!0;r.length>0;)this.push_centroid(Kn(r));this._cumulate(!0),this.compressing=!1}};function le(r){this.config=r||{},this.mode=this.config.mode||"auto",N.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}le.prototype=Object.create(N.prototype);le.prototype.constructor=le;le.prototype.push=function(r){N.prototype.push.call(this,r),this.check_continuous()};le.prototype._new_centroid=function(r,e,t){this.n_unique+=1,N.prototype._new_centroid.call(this,r,e,t)};le.prototype._addweight=function(r,e,t){r.n===1&&(this.n_unique-=1),N.prototype._addweight.call(this,r,e,t)};le.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};zs.exports={TDigest:N,Digest:le}});var mn={};Sn(mn,{debouncedSearch:()=>Vc,destroy:()=>$c,filters:()=>Wc,init:()=>qc,mergeIndex:()=>jc,options:()=>Dc,preload:()=>Uc,search:()=>Hc});function Fc(r,e){return Lc(r.subarray(Mc(r),-8),e||new j(Pc(r)))}var bc,es,j,be,nn,on,an,wc,cn,ln,hn,_c,un,Ec,Eh,Yr,ie,C,Je,Ge,C,C,C,C,dn,C,Sc,Ac,Xr,z,Qr,Tc,Oc,kc,ne,Lc,Rc,Mc,Pc,Cc,xc,Nc,fn,pn,Ic,Zr,sn,Bc,Y,ts,Fe,Dc,qc,$c,jc,Hc,Vc,Uc,Wc,gn=En(()=>{bc="1.1.0";(function(){let r={},e;typeof document<"u"&&document.currentScript!==null&&(e=new URL("UNHANDLED",location.href).toString());let t,s=null;function i(){return(s===null||s.byteLength===0)&&(s=new Uint8Array(t.memory.buffer)),s}let n=0;function o(h,u){let m=u(h.length*1,1)>>>0;return i().set(h,m/1),n=h.length,m}r.init_pagefind=function(h){let u=o(h,t.__wbindgen_malloc),m=n;return t.init_pagefind(u,m)>>>0};let c=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},a=typeof c.encodeInto=="function"?function(h,u){return c.encodeInto(h,u)}:function(h,u){let m=c.encode(h);return u.set(m),{read:h.length,written:m.length}};function d(h,u,m){if(m===void 0){let l=c.encode(h),g=u(l.length,1)>>>0;return i().subarray(g,g+l.length).set(l),n=l.length,g}let p=h.length,f=u(p,1)>>>0,A=i(),L=0;for(;L<p;L++){let l=h.charCodeAt(L);if(l>127)break;A[f+L]=l}if(L!==p){L!==0&&(h=h.slice(L)),f=m(f,p,p=L+h.length*3,1)>>>0;let l=i().subarray(f+L,f+p),g=a(h,l);L+=g.written,f=m(f,p,L,1)>>>0}return n=L,f}r.set_ranking_weights=function(h,u){let m=d(u,t.__wbindgen_malloc,t.__wbindgen_realloc),p=n;return t.set_ranking_weights(h,m,p)>>>0},r.load_index_chunk=function(h,u){let m=o(u,t.__wbindgen_malloc),p=n;return t.load_index_chunk(h,m,p)>>>0},r.load_filter_chunk=function(h,u){let m=o(u,t.__wbindgen_malloc),p=n;return t.load_filter_chunk(h,m,p)>>>0},r.add_synthetic_filter=function(h,u){let m=d(u,t.__wbindgen_malloc,t.__wbindgen_realloc),p=n;return t.add_synthetic_filter(h,m,p)>>>0};let v=null;function y(){return(v===null||v.byteLength===0)&&(v=new Int32Array(t.memory.buffer)),v}let _=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&_.decode();function E(h,u){return h=h>>>0,_.decode(i().subarray(h,h+u))}r.request_indexes=function(h,u){let m,p;try{let L=t.__wbindgen_add_to_stack_pointer(-16),l=d(u,t.__wbindgen_malloc,t.__wbindgen_realloc),g=n;t.request_indexes(L,h,l,g);var f=y()[L/4+0],A=y()[L/4+1];return m=f,p=A,E(f,A)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_free(m,p,1)}},r.request_filter_indexes=function(h,u){let m,p;try{let L=t.__wbindgen_add_to_stack_pointer(-16),l=d(u,t.__wbindgen_malloc,t.__wbindgen_realloc),g=n;t.request_filter_indexes(L,h,l,g);var f=y()[L/4+0],A=y()[L/4+1];return m=f,p=A,E(f,A)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_free(m,p,1)}},r.request_all_filter_indexes=function(h){let u,m;try{let A=t.__wbindgen_add_to_stack_pointer(-16);t.request_all_filter_indexes(A,h);var p=y()[A/4+0],f=y()[A/4+1];return u=p,m=f,E(p,f)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_free(u,m,1)}},r.filters=function(h){let u,m;try{let A=t.__wbindgen_add_to_stack_pointer(-16);t.filters(A,h);var p=y()[A/4+0],f=y()[A/4+1];return u=p,m=f,E(p,f)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_free(u,m,1)}},r.search=function(h,u,m,p,f){let A,L;try{let R=t.__wbindgen_add_to_stack_pointer(-16),M=d(u,t.__wbindgen_malloc,t.__wbindgen_realloc),F=n,P=d(m,t.__wbindgen_malloc,t.__wbindgen_realloc),J=n,Z=d(p,t.__wbindgen_malloc,t.__wbindgen_realloc),oe=n;t.search(R,h,M,F,P,J,Z,oe,f);var l=y()[R/4+0],g=y()[R/4+1];return A=l,L=g,E(l,g)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_free(A,L,1)}};async function S(h,u){if(typeof Response=="function"&&h instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(h,u)}catch(p){if(h.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",p);else throw p}let m=await h.arrayBuffer();return await WebAssembly.instantiate(m,u)}else{let m=await WebAssembly.instantiate(h,u);return m instanceof WebAssembly.Instance?{instance:m,module:h}:m}}function k(){let h={};return h.wbg={},h}function T(h,u){}function O(h,u){return t=h.exports,w.__wbindgen_wasm_module=u,v=null,s=null,t}function b(h){if(t!==void 0)return t;let u=k();h instanceof WebAssembly.Module||(h=new WebAssembly.Module(h));let m=new WebAssembly.Instance(h,u);return O(m,h)}async function w(h){if(t!==void 0)return t;typeof h>"u"&&typeof e<"u"&&(h=e.replace(/\.js$/,"_bg.wasm"));let u=k();(typeof h=="string"||typeof Request=="function"&&h instanceof Request||typeof URL=="function"&&h instanceof URL)&&(h=fetch(h));let{instance:m,module:p}=await S(await h,u);return O(m,p)}es=Object.assign(w,{initSync:b},r)})();j=Uint8Array,be=Uint16Array,nn=Uint32Array,on=new j([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),an=new j([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),wc=new j([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),cn=function(r,e){for(var t=new be(31),s=0;s<31;++s)t[s]=e+=1<<r[s-1];for(var i=new nn(t[30]),s=1;s<30;++s)for(var n=t[s];n<t[s+1];++n)i[n]=n-t[s]<<5|s;return[t,i]},ln=cn(on,2),hn=ln[0],_c=ln[1];hn[28]=258,_c[258]=28;un=cn(an,0),Ec=un[0],Eh=un[1],Yr=new be(32768);for(C=0;C<32768;++C)ie=(C&43690)>>>1|(C&21845)<<1,ie=(ie&52428)>>>2|(ie&13107)<<2,ie=(ie&61680)>>>4|(ie&3855)<<4,Yr[C]=((ie&65280)>>>8|(ie&255)<<8)>>>1;Je=function(r,e,t){for(var s=r.length,i=0,n=new be(e);i<s;++i)r[i]&&++n[r[i]-1];var o=new be(e);for(i=0;i<e;++i)o[i]=o[i-1]+n[i-1]<<1;var c;if(t){c=new be(1<<e);var a=15-e;for(i=0;i<s;++i)if(r[i])for(var d=i<<4|r[i],v=e-r[i],y=o[r[i]-1]++<<v,_=y|(1<<v)-1;y<=_;++y)c[Yr[y]>>>a]=d}else for(c=new be(s),i=0;i<s;++i)r[i]&&(c[i]=Yr[o[r[i]-1]++]>>>15-r[i]);return c},Ge=new j(288);for(C=0;C<144;++C)Ge[C]=8;for(C=144;C<256;++C)Ge[C]=9;for(C=256;C<280;++C)Ge[C]=7;for(C=280;C<288;++C)Ge[C]=8;dn=new j(32);for(C=0;C<32;++C)dn[C]=5;Sc=Je(Ge,9,1),Ac=Je(dn,5,1),Xr=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},z=function(r,e,t){var s=e/8|0;return(r[s]|r[s+1]<<8)>>(e&7)&t},Qr=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},Tc=function(r){return(r+7)/8|0},Oc=function(r,e,t){(e==null||e<0)&&(e=0),(t==null||t>r.length)&&(t=r.length);var s=new(r.BYTES_PER_ELEMENT==2?be:r.BYTES_PER_ELEMENT==4?nn:j)(t-e);return s.set(r.subarray(e,t)),s},kc=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ne=function(r,e,t){var s=new Error(e||kc[r]);if(s.code=r,Error.captureStackTrace&&Error.captureStackTrace(s,ne),!t)throw s;return s},Lc=function(r,e,t){var s=r.length;if(!s||t&&t.f&&!t.l)return e||new j(0);var i=!e||t,n=!t||t.i;t||(t={}),e||(e=new j(s*3));var o=function(ss){var is=e.length;if(ss>is){var ns=new j(Math.max(is*2,ss));ns.set(e),e=ns}},c=t.f||0,a=t.p||0,d=t.b||0,v=t.l,y=t.d,_=t.m,E=t.n,S=s*8;do{if(!v){c=z(r,a,1);var k=z(r,a+1,3);if(a+=3,k)if(k==1)v=Sc,y=Ac,_=9,E=5;else if(k==2){var w=z(r,a,31)+257,h=z(r,a+10,15)+4,u=w+z(r,a+5,31)+1;a+=14;for(var m=new j(u),p=new j(19),f=0;f<h;++f)p[wc[f]]=z(r,a+f*3,7);a+=h*3;for(var A=Xr(p),L=(1<<A)-1,l=Je(p,A,1),f=0;f<u;){var g=l[z(r,a,L)];a+=g&15;var T=g>>>4;if(T<16)m[f++]=T;else{var R=0,M=0;for(T==16?(M=3+z(r,a,3),a+=2,R=m[f-1]):T==17?(M=3+z(r,a,7),a+=3):T==18&&(M=11+z(r,a,127),a+=7);M--;)m[f++]=R}}var F=m.subarray(0,w),P=m.subarray(w);_=Xr(F),E=Xr(P),v=Je(F,_,1),y=Je(P,E,1)}else ne(1);else{var T=Tc(a)+4,O=r[T-4]|r[T-3]<<8,b=T+O;if(b>s){n&&ne(0);break}i&&o(d+O),e.set(r.subarray(T,b),d),t.b=d+=O,t.p=a=b*8,t.f=c;continue}if(a>S){n&&ne(0);break}}i&&o(d+131072);for(var J=(1<<_)-1,Z=(1<<E)-1,oe=a;;oe=a){var R=v[Qr(r,a)&J],x=R>>>4;if(a+=R&15,a>S){n&&ne(0);break}if(R||ne(2),x<256)e[d++]=x;else if(x==256){oe=a,v=null;break}else{var G=x-254;if(x>264){var f=x-257,Ce=on[f];G=z(r,a,(1<<Ce)-1)+hn[f],a+=Ce}var Mt=y[Qr(r,a)&Z],Pt=Mt>>>4;Mt||ne(3),a+=Mt&15;var P=Ec[Pt];if(Pt>3){var Ce=an[Pt];P+=Qr(r,a)&(1<<Ce)-1,a+=Ce}if(a>S){n&&ne(0);break}i&&o(d+131072);for(var rs=d+G;d<rs;d+=4)e[d]=e[d-P],e[d+1]=e[d+1-P],e[d+2]=e[d+2-P],e[d+3]=e[d+3-P];d=rs}}t.l=v,t.p=oe,t.b=d,t.f=c,v&&(c=1,t.m=_,t.d=y,t.n=E)}while(!c);return d==e.length?e:Oc(e,0,d)},Rc=new j(0),Mc=function(r){(r[0]!=31||r[1]!=139||r[2]!=8)&&ne(6,"invalid gzip data");var e=r[3],t=10;e&4&&(t+=r[10]|(r[11]<<8)+2);for(var s=(e>>3&1)+(e>>4&1);s>0;s-=!r[t++]);return t+(e&2)},Pc=function(r){var e=r.length;return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0};Cc=typeof TextDecoder<"u"&&new TextDecoder,xc=0;try{Cc.decode(Rc,{stream:!0}),xc=1}catch{}Nc=Fc,fn=(r,e)=>{if(r.length===0)return 0;let t=[];for(let c of r)t[c.location]=t[c.location]||0,t[c.location]+=c.balanced_score;if(t.length<=e)return 0;let s=t.slice(0,e).reduce((c,a)=>c+a,0),i=s,n=[0];for(let c=0;c<t.length;c++){let a=c+e;i+=(t[a]??0)-(t[c]??0),i>s?(s=i,n=[c]):i===s&&n[n.length-1]===c-1&&n.push(c)}return n[Math.floor(n.length/2)]},pn=(r,e,t,s,i,n)=>{let o=r.includes("\u200B"),c=[];o?c=r.split("\u200B"):c=r.split(/[\r\n\s]+/g);for(let v of s)c[v]?.startsWith("<mark>")||(c[v]=`<mark>${c[v]}</mark>`);let a=n??c.length,d=i??0;return a-d<t&&(t=a-d),e+t>a&&(e=a-t),e<d&&(e=d),c.slice(e,e+t).join(o?"":" ").trim()},Ic=(r,e)=>{let t=r.anchors.filter(c=>/h\d/i.test(c.element)&&c.text?.length&&/\S/.test(c.text)).sort((c,a)=>c.location-a.location),s=[],i=0,n={title:r.meta.title,url:r.url,weighted_locations:[],locations:[],excerpt:""},o=c=>{if(n.locations.length){let a=n.weighted_locations.map(y=>({weight:y.weight,balanced_score:y.balanced_score,location:y.location-i})),d=fn(a,e)+i,v=c?Math.min(c-d,e):e;n.excerpt=pn(r.raw_content??"",d,v,n.locations,i,c),s.push(n)}};for(let c of r.weighted_locations)if(!t.length||c.location<t[0].location)n.weighted_locations.push(c),n.locations.push(c.location);else{let a=t.shift();for(o(a.location);t.length&&c.location>=t[0].location;)a=t.shift();let d=r.url;try{if(/^((https?:)?\/\/)/.test(d)){let y=new URL(d);y.hash=a.id,d=y.toString()}else{/^\//.test(d)||(d=`/${d}`);let y=new URL(`https://example.com${d}`);y.hash=a.id,d=y.toString().replace(/^https:\/\/example.com/,"")}}catch{console.error(`Pagefind: Couldn't process ${d} for a search result`)}i=a.location,n={title:a.text,url:d,anchor:a,weighted_locations:[c],locations:[c.location],excerpt:""}}return o(t[0]?.location),s},Zr=async(r=100)=>new Promise(e=>setTimeout(e,r)),sn=class{constructor(r={}){this.version=bc,this.backend=es,this.decoder=new TextDecoder("utf-8"),this.wasm=null,this.basePath=r.basePath||"/pagefind/",this.primary=r.primary||!1,this.primary&&!r.basePath&&this.initPrimary(),/[^\/]$/.test(this.basePath)&&(this.basePath=`${this.basePath}/`),window?.location?.origin&&this.basePath.startsWith(window.location.origin)&&(this.basePath=this.basePath.replace(window.location.origin,"")),this.baseUrl=r.baseUrl||this.defaultBaseUrl(),/^(\/|https?:\/\/)/.test(this.baseUrl)||(this.baseUrl=`/${this.baseUrl}`),this.indexWeight=r.indexWeight??1,this.excerptLength=r.excerptLength??30,this.mergeFilter=r.mergeFilter??{},this.ranking=r.ranking,this.highlightParam=r.highlightParam??null,this.loaded_chunks={},this.loaded_filters={},this.loaded_fragments={},this.raw_ptr=null,this.searchMeta=null,this.languages=null}initPrimary(){let r=null;r?this.basePath=r:console.warn(["Pagefind couldn't determine the base of the bundle from the import path. Falling back to the default.","Set a basePath option when initialising Pagefind to ignore this message."].join(`
|
12
|
+
`))}defaultBaseUrl(){return this.basePath.match(/^(.*\/)_?pagefind/)?.[1]||"/"}async options(r){let e=["basePath","baseUrl","indexWeight","excerptLength","mergeFilter","highlightParam","ranking"];for(let[t,s]of Object.entries(r))if(t==="mergeFilter"){let i=this.stringifyFilters(s),n=await this.getPtr();this.raw_ptr=this.backend.add_synthetic_filter(n,i)}else t==="ranking"?await this.set_ranking(r.ranking):e.includes(t)?(t==="basePath"&&typeof s=="string"&&(this.basePath=s),t==="baseUrl"&&typeof s=="string"&&(this.baseUrl=s),t==="indexWeight"&&typeof s=="number"&&(this.indexWeight=s),t==="excerptLength"&&typeof s=="number"&&(this.excerptLength=s),t==="mergeFilter"&&typeof s=="object"&&(this.mergeFilter=s),t==="highlightParam"&&typeof s=="string"&&(this.highlightParam=s)):console.warn(`Unknown Pagefind option ${t}. Allowed options: [${e.join(", ")}]`)}decompress(r,e="unknown file"){return this.decoder.decode(r.slice(0,12))==="pagefind_dcd"?r.slice(12):(r=Nc(r),this.decoder.decode(r.slice(0,12))!=="pagefind_dcd"?(console.error(`Decompressing ${e} appears to have failed: Missing signature`),r):r.slice(12))}async set_ranking(r){if(!r)return;let e={term_similarity:r.termSimilarity??null,page_length:r.pageLength??null,term_saturation:r.termSaturation??null,term_frequency:r.termFrequency??null},t=await this.getPtr();this.raw_ptr=this.backend.set_ranking_weights(t,JSON.stringify(e))}async init(r,e){await this.loadEntry();let t=this.findIndex(r),s=t.wasm?t.wasm:"unknown",i=[this.loadMeta(t.hash)];if(e.load_wasm===!0&&i.push(this.loadWasm(s)),await Promise.all(i),this.raw_ptr=this.backend.init_pagefind(new Uint8Array(this.searchMeta)),Object.keys(this.mergeFilter)?.length){let n=this.stringifyFilters(this.mergeFilter),o=await this.getPtr();this.raw_ptr=this.backend.add_synthetic_filter(o,n)}this.ranking&&await this.set_ranking(this.ranking)}async loadEntry(){try{let e=await(await fetch(`${this.basePath}pagefind-entry.json?ts=${Date.now()}`)).json();this.languages=e.languages,e.version!==this.version&&(this.primary?console.warn(["Pagefind JS version doesn't match the version in your search index.",`Pagefind JS: ${this.version}. Pagefind index: ${e.version}`,"If you upgraded Pagefind recently, you likely have a cached pagefind.js file.","If you encounter any search errors, try clearing your cache."].join(`
|
13
|
+
`)):console.warn(["Merging a Pagefind index from a different version than the main Pagefind instance.",`Main Pagefind JS: ${this.version}. Merged index (${this.basePath}): ${e.version}`,"If you encounter any search errors, make sure that both sites are running the same version of Pagefind."].join(`
|
14
|
+
`)))}catch(r){throw console.error(`Failed to load Pagefind metadata:
|
15
|
+
${r?.toString()}`),new Error("Failed to load Pagefind metadata")}}findIndex(r){if(this.languages){let e=this.languages[r];if(e||(e=this.languages[r.split("-")[0]],e))return e;let t=Object.values(this.languages).sort((s,i)=>i.page_count-s.page_count);if(t[0])return t[0]}throw new Error("Pagefind Error: No language indexes found.")}async loadMeta(r){try{let t=await(await fetch(`${this.basePath}pagefind.${r}.pf_meta`)).arrayBuffer();this.searchMeta=this.decompress(new Uint8Array(t),"Pagefind metadata")}catch(e){console.error(`Failed to load the meta index:
|
16
|
+
${e?.toString()}`)}}async loadWasm(r){try{let e=`${this.basePath}wasm.${r}.pagefind`,s=await(await fetch(e)).arrayBuffer(),i=this.decompress(new Uint8Array(s),"Pagefind WebAssembly");if(!i)throw new Error("No WASM after decompression");this.wasm=await this.backend(i)}catch(e){throw console.error(`Failed to load the Pagefind WASM:
|
17
|
+
${e?.toString()}`),new Error(`Failed to load the Pagefind WASM:
|
18
|
+
${e?.toString()}`)}}async _loadGenericChunk(r,e){try{let s=await(await fetch(r)).arrayBuffer(),i=this.decompress(new Uint8Array(s),r),n=await this.getPtr();this.raw_ptr=this.backend[e](n,i)}catch(t){console.error(`Failed to load the index chunk ${r}:
|
19
|
+
${t?.toString()}`)}}async loadChunk(r){if(!this.loaded_chunks[r]){let e=`${this.basePath}index/${r}.pf_index`;this.loaded_chunks[r]=this._loadGenericChunk(e,"load_index_chunk")}return await this.loaded_chunks[r]}async loadFilterChunk(r){if(!this.loaded_filters[r]){let e=`${this.basePath}filter/${r}.pf_filter`;this.loaded_filters[r]=this._loadGenericChunk(e,"load_filter_chunk")}return await this.loaded_filters[r]}async _loadFragment(r){let t=await(await fetch(`${this.basePath}fragment/${r}.pf_fragment`)).arrayBuffer(),s=this.decompress(new Uint8Array(t),`Fragment ${r}`);return JSON.parse(new TextDecoder().decode(s))}async loadFragment(r,e=[],t){this.loaded_fragments[r]||(this.loaded_fragments[r]=this._loadFragment(r));let s=await this.loaded_fragments[r];s.weighted_locations=e,s.locations=e.map(n=>n.location),s.raw_content||(s.raw_content=s.content.replace(/</g,"<").replace(/>/g,">"),s.content=s.content.replace(/\u200B/g,"")),s.raw_url||(s.raw_url=s.url),s.url=this.processedUrl(s.raw_url,t);let i=fn(e,this.excerptLength);return s.excerpt=pn(s.raw_content,i,this.excerptLength,s.locations),s.sub_results=Ic(s,this.excerptLength),s}fullUrl(r){return/^(https?:)?\/\//.test(r)?r:`${this.baseUrl}/${r}`.replace(/\/+/g,"/").replace(/^(https?:\/)/,"$1/")}processedUrl(r,e){let t=this.fullUrl(r);if(this.highlightParam===null)return t;let s=e.split(/\s+/);try{let i=new URL(t);for(let n of s)i.searchParams.append(this.highlightParam,n);return i.toString()}catch{try{let n=new URL(`https://example.com${t}`);for(let o of s)n.searchParams.append(this.highlightParam,o);return n.toString().replace(/^https:\/\/example\.com/,"")}catch{return t}}}async getPtr(){for(;this.raw_ptr===null;)await Zr(50);if(!this.raw_ptr)throw console.error("Pagefind: WASM Error (No pointer)"),new Error("Pagefind: WASM Error (No pointer)");return this.raw_ptr}parseFilters(r){let e={};if(!r)return e;for(let t of r.split("__PF_FILTER_DELIM__")){let[s,i]=t.split(/:(.*)$/);if(e[s]={},i){for(let n of i.split("__PF_VALUE_DELIM__"))if(n){let o=n.match(/^(.*):(\d+)$/);if(o){let[,c,a]=o;e[s][c]=parseInt(a)??a}}}}return e}stringifyFilters(r={}){return JSON.stringify(r)}stringifySorts(r={}){let e=Object.entries(r);for(let[t,s]of e)return e.length>1&&console.warn(`Pagefind was provided multiple sort options in this search, but can only operate on one. Using the ${t} sort.`),s!=="asc"&&s!=="desc"&&console.warn(`Pagefind was provided a sort with unknown direction ${s}. Supported: [asc, desc]`),`${t}:${s}`;return""}async filters(){let r=await this.getPtr(),t=this.backend.request_all_filter_indexes(r).split(" ").filter(i=>i).map(i=>this.loadFilterChunk(i));await Promise.all([...t]),r=await this.getPtr();let s=this.backend.filters(r);return this.parseFilters(s)}async preload(r,e={}){await this.search(r,{...e,preload:!0})}async search(r,e={}){e={verbose:!1,filters:{},sort:{},...e};let t=A=>{e.verbose&&console.log(A)};t(`Starting search on ${this.basePath}`);let s=Date.now(),i=await this.getPtr(),n=r===null;r=r??"";let o=/^\s*".+"\s*$/.test(r);if(o&&t("Running an exact search"),r=r.toLowerCase().trim().replace(/[\.`~!@#\$%\^&\*\(\)\{\}\[\]\\\|:;'",<>\/\?\-]/g,"").replace(/\s{2,}/g," ").trim(),t(`Normalized search term to ${r}`),!r?.length&&!n)return{results:[],unfilteredResultCount:0,filters:{},totalFilters:{},timings:{preload:Date.now()-s,search:Date.now()-s,total:Date.now()-s}};let c=this.stringifySorts(e.sort);t(`Stringified sort to ${c}`);let a=this.stringifyFilters(e.filters);t(`Stringified filters to ${a}`);let d=this.backend.request_indexes(i,r),v=this.backend.request_filter_indexes(i,a),y=d.split(" ").filter(A=>A).map(A=>this.loadChunk(A)),_=v.split(" ").filter(A=>A).map(A=>this.loadFilterChunk(A));if(await Promise.all([...y,..._]),t("Loaded necessary chunks to run search"),e.preload)return t("Preload \u2014 bailing out of search operation now."),null;i=await this.getPtr();let E=Date.now(),S=this.backend.search(i,r,a,c,o);t(`Got the raw search result: ${S}`);let[k,T,O,b]=S.split(/:([^:]*):(.*)__PF_UNFILTERED_DELIM__(.*)$/),w=this.parseFilters(O),h=this.parseFilters(b);t(`Remaining filters: ${JSON.stringify(S)}`);let u=T.length?T.split(" "):[],m=u.map(A=>{let[L,l,g]=A.split("@");t(`Processing result:
|
20
|
+
hash:${L}
|
21
|
+
score:${l}
|
22
|
+
locations:${g}`);let R=g.length?g.split(",").map(F=>{let[P,J,Z]=F.split(">");return{weight:parseInt(P)/24,balanced_score:parseFloat(J),location:parseInt(Z)}}):[],M=R.map(F=>F.location);return{id:L,score:parseFloat(l)*this.indexWeight,words:M,data:async()=>await this.loadFragment(L,R,r)}}),p=Date.now()-E,f=Date.now()-s;return t(`Found ${u.length} result${u.length==1?"":"s"} for "${r}" in ${Date.now()-E}ms (${Date.now()-s}ms realtime)`),{results:m,unfilteredResultCount:parseInt(k),filters:w,totalFilters:h,timings:{preload:f-p,search:p,total:f}}}},Bc=class{constructor(r={}){this.backend=es,this.primaryLanguage="unknown",this.searchID=0,this.primary=new sn({...r,primary:!0}),this.instances=[this.primary],this.init(r?.language)}async options(r){await this.primary.options(r)}async init(r){if(document?.querySelector){let e=document.querySelector("html")?.getAttribute("lang")||"unknown";this.primaryLanguage=e.toLocaleLowerCase()}await this.primary.init(r||this.primaryLanguage,{load_wasm:!0})}async mergeIndex(r,e={}){if(this.primary.basePath.startsWith(r)){console.warn(`Skipping mergeIndex ${r} that appears to be the same as the primary index (${this.primary.basePath})`);return}let t=new sn({primary:!1,basePath:r});for(this.instances.push(t);this.primary.wasm===null;)await Zr(50);await t.init(e.language||this.primaryLanguage,{load_wasm:!1}),delete e.language,await t.options(e)}mergeFilters(r){let e={};for(let t of r)for(let[s,i]of Object.entries(t))if(e[s]){let n=e[s];for(let[o,c]of Object.entries(i))n[o]=(n[o]||0)+c}else{e[s]=i;continue}return e}async filters(){let r=await Promise.all(this.instances.map(e=>e.filters()));return this.mergeFilters(r)}async preload(r,e={}){await Promise.all(this.instances.map(t=>t.preload(r,e)))}async debouncedSearch(r,e,t){let s=++this.searchID;if(this.preload(r,e),await Zr(t),s!==this.searchID)return null;let i=await this.search(r,e);return s!==this.searchID?null:i}async search(r,e={}){let t=await Promise.all(this.instances.map(a=>a.search(r,e))),s=this.mergeFilters(t.map(a=>a.filters)),i=this.mergeFilters(t.map(a=>a.totalFilters)),n=t.map(a=>a.results).flat().sort((a,d)=>d.score-a.score),o=t.map(a=>a.timings),c=t.reduce((a,d)=>a+d.unfilteredResultCount,0);return{results:n,unfilteredResultCount:c,filters:s,totalFilters:i,timings:o}}},Y=void 0,ts=void 0,Fe=()=>{Y||(Y=new Bc(ts??{}))},Dc=async r=>{Y?await Y.options(r):ts=r},qc=async()=>{Fe()},$c=async()=>{Y=void 0,ts=void 0},jc=async(r,e)=>(Fe(),await Y.mergeIndex(r,e)),Hc=async(r,e)=>(Fe(),await Y.search(r,e)),Vc=async(r,e,t=300)=>(Fe(),await Y.debouncedSearch(r,e,t)),Uc=async(r,e)=>(Fe(),await Y.preload(r,e)),Wc=async()=>(Fe(),await Y.filters())});function Tn(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 cs=Tn;function On(r){var e=this;return new e(function(t,s){if(!(r&&typeof r.length<"u"))return s(new TypeError(typeof r+" "+r+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var i=Array.prototype.slice.call(r);if(i.length===0)return t([]);var n=i.length;function o(a,d){if(d&&(typeof d=="object"||typeof d=="function")){var v=d.then;if(typeof v=="function"){v.call(d,function(y){o(a,y)},function(y){i[a]={status:"rejected",reason:y},--n===0&&t(i)});return}}i[a]={status:"fulfilled",value:d},--n===0&&t(i)}for(var c=0;c<i.length;c++)o(c,i[c])})}var ls=On;function hs(r,e){this.name="AggregateError",this.errors=r,this.message=e||""}hs.prototype=Error.prototype;function kn(r){var e=this;return new e(function(t,s){if(!(r&&typeof r.length<"u"))return s(new TypeError("Promise.any accepts an array"));var i=Array.prototype.slice.call(r);if(i.length===0)return s();for(var n=[],o=0;o<i.length;o++)try{e.resolve(i[o]).then(t).catch(function(c){n.push(c),n.length===i.length&&s(new hs(n,"All promises were rejected"))})}catch(c){s(c)}})}var us=kn;var Ln=setTimeout;function ds(r){return!!(r&&typeof r.length<"u")}function Rn(){}function Mn(r,e){return function(){r.apply(e,arguments)}}function I(r){if(!(this instanceof I))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=[],ps(r,this)}function fs(r,e){for(;r._state===3;)r=r._value;if(r._state===0){r._deferreds.push(e);return}r._handled=!0,I._immediateFn(function(){var t=r._state===1?e.onFulfilled:e.onRejected;if(t===null){(r._state===1?Ft:xe)(e.promise,r._value);return}var s;try{s=t(r._value)}catch(i){xe(e.promise,i);return}Ft(e.promise,s)})}function Ft(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 I){r._state=3,r._value=e,Ct(r);return}else if(typeof t=="function"){ps(Mn(t,e),r);return}}r._state=1,r._value=e,Ct(r)}catch(s){xe(r,s)}}function xe(r,e){r._state=2,r._value=e,Ct(r)}function Ct(r){r._state===2&&r._deferreds.length===0&&I._immediateFn(function(){r._handled||I._unhandledRejectionFn(r._value)});for(var e=0,t=r._deferreds.length;e<t;e++)fs(r,r._deferreds[e]);r._deferreds=null}function Pn(r,e,t){this.onFulfilled=typeof r=="function"?r:null,this.onRejected=typeof e=="function"?e:null,this.promise=t}function ps(r,e){var t=!1;try{r(function(s){t||(t=!0,Ft(e,s))},function(s){t||(t=!0,xe(e,s))})}catch(s){if(t)return;t=!0,xe(e,s)}}I.prototype.catch=function(r){return this.then(null,r)};I.prototype.then=function(r,e){var t=new this.constructor(Rn);return fs(this,new Pn(r,e,t)),t};I.prototype.finally=cs;I.all=function(r){return new I(function(e,t){if(!ds(r))return t(new TypeError("Promise.all accepts an array"));var s=Array.prototype.slice.call(r);if(s.length===0)return e([]);var i=s.length;function n(c,a){try{if(a&&(typeof a=="object"||typeof a=="function")){var d=a.then;if(typeof d=="function"){d.call(a,function(v){n(c,v)},t);return}}s[c]=a,--i===0&&e(s)}catch(v){t(v)}}for(var o=0;o<s.length;o++)n(o,s[o])})};I.any=us;I.allSettled=ls;I.resolve=function(r){return r&&typeof r=="object"&&r.constructor===I?r:new I(function(e){e(r)})};I.reject=function(r){return new I(function(e,t){t(r)})};I.race=function(r){return new I(function(e,t){if(!ds(r))return t(new TypeError("Promise.race accepts an array"));for(var s=0,i=r.length;s<i;s++)I.resolve(r[s]).then(e,t)})};I._immediateFn=typeof setImmediate=="function"&&function(r){setImmediate(r)}||function(r){Ln(r,0)};I._unhandledRejectionFn=function(e){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var X=I;var Fn="[Filtered]",ms=128;function vs(r,e){var t=e===void 0?{}:e,s=t.maxLength,i=s===void 0?64e3:s,n=t.keysBlocklist,o=n===void 0?[]:n;if(r.errors)for(var c=0;c<r.errors.length;c++){var a=new ys({keysBlocklist:o});r.errors[c]=a.truncate(r.errors[c])}for(var d="",v=["context","params","environment","session"],y=0;y<8;y++){for(var _={level:y,keysBlocklist:o},E=0,S=v;E<S.length;E++){var k=S[E],T=r[k];T&&(r[k]=Cn(T,_))}if(d=JSON.stringify(r),d.length<i)return d}var O={json:d.slice(0,Math.floor(i/2))+"..."};v.push("errors");for(var b=0,w=v;b<w.length;b++){var k=w[b],T=r[k];T&&(d=JSON.stringify(T),O[k]=d.length)}var h=new Error("airbrake: notice exceeds max length and can't be truncated");throw h.params=O,h}function Qe(r,e){return r>>e||1}var ys=function(){function r(e){this.maxStringLength=1024,this.maxObjectLength=ms,this.maxArrayLength=ms,this.maxDepth=8,this.keys=[],this.keysBlocklist=[],this.seen=[];var t=e.level||0;this.keysBlocklist=e.keysBlocklist||[],this.maxStringLength=Qe(this.maxStringLength,t),this.maxObjectLength=Qe(this.maxObjectLength,t),this.maxArrayLength=Qe(this.maxArrayLength,t),this.maxDepth=Qe(this.maxDepth,t)}return r.prototype.truncate=function(e,t,s){if(t===void 0&&(t=""),s===void 0&&(s=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 i=xn(e);if(s++,s>this.maxDepth)return"[Truncated "+i+"]";switch(this.keys.push(t),this.seen.push(e),i){case"Array":return this.truncateArray(e,s);case"Object":return this.truncateObject(e,s);default:var n=this.maxDepth;this.maxDepth=0;var o=this.truncateObject(e,s);return o.__type=i,this.maxDepth=n,o}},r.prototype.getPath=function(e){for(var t=this.seen.indexOf(e),s=[this.keys[t]],i=t;i>=0;i--){var n=this.seen[i];n&&gs(n,s[0])===e&&(e=n,s.unshift(this.keys[i]))}return"~"+s.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 s=0,i=[],n=0;n<e.length;n++){var o=e[n];if(i.push(this.truncate(o,n.toString(),t)),s++,s>=this.maxArrayLength)break}return i},r.prototype.truncateObject=function(e,t){t===void 0&&(t=0);var s=0,i={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(Nn(n,this.keysBlocklist)){i[n]=Fn;continue}var o=gs(e,n);if(!(o===void 0||typeof o=="function")&&(i[n]=this.truncate(o,n,t),s++,s>=this.maxObjectLength))break}return i},r}();function Cn(r,e){e===void 0&&(e={});var t=new ys(e);return t.truncate(r)}function gs(r,e){try{return r[e]}catch{return}}function xn(r){var e=Object.prototype.toString.apply(r);return e.slice(8,-1)}function Nn(r,e){for(var t=0,s=e;t<s.length;t++){var i=s[t];if(i===r||i instanceof RegExp&&r.match(i))return!0}return!1}var In=function(){function r(e,t,s){this._dur=0,this._level=0,this._metric=e,this.name=t,this.startTime=s||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 Ye=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 s=this._spans[e];s?s._level++:(s=new In(this,e,t),this._spans[e]=s)},r.prototype.endSpan=function(e,t){var s=this._spans[e];if(!s){console.error("airbrake: span=%s does not exist",e);return}s._level>0?s._level--:(s.end(t),delete this._spans[s.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 bs=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 we=function(){return we=Object.assign||function(r){for(var e,t=1,s=arguments.length;t<s;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},we.apply(this,arguments)},xt=function(){function r(){this._noopMetric=new bs,this._context={},this._historyMaxLen=20,this._history=[]}return r.prototype.clone=function(){var e=new r;return e._context=we({},this._context),e._history=this._history.slice(),e},r.prototype.setContext=function(e){this._context=we(we({},this._context),e)},r.prototype.context=function(){var e=we({},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 Ts=as(Ss()),Bn=typeof console=="object"&&console.warn;function As(r){try{return Ts.default.parse(r)}catch(e){Bn&&r.stack&&console.warn("ErrorStackParser:",e.toString(),r.stack)}return r.fileName?[r]:[]}function Os(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=As(r);if(t.length===0)try{throw new Error("fake")}catch(a){t=As(a),t.shift(),t.shift()}for(var s=0,i=t;s<i.length;s++){var n=i[s];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 Dn=new RegExp(["^","\\[(\\$.+)\\]","\\s","([\\s\\S]+)","$"].join(""));function ks(r){var e=r.errors[0];if(e.type!==""&&e.type!=="Error")return r;var t=e.message.match(Dn);return t!==null&&(e.type=t[1],e.message=t[2]),r}function Ls(){var r,e;return function(t){var s=JSON.stringify(t.errors);return s===r?null:(e&&clearTimeout(e),r=s,e=setTimeout(function(){r=""},1e3),t)}}var qn=["Script error","Script error.","InvalidAccessError"];function Rs(r){var e=r.errors[0];if(e.type===""&&qn.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 $n=new RegExp(["^","Uncaught\\s","(.+?)",":\\s","(.+)","$"].join(""));function Ms(r){var e=r.errors[0];if(e.type!==""&&e.type!=="Error")return r;var t=e.message.match($n);return t!==null&&(e.type=t[1],e.message=t[2]),r}var xs=as(Fs());var ee={unauthorized:new Error("airbrake: unauthorized: project id or key are wrong"),ipRateLimited:new Error("airbrake: IP is rate limited")};var Cs=0;function Ns(r){var e=Date.now()/1e3;if(e<Cs)return X.reject(ee.ipRateLimited);var t={method:r.method,body:r.body};return(0,xs.default)(r.url,t).then(function(s){if(s.status===401)throw ee.unauthorized;if(s.status===429){var i=s.headers.get("X-RateLimit-Delay");if(!i)throw ee.ipRateLimited;var n=parseInt(i,10);throw n>0&&(Cs=Date.now()/1e3+n),ee.ipRateLimited}if(s.status===204)return{json:null};if(s.status===404)throw new Error("404 Not Found");return s.status>=200&&s.status<300?s.json().then(function(o){return{json:o}}):s.status>=400&&s.status<500?s.json().then(function(o){var c=new Error(o.message);throw c}):s.text().then(function(o){var c=new Error("airbrake: fetch: unexpected response: code="+s.status+" body='"+o+"'");throw c})})}function Bs(r){return function(e){return jn(e,r)}}var Is=0;function jn(r,e){var t=Date.now()/1e3;return t<Is?X.reject(ee.ipRateLimited):new X(function(s,i){e({url:r.url,method:r.method,body:r.body,headers:{"content-type":"application/json"},timeout:r.timeout},function(n,o,c){if(n){i(n);return}if(!o.statusCode){n=new Error("airbrake: request: response statusCode is "+o.statusCode),i(n);return}if(o.statusCode===401){i(ee.unauthorized);return}if(o.statusCode===429){i(ee.ipRateLimited);var a=o.headers["x-ratelimit-delay"];if(!a)return;var d=void 0;if(typeof a=="string")d=a;else if(a instanceof Array)d=a[0];else return;var v=parseInt(d,10);v>0&&(Is=Date.now()/1e3+v);return}if(o.statusCode===204){s({json:null});return}if(o.statusCode>=200&&o.statusCode<300){var y=void 0;try{y=JSON.parse(c)}catch(_){i(_);return}s(y);return}if(o.statusCode>=400&&o.statusCode<500){var y=void 0;try{y=JSON.parse(c)}catch(E){i(E);return}n=new Error(y.message),i(n);return}c=c.trim(),n=new Error("airbrake: node: unexpected response: code="+o.statusCode+" body='"+c+"'"),i(n)})})}function te(r){return r.request?Bs(r.request):Ns}var zn=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,i){s.__proto__=i}||function(s,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(s[n]=i[n])},r(e,t)};return function(e,t){r(e,t);function s(){this.constructor=e}e.prototype=t===null?Object.create(t):(s.prototype=t.prototype,new s)}}(),Gs,he=!1;try{Gs=Js(),he=!0}catch{}var Ae=function(){function r(){this.count=0,this.sum=0,this.sumsq=0,this._td=new Gs.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:Xs(this._td)}},r}();var st=function(r){zn(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.groups={},t}return e.prototype.addGroups=function(t,s){this.add(t);for(var i in s)s.hasOwnProperty(i)&&this.addGroup(i,s[i])},e.prototype.addGroup=function(t,s){var i=this.groups[t];i||(i=new Ae,this.groups[t]=i),i.add(s)},e.prototype.toJSON=function(){return{count:this.count,sum:this.sum,sumsq:this.sumsq,tdigestCentroids:Xs(this._td),groups:this.groups}},e}(Ae);function Xs(r){var e=[],t=[];return r.centroids.each(function(s){e.push(s.mean),t.push(s.n)}),{mean:e,count:t}}var it=function(){return it=Object.assign||function(r){for(var e,t=1,s=arguments.length;t<s;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},it.apply(this,arguments)},Jn=15e3,Qs=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 Ys=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=te(e)}return r.prototype.start=function(e){return e===void 0&&(e=""),new Qs(e)},r.prototype.notify=function(e){var t=this;if(he){var s=e._duration(),i=60*1e3,n=new Date(Math.floor(e.startTime.getTime()/i)*i),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 Ae,this._m[c]=a),a.add(s),!this._timer&&(this._timer=setTimeout(function(){t._flush()},Jn))}},r.prototype._flush=function(){var e=[];for(var t in this._m)if(this._m.hasOwnProperty(t)){var s=JSON.parse(t),i=it(it({},s),this._m[t].toJSON());e.push(i)}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 Gn=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,i){s.__proto__=i}||function(s,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(s[n]=i[n])},r(e,t)};return function(e,t){r(e,t);function s(){this.constructor=e}e.prototype=t===null?Object.create(t):(s.prototype=t.prototype,new s)}}(),nt=function(){return nt=Object.assign||function(r){for(var e,t=1,s=arguments.length;t<s;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},nt.apply(this,arguments)},Xn=15e3,Zs=function(r){Gn(e,r);function e(t){var s=r.call(this)||this;return s.queue=t,s.startTime=new Date,s}return e}(Ye);var ei=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=te(e)}return r.prototype.notify=function(e){var t=this;if(he){var s=e._duration();s===0&&(s=1e-5);var i=60*1e3,n=new Date(Math.floor(e.startTime.getTime()/i)*i),o={queue:e.queue,time:n},c=JSON.stringify(o),a=this._m[c];a||(a=new st,this._m[c]=a),a.addGroups(s,e._groups),!this._timer&&(this._timer=setTimeout(function(){t._flush()},Xn))}},r.prototype._flush=function(){var e=[];for(var t in this._m)if(this._m.hasOwnProperty(t)){var s=JSON.parse(t),i=nt(nt({},s),this._m[t].toJSON());e.push(i)}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 Qn=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,i){s.__proto__=i}||function(s,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(s[n]=i[n])},r(e,t)};return function(e,t){r(e,t);function s(){this.constructor=e}e.prototype=t===null?Object.create(t):(s.prototype=t.prototype,new s)}}(),Te=function(){return Te=Object.assign||function(r){for(var e,t=1,s=arguments.length;t<s;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Te.apply(this,arguments)},ti=15e3,ri=function(r){Qn(e,r);function e(t,s,i,n){t===void 0&&(t=""),s===void 0&&(s=""),i===void 0&&(i=0),n===void 0&&(n="");var o=r.call(this)||this;return o.method=t,o.route=s,o.statusCode=i,o.contentType=n,o.startTime=new Date,o}return e}(Ye);var si=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=te(e)}return r.prototype.notify=function(e){var t=this;if(he){var s=e._duration(),i=60*1e3,n=new Date(Math.floor(e.startTime.getTime()/i)*i),o={method:e.method,route:e.route,statusCode:e.statusCode,time:n},c=JSON.stringify(o),a=this._m[c];a||(a=new Ae,this._m[c]=a),a.add(s),!this._timer&&(this._timer=setTimeout(function(){t._flush()},ti))}},r.prototype._flush=function(){var e=[];for(var t in this._m)if(this._m.hasOwnProperty(t)){var s=JSON.parse(t),i=Te(Te({},s),this._m[t].toJSON());e.push(i)}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 ii=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=te(e)}return r.prototype.notify=function(e){var t=this;if(he&&!(e.statusCode<200||e.statusCode>=300&&e.statusCode<400||e.statusCode===404||Object.keys(e._groups).length===0)){var s=e._duration();s===0&&(s=1e-5);var i=60*1e3,n=new Date(Math.floor(e.startTime.getTime()/i)*i),o={method:e.method,route:e.route,responseType:this._responseType(e),time:n},c=JSON.stringify(o),a=this._m[c];a||(a=new st,this._m[c]=a),a.addGroups(s,e._groups),!this._timer&&(this._timer=setTimeout(function(){t._flush()},ti))}},r.prototype._flush=function(){var e=[];for(var t in this._m)if(this._m.hasOwnProperty(t)){var s=JSON.parse(t),i=Te(Te({},s),this._m[t].toJSON());e.push(i)}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 ni="airbrake-js/browser",oi="1.4.2",ai="https://github.com/airbrake/airbrake-js/tree/master/packages/browser";var ot=function(){return ot=Object.assign||function(r){for(var e,t=1,s=arguments.length;t<s;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},ot.apply(this,arguments)},Dt=function(){function r(e){var t=this;if(this._filters=[],this._performanceFilters=[],this._scope=new xt,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||Os,this._requester=te(this._opt),this.addFilter(Rs),this.addFilter(Ls()),this.addFilter(Ms),this.addFilter(ks),this.addFilter(function(s){return s.context.notifier={name:ni,version:oi,url:ai},t._opt.environment&&(s.context.environment=t._opt.environment),s}),this.routes=new Yn(this),this.queues=new Zn(this),this.queries=new Ys(this._opt)}return r.prototype.close=function(){for(var e=0,t=this._onClose;e<t.length;e++){var s=t[e];s()}},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:ot(ot({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"),X.resolve(t);var s=this._processor(e.error);t.errors.push(s);for(var i=0,n=this._filters;i<n.length;i++){var o=n[i],c=o(t);if(c===null)return t.error=new Error("airbrake: error is filtered"),X.resolve(t);t=c}return t.context||(t.context={}),t.context.language="JavaScript",this._sendNotice(t)},r.prototype._sendNotice=function(e){var t=vs(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 s={method:"POST",url:this._url,body:t};return this._requester(s).then(function(i){return e.id=i.json.id,e.url=i.json.url,e}).catch(function(i){return e.error=i,e})},r.prototype.wrap=function(e,t){if(t===void 0&&(t=[]),e._airbrake)return e;var s=this,i=function(){var a=Array.prototype.slice.call(arguments),d=s._wrapArguments(a);try{return e.apply(this,d)}catch(v){throw s.notify({error:v,params:{arguments:a}}),this._ignoreNextWindowError(),v}};for(var n in e)e.hasOwnProperty(n)&&(i[n]=e[n]);for(var o=0,c=t;o<c.length;o++){var n=c[o];e.hasOwnProperty(n)&&(i[n]=e[n])}return i._airbrake=!0,i.inner=e,i},r.prototype._wrapArguments=function(e){for(var t=0;t<e.length;t++){var s=e[t];typeof s=="function"&&(e[t]=this.wrap(s))}return e},r.prototype._ignoreNextWindowError=function(){},r.prototype.call=function(e){for(var t=[],s=1;s<arguments.length;s++)t[s-1]=arguments[s];var i=this.wrap(e);return i.apply(this,Array.prototype.slice.call(arguments,1))},r}();var Yn=function(){function r(e){this._notifier=e,this._routes=new si(e._opt),this._breakdowns=new ii(e._opt)}return r.prototype.start=function(e,t,s,i){e===void 0&&(e=""),t===void 0&&(t=""),s===void 0&&(s=0),i===void 0&&(i="");var n=new ri(e,t,s,i),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,s=this._notifier._performanceFilters;t<s.length;t++){var i=s[t];if(i(e)===null)return}this._routes.notify(e),this._breakdowns.notify(e)},r}(),Zn=function(){function r(e){this._notifier=e,this._queues=new ei(e._opt)}return r.prototype.start=function(e){var t=new Zs(e),s=this._notifier.scope().clone();return s.setContext({queue:e}),s.setQueueMetric(t),this._notifier.setActiveScope(s),t},r.prototype.notify=function(e){e.end(),this._queues.notify(e)},r}();function ci(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 eo=["debug","log","info","warn","error"];function li(r){for(var e=function(n){if(!(n in console))return"continue";var o=console[n],c=function(){for(var a=[],d=0;d<arguments.length;d++)a[d]=arguments[d];o.apply(console,a),r.scope().pushHistory({type:"log",severity:n,arguments:a})};c.inner=o,console[n]=c},t=0,s=eo;t<s.length;t++){var i=s[t];e(i)}}var to=["type","name","src"];function hi(r){var e=ro(r);window.addEventListener&&(window.addEventListener("load",e),window.addEventListener("error",function(t){ui(t,"error")||e(t)},!0)),typeof document=="object"&&document.addEventListener&&(document.addEventListener("DOMContentLoaded",e),document.addEventListener("click",e),document.addEventListener("keypress",e))}function ro(r){return function(e){var t=ui(e,"target");if(t){var s={type:e.type};try{s.target=no(t)}catch(i){s.target="<"+String(i)+">"}r.scope().pushHistory(s)}}}function so(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=io(r.className);t!==""&&(e.push("."),e.push(t))}if(r.getAttribute)for(var s=0,i=to;s<i.length;s++){var n=i[s],o=r.getAttribute(n);o&&e.push("["+n+'="'+o+'"]')}return e.join("")}function io(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 no(r){for(var e=10,t=[],s=r;s;){var i=so(s);if(i!==""&&(t.push(i),t.length>e))break;s=s.parentNode}return t.length===0?String(r):t.reverse().join(" > ")}function ui(r,e){try{return r[e]}catch{return null}}function di(r){var e=window.fetch;window.fetch=function(t,s){var i={type:"xhr",date:new Date};return i.method=s&&s.method?s.method:"GET",typeof t=="string"?i.url=t:(i.method=t.method,i.url=t.url),r._ignoreNextXHR++,setTimeout(function(){return r._ignoreNextXHR--}),e.apply(this,arguments).then(function(n){return i.statusCode=n.status,i.duration=new Date().getTime()-i.date.getTime(),r.scope().pushHistory(i),n}).catch(function(n){throw i.error=n,i.duration=new Date().getTime()-i.date.getTime(),r.scope().pushHistory(i),n})}}var qt="";function fi(){return document.location&&document.location.pathname}function mi(r){qt=fi();var e=window.onpopstate;window.onpopstate=function(i){var n=fi();if(n&&pi(r,n),e)return e.apply(this,arguments)};var t=history.pushState;history.pushState=function(i,n,o){o&&pi(r,o.toString()),t.apply(this,arguments)}}function pi(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:qt,to:e}),qt=e}function gi(r){function e(i){var n=i.__state;n.statusCode=i.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,d){r._ignoreNextXHR===0&&(this.__state={type:"xhr",method:n,url:o}),t.apply(this,arguments)};var s=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),s.apply(this,arguments)}}var oo=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,i){s.__proto__=i}||function(s,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(s[n]=i[n])},r(e,t)};return function(e,t){r(e,t);function s(){this.constructor=e}e.prototype=t===null?Object.create(t):(s.prototype=t.prototype,new s)}}(),at=function(){return at=Object.assign||function(r){for(var e,t=1,s=arguments.length;t<s;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},at.apply(this,arguments)},$t=function(r){oo(e,r);function e(t){var s=r.call(this,t)||this;return s.offline=!1,s.todo=[],s._ignoreWindowError=0,s._ignoreNextXHR=0,typeof window>"u"||(s.addFilter(ci),window.addEventListener&&(s.onOnline=s.onOnline.bind(s),window.addEventListener("online",s.onOnline),s.onOffline=s.onOffline.bind(s),window.addEventListener("offline",s.onOffline),s.onUnhandledrejection=s.onUnhandledrejection.bind(s),window.addEventListener("unhandledrejection",s.onUnhandledrejection),s._onClose.push(function(){window.removeEventListener("online",s.onOnline),window.removeEventListener("offline",s.onOffline),window.removeEventListener("unhandledrejection",s.onUnhandledrejection)})),s._opt.ignoreWindowError&&(t.instrumentation.onerror=!1),s._instrument(t.instrumentation)),s}return e.prototype._instrument=function(t){if(t===void 0&&(t={}),t.console===void 0&&(t.console=!ao(this._opt.environment)),Be(t.onerror)){var s=this,i=window.onerror;window.onerror=function(){i&&i.apply(this,arguments),s.onerror.apply(s,arguments)}}hi(this),Be(t.fetch)&&typeof fetch=="function"&&di(this),Be(t.history)&&typeof history=="object"&&mi(this),Be(t.console)&&typeof console=="object"&&li(this),Be(t.xhr)&&typeof XMLHttpRequest<"u"&&gi(this)},e.prototype.notify=function(t){var s=this;return this.offline?new X(function(i,n){for(s.todo.push({err:t,resolve:i,reject:n});s.todo.length>100;){var o=s.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){s.notify(c.err).then(function(a){c.resolve(a)})},s=this,i=0,n=this.todo;i<n.length;i++){var o=n[i];t(o)}this.todo=[]},e.prototype.onOffline=function(){this.offline=!0},e.prototype.onUnhandledrejection=function(t){var s=t.reason||t.detail&&t.detail.reason;if(s){var i=s.message||String(s);if(!(i.indexOf&&i.indexOf("airbrake: ")===0)){if(typeof s!="object"||s.error===void 0){this.notify({error:s,context:{unhandledRejection:!0}});return}this.notify(at(at({},s),{context:{unhandledRejection:!0}}))}}},e.prototype.onerror=function(t,s,i,n,o){if(!(this._ignoreWindowError>0)){if(o){this.notify({error:o,context:{windowError:!0}});return}!s||!i||this.notify({error:{message:t,fileName:s,lineNumber:i,columnNumber:n,noStack:!0},context:{windowError:!0}})}},e.prototype._ignoreNextWindowError=function(){var t=this;this._ignoreWindowError++,setTimeout(function(){return t._ignoreWindowError--})},e}(Dt);function ao(r){return r&&r.startsWith&&r.startsWith("dev")}function Be(r){return r===void 0||r===!0}(function(r){if(typeof r.requestSubmit=="function")return;r.requestSubmit=function(s){s?(e(s,this),s.click()):(s=document.createElement("input"),s.type="submit",s.hidden=!0,this.appendChild(s),s.click(),this.removeChild(s))};function e(s,i){s instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),s.type=="submit"||t(TypeError,"The specified element is not a submit button"),s.form==i||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(s,i,n){throw new s("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+i+".",n)}})(HTMLFormElement.prototype);var Ai=new WeakMap;function co(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 lo(r){let e=co(r.target);e&&e.form&&Ai.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let r=window.Event.prototype;if("SubmitEvent"in window){let e=window.SubmitEvent.prototype;if(/Apple Computer/.test(navigator.vendor)&&!("submitter"in e))r=e;else return}addEventListener("click",lo,!0),Object.defineProperty(r,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return Ai.get(this.target)}})})();var ke={eager:"eager",lazy:"lazy"},K=class r extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new r.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="src"?this.delegate.sourceURLChanged():e=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&this.refresh==="morph"}get loading(){return ho(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(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}};function ho(r){switch(r.toLowerCase()){case"lazy":return ke.lazy;default:return ke.eager}}var uo={enabled:!0,progressBarDelay:500,unvisitableExtensions:new Set([".7z",".aac",".apk",".avi",".bmp",".bz2",".css",".csv",".deb",".dmg",".doc",".docx",".exe",".gif",".gz",".heic",".heif",".ico",".iso",".jpeg",".jpg",".js",".json",".m4a",".mkv",".mov",".mp3",".mp4",".mpeg",".mpg",".msi",".ogg",".ogv",".pdf",".pkg",".png",".ppt",".pptx",".rar",".rtf",".svg",".tar",".tif",".tiff",".txt",".wav",".webm",".webp",".wma",".wmv",".xls",".xlsx",".xml",".zip"])};function qe(r){if(r.getAttribute("data-turbo-eval")=="false")return r;{let e=document.createElement("script"),t=Mi();return t&&(e.nonce=t),e.textContent=r.textContent,e.async=!1,fo(e,r),e}}function fo(r,e){for(let{name:t,value:s}of e.attributes)r.setAttribute(t,s)}function po(r){let e=document.createElement("template");return e.innerHTML=r,e.content}function B(r,{target:e,cancelable:t,detail:s}={}){let i=new CustomEvent(r,{cancelable:t,bubbles:!0,composed:!0,detail:s});return e&&e.isConnected?e.dispatchEvent(i):document.documentElement.dispatchEvent(i),i}function vi(r){r.preventDefault(),r.stopImmediatePropagation()}function De(){return document.visibilityState==="hidden"?Oi():Ti()}function Ti(){return new Promise(r=>requestAnimationFrame(()=>r()))}function Oi(){return new Promise(r=>setTimeout(()=>r(),0))}function mo(){return Promise.resolve()}function ki(r=""){return new DOMParser().parseFromString(r,"text/html")}function Li(r,...e){let t=go(r,e).replace(/^\n/,"").split(`
|
23
|
+
`),s=t[0].match(/^\s+/),i=s?s[0].length:0;return t.map(n=>n.slice(i)).join(`
|
24
|
+
`)}function go(r,e){return r.reduce((t,s,i)=>{let n=e[i]==null?"":e[i];return t+s+n},"")}function de(){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 ht(r,...e){for(let t of e.map(s=>s?.getAttribute(r)))if(typeof t=="string")return t;return null}function vo(r,...e){return e.some(t=>t&&t.hasAttribute(r))}function ut(...r){for(let e of r)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function dt(...r){for(let e of r)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function yo(r,e=2e3){return new Promise(t=>{let s=()=>{r.removeEventListener("error",s),r.removeEventListener("load",s),t()};r.addEventListener("load",s,{once:!0}),r.addEventListener("error",s,{once:!0}),setTimeout(t,e)})}function Ri(r){switch(r){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function bo(r){return r=="advance"||r=="replace"||r=="restore"}function ge(...r){let e=ht("data-turbo-action",...r);return bo(e)?e:null}function wr(r){return document.querySelector(`meta[name="${r}"]`)}function ft(r){let e=wr(r);return e&&e.content}function Mi(){let r=wr("csp-nonce");if(r){let{nonce:e,content:t}=r;return e==""?t:e}}function wo(r,e){let t=wr(r);return t||(t=document.createElement("meta"),t.setAttribute("name",r),document.head.appendChild(t)),t.setAttribute("content",e),t}function Re(r,e){if(r instanceof Element)return r.closest(e)||Re(r.assignedSlot||r.getRootNode()?.host,e)}function _r(r){return!!r&&r.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof r.focus=="function"}function Pi(r){return Array.from(r.querySelectorAll("[autofocus]")).find(_r)}async function _o(r,e){let t=e();r(),await Ti();let s=e();return[t,s]}function Fi(r){if(r==="_blank")return!1;if(r){for(let e of document.getElementsByName(r))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}function Ci(r){return Re(r,"a[href]:not([target^=_]):not([download])")}function xi(r){return $(r.getAttribute("href")||"")}function Eo(r,e){let t=null;return(...s)=>{let i=()=>r.apply(this,s);clearTimeout(t),t=setTimeout(i,e)}}var So={"aria-disabled":{beforeSubmit:r=>{r.setAttribute("aria-disabled","true"),r.addEventListener("click",vi)},afterSubmit:r=>{r.removeAttribute("aria-disabled"),r.removeEventListener("click",vi)}},disabled:{beforeSubmit:r=>r.disabled=!0,afterSubmit:r=>r.disabled=!1}},jt=class{#e=null;constructor(e){Object.assign(this,e)}get submitter(){return this.#e}set submitter(e){this.#e=So[e]||e}},Ao=new jt({mode:"on",submitter:"disabled"}),q={drive:uo,forms:Ao};function $(r){return new URL(r.toString(),document.baseURI)}function ve(r){let e;if(r.hash)return r.hash.slice(1);if(e=r.href.match(/#(.*)$/))return e[1]}function Er(r,e){let t=e?.getAttribute("formaction")||r.getAttribute("action")||r.action;return $(t)}function To(r){return(Ro(r).match(/\.[^.]*$/)||[])[0]||""}function Oo(r,e){let t=Mo(e);return r.href===$(t).href||r.href.startsWith(t)}function ue(r,e){return Oo(r,e)&&!q.drive.unvisitableExtensions.has(To(r))}function Ht(r){let e=ve(r);return e!=null?r.href.slice(0,-(e.length+1)):r.href}function ct(r){return Ht(r)}function ko(r,e){return $(r).href==$(e).href}function Lo(r){return r.pathname.split("/").slice(1)}function Ro(r){return Lo(r).slice(-1)[0]}function Mo(r){return Po(r.origin+r.pathname)}function Po(r){return r.endsWith("/")?r:r+"/"}var $e=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 $(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)}},Vt=class extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){let s=this.values().next().value;this.delete(s)}super.add(e)}},Ni=new Vt(20),Fo=window.fetch;function Ii(r,e={}){let t=new Headers(e.headers||{}),s=de();return Ni.add(s),t.append("X-Turbo-Request-Id",s),Fo(r,{...e,headers:t})}function Sr(r){switch(r.toLowerCase()){case"get":return V.get;case"post":return V.post;case"put":return V.put;case"patch":return V.patch;case"delete":return V.delete}}var V={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function Co(r){switch(r.toLowerCase()){case me.multipart:return me.multipart;case me.plain:return me.plain;default:return me.urlEncoded}}var me={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},ye=class{abortController=new AbortController;#e=e=>{};constructor(e,t,s,i=new URLSearchParams,n=null,o=me.urlEncoded){let[c,a]=yi($(s),t,i,o);this.delegate=e,this.url=c,this.target=n,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t.toUpperCase(),headers:{...this.defaultHeaders},body:a,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=o}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,s=Sr(e)||V.get;this.url.search="";let[i,n]=yi(this.url,s,t,this.enctype);this.url=i,this.fetchOptions.body=n,this.fetchOptions.method=s.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}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);let t=await this.#t(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=Ii(this.url.href,e);let s=await this.response;return await this.receive(s)}catch(s){if(s.name!=="AbortError")throw this.#r(s)&&this.delegate.requestErrored(this,s),s}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new $e(e);return B("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 defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return Ar(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#t(e){let t=new Promise(i=>this.#e=i),s=B("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});return this.url=s.detail.url,s.defaultPrevented&&await t,s}#r(e){return!B("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}};function Ar(r){return Sr(r)==V.get}function yi(r,e,t,s){let i=Array.from(t).length>0?new URLSearchParams(Bi(t)):r.searchParams;return Ar(e)?[xo(r,i),null]:s==me.urlEncoded?[r,i]:[r,t]}function Bi(r){let e=[];for(let[t,s]of r)s instanceof File||e.push([t,s]);return e}function xo(r,e){let t=new URLSearchParams(Bi(e));return r.search=t.toString(),r}var Ut=class{started=!1;constructor(e,t){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))}intersect=e=>{e.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},fe=class{static contentType="text/vnd.turbo-stream.html";static wrap(e){return typeof e=="string"?new this(po(e)):e}constructor(e){this.fragment=No(e)}};function No(r){for(let e of r.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let s of t.templateElement.content.querySelectorAll("script"))s.replaceWith(qe(s));e.replaceWith(t)}return r}var Io=100,Wt=class{#e=null;#t=null;get(e){if(this.#t&&this.#t.url===e&&this.#t.expire>Date.now())return this.#t.request}setLater(e,t,s){this.clear(),this.#e=setTimeout(()=>{t.perform(),this.set(e,t,s),this.#e=null},Io)}set(e,t,s){this.#t={url:e,request:t,expire:new Date(new Date().getTime()+s)}}clear(){this.#e&&clearTimeout(this.#e),this.#t=null}},Bo=10*1e3,Le=new Wt,Oe={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},pt=class r{state=Oe.initialized;static confirmMethod(e){return Promise.resolve(confirm(e))}constructor(e,t,s,i=!1){let n=Vo(t,s),o=Ho(jo(t,s),n),c=Do(t,s),a=Uo(t,s);this.delegate=e,this.formElement=t,this.submitter=s,this.fetchRequest=new ye(this,n,o,c,t,a),this.mustRedirect=i}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=$(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:e,requesting:t}=Oe,s=ht("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof s=="string"&&!await(typeof q.forms.confirm=="function"?q.forms.confirm:r.confirmMethod)(s,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=Oe;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=qo(ft("csrf-param"))||ft("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(fe.contentType)}requestStarted(e){this.state=Oe.waiting,this.submitter&&q.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),ut(this.formElement),B("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){Le.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(Le.clear(),this.requestMustRedirect(e)&&$o(t)){let s=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,s)}else this.state=Oe.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){this.state=Oe.stopped,this.submitter&&q.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),dt(this.formElement),B("turbo:submit-end",{target:this.formElement,detail:{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||vo("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function Do(r,e){let t=new FormData(r),s=e?.getAttribute("name"),i=e?.getAttribute("value");return s&&t.append(s,i||""),t}function qo(r){if(r!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(s=>s.startsWith(r));if(t){let s=t.split("=").slice(1).join("=");return s?decodeURIComponent(s):void 0}}}function $o(r){return r.statusCode==200&&!r.redirected}function jo(r,e){let t=typeof r.action=="string"?r.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":r.getAttribute("action")||t||""}function Ho(r,e){let t=$(r);return Ar(e)&&(t.search=""),t}function Vo(r,e){let t=e?.getAttribute("formmethod")||r.getAttribute("method")||"";return Sr(t.toLowerCase())||V.get}function Uo(r,e){return Co(e?.getAttribute("formenctype")||r.enctype)}var Pe=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(){return Pi(this.element)}get permanentElements(){return qi(this.element)}getPermanentElementById(e){return Di(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let s of this.permanentElements){let{id:i}=s,n=e.getPermanentElementById(i);n&&(t[i]=[s,n])}return t}};function Di(r,e){return r.querySelector(`#${e}[data-turbo-permanent]`)}function qi(r){return r.querySelectorAll("[id][data-turbo-permanent]")}var je=class{started=!1;constructor(e,t){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)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,s=e.submitter||void 0;t&&Wo(t,s)&&Ko(t,s)&&this.delegate.willSubmitForm(t,s)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,s))}}};function Wo(r,e){return(e?.getAttribute("formmethod")||r.getAttribute("method"))!="dialog"}function Ko(r,e){let t=e?.getAttribute("formtarget")||r.getAttribute("target");return Fi(t)}var mt=class{#e=e=>{};#t=e=>{};constructor(e,t){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(ve(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:s,willRender:i,newSnapshot:n}=e,o=i;if(s)try{this.renderPromise=new Promise(v=>this.#e=v),this.renderer=e,await this.prepareToRenderSnapshot(e);let c=new Promise(v=>this.#t=v),a={resume:this.#t,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(n,a)||await c,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(n,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#e(void 0),delete this.renderPromise}else o&&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")}markVisitDirection(e){this.element.setAttribute("data-turbo-visit-direction",e)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},Kt=class extends mt{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new Pe(this.element)}},gt=class{constructor(e,t){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)}clickBubbled=e=>{this.clickEventIsSignificant(e)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.clickEventIsSignificant(e)&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};clickEventIsSignificant(e){let t=e.composed?e.target?.parentElement:e.target,s=Ci(t)||t;return s instanceof Element&&s.closest("turbo-frame, html")==this.element}},vt=class{started=!1;constructor(e,t){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)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=e.composedPath&&e.composedPath()[0]||e.target,s=Ci(t);if(s&&Fi(s.target)){let i=xi(s);this.delegate.willFollowLinkToLocation(s,i,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(s,i))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}},yt=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new vt(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,s){return this.delegate.willSubmitFormLinkToLocation(e,t,s)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let s=document.createElement("form"),i="hidden";for(let[y,_]of t.searchParams)s.append(Object.assign(document.createElement("input"),{type:i,name:y,value:_}));let n=Object.assign(t,{search:""});s.setAttribute("data-turbo","true"),s.setAttribute("action",n.href),s.setAttribute("hidden","");let o=e.getAttribute("data-turbo-method");o&&s.setAttribute("method",o);let c=e.getAttribute("data-turbo-frame");c&&s.setAttribute("data-turbo-frame",c);let a=ge(e);a&&s.setAttribute("data-turbo-action",a);let d=e.getAttribute("data-turbo-confirm");d&&s.setAttribute("data-turbo-confirm",d),e.hasAttribute("data-turbo-stream")&&s.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,s),document.body.appendChild(s),s.addEventListener("turbo:submit-end",()=>s.remove(),{once:!0}),requestAnimationFrame(()=>s.requestSubmit())}},bt=class{static async preservingPermanentElements(e,t,s){let i=new this(e,t);i.enter(),await s(),i.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,s]=this.permanentElementMap[e];this.delegate.enteringBardo(t,s),this.replaceNewPermanentElementWithPlaceholder(s)}}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=zo(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){this.getPlaceholderById(e.id)?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function zo(r){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",r.id),e}var He=class{#e=null;static renderElement(e,t){}constructor(e,t,s,i=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=s,this.willRender=i,this.renderElement=this.constructor.renderElement,this.promise=new Promise((n,o)=>this.resolvingFunctions={resolve:n,reject:o})}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await bt.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}}enteringBardo(e){this.#e||e.contains(this.currentSnapshot.activeElement)&&(this.#e=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#e)&&this.#e instanceof HTMLElement&&(this.#e.focus(),this.#e=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)}get renderMethod(){return"replace"}},Ve=class extends He{static renderElement(e,t){let s=document.createRange();s.selectNodeContents(e),s.deleteContents();let i=t,n=i.ownerDocument?.createRange();n&&(n.selectNodeContents(i),e.appendChild(n.extractContents()))}constructor(e,t,s,i,n,o=!0){super(t,s,i,n,o),this.delegate=e}get shouldRender(){return!0}async render(){await De(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await De(),this.focusFirstAutofocusableElement(),await De(),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=Jo(this.currentElement.getAttribute("data-autoscroll-block"),"end"),s=Go(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:s}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=qe(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function Jo(r,e){return r=="end"||r=="start"||r=="center"||r=="nearest"?r:e}function Go(r,e){return r=="auto"||r=="smooth"?r:e}var Xo=function(){let r=()=>{},e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:r,afterNodeAdded:r,beforeNodeMorphed:r,afterNodeMorphed:r,beforeNodeRemoved:r,afterNodeRemoved:r,beforeAttributeUpdated:r},head:{style:"merge",shouldPreserve:_=>_.getAttribute("im-preserve")==="true",shouldReAppend:_=>_.getAttribute("im-re-append")==="true",shouldRemove:r,afterHeadMorphed:r},restoreFocus:!0};function t(_,E,S={}){_=v(_);let k=y(E),T=d(_,k,S),O=i(T,()=>c(T,_,k,b=>b.morphStyle==="innerHTML"?(n(b,_,k),Array.from(_.childNodes)):s(b,_,k)));return T.pantry.remove(),O}function s(_,E,S){let k=y(E),T=Array.from(k.childNodes),O=T.indexOf(E),b=T.length-(O+1);return n(_,k,S,E,E.nextSibling),T=Array.from(k.childNodes),T.slice(O,T.length-b)}function i(_,E){if(!_.config.restoreFocus)return E();let S=document.activeElement;if(!(S instanceof HTMLInputElement||S instanceof HTMLTextAreaElement))return E();let{id:k,selectionStart:T,selectionEnd:O}=S,b=E();return k&&k!==document.activeElement?.id&&(S=_.target.querySelector(`#${k}`),S?.focus()),S&&!S.selectionEnd&&O&&S.setSelectionRange(T,O),b}let n=function(){function _(h,u,m,p=null,f=null){u instanceof HTMLTemplateElement&&m instanceof HTMLTemplateElement&&(u=u.content,m=m.content),p||=u.firstChild;for(let A of m.childNodes){if(p&&p!=f){let l=S(h,A,p,f);if(l){l!==p&&T(h,p,l),o(l,A,h),p=l.nextSibling;continue}}if(A instanceof Element&&h.persistentIds.has(A.id)){let l=O(u,A.id,p,h);o(l,A,h),p=l.nextSibling;continue}let L=E(u,A,p,h);L&&(p=L.nextSibling)}for(;p&&p!=f;){let A=p;p=p.nextSibling,k(h,A)}}function E(h,u,m,p){if(p.callbacks.beforeNodeAdded(u)===!1)return null;if(p.idMap.has(u)){let f=document.createElement(u.tagName);return h.insertBefore(f,m),o(f,u,p),p.callbacks.afterNodeAdded(f),f}else{let f=document.importNode(u,!0);return h.insertBefore(f,m),p.callbacks.afterNodeAdded(f),f}}let S=function(){function h(p,f,A,L){let l=null,g=f.nextSibling,R=0,M=A;for(;M&&M!=L;){if(m(M,f)){if(u(p,M,f))return M;l===null&&(p.idMap.has(M)||(l=M))}if(l===null&&g&&m(M,g)&&(R++,g=g.nextSibling,R>=2&&(l=void 0)),M.contains(document.activeElement))break;M=M.nextSibling}return l||null}function u(p,f,A){let L=p.idMap.get(f),l=p.idMap.get(A);if(!l||!L)return!1;for(let g of L)if(l.has(g))return!0;return!1}function m(p,f){let A=p,L=f;return A.nodeType===L.nodeType&&A.tagName===L.tagName&&(!A.id||A.id===L.id)}return h}();function k(h,u){if(h.idMap.has(u))w(h.pantry,u,null);else{if(h.callbacks.beforeNodeRemoved(u)===!1)return;u.parentNode?.removeChild(u),h.callbacks.afterNodeRemoved(u)}}function T(h,u,m){let p=u;for(;p&&p!==m;){let f=p;p=p.nextSibling,k(h,f)}return p}function O(h,u,m,p){let f=p.target.querySelector(`#${u}`)||p.pantry.querySelector(`#${u}`);return b(f,p),w(h,f,m),f}function b(h,u){let m=h.id;for(;h=h.parentNode;){let p=u.idMap.get(h);p&&(p.delete(m),p.size||u.idMap.delete(h))}}function w(h,u,m){if(h.moveBefore)try{h.moveBefore(u,m)}catch{h.insertBefore(u,m)}else h.insertBefore(u,m)}return _}(),o=function(){function _(b,w,h){return h.ignoreActive&&b===document.activeElement?null:(h.callbacks.beforeNodeMorphed(b,w)===!1||(b instanceof HTMLHeadElement&&h.head.ignore||(b instanceof HTMLHeadElement&&h.head.style!=="morph"?a(b,w,h):(E(b,w,h),O(b,h)||n(h,b,w))),h.callbacks.afterNodeMorphed(b,w)),b)}function E(b,w,h){let u=w.nodeType;if(u===1){let m=b,p=w,f=m.attributes,A=p.attributes;for(let L of A)T(L.name,m,"update",h)||m.getAttribute(L.name)!==L.value&&m.setAttribute(L.name,L.value);for(let L=f.length-1;0<=L;L--){let l=f[L];if(l&&!p.hasAttribute(l.name)){if(T(l.name,m,"remove",h))continue;m.removeAttribute(l.name)}}O(m,h)||S(m,p,h)}(u===8||u===3)&&b.nodeValue!==w.nodeValue&&(b.nodeValue=w.nodeValue)}function S(b,w,h){if(b instanceof HTMLInputElement&&w instanceof HTMLInputElement&&w.type!=="file"){let u=w.value,m=b.value;k(b,w,"checked",h),k(b,w,"disabled",h),w.hasAttribute("value")?m!==u&&(T("value",b,"update",h)||(b.setAttribute("value",u),b.value=u)):T("value",b,"remove",h)||(b.value="",b.removeAttribute("value"))}else if(b instanceof HTMLOptionElement&&w instanceof HTMLOptionElement)k(b,w,"selected",h);else if(b instanceof HTMLTextAreaElement&&w instanceof HTMLTextAreaElement){let u=w.value,m=b.value;if(T("value",b,"update",h))return;u!==m&&(b.value=u),b.firstChild&&b.firstChild.nodeValue!==u&&(b.firstChild.nodeValue=u)}}function k(b,w,h,u){let m=w[h],p=b[h];if(m!==p){let f=T(h,b,"update",u);f||(b[h]=w[h]),m?f||b.setAttribute(h,""):T(h,b,"remove",u)||b.removeAttribute(h)}}function T(b,w,h,u){return b==="value"&&u.ignoreActiveValue&&w===document.activeElement?!0:u.callbacks.beforeAttributeUpdated(b,w,h)===!1}function O(b,w){return!!w.ignoreActiveValue&&b===document.activeElement&&b!==document.body}return _}();function c(_,E,S,k){if(_.head.block){let T=E.querySelector("head"),O=S.querySelector("head");if(T&&O){let b=a(T,O,_);return Promise.all(b).then(()=>{let w=Object.assign(_,{head:{block:!1,ignore:!0}});return k(w)})}}return k(_)}function a(_,E,S){let k=[],T=[],O=[],b=[],w=new Map;for(let u of E.children)w.set(u.outerHTML,u);for(let u of _.children){let m=w.has(u.outerHTML),p=S.head.shouldReAppend(u),f=S.head.shouldPreserve(u);m||f?p?T.push(u):(w.delete(u.outerHTML),O.push(u)):S.head.style==="append"?p&&(T.push(u),b.push(u)):S.head.shouldRemove(u)!==!1&&T.push(u)}b.push(...w.values());let h=[];for(let u of b){let m=document.createRange().createContextualFragment(u.outerHTML).firstChild;if(S.callbacks.beforeNodeAdded(m)!==!1){if("href"in m&&m.href||"src"in m&&m.src){let p,f=new Promise(function(A){p=A});m.addEventListener("load",function(){p()}),h.push(f)}_.appendChild(m),S.callbacks.afterNodeAdded(m),k.push(m)}}for(let u of T)S.callbacks.beforeNodeRemoved(u)!==!1&&(_.removeChild(u),S.callbacks.afterNodeRemoved(u));return S.head.afterHeadMorphed(_,{added:k,kept:O,removed:T}),h}let d=function(){function _(w,h,u){let{persistentIds:m,idMap:p}=O(w,h),f=E(u),A=f.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(A))throw`Do not understand how to morph style ${A}`;return{target:w,newContent:h,config:f,morphStyle:A,ignoreActive:f.ignoreActive,ignoreActiveValue:f.ignoreActiveValue,restoreFocus:f.restoreFocus,idMap:p,persistentIds:m,pantry:S(),callbacks:f.callbacks,head:f.head}}function E(w){let h=Object.assign({},e);return Object.assign(h,w),h.callbacks=Object.assign({},e.callbacks,w.callbacks),h.head=Object.assign({},e.head,w.head),h}function S(){let w=document.createElement("div");return w.hidden=!0,document.body.insertAdjacentElement("afterend",w),w}function k(w){let h=Array.from(w.querySelectorAll("[id]"));return w.id&&h.push(w),h}function T(w,h,u,m){for(let p of m)if(h.has(p.id)){let f=p;for(;f;){let A=w.get(f);if(A==null&&(A=new Set,w.set(f,A)),A.add(p.id),f===u)break;f=f.parentElement}}}function O(w,h){let u=k(w),m=k(h),p=b(u,m),f=new Map;T(f,p,w,u);let A=h.__idiomorphRoot||h;return T(f,p,A,m),{persistentIds:p,idMap:f}}function b(w,h){let u=new Set,m=new Map;for(let{id:f,tagName:A}of w)m.has(f)?u.add(f):m.set(f,A);let p=new Set;for(let{id:f,tagName:A}of h)p.has(f)?u.add(f):m.get(f)===A&&p.add(f);for(let f of u)p.delete(f);return p}return _}(),{normalizeElement:v,normalizeParent:y}=function(){let _=new WeakSet;function E(O){return O instanceof Document?O.documentElement:O}function S(O){if(O==null)return document.createElement("div");if(typeof O=="string")return S(T(O));if(_.has(O))return O;if(O instanceof Node){if(O.parentNode)return k(O);{let b=document.createElement("div");return b.append(O),b}}else{let b=document.createElement("div");for(let w of[...O])b.append(w);return b}}function k(O){return{childNodes:[O],querySelectorAll:b=>{let w=O.querySelectorAll(b);return O.matches(b)?[O,...w]:w},insertBefore:(b,w)=>O.parentNode.insertBefore(b,w),moveBefore:(b,w)=>O.parentNode.moveBefore(b,w),get __idiomorphRoot(){return O}}}function T(O){let b=new DOMParser,w=O.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(w.match(/<\/html>/)||w.match(/<\/head>/)||w.match(/<\/body>/)){let h=b.parseFromString(O,"text/html");if(w.match(/<\/html>/))return _.add(h),h;{let u=h.firstChild;return u&&_.add(u),u}}else{let u=b.parseFromString("<body><template>"+O+"</template></body>","text/html").body.querySelector("template").content;return _.add(u),u}}return{normalizeElement:E,normalizeParent:S}}();return{morph:t,defaults:e}}();function Tr(r,e,{callbacks:t,...s}={}){Xo.morph(r,e,{...s,callbacks:new zt(t)})}function $i(r,e){Tr(r,e.childNodes,{morphStyle:"innerHTML"})}var zt=class{#e;constructor({beforeNodeMorphed:e}={}){this.#e=e||(()=>!0)}beforeNodeAdded=e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id));beforeNodeMorphed=(e,t)=>{if(e instanceof Element)return!e.hasAttribute("data-turbo-permanent")&&this.#e(e,t)?!B("turbo:before-morph-element",{cancelable:!0,target:e,detail:{currentElement:e,newElement:t}}).defaultPrevented:!1};beforeAttributeUpdated=(e,t,s)=>!B("turbo:before-morph-attribute",{cancelable:!0,target:t,detail:{attributeName:e,mutationType:s}}).defaultPrevented;beforeNodeRemoved=e=>this.beforeNodeMorphed(e);afterNodeMorphed=(e,t)=>{e instanceof Element&&B("turbo:morph-element",{target:e,detail:{currentElement:e,newElement:t}})}},Jt=class extends Ve{static renderElement(e,t){B("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),$i(e,t)}async preservingPermanentElements(e){return await e()}},Gt=class r{static animationDuration=300;static get defaultCSS(){return Li`
|
25
|
+
.turbo-progress-bar {
|
26
|
+
position: fixed;
|
27
|
+
display: block;
|
28
|
+
top: 0;
|
29
|
+
left: 0;
|
30
|
+
height: 3px;
|
31
|
+
background: #0076ff;
|
32
|
+
z-index: 2147483647;
|
33
|
+
transition:
|
34
|
+
width ${r.animationDuration}ms ease-out,
|
35
|
+
opacity ${r.animationDuration/2}ms ${r.animationDuration/2}ms ease-in;
|
36
|
+
transform: translate3d(0, 0, 0);
|
37
|
+
}
|
38
|
+
`}hiding=!1;value=0;visible=!1;constructor(){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,r.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,r.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");e.type="text/css",e.textContent=r.defaultCSS;let t=Mi();return t&&(e.nonce=t),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}},Xt=class extends Pe{detailsByOuterHTML=this.children.filter(e=>!ea(e)).map(e=>sa(e)).reduce((e,t)=>{let{outerHTML:s}=t,i=s in e?e[s]:{type:Qo(t),tracked:Yo(t),elements:[]};return{...e,[s]:{...i,elements:[...i.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(s=>!(s in t.detailsByOuterHTML)).map(s=>this.detailsByOuterHTML[s]).filter(({type:s})=>s==e).map(({elements:[s]})=>s)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:s,tracked:i,elements:n}=this.detailsByOuterHTML[t];return s==null&&!i?[...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,s)=>{let{elements:[i]}=this.detailsByOuterHTML[s];return ra(i,e)?i:t},void 0|void 0)}};function Qo(r){if(Zo(r))return"script";if(ta(r))return"stylesheet"}function Yo(r){return r.getAttribute("data-turbo-track")=="reload"}function Zo(r){return r.localName=="script"}function ea(r){return r.localName=="noscript"}function ta(r){let e=r.localName;return e=="style"||e=="link"&&r.getAttribute("rel")=="stylesheet"}function ra(r,e){return r.localName=="meta"&&r.getAttribute("name")==e}function sa(r){return r.hasAttribute("nonce")&&r.setAttribute("nonce",""),r}var W=class r extends Pe{static fromHTMLString(e=""){return this.fromDocument(ki(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:s}){return new this(e,t,new Xt(s))}constructor(e,t,s){super(t),this.documentElement=e,this.headSnapshot=s}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),s=e.querySelectorAll("select");for(let[i,n]of t.entries()){let o=s[i];for(let c of o.selectedOptions)c.selected=!1;for(let c of n.selectedOptions)o.options[c.index].selected=!0}for(let i of e.querySelectorAll('input[type="password"]'))i.value="";return new r(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){let e=this.getSetting("root")??"/";return $(e)}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"}get prefersViewTransitions(){return this.headSnapshot.getMetaValue("view-transition")==="same-origin"}get shouldMorphPage(){return this.getSetting("refresh-method")==="morph"}get shouldPreserveScrollPosition(){return this.getSetting("refresh-scroll")==="preserve"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},Qt=class{#e=!1;#t=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#e?(this.#e=!0,this.#t=this.#t.then(async()=>{await document.startViewTransition(t).finished})):this.#t=this.#t.then(t),this.#t}get viewTransitionsAvailable(){return document.startViewTransition}},ia={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},lt={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},re={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},Me={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},na={advance:"forward",restore:"back",replace:"none"},Yt=class{identifier=de();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=re.initialized;viewTransitioner=new Qt;constructor(e,t,s,i={}){this.delegate=e,this.location=t,this.restorationIdentifier=s||de();let{action:n,historyChanged:o,referrer:c,snapshot:a,snapshotHTML:d,response:v,visitCachedSnapshot:y,willRender:_,updateHistory:E,shouldCacheSnapshot:S,acceptsStreamResponse:k,direction:T}={...ia,...i};this.action=n,this.historyChanged=o,this.referrer=c,this.snapshot=a,this.snapshotHTML=d,this.response=v,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=y,this.willRender=_,this.updateHistory=E,this.scrolled=!_,this.shouldCacheSnapshot=S,this.acceptsStreamResponse=k,this.direction=T||na[n]}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==re.initialized&&(this.recordTimingMetric(lt.visitStart),this.state=re.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==re.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=re.canceled)}complete(){this.state==re.started&&(this.recordTimingMetric(lt.visitEnd),this.adapter.visitCompleted(this),this.state=re.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==re.started&&(this.state=re.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=this.location.href===this.referrer?.href?"replace":this.action,t=Ri(e);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new ye(this,V.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(lt.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;bi(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(lt.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,bi(e)&&t!=null){let s=W.fromHTMLString(t);await this.renderPageSnapshot(s,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(W.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!ve(this.location)||e.hasAnchor(ve(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return W.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.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.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(fe.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let s=await t.responseHTML,{redirected:i,statusCode:n}=t;s==null?this.recordResponse({statusCode:Me.contentTypeMismatch,redirected:i}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:s,redirected:i}))}async requestFailedWithResponse(e,t){let s=await t.responseHTML,{redirected:i,statusCode:n}=t;s==null?this.recordResponse({statusCode:Me.contentTypeMismatch,redirected:i}):this.recordResponse({statusCode:n,responseHTML:s,redirected:i})}requestErrored(e,t){this.recordResponse({statusCode:Me.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(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=ve(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}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=document.visibilityState==="hidden"?setTimeout(()=>t(),0):requestAnimationFrame(()=>t())}),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function bi(r){return r>=200&&r<300}var Zt=class{progressBar=new Gt;constructor(e){this.session=e}visitProposedToLocation(e,t){ue(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||de(),t):window.location.href=e.toString()}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 Me.networkFailure:case Me.timeoutFailure:case Me.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}linkPrefetchingIsEnabledForLocation(e){return!0}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)}showProgressBar=()=>{this.progressBar.show()};reload(e){B("turbo:reload",{detail:e}),window.location.href=this.location?.toString()||window.location.href}get navigator(){return this.session.navigator}},er=class{selector="[data-turbo-temporary]";deprecatedSelector="[data-turbo-cache=false]";started=!1;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))}removeTemporaryElements=e=>{for(let t of this.temporaryElements)t.remove()};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]}},tr=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new gt(this,t),this.formSubmitObserver=new je(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,s){return this.#t(e)}linkClickIntercepted(e,t,s){let i=this.#r(e);i&&i.delegate.linkClickIntercepted(e,t,s)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.#e(e,t)&&this.#t(e,t)}formSubmitted(e,t){let s=this.#r(e,t);s&&s.delegate.formSubmitted(e,t)}#e(e,t){let s=Er(e,t),i=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=$(i?.content??"/");return this.#t(e,t)&&ue(s,n)}#t(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let i=this.#r(e,t);return i?i!=e.closest("turbo-frame"):!1}else return!1}#r(e,t){let s=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(s&&s!="_top"){let i=this.element.querySelector(`#${s}:not([disabled])`);if(i instanceof K)return i}}},rr=class{location;restorationIdentifier=de();restorationData={};started=!1;pageLoaded=!1;currentIndex=0;constructor(e){this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,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,s=de()){e===history.pushState&&++this.currentIndex;let i={turbo:{restorationIdentifier:s,restorationIndex:this.currentIndex}};e.call(history,i,"",t.href),this.location=t,this.restorationIdentifier=s}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,s=this.restorationData[t];this.restorationData[t]={...s,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{if(this.shouldHandlePopState()){let{turbo:t}=e.state||{};if(t){this.location=new URL(window.location.href);let{restorationIdentifier:s,restorationIndex:i}=t;this.restorationIdentifier=s;let n=i>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,s,n),this.currentIndex=i}}};onPageLoad=async e=>{await mo(),this.pageLoaded=!0};shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},sr=class{started=!1;#e=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#t,{once:!0}):this.#t())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#r,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#n,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#i,!0),this.started=!1)}#t=()=>{this.eventTarget.addEventListener("mouseenter",this.#r,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#n,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#i,!0),this.started=!0};#r=e=>{if(ft("turbo-prefetch")==="false")return;let t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#c(t)){let i=t,n=xi(i);if(this.delegate.canPrefetchRequestToLocation(i,n)){this.#e=i;let o=new ye(this,V.get,n,new URLSearchParams,t);Le.setLater(n.toString(),o,this.#s)}}};#n=e=>{e.target===this.#e&&this.#o()};#o=()=>{Le.clear(),this.#e=null};#i=e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="GET"){let t=Le.get(e.detail.url.toString());t&&(e.detail.fetchRequest=t),Le.clear()}};prepareRequest(e){let t=e.target;e.headers["X-Sec-Purpose"]="prefetch";let s=t.closest("turbo-frame"),i=t.getAttribute("data-turbo-frame")||s?.getAttribute("target")||s?.id;i&&i!=="_top"&&(e.headers["Turbo-Frame"]=i)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get#s(){return Number(ft("turbo-prefetch-cache-time"))||Bo}#c(e){return!(!e.getAttribute("href")||oa(e)||aa(e)||ca(e)||la(e)||ua(e))}},oa=r=>r.origin!==document.location.origin||!["http:","https:"].includes(r.protocol)||r.hasAttribute("target"),aa=r=>r.pathname+r.search===document.location.pathname+document.location.search||r.href.startsWith("#"),ca=r=>{if(r.getAttribute("data-turbo-prefetch")==="false"||r.getAttribute("data-turbo")==="false")return!0;let e=Re(r,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},la=r=>{let e=r.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||ha(r)||r.hasAttribute("data-turbo-confirm")||r.hasAttribute("data-turbo-stream"))},ha=r=>r.hasAttribute("data-remote")||r.hasAttribute("data-behavior")||r.hasAttribute("data-confirm")||r.hasAttribute("data-method"),ua=r=>B("turbo:before-prefetch",{target:r,cancelable:!0}).defaultPrevented,ir=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,s={}){this.stop(),this.currentVisit=new Yt(this,$(e),t,{referrer:this.location,...s}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new pt(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 rootLocation(){return this.view.snapshot.rootLocation}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 s=await t.responseHTML;if(s){let i=e.isSafe;i||this.view.clearSnapshotCache();let{statusCode:n,redirected:o}=t,a={action:this.#e(e,t),shouldCacheSnapshot:i,response:{statusCode:n,responseHTML:s,redirected:o}};this.proposeVisit(t.location,a)}}}async formSubmissionFailedWithResponse(e,t){let s=await t.responseHTML;if(s){let i=W.fromHTMLString(s);t.serverError?await this.view.renderError(i,this.currentVisit):await this.view.renderPage(i,!1,!0,this.currentVisit),i.shouldPreserveScrollPosition||this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}linkPrefetchingIsEnabledForLocation(e){return typeof this.adapter.linkPrefetchingIsEnabledForLocation=="function"?this.adapter.linkPrefetchingIsEnabledForLocation(e):!0}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e),delete this.currentVisit}locationWithActionIsSamePage(e,t){let s=ve(e),i=ve(this.view.lastRenderedLocation),n=t==="restore"&&typeof s>"u";return t!=="replace"&&Ht(e)===Ht(this.view.lastRenderedLocation)&&(n||s!=null&&s!==i)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#e(e,t){let{submitter:s,formElement:i}=e;return ge(s,i)||this.#t(t)}#t(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}},pe={initial:0,loading:1,interactive:2,complete:3},nr=class{stage=pe.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==pe.initial&&(this.stage=pe.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)}interpretReadyState=()=>{let{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==pe.loading&&(this.stage=pe.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==pe.interactive&&(this.stage=pe.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},or=class{started=!1;constructor(e){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)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(e){this.delegate.scrollPositionChanged(e)}},ar=class{render({fragment:e}){bt.preservingPermanentElements(this,da(e),()=>{fa(e,()=>{pa(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function da(r){let e=qi(document.documentElement),t={};for(let s of e){let{id:i}=s;for(let n of r.querySelectorAll("turbo-stream")){let o=Di(n.templateElement.content,i);o&&(t[i]=[s,o])}}return t}async function fa(r,e){let t=`turbo-stream-autofocus-${de()}`,s=r.querySelectorAll("turbo-stream"),i=ma(s),n=null;if(i&&(i.id?n=i.id:n=t,i.id=n),e(),await De(),(document.activeElement==null||document.activeElement==document.body)&&n){let c=document.getElementById(n);_r(c)&&c.focus(),c&&c.id==t&&c.removeAttribute("id")}}async function pa(r){let[e,t]=await _o(r,()=>document.activeElement),s=e&&e.id;if(s){let i=document.getElementById(s);_r(i)&&i!=t&&i.focus()}}function ma(r){for(let e of r){let t=Pi(e.templateElement.content);if(t)return t}return null}var cr=class{sources=new Set;#e=!1;constructor(e){this.delegate=e}start(){this.#e||(this.#e=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#e&&(this.#e=!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)}inspectFetchResponse=e=>{let t=ga(e);t&&va(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#e&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(fe.wrap(e))}};function ga(r){let e=r.detail?.fetchResponse;if(e instanceof $e)return e}function va(r){return(r.contentType??"").startsWith(fe.contentType)}var lr=class extends He{static renderElement(e,t){let{documentElement:s,body:i}=document;s.replaceChild(t,i)}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 s=qe(e);t.replaceChild(s,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},Ue=class extends He{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(){this.#e(),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}#e(){let{documentElement:e}=this.currentSnapshot,{lang:t}=this.newSnapshot;t?e.setAttribute("lang",t):e.removeAttribute("lang")}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,this.willRender&&this.removeUnusedDynamicStylesheetElements()}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(yo(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(qe(e))}removeUnusedDynamicStylesheetElements(){for(let e of this.unusedDynamicStylesheetElements)document.head.removeChild(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[s,i]of t.entries()){if(e.tagName=="TITLE"){if(i.tagName!="TITLE")continue;if(e.innerHTML==i.innerHTML)return t.splice(s,1),!0}if(i.isEqualNode(e))return t.splice(s,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=qe(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(e=>e.getAttribute("data-turbo-track")==="dynamic")}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}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")}},hr=class extends Ue{static renderElement(e,t){Tr(e,t,{callbacks:{beforeNodeMorphed:s=>!wi(s)}});for(let s of e.querySelectorAll("turbo-frame"))wi(s)&&s.reload();B("turbo:morph",{detail:{currentElement:e,newElement:t}})}async preservingPermanentElements(e){return await e()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}};function wi(r){return r instanceof K&&r.src&&r.refresh==="morph"&&!r.closest("[data-turbo-permanent]")}var ur=class{keys=[];snapshots={};constructor(e){this.size=e}has(e){return ct(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[ct(e)]}write(e,t){this.snapshots[ct(e)]=t}touch(e){let t=ct(e),s=this.keys.indexOf(t);s>-1&&this.keys.splice(s,1),this.keys.unshift(t),this.trim()}trim(){for(let e of this.keys.splice(this.size))delete this.snapshots[e]}},dr=class extends mt{snapshotCache=new ur(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,s=!0,i){let o=this.isPageRefresh(i)&&this.snapshot.shouldMorphPage?hr:Ue,c=new o(this.snapshot,e,t,s);return c.shouldRender?i?.changeHistory():this.forceReloaded=!0,this.render(c)}renderError(e,t){t?.changeHistory();let s=new lr(this.snapshot,e,!1);return this.render(s)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await Oi();let s=e.clone();return this.snapshotCache.put(t,s),s}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action==="replace"}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&this.snapshot.shouldPreserveScrollPosition}get snapshot(){return W.fromElement(this.element)}},fr=class{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#e):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#e)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(this.snapshotCache.has(t))return;await new ye(this,V.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{let s=await t.responseHTML,i=W.fromHTMLString(s);this.snapshotCache.put(e.url,i)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#e=()=>{this.preloadOnLoadLinksForView(document.body)}},pr=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#e("")}exemptPageFromCache(){this.#e("no-cache")}exemptPageFromPreview(){this.#e("no-preview")}#e(e){wo("turbo-cache-control",e)}},mr=class{navigator=new ir(this);history=new rr(this);view=new dr(this,document.documentElement);adapter=new Zt(this);pageObserver=new nr(this);cacheObserver=new er;linkPrefetchObserver=new sr(this,document);linkClickObserver=new vt(this,window);formSubmitObserver=new je(this,document);scrollObserver=new or(this);streamObserver=new cr(this);formLinkClickObserver=new yt(this,document.documentElement);frameRedirector=new tr(this,document.documentElement);streamMessageRenderer=new ar;cache=new pr(this);enabled=!0;started=!1;#e=150;constructor(e){this.recentRequests=e,this.preloader=new fr(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.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.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let s=t.frame?document.getElementById(t.frame):null;if(s instanceof K){let i=t.action||ge(s);s.delegate.proposeVisitIfNavigatedWithAction(s,i),s.src=e.toString()}else this.navigator.proposeVisit($(e),t)}refresh(e,t){let s=t&&this.recentRequests.has(t),i=e===document.baseURI;!s&&!this.navigator.currentVisit&&i&&this.visit(e,{action:"replace",shouldCacheSnapshot:!1})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(fe.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"),this.progressBarDelay=e}set progressBarDelay(e){q.drive.progressBarDelay=e}get progressBarDelay(){return q.drive.progressBarDelay}set drive(e){q.drive.enabled=e}get drive(){return q.drive.enabled}set formMode(e){q.forms.mode=e}get formMode(){return q.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#e}set pageRefreshDebouncePeriod(e){this.refresh=Eo(this.debouncedRefresh.bind(this),e),this.#e=e}shouldPreloadLink(e){let t=e.hasAttribute("data-turbo-method"),s=e.hasAttribute("data-turbo-stream"),i=e.getAttribute("data-turbo-frame"),n=i=="_top"?null:document.getElementById(i)||Re(e,"turbo-frame:not([disabled])");if(t||s||n instanceof K)return!1;{let o=new URL(e.href);return this.elementIsNavigatable(e)&&ue(o,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,s){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:s}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&ue(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&ue(t,this.snapshot.rootLocation)&&this.navigator.linkPrefetchingIsEnabledForLocation(t)}willFollowLinkToLocation(e,t,s){return this.elementIsNavigatable(e)&&ue(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,s)}followedLinkToLocation(e,t){let s=this.getActionForLink(e),i=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:s,acceptsStreamResponse:i})}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){_i(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(ut(document.documentElement),this.view.markVisitDirection(e.direction)),_i(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),dt(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 s=Er(e,t);return this.submissionIsNavigatable(e,t)&&ue($(s),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(){this.navigator.currentVisit?.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let s=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:i,detail:{render:n}}=s;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!i}viewRenderedSnapshot(e,t,s){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(s)}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,s){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,s).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,s){return B("turbo:click",{target:e,detail:{url:t.href,originalEvent:s},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return B("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return B("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return B("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return B("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return B("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return B("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 B("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return B("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(q.forms.mode=="off")return!1;{let s=t?this.elementIsNavigatable(t):!0;return q.forms.mode=="optin"?s&&e.closest('[data-turbo="true"]')!=null:s&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=Re(e,"[data-turbo]"),s=Re(e,"turbo-frame");return q.drive.enabled||s?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return ge(e)||"advance"}get snapshot(){return this.view.snapshot}};function _i(r){Object.defineProperties(r,ya)}var ya={absoluteURL:{get(){return this.toString()}}},D=new mr(Ni),{cache:ba,navigator:wa}=D;function wt(){D.start()}function _a(r){D.registerAdapter(r)}function Ea(r,e){D.visit(r,e)}function ji(r){D.connectStreamSource(r)}function Hi(r){D.disconnectStreamSource(r)}function Sa(r){D.renderStreamMessage(r)}function Aa(){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.`"),D.clearCache()}function Ta(r){console.warn("Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),q.drive.progressBarDelay=r}function Oa(r){console.warn("Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),q.forms.confirm=r}function ka(r){console.warn("Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),q.forms.mode=r}var La=Object.freeze({__proto__:null,navigator:wa,session:D,cache:ba,PageRenderer:Ue,PageSnapshot:W,FrameRenderer:Ve,fetch:Ii,config:q,start:wt,registerAdapter:_a,visit:Ea,connectStreamSource:ji,disconnectStreamSource:Hi,renderStreamMessage:Sa,clearCache:Aa,setProgressBarDelay:Ta,setConfirmMethod:Oa,setFormMode:ka}),gr=class extends Error{},vr=class{fetchResponseLoaded=e=>Promise.resolve();#e=null;#t=()=>{};#r=!1;#n=!1;#o=new Set;#i=!1;action=null;constructor(e){this.element=e,this.view=new Kt(this,this.element),this.appearanceObserver=new Ut(this,this.element),this.formLinkClickObserver=new yt(this,this.element),this.linkInterceptor=new gt(this,this.element),this.restorationIdentifier=de(),this.formSubmitObserver=new je(this,this.element)}connect(){this.#r||(this.#r=!0,this.loadingStyle==ke.lazy?this.appearanceObserver.start():this.#s(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#r&&(this.#r=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==ke.eager&&this.#s()}sourceURLChanged(){this.#y("src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==ke.eager||this.#n)&&this.#s())}sourceURLReloaded(){let{refresh:e,src:t}=this.element;return this.#i=t&&e==="morph",this.element.removeAttribute("complete"),this.element.src=null,this.element.src=t,this.element.loaded}loadingStyleChanged(){this.loadingStyle==ke.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#s())}async#s(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#u($(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#n=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let s=ki(t);W.fromDocument(s).isVisitable?await this.#c(e,s):await this.#f(e)}}finally{this.#i=!1,this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,ge(e)),this.#s()}willSubmitFormLinkToLocation(e){return this.#l(e)}submittedFormLinkToLocation(e,t,s){let i=this.#a(e);i&&s.setAttribute("data-turbo-frame",i.id)}shouldInterceptLinkClick(e,t,s){return this.#l(e)}linkClickIntercepted(e,t){this.#d(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.#l(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new pt(this,e,t);let{fetchRequest:s}=this.formSubmission;this.prepareRequest(s),this.formSubmission.start()}prepareRequest(e){e.headers["Turbo-Frame"]=this.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&e.acceptResponseType(fe.contentType)}requestStarted(e){ut(this.element)}requestPreventedHandlingResponse(e,t){this.#t()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.#t()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.#t()}requestErrored(e,t){console.error(t),this.#t()}requestFinished(e){dt(this.element)}formSubmissionStarted({formElement:e}){ut(e,this.#a(e))}formSubmissionSucceededWithResponse(e,t){let s=this.#a(e.formElement,e.submitter);s.delegate.proposeVisitIfNavigatedWithAction(s,ge(e.submitter,e.formElement,s)),s.delegate.loadResponse(t),e.isSafe||D.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),D.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){dt(e,this.#a(e))}allowsImmediateRender({element:e},t){let s=B("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:i,detail:{render:n}}=s;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!i}viewRenderedSnapshot(e,t,s){}preloadOnLoadLinksForView(e){D.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}visitCachedSnapshot=({element:e})=>{let t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#c(e,t){let s=await this.extractForeignFrameElement(t.body),i=this.#i?Jt:Ve;if(s){let n=new Pe(s),o=new i(this,this.view.snapshot,n,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(o),this.complete=!0,D.frameRendered(e,this.element),D.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else this.#p(e)&&this.#m(e)}async#u(e){let t=new ye(this,V.get,e,new URLSearchParams,this.element);return this.#e?.cancel(),this.#e=t,new Promise(s=>{this.#t=()=>{this.#t=()=>{},this.#e=null,s()},t.perform()})}#d(e,t,s){let i=this.#a(e,s);i.delegate.proposeVisitIfNavigatedWithAction(i,ge(s,e,i)),this.#w(e,()=>{i.src=t})}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){let s=W.fromElement(e).clone(),{visitCachedSnapshot:i}=e.delegate;e.delegate.fetchResponseLoaded=async n=>{if(e.src){let{statusCode:o,redirected:c}=n,a=await n.responseHTML,v={response:{statusCode:o,redirected:c,responseHTML:a},visitCachedSnapshot:i,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:s};this.action&&(v.action=this.action),D.visit(e.src,v)}}}}changeHistory(){if(this.action){let e=Ri(this.action);D.history.update(e,$(this.element.src||""),this.restorationIdentifier)}}async#f(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.#h(e.response)}#p(e){this.element.setAttribute("complete","");let t=e.response,s=async(n,o)=>{n instanceof Response?this.#h(n):D.visit(n,o)};return!B("turbo:frame-missing",{target:this.element,detail:{response:t,visit:s},cancelable:!0}).defaultPrevented}#m(e){this.view.missing(),this.#g(e)}#g(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 gr(t)}async#h(e){let t=new $e(e),s=await t.responseHTML,{location:i,redirected:n,statusCode:o}=t;return D.visit(i,{response:{redirected:n,statusCode:o,responseHTML:s}})}#a(e,t){let s=ht("data-turbo-frame",t,e)||this.element.getAttribute("target");return Ei(s)??this.element}async extractForeignFrameElement(e){let t,s=CSS.escape(this.id);try{if(t=Si(e.querySelector(`turbo-frame#${s}`),this.sourceURL),t)return t;if(t=Si(e.querySelector(`turbo-frame[src][recurse~=${s}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(i){return console.error(i),new K}return null}#v(e,t){let s=Er(e,t);return ue($(s),this.rootLocation)}#l(e,t){let s=ht("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.#v(e,t)||!this.enabled||s=="_top")return!1;if(s){let i=Ei(s);if(i)return!i.disabled}return!(!D.elementIsNavigatable(e)||t&&!D.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.#b("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#t()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&this.#r}get rootLocation(){let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return $(t)}#y(e){return this.#o.has(e)}#b(e,t){this.#o.add(e),t(),this.#o.delete(e)}#w(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}};function Ei(r){if(r!=null){let e=document.getElementById(r);if(e instanceof K)return e}}function Si(r,e){if(r){let t=r.getAttribute("src");if(t!=null&&e!=null&&ko(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 K)return r.connectedCallback(),r.disconnectedCallback(),r}}var Vi={after(){this.targetElements.forEach(r=>r.parentElement?.insertBefore(this.templateContent,r.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.append(this.templateContent))},before(){this.targetElements.forEach(r=>r.parentElement?.insertBefore(this.templateContent,r))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.prepend(this.templateContent))},remove(){this.targetElements.forEach(r=>r.remove())},replace(){let r=this.getAttribute("method");this.targetElements.forEach(e=>{r==="morph"?Tr(e,this.templateContent):e.replaceWith(this.templateContent)})},update(){let r=this.getAttribute("method");this.targetElements.forEach(e=>{r==="morph"?$i(e,this.templateContent):(e.innerHTML="",e.append(this.templateContent))})},refresh(){D.refresh(this.baseURI,this.requestId)}},yr=class r 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(){return this.renderPromise??=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await De(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){let e=this.targetElements.flatMap(s=>[...s.children]).filter(s=>!!s.getAttribute("id")),t=[...this.templateContent?.children||[]].filter(s=>!!s.getAttribute("id")).map(s=>s.getAttribute("id"));return e.filter(s=>t.includes(s.getAttribute("id")))}get performAction(){if(this.action){let e=Vi[this.action];if(e)return e;this.#e("unknown action")}this.#e("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#e("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.#e("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")}get requestId(){return this.getAttribute("request-id")}#e(e){throw new Error(`${this.description}: ${e}`)}get description(){return(this.outerHTML.match(/<[^>]+>/)??[])[0]??"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:r.renderElement}})}get targetElementsById(){let e=this.ownerDocument?.getElementById(this.target);return e!==null?[e]:[]}get targetElementsByQuery(){let e=this.ownerDocument?.querySelectorAll(this.targets);return e.length!==0?Array.prototype.slice.call(e):[]}},br=class extends HTMLElement{streamSource=null;connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),ji(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),Hi(this.streamSource))}get src(){return this.getAttribute("src")||""}};K.delegateConstructor=vr;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",K);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",yr);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",br);(()=>{let r=document.currentScript;if(r&&!r.hasAttribute("data-turbo-suppress-warning"))for(r=r.parentElement;r;){if(r==document.body)return console.warn(Li`
|
39
|
+
You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
|
40
|
+
|
41
|
+
Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.
|
42
|
+
|
43
|
+
For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements
|
44
|
+
|
45
|
+
——
|
46
|
+
Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s
|
47
|
+
`,r.outerHTML);r=r.parentElement}})();window.Turbo={...La,StreamActions:Vi};wt();var Or=class{constructor(e,t,s){this.eventTarget=e,this.eventName=t,this.eventOptions=s,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=Ma(e);for(let s of this.bindings){if(t.immediatePropagationStopped)break;s.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{let s=e.index,i=t.index;return s<i?-1:s>i?1:0})}};function Ma(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 kr=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,s={}){this.application.handleError(e,`Error ${t}`,s)}clearEventListenersForBinding(e){let t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){let{eventTarget:t,eventName:s,eventOptions:i}=e,n=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(s,i);n.delete(o),n.size==0&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){let{eventTarget:t,eventName:s,eventOptions:i}=e;return this.fetchEventListener(t,s,i)}fetchEventListener(e,t,s){let i=this.fetchEventListenerMapForEventTarget(e),n=this.cacheKey(t,s),o=i.get(n);return o||(o=this.createEventListener(e,t,s),i.set(n,o)),o}createEventListener(e,t,s){let i=new Or(e,t,s);return this.started&&i.connect(),i}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){let s=[e];return Object.keys(t).sort().forEach(i=>{s.push(`${t[i]?"":"!"}${i}`)}),s.join(":")}},Pa={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}},Fa=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function Ca(r){let t=r.trim().match(Fa)||[],s=t[2],i=t[3];return i&&!["keydown","keyup","keypress"].includes(s)&&(s+=`.${i}`,i=""),{eventTarget:xa(t[4]),eventName:s,eventOptions:t[7]?Na(t[7]):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||i}}function xa(r){if(r=="window")return window;if(r=="document")return document}function Na(r){return r.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function Ia(r){if(r==window)return"window";if(r==document)return"document"}function Gr(r){return r.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function Lr(r){return Gr(r.replace(/--/g,"-").replace(/__/g,"_"))}function Ke(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Zi(r){return r.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function Ba(r){return r.match(/[^\s]+/g)||[]}function Ui(r){return r!=null}function Rr(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var Wi=["meta","ctrl","alt","shift"],Mr=class{constructor(e,t,s,i){this.element=e,this.index=t,this.eventTarget=s.eventTarget||e,this.eventName=s.eventName||Da(e)||_t("missing event name"),this.eventOptions=s.eventOptions||{},this.identifier=s.identifier||_t("missing identifier"),this.methodName=s.methodName||_t("missing method name"),this.keyFilter=s.keyFilter||"",this.schema=i}static forToken(e,t){return new this(e.element,e.index,Ca(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 s=t.filter(i=>!Wi.includes(i))[0];return s?(Rr(this.keyMappings,s)||_t(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[s].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:s,value:i}of Array.from(this.element.attributes)){let n=s.match(t),o=n&&n[1];o&&(e[Gr(o)]=qa(i))}return e}get eventTargetName(){return Ia(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){let[s,i,n,o]=Wi.map(c=>t.includes(c));return e.metaKey!==s||e.ctrlKey!==i||e.altKey!==n||e.shiftKey!==o}},Ki={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:r=>r.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function Da(r){let e=r.tagName.toLowerCase();if(e in Ki)return Ki[e](r)}function _t(r){throw new Error(r)}function qa(r){try{return JSON.parse(r)}catch{return r}}var Pr=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:s}=this.context.application,{controller:i}=this.context,n=!0;for(let[o,c]of Object.entries(this.eventOptions))if(o in s){let a=s[o];n=n&&a({name:o,value:c,event:e,element:t,controller:i})}else continue;return n}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){let{target:t,currentTarget:s}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:s,action:this.methodName})}catch(i){let{identifier:n,controller:o,element:c,index:a}=this,d={identifier:n,controller:o,element:c,index:a,event:e};this.context.handleError(i,`invoking action "${this.action}"`,d)}}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}},Et=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(s=>this.processMutations(s))}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 s=this.elementFromNode(t);s&&this.processTree(s,this.removeElement)}}processAddedNodes(e){for(let t of Array.from(e)){let s=this.elementFromNode(t);s&&this.elementIsActive(s)&&this.processTree(s,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(let s of this.matchElementsInTree(e))t.call(this,s)}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))}},St=class{constructor(e,t,s){this.attributeName=t,this.delegate=s,this.elementObserver=new Et(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]:[],s=Array.from(e.querySelectorAll(this.selector));return t.concat(s)}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 $a(r,e,t){en(r,e).add(t)}function ja(r,e,t){en(r,e).delete(t),Ha(r,e)}function en(r,e){let t=r.get(e);return t||(t=new Set,r.set(e,t)),t}function Ha(r,e){let t=r.get(e);t!=null&&t.size==0&&r.delete(e)}var se=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((t,s)=>t.concat(Array.from(s)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((t,s)=>t+s.size,0)}add(e,t){$a(this.valuesByKey,e,t)}delete(e,t){ja(this.valuesByKey,e,t)}has(e,t){let s=this.valuesByKey.get(e);return s!=null&&s.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(s=>s.has(e))}getValuesForKey(e){let t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,s])=>s.has(e)).map(([t,s])=>t)}};var Fr=class{constructor(e,t,s,i){this._selector=t,this.details=i,this.elementObserver=new Et(e,this),this.delegate=s,this.matchesByElement=new se}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 s=e.matches(t);return this.delegate.selectorMatchElement?s&&this.delegate.selectorMatchElement(e,this.details):s}else return!1}matchElementsInTree(e){let{selector:t}=this;if(t){let s=this.matchElement(e)?[e]:[],i=Array.from(e.querySelectorAll(t)).filter(n=>this.matchElement(n));return s.concat(i)}else return[]}elementMatched(e){let{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){let t=this.matchesByElement.getKeysForValue(e);for(let s of t)this.selectorUnmatched(e,s)}elementAttributeChanged(e,t){let{selector:s}=this;if(s){let i=this.matchElement(e),n=this.matchesByElement.has(s,e);i&&!n?this.selectorMatched(e,s):!i&&n&&this.selectorUnmatched(e,s)}}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)}},Cr=class{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(s=>this.processMutations(s))}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 s=this.delegate.getStringMapKeyForAttribute(e);if(s!=null){this.stringMap.has(e)||this.stringMapKeyAdded(s,e);let i=this.element.getAttribute(e);if(this.stringMap.get(e)!=i&&this.stringMapValueChanged(i,s,t),i==null){let n=this.stringMap.get(e);this.stringMap.delete(e),n&&this.stringMapKeyRemoved(s,e,n)}else this.stringMap.set(e,i)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,s){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,s)}stringMapKeyRemoved(e,t,s){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,s)}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())}},At=class{constructor(e,t,s){this.attributeObserver=new St(e,t,this),this.delegate=s,this.tokensByElement=new se}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,s]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(s)}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),s=this.readTokensForElement(e),i=Ua(t,s).findIndex(([n,o])=>!Wa(n,o));return i==-1?[[],[]]:[t.slice(i),s.slice(i)]}readTokensForElement(e){let t=this.attributeName,s=e.getAttribute(t)||"";return Va(s,e,t)}};function Va(r,e,t){return r.trim().split(/\s+/).filter(s=>s.length).map((s,i)=>({element:e,attributeName:t,content:s,index:i}))}function Ua(r,e){let t=Math.max(r.length,e.length);return Array.from({length:t},(s,i)=>[r[i],e[i]])}function Wa(r,e){return r&&e&&r.index==e.index&&r.content==e.content}var Tt=class{constructor(e,t,s){this.tokenListObserver=new At(e,t,this),this.delegate=s,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:s}=this.fetchParseResultForToken(e);s&&(this.fetchValuesByTokenForElement(t).set(e,s),this.delegate.elementMatchedValue(t,s))}tokenUnmatched(e){let{element:t}=e,{value:s}=this.fetchParseResultForToken(e);s&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,s))}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}}}},xr=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new Tt(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 Pr(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=Mr.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},Nr=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new Cr(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 s=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,s.writer(this.receiver[e]),s.writer(s.defaultValue))}stringMapValueChanged(e,t,s){let i=this.valueDescriptorNameMap[t];e!==null&&(s===null&&(s=i.writer(i.defaultValue)),this.invokeChangedCallback(t,e,s))}stringMapKeyRemoved(e,t,s){let i=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,i.writer(this.receiver[e]),s):this.invokeChangedCallback(e,i.writer(i.defaultValue),s)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:t,defaultValue:s,writer:i}of this.valueDescriptors)s!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(t,i(s),void 0)}invokeChangedCallback(e,t,s){let i=`${e}Changed`,n=this.receiver[i];if(typeof n=="function"){let o=this.valueDescriptorNameMap[e];try{let c=o.reader(t),a=s;s&&(a=o.reader(s)),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 s=this.valueDescriptorMap[t];e[s.name]=s}),e}hasValue(e){let t=this.valueDescriptorNameMap[e],s=`has${Ke(t.name)}`;return this.receiver[s]}},Ir=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new se}start(){this.tokenListObserver||(this.tokenListObserver=new At(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 s;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),(s=this.tokenListObserver)===null||s===void 0||s.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var s;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),(s=this.tokenListObserver)===null||s===void 0||s.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 ze(r,e){let t=tn(r);return Array.from(t.reduce((s,i)=>(za(i,e).forEach(n=>s.add(n)),s),new Set))}function Ka(r,e){return tn(r).reduce((s,i)=>(s.push(...Ja(i,e)),s),[])}function tn(r){let e=[];for(;r;)e.push(r),r=Object.getPrototypeOf(r);return e.reverse()}function za(r,e){let t=r[e];return Array.isArray(t)?t:[]}function Ja(r,e){let t=r[e];return t?Object.keys(t).map(s=>[s,t[s]]):[]}var Br=class{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new se,this.outletElementsByName=new se,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:s}){let i=this.getOutlet(e,s);i&&this.connectOutlet(i,e,s)}selectorUnmatched(e,t,{outletName:s}){let i=this.getOutletFromMap(e,s);i&&this.disconnectOutlet(i,e,s)}selectorMatchElement(e,{outletName:t}){let s=this.selector(t),i=this.hasOutlet(e,t),n=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return s?i&&n&&e.matches(s):!1}elementMatchedAttribute(e,t){let s=this.getOutletNameFromOutletAttributeName(t);s&&this.updateSelectorObserverForOutlet(s)}elementAttributeValueChanged(e,t){let s=this.getOutletNameFromOutletAttributeName(t);s&&this.updateSelectorObserverForOutlet(s)}elementUnmatchedAttribute(e,t){let s=this.getOutletNameFromOutletAttributeName(t);s&&this.updateSelectorObserverForOutlet(s)}connectOutlet(e,t,s){var i;this.outletElementsByName.has(s,t)||(this.outletsByName.add(s,e),this.outletElementsByName.add(s,t),(i=this.selectorObserverMap.get(s))===null||i===void 0||i.pause(()=>this.delegate.outletConnected(e,t,s)))}disconnectOutlet(e,t,s){var i;this.outletElementsByName.has(s,t)&&(this.outletsByName.delete(s,e),this.outletElementsByName.delete(s,t),(i=this.selectorObserverMap.get(s))===null||i===void 0||i.pause(()=>this.delegate.outletDisconnected(e,t,s)))}disconnectAllOutlets(){for(let e of this.outletElementsByName.keys)for(let t of this.outletElementsByName.getValuesForKey(e))for(let s of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(s,t,e)}updateSelectorObserverForOutlet(e){let t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){let t=this.selector(e),s=new Fr(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,s),s.start()}setupAttributeObserverForOutlet(e){let t=this.attributeNameForOutletName(e),s=new St(this.scope.element,t,this);this.attributeObserverMap.set(e,s),s.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 se;return this.router.modules.forEach(t=>{let s=t.definition.controllerConstructor;ze(s,"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(s=>s.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}},Dr=class{constructor(e,t){this.logDebugActivity=(s,i={})=>{let{identifier:n,controller:o,element:c}=this;i=Object.assign({identifier:n,controller:o,element:c},i),this.application.logDebugActivity(this.identifier,s,i)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new xr(this,this.dispatcher),this.valueObserver=new Nr(this,this.controller),this.targetObserver=new Ir(this,this),this.outletObserver=new Br(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(s){this.handleError(s,"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,s={}){let{identifier:i,controller:n,element:o}=this;s=Object.assign({identifier:i,controller:n,element:o},s),this.application.handleError(e,`Error ${t}`,s)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,s){this.invokeControllerMethod(`${Lr(s)}OutletConnected`,e,t)}outletDisconnected(e,t,s){this.invokeControllerMethod(`${Lr(s)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let s=this.controller;typeof s[e]=="function"&&s[e](...t)}};function Ga(r){return Xa(r,Qa(r))}function Xa(r,e){let t=tc(r),s=Ya(r.prototype,e);return Object.defineProperties(t.prototype,s),t}function Qa(r){return ze(r,"blessings").reduce((t,s)=>{let i=s(r);for(let n in i){let o=t[n]||{};t[n]=Object.assign(o,i[n])}return t},{})}function Ya(r,e){return ec(e).reduce((t,s)=>{let i=Za(r,e,s);return i&&Object.assign(t,{[s]:i}),t},{})}function Za(r,e,t){let s=Object.getOwnPropertyDescriptor(r,t);if(!(s&&"value"in s)){let n=Object.getOwnPropertyDescriptor(e,t).value;return s&&(n.get=s.get||n.get,n.set=s.set||n.set),n}}var ec=typeof Object.getOwnPropertySymbols=="function"?r=>[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)]:Object.getOwnPropertyNames,tc=(()=>{function r(t){function s(){return Reflect.construct(t,arguments,new.target)}return s.prototype=Object.create(t.prototype,{constructor:{value:s}}),Reflect.setPrototypeOf(s,t),s}function e(){let s=r(function(){this.a.call(this)});return s.prototype.a=function(){},new s}try{return e(),r}catch{return s=>class extends s{}}})();function rc(r){return{identifier:r.identifier,controllerConstructor:Ga(r.controllerConstructor)}}var qr=class{constructor(e,t){this.application=e,this.definition=rc(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 Dr(this,e),this.contextsByScope.set(e,t)),t}},$r=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 Ba(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},jr=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 s=this.getAttributeNameForKey(e);return this.element.setAttribute(s,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}-${Zi(e)}`}},Hr=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,s){let i=this.warnedKeysByObject.get(e);i||(i=new Set,this.warnedKeysByObject.set(e,i)),i.has(t)||(i.add(t),this.logger.warn(s,e))}};function Vr(r,e){return`[${r}~="${e}"]`}var Ur=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,s)=>t||this.findTarget(s)||this.findLegacyTarget(s),void 0)}findAll(...e){return e.reduce((t,s)=>[...t,...this.findAllTargets(s),...this.findAllLegacyTargets(s)],[])}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 Vr(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(s=>this.deprecate(s,e))}getLegacySelectorForTargetName(e){let t=`${this.identifier}.${e}`;return Vr(this.schema.targetAttribute,t)}deprecate(e,t){if(e){let{identifier:s}=this,i=this.schema.targetAttribute,n=this.schema.targetAttributeForScope(s);this.guide.warn(e,`target:${t}`,`Please replace ${i}="${s}.${t}" with ${n}="${t}". The ${i} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},Wr=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,s)=>t||this.findOutlet(s),void 0)}findAll(...e){return e.reduce((t,s)=>[...t,...this.findAllOutlets(s)],[])}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(i=>this.matchesElement(i,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(i=>this.matchesElement(i,e,t))}matchesElement(e,t,s){let i=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&i.split(" ").includes(s)}},Kr=class r{constructor(e,t,s,i){this.targets=new Ur(this),this.classes=new $r(this),this.data=new jr(this),this.containsElement=n=>n.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=s,this.guide=new Hr(i),this.outlets=new Wr(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 Vr(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new r(this.schema,document.documentElement,this.identifier,this.guide.logger)}},zr=class{constructor(e,t,s){this.element=e,this.schema=t,this.delegate=s,this.valueListObserver=new Tt(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:s}=e;return this.parseValueForElementAndIdentifier(t,s)}parseValueForElementAndIdentifier(e,t){let s=this.fetchScopesByIdentifierForElement(e),i=s.get(t);return i||(i=this.delegate.createScopeForElementAndIdentifier(e,t),s.set(t,i)),i}elementMatchedValue(e,t){let s=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,s),s==1&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){let s=this.scopeReferenceCounts.get(t);s&&(this.scopeReferenceCounts.set(t,s-1),s==1&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}},Jr=class{constructor(e){this.application=e,this.scopeObserver=new zr(this.element,this.schema,this),this.scopesByIdentifier=new se,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 qr(this.application,e);this.connectModule(t);let s=e.controllerConstructor.afterLoad;s&&s.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){let t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){let s=this.modulesByIdentifier.get(t);if(s)return s.contexts.find(i=>i.element==e)}proposeToConnectScopeForElementAndIdentifier(e,t){let s=this.scopeObserver.parseValueForElementAndIdentifier(e,t);s?this.scopeObserver.elementMatchedValue(s.element,s):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,s){this.application.handleError(e,t,s)}createScopeForElementAndIdentifier(e,t){return new Kr(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(s=>e.connectContextForScope(s))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(s=>e.disconnectContextForScope(s))}},sc={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"},zi("abcdefghijklmnopqrstuvwxyz".split("").map(r=>[r,r]))),zi("0123456789".split("").map(r=>[r,r])))};function zi(r){return r.reduce((e,[t,s])=>Object.assign(Object.assign({},e),{[t]:s}),{})}var Ot=class{constructor(e=document.documentElement,t=sc){this.logger=console,this.debug=!1,this.logDebugActivity=(s,i,n={})=>{this.debug&&this.logFormattedMessage(s,i,n)},this.element=e,this.schema=t,this.dispatcher=new kr(this),this.router=new Jr(this),this.actionDescriptorFilters=Object.assign({},Pa)}static start(e,t){let s=new this(e,t);return s.start(),s}async start(){await ic(),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(i=>{i.controllerConstructor.shouldLoad&&this.router.loadDefinition(i)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(i=>this.router.unloadIdentifier(i))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){let s=this.router.getContextForElementAndIdentifier(e,t);return s?s.controller:null}handleError(e,t,s){var i;this.logger.error(`%s
|
48
|
+
|
49
|
+
%o
|
50
|
+
|
51
|
+
%o`,t,e,s),(i=window.onerror)===null||i===void 0||i.call(window,t,"",0,0,e)}logFormattedMessage(e,t,s={}){s=Object.assign({application:this},s),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},s)),this.logger.groupEnd()}};function ic(){return new Promise(r=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>r()):r()})}function nc(r){return ze(r,"classes").reduce((t,s)=>Object.assign(t,oc(s)),{})}function oc(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${Ke(r)}Class`]:{get(){return this.classes.has(r)}}}}function ac(r){return ze(r,"outlets").reduce((t,s)=>Object.assign(t,cc(s)),{})}function Ji(r,e,t){return r.application.getControllerForElementAndIdentifier(e,t)}function Gi(r,e,t){let s=Ji(r,e,t);if(s||(r.application.router.proposeToConnectScopeForElementAndIdentifier(e,t),s=Ji(r,e,t),s))return s}function cc(r){let e=Lr(r);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(r),s=this.outlets.getSelectorForOutletName(r);if(t){let i=Gi(this,t,r);if(i)return i;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 "${s}".`)}},[`${e}Outlets`]:{get(){let t=this.outlets.findAll(r);return t.length>0?t.map(s=>{let i=Gi(this,s,r);if(i)return i;console.warn(`The provided outlet element is missing an outlet controller "${r}" instance for host controller "${this.identifier}"`,s)}).filter(s=>s):[]}},[`${e}OutletElement`]:{get(){let t=this.outlets.find(r),s=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 "${s}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(r)}},[`has${Ke(e)}Outlet`]:{get(){return this.outlets.has(r)}}}}function lc(r){return ze(r,"targets").reduce((t,s)=>Object.assign(t,hc(s)),{})}function hc(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${Ke(r)}Target`]:{get(){return this.targets.has(r)}}}}function uc(r){let e=Ka(r,"values"),t={valueDescriptorMap:{get(){return e.reduce((s,i)=>{let n=rn(i,this.identifier),o=this.data.getAttributeNameForKey(n.key);return Object.assign(s,{[o]:n})},{})}}};return e.reduce((s,i)=>Object.assign(s,dc(i)),t)}function dc(r,e){let t=rn(r,e),{key:s,name:i,reader:n,writer:o}=t;return{[i]:{get(){let c=this.data.get(s);return c!==null?n(c):t.defaultValue},set(c){c===void 0?this.data.delete(s):this.data.set(s,o(c))}},[`has${Ke(i)}`]:{get(){return this.data.has(s)||t.hasCustomDefaultValue}}}}function rn([r,e],t){return gc({controller:t,token:r,typeDefinition:e})}function kt(r){switch(r){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function We(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 fc(r){let{controller:e,token:t,typeObject:s}=r,i=Ui(s.type),n=Ui(s.default),o=i&&n,c=i&&!n,a=!i&&n,d=kt(s.type),v=We(r.typeObject.default);if(c)return d;if(a)return v;if(d!==v){let y=e?`${e}.${t}`:t;throw new Error(`The specified default value for the Stimulus Value "${y}" must match the defined type "${d}". The provided default value of "${s.default}" is of type "${v}".`)}if(o)return d}function pc(r){let{controller:e,token:t,typeDefinition:s}=r,n=fc({controller:e,token:t,typeObject:s}),o=We(s),c=kt(s),a=n||o||c;if(a)return a;let d=e?`${e}.${s}`:t;throw new Error(`Unknown value type "${d}" for "${t}" value`)}function mc(r){let e=kt(r);if(e)return Xi[e];let t=Rr(r,"default"),s=Rr(r,"type"),i=r;if(t)return i.default;if(s){let{type:n}=i,o=kt(n);if(o)return Xi[o]}return r}function gc(r){let{token:e,typeDefinition:t}=r,s=`${Zi(e)}-value`,i=pc(r);return{type:i,key:s,name:Gr(s),get defaultValue(){return mc(t)},get hasCustomDefaultValue(){return We(t)!==void 0},reader:vc[i],writer:Qi[i]||Qi.default}}var Xi={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},vc={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 "${We(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 "${We(e)}"`);return e},string(r){return r}},Qi={default:yc,array:Yi,object:Yi};function Yi(r){return JSON.stringify(r)}function yc(r){return`${r}`}var Q=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:s={},prefix:i=this.identifier,bubbles:n=!0,cancelable:o=!0}={}){let c=i?`${i}:${e}`:e,a=new CustomEvent(c,{detail:s,bubbles:n,cancelable:o});return t.dispatchEvent(a),a}};Q.blessings=[nc,lc,uc,ac];Q.targets=[];Q.outlets=[];Q.values={};var Lt=class extends Q{static targets=["toggler"];connect(){this.togglerTarget.checked=this.storedDarkMode}toggle(){window.localStorage.setItem("dark-mode",this.isDarkModeEnabled)}get isBrowserDarkModeEnabled(){return window.matchMedia("(prefers-color-scheme: dark)").matches}get isDarkModeEnabled(){return this.togglerTarget.checked}get storedDarkMode(){return[null,"true"].includes(window.localStorage.getItem("dark-mode"))}};window.pagefind=(gn(),An(mn));var Rt=class extends Q{static targets=["container","empty","placeholder","searching","label","input","form"];static values={q:String};async connect(){if(await window.pagefind.options({baseUrl:"",bundlePath:"pagefind/",excerptLength:0}),await window.pagefind.init(),window.location.search){let r=new URLSearchParams(window.location.search);if(r.has("q")){let e=this.formTarget;"q"in e.elements&&(e.elements.q.value=r.get("q"),this.search({target:e}))}}}async search(r){if(!this.hasContainerTarget)return;let e=r.target,s=new FormData(e).get("q")||null;this.qValue=s,this.formDisable(e,!0),this.searchingTargets.forEach(n=>n.classList.remove("d-none")),this.searchResults=await window.pagefind.search(s);let i=this.searchResults.results.length;if(this.containerTarget.innerHTML="",this.emptyTargets.forEach(n=>n.classList.add("d-none")),this.searchingTargets.forEach(n=>n.classList.add("d-none")),i){let n=await this.resolveResults(this.searchResults.results);this.renderResults(n)}else this.emptyTargets.forEach(n=>n.classList.remove("d-none"));this.formDisable(e,!1)}async resolveResults(r){return await Promise.all(r.map(e=>e.data()))}async reset(r){this.searchResults=null}updateHistory(){let r=this.qValue,e=new URLSearchParams({q:r});window.history.pushState({q:r},r,`?${e.toString()}`)}formDisable(r,e){Array.from(r.elements).forEach(t=>t.disabled=e)}renderResults(r){r.forEach(e=>this.renderResult(e))}renderResult(r){let e=this.placeholderTarget.content.firstElementChild.cloneNode(!0);this.containerTarget.appendChild(e),fetch(r.meta.indexed).then(t=>t.text()).then(t=>{let s=document.createElement("template");s.innerHTML=t;let i=s.content.firstElementChild;e.replaceWith(i)}).catch(console.error)}};if(window.env.JEKYLL_ENV==="production")try{window.airbrake=new $t({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)}wt();window.Stimulus=Ot.start();window.abortController=void 0;Stimulus.debug=window.env.JEKYLL_ENV!=="production";Stimulus.register("dark-mode",Lt);Stimulus.register("pagefind",Rt);document.addEventListener("turbo:load",r=>{window.abortController=new AbortController});document.addEventListener("turbo:visit",r=>{window.abortController.abort()});})();
|
52
|
+
/*! Bundled license information:
|
53
|
+
|
54
|
+
@hotwired/turbo/dist/turbo.es2017-esm.js:
|
55
|
+
(*!
|
56
|
+
Turbo 8.0.13
|
57
|
+
Copyright © 2025 37signals LLC
|
58
|
+
*)
|
59
|
+
*/
|
60
|
+
//# sourceMappingURL=pack.CO6WJJ2F.js.map
|