diff --git a/static/assets/app.js b/static/assets/app.js index b7b85d2bf..7a46d3a6b 100644 --- a/static/assets/app.js +++ b/static/assets/app.js @@ -657,7 +657,7 @@ ${r.message}`)))}function jve(){return import("./mermaid.core-MG3J7S3E.js" `}var Rye=new Fn(i=>i.isLoaded?Dye(i):Nye(i)),mS=Ir("picker","skeleton","placeholder","searchSkeleton","searchInput","categoryTabsSkeleton","headerSkeleton","categoryTab","contentSkeleton","categoryName","emojiGrid","emoji","previewSkeleton","previewEmoji","previewName","tagList","tag","overlay","content","fullHeight","pluginContainer","header"),gS={emojisPerRow:"--emojis-per-row",visibleRows:"--row-count",emojiSize:"--emoji-size"},VD=class extends Ot{constructor(){super({template:Rye,classes:mS}),this.pickerReady=!1,this.externalEvents=new LD,this.updaters={styleProperty:e=>t=>this.el.style.setProperty(gS[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:Ot.byClass(mS.content),header:Ot.byClass(mS.header)},this.uiEvents=[Ot.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(BD)),this.options.showSearch&&(this.search=this.viewFactory.create(zD,{categories:this.categories,emojiVersion:this.emojiVersion})),this.options.showCategoryTabs&&(this.categoryTabs=this.viewFactory.create(jD,{categories:this.categories})),this.currentView=this.emojiArea=this.viewFactory.create(FD,{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(gS).forEach(e=>{this.options[e]&&this.el.style.setProperty(gS[e],this.options[e].toString())})}updateStyleProperty(e,t){this.el.style.setProperty(gS[e],t.toString())}reinitialize(){this.renderSync()}onError(e){let t=this.viewFactory.createWithOptions({data:!1},HD,{message:this.i18n.get("error.load")}),n=this.el.offsetHeight||375;throw this.el.style.height=`${n}px`,gm(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=Aye()||parseFloat(g5e):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 gm(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(mS.fullHeight,e!==this.emojiArea),gm(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(UD,{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)}},KD=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)}},xS,qD=class{constructor(e={}){Ec(this,xS,void 0),pD(this,xS,new Map(Object.entries(e)))}get(e,t=e){return Tc(this,xS).get(e)||t}};xS=new WeakMap;function Oye(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 QD(){let i=!1;return function(e){oye.injectStyles&&!i&&(Oye(e),i=!0)}}var Pye=`.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 Fye(i){return aie(i.locale,i.dataStore,i.messages,i.emojiData)}var Hye=0,vS;function Bye(){return`picmo-${Date.now()}-${Hye++}`}var zye=QD();function die(i){zye(Pye);let e=XD(i),t=((e==null?void 0:e.custom)||[]).map(s=>Pt(Re({},s),{custom:!0,tags:["custom",...s.tags||[]]})),n=new AD;vS||(vS=Fye(e));let r=new qD(e.i18n);vS.then(s=>{n.emit("data:ready",s)}).catch(s=>{n.emit("error",s)});let o=new KD({events:n,i18n:r,customEmojis:t,renderer:e.renderer,options:e,emojiData:vS,pickerId:Bye()}).create(VD);return o.renderSync(),o}function zh(i){return i.split("-")[0]}function vm(i){return i.split("-")[1]}function PS(i){return["top","bottom"].includes(zh(i))?"x":"y"}function yie(i){return i==="y"?"height":"width"}function uie(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=PS(e),l=yie(a),c=n[l]/2-r[l]/2,d=zh(e),u=a==="x",h;switch(d){case"top":h={x:o,y:n.y-r.height};break;case"bottom":h={x:o,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:s};break;case"left":h={x:n.x-r.width,y:s};break;default:h={x:n.x,y:n.y}}switch(vm(e)){case"start":h[a]-=c*(t&&u?-1:1);break;case"end":h[a]+=c*(t&&u?-1:1);break}return h}var Uye=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}=uie(l,n,a),u=n,h={},p=0;for(let m=0;mqye[e])}function Cie(i,e,t){t===void 0&&(t=!1);let n=vm(i),r=PS(i),o=yie(r),s=r==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=NS(s)),{main:s,cross:NS(s)}}var Gye={start:"end",end:"start"};function JD(i){return i.replace(/start|end/g,e=>Gye[e])}var $ye=["top","right","bottom","left"],Yye=$ye.reduce((i,e)=>i.concat(e,e+"-start",e+"-end"),[]);function Xye(i,e,t){return(i?[...t.filter(n=>vm(n)===i),...t.filter(n=>vm(n)!==i)]:t.filter(n=>zh(n)===n)).filter(n=>i?vm(n)===i||(e?JD(n)!==n:!1):!0)}var Qye=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:u,platform:h,elements:p}=e,rt=i,{alignment:m=null,allowedPlacements:g=Yye,autoAlignment:b=!0}=rt,S=aa(rt,["alignment","allowedPlacements","autoAlignment"]),k=Xye(m,b,g),N=await tN(e,S),A=(t=(n=d.autoPlacement)==null?void 0:n.index)!=null?t:0,H=k[A];if(H==null)return{};let{main:K,cross:W}=Cie(H,c,await(h.isRTL==null?void 0:h.isRTL(p.floating)));if(u!==H)return{x:a,y:l,reset:{placement:k[0]}};let re=[N[zh(H)],N[K],N[W]],ae=[...(r=(o=d.autoPlacement)==null?void 0:o.overflows)!=null?r:[],{placement:H,overflows:re}],Ne=k[A+1];if(Ne)return{data:{index:A+1,overflows:ae},reset:{placement:Ne}};let he=ae.slice().sort((Nt,Z)=>Nt.overflows[0]-Z.overflows[0]),Xe=(s=he.find(Nt=>{let{overflows:Z}=Nt;return Z.every(ye=>ye<=0)}))==null?void 0:s.placement,st=Xe!=null?Xe:he[0].placement;return st!==u?{data:{index:A+1,overflows:ae},reset:{placement:st}}:{}}}};function Jye(i){let e=NS(i);return[JD(i),e,JD(e)]}var Zye=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,re=i,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",flipAlignment:p=!0}=re,m=aa(re,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","flipAlignment"]),g=zh(n),b=u||(g===s||!p?[NS(s)]:Jye(s)),S=[s,...b],k=await tN(e,m),N=[],A=((t=r.flip)==null?void 0:t.overflows)||[];if(c&&N.push(k[g]),d){let{main:ae,cross:Ne}=Cie(n,o,await(a.isRTL==null?void 0:a.isRTL(l.floating)));N.push(k[ae],k[Ne])}if(A=[...A,{placement:n,overflows:N}],!N.every(ae=>ae<=0)){var H,K;let ae=((H=(K=r.flip)==null?void 0:K.index)!=null?H:0)+1,Ne=S[ae];if(Ne)return{data:{index:ae,overflows:A},reset:{placement:Ne}};let he="bottom";switch(h){case"bestFit":{var W;let Xe=(W=A.map(st=>[st,st.overflows.filter(rt=>rt>0).reduce((rt,Nt)=>rt+Nt,0)]).sort((st,rt)=>st[1]-rt[1])[0])==null?void 0:W[0].placement;Xe&&(he=Xe);break}case"initialPlacement":he=s;break}if(n!==he)return{reset:{placement:he}}}return{}}}};async function e2e(i,e){let{placement:t,platform:n,elements:r}=i,o=await(n.isRTL==null?void 0:n.isRTL(r.floating)),s=zh(t),a=vm(t),l=PS(t)==="x",c=["left","top"].includes(s)?-1:1,d=o&&l?-1:1,u=typeof e=="function"?e(i):e,{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:Re({mainAxis:0,crossAxis:0,alignmentAxis:null},u);return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*d,y:h*c}:{x:h*c,y:p*d}}var fie=function(i){return i===void 0&&(i=0),{name:"offset",options:i,async fn(e){let{x:t,y:n}=e,r=await e2e(e,i);return{x:t+r.x,y:n+r.y,data:r}}}};function t2e(i){return i==="x"?"y":"x"}var pie=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:S=>{let{x:k,y:N}=S;return{x:k,y:N}}}}=b,l=aa(b,["mainAxis","crossAxis","limiter"]),c={x:t,y:n},d=await tN(e,l),u=PS(zh(r)),h=t2e(u),p=c[u],m=c[h];if(o){let S=u==="y"?"top":"left",k=u==="y"?"bottom":"right",N=p+d[S],A=p-d[k];p=hie(N,p,A)}if(s){let S=h==="y"?"top":"left",k=h==="y"?"bottom":"right",N=m+d[S],A=m-d[k];m=hie(N,m,A)}let g=a.fn(Pt(Re({},e),{[u]:p,[h]:m}));return Pt(Re({},g),{data:{x:g.x-t,y:g.y-n}})}}};function Sie(i){return i&&i.document&&i.location&&i.alert&&i.setInterval}function Ac(i){if(i==null)return window;if(!Sie(i)){let e=i.ownerDocument;return e&&e.defaultView||window}return i}function ul(i){return Ac(i).getComputedStyle(i)}function kc(i){return Sie(i)?"":i?(i.nodeName||"").toLowerCase():""}function wie(){let i=navigator.userAgentData;return i!=null&&i.brands?i.brands.map(e=>e.brand+"/"+e.version).join(" "):navigator.userAgent}function hl(i){return i instanceof Ac(i).HTMLElement}function jd(i){return i instanceof Ac(i).Element}function i2e(i){return i instanceof Ac(i).Node}function _m(i){if(typeof ShadowRoot>"u")return!1;let e=Ac(i).ShadowRoot;return i instanceof e||i instanceof ShadowRoot}function FS(i){let{overflow:e,overflowX:t,overflowY:n}=ul(i);return/auto|scroll|overlay|hidden/.test(e+n+t)}function n2e(i){return["table","td","th"].includes(kc(i))}function xie(i){let e=/firefox/i.test(wie()),t=ul(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 Eie(){return!/^((?!chrome|android).)*safari/i.test(wie())}var mie=Math.min,t_=Math.max,RS=Math.round;function Ic(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&&hl(i)&&(l=i.offsetWidth>0&&RS(a.width)/i.offsetWidth||1,c=i.offsetHeight>0&&RS(a.height)/i.offsetHeight||1);let d=jd(i)?Ac(i):window,u=!Eie()&&t,h=(a.left+(u&&(n=(r=d.visualViewport)==null?void 0:r.offsetLeft)!=null?n:0))/l,p=(a.top+(u&&(o=(s=d.visualViewport)==null?void 0:s.offsetTop)!=null?o:0))/c,m=a.width/l,g=a.height/c;return{width:m,height:g,top:p,right:h+m,bottom:p+g,left:h,x:h,y:p}}function Vd(i){return((i2e(i)?i.ownerDocument:i.document)||window.document).documentElement}function HS(i){return jd(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.pageXOffset,scrollTop:i.pageYOffset}}function Tie(i){return Ic(Vd(i)).left+HS(i).scrollLeft}function r2e(i){let e=Ic(i);return RS(e.width)!==i.offsetWidth||RS(e.height)!==i.offsetHeight}function o2e(i,e,t){let n=hl(e),r=Vd(e),o=Ic(i,n&&r2e(e),t==="fixed"),s={scrollLeft:0,scrollTop:0},a={x:0,y:0};if(n||!n&&t!=="fixed")if((kc(e)!=="body"||FS(r))&&(s=HS(e)),hl(e)){let l=Ic(e,!0);a.x=l.x+e.clientLeft,a.y=l.y+e.clientTop}else r&&(a.x=Tie(r));return{x:o.left+s.scrollLeft-a.x,y:o.top+s.scrollTop-a.y,width:o.width,height:o.height}}function kie(i){return kc(i)==="html"?i:i.assignedSlot||i.parentNode||(_m(i)?i.host:null)||Vd(i)}function gie(i){return!hl(i)||ul(i).position==="fixed"?null:s2e(i)}function s2e(i){let{offsetParent:e}=i,t=i,n=!1;for(;t&&t!==e;){let{assignedSlot:r}=t;if(r){let o=r.offsetParent;if(ul(r).display==="contents"){let s=r.hasAttribute("style"),a=r.style.display;r.style.display=ul(t).display,o=r.offsetParent,r.style.display=a,s||r.removeAttribute("style")}t=r,e!==o&&(e=o,n=!0)}else if(_m(t)&&t.host&&n)break;t=_m(t)&&t.host||t.parentNode}return e}function a2e(i){let e=kie(i);for(_m(e)&&(e=e.host);hl(e)&&!["html","body"].includes(kc(e));){if(xie(e))return e;{let t=e.parentNode;e=_m(t)?t.host:t}}return null}function ZD(i){let e=Ac(i),t=gie(i);for(;t&&n2e(t)&&ul(t).position==="static";)t=gie(t);return t&&(kc(t)==="html"||kc(t)==="body"&&ul(t).position==="static"&&!xie(t))?e:t||a2e(i)||e}function vie(i){if(hl(i))return{width:i.offsetWidth,height:i.offsetHeight};let e=Ic(i);return{width:e.width,height:e.height}}function l2e(i){let{rect:e,offsetParent:t,strategy:n}=i,r=hl(t),o=Vd(t);if(t===o)return e;let s={scrollLeft:0,scrollTop:0},a={x:0,y:0};if((r||!r&&n!=="fixed")&&((kc(t)!=="body"||FS(o))&&(s=HS(t)),hl(t))){let l=Ic(t,!0);a.x=l.x+t.clientLeft,a.y=l.y+t.clientTop}return Pt(Re({},e),{x:e.x-s.scrollLeft+a.x,y:e.y-s.scrollTop+a.y})}function c2e(i,e){let t=Ac(i),n=Vd(i),r=t.visualViewport,o=n.clientWidth,s=n.clientHeight,a=0,l=0;if(r){o=r.width,s=r.height;let c=Eie();(c||!c&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:o,height:s,x:a,y:l}}function d2e(i){var e;let t=Vd(i),n=HS(i),r=(e=i.ownerDocument)==null?void 0:e.body,o=t_(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=t_(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-n.scrollLeft+Tie(i),l=-n.scrollTop;return ul(r||t).direction==="rtl"&&(a+=t_(t.clientWidth,r?r.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}function Iie(i){let e=kie(i);return["html","body","#document"].includes(kc(e))?i.ownerDocument.body:hl(e)&&FS(e)?e:Iie(e)}function OS(i,e){var t;e===void 0&&(e=[]);let n=Iie(i),r=n===((t=i.ownerDocument)==null?void 0:t.body),o=Ac(n),s=r?[o].concat(o.visualViewport||[],FS(n)?n:[]):n,a=e.concat(s);return r?a:a.concat(OS(s))}function u2e(i,e){let t=e.getRootNode==null?void 0:e.getRootNode();if(i.contains(e))return!0;if(t&&_m(t)){let n=e;do{if(n&&i===n)return!0;n=n.parentNode||n.host}while(n)}return!1}function h2e(i,e){let t=Ic(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 _ie(i,e,t){return e==="viewport"?DS(c2e(i,t)):jd(e)?h2e(e,t):DS(d2e(Vd(i)))}function f2e(i){let e=OS(i),t=["absolute","fixed"].includes(ul(i).position)&&hl(i)?ZD(i):i;return jd(t)?e.filter(n=>jd(n)&&u2e(n,t)&&kc(n)!=="body"):[]}function p2e(i){let{element:e,boundary:t,rootBoundary:n,strategy:r}=i,o=[...t==="clippingAncestors"?f2e(e):[].concat(t),n],s=o[0],a=o.reduce((l,c)=>{let d=_ie(e,c,r);return l.top=t_(d.top,l.top),l.right=mie(d.right,l.right),l.bottom=mie(d.bottom,l.bottom),l.left=t_(d.left,l.left),l},_ie(e,s,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}var m2e={getClippingRect:p2e,convertOffsetParentRelativeRectToViewportRelativeRect:l2e,isElement:jd,getDimensions:vie,getOffsetParent:ZD,getDocumentElement:Vd,getElementRects:i=>{let{reference:e,floating:t,strategy:n}=i;return{reference:o2e(e,ZD(t),n),floating:Pt(Re({},vie(t)),{x:0,y:0})}},getClientRects:i=>Array.from(i.getClientRects()),isRTL:i=>ul(i).direction==="rtl"};function g2e(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?[...jd(i)?OS(i):[],...OS(e)]:[];d.forEach(g=>{l&&g.addEventListener("scroll",t,{passive:!0}),c&&g.addEventListener("resize",t)});let u=null;if(s){let g=!0;u=new ResizeObserver(()=>{g||t(),g=!1}),jd(i)&&!a&&u.observe(i),u.observe(e)}let h,p=a?Ic(i):null;a&&m();function m(){let g=Ic(i);p&&(g.x!==p.x||g.y!==p.y||g.width!==p.width||g.height!==p.height)&&t(),p=g,h=requestAnimationFrame(m)}return t(),()=>{var g;d.forEach(b=>{l&&b.removeEventListener("scroll",t),c&&b.removeEventListener("resize",t)}),(g=u)==null||g.disconnect(),u=null,a&&cancelAnimationFrame(h)}}var v2e=(i,e,t)=>Uye(i,e,Re({platform:m2e},t));async function _2e(i,e,t,n){if(!n)throw new Error("Must provide a positioning option");return await(typeof n=="string"?b2e(i,e,t,n):y2e(e,n))}async function b2e(i,e,t,n){if(!t)throw new Error("Reference element is required for relative positioning");let r;return n==="auto"?r={middleware:[Qye(),pie(),fie({mainAxis:5,crossAxis:12})]}:r={placement:n,middleware:[Zye(),pie(),fie(5)]},g2e(t,e,async()=>{if((!t.isConnected||!t.offsetParent)&&C2e(i))return;let{x:o,y:s}=await v2e(t,e,r);Object.assign(e.style,{position:"absolute",left:`${o}px`,top:`${s}px`})})}function y2e(i,e){return i.style.position="fixed",Object.entries(e).forEach(([t,n])=>{i.style[t]=n}),()=>{}}function C2e(i){switch(i.options.onPositionLost){case"close":return i.close(),!0;case"destroy":return i.destroy(),!0;case"hold":return!0}}var S2e={hideOnClickOutside:!0,hideOnEmojiSelect:!0,hideOnEscape:!0,position:"auto",showCloseButton:!0,onPositionLost:"none"};function w2e(i={}){return Re(Pt(Re({},S2e),{rootElement:document.body}),i)}var x2e='',bie=Ir("popupContainer","closeButton"),eN=class{constructor(e,t){this.isOpen=!1,this.externalEvents=new Hh,this.options=Re(Re({},w2e(t)),XD(e)),this.popupEl=document.createElement("div"),this.popupEl.classList.add(bie.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(bie.closeButton),this.closeButton.innerHTML=x2e,this.closeButton.addEventListener("click",()=>{this.close()}),this.popupEl.appendChild(this.closeButton));let n=document.createElement("div");this.popupEl.appendChild(n),this.picker=die(Pt(Re({},this.options),{rootElement:n})),this.focusTrap=new Jv,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 _2e(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 Ph(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 Ph(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()}},E2e=`.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} `,T2e=QD();function Aie(i,e){return T2e(E2e),new eN(Re({autoFocus:"auto"},i),e)}var k2e={mounted(){let i=this.el.querySelector("[data-emoji-button]"),e=this.el.querySelector("[data-emoji-preview]"),t=this.el.querySelector("[data-emoji-input]"),n=Aie({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()})}},Lie=k2e;var I2e={mounted(){this.focus()},updated(){this.el!==document.activeElement&&this.focus()},focus(){ed(document.activeElement)||(this.el.focus(),this.el.selectionStart=this.el.selectionEnd=this.el.value.length,this.el.scrollLeft=this.el.scrollWidth)}},Mie=I2e;var A2e={mounted(){this.props=this.getProps(),this.isFocused=!1,this.insertMode=!1,this.initializeHeadingEl(),this.unsubscribeFromNavigationEvents=bn.subscribe("navigation",i=>{this.handleNavigationEvent(i)})},updated(){this.props=this.getProps(),this.initializeHeadingEl()},destroyed(){this.unsubscribeFromNavigationEvents()},getProps(){return{focusableId:vt(this.el,"data-focusable-id"),onValueChange:vt(this.el,"data-on-value-change"),metadata:vt(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(),Die(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&&td(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(),Die(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 Die(i){let e=document.createRange();e.selectNodeContents(i),e.collapse(!1);let t=window.getSelection();t.removeAllRanges(),t.addRange(e)}var Nie=A2e;var L2e={mounted(){this.props=this.getProps(),this.sourceEl=Ol(this.el,"[data-source]"),this.targetEl=Ol(this.el,"[data-target]"),this.updateDOM()},updated(){this.props=this.getProps(),this.updateDOM()},getProps(){return{language:vt(this.el,"data-language")}},updateDOM(){let i=this.sourceEl.innerText;em(i,this.props.language).then(e=>{this.targetEl.innerHTML=e,this.el.setAttribute("data-highlighted","")})}},Rie=L2e;var iN=["bg-yellow-100","border-yellow-300"],M2e={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=R2e(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(...iN)}),this.el.addEventListener("dragleave",i=>{this.el.contains(i.relatedTarget)||this.el.classList.remove(...iN)}),this.el.addEventListener("drop",i=>{this.el.classList.remove(...iN)}),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:vt(this.el,"data-id"),phxTarget:vt(this.el,"data-phx-target",hs),height:Wi(this.el,"data-height",null,hs),width:Wi(this.el,"data-width",null,hs),format:vt(this.el,"data-format"),fit:vt(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:D2e(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),u=Math.round(t*c);o.width=d,o.height=u,s.drawImage(i,0,0,e,t,0,0,d,u)}else if(this.props.fit==="crop"){let a=n/e,l=r/t,c=Math.max(a,l),d=Math.round(e*c),u=Math.round(t*c);o.width=n,o.height=r,s.drawImage(i,Math.round((d-n)/c/2),Math.round((u-r)/c/2),e-Math.round((d-n)/c),t-Math.round((u-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),u=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-u)/2),d,u)}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 D2e(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=N2e(t);return n4(n)}throw new Error(`Unexpected format: ${e}`)}function N2e(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-forms allow-modals allow-popups allow-top-navigation",i.allow="accelerometer; ambient-light-sensor; camera; display-capture; encrypted-media; fullscreen; geolocation; gyroscope; microphone; midi; usb; xr-spatial-tracking; clipboard-read; clipboard-write",i.src=n})}function U2e(i,e){let t=window.location.protocol;return e?e.replace(/^https?:/,t):t==="https:"?"https://livebookusercontent.com/iframe/v5.html":`http://${window.location.hostname}:${i}/iframe/v5.html`}var oN=null;function W2e(i){return oN||(oN=fetch(i).then(e=>e.text()).then(e=>{if(SH(e)!==zie)throw new Error(`The iframe loaded from ${i} doesn't have the expected checksum ${zie}`)})),oN}var j2e={mounted(){this.props=this.getProps(),this.id=e4(),this.childToken=yH(),this.childReadyPromise=null,this.childReady=!1,this.initReceived=!1,this.syncCallbackQueue=[],this.pongCallbackQueue=[],this.initTimeout=setTimeout(()=>this.handleInitTimeout(),2e3),this.channel=Fie(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]=rN(r);this.handleServerInit(o)}),e=this.channel.on(`event:${this.props.ref}`,r=>{let[[o],s]=rN(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=bn.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=bn.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:vt(this.el,"data-ref"),assetsBasePath:vt(this.el,"data-assets-base-path"),assetsCdnUrl:Wi(this.el,"data-assets-cdn-url",null),jsPath:vt(this.el,"data-js-path"),sessionToken:vt(this.el,"data-session-token"),connectToken:vt(this.el,"data-connect-token"),iframePort:vt(this.el,"data-iframe-local-port",hs),iframeUrl:Wi(this.el,"data-iframe-url",null),timeoutMessage:vt(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=bn.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,o=new Promise((a,l)=>{E3(this.iframePlaceholder)?a():(r=new IntersectionObserver(c=>{E3(this.iframePlaceholder)&&(r.disconnect(),a())}),r.observe(this.iframePlaceholder))});return this.iframe.toggleAttribute("data-js-focused",!!this.el.closest("[data-js-focused]")),{visibilityPromise:o,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(xf(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]");Uie(this.iframe,this.props.iframePort,this.props.iframeUrl).then(()=>{i.appendChild(this.iframe)})},handleChildMessage(i,e){if(i.type==="ready"&&!this.childReady)this.getAssetsBaseUrl().then(t=>{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=Bie([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})}},getAssetsBaseUrl(){return BS().then(i=>!i&&this.props.assetsCdnUrl?this.props.assetsCdnUrl:window.location.origin+this.props.assetsBasePath)},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)}}};function BS(){return BS.promise=BS.promise||fetch("/public/health").then(i=>i.status===200).catch(i=>!1),BS.promise}var Wie=j2e;var V2e={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{cellId:vt(this.el,"data-cell-id"),defaultHandlers:vt(this.el,"data-default-handlers"),isKeydownEnabled:vt(this.el,"data-keydown-enabled",Rl),isKeyupEnabled:vt(this.el,"data-keyup-enabled",Rl),target:vt(this.el,"data-target")}},handleDocumentKeyDown(i){if(this.isKeyboardToggle(i)&&!ed(document.activeElement)){Da(i),this.keyboardEnabled()?this.disableKeyboard():this.enableKeyboard();return}if(this.keyboardEnabled()){if(this.props.defaultHandlers!=="on"&&Da(i),i.repeat)return;if(this.props.isKeydownEnabled){let{key:e}=i;this.pushEventTo(this.props.target,"keydown",{key:e})}}},handleDocumentKeyUp(i){if(this.keyboardEnabled()&&(this.props.defaultHandlers!=="on"&&Da(i),this.props.isKeyupEnabled)){let{key:e}=i;this.pushEventTo(this.props.target,"keyup",{key:e})}},handleDocumentFocus(i){this.props.isKeydownEnabled&&ed(i.target)&&this.disableKeyboard()},enableKeyboard(){this.keyboardEnabled()||this.pushEventTo(this.props.target,"enable_keyboard",{})},disableKeyboard(){this.keyboardEnabled()&&this.pushEventTo(this.props.target,"disable_keyboard",{})},keyboardEnabled(){return this.props.isKeydownEnabled||this.props.isKeyupEnabled},isKeyboardToggle(i){if(i.repeat)return!1;let{metaKey:e,ctrlKey:t,key:n}=i;return(Zb()?e:t)&&n==="k"&&this.isCellFocused()?!this.keyboardEnabled()||["on","disable_only"].includes(this.props.defaultHandlers):!1},isCellFocused(){let i=this.el.closest("[data-el-session]");return i&&i.getAttribute("data-js-focused-id")===this.props.cellId}},jie=V2e;var K2e={mounted(){this.props=this.getProps(),this.templateEl=Ol(this.el,"[data-template]"),this.contentEl=Ol(this.el,"[data-content]"),this.markdown=new I9(this.contentEl,this.templateEl.textContent,{baseUrl:this.props.basePath,allowedUriSchemes:this.props.allowedUriSchemes.split(",")})},updated(){this.props=this.getProps(),this.markdown.setContent(this.templateEl.textContent)},getProps(){return{basePath:vt(this.el,"data-base-path"),allowedUriSchemes:vt(this.el,"data-allowed-uri-schemes")}}},Vie=K2e;var q2e={mounted(){this.scroll()},updated(){this.scroll()},scroll(){y1(this.el)}},Kie=q2e;var sN=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}},qie=sN;var G2e={mounted(){this.props=this.getProps(),this.focusedId=null,this.insertMode=!1,this.view=null,this.viewOptions=null,this.keyBuffer=new qie,this.clientsMap={},this.lastLocationReportByClientId={},this.followedClientId=null,i4(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("files-list-toggle").addEventListener("click",i=>this.toggleFilesList()),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()),this.initializeDragAndDrop(),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=bn.subscribe("session",i=>{this.handleSessionEvent(i)})},updated(){let i=this.props;this.props=this.getProps(),this.props.globalStatus!==i.globalStatus&&i4(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),i4("favicon"),this.keepChannel||Hie()},getProps(){return{autofocusCellId:Wi(this.el,"data-autofocus-cell-id",null),globalStatus:Wi(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=Zb()?i.metaKey:i.ctrlKey,t=i.altKey,n=i.shiftKey,r=i.key,o=this.keyBuffer;if(!(ed(i.target)&&i.target.closest("[data-el-outputs-container]"))){if(e&&n&&!t&&r==="Enter"){Da(i),this.queueFullCellsEvaluation(!0);return}else if(!e&&n&&!t&&r==="Enter"){Da(i),Lh(this.focusedCellType())&&this.queueFocusedCellEvaluation(),this.moveFocus(1);return}else if(e&&!t&&r==="Enter"){Da(i),Lh(this.focusedCellType())&&this.queueFocusedCellEvaluation();return}else if(e&&r==="s"){Da(i),this.saveNotebook();return}else if(e||t)return}this.insertMode?(o.reset(),r==="Escape"&&(this.escapesMonacoWidget(i)||this.escapeInsertMode())):ed(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"])?Lh(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","f"])?this.toggleFilesList():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"?(Da(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.view||this.viewOptions.showMarkdown)&&this.insertCellBelowFocused("markdown"):o.tryMatch(["M"])?(!this.view||this.viewOptions.showMarkdown)&&this.insertCellAboveFocused("markdown"):o.tryMatch(["v","z"])?this.toggleView("code-zen"):o.tryMatch(["v","p"])?this.toggleView("presentation"):o.tryMatch(["v","c"])?this.toggleView("custom"):o.tryMatch(["c"])?(!this.view||this.viewOptions.showSection)&&this.toggleCollapseSection():o.tryMatch(["C"])&&(!this.view||this.viewOptions.showSection)&&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||["insert","visual"].includes(e.dataset.vimMode)):!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","")}},initializeDragAndDrop(){let i=!1,e=null,t=null,n=(o=null)=>{if(!i){i=!0,e=o;let s=o?"internal":"external";this.el.setAttribute("data-js-dragging",s),s==="external"&&this.toggleFilesList(!0)}},r=()=>{i&&(i=!1,this.el.removeAttribute("data-js-dragging"))};this.el.addEventListener("dragstart",o=>{n(o.target)}),this.el.addEventListener("dragenter",o=>{n()}),this.el.addEventListener("dragleave",o=>{this.el.contains(o.relatedTarget)||r()}),this.el.addEventListener("dragover",o=>{o.stopPropagation(),o.preventDefault()}),this.el.addEventListener("drop",o=>{o.stopPropagation(),o.preventDefault();let s=o.target.closest("[data-el-insert-drop-area]"),a=o.target.closest("[data-el-files-drop-area]");if(s){let l=s.getAttribute("data-section-id")||null,c=s.getAttribute("data-cell-id")||null;if(o.dataTransfer.files.length>0)t=o.dataTransfer.files,this.pushEvent("handle_file_drop",{section_id:l,cell_id:c});else if(e&&e.matches("[data-el-file-entry]")){let d=e.getAttribute("data-name");this.pushEvent("insert_file",{file_entry_name:d,section_id:l,cell_id:c})}}else a&&o.dataTransfer.files.length>0&&(t=o.dataTransfer.files,this.pushEvent("handle_file_drop",{}));r()}),this.handleEvent("finish_file_drop",o=>{let s=document.querySelector('#add-file-entry-modal input[type="file"]');s&&(s.files=t,s.dispatchEvent(new Event("change",{bubbles:!0})))})},toggleSectionsList(i=null){this.toggleSidePanelContent("sections-list",i)},toggleClientsList(i=null){this.toggleSidePanelContent("clients-list",i)},toggleSecretsList(i=null){this.toggleSidePanelContent("secrets-list",i)},toggleAppInfo(i=null){this.toggleSidePanelContent("app-info",i)},toggleFilesList(i=null){this.toggleSidePanelContent("files-list",i)},toggleRuntimeInfo(i=null){this.toggleSidePanelContent("runtime-info",i)},toggleSidePanelContent(i,e=null){(e===null?this.el.getAttribute("data-js-side-panel-content")!==i:e)?this.el.setAttribute("data-js-side-panel-content",i):this.el.removeAttribute("data-js-side-panel-content")},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){Lh(this.focusedCellType())?bn.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?this.el.setAttribute("data-js-focused-id",i):this.el.removeAttribute("data-js-focused-id"),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})}bn.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})),bn.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){i===this.view?(this.unsetView(),i==="custom"&&this.unsubscribeCustomViewFromSettings()):i==="code-zen"?this.setView(i,{showSection:!1,showMarkdown:!1,showOutput:!0,spotlight:!1}):i==="presentation"?this.setView(i,{showSection:!0,showMarkdown:!0,showOutput:!0,spotlight:!0}):i==="custom"&&(this.unsubscribeCustomViewFromSettings=en.getAndSubscribe(t=>{this.setView(i,{showSection:t.custom_view_show_section,showMarkdown:t.custom_view_show_markdown,showOutput:t.custom_view_show_output,spotlight:t.custom_view_spotlight})}),this.pushEvent("open_custom_view_settings"));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"})}},setView(i,e){this.view=i,this.viewOptions=e,this.el.setAttribute("data-js-view",i),this.el.toggleAttribute("data-js-hide-section",!e.showSection),this.el.toggleAttribute("data-js-hide-markdown",!e.showMarkdown),this.el.toggleAttribute("data-js-hide-output",!e.showOutput),this.el.toggleAttribute("data-js-spotlight",e.spotlight)},unsetView(){this.view=null,this.viewOptions=null,this.el.removeAttribute("data-js-view"),this.el.removeAttribute("data-js-hide-section"),this.el.removeAttribute("data-js-hide-markdown"),this.el.removeAttribute("data-js-hide-output"),this.el.removeAttribute("data-js-spotlight")},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),$Q(this.focusedCellType())&&this.setInsertMode(!0)},handleCellDeleted(i,e){if(this.focusedId===i)if(this.view){let t=this.ensureVisibleFocusableEl(e);this.setFocusedEl(t)}else this.setFocusedEl(e)},handleCellRestored(i){this.setFocusedEl(i)},handleCellMoved(i){this.repositionJSViews(),this.focusedId===i&&bn.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),gH(document.activeElement)},handleSectionDeleted(i){this.focusedId&&!this.getFocusableEl(this.focusedId)&&this.setFocusedEl(null)},handleSectionMoved(i){this.repositionJSViews();let e=this.getSectionById(i);td(e)},handleCellUpload(i,e){this.focusedId!==i&&this.setFocusedEl(i),this.insertMode||this.setInsertMode(!0),bn.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){bn.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(){bn.broadcast("js_views",{type:"reposition"})},broadcastLocationReport(i,e){bn.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 ii.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(x3);return r?r.getAttribute("data-focusable-id"):t[0]}else{let r=pH(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=>!xf(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=>!xf(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}]`)}},Gie=G2e;var $2e={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`}},$ie=$2e;var Y2e=100,X2e={mounted(){this.props=this.getProps(),this.interval=setInterval(()=>this.updateDOM(),Y2e)},updated(){this.props=this.getProps(),this.updateDOM()},destroyed(){clearInterval(this.interval)},getProps(){return{start:vt(this.el,"data-start")}},updateDOM(){let e=(Date.now()-new Date(this.props.start))/1e3;this.el.innerHTML=`${e.toFixed(1)}s`}},Yie=X2e;var Xie="lb:user_data";function Qie(i){let e=JSON.stringify(i),t=_H(e);J2e(Xie,t,15768e4)}function Jie(){let i=Q2e(Xie);if(i){let e=bH(i);return JSON.parse(e)}else return null}function Q2e(i){let e=document.cookie.split("; ").find(t=>t.startsWith(`${i}=`));return e?e.replace(`${i}=`,""):null}function J2e(i,e,t){let n=`${i}=${e};max-age=${t};path=/${r4()}`;document.cookie=n}var Z2e={mounted(){this.el.addEventListener("submit",i=>{let e=this.el.user_form_name.value,t=this.el.user_form_hex_color.value;Qie({name:e,hex_color:t})})}},Zie=Z2e;var eCe={mounted(){this.props=this.getProps(),this.updateAttrs(),this.el.addEventListener("blur",i=>{let e=this.datetimeLocalToUtc(this.el.value);this.pushEventTo(this.props.phxTarget,"change",{html_value:e})})},updated(){this.props=this.getProps(),this.updateAttrs()},getProps(){return{utcValue:Wi(this.el,"data-utc-value",null),utcMin:Wi(this.el,"data-utc-min",null),utcMax:Wi(this.el,"data-utc-max",null),phxTarget:vt(this.el,"data-phx-target")}},updateAttrs(){this.el.value=this.datetimeUtcToLocal(this.props.utcValue),this.el.min=this.datetimeUtcToLocal(this.props.utcMin),this.el.max=this.datetimeUtcToLocal(this.props.utcMax)},datetimeUtcToLocal(i){if(!i)return null;let e=new Date(i+"Z"),t=e.getFullYear().toString(),n=(e.getMonth()+1).toString().padStart(2,"0"),r=e.getDate().toString().padStart(2,"0"),o=e.getHours().toString().padStart(2,"0"),s=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0");return`${t}-${n}-${r}T${o}:${s}:${a}`},datetimeLocalToUtc(i){if(!i)return null;let e=new Date(i),t=e.getUTCFullYear().toString(),n=(e.getUTCMonth()+1).toString().padStart(2,"0"),r=e.getUTCDate().toString().padStart(2,"0"),o=e.getUTCHours().toString().padStart(2,"0"),s=e.getUTCMinutes().toString().padStart(2,"0"),a=e.getUTCSeconds().toString().padStart(2,"0");return`${t}-${n}-${r}T${o}:${s}:${a}`}},ene=eCe;var tCe={mounted(){this.props=this.getProps(),this.updateAttrs(),this.el.addEventListener("blur",i=>{let e=this.timeLocalToUtc(this.el.value);this.pushEventTo(this.props.phxTarget,"change",{html_value:e})})},updated(){this.props=this.getProps(),this.updateAttrs()},getProps(){return{utcValue:Wi(this.el,"data-utc-value",null),utcMin:Wi(this.el,"data-utc-min",null),utcMax:Wi(this.el,"data-utc-max",null),phxTarget:vt(this.el,"data-phx-target")}},updateAttrs(){this.el.value=this.timeUtcToLocal(this.props.utcValue),this.el.min=this.timeUtcToLocal(this.props.utcMin),this.el.max=this.timeUtcToLocal(this.props.utcMax)},timeUtcToLocal(i){if(!i)return null;let e=new Date;e.setUTCHours(...i.split(":"));let t=e.getHours().toString().padStart(2,"0"),n=e.getMinutes().toString().padStart(2,"0"),r=e.getSeconds().toString().padStart(2,"0");return`${t}:${n}:${r}`},timeLocalToUtc(i){if(!i)return null;let e=new Date;e.setHours(...i.split(":"));let t=e.getUTCHours().toString().padStart(2,"0"),n=e.getUTCMinutes().toString().padStart(2,"0"),r=e.getUTCSeconds().toString().padStart(2,"0");return`${t}:${n}:${r}`}},tne=tCe;var rne=Fi(nne());var iCe={mounted(){this.props=this.getProps(),this.lineHeight=mH(this.el),this.templateEl=Ol(this.el,"[data-template]"),this.contentEl=Ol(this.el,"[data-content]"),this.capLines();let i=this.hyperListConfig();this.virtualizedList=new rne.default(this.contentEl,i),this.props.follow&&y1(this.contentEl)},updated(){this.props=this.getProps(),this.capLines();let i=this.props.follow&&vH(this.contentEl),e=this.hyperListConfig();this.virtualizedList.refresh(this.contentEl,e),i&&y1(this.contentEl)},getProps(){return{maxHeight:vt(this.el,"data-max-height",hs),follow:Wi(this.el,"data-follow",!1,Rl),maxLines:Wi(this.el,"data-max-lines",null,hs),ignoreTrailingEmptyLine:Wi(this.el,"data-ignore-trailing-empty-line",!1,Rl)}},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="...")}}},one=iCe;var nCe={mounted(){let i=en.get(),e=this.el.querySelector('[name="show_section"][value="true"]'),t=this.el.querySelector('[name="show_markdown"][value="true"]'),n=this.el.querySelector('[name="show_output"][value="true"]'),r=this.el.querySelector('[name="spotlight"][value="true"]');e.checked=i.custom_view_show_section,t.checked=i.custom_view_show_markdown,n.checked=i.custom_view_show_output,r.checked=i.custom_view_spotlight,e.addEventListener("change",o=>{en.update({custom_view_show_section:o.target.checked})}),t.addEventListener("change",o=>{en.update({custom_view_show_markdown:o.target.checked})}),n.addEventListener("change",o=>{en.update({custom_view_show_output:o.target.checked})}),r.addEventListener("change",o=>{en.update({custom_view_spotlight:o.target.checked})})}},sne=nCe;var ane={AppAuth:nH,AudioInput:EH,Cell:YQ,CellEditor:Wte,Dropzone:jte,EditorSettings:Vte,EmojiPicker:Lie,FocusOnUpdate:Mie,Headline:Nie,Highlight:Rie,ImageInput:Oie,ImageOutput:Pie,JSView:Wie,KeyboardControl:jie,MarkdownRenderer:Vie,ScrollOnUpdate:Kie,Session:Gie,TextareaAutosize:$ie,Timer:Yie,UserForm:Zie,UtcDateTimeInput:ene,UtcTimeInput:tne,VirtualizedLines:one,CustomViewSettings:sne};var lne={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 US=Fi(dne());function une(){US.default.config({barColors:{0:"#b2c1ff"},shadowColor:"rgba(0, 0, 0, .3)"}),window.addEventListener("phx:page-loading-start",()=>{US.default.show(500)}),window.addEventListener("phx:page-loading-stop",()=>{US.default.hide()})}function hne(){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.detail.content?navigator.clipboard.writeText(i.detail.content):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(),Die(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&&td(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(),Die(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 Die(i){let e=document.createRange();e.selectNodeContents(i),e.collapse(!1);let t=window.getSelection();t.removeAllRanges(),t.addRange(e)}var Nie=A2e;var L2e={mounted(){this.props=this.getProps(),this.sourceEl=Ol(this.el,"[data-source]"),this.targetEl=Ol(this.el,"[data-target]"),this.updateDOM()},updated(){this.props=this.getProps(),this.updateDOM()},getProps(){return{language:vt(this.el,"data-language")}},updateDOM(){let i=this.sourceEl.innerText;em(i,this.props.language).then(e=>{this.targetEl.innerHTML=e,this.el.setAttribute("data-highlighted","")})}},Rie=L2e;var iN=["bg-yellow-100","border-yellow-300"],M2e={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=R2e(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(...iN)}),this.el.addEventListener("dragleave",i=>{this.el.contains(i.relatedTarget)||this.el.classList.remove(...iN)}),this.el.addEventListener("drop",i=>{this.el.classList.remove(...iN)}),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:vt(this.el,"data-id"),phxTarget:vt(this.el,"data-phx-target",hs),height:Wi(this.el,"data-height",null,hs),width:Wi(this.el,"data-width",null,hs),format:vt(this.el,"data-format"),fit:vt(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:D2e(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),u=Math.round(t*c);o.width=d,o.height=u,s.drawImage(i,0,0,e,t,0,0,d,u)}else if(this.props.fit==="crop"){let a=n/e,l=r/t,c=Math.max(a,l),d=Math.round(e*c),u=Math.round(t*c);o.width=n,o.height=r,s.drawImage(i,Math.round((d-n)/c/2),Math.round((u-r)/c/2),e-Math.round((d-n)/c),t-Math.round((u-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),u=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-u)/2),d,u)}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 D2e(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=N2e(t);return n4(n)}throw new Error(`Unexpected format: ${e}`)}function N2e(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-forms allow-modals allow-popups allow-top-navigation",i.allow="accelerometer; ambient-light-sensor; camera; display-capture; encrypted-media; fullscreen; geolocation; gyroscope; microphone; midi; usb; xr-spatial-tracking; clipboard-read; clipboard-write",i.src=n})}function U2e(i,e){let t=window.location.protocol;return e?e.replace(/^https?:/,t):t==="https:"?"https://livebookusercontent.com/iframe/v5.html":`http://${window.location.hostname}:${i}/iframe/v5.html`}var oN=null;function W2e(i){return oN||(oN=fetch(i).then(e=>e.text()).then(e=>{if(SH(e)!==zie)throw new Error(`The iframe loaded from ${i} doesn't have the expected checksum ${zie}`)})),oN}var j2e={mounted(){this.props=this.getProps(),this.id=e4(),this.childToken=yH(),this.childReadyPromise=null,this.childReady=!1,this.initReceived=!1,this.syncCallbackQueue=[],this.pongCallbackQueue=[],this.initTimeout=setTimeout(()=>this.handleInitTimeout(),2e3),this.channel=Fie(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]=rN(r);this.handleServerInit(o)}),e=this.channel.on(`event:${this.props.ref}`,r=>{let[[o],s]=rN(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=bn.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=bn.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:vt(this.el,"data-ref"),assetsBasePath:vt(this.el,"data-assets-base-path"),assetsCdnUrl:Wi(this.el,"data-assets-cdn-url",null),jsPath:vt(this.el,"data-js-path"),sessionToken:vt(this.el,"data-session-token"),connectToken:vt(this.el,"data-connect-token"),iframePort:vt(this.el,"data-iframe-local-port",hs),iframeUrl:Wi(this.el,"data-iframe-url",null),timeoutMessage:vt(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=bn.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,o=new Promise((a,l)=>{E3(this.iframePlaceholder)?a():(r=new IntersectionObserver(c=>{E3(this.iframePlaceholder)&&(r.disconnect(),a())}),r.observe(this.iframePlaceholder))});return this.iframe.toggleAttribute("data-js-focused",!!this.el.closest("[data-js-focused]")),{visibilityPromise:o,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(xf(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]");Uie(this.iframe,this.props.iframePort,this.props.iframeUrl).then(()=>{i.appendChild(this.iframe)})},handleChildMessage(i,e){if(i.type==="ready"&&!this.childReady)this.getAssetsBaseUrl().then(t=>{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=Bie([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})}},getAssetsBaseUrl(){return BS().then(i=>!i&&this.props.assetsCdnUrl?this.props.assetsCdnUrl:window.location.origin+this.props.assetsBasePath)},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)}}};function BS(){return BS.promise=BS.promise||fetch("/public/health").then(i=>i.status===200).catch(i=>!1),BS.promise}var Wie=j2e;var V2e={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{cellId:vt(this.el,"data-cell-id"),defaultHandlers:vt(this.el,"data-default-handlers"),isKeydownEnabled:vt(this.el,"data-keydown-enabled",Rl),isKeyupEnabled:vt(this.el,"data-keyup-enabled",Rl),target:vt(this.el,"data-target")}},handleDocumentKeyDown(i){if(this.isKeyboardToggle(i)&&!ed(document.activeElement)){Da(i),this.keyboardEnabled()?this.disableKeyboard():this.enableKeyboard();return}if(this.keyboardEnabled()){if(this.props.defaultHandlers!=="on"&&Da(i),i.repeat)return;if(this.props.isKeydownEnabled){let{key:e}=i;this.pushEventTo(this.props.target,"keydown",{key:e})}}},handleDocumentKeyUp(i){if(this.keyboardEnabled()&&(this.props.defaultHandlers!=="on"&&Da(i),this.props.isKeyupEnabled)){let{key:e}=i;this.pushEventTo(this.props.target,"keyup",{key:e})}},handleDocumentFocus(i){this.props.isKeydownEnabled&&ed(i.target)&&this.disableKeyboard()},enableKeyboard(){this.keyboardEnabled()||this.pushEventTo(this.props.target,"enable_keyboard",{})},disableKeyboard(){this.keyboardEnabled()&&this.pushEventTo(this.props.target,"disable_keyboard",{})},keyboardEnabled(){return this.props.isKeydownEnabled||this.props.isKeyupEnabled},isKeyboardToggle(i){if(i.repeat)return!1;let{metaKey:e,ctrlKey:t,key:n}=i;return(Zb()?e:t)&&n==="k"&&this.isCellFocused()?!this.keyboardEnabled()||["on","disable_only"].includes(this.props.defaultHandlers):!1},isCellFocused(){let i=this.el.closest("[data-el-session]");return i&&i.getAttribute("data-js-focused-id")===this.props.cellId}},jie=V2e;var K2e={mounted(){this.props=this.getProps(),this.templateEl=Ol(this.el,"[data-template]"),this.contentEl=Ol(this.el,"[data-content]"),this.markdown=new I9(this.contentEl,this.templateEl.textContent,{baseUrl:this.props.basePath,allowedUriSchemes:this.props.allowedUriSchemes.split(",")})},updated(){this.props=this.getProps(),this.markdown.setContent(this.templateEl.textContent)},getProps(){return{basePath:vt(this.el,"data-base-path"),allowedUriSchemes:vt(this.el,"data-allowed-uri-schemes")}}},Vie=K2e;var q2e={mounted(){this.scroll()},updated(){this.scroll()},scroll(){y1(this.el)}},Kie=q2e;var sN=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}},qie=sN;var G2e={mounted(){this.props=this.getProps(),this.focusedId=null,this.insertMode=!1,this.view=null,this.viewOptions=null,this.keyBuffer=new qie,this.clientsMap={},this.lastLocationReportByClientId={},this.followedClientId=null,i4(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("files-list-toggle").addEventListener("click",i=>this.toggleFilesList()),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()),this.initializeDragAndDrop(),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=bn.subscribe("session",i=>{this.handleSessionEvent(i)})},updated(){let i=this.props;this.props=this.getProps(),this.props.globalStatus!==i.globalStatus&&i4(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),i4("favicon"),this.keepChannel||Hie()},getProps(){return{autofocusCellId:Wi(this.el,"data-autofocus-cell-id",null),globalStatus:Wi(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=Zb()?i.metaKey:i.ctrlKey,t=i.altKey,n=i.shiftKey,r=i.key,o=this.keyBuffer;if(!(ed(i.target)&&i.target.closest("[data-el-outputs-container]"))){if(e&&n&&!t&&r==="Enter"){Da(i),this.queueFullCellsEvaluation(!0);return}else if(!e&&n&&!t&&r==="Enter"){Da(i),Lh(this.focusedCellType())&&this.queueFocusedCellEvaluation(),this.moveFocus(1);return}else if(e&&!t&&r==="Enter"){Da(i),Lh(this.focusedCellType())&&this.queueFocusedCellEvaluation();return}else if(e&&r==="s"){Da(i),this.saveNotebook();return}else if(e||t)return}this.insertMode?(o.reset(),r==="Escape"&&(this.escapesMonacoWidget(i)||this.escapeInsertMode())):ed(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"])?Lh(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","f"])?this.toggleFilesList():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"?(Da(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.view||this.viewOptions.showMarkdown)&&this.insertCellBelowFocused("markdown"):o.tryMatch(["M"])?(!this.view||this.viewOptions.showMarkdown)&&this.insertCellAboveFocused("markdown"):o.tryMatch(["v","z"])?this.toggleView("code-zen"):o.tryMatch(["v","p"])?this.toggleView("presentation"):o.tryMatch(["v","c"])?this.toggleView("custom"):o.tryMatch(["c"])?(!this.view||this.viewOptions.showSection)&&this.toggleCollapseSection():o.tryMatch(["C"])&&(!this.view||this.viewOptions.showSection)&&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||["insert","visual"].includes(e.dataset.vimMode)):!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","")}},initializeDragAndDrop(){let i=!1,e=null,t=null,n=(o=null)=>{if(!i){i=!0,e=o;let s=o?"internal":"external";this.el.setAttribute("data-js-dragging",s),s==="external"&&this.toggleFilesList(!0)}},r=()=>{i&&(i=!1,this.el.removeAttribute("data-js-dragging"))};this.el.addEventListener("dragstart",o=>{n(o.target)}),this.el.addEventListener("dragenter",o=>{n()}),this.el.addEventListener("dragleave",o=>{this.el.contains(o.relatedTarget)||r()}),this.el.addEventListener("dragover",o=>{o.stopPropagation(),o.preventDefault()}),this.el.addEventListener("drop",o=>{o.stopPropagation(),o.preventDefault();let s=o.target.closest("[data-el-insert-drop-area]"),a=o.target.closest("[data-el-files-drop-area]");if(s){let l=s.getAttribute("data-section-id")||null,c=s.getAttribute("data-cell-id")||null;if(o.dataTransfer.files.length>0)t=o.dataTransfer.files,this.pushEvent("handle_file_drop",{section_id:l,cell_id:c});else if(e&&e.matches("[data-el-file-entry]")){let d=e.getAttribute("data-name");this.pushEvent("insert_file",{file_entry_name:d,section_id:l,cell_id:c})}}else a&&o.dataTransfer.files.length>0&&(t=o.dataTransfer.files,this.pushEvent("handle_file_drop",{}));r()}),this.handleEvent("finish_file_drop",o=>{let s=document.querySelector('#add-file-entry-modal input[type="file"]');s&&(s.files=t,s.dispatchEvent(new Event("change",{bubbles:!0})))})},toggleSectionsList(i=null){this.toggleSidePanelContent("sections-list",i)},toggleClientsList(i=null){this.toggleSidePanelContent("clients-list",i)},toggleSecretsList(i=null){this.toggleSidePanelContent("secrets-list",i)},toggleAppInfo(i=null){this.toggleSidePanelContent("app-info",i)},toggleFilesList(i=null){this.toggleSidePanelContent("files-list",i)},toggleRuntimeInfo(i=null){this.toggleSidePanelContent("runtime-info",i)},toggleSidePanelContent(i,e=null){(e===null?this.el.getAttribute("data-js-side-panel-content")!==i:e)?this.el.setAttribute("data-js-side-panel-content",i):this.el.removeAttribute("data-js-side-panel-content")},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){Lh(this.focusedCellType())?bn.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?this.el.setAttribute("data-js-focused-id",i):this.el.removeAttribute("data-js-focused-id"),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})}bn.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})),bn.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){i===this.view?(this.unsetView(),i==="custom"&&this.unsubscribeCustomViewFromSettings()):i==="code-zen"?this.setView(i,{showSection:!1,showMarkdown:!1,showOutput:!0,spotlight:!1}):i==="presentation"?this.setView(i,{showSection:!0,showMarkdown:!0,showOutput:!0,spotlight:!0}):i==="custom"&&(this.unsubscribeCustomViewFromSettings=en.getAndSubscribe(t=>{this.setView(i,{showSection:t.custom_view_show_section,showMarkdown:t.custom_view_show_markdown,showOutput:t.custom_view_show_output,spotlight:t.custom_view_spotlight})}),this.pushEvent("open_custom_view_settings"));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"})}},setView(i,e){this.view=i,this.viewOptions=e,this.el.setAttribute("data-js-view",i),this.el.toggleAttribute("data-js-hide-section",!e.showSection),this.el.toggleAttribute("data-js-hide-markdown",!e.showMarkdown),this.el.toggleAttribute("data-js-hide-output",!e.showOutput),this.el.toggleAttribute("data-js-spotlight",e.spotlight)},unsetView(){this.view=null,this.viewOptions=null,this.el.removeAttribute("data-js-view"),this.el.removeAttribute("data-js-hide-section"),this.el.removeAttribute("data-js-hide-markdown"),this.el.removeAttribute("data-js-hide-output"),this.el.removeAttribute("data-js-spotlight")},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),$Q(this.focusedCellType())&&this.setInsertMode(!0)},handleCellDeleted(i,e){if(this.focusedId===i)if(this.view){let t=this.ensureVisibleFocusableEl(e);this.setFocusedEl(t)}else this.setFocusedEl(e)},handleCellRestored(i){this.setFocusedEl(i)},handleCellMoved(i){this.repositionJSViews(),this.focusedId===i&&bn.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),gH(document.activeElement)},handleSectionDeleted(i){this.focusedId&&!this.getFocusableEl(this.focusedId)&&this.setFocusedEl(null)},handleSectionMoved(i){this.repositionJSViews();let e=this.getSectionById(i);td(e)},handleCellUpload(i,e){this.focusedId!==i&&this.setFocusedEl(i),this.insertMode||this.setInsertMode(!0),bn.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){bn.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(){bn.broadcast("js_views",{type:"reposition"})},broadcastLocationReport(i,e){bn.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 ii.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(x3);return r?r.getAttribute("data-focusable-id"):t[0]}else{let r=pH(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=>!xf(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=>!xf(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}]`)}},Gie=G2e;var $2e={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`}},$ie=$2e;var Y2e=100,X2e={mounted(){this.props=this.getProps(),this.interval=setInterval(()=>this.updateDOM(),Y2e)},updated(){this.props=this.getProps(),this.updateDOM()},destroyed(){clearInterval(this.interval)},getProps(){return{start:vt(this.el,"data-start")}},updateDOM(){let e=(Date.now()-new Date(this.props.start))/1e3;this.el.innerHTML=`${e.toFixed(1)}s`}},Yie=X2e;var Xie="lb:user_data";function Qie(i){let e=JSON.stringify(i),t=_H(e);J2e(Xie,t,15768e4)}function Jie(){let i=Q2e(Xie);if(i){let e=bH(i);return JSON.parse(e)}else return null}function Q2e(i){let e=document.cookie.split("; ").find(t=>t.startsWith(`${i}=`));return e?e.replace(`${i}=`,""):null}function J2e(i,e,t){let n=`${i}=${e};max-age=${t};path=/${r4()}`;document.cookie=n}var Z2e={mounted(){this.el.addEventListener("submit",i=>{let e=this.el.user_form_name.value,t=this.el.user_form_hex_color.value;Qie({name:e,hex_color:t})})}},Zie=Z2e;var eCe={mounted(){this.props=this.getProps(),this.updateAttrs(),this.el.addEventListener("blur",i=>{let e=this.datetimeLocalToUtc(this.el.value);this.pushEventTo(this.props.phxTarget,"change",{html_value:e})})},updated(){this.props=this.getProps(),this.updateAttrs()},getProps(){return{utcValue:Wi(this.el,"data-utc-value",null),utcMin:Wi(this.el,"data-utc-min",null),utcMax:Wi(this.el,"data-utc-max",null),phxTarget:vt(this.el,"data-phx-target")}},updateAttrs(){this.el.value=this.datetimeUtcToLocal(this.props.utcValue),this.el.min=this.datetimeUtcToLocal(this.props.utcMin),this.el.max=this.datetimeUtcToLocal(this.props.utcMax)},datetimeUtcToLocal(i){if(!i)return null;let e=new Date(i+"Z"),t=e.getFullYear().toString(),n=(e.getMonth()+1).toString().padStart(2,"0"),r=e.getDate().toString().padStart(2,"0"),o=e.getHours().toString().padStart(2,"0"),s=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0");return`${t}-${n}-${r}T${o}:${s}:${a}`},datetimeLocalToUtc(i){if(!i)return null;let e=new Date(i),t=e.getUTCFullYear().toString(),n=(e.getUTCMonth()+1).toString().padStart(2,"0"),r=e.getUTCDate().toString().padStart(2,"0"),o=e.getUTCHours().toString().padStart(2,"0"),s=e.getUTCMinutes().toString().padStart(2,"0"),a=e.getUTCSeconds().toString().padStart(2,"0");return`${t}-${n}-${r}T${o}:${s}:${a}`}},ene=eCe;var tCe={mounted(){this.props=this.getProps(),this.updateAttrs(),this.el.addEventListener("blur",i=>{let e=this.timeLocalToUtc(this.el.value);this.pushEventTo(this.props.phxTarget,"change",{html_value:e})})},updated(){this.props=this.getProps(),this.updateAttrs()},getProps(){return{utcValue:Wi(this.el,"data-utc-value",null),utcMin:Wi(this.el,"data-utc-min",null),utcMax:Wi(this.el,"data-utc-max",null),phxTarget:vt(this.el,"data-phx-target")}},updateAttrs(){this.el.value=this.timeUtcToLocal(this.props.utcValue),this.el.min=this.timeUtcToLocal(this.props.utcMin),this.el.max=this.timeUtcToLocal(this.props.utcMax)},timeUtcToLocal(i){if(!i)return null;let e=new Date;e.setUTCHours(...i.split(":"));let t=e.getHours().toString().padStart(2,"0"),n=e.getMinutes().toString().padStart(2,"0"),r=e.getSeconds().toString().padStart(2,"0");return`${t}:${n}:${r}`},timeLocalToUtc(i){if(!i)return null;let e=new Date;e.setHours(...i.split(":"));let t=e.getUTCHours().toString().padStart(2,"0"),n=e.getUTCMinutes().toString().padStart(2,"0"),r=e.getUTCSeconds().toString().padStart(2,"0");return`${t}:${n}:${r}`}},tne=tCe;var rne=Fi(nne());var iCe={mounted(){this.props=this.getProps(),this.lineHeight=mH(this.el),this.templateEl=Ol(this.el,"[data-template]"),this.contentEl=Ol(this.el,"[data-content]"),this.capLines();let i=this.hyperListConfig();this.virtualizedList=new rne.default(this.contentEl,i),this.props.follow&&y1(this.contentEl)},updated(){this.props=this.getProps(),this.capLines();let i=this.props.follow&&vH(this.contentEl),e=this.hyperListConfig();this.virtualizedList.refresh(this.contentEl,e),i&&y1(this.contentEl)},getProps(){return{maxHeight:vt(this.el,"data-max-height",hs),follow:Wi(this.el,"data-follow",!1,Rl),maxLines:Wi(this.el,"data-max-lines",null,hs),ignoreTrailingEmptyLine:Wi(this.el,"data-ignore-trailing-empty-line",!1,Rl)}},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="...")}}},one=iCe;var nCe={mounted(){let i=en.get(),e=this.el.querySelector('[name="show_section"][value="true"]'),t=this.el.querySelector('[name="show_markdown"][value="true"]'),n=this.el.querySelector('[name="show_output"][value="true"]'),r=this.el.querySelector('[name="spotlight"][value="true"]');e.checked=i.custom_view_show_section,t.checked=i.custom_view_show_markdown,n.checked=i.custom_view_show_output,r.checked=i.custom_view_spotlight,e.addEventListener("change",o=>{en.update({custom_view_show_section:o.target.checked})}),t.addEventListener("change",o=>{en.update({custom_view_show_markdown:o.target.checked})}),n.addEventListener("change",o=>{en.update({custom_view_show_output:o.target.checked})}),r.addEventListener("change",o=>{en.update({custom_view_spotlight:o.target.checked})})}},sne=nCe;var ane={AppAuth:nH,AudioInput:EH,Cell:YQ,CellEditor:Wte,Dropzone:jte,EditorSettings:Vte,EmojiPicker:Lie,FocusOnUpdate:Mie,Headline:Nie,Highlight:Rie,ImageInput:Oie,ImageOutput:Pie,JSView:Wie,KeyboardControl:jie,MarkdownRenderer:Vie,ScrollOnUpdate:Kie,Session:Gie,TextareaAutosize:$ie,Timer:Yie,UserForm:Zie,UtcDateTimeInput:ene,UtcTimeInput:tne,VirtualizedLines:one,CustomViewSettings:sne};var lne={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 US=Fi(dne());function une(){US.default.config({barColors:{0:"#b2c1ff"},shadowColor:"rgba(0, 0, 0, .3)"}),window.addEventListener("phx:page-loading-start",()=>{US.default.show(500)}),window.addEventListener("phx:page-loading-stop",()=>{US.default.hide()})}function hne(){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.detail.content?navigator.clipboard.writeText(i.detail.content):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("phx:lb:exec_js",i=>{let e=i.detail.to||"body";document.querySelectorAll(e).forEach(t=>{window.liveSocket.execJS(t,i.detail.js)})}),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.parentElement.classList.toggle("pointer-events-none",!i),e.parentElement.classList.toggle("opacity-50",!i),t.parentElement.classList.toggle("pointer-events-none",!i),t.parentElement.classList.toggle("opacity-50",!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})}function fne(){let i=/AppleWebKit/.test(navigator.userAgent),e="ontouchstart"in window||navigator.maxTouchPoints>0;if(i&&e){let t=document.querySelector("meta[name='viewport']");t&&(t.content+=", maximum-scale=1.0")}}var lN="confirm-opted-out-ids";function pne(){return hu(lN)||[]}function mne(){window.addEventListener("phx:add_confirm_opt_out_id",i=>{let e=hu(lN)||[],t=i.detail.opt_out_id;e.push(t),wf(lN,e)})}function rCe(){let i=document.querySelector("meta[name='csrf-token']").getAttribute("content"),e=new JF(window.LIVEBOOK_BASE_URL_PATH+"/live",Db,{params:t=>({_csrf_token:i,user_data:Jie(),app_auth_token:iH(),confirm_opt_out_ids:pne()}),hooks:ane,dom:lne});une(),hne(),mne(),fne(),en.getAndSubscribe(t=>{document.body.setAttribute("data-editor-theme",t.editor_theme)}),e.connect(),window.liveSocket=e}if(oCe())rCe();else{let i=document.createElement("div");i.innerHTML=`