var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n={exports:{}},r={exports:{}};!function(e,t){function n(e,t){for(var n=0;n0){var o=n(r,this);~o?r.splice(o+1):r.push(this),~o?i.splice(o,1/0,s):i.push(s),~n(r,a)&&(a=t.call(this,s,a))}else r.push(a);return null==e?a instanceof Error?function(e){var t={stack:e.stack,message:e.message,name:e.name};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}(a):a:e.call(this,s,a)}}(r.exports=function(e,t,n,r){return JSON.stringify(e,i(t,r),n)}).getSerialize=i}();var i=r.exports,s=i,a="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{};function o(e){return void 0===e}function u(e){return"[object Object]"===Object.prototype.toString.call(e)}function l(e){return"[object String]"===Object.prototype.toString.call(e)}function c(e){return"[object Array]"===Object.prototype.toString.call(e)}function h(){if(!("fetch"in a))return!1;try{return new Headers,new Request(""),new Response,!0}catch(e){return!1}}function d(e,t){var n,r;if(o(e.length))for(n in e)f(e,n)&&t.call(null,n,e[n]);else if(r=e.length)for(n=0;n1&&i+3*n.length+t.length>=80);)n.push(t),i+=t.length,e=e.parentNode;return n.reverse().join(" > ")},htmlElementAsString:m,isSameException:function(e,t){return!v(e,t)&&(e=e.values[0],t=t.values[0],e.type===t.type&&e.value===t.value&&(n=e.stacktrace,r=t.stacktrace,(!o(n)||!o(r))&&_(e.stacktrace,t.stacktrace)));var n,r},isSameStacktrace:_,parseUrl:function(e){if("string"!=typeof e)return{};var t=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/),n=t[6]||"",r=t[8]||"";return{protocol:t[2],host:t[4],path:t[5],relative:t[5]+n+r}},fill:function(e,t,n,r){if(null!=e){var i=e[t];e[t]=n(i),e[t].__raven__=!0,e[t].__orig__=i,r&&r.push([e,t,i])}},safeJoin:function(e,t){if(!c(e))return"";for(var n=[],r=0;rr?e(t,n-1):i},serializeKeysForMessage:function(e,t){if("number"==typeof e||"string"==typeof e)return e.toString();if(!Array.isArray(e))return"";if(0===(e=e.filter((function(e){return"string"==typeof e}))).length)return"[object has no keys]";if(t="number"!=typeof t?40:t,e[0].length>=t)return e[0];for(var n=e.length;n>0;n--){var r=e.slice(0,n).join(", ");if(!(r.length>t))return n===e.length?r:r+"…"}return""},sanitize:function(e,t){if(!c(t)||c(t)&&0===t.length)return e;var n,r=g(t);try{n=JSON.parse(s(e))}catch(t){return e}return function e(t){return c(t)?t.map((function(t){return e(t)})):u(t)?Object.keys(t).reduce((function(n,i){return r.test(i)?n[i]="********":n[i]=e(t[i]),n}),{}):t}(n)}},x=w,C={collectWindowErrors:!0,debug:!1},S="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},A=[].slice,O="?",k=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function F(){return"undefined"==typeof document||null==document.location?"":document.location.href}C.report=function(){var e,t,n=[],r=null,i=null,s=null;function a(e,t){var r=null;if(!t||C.collectWindowErrors){for(var i in n)if(n.hasOwnProperty(i))try{n[i].apply(null,[e].concat(A.call(arguments,2)))}catch(e){r=e}if(r)throw r}}function o(t,n,r,i,o){var l=x.isErrorEvent(o)?o.error:o,c=x.isErrorEvent(t)?t.message:t;if(s)C.computeStackTrace.augmentStackTraceWithInitialElement(s,n,r,c),u();else if(l&&x.isError(l))a(C.computeStackTrace(l),!0);else{var h,d={url:n,line:r,column:i},p=void 0;if("[object String]"==={}.toString.call(c))(h=c.match(k))&&(p=h[1],c=h[2]);d.func=O,a({name:p,message:c,url:F(),stack:[d]},!0)}return!!e&&e.apply(this,arguments)}function u(){var e=s,t=r;r=null,s=null,i=null,a.apply(null,[e,!1].concat(t))}function l(e,t){var n=A.call(arguments,1);if(s){if(i===e)return;u()}var a=C.computeStackTrace(e);if(s=a,i=e,r=n,setTimeout((function(){i===e&&u()}),a.incomplete?2e3:0),!1!==t)throw e}return l.subscribe=function(r){!function(){if(t)return;e=S.onerror,S.onerror=o,t=!0}(),n.push(r)},l.unsubscribe=function(e){for(var t=n.length-1;t>=0;--t)n[t]===e&&n.splice(t,1)},l.uninstall=function(){!function(){if(!t)return;S.onerror=e,t=!1,e=void 0}(),n=[]},l}(),C.computeStackTrace=function(){function e(e){if(void 0!==e.stack&&e.stack){var t,n,r,i=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|native|eval|webpack||[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,s=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx(?:-web)|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,a=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js))(?::(\d+))?(?::(\d+))?\s*$/i,o=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,u=/\((\S*)(?::(\d+))(?::(\d+))\)/,l=e.stack.split("\n"),c=[];/^(.*) is undefined$/.exec(e.message);for(var h=0,d=l.length;h eval")>-1&&(t=o.exec(n[3]))?(n[3]=t[1],n[4]=t[2],n[5]=null):0!==h||n[5]||void 0===e.columnNumber||(c[0].column=e.columnNumber+1),r={url:n[3],func:n[1]||O,args:n[2]?n[2].split(","):[],line:n[4]?+n[4]:null,column:n[5]?+n[5]:null}}if(!r.func&&r.line&&(r.func=O),r.url&&"blob:"===r.url.substr(0,5)){var f=new XMLHttpRequest;if(f.open("GET",r.url,!1),f.send(null),200===f.status){var g=f.responseText||"",m=(g=g.slice(-300)).match(/\/\/# sourceMappingURL=(.*)$/);if(m){var v=m[1];"~"===v.charAt(0)&&(v=("undefined"==typeof document||null==document.location?"":document.location.origin?document.location.origin:document.location.protocol+"//"+document.location.hostname+(document.location.port?":"+document.location.port:""))+v.slice(1)),r.url=v.slice(0,-4)}}}c.push(r)}return c.length?{name:e.name,message:e.message,url:F(),stack:c}:null}}function t(e,t,n,r){var i={url:t,line:n};if(i.url&&i.line){if(e.incomplete=!1,i.func||(i.func=O),e.stack.length>0&&e.stack[0].url===i.url){if(e.stack[0].line===i.line)return!1;if(!e.stack[0].line&&e.stack[0].func===i.func)return e.stack[0].line=i.line,!1}return e.stack.unshift(i),e.partial=!0,!0}return e.incomplete=!0,!1}function n(e,i){for(var s,a,o=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,u=[],l={},c=!1,h=n.caller;h&&!c;h=h.caller)if(h!==r&&h!==C.report){if(a={url:null,func:O,line:null,column:null},h.name?a.func=h.name:(s=o.exec(h.toString()))&&(a.func=s[1]),void 0===a.func)try{a.func=s.input.substring(0,s.input.indexOf("{"))}catch(e){}l[""+h]?c=!0:l[""+h]=!0,u.push(a)}i&&u.splice(0,i);var d={name:e.name,message:e.message,url:F(),stack:u};return t(d,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),d}function r(t,r){var i=null;r=null==r?0:+r;try{if(i=e(t))return i}catch(e){if(C.debug)throw e}try{if(i=n(t,r+1))return i}catch(e){if(C.debug)throw e}return{name:t.name,message:t.message,url:F()}}return r.augmentStackTraceWithInitialElement=t,r.computeStackTraceFromStackProp=e,r}();var L=C;function D(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function B(e,t,n,r,i,s){return D((a=D(D(t,e),D(r,s)))<<(o=i)|a>>>32-o,n);var a,o}function j(e,t,n,r,i,s,a){return B(t&n|~t&r,e,t,i,s,a)}function T(e,t,n,r,i,s,a){return B(t&r|n&~r,e,t,i,s,a)}function R(e,t,n,r,i,s,a){return B(t^n^r,e,t,i,s,a)}function I(e,t,n,r,i,s,a){return B(n^(t|~r),e,t,i,s,a)}function N(e,t){var n,r,i,s,a;e[t>>5]|=128<>>9<<4)]=t;var o=1732584193,u=-271733879,l=-1732584194,c=271733878;for(n=0;n>5]>>>t%32&255);return n}function H(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t>5]|=(255&e.charCodeAt(t/8))<>>4&15)+r.charAt(15&t);return i}function q(e){return unescape(encodeURIComponent(e))}function U(e){return function(e){return M(N(H(e),8*e.length))}(q(e))}function z(e,t){return function(e,t){var n,r,i=H(e),s=[],a=[];for(s[15]=a[15]=void 0,i.length>16&&(i=N(i,8*e.length)),n=0;n<16;n+=1)s[n]=909522486^i[n],a[n]=1549556828^i[n];return r=N(s.concat(H(t)),512+8*t.length),M(N(a.concat(r),640))}(q(e),q(t))}var V=function(e,t,n){return t?n?z(t,e):P(z(t,e)):n?U(e):P(U(e))};function W(e){this.name="RavenConfigError",this.message=e}W.prototype=new Error,W.prototype.constructor=W;var X=w,K=L,J=i,$=V,Y=W,G=w.isErrorEvent,Z=w.isDOMError,Q=w.isDOMException,ee=w.isError,te=w.isObject,ne=w.isPlainObject,re=w.isUndefined,ie=w.isFunction,se=w.isString,ae=w.isArray,oe=w.isEmptyObject,ue=w.each,le=w.objectMerge,ce=w.truncate,he=w.objectFrozen,de=w.hasKey,pe=w.joinRegExp,fe=w.urlencode,ge=w.uuid4,me=w.htmlTreeAsString,ve=w.isSameException,_e=w.isSameStacktrace,be=w.parseUrl,ye=w.fill,Ee=w.supportsFetch,we=w.supportsReferrerPolicy,xe=w.serializeKeysForMessage,Ce=w.serializeException,Se=w.sanitize,Ae=function(e,t,n){var r=e[t],i=e;if(t in e){var s="warn"===t?"warning":t;e[t]=function(){var e=[].slice.call(arguments),a=X.safeJoin(e," "),o={level:s,logger:"console",extra:{arguments:e}};"assert"===t?!1===e[0]&&(a="Assertion failed: "+(X.safeJoin(e.slice(1)," ")||"console.assert"),o.extra.arguments=e.slice(1),n&&n(a,o)):n&&n(a,o),r&&Function.prototype.apply.call(r,i,e)}}},Oe="source protocol user pass host port path".split(" "),ke=/^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/;function Fe(){return+new Date}var Le="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},De=Le.document,Be=Le.navigator;function je(e,t){return ie(t)?function(n){return t(n,e)}:t}function Te(){for(var e in this._hasJSON=!("object"!=typeof JSON||!JSON.stringify),this._hasDocument=!re(De),this._hasNavigator=!re(Be),this._lastCapturedException=null,this._lastData=null,this._lastEventId=null,this._globalServer=null,this._globalKey=null,this._globalProject=null,this._globalContext={},this._globalOptions={release:Le.SENTRY_RELEASE&&Le.SENTRY_RELEASE.id,logger:"javascript",ignoreErrors:[],ignoreUrls:[],whitelistUrls:[],includePaths:[],headers:null,collectWindowErrors:!0,captureUnhandledRejections:!0,maxMessageLength:0,maxUrlLength:250,stackTraceLimit:50,autoBreadcrumbs:!0,instrument:!0,sampleRate:1,sanitizeKeys:[]},this._fetchDefaults={method:"POST",referrerPolicy:we()?"origin":""},this._ignoreOnError=0,this._isRavenInstalled=!1,this._originalErrorStackTraceLimit=Error.stackTraceLimit,this._originalConsole=Le.console||{},this._originalConsoleMethods={},this._plugins=[],this._startTime=Fe(),this._wrappedBuiltIns=[],this._breadcrumbs=[],this._lastCapturedEvent=null,this._keypressTimeout,this._location=Le.location,this._lastHref=this._location&&this._location.href,this._resetBackoff(),this._originalConsole)this._originalConsoleMethods[e]=this._originalConsole[e]}Te.prototype={VERSION:"3.27.2",debug:!1,TraceKit:K,config:function(e,t){var n=this;if(n._globalServer)return this._logDebug("error","Error: Raven has already been configured"),n;if(!e)return n;var r=n._globalOptions;t&&ue(t,(function(e,t){"tags"===e||"extra"===e||"user"===e?n._globalContext[e]=t:r[e]=t})),n.setDSN(e),r.ignoreErrors.push(/^Script error\.?$/),r.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/),r.ignoreErrors=pe(r.ignoreErrors),r.ignoreUrls=!!r.ignoreUrls.length&&pe(r.ignoreUrls),r.whitelistUrls=!!r.whitelistUrls.length&&pe(r.whitelistUrls),r.includePaths=pe(r.includePaths),r.maxBreadcrumbs=Math.max(0,Math.min(r.maxBreadcrumbs||100,100));var i={xhr:!0,console:!0,dom:!0,location:!0,sentry:!0},s=r.autoBreadcrumbs;"[object Object]"==={}.toString.call(s)?s=le(i,s):!1!==s&&(s=i),r.autoBreadcrumbs=s;var a={tryCatch:!0},o=r.instrument;return"[object Object]"==={}.toString.call(o)?o=le(a,o):!1!==o&&(o=a),r.instrument=o,K.collectWindowErrors=!!r.collectWindowErrors,n},install:function(){var e=this;return e.isSetup()&&!e._isRavenInstalled&&(K.report.subscribe((function(){e._handleOnErrorStackInfo.apply(e,arguments)})),e._globalOptions.captureUnhandledRejections&&e._attachPromiseRejectionHandler(),e._patchFunctionToString(),e._globalOptions.instrument&&e._globalOptions.instrument.tryCatch&&e._instrumentTryCatch(),e._globalOptions.autoBreadcrumbs&&e._instrumentBreadcrumbs(),e._drainPlugins(),e._isRavenInstalled=!0),Error.stackTraceLimit=e._globalOptions.stackTraceLimit,this},setDSN:function(e){var t=this,n=t._parseDSN(e),r=n.path.lastIndexOf("/"),i=n.path.substr(1,r);t._dsn=e,t._globalKey=n.user,t._globalSecret=n.pass&&n.pass.substr(1),t._globalProject=n.path.substr(r+1),t._globalServer=t._getGlobalServer(n),t._globalEndpoint=t._globalServer+"/"+i+"api/"+t._globalProject+"/store/",this._resetBackoff()},context:function(e,t,n){return ie(e)&&(n=t||[],t=e,e={}),this.wrap(e,t).apply(this,n)},wrap:function(e,t,n){var r=this;if(re(t)&&!ie(e))return e;if(ie(e)&&(t=e,e=void 0),!ie(t))return t;try{if(t.__raven__)return t;if(t.__raven_wrapper__)return t.__raven_wrapper__}catch(e){return t}function i(){var i=[],s=arguments.length,a=!e||e&&!1!==e.deep;for(n&&ie(n)&&n.apply(this,arguments);s--;)i[s]=a?r.wrap(e,arguments[s]):arguments[s];try{return t.apply(this,i)}catch(t){throw r._ignoreNextOnError(),r.captureException(t,e),t}}for(var s in t)de(t,s)&&(i[s]=t[s]);return i.prototype=t.prototype,t.__raven_wrapper__=i,i.__raven__=!0,i.__orig__=t,i},uninstall:function(){return K.report.uninstall(),this._detachPromiseRejectionHandler(),this._unpatchFunctionToString(),this._restoreBuiltIns(),this._restoreConsole(),Error.stackTraceLimit=this._originalErrorStackTraceLimit,this._isRavenInstalled=!1,this},_promiseRejectionHandler:function(e){this._logDebug("debug","Raven caught unhandled promise rejection:",e),this.captureException(e.reason,{mechanism:{type:"onunhandledrejection",handled:!1}})},_attachPromiseRejectionHandler:function(){return this._promiseRejectionHandler=this._promiseRejectionHandler.bind(this),Le.addEventListener&&Le.addEventListener("unhandledrejection",this._promiseRejectionHandler),this},_detachPromiseRejectionHandler:function(){return Le.removeEventListener&&Le.removeEventListener("unhandledrejection",this._promiseRejectionHandler),this},captureException:function(e,t){if(t=le({trimHeadFrames:0},t||{}),G(e)&&e.error)e=e.error;else{if(Z(e)||Q(e)){var n=e.name||(Z(e)?"DOMError":"DOMException"),r=e.message?n+": "+e.message:n;return this.captureMessage(r,le(t,{stacktrace:!0,trimHeadFrames:t.trimHeadFrames+1}))}if(ee(e));else{if(!ne(e))return this.captureMessage(e,le(t,{stacktrace:!0,trimHeadFrames:t.trimHeadFrames+1}));t=this._getCaptureExceptionOptionsFromPlainObject(t,e),e=new Error(t.message)}}this._lastCapturedException=e;try{var i=K.computeStackTrace(e);this._handleStackInfo(i,t)}catch(t){if(e!==t)throw t}return this},_getCaptureExceptionOptionsFromPlainObject:function(e,t){var n=Object.keys(t).sort(),r=le(e,{message:"Non-Error exception captured with keys: "+xe(n),fingerprint:[$(n)],extra:e.extra||{}});return r.extra.__serialized__=Ce(t),r},captureMessage:function(e,t){if(!this._globalOptions.ignoreErrors.test||!this._globalOptions.ignoreErrors.test(e)){var n,r=le({message:e+=""},t=t||{});try{throw new Error(e)}catch(e){n=e}n.name=null;var i=K.computeStackTrace(n),s=ae(i.stack)&&i.stack[1];s&&"Raven.captureException"===s.func&&(s=i.stack[2]);var a=s&&s.url||"";if((!this._globalOptions.ignoreUrls.test||!this._globalOptions.ignoreUrls.test(a))&&(!this._globalOptions.whitelistUrls.test||this._globalOptions.whitelistUrls.test(a))){if(this._globalOptions.stacktrace||t.stacktrace||""===r.message){r.fingerprint=null==r.fingerprint?e:r.fingerprint,(t=le({trimHeadFrames:0},t)).trimHeadFrames+=1;var o=this._prepareFrames(i,t);r.stacktrace={frames:o.reverse()}}return r.fingerprint&&(r.fingerprint=ae(r.fingerprint)?r.fingerprint:[r.fingerprint]),this._send(r),this}}},captureBreadcrumb:function(e){var t=le({timestamp:Fe()/1e3},e);if(ie(this._globalOptions.breadcrumbCallback)){var n=this._globalOptions.breadcrumbCallback(t);if(te(n)&&!oe(n))t=n;else if(!1===n)return this}return this._breadcrumbs.push(t),this._breadcrumbs.length>this._globalOptions.maxBreadcrumbs&&this._breadcrumbs.shift(),this},addPlugin:function(e){var t=[].slice.call(arguments,1);return this._plugins.push([e,t]),this._isRavenInstalled&&this._drainPlugins(),this},setUserContext:function(e){return this._globalContext.user=e,this},setExtraContext:function(e){return this._mergeContext("extra",e),this},setTagsContext:function(e){return this._mergeContext("tags",e),this},clearContext:function(){return this._globalContext={},this},getContext:function(){return JSON.parse(J(this._globalContext))},setEnvironment:function(e){return this._globalOptions.environment=e,this},setRelease:function(e){return this._globalOptions.release=e,this},setDataCallback:function(e){var t=this._globalOptions.dataCallback;return this._globalOptions.dataCallback=je(t,e),this},setBreadcrumbCallback:function(e){var t=this._globalOptions.breadcrumbCallback;return this._globalOptions.breadcrumbCallback=je(t,e),this},setShouldSendCallback:function(e){var t=this._globalOptions.shouldSendCallback;return this._globalOptions.shouldSendCallback=je(t,e),this},setTransport:function(e){return this._globalOptions.transport=e,this},lastException:function(){return this._lastCapturedException},lastEventId:function(){return this._lastEventId},isSetup:function(){return!!this._hasJSON&&(!!this._globalServer||(this.ravenNotConfiguredError||(this.ravenNotConfiguredError=!0,this._logDebug("error","Error: Raven has not been configured.")),!1))},afterLoad:function(){var e=Le.RavenConfig;e&&this.config(e.dsn,e.config).install()},showReportDialog:function(e){if(De){if(!(e=le({eventId:this.lastEventId(),dsn:this._dsn,user:this._globalContext.user||{}},e)).eventId)throw new Y("Missing eventId");if(!e.dsn)throw new Y("Missing DSN");var t=encodeURIComponent,n=[];for(var r in e)if("user"===r){var i=e.user;i.name&&n.push("name="+t(i.name)),i.email&&n.push("email="+t(i.email))}else n.push(t(r)+"="+t(e[r]));var s=this._getGlobalServer(this._parseDSN(e.dsn)),a=De.createElement("script");a.async=!0,a.src=s+"/api/embed/error-page/?"+n.join("&"),(De.head||De.body).appendChild(a)}},_ignoreNextOnError:function(){var e=this;this._ignoreOnError+=1,setTimeout((function(){e._ignoreOnError-=1}))},_triggerEvent:function(e,t){var n,r;if(this._hasDocument){for(r in t=t||{},e="raven"+e.substr(0,1).toUpperCase()+e.substr(1),De.createEvent?(n=De.createEvent("HTMLEvents")).initEvent(e,!0,!0):(n=De.createEventObject()).eventType=e,t)de(t,r)&&(n[r]=t[r]);if(De.createEvent)De.dispatchEvent(n);else try{De.fireEvent("on"+n.eventType.toLowerCase(),n)}catch(e){}}},_breadcrumbEventHandler:function(e){var t=this;return function(n){if(t._keypressTimeout=null,t._lastCapturedEvent!==n){var r;t._lastCapturedEvent=n;try{r=me(n.target)}catch(e){r=""}t.captureBreadcrumb({category:"ui."+e,message:r})}}},_keypressEventHandler:function(){var e=this;return function(t){var n;try{n=t.target}catch(e){return}var r=n&&n.tagName;if(r&&("INPUT"===r||"TEXTAREA"===r||n.isContentEditable)){var i=e._keypressTimeout;i||e._breadcrumbEventHandler("input")(t),clearTimeout(i),e._keypressTimeout=setTimeout((function(){e._keypressTimeout=null}),1e3)}}},_captureUrlChange:function(e,t){var n=be(this._location.href),r=be(t),i=be(e);this._lastHref=t,n.protocol===r.protocol&&n.host===r.host&&(t=r.relative),n.protocol===i.protocol&&n.host===i.host&&(e=i.relative),this.captureBreadcrumb({category:"navigation",data:{to:t,from:e}})},_patchFunctionToString:function(){var e=this;e._originalFunctionToString=Function.prototype.toString,Function.prototype.toString=function(){return"function"==typeof this&&this.__raven__?e._originalFunctionToString.apply(this.__orig__,arguments):e._originalFunctionToString.apply(this,arguments)}},_unpatchFunctionToString:function(){this._originalFunctionToString&&(Function.prototype.toString=this._originalFunctionToString)},_instrumentTryCatch:function(){var e=this,t=e._wrappedBuiltIns;function n(t){return function(n,r){for(var i=new Array(arguments.length),s=0;s"}}},a)),t.apply?t.apply(this,i):t(i[0],i[1])}}var r=this._globalOptions.autoBreadcrumbs;function i(n){var i=Le[n]&&Le[n].prototype;i&&i.hasOwnProperty&&i.hasOwnProperty("addEventListener")&&(ye(i,"addEventListener",(function(t){return function(i,s,a,o){try{s&&s.handleEvent&&(s.handleEvent=e.wrap({mechanism:{type:"instrument",data:{target:n,function:"handleEvent",handler:s&&s.name||""}}},s.handleEvent))}catch(e){}var u,l,c;return r&&r.dom&&("EventTarget"===n||"Node"===n)&&(l=e._breadcrumbEventHandler("click"),c=e._keypressEventHandler(),u=function(e){if(e){var t;try{t=e.type}catch(e){return}return"click"===t?l(e):"keypress"===t?c(e):void 0}}),t.call(this,i,e.wrap({mechanism:{type:"instrument",data:{target:n,function:"addEventListener",handler:s&&s.name||""}}},s,u),a,o)}}),t),ye(i,"removeEventListener",(function(e){return function(t,n,r,i){try{n=n&&(n.__raven_wrapper__?n.__raven_wrapper__:n)}catch(e){}return e.call(this,t,n,r,i)}}),t))}ye(Le,"setTimeout",n,t),ye(Le,"setInterval",n,t),Le.requestAnimationFrame&&ye(Le,"requestAnimationFrame",(function(t){return function(n){return t(e.wrap({mechanism:{type:"instrument",data:{function:"requestAnimationFrame",handler:t&&t.name||""}}},n))}}),t);for(var s=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],a=0;a"}}},n)}))}if(t.xhr&&"XMLHttpRequest"in Le){var i=Le.XMLHttpRequest&&Le.XMLHttpRequest.prototype;ye(i,"open",(function(t){return function(n,r){return se(r)&&-1===r.indexOf(e._globalKey)&&(this.__raven_xhr={method:n,url:r,status_code:null}),t.apply(this,arguments)}}),n),ye(i,"send",(function(t){return function(){var n=this;function i(){if(n.__raven_xhr&&4===n.readyState){try{n.__raven_xhr.status_code=n.status}catch(e){}e.captureBreadcrumb({type:"http",category:"xhr",data:n.__raven_xhr})}}for(var s=["onload","onerror","onprogress"],a=0;a"}}},t,i)})):n.onreadystatechange=i,t.apply(this,arguments)}}),n)}t.xhr&&Ee()&&ye(Le,"fetch",(function(t){return function(){for(var n=new Array(arguments.length),r=0;r2?arguments[2]:void 0;return n&&e._captureUrlChange(e._lastHref,n+""),t.apply(this,arguments)}};ye(Le.history,"pushState",u,n),ye(Le.history,"replaceState",u,n)}if(t.console&&"console"in Le&&console.log){var l=function(t,n){e.captureBreadcrumb({message:t,level:n.level,category:"console"})};ue(["debug","info","warn","error","log"],(function(e,t){Ae(console,t,l)}))}},_restoreBuiltIns:function(){for(var e;this._wrappedBuiltIns.length;){var t=(e=this._wrappedBuiltIns.shift())[0],n=e[1],r=e[2];t[n]=r}},_restoreConsole:function(){for(var e in this._originalConsoleMethods)this._originalConsole[e]=this._originalConsoleMethods[e]},_drainPlugins:function(){var e=this;ue(this._plugins,(function(t,n){var r=n[0],i=n[1];r.apply(e,[e].concat(i))}))},_parseDSN:function(e){var t=ke.exec(e),n={},r=7;try{for(;r--;)n[Oe[r]]=t[r]||""}catch(t){throw new Y("Invalid DSN: "+e)}if(n.pass&&!this._globalOptions.allowSecretKey)throw new Y("Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key");return n},_getGlobalServer:function(e){var t="//"+e.host+(e.port?":"+e.port:"");return e.protocol&&(t=e.protocol+":"+t),t},_handleOnErrorStackInfo:function(e,t){(t=t||{}).mechanism=t.mechanism||{type:"onerror",handled:!1},this._ignoreOnError||this._handleStackInfo(e,t)},_handleStackInfo:function(e,t){var n=this._prepareFrames(e,t);this._triggerEvent("handle",{stackInfo:e,options:t}),this._processException(e.name,e.message,e.url,e.lineno,n,t)},_prepareFrames:function(e,t){var n=this,r=[];if(e.stack&&e.stack.length&&(ue(e.stack,(function(t,i){var s=n._normalizeFrame(i,e.url);s&&r.push(s)})),t&&t.trimHeadFrames))for(var i=0;i0&&(e.breadcrumbs={values:[].slice.call(this._breadcrumbs,0)}),this._globalContext.user&&(e.user=this._globalContext.user),t.environment&&(e.environment=t.environment),t.release&&(e.release=t.release),t.serverName&&(e.server_name=t.serverName),e=this._sanitizeData(e),Object.keys(e).forEach((function(t){(null==e[t]||""===e[t]||oe(e[t]))&&delete e[t]})),ie(t.dataCallback)&&(e=t.dataCallback(e)||e),e&&!oe(e)&&(ie(t.shouldSendCallback)&&!t.shouldSendCallback(e)||(this._shouldBackoff()?this._logDebug("warn","Raven dropped error due to backoff: ",e):"number"==typeof t.sampleRate?Math.random(){var r="is-"+ze(n);t[n]?e.classList.add(r):e.classList.remove(r)}))}function We(e){for(var t={},n=e.querySelectorAll("[data-ref]"),r=function(){var e=n[i];(e.getAttribute("data-ref")||"").split(" ").forEach((n=>{t[n]=e}))},i=0;i1&&void 0!==arguments[1]?arguments[1]:{};if(!e)throw new Error("Controllers require an element passed to the constructor");e.controllers?e.controllers.push(this):e.controllers=[this],this.state={},this.element=e,this.options=t,this.refs=We(e)}setState(e){var t=this.state;this.state=Object.freeze(Object.assign({},this.state,e)),this.update(this.state,t)}forceUpdate(){this.update(this.state,this.state)}on(e,t,n){this.element.addEventListener(e,t,n)}beforeRemove(){}}class Je extends Error{constructor(e,t){super(e),Object.assign(this,t)}}function $e(e){var t,n;return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.fetch)((n=e,n.getAttribute("action")?n.action:document.location.href),{body:new FormData(e),credentials:"same-origin",method:"POST",headers:{"X-Requested-With":"XMLHttpRequest"}}).then((e=>(t=e).text())).then((e=>{var{status:n}=t;switch(n){case 200:return{status:n,form:e};case 400:throw new Je("Form validation failed",{status:n,form:e});default:throw new Je("Form submission failed",{status:n,reason:t.statusText})}}))}function Ye(e){return-1!==["checkbox","radio"].indexOf(e)}function Ge(e){return e.dataset.hideUntilActive}class Ze extends Ke{constructor(e,t){super(e,t),Ve(this.refs.cancelBtn,{hidden:!1}),this.refs.cancelBtn.addEventListener("click",(e=>{e.preventDefault(),this.cancel()})),this._fields=Array.from(e.querySelectorAll(".js-form-input")).map((e=>{var t=We(e);return{container:e,input:t.formInput,label:t.label}})),this.on("focus",(e=>{var t=this._fields.find((t=>t.input===e.target));t&&this.setState({editingFields:this._editSet(t),focusedField:t})}),!0),this.on("change",(e=>{Ye(e.target.type)&&this.submit()})),this.on("input",(e=>{Ye(e.target.type)||this.setState({dirty:!0})})),this.on("keydown",(e=>{e.stopPropagation(),"Escape"===e.key&&this.cancel()})),this.refs.formBackdrop.addEventListener("mousedown",(e=>{e.preventDefault(),e.stopPropagation()})),this.on("submit",(e=>{e.preventDefault(),this.submit()})),this.setState({dirty:!1,editingFields:[],focusedField:null,originalForm:this.element.outerHTML,saving:!1,submitError:""})}update(e,t){1===e.editingFields.length&&e.editingFields[0].container.parentElement.insertBefore(this.refs.formActions,e.editingFields[0].container.nextSibling),e.editingFields.length>0&&e.editingFields!==t.editingFields&&this._trapFocus();var n=e.editingFields.length>0;Ve(this.element,{editing:n}),Ve(this.refs.formActions,{hidden:!n||Ye(e.editingFields[0].input.type),saving:e.saving}),Ve(this.refs.formSubmitError,{visible:e.submitError.length>0}),this.refs.formSubmitErrorMessage.textContent=e.submitError,this._updateFields(e)}_updateFields(e){this._fields.forEach((t=>{Ve(t.container,{editing:e.editingFields.includes(t),focused:t===e.focusedField,hidden:Ge(t.container)&&!e.editingFields.includes(t)});var n=t.container.dataset.activeLabel,r=t.container.dataset.inactiveLabel,i=e.editingFields.includes(t);n&&r&&(t.label.textContent=i?n:r),"password"===t.input.type&&t.input.setAttribute("placeholder",i?"":"••••••••")}))}beforeRemove(){this._releaseFocus&&this._releaseFocus()}submit(){var e,t=this.state.originalForm;return this.state.editingFields.length>0&&(e=this.state.editingFields[0].input.id),this.setState({saving:!0}),$e(this.element).then((e=>{this.options.reload(e.form)})).catch((n=>{if(n.form){var r=this.options.reload(n.form).controllers.find((e=>e instanceof Ze)),i=document.getElementById(e);i&&i.focus(),r.setState({dirty:null!==i,originalForm:t})}else this.setState({submitError:n.reason||"There was a problem saving changes.",saving:!1})}))}_focusGroup(){var e=this.state.editingFields.map((e=>e.container));return 0===e.length?null:[this.refs.formActions].concat(e)}_trapFocus(){this._releaseFocus=function(e,t){Ue&&Ue();var n=n=>{if(!e.some((e=>e.contains(n.target)))){var r=t(n.target);r?(n.preventDefault(),n.stopPropagation(),r.focus()):Ue&&Ue()}};document.addEventListener("focus",n,!0);var r=()=>{Ue===r&&(Ue=null,document.removeEventListener("focus",n,!0))};return Ue=r,r}(this._focusGroup(),(e=>this.state.dirty?this.state.editingFields[0].input:(this.element.contains(e)||this.setState({editingFields:[]}),null)))}_editSet(e){return this._fields.some((e=>Ge(e.container)))?this._fields:[e]}cancel(){this.options.reload(this.state.originalForm)}}var Qe={".js-character-limit":class extends Ke{constructor(e){super(e),this.refs.characterLimitInput.addEventListener("input",(()=>{this.forceUpdate()})),this.forceUpdate()}update(){var e=this.refs.characterLimitInput,t=parseInt(e.dataset.maxlength),n=this.refs.characterLimitCounter;n.textContent=e.value.length+"/"+t,Ve(n,{tooLong:e.value.length>t}),Ve(this.refs.characterLimitCounter,{ready:!0})}},".js-copy-button":class extends Ke{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e,t);var n=t.userAgent||navigator.userAgent;this.refs.input.readOnly=!function(e){return/\bMobile\b/.test(e)&&/\bSafari\b/.test(e)}(n),this.refs.button.onclick=()=>{this.refs.input.focus(),this.refs.input.setSelectionRange(0,this.refs.input.value.length);var e=document.execCommand("copy")?"Link copied to clipboard!":"Copying link failed",t=this.refs.input.value;this.refs.input.value=e,window.setTimeout((()=>{this.refs.input.value=t,this.refs.input.blur()}),1e3)}}},".js-confirm-submit":class extends Ke{constructor(e,t){super(e);var n=t.window||window;e.addEventListener("click",(t=>{if(!n.confirm(e.dataset.confirmMessage))return t.preventDefault(),t.stopPropagation(),void t.stopImmediatePropagation()}),!0)}},".js-disable-on-submit":class extends Ke{constructor(e){super(e);var t=e.querySelectorAll('[type="submit"]');e.addEventListener("submit",(()=>{for(var e=0;e{this.refs.dropdownMenuContent.contains(r.target)||(t.contains(r.target)&&(r.stopPropagation(),r.preventDefault()),this.setState({open:!1}),e.ownerDocument.removeEventListener("click",n,!0))};t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),this.setState({open:!0}),e.ownerDocument.addEventListener("click",n,!0)}))}update(e){Ve(this.refs.dropdownMenuContent,{open:e.open}),this.refs.dropdownMenuToggle.setAttribute("aria-expanded",e.open.toString())}},".js-form":Ze,".js-form-cancel":class extends Ke{constructor(e,t){super(e,t);var n=t.window||window;e.addEventListener("click",(e=>{e.preventDefault(),n.close()}))}},".js-form-input":class extends Ke{constructor(e){super(e);var t=e.classList.contains("is-error");this.setState({hasError:t}),e.addEventListener("input",(()=>{this.setState({hasError:!1})}))}update(){Ve(this.element,{error:this.state.hasError})}},".js-input-autofocus":class extends Ke{constructor(e){super(e),this._onKeyDown=t=>{document.activeElement===document.body?(function(e){return e.key.match(/^\w$/)&&!e.ctrlKey&&!e.altKey&&!e.metaKey}(t)||"Backspace"===t.key)&&e.focus():document.activeElement===e&&"Escape"===t.key&&e.blur()},document.addEventListener("keydown",this._onKeyDown)}beforeRemove(){document.removeEventListener("keydown",this._onKeyDown)}},".js-list-input":class extends Ke{constructor(e){super(e),this.refs.addItemButton.addEventListener("click",(()=>{var e=Xe(this.refs.itemTemplate);this.refs.itemList.appendChild(e)})),e.addEventListener("click",(e=>{"removeItemButton"===e.target.closest("button").getAttribute("data-ref")&&e.target.closest("li").remove()}))}},".js-select-onfocus":class extends Ke{constructor(e){super(e),e===document.activeElement&&e.select(),e.addEventListener("focus",(e=>{e.target.select()}))}},".js-tooltip":class extends Ke{constructor(e){super(e),e.addEventListener("mouseover",(()=>{this.setState({target:e})})),e.addEventListener("mouseout",(()=>{this.setState({target:null})})),this._tooltipEl=e.ownerDocument.createElement("div"),this._tooltipEl.innerHTML='',this._tooltipEl.className="tooltip",e.appendChild(this._tooltipEl),this._labelEl=this._tooltipEl.querySelector(".js-tooltip-label"),this.setState({target:null})}update(e){if(e.target){var t=e.target.getAttribute("aria-label");this._labelEl.textContent=t,Object.assign(this._tooltipEl.style,{visibility:"",bottom:"calc(100% + 5px)"})}else this._tooltipEl.style.visibility="hidden"}}}; /*! * escape-html * Copyright(c) 2012-2013 TJ Holowaychuk * Copyright(c) 2015 Andreas Lubbe * Copyright(c) 2015 Tiancheng "Timothy" Gu * MIT Licensed */ var et=/["'&<>]/;var tt=t((function(e){var t,n=""+e,r=et.exec(n);if(!r)return n;var i="",s=0,a=0;for(s=r.index;se.length-1||e.indexOf('"',1)<0))&&((0!==e.indexOf("'")||!(e.indexOf("'",1)>e.length-1||e.indexOf("'",1)<0))&&((e.indexOf('"',1)!==e.length-1||0===e.indexOf('"'))&&(e.indexOf("'",1)!==e.length-1||0===e.indexOf("'")))))}function rt(e){if(e.indexOf(":")>=0){var t=it(e);if(!nt(t.facetName))return!1;if(t.facetValue.length>0&&!nt(t.facetValue))return!1}else if(!nt(e))return!1;return!0}function it(e){var t,n={facetName:"",facetValue:""};return e.indexOf(":")>=0?(t=e.indexOf(":"),n.facetName=e.slice(0,t).trim(),n.facetValue=e.slice(t+1,e.length).trim(),n):(n.facetValue=e,n)}var st=function(e,t){return!Array.isArray(e)||!Array.isArray(t)||(e.length!==t.length||!e.every(((e,n)=>e===t[n])))},at=13,ot=38,ut=40;class lt extends Ke{constructor(e,t){if(super(e,t),!t.renderListItem)throw new Error("Missing renderListItem callback in AutosuggestDropdownController constructor");if(!t.listFilter)throw new Error("Missing listFilter function in AutosuggestDropdownController constructor");if(!t.onSelect)throw new Error("Missing onSelect callback in AutosuggestDropdownController constructor");t.classNames&&(this.options.classNames.container=t.classNames.container||"autosuggest__container",this.options.classNames.list=t.classNames.list||"autosuggest__list",this.options.classNames.item=t.classNames.item||"autosuggest__list-item",this.options.classNames.activeItem=t.classNames.activeItem||"autosuggest__list-item--active",this.options.classNames.header=t.classNames.header||"autosuggest__header"),this._input=this.element,this.setState({visible:!1,header:t.header||"",list:[],rootList:[]}),this._setList(t.list),this.setHeader=this._setHeader}update(e,t){"visible"in t||(this._renderContentContainers(),this._addTopLevelEventListeners()),e.visible!==t.visible&&Ve(this._suggestionContainer,{open:e.visible}),e.header!==t.header&&(this._header.innerHTML=e.header);var n=st(e.list,t.list);if(n&&this._renderListItems(),e.activeId!==t.activeId||n){var r=this._getActiveListItemElement();t.activeId&&r&&r.classList.remove(this.options.classNames.activeItem),e.activeId&&e.list.find((t=>t.__suggestionId===e.activeId))&&this._listContainer.querySelector('[data-suggestion-id="'.concat(e.activeId,'"]')).classList.add(this.options.classNames.activeItem)}}_setHeader(e){this.setState({header:e})}_setList(e){if(!Array.isArray(e))throw new TypeError("setList requires an array first argument");this.setState({rootList:e.map((e=>Object.assign({},e,{__suggestionId:Math.random().toString(36).substr(2,5)})))}),this._filterListFromInput()}_filterListFromInput(){this.setState({list:this.options.listFilter(this.state.rootList,this._input.value)||[]})}_filterAndToggleVisibility(){this._filterListFromInput(),this._toggleSuggestionsVisibility(this.state.list.length>0)}_selectCurrentActiveItem(){var e=this._getActiveListItemElement(),t=e&&e.getAttribute("data-suggestion-id"),n=this.state.list.filter((e=>e.__suggestionId===t))[0];n&&(this.options.onSelect(n),this._filterAndToggleVisibility(),this.setState({activeId:null}))}_toggleItemHoverState(e,t){var n=this._getActiveListItemElement(),r=t.currentTarget;e&&n&&n.contains(r)||this.setState({activeId:e?r.getAttribute("data-suggestion-id"):null})}_toggleSuggestionsVisibility(e){this.setState({visible:!!e})}_getActiveListItemElement(){return this._listContainer.querySelector("."+this.options.classNames.activeItem)}_keyboardSelectionChange(e){var t,n=this._getActiveListItemElement();t=n?e?n.nextSibling:n.previousSibling:e?this._listContainer.firstChild:this._listContainer.lastChild,this.setState({activeId:t?t.getAttribute("data-suggestion-id"):null})}_renderContentContainers(){this._suggestionContainer=document.createElement("div"),this._suggestionContainer.classList.add(this.options.classNames.container),this._header=document.createElement("h4"),this._header.classList.add(this.options.classNames.header),this._setHeader(this.state.header),this._suggestionContainer.appendChild(this._header),this._listContainer=document.createElement("ul"),this._listContainer.setAttribute("role","listbox"),this._listContainer.classList.add(this.options.classNames.list),this._suggestionContainer.appendChild(this._listContainer),HTMLElement.prototype.insertAdjacentElement?this._input.insertAdjacentElement("afterend",this._suggestionContainer):this._input.parentNode.insertBefore(this._suggestionContainer,this._input.nextSibling)}_renderListItems(){this._listContainer.innerHTML="",this.state.list.forEach((e=>{var t=document.createElement("li");t.setAttribute("role","option"),t.classList.add(this.options.classNames.item),t.setAttribute("data-suggestion-id",e.__suggestionId),t.addEventListener("mouseenter",this._toggleItemHoverState.bind(this,!0)),t.addEventListener("mouseleave",this._toggleItemHoverState.bind(this,!1)),t.addEventListener("mousedown",(e=>{this._toggleItemHoverState(!0,e),this._selectCurrentActiveItem()})),t.innerHTML=this.options.renderListItem(e),this._listContainer.appendChild(t)}))}_addTopLevelEventListeners(){document.addEventListener("mousedown",(e=>{var t=e.target;this.state.visible&&t!==this._input&&(this._suggestionContainer.contains(t)&&(e.preventDefault(),e.stopPropagation()),this._toggleSuggestionsVisibility(!1))})),this._input.addEventListener("keydown",(e=>{var t=e.keyCode;(t!==at||this._getActiveListItemElement())&&[at,ot,ut].indexOf(t)>-1&&(t===at?this._selectCurrentActiveItem():this._keyboardSelectionChange(t===ut),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())}),!0),this._input.addEventListener("keyup",(e=>{-1===[at,ot,ut].indexOf(e.keyCode)&&this._filterAndToggleVisibility()}),!0),this._input.addEventListener("focus",(()=>{this._filterAndToggleVisibility()})),this._input.addEventListener("blur",(()=>{this._toggleSuggestionsVisibility(!1)}))}}class ct extends Ke{constructor(e,t){super(e,t),this.refs.deleteButton.type="button";var n="",r=t.content;if(function(e){var t=it(e).facetName;return["user","uri","url","group","tag"].indexOf(t)>=0}(t.content)){var i=it(t.content);n=i.facetName,r=i.facetValue}e.classList.add("js-lozenge"),this.refs.deleteButton.addEventListener("click",(e=>{e.preventDefault(),t.deleteCallback()})),this.setState({facetName:n,facetValue:r,disabled:!1})}update(e){Ve(this.element,{disabled:e.disabled});var t=e.facetName;t&&(t+=":"),this.refs.facetName.textContent=t,this.refs.facetValue.textContent=e.facetValue}inputValue(){return this.state.facetName?this.state.facetName+":"+this.state.facetValue:this.state.facetValue}}var ht="FACET",dt="TAG",pt="GROUP",ft=function(e){return function(e){return e.replace(qe,"")}(function(e){return String.prototype.normalize?e.normalize("NFKD"):e}(e))};var gt="complete",mt="canceled";function vt(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function _t(e){var t=e._scrollSettings;if(t){var n=t.maxSynchronousAlignments,r=function(e,t){var n,r,i,s,a,o,u,l=e.align,c=e.target.getBoundingClientRect(),h=l&&null!=l.left?l.left:.5,d=l&&null!=l.top?l.top:.5,p=l&&null!=l.leftOffset?l.leftOffset:0,f=l&&null!=l.topOffset?l.topOffset:0,g=h,m=d;if(e.isWindow(t))o=Math.min(c.width,t.innerWidth),u=Math.min(c.height,t.innerHeight),r=c.left+t.pageXOffset-t.innerWidth*g+o*g,i=c.top+t.pageYOffset-t.innerHeight*m+u*m,r-=p,i-=f,r=e.align.lockX?t.pageXOffset:r,i=e.align.lockY?t.pageYOffset:i,s=r-t.pageXOffset,a=i-t.pageYOffset;else{o=c.width,u=c.height,n=t.getBoundingClientRect();var v=c.left-(n.left-t.scrollLeft),_=c.top-(n.top-t.scrollTop);r=v+o*g-t.clientWidth*g,i=_+u*m-t.clientHeight*m,r-=p,i-=f,r=Math.max(Math.min(r,t.scrollWidth-t.clientWidth),0),i=Math.max(Math.min(i,t.scrollHeight-t.clientHeight),0),r=e.align.lockX?t.scrollLeft:r,i=e.align.lockY?t.scrollTop:i,s=r-t.scrollLeft,a=i-t.scrollTop}return{x:r,y:i,differenceX:s,differenceY:a}}(t,e),i=Date.now()-t.startTime,s=Math.min(1/t.time*i,1);if(t.endIterations>=n)return vt(e,r.x,r.y),e._scrollSettings=null,t.end(gt);var a=1-t.ease(s);if(vt(e,r.x-r.differenceX*a,r.y-r.differenceY*a),i>=t.time)return t.endIterations++,t.scrollAncestor&&_t(t.scrollAncestor),void _t(e);!function(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}(_t.bind(null,e))}}function bt(e){return e.self===e}function yt(e){return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function Et(){return!0}function wt(e){if(e.assignedSlot)return wt(e.assignedSlot);if(e.parentElement)return"body"===e.parentElement.tagName.toLowerCase()?e.parentElement.ownerDocument.defaultView||e.parentElement.ownerDocument.ownerWindow:e.parentElement;if(e.getRootNode){var t=e.getRootNode();if(11===t.nodeType)return t.host}}var xt=function(e,t,n){if(e){"function"==typeof t&&(n=t,t=null),t||(t={}),t.time=isNaN(t.time)?1e3:t.time,t.ease=t.ease||function(e){return 1-Math.pow(1-e,e/2)},t.align=t.align||{};var r=wt(e),i=1,s=t.validTarget||Et,a=t.isScrollable;t.debug&&(console.log("About to scroll to",e),r||console.error("Target did not have a parent, is it mounted in the DOM?"));for(var o=[];r;)if(t.debug&&console.log("Scrolling parent node",r),s(r,i)&&(a?a(r,yt):yt(r))&&(i++,o.push(r)),!(r=wt(r))){u(gt);break}return o.reduce(((n,r,i)=>function(e,t,n,r,i){var s,a=!t._scrollSettings,o=t._scrollSettings,u=Date.now(),l={passive:!0};function c(e){t._scrollSettings=null,t.parentElement&&t.parentElement._scrollSettings&&t.parentElement._scrollSettings.end(e),n.debug&&console.log("Scrolling ended with type",e,"for",t),i(e),s&&(t.removeEventListener("touchstart",s,l),t.removeEventListener("wheel",s,l))}o&&o.end(mt);var h=n.maxSynchronousAlignments;return null==h&&(h=3),t._scrollSettings={startTime:u,endIterations:0,target:e,time:n.time,ease:n.ease,align:n.align,isWindow:n.isWindow||bt,maxSynchronousAlignments:h,end:c,scrollAncestor:r},"cancellable"in n&&!n.cancellable||(s=c.bind(null,mt),t.addEventListener("touchstart",s,l),t.addEventListener("wheel",s,l)),a&&_t(t),s}(e,r,t,o[i+1],u)),null)}function u(e){--i||n&&n(e)}},Ct=t(xt);var St="share-widget-config",At="[".concat(St,"]"),Ot="share-target-href",kt="[".concat(Ot,"]"),Ft=!1,Lt=e=>({left:(e=e.getBoundingClientRect()).left+window.pageXOffset,top:e.top+window.pageYOffset,width:e.width,height:e.height});class Dt{constructor(e){Ft||(Ft=!0,this._currentTrigger=null,this._container=e,this._widget=this._container.querySelector(".js-share-widget-owner"),this._widgetVisible=!1,this.hide(),this._handler=e=>{var t=e.target;if(!this._container.contains(t)){var n=t.closest(At);if(n){var r=JSON.parse(n.getAttribute(St));return n===this._currentTrigger&&this._widgetVisible?this.hide():this.showForNode(n,r),n!==this._currentTrigger&&(this._currentTrigger=n),e.preventDefault(),e.stopPropagation(),void e.stopImmediatePropagation()}this._widgetVisible&&this.hide()}},window.document.body.addEventListener("click",this._handler))}_renderWidgetTemplate(e){this._widget.querySelector(".js-share-widget-clipboard").value=e.url,Array.from(this._widget.querySelectorAll(kt)).forEach((t=>{t.href=t.getAttribute(Ot).replace("{href}",encodeURI(e.url))}));var t=this._widget.querySelector(".js-share-widget-msg-private"),n=this._widget.querySelector(".js-share-widget-msg-group");t.style.display="none",n.style.display="none",e.private?t.style.display="block":e.group&&(n.style.display="block")}showForNode(e,t){if(!e||!t)throw new Error("showForNode did not recieve both arguments");this._renderWidgetTemplate(t);var n=Lt(this._widget),r=Lt(e);this._widget.style.top=r.top-n.height-5+"px",this._widget.style.left=16+r.left+r.width/2-n.width+"px",this._container.style.visibility="visible",this._widgetVisible=!0}hide(){this._container.style.visibility="hidden",this._widgetVisible=!1}detach(){window.document.body.removeEventListener("click",this._handler)}}var Bt,jt=function(e,t){t||(t="js-hypothesis-settings");for(var n=e.querySelectorAll("script."+t),r={},i=0;i{e.reason&&function(e,t,n){e instanceof Error||"object"==typeof e&&e.message&&(e=e.message);var r=Object.assign({when:t},n);He.captureException(e,{extra:r})}(e.reason,"Unhandled Promise rejection")})));var Tt=Object.assign({".js-authorize-form":class extends Ke{constructor(e){super(e),this.on("submit",(()=>{this.setState({submitting:!0})})),this.refs.cancelBtn.addEventListener("click",(()=>{window.close()})),window.addEventListener("beforeunload",(()=>{this._sendAuthCanceledMessage()}))}_sendAuthCanceledMessage(){var e;this.state.submitting||window.opener&&(this.refs.stateInput&&(e=this.refs.stateInput.value),window.opener.postMessage({type:"authorization_canceled",state:e},"*"))}update(){this.refs.cancelBtn.disabled=!this.state.submitting,this.refs.acceptBtn.disabled=!this.state.submitting}},".js-create-group-form":function(e){var t=this;function n(){t._submitBtn.disabled=0===t._groupNameInput.value.trim().length}this._submitBtn=e.querySelector(".js-create-group-create-btn"),this._groupNameInput=e.querySelector(".js-group-name-input"),this._infoLink=e.querySelector(".js-group-info-link"),this._infoText=e.querySelector(".js-group-info-text"),t._groupNameInput.addEventListener("input",n),n(),this._infoLink.addEventListener("click",(e=>{e.preventDefault(),t._infoLink.classList.add("is-hidden"),t._infoText.classList.remove("is-hidden")}))},".js-search-bar":class extends Ke{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e,t),t.lozengeTemplate||(t.lozengeTemplate=document.querySelector("#lozenge-template")),this._input=this.refs.searchBarInput,this._lozengeContainer=this.refs.searchBarLozenges,this._suggestionsMap=(()=>{var e=[{matchOn:"user",title:"user:",explanation:"search by username"},{matchOn:"tag",title:"tag:",explanation:"search for annotations with a tag"},{matchOn:"url",title:"url:",explanation:"search by URL
for domain level search\n add trailing /* eg. example.com/*"},{matchOn:"group",title:"group:",explanation:"show annotations associated with a group"}].map((e=>Object.assign(e,{type:ht}))),t=document.querySelector(".js-tag-suggestions"),n=[];if(t)try{n=JSON.parse(t.innerHTML.trim())}catch(e){console.error("Could not parse .js-tag-suggestions JSON content",e)}var r=(n||[]).map((e=>Object.assign(e,{type:dt,title:e.tag,matchOn:ft(e.tag),usageCount:e.count||0}))),i=document.querySelector(".js-group-suggestions"),s=[];if(i)try{s=JSON.parse(i.innerHTML.trim())}catch(e){console.error("Could not parse .js-group-suggestions JSON content",e)}var a=(s||[]).map((e=>Object.assign(e,{type:pt,title:e.name,matchOn:ft(e.name),pubid:e.pubid,name:e.name,relationship:e.relationship})));return e.concat(r,a)})();var n=()=>this._input.value.trim(),r=e=>{var t=e.substr(e.indexOf(":")+1).trim(),n=t.trim(),r=t,i=function(e){return e.indexOf(" ")>-1?'"'.concat(e,'"'):e};'"'!==t[0]&&"'"!==t[0]||(t=t.substr(1)),'"'!==t[t.length-1]&&"'"!==t[t.length-1]||(t=t.slice(0,-1));var s=ft(t).toLowerCase(),a=this._suggestionsMap.find((e=>e.type===pt&&e.pubid.toLowerCase()===s));if(a)n=a.pubid,r=i(a.name);else{var o=this._suggestionsMap.find((e=>e.type===pt&&e.matchOn.toLowerCase()===s));o&&(n=o.pubid,r=i(o.name))}return{input:"group:"+n,display:"group:"+r}},i=()=>Array.from(this.element.querySelectorAll(".js-lozenge")).map((e=>e.controllers[0])),s=()=>{var e="";i().forEach((t=>{var n=t.inputValue();0===n.indexOf("group:")&&(n=r(n).input),e=e+n+" "})),this._hiddenInput.value=(e+n()).trim()},a=e=>{var t=Xe(this.options.lozengeTemplate),n=this.element.querySelectorAll(".lozenge");n.length>0?this._lozengeContainer.insertBefore(t,n[n.length-1].nextSibling):this._lozengeContainer.insertBefore(t,this._lozengeContainer.firstChild);0===e.indexOf("group:")&&(e=r(e).display),new ct(t,{content:e,deleteCallback:()=>{t.remove(),i().forEach((e=>e.setState({disabled:!0}))),s(),this.refs.searchBarForm.submit()}})};this._hiddenInput=(()=>{var e=document.createElement("input");return e.type="hidden",e.name=this._input.name,this._input.removeAttribute("name"),this.refs.searchBarForm.appendChild(e),e})(this.refs.searchBarForm),this._suggestionsHandler=new lt(this._input,{list:this._suggestionsMap,header:"Narrow your search:",classNames:{container:"search-bar__dropdown-menu-container",header:"search-bar__dropdown-menu-header",list:"search-bar__dropdown-menu",item:"search-bar__dropdown-menu-item",activeItem:"js-search-bar-dropdown-menu-item--active"},renderListItem:e=>{var t=' '.concat(tt(e.title)," ");return e.type===pt&&e.relationship&&(t+=' '.concat(tt(e.relationship)," ")),e.explanation&&(t+=' '.concat(e.explanation," ")),t},listFilter:(e,t)=>{t=(t||"").trim();var n=ht,r=t.toLowerCase();0===r.indexOf("tag:")?n=dt:0===r.indexOf("group:")&&(n=pt);var i=ft(t);return n!==dt&&n!==pt||"'"!==(i=i.substr(i.indexOf(":")+1))[0]&&'"'!==i[0]||(i=i.substr(1)),this.state.suggestionsType!==n&&this.setState({suggestionsType:n}),e.filter((e=>e.type===n&&e.matchOn.toLowerCase().indexOf(i.toLowerCase())>=0)).sort(((e,t)=>{if(i){var r=e.matchOn.indexOf(i),s=t.matchOn.indexOf(i);if(r>s)return 1;if(rt.usageCount)return-1;if(e.usageCount{if(e.type===dt||e.type===pt){var t=e.type===dt?"tag:":"group:",n=e.title;n.indexOf(" ")>-1&&(n='"'.concat(n,'"')),a(t+n),this._input.value=""}else this._input.value=e.title,setTimeout((()=>{this._input.focus()}),0);s()}}),this._input.addEventListener("keydown",(e=>{if(32===e.keyCode){var t=n();rt(t)&&(e.preventDefault(),a(t),this._input.value="",s())}})),this._input.addEventListener("input",s),(()=>{var e,t,n,r,{lozengeValues:i,incompleteInputValue:o}=(e=this._input.value,n="",r=[],e.split(" ").forEach((e=>{t?rt(n=n+" "+e)&&(r.push(n),n="",t=!1):rt(e)?r.push(e):(n=e,t=!0)})),{lozengeValues:r,incompleteInputValue:n});i.forEach(a),this._input.value=o,this._input.style.visibility="visible",s()})()}update(e,t){this._suggestionsHandler&&e.suggestionsType!==t.suggestionsType&&(e.suggestionsType===dt?this._suggestionsHandler.setHeader("Popular tags:"):e.suggestionsType===pt?this._suggestionsHandler.setHeader("Your groups:"):this._suggestionsHandler.setHeader("Narrow your search:"))}},".js-search-bucket":class extends Ke{constructor(e,t){super(e,t),this.scrollTo=this.options.scrollTo||Ct,this.refs.header.addEventListener("click",(e=>{this.refs.domainLink.contains(e.target)||(e.stopPropagation(),e.preventDefault(),this.setState({expanded:!this.state.expanded}))})),this.refs.title.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault(),this.setState({expanded:!this.state.expanded})})),this.refs.collapseView.addEventListener("click",(()=>{this.setState({expanded:!this.state.expanded})}));var n=this.options.envFlags||window.envFlags;this.setState({expanded:!!n.get("js-timeout")})}update(e,t){Ve(this.refs.content,{expanded:e.expanded}),Ve(this.element,{expanded:e.expanded}),this.refs.title.setAttribute("aria-expanded",e.expanded.toString()),void 0!==t.expanded&&e.expanded&&this.scrollTo(this.element)}},".js-share-widget":class extends Ke{constructor(e){super(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),Ft||(Ft=new Dt(e))}beforeRemove(){Ft&&(Ft.detach(),Ft=null)}}},Qe);window.envFlags&&window.envFlags.get("js-capable")?(!function e(t,n){function r(t,r){if(function(e){Pe=Pe.filter((t=>!e.contains(t)||(t.controllers.forEach((e=>e.beforeRemove())),t.controllers=[],!1)))}(t),"string"!=typeof r)throw new Error("Replacement markup must be a string");var i=document.createElement("div");i.innerHTML=r,e(i,n);var s=i.children[0];return t.parentElement.replaceChild(s,t),s}Object.keys(n).forEach((e=>{Array.from(t.querySelectorAll(e)).forEach((t=>{var i,s,a=n[e];try{new a(t,{reload:r.bind(null,t)}),Pe.push(t),i=t,s="is-hidden-when-loading",Array.from(i.querySelectorAll("."+s)).forEach((e=>{e.classList.remove(s)})),i.classList.remove(s)}catch(e){throw console.error("Failed to upgrade element %s with controller",t,a,":",e.toString()),e}}))}))}(document.body,Tt),window.envFlags.ready()):console.warn("EnvironmentFlags not initialized. Skipping element upgrades");