From 3270372f098718ee09bc3d66f7d09b8d1e6025f9 Mon Sep 17 00:00:00 2001 From: blurymind Date: Fri, 2 Aug 2024 20:35:43 +0100 Subject: [PATCH] Updates --- index.html | 4 ++-- ...ef5eb6c13b0f47d.js => main.2d01b423de482c0405ed.js} | 2 +- ...eb6c13b0f47d.js => runtime.2d01b423de482c0405ed.js} | 0 ...5eb6c13b0f47d.js => vendor.2d01b423de482c0405ed.js} | 0 public/plugins/index.js | 10 ++++++---- sw.js | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) rename js/{main.e22f7ef5eb6c13b0f47d.js => main.2d01b423de482c0405ed.js} (63%) rename js/{runtime.e22f7ef5eb6c13b0f47d.js => runtime.2d01b423de482c0405ed.js} (100%) rename js/{vendor.e22f7ef5eb6c13b0f47d.js => vendor.2d01b423de482c0405ed.js} (100%) diff --git a/index.html b/index.html index fc42d9553..7bfc341e0 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ -Yarn
 
\n

\n + add\n
\n
\n\n ';var n=e("#table"),o=e("#save-btn");this.table=n,this.rows=n.find("tr:not(:hidden)"),e("#save-btn").addClass("hide"),e(".table-add").on("click",this.tableAdd),e(".table-remove").on("click",(function(){console.log({removeThis:this}),e(this).parents("tr").detach()})),i.fn.pop=[].pop,i.fn.shift=[].shift,o.on("click",this.getValue)},this.init(),this.setValue=(e=[])=>{e.forEach(this.tableAdd)}}}.call(this,n("EVdn"),n("EVdn"))},P0sH:function(e,t,n){"use strict";(function(e,i){n.d(t,"a",(function(){return g}));var o=n("owJe"),s=n("W2Rx"),a=n("5dEm"),r=n("INAQ"),l=n("pYPP"),d=n("fkuv"),c=n("2Qx2"),p=n("oj90"),u=n("l8+o"),g=(n("+NoZ"),function(t,g){const h=this;this.utils=p.Utils,this.setTheme=function(t,n){let i=n?n.target.value:t;setTimeout(h.initGrid,50),setTimeout(h.workspace.updateArrows,50),e("#theme-stylesheet").attr("href",p.Utils.getPublicPath(`themes/${i}.css`))},this.setLanguage=function(e,t){const n=t?t.target.value:e;Object(o.load_dictionary)(h.settings.language().split("-")[0]);const i=new CustomEvent("yarnSetLanguage");i.language=n,window.dispatchEvent(i),window.parent.dispatchEvent(i)},this.log=function(e){h.settings.developmentModeEnabled()&&console.log(e)},this.setDocumentType=function(e,t){const n=t?t.target.value:e;h.settings.documentType(n),h.log("Set doc type",e,app.data.inkCompiler),"ink"===n?(null===app.data.inkCompiler&&(app.data.inkCompiler=new app.data.InkCompiler),c.a.addGlobalScopeToInkDoc(),app.setMarkupLanguage("html")):app.data.inkCompiler=null,app.updateNodeLinks();const i=new CustomEvent("yarnSetDocumentType");i.language=n,window.dispatchEvent(i),window.parent.dispatchEvent(i)},this.setMarkupLanguage=function(e,t){const n=t?t.target.value:e;app.settings.markupLanguage(n),h.richTextFormatter=new u.a(h),h.mustRefreshNodes.notifySubscribers()},this.setGistPluginsFile=function(e,t){const n=t?t.target.value:e;app.settings.gistPluginsFile(n)},this.setFiletypeVersion=function(e,t){const n=t?t.target.value:e;h.filetypeVersion=n},this.setGistCredentials=function(e,t){const{token:n,file:i}=e;c.a.storage.setCredentials(n,i)},this.input=new r.a(h),this.settings=new l.a(h),this.workspace=new a.a(h),this.ui=new d.a(h),this.richTextFormatter=new u.a(h),this.data=c.a,this.name=i.observable(t),this.version=i.observable(g),this.editing=i.observable(null),this.nodes=i.observableArray([]),this.tags=i.observableArray([]),this.mustRefreshNodes=i.observable(),this.mustUpdateTags=!0,this.nodeHistory=[],this.nodeFuture=[],this.editingHistory=[],this.editingSaveHistoryTimeout=null,this.focusedNodeIdx=-1,this.isElectron=!1,this.editor=null,this.nodeVisitHistory=[],this.plugins={pluginStorage:{}},this.clipboard="",this.nodeClipboard=[],this.speachInstance=null,this.editingPath=i.observable(null),this.$searchField=e(".search-field"),this.isEditorInPreviewMode=!1,this.isEditorInPlayMode=i.observable(!1),this.isEditorSplit=!1,this.isEditorFocused=!1,this.editorResizeHandleOptions={handleSelector:"#editor-resize-handle",resizeHeight:!1,resizeWidthFrom:"right",onDragStart:function(){h.isSplitEditorInFocus=!0,e("#node-editor").removeClass("split-editor-out-of-focus")},onDragEnd:function(){h.editor.resize(),h.settings.editorSplitSize(e("#editor-form").width())}},this.inEditor=()=>(h.editing()||h.isEditorSplit&&h.isEditorFocused)&&!h.ui.isDialogOpen(),this.inWorkspace=()=>(!h.editing()||h.isEditorSplit&&!1===h.isEditorFocused)&&!h.ui.isDialogOpen(),this.run=function(){var t="Unknown OS";-1!=navigator.platform.indexOf("Win")&&(t="Windows"),-1!=navigator.platform.indexOf("Mac")&&(t="MacOS"),-1!=navigator.platform.indexOf("X11")&&(t="UNIX"),-1!=navigator.platform.indexOf("Linux")&&(t="Linux"),-1!=navigator.platform.indexOf("Linux")&&(t="Linux"),h.isElectron=navigator.userAgent.toLowerCase().includes("electron");var n=navigator.userAgent||navigator.vendor||window.opera;let o;/android|iPad|iPhone|iPod/.test(n.toLowerCase())&&!window.MSStream&&(t="mobile"),"Windows"==t&&(h.workspace.zoomSpeed=.1),window.addEventListener("beforeunload",e=>(this.data.saveAppStateToLocalStorage(),null)),window.addEventListener("DOMContentLoaded",e=>{if(h.electron){const e=h.electron.remote.process.argv.length>1?h.electron.remote.process.argv[1]:null;if(e&&app.fs.existsSync(e))return void this.data.openFileFromFilePath(e)}this.data.loadAppStateFromLocalStorage();const t=new URL(window.location),n=t.searchParams.get("text")||t.searchParams.get("url");null!==n&&h.insertTextAtCursor(n+"\n",!0)});const s=e("#addPwa")[0];s.style.display="none",window.addEventListener("beforeinstallprompt",e=>{e.preventDefault(),o=e,s.style.display="block",s.addEventListener("click",e=>{s.style.display="none",o.prompt(),o.userChoice.then(e=>{"accepted"===e.outcome?(h.log("User accepted the A2HS prompt"),s.style.display="none"):h.log("User dismissed the A2HS prompt"),o=null})})}),e("#app").show(),i.applyBindings(h,e("#app")[0]),h.editingVisualStudioCodeFile()||h.newNode().title("Start"),h.settings.apply(),e(".search-title input").click(h.updateSearch),e(".search-body input").click(h.updateSearch),e(".search-tags input").click(h.updateSearch),h.$searchField.on("input",h.updateSearch),h.$searchField.on("keyup",(function(e){27==e.keyCode?h.clearSearch():h.searchWarp()})),"mobile"===t&&h.workspace.setZoom(3),e(window).on("resize",(function(){h.ui.isScreenNarrow()&&h.editing()&&h.isEditorSplit&&h.toggleEditorView(),h.workspace.updateArrows(),h.initGrid()})),setTimeout(h.initGrid,50),this.guessPopUpHelper=function(){/color=#([a-zA-Z0-9]{3,6})$/.test(h.getTagBeforeCursor())&&h.insertColorCode()},this.insertEmoji=function(){this.emPicker.toggle(),h.togglePreviewMode(!0),e("#emojiPicker-container").css({left:h.input.mouse.x-200,top:h.input.mouse.y-125}),e("#emojiPicker-container").show()},this.insertColorCode=function(){e("#colorPicker-container").is(":visible")||(e("#colorPicker").spectrum("set",h.editor.getSelectedText()),e("#colorPicker").spectrum("toggle"),e("#colorPicker-container").css({left:h.input.mouse.x-70,top:h.input.mouse.y-50}),e("#colorPicker-container").show(),h.togglePreviewMode(!0),setTimeout(()=>{const t=e("#colorPicker").spectrum("get");h.applyPickerColorEditor(t)},100))},this.applyPickerColorEditor=function(e){const t=JSON.parse(JSON.stringify(h.editor.selection.getRange()));h.editor.selection.setRange(t);const n=e.toHexString().replace("#","");h.editor.session.replace(t,n),h.editor.selection.setRange({start:h.editor.getCursorPosition(),end:{row:h.editor.getCursorPosition().row,column:h.editor.getCursorPosition().column-n.length}}),h.togglePreviewMode(!0)},document.addEventListener("contextmenu",(function(e){h.editing()&&e.preventDefault()}),!1),document.ondragover=document.ondrop=e=>{e.preventDefault()},document.body.ondrop=e=>{e.preventDefault();for(var t=0;t{const t=e.data;switch(t.type){case"UpdateNode":h.nodes().forEach(e=>{e.title().trim()===t.payload.originalNodeTitle.trim()&&(e.title(t.payload.title),e.tags(t.payload.tags),e.body(t.payload.body),h.setYarnDocumentIsDirty())})}});var a=new CustomEvent("yarnReady");a.document=document,a.data=c.a,a.app=this,window.dispatchEvent(a),window.parent.dispatchEvent(a);const r=new URLSearchParams(window.location.href.split("?")[1]),l=r.get("gist"),d=r.get("fileName");l&&d&&fetch("https://api.github.com/gists/"+l).then(e=>e.json()).then(e=>{const t=e.files[d].content;c.a.openGist(t,d)})},this.limitNodesUpdate=function(e){h.nodes.extend({rateLimit:{method:"notifyWhenChangesStop",timeout:250}}),e(),h.nodes.limit(e=>()=>e())},this.getNodesConnectedTo=function(e){var t=[],n=h.nodes();for(var i in n)if(n[i]!=e&&n[i].isConnectedTo(e,!0)){var o=!1;for(var s in t)if(t[s]==n[i]){o=!0;break}o||t.push(n[i])}return t},this.matchConnectedColorID=function(e){var t=h.getNodesConnectedTo(e);for(var n in t)t[n].colorID(e.colorID())},this.quit=function(){h.isElectron},this.canEditNodeMeta=function(e){return"ink"!==app.settings.documentType()||e.trim()!==c.a.InkGlobalScopeNodeName},this.sanitiseNodeTitle=function(){"ink"===app.settings.documentType()&&(app.editing().title().startsWith("function ")||app.editing().title(app.editing().title().replace(/[ ]/g,"_")))},this.validateTitle=function(){var t=document.getElementById("editorTitle").value,n=e("#editorTitle");h.getOtherNodeTitles().includes(t)||h.titleExistsTwice(t)?(n.attr("class","title title-error"),n.attr("title","Another node has the same title")):"yarn"!==app.settings.documentType()||RegExp("^[a-z0-9]+$","i").test(t)?(n.removeAttr("title"),n.removeClass("title-error")):(n.attr("class","title title-error"),n.attr("title","Only upper or lower case letters and numbers are allowed in a node title."))},this.refreshWindowTitle=function(){let e="";"LOCAL"===app.settings.lastStorageHost()?e="Yarn - "+(c.a.editingPath()||c.a.editingName())+" "+(c.a.isDocumentDirty()?"*":""):"GIST"===app.settings.lastStorageHost()&&(e="Gist - "+(c.a.editingPath()||c.a.editingName())+" "+(c.a.isDocumentDirty()?"*":"")),h.electron?h.electron.remote.getCurrentWindow().setTitle(e):document.title=e},this.usingVisualStudioCodeExtension=function(){return!!window.vsCodeApi},this.editingVisualStudioCodeFile=function(){return!0===window.editingVsCodeFile},this.setYarnDocumentIsDirty=function(){h.usingVisualStudioCodeExtension()&&h.editingVisualStudioCodeFile()&&c.a.getSaveData(c.a.editingType()).then(e=>{window.vsCodeApi.postMessage({type:"DocumentEdit",payload:e})})},this.recordNodeAction=function(e,t){if(h.nodeFuture.length>0){for(var n=0;n=0&&h.nodes.splice(t,1),h.updateNodeLinks()}var n=null;if(n="undo"==e?h.nodeHistory.pop():h.nodeFuture.pop()){var i=n.action,o=n.node;"undo"==e?("created"==i?(n.lastX=o.x(),n.lastY=o.y(),t(o)):"removed"==i&&h.recreateNode(o,n.lastX,n.lastY),h.nodeFuture.push(n),h.setYarnDocumentIsDirty()):("created"==i?h.recreateNode(o,n.lastX,n.lastY):"removed"==i&&t(o),h.nodeHistory.push(n),h.setYarnDocumentIsDirty())}},this.recreateNode=function(e,t,n){h.nodes.push(e),e.moveTo(t,n),h.updateNodeLinks()},this.setSelectedColors=function(e){var t=h.workspace.getSelectedNodes();for(var n in t.splice(t.indexOf(e),1),t)t[n].colorID(e.colorID())},this.pasteNodes=function(){h.nodeClipboard.length&&(h.workspace.deselectAll(),h.nodeClipboard.forEach((function(e){var t=new s.a({title:h.getUniqueTitle(e.title()),body:e.body(),tags:e.tags(),colorID:e.colorID(),x:e.createX,y:e.createY});h.nodes.push(t),h.workspace.selectNodes(t),h.recordNodeAction("created",t)})),h.updateNodeLinks())},this.confirmDeleteNodes=function(e){const t=Array.isArray(e)?void 0:e,n=Array.isArray(e)?[...e]:t&&t.selected?[...h.workspace.getSelectedNodes()]:[e];n.length&&Swal.fire({title:"Are you sure?",text:`${n.length} ${1===n.length?"node":"nodes"} will be deleted.`,icon:"warning",showCancelButton:!0,confirmButtonText:"Yes, delete!",cancelButtonText:"No, cancel!",reverseButtons:!0}).then(e=>{e.value&&h.deleteNodes(n)})},this.deleteNodes=function(e){const t=Array.isArray(e)?e:[e],n=[];for(let e=t.length-1;e>=0;--e)n.push(t[e].remove());Promise.all(n).then(()=>{h.limitNodesUpdate(()=>{for(let e=t.length-1;e>=0;--e)h.inEditor()&&h.editing()===t[e]&&h.closeEditor(),h.deleteNode(t[e]);h.updateNodeLinks(),h.workspace.deselectNodes(t),h.workspace.updateArrows()})})},this.deleteNode=function(e){const t=h.nodes.indexOf(e);t>=0&&(h.recordNodeAction("removed",e),h.nodes.splice(t,1)),h.setYarnDocumentIsDirty()},this.cloneNodeArray=function(e){return e.map((function(e){return new s.a({title:e.title(),body:e.body(),tags:e.tags(),colorID:e.colorID(),x:e.x()+10,y:e.y()+10})}))},this.newNode=function(e=!0){var t=new s.a;return h.nodes.push(t),e&&h.updateNodeLinks(),h.recordNodeAction("created",t),t},this.newNodeAt=function(e,t){var n=new s.a({x:e-100,y:t-100});return h.nodes.push(n),h.updateNodeLinks(),h.recordNodeAction("created",n),n},this.searchTextInEditor=function(e=!0){e?h.editor.execCommand("find"):h.editor.searchBox&&h.editor.searchBox.hide()},this.showRandomQuote=function(){e.ajax({url:"https://api.forismatic.com/api/1.0/?",dataType:"jsonp",data:"method=getQuote&format=jsonp&lang=en&jsonp=?",success:function(e){Swal.fire({text:e.quoteText+"\n\n-"+e.quoteAuthor})}})},this.editNode=function(t,n=!0){if(!n&&!t.active())return;if(h.settings.alwaysOpenNodesInVisualStudioCodeEditor())return void h.editNodeInVisualStudioCodeEditor(t);h.editing()&&h.editing()!==t&&h.saveNode(!1),h.isEditorInPlayMode()&&h.togglePlayMode(!1),h.isEditorInPreviewMode&&h.togglePreviewMode(!1),t.oldTitle=t.title(),h.editing(t),h.mustUpdateTags=!0,e("#node-editor-background").css({opacity:0}).transition({opacity:1},250),e("#node-editor").css({y:"-100",opacity:0}).transition({y:"0",opacity:1},250),h.editor=ace.edit("editor"),h.editor.setOptions({scrollPastEnd:.5}),h.editor.focus(),h.editor.navigateFileEnd(),e("#colorPicker").spectrum({flat:!0,showButtons:!1,showInput:!0,showPalette:!0,preferredFormat:"hex",palette:[["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"],["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"],["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"]],move:function(e){h.applyPickerColorEditor(e)},clickoutFiresChange:!0});const i=ace.require("ace/ext/language_tools"),s=p.Utils.createAutocompleter("ink"===app.settings.documentType()?["divert.target"]:["string.llink","string.rlink"],app.getOtherNodeTitles().map(e=>{const n=h.getNodeByTitle(e);return{word:e,title:e,about:`${n.tags().length>0?`tags: ${n.tags()}
`:""}Preview:
${n.clippedBody()}`,titleStyle:t.titleStyles[n.colorID()]}}),"Node Link");i.setCompleters([s,i.keyWordCompleter,i.textCompleter,i.snippetCompleter]);let a=void 0;h.editor.getSession().on("change",(function(e){const t=h.settings.autoCloseTags();if("insert"===e.action&&t){if(h.richTextFormatter.justInsertedAutoComplete)return void(h.richTextFormatter.justInsertedAutoComplete=!1);a&&clearTimeout(a),a=setTimeout(()=>{a=void 0,h.richTextFormatter.completableTags.forEach(e=>{if(h.getTagBeforeCursor()===e.Start){h.richTextFormatter.justInsertedAutoComplete=!0;let t=e.Completion,n=e.Offset;h.settings.autoCloseBrackets()&&e.BehaviorCompletion&&(t=e.BehaviorCompletion,n+=1),e.Completion&&h.insertTextAtCursor(t),e.Offset&&h.moveEditCursor(n),e.Func&&e.Func()}})},200)}})),this.emPicker=new EmojiPicker(document.getElementById("emojiPickerDom"),e=>{h.insertTextAtCursor(e.char),this.emPicker.toggle(),h.togglePreviewMode(!1)}),Object(o.enable_spellcheck)(),h.toggleInvertColors(),h.toggleShowCounter(),h.toggleSpellCheck(),h.validateTitle(),h.updateEditorStats(),h.updateEditorOptions(),h.$searchField.val().length>0&&e(".search-body input").is(":checked")&&h.editor.findAll(h.$searchField.val()),h.settings.editorSplit()&&(h.splitEditor(),h.workspace.warpToNodeByIdx(t.index()-1)),"right"===h.settings.editorSplitDirection()?(e("#editor-form").addClass("split-editor-right"),e("#editor-resize-handle").addClass("float-right")):(e("#editor-form").removeClass("split-editor-right"),e("#editor-resize-handle").removeClass("float-right")),e(".node-editor").on("pointerdown","> *",(function(e){h.isEditorSplit&&(h.focusEditor(!0),e.stopPropagation())})),e(".app-info").hide(),h.editor.resize(),null!=t.undoManager&&h.editor.session.setUndoManager(t.undoManager);var r=new CustomEvent("yarnEditorOpen");r.document=document,r.data=c.a,r.app=app,window.dispatchEvent(r),window.parent.dispatchEvent(r)},this.splitEditor=function(){h.isEditorSplit=!0,h.focusEditor(!0),h.settings.editorSplit(!0),h.editorResizeHandleOptions.resizeWidthFrom="right"===h.settings.editorSplitDirection()?"left":"right",e("#editor-form").width(h.settings.editorSplitSize()).addClass("split-editor").toggleClass("split-editor-right","right"===h.settings.editorSplitDirection()).resizable(h.editorResizeHandleOptions),e("#node-editor-background").addClass("hidden"),e("#node-editor").css({"z-index":10002}),e("#editor-resize-handle").removeClass("hidden").toggleClass("float-right","right"===h.settings.editorSplitDirection()),e("#split-editor-button").addClass("hidden"),e("#snap-editor-button").removeClass("hidden"),e("#exit-editor").removeClass("hidden"),e("#full-size-editor-button").removeClass("hidden"),e("#split-button-separator").removeClass("hidden"),h.ui.checkAndMoveAppButtons()},this.toggleEditorView=function(){h.settings.editorSplit(!h.settings.editorSplit()),h.reopenEditor()},this.reopenEditor=function(){h.saveNode();let e=h.editing();h.closeEditor(),setTimeout(()=>{h.editNode(e)},250)},this.editorSnapToggle=function(){h.settings.editorSplitDirection("right"===h.settings.editorSplitDirection()?"left":"right"),h.reopenEditor()},this.focusEditor=function(t){!0===t?(e("#node-editor").removeClass("split-editor-unfocused"),h.isEditorFocused=!0):(e("#node-editor").addClass("split-editor-unfocused"),h.isEditorFocused=!1)},this.getSplitEditorXOffset=function(){let t=0;return h.inEditor()&&h.settings.editorSplit()&&(t=e("#editor-form").width()/2,"right"===h.settings.editorSplitDirection()&&(t*=-1)),t},this.editNodeInVisualStudioCodeEditor=function(e){h.usingVisualStudioCodeExtension()?(h.setYarnDocumentIsDirty(),window.vsCodeApi.postMessage({type:"OpenNode",payload:{title:e.title().trim(),tags:e.tags().trim(),body:h.trimBodyLinks(e.body().trim())}})):console.error("Tried to open node in Visual Studio Code text editor but we're not in the Visual Studio Code extension")},this.chooseRelativePathImage=function(e){h.insertTextAtCursor(e)},this.getNodeByTitle=function(e){return h.nodes().find(t=>t.title().trim().toLowerCase()===e.trim().toLowerCase())},this.openNodeByTitle=function(e,t=""){h.isEditorInPlayMode()&&h.togglePlayMode(),h.makeNodeWithName(e);const n=h.nodes().find(t=>t.title().trim().toLowerCase()===e.trim().toLowerCase());n&&(h.editNode(n,!0),t&&setTimeout(()=>h.editor.find(t),200))},this.openLastEditedNode=function(){if(0===h.nodeVisitHistory.length)h.saveNode(),h.closeEditor();else{const e=h.nodeVisitHistory.pop();h.propagateUpdateFromNode(h.editing()),h.openNodeByTitle(e)}},this.getSpellCheckSuggestionItems=function(){var e=Object(o.suggest_word_for_misspelled)(h.editor.getSelectedText());if(e){var t={};return e.forEach(e=>{t[e]={name:e,icon:"edit",callback:e=>{h.insertTextAtCursor(e)}}}),t}return!1},this.getThesaurusItems=function(){var e=n("GLdW")(h.editor.getSelectedText());if(!e)return!1;var t=[];if(Object.keys(e).forEach((function(n){e[n].forEach((function(e){t.includes(e)||e===n||t.push(e)}))})),t.length>0){var i={};return t.forEach(e=>{i[e]={name:e,icon:"edit",callback:e=>{h.insertTextAtCursor(e)}}}),i}return!1},this.toggleSpellCheck=function(){setTimeout((function(){h.settings.spellcheckEnabled()?Object(o.enable_spellcheck)():Object(o.disable_spellcheck)()}),50)},this.toggleInvertColors=function(){const t=h.settings.invertColorsEnabled()?{filter:"invert(100%)"}:{filter:"invert(0%)"};e("#app").css(t),e("#app-bg").css(t),e(".tooltip").css(t),e(".node .body").css(t),e(".editor-container .editor-preview").css(t)},this.initGrid=function(){if(h.settings.snapGridEnabled()){var t=e(window).width(),n=e(window).height();e("#grid-canvas").attr("width",t),e("#grid-canvas").attr("height",n),e("#gridSize").attr("disabled",!1),h.workspace.gridContext.strokeStyle=h.workspace.gridContext.fillStyle=e(".grid-canvas").css("color")}else e("#gridSize").attr("disabled",!0);app.workspace.updateGrid()},this.toggleShowCounter=function(){h.settings.editorStatsEnabled()?e(".node-editor .form .editor-counter").css({display:"initial"}):e(".node-editor .form .editor-counter").css({display:"none"})},this.toggleAutocompleteSuggestions=function(){h.settings.autocompleteSuggestionsEnabled(!h.settings.autocompleteSuggestionsEnabled()),h.updateEditorOptions()},this.toggleAutoCloseBrackets=function(){h.settings.autoCloseBrackets(!h.settings.autoCloseBrackets()),h.updateEditorOptions()},this.updateEditorOptions=function(){h.editor.setOptions({enableBasicAutocompletion:app.settings.autocompleteSuggestionsEnabled(),enableLiveAutocompletion:app.settings.autocompleteSuggestionsEnabled(),behavioursEnabled:app.settings.autoCloseBrackets()})},this.togglePreviewMode=function(t){const n=e(".editor")[0],i=e("#editor-preview")[0];h.isEditorInPreviewMode=t,app.ui.dispatchEvent("yarnInPreviewMode"),t?(e(".bbcode-toolbar").addClass("hidden"),n.style.display="none",i.style.display="block",i.innerHTML=h.richTextFormatter.richTextToHtml(h.editing().body(),!0),i.scrollTop=h.editor.renderer.scrollTop):(e(".bbcode-toolbar").removeClass("hidden"),h.editor.session.setScrollTop(i.scrollTop),i.innerHTML="",i.style.display="none",n.style.display="flex",h.editor.focus(),h.editor.resize(),e("#colorPicker-container").is(":visible")&&e("#colorPicker-container").hide(),e("#emojiPicker-container").is(":visible")&&e("#emojiPicker-container").hide())},this.appendText=function(e){h.editing().body(h.editing().body()+e);const t=h.editor.session.getLength()-1,n=h.editor.session.getLine(t).length;h.editor.gotoLine(t+1,n)},this.moveEditCursor=function(e){const t=h.editor.getCursorPosition();h.editor.gotoLine(t.row+1,t.column+e),h.editor.focus()},this.insertTextAtCursor=function(e,t=!1){if(!h.editing())return;h.editor.session.replace(h.editor.selection.getRange(),"");const n=h.editor.getCursorPosition();if(h.editor.session.insert(n,e),t){const e=h.editor.getCursorPosition();editor.scrollToLine(e.row,!0,!0,(function(){})),h.editor.focus()}h.updateEditorStats(),h.editor.focus()},this.getTagBeforeCursor=function(){const e=h.editor.getSelectionRange(),t=e.start.row,n=h.editor.session.getLine(t).substring(e.start.column-2,e.start.column+2);if(!n)return"";if("ink"===app.settings.documentType()){if(["->"].includes(n.trim()))return n.trim()}else if(["[[","<<"].includes(n.trim())||n.includes("|"))return n.trim();return h.richTextFormatter.identifyTag(n)},this.saveNode=function(){const t=h.editing();if(t){const n=e("#editorTitle")[0],i=h.getFutureEditedNodeTitle();n.value=i,t.title(i),t.body(h.trimBodyLinks(t.body().trim())),h.makeNewNodesFromLinks(),h.propagateUpdateFromNode(t),h.workspace.updateArrows(),setTimeout(h.updateSearch,600),h.setYarnDocumentIsDirty(),app.ui.dispatchEvent("yarnSavedNode")}},this.closeEditor=function(){h.editing().undoManager=h.editor.session.getUndoManager(),e("#node-editor-background").transition({opacity:0},250),e("#node-editor").transition({y:"-100",opacity:0},250,(function(e){h.editing(null),h.editor.destroy(),h.editor=null,this.emPicker=null})),h.isEditorSplit=!1,h.isEditorFocused=!1,e(".app-info").show(),app.ui.resetAppButtonsLocation(),h.isEditorInPlayMode()&&h.togglePlayMode(!1),h.isEditorInPreviewMode&&h.togglePreviewMode(!1)},this.convertMarkup=function(){h.nodes().forEach(e=>{e.body(h.richTextFormatter.convert(e.body()))})},this.updateSearch=p.Utils.debounce((function(){const t=app.$searchField.val().toLowerCase();for(var n=0;n{n.includes(e)||t.push(e)}),e.linkedFrom().forEach(e=>{n.includes(e)||t.push(e)}))},this.updateTagsRepository=p.Utils.debounce((function(){if(!app.mustUpdateTags)return;app.mustUpdateTags=!1;h.tags().forEach(e=>e.count=0),h.nodes().forEach(e=>{p.Utils.uniqueSplit(e.tags()," ").forEach(e=>{const t=h.tags().find(t=>t.text==e);if(t)++t.count;else{const t=(()=>{const e=h.tags().map(e=>e.id);for(let t=1;;++t)if(!e.includes(t))return t})();h.tags.push({id:t,style:"tag-style-"+t,text:e,count:1})}})});let e=h.tags().length;for(;e--;)0===h.tags()[e].count&&h.tags().splice(e,1)}),500),this.makeNewNodesFromLinks=function(){if(!h.settings.createNodesEnabled())return console.info("Autocreate new nodes disabled");var e=h.editing().getLinksInNode();if(null!=e)for(var t=0;t0&&!n.includes(e)&&e!=h.editing().title()&&h.newNodeAt(h.editing().x()+t,h.editing().y()-120).title(e)},this.titleExistsTwice=function(e){return h.nodes().filter(t=>t.title().trim()===e.trim()).length>1},this.getFutureEditedNodeTitle=function(){const t=e("#editorTitle")[0];return h.getUniqueTitle(t.value.trim())},this.getOtherNodeTitles=function(){const e=[];return h.nodes().forEach(t=>{if(!h.editing()||t.title()!==h.editing().title()){if("ink"===app.settings.documentType()&&t.title().trim()===c.a.InkGlobalScopeNodeName)return;e.push(t.title().trim())}}),e},this.getHighlightedText=function(t){t=(t=(t=(t=(t=(t=(t=(t=t.replace(/\/g,">")).replace(/\<\<(.*?)\>\>/g,'

<<

$1

>>

')).replace(/\[\[([^\|]*?)\]\]/g,'

[[

$1

]]

')).replace(/\[\[([^\[\]]*?)\|([^\[\]]*?)\]\]/g,'

[[

$1

|

$2

]]

')).replace(/[^:]\/\/(.*)?($|\n)/g,'//$1\n')).replace(/\/\*((.|[\r\n])*)?\*\//gm,'/*$1*/')).replace(/\/\%((.|[\r\n])*)?\%\//gm,'/%$1%/');var n=e("
");return n[0].innerHTML=t,n.find(".comment").each((function(){e(this).find("p").each((function(){e(this).removeClass()}))})),n.find(".linkname").each((function(){var t=e(this).text(),n=!1;for(var i in h.nodes())if(h.nodes()[i].title().toLowerCase()==t.toLowerCase()){n=!0;break}n||e(this).removeClass("linkname")})),t=n[0].innerHTML},this.updateLineNumbers=function(t){for(var n=t.split("\n"),i="",o=0;o0)&&(i+=o+1+"
");e(".editor-container .lines").html(i)},this.moveNodes=function(e,t){for(var n in h.nodes()){var i=h.nodes()[n];i.moveTo(i.x()+e,i.y()+t)}},this.getFirstFoundNode=function(e){return h.nodes().find(t=>t.title().toLowerCase().trim()===e)},this.searchWarp=function(){var e=h.$searchField.val().toLowerCase().trim();if(""===e)h.workspace.warpToNodeByIdx(0);else{const t=h.getFirstFoundNode(e);h.workspace.warpToNodeByIdx(h.nodes.indexOf(t))}},this.clearSearch=function(){h.$searchField.val(""),h.updateSearch()},this.updateEditorStats=function(){var t=h.editor.getSession().getValue(),n=h.editor.getCursorPosition(),i=t.split("\n");e(".editor-counter .character-count").html(t.length),e(".editor-counter .line-count").html(i.length),e(".editor-counter .row-index").html(n.row),e(".editor-counter .column-index").html(n.column),c.a.saveAppStateToLocalStorage()},this.getUniqueTitle=function(e){var t=h.getOtherNodeTitles();if(e&&!t.includes(e))return e;var n=e||"Node",i=2;const o=n.match(/^(.*)(_([0-9]+))$/);if(o&&4===o.length&&(n=o[1],i=Number(o[3])),!t.includes(n))return n;for(;;++i){var s=n+"_"+i;if(!t.includes(s))return s}},this.navigateToNodeDuringPlayTest=function(e,t=""){h.openNodeByTitle(e,t),h.togglePlayMode(!0),app.workspace.warpToNode(app.getFirstFoundNode(e))}})}).call(this,n("EVdn"),n("Z1dp"))},"P85/":function(e,t,n){},W2Rx:function(e,t,n){"use strict";(function(e,i){n.d(t,"a",(function(){return a}));var o=n("oj90");let s=0;let a=function(t={}){const n=this;this.titleStyles=["title-style-1","title-style-2","title-style-3","title-style-4","title-style-5","title-style-6","title-style-7","title-style-8","title-style-9"],this.index=e.observable(s++),this.title=e.observable(t.title||app.getUniqueTitle()),this.tags=e.observable(t.tags||""),this.body=e.observable(t.body||""),this.active=e.observable(t.active||!0),this.width=200,this.height=200,this.tempOpacity=null,this.style=null,this.colorID=e.observable(t.colorID||0),this.checked=!1,this.selected=!1,this.createX=t.x||null,this.createY=t.y||null,this.undoManager=null,this.clippedTags=e.computed((function(){return app.updateTagsRepository(),o.Utils.uniqueSplit(n.tags()," ").map(e=>app.tags().find(t=>t.text===e)).filter(e=>e)}),this),this.clippedBody=e.computed((function(){if(app.ui.isScreenNarrow()&&app.editing())return;app.mustRefreshNodes();let e=app.getHighlightedText(this.body());return e=app.richTextFormatter.richTextToHtml(e),e=e.substr(0,225),e}),this),this.linkedTo=e.observableArray(),this.linkedFrom=e.observableArray(),this.element=null,this.canDoubleClick=!0,this.create=function(){if(n.style=window.getComputedStyle(i(n.element).get(0)),n.createX&&n.createY)n.x(n.createX),n.y(n.createY);else{let e=i(n.element).parent();n.x((-e.offset().left+i(window).width()/2-100)/app.workspace.scale),n.y((-e.offset().top+i(window).height()/2-100)/app.workspace.scale)}app.workspace.bringToFront(n.element),app.workspace.startUpdatingArrows(),i(n.element).css({opacity:0,scale:.8,y:"-=80px",rotate:"45deg"}).transition({opacity:1,scale:1,y:"+=80px",rotate:"0deg"},250,"easeInQuad",(function(){app.workspace.stopUpdatingArrows(),app.workspace.updateArrows()})),n.drag(),i(n.element).on("dblclick",(function(){n.canDoubleClick&&app.editNode(n)})),o.Utils.addDoubleTapDetector(n.element,(function(){n.canDoubleClick&&app.editNode(n)})),i(n.element).on("click",(function(e){e.ctrlKey&&(n.selected?app.workspace.deselectNodes(n):app.workspace.selectNodes(n))}))},this.setSelected=function(e){n.selected=e,n.selected?i(n.element).addClass("selected"):i(n.element).removeClass("selected")},this.toggleSelected=function(){n.setSelected(!n.selected)},this.x=function(e){if(null!=e&&i(n.element).css({x:Math.floor(e)}),n.style)return Math.floor(new WebKitCSSMatrix(n.style.webkitTransform).m41)},this.y=function(e){if(null!=e&&i(n.element).css({y:Math.floor(e)}),n.style)return Math.floor(new WebKitCSSMatrix(n.style.webkitTransform).m42)},this.resetDoubleClick=function(){n.canDoubleClick=!0},this.cycleColorDown=function(){n.doCycleColorDown(),setTimeout(n.resetDoubleClick,500),n.canDoubleClick=!1,app.input.isShiftDown&&app.matchConnectedColorID(n),n.selected&&app.setSelectedColors(n),app.setYarnDocumentIsDirty()},this.cycleColorUp=function(){n.doCycleColorUp(),setTimeout(n.resetDoubleClick,500),n.canDoubleClick=!1,app.input.isShiftDown&&app.matchConnectedColorID(n),n.selected&&app.setSelectedColors(n),app.setYarnDocumentIsDirty()},this.doCycleColorDown=function(){n.colorID(n.colorID()-1),n.colorID()<0&&n.colorID(8)},this.doCycleColorUp=function(){n.colorID(n.colorID()+1),n.colorID()>8&&n.colorID(0)},this.remove=async function(){return new Promise((e,t)=>{i(n.element).transition({opacity:0,scale:.8,y:"-=80px",rotate:"-45deg"},250,"easeInQuad",e)})},this.drag=function(){const e={x:0,y:0};let t=!1,o=!1;i(document.body).on("mousemove touchmove",(function(i){if(t){const t=app.input.isScreenTouched&&i.changedTouches?i.changedTouches[0].pageX:i.pageX,s=app.input.isScreenTouched&&i.changedTouches?i.changedTouches[0].pageY:i.pageY;let{x:a,y:r}=app.workspace.toWorkspaceCoordinates(t,s);a-=e.x,r-=e.y;let l=a-n.x(),d=r-n.y();const c=app.workspace.getSelectedNodes();if(("mousemove"===i.originalEvent.type||c.includes(n)&&"touchmove"===i.originalEvent.type)&&(n.x(a),n.y(r)),o&&(n.selected?c.splice(c.indexOf(n),1):c=app.getNodesConnectedTo(n),c.length>0))for(let e in c)c[e].active()&&(c[e].x(c[e].x()+l),c[e].y(c[e].y()+d));app.workspace.updateArrows()}})),i(n.element).on("pointerdown",(function(i){if(!t&&n.active()&&0===i.button){t=!0,(app.input.isShiftDown||n.selected)&&(o=!0);const{x:s,y:a}=app.workspace.toWorkspaceCoordinates(i.pageX,i.pageY);e.x=app.settings.snapGridEnabled()?app.workspace.stepify(s-n.x(),app.settings.gridSize()):s-n.x(),e.y=app.settings.snapGridEnabled()?app.workspace.stepify(a-n.y(),app.settings.gridSize()):a-n.y()}})),i(n.element).on("touchend",(function(e){app.workspace.selectNodes(n)})),i(document).on("pointerup touchend",(function(){(t||o)&&(t=!1,o=!1,app.setYarnDocumentIsDirty())}))},this.moveTo=function(e,t){app.workspace.startUpdatingArrows(),i(n.element).clearQueue(),i(n.element).transition({x:e,y:t},app.stopUpdatingArrows,500)},this.isConnectedTo=function(e,t){if(t&&e.isConnectedTo(n,!1))return!0;let i=n.linkedTo();for(let t in i){if(i[t]==e)return!0;if(i[t].isConnectedTo(e,!1))return!0;if(e.isConnectedTo(i[t],!1))return!0}return!1},this.getLinksInNode=function(e){const t="yarn"===app.settings.documentType();let i=(e||n).body().match(t?/\[\[(.*?)\]\]/g:/\-\>(.*)/g);if(null!=i){let e={};for(let n=i.length-1;n>=0;n--)t?(i[n]=i[n].substr(2,i[n].length-4).trim(),i[n].indexOf("|")>=0&&(i[n]=i[n].split("|")[1]),null!=e[i[n]]&&i.splice(n,1),e[i[n]]=!0):i[n]=i[n].substr(2,i[n].length).trim();return i}},this.updateLinks=function(){n.resetDoubleClick(),n.updateLinksFromParents(),n.updateLinksToChildren()},this.updateLinksFromParents=function(){n.oldTitle&&n.oldTitle!==n.title()&&(n.linkedFrom.removeAll(),app.nodes().forEach(e=>{const t=n.getLinksInNode(e);if(t)if(t.includes(n.oldTitle)){const t=RegExp("\\|\\s*"+n.oldTitle+"\\s*\\]\\]","g"),i=RegExp("\\[\\[\\s*"+n.oldTitle+"\\s*\\]\\]","g");let o=e.body().replace(t,"|"+n.title()+"]]");o=o.replace(i,"[["+n.title()+"]]"),e.body(o),n.linkedFrom.push(e)}else t.includes(n.title())&&n.linkedFrom.push(e)}),n.oldTitle=void 0)},this.updateLinksToChildren=function(){n.linkedTo.removeAll();let e=n.getLinksInNode();if(e)for(let t in app.nodes()){let i=app.nodes()[t];for(let t=0;t{t.plugins[e.name]=e},r=e=>(n.pluginStorage||(n.pluginStorage={}),n.pluginStorage[e]||(n.pluginStorage={...n.pluginStorage,[e]:{}}),this.pluginStorage[e]);window.addEventListener("yarnLoadedData",e=>{if(null!==t.data.documentHeader()){const e=t.data.documentHeader();"pluginStorage"in e&&(n.pluginStorage=e.pluginStorage)}}),window.addEventListener("newYarnFileStarted",e=>{n.pluginStorage={}});const l={app:t,createButton:(e,{name:t,iconName:n,onClick:i,attachTo:o,className:s,title:a,onPointerDown:r,onDoubleClick:l,id:d})=>{if(null!==document.getElementById(d))return;const c=document.createElement("span");return c.id=d||t||a||n,c.innerHTML=`\n \n \n  \n ${t||""}\n \n `,document.getElementById(o).appendChild(c),c},createToggle:(e,{id:t,attachTo:n,className:i,title:o,tooltipId:s,toggleValueKey:a,onToggle:r,enableKey:l,iconName:d})=>{if(null!==document.getElementById(t))return;const c=document.createElement("span");return c.id=t,c.className="styled-checkbox",c.innerHTML=`\n \n \n `,document.getElementById(n).appendChild(c),c},getPluginStore:r,setPluginStore:(e,t,i)=>{const o={...r(e),[t]:i};n.pluginStorage={...n.pluginStorage,[e]:o}},addSettingsItem:({title:n,valueKey:i,defaultValue:o,optionsKey:s,options:a,setterKey:r,settingsColumn:l})=>{t.settings[i]=e.observable(t.settings.storage.getItem(i)||o).extend({persist:i}),t.ui[s]=a,t[r]=function(e,n){const o=n?n.target.value:e;t.settings[i](o)},window.addEventListener("settingsOpened",()=>{const e=t.ui[s].map(e=>``).join(""),o=`\n \n
\n \n
\n `,a=document.createElement("div");a.className="settings-item",a.innerHTML=o,document.getElementById("settingsColumn"+(l||"A")).appendChild(a),document.getElementById("mySelect").addEventListener("change",e=>{t[r](!1,e)})})},onYarnLoadedData:e=>{window.addEventListener("yarnLoadedData",t=>{e(t)})},onYarnEditorOpen:e=>{window.addEventListener("yarnEditorOpen",t=>{e(t)})},onYarnInPreviewMode:e=>{window.addEventListener("yarnSavedNode",t=>{e(t)})},onYarnSavedNode:e=>{window.addEventListener("yarnInPreviewMode",t=>{e(t)})},onYarnSetLanguage:e=>{window.addEventListener("yarnSetLanguage",t=>{e(t)})},onYarnLoadedStateFromLocalStorage:e=>{window.addEventListener("yarnLoadedStateFromLocalStorage",t=>{e(t)})},onYarnSavedStateToLocalStorage:e=>{window.addEventListener("yarnSavedStateToLocalStorage",t=>{e(t)})},onYarnSetDocumentType:e=>{window.addEventListener("yarnSetDocumentType",t=>{e(t)})},onKeyUp:e=>{i(document).on("keyup",t=>{e(t)})},onKeyDown:e=>{i(document).on("keydown",t=>{e(t)})},onLoad:e=>{window.addEventListener("DOMContentLoaded",t=>{e(t)})}};o.forEach(e=>{const t=new e(l);window.addEventListener("DOMContentLoaded",e=>{a(t)})}),null!==t.settings.gistPluginsFile()&&t.data.storage.getGist(t.settings.gistPluginsFile()).then(({fileList:e})=>{t.log({fileList:e}),e.forEach(e=>{if("JavaScript"===e.language){t.log({gistFile:e});try{t.storage.getContentOrRaw(e.content,e.raw_url).then(n=>{s(n,e.filename).then(n=>{const i=n(l);i.name=i.name||e.filename,t.log({newPlugin:i},"loaded from ",e.raw_url),"dependencies"in i&&i.dependencies.forEach(e=>{const n=document.createElement("script");n.setAttribute("src",e),document.body.appendChild(n),n.addEventListener("load",()=>{t.log("File loaded",e)}),n.addEventListener("error",e=>{t.log("Error on loading file",e)})}),a(i)})})}catch(t){console.error(e.filename,"Plugin failed to load",t)}}})})}}).call(this,n("Z1dp"),n("EVdn"))},e6Wu:function(e,t,n){"use strict";n.r(t);n("3ozf"),n("P85/"),n("uMdg"),n("gugv");var i=n("oj90"),o=n("0h2I"),s=n.n(o),a=(n("5uVa"),n("si6p"),n("ghrA"),n("bU/s")),r=n.n(a),l=(n("A8C4"),n("VEX6"),n("jF1P"),n("YhK8"),n("Ab/9"),n("KDOe"),n("PSD3")),d=n.n(l),c=n("P0sH"),p=n("pLxK"),u=n("bHyH");window.ko=s.a,window.$=window.jQuery=n("EVdn"),window.ace=r.a,r.a.config.set("basePath",i.Utils.getPublicPath()),window.define=r.a.define,window.Swal=d.a,"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("sw.js").then(e=>{console.log("SW registered: ",e)}).catch(e=>{console.log("SW registration failed: ",e)})}),window.app=new c.a("Yarn",p.a),window.app.run();const g=new u.a(window.app);window.app.plugins=g},fkuv:function(e,t,n){"use strict";(function(e,i){n.d(t,"a",(function(){return s}));var o=n("2Qx2");const s=function(t){const n=this;this.notification=Swal.mixin({toast:!0,position:"top",showConfirmButton:!1,timer:2500}),this.dispatchEvent=function(e,t){const n=new CustomEvent(e);n.options=t,window.dispatchEvent(n),window.parent.dispatchEvent(n)},this.settingsDialogVisible=e.observable(!1),this.narrowScreenThreshold=600,this.isScreenNarrow=function(){return i(window).width()<=n.narrowScreenThreshold},this.availableMarkupLanguages=[{id:"bbcode",name:"Bbcode"},{id:"html",name:"Html"}],this.availableFiletypeVersions=[{id:"1",name:"1"},{id:"2",name:"2"}],this.availableThemes=[{id:"classic",name:"Classic"},{id:"blueprint",name:"Blueprint"},{id:"dracula",name:"Dracula"}],this.availableDocumentTypes=[{id:"yarn",name:"Yarn"},{id:"ink",name:"Ink"}],this.availableLanguages=[{name:"Čeština",id:"cs-CZ"},{name:"Deutsch",id:"de-DE"},{name:"English",id:"en-GB"},{name:"Español",id:"es-ES"},{name:"Français",id:"fr-FR"},{name:"Íslenska",id:"is-IS"},{name:"Nederlands",id:"nl-NL"},{name:"Norsk bokmål",id:"nb-NO"},{name:"Polski",id:"pl-PL"},{name:"Română",id:"ro-RO"},{name:"Slovenčina",id:"sk-SK"},{name:"Svenska",id:"sv-SE"},{name:"Türkçe",id:"tr-TR"},{name:"български",id:"bg-BG"},{name:"Pусский",id:"ru-RU"},{name:"Српски",id:"sr-RS"},{name:"한국어",id:"ko-KR"}],this.availableLineStyles=[{id:"straight",name:"Straight Lines"},{id:"bezier",name:"Bezier Curves"}],this.openSettingsDialog=function(){n.settingsDialogVisible(!0),i(".settings-dialog").css({opacity:0}).transition({opacity:1},250),i(".settings-dialog .form").css({y:"-100"}).transition({y:"0"},250);var e=new CustomEvent("settingsOpened");window.dispatchEvent(e)},this.openHelpDialog=function(){Swal.fire({title:"Help",html:'\n
\n

Useful editor shortcuts:

\n \n
    \n
  • Cmd/Ctrl + Left Click -- Create multiple input carets
  • \n
  • Cmd/Ctrl + Left/Right -- Caret jump word
  • \n
  • Cmd/Ctrl + Up/Down -- Scroll up/down
  • \n
  • Cmd/Ctrl + Left/Right + Shift -- Caret jump word selection
  • \n
  • Cmd/Ctrl + F -- Search
  • \n
  • Cmd/Ctrl + Alt + K -- Find All
  • \n
  • Cmd/Ctrl + H -- Search and Replace
  • \n
  • Cmd/Ctrl + A -- Select all
  • \n
  • Cmd/Ctrl + U -- To Uppercase
  • \n
  • Cmd/Ctrl + Shift + U -- To Lowercase
  • \n
  • Alt + Up/Down -- Move line(s) up/down
  • \n
  • ...
  • \n
\n
\n
How to use Yarn Syntax
\n
How to use Ink Syntax
\n

Runtimes:

\n YarnSpinner (Unity3d)\n BondageJs (yarn javascript)\n Ink C# (Unity3d)\n InkJs (javascript)\n BladeInk (java)\n Many more Ink parsers\n
\n ',showCancelButton:!0,confirmButtonText:"About",cancelButtonText:"Close"}).then(e=>{e.value&&Swal.fire({title:"About",html:'\n \n ',showCancelButton:!1,confirmButtonText:"OK"})})},this.closeSettingsDialog=function(){i(".settings-dialog").css({opacity:1}).transition({opacity:0},250,e=>{n.settingsDialogVisible(!1)}),i(".settings-dialog .form").css({y:"0"}).transition({y:"-100"},250),setTimeout(()=>t.settings.apply(),100)},this.isDialogOpen=function(){return n.settingsDialogVisible()||Swal.isVisible()&&!Swal.isTimerRunning()},this.confirmMarkupConversion=function(){Swal.fire({title:"Are you sure?",text:"Markup on all nodes will be modified. This can rarely result in broken texts. This operation can't be undone.",icon:"warning",showCancelButton:!0,confirmButtonText:"Yes, convert it!",cancelButtonText:"No, cancel!",reverseButtons:!0}).then(e=>{e.value&&(t.convertMarkup(),Swal.fire("Converted!","The markup on the nodes has been converted.","success"))})},this.nodeSearchMatches=function(e,t,n=!1){var o=n||i(".search-title input").is(":checked"),s=n||i(".search-body input").is(":checked"),a=n||i(".search-tags input").is(":checked");return 0!==t.length&&(o||s||a)?{matchTitle:o&&e.title().toLowerCase().indexOf(t)>=0,matchBody:s&&e.body().toLowerCase().indexOf(t)>=0,matchTags:a&&e.tags().toLowerCase().indexOf(t)>=0,clearSearch:!1}:{matchTitle:!1,matchBody:!1,matchTags:!1,clearSearch:!0}},this.findMatchingNodes=function(e){const n={matchTitle:[],matchBody:[],matchTags:[],foundNodes:!1};return[...t.nodes()].reverse().forEach(i=>{const{matchTitle:o,matchBody:s,matchTags:a}=t.ui.nodeSearchMatches(i,e,!0);o&&n.matchTitle.push(i),s&&n.matchBody.push(i),a&&n.matchTags.push(i)}),n.foundNodes=n.matchTitle.length>0||n.matchBody.length>0||n.matchTags.length>0,n},this.createSearchMenuLine=function(e,n,s,a="title"){const r=document.createElement("div");if(r.innerHTML=`${e.title()} ${a?`(${a})`:""}`,i(r).addClass("item "+e.titleStyles[e.colorID()]),"link"==n){if(e.title()!==t.editing().title()){if("ink"===t.settings.documentType()&&e.title().trim()===o.a.InkGlobalScopeNodeName)return;r.setAttribute("onclick","ink"===t.settings.documentType()?"app.insertTextAtCursor('-> "+e.title()+"')":"app.insertTextAtCursor('[["+e.title()+"]]')"),s.appendChild(r)}}else"open"==n&&(r.setAttribute("onclick",`app.openNodeByTitle("${e.title()}")`),r.setAttribute("onmouseenter",`app.workspace.warpToNodeByIdx(${t.nodes.indexOf(e)})`),s.appendChild(r))},this.openNodeListMenu=function(e){const n="link"===e?document.getElementById("linkHelperMenuFilter").value.toLowerCase():document.getElementById("nodeSearchInput").value.toLowerCase(),i=document.getElementById(e+"HelperMenu");i.innerHTML="";const o=()=>{[...t.nodes()].reverse().forEach(t=>{this.createSearchMenuLine(t,e,i,"")})};if(!n)return void o();const s=this.findMatchingNodes(n);s.foundNodes?(s.matchTitle.forEach(t=>{this.createSearchMenuLine(t,e,i,"title")}),s.matchTags.forEach(t=>{this.createSearchMenuLine(t,e,i,"tags")}),s.matchBody.forEach(t=>{this.createSearchMenuLine(t,e,i,"body")})):o()},this.checkAndMoveAppButtons=function(){i(".app-add-node").toggleClass("app-add-node-alt","right"===t.settings.editorSplitDirection()),i(".app-sort").toggleClass("app-sort-alt","right"===t.settings.editorSplitDirection()),i(".app-undo-redo").toggleClass("app-undo-redo-alt","right"===t.settings.editorSplitDirection()),i(".app-zoom").toggleClass("app-zoom-alt","right"===t.settings.editorSplitDirection())},this.resetAppButtonsLocation=function(){i(".app-add-node").removeClass("app-add-node-alt"),i(".app-sort").removeClass("app-sort-alt"),i(".app-undo-redo").removeClass("app-undo-redo-alt"),i(".app-zoom").removeClass("app-zoom-alt")},this.toastMixin=Swal.mixin({toast:!0,icon:"success",title:"Done!",animation:!1,position:"bottom",showConfirmButton:!1,timer:2500,timerProgressBar:!0,didOpen:e=>{e.addEventListener("mouseenter",Swal.stopTimer),e.addEventListener("mouseleave",Swal.resumeTimer)}}),this.insertTextAtCursorWithParams=function(e="",n=[]){const o=n.map((e,t)=>"boolean"==typeof e.default?`
${e.name} :
`:"number"==typeof e.default?`
${e.name} :
`:`
${e.name} :
`).join("\n");Swal.fire({title:"Snippet properties",html:o,preConfirm:function(){return new Promise((function(e){e(n.map((e,t)=>"boolean"==typeof e.default?i("#swal-input"+t).is(":checked"):i("#swal-input"+t).val()))}))},onOpen:function(){i("#swal-input0").focus(),n.forEach((e,n)=>{void 0!==e.default&&("boolean"==typeof e.default?i("#swal-input"+n)[0].checked=e.default:i("#swal-input"+n)[0].value=e.default,t.log(i("#swal-input"+n)))})}}).then((function(n){if(!n.value)return;let i=e;n.value.forEach((e,t)=>{void 0!==e&&(i=i.replace("%"+t,e))}),t.insertTextAtCursor(i)}))}}}).call(this,n("Z1dp"),n("EVdn"))},gugv:function(e,t,n){},jF1P:function(e,t,n){(function(e){var t,n;t={},n=0,e.bindingHandlers.ace={init:function(i,o,s,a,r){var l=s().aceOptions||{},d=e.utils.unwrapObservable(o());i.id||(i.id="knockout-ace-"+n,n+=1);var c=ace.edit(i.id);l.theme&&c.setTheme("ace/theme/"+l.theme),l.mode&&c.getSession().setMode("ace/mode/"+l.mode),c.setValue(d),c.gotoLine(0),c.setShowPrintMargin(!1),c.getSession().setUseWrapMode(!0),c.getSession().on("change",(function(t){e.isWriteableObservable(o())&&o()(c.getValue())})),t[i.id]=c,e.utils.domNodeDisposal.addDisposeCallback(i,(function(){try{c.destroy()}catch(e){}delete t[i.id]}))},update:function(n,i,o,s,a){var r=e.utils.unwrapObservable(i()),l=n.id;if(void 0!==l&&""!==l&&t.hasOwnProperty(l)){var d=t[l];d.getValue()!==r&&(d.setValue(r),d.gotoLine(0))}}},e.aceEditors={resizeAll:function(){for(var e in t)t.hasOwnProperty(e)&&t[e].resize()},get:function(e){return t[e]}}}).call(this,n("Z1dp"))},"l8+o":function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var i=n("mIo7"),o=n("mqgS");const s=function(e){const t=t=>{const n=/((https:\/\/)?(www.)?instagram.com\/p\/[^\s\<]+)/gi,i=/(?:http(?:s?):\/\/|)(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]*)(&(amp;)?‌​[\w\?‌​=]*)?(?:\?t=[0-9]+)?/gi,o=new RegExp(`^(?!${/(https?:\/\/twitter.com\/[^\s\<]+\/[^\s\<]+\/[^\s\<]+)/gi.source}|${i.source}|${n.source})https?:.*$`,"gm");return t=(t=(t=t.replace(o,(function(e){return`\n ${e}\n `}))).replace(i,(function(e){const t=e.match(/(?:https\:.*|)(?:www.|)youtu(?:.*\/v\/|.*v\=|\.be\/)([A-Za-z0-9_\-]{11}(?:\?t=[0-9]+)?)/i);if(t.length>1)return`\n \n `}))).replace(n,(function(t){const n=t.match(/((?:https?:\/\/)?(?:www.)?instagram.com\/p\/([^\s\<]+)\/)/i);if(n.length>2)return e.log("EXTRACTED",n),`\n \n `}))};return"html"===e.settings.markupLanguage()?new o.a(e,t):new i.a(e,t)}},mIo7:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return BbcodeRichTextFormatter}));const bbcode=__webpack_require__("L8pc"),BbcodeRichTextFormatter=function(app,addExtraPreviewerEmbeds){const self=this;this.justInsertedAutoComplete=!1,this.completableTags=Object.freeze([{Start:"<<",Completion:">>",Offset:-2},{Start:"[colo",Completion:"r=#][/color]",Offset:-9,BehaviorCompletion:"r=#][/color",Func:()=>{app.insertColorCode()}},{Start:"[b",Completion:"][/b]",BehaviorCompletion:"][/b",Offset:-4},{Start:"[i",Completion:"][/i]",BehaviorCompletion:"][/i",Offset:-4},{Start:"[img",Completion:"][/img]",BehaviorCompletion:"][/img",Offset:-6},{Start:"[u",Completion:"][/u]",BehaviorCompletion:"][/u",Offset:-4},{Start:"[url",Completion:"][/url]",BehaviorCompletion:"][/url",Offset:-6}]),this.getTagOpen=function(e){switch(e){case"cmd":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"~ ":"{ ":"<<";case"opt":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"-> ":"* [":"[[";case"color":return"[color=#]";default:return`[${e}]`}},this.getTagClose=function(e){switch(e){case"cmd":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"":" }":">>";case"opt":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"":"]":"|]]";default:return`[/${e}]`}},this.identifyTag=function(e){return-1!==e.lastIndexOf("[")?e.substring(e.lastIndexOf("["),e.length):""},this.insertTag=function(e){const t=self.getTagOpen(e),n=self.getTagClose(e),i=JSON.parse(JSON.stringify(app.editor.selection.getRange()));app.editor.session.insert(i.start,t),app.editor.session.insert({column:i.end.column+t.length,row:i.end.row},n),"color"===e&&(0===app.editor.getSelectedText().length?app.moveEditCursor(-9):app.editor.selection.setRange({start:{row:app.editor.selection.getRange().start.row,column:app.editor.selection.getRange().start.column-1},end:{row:app.editor.selection.getRange().start.row,column:app.editor.selection.getRange().start.column-1}}),app.insertColorCode()),"img"===e?0===app.editor.getSelectedText().length&&(app.moveEditCursor(-6),app.data.triggerPasteClipboard(),setTimeout(()=>app.moveEditCursor(6),300)):0===app.editor.getSelectedText().length?app.isEditorInPreviewMode||app.moveEditCursor(-n.length):app.editor.selection.setRange({start:app.editor.selection.getRange().start,end:{row:app.editor.selection.getRange().end.row,column:app.editor.selection.getRange().end.column-n.length}}),app.editor.focus()},this._convertTag=function(inPattern,outPattern,text){const globalRegex=new RegExp(inPattern,"gi"),localRegex=new RegExp(inPattern,"i");return text.replace(globalRegex,m=>{const match=m.match(localRegex),template=eval("`"+outPattern+"`");return match.length?template:null})},this.convert=function(e){let t=e;return t=self._convertTag("(.*?)<\\/b>","[b]${match[1]}[/b]",t),t=self._convertTag("(.*?)<\\/u>","[u]${match[1]}[/u]",t),t=self._convertTag("(.*?)<\\/i>","[i]${match[1]}[/i]",t),t=self._convertTag("(.*?)<\\/img>","[img]${match[1]}[/img]",t),t=self._convertTag("(.*?)<\\/color>","[color=#${match[1]}]${match[2]}[/color]",t),t=self._convertTag("(.*?)<\\/url>","[url]${match[1]}[/url]",t),t},this.richTextToHtml=function(e,t=!1){let n=1,i=t?'
'+n+". "+e+"
":e;return i=i.replace(/<(run:"),i=i.replace(/>>/gi,")"),i=i.replace(/\[color=#[A-Za-z0-9]+\]/gi,(function(e){const t=e.match(/\[color=#([A-Za-z0-9]+)\]/i);if(t&&t.length>1)return"[color=#"+t[1]+"]"})),i=i.replace(/\[img\][^\[]+\[\/img\]/gi,(function(e){const n=e.match(/\[img\](.*)\[\/img\]/i);if(n.length>1){const e=app.data.editingFileFolder(n[1]);return app.data.doesFileExist(e)?t?' ':' ':t?' ':' '}})),t&&(i=addExtraPreviewerEmbeds(i)),i=i.replace(/[\n\r]/g,(function(e){let i="
";return n+=1,t&&(i+='
'+n+". "),i})),i=bbcode.parse(i),i}}},mqgS:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return HtmlRichTextFormatter}));const HtmlRichTextFormatter=function(app,addExtraPreviewerEmbeds){const self=this;this.justInsertedAutoComplete=!1,this.completableTags=Object.freeze([{Start:"<<",Completion:">>",Offset:-2},{Start:"",Offset:-9,Func:()=>{app.insertColorCode()}},{Start:"",Offset:-4},{Start:"",Offset:-6},{Start:"",Offset:-4},{Start:"",Offset:-4},{Start:"",Offset:-6}]),this.getTagOpen=function(e){switch(e){case"cmd":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"~ ":"{ ":"<<";case"opt":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"-> ":"* [":"[[";case"color":return"";default:return`<${e}>`}},this.getTagClose=function(e){switch(e){case"cmd":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"":" }":">>";case"opt":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"":"]":"|]]";default:return``}},this.identifyTag=function(e){return-1!==e.lastIndexOf("<")?e.substring(e.lastIndexOf("<"),e.length):""},this.insertTag=function(e){const t=self.getTagOpen(e),n=self.getTagClose(e),i=JSON.parse(JSON.stringify(app.editor.selection.getRange()));app.editor.session.insert(i.start,t),app.editor.session.insert({column:i.end.column+t.length,row:i.end.row},n),"color"===e&&(0===app.editor.getSelectedText().length?app.moveEditCursor(-9):app.editor.selection.setRange({start:{row:app.editor.selection.getRange().start.row,column:app.editor.selection.getRange().start.column-1},end:{row:app.editor.selection.getRange().start.row,column:app.editor.selection.getRange().start.column-1}}),app.insertColorCode()),"img"===e?navigator.clipboard.readText().then(e=>{0===app.editor.getSelectedText().length&&(app.moveEditCursor(-7),app.insertTextAtCursor(` src="${e}"`))}):0===app.editor.getSelectedText().length?app.isEditorInPreviewMode||app.moveEditCursor(-n.length):app.editor.selection.setRange({start:app.editor.selection.getRange().start,end:{row:app.editor.selection.getRange().end.row,column:app.editor.selection.getRange().end.column-n.length}}),app.editor.focus()},this._convertTag=function(inPattern,outPattern,text){const globalRegex=new RegExp(inPattern,"gi"),localRegex=new RegExp(inPattern,"i");return text.replace(globalRegex,m=>{const match=m.match(localRegex),template=eval("`"+outPattern+"`");return match.length?template:null})},this.convert=function(e){let t=e;return t=self._convertTag("\\[b\\](.*?)\\[\\/b\\]","${match[1]}",t),t=self._convertTag("\\[u\\](.*?)\\[\\/u\\]","${match[1]}",t),t=self._convertTag("\\[i\\](.*?)\\[\\/i\\]","${match[1]}",t),t=self._convertTag("\\[img\\](.*?)\\[\\/img\\]","${match[1]}",t),t=self._convertTag("\\[color=#(.*?)\\](.*?)\\[\\/color\\]","${match[2]}",t),t=self._convertTag("\\[url\\](.*?)\\[\\/url\\]","${match[1]}",t),t},this.richTextToHtml=function(e,t=!1){let n=1,i=t?'
'+n+". "+e+"
":e;return i=i.replace(/<(run:"),i=i.replace(/>>/gi,")
"),[/<color=#(.*?)>(.*?)<\/color>/,/(.*?)<\/color>/].forEach(e=>{const t=new RegExp(e,"gi"),n=new RegExp(e,"i");i=i.replace(t,(function(e){const t=e.match(n);if(t&&t.length>2)return`☗${t[2]}`}))}),i=i.replace(/<img>[^\[]+<\/img>/gi,(function(e){const n=e.match(/<img>(.*?)<\/img>/i);if(n.length>1){const e=app.data.editingFileFolder(n[1]);return app.data.doesFileExist(e)?t?' ':' ':t?' ':' '}})),i=i.replace(/<b>.*<\/b>/gi,e=>{const t=e.match(/<b>(.*)<\/b>/i);if(t.length)return`${t[1]}`}),i=i.replace(/<u>.*<\/u>/gi,e=>{const t=e.match(/<u>(.*)<\/u>/i);if(t.length)return`${t[1]}`}),i=i.replace(/<i>.*<\/i>/gi,e=>{const t=e.match(/<i>(.*)<\/i>/i);if(t.length)return`${t[1]}`}),t&&(i=addExtraPreviewerEmbeds(i)),i=i.replace(/[\n\r]/g,(function(e){let i="
";return n+=1,t&&(i+='
'+n+". "),i})),i}}},oj90:function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"Utils",(function(){return i}));var i={createAutocompleter:function(e,t,n,i=1){return{getCompletions:function(o,s,a,r,l){var d=o.session.getTokenAt(a.row,a.column);r.length`,"

",e.title,"

","
","
",e.about,"
","
","
"].join("")}}},addDoubleTapDetector:function(e,t){e.lastTap=0,e.tapTimeout=0,e.addEventListener("touchend",(function(n){var i=(new Date).getTime(),o=i-e.lastTap;clearTimeout(e.tapTimeout),o<500&&o>0?(t(),n.preventDefault()):e.tapTimeout=setTimeout((function(){clearTimeout(e.tapTimeout)}),500),e.lastTap=i}))},uniqueSplit:function(e,t=" "){return[...new Set(e.split(t).filter(e=>e))]},getHighestZ:function(t){let n=Number.NEGATIVE_INFINITY;return e(t).children().each((function(){let t=parseInt(e(this).css("z-index"))||0;t>n&&(n=t)})),n},clamp:function(e,t,n){return Math.max(Math.min(e,n),t)},rectanglesOverlap:function(e,t){return!(t.left>e.right||t.righte.bottom||t.bottom=0;)e=e.replace("<","<");for(;e.indexOf(">")>=0;)e=e.replace(">",">");return e},xmlToObject:function(e){var t=[];if((e=e.childNodes.item(0)).hasChildNodes())for(var n=0;n0)){o[r.nodeName]={};for(var l=0;l1){if(n.items={cut:{name:"Cut",icon:"cut",callback:()=>{app.clipboard.length>0&&(app.data.triggerCopyClipboard(),app.insertTextAtCursor(""))}},copy:{name:"Copy",icon:"copy",callback:()=>{app.data.triggerCopyClipboard()}},paste:{name:"Paste",icon:"paste",callback:()=>app.data.triggerPasteClipboard()},sep1:"---------"},!app.getTagBeforeCursor().match(e)||"ink"===app.settings.documentType()&&"END"===app.editor.getSelectedText()||(n.items["go to node"]={name:"Edit node: "+app.editor.getSelectedText(),callback:()=>{const e=app.getFutureEditedNodeTitle();app.nodeVisitHistory.includes(e)||app.nodeVisitHistory.push(e),app.openNodeByTitle(app.editor.getSelectedText())}}),app.settings.spellcheckEnabled()){var i=app.getSpellCheckSuggestionItems();!1!==i&&(n.items.corrections={name:"Correct word",items:i})}var o=app.getThesaurusItems();!1!==o&&(n.items.corrections={name:"Related words",items:o})}else n.items={paste:{name:"Paste",icon:"paste",callback:()=>app.data.triggerPasteClipboard()}},"ink"===app.settings.documentType()&&(n.items.inkSnips={name:"Ink snippets",items:{structure:{name:"Structure",items:{stitch:{name:"Stitch",callback:()=>{app.insertTextAtCursor("= stitchName\nThis is the content of the stitch that should be embedded within a knot.\n-> END")}},end:{name:"Ending indicator",callback:()=>{app.insertTextAtCursor("-> END")}}}},choices:{name:"Choices",items:{basicChoice:{name:"Basic choice",callback:()=>{app.insertTextAtCursor("* This is a choice that can only be chosen once")}},stickyChoice:{name:"Sticky choice",callback:()=>{app.insertTextAtCursor("+ This is a sticky choice - the player can choose it more than once")}},choiceWithoutPrinting:{name:"Choice without printing",callback:()=>{app.insertTextAtCursor("* [A choice where the content isn't printed after choosing]")}},choiceWithoutMixedOutput:{name:"Choice without mixed output",callback:()=>{app.insertTextAtCursor("* Try [it] this example!")}}}},variableText:{name:"Variable text",items:{shuffle:{name:"~Shuffle (rand) text",callback:()=>{app.insertTextAtCursor("I tossed the coin. {~Heads|Tails}.")}},cycle:{name:"&Cycle text",callback:()=>{app.insertTextAtCursor("It was {&Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday} today.")}},sequence:{name:"Sequence text",callback:()=>{app.insertTextAtCursor('The radio hissed into life. {"Three!"|"Two!"|"One!"|There was the white noise racket of an explosion.|But it was just static.}\n\n{I bought a coffee with my five-pound note.|I bought a second coffee for my friend.|I didn\'t have enough money to buy any more coffee.}')}},onceOnly:{name:"!Once only text",callback:()=>{app.insertTextAtCursor("He told me a joke. {!I laughed politely.|I smiled.|I grimaced.|I promised myself to not react again.}\n")}}}},variables:{name:"Variables",items:{globalVariable:{name:"Global variable",callback:()=>{app.insertTextAtCursor("VAR myNumber = 5")}},temporaryVariable:{name:"Temporary variable",callback:()=>{app.insertTextAtCursor("temp myTemporaryValue = 5")}},modifyVariable:{name:"Modify variable",callback:()=>{app.insertTextAtCursor("~ myNumber = myNumber + 1")}}}},conditions:{name:"Conditions",items:{inlineCondition:{name:"Inline condition",callback:()=>{app.insertTextAtCursor("{yourVariable: This is written if yourVariable is true|Otherwise this is written}\n")}},multilineCondition:{name:"Multiline condition",callback:()=>{app.insertTextAtCursor("{yourVariable:\n This is written if yourVariable is true.\n - else:\n Otherwise this is written.\n}")}}}}}},n.items.code={name:"Code",items:{equal:{name:"== (equal)",callback:()=>app.insertTextAtCursor("== ")},notEqual:{name:"!= (not equal)",callback:()=>app.insertTextAtCursor("!= ")},tag:{name:"# (tag)",callback:()=>app.insertTextAtCursor("# ")},list:{name:"LIST",callback:()=>app.insertTextAtCursor("LIST = ")},listFunc:{name:"List functions",items:{count:{name:"count",callback:()=>app.insertTextAtCursor("LIST_COUNT()")},min:{name:"min",callback:()=>app.insertTextAtCursor("LIST_MIN()")},max:{name:"max",callback:()=>app.insertTextAtCursor("LIST_MAX()")},rand:{name:"random",callback:()=>app.insertTextAtCursor("LIST_RANDOM()")}}},variable:{name:"VAR",callback:()=>app.insertTextAtCursor("VAR = ")},temp:{name:"~ temp",callback:()=>app.insertTextAtCursor("~ temp = ")},plusEq:{name:"+= (plus equal)",callback:()=>app.insertTextAtCursor("+= ")},else:{name:"- else",callback:()=>app.insertTextAtCursor("- else:\n")},or:{name:"|",callback:()=>app.insertTextAtCursor("|")},rand:{name:"~",callback:()=>app.insertTextAtCursor("~")}}},n.items.bladeCoder={name:"BladeCoder",items:{player:{name:"$PLAYER>",callback:()=>app.insertTextAtCursor("$PLAYER> ")},animation:{name:"Animation",callback:()=>app.ui.insertTextAtCursorWithParams("> Animation: animation=%0.%1, wait=%2, keepDirection=%3, repeat=%4, count=%5",[{name:"Actor",default:"$PLAYER"},{name:"Animation",default:"stand.right"},{name:"Wait",default:!1},{name:"Keep direction",default:!1},{name:"Repeat",default:"SPRITE_DEFINED"},{name:"Count",default:-1}])},goto:{name:"Goto",callback:()=>app.ui.insertTextAtCursorWithParams("> Goto: actor=%0, target=%1",[{name:"Actor",default:"$PLAYER"},{name:"target",default:"target"}])},wait:{name:"Wait",callback:()=>app.ui.insertTextAtCursorWithParams("> Wait: time=%0",[{name:"Time",default:.8}])},playSound:{name:"Play Sound",callback:()=>app.ui.insertTextAtCursorWithParams("> PlaySound: sound=%0, stop=%1",[{name:"Sound",default:"yawn"},{name:"Stop",default:!1}])},setActorAttr:{name:"Set Actor Attribute",callback:()=>app.ui.insertTextAtCursorWithParams("> SetActorAttr: actor=%0, talkAnimation=%1, visible=%2",[{name:"Actor",default:"$PLAYER"},{name:"Talk animation"},{name:"Visible",default:!0}])}}},n.items.end={name:"-> END",callback:()=>app.insertTextAtCursor("-> END")},n.items.star={name:"* (choice)",callback:()=>app.insertTextAtCursor("* ")},n.items.gather={name:"- (gather)",callback:()=>app.insertTextAtCursor("-")},n.items.stitch={name:"= (stitch)",callback:()=>app.insertTextAtCursor("= ")},n.items.glue={name:"<> (glue)",callback:()=>app.insertTextAtCursor("<>")},n.items.comment={name:"// (comment)",callback:()=>app.insertTextAtCursor("// ")},n.items.nested={name:"Nested",items:{gather2:{name:"-- (gather)",callback:()=>app.insertTextAtCursor("-- ")},star2:{name:"** (choice)",callback:()=>app.insertTextAtCursor("** ")}}},n.items.inkDoc={name:"How to use ink",callback:()=>window.open("https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md","_blank").focus()});return n}}}},debounce:function(e,t){var n;return function(){clearTimeout(n),n=setTimeout((function(){e()}),t)}}}}.call(this,n("EVdn"))},owJe:function(e,t,n){(function(e){var i=n("jXEy"),o=n("oj90"),s=o.Utils.getPublicPath("dictionaries/en/index.dic"),a=o.Utils.getPublicPath("dictionaries/en/index.aff");e("").appendTo("head"),e("").appendTo("head");var r=null;function l(e){var t=e.split(/\s+|\.|\,|\?|\\|\/|\!|\[|\]|"|'|;|:|`|\+|\-|\&|\$|@|~|#|>|<|_|\)|\(|£|\^|%|\*|„|“|\||[0-9]+/g),n=0,i=[];for(word in t){var o=t[word];r.correct(o)||(i[i.length]=[n,n+t[word].length]),n+=t[word].length+1}return i}t.load_dictionary=function(t){console.info(`Loading ${t} hunspell dictionary locally`),s=o.Utils.getPublicPath(`dictionaries/${t}/index.dic`),a=o.Utils.getPublicPath(`dictionaries/${t}/index.aff`),e.get(s,(function(e){dicData=e})).fail((function(){const n=sessionStorage.getItem("affData"),o=sessionStorage.getItem("dicData");if(n&&o)return console.info(t+" found in sessionStorage. Loading dictionary from cache..."),r=new i(n,o),void(d=!0);console.error(t+" not found locally. Loading dictionary from server instead..."),s=`https://raw.githubusercontent.com/wooorm/dictionaries/main/dictionaries/${t}/index.dic`,a=`https://raw.githubusercontent.com/wooorm/dictionaries/main/dictionaries/${t}/index.aff`,e.get(s,(function(e){dicData=e})).done((function(){e.get(a,(function(e){affData=e})).done((function(){sessionStorage.setItem("affData",affData),sessionStorage.setItem("dicData",dicData),r=new i(affData,dicData),d=!0}))}))})).done((function(){e.get(a,(function(e){affData=e})).done((function(){console.log("Dictionary loaded locally"),r=new i(affData,dicData),d=!0}))}))},t.misspelled=l;var d=!0,c=!1,p=[];function u(){if(null!=r&&!c&&d){c=!0;var e=ace.edit("editor").getSession();h();try{var t=ace.require("ace/range").Range,n=e.getDocument().getAllLines();for(var i in n){var o=l(n[i]);for(var s in o){var a=new t(i,o[s][0],i,o[s][1]);p[p.length]=e.addMarker(a,"misspelled","typo",!0)}}}finally{c=!1,d=!1}}}t.spell_check=u;var g=!1;function h(){var e=ace.edit("editor").getSession();for(var t in p)e.removeMarker(p[t]);p=[];var n=e.getDocument().getAllLines();for(var t in n)e.removeGutterDecoration(t,"misspelled")}t.enable_spellcheck=function(){g=!0,ace.edit("editor").getSession().on("change",(function(e){g&&(d=!0,u())})),d=!0,u()},t.disable_spellcheck=function(){g=!1,h()},t.clear_spellcheck_markers=h,t.suggest_word_for_misspelled=function(e){var t=r.suggest(e);return 0!==t.length&&t}}).call(this,n("EVdn"))},pLxK:function(e){e.exports=JSON.parse('{"a":"0.4.283"}')},pYPP:function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return i}));const i=function(t){const n=this,i=window.vsCodeApi?{getItem:()=>{},setItem:()=>{}}:window.localStorage;this.storage=i,e.extenders.persist=function(e,n){return e.subscribe((function(e){i.setItem(n,e),t.data.db.save(n,e)})),e},this.apply=function(){t.setTheme(n.theme()),t.setLanguage(n.language()),t.setDocumentType(n.documentType()),t.toggleInvertColors(),t.setMarkupLanguage(n.markupLanguage()),console.log("redraw throttle:",n.redrawThrottle()),t.workspace.setThrottle(n.redrawThrottle()),t.setGistCredentials({token:n.gistToken(),file:null!==n.gistFile()?n.gistFile().split("/").pop():null}),t.setGistPluginsFile(null!==n.gistPluginsFile()?n.gistPluginsFile().split("/").pop():null)},this.pasteFromClipboard=function(e){e&&e.length>0||navigator.clipboard&&navigator.clipboard.readText().then(n=>{t.log("clipboard",n),n&&n.length>5&&e(n)})},this.guessGistToken=function(){n.pasteFromClipboard(n.gistToken)},this.guessGistFile=function(){n.pasteFromClipboard(n.gistFile)},this.validateGridSize=function(){n.gridSize()<20&&n.gridSize(20),n.gridSize()>200&&n.gridSize(200),n.gridSize(parseInt(n.gridSize())),t.initGrid()},this.theme=e.observable(i.getItem("theme")||"dracula").extend({persist:"theme"}),this.documentType=e.observable(i.getItem("documentType")||"yarn").extend({persist:"documentType"}),this.language=e.observable(i.getItem("language")||"en-GB").extend({persist:"language"}),this.redrawThrottle=e.observable(parseInt(i.getItem("redrawThrottle")||"130")).extend({persist:"redrawThrottle"}),this.gistToken=e.observable(i.getItem("gistToken")).extend({persist:"gistToken"}),this.gistFile=e.observable(i.getItem("gistFile")).extend({persist:"gistFile"}),this.lastEditedGist=e.observable(i.getItem("lastEditedGist")).extend({persist:"lastEditedGist"}),this.lastStorageHost=e.observable(i.getItem("lastStorageHost")).extend({persist:"lastStorageHost"}),this.gistPluginsFile=e.observable(i.getItem("gistPluginsFile")).extend({persist:"gistPluginsFile"}),this.spellcheckEnabled=e.observable(null===i.getItem("spellcheckEnabled")||"true"===i.getItem("spellcheckEnabled")).extend({persist:"spellcheckEnabled"}),this.autoCloseTags=e.observable(null===i.getItem("autoCloseTags")||"true"===i.getItem("autoCloseTags")).extend({persist:"autoCloseTags"}),this.autocompleteSuggestionsEnabled=e.observable(null===i.getItem("autocompleteSuggestionsEnabled")||"true"===i.getItem("autocompleteSuggestionsEnabled")).extend({persist:"autocompleteSuggestionsEnabled"}),this.autoCloseBrackets=e.observable(null===i.getItem("autoCloseBrackets")||"true"===i.getItem("autoCloseBrackets")).extend({persist:"autoCloseBrackets"}),this.invertColorsEnabled=e.observable(null!==i.getItem("invertColorsEnabled")&&"true"===i.getItem("invertColorsEnabled")).extend({persist:"invertColorsEnabled"}),this.snapGridEnabled=e.observable(null!==i.getItem("snapGridEnabled")&&"true"===i.getItem("snapGridEnabled")).extend({persist:"snapGridEnabled"}),this.restoreSessionEnabled=e.observable(null!==i.getItem("restoreSessionEnabled")&&"true"===i.getItem("restoreSessionEnabled")).extend({persist:"restoreSessionEnabled"}),this.developmentModeEnabled=e.observable(null!==i.getItem("developmentModeEnabled")&&"true"===i.getItem("developmentModeEnabled")).extend({persist:"developmentModeEnabled"}),this.gridSize=e.observable(parseInt(i.getItem("gridSize")||"40")).extend({persist:"gridSize"}),this.createNodesEnabled=e.observable(null===i.getItem("createNodesEnabled")||"true"===i.getItem("createNodesEnabled")).extend({persist:"createNodesEnabled"}),this.editorStatsEnabled=e.observable(null!==i.getItem("editorStatsEnabled")&&"true"===i.getItem("editorStatsEnabled")).extend({persist:"editorStatsEnabled"}),this.markupLanguage=e.observable(i.getItem("markupLanguage")||"bbcode").extend({persist:"markupLanguage"}),this.filetypeVersion=e.observable(i.getItem("filetypeVersion")||"1").extend({persist:"filetypeVersion"}),this.lineStyle=e.observable(i.getItem("lineStyle")||"straight").extend({persist:"lineStyle"}),this.fileTabsVisible=e.observable(null===i.getItem("fileTabsVisible")||"true"===i.getItem("fileTabsVisible")).extend({persist:"fileTabsVisible"}),this.selectedFileTab=e.observable(i.getItem("selectedFileTab")||0).extend({persist:"selectedFileTab"}),this.alwaysOpenNodesInVisualStudioCodeEditor=e.observable(null!==i.getItem("alwaysOpenNodesInVisualStudioCodeEditor")&&"true"===i.getItem("alwaysOpenNodesInVisualStudioCodeEditor")).extend({persist:"alwaysOpenNodesInVisualStudioCodeEditor"}),this.editorSplitDirection=e.observable(i.getItem("editorSplitDirection")||"left").extend({persist:"editorSplitDirection"}),this.editorSplit=e.observable(null!==i.getItem("editorSplit")&&"true"===i.getItem("editorSplit")).extend({persist:"editorSplit"}),this.editorSplitSize=e.observable(i.getItem("editorSplitSize")||"50%").extend({persist:"editorSplitSize"})}}).call(this,n("Z1dp"))},qVgP:function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return s}));var i=n("+qE3");const{Story:o}=n("OeYU");var s=function(){let t=new i.EventEmitter;this.emiter=t,this.story=null,this.log=[],this.onRecompile=()=>{},this.curStory={messages:[],choices:[],tags:[],paragraphEl:""},this.resetStory=()=>{this.prevSavePoints=[],this.choiceHistory=[],this.textAreaEl.innerHTML="",this.curStory={messages:[],choices:[],tags:[],paragraphEl:""},this.story.ResetState()},this.terminate=()=>{if(this.textAreaEl)try{t.removeAllListeners(),this.finished=!0}catch(e){console.warn(e)}},this.setCurStory=({messages:e,choices:t,tags:n,paragraphEl:i})=>{this.curStory={messages:e,choices:t,tags:n,paragraphEl:i}};const n=(e="",t="")=>{const n=(e=>{let t=[];for(;e.canContinue;)t.push(e.Continue().replace(/\n/g,""));return t})(this.story),i=e.includes('"')?e:`[${e}]`,o=document.createElement("p");if(e){const s=document.createElement("p");s.innerHTML=``,s.onclick=()=>app.navigateToNodeDuringPlayTest(t,i),o.appendChild(s),n.forEach(e=>{const t=document.createElement("p");t.innerHTML=e+"
",o.appendChild(t)})}else o.innerHTML=n.join("
");this.setCurStory({...this.curStory,messages:this.log?[...this.curStory.messages,e?`--${e}--`:"",n].filter(Boolean):[n],tags:this.story.currentTags,choices:this.story.currentChoices,paragraphEl:o}),a()};this.prevSavePoints=[];const s=(e,t)=>{this.prevSavePoints.push(this.story.state.toJson());const i=this.story.state.currentChoices[e].sourcePath.split(".")[0];this.story.ChooseChoiceIndex(e),n(t,i)};this.rewindStory=()=>{document.getElementById("choiceButtons").remove(),this.textAreaEl.removeChild(this.textAreaEl.lastElementChild),this.story.state.LoadJson(this.prevSavePoints.pop()),n()},this.createAndAddParagraph=t=>{if(console.log("made",t),t.innerHTML){const n=document.createElement("p");n.appendChild(t),n.className="story-playtest-bubble story-playtest-answer answer-post fade-in is-paused",this.textAreaEl.appendChild(n),e(n).removeClass("is-paused")}};const a=()=>{this.createAndAddParagraph(this.curStory.paragraphEl),this.textAreaEl.querySelectorAll("div").forEach(e=>e.remove());const e=document.createElement("div");e.id="choiceButtons",e.className="flex-wrap";const t=document.createElement("button");t.innerText="🔄",t.title="Recompile story",t.onclick=this.onRecompile,t.className="storyPreviewChoiceButton",e.appendChild(t);const i=document.createElement("button");i.innerText="🎬",i.title="Restart story",i.onclick=()=>{this.resetStory(),n()},i.className="storyPreviewChoiceButton",e.appendChild(i);const o=document.createElement("button");o.innerText="⏪",o.title="Go to previous",o.disabled=0===this.prevSavePoints.length,o.onclick=()=>{this.rewindStory(),n()},e.appendChild(o),o.className="storyPreviewChoiceButton",this.curStory.choices.forEach((t,n)=>{const i=document.createElement("button");i.innerText=t.text,i.onclick=e=>{e.stopPropagation(),s(n,t.text)},i.className="storyPreviewChoiceButton",e.appendChild(i)}),this.textAreaEl.appendChild(e),this.textAreaEl.scrollTo({top:this.textAreaEl.scrollHeight+100,left:0,behavior:"smooth"})};this.initInk=(e,t,i,s,a,r,l,d,c,p)=>{this.onRecompile=t,console.log("INIT INK"),this.finished=!1,document.getElementById(r).style.visibility="hidden",this.textAreaEl=document.getElementById(d),this.textAreaEl.innerHTML='

Parsing ink

.

.

.

',this.inkTextData=s,this.compiler=e,this.compiler.init(e=>{if(this.textAreaEl.innerHTML="",e.errors.length>0)return this.textAreaEl.innerHTML=`

Parsing failed:

>

${e.errors.join("

")}


${e.warnings.join("

")}

`,void(this.textAreaEl.onclick=()=>{console.log("====>",e),app.data.goToErrorInkNode(this.inkTextData,e.errors[0]),this.textAreaEl.onclick=null});if(e.warnings.length>0){const t=document.createElement("p");t.className="title-warning",e.warnings.forEach(e=>{const n=document.createElement("p");n.innerText=e,n.onclick=()=>{app.data.goToErrorInkNode(this.inkTextData,e)},t.appendChild(n)}),this.createAndAddParagraph(t)}if(this.story=new o(e.story),console.log("STORY",this.story),console.warn("Warnings",e.warnings),n(),""===this.story.currentText&&0===this.story.currentChoices.length)if(a!==app.data.InkGlobalScopeNodeName)this.compiler.submit(`-> ${a}\n`+s);else{const e=s.split("\n").find(e=>e.includes("==="));this.compiler.submit(`-> ${e.split("===")[1]}\n`+s)}}).then(()=>{if(!i.recompile&&i.story&&0!==i.prevSavePoints.length)return this.story=i.story,i.childNodes.forEach(e=>this.textAreaEl.appendChild(e)),this.prevSavePoints=i.prevSavePoints,void n();s&&this.compiler.submit(s)})}}}).call(this,n("EVdn"))},tUqF:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const i=n("Wd8k"),o=n("L8pc"),s=new i.Runner,a=n("+qE3").EventEmitter;var r=function(){this.visitedNodes=[];this.node={title:""};let e=new a;this.emiter=e;let t=[];this.commandsPassedLog=t;this.commandPassed="";let n=!0;this.finished=n,this.scrollTextStyle=!1,this.visitedChapters=[],this.self=this,this.vnChoiceSelectionCursor=">",this.startTimeWait,this.vnSelectedChoice=-1,this.vnTextScrollInterval,this.storyChapter="",this.choices={};let i,r,l,d,c,p,u,g,h=null;this.vnSelectChoice=()=>{(new Date).getTime()-this.startTimeWait<1e3||(this.choices[this.storyChapter].push(d.options[this.vnSelectedChoice]),d.select(this.vnSelectedChoice),this.emiter.emit("choiceMade",d.options[this.vnSelectedChoice]),r="",i=void 0,d=self.goToNext(),this.vnSelectedChoice=-1,this.changeTextScrollSpeed(111))},this.vnUpdateChoice=(t=0)=>{if(this.vnSelectedChoice<0)return;let n=this.vnSelectedChoice+t;n>d.options.length-1?n=0:n<0&&(n=d.options.length-1),this.vnSelectedChoice=n,i=document.createElement("DIV"),d.options.forEach((e,t)=>{const n=document.createElement("DIV");t==this.vnSelectedChoice?n.innerHTML=`${this.vnChoiceSelectionCursor} [${e}]`:n.innerHTML=`${this.vnChoiceSelectionCursor.replace(/.*/gm," ")} [${e}]`,n.onclick=e=>{e.stopPropagation(),this.vnSelectedChoice=t,this.vnUpdateChoice()},n.ondblclick=e=>{e.stopPropagation(),this.vnSelectedChoice=t,this.vnSelectChoice()},n.className="storyPreviewChoiceButton",i.appendChild(n)}),e.emit("choiceUpdated",this.vnSelectedChoice),self.updateVNHud()},this.changeTextScrollSpeed=(t=0)=>{if(t!==this.vnTextScrollInterval){if(this.vnTextScrollInterval=t,clearInterval(p),h<0){if(this.isFinishedParsing(d))return void e.emit("finished");if("TextResult"===d.constructor.name)return r=d.text,h=0,e.emit("textResult",r),void this.changeTextScrollSpeed(220);"OptionsResult"===d.constructor.name&&-1===this.vnSelectedChoice&&(this.vnSelectedChoice=0,this.vnUpdateChoice(),this.startTimeWait=(new Date).getTime())}0!==t&&(p=setInterval(this.scrollUpdateText,t))}},self.goToNext=()=>{const e=c.next().value;if(!this.isFinishedParsing(e))return"TextResult"===e.constructor.name&&e.data&&this.node.title!==e.data.title&&(r="",h=-1,this.node=self.jsonCopy(e.data),this.visitedNodes.push(e.data.title),this.emiter.emit("startedNode",this.node)),e},this.isFinishedParsing=e=>(void 0===e||null===d)&&(n||(n=!0,h=-1),n=!0,n),this.runCommand=()=>{e.emit("commandCall",d.text),t.push(d.text),d=self.goToNext(),this.isFinishedParsing(d)||("TextResult"===d.constructor.name&&(r+="\n"+d.text,e.emit("textResult",d.text)),"OptionsResult"===d.constructor.name&&(h=-1))},this.scrollUpdateText=()=>{if(!this.isFinishedParsing(d))if(h<0)"CommandResult"===d.constructor.name&&this.runCommand();else if(h>r.length){if("TextResult"===d.constructor.name){if(d=self.goToNext(),this.isFinishedParsing(d))return;"CommandResult"===d.constructor.name?this.runCommand():("TextResult"===d.constructor.name||"OptionsResult"===d.constructor.name)&&(h=-1)}}else"TextResult"===d.constructor.name&&(h+=1,l=r.substring(0,h),self.updateVNHud())},self.updateVNHud=()=>{if("TextResult"===d.constructor.name){for(;l.lastIndexOf("[img]")>l.lastIndexOf("[/img]");)h+=1,l=r.substring(0,h);for(;l.lastIndexOf("[")>l.lastIndexOf("]");)h+=1,l=r.substring(0,h)}this.scrollTextStyle&&(document.getElementById(u).innerHTML=o.parse(l)+"
"),void 0!==i&&(this.scrollTextStyle||(document.getElementById(u).innerHTML=""),document.getElementById(u).appendChild(i))},this.terminate=()=>{try{let t=document.getElementById(u);t&&(t.innerHTML=""),t=document.getElementById(g),t&&(t.innerHTML=""),i=void 0,e.removeAllListeners(),this.finished=!0}catch(e){console.warn(e)}},this.initYarn=(t,i,a,r,l,d,c)=>{const p=["#f5ff6f","#44fe66","#e00ec0","#e93ecf","#0ec0e0","#3ecfe9","#e4dbcb","#978e7e","#666","#2f919a","deeppink","black","#97E1E9","#576574","#6EA5E0","#9EDE74","#FFE374","#F7A666","#C47862"],h=["__̴ı̴̴̡̡̡ ̡͌l̡̡̡ ̡͌l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡| ̲▫̲͡ ̲̲͡▫̲̲͡͡ ̲|̡̡̡ ̡, ̴̡ı̴̡̡ ̡͌l̡̡̡̡.___","°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸","(===||:::::::::::::::>","¸.·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º>","=^..^=","|==|iiii|>-----"," ¦̵̱ ̵̱ ̵̱ ̵̱ ̵̱(̢ ̡͇̅└͇̅┘͇̅ (▤8כ−◦","(♥_♥)","龴ↀ◡ↀ龴","☁ ▅▒░☼‿☼░▒▅ ☁,","▓⚗_⚗▓","<:3 )~~~","(╯°□°)╯︵ ┻━┻","●▬▬▬▬๑۩۩๑▬▬▬▬▬●","(/)(Ö,,,,Ö)(/)","/)^3^(\\","( . Y . )","< )))) ><","(ノಠ益ಠ)ノ彡","d(^o^)b¸¸♬·¯·♩¸¸♪·¯·♫¸¸","O=('-'Q)","-`ღ´-","ˁ(⦿ᴥ⦿)ˀ","(╥﹏╥)","✲´*。.❄¨¯`*✲。❄。*。¨¯`*✲","▂▃▅▇█▓▒░۩۞۩ ۩۞۩░▒▓█▇▅▃▂","( •_•)O*¯`·.¸.·´¯`°Q(•_• )","┻━┻︵ (°□°)/ ︵ ┻━┻","|̲̲̲͡͡͡ ̲▫̲͡ ̲̲̲͡͡π̲̲͡͡ ̲̲͡▫̲̲͡͡ ̲|̡̡̡ ̡ ̴̡ı̴̡̡ ̡͌l̡ ̴̡ı̴̴̡ ̡l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡|̲̲̲͡͡͡ ̲▫̲͡ ̲̲̲͡͡π̲̲͡͡ ̲̲͡▫̲̲͡͡ |","❤◦.¸¸. ◦✿","ʕʘ̅͜ʘ̅ʔ","( ๏ Y ๏ )","ʕ•̫͡•ʕ*̫͡*ʕ•͓͡•ʔ-̫͡-ʕ•̫͡•ʔ*̫͡*ʔ-̫͡-ʔ","(っ◕‿◕)っ","❚█══█❚","─=≡Σ((( つ◕ل͜◕)つ","^ↀᴥↀ^","༼ つ ͡◕ Ѿ ͡◕ ༽つ","ᕦ(ò_óˇ)ᕤ","┬┴┬┴┤ ͜ʖ ͡°) ├┬┴┬┴","[̲̅$̲̅(̲̅5)̲̅$̲̅]","(ꈍ⌓ꈍ✿)","(๑•́ ₃ •̀๑) ♡","( • )( • )ԅ(≖⌣≖ԅ)","(。々°)","⊂(´・◡・⊂ )∘˚˳°","( ㅅ )","(ノ☉ヮ⚆)ノ ⌒*:・゚✧","(-‸ლ)","(‿|‿)","(㇏(•̀ᵥᵥ•́)ノ)","ʚ✟⃛ɞ","(′ꈍωꈍ‵)","♚ ♛ ♜ ♝ ♞ ♟ ♔ ♕ ♖ ♗ ♘ ♙","(´ᴗ`)(´ᴗ`)","♥(´∀`)","ฅ(˵●ﻌ●˵)ฅ"];if(g=l,u=a,this.yarnDataObject=t,this.startChapter=i,this.resourcesPath=r,this.finished=!1,this.scrollTextStyle="npc"===d,document.getElementById(g).innerHTML="
🚥Press/Hold Z or 📱Double-click/Tap to advance
",e.on("startedNode",(function(e){document.getElementById(g).innerHTML+="

📜 --- Loaded next node ---",document.getElementById(g).innerHTML+=` ${h[Math.floor(Math.random()*h.length)]}`,document.getElementById(g).innerHTML+="
   Title: "+e.title+"",e.tags.length>0&&e.tags[0].length>0&&(document.getElementById(g).innerHTML+="
   Tags: "+e.tags+"")})),e.on("choiceMade",(function(e){this.scrollTextStyle?document.getElementById(g).innerHTML+="
🐙Player chose: >"+e+"":document.getElementById(g).innerHTML+=`

${o.parse(e)}

`})),e.on("commandCall",(function(e){document.getElementById(g).innerHTML+=`
🐣Command call: <<${e}>>`})),this.scrollTextStyle||(e.on("textResult",(function(e){document.getElementById(g).innerHTML+=`

${o.parse(e)}

`,document.getElementById(u).innerHTML='

.

.

.

',document.getElementById(u).className="story-playtest-bubble",document.getElementById(g).scrollTo({top:document.getElementById(g).scrollHeight,left:0,behavior:"smooth"})})),e.on("choiceUpdated",(function(e){document.getElementById(u).className="story-playtest-answer"}))),e.on("finished",(function(){n=!0,e.removeAllListeners()})),Array.isArray(t))s.load(t);else{if(!("nodes"in t))return;s.load(t.nodes)}this.loadYarnChapter(i),s.variables.data={},c.forEach((function(e){console.log(e),s.variables.set(e.key,e.value)}))},this.loadYarnChapter=e=>{n=!1,this.storyChapter=e,this.choices[this.storyChapter]=[],this.visitedChapters.push(e),c=s.run(e),d=self.goToNext(),r=d.text,this.changeTextScrollSpeed(100)},this.wasChoiceMade=(e,t=this.storyChapter)=>!!this.choices[t].includes(e),this.timesNodeWasVisited=e=>{let t=0;return this.visitedNodes.forEach((n,i)=>{n===e&&(t+=1)}),t},self.jsonCopy=e=>JSON.parse(JSON.stringify(e))}},uMdg:function(e,t,n){},wt9v:function(e,t){function n(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}n.keys=function(){return[]},n.resolve=n,e.exports=n,n.id="wt9v"}},[["e6Wu",1,2]]]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{"+NoZ":function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return s})),n.d(t,"d",(function(){return a})),n.d(t,"c",(function(){return r}));const i=n("HSUl"),o=function(e="my-db",t="preferences"){return{dbName:e,objectStoreName:t,db:void 0,save:async function(e,t){const n=this.db.transaction(this.objectStoreName,"readwrite");return n.objectStore(this.objectStoreName).put({key:e,value:t}),n.complete},load:async function(e){const t=this.db.transaction(this.objectStoreName,"readonly").objectStore(this.objectStoreName),n=await t.get(e);return n&&n.value},openDatabase:function(){return i.openDB(e,1,{upgrade:e=>{e.createObjectStore(this.objectStoreName,{keyPath:"key"})}})},getDbValue:function(e=this.dbName){return this.openDatabase().then(t=>(this.db=t,this.load(e)))}}},s={JSON:"json",XML:"xml",TWEE:"twee",TWEE2:"tw2",UNKNOWN:"none",YARN:"yarn",INK:"ink",INKJSON:"ink.json",RENPY:"rpy"},a=e=>{if(!e)return s.UNKNOWN;const t=e.toLowerCase();return t.endsWith(".json")?s.JSON:t.endsWith(".yarn.txt")?s.YARN:t.endsWith(".ink")?s.INK:t.endsWith(".yarn")?s.YARN:t.endsWith(".xml")?s.XML:t.endsWith(".txt")?s.TWEE:t.endsWith(".tw2")||t.endsWith(".twee")?s.TWEE2:s.UNKNOWN},r=(e="gist")=>"gist"===e?{getFileType:a,FILETYPE:s,lastStorageHost:"GIST",fileType:s.UNKNOWN,fileHandle:void 0,writable:void 0,saveAsFile:async function(e,t){return new Promise(async(n,i)=>{const o=await window.showSaveFilePicker({suggestedName:e,types:[{description:"Yarn editor files",accept:{"text/plain":Object.values(s).map(e=>"."+e)}}]});this.fileHandle=o;const r=o.name,l=a(r);this.fileType=l;const d=await t(l),c=await o.createWritable();this.writable=c,await c.write(d),await c.close(),console.log({fileHandle:o,writable:c}),n({type:l,content:d,chosenFileName:r,fileHandle:o,writable:c})})},downloadContent:function(e,t){const n=new File([e],t,{type:"text/plain"}),i=document.createElement("a"),o=URL.createObjectURL(n);i.href=o,i.download=n.name,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(o)},saveToCurrentFile:async function(e,t){if(console.log({writable:this.writable,handle:this.fileHandle}),this.fileHandle){const t=await this.fileHandle.createWritable();await t.write(e),await t.close()}else this.downloadContent(e,t)},openFileOrFiles:async function(e=!1){const t="showOpenFilePicker"in window;let n;if(console.log({supportsFileSystemAccess:t}),t){try{const t=await showOpenFilePicker({multiple:e});e||(this.fileHandle=t[0],n=t[0],console.log({fileOrFiles:n}))}catch(e){"AbortError"!==e.name&&console.error(e.name,e.message)}return await n.getFile()}return new Promise(t=>{const n=document.createElement("input");n.style.display="none",n.type="file",document.body.append(n),e&&(n.multiple=!0),n.addEventListener("change",()=>{n.remove(),n.files&&t(e?n.files:n.files[0])}),"showPicker"in HTMLInputElement.prototype?n.showPicker():n.click()})},fileName:"",openLocalFile:function(){return this.openFileOrFiles().then(e=>(this.fileType=a(e.name),this.fileName=e.name,this.lastStorageHost="LOCAL",e.text()))},setLastStorageHost:function(e){this.lastStorageHost=e},token:void 0,gistId:void 0,setCredentials:function(e,t){this.token=e,this.gistId=t},filesInGist:{},getFilesInGist:function(e){return e?e in this.filesInGist?this.filesInGist[e]:void console.error(e+" not found in gist",this.filesInGist):this.filesInGist},getGist:function(e,t=(()=>{})){const n="https://api.github.com/gists/"+e;return fetch(n,{method:"GET",headers:{Accept:"application/vnd.github+json",Authorization:"Bearer "+this.token,"X-GitHub-Api-Version":"2022-11-28"}}).then(e=>{if(console.log("GOT -- ",{data:e}),!1===e.ok){const i={401:"Is your Gist Token valid?",404:"Is your Gist ID online?\n\naddress:\n"+n};alert(`Failed to get:\n${n}...\n\nSTATUS: ${e.status}\n${e.status in i?i[e.status]:""}`),e.status in i&&t(e.status),404===e.status&&window.open(n,"_blank").focus()}return e.json()}).then(e=>{console.log("NEW from get::",{content:e}),this.filesInGist=e.files;const t={};return Object.keys(this.filesInGist).forEach(e=>{t[e]=e}),this.setLastStorageHost("GIST"),{body:e,filesInGist:this.filesInGist,inputOptions:t,fileList:Object.keys(this.filesInGist)}})},hasGistSettings:function(){return this.gistId&&this.gistId.length>0},getGistFile:function(e=(()=>{})){return this.getGist(this.gistId,e)},getContentOrRaw:function(e,t){return new Promise((n,i)=>{!e&&t?fetch(t).then(e=>(this.fileType=a(e.name),this.fileName=e.name,this.fileHandle=e,this.lastStorageHost="GIST",e.text())).then(e=>{n(e)}):n(e)})},editGist:function(e,t,n){return console.log({gistId:e,fileName:t,content:n}),fetch("https://api.github.com/gists/"+e,{method:"POST",headers:{Accept:"application/vnd.github+json",Authorization:"Bearer "+this.token,"X-GitHub-Api-Version":"2022-11-28"},body:JSON.stringify({description:"upload data from api",public:!1,files:{[t]:{content:n}}})}).then(e=>(this.setLastStorageHost("GIST"),e.json()))},editGistFile:function(e,t){return this.editGist(this.gistId,e,t)},FILETYPE:s}:{getFile:()=>{},setFile:()=>{},credentials:credentials,setCredentials:setCredentials}},"1mrn":function(e,t,n){},"2Qx2":function(e,t,n){"use strict";(function(e,i){n.d(t,"a",(function(){return d}));var o=n("W2Rx"),s=n("oj90"),a=n("+NoZ");const r=n("33yf"),l=n("OeYU"),d={db:Object(a.a)("yarn-DB","Yarn-persistence"),storage:Object(a.c)("gist"),appInstanceStates:e.observable([]),isDocumentDirty:e.observable(!1),editingPath:e.observable(null),editingName:e.observable("NewFile"),editingType:e.observable("json"),editingFolder:e.observable(null),documentHeader:e.observable(null),lastEditedUnix:e.observable(new Date),lastSavedUnix:e.observable(null),inkCompiler:null,editingFileFolder:function(e=""){const t=d.editingPath()?d.editingPath():"";return e.length>0?r.join(r.dirname(t),e):r.dirname(t)},startNewFile:function(e="NewFile",t="json"){d.editingPath(null),d.editingName(e),d.editingType(t),d.editingFolder(null),d.documentHeader(null),app.workspace.selectedNodes=[],app.editing(null),t===a.b.INK&&app.settings.documentType("ink"),app.nodes([app.newNode(!0).title("ink"===app.settings.documentType()?d.InkGlobalScopeNodeName:"Start").body("ink"===app.settings.documentType()?"":"Empty text")]),app.tags([]),app.updateNodeLinks(),app.workspace.warpToNodeByIdx(0),d.isDocumentDirty(!0),app.refreshWindowTitle(),d.saveAppStateToLocalStorage(),app.ui.dispatchEvent("newYarnFileStarted")},askForFileName:function(){Swal.fire({title:"Enter a New File Name",input:"text",inputPlaceholder:"NewFile",showCancelButton:!0}).then(e=>{(e.value||""===e.value)&&d.startNewFile(e.value||"NewFile")})},setNewFile:function(){Swal.fire({title:"Create a New File?",text:`Any unsaved progress to ${d.editingName()}.${d.editingType()} will be lost!\n Path: ${d.editingPath()}\n Storage: ${app.settings.lastStorageHost()}\n `,icon:"warning",showCancelButton:!0,confirmButtonText:"New file",cancelButtonText:"No, cancel!"}).then(e=>{e.value?d.askForFileName():d.startNewFile("NewFile")})},loadDocumentStateTabFromIndex:function(e){app.log("ATTEMPT TO LOAD STATE",e),app.settings.selectedFileTab(e),d.loadAppStateFromLocalStorage()},getCurrentAppState:function(){return{editingPath:d.editingPath(),editingName:d.editingName(),documentType:app.settings.documentType(),editingType:d.editingType(),editingFolder:d.editingFolder(),editingTitle:app.editing()?app.editing().title():null,nodes:d.getNodesAsObjects(),documentHeader:d.documentHeader(),tags:app.tags(),editorSelection:app.editor?app.editor.selection.getRange():null,transform:app.workspace.transform,scale:app.workspace.scale,lastStorageHost:app.settings.lastStorageHost(),lastEditedUnix:d.lastEditedUnix()||"",lastSavedUnix:d.lastSavedUnix(),pluginStorage:app.plugins.pluginStorage}},deleteDocumentStateTab:function(e){Swal.fire({title:"Are you sure?",text:`Are you sure you want to close this file? Any unsaved changes to ${d.editingName()}.${d.editingType()} will be lost!\n Path: ${d.editingPath()||""}\n Storage: ${app.settings.lastStorageHost()}\n `,icon:"warning",showCancelButton:!0,confirmButtonText:"Yes close",cancelButtonText:"Cancel",reverseButtons:!0}).then(t=>{if(t.value){app.log("DELETE TAB",d.appInstanceStates(),e);const t=d.appInstanceStates().filter((t,n)=>n!==e).map(e=>({...e}));d.appInstanceStates([...t]),d.saveAppStateToLocalStorage(!1),setTimeout(()=>{const t=e>d.appInstanceStates().length-1?d.appInstanceStates().length-1:e;d.loadDocumentStateTabFromIndex(t)},500),app.log(d.appInstanceStates(),"resulting mutation",t)}})},addDocumentState:function({editingName:e,editingType:t,yarnData:n,checked:i}){d.appInstanceStates([...d.appInstanceStates(),{...d.getCurrentAppState()}]),app.log("DOCUMENT TAB ADDED",d.appInstanceStates()),d.saveAppStateToLocalStorage(),d.loadDocumentStateTabFromIndex(d.appInstanceStates().length-1),i?(d.editingName(e),d.editingType(t)):d.startNewFile(e,t),app.log({editingName:e,yarnData:n,editingType:t,checked:i})},addDocumentStateTab:function(){d.promptFileNameAndFormat(d.addDocumentState,null,"📜 Name of new file"," Copy of "+d.editingName())},saveAppStateToLocalStorage:s.Utils.debounce((function(e=!0){app.settings.storage;d.isDocumentDirty(!0),d.lastEditedUnix(new Date),app.refreshWindowTitle();const t=[...d.appInstanceStates()];e&&(t[app.settings.selectedFileTab()]=d.getCurrentAppState()),d.appInstanceStates(t),d.db.save("appStates",JSON.stringify(d.appInstanceStates())),app.ui.dispatchEvent("yarnSavedStateToLocalStorage")}),700),loadAppStateFromLocalStorage:async function(){const e=app.settings.storage;e.getItem("appState")&&(app.log("--- storage.clear() ---"),e.clear());const t=await d.db.getDbValue("appStates"),n=JSON.parse(t),i=n[app.settings.selectedFileTab()];if(!1===app.settings.restoreSessionEnabled())return i&&(app.pluginStorage=i.pluginStorage),app.settings.selectedFileTab(0),void d.startNewFile();if(d.appInstanceStates(n),app.log("APP state",n,i),i){const{editingPath:e,editingName:t,editingType:n,documentType:o,editingFolder:s,editingTitle:a,editorSelection:r,nodes:l,documentHeader:c,tags:p,transform:u,scale:g,pluginStorage:h,lastEditedUnix:m,lastSavedUnix:f}=i;app.pluginStorage=h,app.tags(p),d.editingPath(e),d.editingName(t),d.editingType(n),app.settings.documentType(o),d.editingFolder(s),d.lastEditedUnix(m),d.lastSavedUnix(f),d.documentHeader(c),d.isDocumentDirty(!0),app.refreshWindowTitle(),app.ui.dispatchEvent("yarnLoadedStateFromLocalStorage"),app.log("--- app.plugins.pluginStorage ---"),d.getNodesFromObjectsAsync(l).then(e=>{a&&(app.editNode(e.find(e=>e.title()===a)),r&&app.editor.selection.setRange(r)),app.log("--- app.nodes(newNodes) ---",e.length),app.nodes(e),app.log("--- app.updateNodeLinks ---"),app.updateNodeLinks(),app.log("--- app.workspace.setTranslation ---"),app.workspace.setTranslation(u.x,u.y),app.log("--- app.workspace.setZoom ---"),app.workspace.setZoom(4*g)})}},readFile:function(e,t,n){d.getFileData(e,t).then(t=>{d.editingPath(e.path),d.editingType(t.type),d.loadData(t.data,t.type,n)})},setNewFileStats:function(e,t,n="LOCAL"){app.log("Updated save data",e,t),d.editingName(e.replace(/^.*[\\\/]/,"")),d.isDocumentDirty(!1),d.editingPath(t),app.settings.lastStorageHost(n),app.refreshWindowTitle()},openFile:function(e,t){const n=d.editingPath()?"Any unsaved progress to "+d.editingName()+" will be lost.":"Any unsaved progress will be lost.";Swal.fire({title:"Are you sure you want to open another file?",text:n,icon:"warning",showConfirmButton:!0,showCancelButton:!0}).then(n=>{!0===n.value&&(d.readFile(e,t,!0),d.setNewFileStats(t,e.path),app.refreshWindowTitle())})},openFileFromFilePath:function(e){const t=app.path.basename(e);i.ajax({url:e,async:!1,success:n=>{const i=Object(a.d)(t);i===a.b.UNKNOWN?Swal.fire({title:"Unknown filetype!",icon:"error"}):(d.loadData(n,i,!0),d.setNewFileStats(t,e),d.editingType(i))}})},getFileData:function(e,t){return new Promise((n,i)=>{const o=new FileReader;o.onload=function(s){const r=Object(a.d)(t);r===a.b.UNKNOWN?(Swal.fire({title:"Unknown filetype!",icon:"error"}),i()):n({file:e,type:r,data:o.result,name:e.name})},o.readAsText(e)})},openFolder:function(e,t){editingFolder=t,Swal.fire({text:"openFolder not yet implemented e: "+e+" foldername: "+t,icon:"error"})},appendFile:function(e,t){d.readFile(e,t,!1)},dispatchEventDataLoaded:function(){var e=new CustomEvent("yarnLoadedData");e.document=document,e.data=d,e.app=app,window.dispatchEvent(e),window.parent.dispatchEvent(e)},restoreSettingsFromDocumentHeader:function(){if(null!==d.documentHeader()){const e=d.documentHeader();app.log("Apply settings from file header:",e),"markupLanguage"in e&&app.settings.markupLanguage(e.markupLanguage),"language"in e&&app.settings.language(e.language),"filetypeVersion"in e&&app.settings.filetypeVersion(e.filetypeVersion),app.settings.apply()}},loadData:function(e,t,n){const i=[],o=e=>{for(let t=0;t{try{l.title=r[e].split("//yarn-editor-metadata:")[0].replace(/===/g,"").trim();const{x:t,y:n,colorID:i}=JSON.parse(r[e].split("//yarn-editor-metadata:")[1]);l.position={x:parseInt(t),y:parseInt(n)},l.colorID=i}catch(e){console.warn("node metadata failed parse: ",e)}};for(let e=0;e-1)null==l&&(l={}),l.title=r[e].substr(7,r[e].length-7);else if(r[e].indexOf("position:")>-1){null==l&&(l={});var p=r[e].substr(9,r[e].length-9).split(",");l.position={x:Number(p[0].trim()),y:Number(p[1].trim())}}else r[e].indexOf("colorID:")>-1?(null==l&&(l={}),l.colorID=Number(r[e].substr(9,r[e].length-9).trim())):r[e].indexOf("tags:")>-1?(null==l&&(l={}),l.tags=r[e].substr(6,r[e].length-6)):"---"===r[e].trim()&&(c=!0,l.body="");null!=l&&i.push(l),app.setDocumentType("yarn")}else if(t===a.b.TWEE||t===a.b.TWEE2){r=e.split("\n"),l=null;for(var u=0,g=0;g0&&b>0&&(m=r[g].substr(y+1,b-y-1));var w=r[g].indexOf("<"),v=r[g].indexOf(">");if(w>0&&v>0){var S=r[g].substr(w+1,v-w-1).split(",");f.x=parseInt(S[0]),f.y=parseInt(S[1])}var T=0;y>0?T=y:w>0&&(T=w),h=(h=T?r[g].substr(3,T-3):r[g].substr(3)).trim(),l.title=h,l.tags=m,l.body="",l.position=f}else null!=l&&(l.body.length>0&&(r[g]+="\n"),l.body+=r[g]);null!=l&&i.push(l),app.setDocumentType("yarn")}else if(t===a.b.XML){app.setDocumentType("yarn");var x=(new DOMParser).parseFromString(e,"text/xml");if(void 0!==(e=s.Utils.xmlToObject(x)))for(let t=0;t{n&&app.nodes.removeAll(),d.getNodesFromObjects(i).forEach(e=>app.nodes.push(e))}),d.editingType(t),d.restoreSettingsFromDocumentHeader(),app.updateNodeLinks(),app.workspace.warpToNodeByIdx(0),d.isDocumentDirty(!1),d.addGlobalScopeToInkDoc(),d.dispatchEventDataLoaded()},addGlobalScopeToInkDoc:function(){"ink"!==app.settings.documentType()||app.nodes().find(e=>e.title().trim()===d.InkGlobalScopeNodeName)||app.newNode(!0).title(d.InkGlobalScopeNodeName).x(-400)},getNodeFromObject:function(e){return new o.a({title:e.title,body:e.body,tags:e.tags,colorID:e.colorID,x:parseInt(e.position.x),y:parseInt(e.position.y)})},getNodeAsObject:function(e){return{title:e.title(),tags:e.tags(),body:e.body(),position:{x:e.x(),y:e.y()},colorID:e.colorID()}},getNodesFromObjects:function(e){const t=[];if(!e)return[];for(let n=0;nnew Promise(t=>t(d.getNodeFromObject(e))));return await Promise.all(t)},getNodesAsObjects:function(){const e=[],t=app.nodes();for(var n=0;ne.title.trim()===d.InkGlobalScopeNodeName);if(e){if(n){const t=e.body.split(/\r\n|\r|\n/).filter(e=>e.trim().startsWith("INCLUDE "));o+=e.body.split(/\r\n|\r|\n/).filter(e=>!e.trim().startsWith("INCLUDE ")).join("\n");for(const e of t){const t=e.trim().split("INCLUDE ");if(t.length>1){const e=d.appInstanceStates().find(e=>e.editingType===a.b.INK&&e.editingName===t[1]);if(e){o+=await d.getSaveData(a.b.INK,null,n,e.nodes)+"\n"}}}}else o+=e.body;if(t&&o.split(/\r\n|\r|\n/).length>t)return e}for(let e=0;e0&&"\n"===s[s.length-1]||(o+="\n"),t&&o.split(/\r\n|\r|\n/).length>t)return n}}else if(e===a.b.INKJSON){const e=await d.getSaveData("ink",null,!0),t=new Promise((t,n)=>{app.ui.toastMixin.fire({title:"Ink file is compiling",icon:"info",timer:4e3,text:"Please wait..."}),d.inkCompiler.init(i=>{i.errors.length>0?(Swal.fire({title:"Failed to parse ink file",html:`
${i.errors.join("
")}
`,icon:"error"}).then(()=>d.goToErrorInkNode(e,i.errors[0])),n()):(app.log("Warnings",i.warnings),app.ui.toastMixin.fire({animation:!0,title:i.warnings.length>0?"Ink file compiled with some warnings":"Ink file compiled successfully",icon:i.warnings.length>0?"warning":"success",text:i.warnings.join("\n")}),app.log({responseStory:i.story}),t(JSON.stringify(i.story,null,"\t")))}).then(()=>d.inkCompiler.submit(e))});o=await t}else if(e===a.b.YARN)for(let e=0;e0&&"\n"===s[s.length-1]||(o+="\n"),o+="===\n"}else if(e===a.b.RENPY)for(let e=0;e0&&"\n"===t[t.length-1]||(o+="\n");let n=!1,s=!1,a="";const r=i[e].tags.includes("renpy");t.split("\n").forEach(e=>{const t=e.trim(),i=s?"\t\t":"\t";if(r)a+=`${i}${e}\n`;else if(t.startsWith("[[")){const e=t.replace(/[\[\[]|[\]\]]]/g,"").split("|");e.length>1?(n||(a+=i+"menu:\n",n=!0),a+=`${i}\t"${e[0].trim()}":\n${i}\t\tjump ${e[1].trim()}\n`):a+=`${i}jump ${e[0].trim()}\n`}else if(t.startsWith("<\>|if/g,"").split(/==|!=|>||==|!=|<)/);a+=e.length>1&&n?`\tif ${e[0].trim()} ${n[0]} ${e[1].trim()}:\n`:`\t# ${t}\n`,s=!0}else if(t.startsWith("<\>|elseif/g,"").split(/==|!=|>||==|!=|<)/);a+=e.length>1&&n?`\telif ${e[0].trim()} ${n[0]} ${e[1].trim()}:\n`:`\t# ${t}\n`,s=!0}else if(t.startsWith("<\$]|set /g,"").split("=");app.log({set:e}),a+=e.length>1?`${i}$ ${e[0].trim()} = ${e[1].trim()}\n`:`${i}#$ ${e[0].trim()} = 0:\n`}else t.startsWith("<<")?a+=`${i}${t.replace(/[\<\>]/g,"")}\n`:t.startsWith("//")?a+=`${i}#${t.substring(2)}\n`:t.length>0&&(t.endsWith('"')?a+=`${i}${t}\n`:a+=`${i}"${t}"\n`);n=!1}),o+=a+"\n"}else if(e===a.b.TWEE)for(let e=0;e0&&(r=" ["+i[e].tags+"]"),o+=":: "+i[e].title+r+"\n",o+=i[e].body+"\n\n"}else if(e===a.b.TWEE2)for(let e=0;e0&&(r=" ["+i[e].tags+"]");var l=" <"+i[e].position.x+","+i[e].position.y+">";o+=":: "+i[e].title+r+l+"\n",o+=i[e].body+"\n\n"}else if(e===a.b.XML){o+="\n";for(let e=0;e\n",o+="\t\t"+i[e].title+"\n",o+="\t\t"+i[e].tags+"\n",o+="\t\t"+i[e].body+"\n",o+='\t\t\n',o+="\t\t"+i[e].colorID+"\n",o+="\t\n";o+="\n"}return d.isDocumentDirty(!1),app.refreshWindowTitle(),o},tryOpenFile:function(){d.storage.openLocalFile().then(e=>{d.addDocumentState({editingName:d.storage.fileName,editingType:d.storage.fileType,yarnData:e}),d.loadData(e,d.storage.fileType,!0)})},promptFileNameAndFormat:function(e,t=null,n="💾 Save file - enter file name",i=""){const o=d.editingName().replace(/\.[^/.]+$/,"")+"."+d.editingType();Swal.fire({title:n,html:` \n \n ${t&&t.map(e=>`\n ${i?`

${i}`:""}\n `,onOpen:()=>{"NewFile"!==d.editingName()&&(document.getElementById("swal-input1").value=o,document.getElementById("swal-input1").addEventListener("focus",e=>{e.target.value="",e.target.showPicker()}))},showCancelButton:!0,preConfirm:()=>({name:document.getElementById("swal-input1").value,checked:!!i&&document.getElementById("swal-checkbox-checked").checked})}).then(({value:t})=>{if(t){const{name:n,checked:i}=t,o=n.split(".").pop(),s=Object.values(a.b).includes(o)?o:d.editingType(),r=(n||"").replace(/\.[^/.]+$/,"")+"."+s;d.getSaveData(s).then(t=>{e({editingName:r,editingType:s,yarnData:t,checked:i})})}})},tryShareFilePwa:function(e){d.promptFileNameAndFormat(({editingName:e,yarnData:t})=>{const n=[new Blob([t],{type:"text/plain"})],i=new File(n,e,{});navigator.canShare&&navigator.canShare({files:[i]})?navigator.share({title:e,text:t,file:[i]}).then(()=>app.log("Successful share")).catch(e=>app.log("Error sharing",e)):Swal.fire({title:"Web Share API is not supported in your browser.\nTry using it on your smartphone or tablet...",icon:"error"})})},trySaveGist:function(e){console.log({gists:e}),d.storage.hasGistSettings()?d.storage.getGistFile().then(e=>{const t=Object.keys(e.body.files);app.log(t),d.promptFileNameAndFormat(({editingName:e,yarnData:t})=>{d.editingName(e),d.storage.editGist(d.storage.gistId,e,t),Swal.fire("Saved!","The Yarn has been saved to gist "+d.storage.gistId,"success"),app.settings.lastStorageHost("GIST"),d.isDocumentDirty(!1),app.refreshWindowTitle()},t)}):(Swal.fire("Not configured","Your github settings are not configured","warning"),app.ui.openSettingsDialog())},openGist:function(e,t){const n=Object(a.d)(t);d.loadData(e,n,!0),d.isDocumentDirty(!1),app.settings.lastStorageHost("GIST"),d.editingPath(null),d.editingName(t),app.settings.lastEditedGist(t),app.refreshWindowTitle()},tryOpenGist:function(e){if(d.storage.hasGistSettings()){console.log({edit:d.editingName(),last:app.settings.lastEditedGist(),lastHost:app.settings.lastStorageHost()});const e="GIST"===app.settings.lastStorageHost()?app.settings.lastEditedGist():"";d.storage.getGistFile(app.ui.openSettingsDialog).then(({inputOptions:t,filesInGist:n})=>{Swal.fire({title:"🐙 Open file from a gist",input:"select",inputOptions:t,inputAttributes:{autocomplete:"off"},inputValue:e,inputPlaceholder:"Select a file from the gist",showCancelButton:!0}).then(({value:e})=>{if(e){const t=n[e].content,i=n[e].raw_url;d.storage.getContentOrRaw(t,i).then(t=>{d.openGist(t,e)})}})})}else Swal.fire("Not configured","Your github settings are not configured","warning"),app.ui.openSettingsDialog()},tryAppend:function(){d.storage.openLocalFile().then(e=>{d.loadData(e,d.storage.fileType,!1)})},trySave:function(e){const t=(d.editingName()||"").replace(/\.[^/.]+$/,"")+"."+e;d.storage.saveAsFile(t,d.getSaveData).then(e=>{d.setNewFileStats(e.chosenFileName,"","LOCAL"),d.editingType(e.type)})},trySaveCurrent:function(){if(d.isDocumentDirty())if("GIST"===app.settings.lastStorageHost()){const e=d.storage;e.getGistFile().then(t=>{d.getSaveData(d.editingType()).then(t=>{d.getSaveData(d.editingType()),e.editGistFile(d.editingName(),t),app.settings.lastStorageHost("GIST"),d.isDocumentDirty(!1),app.refreshWindowTitle(),app.ui.toastMixin.fire({title:"Saved",text:`Saved ${d.editingName()} to Gist`})})})}else d.editingPath()?d.editingPath().length>0&&d.editingType().length>0&&d.getSaveData(d.editingType()).then(e=>{}):d.getSaveData(d.editingType()).then(e=>{d.storage.saveToCurrentFile(e,d.editingName())})},doesFileExist:function(e){return!1},triggerPasteClipboard:function(){if(app.electron){const e=app.electron.clipboard.readText();app.clipboard=e,document.execCommand("paste")}else navigator.clipboard&&navigator.clipboard.readText().then(e=>{app.clipboard=e}).catch(e=>{app.clipboard=app.editor.getSelectedText(),app.log("No clipboard access",e,"using local instead")}),setTimeout(()=>app.insertTextAtCursor(app.clipboard),100)},triggerCopyClipboard:function(){if(app.electron)app.electron.clipboard.writeText(app.editor.getSelectedText()),app.clipboard=app.editor.getSelectedText();else{const e=app.editor.getSelectedText();app.clipboard=e,navigator.clipboard&&e.length>0&&navigator.clipboard.writeText(e).then(()=>{app.clipboard=e})}},InkCompiler:function(){this.errors=[],this.warnings=[],this.errorHandler=(e,t)=>{let n=e.match(/^(ERROR|RUNTIME ERROR): ('([^']+)' )?line (\d+): (.*)/);let i=e.match(/^(WARNING|RUNTIME WARNING|TODO): ('([^']+)' )?line (\d+): (.*)/);n?this.errors.push(e):i&&this.warnings.push(e)},this.compilerOptions=new l.CompilerOptions(null,[],!1,this.errorHandler),this.ready=!1,this.worker=null,this.onComplete=()=>{},this.init=(e=(()=>{}))=>(this.onComplete=e,new Promise((e,t)=>{e()})),this.submit=e=>{this.errors=[],this.warnings=[];const t=new l.Compiler(e,this.compilerOptions).Compile().ToJson(),n={story:JSON.parse(t),warnings:this.warnings,errors:this.errors};this.onComplete(n)},this.getInkErrorGotoNode=async(e,t)=>{const n=t.substr(t.lastIndexOf(":")+1,t.length).trim();try{const e=Number(t.match(/line ([0-9]+):/)[1]);return{ln:e,node:(await d.getSaveData(a.b.INK,e)).title,find:n}}catch(e){return console.error(e),null}}},InkGlobalScopeNodeName:"INK_GLOBAL_SCOPE",goToErrorInkNode:(e,t)=>{d.inkCompiler.getInkErrorGotoNode(e,t).then(e=>{if(e){const{node:t,ln:n,find:i}=e;app.openNodeByTitle(t,i)}})}}}).call(this,n("Z1dp"),n("EVdn"))},"3ozf":function(e,t,n){},"5aMW":function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return a}));var i=n("tUqF"),o=n("qVgP");const{JSONEditor:s}=n("JGHU");var a=function({app:t,createButton:a,addSettingsItem:r,getPluginStore:l,onYarnEditorOpen:d,onYarnInPreviewMode:c,onYarnSavedNode:p,onYarnSetDocumentType:u,onKeyUp:g,onKeyDown:h,onLoad:m,setPluginStore:f}){const y=this;this.name="Runner",this.onOpenDialog=async()=>{let e=null;const{value:i}=await Swal.fire({title:"Playtest starting variables",html:'
',focusConfirm:!1,customClass:"swal-wide",onOpen:()=>{n("1mrn"),e=new s({id:"jsoneditor"});const i=l(y.name);t.log({editor:e}),e.setValue("object"!=typeof i.variables?[{key:"er",value:"erd"}]:i.variables),f(y.name,"runnerVariablesOpen",!0)},preConfirm:()=>(f(y.name,"runnerVariablesOpen",!1),e.getValue())});i&&f(y.name,"variables",i)},m(()=>{r({title:"Playtesting Style",valueKey:"playtestStyle",defaultValue:"chat",optionsKey:"availablePlaytestStyles",options:[{id:"npc",name:"Npc bubble"},{id:"chat",name:"Chat messages"}],setterKey:"setPlaytestStyle",settingsColumn:"A"}),a(y.name,{name:"Playtest variables",attachTo:"fileMenuDropdown",onClick:"onOpenDialog()",iconName:"cog"}),l(y.name).runnerVariablesOpen&&y.onOpenDialog()});const b=()=>{if("yarn"===t.settings.documentType())this.previewStory=new i.a,this.gotoLastPlayNode=function(){t.editing()&&t.editing().title()!==y.previewStory.node.title&&t.openNodeByTitle(y.previewStory.node.title),t.editor.focus()},this.advanceStoryPlayMode=function(e=5){y.previewStory.finished?(y.togglePlayMode(!1),y.gotoLastPlayNode()):(y.previewStory.changeTextScrollSpeed(e),-1!=y.previewStory.vnSelectedChoice&&5===e&&y.previewStory.vnSelectChoice())},this.togglePlayMode=function(n=!1){const i=e(".editor")[0],o=document.getElementById("storyPlayButton"),s=document.getElementById("editor-play");if(e("#editor-play").addClass("inYarnMode"),e("#commandDebugLabel").addClass("inYarnMode"),t.isEditorInPlayMode(n),n){i.style.display="none",e(".bbcode-toolbar").addClass("hidden"),s.style.display="flex",e(o).addClass("disabled"),y.previewStory.emiter.on("finished",(function(){y.togglePlayMode(!1),y.gotoLastPlayNode()})),y.previewStory.emiter.on("startedNode",(function(e){t.isEditorSplit&&t.workspace.warpToNode(t.getFirstFoundNode(e.title.toLowerCase().trim()))}));const n=l(y.name);t.log("variables",n),t.data.getSaveData("json").then(e=>{y.previewStory.initYarn(JSON.parse(e),t.editing().title().trim(),"NVrichTextLabel",!1,"commandDebugLabel",t.settings.playtestStyle(),n.variables||[])})}else t.editor.session.setScrollTop(s.scrollTop),s.style.display="none",i.style.display="flex",e(o).removeClass("disabled"),e(".bbcode-toolbar").removeClass("hidden"),e(".toggle-toolbar").removeClass("hidden"),e(".editor-counter").removeClass("hidden"),y.previewStory.terminate()},c(()=>y.togglePlayMode(!1)),p(()=>y.togglePlayMode(!1)),d(()=>{a(y.name,{iconName:"play",title:"Preview",attachTo:"bbcodeToolbar",onClick:"togglePlayMode(true)",className:"bbcode-button bbcode-button-right",id:"storyPlayButton"});const e=document.createElement("div");e.innerHTML=`\n
\n

\n
\n
\n `,document.getElementById("editorContainer").appendChild(e),h(e=>{if(t.editing()&&!y.previewStory.finished)switch(e.keyCode){case t.input.keys.Z:y.previewStory.changeTextScrollSpeed(10),-1!=y.previewStory.vnSelectedChoice&&y.previewStory.vnSelectChoice();break;case t.input.keys.Up:-1!=y.previewStory.vnSelectedChoice&&y.previewStory.vnUpdateChoice(-1);break;case t.input.keys.Down:-1!=y.previewStory.vnSelectedChoice&&y.previewStory.vnUpdateChoice(1)}}),g(e=>{e.keyCode===t.input.keys.Z&&(y.previewStory.changeTextScrollSpeed(200),-1!=y.previewStory.vnSelectedChoice&&y.previewStory.vnSelectChoice())})});else{this.previewStory=new o.a,this.prevSession={story:null,prevSavePoints:[],childNodes:[],recompile:!1};const n=new t.data.InkCompiler;this.togglePlayMode=function(i=!1){const o=e(".editor")[0],s=document.getElementById("storyPlayButton"),a=document.getElementById("editor-play");if(t.isEditorInPlayMode(i),e("#editor-play").addClass("inInkMode"),e("#commandDebugLabel").addClass("inInkMode"),i){a.style.display="flex",e("#editor").addClass("editor-take-half"),y.previewStory.emiter.on("finished",(function(){y.togglePlayMode(!1),y.gotoLastPlayNode()})),y.previewStory.emiter.on("startedNode",(function(e){t.isEditorSplit&&t.workspace.warpToNode(t.getFirstFoundNode(e.title.toLowerCase().trim()))}));const i=l(y.name);t.log("VARIABLES::::",i),t.data.getSaveData("ink",null,!0).then(e=>{y.previewStory.initInk(n,()=>{y.prevSession={...y.prevSession,recompile:!0},y.togglePlayMode(!0)},y.prevSession,e,t.editing().title().trim(),"NVrichTextLabel",!1,"commandDebugLabel",t.settings.playtestStyle(),i.variables||[])})}else t.editor.session.setScrollTop(a.scrollTop),a.style.display="none",o.style.display="flex",e("#editor").removeClass("editor-take-half"),e(s).removeClass("disabled"),y.prevSession={prevSavePoints:y.previewStory.prevSavePoints,story:y.previewStory.story,childNodes:y.previewStory.textAreaEl?[...y.previewStory.textAreaEl.childNodes]:[],recompile:!1},y.previewStory.terminate();t.editor.resize()},c(()=>y.togglePlayMode(!1)),p(()=>y.togglePlayMode(!1)),this.advanceStoryPlayMode=function(e=5){},d(()=>{a(y.name,{iconName:"play",title:"Preview",attachTo:"bbcodeToolbar",onClick:"togglePlayMode(!app.isEditorInPlayMode())",className:"bbcode-button bbcode-button-right",id:"storyPlayButton"});const e=document.createElement("div");e.innerHTML=`\n
\n

\n
\n
\n `,document.getElementById("editorContainer").appendChild(e)})}};b(),u(b),t.togglePlayMode=this.togglePlayMode}}).call(this,n("EVdn"))},"5dEm":function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return o}));var i=n("oj90");const o=function(t){const n=this,o={toast:!0,position:"bottom",icon:"error",title:"Alignment requires two or more nodes be selected.",showConfirmButton:!1,timer:3500,timerProgressBar:!0};this.canvas=e(".arrows")[0],this.context=n.canvas.getContext("2d"),this.gridCanvas=e("#grid-canvas")[0],this.gridContext=n.gridCanvas.getContext("2d"),this.gridEnabled=!0,this.updateArrowsThrottle=50,this.updateArrowsInterval=void 0,this.deferredArrowsDrawInterval=void 0,this.nextArrowsUpdate=Number.NEGATIVE_INFINITY,this.isDrawingArrows=!1,this.selectedNodes=[],this.scale=1,this.offset={x:0,y:0},this.transform={x:0,y:0},this.isMarqueeEnabled=!1,this.marqueeSelection=[],this.marqueeRect={x1:0,y1:0,x2:0,y2:0},this.marqueeOffset=[0,0],this.zoomSpeed=.005,this.zoomLimitMin=.05,this.zoomLimitMax=1,this.setThrottle=function(e,t){const o=t?t.target.value:e;n.updateArrowsThrottle=i.Utils.clamp(o,16,250)},this.setTranslation=function(e,t,i=0){n.transform.x=e,n.transform.y=t,n.translate(i)},this.shiftTranslation=function(e,t,i=0){n.setTranslation(n.transform.x+e,n.transform.y+t,i)},this.translate=function(t){t&&n.startUpdatingArrows(),e(".nodes-holder").finish().transition({transform:"matrix("+n.scale+",0,0,"+n.scale+","+n.transform.x+","+n.transform.y+")"},t||0,"easeInQuad",(function(){t&&n.stopUpdatingArrows(),n.updateArrows(),n.updateGrid()}))},this.toWorkspaceCoordinates=(e,i)=>t.settings.snapGridEnabled()?{x:n.stepify((e-n.transform.x)/n.scale,t.settings.gridSize()),y:n.stepify((i-n.transform.y)/n.scale,t.settings.gridSize())}:{x:(e-n.transform.x)/n.scale,y:(i-n.transform.y)/n.scale},this.onPanLeft=function(){n.shiftTranslation(n.getPanAmount(),0,100)},this.onPanRight=function(){n.shiftTranslation(-n.getPanAmount(),0,100)},this.onPanUp=function(){n.shiftTranslation(0,n.getPanAmount(),100)},this.onPanDown=function(){n.shiftTranslation(0,-n.getPanAmount(),100)},this.getPanAmount=function(){return t.input.isShiftDown?100*n.scale:500*n.scale},this.setZoom=function(e){n.scale=e/4,n.translate(200)},this.onZoom=function(e,t,o){const s=n.scale,a=o*n.zoomSpeed*n.scale;n.scale=i.Utils.clamp(n.scale+a,n.zoomLimitMin,n.zoomLimitMax);const r=e-n.transform.x,l=t-n.transform.y,d=r-r*(n.scale/s),c=l-l*(n.scale/s);n.shiftTranslation(d,c)},this.onDragStart=function(e){n.offset.x=e.x,n.offset.y=e.y},this.onDragUpdate=function(e){n.isMarqueeEnabled&&t.workspace.onMarqueeEnd(),t.workspace.shiftNodes(e)},this.onDragEnd=function(){t.data.saveAppStateToLocalStorage()},this.onMarqueeStart=function(e){n.isMarqueeEnabled=!0,n.offset.x=e.x,n.offset.y=e.y,n.marqueeSelection=[],n.marqueeOffset[0]=0,n.marqueeOffset[1]=0,n.marqueeRect={x1:0,y1:0,x2:0,y2:0}},this.onMarqueeUpdate=function(e){n.isMarqueeEnabled&&(n.updateMarqueeRect(e),n.selectNodesInsideMarquee())},this.updateMarqueeRect=function(t){t.x>n.offset.x&&t.yn.offset.x&&t.y>n.offset.y?(n.marqueeRect.x1=n.offset.x,n.marqueeRect.y1=n.offset.y,n.marqueeRect.x2=t.x,n.marqueeRect.y2=t.y):t.x{const t=n.marqueeSelection.indexOf(e),o=t>=0,a=e.x(),r=e.y(),l={left:a,right:a+e.width,top:r,bottom:r+e.height},d=i.Utils.rectanglesOverlap(s,l);d&&!o&&(n.selectNodes(e),n.marqueeSelection.push(e)),!d&&o&&(n.deselectNodes(e),n.marqueeSelection.splice(t,1))})},this.onMarqueeEnd=function(){n.isMarqueeEnabled&&(0==n.marqueeSelection.length&&n.deselectAll(),n.isMarqueeEnabled=!1,n.marqueeSelection=[],n.marqueeRect={x1:0,y1:0,x2:0,y2:0},e("#marquee").css({display:"none",x:0,y:0,width:0,height:0}))},this.shiftNodes=function(e){const t={x:e.x-n.offset.x,y:e.y-n.offset.y};n.shiftTranslation(t.x,t.y),n.offset=e},this.updateGrid=function(){const i=e(".nodes-holder").offset(),o=t.settings.gridSize();if(n.gridContext.clearRect(0,0,n.gridCanvas.width,n.gridCanvas.height),t.settings.snapGridEnabled()){const r=e(window).width(),l=e(window).height(),d=i.left%(o*n.scale),c=i.top%(o*n.scale);n.gridContext.beginPath(),n.gridContext.lineWidth=.5;for(var s=d;s=315?(u=!0,h=(n.x()+n.width)*a+s.left,m=(n.y()+n.halfHeight)*a+s.top,f=e.x()*a+s.left-l,y=(e.y()+e.halfHeight)*a+s.top,p.push({x1:f+l,y1:y,x2:f-l,y2:y-d,x3:f-l,y3:y+d})):g>45&&g<135?(u=!1,h=(n.x()+n.halfWidth)*a+s.left,m=n.y()*a+s.top,f=(e.x()+e.halfWidth)*a+s.left,y=(e.y()+n.height)*a+s.top+d,p.push({x1:f,y1:y-d,x2:f-l,y2:y+d,x3:f+l,y3:y+d})):g>=135&&g<=225?(u=!0,h=n.x()*a+s.left,m=(n.y()+n.halfHeight)*a+s.top,f=(e.x()+e.width)*a+s.left+l,y=(e.y()+e.halfHeight)*a+s.top,p.push({x1:f-l,y1:y,x2:f+l,y2:y-d,x3:f+l,y3:y+d})):g>225&&g<315&&(u=!1,h=(n.x()+n.halfWidth)*a+s.left,m=(n.y()+n.height)*a+s.top,f=(e.x()+e.halfWidth)*a+s.left,y=e.y()*a+s.top-d,p.push({x1:f,y1:y+d,x2:f-l,y2:y-d,x3:f+l,y3:y-d})),c.push({x1:h,y1:m,x2:f,y2:y,drawHorizontal:u})}n.context.beginPath();for(let e of c)n.context.moveTo(e.x1,e.y1),"straight"===t.settings.lineStyle()?n.context.lineTo(e.x2,e.y2):!0===e.drawHorizontal?n.context.bezierCurveTo(e.x2,e.y1,e.x1,e.y2,e.x2,e.y2):n.context.bezierCurveTo(e.x1,e.y2,e.x2,e.y1,e.x2,e.y2);n.context.stroke(),n.context.beginPath();for(let e of p)n.context.moveTo(e.x1,e.y1),n.context.lineTo(e.x2,e.y2),n.context.lineTo(e.x3,e.y3);n.context.fill(),n.isDrawingArrows=!1},this.bringToFront=function(t){const n=e(t),o=i.Utils.getHighestZ(n.parent());n.css("z-index",o+1)},this.selectAll=function(){n.selectNodes(t.nodes())},this.deselectAll=function(){n.deselectNodes(t.nodes())},this.selectNodes=function(e){const i=Array.isArray(e)?e:[e];for(let e of i)if(e.active()&&!n.selectedNodes.includes(e)&&t.canEditNodeMeta(e.title())){if(t.input.isScreenTouched&&t.input.isDragging)return;n.selectedNodes.push(e),e.setSelected(!0)}},this.deselectNodes=function(e){const t=Array.isArray(e)?e:[e];for(let e of t){const t=n.selectedNodes.indexOf(e);e.active()&&t>=0&&(n.selectedNodes.splice(t,1),e.setSelected(!1))}},this.getSelectedNodes=function(){return 1===n.selectedNodes.length?[n.selectedNodes[0]]:Array.apply(this,n.selectedNodes)},this.warpToNodeByIdx=function(e){n.warpToNode(t.nodes()[e]),t.focusedNodeIdx=e},this.warpToSelectedNodeByIdx=function(e){n.warpToNode(n.getSelectedNodes()[e]),t.focusedNodeIdx=e},this.warpToNode=function(t){if(t){var i=e(t.element);n.warpToXY(t.x()||t.createX,t.y()||t.createY),i.clearQueue(),i.transition({outlineColor:"pink",outlineWidth:2,outlineOffset:0},500),setTimeout(()=>{i.transition({outlineColor:"transparent",outlineWidth:1,outlineOffset:50},300)},700)}},this.warpToXY=function(i,o){const s=-i*n.scale,a=-o*n.scale,r=e(window).width()/2,l=e(window).height()/2,d=100*n.scale/2,c=100*n.scale/2;n.setTranslation(s+r-d+t.getSplitEditorXOffset(),a+l-c,100)},this.alignV=function(){if(t.input.isCtrlDown)return void n.reduceAlignV();const e=t.nodes().filter(e=>e.selected).sort((e,t)=>e.y()>t.y()?1:e.y(){e.moveTo(i.x(),e.y())})},this.reduceAlignV=function(){const e=t.settings.gridSize(),i=t.nodes().filter(e=>e.selected).sort((e,t)=>e.y()>t.y()?1:e.y(){const i=t.settings.snapGridEnabled()?s.y()+e.height*(n+1)+a*(n+1):s.y()+210*(n+1);e.moveTo(s.x(),i)})},this.alignH=function(){if(t.input.isCtrlDown)return void n.reduceAlignH();const e=t.nodes().filter(e=>e.selected).sort((e,t)=>e.x()>t.x()?1:e.x(){e.moveTo(e.x(),i.y())})},this.reduceAlignH=function(){const e=t.settings.gridSize(),i=t.nodes().filter(e=>e.selected).sort((e,t)=>e.x()>t.x()?1:e.x(){const i=t.settings.snapGridEnabled()?s.x()+e.width*(n+1)+a*(n+1):s.x()+210*(n+1);e.moveTo(i,s.y())})},this.arrangeSpiral=function(){const e=n.getSelectedNodes();e.length<2?Swal.fire(o):(e.forEach((e,i)=>{e.moveTo(t.settings.snapGridEnabled()?n.stepify(Math.cos(.5*i)*(600+30*i),t.settings.gridSize()):Math.cos(.5*i)*(600+30*i),t.settings.snapGridEnabled()?n.stepify(Math.sin(.5*i)*(600+30*i),t.settings.gridSize()):Math.cos(.5*i)*(600+30*i))}),n.warpToXY(0,0))},this.sortAlphabetical=function(){const i=n.getSelectedNodes().sort((e,t)=>e.title().localeCompare(t.title()));if(i.length<2)return void Swal.fire(o);let s=Math.round(i.length/2),a=0,r=0;const l=e(i[0].element).width()+30,d=e(i[0].element).height()+30,c=t.settings.gridSize();t.settings.snapGridEnabled()&&i[0].moveTo(n.stepify(i[0].x(),c),n.stepify(i[0],c)),i.forEach((e,n)=>{n%s?a+=1:(r+=1,a=0),1===n&&(r=0);const o=i[0].x()+i[0].width,p=c-o%c+c,u=i[0].y()+i[0].height,g=c-u%c+c;e.moveTo(t.settings.snapGridEnabled()?i[0].x()+a*e.width+a*p:i[0].x()+a*l,t.settings.snapGridEnabled()?i[0].y()+r*e.height+r*g:i[0].y()+r*d)}),n.warpToNode(i[0])},this.stepify=function(e,t){return Math.round(e/t)*t}}}).call(this,n("EVdn"))},INAQ:function(e,t,n){"use strict";(function(e,i){n.d(t,"a",(function(){return o}));n("oj90");const o=function(t){const n=this,o=Object.freeze({Left:0,Middle:1,Right:2}),s=Object.freeze({Enter:13,Escape:27,Space:32,Left:37,Up:38,Right:39,Down:40,Delete:46,A:65,C:67,D:68,O:79,S:83,V:86,W:87,X:88,Y:89,Z:90});this.keys=s,this.mouse={x:0,y:0},this.isDragging=!1,this.isScreenTouched=!1,this.isMiddleButtonDown=!1,this.isLeftButtonDown=!1,this.isShiftDown=!1,this.isCtrlDown=!1,this.isHoverOverWorkspace=!1,this.trackMouseEvents=function(){e(document).on("pointerdown",e=>{if(n.isDragging="nodes"===e.target.className||"body"===e.target.className&&(n.isMiddleButtonDown||0===t.workspace.selectedNodes.length),n.mouse.x=e.pageX,n.mouse.y=e.pageY,n.isMiddleButtonDown=e.button===o.Middle,this.isLeftButtonDown=e.button===o.Left,t.inWorkspace()){if(n.isDragging)switch(e.button){case o.Left:"nodes"===e.target.className&&t.workspace.onMarqueeStart({x:e.pageX,y:e.pageY});break;case o.Middle:t.workspace.onDragStart({x:e.pageX,y:e.pageY})}}else t.inEditor()&&e.button===o.Right&&(t.guessPopUpHelper(),e.preventDefault())}),window.addEventListener("touchstart",()=>{n.isScreenTouched=!0}),e(document).on("pointermove",e=>{n.mouse.x=e.pageX,n.mouse.y=e.pageY}),e(document).on("mousemove touchmove",e=>{if(n.isDragging){t.focusedNodeIdx=-1;const i=n.isScreenTouched&&e.changedTouches?e.changedTouches[0].pageX:e.pageX,o=n.isScreenTouched&&e.changedTouches?e.changedTouches[0].pageY:e.pageY;t.inWorkspace()&&(e.altKey||n.isMiddleButtonDown||n.isScreenTouched?t.workspace.onDragUpdate({x:i,y:o}):t.workspace.onMarqueeUpdate({x:i,y:o}))}}),e(document).on("pointerup touchend",e=>{n.isScreenTouched=!1,n.isDragging=!1,e.button===o.Left&&(n.isLeftButtonDown=!1),e.button===o.Middle&&(n.isMiddleButtonDown=!1),t.inWorkspace()&&(t.workspace.onDragEnd(),t.workspace.onMarqueeEnd())}),e(".nodes").mousewheel(e=>{e.altKey||(t.inWorkspace()||n.isHoverOverWorkspace)&&(t.workspace.onZoom(e.pageX,e.pageY,e.deltaY),e.preventDefault())}),e(".nodes").hover(()=>{n.isHoverOverWorkspace=!0},()=>{n.isHoverOverWorkspace=!1}),e(".nodes").on("pointerdown",()=>{t.isEditorSplit&&(t.focusEditor(!1),t.makeNewNodesFromLinks(),t.propagateUpdateFromNode(t.editing()),t.mustUpdateTags=!0,t.updateTagsRepository(),t.workspace.updateArrows())}),e(document).contextmenu(n=>{if(!t.inWorkspace())return;const i=e(n.target).hasClass("nodes")||e(n.target).parents(".nodes").length;if(n.button===o.Right&&i){const{x:e,y:i}=t.workspace.toWorkspaceCoordinates(n.pageX,n.pageY);t.newNodeAt(e,i)}return!i})},this.trackKeyboardEvents=function(){e(document).on("keyup keydown",e=>{n.isShiftDown=e.shiftKey,n.isCtrlDown=e.ctrlKey}),e(document).on("keyup",(function(e){if(e.keyCode===s.Space){if(t.inWorkspace()&&e.altKey||t.inEditor()&&!e.altKey)return;t.workspace.scale=1;const n=t.workspace.getSelectedNodes(),i=n.length>0,o=i>0?n:t.nodes();++t.focusedNodeIdx,(t.focusedNodeIdx<0||t.focusedNodeIdx>=o.length)&&(t.focusedNodeIdx=0),t.inWorkspace()?i?t.workspace.warpToSelectedNodeByIdx(t.focusedNodeIdx):t.workspace.warpToNodeByIdx(t.focusedNodeIdx):t.inEditor()&&t.editNode(t.nodes()[t.focusedNodeIdx])}})),e(document).on("keydown",e=>{if(t.inWorkspace()){if(e.metaKey||e.ctrlKey)switch(e.keyCode){case s.S:e.preventDefault(),t.data.trySaveCurrent();break;case s.A:if(e.shiftKey){e.preventDefault(),t.data.tryAppend();break}}if((e.metaKey||e.ctrlKey)&&e.altKey)switch(e.keyCode){case s.S:t.data.trySaveCurrent()}else if(e.metaKey||e.ctrlKey)switch(e.keyCode){case s.C:t.nodeClipboard=t.cloneNodeArray(t.workspace.getSelectedNodes());break;case s.D:t.workspace.deselectAll();break;case s.O:t.data.tryOpenFile();break;case s.S:t.data.trySaveCurrent();break;case s.X:const e=t.workspace.getSelectedNodes();t.nodeClipboard=t.cloneNodeArray(e),t.deleteNodes(e);break;case s.Y:t.historyDirection("redo");break;case s.Z:t.historyDirection("undo")}else e.keyCode===s.Delete||"Delete"===e.key?t.confirmDeleteNodes(t.workspace.getSelectedNodes()):t.$searchField.is(":focus")||e.ctrlKey||e.metaKey||(e.keyCode===s.A||e.keyCode===s.Left?t.workspace.onPanLeft():e.keyCode===s.D||e.keyCode===s.Right?t.workspace.onPanRight():e.keyCode===s.W||e.keyCode===s.Up?t.workspace.onPanUp():e.keyCode!==s.S&&e.keyCode!==s.Down||t.workspace.onPanDown())}}),e(document).on("keyup",e=>{if(t.inWorkspace())if(e.metaKey||e.ctrlKey)switch(e.keyCode){case s.A:t.workspace.selectAll();break;case s.V:t.pasteNodes()}else if(e.keyCode===s.Enter||"Enter"===e.key){const e=t.nodes()[t.focusedNodeIdx];e?t.editNode(e):t.editNode(t.nodes()[0])}}),e(document).on("keydown",(function(e){if(t.inEditor())if(e.metaKey||e.ctrlKey)switch(e.keyCode){case s.C:n.clipboard=t.editor.getSelectedText();break;case s.X:document.execCommand("copy"),t.clipboard=t.editor.getSelectedText(),t.insertTextAtCursor("");break;case s.S:t.data.trySaveCurrent()}else switch(e.keyCode){case s.Escape:t.saveNode(),t.closeEditor()}})),e(document).on("keyup",(function(e){if(t.inEditor()&&(e.metaKey||e.ctrlKey)&&e.altKey)switch(e.keyCode){case s.Enter:t.saveNode(),t.closeEditor()}})),e(document).on("keydown",(function(e){if(t.ui.settingsDialogVisible())switch(e.keyCode){case s.Escape:t.ui.closeSettingsDialog()}})),e(document).on("keyup keydown pointerdown pointerup",(function(e){t.inEditor()&&t.updateEditorStats()}))},this.initKnockoutBindings=function(){i.bindingHandlers.preventBubble={init:function(e,t){var n=i.utils.unwrapObservable(t());i.utils.registerEventHandler(e,n,(function(e){e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation()}))}},i.bindingHandlers.mousedown={init:function(t,n,o,s,a){var r=i.unwrap(n());e(t).mousedown((function(){r()}))}}};n.initKnockoutBindings(),n.trackMouseEvents(),n.trackKeyboardEvents()}}).call(this,n("EVdn"),n("Z1dp"))},JGHU:function(e,t,n){"use strict";n.r(t),function(e,i){n.d(t,"JSONEditor",(function(){return o}));var o=function({id:t}){this.tableAdd=({key:t,value:n})=>{var i=this.table.find("tr.hide").clone(!0).removeClass("hide table-line");t&&n&&(console.log("mutate",{key:t,value:n,html:i.html()}),i.html(`\n ${t}\n ${n}\n \n x delete\n \n `),e(".table-remove").on("click",(function(){e(this).parents("tr").detach()}))),this.table.find("table").append(i)},this.getValue=()=>{var t=this.table.find("tr:not(:hidden)"),n=[],i=[];return e(t.shift()).find("th:not(:empty):not([data-attr-ignore])").each((function(){n.push(e(this).text().toLowerCase())})),t.each((function(){var t=e(this).find("td"),o={};n.forEach((function(e,n){o[e]=t.eq(n).text()})),i.push(o)})),i},this.init=()=>{document.getElementById(t).innerHTML='\n
\n
\n \n \n \n \n \n \n\n\n \x3c!-- This is our clonable table line --\x3e\n \n \n \n \n \n
KeyValueRemove
keyval\n x delete\n
\n\n \n
\n
\n ';var n=e("#table"),o=e("#save-btn");this.table=n,this.rows=n.find("tr:not(:hidden)"),e("#save-btn").addClass("hide"),e(".table-add").on("click",this.tableAdd),e(".table-remove").on("click",(function(){console.log({removeThis:this}),e(this).parents("tr").detach()})),i.fn.pop=[].pop,i.fn.shift=[].shift,o.on("click",this.getValue)},this.init(),this.setValue=(e=[])=>{e.forEach(this.tableAdd)}}}.call(this,n("EVdn"),n("EVdn"))},P0sH:function(e,t,n){"use strict";(function(e,i){n.d(t,"a",(function(){return g}));var o=n("owJe"),s=n("W2Rx"),a=n("5dEm"),r=n("INAQ"),l=n("pYPP"),d=n("fkuv"),c=n("2Qx2"),p=n("oj90"),u=n("l8+o"),g=(n("+NoZ"),function(t,g){const h=this;this.utils=p.Utils,this.setTheme=function(t,n){let i=n?n.target.value:t;setTimeout(h.initGrid,50),setTimeout(h.workspace.updateArrows,50),e("#theme-stylesheet").attr("href",p.Utils.getPublicPath(`themes/${i}.css`))},this.setLanguage=function(e,t){const n=t?t.target.value:e;Object(o.load_dictionary)(h.settings.language().split("-")[0]);const i=new CustomEvent("yarnSetLanguage");i.language=n,window.dispatchEvent(i),window.parent.dispatchEvent(i)},this.log=function(e){h.settings.developmentModeEnabled()&&console.log(e)},this.setDocumentType=function(e,t){const n=t?t.target.value:e;h.settings.documentType(n),h.log("Set doc type",e,app.data.inkCompiler),"ink"===n?(null===app.data.inkCompiler&&(app.data.inkCompiler=new app.data.InkCompiler),c.a.addGlobalScopeToInkDoc(),app.setMarkupLanguage("html")):app.data.inkCompiler=null,app.updateNodeLinks();const i=new CustomEvent("yarnSetDocumentType");i.language=n,window.dispatchEvent(i),window.parent.dispatchEvent(i)},this.setMarkupLanguage=function(e,t){const n=t?t.target.value:e;app.settings.markupLanguage(n),h.richTextFormatter=new u.a(h),h.mustRefreshNodes.notifySubscribers()},this.setGistPluginsFile=function(e,t){const n=t?t.target.value:e;app.settings.gistPluginsFile(n)},this.setFiletypeVersion=function(e,t){const n=t?t.target.value:e;h.filetypeVersion=n},this.setGistCredentials=function(e,t){const{token:n,file:i}=e;c.a.storage.setCredentials(n,i)},this.input=new r.a(h),this.settings=new l.a(h),this.workspace=new a.a(h),this.ui=new d.a(h),this.richTextFormatter=new u.a(h),this.data=c.a,this.name=i.observable(t),this.version=i.observable(g),this.editing=i.observable(null),this.nodes=i.observableArray([]),this.tags=i.observableArray([]),this.mustRefreshNodes=i.observable(),this.mustUpdateTags=!0,this.nodeHistory=[],this.nodeFuture=[],this.editingHistory=[],this.editingSaveHistoryTimeout=null,this.focusedNodeIdx=-1,this.isElectron=!1,this.editor=null,this.nodeVisitHistory=[],this.plugins={pluginStorage:{}},this.clipboard="",this.nodeClipboard=[],this.speachInstance=null,this.editingPath=i.observable(null),this.$searchField=e(".search-field"),this.isEditorInPreviewMode=!1,this.isEditorInPlayMode=i.observable(!1),this.isEditorSplit=!1,this.isEditorFocused=!1,this.editorResizeHandleOptions={handleSelector:"#editor-resize-handle",resizeHeight:!1,resizeWidthFrom:"right",onDragStart:function(){h.isSplitEditorInFocus=!0,e("#node-editor").removeClass("split-editor-out-of-focus")},onDragEnd:function(){h.editor.resize(),h.settings.editorSplitSize(e("#editor-form").width())}},this.inEditor=()=>(h.editing()||h.isEditorSplit&&h.isEditorFocused)&&!h.ui.isDialogOpen(),this.inWorkspace=()=>(!h.editing()||h.isEditorSplit&&!1===h.isEditorFocused)&&!h.ui.isDialogOpen(),this.run=function(){var t="Unknown OS";-1!=navigator.platform.indexOf("Win")&&(t="Windows"),-1!=navigator.platform.indexOf("Mac")&&(t="MacOS"),-1!=navigator.platform.indexOf("X11")&&(t="UNIX"),-1!=navigator.platform.indexOf("Linux")&&(t="Linux"),-1!=navigator.platform.indexOf("Linux")&&(t="Linux"),h.isElectron=navigator.userAgent.toLowerCase().includes("electron");var n=navigator.userAgent||navigator.vendor||window.opera;let o;/android|iPad|iPhone|iPod/.test(n.toLowerCase())&&!window.MSStream&&(t="mobile"),"Windows"==t&&(h.workspace.zoomSpeed=.1),window.addEventListener("beforeunload",e=>(this.data.saveAppStateToLocalStorage(),null)),window.addEventListener("DOMContentLoaded",e=>{if(h.electron){const e=h.electron.remote.process.argv.length>1?h.electron.remote.process.argv[1]:null;if(e&&app.fs.existsSync(e))return void this.data.openFileFromFilePath(e)}this.data.loadAppStateFromLocalStorage();const t=new URL(window.location),n=t.searchParams.get("text")||t.searchParams.get("url");null!==n&&h.insertTextAtCursor(n+"\n",!0)});const s=e("#addPwa")[0];s.style.display="none",window.addEventListener("beforeinstallprompt",e=>{e.preventDefault(),o=e,s.style.display="block",s.addEventListener("click",e=>{s.style.display="none",o.prompt(),o.userChoice.then(e=>{"accepted"===e.outcome?(h.log("User accepted the A2HS prompt"),s.style.display="none"):h.log("User dismissed the A2HS prompt"),o=null})})}),e("#app").show(),i.applyBindings(h,e("#app")[0]),h.editingVisualStudioCodeFile()||h.newNode().title("Start"),h.settings.apply(),e(".search-title input").click(h.updateSearch),e(".search-body input").click(h.updateSearch),e(".search-tags input").click(h.updateSearch),h.$searchField.on("input",h.updateSearch),h.$searchField.on("keyup",(function(e){27==e.keyCode?h.clearSearch():h.searchWarp()})),"mobile"===t&&h.workspace.setZoom(3),e(window).on("resize",(function(){h.ui.isScreenNarrow()&&h.editing()&&h.isEditorSplit&&h.toggleEditorView(),h.workspace.updateArrows(),h.initGrid()})),setTimeout(h.initGrid,50),this.guessPopUpHelper=function(){/color=#([a-zA-Z0-9]{3,6})$/.test(h.getTagBeforeCursor())&&h.insertColorCode()},this.insertEmoji=function(){this.emPicker.toggle(),h.togglePreviewMode(!0),e("#emojiPicker-container").css({left:h.input.mouse.x-200,top:h.input.mouse.y-125}),e("#emojiPicker-container").show()},this.insertColorCode=function(){e("#colorPicker-container").is(":visible")||(e("#colorPicker").spectrum("set",h.editor.getSelectedText()),e("#colorPicker").spectrum("toggle"),e("#colorPicker-container").css({left:h.input.mouse.x-70,top:h.input.mouse.y-50}),e("#colorPicker-container").show(),h.togglePreviewMode(!0),setTimeout(()=>{const t=e("#colorPicker").spectrum("get");h.applyPickerColorEditor(t)},100))},this.applyPickerColorEditor=function(e){const t=JSON.parse(JSON.stringify(h.editor.selection.getRange()));h.editor.selection.setRange(t);const n=e.toHexString().replace("#","");h.editor.session.replace(t,n),h.editor.selection.setRange({start:h.editor.getCursorPosition(),end:{row:h.editor.getCursorPosition().row,column:h.editor.getCursorPosition().column-n.length}}),h.togglePreviewMode(!0)},document.addEventListener("contextmenu",(function(e){h.editing()&&e.preventDefault()}),!1),document.ondragover=document.ondrop=e=>{e.preventDefault()},document.body.ondrop=e=>{e.preventDefault();for(var t=0;t{const t=e.data;switch(t.type){case"UpdateNode":h.nodes().forEach(e=>{e.title().trim()===t.payload.originalNodeTitle.trim()&&(e.title(t.payload.title),e.tags(t.payload.tags),e.body(t.payload.body),h.setYarnDocumentIsDirty())})}});var a=new CustomEvent("yarnReady");a.document=document,a.data=c.a,a.app=this,window.dispatchEvent(a),window.parent.dispatchEvent(a);const r=new URLSearchParams(window.location.href.split("?")[1]),l=r.get("gist"),d=r.get("fileName");l&&d&&fetch("https://api.github.com/gists/"+l).then(e=>e.json()).then(e=>{const t=e.files[d].content;c.a.openGist(t,d)})},this.limitNodesUpdate=function(e){h.nodes.extend({rateLimit:{method:"notifyWhenChangesStop",timeout:250}}),e(),h.nodes.limit(e=>()=>e())},this.getNodesConnectedTo=function(e){var t=[],n=h.nodes();for(var i in n)if(n[i]!=e&&n[i].isConnectedTo(e,!0)){var o=!1;for(var s in t)if(t[s]==n[i]){o=!0;break}o||t.push(n[i])}return t},this.matchConnectedColorID=function(e){var t=h.getNodesConnectedTo(e);for(var n in t)t[n].colorID(e.colorID())},this.quit=function(){h.isElectron},this.canEditNodeMeta=function(e){return"ink"!==app.settings.documentType()||e.trim()!==c.a.InkGlobalScopeNodeName},this.sanitiseNodeTitle=function(){"ink"===app.settings.documentType()&&(app.editing().title().startsWith("function ")||app.editing().title(app.editing().title().replace(/[ ]/g,"_")))},this.validateTitle=function(){var t=document.getElementById("editorTitle").value,n=e("#editorTitle");h.getOtherNodeTitles().includes(t)||h.titleExistsTwice(t)?(n.attr("class","title title-error"),n.attr("title","Another node has the same title")):"yarn"!==app.settings.documentType()||RegExp("^[a-z0-9]+$","i").test(t)?(n.removeAttr("title"),n.removeClass("title-error")):(n.attr("class","title title-error"),n.attr("title","Only upper or lower case letters and numbers are allowed in a node title."))},this.refreshWindowTitle=function(){let e="";"LOCAL"===app.settings.lastStorageHost()?e="Yarn - "+(c.a.editingPath()||c.a.editingName())+" "+(c.a.isDocumentDirty()?"*":""):"GIST"===app.settings.lastStorageHost()&&(e="Gist - "+(c.a.editingPath()||c.a.editingName())+" "+(c.a.isDocumentDirty()?"*":"")),h.electron?h.electron.remote.getCurrentWindow().setTitle(e):document.title=e},this.usingVisualStudioCodeExtension=function(){return!!window.vsCodeApi},this.editingVisualStudioCodeFile=function(){return!0===window.editingVsCodeFile},this.setYarnDocumentIsDirty=function(){h.usingVisualStudioCodeExtension()&&h.editingVisualStudioCodeFile()&&c.a.getSaveData(c.a.editingType()).then(e=>{window.vsCodeApi.postMessage({type:"DocumentEdit",payload:e})})},this.recordNodeAction=function(e,t){if(h.nodeFuture.length>0){for(var n=0;n=0&&h.nodes.splice(t,1),h.updateNodeLinks()}var n=null;if(n="undo"==e?h.nodeHistory.pop():h.nodeFuture.pop()){var i=n.action,o=n.node;"undo"==e?("created"==i?(n.lastX=o.x(),n.lastY=o.y(),t(o)):"removed"==i&&h.recreateNode(o,n.lastX,n.lastY),h.nodeFuture.push(n),h.setYarnDocumentIsDirty()):("created"==i?h.recreateNode(o,n.lastX,n.lastY):"removed"==i&&t(o),h.nodeHistory.push(n),h.setYarnDocumentIsDirty())}},this.recreateNode=function(e,t,n){h.nodes.push(e),e.moveTo(t,n),h.updateNodeLinks()},this.setSelectedColors=function(e){var t=h.workspace.getSelectedNodes();for(var n in t.splice(t.indexOf(e),1),t)t[n].colorID(e.colorID())},this.pasteNodes=function(){h.nodeClipboard.length&&(h.workspace.deselectAll(),h.nodeClipboard.forEach((function(e){var t=new s.a({title:h.getUniqueTitle(e.title()),body:e.body(),tags:e.tags(),colorID:e.colorID(),x:e.createX,y:e.createY});h.nodes.push(t),h.workspace.selectNodes(t),h.recordNodeAction("created",t)})),h.updateNodeLinks())},this.confirmDeleteNodes=function(e){const t=Array.isArray(e)?void 0:e,n=Array.isArray(e)?[...e]:t&&t.selected?[...h.workspace.getSelectedNodes()]:[e];n.length&&Swal.fire({title:"Are you sure?",text:`${n.length} ${1===n.length?"node":"nodes"} will be deleted.`,icon:"warning",showCancelButton:!0,confirmButtonText:"Yes, delete!",cancelButtonText:"No, cancel!",reverseButtons:!0}).then(e=>{e.value&&h.deleteNodes(n)})},this.deleteNodes=function(e){const t=Array.isArray(e)?e:[e],n=[];for(let e=t.length-1;e>=0;--e)n.push(t[e].remove());Promise.all(n).then(()=>{h.limitNodesUpdate(()=>{for(let e=t.length-1;e>=0;--e)h.inEditor()&&h.editing()===t[e]&&h.closeEditor(),h.deleteNode(t[e]);h.updateNodeLinks(),h.workspace.deselectNodes(t),h.workspace.updateArrows()})})},this.deleteNode=function(e){const t=h.nodes.indexOf(e);t>=0&&(h.recordNodeAction("removed",e),h.nodes.splice(t,1)),h.setYarnDocumentIsDirty()},this.cloneNodeArray=function(e){return e.map((function(e){return new s.a({title:e.title(),body:e.body(),tags:e.tags(),colorID:e.colorID(),x:e.x()+10,y:e.y()+10})}))},this.newNode=function(e=!0){var t=new s.a;return h.nodes.push(t),e&&h.updateNodeLinks(),h.recordNodeAction("created",t),t},this.newNodeAt=function(e,t){var n=new s.a({x:e-100,y:t-100});return h.nodes.push(n),h.updateNodeLinks(),h.recordNodeAction("created",n),n},this.searchTextInEditor=function(e=!0){e?h.editor.execCommand("find"):h.editor.searchBox&&h.editor.searchBox.hide()},this.showRandomQuote=function(){e.ajax({url:"https://api.forismatic.com/api/1.0/?",dataType:"jsonp",data:"method=getQuote&format=jsonp&lang=en&jsonp=?",success:function(e){Swal.fire({text:e.quoteText+"\n\n-"+e.quoteAuthor})}})},this.editNode=function(t,n=!0){if(!n&&!t.active())return;if(h.settings.alwaysOpenNodesInVisualStudioCodeEditor())return void h.editNodeInVisualStudioCodeEditor(t);h.editing()&&h.editing()!==t&&h.saveNode(!1),h.isEditorInPlayMode()&&h.togglePlayMode(!1),h.isEditorInPreviewMode&&h.togglePreviewMode(!1),t.oldTitle=t.title(),h.editing(t),h.mustUpdateTags=!0,e("#node-editor-background").css({opacity:0}).transition({opacity:1},250),e("#node-editor").css({y:"-100",opacity:0}).transition({y:"0",opacity:1},250),h.editor=ace.edit("editor"),h.editor.setOptions({scrollPastEnd:.5}),h.editor.focus(),h.editor.navigateFileEnd(),e("#colorPicker").spectrum({flat:!0,showButtons:!1,showInput:!0,showPalette:!0,preferredFormat:"hex",palette:[["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"],["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"],["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"]],move:function(e){h.applyPickerColorEditor(e)},clickoutFiresChange:!0});const i=ace.require("ace/ext/language_tools"),s=p.Utils.createAutocompleter("ink"===app.settings.documentType()?["divert.target"]:["string.llink","string.rlink"],app.getOtherNodeTitles().map(e=>{const n=h.getNodeByTitle(e);return{word:e,title:e,about:`${n.tags().length>0?`tags: ${n.tags()}
`:""}Preview:
${n.clippedBody()}`,titleStyle:t.titleStyles[n.colorID()]}}),"Node Link");i.setCompleters([s,i.keyWordCompleter,i.textCompleter,i.snippetCompleter]);let a=void 0;h.editor.getSession().on("change",(function(e){const t=h.settings.autoCloseTags();if("insert"===e.action&&t){if(h.richTextFormatter.justInsertedAutoComplete)return void(h.richTextFormatter.justInsertedAutoComplete=!1);a&&clearTimeout(a),a=setTimeout(()=>{a=void 0,h.richTextFormatter.completableTags.forEach(e=>{if(h.getTagBeforeCursor()===e.Start){h.richTextFormatter.justInsertedAutoComplete=!0;let t=e.Completion,n=e.Offset;h.settings.autoCloseBrackets()&&e.BehaviorCompletion&&(t=e.BehaviorCompletion,n+=1),e.Completion&&h.insertTextAtCursor(t),e.Offset&&h.moveEditCursor(n),e.Func&&e.Func()}})},200)}})),this.emPicker=new EmojiPicker(document.getElementById("emojiPickerDom"),e=>{h.insertTextAtCursor(e.char),this.emPicker.toggle(),h.togglePreviewMode(!1)}),Object(o.enable_spellcheck)(),h.toggleInvertColors(),h.toggleShowCounter(),h.toggleSpellCheck(),h.validateTitle(),h.updateEditorStats(),h.updateEditorOptions(),h.$searchField.val().length>0&&e(".search-body input").is(":checked")&&h.editor.findAll(h.$searchField.val()),h.settings.editorSplit()&&(h.splitEditor(),h.workspace.warpToNodeByIdx(t.index()-1)),"right"===h.settings.editorSplitDirection()?(e("#editor-form").addClass("split-editor-right"),e("#editor-resize-handle").addClass("float-right")):(e("#editor-form").removeClass("split-editor-right"),e("#editor-resize-handle").removeClass("float-right")),e(".node-editor").on("pointerdown","> *",(function(e){h.isEditorSplit&&(h.focusEditor(!0),e.stopPropagation())})),e(".app-info").hide(),h.editor.resize(),null!=t.undoManager&&h.editor.session.setUndoManager(t.undoManager);var r=new CustomEvent("yarnEditorOpen");r.document=document,r.data=c.a,r.app=app,window.dispatchEvent(r),window.parent.dispatchEvent(r)},this.splitEditor=function(){h.isEditorSplit=!0,h.focusEditor(!0),h.settings.editorSplit(!0),h.editorResizeHandleOptions.resizeWidthFrom="right"===h.settings.editorSplitDirection()?"left":"right",e("#editor-form").width(h.settings.editorSplitSize()).addClass("split-editor").toggleClass("split-editor-right","right"===h.settings.editorSplitDirection()).resizable(h.editorResizeHandleOptions),e("#node-editor-background").addClass("hidden"),e("#node-editor").css({"z-index":10002}),e("#editor-resize-handle").removeClass("hidden").toggleClass("float-right","right"===h.settings.editorSplitDirection()),e("#split-editor-button").addClass("hidden"),e("#snap-editor-button").removeClass("hidden"),e("#exit-editor").removeClass("hidden"),e("#full-size-editor-button").removeClass("hidden"),e("#split-button-separator").removeClass("hidden"),h.ui.checkAndMoveAppButtons()},this.toggleEditorView=function(){h.settings.editorSplit(!h.settings.editorSplit()),h.reopenEditor()},this.reopenEditor=function(){h.saveNode();let e=h.editing();h.closeEditor(),setTimeout(()=>{h.editNode(e)},250)},this.editorSnapToggle=function(){h.settings.editorSplitDirection("right"===h.settings.editorSplitDirection()?"left":"right"),h.reopenEditor()},this.focusEditor=function(t){!0===t?(e("#node-editor").removeClass("split-editor-unfocused"),h.isEditorFocused=!0):(e("#node-editor").addClass("split-editor-unfocused"),h.isEditorFocused=!1)},this.getSplitEditorXOffset=function(){let t=0;return h.inEditor()&&h.settings.editorSplit()&&(t=e("#editor-form").width()/2,"right"===h.settings.editorSplitDirection()&&(t*=-1)),t},this.editNodeInVisualStudioCodeEditor=function(e){h.usingVisualStudioCodeExtension()?(h.setYarnDocumentIsDirty(),window.vsCodeApi.postMessage({type:"OpenNode",payload:{title:e.title().trim(),tags:e.tags().trim(),body:h.trimBodyLinks(e.body().trim())}})):console.error("Tried to open node in Visual Studio Code text editor but we're not in the Visual Studio Code extension")},this.chooseRelativePathImage=function(e){h.insertTextAtCursor(e)},this.getNodeByTitle=function(e){return h.nodes().find(t=>t.title().trim().toLowerCase()===e.trim().toLowerCase())},this.openNodeByTitle=function(e,t=""){h.isEditorInPlayMode()&&h.togglePlayMode(),h.makeNodeWithName(e);const n=h.nodes().find(t=>t.title().trim().toLowerCase()===e.trim().toLowerCase());n&&(h.editNode(n,!0),t&&setTimeout(()=>h.editor.find(t),200))},this.openLastEditedNode=function(){if(0===h.nodeVisitHistory.length)h.saveNode(),h.closeEditor();else{const e=h.nodeVisitHistory.pop();h.propagateUpdateFromNode(h.editing()),h.openNodeByTitle(e)}},this.getSpellCheckSuggestionItems=function(){var e=Object(o.suggest_word_for_misspelled)(h.editor.getSelectedText());if(e){var t={};return e.forEach(e=>{t[e]={name:e,icon:"edit",callback:e=>{h.insertTextAtCursor(e)}}}),t}return!1},this.getThesaurusItems=function(){var e=n("GLdW")(h.editor.getSelectedText());if(!e)return!1;var t=[];if(Object.keys(e).forEach((function(n){e[n].forEach((function(e){t.includes(e)||e===n||t.push(e)}))})),t.length>0){var i={};return t.forEach(e=>{i[e]={name:e,icon:"edit",callback:e=>{h.insertTextAtCursor(e)}}}),i}return!1},this.toggleSpellCheck=function(){setTimeout((function(){h.settings.spellcheckEnabled()?Object(o.enable_spellcheck)():Object(o.disable_spellcheck)()}),50)},this.toggleInvertColors=function(){const t=h.settings.invertColorsEnabled()?{filter:"invert(100%)"}:{filter:"invert(0%)"};e("#app").css(t),e("#app-bg").css(t),e(".tooltip").css(t),e(".node .body").css(t),e(".editor-container .editor-preview").css(t)},this.initGrid=function(){if(h.settings.snapGridEnabled()){var t=e(window).width(),n=e(window).height();e("#grid-canvas").attr("width",t),e("#grid-canvas").attr("height",n),e("#gridSize").attr("disabled",!1),h.workspace.gridContext.strokeStyle=h.workspace.gridContext.fillStyle=e(".grid-canvas").css("color")}else e("#gridSize").attr("disabled",!0);app.workspace.updateGrid()},this.toggleShowCounter=function(){h.settings.editorStatsEnabled()?e(".node-editor .form .editor-counter").css({display:"initial"}):e(".node-editor .form .editor-counter").css({display:"none"})},this.toggleAutocompleteSuggestions=function(){h.settings.autocompleteSuggestionsEnabled(!h.settings.autocompleteSuggestionsEnabled()),h.updateEditorOptions()},this.toggleAutoCloseBrackets=function(){h.settings.autoCloseBrackets(!h.settings.autoCloseBrackets()),h.updateEditorOptions()},this.updateEditorOptions=function(){h.editor.setOptions({enableBasicAutocompletion:app.settings.autocompleteSuggestionsEnabled(),enableLiveAutocompletion:app.settings.autocompleteSuggestionsEnabled(),behavioursEnabled:app.settings.autoCloseBrackets()})},this.togglePreviewMode=function(t){const n=e(".editor")[0],i=e("#editor-preview")[0];h.isEditorInPreviewMode=t,app.ui.dispatchEvent("yarnInPreviewMode"),t?(e(".bbcode-toolbar").addClass("hidden"),n.style.display="none",i.style.display="block",i.innerHTML=h.richTextFormatter.richTextToHtml(h.editing().body(),!0),i.scrollTop=h.editor.renderer.scrollTop):(e(".bbcode-toolbar").removeClass("hidden"),h.editor.session.setScrollTop(i.scrollTop),i.innerHTML="",i.style.display="none",n.style.display="flex",h.editor.focus(),h.editor.resize(),e("#colorPicker-container").is(":visible")&&e("#colorPicker-container").hide(),e("#emojiPicker-container").is(":visible")&&e("#emojiPicker-container").hide())},this.appendText=function(e){h.editing().body(h.editing().body()+e);const t=h.editor.session.getLength()-1,n=h.editor.session.getLine(t).length;h.editor.gotoLine(t+1,n)},this.moveEditCursor=function(e){const t=h.editor.getCursorPosition();h.editor.gotoLine(t.row+1,t.column+e),h.editor.focus()},this.insertTextAtCursor=function(e,t=!1){if(!h.editing())return;h.editor.session.replace(h.editor.selection.getRange(),"");const n=h.editor.getCursorPosition();if(h.editor.session.insert(n,e),t){const e=h.editor.getCursorPosition();editor.scrollToLine(e.row,!0,!0,(function(){})),h.editor.focus()}h.updateEditorStats(),h.editor.focus()},this.getTagBeforeCursor=function(){const e=h.editor.getSelectionRange(),t=e.start.row,n=h.editor.session.getLine(t).substring(e.start.column-2,e.start.column+2);if(!n)return"";if("ink"===app.settings.documentType()){if(["->"].includes(n.trim()))return n.trim()}else if(["[[","<<"].includes(n.trim())||n.includes("|"))return n.trim();return h.richTextFormatter.identifyTag(n)},this.saveNode=function(){const t=h.editing();if(t){const n=e("#editorTitle")[0],i=h.getFutureEditedNodeTitle();n.value=i,t.title(i),t.body(h.trimBodyLinks(t.body().trim())),h.makeNewNodesFromLinks(),h.propagateUpdateFromNode(t),h.workspace.updateArrows(),setTimeout(h.updateSearch,600),h.setYarnDocumentIsDirty(),app.ui.dispatchEvent("yarnSavedNode")}},this.closeEditor=function(){h.editing().undoManager=h.editor.session.getUndoManager(),e("#node-editor-background").transition({opacity:0},250),e("#node-editor").transition({y:"-100",opacity:0},250,(function(e){h.editing(null),h.editor.destroy(),h.editor=null,this.emPicker=null})),h.isEditorSplit=!1,h.isEditorFocused=!1,e(".app-info").show(),app.ui.resetAppButtonsLocation(),h.isEditorInPlayMode()&&h.togglePlayMode(!1),h.isEditorInPreviewMode&&h.togglePreviewMode(!1)},this.convertMarkup=function(){h.nodes().forEach(e=>{e.body(h.richTextFormatter.convert(e.body()))})},this.updateSearch=p.Utils.debounce((function(){const t=app.$searchField.val().toLowerCase();for(var n=0;n{n.includes(e)||t.push(e)}),e.linkedFrom().forEach(e=>{n.includes(e)||t.push(e)}))},this.updateTagsRepository=p.Utils.debounce((function(){if(!app.mustUpdateTags)return;app.mustUpdateTags=!1;h.tags().forEach(e=>e.count=0),h.nodes().forEach(e=>{p.Utils.uniqueSplit(e.tags()," ").forEach(e=>{const t=h.tags().find(t=>t.text==e);if(t)++t.count;else{const t=(()=>{const e=h.tags().map(e=>e.id);for(let t=1;;++t)if(!e.includes(t))return t})();h.tags.push({id:t,style:"tag-style-"+t,text:e,count:1})}})});let e=h.tags().length;for(;e--;)0===h.tags()[e].count&&h.tags().splice(e,1)}),500),this.makeNewNodesFromLinks=function(){if(!h.settings.createNodesEnabled())return console.info("Autocreate new nodes disabled");var e=h.editing().getLinksInNode();if(null!=e)for(var t=0;t0&&!n.includes(e)&&e!=h.editing().title()&&h.newNodeAt(h.editing().x()+t,h.editing().y()-120).title(e)},this.titleExistsTwice=function(e){return h.nodes().filter(t=>t.title().trim()===e.trim()).length>1},this.getFutureEditedNodeTitle=function(){const t=e("#editorTitle")[0];return h.getUniqueTitle(t.value.trim())},this.getOtherNodeTitles=function(){const e=[];return h.nodes().forEach(t=>{if(!h.editing()||t.title()!==h.editing().title()){if("ink"===app.settings.documentType()&&t.title().trim()===c.a.InkGlobalScopeNodeName)return;e.push(t.title().trim())}}),e},this.getHighlightedText=function(t){t=(t=(t=(t=(t=(t=(t=(t=t.replace(/\/g,">")).replace(/\<\<(.*?)\>\>/g,'

<<

$1

>>

')).replace(/\[\[([^\|]*?)\]\]/g,'

[[

$1

]]

')).replace(/\[\[([^\[\]]*?)\|([^\[\]]*?)\]\]/g,'

[[

$1

|

$2

]]

')).replace(/[^:]\/\/(.*)?($|\n)/g,'//$1\n')).replace(/\/\*((.|[\r\n])*)?\*\//gm,'/*$1*/')).replace(/\/\%((.|[\r\n])*)?\%\//gm,'/%$1%/');var n=e("
");return n[0].innerHTML=t,n.find(".comment").each((function(){e(this).find("p").each((function(){e(this).removeClass()}))})),n.find(".linkname").each((function(){var t=e(this).text(),n=!1;for(var i in h.nodes())if(h.nodes()[i].title().toLowerCase()==t.toLowerCase()){n=!0;break}n||e(this).removeClass("linkname")})),t=n[0].innerHTML},this.updateLineNumbers=function(t){for(var n=t.split("\n"),i="",o=0;o0)&&(i+=o+1+"
");e(".editor-container .lines").html(i)},this.moveNodes=function(e,t){for(var n in h.nodes()){var i=h.nodes()[n];i.moveTo(i.x()+e,i.y()+t)}},this.getFirstFoundNode=function(e){return h.nodes().find(t=>t.title().toLowerCase().trim()===e)},this.searchWarp=function(){var e=h.$searchField.val().toLowerCase().trim();if(""===e)h.workspace.warpToNodeByIdx(0);else{const t=h.getFirstFoundNode(e);h.workspace.warpToNodeByIdx(h.nodes.indexOf(t))}},this.clearSearch=function(){h.$searchField.val(""),h.updateSearch()},this.updateEditorStats=function(){var t=h.editor.getSession().getValue(),n=h.editor.getCursorPosition(),i=t.split("\n");e(".editor-counter .character-count").html(t.length),e(".editor-counter .line-count").html(i.length),e(".editor-counter .row-index").html(n.row),e(".editor-counter .column-index").html(n.column),c.a.saveAppStateToLocalStorage()},this.getUniqueTitle=function(e){var t=h.getOtherNodeTitles();if(e&&!t.includes(e))return e;var n=e||"Node",i=2;const o=n.match(/^(.*)(_([0-9]+))$/);if(o&&4===o.length&&(n=o[1],i=Number(o[3])),!t.includes(n))return n;for(;;++i){var s=n+"_"+i;if(!t.includes(s))return s}},this.navigateToNodeDuringPlayTest=function(e,t=""){h.openNodeByTitle(e,t),h.togglePlayMode(!0),app.workspace.warpToNode(app.getFirstFoundNode(e))}})}).call(this,n("EVdn"),n("Z1dp"))},"P85/":function(e,t,n){},W2Rx:function(e,t,n){"use strict";(function(e,i){n.d(t,"a",(function(){return a}));var o=n("oj90");let s=0;let a=function(t={}){const n=this;this.titleStyles=["title-style-1","title-style-2","title-style-3","title-style-4","title-style-5","title-style-6","title-style-7","title-style-8","title-style-9"],this.index=e.observable(s++),this.title=e.observable(t.title||app.getUniqueTitle()),this.tags=e.observable(t.tags||""),this.body=e.observable(t.body||""),this.active=e.observable(t.active||!0),this.width=200,this.height=200,this.tempOpacity=null,this.style=null,this.colorID=e.observable(t.colorID||0),this.checked=!1,this.selected=!1,this.createX=t.x||null,this.createY=t.y||null,this.undoManager=null,this.clippedTags=e.computed((function(){return app.updateTagsRepository(),o.Utils.uniqueSplit(n.tags()," ").map(e=>app.tags().find(t=>t.text===e)).filter(e=>e)}),this),this.clippedBody=e.computed((function(){if(app.ui.isScreenNarrow()&&app.editing())return;app.mustRefreshNodes();let e=app.getHighlightedText(this.body());return e=app.richTextFormatter.richTextToHtml(e),e=e.substr(0,225),e}),this),this.linkedTo=e.observableArray(),this.linkedFrom=e.observableArray(),this.element=null,this.canDoubleClick=!0,this.create=function(){if(n.style=window.getComputedStyle(i(n.element).get(0)),n.createX&&n.createY)n.x(n.createX),n.y(n.createY);else{let e=i(n.element).parent();n.x((-e.offset().left+i(window).width()/2-100)/app.workspace.scale),n.y((-e.offset().top+i(window).height()/2-100)/app.workspace.scale)}app.workspace.bringToFront(n.element),app.workspace.startUpdatingArrows(),i(n.element).css({opacity:0,scale:.8,y:"-=80px",rotate:"45deg"}).transition({opacity:1,scale:1,y:"+=80px",rotate:"0deg"},250,"easeInQuad",(function(){app.workspace.stopUpdatingArrows(),app.workspace.updateArrows()})),n.drag(),i(n.element).on("dblclick",(function(){n.canDoubleClick&&app.editNode(n)})),o.Utils.addDoubleTapDetector(n.element,(function(){n.canDoubleClick&&app.editNode(n)})),i(n.element).on("click",(function(e){e.ctrlKey&&(n.selected?app.workspace.deselectNodes(n):app.workspace.selectNodes(n))}))},this.setSelected=function(e){n.selected=e,n.selected?i(n.element).addClass("selected"):i(n.element).removeClass("selected")},this.toggleSelected=function(){n.setSelected(!n.selected)},this.x=function(e){if(null!=e&&i(n.element).css({x:Math.floor(e)}),n.style)return Math.floor(new WebKitCSSMatrix(n.style.webkitTransform).m41)},this.y=function(e){if(null!=e&&i(n.element).css({y:Math.floor(e)}),n.style)return Math.floor(new WebKitCSSMatrix(n.style.webkitTransform).m42)},this.resetDoubleClick=function(){n.canDoubleClick=!0},this.cycleColorDown=function(){n.doCycleColorDown(),setTimeout(n.resetDoubleClick,500),n.canDoubleClick=!1,app.input.isShiftDown&&app.matchConnectedColorID(n),n.selected&&app.setSelectedColors(n),app.setYarnDocumentIsDirty()},this.cycleColorUp=function(){n.doCycleColorUp(),setTimeout(n.resetDoubleClick,500),n.canDoubleClick=!1,app.input.isShiftDown&&app.matchConnectedColorID(n),n.selected&&app.setSelectedColors(n),app.setYarnDocumentIsDirty()},this.doCycleColorDown=function(){n.colorID(n.colorID()-1),n.colorID()<0&&n.colorID(8)},this.doCycleColorUp=function(){n.colorID(n.colorID()+1),n.colorID()>8&&n.colorID(0)},this.remove=async function(){return new Promise((e,t)=>{i(n.element).transition({opacity:0,scale:.8,y:"-=80px",rotate:"-45deg"},250,"easeInQuad",e)})},this.drag=function(){const e={x:0,y:0};let t=!1,o=!1;i(document.body).on("mousemove touchmove",(function(i){if(t){const t=app.input.isScreenTouched&&i.changedTouches?i.changedTouches[0].pageX:i.pageX,s=app.input.isScreenTouched&&i.changedTouches?i.changedTouches[0].pageY:i.pageY;let{x:a,y:r}=app.workspace.toWorkspaceCoordinates(t,s);a-=e.x,r-=e.y;let l=a-n.x(),d=r-n.y();const c=app.workspace.getSelectedNodes();if(("mousemove"===i.originalEvent.type||c.includes(n)&&"touchmove"===i.originalEvent.type)&&(n.x(a),n.y(r)),o&&(n.selected?c.splice(c.indexOf(n),1):c=app.getNodesConnectedTo(n),c.length>0))for(let e in c)c[e].active()&&(c[e].x(c[e].x()+l),c[e].y(c[e].y()+d));app.workspace.updateArrows()}})),i(n.element).on("pointerdown",(function(i){if(!t&&n.active()&&0===i.button){t=!0,(app.input.isShiftDown||n.selected)&&(o=!0);const{x:s,y:a}=app.workspace.toWorkspaceCoordinates(i.pageX,i.pageY);e.x=app.settings.snapGridEnabled()?app.workspace.stepify(s-n.x(),app.settings.gridSize()):s-n.x(),e.y=app.settings.snapGridEnabled()?app.workspace.stepify(a-n.y(),app.settings.gridSize()):a-n.y()}})),i(n.element).on("touchend",(function(e){app.workspace.selectNodes(n)})),i(document).on("pointerup touchend",(function(){(t||o)&&(t=!1,o=!1,app.setYarnDocumentIsDirty())}))},this.moveTo=function(e,t){app.workspace.startUpdatingArrows(),i(n.element).clearQueue(),i(n.element).transition({x:e,y:t},app.stopUpdatingArrows,500)},this.isConnectedTo=function(e,t){if(t&&e.isConnectedTo(n,!1))return!0;let i=n.linkedTo();for(let t in i){if(i[t]==e)return!0;if(i[t].isConnectedTo(e,!1))return!0;if(e.isConnectedTo(i[t],!1))return!0}return!1},this.getLinksInNode=function(e){const t="yarn"===app.settings.documentType();let i=(e||n).body().match(t?/\[\[(.*?)\]\]/g:/\-\>(.*)/g);if(null!=i){let e={};for(let n=i.length-1;n>=0;n--)t?(i[n]=i[n].substr(2,i[n].length-4).trim(),i[n].indexOf("|")>=0&&(i[n]=i[n].split("|")[1]),null!=e[i[n]]&&i.splice(n,1),e[i[n]]=!0):i[n]=i[n].substr(2,i[n].length).trim();return i}},this.updateLinks=function(){n.resetDoubleClick(),n.updateLinksFromParents(),n.updateLinksToChildren()},this.updateLinksFromParents=function(){n.oldTitle&&n.oldTitle!==n.title()&&(n.linkedFrom.removeAll(),app.nodes().forEach(e=>{const t=n.getLinksInNode(e);if(t)if(t.includes(n.oldTitle)){const t=RegExp("\\|\\s*"+n.oldTitle+"\\s*\\]\\]","g"),i=RegExp("\\[\\[\\s*"+n.oldTitle+"\\s*\\]\\]","g");let o=e.body().replace(t,"|"+n.title()+"]]");o=o.replace(i,"[["+n.title()+"]]"),e.body(o),n.linkedFrom.push(e)}else t.includes(n.title())&&n.linkedFrom.push(e)}),n.oldTitle=void 0)},this.updateLinksToChildren=function(){n.linkedTo.removeAll();let e=n.getLinksInNode();if(e)for(let t in app.nodes()){let i=app.nodes()[t];for(let t=0;t{t.plugins[e.name]=e},r=e=>(n.pluginStorage||(n.pluginStorage={}),n.pluginStorage[e]||(n.pluginStorage={...n.pluginStorage,[e]:{}}),this.pluginStorage[e]);window.addEventListener("yarnLoadedData",e=>{if(null!==t.data.documentHeader()){const e=t.data.documentHeader();"pluginStorage"in e&&(n.pluginStorage=e.pluginStorage)}}),window.addEventListener("newYarnFileStarted",e=>{n.pluginStorage={}});const l={app:t,createButton:(e,{name:t,iconName:n,onClick:i,attachTo:o,className:s,title:a,onPointerDown:r,onDoubleClick:l,id:d})=>{if(null!==document.getElementById(d))return;const c=document.createElement("span");return c.id=d||t||a||n,c.innerHTML=`\n \n \n  \n ${t||""}\n \n `,document.getElementById(o).appendChild(c),c},createToggle:(e,{id:t,attachTo:n,className:i,title:o,tooltipId:s,toggleValueKey:a,onToggle:r,enableKey:l,iconName:d})=>{if(null!==document.getElementById(t))return;const c=document.createElement("span");return c.id=t,c.className="styled-checkbox",c.innerHTML=`\n \n \n `,document.getElementById(n).appendChild(c),c},getPluginStore:r,setPluginStore:(e,t,i)=>{const o={...r(e),[t]:i};n.pluginStorage={...n.pluginStorage,[e]:o}},addSettingsItem:({title:n,valueKey:i,defaultValue:o,optionsKey:s,options:a,setterKey:r,settingsColumn:l})=>{t.settings[i]=e.observable(t.settings.storage.getItem(i)||o).extend({persist:i}),t.ui[s]=a,t[r]=function(e,n){const o=n?n.target.value:e;t.settings[i](o)},window.addEventListener("settingsOpened",()=>{const e=t.ui[s].map(e=>``).join(""),o=`\n \n
\n \n
\n `,a=document.createElement("div");a.className="settings-item",a.innerHTML=o,document.getElementById("settingsColumn"+(l||"A")).appendChild(a),document.getElementById("mySelect").addEventListener("change",e=>{t[r](!1,e)})})},onYarnLoadedData:e=>{window.addEventListener("yarnLoadedData",t=>{e(t)})},onYarnEditorOpen:e=>{window.addEventListener("yarnEditorOpen",t=>{e(t)})},onYarnInPreviewMode:e=>{window.addEventListener("yarnSavedNode",t=>{e(t)})},onYarnSavedNode:e=>{window.addEventListener("yarnInPreviewMode",t=>{e(t)})},onYarnSetLanguage:e=>{window.addEventListener("yarnSetLanguage",t=>{e(t)})},onYarnLoadedStateFromLocalStorage:e=>{window.addEventListener("yarnLoadedStateFromLocalStorage",t=>{e(t)})},onYarnSavedStateToLocalStorage:e=>{window.addEventListener("yarnSavedStateToLocalStorage",t=>{e(t)})},onYarnSetDocumentType:e=>{window.addEventListener("yarnSetDocumentType",t=>{e(t)})},onKeyUp:e=>{i(document).on("keyup",t=>{e(t)})},onKeyDown:e=>{i(document).on("keydown",t=>{e(t)})},onLoad:e=>{window.addEventListener("DOMContentLoaded",t=>{e(t)})}};o.forEach(e=>{const t=new e(l);window.addEventListener("DOMContentLoaded",e=>{a(t)})}),console.log("Get plugins:",t.settings.gistPluginsFile()),null!==t.settings.gistPluginsFile()&&t.data.storage.getGist(t.settings.gistPluginsFile()).then(({filesInGist:e})=>{console.log({filesInGist:e}),Object.values(e).forEach(e=>{if("JavaScript"===e.language){console.log({gistFile:e});try{t.storage.getContentOrRaw(e.content,e.raw_url).then(n=>{console.log({content:n}),s(n,e.filename).then(n=>{const i=n(l);i.name=i.name||e.filename,t.log({newPlugin:i},"loaded from ",e.raw_url),"dependencies"in i&&i.dependencies.forEach(e=>{const n=document.createElement("script");n.setAttribute("src",e),document.body.appendChild(n),n.addEventListener("load",()=>{t.log("File loaded",e)}),n.addEventListener("error",e=>{t.log("Error on loading file",e)})}),a(i)})})}catch(t){console.error(e.filename,"Plugin failed to load",t)}}})})}}).call(this,n("Z1dp"),n("EVdn"))},e6Wu:function(e,t,n){"use strict";n.r(t);n("3ozf"),n("P85/"),n("uMdg"),n("gugv");var i=n("oj90"),o=n("0h2I"),s=n.n(o),a=(n("5uVa"),n("si6p"),n("ghrA"),n("bU/s")),r=n.n(a),l=(n("A8C4"),n("VEX6"),n("jF1P"),n("YhK8"),n("Ab/9"),n("KDOe"),n("PSD3")),d=n.n(l),c=n("P0sH"),p=n("pLxK"),u=n("bHyH");window.ko=s.a,window.$=window.jQuery=n("EVdn"),window.ace=r.a,r.a.config.set("basePath",i.Utils.getPublicPath()),window.define=r.a.define,window.Swal=d.a,"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("sw.js").then(e=>{console.log("SW registered: ",e)}).catch(e=>{console.log("SW registration failed: ",e)})}),window.app=new c.a("Yarn",p.a),window.app.run();const g=new u.a(window.app);window.app.plugins=g},fkuv:function(e,t,n){"use strict";(function(e,i){n.d(t,"a",(function(){return s}));var o=n("2Qx2");const s=function(t){const n=this;this.notification=Swal.mixin({toast:!0,position:"top",showConfirmButton:!1,timer:2500}),this.dispatchEvent=function(e,t){const n=new CustomEvent(e);n.options=t,window.dispatchEvent(n),window.parent.dispatchEvent(n)},this.settingsDialogVisible=e.observable(!1),this.narrowScreenThreshold=600,this.isScreenNarrow=function(){return i(window).width()<=n.narrowScreenThreshold},this.availableMarkupLanguages=[{id:"bbcode",name:"Bbcode"},{id:"html",name:"Html"}],this.availableFiletypeVersions=[{id:"1",name:"1"},{id:"2",name:"2"}],this.availableThemes=[{id:"classic",name:"Classic"},{id:"blueprint",name:"Blueprint"},{id:"dracula",name:"Dracula"}],this.availableDocumentTypes=[{id:"yarn",name:"Yarn"},{id:"ink",name:"Ink"}],this.availableLanguages=[{name:"Čeština",id:"cs-CZ"},{name:"Deutsch",id:"de-DE"},{name:"English",id:"en-GB"},{name:"Español",id:"es-ES"},{name:"Français",id:"fr-FR"},{name:"Íslenska",id:"is-IS"},{name:"Nederlands",id:"nl-NL"},{name:"Norsk bokmål",id:"nb-NO"},{name:"Polski",id:"pl-PL"},{name:"Română",id:"ro-RO"},{name:"Slovenčina",id:"sk-SK"},{name:"Svenska",id:"sv-SE"},{name:"Türkçe",id:"tr-TR"},{name:"български",id:"bg-BG"},{name:"Pусский",id:"ru-RU"},{name:"Српски",id:"sr-RS"},{name:"한국어",id:"ko-KR"}],this.availableLineStyles=[{id:"straight",name:"Straight Lines"},{id:"bezier",name:"Bezier Curves"}],this.openSettingsDialog=function(){n.settingsDialogVisible(!0),i(".settings-dialog").css({opacity:0}).transition({opacity:1},250),i(".settings-dialog .form").css({y:"-100"}).transition({y:"0"},250);var e=new CustomEvent("settingsOpened");window.dispatchEvent(e)},this.openHelpDialog=function(){Swal.fire({title:"Help",html:'\n
\n

Useful editor shortcuts:

\n \n
    \n
  • Cmd/Ctrl + Left Click -- Create multiple input carets
  • \n
  • Cmd/Ctrl + Left/Right -- Caret jump word
  • \n
  • Cmd/Ctrl + Up/Down -- Scroll up/down
  • \n
  • Cmd/Ctrl + Left/Right + Shift -- Caret jump word selection
  • \n
  • Cmd/Ctrl + F -- Search
  • \n
  • Cmd/Ctrl + Alt + K -- Find All
  • \n
  • Cmd/Ctrl + H -- Search and Replace
  • \n
  • Cmd/Ctrl + A -- Select all
  • \n
  • Cmd/Ctrl + U -- To Uppercase
  • \n
  • Cmd/Ctrl + Shift + U -- To Lowercase
  • \n
  • Alt + Up/Down -- Move line(s) up/down
  • \n
  • ...
  • \n
\n
\n
How to use Yarn Syntax
\n
How to use Ink Syntax
\n

Runtimes:

\n YarnSpinner (Unity3d)\n BondageJs (yarn javascript)\n Ink C# (Unity3d)\n InkJs (javascript)\n BladeInk (java)\n Many more Ink parsers\n
\n ',showCancelButton:!0,confirmButtonText:"About",cancelButtonText:"Close"}).then(e=>{e.value&&Swal.fire({title:"About",html:'\n \n ',showCancelButton:!1,confirmButtonText:"OK"})})},this.closeSettingsDialog=function(){i(".settings-dialog").css({opacity:1}).transition({opacity:0},250,e=>{n.settingsDialogVisible(!1)}),i(".settings-dialog .form").css({y:"0"}).transition({y:"-100"},250),setTimeout(()=>t.settings.apply(),100)},this.isDialogOpen=function(){return n.settingsDialogVisible()||Swal.isVisible()&&!Swal.isTimerRunning()},this.confirmMarkupConversion=function(){Swal.fire({title:"Are you sure?",text:"Markup on all nodes will be modified. This can rarely result in broken texts. This operation can't be undone.",icon:"warning",showCancelButton:!0,confirmButtonText:"Yes, convert it!",cancelButtonText:"No, cancel!",reverseButtons:!0}).then(e=>{e.value&&(t.convertMarkup(),Swal.fire("Converted!","The markup on the nodes has been converted.","success"))})},this.nodeSearchMatches=function(e,t,n=!1){var o=n||i(".search-title input").is(":checked"),s=n||i(".search-body input").is(":checked"),a=n||i(".search-tags input").is(":checked");return 0!==t.length&&(o||s||a)?{matchTitle:o&&e.title().toLowerCase().indexOf(t)>=0,matchBody:s&&e.body().toLowerCase().indexOf(t)>=0,matchTags:a&&e.tags().toLowerCase().indexOf(t)>=0,clearSearch:!1}:{matchTitle:!1,matchBody:!1,matchTags:!1,clearSearch:!0}},this.findMatchingNodes=function(e){const n={matchTitle:[],matchBody:[],matchTags:[],foundNodes:!1};return[...t.nodes()].reverse().forEach(i=>{const{matchTitle:o,matchBody:s,matchTags:a}=t.ui.nodeSearchMatches(i,e,!0);o&&n.matchTitle.push(i),s&&n.matchBody.push(i),a&&n.matchTags.push(i)}),n.foundNodes=n.matchTitle.length>0||n.matchBody.length>0||n.matchTags.length>0,n},this.createSearchMenuLine=function(e,n,s,a="title"){const r=document.createElement("div");if(r.innerHTML=`${e.title()} ${a?`(${a})`:""}`,i(r).addClass("item "+e.titleStyles[e.colorID()]),"link"==n){if(e.title()!==t.editing().title()){if("ink"===t.settings.documentType()&&e.title().trim()===o.a.InkGlobalScopeNodeName)return;r.setAttribute("onclick","ink"===t.settings.documentType()?"app.insertTextAtCursor('-> "+e.title()+"')":"app.insertTextAtCursor('[["+e.title()+"]]')"),s.appendChild(r)}}else"open"==n&&(r.setAttribute("onclick",`app.openNodeByTitle("${e.title()}")`),r.setAttribute("onmouseenter",`app.workspace.warpToNodeByIdx(${t.nodes.indexOf(e)})`),s.appendChild(r))},this.openNodeListMenu=function(e){const n="link"===e?document.getElementById("linkHelperMenuFilter").value.toLowerCase():document.getElementById("nodeSearchInput").value.toLowerCase(),i=document.getElementById(e+"HelperMenu");i.innerHTML="";const o=()=>{[...t.nodes()].reverse().forEach(t=>{this.createSearchMenuLine(t,e,i,"")})};if(!n)return void o();const s=this.findMatchingNodes(n);s.foundNodes?(s.matchTitle.forEach(t=>{this.createSearchMenuLine(t,e,i,"title")}),s.matchTags.forEach(t=>{this.createSearchMenuLine(t,e,i,"tags")}),s.matchBody.forEach(t=>{this.createSearchMenuLine(t,e,i,"body")})):o()},this.checkAndMoveAppButtons=function(){i(".app-add-node").toggleClass("app-add-node-alt","right"===t.settings.editorSplitDirection()),i(".app-sort").toggleClass("app-sort-alt","right"===t.settings.editorSplitDirection()),i(".app-undo-redo").toggleClass("app-undo-redo-alt","right"===t.settings.editorSplitDirection()),i(".app-zoom").toggleClass("app-zoom-alt","right"===t.settings.editorSplitDirection())},this.resetAppButtonsLocation=function(){i(".app-add-node").removeClass("app-add-node-alt"),i(".app-sort").removeClass("app-sort-alt"),i(".app-undo-redo").removeClass("app-undo-redo-alt"),i(".app-zoom").removeClass("app-zoom-alt")},this.toastMixin=Swal.mixin({toast:!0,icon:"success",title:"Done!",animation:!1,position:"bottom",showConfirmButton:!1,timer:2500,timerProgressBar:!0,didOpen:e=>{e.addEventListener("mouseenter",Swal.stopTimer),e.addEventListener("mouseleave",Swal.resumeTimer)}}),this.insertTextAtCursorWithParams=function(e="",n=[]){const o=n.map((e,t)=>"boolean"==typeof e.default?`
${e.name} :
`:"number"==typeof e.default?`
${e.name} :
`:`
${e.name} :
`).join("\n");Swal.fire({title:"Snippet properties",html:o,preConfirm:function(){return new Promise((function(e){e(n.map((e,t)=>"boolean"==typeof e.default?i("#swal-input"+t).is(":checked"):i("#swal-input"+t).val()))}))},onOpen:function(){i("#swal-input0").focus(),n.forEach((e,n)=>{void 0!==e.default&&("boolean"==typeof e.default?i("#swal-input"+n)[0].checked=e.default:i("#swal-input"+n)[0].value=e.default,t.log(i("#swal-input"+n)))})}}).then((function(n){if(!n.value)return;let i=e;n.value.forEach((e,t)=>{void 0!==e&&(i=i.replace("%"+t,e))}),t.insertTextAtCursor(i)}))}}}).call(this,n("Z1dp"),n("EVdn"))},gugv:function(e,t,n){},jF1P:function(e,t,n){(function(e){var t,n;t={},n=0,e.bindingHandlers.ace={init:function(i,o,s,a,r){var l=s().aceOptions||{},d=e.utils.unwrapObservable(o());i.id||(i.id="knockout-ace-"+n,n+=1);var c=ace.edit(i.id);l.theme&&c.setTheme("ace/theme/"+l.theme),l.mode&&c.getSession().setMode("ace/mode/"+l.mode),c.setValue(d),c.gotoLine(0),c.setShowPrintMargin(!1),c.getSession().setUseWrapMode(!0),c.getSession().on("change",(function(t){e.isWriteableObservable(o())&&o()(c.getValue())})),t[i.id]=c,e.utils.domNodeDisposal.addDisposeCallback(i,(function(){try{c.destroy()}catch(e){}delete t[i.id]}))},update:function(n,i,o,s,a){var r=e.utils.unwrapObservable(i()),l=n.id;if(void 0!==l&&""!==l&&t.hasOwnProperty(l)){var d=t[l];d.getValue()!==r&&(d.setValue(r),d.gotoLine(0))}}},e.aceEditors={resizeAll:function(){for(var e in t)t.hasOwnProperty(e)&&t[e].resize()},get:function(e){return t[e]}}}).call(this,n("Z1dp"))},"l8+o":function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var i=n("mIo7"),o=n("mqgS");const s=function(e){const t=t=>{const n=/((https:\/\/)?(www.)?instagram.com\/p\/[^\s\<]+)/gi,i=/(?:http(?:s?):\/\/|)(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]*)(&(amp;)?‌​[\w\?‌​=]*)?(?:\?t=[0-9]+)?/gi,o=new RegExp(`^(?!${/(https?:\/\/twitter.com\/[^\s\<]+\/[^\s\<]+\/[^\s\<]+)/gi.source}|${i.source}|${n.source})https?:.*$`,"gm");return t=(t=(t=t.replace(o,(function(e){return`\n ${e}\n `}))).replace(i,(function(e){const t=e.match(/(?:https\:.*|)(?:www.|)youtu(?:.*\/v\/|.*v\=|\.be\/)([A-Za-z0-9_\-]{11}(?:\?t=[0-9]+)?)/i);if(t.length>1)return`\n \n `}))).replace(n,(function(t){const n=t.match(/((?:https?:\/\/)?(?:www.)?instagram.com\/p\/([^\s\<]+)\/)/i);if(n.length>2)return e.log("EXTRACTED",n),`\n \n `}))};return"html"===e.settings.markupLanguage()?new o.a(e,t):new i.a(e,t)}},mIo7:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return BbcodeRichTextFormatter}));const bbcode=__webpack_require__("L8pc"),BbcodeRichTextFormatter=function(app,addExtraPreviewerEmbeds){const self=this;this.justInsertedAutoComplete=!1,this.completableTags=Object.freeze([{Start:"<<",Completion:">>",Offset:-2},{Start:"[colo",Completion:"r=#][/color]",Offset:-9,BehaviorCompletion:"r=#][/color",Func:()=>{app.insertColorCode()}},{Start:"[b",Completion:"][/b]",BehaviorCompletion:"][/b",Offset:-4},{Start:"[i",Completion:"][/i]",BehaviorCompletion:"][/i",Offset:-4},{Start:"[img",Completion:"][/img]",BehaviorCompletion:"][/img",Offset:-6},{Start:"[u",Completion:"][/u]",BehaviorCompletion:"][/u",Offset:-4},{Start:"[url",Completion:"][/url]",BehaviorCompletion:"][/url",Offset:-6}]),this.getTagOpen=function(e){switch(e){case"cmd":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"~ ":"{ ":"<<";case"opt":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"-> ":"* [":"[[";case"color":return"[color=#]";default:return`[${e}]`}},this.getTagClose=function(e){switch(e){case"cmd":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"":" }":">>";case"opt":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"":"]":"|]]";default:return`[/${e}]`}},this.identifyTag=function(e){return-1!==e.lastIndexOf("[")?e.substring(e.lastIndexOf("["),e.length):""},this.insertTag=function(e){const t=self.getTagOpen(e),n=self.getTagClose(e),i=JSON.parse(JSON.stringify(app.editor.selection.getRange()));app.editor.session.insert(i.start,t),app.editor.session.insert({column:i.end.column+t.length,row:i.end.row},n),"color"===e&&(0===app.editor.getSelectedText().length?app.moveEditCursor(-9):app.editor.selection.setRange({start:{row:app.editor.selection.getRange().start.row,column:app.editor.selection.getRange().start.column-1},end:{row:app.editor.selection.getRange().start.row,column:app.editor.selection.getRange().start.column-1}}),app.insertColorCode()),"img"===e?0===app.editor.getSelectedText().length&&(app.moveEditCursor(-6),app.data.triggerPasteClipboard(),setTimeout(()=>app.moveEditCursor(6),300)):0===app.editor.getSelectedText().length?app.isEditorInPreviewMode||app.moveEditCursor(-n.length):app.editor.selection.setRange({start:app.editor.selection.getRange().start,end:{row:app.editor.selection.getRange().end.row,column:app.editor.selection.getRange().end.column-n.length}}),app.editor.focus()},this._convertTag=function(inPattern,outPattern,text){const globalRegex=new RegExp(inPattern,"gi"),localRegex=new RegExp(inPattern,"i");return text.replace(globalRegex,m=>{const match=m.match(localRegex),template=eval("`"+outPattern+"`");return match.length?template:null})},this.convert=function(e){let t=e;return t=self._convertTag("(.*?)<\\/b>","[b]${match[1]}[/b]",t),t=self._convertTag("(.*?)<\\/u>","[u]${match[1]}[/u]",t),t=self._convertTag("(.*?)<\\/i>","[i]${match[1]}[/i]",t),t=self._convertTag("(.*?)<\\/img>","[img]${match[1]}[/img]",t),t=self._convertTag("(.*?)<\\/color>","[color=#${match[1]}]${match[2]}[/color]",t),t=self._convertTag("(.*?)<\\/url>","[url]${match[1]}[/url]",t),t},this.richTextToHtml=function(e,t=!1){let n=1,i=t?'
'+n+". "+e+"
":e;return i=i.replace(/<(run:"),i=i.replace(/>>/gi,")
"),i=i.replace(/\[color=#[A-Za-z0-9]+\]/gi,(function(e){const t=e.match(/\[color=#([A-Za-z0-9]+)\]/i);if(t&&t.length>1)return"[color=#"+t[1]+"]"})),i=i.replace(/\[img\][^\[]+\[\/img\]/gi,(function(e){const n=e.match(/\[img\](.*)\[\/img\]/i);if(n.length>1){const e=app.data.editingFileFolder(n[1]);return app.data.doesFileExist(e)?t?' ':' ':t?' ':' '}})),t&&(i=addExtraPreviewerEmbeds(i)),i=i.replace(/[\n\r]/g,(function(e){let i="
";return n+=1,t&&(i+='
'+n+". "),i})),i=bbcode.parse(i),i}}},mqgS:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return HtmlRichTextFormatter}));const HtmlRichTextFormatter=function(app,addExtraPreviewerEmbeds){const self=this;this.justInsertedAutoComplete=!1,this.completableTags=Object.freeze([{Start:"<<",Completion:">>",Offset:-2},{Start:"",Offset:-9,Func:()=>{app.insertColorCode()}},{Start:"",Offset:-4},{Start:"",Offset:-6},{Start:"",Offset:-4},{Start:"",Offset:-4},{Start:"",Offset:-6}]),this.getTagOpen=function(e){switch(e){case"cmd":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"~ ":"{ ":"<<";case"opt":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"-> ":"* [":"[[";case"color":return"";default:return`<${e}>`}},this.getTagClose=function(e){switch(e){case"cmd":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"":" }":">>";case"opt":return"ink"===app.settings.documentType()?0===app.editor.getSelectedText().length?"":"]":"|]]";default:return``}},this.identifyTag=function(e){return-1!==e.lastIndexOf("<")?e.substring(e.lastIndexOf("<"),e.length):""},this.insertTag=function(e){const t=self.getTagOpen(e),n=self.getTagClose(e),i=JSON.parse(JSON.stringify(app.editor.selection.getRange()));app.editor.session.insert(i.start,t),app.editor.session.insert({column:i.end.column+t.length,row:i.end.row},n),"color"===e&&(0===app.editor.getSelectedText().length?app.moveEditCursor(-9):app.editor.selection.setRange({start:{row:app.editor.selection.getRange().start.row,column:app.editor.selection.getRange().start.column-1},end:{row:app.editor.selection.getRange().start.row,column:app.editor.selection.getRange().start.column-1}}),app.insertColorCode()),"img"===e?navigator.clipboard.readText().then(e=>{0===app.editor.getSelectedText().length&&(app.moveEditCursor(-7),app.insertTextAtCursor(` src="${e}"`))}):0===app.editor.getSelectedText().length?app.isEditorInPreviewMode||app.moveEditCursor(-n.length):app.editor.selection.setRange({start:app.editor.selection.getRange().start,end:{row:app.editor.selection.getRange().end.row,column:app.editor.selection.getRange().end.column-n.length}}),app.editor.focus()},this._convertTag=function(inPattern,outPattern,text){const globalRegex=new RegExp(inPattern,"gi"),localRegex=new RegExp(inPattern,"i");return text.replace(globalRegex,m=>{const match=m.match(localRegex),template=eval("`"+outPattern+"`");return match.length?template:null})},this.convert=function(e){let t=e;return t=self._convertTag("\\[b\\](.*?)\\[\\/b\\]","${match[1]}",t),t=self._convertTag("\\[u\\](.*?)\\[\\/u\\]","${match[1]}",t),t=self._convertTag("\\[i\\](.*?)\\[\\/i\\]","${match[1]}",t),t=self._convertTag("\\[img\\](.*?)\\[\\/img\\]","${match[1]}",t),t=self._convertTag("\\[color=#(.*?)\\](.*?)\\[\\/color\\]","${match[2]}",t),t=self._convertTag("\\[url\\](.*?)\\[\\/url\\]","${match[1]}",t),t},this.richTextToHtml=function(e,t=!1){let n=1,i=t?'
'+n+". "+e+"
":e;return i=i.replace(/<(run:"),i=i.replace(/>>/gi,")
"),[/<color=#(.*?)>(.*?)<\/color>/,/(.*?)<\/color>/].forEach(e=>{const t=new RegExp(e,"gi"),n=new RegExp(e,"i");i=i.replace(t,(function(e){const t=e.match(n);if(t&&t.length>2)return`☗${t[2]}`}))}),i=i.replace(/<img>[^\[]+<\/img>/gi,(function(e){const n=e.match(/<img>(.*?)<\/img>/i);if(n.length>1){const e=app.data.editingFileFolder(n[1]);return app.data.doesFileExist(e)?t?' ':' ':t?' ':' '}})),i=i.replace(/<b>.*<\/b>/gi,e=>{const t=e.match(/<b>(.*)<\/b>/i);if(t.length)return`${t[1]}`}),i=i.replace(/<u>.*<\/u>/gi,e=>{const t=e.match(/<u>(.*)<\/u>/i);if(t.length)return`${t[1]}`}),i=i.replace(/<i>.*<\/i>/gi,e=>{const t=e.match(/<i>(.*)<\/i>/i);if(t.length)return`${t[1]}`}),t&&(i=addExtraPreviewerEmbeds(i)),i=i.replace(/[\n\r]/g,(function(e){let i="
";return n+=1,t&&(i+='
'+n+". "),i})),i}}},oj90:function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"Utils",(function(){return i}));var i={createAutocompleter:function(e,t,n,i=1){return{getCompletions:function(o,s,a,r,l){var d=o.session.getTokenAt(a.row,a.column);r.length`,"

",e.title,"

","
","
",e.about,"
","
","
"].join("")}}},addDoubleTapDetector:function(e,t){e.lastTap=0,e.tapTimeout=0,e.addEventListener("touchend",(function(n){var i=(new Date).getTime(),o=i-e.lastTap;clearTimeout(e.tapTimeout),o<500&&o>0?(t(),n.preventDefault()):e.tapTimeout=setTimeout((function(){clearTimeout(e.tapTimeout)}),500),e.lastTap=i}))},uniqueSplit:function(e,t=" "){return[...new Set(e.split(t).filter(e=>e))]},getHighestZ:function(t){let n=Number.NEGATIVE_INFINITY;return e(t).children().each((function(){let t=parseInt(e(this).css("z-index"))||0;t>n&&(n=t)})),n},clamp:function(e,t,n){return Math.max(Math.min(e,n),t)},rectanglesOverlap:function(e,t){return!(t.left>e.right||t.righte.bottom||t.bottom=0;)e=e.replace("<","<");for(;e.indexOf(">")>=0;)e=e.replace(">",">");return e},xmlToObject:function(e){var t=[];if((e=e.childNodes.item(0)).hasChildNodes())for(var n=0;n0)){o[r.nodeName]={};for(var l=0;l1){if(n.items={cut:{name:"Cut",icon:"cut",callback:()=>{app.clipboard.length>0&&(app.data.triggerCopyClipboard(),app.insertTextAtCursor(""))}},copy:{name:"Copy",icon:"copy",callback:()=>{app.data.triggerCopyClipboard()}},paste:{name:"Paste",icon:"paste",callback:()=>app.data.triggerPasteClipboard()},sep1:"---------"},!app.getTagBeforeCursor().match(e)||"ink"===app.settings.documentType()&&"END"===app.editor.getSelectedText()||(n.items["go to node"]={name:"Edit node: "+app.editor.getSelectedText(),callback:()=>{const e=app.getFutureEditedNodeTitle();app.nodeVisitHistory.includes(e)||app.nodeVisitHistory.push(e),app.openNodeByTitle(app.editor.getSelectedText())}}),app.settings.spellcheckEnabled()){var i=app.getSpellCheckSuggestionItems();!1!==i&&(n.items.corrections={name:"Correct word",items:i})}var o=app.getThesaurusItems();!1!==o&&(n.items.corrections={name:"Related words",items:o})}else n.items={paste:{name:"Paste",icon:"paste",callback:()=>app.data.triggerPasteClipboard()}},"ink"===app.settings.documentType()&&(n.items.inkSnips={name:"Ink snippets",items:{structure:{name:"Structure",items:{stitch:{name:"Stitch",callback:()=>{app.insertTextAtCursor("= stitchName\nThis is the content of the stitch that should be embedded within a knot.\n-> END")}},end:{name:"Ending indicator",callback:()=>{app.insertTextAtCursor("-> END")}}}},choices:{name:"Choices",items:{basicChoice:{name:"Basic choice",callback:()=>{app.insertTextAtCursor("* This is a choice that can only be chosen once")}},stickyChoice:{name:"Sticky choice",callback:()=>{app.insertTextAtCursor("+ This is a sticky choice - the player can choose it more than once")}},choiceWithoutPrinting:{name:"Choice without printing",callback:()=>{app.insertTextAtCursor("* [A choice where the content isn't printed after choosing]")}},choiceWithoutMixedOutput:{name:"Choice without mixed output",callback:()=>{app.insertTextAtCursor("* Try [it] this example!")}}}},variableText:{name:"Variable text",items:{shuffle:{name:"~Shuffle (rand) text",callback:()=>{app.insertTextAtCursor("I tossed the coin. {~Heads|Tails}.")}},cycle:{name:"&Cycle text",callback:()=>{app.insertTextAtCursor("It was {&Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday} today.")}},sequence:{name:"Sequence text",callback:()=>{app.insertTextAtCursor('The radio hissed into life. {"Three!"|"Two!"|"One!"|There was the white noise racket of an explosion.|But it was just static.}\n\n{I bought a coffee with my five-pound note.|I bought a second coffee for my friend.|I didn\'t have enough money to buy any more coffee.}')}},onceOnly:{name:"!Once only text",callback:()=>{app.insertTextAtCursor("He told me a joke. {!I laughed politely.|I smiled.|I grimaced.|I promised myself to not react again.}\n")}}}},variables:{name:"Variables",items:{globalVariable:{name:"Global variable",callback:()=>{app.insertTextAtCursor("VAR myNumber = 5")}},temporaryVariable:{name:"Temporary variable",callback:()=>{app.insertTextAtCursor("temp myTemporaryValue = 5")}},modifyVariable:{name:"Modify variable",callback:()=>{app.insertTextAtCursor("~ myNumber = myNumber + 1")}}}},conditions:{name:"Conditions",items:{inlineCondition:{name:"Inline condition",callback:()=>{app.insertTextAtCursor("{yourVariable: This is written if yourVariable is true|Otherwise this is written}\n")}},multilineCondition:{name:"Multiline condition",callback:()=>{app.insertTextAtCursor("{yourVariable:\n This is written if yourVariable is true.\n - else:\n Otherwise this is written.\n}")}}}}}},n.items.code={name:"Code",items:{equal:{name:"== (equal)",callback:()=>app.insertTextAtCursor("== ")},notEqual:{name:"!= (not equal)",callback:()=>app.insertTextAtCursor("!= ")},tag:{name:"# (tag)",callback:()=>app.insertTextAtCursor("# ")},list:{name:"LIST",callback:()=>app.insertTextAtCursor("LIST = ")},listFunc:{name:"List functions",items:{count:{name:"count",callback:()=>app.insertTextAtCursor("LIST_COUNT()")},min:{name:"min",callback:()=>app.insertTextAtCursor("LIST_MIN()")},max:{name:"max",callback:()=>app.insertTextAtCursor("LIST_MAX()")},rand:{name:"random",callback:()=>app.insertTextAtCursor("LIST_RANDOM()")}}},variable:{name:"VAR",callback:()=>app.insertTextAtCursor("VAR = ")},temp:{name:"~ temp",callback:()=>app.insertTextAtCursor("~ temp = ")},plusEq:{name:"+= (plus equal)",callback:()=>app.insertTextAtCursor("+= ")},else:{name:"- else",callback:()=>app.insertTextAtCursor("- else:\n")},or:{name:"|",callback:()=>app.insertTextAtCursor("|")},rand:{name:"~",callback:()=>app.insertTextAtCursor("~")}}},n.items.bladeCoder={name:"BladeCoder",items:{player:{name:"$PLAYER>",callback:()=>app.insertTextAtCursor("$PLAYER> ")},animation:{name:"Animation",callback:()=>app.ui.insertTextAtCursorWithParams("> Animation: animation=%0.%1, wait=%2, keepDirection=%3, repeat=%4, count=%5",[{name:"Actor",default:"$PLAYER"},{name:"Animation",default:"stand.right"},{name:"Wait",default:!1},{name:"Keep direction",default:!1},{name:"Repeat",default:"SPRITE_DEFINED"},{name:"Count",default:-1}])},goto:{name:"Goto",callback:()=>app.ui.insertTextAtCursorWithParams("> Goto: actor=%0, target=%1",[{name:"Actor",default:"$PLAYER"},{name:"target",default:"target"}])},wait:{name:"Wait",callback:()=>app.ui.insertTextAtCursorWithParams("> Wait: time=%0",[{name:"Time",default:.8}])},playSound:{name:"Play Sound",callback:()=>app.ui.insertTextAtCursorWithParams("> PlaySound: sound=%0, stop=%1",[{name:"Sound",default:"yawn"},{name:"Stop",default:!1}])},setActorAttr:{name:"Set Actor Attribute",callback:()=>app.ui.insertTextAtCursorWithParams("> SetActorAttr: actor=%0, talkAnimation=%1, visible=%2",[{name:"Actor",default:"$PLAYER"},{name:"Talk animation"},{name:"Visible",default:!0}])}}},n.items.end={name:"-> END",callback:()=>app.insertTextAtCursor("-> END")},n.items.star={name:"* (choice)",callback:()=>app.insertTextAtCursor("* ")},n.items.gather={name:"- (gather)",callback:()=>app.insertTextAtCursor("-")},n.items.stitch={name:"= (stitch)",callback:()=>app.insertTextAtCursor("= ")},n.items.glue={name:"<> (glue)",callback:()=>app.insertTextAtCursor("<>")},n.items.comment={name:"// (comment)",callback:()=>app.insertTextAtCursor("// ")},n.items.nested={name:"Nested",items:{gather2:{name:"-- (gather)",callback:()=>app.insertTextAtCursor("-- ")},star2:{name:"** (choice)",callback:()=>app.insertTextAtCursor("** ")}}},n.items.inkDoc={name:"How to use ink",callback:()=>window.open("https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md","_blank").focus()});return n}}}},debounce:function(e,t){var n;return function(){clearTimeout(n),n=setTimeout((function(){e()}),t)}}}}.call(this,n("EVdn"))},owJe:function(e,t,n){(function(e){var i=n("jXEy"),o=n("oj90"),s=o.Utils.getPublicPath("dictionaries/en/index.dic"),a=o.Utils.getPublicPath("dictionaries/en/index.aff");e("").appendTo("head"),e("").appendTo("head");var r=null;function l(e){var t=e.split(/\s+|\.|\,|\?|\\|\/|\!|\[|\]|"|'|;|:|`|\+|\-|\&|\$|@|~|#|>|<|_|\)|\(|£|\^|%|\*|„|“|\||[0-9]+/g),n=0,i=[];for(word in t){var o=t[word];r.correct(o)||(i[i.length]=[n,n+t[word].length]),n+=t[word].length+1}return i}t.load_dictionary=function(t){console.info(`Loading ${t} hunspell dictionary locally`),s=o.Utils.getPublicPath(`dictionaries/${t}/index.dic`),a=o.Utils.getPublicPath(`dictionaries/${t}/index.aff`),e.get(s,(function(e){dicData=e})).fail((function(){const n=sessionStorage.getItem("affData"),o=sessionStorage.getItem("dicData");if(n&&o)return console.info(t+" found in sessionStorage. Loading dictionary from cache..."),r=new i(n,o),void(d=!0);console.error(t+" not found locally. Loading dictionary from server instead..."),s=`https://raw.githubusercontent.com/wooorm/dictionaries/main/dictionaries/${t}/index.dic`,a=`https://raw.githubusercontent.com/wooorm/dictionaries/main/dictionaries/${t}/index.aff`,e.get(s,(function(e){dicData=e})).done((function(){e.get(a,(function(e){affData=e})).done((function(){sessionStorage.setItem("affData",affData),sessionStorage.setItem("dicData",dicData),r=new i(affData,dicData),d=!0}))}))})).done((function(){e.get(a,(function(e){affData=e})).done((function(){console.log("Dictionary loaded locally"),r=new i(affData,dicData),d=!0}))}))},t.misspelled=l;var d=!0,c=!1,p=[];function u(){if(null!=r&&!c&&d){c=!0;var e=ace.edit("editor").getSession();h();try{var t=ace.require("ace/range").Range,n=e.getDocument().getAllLines();for(var i in n){var o=l(n[i]);for(var s in o){var a=new t(i,o[s][0],i,o[s][1]);p[p.length]=e.addMarker(a,"misspelled","typo",!0)}}}finally{c=!1,d=!1}}}t.spell_check=u;var g=!1;function h(){var e=ace.edit("editor").getSession();for(var t in p)e.removeMarker(p[t]);p=[];var n=e.getDocument().getAllLines();for(var t in n)e.removeGutterDecoration(t,"misspelled")}t.enable_spellcheck=function(){g=!0,ace.edit("editor").getSession().on("change",(function(e){g&&(d=!0,u())})),d=!0,u()},t.disable_spellcheck=function(){g=!1,h()},t.clear_spellcheck_markers=h,t.suggest_word_for_misspelled=function(e){var t=r.suggest(e);return 0!==t.length&&t}}).call(this,n("EVdn"))},pLxK:function(e){e.exports=JSON.parse('{"a":"0.4.283"}')},pYPP:function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return i}));const i=function(t){const n=this,i=window.vsCodeApi?{getItem:()=>{},setItem:()=>{}}:window.localStorage;this.storage=i,e.extenders.persist=function(e,n){return e.subscribe((function(e){i.setItem(n,e),t.data.db.save(n,e)})),e},this.apply=function(){t.setTheme(n.theme()),t.setLanguage(n.language()),t.setDocumentType(n.documentType()),t.toggleInvertColors(),t.setMarkupLanguage(n.markupLanguage()),console.log("redraw throttle:",n.redrawThrottle()),t.workspace.setThrottle(n.redrawThrottle()),t.setGistCredentials({token:n.gistToken(),file:null!==n.gistFile()?n.gistFile().split("/").pop():null}),t.setGistPluginsFile(null!==n.gistPluginsFile()?n.gistPluginsFile().split("/").pop():null)},this.pasteFromClipboard=function(e){e&&e.length>0||navigator.clipboard&&navigator.clipboard.readText().then(n=>{t.log("clipboard",n),n&&n.length>5&&e(n)})},this.guessGistToken=function(){n.pasteFromClipboard(n.gistToken)},this.guessGistFile=function(){n.pasteFromClipboard(n.gistFile)},this.validateGridSize=function(){n.gridSize()<20&&n.gridSize(20),n.gridSize()>200&&n.gridSize(200),n.gridSize(parseInt(n.gridSize())),t.initGrid()},this.theme=e.observable(i.getItem("theme")||"dracula").extend({persist:"theme"}),this.documentType=e.observable(i.getItem("documentType")||"yarn").extend({persist:"documentType"}),this.language=e.observable(i.getItem("language")||"en-GB").extend({persist:"language"}),this.redrawThrottle=e.observable(parseInt(i.getItem("redrawThrottle")||"130")).extend({persist:"redrawThrottle"}),this.gistToken=e.observable(i.getItem("gistToken")).extend({persist:"gistToken"}),this.gistFile=e.observable(i.getItem("gistFile")).extend({persist:"gistFile"}),this.lastEditedGist=e.observable(i.getItem("lastEditedGist")).extend({persist:"lastEditedGist"}),this.lastStorageHost=e.observable(i.getItem("lastStorageHost")).extend({persist:"lastStorageHost"}),this.gistPluginsFile=e.observable(i.getItem("gistPluginsFile")).extend({persist:"gistPluginsFile"}),this.spellcheckEnabled=e.observable(null===i.getItem("spellcheckEnabled")||"true"===i.getItem("spellcheckEnabled")).extend({persist:"spellcheckEnabled"}),this.autoCloseTags=e.observable(null===i.getItem("autoCloseTags")||"true"===i.getItem("autoCloseTags")).extend({persist:"autoCloseTags"}),this.autocompleteSuggestionsEnabled=e.observable(null===i.getItem("autocompleteSuggestionsEnabled")||"true"===i.getItem("autocompleteSuggestionsEnabled")).extend({persist:"autocompleteSuggestionsEnabled"}),this.autoCloseBrackets=e.observable(null===i.getItem("autoCloseBrackets")||"true"===i.getItem("autoCloseBrackets")).extend({persist:"autoCloseBrackets"}),this.invertColorsEnabled=e.observable(null!==i.getItem("invertColorsEnabled")&&"true"===i.getItem("invertColorsEnabled")).extend({persist:"invertColorsEnabled"}),this.snapGridEnabled=e.observable(null!==i.getItem("snapGridEnabled")&&"true"===i.getItem("snapGridEnabled")).extend({persist:"snapGridEnabled"}),this.restoreSessionEnabled=e.observable(null!==i.getItem("restoreSessionEnabled")&&"true"===i.getItem("restoreSessionEnabled")).extend({persist:"restoreSessionEnabled"}),this.developmentModeEnabled=e.observable(null!==i.getItem("developmentModeEnabled")&&"true"===i.getItem("developmentModeEnabled")).extend({persist:"developmentModeEnabled"}),this.gridSize=e.observable(parseInt(i.getItem("gridSize")||"40")).extend({persist:"gridSize"}),this.createNodesEnabled=e.observable(null===i.getItem("createNodesEnabled")||"true"===i.getItem("createNodesEnabled")).extend({persist:"createNodesEnabled"}),this.editorStatsEnabled=e.observable(null!==i.getItem("editorStatsEnabled")&&"true"===i.getItem("editorStatsEnabled")).extend({persist:"editorStatsEnabled"}),this.markupLanguage=e.observable(i.getItem("markupLanguage")||"bbcode").extend({persist:"markupLanguage"}),this.filetypeVersion=e.observable(i.getItem("filetypeVersion")||"1").extend({persist:"filetypeVersion"}),this.lineStyle=e.observable(i.getItem("lineStyle")||"straight").extend({persist:"lineStyle"}),this.fileTabsVisible=e.observable(null===i.getItem("fileTabsVisible")||"true"===i.getItem("fileTabsVisible")).extend({persist:"fileTabsVisible"}),this.selectedFileTab=e.observable(i.getItem("selectedFileTab")||0).extend({persist:"selectedFileTab"}),this.alwaysOpenNodesInVisualStudioCodeEditor=e.observable(null!==i.getItem("alwaysOpenNodesInVisualStudioCodeEditor")&&"true"===i.getItem("alwaysOpenNodesInVisualStudioCodeEditor")).extend({persist:"alwaysOpenNodesInVisualStudioCodeEditor"}),this.editorSplitDirection=e.observable(i.getItem("editorSplitDirection")||"left").extend({persist:"editorSplitDirection"}),this.editorSplit=e.observable(null!==i.getItem("editorSplit")&&"true"===i.getItem("editorSplit")).extend({persist:"editorSplit"}),this.editorSplitSize=e.observable(i.getItem("editorSplitSize")||"50%").extend({persist:"editorSplitSize"})}}).call(this,n("Z1dp"))},qVgP:function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return s}));var i=n("+qE3");const{Story:o}=n("OeYU");var s=function(){let t=new i.EventEmitter;this.emiter=t,this.story=null,this.log=[],this.onRecompile=()=>{},this.curStory={messages:[],choices:[],tags:[],paragraphEl:""},this.resetStory=()=>{this.prevSavePoints=[],this.choiceHistory=[],this.textAreaEl.innerHTML="",this.curStory={messages:[],choices:[],tags:[],paragraphEl:""},this.story.ResetState()},this.terminate=()=>{if(this.textAreaEl)try{t.removeAllListeners(),this.finished=!0}catch(e){console.warn(e)}},this.setCurStory=({messages:e,choices:t,tags:n,paragraphEl:i})=>{this.curStory={messages:e,choices:t,tags:n,paragraphEl:i}};const n=(e="",t="")=>{const n=(e=>{let t=[];for(;e.canContinue;)t.push(e.Continue().replace(/\n/g,""));return t})(this.story),i=e.includes('"')?e:`[${e}]`,o=document.createElement("p");if(e){const s=document.createElement("p");s.innerHTML=``,s.onclick=()=>app.navigateToNodeDuringPlayTest(t,i),o.appendChild(s),n.forEach(e=>{const t=document.createElement("p");t.innerHTML=e+"
",o.appendChild(t)})}else o.innerHTML=n.join("
");this.setCurStory({...this.curStory,messages:this.log?[...this.curStory.messages,e?`--${e}--`:"",n].filter(Boolean):[n],tags:this.story.currentTags,choices:this.story.currentChoices,paragraphEl:o}),a()};this.prevSavePoints=[];const s=(e,t)=>{this.prevSavePoints.push(this.story.state.toJson());const i=this.story.state.currentChoices[e].sourcePath.split(".")[0];this.story.ChooseChoiceIndex(e),n(t,i)};this.rewindStory=()=>{document.getElementById("choiceButtons").remove(),this.textAreaEl.removeChild(this.textAreaEl.lastElementChild),this.story.state.LoadJson(this.prevSavePoints.pop()),n()},this.createAndAddParagraph=t=>{if(console.log("made",t),t.innerHTML){const n=document.createElement("p");n.appendChild(t),n.className="story-playtest-bubble story-playtest-answer answer-post fade-in is-paused",this.textAreaEl.appendChild(n),e(n).removeClass("is-paused")}};const a=()=>{this.createAndAddParagraph(this.curStory.paragraphEl),this.textAreaEl.querySelectorAll("div").forEach(e=>e.remove());const e=document.createElement("div");e.id="choiceButtons",e.className="flex-wrap";const t=document.createElement("button");t.innerText="🔄",t.title="Recompile story",t.onclick=this.onRecompile,t.className="storyPreviewChoiceButton",e.appendChild(t);const i=document.createElement("button");i.innerText="🎬",i.title="Restart story",i.onclick=()=>{this.resetStory(),n()},i.className="storyPreviewChoiceButton",e.appendChild(i);const o=document.createElement("button");o.innerText="⏪",o.title="Go to previous",o.disabled=0===this.prevSavePoints.length,o.onclick=()=>{this.rewindStory(),n()},e.appendChild(o),o.className="storyPreviewChoiceButton",this.curStory.choices.forEach((t,n)=>{const i=document.createElement("button");i.innerText=t.text,i.onclick=e=>{e.stopPropagation(),s(n,t.text)},i.className="storyPreviewChoiceButton",e.appendChild(i)}),this.textAreaEl.appendChild(e),this.textAreaEl.scrollTo({top:this.textAreaEl.scrollHeight+100,left:0,behavior:"smooth"})};this.initInk=(e,t,i,s,a,r,l,d,c,p)=>{this.onRecompile=t,console.log("INIT INK"),this.finished=!1,document.getElementById(r).style.visibility="hidden",this.textAreaEl=document.getElementById(d),this.textAreaEl.innerHTML='

Parsing ink

.

.

.

',this.inkTextData=s,this.compiler=e,this.compiler.init(e=>{if(this.textAreaEl.innerHTML="",e.errors.length>0)return this.textAreaEl.innerHTML=`

Parsing failed:

>

${e.errors.join("

")}


${e.warnings.join("

")}

`,void(this.textAreaEl.onclick=()=>{console.log("====>",e),app.data.goToErrorInkNode(this.inkTextData,e.errors[0]),this.textAreaEl.onclick=null});if(e.warnings.length>0){const t=document.createElement("p");t.className="title-warning",e.warnings.forEach(e=>{const n=document.createElement("p");n.innerText=e,n.onclick=()=>{app.data.goToErrorInkNode(this.inkTextData,e)},t.appendChild(n)}),this.createAndAddParagraph(t)}if(this.story=new o(e.story),console.log("STORY",this.story),console.warn("Warnings",e.warnings),n(),""===this.story.currentText&&0===this.story.currentChoices.length)if(a!==app.data.InkGlobalScopeNodeName)this.compiler.submit(`-> ${a}\n`+s);else{const e=s.split("\n").find(e=>e.includes("==="));this.compiler.submit(`-> ${e.split("===")[1]}\n`+s)}}).then(()=>{if(!i.recompile&&i.story&&0!==i.prevSavePoints.length)return this.story=i.story,i.childNodes.forEach(e=>this.textAreaEl.appendChild(e)),this.prevSavePoints=i.prevSavePoints,void n();s&&this.compiler.submit(s)})}}}).call(this,n("EVdn"))},tUqF:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const i=n("Wd8k"),o=n("L8pc"),s=new i.Runner,a=n("+qE3").EventEmitter;var r=function(){this.visitedNodes=[];this.node={title:""};let e=new a;this.emiter=e;let t=[];this.commandsPassedLog=t;this.commandPassed="";let n=!0;this.finished=n,this.scrollTextStyle=!1,this.visitedChapters=[],this.self=this,this.vnChoiceSelectionCursor=">",this.startTimeWait,this.vnSelectedChoice=-1,this.vnTextScrollInterval,this.storyChapter="",this.choices={};let i,r,l,d,c,p,u,g,h=null;this.vnSelectChoice=()=>{(new Date).getTime()-this.startTimeWait<1e3||(this.choices[this.storyChapter].push(d.options[this.vnSelectedChoice]),d.select(this.vnSelectedChoice),this.emiter.emit("choiceMade",d.options[this.vnSelectedChoice]),r="",i=void 0,d=self.goToNext(),this.vnSelectedChoice=-1,this.changeTextScrollSpeed(111))},this.vnUpdateChoice=(t=0)=>{if(this.vnSelectedChoice<0)return;let n=this.vnSelectedChoice+t;n>d.options.length-1?n=0:n<0&&(n=d.options.length-1),this.vnSelectedChoice=n,i=document.createElement("DIV"),d.options.forEach((e,t)=>{const n=document.createElement("DIV");t==this.vnSelectedChoice?n.innerHTML=`${this.vnChoiceSelectionCursor} [${e}]`:n.innerHTML=`${this.vnChoiceSelectionCursor.replace(/.*/gm," ")} [${e}]`,n.onclick=e=>{e.stopPropagation(),this.vnSelectedChoice=t,this.vnUpdateChoice()},n.ondblclick=e=>{e.stopPropagation(),this.vnSelectedChoice=t,this.vnSelectChoice()},n.className="storyPreviewChoiceButton",i.appendChild(n)}),e.emit("choiceUpdated",this.vnSelectedChoice),self.updateVNHud()},this.changeTextScrollSpeed=(t=0)=>{if(t!==this.vnTextScrollInterval){if(this.vnTextScrollInterval=t,clearInterval(p),h<0){if(this.isFinishedParsing(d))return void e.emit("finished");if("TextResult"===d.constructor.name)return r=d.text,h=0,e.emit("textResult",r),void this.changeTextScrollSpeed(220);"OptionsResult"===d.constructor.name&&-1===this.vnSelectedChoice&&(this.vnSelectedChoice=0,this.vnUpdateChoice(),this.startTimeWait=(new Date).getTime())}0!==t&&(p=setInterval(this.scrollUpdateText,t))}},self.goToNext=()=>{const e=c.next().value;if(!this.isFinishedParsing(e))return"TextResult"===e.constructor.name&&e.data&&this.node.title!==e.data.title&&(r="",h=-1,this.node=self.jsonCopy(e.data),this.visitedNodes.push(e.data.title),this.emiter.emit("startedNode",this.node)),e},this.isFinishedParsing=e=>(void 0===e||null===d)&&(n||(n=!0,h=-1),n=!0,n),this.runCommand=()=>{e.emit("commandCall",d.text),t.push(d.text),d=self.goToNext(),this.isFinishedParsing(d)||("TextResult"===d.constructor.name&&(r+="\n"+d.text,e.emit("textResult",d.text)),"OptionsResult"===d.constructor.name&&(h=-1))},this.scrollUpdateText=()=>{if(!this.isFinishedParsing(d))if(h<0)"CommandResult"===d.constructor.name&&this.runCommand();else if(h>r.length){if("TextResult"===d.constructor.name){if(d=self.goToNext(),this.isFinishedParsing(d))return;"CommandResult"===d.constructor.name?this.runCommand():("TextResult"===d.constructor.name||"OptionsResult"===d.constructor.name)&&(h=-1)}}else"TextResult"===d.constructor.name&&(h+=1,l=r.substring(0,h),self.updateVNHud())},self.updateVNHud=()=>{if("TextResult"===d.constructor.name){for(;l.lastIndexOf("[img]")>l.lastIndexOf("[/img]");)h+=1,l=r.substring(0,h);for(;l.lastIndexOf("[")>l.lastIndexOf("]");)h+=1,l=r.substring(0,h)}this.scrollTextStyle&&(document.getElementById(u).innerHTML=o.parse(l)+"
"),void 0!==i&&(this.scrollTextStyle||(document.getElementById(u).innerHTML=""),document.getElementById(u).appendChild(i))},this.terminate=()=>{try{let t=document.getElementById(u);t&&(t.innerHTML=""),t=document.getElementById(g),t&&(t.innerHTML=""),i=void 0,e.removeAllListeners(),this.finished=!0}catch(e){console.warn(e)}},this.initYarn=(t,i,a,r,l,d,c)=>{const p=["#f5ff6f","#44fe66","#e00ec0","#e93ecf","#0ec0e0","#3ecfe9","#e4dbcb","#978e7e","#666","#2f919a","deeppink","black","#97E1E9","#576574","#6EA5E0","#9EDE74","#FFE374","#F7A666","#C47862"],h=["__̴ı̴̴̡̡̡ ̡͌l̡̡̡ ̡͌l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡| ̲▫̲͡ ̲̲͡▫̲̲͡͡ ̲|̡̡̡ ̡, ̴̡ı̴̡̡ ̡͌l̡̡̡̡.___","°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸","(===||:::::::::::::::>","¸.·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º>","=^..^=","|==|iiii|>-----"," ¦̵̱ ̵̱ ̵̱ ̵̱ ̵̱(̢ ̡͇̅└͇̅┘͇̅ (▤8כ−◦","(♥_♥)","龴ↀ◡ↀ龴","☁ ▅▒░☼‿☼░▒▅ ☁,","▓⚗_⚗▓","<:3 )~~~","(╯°□°)╯︵ ┻━┻","●▬▬▬▬๑۩۩๑▬▬▬▬▬●","(/)(Ö,,,,Ö)(/)","/)^3^(\\","( . Y . )","< )))) ><","(ノಠ益ಠ)ノ彡","d(^o^)b¸¸♬·¯·♩¸¸♪·¯·♫¸¸","O=('-'Q)","-`ღ´-","ˁ(⦿ᴥ⦿)ˀ","(╥﹏╥)","✲´*。.❄¨¯`*✲。❄。*。¨¯`*✲","▂▃▅▇█▓▒░۩۞۩ ۩۞۩░▒▓█▇▅▃▂","( •_•)O*¯`·.¸.·´¯`°Q(•_• )","┻━┻︵ (°□°)/ ︵ ┻━┻","|̲̲̲͡͡͡ ̲▫̲͡ ̲̲̲͡͡π̲̲͡͡ ̲̲͡▫̲̲͡͡ ̲|̡̡̡ ̡ ̴̡ı̴̡̡ ̡͌l̡ ̴̡ı̴̴̡ ̡l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡|̲̲̲͡͡͡ ̲▫̲͡ ̲̲̲͡͡π̲̲͡͡ ̲̲͡▫̲̲͡͡ |","❤◦.¸¸. ◦✿","ʕʘ̅͜ʘ̅ʔ","( ๏ Y ๏ )","ʕ•̫͡•ʕ*̫͡*ʕ•͓͡•ʔ-̫͡-ʕ•̫͡•ʔ*̫͡*ʔ-̫͡-ʔ","(っ◕‿◕)っ","❚█══█❚","─=≡Σ((( つ◕ل͜◕)つ","^ↀᴥↀ^","༼ つ ͡◕ Ѿ ͡◕ ༽つ","ᕦ(ò_óˇ)ᕤ","┬┴┬┴┤ ͜ʖ ͡°) ├┬┴┬┴","[̲̅$̲̅(̲̅5)̲̅$̲̅]","(ꈍ⌓ꈍ✿)","(๑•́ ₃ •̀๑) ♡","( • )( • )ԅ(≖⌣≖ԅ)","(。々°)","⊂(´・◡・⊂ )∘˚˳°","( ㅅ )","(ノ☉ヮ⚆)ノ ⌒*:・゚✧","(-‸ლ)","(‿|‿)","(㇏(•̀ᵥᵥ•́)ノ)","ʚ✟⃛ɞ","(′ꈍωꈍ‵)","♚ ♛ ♜ ♝ ♞ ♟ ♔ ♕ ♖ ♗ ♘ ♙","(´ᴗ`)(´ᴗ`)","♥(´∀`)","ฅ(˵●ﻌ●˵)ฅ"];if(g=l,u=a,this.yarnDataObject=t,this.startChapter=i,this.resourcesPath=r,this.finished=!1,this.scrollTextStyle="npc"===d,document.getElementById(g).innerHTML="
🚥Press/Hold Z or 📱Double-click/Tap to advance
",e.on("startedNode",(function(e){document.getElementById(g).innerHTML+="

📜 --- Loaded next node ---",document.getElementById(g).innerHTML+=` ${h[Math.floor(Math.random()*h.length)]}`,document.getElementById(g).innerHTML+="
   Title: "+e.title+"",e.tags.length>0&&e.tags[0].length>0&&(document.getElementById(g).innerHTML+="
   Tags: "+e.tags+"")})),e.on("choiceMade",(function(e){this.scrollTextStyle?document.getElementById(g).innerHTML+="
🐙Player chose: >"+e+"":document.getElementById(g).innerHTML+=`

${o.parse(e)}

`})),e.on("commandCall",(function(e){document.getElementById(g).innerHTML+=`
🐣Command call: <<${e}>>`})),this.scrollTextStyle||(e.on("textResult",(function(e){document.getElementById(g).innerHTML+=`

${o.parse(e)}

`,document.getElementById(u).innerHTML='

.

.

.

',document.getElementById(u).className="story-playtest-bubble",document.getElementById(g).scrollTo({top:document.getElementById(g).scrollHeight,left:0,behavior:"smooth"})})),e.on("choiceUpdated",(function(e){document.getElementById(u).className="story-playtest-answer"}))),e.on("finished",(function(){n=!0,e.removeAllListeners()})),Array.isArray(t))s.load(t);else{if(!("nodes"in t))return;s.load(t.nodes)}this.loadYarnChapter(i),s.variables.data={},c.forEach((function(e){console.log(e),s.variables.set(e.key,e.value)}))},this.loadYarnChapter=e=>{n=!1,this.storyChapter=e,this.choices[this.storyChapter]=[],this.visitedChapters.push(e),c=s.run(e),d=self.goToNext(),r=d.text,this.changeTextScrollSpeed(100)},this.wasChoiceMade=(e,t=this.storyChapter)=>!!this.choices[t].includes(e),this.timesNodeWasVisited=e=>{let t=0;return this.visitedNodes.forEach((n,i)=>{n===e&&(t+=1)}),t},self.jsonCopy=e=>JSON.parse(JSON.stringify(e))}},uMdg:function(e,t,n){},wt9v:function(e,t){function n(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}n.keys=function(){return[]},n.resolve=n,e.exports=n,n.id="wt9v"}},[["e6Wu",1,2]]]); \ No newline at end of file diff --git a/js/runtime.e22f7ef5eb6c13b0f47d.js b/js/runtime.2d01b423de482c0405ed.js similarity index 100% rename from js/runtime.e22f7ef5eb6c13b0f47d.js rename to js/runtime.2d01b423de482c0405ed.js diff --git a/js/vendor.e22f7ef5eb6c13b0f47d.js b/js/vendor.2d01b423de482c0405ed.js similarity index 100% rename from js/vendor.e22f7ef5eb6c13b0f47d.js rename to js/vendor.2d01b423de482c0405ed.js diff --git a/public/plugins/index.js b/public/plugins/index.js index d74383d3b..91e3d1d52 100644 --- a/public/plugins/index.js +++ b/public/plugins/index.js @@ -264,17 +264,19 @@ export var Plugins = function(app) { }); }); + console.log("Get plugins:", app.settings.gistPluginsFile()) // register plugins stored on a gist - todo cache all this if (app.settings.gistPluginsFile() !== null) { - app.data.storage.getGist(app.settings.gistPluginsFile()).then(({fileList}) => { - app.log({ fileList }); - fileList.forEach(gistFile => { + app.data.storage.getGist(app.settings.gistPluginsFile()).then(({filesInGist}) => { + console.log({ filesInGist }); + Object.values(filesInGist).forEach(gistFile => { if (gistFile.language === 'JavaScript') { - app.log({ gistFile }); + console.log({ gistFile }); try { app.storage .getContentOrRaw(gistFile.content, gistFile.raw_url) .then(content => { + console.log({content}) importModuleWeb(content, gistFile.filename).then( importedPlugin => { const newPlugin = importedPlugin(pluginApiMethods); diff --git a/sw.js b/sw.js index 3bc21c913..1bc774ed3 100644 --- a/sw.js +++ b/sw.js @@ -1 +1 @@ -!function(e){var t={};function s(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,s),r.l=!0,r.exports}s.m=e,s.c=t,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)s.d(n,r,function(t){return e[t]}.bind(null,r));return n},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s="jlOC")}({"5tLK":function(e,t,s){"use strict";try{self["workbox:routing:5.1.3"]&&_()}catch(e){}},Bxln:function(e,t,s){"use strict";try{self["workbox:core:5.1.3"]&&_()}catch(e){}},aqiC:function(e,t,s){"use strict";try{self["workbox:strategies:5.1.3"]&&_()}catch(e){}},jlOC:function(e,t,s){"use strict";s.r(t);s("xwD5");const n=[],r={get:()=>n,add(e){n.push(...e)}};s("Bxln");const o={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},c=e=>[o.prefix,e,o.suffix].filter(e=>e&&e.length>0).join("-"),i=e=>e||c(o.precache),a=e=>e||c(o.runtime),h=e=>new URL(String(e),location.href).href.replace(new RegExp("^"+location.origin),""),u=(e,...t)=>{let s=e;return t.length>0&&(s+=" :: "+JSON.stringify(t)),s};class l extends Error{constructor(e,t){super(u(e,t)),this.name=e,this.details=t}}const f=new Set;const d=(e,t)=>e.filter(e=>t in e),p=async({request:e,mode:t,plugins:s=[]})=>{const n=d(s,"cacheKeyWillBeUsed");let r=e;for(const e of n)r=await e.cacheKeyWillBeUsed.call(e,{mode:t,request:r}),"string"==typeof r&&(r=new Request(r));return r},g=async({cacheName:e,request:t,event:s,matchOptions:n,plugins:r=[]})=>{const o=await self.caches.open(e),c=await p({plugins:r,request:t,mode:"read"});let i=await o.match(c,n);for(const t of r)if("cachedResponseWillBeUsed"in t){const r=t.cachedResponseWillBeUsed;i=await r.call(t,{cacheName:e,event:s,matchOptions:n,cachedResponse:i,request:c})}return i},w=async({cacheName:e,request:t,response:s,event:n,plugins:r=[],matchOptions:o})=>{const c=await p({plugins:r,request:t,mode:"write"});if(!s)throw new l("cache-put-with-no-response",{url:h(c.url)});const i=await(async({request:e,response:t,event:s,plugins:n=[]})=>{let r=t,o=!1;for(const t of n)if("cacheWillUpdate"in t){o=!0;const n=t.cacheWillUpdate;if(r=await n.call(t,{request:e,response:r,event:s}),!r)break}return o||(r=r&&200===r.status?r:void 0),r||null})({event:n,plugins:r,response:s,request:c});if(!i)return void 0;const a=await self.caches.open(e),u=d(r,"cacheDidUpdate"),w=u.length>0?await g({cacheName:e,matchOptions:o,request:c}):null;try{await a.put(c,i)}catch(e){throw"QuotaExceededError"===e.name&&await async function(){for(const e of f)await e()}(),e}for(const t of u)await t.cacheDidUpdate.call(t,{cacheName:e,event:n,oldResponse:w,newResponse:i,request:c})},y=g,m=async({request:e,fetchOptions:t,event:s,plugins:n=[]})=>{if("string"==typeof e&&(e=new Request(e)),s instanceof FetchEvent&&s.preloadResponse){const e=await s.preloadResponse;if(e)return e}const r=d(n,"fetchDidFail"),o=r.length>0?e.clone():null;try{for(const t of n)if("requestWillFetch"in t){const n=t.requestWillFetch,r=e.clone();e=await n.call(t,{request:r,event:s})}}catch(e){throw new l("plugin-error-request-will-fetch",{thrownError:e})}const c=e.clone();try{let r;r="navigate"===e.mode?await fetch(e):await fetch(e,t);for(const e of n)"fetchDidSucceed"in e&&(r=await e.fetchDidSucceed.call(e,{event:s,request:c,response:r}));return r}catch(e){0;for(const t of r)await t.fetchDidFail.call(t,{error:e,event:s,originalRequest:o.clone(),request:c.clone()});throw e}};let _;async function v(e,t){const s=e.clone(),n={headers:new Headers(s.headers),status:s.status,statusText:s.statusText},r=t?t(n):n,o=function(){if(void 0===_){const e=new Response("");if("body"in e)try{new Response(e.body),_=!0}catch(e){_=!1}_=!1}return _}()?s.body:await s.blob();return new Response(o,r)}function R(e){if(!e)throw new l("add-to-cache-list-unexpected-type",{entry:e});if("string"==typeof e){const t=new URL(e,location.href);return{cacheKey:t.href,url:t.href}}const{revision:t,url:s}=e;if(!s)throw new l("add-to-cache-list-unexpected-type",{entry:e});if(!t){const e=new URL(s,location.href);return{cacheKey:e.href,url:e.href}}const n=new URL(s,location.href),r=new URL(s,location.href);return n.searchParams.set("__WB_REVISION__",t),{cacheKey:n.href,url:r.href}}class q{constructor(e){this._cacheName=i(e),this._urlsToCacheKeys=new Map,this._urlsToCacheModes=new Map,this._cacheKeysToIntegrities=new Map}addToCacheList(e){const t=[];for(const s of e){"string"==typeof s?t.push(s):s&&void 0===s.revision&&t.push(s.url);const{cacheKey:e,url:n}=R(s),r="string"!=typeof s&&s.revision?"reload":"default";if(this._urlsToCacheKeys.has(n)&&this._urlsToCacheKeys.get(n)!==e)throw new l("add-to-cache-list-conflicting-entries",{firstEntry:this._urlsToCacheKeys.get(n),secondEntry:e});if("string"!=typeof s&&s.integrity){if(this._cacheKeysToIntegrities.has(e)&&this._cacheKeysToIntegrities.get(e)!==s.integrity)throw new l("add-to-cache-list-conflicting-integrities",{url:n});this._cacheKeysToIntegrities.set(e,s.integrity)}if(this._urlsToCacheKeys.set(n,e),this._urlsToCacheModes.set(n,r),t.length>0){const e=`Workbox is precaching URLs without revision info: ${t.join(", ")}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(e)}}}async install({event:e,plugins:t}={}){const s=[],n=[],r=await self.caches.open(this._cacheName),o=await r.keys(),c=new Set(o.map(e=>e.url));for(const[e,t]of this._urlsToCacheKeys)c.has(t)?n.push(e):s.push({cacheKey:t,url:e});const i=s.map(({cacheKey:s,url:n})=>{const r=this._cacheKeysToIntegrities.get(s),o=this._urlsToCacheModes.get(n);return this._addURLToCache({cacheKey:s,cacheMode:o,event:e,integrity:r,plugins:t,url:n})});return await Promise.all(i),{updatedURLs:s.map(e=>e.url),notUpdatedURLs:n}}async activate(){const e=await self.caches.open(this._cacheName),t=await e.keys(),s=new Set(this._urlsToCacheKeys.values()),n=[];for(const r of t)s.has(r.url)||(await e.delete(r),n.push(r.url));return{deletedURLs:n}}async _addURLToCache({cacheKey:e,url:t,cacheMode:s,event:n,plugins:r,integrity:o}){const c=new Request(t,{integrity:o,cache:s,credentials:"same-origin"});let i,a=await m({event:n,plugins:r,request:c});for(const e of r||[])"cacheWillUpdate"in e&&(i=e);if(!(i?await i.cacheWillUpdate({event:n,request:c,response:a}):a.status<400))throw new l("bad-precaching-response",{url:t,status:a.status});a.redirected&&(a=await v(a)),await w({event:n,plugins:r,response:a,request:e===t?c:new Request(e),cacheName:this._cacheName,matchOptions:{ignoreSearch:!0}})}getURLsToCacheKeys(){return this._urlsToCacheKeys}getCachedURLs(){return[...this._urlsToCacheKeys.keys()]}getCacheKeyForURL(e){const t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}async matchPrecache(e){const t=e instanceof Request?e.url:e,s=this.getCacheKeyForURL(t);if(s){return(await self.caches.open(this._cacheName)).match(s)}}createHandler(e=!0){return async({request:t})=>{try{const e=await this.matchPrecache(t);if(e)return e;throw new l("missing-precache-entry",{cacheName:this._cacheName,url:t instanceof Request?t.url:t})}catch(s){if(e)return fetch(t);throw s}}}createHandlerBoundToURL(e,t=!0){if(!this.getCacheKeyForURL(e))throw new l("non-precached-url",{url:e});const s=this.createHandler(t),n=new Request(e);return()=>s({request:n})}}let U;const L=()=>(U||(U=new q),U);const T=(e,t)=>{const s=L().getURLsToCacheKeys();for(const n of function*(e,{ignoreURLParametersMatching:t,directoryIndex:s,cleanURLs:n,urlManipulation:r}={}){const o=new URL(e,location.href);o.hash="",yield o.href;const c=function(e,t=[]){for(const s of[...e.searchParams.keys()])t.some(e=>e.test(s))&&e.searchParams.delete(s);return e}(o,t);if(yield c.href,s&&c.pathname.endsWith("/")){const e=new URL(c.href);e.pathname+=s,yield e.href}if(n){const e=new URL(c.href);e.pathname+=".html",yield e.href}if(r){const e=r({url:o});for(const t of e)yield t.href}}(e,t)){const e=s.get(n);if(e)return e}};let C=!1;function x(e){C||((({ignoreURLParametersMatching:e=[/^utm_/],directoryIndex:t="index.html",cleanURLs:s=!0,urlManipulation:n}={})=>{const r=i();self.addEventListener("fetch",o=>{const c=T(o.request.url,{cleanURLs:s,directoryIndex:t,ignoreURLParametersMatching:e,urlManipulation:n});if(!c)return void 0;let i=self.caches.open(r).then(e=>e.match(c)).then(e=>e||fetch(c));o.respondWith(i)})})(e),C=!0)}const b=e=>{const t=L(),s=r.get();e.waitUntil(t.install({event:e,plugins:s}).catch(e=>{throw e}))},K=e=>{const t=L();e.waitUntil(t.activate())};s("aqiC");const O={cacheWillUpdate:async({response:e})=>200===e.status||0===e.status?e:null};s("5tLK");const N=e=>e&&"object"==typeof e?e:{handle:e};class M{constructor(e,t,s="GET"){this.handler=N(t),this.match=e,this.method=s}}class P extends M{constructor(e,t,s){super(({url:t})=>{const s=e.exec(t.href);if(s&&(t.origin===location.origin||0===s.index))return s.slice(1)},t,s)}}class k{constructor(){this._routes=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener("fetch",e=>{const{request:t}=e,s=this.handleRequest({request:t,event:e});s&&e.respondWith(s)})}addCacheListener(){self.addEventListener("message",e=>{if(e.data&&"CACHE_URLS"===e.data.type){const{payload:t}=e.data;0;const s=Promise.all(t.urlsToCache.map(e=>{"string"==typeof e&&(e=[e]);const t=new Request(...e);return this.handleRequest({request:t})}));e.waitUntil(s),e.ports&&e.ports[0]&&s.then(()=>e.ports[0].postMessage(!0))}})}handleRequest({request:e,event:t}){const s=new URL(e.url,location.href);if(!s.protocol.startsWith("http"))return void 0;const{params:n,route:r}=this.findMatchingRoute({url:s,request:e,event:t});let o=r&&r.handler;if(!o&&this._defaultHandler&&(o=this._defaultHandler),!o)return void 0;let c;try{c=o.handle({url:s,request:e,event:t,params:n})}catch(e){c=Promise.reject(e)}return c instanceof Promise&&this._catchHandler&&(c=c.catch(n=>this._catchHandler.handle({url:s,request:e,event:t}))),c}findMatchingRoute({url:e,request:t,event:s}){const n=this._routes.get(t.method)||[];for(const r of n){let n;const o=r.match({url:e,request:t,event:s});if(o)return n=o,(Array.isArray(o)&&0===o.length||o.constructor===Object&&0===Object.keys(o).length||"boolean"==typeof o)&&(n=void 0),{route:r,params:n}}return{}}setDefaultHandler(e){this._defaultHandler=N(e)}setCatchHandler(e){this._catchHandler=N(e)}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new l("unregister-route-but-not-found-with-method",{method:e.method});const t=this._routes.get(e.method).indexOf(e);if(!(t>-1))throw new l("unregister-route-route-not-registered");this._routes.get(e.method).splice(t,1)}}let S;const W=()=>(S||(S=new k,S.addFetchListener(),S.addCacheListener()),S);var E;console.log("Yarn's service worker is caching files"),function(e,t,s){let n;if("string"==typeof e){const r=new URL(e,location.href);0,n=new M(({url:e})=>e.href===r.href,t,s)}else if(e instanceof RegExp)n=new P(e,t,s);else if("function"==typeof e)n=new M(e,t,s);else{if(!(e instanceof M))throw new l("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});n=e}W().registerRoute(n)}(/\.\/YarnClassic\//,new class{constructor(e={}){if(this._cacheName=a(e.cacheName),e.plugins){const t=e.plugins.some(e=>!!e.cacheWillUpdate);this._plugins=t?e.plugins:[O,...e.plugins]}else this._plugins=[O];this._networkTimeoutSeconds=e.networkTimeoutSeconds||0,this._fetchOptions=e.fetchOptions,this._matchOptions=e.matchOptions}async handle({event:e,request:t}){const s=[];"string"==typeof t&&(t=new Request(t));const n=[];let r;if(this._networkTimeoutSeconds){const{id:o,promise:c}=this._getTimeoutPromise({request:t,event:e,logs:s});r=o,n.push(c)}const o=this._getNetworkPromise({timeoutId:r,request:t,event:e,logs:s});n.push(o);let c=await Promise.race(n);if(c||(c=await o),!c)throw new l("no-response",{url:t.url});return c}_getTimeoutPromise({request:e,logs:t,event:s}){let n;return{promise:new Promise(t=>{n=setTimeout(async()=>{t(await this._respondFromCache({request:e,event:s}))},1e3*this._networkTimeoutSeconds)}),id:n}}async _getNetworkPromise({timeoutId:e,request:t,logs:s,event:n}){let r,o;try{o=await m({request:t,event:n,fetchOptions:this._fetchOptions,plugins:this._plugins})}catch(e){r=e}if(e&&clearTimeout(e),r||!o)o=await this._respondFromCache({request:t,event:n});else{const e=o.clone(),s=w({cacheName:this._cacheName,request:t,response:e,event:n,plugins:this._plugins});if(n)try{n.waitUntil(s)}catch(e){0}}return o}_respondFromCache({event:e,request:t}){return y({cacheName:this._cacheName,request:t,event:e,matchOptions:this._matchOptions,plugins:this._plugins})}}),function(e){L().addToCacheList(e),e.length>0&&(self.addEventListener("install",b),self.addEventListener("activate",K))}([{'revision':'158804f40075815c6d0ade3ec7771c26','url':'css/0.css'},{'revision':'cc26e986ac53238679cef6af5cbc5104','url':'fonts/context-menu-icons.eot'},{'revision':'66fe7d78e602880e529daf66c8cb85d3','url':'fonts/context-menu-icons.ttf'},{'revision':'4568f559933f6b3db786835cf61387b1','url':'fonts/context-menu-icons.woff'},{'revision':'3124260e1569c74431e23dd130111455','url':'fonts/context-menu-icons.woff2'},{'revision':'a267c0b23e4794a4d9f2092027ab0fc7','url':'fonts/droid-sans-mono.ttf'},{'revision':'0158a98eda5da93408305a8f817bd61e','url':'icon.ico'},{'revision':'54a04953b96717b70ace1f2bcae537c1','url':'icon_128x128.png'},{'revision':'bd585463236696d22e72c822e9e2c36e','url':'icon_192x192.png'},{'revision':'0158a98eda5da93408305a8f817bd61e','url':'icon_32x32.ico'},{'revision':'41a610c236dfc4ca3db11af9f1d1efd1','url':'icon_512x512.png'},{'revision':'4f50d85588e2e334596e0bcc71892e42','url':'icon_96x96.png'},{'revision':'29c80978b4de3a69446bc8e033c858c6','url':'index.html'},{'revision':'3e9b319140ffc269c4f6706cf2199906','url':'js/main.e22f7ef5eb6c13b0f47d.js'},{'revision':'bac88d544bdbbe5a66ee018b2815af84','url':'js/runtime.e22f7ef5eb6c13b0f47d.js'},{'revision':'b9038b5e20d64a47cf6e8843150f3856','url':'manifest.json'},{'revision':'a267c0b23e4794a4d9f2092027ab0fc7','url':'public/droid-sans-mono.ttf'},{'revision':'0158a98eda5da93408305a8f817bd61e','url':'public/icon.ico'},{'revision':'73d45685f29fa05223dbb6cf7fb57097','url':'public/icon.png'},{'revision':'a6b5dbbf657b6b6bac1067ae1d3d4342','url':'public/icons.svg'},{'revision':'51e2de798b41db26b6a0ec187959d394','url':'public/images/dropbox.ico'},{'revision':'6c62f589f84498c29d24fb22633146a0','url':'public/images/inky-icon.png'},{'revision':'85f678b520893f6007833e0ae0a1f106','url':'public/images/pixel.png'},{'revision':'167ec6047e43038e9209db69a24ba97b','url':'public/images/renpy-128.png'},{'revision':'83e847f2aeb1d4f8f7f05cbb6be593c8','url':'public/images/twine-favicon-152.png'},{'revision':'b1fa70b8f39a3e9b8365db954a81630c','url':'public/mode-ink.js'},{'revision':'7b22b65964ff8eb66dda7e1ee0f2c09e','url':'public/mode-yarn.js'},{'revision':'c9f414bca468fcb950fec09ccfaf2cf4','url':'public/plugins/bondage/renderer.js'},{'revision':'2a5973ccb5dab2b54d89b72f71c974a8','url':'public/plugins/index.js'},{'revision':'ac463da67318e812aa482c83d97e0f71','url':'public/plugins/inkjs/ink-renderer.js'},{'revision':'9cd28d275cb98a86a6f9ddf3e8f1c953','url':'public/plugins/jsoneditor/jsoneditor.js'},{'revision':'31583e2c2d32d27701df21fee914c6a3','url':'public/plugins/jsoneditor/size-overrides.css'},{'revision':'89cbc0dadd9f4dc973e012aac69559b3','url':'public/plugins/runner.js'},{'revision':'df3a64e933f73f88115992eedc6c80a6','url':'public/templates/node.html'},{'revision':'7174b16ad3a29e6059f0a0cd448f70df','url':'public/theme-ink.js'},{'revision':'2fe43fbb7c796eddba021471ef0262ea','url':'public/theme-yarn.js'},{'revision':'29861db0837e9e12ca7f8bc4c817fc19','url':'public/themes/blueprint.css'},{'revision':'5d979276428e7e5bf92a2f6699feb32e','url':'public/themes/classic.css'},{'revision':'c663316992808bbc41b57346d2d7bcf0','url':'public/themes/dracula.css'},{'revision':'6231ce121cab87ce74ccd7ef6d353470','url':'public/version.json'}]),x(E)},xwD5:function(e,t,s){"use strict";try{self["workbox:precaching:5.1.3"]&&_()}catch(e){}}}); \ No newline at end of file +!function(e){var t={};function s(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,s),r.l=!0,r.exports}s.m=e,s.c=t,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)s.d(n,r,function(t){return e[t]}.bind(null,r));return n},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s="jlOC")}({"5tLK":function(e,t,s){"use strict";try{self["workbox:routing:5.1.3"]&&_()}catch(e){}},Bxln:function(e,t,s){"use strict";try{self["workbox:core:5.1.3"]&&_()}catch(e){}},aqiC:function(e,t,s){"use strict";try{self["workbox:strategies:5.1.3"]&&_()}catch(e){}},jlOC:function(e,t,s){"use strict";s.r(t);s("xwD5");const n=[],r={get:()=>n,add(e){n.push(...e)}};s("Bxln");const o={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},c=e=>[o.prefix,e,o.suffix].filter(e=>e&&e.length>0).join("-"),i=e=>e||c(o.precache),a=e=>e||c(o.runtime),h=e=>new URL(String(e),location.href).href.replace(new RegExp("^"+location.origin),""),u=(e,...t)=>{let s=e;return t.length>0&&(s+=" :: "+JSON.stringify(t)),s};class l extends Error{constructor(e,t){super(u(e,t)),this.name=e,this.details=t}}const f=new Set;const d=(e,t)=>e.filter(e=>t in e),p=async({request:e,mode:t,plugins:s=[]})=>{const n=d(s,"cacheKeyWillBeUsed");let r=e;for(const e of n)r=await e.cacheKeyWillBeUsed.call(e,{mode:t,request:r}),"string"==typeof r&&(r=new Request(r));return r},g=async({cacheName:e,request:t,event:s,matchOptions:n,plugins:r=[]})=>{const o=await self.caches.open(e),c=await p({plugins:r,request:t,mode:"read"});let i=await o.match(c,n);for(const t of r)if("cachedResponseWillBeUsed"in t){const r=t.cachedResponseWillBeUsed;i=await r.call(t,{cacheName:e,event:s,matchOptions:n,cachedResponse:i,request:c})}return i},w=async({cacheName:e,request:t,response:s,event:n,plugins:r=[],matchOptions:o})=>{const c=await p({plugins:r,request:t,mode:"write"});if(!s)throw new l("cache-put-with-no-response",{url:h(c.url)});const i=await(async({request:e,response:t,event:s,plugins:n=[]})=>{let r=t,o=!1;for(const t of n)if("cacheWillUpdate"in t){o=!0;const n=t.cacheWillUpdate;if(r=await n.call(t,{request:e,response:r,event:s}),!r)break}return o||(r=r&&200===r.status?r:void 0),r||null})({event:n,plugins:r,response:s,request:c});if(!i)return void 0;const a=await self.caches.open(e),u=d(r,"cacheDidUpdate"),w=u.length>0?await g({cacheName:e,matchOptions:o,request:c}):null;try{await a.put(c,i)}catch(e){throw"QuotaExceededError"===e.name&&await async function(){for(const e of f)await e()}(),e}for(const t of u)await t.cacheDidUpdate.call(t,{cacheName:e,event:n,oldResponse:w,newResponse:i,request:c})},y=g,m=async({request:e,fetchOptions:t,event:s,plugins:n=[]})=>{if("string"==typeof e&&(e=new Request(e)),s instanceof FetchEvent&&s.preloadResponse){const e=await s.preloadResponse;if(e)return e}const r=d(n,"fetchDidFail"),o=r.length>0?e.clone():null;try{for(const t of n)if("requestWillFetch"in t){const n=t.requestWillFetch,r=e.clone();e=await n.call(t,{request:r,event:s})}}catch(e){throw new l("plugin-error-request-will-fetch",{thrownError:e})}const c=e.clone();try{let r;r="navigate"===e.mode?await fetch(e):await fetch(e,t);for(const e of n)"fetchDidSucceed"in e&&(r=await e.fetchDidSucceed.call(e,{event:s,request:c,response:r}));return r}catch(e){0;for(const t of r)await t.fetchDidFail.call(t,{error:e,event:s,originalRequest:o.clone(),request:c.clone()});throw e}};let _;async function v(e,t){const s=e.clone(),n={headers:new Headers(s.headers),status:s.status,statusText:s.statusText},r=t?t(n):n,o=function(){if(void 0===_){const e=new Response("");if("body"in e)try{new Response(e.body),_=!0}catch(e){_=!1}_=!1}return _}()?s.body:await s.blob();return new Response(o,r)}function R(e){if(!e)throw new l("add-to-cache-list-unexpected-type",{entry:e});if("string"==typeof e){const t=new URL(e,location.href);return{cacheKey:t.href,url:t.href}}const{revision:t,url:s}=e;if(!s)throw new l("add-to-cache-list-unexpected-type",{entry:e});if(!t){const e=new URL(s,location.href);return{cacheKey:e.href,url:e.href}}const n=new URL(s,location.href),r=new URL(s,location.href);return n.searchParams.set("__WB_REVISION__",t),{cacheKey:n.href,url:r.href}}class q{constructor(e){this._cacheName=i(e),this._urlsToCacheKeys=new Map,this._urlsToCacheModes=new Map,this._cacheKeysToIntegrities=new Map}addToCacheList(e){const t=[];for(const s of e){"string"==typeof s?t.push(s):s&&void 0===s.revision&&t.push(s.url);const{cacheKey:e,url:n}=R(s),r="string"!=typeof s&&s.revision?"reload":"default";if(this._urlsToCacheKeys.has(n)&&this._urlsToCacheKeys.get(n)!==e)throw new l("add-to-cache-list-conflicting-entries",{firstEntry:this._urlsToCacheKeys.get(n),secondEntry:e});if("string"!=typeof s&&s.integrity){if(this._cacheKeysToIntegrities.has(e)&&this._cacheKeysToIntegrities.get(e)!==s.integrity)throw new l("add-to-cache-list-conflicting-integrities",{url:n});this._cacheKeysToIntegrities.set(e,s.integrity)}if(this._urlsToCacheKeys.set(n,e),this._urlsToCacheModes.set(n,r),t.length>0){const e=`Workbox is precaching URLs without revision info: ${t.join(", ")}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(e)}}}async install({event:e,plugins:t}={}){const s=[],n=[],r=await self.caches.open(this._cacheName),o=await r.keys(),c=new Set(o.map(e=>e.url));for(const[e,t]of this._urlsToCacheKeys)c.has(t)?n.push(e):s.push({cacheKey:t,url:e});const i=s.map(({cacheKey:s,url:n})=>{const r=this._cacheKeysToIntegrities.get(s),o=this._urlsToCacheModes.get(n);return this._addURLToCache({cacheKey:s,cacheMode:o,event:e,integrity:r,plugins:t,url:n})});return await Promise.all(i),{updatedURLs:s.map(e=>e.url),notUpdatedURLs:n}}async activate(){const e=await self.caches.open(this._cacheName),t=await e.keys(),s=new Set(this._urlsToCacheKeys.values()),n=[];for(const r of t)s.has(r.url)||(await e.delete(r),n.push(r.url));return{deletedURLs:n}}async _addURLToCache({cacheKey:e,url:t,cacheMode:s,event:n,plugins:r,integrity:o}){const c=new Request(t,{integrity:o,cache:s,credentials:"same-origin"});let i,a=await m({event:n,plugins:r,request:c});for(const e of r||[])"cacheWillUpdate"in e&&(i=e);if(!(i?await i.cacheWillUpdate({event:n,request:c,response:a}):a.status<400))throw new l("bad-precaching-response",{url:t,status:a.status});a.redirected&&(a=await v(a)),await w({event:n,plugins:r,response:a,request:e===t?c:new Request(e),cacheName:this._cacheName,matchOptions:{ignoreSearch:!0}})}getURLsToCacheKeys(){return this._urlsToCacheKeys}getCachedURLs(){return[...this._urlsToCacheKeys.keys()]}getCacheKeyForURL(e){const t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}async matchPrecache(e){const t=e instanceof Request?e.url:e,s=this.getCacheKeyForURL(t);if(s){return(await self.caches.open(this._cacheName)).match(s)}}createHandler(e=!0){return async({request:t})=>{try{const e=await this.matchPrecache(t);if(e)return e;throw new l("missing-precache-entry",{cacheName:this._cacheName,url:t instanceof Request?t.url:t})}catch(s){if(e)return fetch(t);throw s}}}createHandlerBoundToURL(e,t=!0){if(!this.getCacheKeyForURL(e))throw new l("non-precached-url",{url:e});const s=this.createHandler(t),n=new Request(e);return()=>s({request:n})}}let U;const L=()=>(U||(U=new q),U);const T=(e,t)=>{const s=L().getURLsToCacheKeys();for(const n of function*(e,{ignoreURLParametersMatching:t,directoryIndex:s,cleanURLs:n,urlManipulation:r}={}){const o=new URL(e,location.href);o.hash="",yield o.href;const c=function(e,t=[]){for(const s of[...e.searchParams.keys()])t.some(e=>e.test(s))&&e.searchParams.delete(s);return e}(o,t);if(yield c.href,s&&c.pathname.endsWith("/")){const e=new URL(c.href);e.pathname+=s,yield e.href}if(n){const e=new URL(c.href);e.pathname+=".html",yield e.href}if(r){const e=r({url:o});for(const t of e)yield t.href}}(e,t)){const e=s.get(n);if(e)return e}};let C=!1;function x(e){C||((({ignoreURLParametersMatching:e=[/^utm_/],directoryIndex:t="index.html",cleanURLs:s=!0,urlManipulation:n}={})=>{const r=i();self.addEventListener("fetch",o=>{const c=T(o.request.url,{cleanURLs:s,directoryIndex:t,ignoreURLParametersMatching:e,urlManipulation:n});if(!c)return void 0;let i=self.caches.open(r).then(e=>e.match(c)).then(e=>e||fetch(c));o.respondWith(i)})})(e),C=!0)}const b=e=>{const t=L(),s=r.get();e.waitUntil(t.install({event:e,plugins:s}).catch(e=>{throw e}))},K=e=>{const t=L();e.waitUntil(t.activate())};s("aqiC");const O={cacheWillUpdate:async({response:e})=>200===e.status||0===e.status?e:null};s("5tLK");const N=e=>e&&"object"==typeof e?e:{handle:e};class M{constructor(e,t,s="GET"){this.handler=N(t),this.match=e,this.method=s}}class P extends M{constructor(e,t,s){super(({url:t})=>{const s=e.exec(t.href);if(s&&(t.origin===location.origin||0===s.index))return s.slice(1)},t,s)}}class k{constructor(){this._routes=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener("fetch",e=>{const{request:t}=e,s=this.handleRequest({request:t,event:e});s&&e.respondWith(s)})}addCacheListener(){self.addEventListener("message",e=>{if(e.data&&"CACHE_URLS"===e.data.type){const{payload:t}=e.data;0;const s=Promise.all(t.urlsToCache.map(e=>{"string"==typeof e&&(e=[e]);const t=new Request(...e);return this.handleRequest({request:t})}));e.waitUntil(s),e.ports&&e.ports[0]&&s.then(()=>e.ports[0].postMessage(!0))}})}handleRequest({request:e,event:t}){const s=new URL(e.url,location.href);if(!s.protocol.startsWith("http"))return void 0;const{params:n,route:r}=this.findMatchingRoute({url:s,request:e,event:t});let o=r&&r.handler;if(!o&&this._defaultHandler&&(o=this._defaultHandler),!o)return void 0;let c;try{c=o.handle({url:s,request:e,event:t,params:n})}catch(e){c=Promise.reject(e)}return c instanceof Promise&&this._catchHandler&&(c=c.catch(n=>this._catchHandler.handle({url:s,request:e,event:t}))),c}findMatchingRoute({url:e,request:t,event:s}){const n=this._routes.get(t.method)||[];for(const r of n){let n;const o=r.match({url:e,request:t,event:s});if(o)return n=o,(Array.isArray(o)&&0===o.length||o.constructor===Object&&0===Object.keys(o).length||"boolean"==typeof o)&&(n=void 0),{route:r,params:n}}return{}}setDefaultHandler(e){this._defaultHandler=N(e)}setCatchHandler(e){this._catchHandler=N(e)}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new l("unregister-route-but-not-found-with-method",{method:e.method});const t=this._routes.get(e.method).indexOf(e);if(!(t>-1))throw new l("unregister-route-route-not-registered");this._routes.get(e.method).splice(t,1)}}let S;const W=()=>(S||(S=new k,S.addFetchListener(),S.addCacheListener()),S);var E;console.log("Yarn's service worker is caching files"),function(e,t,s){let n;if("string"==typeof e){const r=new URL(e,location.href);0,n=new M(({url:e})=>e.href===r.href,t,s)}else if(e instanceof RegExp)n=new P(e,t,s);else if("function"==typeof e)n=new M(e,t,s);else{if(!(e instanceof M))throw new l("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});n=e}W().registerRoute(n)}(/\.\/YarnClassic\//,new class{constructor(e={}){if(this._cacheName=a(e.cacheName),e.plugins){const t=e.plugins.some(e=>!!e.cacheWillUpdate);this._plugins=t?e.plugins:[O,...e.plugins]}else this._plugins=[O];this._networkTimeoutSeconds=e.networkTimeoutSeconds||0,this._fetchOptions=e.fetchOptions,this._matchOptions=e.matchOptions}async handle({event:e,request:t}){const s=[];"string"==typeof t&&(t=new Request(t));const n=[];let r;if(this._networkTimeoutSeconds){const{id:o,promise:c}=this._getTimeoutPromise({request:t,event:e,logs:s});r=o,n.push(c)}const o=this._getNetworkPromise({timeoutId:r,request:t,event:e,logs:s});n.push(o);let c=await Promise.race(n);if(c||(c=await o),!c)throw new l("no-response",{url:t.url});return c}_getTimeoutPromise({request:e,logs:t,event:s}){let n;return{promise:new Promise(t=>{n=setTimeout(async()=>{t(await this._respondFromCache({request:e,event:s}))},1e3*this._networkTimeoutSeconds)}),id:n}}async _getNetworkPromise({timeoutId:e,request:t,logs:s,event:n}){let r,o;try{o=await m({request:t,event:n,fetchOptions:this._fetchOptions,plugins:this._plugins})}catch(e){r=e}if(e&&clearTimeout(e),r||!o)o=await this._respondFromCache({request:t,event:n});else{const e=o.clone(),s=w({cacheName:this._cacheName,request:t,response:e,event:n,plugins:this._plugins});if(n)try{n.waitUntil(s)}catch(e){0}}return o}_respondFromCache({event:e,request:t}){return y({cacheName:this._cacheName,request:t,event:e,matchOptions:this._matchOptions,plugins:this._plugins})}}),function(e){L().addToCacheList(e),e.length>0&&(self.addEventListener("install",b),self.addEventListener("activate",K))}([{'revision':'158804f40075815c6d0ade3ec7771c26','url':'css/0.css'},{'revision':'cc26e986ac53238679cef6af5cbc5104','url':'fonts/context-menu-icons.eot'},{'revision':'66fe7d78e602880e529daf66c8cb85d3','url':'fonts/context-menu-icons.ttf'},{'revision':'4568f559933f6b3db786835cf61387b1','url':'fonts/context-menu-icons.woff'},{'revision':'3124260e1569c74431e23dd130111455','url':'fonts/context-menu-icons.woff2'},{'revision':'a267c0b23e4794a4d9f2092027ab0fc7','url':'fonts/droid-sans-mono.ttf'},{'revision':'0158a98eda5da93408305a8f817bd61e','url':'icon.ico'},{'revision':'54a04953b96717b70ace1f2bcae537c1','url':'icon_128x128.png'},{'revision':'bd585463236696d22e72c822e9e2c36e','url':'icon_192x192.png'},{'revision':'0158a98eda5da93408305a8f817bd61e','url':'icon_32x32.ico'},{'revision':'41a610c236dfc4ca3db11af9f1d1efd1','url':'icon_512x512.png'},{'revision':'4f50d85588e2e334596e0bcc71892e42','url':'icon_96x96.png'},{'revision':'09b42db0eb19068ed3af238e6e686172','url':'index.html'},{'revision':'33450882174b07dcb317a7fdd8d96458','url':'js/main.2d01b423de482c0405ed.js'},{'revision':'bac88d544bdbbe5a66ee018b2815af84','url':'js/runtime.2d01b423de482c0405ed.js'},{'revision':'b9038b5e20d64a47cf6e8843150f3856','url':'manifest.json'},{'revision':'a267c0b23e4794a4d9f2092027ab0fc7','url':'public/droid-sans-mono.ttf'},{'revision':'0158a98eda5da93408305a8f817bd61e','url':'public/icon.ico'},{'revision':'73d45685f29fa05223dbb6cf7fb57097','url':'public/icon.png'},{'revision':'a6b5dbbf657b6b6bac1067ae1d3d4342','url':'public/icons.svg'},{'revision':'51e2de798b41db26b6a0ec187959d394','url':'public/images/dropbox.ico'},{'revision':'6c62f589f84498c29d24fb22633146a0','url':'public/images/inky-icon.png'},{'revision':'85f678b520893f6007833e0ae0a1f106','url':'public/images/pixel.png'},{'revision':'167ec6047e43038e9209db69a24ba97b','url':'public/images/renpy-128.png'},{'revision':'83e847f2aeb1d4f8f7f05cbb6be593c8','url':'public/images/twine-favicon-152.png'},{'revision':'b1fa70b8f39a3e9b8365db954a81630c','url':'public/mode-ink.js'},{'revision':'7b22b65964ff8eb66dda7e1ee0f2c09e','url':'public/mode-yarn.js'},{'revision':'c9f414bca468fcb950fec09ccfaf2cf4','url':'public/plugins/bondage/renderer.js'},{'revision':'a07a22f0e25d650069261100ec5facdb','url':'public/plugins/index.js'},{'revision':'ac463da67318e812aa482c83d97e0f71','url':'public/plugins/inkjs/ink-renderer.js'},{'revision':'9cd28d275cb98a86a6f9ddf3e8f1c953','url':'public/plugins/jsoneditor/jsoneditor.js'},{'revision':'31583e2c2d32d27701df21fee914c6a3','url':'public/plugins/jsoneditor/size-overrides.css'},{'revision':'89cbc0dadd9f4dc973e012aac69559b3','url':'public/plugins/runner.js'},{'revision':'df3a64e933f73f88115992eedc6c80a6','url':'public/templates/node.html'},{'revision':'7174b16ad3a29e6059f0a0cd448f70df','url':'public/theme-ink.js'},{'revision':'2fe43fbb7c796eddba021471ef0262ea','url':'public/theme-yarn.js'},{'revision':'29861db0837e9e12ca7f8bc4c817fc19','url':'public/themes/blueprint.css'},{'revision':'5d979276428e7e5bf92a2f6699feb32e','url':'public/themes/classic.css'},{'revision':'c663316992808bbc41b57346d2d7bcf0','url':'public/themes/dracula.css'},{'revision':'6231ce121cab87ce74ccd7ef6d353470','url':'public/version.json'}]),x(E)},xwD5:function(e,t,s){"use strict";try{self["workbox:precaching:5.1.3"]&&_()}catch(e){}}}); \ No newline at end of file