From f507f674884ffcff12c145fe47f02204f9a03f85 Mon Sep 17 00:00:00 2001 From: jonatanklosko Date: Wed, 31 May 2023 11:10:12 +0000 Subject: [PATCH] Update assets --- static/assets/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/assets/app.js b/static/assets/app.js index 8489ce1dc..5c5ea71e4 100644 --- a/static/assets/app.js +++ b/static/assets/app.js @@ -566,7 +566,7 @@ ${r.message}`)))}function une(){return import("./mermaid.core-SWT5URIY.js" `}var ioe=new Ki(i=>i.isLoaded?eoe(i):toe(i)),o2=wn("picker","skeleton","placeholder","searchSkeleton","searchInput","categoryTabsSkeleton","headerSkeleton","categoryTab","contentSkeleton","categoryName","emojiGrid","emoji","previewSkeleton","previewEmoji","previewName","tagList","tag","overlay","content","fullHeight","pluginContainer","header"),s2={emojisPerRow:"--emojis-per-row",visibleRows:"--row-count",emojiSize:"--emoji-size"},IE=class extends Ye{constructor(){super({template:ioe,classes:o2}),this.pickerReady=!1,this.externalEvents=new mE,this.updaters={styleProperty:e=>t=>this.el.style.setProperty(s2[e],t.toString()),theme:e=>{let t=this.options.theme,n=this.el.closest(`.${t}`);this.el.classList.remove(t),n==null||n.classList.remove(t),this.el.classList.add(e),n==null||n.classList.add(e)},className:e=>{this.options.className&&this.el.classList.remove(this.options.className),this.el.classList.add(e)},emojisPerRow:this.updateStyleProperty.bind(this,"emojisPerRow"),emojiSize:this.updateStyleProperty.bind(this,"emojiSize"),visibleRows:this.updateStyleProperty.bind(this,"visibleRows")}}initialize(){this.uiElements={pickerContent:Ye.byClass(o2.content),header:Ye.byClass(o2.header)},this.uiEvents=[Ye.uiEvent("keydown",this.handleKeyDown)],this.appEvents={error:this.onError,reinitialize:this.reinitialize,"data:ready":this.onDataReady,"content:show":this.showContent,"variantPopup:hide":this.hideVariantPopup,"emoji:select":this.selectEmoji},super.initialize(),this.options.recentsProvider}destroy(){var e,t;super.destroy(),(e=this.search)==null||e.destroy(),this.emojiArea.destroy(),(t=this.categoryTabs)==null||t.destroy(),this.events.removeAll(),this.externalEvents.removeAll()}clearRecents(){this.options.recentsProvider.clear()}addEventListener(e,t){this.externalEvents.on(e,t)}removeEventListener(e,t){this.externalEvents.off(e,t)}initializePickerView(){this.pickerReady&&(this.showContent(),this.emojiArea.reset(!1))}handleKeyDown(e){let t=e.ctrlKey||e.metaKey;e.key==="s"&&t&&this.search&&(e.preventDefault(),this.search.focus())}buildChildViews(){return this.options.showPreview&&(this.preview=this.viewFactory.create(CE)),this.options.showSearch&&(this.search=this.viewFactory.create(wE,{categories:this.categories,emojiVersion:this.emojiVersion})),this.options.showCategoryTabs&&(this.categoryTabs=this.viewFactory.create(TE,{categories:this.categories})),this.currentView=this.emojiArea=this.viewFactory.create(yE,{categoryTabs:this.categoryTabs,categories:this.categories,emojiVersion:this.emojiVersion}),[this.preview,this.search,this.emojiArea,this.categoryTabs]}setStyleProperties(){this.options.showSearch||this.el.style.setProperty("--search-height-full","0px"),this.options.showCategoryTabs||(this.el.style.setProperty("--category-tabs-height","0px"),this.el.style.setProperty("--category-tabs-offset","0px")),this.options.showPreview||this.el.style.setProperty("--emoji-preview-height-full","0px"),Object.keys(s2).forEach(e=>{this.options[e]&&this.el.style.setProperty(s2[e],this.options[e].toString())})}updateStyleProperty(e,t){this.el.style.setProperty(s2[e],t.toString())}reinitialize(){this.renderSync()}onError(e){let t=this.viewFactory.createWithOptions({data:!1},SE,{message:this.i18n.get("error.load")}),n=this.el.offsetHeight||375;throw this.el.style.height=`${n}px`,F1(this.el,t.renderSync()),e}async onDataReady(e){let t=this.el;try{e?this.emojiData=e:await this.emojiDataPromise,this.options.emojiVersion==="auto"?this.emojiVersion=Qre()||parseFloat(Hne):this.emojiVersion=this.options.emojiVersion,this.categories=await this.emojiData.getCategories(this.options);let[n,r,o,s]=this.buildChildViews();await super.render({isLoaded:!0,search:r,categoryTabs:s,emojiArea:o,preview:n,showHeader:!!(this.search||this.categoryTabs),theme:this.options.theme,className:this.options.className}),this.el.style.setProperty("--category-count",this.categories.length.toString()),this.pickerReady=!0,t.replaceWith(this.el),this.setStyleProperties(),this.initializePickerView(),this.setInitialFocus(),this.externalEvents.emit("data:ready")}catch(n){this.events.emit("error",n)}}renderSync(){var e;let t=((e=this.options.categories)==null?void 0:e.length)||10;if(this.options.showRecents&&(t+=1),super.renderSync({isLoaded:!1,theme:this.options.theme,className:this.options.className,showSearch:this.options.showSearch,showPreview:this.options.showPreview,showCategoryTabs:this.options.showCategoryTabs,showHeader:this.options.showSearch||this.options.showCategoryTabs,emojiCount:this.options.emojisPerRow*this.options.visibleRows,categoryCount:t}),this.el.style.setProperty("--category-count",t.toString()),!this.options.rootElement)throw new Error("Picker must be given a root element via the rootElement option");return F1(this.options.rootElement,this.el),this.setStyleProperties(),this.pickerReady&&this.initializePickerView(),this.el}getInitialFocusTarget(){if(typeof this.options.autoFocus<"u")switch(this.options.autoFocus){case"emojis":return this.emojiArea.focusableEmoji;case"search":return this.search;case"auto":return this.search||this.emojiArea.focusableEmoji;default:return null}if(this.options.autoFocusSearch===!0)return console.warn("options.autoFocusSearch is deprecated, please use options.focusTarget instead"),this.search}setInitialFocus(){var e;!this.pickerReady||(e=this.getInitialFocusTarget())==null||e.focus()}reset(e=!0){var t;this.pickerReady&&(this.emojiArea.reset(e),this.showContent(this.emojiArea)),(t=this.search)==null||t.clear(),this.hideVariantPopup()}showContent(e=this.emojiArea){var t,n;e!==this.currentView&&(this.currentView!==this.emojiArea&&((t=this.currentView)==null||t.destroy()),this.ui.pickerContent.classList.toggle(o2.fullHeight,e!==this.emojiArea),F1(this.ui.pickerContent,e.el),this.currentView=e,e===this.emojiArea?(this.emojiArea.reset(),this.categoryTabs&&this.ui.header.appendChild(this.categoryTabs.el)):(n=this.categoryTabs)==null||n.el.remove())}hideVariantPopup(){var e;(e=this.variantPopup)==null||e.destroy()}isPickerClick(e){var t,n;let r=e.target,o=this.el.contains(r),s=(n=(t=this.variantPopup)==null?void 0:t.el)==null?void 0:n.contains(r);return o||s}async selectEmoji({emoji:e}){var t,n;(t=e.skins)!=null&&t.length&&this.options.showVariants&&!this.isVariantPopupOpen?this.showVariantPopup(e):(await((n=this.variantPopup)==null?void 0:n.animateHide()),this.events.emit("variantPopup:hide"),await this.emitEmoji(e))}get isVariantPopupOpen(){return this.variantPopup&&!this.variantPopup.isDestroyed}async showVariantPopup(e){let t=document.activeElement;this.events.once("variantPopup:hide",()=>{t==null||t.focus()}),this.variantPopup=this.viewFactory.create(xE,{emoji:e,parent:this.el}),this.el.appendChild(this.variantPopup.renderSync()),this.variantPopup.activate()}async emitEmoji(e){this.externalEvents.emit("emoji:select",await this.renderer.doEmit(e)),this.options.recentsProvider.addOrUpdateRecent(e,this.options.maxRecents),this.events.emit("recent:add",e)}updateOptions(e){Object.keys(e).forEach(t=>{this.updaters[t](e[t])}),Object.assign(this.options,e)}},kE=class{constructor({events:e,i18n:t,renderer:n,emojiData:r,options:o,customEmojis:s=[],pickerId:a}){this.events=e,this.i18n=t,this.renderer=n,this.emojiData=r,this.options=o,this.customEmojis=s,this.pickerId=a}setEmojiData(e){this.emojiData=Promise.resolve(e)}createWithOptions(e={},t,...n){let r=new t(...n);return r.setPickerId(this.pickerId),r.setEvents(this.events),r.setI18n(this.i18n),r.setRenderer(this.renderer),e.data!==!1&&r.setEmojiData(this.emojiData),r.setOptions(this.options),r.setCustomEmojis(this.customEmojis),r.viewFactory=this,r.initialize(),r}create(e,...t){return this.createWithOptions({},e,...t)}},p2,AE=class{constructor(e={}){hl(this,p2,void 0),Qx(this,p2,new Map(Object.entries(e)))}get(e,t=e){return ul(this,p2).get(e)||t}};p2=new WeakMap;function noe(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(!i||typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}function ME(){let i=!1;return function(e){Ire.injectStyles&&!i&&(noe(e),i=!0)}}var roe=`.picmo__picker .picmo__icon{width:1.25em;height:1em;fill:currentColor}.picmo__icon-small{font-size:.8em}.picmo__icon-medium{font-size:1em}.picmo__icon-large{font-size:1.25em}.picmo__icon-2x{font-size:2em}.picmo__icon-3x{font-size:3em}.picmo__icon-4x{font-size:4em}.picmo__icon-5x{font-size:5em}.picmo__icon-8x{font-size:8em}.picmo__icon-10x{font-size:10em}.picmo__light,.picmo__auto{color-scheme:light;--accent-color: #4f46e5;--background-color: #f9fafb;--border-color: #cccccc;--category-name-background-color: #f9fafb;--category-name-button-color: #999999;--category-name-text-color: hsl(214, 30%, 50%);--category-tab-active-background-color: rgba(255, 255, 255, .6);--category-tab-active-color: var(--accent-color);--category-tab-color: #666;--category-tab-highlight-background-color: rgba(0, 0, 0, .15);--error-color-dark: hsl(0, 100%, 45%);--error-color: hsl(0, 100%, 40%);--focus-indicator-background-color: hsl(198, 65%, 85%);--focus-indicator-color: #333333;--hover-background-color: #c7d2fe;--placeholder-background-color: #cccccc;--search-background-color: #f9fafb;--search-focus-background-color: #ffffff;--search-icon-color: #999999;--search-placeholder-color: #71717a;--secondary-background-color: #e2e8f0;--secondary-text-color: #666666;--tag-background-color: rgba(162, 190, 245, .3);--text-color: #000000;--variant-popup-background-color: #ffffff}.picmo__dark{color-scheme:dark;--accent-color: #A580F9;--background-color: #333333;--border-color: #666666;--category-name-background-color: #333333;--category-name-button-color: #eeeeee;--category-name-text-color: #ffffff;--category-tab-active-background-color: #000000;--category-tab-active-color: var(--accent-color);--category-tab-color: #cccccc;--category-tab-highlight-background-color: #4A4A4A;--error-color-dark: hsl(0, 7%, 3%);--error-color: hsl(0, 30%, 60%);--focus-indicator-background-color: hsl(0, 0%, 50%);--focus-indicator-color: #999999;--hover-background-color: hsla(0, 0%, 40%, .85);--image-placeholder-color: #ffffff;--placeholder-background-color: #666666;--search-background-color: #71717a;--search-focus-background-color: #52525b;--search-icon-color: #cccccc;--search-placeholder-color: #d4d4d8;--secondary-background-color: #000000;--secondary-text-color: #999999;--tag-background-color: rgba(162, 190, 245, .3);--text-color: #ffffff;--variant-popup-background-color: #333333}@media (prefers-color-scheme: dark){.picmo__auto{color-scheme:dark;--accent-color: #A580F9;--background-color: #333333;--border-color: #666666;--category-name-background-color: #333333;--category-name-button-color: #eeeeee;--category-name-text-color: #ffffff;--category-tab-active-background-color: #000000;--category-tab-active-color: var(--accent-color);--category-tab-color: #cccccc;--category-tab-highlight-background-color: #4A4A4A;--error-color-dark: hsl(0, 7%, 3%);--error-color: hsl(0, 30%, 60%);--focus-indicator-background-color: hsl(0, 0%, 50%);--focus-indicator-color: #999999;--hover-background-color: hsla(0, 0%, 40%, .85);--image-placeholder-color: #ffffff;--placeholder-background-color: #666666;--search-background-color: #71717a;--search-focus-background-color: #52525b;--search-icon-color: #cccccc;--search-placeholder-color: #d4d4d8;--secondary-background-color: #000000;--secondary-text-color: #999999;--tag-background-color: rgba(162, 190, 245, .3);--text-color: #ffffff;--variant-popup-background-color: #333333}}.picmo__picker .picmo__categoryButtonsContainer{overflow:auto;padding:2px 0}.picmo__picker .picmo__categoryButtonsContainer.picmo__has-overflow-right{mask-image:linear-gradient(270deg,rgba(255,255,255,0) 0%,rgba(255,255,255,1) 10%);-webkit-mask-image:linear-gradient(270deg,rgba(255,255,255,0) 0%,rgba(255,255,255,1) 10%)}.picmo__picker .picmo__categoryButtonsContainer.picmo__has-overflow-left{mask-image:linear-gradient(90deg,rgba(255,255,255,0) 0%,rgba(255,255,255,1) 10%);-webkit-mask-image:linear-gradient(90deg,rgba(255,255,255,0) 0%,rgba(255,255,255,1) 10%)}.picmo__picker .picmo__categoryButtonsContainer.picmo__has-overflow-both{mask-image:linear-gradient(90deg,rgba(255,255,255,0) 0%,rgba(255,255,255,1) 10%,rgba(255,255,255,1) 90%,rgba(255,255,255,0) 100%);-webkit-mask-image:linear-gradient(90deg,rgba(255,255,255,0) 0%,rgba(255,255,255,1) 10%,rgba(255,255,255,1) 90%,rgba(255,255,255,0) 100%)}.picmo__picker .picmo__categoryButtons{display:flex;flex-direction:row;gap:var(--tab-gap);margin:0;padding:0 .5em;align-items:center;height:var(--category-tabs-height);box-sizing:border-box;width:100%;justify-content:space-between;position:relative;list-style-type:none;justify-self:center;max-width:min(23.55rem,calc(var(--category-count, 1) * 2.5rem))}.picmo__picker .picmo__categoryButtons .picmo__categoryTab{display:flex;align-items:center;transition:all .1s;width:2em}.picmo__picker .picmo__categoryButtons .picmo__categoryTab.picmo__categoryTabActive .picmo__categoryButton{color:var(--category-tab-active-color);background:linear-gradient(rgba(255,255,255,.75) 0%,rgba(255,255,255,.75) 100%),linear-gradient(var(--category-tab-active-color) 0%,var(--category-tab-active-color) 100%);border:2px solid var(--category-tab-active-color)}.picmo__picker .picmo__categoryButtons .picmo__categoryTab.picmo__categoryTabActive .picmo__categoryButton:hover{background-color:var(--category-tab-active-background-color)}.picmo__picker .picmo__categoryButtons .picmo__categoryTab button.picmo__categoryButton{border-radius:5px;background:transparent;border:2px solid transparent;color:var(--category-tab-color);cursor:pointer;padding:2px;vertical-align:middle;display:flex;align-items:center;justify-content:center;font-size:1.2rem;width:1.6em;height:1.6em;transition:all .1s}.picmo__picker .picmo__categoryButtons .picmo__categoryTab button.picmo__categoryButton:is(img){width:var(--category-tab-size);height:var(--category-tab-size)}.picmo__picker .picmo__categoryButtons .picmo__categoryTab button.picmo__categoryButton:hover{background:var(--category-tab-highlight-background-color)}.picmo__dataError [data-icon]{opacity:.8}@keyframes appear{0%{opacity:0}to{opacity:.8}}@keyframes appear-grow{0%{opacity:0;transform:scale(.8)}to{opacity:.8;transform:scale(1)}}.picmo__picker .picmo__error{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:var(--secondary-text-color)}.picmo__picker .picmo__error .picmo__iconContainer{opacity:.8;animation:appear-grow .25s cubic-bezier(.175,.885,.32,1.275);--color-primary: var(--error-color);--color-secondary: var(--error-color-dark)}.picmo__picker .picmo__error .picmo__title{animation:appear .25s;animation-delay:50ms;animation-fill-mode:both}.picmo__picker .picmo__error button{padding:8px 16px;cursor:pointer;background:var(--background-color);border:1px solid var(--text-color);border-radius:5px;color:var(--text-color)}.picmo__picker .picmo__error button:hover{background:var(--text-color);color:var(--background-color)}.picmo__emojiButton{background:transparent;border:none;border-radius:15px;cursor:pointer;display:flex;font-family:var(--emoji-font);font-size:var(--emoji-size);height:100%;justify-content:center;align-items:center;margin:0;overflow:hidden;padding:0;width:100%}.picmo__emojiButton:hover{background:var(--hover-background-color)}.picmo__emojiButton:focus{border-radius:0;background:var(--focus-indicator-background-color);outline:1px solid var(--focus-indicator-color)}.picmo__picker .picmo__emojiArea{height:var(--emoji-area-height);overflow-y:auto;position:relative}.picmo__picker .picmo__emojiCategory{position:relative}.picmo__picker .picmo__emojiCategory .picmo__categoryName{font-size:.9em;padding:.5rem;margin:0;background:var(--category-name-background-color);color:var(--category-name-text-color);top:0;z-index:1;display:grid;gap:4px;grid-template-columns:auto 1fr auto;align-items:center;line-height:1;box-sizing:border-box;height:var(--category-name-height);justify-content:flex-start;text-transform:uppercase}.picmo__picker .picmo__emojiCategory .picmo__categoryName button{background:transparent;border:none;display:flex;align-items:center;cursor:pointer;color:var(--category-name-button-color)}.picmo__picker .picmo__emojiCategory .picmo__categoryName button:hover{opacity:1}.picmo__picker .picmo__emojiCategory .picmo__noRecents{color:var(--secondary-text-color);grid-column:1 / span var(--emojis-per-row);font-size:.9em;text-align:center;display:flex;align-items:center;justify-content:center;min-height:calc(var(--emoji-size) * var(--emoji-size-multiplier))}.picmo__picker .picmo__emojiCategory .picmo__recentEmojis[data-empty=true]{display:none}:is(.picmo__picker .picmo__emojiCategory) .picmo__recentEmojis[data-empty=false]+div{display:none}.picmo__picker .picmo__emojiContainer{display:grid;justify-content:space-between;gap:1px;padding:0 .5em;grid-template-columns:repeat(var(--emojis-per-row),calc(var(--emoji-size) * var(--emoji-size-multiplier)));grid-auto-rows:calc(var(--emoji-size) * var(--emoji-size-multiplier));align-items:center;justify-items:center}.picmo__picker.picmo__picker{--border-radius: 5px;--emoji-area-height: calc( (var(--row-count) * var(--emoji-size) * var(--emoji-size-multiplier)) + var(--category-name-height) );--content-height: var(--emoji-area-height);--emojis-per-row: 8;--row-count: 6;--emoji-preview-margin: 4px;--emoji-preview-height: calc(var(--emoji-preview-size) + 1em + 1px);--emoji-preview-height-full: calc(var(--emoji-preview-height) + var(--emoji-preview-margin));--emoji-preview-size: 2.75em;--emoji-size: 2rem;--emoji-size-multiplier: 1.3;--content-margin: 8px;--category-tabs-height:calc(1.5em + 9px);--category-tabs-offset: 8px;--category-tab-size: 1.2rem;--category-name-height: 2rem;--category-name-padding-y: 6px;--search-height: 2em;--search-margin: .5em;--search-margin-bottom: 4px;--search-height-full: calc(var(--search-height) + var(--search-margin) + var(--search-margin-bottom));--overlay-background-color: rgba(0, 0, 0, .8);--emoji-font: "Segoe UI Emoji", "Segoe UI Symbol", "Segoe UI", "Apple Color Emoji", "Twemoji Mozilla", "Noto Color Emoji", "EmojiOne Color", "Android Emoji";--ui-font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;--ui-font-size: 16px;--picker-width: calc(var(--emojis-per-row) * var(--emoji-size) * var(--emoji-size-multiplier) + 2.75rem);--preview-background-color: var(--secondary-background-color);background:var(--background-color);border-radius:var(--border-radius);border:1px solid var(--border-color);font-family:var(--ui-font);font-size:var(--ui-font-size);overflow:hidden;position:relative;width:var(--picker-width);display:grid;gap:8px}.picmo__picker.picmo__picker>*{font-family:var(--ui-font)}.picmo__picker.picmo__skeleton{background:var(--background-color);border-radius:var(--border-radius);border:1px solid var(--border-color);font-family:var(--ui-font);width:var(--picker-width);color:var(--secondary-text-color)}.picmo__picker.picmo__skeleton *{box-sizing:border-box}.picmo__picker.picmo__skeleton .picmo__placeholder{background:var(--placeholder-background-color);position:relative;overflow:hidden}.picmo__picker.picmo__skeleton .picmo__placeholder:after{position:absolute;top:0;right:0;bottom:0;left:0;transform:translate(-100%);background-image:linear-gradient(90deg,rgba(255,255,255,0) 0,rgba(255,255,255,.2) 20%,rgba(255,255,255,.5) 60%,rgba(255,255,255,0) 100%);animation:shine 2s infinite;content:""}.picmo__picker.picmo__skeleton .picmo__headerSkeleton{background-color:var(--secondary-background-color);padding-top:8px;padding-bottom:8px;display:flex;flex-direction:column;overflow:hidden;gap:8px;border-bottom:1px solid var(--border-color);width:var(--picker-width)}.picmo__picker.picmo__skeleton .picmo__searchSkeleton{padding:0 8px;height:var(--search-height)}.picmo__picker.picmo__skeleton .picmo__searchSkeleton .picmo__searchInput{width:100%;height:28px;border-radius:3px}.picmo__picker.picmo__skeleton .picmo__categoryTabsSkeleton{height:var(--category-tabs-height);display:flex;flex-direction:row;align-items:center;justify-self:center;width:calc(2rem * var(--category-count, 1))}.picmo__picker.picmo__skeleton .picmo__categoryTabsSkeleton .picmo__categoryTab{width:25px;height:25px;padding:2px;border-radius:5px;margin:.25em}.picmo__picker.picmo__skeleton .picmo__contentSkeleton{height:var(--content-height);padding-right:8px;opacity:.7}.picmo__picker.picmo__skeleton .picmo__contentSkeleton .picmo__categoryName{width:50%;height:1rem;margin:.5rem;box-sizing:border-box}.picmo__picker.picmo__skeleton .picmo__contentSkeleton .picmo__emojiGrid{display:grid;justify-content:space-between;gap:1px;padding:0 .5em;grid-template-columns:repeat(var(--emojis-per-row),calc(var(--emoji-size) * var(--emoji-size-multiplier)));grid-auto-rows:calc(var(--emoji-size) * var(--emoji-size-multiplier));align-items:center;justify-items:center;width:var(--picker-width)}.picmo__picker.picmo__skeleton .picmo__contentSkeleton .picmo__emojiGrid .picmo__emoji{width:var(--emoji-size);height:var(--emoji-size);border-radius:50%}.picmo__picker.picmo__skeleton .picmo__previewSkeleton{height:var(--emoji-preview-height);border-top:1px solid var(--border-color);display:grid;align-items:center;padding:.5em;gap:6px;grid-template-columns:auto 1fr;grid-template-rows:auto 1fr;grid-template-areas:"emoji name" "emoji tags"}.picmo__picker.picmo__skeleton .picmo__previewSkeleton .picmo__previewEmoji{grid-area:emoji;border-radius:50%;width:var(--emoji-preview-size);height:var(--emoji-preview-size)}.picmo__picker.picmo__skeleton .picmo__previewSkeleton .picmo__previewName{grid-area:name;height:.8em;width:80%}.picmo__picker.picmo__skeleton .picmo__previewSkeleton .picmo__tagList{grid-area:tags;list-style-type:none;display:flex;flex-direction:row;padding:0;margin:0}.picmo__picker.picmo__skeleton .picmo__previewSkeleton .picmo__tagList .picmo__tag{border-radius:3px;padding:2px 8px;margin-right:.25em;height:1em;width:20%}.picmo__overlay{background:rgba(0,0,0,.75);height:100%;left:0;position:fixed;top:0;width:100%;z-index:1000}.picmo__content{position:relative;overflow:hidden;height:var(--content-height)}.picmo__content.picmo__fullHeight{height:calc(var(--content-height) + var(--category-tabs-height) + var(--category-tabs-offset));overflow-y:auto}.picmo__pluginContainer{margin:.5em;display:flex;flex-direction:row}.picmo__header{background-color:var(--secondary-background-color);padding-top:8px;padding-bottom:8px;display:grid;gap:8px;border-bottom:1px solid var(--border-color)}@media (prefers-reduced-motion: reduce){.picmo__placeholder{background:var(--placeholder-background-color);position:relative;overflow:hidden}.picmo__placeholder:after{display:none}}.picmo__picker .picmo__preview{border-top:1px solid var(--border-color);display:grid;align-items:center;gap:6px;grid-template-columns:auto 1fr;grid-template-rows:auto 1fr;grid-template-areas:"emoji name" "emoji tags";height:var(--emoji-preview-height);box-sizing:border-box;padding:.5em;position:relative;background:var(--preview-background-color)}.picmo__picker .picmo__preview .picmo__previewEmoji{grid-area:emoji;font-size:var(--emoji-preview-size);font-family:var(--emoji-font);width:1.25em;display:flex;align-items:center;justify-content:center}.picmo__picker .picmo__preview .picmo__previewName{grid-area:name;color:var(--text-color);font-size:.8em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}.picmo__picker .picmo__preview .picmo__tagList{grid-area:tags;list-style-type:none;display:flex;flex-direction:row;padding:0;margin:0;font-size:.75em;overflow:hidden}.picmo__picker .picmo__preview .picmo__tag{border-radius:3px;background:var(--tag-background-color);color:var(--text-color);padding:2px 8px;margin-right:.25em;white-space:nowrap}.picmo__picker .picmo__preview .picmo__tag:last-child{margin-right:0}.picmo__picker .picmo__searchContainer{display:flex;height:var(--search-height);box-sizing:border-box;padding:0 8px;position:relative}.picmo__picker .picmo__searchContainer .picmo__searchField{background:var(--search-background-color);border-radius:3px;border:none;box-sizing:border-box;color:var(--text-color);font-size:.9em;outline:none;padding:.5em 2.25em .5em .5em;width:100%}.picmo__picker .picmo__searchContainer .picmo__searchField:focus{background:var(--search-focus-background-color)}.picmo__picker .picmo__searchContainer .picmo__searchField::placeholder{color:var(--search-placeholder-color)}.picmo__picker .picmo__searchContainer .picmo__searchAccessory{color:var(--search-icon-color);height:100%;position:absolute;right:1em;top:0;width:1.25rem;display:flex;align-items:center}.picmo__picker .picmo__searchContainer .picmo__searchAccessory svg{fill:var(--search-icon-color)}.picmo__picker .picmo__searchContainer .picmo__clearButton{border:0;color:var(--search-icon-color);background:transparent;cursor:pointer}.picmo__picker .picmo__searchContainer .picmo__clearSearchButton{cursor:pointer;border:none;background:transparent;color:var(--search-icon-color);font-size:1em;width:100%;height:100%;display:flex;align-items:center;padding:0}.picmo__picker .picmo__searchContainer .picmo__notFound [data-icon]{fill:#f3e265}.picmo__picker .picmo__variantOverlay{background:var(--overlay-background-color);border-radius:5px;display:flex;flex-direction:column;height:100%;justify-content:center;left:0;position:absolute;top:0;width:100%;z-index:1}.picmo__picker .picmo__variantOverlay .picmo__variantPopup{background:var(--variant-popup-background-color);border-radius:5px;margin:.5em;padding:.5em;text-align:center;user-select:none;display:flex;align-items:center;justify-content:center}.picmo__customEmoji{width:1em;height:1em}@keyframes shine{to{transform:translate(100%)}}.picmo__picker .picmo__imagePlaceholder{width:2rem;height:2rem;border-radius:50%}.picmo__placeholder{background:#DDDBDD;position:relative}.picmo__placeholder:after{position:absolute;top:0;right:0;bottom:0;left:0;transform:translate(-100%);background-image:linear-gradient(90deg,rgba(255,255,255,0) 0,rgba(255,255,255,.2) 20%,rgba(255,255,255,.5) 60%,rgba(255,255,255,0) 100%);animation:shine 2s infinite;content:""} `;function ooe(i){return fU(i.locale,i.dataStore,i.messages,i.emojiData)}var soe=0,a2;function aoe(){return`picmo-${Date.now()}-${soe++}`}var loe=ME();function vU(i){loe(roe);let e=DE(i),t=((e==null?void 0:e.custom)||[]).map(s=>Qe(ge({},s),{custom:!0,tags:["custom",...s.tags||[]]})),n=new uE;a2||(a2=ooe(e));let r=new AE(e.i18n);a2.then(s=>{n.emit("data:ready",s)}).catch(s=>{n.emit("error",s)});let o=new kE({events:n,i18n:r,customEmojis:t,renderer:e.renderer,options:e,emojiData:a2,pickerId:aoe()}).create(IE);return o.renderSync(),o}function _h(i){return i.split("-")[0]}function H1(i){return i.split("-")[1]}function T2(i){return["top","bottom"].includes(_h(i))?"x":"y"}function kU(i){return i==="y"?"height":"width"}function bU(i,e,t){let{reference:n,floating:r}=i,o=n.x+n.width/2-r.width/2,s=n.y+n.height/2-r.height/2,a=T2(e),l=kU(a),c=n[l]/2-r[l]/2,d=_h(e),h=a==="x",u;switch(d){case"top":u={x:o,y:n.y-r.height};break;case"bottom":u={x:o,y:n.y+n.height};break;case"right":u={x:n.x+n.width,y:s};break;case"left":u={x:n.x-r.width,y:s};break;default:u={x:n.x,y:n.y}}switch(H1(e)){case"start":u[a]-=c*(t&&h?-1:1);break;case"end":u[a]+=c*(t&&h?-1:1);break}return u}var coe=async(i,e,t)=>{let{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:s}=t,a=await(s.isRTL==null?void 0:s.isRTL(e)),l=await s.getElementRects({reference:i,floating:e,strategy:r}),{x:c,y:d}=bU(l,n,a),h=n,u={},m=0;for(let p=0;ppoe[e])}function AU(i,e,t){t===void 0&&(t=!1);let n=H1(i),r=T2(i),o=kU(r),s=r==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=w2(s)),{main:s,cross:w2(s)}}var foe={start:"end",end:"start"};function OE(i){return i.replace(/start|end/g,e=>foe[e])}var goe=["top","right","bottom","left"],_oe=goe.reduce((i,e)=>i.concat(e,e+"-start",e+"-end"),[]);function voe(i,e,t){return(i?[...t.filter(n=>H1(n)===i),...t.filter(n=>H1(n)!==i)]:t.filter(n=>_h(n)===n)).filter(n=>i?H1(n)===i||(e?OE(n)!==n:!1):!0)}var boe=function(i){return i===void 0&&(i={}),{name:"autoPlacement",options:i,async fn(e){var t,n,r,o,s;let{x:a,y:l,rects:c,middlewareData:d,placement:h,platform:u,elements:m}=e,He=i,{alignment:p=null,allowedPlacements:f=_oe,autoAlignment:b=!0}=He,_=Qo(He,["alignment","allowedPlacements","autoAlignment"]),C=voe(p,b,f),x=await HE(e,_),I=(t=(n=d.autoPlacement)==null?void 0:n.index)!=null?t:0,A=C[I];if(A==null)return{};let{main:O,cross:D}=AU(A,c,await(u.isRTL==null?void 0:u.isRTL(m.floating)));if(h!==A)return{x:a,y:l,reset:{placement:C[0]}};let K=[x[_h(A)],x[O],x[D]],G=[...(r=(o=d.autoPlacement)==null?void 0:o.overflows)!=null?r:[],{placement:A,overflows:K}],Se=C[I+1];if(Se)return{data:{index:I+1,overflows:G},reset:{placement:Se}};let te=G.slice().sort((Xe,B)=>Xe.overflows[0]-B.overflows[0]),Ie=(s=te.find(Xe=>{let{overflows:B}=Xe;return B.every(Q=>Q<=0)}))==null?void 0:s.placement,Oe=Ie!=null?Ie:te[0].placement;return Oe!==h?{data:{index:I+1,overflows:G},reset:{placement:Oe}}:{}}}};function yoe(i){let e=w2(i);return[OE(i),e,OE(e)]}var Soe=function(i){return i===void 0&&(i={}),{name:"flip",options:i,async fn(e){var t;let{placement:n,middlewareData:r,rects:o,initialPlacement:s,platform:a,elements:l}=e,K=i,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:u="bestFit",flipAlignment:m=!0}=K,p=Qo(K,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","flipAlignment"]),f=_h(n),b=h||(f===s||!m?[w2(s)]:yoe(s)),_=[s,...b],C=await HE(e,p),x=[],I=((t=r.flip)==null?void 0:t.overflows)||[];if(c&&x.push(C[f]),d){let{main:G,cross:Se}=AU(n,o,await(a.isRTL==null?void 0:a.isRTL(l.floating)));x.push(C[G],C[Se])}if(I=[...I,{placement:n,overflows:x}],!x.every(G=>G<=0)){var A,O;let G=((A=(O=r.flip)==null?void 0:O.index)!=null?A:0)+1,Se=_[G];if(Se)return{data:{index:G,overflows:I},reset:{placement:Se}};let te="bottom";switch(u){case"bestFit":{var D;let Ie=(D=I.map(Oe=>[Oe,Oe.overflows.filter(He=>He>0).reduce((He,Xe)=>He+Xe,0)]).sort((Oe,He)=>Oe[1]-He[1])[0])==null?void 0:D[0].placement;Ie&&(te=Ie);break}case"initialPlacement":te=s;break}if(n!==te)return{reset:{placement:te}}}return{}}}};async function Coe(i,e){let{placement:t,platform:n,elements:r}=i,o=await(n.isRTL==null?void 0:n.isRTL(r.floating)),s=_h(t),a=H1(t),l=T2(t)==="x",c=["left","top"].includes(s)?-1:1,d=o&&l?-1:1,h=typeof e=="function"?e(i):e,{mainAxis:u,crossAxis:m,alignmentAxis:p}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:ge({mainAxis:0,crossAxis:0,alignmentAxis:null},h);return a&&typeof p=="number"&&(m=a==="end"?p*-1:p),l?{x:m*d,y:u*c}:{x:u*c,y:m*d}}var SU=function(i){return i===void 0&&(i=0),{name:"offset",options:i,async fn(e){let{x:t,y:n}=e,r=await Coe(e,i);return{x:t+r.x,y:n+r.y,data:r}}}};function woe(i){return i==="x"?"y":"x"}var CU=function(i){return i===void 0&&(i={}),{name:"shift",options:i,async fn(e){let{x:t,y:n,placement:r}=e,b=i,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:_=>{let{x:C,y:x}=_;return{x:C,y:x}}}}=b,l=Qo(b,["mainAxis","crossAxis","limiter"]),c={x:t,y:n},d=await HE(e,l),h=T2(_h(r)),u=woe(h),m=c[h],p=c[u];if(o){let _=h==="y"?"top":"left",C=h==="y"?"bottom":"right",x=m+d[_],I=m-d[C];m=yU(x,m,I)}if(s){let _=u==="y"?"top":"left",C=u==="y"?"bottom":"right",x=p+d[_],I=p-d[C];p=yU(x,p,I)}let f=a.fn(Qe(ge({},e),{[h]:m,[u]:p}));return Qe(ge({},f),{data:{x:f.x-t,y:f.y-n}})}}};function LU(i){return i&&i.document&&i.location&&i.alert&&i.setInterval}function fl(i){if(i==null)return window;if(!LU(i)){let e=i.ownerDocument;return e&&e.defaultView||window}return i}function ta(i){return fl(i).getComputedStyle(i)}function ml(i){return LU(i)?"":i?(i.nodeName||"").toLowerCase():""}function NU(){let i=navigator.userAgentData;return i!=null&&i.brands?i.brands.map(e=>e.brand+"/"+e.version).join(" "):navigator.userAgent}function ia(i){return i instanceof fl(i).HTMLElement}function wc(i){return i instanceof fl(i).Element}function xoe(i){return i instanceof fl(i).Node}function B1(i){if(typeof ShadowRoot>"u")return!1;let e=fl(i).ShadowRoot;return i instanceof e||i instanceof ShadowRoot}function I2(i){let{overflow:e,overflowX:t,overflowY:n}=ta(i);return/auto|scroll|overlay|hidden/.test(e+n+t)}function Eoe(i){return["table","td","th"].includes(ml(i))}function RU(i){let e=/firefox/i.test(NU()),t=ta(i);return t.transform!=="none"||t.perspective!=="none"||t.contain==="paint"||["transform","perspective"].includes(t.willChange)||e&&t.willChange==="filter"||e&&(t.filter?t.filter!=="none":!1)}function DU(){return!/^((?!chrome|android).)*safari/i.test(NU())}var wU=Math.min,Ef=Math.max,x2=Math.round;function pl(i,e,t){var n,r,o,s;e===void 0&&(e=!1),t===void 0&&(t=!1);let a=i.getBoundingClientRect(),l=1,c=1;e&&ia(i)&&(l=i.offsetWidth>0&&x2(a.width)/i.offsetWidth||1,c=i.offsetHeight>0&&x2(a.height)/i.offsetHeight||1);let d=wc(i)?fl(i):window,h=!DU()&&t,u=(a.left+(h&&(n=(r=d.visualViewport)==null?void 0:r.offsetLeft)!=null?n:0))/l,m=(a.top+(h&&(o=(s=d.visualViewport)==null?void 0:s.offsetTop)!=null?o:0))/c,p=a.width/l,f=a.height/c;return{width:p,height:f,top:m,right:u+p,bottom:m+f,left:u,x:u,y:m}}function xc(i){return((xoe(i)?i.ownerDocument:i.document)||window.document).documentElement}function k2(i){return wc(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.pageXOffset,scrollTop:i.pageYOffset}}function MU(i){return pl(xc(i)).left+k2(i).scrollLeft}function Toe(i){let e=pl(i);return x2(e.width)!==i.offsetWidth||x2(e.height)!==i.offsetHeight}function Ioe(i,e,t){let n=ia(e),r=xc(e),o=pl(i,n&&Toe(e),t==="fixed"),s={scrollLeft:0,scrollTop:0},a={x:0,y:0};if(n||!n&&t!=="fixed")if((ml(e)!=="body"||I2(r))&&(s=k2(e)),ia(e)){let l=pl(e,!0);a.x=l.x+e.clientLeft,a.y=l.y+e.clientTop}else r&&(a.x=MU(r));return{x:o.left+s.scrollLeft-a.x,y:o.top+s.scrollTop-a.y,width:o.width,height:o.height}}function OU(i){return ml(i)==="html"?i:i.assignedSlot||i.parentNode||(B1(i)?i.host:null)||xc(i)}function xU(i){return!ia(i)||ta(i).position==="fixed"?null:koe(i)}function koe(i){let{offsetParent:e}=i,t=i,n=!1;for(;t&&t!==e;){let{assignedSlot:r}=t;if(r){let o=r.offsetParent;if(ta(r).display==="contents"){let s=r.hasAttribute("style"),a=r.style.display;r.style.display=ta(t).display,o=r.offsetParent,r.style.display=a,s||r.removeAttribute("style")}t=r,e!==o&&(e=o,n=!0)}else if(B1(t)&&t.host&&n)break;t=B1(t)&&t.host||t.parentNode}return e}function Aoe(i){let e=OU(i);for(B1(e)&&(e=e.host);ia(e)&&!["html","body"].includes(ml(e));){if(RU(e))return e;{let t=e.parentNode;e=B1(t)?t.host:t}}return null}function PE(i){let e=fl(i),t=xU(i);for(;t&&Eoe(t)&&ta(t).position==="static";)t=xU(t);return t&&(ml(t)==="html"||ml(t)==="body"&&ta(t).position==="static"&&!RU(t))?e:t||Aoe(i)||e}function EU(i){if(ia(i))return{width:i.offsetWidth,height:i.offsetHeight};let e=pl(i);return{width:e.width,height:e.height}}function Loe(i){let{rect:e,offsetParent:t,strategy:n}=i,r=ia(t),o=xc(t);if(t===o)return e;let s={scrollLeft:0,scrollTop:0},a={x:0,y:0};if((r||!r&&n!=="fixed")&&((ml(t)!=="body"||I2(o))&&(s=k2(t)),ia(t))){let l=pl(t,!0);a.x=l.x+t.clientLeft,a.y=l.y+t.clientTop}return Qe(ge({},e),{x:e.x-s.scrollLeft+a.x,y:e.y-s.scrollTop+a.y})}function Noe(i,e){let t=fl(i),n=xc(i),r=t.visualViewport,o=n.clientWidth,s=n.clientHeight,a=0,l=0;if(r){o=r.width,s=r.height;let c=DU();(c||!c&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:o,height:s,x:a,y:l}}function Roe(i){var e;let t=xc(i),n=k2(i),r=(e=i.ownerDocument)==null?void 0:e.body,o=Ef(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=Ef(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-n.scrollLeft+MU(i),l=-n.scrollTop;return ta(r||t).direction==="rtl"&&(a+=Ef(t.clientWidth,r?r.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}function PU(i){let e=OU(i);return["html","body","#document"].includes(ml(e))?i.ownerDocument.body:ia(e)&&I2(e)?e:PU(e)}function E2(i,e){var t;e===void 0&&(e=[]);let n=PU(i),r=n===((t=i.ownerDocument)==null?void 0:t.body),o=fl(n),s=r?[o].concat(o.visualViewport||[],I2(n)?n:[]):n,a=e.concat(s);return r?a:a.concat(E2(s))}function Doe(i,e){let t=e.getRootNode==null?void 0:e.getRootNode();if(i.contains(e))return!0;if(t&&B1(t)){let n=e;do{if(n&&i===n)return!0;n=n.parentNode||n.host}while(n)}return!1}function Moe(i,e){let t=pl(i,!1,e==="fixed"),n=t.top+i.clientTop,r=t.left+i.clientLeft;return{top:n,left:r,x:r,y:n,right:r+i.clientWidth,bottom:n+i.clientHeight,width:i.clientWidth,height:i.clientHeight}}function TU(i,e,t){return e==="viewport"?C2(Noe(i,t)):wc(e)?Moe(e,t):C2(Roe(xc(i)))}function Ooe(i){let e=E2(i),t=["absolute","fixed"].includes(ta(i).position)&&ia(i)?PE(i):i;return wc(t)?e.filter(n=>wc(n)&&Doe(n,t)&&ml(n)!=="body"):[]}function Poe(i){let{element:e,boundary:t,rootBoundary:n,strategy:r}=i,o=[...t==="clippingAncestors"?Ooe(e):[].concat(t),n],s=o[0],a=o.reduce((l,c)=>{let d=TU(e,c,r);return l.top=Ef(d.top,l.top),l.right=wU(d.right,l.right),l.bottom=wU(d.bottom,l.bottom),l.left=Ef(d.left,l.left),l},TU(e,s,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}var Foe={getClippingRect:Poe,convertOffsetParentRelativeRectToViewportRelativeRect:Loe,isElement:wc,getDimensions:EU,getOffsetParent:PE,getDocumentElement:xc,getElementRects:i=>{let{reference:e,floating:t,strategy:n}=i;return{reference:Ioe(e,PE(t),n),floating:Qe(ge({},EU(t)),{x:0,y:0})}},getClientRects:i=>Array.from(i.getClientRects()),isRTL:i=>ta(i).direction==="rtl"};function Hoe(i,e,t,n){n===void 0&&(n={});let{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:s=!0,animationFrame:a=!1}=n,l=r&&!a,c=o&&!a,d=l||c?[...wc(i)?E2(i):[],...E2(e)]:[];d.forEach(f=>{l&&f.addEventListener("scroll",t,{passive:!0}),c&&f.addEventListener("resize",t)});let h=null;if(s){let f=!0;h=new ResizeObserver(()=>{f||t(),f=!1}),wc(i)&&!a&&h.observe(i),h.observe(e)}let u,m=a?pl(i):null;a&&p();function p(){let f=pl(i);m&&(f.x!==m.x||f.y!==m.y||f.width!==m.width||f.height!==m.height)&&t(),m=f,u=requestAnimationFrame(p)}return t(),()=>{var f;d.forEach(b=>{l&&b.removeEventListener("scroll",t),c&&b.removeEventListener("resize",t)}),(f=h)==null||f.disconnect(),h=null,a&&cancelAnimationFrame(u)}}var Boe=(i,e,t)=>coe(i,e,ge({platform:Foe},t));async function zoe(i,e,t,n){if(!n)throw new Error("Must provide a positioning option");return await(typeof n=="string"?Uoe(i,e,t,n):Woe(e,n))}async function Uoe(i,e,t,n){if(!t)throw new Error("Reference element is required for relative positioning");let r;return n==="auto"?r={middleware:[boe(),CU(),SU({mainAxis:5,crossAxis:12})]}:r={placement:n,middleware:[Soe(),CU(),SU(5)]},Hoe(t,e,async()=>{if((!t.isConnected||!t.offsetParent)&&joe(i))return;let{x:o,y:s}=await Boe(t,e,r);Object.assign(e.style,{position:"absolute",left:`${o}px`,top:`${s}px`})})}function Woe(i,e){return i.style.position="fixed",Object.entries(e).forEach(([t,n])=>{i.style[t]=n}),()=>{}}function joe(i){switch(i.options.onPositionLost){case"close":return i.close(),!0;case"destroy":return i.destroy(),!0;case"hold":return!0}}var Voe={hideOnClickOutside:!0,hideOnEmojiSelect:!0,hideOnEscape:!0,position:"auto",showCloseButton:!0,onPositionLost:"none"};function Koe(i={}){return ge(Qe(ge({},Voe),{rootElement:document.body}),i)}var qoe='',IU=wn("popupContainer","closeButton"),FE=class{constructor(e,t){this.isOpen=!1,this.externalEvents=new fh,this.options=ge(ge({},Koe(t)),DE(e)),this.popupEl=document.createElement("div"),this.popupEl.classList.add(IU.popupContainer),this.popupEl.classList.add(this.options.theme),t.className&&this.popupEl.classList.add(t.className),this.options.showCloseButton&&(this.closeButton=document.createElement("button"),this.closeButton.type="button",this.closeButton.classList.add(IU.closeButton),this.closeButton.innerHTML=qoe,this.closeButton.addEventListener("click",()=>{this.close()}),this.popupEl.appendChild(this.closeButton));let n=document.createElement("div");this.popupEl.appendChild(n),this.picker=vU(Qe(ge({},this.options),{rootElement:n})),this.focusTrap=new Cf,this.picker.addEventListener("data:ready",()=>{this.focusTrap.activate(this.picker.el),this.picker.setInitialFocus()}),this.options.hideOnEmojiSelect&&this.picker.addEventListener("emoji:select",()=>{var r;this.close(),(r=this.triggerElement)==null||r.focus()}),this.options.hideOnClickOutside&&(this.onDocumentClick=this.onDocumentClick.bind(this),document.addEventListener("click",this.onDocumentClick)),this.options.hideOnEscape&&(this.handleKeydown=this.handleKeydown.bind(this),this.popupEl.addEventListener("keydown",this.handleKeydown)),this.referenceElement=this.options.referenceElement,this.triggerElement=this.options.triggerElement}addEventListener(e,t){this.externalEvents.on(e,t),this.picker.addEventListener(e,t)}removeEventListener(e,t){this.externalEvents.off(e,t),this.picker.removeEventListener(e,t)}handleKeydown(e){var t;e.key==="Escape"&&(this.close(),(t=this.triggerElement)==null||t.focus())}async destroy(){this.isOpen&&await this.close(),document.removeEventListener("click",this.onDocumentClick),this.picker.destroy(),this.externalEvents.removeAll()}toggle(e){return this.isOpen?this.close():this.open(e)}async open({triggerElement:e,referenceElement:t}={}){this.isOpen||(e&&(this.triggerElement=e),t&&(this.referenceElement=t),await this.initiateOpenStateChange(!0),this.popupEl.style.opacity="0",this.options.rootElement.appendChild(this.popupEl),await this.setPosition(),this.picker.reset(!1),await this.animatePopup(!0),await this.animateCloseButton(!0),this.picker.setInitialFocus(),this.externalEvents.emit("picker:open"))}async close(){var e;!this.isOpen||(await this.initiateOpenStateChange(!1),await this.animateCloseButton(!1),await this.animatePopup(!1),this.popupEl.remove(),this.picker.reset(),(e=this.positionCleanup)==null||e.call(this),this.focusTrap.deactivate(),this.externalEvents.emit("picker:close"))}getRunningAnimations(){return this.picker.el.getAnimations().filter(e=>e.playState==="running")}async setPosition(){var e;(e=this.positionCleanup)==null||e.call(this),this.positionCleanup=await zoe(this,this.popupEl,this.referenceElement,this.options.position)}awaitPendingAnimations(){return Promise.all(this.getRunningAnimations().map(e=>e.finished))}onDocumentClick(e){var t;let n=e.target,r=(t=this.triggerElement)==null?void 0:t.contains(n);this.isOpen&&!this.picker.isPickerClick(e)&&!r&&this.close()}animatePopup(e){return mh(this.popupEl,{opacity:[0,1],transform:["scale(0.9)","scale(1)"]},{duration:150,id:e?"show-picker":"hide-picker",easing:"ease-in-out",direction:e?"normal":"reverse",fill:"both"},this.options)}animateCloseButton(e){if(this.closeButton)return mh(this.closeButton,{opacity:[0,1]},{duration:25,id:e?"show-close":"hide-close",easing:"ease-in-out",direction:e?"normal":"reverse",fill:"both"},this.options)}async initiateOpenStateChange(e){this.isOpen=e,await this.awaitPendingAnimations()}},Goe=`.picmo__popupContainer{display:flex;flex-direction:column;position:absolute}.picmo__popupContainer .picmo__closeButton{position:absolute;opacity:0;background:transparent;border:none;z-index:1;right:0;top:0;cursor:pointer;padding:4px;align-self:flex-end;transform:translate(50%,-50%);background:#999999;width:1.5rem;height:1.5rem;display:flex;align-items:center;justify-content:center;border-radius:50%}.picmo__popupContainer .picmo__closeButton:hover{background:var(--accent-color)}.picmo__popupContainer .picmo__closeButton svg{fill:#fff;width:1.25rem;height:1.25rem} `,$oe=ME();function FU(i,e){return $oe(Goe),new FE(ge({autoFocus:"auto"},i),e)}var Yoe={mounted(){let i=this.el.querySelector("[data-emoji-button]"),e=this.el.querySelector("[data-emoji-preview]"),t=this.el.querySelector("[data-emoji-input]"),n=FU({showPreview:!1},{triggerElement:i,referenceElement:i,position:"bottom"});n.addEventListener("emoji:select",({emoji:r})=>{e.innerHTML=r,t.value=r}),i.addEventListener("click",r=>{n.toggle()})}},HU=Yoe;var Xoe={mounted(){this.focus()},updated(){this.el!==document.activeElement&&this.focus()},focus(){Gc(document.activeElement)||(this.el.focus(),this.el.selectionStart=this.el.selectionEnd=this.el.value.length,this.el.scrollLeft=this.el.scrollWidth)}},BU=Xoe;var Qoe={mounted(){this.props=this.getProps(),this.isFocused=!1,this.insertMode=!1,this.initializeHeadingEl(),this.unsubscribeFromNavigationEvents=ki.subscribe("navigation",i=>{this.handleNavigationEvent(i)})},updated(){this.props=this.getProps(),this.initializeHeadingEl()},destroyed(){this.unsubscribeFromNavigationEvents()},getProps(){return{focusableId:Ge(this.el,"data-focusable-id"),onValueChange:Ge(this.el,"data-on-value-change"),metadata:Ge(this.el,"data-metadata")}},initializeHeadingEl(){let i=this.el.querySelector("[data-el-heading]");i!==this.headingEl&&(this.headingEl=i,this.headingEl.addEventListener("paste",e=>{e.preventDefault();let t=e.clipboardData.getData("text/plain").replace(` -`," ");document.execCommand("insertText",!1,t)}),this.headingEl.addEventListener("keydown",e=>{e.key==="Enter"&&e.preventDefault()}),this.headingEl.addEventListener("blur",e=>{setTimeout(()=>{this.isFocused&&this.insertMode&&(this.headingEl.focus(),zU(this.headingEl))},0)}))},handleNavigationEvent(i){i.type==="element_focused"?this.handleElementFocused(i.focusableId,i.scroll):i.type==="insert_mode_changed"&&this.handleInsertModeChanged(i.enabled)},handleElementFocused(i,e){this.props.focusableId===i?(this.isFocused=!0,this.el.setAttribute("data-js-focused",""),e&&Pl(this.el)):this.isFocused&&(this.isFocused=!1,this.el.removeAttribute("data-js-focused"))},handleInsertModeChanged(i){this.isFocused&&!this.insertMode&&i?(this.insertMode=i,this.el.setAttribute("phx-update","ignore"),this.headingEl.setAttribute("contenteditable",""),this.headingEl.focus(),zU(this.headingEl)):this.insertMode&&!i&&(this.insertMode=i,this.headingEl.removeAttribute("contenteditable"),this.el.removeAttribute("phx-update"),this.pushEvent(this.props.onValueChange,{value:this.headingEl.textContent.trim(),metadata:this.props.metadata}))}};function zU(i){let e=document.createRange();e.selectNodeContents(i),e.collapse(!1);let t=window.getSelection();t.removeAllRanges(),t.addRange(e)}var UU=Qoe;var Joe={mounted(){this.props=this.getProps(),this.sourceEl=Zh(this.el,"[data-source]"),this.targetEl=Zh(this.el,"[data-target]"),this.updateDOM()},updated(){this.props=this.getProps(),this.updateDOM()},getProps(){return{language:Ge(this.el,"data-language")}},updateDOM(){let i=this.sourceEl.innerText;D1(i,this.props.language).then(e=>{this.targetEl.innerHTML=e,this.el.setAttribute("data-highlighted","")})}},WU=Joe;var BE=["bg-yellow-100","border-yellow-300"],Zoe={mounted(){this.props=this.getProps(),this.inputEl=this.el.querySelector("[data-input]"),this.previewEl=this.el.querySelector("[data-preview]"),this.initialPreviewContentEl=this.previewEl.firstElementChild,this.cameraPreviewEl=this.el.querySelector("[data-camera-preview]"),this.cameraListEl=this.el.querySelector("[data-camera-list]"),this.cameraItemTemplateEl=this.cameraListEl.firstElementChild,this.cameraItemTemplateEl.remove(),this.uploadButton=this.el.querySelector("[data-btn-upload]"),this.openCameraButton=this.el.querySelector("[data-btn-open-camera]"),this.captureCameraButton=this.el.querySelector("[data-btn-capture-camera]"),this.cancelButton=this.el.querySelector("[data-btn-cancel]"),this.cameraListPopulated=!1,this.cameraVideoEl=null,this.cameraStream=null,this.handleEvent(`image_input_change:${this.props.id}`,({image_info:i})=>{if(i){let e=ise(i,this.props.format);this.setPreview(e)}else this.setPreview(this.initialPreviewContentEl)}),this.uploadButton.addEventListener("click",i=>{this.inputEl.click()}),this.inputEl.addEventListener("change",i=>{let[e]=i.target.files;e&&this.loadFile(e)}),this.el.addEventListener("dragover",i=>{i.stopPropagation(),i.preventDefault(),i.dataTransfer.dropEffect="copy"}),this.el.addEventListener("drop",i=>{i.stopPropagation(),i.preventDefault();let[e]=i.dataTransfer.files;e&&this.loadFile(e),this.closeCameraView()}),this.el.addEventListener("dragenter",i=>{this.el.classList.add(...BE)}),this.el.addEventListener("dragleave",i=>{this.el.contains(i.relatedTarget)||this.el.classList.remove(...BE)}),this.el.addEventListener("drop",i=>{this.el.classList.remove(...BE)}),this.openCameraButton.addEventListener("click",i=>{this.cameraListPopulated||(this.renderCameraList(),this.cameraListPopulated=!0)}),this.cameraListEl.addEventListener("click",i=>{let e=i.target.closest("[data-camera-id]");if(e){let t=e.dataset.cameraId;this.openCameraView(t)}}),this.captureCameraButton.addEventListener("click",i=>{let e=this.toCanvas(this.cameraVideoEl,this.cameraVideoEl.videoWidth,this.cameraVideoEl.videoHeight);this.pushImage(e),this.closeCameraView()}),this.cancelButton.addEventListener("click",i=>{this.closeCameraView()})},updated(){this.props=this.getProps()},getProps(){return{id:Ge(this.el,"data-id"),phxTarget:Ge(this.el,"data-phx-target",lo),height:Vn(this.el,"data-height",null,lo),width:Vn(this.el,"data-width",null,lo),format:Ge(this.el,"data-format"),fit:Ge(this.el,"data-fit")}},loadFile(i){let e=new FileReader;e.onload=t=>{let n=document.createElement("img");n.addEventListener("load",r=>{let o=this.toCanvas(n,n.width,n.height);this.pushImage(o)}),n.src=t.target.result},e.readAsDataURL(i)},openCameraView(i){this.cameraPreviewEl.classList.remove("hidden"),this.cancelButton.classList.remove("hidden"),this.captureCameraButton.classList.remove("hidden"),this.previewEl.classList.add("hidden"),this.openCameraButton.classList.add("hidden"),this.uploadButton.classList.add("hidden"),navigator.mediaDevices.getUserMedia(this.cameraConstraints(i)).then(e=>{this.cameraStream=e,this.cameraVideoEl=document.createElement("video"),this.cameraVideoEl.autoplay=!0,this.cameraVideoEl.playsinline=!0,this.cameraVideoEl.muted=!0,this.cameraVideoEl.srcObject=e,this.setCameraPreview(this.cameraVideoEl)}).catch(()=>{})},cameraConstraints(i){return i==="system_default"?{audio:!1,video:!0}:{audio:!1,video:{deviceId:i}}},renderCameraList(){navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then(i=>navigator.mediaDevices.enumerateDevices().then(e=>(this.stopMediaStream(i),e))).then(i=>{let e=i.filter(t=>t.kind==="videoinput").map(t=>({deviceId:t.deviceId,label:t.label}));[{deviceId:"system_default",label:"System Default"},...e].forEach(({deviceId:t,label:n})=>{let r=this.cameraItemTemplateEl.cloneNode(!0);r.querySelector("[data-camera-id]").setAttribute("data-camera-id",t),r.querySelector("[data-label]").innerHTML=n,this.cameraListEl.appendChild(r)})}).catch(i=>{console.error(i),this.openCameraButton.disabled=!0})},closeCameraView(){return this.cameraStream!==null&&(this.stopMediaStream(this.cameraStream),this.cameraStream=null),this.cameraVideoEl!==null&&(this.cameraVideoEl.remove(),this.cameraVideoEl=null),this.cameraPreviewEl.classList.add("hidden"),this.cancelButton.classList.add("hidden"),this.captureCameraButton.classList.add("hidden"),this.previewEl.classList.remove("hidden"),this.openCameraButton.classList.remove("hidden"),this.uploadButton.classList.remove("hidden"),!0},stopMediaStream(i){i.getTracks().forEach(e=>{e.stop()})},pushImage(i){this.pushEventTo(this.props.phxTarget,"change",{data:ese(i,this.props.format),height:i.height,width:i.width})},toCanvas(i,e,t){let{width:n,height:r}=this.props,o=document.createElement("canvas"),s=o.getContext("2d");if(n===null&&r===null||n===e&&r===t)o.width=e,o.height=t,o.getContext("2d").drawImage(i,0,0,e,t,0,0,e,t);else if(this.props.fit==="contain"){let a=n/e,l=r/t,c=Math.min(a,l),d=Math.round(e*c),h=Math.round(t*c);o.width=d,o.height=h,s.drawImage(i,0,0,e,t,0,0,d,h)}else if(this.props.fit==="crop"){let a=n/e,l=r/t,c=Math.max(a,l),d=Math.round(e*c),h=Math.round(t*c);o.width=n,o.height=r,s.drawImage(i,Math.round((d-n)/c/2),Math.round((h-r)/c/2),e-Math.round((d-n)/c),t-Math.round((h-r)/c),0,0,n,r)}else if(this.props.fit==="pad"){let a=n/e,l=r/t,c=Math.min(a,l),d=Math.round(e*c),h=Math.round(t*c);o.width=n,o.height=r,s.fillStyle="black",s.fillRect(0,0,o.width,o.height),s.drawImage(i,0,0,e,t,Math.round((n-d)/2),Math.round((r-h)/2),d,h)}else o.width=n,o.height=r,s.drawImage(i,0,0,e,t,0,0,n,r);return o},setPreview(i){i.style.maxHeight="300px",i.style.maxWidth="100%",this.previewEl.replaceChildren(i)},setCameraPreview(i){i.style.maxHeight="300px",i.style.maxWidth="100%",this.cameraPreviewEl.replaceChildren(i)}};function ese(i,e){if(e==="png"||e==="jpeg"){let t=`data:image/${e};base64,`;return i.toDataURL(`image/${e}`).slice(t.length)}if(e==="rgb"){let t=i.getContext("2d").getImageData(0,0,i.width,i.height),n=tse(t);return f_(n)}throw new Error(`Unexpected format: ${e}`)}function tse(i){let e=i.width*i.height,t=new Uint8ClampedArray(e*3);for(let n=0;n{i.sandbox="allow-scripts allow-same-origin allow-downloads allow-modals allow-popups",i.allow="accelerometer; ambient-light-sensor; camera; display-capture; encrypted-media; geolocation; gyroscope; microphone; midi; usb; xr-spatial-tracking; clipboard-read; clipboard-write",i.src=n})}function cse(i,e){let t=window.location.protocol;return e?e.replace(/^https?:/,t):t==="https:"?"https://livebookusercontent.com/iframe/v4.html":`http://${window.location.hostname}:${i}/iframe/v4.html`}var WE=null;function dse(i){return WE||(WE=fetch(i).then(e=>e.text()).then(e=>{if(rL(e)!==$U)throw new Error(`The iframe loaded from ${i} doesn't have the expected checksum ${$U}`)})),WE}var hse={mounted(){this.props=this.getProps(),this.id=u_(),this.childToken=iL(),this.childReadyPromise=null,this.childReady=!1,this.initReceived=!1,this.syncCallbackQueue=[],this.pongCallbackQueue=[],this.initTimeout=setTimeout(()=>this.handleInitTimeout(),2e3),this.channel=KU(this.props.sessionToken),this.iframeActions=this.createIframe(),this.childReadyPromise=new Promise((r,o)=>{this._handleWindowMessage=s=>{s.source===this.iframe.contentWindow&&this.handleChildMessage(s.data,r)},window.addEventListener("message",this._handleWindowMessage)}),this.hiddenInput=document.createElement("input"),this.hiddenInput.style.display="none",this.el.appendChild(this.hiddenInput),this.iframeActions.visibilityPromise.then(()=>{this.loadIframe()});let i=this.channel.on(`init:${this.props.ref}:${this.id}`,r=>{let[,o]=UE(r);this.handleServerInit(o)}),e=this.channel.on(`event:${this.props.ref}`,r=>{let[[o],s]=UE(r);this.handleServerEvent(o,s)}),t=this.channel.on(`error:${this.props.ref}`,({message:r,init:o})=>{this.handleServerError(r,o)}),n=this.channel.on(`pong:${this.props.ref}`,()=>{this.handleServerPong()});this.unsubscribeFromChannelEvents=()=>{this.channel.off(`init:${this.props.ref}:${this.id}`,i),this.channel.off(`event:${this.props.ref}`,e),this.channel.off(`error:${this.props.ref}`,t),this.channel.off(`pong:${this.props.ref}`,n)},this.unsubscribeFromJSViewEvents=ki.subscribe(`js_views:${this.props.ref}`,r=>this.handleJSViewEvent(r)),this.channel.push("connect",{connect_token:this.props.connectToken,ref:this.props.ref,id:this.id},3e4),this.unsubscribeFromCellEvents=ki.subscribe("navigation",r=>this.handleNavigationEvent(r))},updated(){this.props=this.getProps(this)},disconnected(){this.el.removeAttribute("id")},destroyed(){window.removeEventListener("message",this._handleWindowMessage),this.iframeActions.remove(),this.unsubscribeFromChannelEvents(),this.channel.push("disconnect",{ref:this.props.ref}),this.unsubscribeFromJSViewEvents(),this.unsubscribeFromCellEvents()},getProps(){return{ref:Ge(this.el,"data-ref"),assetsBasePath:Ge(this.el,"data-assets-base-path"),jsPath:Ge(this.el,"data-js-path"),sessionToken:Ge(this.el,"data-session-token"),connectToken:Ge(this.el,"data-connect-token"),iframePort:Ge(this.el,"data-iframe-local-port",lo),iframeUrl:Vn(this.el,"data-iframe-url",null),timeoutMessage:Ge(this.el,"data-timeout-message")}},createIframe(){this.iframePlaceholder=document.createElement("div"),this.el.appendChild(this.iframePlaceholder),this.iframe=document.createElement("iframe"),this.iframe.className="w-full h-0 absolute z-[1]";let i=document.querySelector("[data-el-notebook]"),e=i.querySelector("[data-el-notebook-content]"),t=new ResizeObserver(a=>{this.repositionIframe()});t.observe(e),t.observe(i);let n=ki.subscribe("js_views",a=>{a.type==="reposition"&&this.repositionIframe()});this.iframe.addEventListener("mouseenter",a=>{this.iframePlaceholder.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0}))}),this.iframe.addEventListener("mouseleave",a=>{this.iframePlaceholder.dispatchEvent(new MouseEvent("mouseleave",{bubbles:!0}))});let r=null;return{visibilityPromise:new Promise((a,l)=>{Q9(this.iframePlaceholder)?a():(r=new IntersectionObserver(c=>{Q9(this.iframePlaceholder)&&(r.disconnect(),a())}),r.observe(this.iframePlaceholder))}),remove:()=>{t.disconnect(),n(),r&&r.disconnect(),this.iframe.remove(),this.iframePlaceholder.remove()}}},repositionIframe(){let{iframe:i,iframePlaceholder:e}=this,t=document.querySelector("[data-el-notebook]");if(Jh(e))i.classList.add("hidden");else{i.classList.remove("hidden");let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=r.top-n.top+t.scrollTop;i.style.top=`${o}px`;let s=r.left-n.left+t.scrollLeft;i.style.left=`${s}px`,i.style.height=`${r.height}px`,i.style.width=`${r.width}px`}},loadIframe(){let i=document.querySelector("[data-el-js-view-iframes]");YU(this.iframe,this.props.iframePort,this.props.iframeUrl).then(()=>{i.appendChild(this.iframe)})},handleChildMessage(i,e){if(i.type==="ready"&&!this.childReady){let t=window.location.origin+this.props.assetsBasePath;this.postMessage({type:"readyReply",token:this.childToken,baseUrl:t,jsPath:this.props.jsPath}),this.childReady=!0,e()}else{if(i.token!==this.childToken)throw new Error("Token mismatch");if(i.type==="resize")this.iframePlaceholder.style.height=`${i.height}px`,this.iframe.style.height=`${i.height}px`;else if(i.type==="domEvent"){let t=this.replicateDomEvent(i.event);i.isTargetEditable?this.hiddenInput.dispatchEvent(t):this.el.dispatchEvent(t)}else if(i.type==="event"){let{event:t,payload:n}=i,r=GU([t,this.props.ref],n);this.channel.push("event",r)}else i.type==="syncReply"?(this.pongCallbackQueue.push(this.syncCallbackQueue.shift()),this.channel.push("ping",{ref:this.props.ref})):i.type=="selectSecret"&&this.pushEvent("select_secret",{js_view_ref:this.props.ref,preselect_name:i.preselectName,options:i.options})}},postMessage(i){this.iframe.contentWindow.postMessage(i,"*")},replicateDomEvent(i){if(i.type==="focus")return new FocusEvent("focus");if(i.type==="mousedown")return new MouseEvent("mousedown",{bubbles:!0});if(i.type==="keydown")return new KeyboardEvent(i.type,i.props)},handleInitTimeout(){this.initTimeoutContainer=document.createElement("div"),this.initTimeoutContainer.classList.add("info-box"),this.el.prepend(this.initTimeoutContainer),this.initTimeoutContainer.textContent=this.props.timeoutMessage},clearInitTimeout(){clearTimeout(this.initTimeout),this.initTimeoutContainer&&this.initTimeoutContainer.remove()},handleServerInit(i){this.clearInitTimeout(),this.initReceived=!0,this.childReadyPromise.then(()=>{this.postMessage({type:"init",data:i})})},handleServerEvent(i,e){this.initReceived&&this.childReadyPromise.then(()=>{this.postMessage({type:"event",event:i,payload:e})})},handleServerError(i,e){e&&this.clearInitTimeout(),this.errorContainer||(this.errorContainer=document.createElement("div"),this.errorContainer.classList.add("error-box","mb-4"),this.el.prepend(this.errorContainer)),this.errorContainer.textContent=i},handleServerPong(){this.pongCallbackQueue.shift()()},handleJSViewEvent(i){i.type==="sync"?(this.syncCallbackQueue.push(i.callback),this.postMessage({type:"sync"})):i.type=="secretSelected"&&this.postMessage({type:"secretSelected",secretName:i.secretName})},handleNavigationEvent(i){if(i.type==="element_focused"){let e=this.el.closest("[data-focusable-id]"),t=e?e.dataset.focusableId:null;this.iframe.toggleAttribute("data-js-focused",t===i.focusableId)}}},XU=hse;var use={mounted(){this.props=this.getProps(),this._handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this._handleDocumentKeyUp=this.handleDocumentKeyUp.bind(this),this._handleDocumentFocus=this.handleDocumentFocus.bind(this),window.addEventListener("keydown",this._handleDocumentKeyDown,!0),window.addEventListener("keyup",this._handleDocumentKeyUp,!0),window.addEventListener("focus",this._handleDocumentFocus,!0)},updated(){this.props=this.getProps()},destroyed(){window.removeEventListener("keydown",this._handleDocumentKeyDown,!0),window.removeEventListener("keyup",this._handleDocumentKeyUp,!0),window.removeEventListener("focus",this._handleDocumentFocus,!0)},getProps(){return{isKeydownEnabled:Ge(this.el,"data-keydown-enabled",Qh),isKeyupEnabled:Ge(this.el,"data-keyup-enabled",Qh),target:Ge(this.el,"data-target")}},handleDocumentKeyDown(i){if(this.keyboardEnabled()&&va(i),this.props.isKeydownEnabled){if(i.repeat)return;let{key:e}=i;this.pushEventTo(this.props.target,"keydown",{key:e})}},handleDocumentKeyUp(i){if(this.keyboardEnabled()&&va(i),this.props.isKeyupEnabled){let{key:e}=i;this.pushEventTo(this.props.target,"keyup",{key:e})}},handleDocumentFocus(i){this.props.isKeydownEnabled&&Gc(i.target)&&this.pushEventTo(this.props.target,"disable_keyboard",{})},keyboardEnabled(){return this.props.isKeydownEnabled||this.props.isKeyupEnabled}},QU=use;var mse={mounted(){this.props=this.getProps();let i=new e2(this.el,"",{baseUrl:this.props.sessionPath,allowedUriSchemes:this.props.allowedUriSchemes.split(",")});this.handleEvent(`markdown_renderer:${this.props.id}:content`,({content:e})=>{i.setContent(e)})},getProps(){return{id:Ge(this.el,"data-id"),sessionPath:Ge(this.el,"data-session-path"),allowedUriSchemes:Ge(this.el,"data-allowed-uri-schemes")}}},JU=mse;var pse={mounted(){this.scroll()},updated(){this.scroll()},scroll(){L0(this.el)}},ZU=pse;var jE=class{constructor(e=2e3){this.resetTimeout=e,this.buffer=[],this.resetTimeoutId=null}push(e){this.buffer.push(e),this.resetTimeoutId&&clearTimeout(this.resetTimeoutId),this.resetTimeoutId=setTimeout(()=>{this.reset()},this.resetTimeout)}reset(){this.resetTimeoutId&&clearTimeout(this.resetTimeoutId),this.resetTimeoutId=null,this.buffer=[]}tryMatch(e){if(e.length>this.buffer.length)return!1;let t=this.buffer.slice(-e.length),n=e.every((r,o)=>r===t[o]);return n&&this.reset(),n}},eW=jE;var fse={mounted(){this.props=this.getProps(),this.focusedId=null,this.insertMode=!1,this.view=null,this.keyBuffer=new eW,this.clientsMap={},this.lastLocationReportByClientId={},this.followedClientId=null,p_(this.faviconForEvaluationStatus(this.props.globalStatus)),this.updateSectionListHighlight(),this._handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this._handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this._handleDocumentFocus=this.handleDocumentFocus.bind(this),this._handleDocumentClick=this.handleDocumentClick.bind(this),document.addEventListener("keydown",this._handleDocumentKeyDown,!0),document.addEventListener("mousedown",this._handleDocumentMouseDown),document.addEventListener("focus",this._handleDocumentFocus,!0),document.addEventListener("click",this._handleDocumentClick),this.getElement("sections-list").addEventListener("click",i=>{this.handleSectionsListClick(i),this.handleCellIndicatorsClick(i)}),this.getElement("clients-list").addEventListener("click",i=>this.handleClientsListClick(i)),this.getElement("sections-list-toggle").addEventListener("click",i=>this.toggleSectionsList()),this.getElement("clients-list-toggle").addEventListener("click",i=>this.toggleClientsList()),this.getElement("secrets-list-toggle").addEventListener("click",i=>this.toggleSecretsList()),this.getElement("runtime-info-toggle").addEventListener("click",i=>this.toggleRuntimeInfo()),this.getElement("app-info-toggle").addEventListener("click",i=>this.toggleAppInfo()),this.getElement("notebook").addEventListener("scroll",i=>this.updateSectionListHighlight()),this.getElement("notebook-indicators").addEventListener("click",i=>this.handleCellIndicatorsClick(i)),this.getElement("views").addEventListener("click",i=>{this.handleViewsClick(i)}),this.getElement("section-toggle-collapse-all-button").addEventListener("click",i=>this.toggleCollapseAllSections()),window.addEventListener("phx:page-loading-stop",()=>{this.initializeFocus()},{once:!0}),this.handleEvent("session_init",({clients:i})=>{i.forEach(e=>{this.clientsMap[e.id]=e})}),this.handleEvent("cell_inserted",({cell_id:i})=>{this.handleCellInserted(i)}),this.handleEvent("cell_deleted",({cell_id:i,sibling_cell_id:e})=>{this.handleCellDeleted(i,e)}),this.handleEvent("cell_restored",({cell_id:i})=>{this.handleCellRestored(i)}),this.handleEvent("cell_moved",({cell_id:i})=>{this.handleCellMoved(i)}),this.handleEvent("section_inserted",({section_id:i})=>{this.handleSectionInserted(i)}),this.handleEvent("section_deleted",({section_id:i})=>{this.handleSectionDeleted(i)}),this.handleEvent("section_moved",({section_id:i})=>{this.handleSectionMoved(i)}),this.handleEvent("cell_upload",({cell_id:i,url:e})=>{this.handleCellUpload(i,e)}),this.handleEvent("client_joined",({client:i})=>{this.handleClientJoined(i)}),this.handleEvent("client_left",({client_id:i})=>{this.handleClientLeft(i)}),this.handleEvent("clients_updated",({clients:i})=>{this.handleClientsUpdated(i)}),this.handleEvent("secret_selected",({select_secret_ref:i,secret_name:e})=>{this.handleSecretSelected(i,e)}),this.handleEvent("location_report",({client_id:i,focusable_id:e,selection:t})=>{let n={focusableId:e,selection:this.decodeSelection(t)};this.handleLocationReport(i,n)}),this.unsubscribeFromSessionEvents=ki.subscribe("session",i=>{this.handleSessionEvent(i)})},updated(){let i=this.props;this.props=this.getProps(),this.props.globalStatus!==i.globalStatus&&p_(this.faviconForEvaluationStatus(this.props.globalStatus))},disconnected(){this.el.removeAttribute("id"),this.keepChannel=!0},destroyed(){this.unsubscribeFromSessionEvents(),document.removeEventListener("keydown",this._handleDocumentKeyDown,!0),document.removeEventListener("mousedown",this._handleDocumentMouseDown),document.removeEventListener("focus",this._handleDocumentFocus,!0),document.removeEventListener("click",this._handleDocumentClick),p_("favicon"),this.keepChannel||qU()},getProps(){return{autofocusCellId:Vn(this.el,"data-autofocus-cell-id",null),globalStatus:Vn(this.el,"data-global-status",null)}},faviconForEvaluationStatus(i){return i==="evaluating"?"favicon-evaluating":i==="stale"?"favicon-stale":i==="errored"?"favicon-errored":"favicon"},handleDocumentKeyDown(i){if(i.repeat)return;let e=YA()?i.metaKey:i.ctrlKey,t=i.altKey,n=i.shiftKey,r=i.key,o=this.keyBuffer;if(!(Gc(i.target)&&i.target.closest("[data-el-outputs-container]"))){if(e&&n&&!t&&r==="Enter"){va(i),this.queueFullCellsEvaluation(!0);return}else if(!e&&n&&!t&&r==="Enter"){va(i),uh(this.focusedCellType())&&this.queueFocusedCellEvaluation(),this.moveFocus(1);return}else if(e&&!t&&r==="Enter"){va(i),uh(this.focusedCellType())&&this.queueFocusedCellEvaluation();return}else if(e&&r==="s"){va(i),this.saveNotebook();return}else if(e||t)return}this.insertMode?(o.reset(),r==="Escape"&&(this.escapesMonacoWidget(i)||this.escapeInsertMode())):Gc(i.target)?(o.reset(),r==="Escape"&&i.target.blur()):(o.push(i.key),o.tryMatch(["d","d"])?this.deleteFocusedCell():o.tryMatch(["e","a"])?this.queueFullCellsEvaluation(!1):o.tryMatch(["e","e"])?uh(this.focusedCellType())&&this.queueFocusedCellEvaluation():o.tryMatch(["e","s"])?this.queueFocusedSectionEvaluation():o.tryMatch(["s","s"])?this.toggleSectionsList():o.tryMatch(["s","e"])?this.toggleSecretsList():o.tryMatch(["s","a"])?this.toggleAppInfo():o.tryMatch(["s","u"])?this.toggleClientsList():o.tryMatch(["s","r"])?this.toggleRuntimeInfo():o.tryMatch(["s","b"])?this.showBin():o.tryMatch(["s","p"])?this.showPackageSearch():o.tryMatch(["e","x"])?this.cancelFocusedCellEvaluation():o.tryMatch(["0","0"])?this.reconnectRuntime():o.tryMatch(["Escape","Escape"])?this.setFocusedEl(null):o.tryMatch(["?"])?this.showShortcuts():o.tryMatch(["i"])||i.target.matches("body, [data-el-cell-body], [data-el-heading], [data-focusable-id]")&&this.focusedId&&r==="Enter"?(va(i),this.isInsertModeAvailable()&&this.enterInsertMode()):o.tryMatch(["j"])?this.moveFocus(1):o.tryMatch(["k"])?this.moveFocus(-1):o.tryMatch(["J"])?this.moveFocusedCell(1):o.tryMatch(["K"])?this.moveFocusedCell(-1):o.tryMatch(["n"])?this.insertCellBelowFocused("code"):o.tryMatch(["N"])?this.insertCellAboveFocused("code"):o.tryMatch(["m"])?!this.isViewCodeZen()&&this.insertCellBelowFocused("markdown"):o.tryMatch(["M"])?!this.isViewCodeZen()&&this.insertCellAboveFocused("markdown"):o.tryMatch(["v","z"])?this.toggleView("code-zen"):o.tryMatch(["v","p"])?this.toggleView("presentation"):o.tryMatch(["c"])?!this.isViewCodeZen()&&this.toggleCollapseSection():o.tryMatch(["C"])&&!this.isViewCodeZen()&&this.toggleCollapseAllSections())},escapesMonacoWidget(i){if(i.target.closest(".monaco-inputbox"))return!0;let e=i.target.closest(".monaco-editor.focused");return e?!!(e.querySelector(".editor-widget.parameter-hints-widget.visible")||e.querySelector(".editor-widget.suggest-widget.visible")||e.querySelectorAll(".cursor").length>1):!1},handleDocumentMouseDown(i){if(!i.target.closest("[data-el-notebook]")||i.target.closest(".doctest-failure-overlay")){this.insertMode&&this.setInsertMode(!1);return}if(i.target.closest("[data-el-insert-buttons] button"))return;let e=i.target.closest("[data-focusable-id]"),t=e?e.dataset.focusableId:null,n=this.editableElementClicked(i,e);t!==this.focusedId&&this.setFocusedEl(t,{scroll:!1,focusElement:!1}),!i.target.closest("[data-el-actions]")&&this.insertMode!==n&&this.setInsertMode(n)},editableElementClicked(i,e){if(e){let t=i.target.closest("[data-el-editor-container], [data-el-heading]");return t&&e.contains(t)}return!1},handleDocumentFocus(i){let e=i.target.closest&&i.target.closest("[data-focusable-id]");if(e){let t=e.dataset.focusableId;t!==this.focusedId&&this.setFocusedEl(t,{scroll:!1,focusElement:!1})}},handleDocumentClick(i){i.target.closest("[data-el-enable-insert-mode-button]")&&this.setInsertMode(!0),i.target.closest("[data-btn-package-search]")&&this.insertMode&&this.setInsertMode(!1);let e=i.target.closest("[data-el-queue-cell-evaluation-button]");if(e){let n=e.getAttribute("data-cell-id"),r=e.hasAttribute("data-disable-dependencies-cache");this.queueCellEvaluation(n,r)}let t=window.location.hash;if(t){let n=t.replace(/^#/,"");!document.getElementById(n).contains(i.target)&&!i.target.closest("a")&&history.pushState(null,document.title,window.location.pathname+window.location.search)}},handleSectionsListClick(i){let e=i.target.closest("[data-el-sections-list-item]");if(e){let t=e.getAttribute("data-section-id");this.getSectionById(t).scrollIntoView({behavior:"smooth",block:"start"})}},handleClientsListClick(i){let e=i.target.closest("[data-el-clients-list-item]");if(e){let t=e.getAttribute("data-client-id");i.target.closest("[data-el-client-link]")&&this.handleClientLinkClick(t),i.target.closest("[data-el-client-follow-toggle]")&&this.handleClientFollowToggleClick(t,e)}},handleClientLinkClick(i){this.mirrorClientFocus(i)},handleClientFollowToggleClick(i,e){let t=this.el.querySelector("[data-el-clients-list-item][data-js-followed]");t&&t.removeAttribute("data-js-followed"),i===this.followedClientId?this.followedClientId=null:(e.setAttribute("data-js-followed",""),this.followedClientId=i,this.mirrorClientFocus(i))},mirrorClientFocus(i){let e=this.lastLocationReportByClientId[i];e&&e.focusableId&&this.setFocusedEl(e.focusableId)},handleCellIndicatorsClick(i){let e=i.target.closest("[data-el-focus-cell-button]");if(e){let t=e.getAttribute("data-target");this.setFocusedEl(t)}},initializeFocus(){let i=window.location.hash;if(i){let e=i.replace(/^#/,""),t=document.getElementById(e);if(t){let n=t.closest("[data-focusable-id]");n?this.setFocusedEl(n.dataset.focusableId):t.scrollIntoView()}}else this.props.autofocusCellId&&(this.setFocusedEl(this.props.autofocusCellId,{scroll:!1}),this.setInsertMode(!0))},updateSectionListHighlight(){let i=this.el.querySelector("[data-el-sections-list-item][data-js-is-viewed]");i&&i.removeAttribute("data-js-is-viewed");let e=this.getSections().reverse().find(t=>{let{top:n}=t.getBoundingClientRect(),r=document.documentElement.scrollTop;return n<=r+window.innerHeight*.35});if(e){let t=e.getAttribute("data-section-id");this.el.querySelector(`[data-el-sections-list-item][data-section-id="${t}"]`).setAttribute("data-js-is-viewed","")}},toggleSectionsList(){this.toggleSidePanelContent("sections-list")},toggleClientsList(){this.toggleSidePanelContent("clients-list")},toggleSecretsList(){this.toggleSidePanelContent("secrets-list")},toggleAppInfo(){this.toggleSidePanelContent("app-info")},toggleRuntimeInfo(){this.toggleSidePanelContent("runtime-info")},toggleSidePanelContent(i){this.el.getAttribute("data-js-side-panel-content")===i?this.el.removeAttribute("data-js-side-panel-content"):this.el.setAttribute("data-js-side-panel-content",i)},showBin(){let i=this.el.querySelector("[data-btn-show-bin]");i&&i.click()},showPackageSearch(){this.setFocusedEl("setup");let i=this.el.querySelector("[data-btn-package-search]");i&&i.click()},saveNotebook(){this.pushEvent("save",{})},deleteFocusedCell(){this.focusedId&&this.isCell(this.focusedId)&&this.pushEvent("delete_cell",{cell_id:this.focusedId})},queueCellEvaluation(i,e){this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_cell_evaluation",{cell_id:i,disable_dependencies_cache:e})})},queueFocusedCellEvaluation(){this.focusedId&&this.isCell(this.focusedId)&&this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_cell_evaluation",{cell_id:this.focusedId})})},queueFullCellsEvaluation(i){let e=i&&this.focusedId&&this.isCell(this.focusedId)?[this.focusedId]:[];this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_full_evaluation",{forced_cell_ids:e})})},queueFocusedSectionEvaluation(){if(this.focusedId){let i=this.getSectionIdByFocusableId(this.focusedId);i&&this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_section_evaluation",{section_id:i})})}},dispatchQueueEvaluation(i){uh(this.focusedCellType())?ki.broadcast(`cells:${this.focusedId}`,{type:"dispatch_queue_evaluation",dispatch:i}):i()},cancelFocusedCellEvaluation(){this.focusedId&&this.isCell(this.focusedId)&&this.pushEvent("cancel_cell_evaluation",{cell_id:this.focusedId})},reconnectRuntime(){this.pushEvent("reconnect_runtime",{})},showShortcuts(){let i=this.el.querySelector("[data-btn-show-shortcuts]");i&&i.click()},isInsertModeAvailable(){if(!this.focusedId)return!1;let i=this.getFocusableEl(this.focusedId);return!this.isCell(this.focusedId)||!i.hasAttribute("data-js-insert-mode-disabled")},enterInsertMode(){this.focusedId&&this.setInsertMode(!0)},escapeInsertMode(){this.setInsertMode(!1)},moveFocus(i){let e=this.nearbyFocusableId(this.focusedId,i);this.setFocusedEl(e)},moveFocusedCell(i){this.focusedId&&this.isCell(this.focusedId)&&this.pushEvent("move_cell",{cell_id:this.focusedId,offset:i})},insertCellBelowFocused(i){if(this.focusedId)this.insertCellBelowFocusableId(this.focusedId,i);else{let e=this.getFocusableIds();e.length>0&&this.insertCellBelowFocusableId(e[e.length-1],i)}},insertCellAboveFocused(i){if(this.focusedId){let e=this.nearbyFocusableId(this.focusedId,-1);this.insertCellBelowFocusableId(e,i)}else{let e=this.getFocusableIds();e.length>0&&this.insertCellBelowFocusableId(e[0],i)}},insertCellBelowFocusableId(i,e){if(this.isCell(i))this.pushEvent("insert_cell_below",{type:e,cell_id:i});else if(this.isSection(i))this.pushEvent("insert_cell_below",{type:e,section_id:i});else if(this.isNotebook(i)){let t=this.getSectionIds();t.length>0&&this.pushEvent("insert_cell_below",{type:e,section_id:t[0]})}},setFocusedEl(i,{scroll:e=!0,focusElement:t=!0}={}){if(this.focusedId=i,i){if(!this.isSection(i)){let r=this.getSectionIdByFocusableId(i);r&&this.getSectionById(r).removeAttribute("data-js-collapsed")}let n=this.getFocusableEl(i);t&&(n.querySelector("[data-el-cell-body]")||n.querySelector("[data-el-heading]")||n).focus({preventScroll:!0})}ki.broadcast("navigation",{type:"element_focused",focusableId:i,scroll:e}),this.setInsertMode(!1)},setInsertMode(i){this.insertMode=i,i?this.el.setAttribute("data-js-insert-mode",""):(this.el.removeAttribute("data-js-insert-mode"),this.sendLocationReport({focusableId:this.focusedId,selection:null})),ki.broadcast("navigation",{type:"insert_mode_changed",enabled:i})},handleViewsClick(i){let e=i.target.closest("[data-el-view-toggle]");if(e){let t=e.getAttribute("data-el-view-toggle");this.toggleView(t)}},toggleView(i){this.view===i?(this.view=null,this.el.removeAttribute("data-js-view")):(this.view=i,this.el.setAttribute("data-js-view",i));let e=this.focusedId||this.nearbyFocusableId(null,0);if(e){let t=this.ensureVisibleFocusableEl(e);t!==this.focused&&this.setFocusedEl(t,{scroll:!1}),t&&this.getFocusableEl(t).scrollIntoView({block:"center"})}},toggleCollapseSection(){if(this.focusedId){let i=this.getSectionIdByFocusableId(this.focusedId);if(i){let e=this.getSectionById(i);e.hasAttribute("data-js-collapsed")?e.removeAttribute("data-js-collapsed"):(e.setAttribute("data-js-collapsed",""),this.setFocusedEl(i,{scroll:!0}))}}},toggleCollapseAllSections(){let i=this.getSections().every(e=>e.hasAttribute("data-js-collapsed"));if(this.getSections().forEach(e=>{e.toggleAttribute("data-js-collapsed",!i)}),this.focusedId){let e=this.getSectionIdByFocusableId(this.focusedId);e&&this.setFocusedEl(e,{scroll:!0})}},handleCellInserted(i){this.setFocusedEl(i),Vz(this.focusedCellType())&&this.setInsertMode(!0)},handleCellDeleted(i,e){if(this.focusedId===i)if(this.isViewCodeZen()){let t=this.ensureVisibleFocusableEl(e);this.setFocusedEl(t)}else this.setFocusedEl(e)},handleCellRestored(i){this.setFocusedEl(i)},handleCellMoved(i){this.repositionJSViews(),this.focusedId===i&&ki.broadcast("cells",{type:"cell_moved",cellId:i})},handleSectionInserted(i){let t=this.getSectionById(i).querySelector("[data-el-section-headline]"),{focusableId:n}=t.dataset;this.setFocusedEl(n),this.setInsertMode(!0),JA(document.activeElement)},handleSectionDeleted(i){this.focusedId&&!this.getFocusableEl(this.focusedId)&&this.setFocusedEl(null)},handleSectionMoved(i){this.repositionJSViews();let e=this.getSectionById(i);Pl(e)},handleCellUpload(i,e){this.focusedId!==i&&this.setFocusedEl(i),this.insertMode||this.setInsertMode(!0),ki.broadcast("cells",{type:"cell_upload",cellId:i,url:e})},handleClientJoined(i){this.clientsMap[i.id]=i},handleClientLeft(i){let e=this.clientsMap[i];e&&(delete this.clientsMap[i],this.broadcastLocationReport(e,{focusableId:null,selection:null}),e.id===this.followedClientId&&(this.followedClientId=null))},handleClientsUpdated(i){i.forEach(e=>{this.clientsMap[e.id]=e})},handleSecretSelected(i,e){ki.broadcast(`js_views:${i}`,{type:"secretSelected",secretName:e})},handleLocationReport(i,e){let t=this.clientsMap[i];this.lastLocationReportByClientId[i]=e,t&&(this.broadcastLocationReport(t,e),t.id===this.followedClientId&&e.focusableId!==this.focusedId&&this.setFocusedEl(e.focusableId))},handleSessionEvent(i){i.type==="cursor_selection_changed"&&this.sendLocationReport({focusableId:i.focusableId,selection:i.selection})},repositionJSViews(){ki.broadcast("js_views",{type:"reposition"})},broadcastLocationReport(i,e){ki.broadcast("navigation",{type:"location_report",client:i,report:e})},sendLocationReport(i){Object.keys(this.clientsMap).length>1&&this.pushEvent("location_report",{focusable_id:i.focusableId,selection:this.encodeSelection(i.selection)})},encodeSelection(i){if(i===null)return null;let{tag:e,editorSelection:t}=i;return[e,t.selectionStartLineNumber,t.selectionStartColumn,t.positionLineNumber,t.positionColumn]},decodeSelection(i){if(i===null)return null;let[e,t,n,r,o]=i,s=new vt.Selection(t,n,r,o);return{tag:e,editorSelection:s}},focusedCellType(){return this.focusedId&&this.isCell(this.focusedId)?this.getFocusableEl(this.focusedId).getAttribute("data-type"):null},nearbyFocusableId(i,e){let t=this.getFocusableIds();if(t.length===0)return null;let n=t.indexOf(i);if(n===-1){let r=this.getFocusableEls().find(X9);return r?r.getAttribute("data-focusable-id"):t[0]}else{let r=XA(n+e,0,t.length-1);return t[r]}},ensureVisibleFocusableEl(i){let e=this.getFocusableEl(i),t=Array.from(this.el.querySelectorAll("[data-focusable-id]")),n=t.indexOf(e),r=[...t.slice(n,-1),...t.slice(0,n).reverse()].find(o=>!Jh(o));return r&&r.getAttribute("data-focusable-id")},isCell(i){return this.getFocusableEl(i).hasAttribute("data-el-cell")},isSection(i){return this.getFocusableEl(i).hasAttribute("data-el-section-headline")},isNotebook(i){return this.getFocusableEl(i).hasAttribute("data-el-notebook-headline")},getFocusableEl(i){return this.el.querySelector(`[data-focusable-id="${i}"]`)},getFocusableEls(){return Array.from(this.el.querySelectorAll("[data-focusable-id]")).filter(i=>!Jh(i))},getFocusableIds(){return this.getFocusableEls().map(i=>i.getAttribute("data-focusable-id"))},getSectionIdByFocusableId(i){let t=this.getFocusableEl(i).closest("[data-el-section]");return t&&t.getAttribute("data-section-id")},getSectionIds(){return this.getSections().map(e=>e.getAttribute("data-section-id"))},getSections(){return Array.from(this.el.querySelectorAll("[data-el-section]"))},getSectionById(i){return this.el.querySelector(`[data-el-section][data-section-id="${i}"]`)},getElement(i){return this.el.querySelector(`[data-el-${i}]`)},isViewCodeZen(){return this.view==="code-zen"},isViewPresentation(){return this.view==="presentation"}},tW=fse;var gse={mounted(){this.autosize(),this.el.addEventListener("input",i=>{this.autosize()})},updated(){this.autosize()},autosize(){this.el.style.height="0px",this.el.style.height=`${this.el.scrollHeight+2}px`}},iW=gse;var _se=100,vse={mounted(){this.props=this.getProps(),this.interval=setInterval(()=>this.updateDOM(),_se)},updated(){this.props=this.getProps(),this.updateDOM()},destroyed(){clearInterval(this.interval)},getProps(){return{start:Ge(this.el,"data-start")}},updateDOM(){let e=(Date.now()-new Date(this.props.start))/1e3;this.el.innerHTML=`${e.toFixed(1)}s`}},nW=vse;var rW="lb:user_data";function oW(i){let e=JSON.stringify(i),t=eL(e);yse(rW,t,15768e4)}function sW(){let i=bse(rW);if(i){let e=tL(i);return JSON.parse(e)}else return null}function bse(i){let e=document.cookie.split("; ").find(t=>t.startsWith(`${i}=`));return e?e.replace(`${i}=`,""):null}function yse(i,e,t){let n=`${i}=${e};max-age=${t};path=/${g_()}`;document.cookie=n}var Sse={mounted(){this.el.addEventListener("submit",i=>{let e=this.el.user_form_name.value,t=this.el.user_form_hex_color.value;oW({name:e,hex_color:t})})}},aW=Sse;var dW=qi(cW());var Cse={mounted(){this.props=this.getProps(),this.lineHeight=QA(this.el),this.templateEl=Zh(this.el,"[data-template]"),this.contentEl=Zh(this.el,"[data-content]"),this.capLines();let i=this.hyperListConfig();this.virtualizedList=new dW.default(this.contentEl,i),this.props.follow&&L0(this.contentEl)},updated(){this.props=this.getProps(),this.capLines();let i=this.props.follow&&ZA(this.contentEl),e=this.hyperListConfig();this.virtualizedList.refresh(this.contentEl,e),i&&L0(this.contentEl)},getProps(){return{maxHeight:Ge(this.el,"data-max-height",lo),follow:Vn(this.el,"data-follow",!1,Qh),maxLines:Vn(this.el,"data-max-lines",null,lo),ignoreTrailingEmptyLine:Vn(this.el,"data-ignore-trailing-empty-line",!1,Qh)}},hyperListConfig(){let i=this.getLineElements(),e=i.length,t=Math.min(this.props.maxHeight,this.lineHeight*e);return{height:t,total:e,itemHeight:this.lineHeight,generate:n=>{let r=i[n].cloneNode(!0);return r.removeAttribute("id"),r},afterRender:()=>{this.contentEl.scrollWidth>this.contentEl.clientWidth?this.contentEl.style.height=`${t+12}px`:this.contentEl.style.height=`${t}px`}}},getLineElements(){let i=Array.from(this.templateEl.querySelectorAll("[data-line]"));if(i.length===0)return[];let e=i[i.length-1];return this.props.ignoreTrailingEmptyLine&&e.innerText===""?i.slice(0,-1):i},capLines(){if(this.props.maxLines){let e=Array.from(this.templateEl.querySelectorAll("[data-line]")).slice(0,-this.props.maxLines),[t,...n]=e;n.forEach(r=>r.remove()),t&&(t.innerHTML="...")}}},hW=Cse;var uW={AppAuth:HA,AudioInput:aL,Cell:Kz,CellEditor:Xz,Dropzone:Qz,EditorSettings:Jz,EmojiPicker:HU,FocusOnUpdate:BU,Headline:UU,Highlight:WU,ImageInput:jU,ImageOutput:VU,JSView:XU,KeyboardControl:QU,MarkdownRenderer:JU,ScrollOnUpdate:ZU,Session:tW,TextareaAutosize:iW,Timer:nW,UserForm:aW,VirtualizedLines:hW};var mW={onBeforeElUpdated(i,e){for(let t of i.attributes)t.name.startsWith("data-js-")&&e.setAttribute(t.name,t.value),t.name==="data-keep-attribute"&&(i.hasAttribute(t.value)?e.setAttribute(t.value,i.getAttribute(t.value)):e.removeAttribute(t.value))},onNodeAdded(i){if(i.nodeType===Node.ELEMENT_NODE&&i.hasAttribute("autofocus")&&(i.focus(),i.setSelectionRange&&i.value)){let e=i.value.length;i.setSelectionRange(e,e)}}};var L2=qi(fW());function gW(){L2.default.config({barColors:{0:"#b2c1ff"},shadowColor:"rgba(0, 0, 0, .3)"});let i=null;window.addEventListener("phx:page-loading-start",()=>{i||(i=setTimeout(()=>L2.default.show(),500))}),window.addEventListener("phx:page-loading-stop",()=>{clearTimeout(i),i=null,L2.default.hide()})}function _W(){window.addEventListener("lb:focus",i=>{requestAnimationFrame(()=>{i.target.focus()})}),window.addEventListener("lb:set_value",i=>{i.target.value=i.detail.value}),window.addEventListener("lb:check",i=>{i.target.checked=!0}),window.addEventListener("lb:uncheck",i=>{i.target.checked=!1}),window.addEventListener("lb:set_text",i=>{i.target.textContent=i.detail.value}),window.addEventListener("lb:clipcopy",i=>{"clipboard"in navigator?i.target.tagName==="INPUT"?navigator.clipboard.writeText(i.target.value):navigator.clipboard.writeText(i.target.textContent):alert(`Sorry, your browser does not support clipboard copy. +`," ");document.execCommand("insertText",!1,t)}),this.headingEl.addEventListener("keydown",e=>{e.key==="Enter"&&e.preventDefault()}),this.headingEl.addEventListener("blur",e=>{setTimeout(()=>{this.isFocused&&this.insertMode&&(this.headingEl.focus(),zU(this.headingEl))},0)}))},handleNavigationEvent(i){i.type==="element_focused"?this.handleElementFocused(i.focusableId,i.scroll):i.type==="insert_mode_changed"&&this.handleInsertModeChanged(i.enabled)},handleElementFocused(i,e){this.props.focusableId===i?(this.isFocused=!0,this.el.setAttribute("data-js-focused",""),e&&Pl(this.el)):this.isFocused&&(this.isFocused=!1,this.el.removeAttribute("data-js-focused"))},handleInsertModeChanged(i){this.isFocused&&!this.insertMode&&i?(this.insertMode=i,this.el.setAttribute("phx-update","ignore"),this.headingEl.setAttribute("contenteditable",""),this.headingEl.focus(),zU(this.headingEl)):this.insertMode&&!i&&(this.insertMode=i,this.headingEl.removeAttribute("contenteditable"),this.el.removeAttribute("phx-update"),this.pushEvent(this.props.onValueChange,{value:this.headingEl.textContent.trim(),metadata:this.props.metadata}))}};function zU(i){let e=document.createRange();e.selectNodeContents(i),e.collapse(!1);let t=window.getSelection();t.removeAllRanges(),t.addRange(e)}var UU=Qoe;var Joe={mounted(){this.props=this.getProps(),this.sourceEl=Zh(this.el,"[data-source]"),this.targetEl=Zh(this.el,"[data-target]"),this.updateDOM()},updated(){this.props=this.getProps(),this.updateDOM()},getProps(){return{language:Ge(this.el,"data-language")}},updateDOM(){let i=this.sourceEl.innerText;D1(i,this.props.language).then(e=>{this.targetEl.innerHTML=e,this.el.setAttribute("data-highlighted","")})}},WU=Joe;var BE=["bg-yellow-100","border-yellow-300"],Zoe={mounted(){this.props=this.getProps(),this.inputEl=this.el.querySelector("[data-input]"),this.previewEl=this.el.querySelector("[data-preview]"),this.initialPreviewContentEl=this.previewEl.firstElementChild,this.cameraPreviewEl=this.el.querySelector("[data-camera-preview]"),this.cameraListEl=this.el.querySelector("[data-camera-list]"),this.cameraItemTemplateEl=this.cameraListEl.firstElementChild,this.cameraItemTemplateEl.remove(),this.uploadButton=this.el.querySelector("[data-btn-upload]"),this.openCameraButton=this.el.querySelector("[data-btn-open-camera]"),this.captureCameraButton=this.el.querySelector("[data-btn-capture-camera]"),this.cancelButton=this.el.querySelector("[data-btn-cancel]"),this.cameraListPopulated=!1,this.cameraVideoEl=null,this.cameraStream=null,this.handleEvent(`image_input_change:${this.props.id}`,({image_info:i})=>{if(i){let e=ise(i,this.props.format);this.setPreview(e)}else this.setPreview(this.initialPreviewContentEl)}),this.uploadButton.addEventListener("click",i=>{this.inputEl.click()}),this.inputEl.addEventListener("change",i=>{let[e]=i.target.files;e&&this.loadFile(e)}),this.el.addEventListener("dragover",i=>{i.stopPropagation(),i.preventDefault(),i.dataTransfer.dropEffect="copy"}),this.el.addEventListener("drop",i=>{i.stopPropagation(),i.preventDefault();let[e]=i.dataTransfer.files;e&&this.loadFile(e),this.closeCameraView()}),this.el.addEventListener("dragenter",i=>{this.el.classList.add(...BE)}),this.el.addEventListener("dragleave",i=>{this.el.contains(i.relatedTarget)||this.el.classList.remove(...BE)}),this.el.addEventListener("drop",i=>{this.el.classList.remove(...BE)}),this.openCameraButton.addEventListener("click",i=>{this.cameraListPopulated||(this.renderCameraList(),this.cameraListPopulated=!0)}),this.cameraListEl.addEventListener("click",i=>{let e=i.target.closest("[data-camera-id]");if(e){let t=e.dataset.cameraId;this.openCameraView(t)}}),this.captureCameraButton.addEventListener("click",i=>{let e=this.toCanvas(this.cameraVideoEl,this.cameraVideoEl.videoWidth,this.cameraVideoEl.videoHeight);this.pushImage(e),this.closeCameraView()}),this.cancelButton.addEventListener("click",i=>{this.closeCameraView()})},updated(){this.props=this.getProps()},getProps(){return{id:Ge(this.el,"data-id"),phxTarget:Ge(this.el,"data-phx-target",lo),height:Vn(this.el,"data-height",null,lo),width:Vn(this.el,"data-width",null,lo),format:Ge(this.el,"data-format"),fit:Ge(this.el,"data-fit")}},loadFile(i){let e=new FileReader;e.onload=t=>{let n=document.createElement("img");n.addEventListener("load",r=>{let o=this.toCanvas(n,n.width,n.height);this.pushImage(o)}),n.src=t.target.result},e.readAsDataURL(i)},openCameraView(i){this.cameraPreviewEl.classList.remove("hidden"),this.cancelButton.classList.remove("hidden"),this.captureCameraButton.classList.remove("hidden"),this.previewEl.classList.add("hidden"),this.openCameraButton.classList.add("hidden"),this.uploadButton.classList.add("hidden"),navigator.mediaDevices.getUserMedia(this.cameraConstraints(i)).then(e=>{this.cameraStream=e,this.cameraVideoEl=document.createElement("video"),this.cameraVideoEl.autoplay=!0,this.cameraVideoEl.playsinline=!0,this.cameraVideoEl.muted=!0,this.cameraVideoEl.srcObject=e,this.setCameraPreview(this.cameraVideoEl)}).catch(()=>{})},cameraConstraints(i){return i==="system_default"?{audio:!1,video:!0}:{audio:!1,video:{deviceId:i}}},renderCameraList(){navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then(i=>navigator.mediaDevices.enumerateDevices().then(e=>(this.stopMediaStream(i),e))).then(i=>{let e=i.filter(t=>t.kind==="videoinput").map(t=>({deviceId:t.deviceId,label:t.label}));[{deviceId:"system_default",label:"System Default"},...e].forEach(({deviceId:t,label:n})=>{let r=this.cameraItemTemplateEl.cloneNode(!0);r.querySelector("[data-camera-id]").setAttribute("data-camera-id",t),r.querySelector("[data-label]").innerHTML=n,this.cameraListEl.appendChild(r)})}).catch(i=>{console.error(i),this.openCameraButton.disabled=!0})},closeCameraView(){return this.cameraStream!==null&&(this.stopMediaStream(this.cameraStream),this.cameraStream=null),this.cameraVideoEl!==null&&(this.cameraVideoEl.remove(),this.cameraVideoEl=null),this.cameraPreviewEl.classList.add("hidden"),this.cancelButton.classList.add("hidden"),this.captureCameraButton.classList.add("hidden"),this.previewEl.classList.remove("hidden"),this.openCameraButton.classList.remove("hidden"),this.uploadButton.classList.remove("hidden"),!0},stopMediaStream(i){i.getTracks().forEach(e=>{e.stop()})},pushImage(i){this.pushEventTo(this.props.phxTarget,"change",{data:ese(i,this.props.format),height:i.height,width:i.width})},toCanvas(i,e,t){let{width:n,height:r}=this.props,o=document.createElement("canvas"),s=o.getContext("2d");if(n===null&&r===null||n===e&&r===t)o.width=e,o.height=t,o.getContext("2d").drawImage(i,0,0,e,t,0,0,e,t);else if(this.props.fit==="contain"){let a=n/e,l=r/t,c=Math.min(a,l),d=Math.round(e*c),h=Math.round(t*c);o.width=d,o.height=h,s.drawImage(i,0,0,e,t,0,0,d,h)}else if(this.props.fit==="crop"){let a=n/e,l=r/t,c=Math.max(a,l),d=Math.round(e*c),h=Math.round(t*c);o.width=n,o.height=r,s.drawImage(i,Math.round((d-n)/c/2),Math.round((h-r)/c/2),e-Math.round((d-n)/c),t-Math.round((h-r)/c),0,0,n,r)}else if(this.props.fit==="pad"){let a=n/e,l=r/t,c=Math.min(a,l),d=Math.round(e*c),h=Math.round(t*c);o.width=n,o.height=r,s.fillStyle="black",s.fillRect(0,0,o.width,o.height),s.drawImage(i,0,0,e,t,Math.round((n-d)/2),Math.round((r-h)/2),d,h)}else o.width=n,o.height=r,s.drawImage(i,0,0,e,t,0,0,n,r);return o},setPreview(i){i.style.maxHeight="300px",i.style.maxWidth="100%",this.previewEl.replaceChildren(i)},setCameraPreview(i){i.style.maxHeight="300px",i.style.maxWidth="100%",this.cameraPreviewEl.replaceChildren(i)}};function ese(i,e){if(e==="png"||e==="jpeg"){let t=`data:image/${e};base64,`;return i.toDataURL(`image/${e}`).slice(t.length)}if(e==="rgb"){let t=i.getContext("2d").getImageData(0,0,i.width,i.height),n=tse(t);return f_(n)}throw new Error(`Unexpected format: ${e}`)}function tse(i){let e=i.width*i.height,t=new Uint8ClampedArray(e*3);for(let n=0;n{i.sandbox="allow-scripts allow-same-origin allow-downloads allow-modals allow-popups",i.allow="accelerometer; ambient-light-sensor; camera; display-capture; encrypted-media; geolocation; gyroscope; microphone; midi; usb; xr-spatial-tracking; clipboard-read; clipboard-write",i.src=n})}function cse(i,e){let t=window.location.protocol;return e?e.replace(/^https?:/,t):t==="https:"?"https://livebookusercontent.com/iframe/v4.html":`http://${window.location.hostname}:${i}/iframe/v4.html`}var WE=null;function dse(i){return WE||(WE=fetch(i).then(e=>e.text()).then(e=>{if(rL(e)!==$U)throw new Error(`The iframe loaded from ${i} doesn't have the expected checksum ${$U}`)})),WE}var hse={mounted(){this.props=this.getProps(),this.id=u_(),this.childToken=iL(),this.childReadyPromise=null,this.childReady=!1,this.initReceived=!1,this.syncCallbackQueue=[],this.pongCallbackQueue=[],this.initTimeout=setTimeout(()=>this.handleInitTimeout(),2e3),this.channel=KU(this.props.sessionToken),this.iframeActions=this.createIframe(),this.childReadyPromise=new Promise((r,o)=>{this._handleWindowMessage=s=>{s.source===this.iframe.contentWindow&&this.handleChildMessage(s.data,r)},window.addEventListener("message",this._handleWindowMessage)}),this.hiddenInput=document.createElement("input"),this.hiddenInput.style.display="none",this.el.appendChild(this.hiddenInput),this.iframeActions.visibilityPromise.then(()=>{this.loadIframe()});let i=this.channel.on(`init:${this.props.ref}:${this.id}`,r=>{let[,o]=UE(r);this.handleServerInit(o)}),e=this.channel.on(`event:${this.props.ref}`,r=>{let[[o],s]=UE(r);this.handleServerEvent(o,s)}),t=this.channel.on(`error:${this.props.ref}`,({message:r,init:o})=>{this.handleServerError(r,o)}),n=this.channel.on(`pong:${this.props.ref}`,()=>{this.handleServerPong()});this.unsubscribeFromChannelEvents=()=>{this.channel.off(`init:${this.props.ref}:${this.id}`,i),this.channel.off(`event:${this.props.ref}`,e),this.channel.off(`error:${this.props.ref}`,t),this.channel.off(`pong:${this.props.ref}`,n)},this.unsubscribeFromJSViewEvents=ki.subscribe(`js_views:${this.props.ref}`,r=>this.handleJSViewEvent(r)),this.channel.push("connect",{connect_token:this.props.connectToken,ref:this.props.ref,id:this.id},3e4),this.unsubscribeFromCellEvents=ki.subscribe("navigation",r=>this.handleNavigationEvent(r))},updated(){this.props=this.getProps(this)},disconnected(){this.el.removeAttribute("id")},destroyed(){window.removeEventListener("message",this._handleWindowMessage),this.iframeActions.remove(),this.unsubscribeFromChannelEvents(),this.channel.push("disconnect",{ref:this.props.ref}),this.unsubscribeFromJSViewEvents(),this.unsubscribeFromCellEvents()},getProps(){return{ref:Ge(this.el,"data-ref"),assetsBasePath:Ge(this.el,"data-assets-base-path"),jsPath:Ge(this.el,"data-js-path"),sessionToken:Ge(this.el,"data-session-token"),connectToken:Ge(this.el,"data-connect-token"),iframePort:Ge(this.el,"data-iframe-local-port",lo),iframeUrl:Vn(this.el,"data-iframe-url",null),timeoutMessage:Ge(this.el,"data-timeout-message")}},createIframe(){this.iframePlaceholder=document.createElement("div"),this.el.appendChild(this.iframePlaceholder),this.iframe=document.createElement("iframe"),this.iframe.className="w-full h-0 absolute z-[1]";let i=document.querySelector("[data-el-notebook]"),e=i.querySelector("[data-el-notebook-content]"),t=new ResizeObserver(a=>{this.repositionIframe()});t.observe(e),t.observe(i);let n=ki.subscribe("js_views",a=>{a.type==="reposition"&&this.repositionIframe()});this.iframe.addEventListener("mouseenter",a=>{this.iframePlaceholder.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0}))}),this.iframe.addEventListener("mouseleave",a=>{this.iframePlaceholder.dispatchEvent(new MouseEvent("mouseleave",{bubbles:!0}))});let r=null;return{visibilityPromise:new Promise((a,l)=>{Q9(this.iframePlaceholder)?a():(r=new IntersectionObserver(c=>{Q9(this.iframePlaceholder)&&(r.disconnect(),a())}),r.observe(this.iframePlaceholder))}),remove:()=>{t.disconnect(),n(),r&&r.disconnect(),this.iframe.remove(),this.iframePlaceholder.remove()}}},repositionIframe(){let{iframe:i,iframePlaceholder:e}=this,t=document.querySelector("[data-el-notebook]");if(Jh(e))i.classList.add("hidden");else{i.classList.remove("hidden");let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=r.top-n.top+t.scrollTop;i.style.top=`${o}px`;let s=r.left-n.left+t.scrollLeft;i.style.left=`${s}px`,i.style.height=`${r.height}px`,i.style.width=`${r.width}px`}},loadIframe(){let i=document.querySelector("[data-el-js-view-iframes]");YU(this.iframe,this.props.iframePort,this.props.iframeUrl).then(()=>{i.appendChild(this.iframe)})},handleChildMessage(i,e){if(i.type==="ready"&&!this.childReady){let t=window.location.origin+this.props.assetsBasePath;this.postMessage({type:"readyReply",token:this.childToken,baseUrl:t,jsPath:this.props.jsPath}),this.childReady=!0,e()}else{if(i.token!==this.childToken)throw new Error("Token mismatch");if(i.type==="resize")this.iframePlaceholder.style.height=`${i.height}px`,this.iframe.style.height=`${i.height}px`;else if(i.type==="domEvent"){let t=this.replicateDomEvent(i.event);i.isTargetEditable?this.hiddenInput.dispatchEvent(t):this.el.dispatchEvent(t)}else if(i.type==="event"){let{event:t,payload:n}=i,r=GU([t,this.props.ref],n);this.channel.push("event",r)}else i.type==="syncReply"?(this.pongCallbackQueue.push(this.syncCallbackQueue.shift()),this.channel.push("ping",{ref:this.props.ref})):i.type=="selectSecret"&&this.pushEvent("select_secret",{js_view_ref:this.props.ref,preselect_name:i.preselectName,options:i.options})}},postMessage(i){this.iframe.contentWindow.postMessage(i,"*")},replicateDomEvent(i){if(i.type==="focus")return new FocusEvent("focus");if(i.type==="mousedown")return new MouseEvent("mousedown",{bubbles:!0});if(i.type==="keydown")return new KeyboardEvent(i.type,i.props)},handleInitTimeout(){this.initTimeoutContainer=document.createElement("div"),this.initTimeoutContainer.classList.add("info-box"),this.el.prepend(this.initTimeoutContainer),this.initTimeoutContainer.textContent=this.props.timeoutMessage},clearInitTimeout(){clearTimeout(this.initTimeout),this.initTimeoutContainer&&this.initTimeoutContainer.remove()},handleServerInit(i){this.clearInitTimeout(),this.initReceived=!0,this.childReadyPromise.then(()=>{this.postMessage({type:"init",data:i})})},handleServerEvent(i,e){this.initReceived&&this.childReadyPromise.then(()=>{this.postMessage({type:"event",event:i,payload:e})})},handleServerError(i,e){e&&this.clearInitTimeout(),this.errorContainer||(this.errorContainer=document.createElement("div"),this.errorContainer.classList.add("error-box","mb-4"),this.el.prepend(this.errorContainer)),this.errorContainer.textContent=i},handleServerPong(){this.pongCallbackQueue.shift()()},handleJSViewEvent(i){i.type==="sync"?(this.syncCallbackQueue.push(i.callback),this.postMessage({type:"sync"})):i.type=="secretSelected"&&this.postMessage({type:"secretSelected",secretName:i.secretName})},handleNavigationEvent(i){if(i.type==="element_focused"){let e=this.el.closest("[data-focusable-id]"),t=e?e.dataset.focusableId:null;this.iframe.toggleAttribute("data-js-focused",t===i.focusableId)}}},XU=hse;var use={mounted(){this.props=this.getProps(),this._handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this._handleDocumentKeyUp=this.handleDocumentKeyUp.bind(this),this._handleDocumentFocus=this.handleDocumentFocus.bind(this),window.addEventListener("keydown",this._handleDocumentKeyDown,!0),window.addEventListener("keyup",this._handleDocumentKeyUp,!0),window.addEventListener("focus",this._handleDocumentFocus,!0)},updated(){this.props=this.getProps()},destroyed(){window.removeEventListener("keydown",this._handleDocumentKeyDown,!0),window.removeEventListener("keyup",this._handleDocumentKeyUp,!0),window.removeEventListener("focus",this._handleDocumentFocus,!0)},getProps(){return{isKeydownEnabled:Ge(this.el,"data-keydown-enabled",Qh),isKeyupEnabled:Ge(this.el,"data-keyup-enabled",Qh),target:Ge(this.el,"data-target")}},handleDocumentKeyDown(i){if(this.keyboardEnabled()&&va(i),this.props.isKeydownEnabled){if(i.repeat)return;let{key:e}=i;this.pushEventTo(this.props.target,"keydown",{key:e})}},handleDocumentKeyUp(i){if(this.keyboardEnabled()&&va(i),this.props.isKeyupEnabled){let{key:e}=i;this.pushEventTo(this.props.target,"keyup",{key:e})}},handleDocumentFocus(i){this.props.isKeydownEnabled&&Gc(i.target)&&this.pushEventTo(this.props.target,"disable_keyboard",{})},keyboardEnabled(){return this.props.isKeydownEnabled||this.props.isKeyupEnabled}},QU=use;var mse={mounted(){this.props=this.getProps();let i=new e2(this.el,"",{baseUrl:this.props.sessionPath,allowedUriSchemes:this.props.allowedUriSchemes.split(",")});this.handleEvent(`markdown_renderer:${this.props.id}:content`,({content:e})=>{i.setContent(e)})},getProps(){return{id:Ge(this.el,"data-id"),sessionPath:Ge(this.el,"data-session-path"),allowedUriSchemes:Ge(this.el,"data-allowed-uri-schemes")}}},JU=mse;var pse={mounted(){this.scroll()},updated(){this.scroll()},scroll(){L0(this.el)}},ZU=pse;var jE=class{constructor(e=2e3){this.resetTimeout=e,this.buffer=[],this.resetTimeoutId=null}push(e){this.buffer.push(e),this.resetTimeoutId&&clearTimeout(this.resetTimeoutId),this.resetTimeoutId=setTimeout(()=>{this.reset()},this.resetTimeout)}reset(){this.resetTimeoutId&&clearTimeout(this.resetTimeoutId),this.resetTimeoutId=null,this.buffer=[]}tryMatch(e){if(e.length>this.buffer.length)return!1;let t=this.buffer.slice(-e.length),n=e.every((r,o)=>r===t[o]);return n&&this.reset(),n}},eW=jE;var fse={mounted(){this.props=this.getProps(),this.focusedId=null,this.insertMode=!1,this.view=null,this.keyBuffer=new eW,this.clientsMap={},this.lastLocationReportByClientId={},this.followedClientId=null,p_(this.faviconForEvaluationStatus(this.props.globalStatus)),this.updateSectionListHighlight(),this._handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this._handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this._handleDocumentFocus=this.handleDocumentFocus.bind(this),this._handleDocumentClick=this.handleDocumentClick.bind(this),document.addEventListener("keydown",this._handleDocumentKeyDown,!0),document.addEventListener("mousedown",this._handleDocumentMouseDown),document.addEventListener("focus",this._handleDocumentFocus,!0),document.addEventListener("click",this._handleDocumentClick),this.getElement("sections-list").addEventListener("click",i=>{this.handleSectionsListClick(i),this.handleCellIndicatorsClick(i)}),this.getElement("clients-list").addEventListener("click",i=>this.handleClientsListClick(i)),this.getElement("sections-list-toggle").addEventListener("click",i=>this.toggleSectionsList()),this.getElement("clients-list-toggle").addEventListener("click",i=>this.toggleClientsList()),this.getElement("secrets-list-toggle").addEventListener("click",i=>this.toggleSecretsList()),this.getElement("runtime-info-toggle").addEventListener("click",i=>this.toggleRuntimeInfo()),this.getElement("app-info-toggle").addEventListener("click",i=>this.toggleAppInfo()),this.getElement("notebook").addEventListener("scroll",i=>this.updateSectionListHighlight()),this.getElement("notebook-indicators").addEventListener("click",i=>this.handleCellIndicatorsClick(i)),this.getElement("views").addEventListener("click",i=>{this.handleViewsClick(i)}),this.getElement("section-toggle-collapse-all-button").addEventListener("click",i=>this.toggleCollapseAllSections()),window.addEventListener("phx:page-loading-stop",()=>{this.initializeFocus()},{once:!0}),this.handleEvent("session_init",({clients:i})=>{i.forEach(e=>{this.clientsMap[e.id]=e})}),this.handleEvent("cell_inserted",({cell_id:i})=>{this.handleCellInserted(i)}),this.handleEvent("cell_deleted",({cell_id:i,sibling_cell_id:e})=>{this.handleCellDeleted(i,e)}),this.handleEvent("cell_restored",({cell_id:i})=>{this.handleCellRestored(i)}),this.handleEvent("cell_moved",({cell_id:i})=>{this.handleCellMoved(i)}),this.handleEvent("section_inserted",({section_id:i})=>{this.handleSectionInserted(i)}),this.handleEvent("section_deleted",({section_id:i})=>{this.handleSectionDeleted(i)}),this.handleEvent("section_moved",({section_id:i})=>{this.handleSectionMoved(i)}),this.handleEvent("cell_upload",({cell_id:i,url:e})=>{this.handleCellUpload(i,e)}),this.handleEvent("client_joined",({client:i})=>{this.handleClientJoined(i)}),this.handleEvent("client_left",({client_id:i})=>{this.handleClientLeft(i)}),this.handleEvent("clients_updated",({clients:i})=>{this.handleClientsUpdated(i)}),this.handleEvent("secret_selected",({select_secret_ref:i,secret_name:e})=>{this.handleSecretSelected(i,e)}),this.handleEvent("location_report",({client_id:i,focusable_id:e,selection:t})=>{let n={focusableId:e,selection:this.decodeSelection(t)};this.handleLocationReport(i,n)}),this.unsubscribeFromSessionEvents=ki.subscribe("session",i=>{this.handleSessionEvent(i)})},updated(){let i=this.props;this.props=this.getProps(),this.props.globalStatus!==i.globalStatus&&p_(this.faviconForEvaluationStatus(this.props.globalStatus))},disconnected(){this.el.removeAttribute("id"),this.keepChannel=!0},destroyed(){this.unsubscribeFromSessionEvents(),document.removeEventListener("keydown",this._handleDocumentKeyDown,!0),document.removeEventListener("mousedown",this._handleDocumentMouseDown),document.removeEventListener("focus",this._handleDocumentFocus,!0),document.removeEventListener("click",this._handleDocumentClick),p_("favicon"),this.keepChannel||qU()},getProps(){return{autofocusCellId:Vn(this.el,"data-autofocus-cell-id",null),globalStatus:Vn(this.el,"data-global-status",null)}},faviconForEvaluationStatus(i){return i==="evaluating"?"favicon-evaluating":i==="stale"?"favicon-stale":i==="errored"?"favicon-errored":"favicon"},handleDocumentKeyDown(i){if(i.repeat)return;let e=YA()?i.metaKey:i.ctrlKey,t=i.altKey,n=i.shiftKey,r=i.key,o=this.keyBuffer;if(!(Gc(i.target)&&i.target.closest("[data-el-outputs-container]"))){if(e&&n&&!t&&r==="Enter"){va(i),this.queueFullCellsEvaluation(!0);return}else if(!e&&n&&!t&&r==="Enter"){va(i),uh(this.focusedCellType())&&this.queueFocusedCellEvaluation(),this.moveFocus(1);return}else if(e&&!t&&r==="Enter"){va(i),uh(this.focusedCellType())&&this.queueFocusedCellEvaluation();return}else if(e&&r==="s"){va(i),this.saveNotebook();return}else if(e||t)return}this.insertMode?(o.reset(),r==="Escape"&&(this.escapesMonacoWidget(i)||this.escapeInsertMode())):Gc(i.target)?(o.reset(),r==="Escape"&&i.target.blur()):(o.push(i.key),o.tryMatch(["d","d"])?this.deleteFocusedCell():o.tryMatch(["e","a"])?this.queueFullCellsEvaluation(!1):o.tryMatch(["e","e"])?uh(this.focusedCellType())&&this.queueFocusedCellEvaluation():o.tryMatch(["e","s"])?this.queueFocusedSectionEvaluation():o.tryMatch(["s","s"])?this.toggleSectionsList():o.tryMatch(["s","e"])?this.toggleSecretsList():o.tryMatch(["s","a"])?this.toggleAppInfo():o.tryMatch(["s","u"])?this.toggleClientsList():o.tryMatch(["s","r"])?this.toggleRuntimeInfo():o.tryMatch(["s","b"])?this.showBin():o.tryMatch(["s","p"])?this.showPackageSearch():o.tryMatch(["e","x"])?this.cancelFocusedCellEvaluation():o.tryMatch(["0","0"])?this.reconnectRuntime():o.tryMatch(["Escape","Escape"])?this.setFocusedEl(null):o.tryMatch(["?"])?this.showShortcuts():o.tryMatch(["i"])||i.target.matches("body, [data-el-cell-body], [data-el-heading], [data-focusable-id]")&&this.focusedId&&r==="Enter"?(va(i),this.isInsertModeAvailable()&&this.enterInsertMode()):o.tryMatch(["j"])?this.moveFocus(1):o.tryMatch(["k"])?this.moveFocus(-1):o.tryMatch(["J"])?this.moveFocusedCell(1):o.tryMatch(["K"])?this.moveFocusedCell(-1):o.tryMatch(["n"])?this.insertCellBelowFocused("code"):o.tryMatch(["N"])?this.insertCellAboveFocused("code"):o.tryMatch(["m"])?!this.isViewCodeZen()&&this.insertCellBelowFocused("markdown"):o.tryMatch(["M"])?!this.isViewCodeZen()&&this.insertCellAboveFocused("markdown"):o.tryMatch(["v","z"])?this.toggleView("code-zen"):o.tryMatch(["v","p"])?this.toggleView("presentation"):o.tryMatch(["c"])?!this.isViewCodeZen()&&this.toggleCollapseSection():o.tryMatch(["C"])&&!this.isViewCodeZen()&&this.toggleCollapseAllSections())},escapesMonacoWidget(i){if(i.target.closest(".monaco-inputbox"))return!0;let e=i.target.closest(".monaco-editor.focused");return e?!!(e.querySelector(".editor-widget.parameter-hints-widget.visible")||e.querySelector(".editor-widget.suggest-widget.visible")||e.querySelectorAll(".cursor").length>1):!1},handleDocumentMouseDown(i){if(!i.target.closest("[data-el-notebook]")||i.target.closest(".doctest-details-widget")){this.insertMode&&this.setInsertMode(!1);return}if(i.target.closest("[data-el-insert-buttons] button"))return;let e=i.target.closest("[data-focusable-id]"),t=e?e.dataset.focusableId:null,n=this.editableElementClicked(i,e);t!==this.focusedId&&this.setFocusedEl(t,{scroll:!1,focusElement:!1}),!i.target.closest("[data-el-actions]")&&this.insertMode!==n&&this.setInsertMode(n)},editableElementClicked(i,e){if(e){let t=i.target.closest("[data-el-editor-container], [data-el-heading]");return t&&e.contains(t)}return!1},handleDocumentFocus(i){let e=i.target.closest&&i.target.closest("[data-focusable-id]");if(e){let t=e.dataset.focusableId;t!==this.focusedId&&this.setFocusedEl(t,{scroll:!1,focusElement:!1})}},handleDocumentClick(i){i.target.closest("[data-el-enable-insert-mode-button]")&&this.setInsertMode(!0),i.target.closest("[data-btn-package-search]")&&this.insertMode&&this.setInsertMode(!1);let e=i.target.closest("[data-el-queue-cell-evaluation-button]");if(e){let n=e.getAttribute("data-cell-id"),r=e.hasAttribute("data-disable-dependencies-cache");this.queueCellEvaluation(n,r)}let t=window.location.hash;if(t){let n=t.replace(/^#/,"");!document.getElementById(n).contains(i.target)&&!i.target.closest("a")&&history.pushState(null,document.title,window.location.pathname+window.location.search)}},handleSectionsListClick(i){let e=i.target.closest("[data-el-sections-list-item]");if(e){let t=e.getAttribute("data-section-id");this.getSectionById(t).scrollIntoView({behavior:"smooth",block:"start"})}},handleClientsListClick(i){let e=i.target.closest("[data-el-clients-list-item]");if(e){let t=e.getAttribute("data-client-id");i.target.closest("[data-el-client-link]")&&this.handleClientLinkClick(t),i.target.closest("[data-el-client-follow-toggle]")&&this.handleClientFollowToggleClick(t,e)}},handleClientLinkClick(i){this.mirrorClientFocus(i)},handleClientFollowToggleClick(i,e){let t=this.el.querySelector("[data-el-clients-list-item][data-js-followed]");t&&t.removeAttribute("data-js-followed"),i===this.followedClientId?this.followedClientId=null:(e.setAttribute("data-js-followed",""),this.followedClientId=i,this.mirrorClientFocus(i))},mirrorClientFocus(i){let e=this.lastLocationReportByClientId[i];e&&e.focusableId&&this.setFocusedEl(e.focusableId)},handleCellIndicatorsClick(i){let e=i.target.closest("[data-el-focus-cell-button]");if(e){let t=e.getAttribute("data-target");this.setFocusedEl(t)}},initializeFocus(){let i=window.location.hash;if(i){let e=i.replace(/^#/,""),t=document.getElementById(e);if(t){let n=t.closest("[data-focusable-id]");n?this.setFocusedEl(n.dataset.focusableId):t.scrollIntoView()}}else this.props.autofocusCellId&&(this.setFocusedEl(this.props.autofocusCellId,{scroll:!1}),this.setInsertMode(!0))},updateSectionListHighlight(){let i=this.el.querySelector("[data-el-sections-list-item][data-js-is-viewed]");i&&i.removeAttribute("data-js-is-viewed");let e=this.getSections().reverse().find(t=>{let{top:n}=t.getBoundingClientRect(),r=document.documentElement.scrollTop;return n<=r+window.innerHeight*.35});if(e){let t=e.getAttribute("data-section-id");this.el.querySelector(`[data-el-sections-list-item][data-section-id="${t}"]`).setAttribute("data-js-is-viewed","")}},toggleSectionsList(){this.toggleSidePanelContent("sections-list")},toggleClientsList(){this.toggleSidePanelContent("clients-list")},toggleSecretsList(){this.toggleSidePanelContent("secrets-list")},toggleAppInfo(){this.toggleSidePanelContent("app-info")},toggleRuntimeInfo(){this.toggleSidePanelContent("runtime-info")},toggleSidePanelContent(i){this.el.getAttribute("data-js-side-panel-content")===i?this.el.removeAttribute("data-js-side-panel-content"):this.el.setAttribute("data-js-side-panel-content",i)},showBin(){let i=this.el.querySelector("[data-btn-show-bin]");i&&i.click()},showPackageSearch(){this.setFocusedEl("setup");let i=this.el.querySelector("[data-btn-package-search]");i&&i.click()},saveNotebook(){this.pushEvent("save",{})},deleteFocusedCell(){this.focusedId&&this.isCell(this.focusedId)&&this.pushEvent("delete_cell",{cell_id:this.focusedId})},queueCellEvaluation(i,e){this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_cell_evaluation",{cell_id:i,disable_dependencies_cache:e})})},queueFocusedCellEvaluation(){this.focusedId&&this.isCell(this.focusedId)&&this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_cell_evaluation",{cell_id:this.focusedId})})},queueFullCellsEvaluation(i){let e=i&&this.focusedId&&this.isCell(this.focusedId)?[this.focusedId]:[];this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_full_evaluation",{forced_cell_ids:e})})},queueFocusedSectionEvaluation(){if(this.focusedId){let i=this.getSectionIdByFocusableId(this.focusedId);i&&this.dispatchQueueEvaluation(()=>{this.pushEvent("queue_section_evaluation",{section_id:i})})}},dispatchQueueEvaluation(i){uh(this.focusedCellType())?ki.broadcast(`cells:${this.focusedId}`,{type:"dispatch_queue_evaluation",dispatch:i}):i()},cancelFocusedCellEvaluation(){this.focusedId&&this.isCell(this.focusedId)&&this.pushEvent("cancel_cell_evaluation",{cell_id:this.focusedId})},reconnectRuntime(){this.pushEvent("reconnect_runtime",{})},showShortcuts(){let i=this.el.querySelector("[data-btn-show-shortcuts]");i&&i.click()},isInsertModeAvailable(){if(!this.focusedId)return!1;let i=this.getFocusableEl(this.focusedId);return!this.isCell(this.focusedId)||!i.hasAttribute("data-js-insert-mode-disabled")},enterInsertMode(){this.focusedId&&this.setInsertMode(!0)},escapeInsertMode(){this.setInsertMode(!1)},moveFocus(i){let e=this.nearbyFocusableId(this.focusedId,i);this.setFocusedEl(e)},moveFocusedCell(i){this.focusedId&&this.isCell(this.focusedId)&&this.pushEvent("move_cell",{cell_id:this.focusedId,offset:i})},insertCellBelowFocused(i){if(this.focusedId)this.insertCellBelowFocusableId(this.focusedId,i);else{let e=this.getFocusableIds();e.length>0&&this.insertCellBelowFocusableId(e[e.length-1],i)}},insertCellAboveFocused(i){if(this.focusedId){let e=this.nearbyFocusableId(this.focusedId,-1);this.insertCellBelowFocusableId(e,i)}else{let e=this.getFocusableIds();e.length>0&&this.insertCellBelowFocusableId(e[0],i)}},insertCellBelowFocusableId(i,e){if(this.isCell(i))this.pushEvent("insert_cell_below",{type:e,cell_id:i});else if(this.isSection(i))this.pushEvent("insert_cell_below",{type:e,section_id:i});else if(this.isNotebook(i)){let t=this.getSectionIds();t.length>0&&this.pushEvent("insert_cell_below",{type:e,section_id:t[0]})}},setFocusedEl(i,{scroll:e=!0,focusElement:t=!0}={}){if(this.focusedId=i,i){if(!this.isSection(i)){let r=this.getSectionIdByFocusableId(i);r&&this.getSectionById(r).removeAttribute("data-js-collapsed")}let n=this.getFocusableEl(i);t&&(n.querySelector("[data-el-cell-body]")||n.querySelector("[data-el-heading]")||n).focus({preventScroll:!0})}ki.broadcast("navigation",{type:"element_focused",focusableId:i,scroll:e}),this.setInsertMode(!1)},setInsertMode(i){this.insertMode=i,i?this.el.setAttribute("data-js-insert-mode",""):(this.el.removeAttribute("data-js-insert-mode"),this.sendLocationReport({focusableId:this.focusedId,selection:null})),ki.broadcast("navigation",{type:"insert_mode_changed",enabled:i})},handleViewsClick(i){let e=i.target.closest("[data-el-view-toggle]");if(e){let t=e.getAttribute("data-el-view-toggle");this.toggleView(t)}},toggleView(i){this.view===i?(this.view=null,this.el.removeAttribute("data-js-view")):(this.view=i,this.el.setAttribute("data-js-view",i));let e=this.focusedId||this.nearbyFocusableId(null,0);if(e){let t=this.ensureVisibleFocusableEl(e);t!==this.focused&&this.setFocusedEl(t,{scroll:!1}),t&&this.getFocusableEl(t).scrollIntoView({block:"center"})}},toggleCollapseSection(){if(this.focusedId){let i=this.getSectionIdByFocusableId(this.focusedId);if(i){let e=this.getSectionById(i);e.hasAttribute("data-js-collapsed")?e.removeAttribute("data-js-collapsed"):(e.setAttribute("data-js-collapsed",""),this.setFocusedEl(i,{scroll:!0}))}}},toggleCollapseAllSections(){let i=this.getSections().every(e=>e.hasAttribute("data-js-collapsed"));if(this.getSections().forEach(e=>{e.toggleAttribute("data-js-collapsed",!i)}),this.focusedId){let e=this.getSectionIdByFocusableId(this.focusedId);e&&this.setFocusedEl(e,{scroll:!0})}},handleCellInserted(i){this.setFocusedEl(i),Vz(this.focusedCellType())&&this.setInsertMode(!0)},handleCellDeleted(i,e){if(this.focusedId===i)if(this.isViewCodeZen()){let t=this.ensureVisibleFocusableEl(e);this.setFocusedEl(t)}else this.setFocusedEl(e)},handleCellRestored(i){this.setFocusedEl(i)},handleCellMoved(i){this.repositionJSViews(),this.focusedId===i&&ki.broadcast("cells",{type:"cell_moved",cellId:i})},handleSectionInserted(i){let t=this.getSectionById(i).querySelector("[data-el-section-headline]"),{focusableId:n}=t.dataset;this.setFocusedEl(n),this.setInsertMode(!0),JA(document.activeElement)},handleSectionDeleted(i){this.focusedId&&!this.getFocusableEl(this.focusedId)&&this.setFocusedEl(null)},handleSectionMoved(i){this.repositionJSViews();let e=this.getSectionById(i);Pl(e)},handleCellUpload(i,e){this.focusedId!==i&&this.setFocusedEl(i),this.insertMode||this.setInsertMode(!0),ki.broadcast("cells",{type:"cell_upload",cellId:i,url:e})},handleClientJoined(i){this.clientsMap[i.id]=i},handleClientLeft(i){let e=this.clientsMap[i];e&&(delete this.clientsMap[i],this.broadcastLocationReport(e,{focusableId:null,selection:null}),e.id===this.followedClientId&&(this.followedClientId=null))},handleClientsUpdated(i){i.forEach(e=>{this.clientsMap[e.id]=e})},handleSecretSelected(i,e){ki.broadcast(`js_views:${i}`,{type:"secretSelected",secretName:e})},handleLocationReport(i,e){let t=this.clientsMap[i];this.lastLocationReportByClientId[i]=e,t&&(this.broadcastLocationReport(t,e),t.id===this.followedClientId&&e.focusableId!==this.focusedId&&this.setFocusedEl(e.focusableId))},handleSessionEvent(i){i.type==="cursor_selection_changed"&&this.sendLocationReport({focusableId:i.focusableId,selection:i.selection})},repositionJSViews(){ki.broadcast("js_views",{type:"reposition"})},broadcastLocationReport(i,e){ki.broadcast("navigation",{type:"location_report",client:i,report:e})},sendLocationReport(i){Object.keys(this.clientsMap).length>1&&this.pushEvent("location_report",{focusable_id:i.focusableId,selection:this.encodeSelection(i.selection)})},encodeSelection(i){if(i===null)return null;let{tag:e,editorSelection:t}=i;return[e,t.selectionStartLineNumber,t.selectionStartColumn,t.positionLineNumber,t.positionColumn]},decodeSelection(i){if(i===null)return null;let[e,t,n,r,o]=i,s=new vt.Selection(t,n,r,o);return{tag:e,editorSelection:s}},focusedCellType(){return this.focusedId&&this.isCell(this.focusedId)?this.getFocusableEl(this.focusedId).getAttribute("data-type"):null},nearbyFocusableId(i,e){let t=this.getFocusableIds();if(t.length===0)return null;let n=t.indexOf(i);if(n===-1){let r=this.getFocusableEls().find(X9);return r?r.getAttribute("data-focusable-id"):t[0]}else{let r=XA(n+e,0,t.length-1);return t[r]}},ensureVisibleFocusableEl(i){let e=this.getFocusableEl(i),t=Array.from(this.el.querySelectorAll("[data-focusable-id]")),n=t.indexOf(e),r=[...t.slice(n,-1),...t.slice(0,n).reverse()].find(o=>!Jh(o));return r&&r.getAttribute("data-focusable-id")},isCell(i){return this.getFocusableEl(i).hasAttribute("data-el-cell")},isSection(i){return this.getFocusableEl(i).hasAttribute("data-el-section-headline")},isNotebook(i){return this.getFocusableEl(i).hasAttribute("data-el-notebook-headline")},getFocusableEl(i){return this.el.querySelector(`[data-focusable-id="${i}"]`)},getFocusableEls(){return Array.from(this.el.querySelectorAll("[data-focusable-id]")).filter(i=>!Jh(i))},getFocusableIds(){return this.getFocusableEls().map(i=>i.getAttribute("data-focusable-id"))},getSectionIdByFocusableId(i){let t=this.getFocusableEl(i).closest("[data-el-section]");return t&&t.getAttribute("data-section-id")},getSectionIds(){return this.getSections().map(e=>e.getAttribute("data-section-id"))},getSections(){return Array.from(this.el.querySelectorAll("[data-el-section]"))},getSectionById(i){return this.el.querySelector(`[data-el-section][data-section-id="${i}"]`)},getElement(i){return this.el.querySelector(`[data-el-${i}]`)},isViewCodeZen(){return this.view==="code-zen"},isViewPresentation(){return this.view==="presentation"}},tW=fse;var gse={mounted(){this.autosize(),this.el.addEventListener("input",i=>{this.autosize()})},updated(){this.autosize()},autosize(){this.el.style.height="0px",this.el.style.height=`${this.el.scrollHeight+2}px`}},iW=gse;var _se=100,vse={mounted(){this.props=this.getProps(),this.interval=setInterval(()=>this.updateDOM(),_se)},updated(){this.props=this.getProps(),this.updateDOM()},destroyed(){clearInterval(this.interval)},getProps(){return{start:Ge(this.el,"data-start")}},updateDOM(){let e=(Date.now()-new Date(this.props.start))/1e3;this.el.innerHTML=`${e.toFixed(1)}s`}},nW=vse;var rW="lb:user_data";function oW(i){let e=JSON.stringify(i),t=eL(e);yse(rW,t,15768e4)}function sW(){let i=bse(rW);if(i){let e=tL(i);return JSON.parse(e)}else return null}function bse(i){let e=document.cookie.split("; ").find(t=>t.startsWith(`${i}=`));return e?e.replace(`${i}=`,""):null}function yse(i,e,t){let n=`${i}=${e};max-age=${t};path=/${g_()}`;document.cookie=n}var Sse={mounted(){this.el.addEventListener("submit",i=>{let e=this.el.user_form_name.value,t=this.el.user_form_hex_color.value;oW({name:e,hex_color:t})})}},aW=Sse;var dW=qi(cW());var Cse={mounted(){this.props=this.getProps(),this.lineHeight=QA(this.el),this.templateEl=Zh(this.el,"[data-template]"),this.contentEl=Zh(this.el,"[data-content]"),this.capLines();let i=this.hyperListConfig();this.virtualizedList=new dW.default(this.contentEl,i),this.props.follow&&L0(this.contentEl)},updated(){this.props=this.getProps(),this.capLines();let i=this.props.follow&&ZA(this.contentEl),e=this.hyperListConfig();this.virtualizedList.refresh(this.contentEl,e),i&&L0(this.contentEl)},getProps(){return{maxHeight:Ge(this.el,"data-max-height",lo),follow:Vn(this.el,"data-follow",!1,Qh),maxLines:Vn(this.el,"data-max-lines",null,lo),ignoreTrailingEmptyLine:Vn(this.el,"data-ignore-trailing-empty-line",!1,Qh)}},hyperListConfig(){let i=this.getLineElements(),e=i.length,t=Math.min(this.props.maxHeight,this.lineHeight*e);return{height:t,total:e,itemHeight:this.lineHeight,generate:n=>{let r=i[n].cloneNode(!0);return r.removeAttribute("id"),r},afterRender:()=>{this.contentEl.scrollWidth>this.contentEl.clientWidth?this.contentEl.style.height=`${t+12}px`:this.contentEl.style.height=`${t}px`}}},getLineElements(){let i=Array.from(this.templateEl.querySelectorAll("[data-line]"));if(i.length===0)return[];let e=i[i.length-1];return this.props.ignoreTrailingEmptyLine&&e.innerText===""?i.slice(0,-1):i},capLines(){if(this.props.maxLines){let e=Array.from(this.templateEl.querySelectorAll("[data-line]")).slice(0,-this.props.maxLines),[t,...n]=e;n.forEach(r=>r.remove()),t&&(t.innerHTML="...")}}},hW=Cse;var uW={AppAuth:HA,AudioInput:aL,Cell:Kz,CellEditor:Xz,Dropzone:Qz,EditorSettings:Jz,EmojiPicker:HU,FocusOnUpdate:BU,Headline:UU,Highlight:WU,ImageInput:jU,ImageOutput:VU,JSView:XU,KeyboardControl:QU,MarkdownRenderer:JU,ScrollOnUpdate:ZU,Session:tW,TextareaAutosize:iW,Timer:nW,UserForm:aW,VirtualizedLines:hW};var mW={onBeforeElUpdated(i,e){for(let t of i.attributes)t.name.startsWith("data-js-")&&e.setAttribute(t.name,t.value),t.name==="data-keep-attribute"&&(i.hasAttribute(t.value)?e.setAttribute(t.value,i.getAttribute(t.value)):e.removeAttribute(t.value))},onNodeAdded(i){if(i.nodeType===Node.ELEMENT_NODE&&i.hasAttribute("autofocus")&&(i.focus(),i.setSelectionRange&&i.value)){let e=i.value.length;i.setSelectionRange(e,e)}}};var L2=qi(fW());function gW(){L2.default.config({barColors:{0:"#b2c1ff"},shadowColor:"rgba(0, 0, 0, .3)"});let i=null;window.addEventListener("phx:page-loading-start",()=>{i||(i=setTimeout(()=>L2.default.show(),500))}),window.addEventListener("phx:page-loading-stop",()=>{clearTimeout(i),i=null,L2.default.hide()})}function _W(){window.addEventListener("lb:focus",i=>{requestAnimationFrame(()=>{i.target.focus()})}),window.addEventListener("lb:set_value",i=>{i.target.value=i.detail.value}),window.addEventListener("lb:check",i=>{i.target.checked=!0}),window.addEventListener("lb:uncheck",i=>{i.target.checked=!1}),window.addEventListener("lb:set_text",i=>{i.target.textContent=i.detail.value}),window.addEventListener("lb:clipcopy",i=>{"clipboard"in navigator?i.target.tagName==="INPUT"?navigator.clipboard.writeText(i.target.value):navigator.clipboard.writeText(i.target.textContent):alert(`Sorry, your browser does not support clipboard copy. This generally requires a secure origin \u2014 either HTTPS or localhost.`)}),window.addEventListener("lb:session_list:on_selection_change",()=>{let i=!!document.querySelector("[name='session_ids[]']:checked"),e=document.querySelector("#edit-sessions [name='disconnect']"),t=document.querySelector("#edit-sessions [name='close_all']");e.disabled=!i,t.disabled=!i}),window.addEventListener("contextmenu",i=>{let e=i.target.closest("[data-contextmenu-trigger-click]");e&&(i.preventDefault(),e.dispatchEvent(new Event("mousedown",{bubbles:!0})),e.dispatchEvent(new Event("click",{bubbles:!0})))}),window.addEventListener("submit",i=>{i.target.hasAttribute("phx-nosubmit")&&(i.preventDefault(),i.stopPropagation())},{capture:!0})}var KE="confirm-opted-out-ids";function vW(){return qc(KE)||[]}function bW(){window.addEventListener("phx:add_confirm_opt_out_id",i=>{let e=qc(KE)||[],t=i.detail.opt_out_id;e.push(t),Xh(KE,e)})}function wse(){let i=document.querySelector("meta[name='csrf-token']").getAttribute("content"),e=new DA(window.LIVEBOOK_BASE_URL_PATH+"/live",Kg,{params:t=>({_csrf_token:i,user_data:sW(),app_auth_token:FA(),confirm_opt_out_ids:vW()}),hooks:uW,dom:mW});gW(),_W(),bW(),nr.getAndSubscribe(t=>{document.body.setAttribute("data-editor-theme",t.editor_theme)}),e.connect(),window.liveSocket=e}if(xse())wse();else{let i=document.createElement("div");i.innerHTML=`