diff --git a/dist/bunny.css b/dist/bunny.css index 2139f0a..771381c 100644 --- a/dist/bunny.css +++ b/dist/bunny.css @@ -916,7 +916,7 @@ button[disabled].bny-btn { } /* 代码code */ -.bny-code { +pre { font-family: monospace, monospace; color: var(--primary); background-color: var(--white); @@ -933,7 +933,7 @@ button[disabled].bny-btn { word-wrap: break-word; } -.bny-code code { +pre code { color: var(--primary); background: transparent; display: block; diff --git a/dist/bunny.js b/dist/bunny.js index 75be640..4cecd4c 100644 --- a/dist/bunny.js +++ b/dist/bunny.js @@ -1 +1 @@ -(()=>{"use strict";var __webpack_modules__={335:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var htmx=function(){const htmx={onLoad:null,process:null,on:null,off:null,trigger:null,ajax:null,find:null,findAll:null,closest:null,values:function(e,t){return getInputValues(e,t||"post").values},remove:null,addClass:null,removeClass:null,toggleClass:null,takeClass:null,swap:null,defineExtension:null,removeExtension:null,logAll:null,logNone:null,logger:null,config:{historyEnabled:!0,historyCacheSize:10,refreshOnHistoryMiss:!1,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:!0,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:!0,allowScriptTags:!0,inlineScriptNonce:"",inlineStyleNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:!1,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",scrollBehavior:"instant",defaultFocusScroll:!1,getCacheBusterParam:!1,globalViewTransitions:!1,methodsThatUseUrlParams:["get","delete"],selfRequestsOnly:!0,ignoreTitle:!1,scrollIntoViewOnBoost:!0,triggerSpecsCache:null,disableInheritance:!1,responseHandling:[{code:"204",swap:!1},{code:"[23]..",swap:!0},{code:"[45]..",swap:!1,error:!0}],allowNestedOobSwaps:!0},parseInterval:null,_:null,version:"2.0.2"};htmx.onLoad=onLoadHelper,htmx.process=processNode,htmx.on=addEventListenerImpl,htmx.off=removeEventListenerImpl,htmx.trigger=triggerEvent,htmx.ajax=ajaxHelper,htmx.find=find,htmx.findAll=findAll,htmx.closest=closest,htmx.remove=removeElement,htmx.addClass=addClassToElement,htmx.removeClass=removeClassFromElement,htmx.toggleClass=toggleClassOnElement,htmx.takeClass=takeClassForElement,htmx.swap=swap,htmx.defineExtension=defineExtension,htmx.removeExtension=removeExtension,htmx.logAll=logAll,htmx.logNone=logNone,htmx.parseInterval=parseInterval,htmx._=internalEval;const internalAPI={addTriggerHandler,bodyContains,canAccessLocalStorage,findThisElement,filterValues,swap,hasAttribute,getAttributeValue,getClosestAttributeValue,getClosestMatch,getExpressionVars,getHeaders,getInputValues,getInternalData,getSwapSpecification,getTriggerSpecs,getTarget,makeFragment,mergeObjects,makeSettleInfo,oobSwap,querySelectorExt,settleImmediately,shouldCancel,triggerEvent,triggerErrorEvent,withExtensions},VERBS=["get","post","put","delete","patch"],VERB_SELECTOR=VERBS.map((function(e){return"[hx-"+e+"], [data-hx-"+e+"]"})).join(", "),HEAD_TAG_REGEX=makeTagRegEx("head");function makeTagRegEx(e,t=!1){return new RegExp(`<${e}(\\s[^>]*>|>)([\\s\\S]*?)<\\/${e}>`,t?"gim":"im")}function parseInterval(e){if(null==e)return;let t=NaN;return t="ms"==e.slice(-2)?parseFloat(e.slice(0,-2)):"s"==e.slice(-1)?1e3*parseFloat(e.slice(0,-1)):"m"==e.slice(-1)?1e3*parseFloat(e.slice(0,-1))*60:parseFloat(e),isNaN(t)?void 0:t}function getRawAttribute(e,t){return e instanceof Element&&e.getAttribute(t)}function hasAttribute(e,t){return!!e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function getAttributeValue(e,t){return getRawAttribute(e,t)||getRawAttribute(e,"data-"+t)}function parentElt(e){const t=e.parentElement;return!t&&e.parentNode instanceof ShadowRoot?e.parentNode:t}function getDocument(){return document}function getRootNode(e,t){return e.getRootNode?e.getRootNode({composed:t}):getDocument()}function getClosestMatch(e,t){for(;e&&!t(e);)e=parentElt(e);return e||null}function getAttributeValueWithDisinheritance(e,t,n){const r=getAttributeValue(t,n),o=getAttributeValue(t,"hx-disinherit");var a=getAttributeValue(t,"hx-inherit");if(e!==t){if(htmx.config.disableInheritance)return a&&("*"===a||a.split(" ").indexOf(n)>=0)?r:null;if(o&&("*"===o||o.split(" ").indexOf(n)>=0))return"unset"}return r}function getClosestAttributeValue(e,t){let n=null;if(getClosestMatch(e,(function(r){return!!(n=getAttributeValueWithDisinheritance(e,asElement(r),t))})),"unset"!==n)return n}function matches(e,t){const n=e instanceof Element&&(e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector);return!!n&&n.call(e,t)}function getStartTag(e){const t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i.exec(e);return t?t[1].toLowerCase():""}function parseHTML(e){return(new DOMParser).parseFromString(e,"text/html")}function takeChildrenFor(e,t){for(;t.childNodes.length>0;)e.append(t.childNodes[0])}function duplicateScript(e){const t=getDocument().createElement("script");return forEach(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),t.textContent=e.textContent,t.async=!1,htmx.config.inlineScriptNonce&&(t.nonce=htmx.config.inlineScriptNonce),t}function isJavaScriptScriptNode(e){return e.matches("script")&&("text/javascript"===e.type||"module"===e.type||""===e.type)}function normalizeScriptTags(e){Array.from(e.querySelectorAll("script")).forEach((e=>{if(isJavaScriptScriptNode(e)){const t=duplicateScript(e),n=e.parentNode;try{n.insertBefore(t,e)}catch(e){logError(e)}finally{e.remove()}}}))}function makeFragment(e){const t=e.replace(HEAD_TAG_REGEX,""),n=getStartTag(t);let r;if("html"===n){r=new DocumentFragment;const t=parseHTML(e);takeChildrenFor(r,t.body),r.title=t.title}else if("body"===n){r=new DocumentFragment;const e=parseHTML(t);takeChildrenFor(r,e.body),r.title=e.title}else{const e=parseHTML('");r=e.querySelector("template").content,r.title=e.title;var o=r.querySelector("title");o&&o.parentNode===r&&(o.remove(),r.title=o.innerText)}return r&&(htmx.config.allowScriptTags?normalizeScriptTags(r):r.querySelectorAll("script").forEach((e=>e.remove()))),r}function maybeCall(e){e&&e()}function isType(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function isFunction(e){return"function"==typeof e}function isRawObject(e){return isType(e,"Object")}function getInternalData(e){const t="htmx-internal-data";let n=e[t];return n||(n=e[t]={}),n}function toArray(e){const t=[];if(e)for(let n=0;n=0}function bodyContains(e){const t=e.getRootNode&&e.getRootNode();return t&&t instanceof window.ShadowRoot?getDocument().body.contains(t.host):getDocument().body.contains(e)}function splitOnWhitespace(e){return e.trim().split(/\s+/)}function mergeObjects(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function parseJSON(e){try{return JSON.parse(e)}catch(e){return logError(e),null}}function canAccessLocalStorage(){const e="htmx:localStorageTest";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}function normalizePath(e){try{const t=new URL(e);return t&&(e=t.pathname+t.search),/^\/$/.test(e)||(e=e.replace(/\/+$/,"")),e}catch(t){return e}}function internalEval(str){return maybeEval(getDocument().body,(function(){return eval(str)}))}function onLoadHelper(e){return htmx.on("htmx:load",(function(t){e(t.detail.elt)}))}function logAll(){htmx.logger=function(e,t,n){console&&console.log(t,e,n)}}function logNone(){htmx.logger=null}function find(e,t){return"string"!=typeof e?e.querySelector(t):find(getDocument(),e)}function findAll(e,t){return"string"!=typeof e?e.querySelectorAll(t):findAll(getDocument(),e)}function getWindow(){return window}function removeElement(e,t){e=resolveTarget(e),t?getWindow().setTimeout((function(){removeElement(e),e=null}),t):parentElt(e).removeChild(e)}function asElement(e){return e instanceof Element?e:null}function asHtmlElement(e){return e instanceof HTMLElement?e:null}function asString(e){return"string"==typeof e?e:null}function asParentNode(e){return e instanceof Element||e instanceof Document||e instanceof DocumentFragment?e:null}function addClassToElement(e,t,n){(e=asElement(resolveTarget(e)))&&(n?getWindow().setTimeout((function(){addClassToElement(e,t),e=null}),n):e.classList&&e.classList.add(t))}function removeClassFromElement(e,t,n){let r=asElement(resolveTarget(e));r&&(n?getWindow().setTimeout((function(){removeClassFromElement(r,t),r=null}),n):r.classList&&(r.classList.remove(t),0===r.classList.length&&r.removeAttribute("class")))}function toggleClassOnElement(e,t){(e=resolveTarget(e)).classList.toggle(t)}function takeClassForElement(e,t){forEach((e=resolveTarget(e)).parentElement.children,(function(e){removeClassFromElement(e,t)})),addClassToElement(asElement(e),t)}function closest(e,t){if((e=asElement(resolveTarget(e)))&&e.closest)return e.closest(t);do{if(null==e||matches(e,t))return e}while(e=e&&asElement(parentElt(e)));return null}function startsWith(e,t){return e.substring(0,t.length)===t}function endsWith(e,t){return e.substring(e.length-t.length)===t}function normalizeSelector(e){const t=e.trim();return startsWith(t,"<")&&endsWith(t,"/>")?t.substring(1,t.length-2):t}function querySelectorAllExt(e,t,n){return e=resolveTarget(e),0===t.indexOf("closest ")?[closest(asElement(e),normalizeSelector(t.substr(8)))]:0===t.indexOf("find ")?[find(asParentNode(e),normalizeSelector(t.substr(5)))]:"next"===t?[asElement(e).nextElementSibling]:0===t.indexOf("next ")?[scanForwardQuery(e,normalizeSelector(t.substr(5)),!!n)]:"previous"===t?[asElement(e).previousElementSibling]:0===t.indexOf("previous ")?[scanBackwardsQuery(e,normalizeSelector(t.substr(9)),!!n)]:"document"===t?[document]:"window"===t?[window]:"body"===t?[document.body]:"root"===t?[getRootNode(e,!!n)]:0===t.indexOf("global ")?querySelectorAllExt(e,t.slice(7),!0):toArray(asParentNode(getRootNode(e,!!n)).querySelectorAll(normalizeSelector(t)))}var scanForwardQuery=function(e,t,n){const r=asParentNode(getRootNode(e,n)).querySelectorAll(t);for(let t=0;t=0;t--){const n=r[t];if(n.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING)return n}};function querySelectorExt(e,t){return"string"!=typeof e?querySelectorAllExt(e,t)[0]:querySelectorAllExt(getDocument().body,e)[0]}function resolveTarget(e,t){return"string"==typeof e?find(asParentNode(t)||document,e):e}function processEventArgs(e,t,n){return isFunction(t)?{target:getDocument().body,event:asString(e),listener:t}:{target:resolveTarget(e),event:asString(t),listener:n}}function addEventListenerImpl(e,t,n){return ready((function(){const r=processEventArgs(e,t,n);r.target.addEventListener(r.event,r.listener)})),isFunction(t)?t:n}function removeEventListenerImpl(e,t,n){return ready((function(){const r=processEventArgs(e,t,n);r.target.removeEventListener(r.event,r.listener)})),isFunction(t)?t:n}const DUMMY_ELT=getDocument().createElement("output");function findAttributeTargets(e,t){const n=getClosestAttributeValue(e,t);if(n){if("this"===n)return[findThisElement(e,t)];{const r=querySelectorAllExt(e,n);return 0===r.length?(logError('The selector "'+n+'" on '+t+" returned no matches!"),[DUMMY_ELT]):r}}}function findThisElement(e,t){return asElement(getClosestMatch(e,(function(e){return null!=getAttributeValue(asElement(e),t)})))}function getTarget(e){const t=getClosestAttributeValue(e,"hx-target");return t?"this"===t?findThisElement(e,"hx-target"):querySelectorExt(e,t):getInternalData(e).boosted?getDocument().body:e}function shouldSettleAttribute(e){const t=htmx.config.attributesToSettle;for(let n=0;n0?(o=e.substr(0,e.indexOf(":")),r=e.substr(e.indexOf(":")+1,e.length)):o=e);const a=getDocument().querySelectorAll(r);return a?(forEach(a,(function(e){let r;const a=t.cloneNode(!0);r=getDocument().createDocumentFragment(),r.appendChild(a),isInlineSwap(o,e)||(r=asParentNode(a));const s={shouldSwap:!0,target:e,fragment:r};triggerEvent(e,"htmx:oobBeforeSwap",s)&&(e=s.target,s.shouldSwap&&swapWithStyle(o,e,e,r,n),forEach(n.elts,(function(e){triggerEvent(e,"htmx:oobAfterSwap",s)})))})),t.parentNode.removeChild(t)):(t.parentNode.removeChild(t),triggerErrorEvent(getDocument().body,"htmx:oobErrorNoTarget",{content:t})),e}function handlePreservedElements(e){forEach(findAll(e,"[hx-preserve], [data-hx-preserve]"),(function(e){const t=getAttributeValue(e,"id"),n=getDocument().getElementById(t);null!=n&&e.parentNode.replaceChild(n,e)}))}function handleAttributes(e,t,n){forEach(t.querySelectorAll("[id]"),(function(t){const r=getRawAttribute(t,"id");if(r&&r.length>0){const o=r.replace("'","\\'"),a=t.tagName.replace(":","\\:"),s=asParentNode(e),i=s&&s.querySelector(a+"[id='"+o+"']");if(i&&i!==s){const e=t.cloneNode();cloneAttributes(t,i),n.tasks.push((function(){cloneAttributes(t,e)}))}}}))}function makeAjaxLoadTask(e){return function(){removeClassFromElement(e,htmx.config.addedClass),processNode(asElement(e)),processFocus(asParentNode(e)),triggerEvent(e,"htmx:load")}}function processFocus(e){const t="[autofocus]",n=asHtmlElement(matches(e,t)?e:e.querySelector(t));null!=n&&n.focus()}function insertNodesBefore(e,t,n,r){for(handleAttributes(e,n,r);n.childNodes.length>0;){const o=n.firstChild;addClassToElement(asElement(o),htmx.config.addedClass),e.insertBefore(o,t),o.nodeType!==Node.TEXT_NODE&&o.nodeType!==Node.COMMENT_NODE&&r.tasks.push(makeAjaxLoadTask(o))}}function stringHash(e,t){let n=0;for(;n0}function swap(e,t,n,r){r||(r={}),e=resolveTarget(e);const o=document.activeElement;let a={};try{a={elt:o,start:o?o.selectionStart:null,end:o?o.selectionEnd:null}}catch(e){}const s=makeSettleInfo(e);if("textContent"===n.swapStyle)e.textContent=t;else{let o=makeFragment(t);if(s.title=o.title,r.selectOOB){const e=r.selectOOB.split(",");for(let t=0;t0?getWindow().setTimeout(i,n.settleDelay):i()}function handleTriggerHeader(e,t,n){const r=e.getResponseHeader(t);if(0===r.indexOf("{")){const e=parseJSON(r);for(const t in e)if(e.hasOwnProperty(t)){let r=e[t];isRawObject(r)?n=void 0!==r.target?r.target:n:r={value:r},triggerEvent(n,t,r)}}else{const e=r.split(",");for(let t=0;t0;){const s=t[0];if("]"===s){if(r--,0===r){null===a&&(o+="true"),t.shift(),o+=")})";try{const t=maybeEval(e,(function(){return Function(o)()}),(function(){return!0}));return t.source=o,t}catch(e){return triggerErrorEvent(getDocument().body,"htmx:syntax:error",{error:e,source:o}),null}}}else"["===s&&r++;isPossibleRelativeReference(s,a,n)?o+="(("+n+"."+s+") ? ("+n+"."+s+") : (window."+s+"))":o+=s,a=t.shift()}}}function consumeUntil(e,t){let n="";for(;e.length>0&&!t.test(e[0]);)n+=e.shift();return n}function consumeCSSSelector(e){let t;return e.length>0&&COMBINED_SELECTOR_START.test(e[0])?(e.shift(),t=consumeUntil(e,COMBINED_SELECTOR_END).trim(),e.shift()):t=consumeUntil(e,WHITESPACE_OR_COMMA),t}const INPUT_SELECTOR="input, textarea, select";function parseAndCacheTrigger(e,t,n){const r=[],o=tokenizeString(t);do{consumeUntil(o,NOT_WHITESPACE);const t=o.length,n=consumeUntil(o,/[,\[\s]/);if(""!==n)if("every"===n){const t={trigger:"every"};consumeUntil(o,NOT_WHITESPACE),t.pollInterval=parseInterval(consumeUntil(o,/[,\[\s]/)),consumeUntil(o,NOT_WHITESPACE),(a=maybeGenerateConditional(e,o,"event"))&&(t.eventFilter=a),r.push(t)}else{const t={trigger:n};var a;for((a=maybeGenerateConditional(e,o,"event"))&&(t.eventFilter=a);o.length>0&&","!==o[0];){consumeUntil(o,NOT_WHITESPACE);const n=o.shift();if("changed"===n)t.changed=!0;else if("once"===n)t.once=!0;else if("consume"===n)t.consume=!0;else if("delay"===n&&":"===o[0])o.shift(),t.delay=parseInterval(consumeUntil(o,WHITESPACE_OR_COMMA));else if("from"===n&&":"===o[0]){if(o.shift(),COMBINED_SELECTOR_START.test(o[0]))var s=consumeCSSSelector(o);else if("closest"===(s=consumeUntil(o,WHITESPACE_OR_COMMA))||"find"===s||"next"===s||"previous"===s){o.shift();const e=consumeCSSSelector(o);e.length>0&&(s+=" "+e)}t.from=s}else"target"===n&&":"===o[0]?(o.shift(),t.target=consumeCSSSelector(o)):"throttle"===n&&":"===o[0]?(o.shift(),t.throttle=parseInterval(consumeUntil(o,WHITESPACE_OR_COMMA))):"queue"===n&&":"===o[0]?(o.shift(),t.queue=consumeUntil(o,WHITESPACE_OR_COMMA)):"root"===n&&":"===o[0]?(o.shift(),t[n]=consumeCSSSelector(o)):"threshold"===n&&":"===o[0]?(o.shift(),t[n]=consumeUntil(o,WHITESPACE_OR_COMMA)):triggerErrorEvent(e,"htmx:syntax:error",{token:o.shift()})}r.push(t)}o.length===t&&triggerErrorEvent(e,"htmx:syntax:error",{token:o.shift()}),consumeUntil(o,NOT_WHITESPACE)}while(","===o[0]&&o.shift());return n&&(n[t]=r),r}function getTriggerSpecs(e){const t=getAttributeValue(e,"hx-trigger");let n=[];if(t){const r=htmx.config.triggerSpecsCache;n=r&&r[t]||parseAndCacheTrigger(e,t,r)}return n.length>0?n:matches(e,"form")?[{trigger:"submit"}]:matches(e,'input[type="button"], input[type="submit"]')?[{trigger:"click"}]:matches(e,INPUT_SELECTOR)?[{trigger:"change"}]:[{trigger:"click"}]}function cancelPolling(e){getInternalData(e).cancelled=!0}function processPolling(e,t,n){const r=getInternalData(e);r.timeout=getWindow().setTimeout((function(){bodyContains(e)&&!0!==r.cancelled&&(maybeFilterEvent(n,e,makeEvent("hx:poll:trigger",{triggerSpec:n,target:e}))||t(e),processPolling(e,t,n))}),n.pollInterval)}function isLocalLink(e){return location.hostname===e.hostname&&getRawAttribute(e,"href")&&0!==getRawAttribute(e,"href").indexOf("#")}function eltIsDisabled(e){return closest(e,htmx.config.disableSelector)}function boostElement(e,t,n){if(e instanceof HTMLAnchorElement&&isLocalLink(e)&&(""===e.target||"_self"===e.target)||"FORM"===e.tagName&&"dialog"!==String(getRawAttribute(e,"method")).toLowerCase()){let r,o;if(t.boosted=!0,"A"===e.tagName)r="get",o=getRawAttribute(e,"href");else{const t=getRawAttribute(e,"method");r=t?t.toLowerCase():"get",o=getRawAttribute(e,"action")}n.forEach((function(n){addEventListener(e,(function(e,t){const n=asElement(e);eltIsDisabled(n)?cleanUpElement(n):issueAjaxRequest(r,o,n,t)}),t,n,!0)}))}}function shouldCancel(e,t){const n=asElement(t);if(!n)return!1;if("submit"===e.type||"click"===e.type){if("FORM"===n.tagName)return!0;if(matches(n,'input[type="submit"], button')&&null!==closest(n,"form"))return!0;if(n instanceof HTMLAnchorElement&&n.href&&("#"===n.getAttribute("href")||0!==n.getAttribute("href").indexOf("#")))return!0}return!1}function ignoreBoostedAnchorCtrlClick(e,t){return getInternalData(e).boosted&&e instanceof HTMLAnchorElement&&"click"===t.type&&(t.ctrlKey||t.metaKey)}function maybeFilterEvent(e,t,n){const r=e.eventFilter;if(r)try{return!0!==r.call(t,n)}catch(e){const t=r.source;return triggerErrorEvent(getDocument().body,"htmx:eventFilter:error",{error:e,source:t}),!0}return!1}function addEventListener(e,t,n,r,o){const a=getInternalData(e);let s;s=r.from?querySelectorAllExt(e,r.from):[e],r.changed&&s.forEach((function(e){getInternalData(e).lastValue=e.value})),forEach(s,(function(s){const i=function(n){if(!bodyContains(e))return void s.removeEventListener(r.trigger,i);if(ignoreBoostedAnchorCtrlClick(e,n))return;if((o||shouldCancel(n,e))&&n.preventDefault(),maybeFilterEvent(r,e,n))return;const l=getInternalData(n);if(l.triggerSpec=r,null==l.handledFor&&(l.handledFor=[]),l.handledFor.indexOf(e)<0){if(l.handledFor.push(e),r.consume&&n.stopPropagation(),r.target&&n.target&&!matches(asElement(n.target),r.target))return;if(r.once){if(a.triggeredOnce)return;a.triggeredOnce=!0}if(r.changed){const e=getInternalData(s),t=s.value;if(e.lastValue===t)return;e.lastValue=t}if(a.delayed&&clearTimeout(a.delayed),a.throttle)return;r.throttle>0?a.throttle||(triggerEvent(e,"htmx:trigger"),t(e,n),a.throttle=getWindow().setTimeout((function(){a.throttle=null}),r.throttle)):r.delay>0?a.delayed=getWindow().setTimeout((function(){triggerEvent(e,"htmx:trigger"),t(e,n)}),r.delay):(triggerEvent(e,"htmx:trigger"),t(e,n))}};null==n.listenerInfos&&(n.listenerInfos=[]),n.listenerInfos.push({trigger:r.trigger,listener:i,on:s}),s.addEventListener(r.trigger,i)}))}let windowIsScrolling=!1,scrollHandler=null;function initScrollHandler(){scrollHandler||(scrollHandler=function(){windowIsScrolling=!0},window.addEventListener("scroll",scrollHandler),setInterval((function(){windowIsScrolling&&(windowIsScrolling=!1,forEach(getDocument().querySelectorAll("[hx-trigger*='revealed'],[data-hx-trigger*='revealed']"),(function(e){maybeReveal(e)})))}),200))}function maybeReveal(e){!hasAttribute(e,"data-hx-revealed")&&isScrolledIntoView(e)&&(e.setAttribute("data-hx-revealed","true"),getInternalData(e).initHash?triggerEvent(e,"revealed"):e.addEventListener("htmx:afterProcessNode",(function(){triggerEvent(e,"revealed")}),{once:!0}))}function loadImmediately(e,t,n,r){const o=function(){n.loaded||(n.loaded=!0,t(e))};r>0?getWindow().setTimeout(o,r):o()}function processVerbs(e,t,n){let r=!1;return forEach(VERBS,(function(o){if(hasAttribute(e,"hx-"+o)){const a=getAttributeValue(e,"hx-"+o);r=!0,t.path=a,t.verb=o,n.forEach((function(n){addTriggerHandler(e,n,t,(function(e,t){const n=asElement(e);closest(n,htmx.config.disableSelector)?cleanUpElement(n):issueAjaxRequest(o,a,n,t)}))}))}})),r}function addTriggerHandler(e,t,n,r){if("revealed"===t.trigger)initScrollHandler(),addEventListener(e,r,n,t),maybeReveal(asElement(e));else if("intersect"===t.trigger){const o={};t.root&&(o.root=querySelectorExt(e,t.root)),t.threshold&&(o.threshold=parseFloat(t.threshold)),new IntersectionObserver((function(t){for(let n=0;n0?(n.polling=!0,processPolling(asElement(e),r,t)):addEventListener(e,r,n,t)}function shouldProcessHxOn(e){const t=asElement(e);if(!t)return!1;const n=t.attributes;for(let e=0;e", "+e)).join(""))}return[]}function maybeSetLastButtonClicked(e){const t=closest(asElement(e.target),"button, input[type='submit']"),n=getRelatedFormData(e);n&&(n.lastButtonClicked=t)}function maybeUnsetLastButtonClicked(e){const t=getRelatedFormData(e);t&&(t.lastButtonClicked=null)}function getRelatedFormData(e){const t=closest(asElement(e.target),"button, input[type='submit']");if(!t)return;const n=resolveTarget("#"+getRawAttribute(t,"form"),t.getRootNode())||closest(t,"form");return n?getInternalData(n):void 0}function initButtonTracking(e){e.addEventListener("click",maybeSetLastButtonClicked),e.addEventListener("focusin",maybeSetLastButtonClicked),e.addEventListener("focusout",maybeUnsetLastButtonClicked)}function addHxOnEventHandler(e,t,n){const r=getInternalData(e);let o;Array.isArray(r.onHandlers)||(r.onHandlers=[]);const a=function(t){maybeEval(e,(function(){eltIsDisabled(e)||(o||(o=new Function("event",n)),o.call(e,t))}))};e.addEventListener(t,a),r.onHandlers.push({event:t,listener:a})}function processHxOnWildcard(e){deInitOnHandlers(e);for(let t=0;thtmx.config.historyCacheSize;)a.shift();for(;a.length>0;)try{localStorage.setItem("htmx-history-cache",JSON.stringify(a));break}catch(e){triggerErrorEvent(getDocument().body,"htmx:historyCacheError",{cause:e,cache:a}),a.shift()}}function getCachedHistory(e){if(!canAccessLocalStorage())return null;e=normalizePath(e);const t=parseJSON(localStorage.getItem("htmx-history-cache"))||[];for(let n=0;n=200&&this.status<400){triggerEvent(getDocument().body,"htmx:historyCacheMissLoad",n);const t=makeFragment(this.response),r=t.querySelector("[hx-history-elt],[data-hx-history-elt]")||t,o=getHistoryElement(),a=makeSettleInfo(o);handleTitle(t.title),swapInnerHTML(o,r,a),settleImmediately(a.tasks),currentPathForHistory=e,triggerEvent(getDocument().body,"htmx:historyRestore",{path:e,cacheMiss:!0,serverResponse:this.response})}else triggerErrorEvent(getDocument().body,"htmx:historyCacheMissLoadError",n)},t.send()}function restoreHistory(e){saveCurrentPageToHistory();const t=getCachedHistory(e=e||location.pathname+location.search);if(t){const n=makeFragment(t.content),r=getHistoryElement(),o=makeSettleInfo(r);handleTitle(n.title),swapInnerHTML(r,n,o),settleImmediately(o.tasks),getWindow().setTimeout((function(){window.scrollTo(0,t.scroll)}),0),currentPathForHistory=e,triggerEvent(getDocument().body,"htmx:historyRestore",{path:e,item:t})}else htmx.config.refreshOnHistoryMiss?window.location.reload(!0):loadHistoryFromServer(e)}function addRequestIndicatorClasses(e){let t=findAttributeTargets(e,"hx-indicator");return null==t&&(t=[e]),forEach(t,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)+1,e.classList.add.call(e.classList,htmx.config.requestClass)})),t}function disableElements(e){let t=findAttributeTargets(e,"hx-disabled-elt");return null==t&&(t=[]),forEach(t,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)+1,e.setAttribute("disabled",""),e.setAttribute("data-disabled-by-htmx","")})),t}function removeRequestIndicators(e,t){forEach(e,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)-1,0===t.requestCount&&e.classList.remove.call(e.classList,htmx.config.requestClass)})),forEach(t,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)-1,0===t.requestCount&&(e.removeAttribute("disabled"),e.removeAttribute("data-disabled-by-htmx"))}))}function haveSeenNode(e,t){for(let n=0;nt.indexOf(e)<0)):r.filter((e=>e!==t)),n.delete(e),forEach(r,(t=>n.append(e,t)))}}function processInputValue(e,t,n,r,o){if(null!=r&&!haveSeenNode(e,r)){if(e.push(r),shouldInclude(r)){const e=getRawAttribute(r,"name");let a=r.value;r instanceof HTMLSelectElement&&r.multiple&&(a=toArray(r.querySelectorAll("option:checked")).map((function(e){return e.value}))),r instanceof HTMLInputElement&&r.files&&(a=toArray(r.files)),addValueToFormData(e,a,t),o&&validateElement(r,n)}r instanceof HTMLFormElement&&(forEach(r.elements,(function(r){e.indexOf(r)>=0?removeValueFromFormData(r.name,r.value,t):e.push(r),o&&validateElement(r,n)})),new FormData(r).forEach((function(e,n){e instanceof File&&""===e.name||addValueToFormData(n,e,t)})))}}function validateElement(e,t){const n=e;n.willValidate&&(triggerEvent(n,"htmx:validation:validate"),n.checkValidity()||(t.push({elt:n,message:n.validationMessage,validity:n.validity}),triggerEvent(n,"htmx:validation:failed",{message:n.validationMessage,validity:n.validity})))}function overrideFormData(e,t){for(const n of t.keys())e.delete(n);return t.forEach((function(t,n){e.append(n,t)})),e}function getInputValues(e,t){const n=[],r=new FormData,o=new FormData,a=[],s=getInternalData(e);s.lastButtonClicked&&!bodyContains(s.lastButtonClicked)&&(s.lastButtonClicked=null);let i=e instanceof HTMLFormElement&&!0!==e.noValidate||"true"===getAttributeValue(e,"hx-validate");if(s.lastButtonClicked&&(i=i&&!0!==s.lastButtonClicked.formNoValidate),"get"!==t&&processInputValue(n,o,a,closest(e,"form"),i),processInputValue(n,r,a,e,i),s.lastButtonClicked||"BUTTON"===e.tagName||"INPUT"===e.tagName&&"submit"===getRawAttribute(e,"type")){const t=s.lastButtonClicked||e;addValueToFormData(getRawAttribute(t,"name"),t.value,o)}return forEach(findAttributeTargets(e,"hx-include"),(function(e){processInputValue(n,r,a,asElement(e),i),matches(e,"form")||forEach(asParentNode(e).querySelectorAll(INPUT_SELECTOR),(function(e){processInputValue(n,r,a,e,i)}))})),overrideFormData(r,o),{errors:a,formData:r,values:formDataProxy(r)}}function appendParam(e,t,n){""!==e&&(e+="&"),"[object Object]"===String(n)&&(n=JSON.stringify(n));const r=encodeURIComponent(n);return e+(encodeURIComponent(t)+"=")+r}function urlEncode(e){e=formDataFromObject(e);let t="";return e.forEach((function(e,n){t=appendParam(t,n,e)})),t}function getHeaders(e,t,n){const r={"HX-Request":"true","HX-Trigger":getRawAttribute(e,"id"),"HX-Trigger-Name":getRawAttribute(e,"name"),"HX-Target":getAttributeValue(t,"id"),"HX-Current-URL":getDocument().location.href};return getValuesForElement(e,"hx-headers",!1,r),void 0!==n&&(r["HX-Prompt"]=n),getInternalData(e).boosted&&(r["HX-Boosted"]="true"),r}function filterValues(e,t){const n=getClosestAttributeValue(t,"hx-params");if(n){if("none"===n)return new FormData;if("*"===n)return e;if(0===n.indexOf("not "))return forEach(n.substr(4).split(","),(function(t){t=t.trim(),e.delete(t)})),e;{const t=new FormData;return forEach(n.split(","),(function(n){n=n.trim(),e.has(n)&&e.getAll(n).forEach((function(e){t.append(n,e)}))})),t}}return e}function isAnchorLink(e){return!!getRawAttribute(e,"href")&&getRawAttribute(e,"href").indexOf("#")>=0}function getSwapSpecification(e,t){const n=t||getClosestAttributeValue(e,"hx-swap"),r={swapStyle:getInternalData(e).boosted?"innerHTML":htmx.config.defaultSwapStyle,swapDelay:htmx.config.defaultSwapDelay,settleDelay:htmx.config.defaultSettleDelay};if(htmx.config.scrollIntoViewOnBoost&&getInternalData(e).boosted&&!isAnchorLink(e)&&(r.show="top"),n){const e=splitOnWhitespace(n);if(e.length>0)for(let t=0;t0?a.join(":"):null;r.scroll=e,r.scrollTarget=o}else if(0===n.indexOf("show:")){var a;const e=(a=n.substr(5).split(":")).pop();o=a.length>0?a.join(":"):null,r.show=e,r.showTarget=o}else if(0===n.indexOf("focus-scroll:")){const e=n.substr(13);r.focusScroll="true"==e}else 0==t?r.swapStyle=n:logError("Unknown modifier in hx-swap: "+n)}}return r}function usesFormData(e){return"multipart/form-data"===getClosestAttributeValue(e,"hx-encoding")||matches(e,"form")&&"multipart/form-data"===getRawAttribute(e,"enctype")}function encodeParamsForBody(e,t,n){let r=null;return withExtensions(t,(function(o){null==r&&(r=o.encodeParameters(e,n,t))})),null!=r?r:usesFormData(t)?overrideFormData(new FormData,formDataFromObject(n)):urlEncode(n)}function makeSettleInfo(e){return{tasks:[],elts:[e]}}function updateScrollState(e,t){const n=e[0],r=e[e.length-1];if(t.scroll){var o=null;t.scrollTarget&&(o=asElement(querySelectorExt(n,t.scrollTarget))),"top"===t.scroll&&(n||o)&&((o=o||n).scrollTop=0),"bottom"===t.scroll&&(r||o)&&((o=o||r).scrollTop=o.scrollHeight)}if(t.show){if(o=null,t.showTarget){let e=t.showTarget;"window"===t.showTarget&&(e="body"),o=asElement(querySelectorExt(n,e))}"top"===t.show&&(n||o)&&(o=o||n).scrollIntoView({block:"start",behavior:htmx.config.scrollBehavior}),"bottom"===t.show&&(r||o)&&(o=o||r).scrollIntoView({block:"end",behavior:htmx.config.scrollBehavior})}}function getValuesForElement(e,t,n,r){if(null==r&&(r={}),null==e)return r;const o=getAttributeValue(e,t);if(o){let t,a=o.trim(),s=n;if("unset"===a)return null;0===a.indexOf("javascript:")?(a=a.substr(11),s=!0):0===a.indexOf("js:")&&(a=a.substr(3),s=!0),0!==a.indexOf("{")&&(a="{"+a+"}"),t=s?maybeEval(e,(function(){return Function("return ("+a+")")()}),{}):parseJSON(a);for(const e in t)t.hasOwnProperty(e)&&null==r[e]&&(r[e]=t[e])}return getValuesForElement(asElement(parentElt(e)),t,n,r)}function maybeEval(e,t,n){return htmx.config.allowEval?t():(triggerErrorEvent(e,"htmx:evalDisallowedError"),n)}function getHXVarsForElement(e,t){return getValuesForElement(e,"hx-vars",!0,t)}function getHXValsForElement(e,t){return getValuesForElement(e,"hx-vals",!1,t)}function getExpressionVars(e){return mergeObjects(getHXVarsForElement(e),getHXValsForElement(e))}function safelySetHeaderValue(e,t,n){if(null!==n)try{e.setRequestHeader(t,n)}catch(r){e.setRequestHeader(t,encodeURIComponent(n)),e.setRequestHeader(t+"-URI-AutoEncoded","true")}}function getPathFromResponse(e){if(e.responseURL&&"undefined"!=typeof URL)try{const t=new URL(e.responseURL);return t.pathname+t.search}catch(t){triggerErrorEvent(getDocument().body,"htmx:badResponseUrl",{url:e.responseURL})}}function hasHeader(e,t){return t.test(e.getAllResponseHeaders())}function ajaxHelper(e,t,n){return e=e.toLowerCase(),n?n instanceof Element||"string"==typeof n?issueAjaxRequest(e,t,null,null,{targetOverride:resolveTarget(n),returnPromise:!0}):issueAjaxRequest(e,t,resolveTarget(n.source),n.event,{handler:n.handler,headers:n.headers,values:n.values,targetOverride:resolveTarget(n.target),swapOverride:n.swap,select:n.select,returnPromise:!0}):issueAjaxRequest(e,t,null,null,{returnPromise:!0})}function hierarchyForElt(e){const t=[];for(;e;)t.push(e),e=e.parentElement;return t}function verifyPath(e,t,n){let r,o;return"function"==typeof URL?(o=new URL(t,document.location.href),r=document.location.origin===o.origin):(o=t,r=startsWith(t,document.location.origin)),!(htmx.config.selfRequestsOnly&&!r)&&triggerEvent(e,"htmx:validateUrl",mergeObjects({url:o,sameHost:r},n))}function formDataFromObject(e){if(e instanceof FormData)return e;const t=new FormData;for(const n in e)e.hasOwnProperty(n)&&("function"==typeof e[n].forEach?e[n].forEach((function(e){t.append(n,e)})):"object"!=typeof e[n]||e[n]instanceof Blob?t.append(n,e[n]):t.append(n,JSON.stringify(e[n])));return t}function formDataArrayProxy(e,t,n){return new Proxy(n,{get:function(n,r){return"number"==typeof r?n[r]:"length"===r?n.length:"push"===r?function(r){n.push(r),e.append(t,r)}:"function"==typeof n[r]?function(){n[r].apply(n,arguments),e.delete(t),n.forEach((function(n){e.append(t,n)}))}:n[r]&&1===n[r].length?n[r][0]:n[r]},set:function(n,r,o){return n[r]=o,e.delete(t),n.forEach((function(n){e.append(t,n)})),!0}})}function formDataProxy(e){return new Proxy(e,{get:function(t,n){if("symbol"==typeof n)return Reflect.get(t,n);if("toJSON"===n)return()=>Object.fromEntries(e);if(n in t)return"function"==typeof t[n]?function(){return e[n].apply(e,arguments)}:t[n];const r=e.getAll(n);return 0===r.length?void 0:1===r.length?r[0]:formDataArrayProxy(t,n,r)},set:function(e,t,n){return"string"==typeof t&&(e.delete(t),"function"==typeof n.forEach?n.forEach((function(n){e.append(t,n)})):"object"!=typeof n||n instanceof Blob?e.append(t,n):e.append(t,JSON.stringify(n)),!0)},deleteProperty:function(e,t){return"string"==typeof t&&e.delete(t),!0},ownKeys:function(e){return Reflect.ownKeys(Object.fromEntries(e))},getOwnPropertyDescriptor:function(e,t){return Reflect.getOwnPropertyDescriptor(Object.fromEntries(e),t)}})}function issueAjaxRequest(e,t,n,r,o,a){let s=null,i=null;if((o=null!=o?o:{}).returnPromise&&"undefined"!=typeof Promise)var l=new Promise((function(e,t){s=e,i=t}));null==n&&(n=getDocument().body);const c=o.handler||handleAjaxResponse,u=o.select||null;if(!bodyContains(n))return maybeCall(s),l;const f=o.targetOverride||asElement(getTarget(n));if(null==f||f==DUMMY_ELT)return triggerErrorEvent(n,"htmx:targetError",{target:getAttributeValue(n,"hx-target")}),maybeCall(i),l;let d=getInternalData(n);const g=d.lastButtonClicked;if(g){const n=getRawAttribute(g,"formaction");null!=n&&(t=n);const r=getRawAttribute(g,"formmethod");null!=r&&"dialog"!==r.toLowerCase()&&(e=r)}const h=getClosestAttributeValue(n,"hx-confirm");if(void 0===a&&!1===triggerEvent(n,"htmx:confirm",{target:f,elt:n,path:t,verb:e,triggeringEvent:r,etc:o,issueRequest:function(a){return issueAjaxRequest(e,t,n,r,o,!!a)},question:h}))return maybeCall(s),l;let m=n,p=getClosestAttributeValue(n,"hx-sync"),E=null,b=!1;if(p){const e=p.split(":"),t=e[0].trim();if(m="this"===t?findThisElement(n,"hx-sync"):asElement(querySelectorExt(n,t)),p=(e[1]||"drop").trim(),d=getInternalData(m),"drop"===p&&d.xhr&&!0!==d.abortable)return maybeCall(s),l;if("abort"===p){if(d.xhr)return maybeCall(s),l;b=!0}else"replace"===p?triggerEvent(m,"htmx:abort"):0===p.indexOf("queue")&&(E=(p.split(" ")[1]||"last").trim())}if(d.xhr){if(!d.abortable){if(null==E){if(r){const e=getInternalData(r);e&&e.triggerSpec&&e.triggerSpec.queue&&(E=e.triggerSpec.queue)}null==E&&(E="last")}return null==d.queuedRequests&&(d.queuedRequests=[]),"first"===E&&0===d.queuedRequests.length||"all"===E?d.queuedRequests.push((function(){issueAjaxRequest(e,t,n,r,o)})):"last"===E&&(d.queuedRequests=[],d.queuedRequests.push((function(){issueAjaxRequest(e,t,n,r,o)}))),maybeCall(s),l}triggerEvent(m,"htmx:abort")}const x=new XMLHttpRequest;d.xhr=x,d.abortable=b;const y=function(){d.xhr=null,d.abortable=!1,null!=d.queuedRequests&&d.queuedRequests.length>0&&d.queuedRequests.shift()()},v=getClosestAttributeValue(n,"hx-prompt");if(v){var w=prompt(v);if(null===w||!triggerEvent(n,"htmx:prompt",{prompt:w,target:f}))return maybeCall(s),y(),l}if(h&&!a&&!confirm(h))return maybeCall(s),y(),l;let S=getHeaders(n,f,w);"get"===e||usesFormData(n)||(S["Content-Type"]="application/x-www-form-urlencoded"),o.headers&&(S=mergeObjects(S,o.headers));const A=getInputValues(n,e);let C=A.errors;const T=A.formData;o.values&&overrideFormData(T,formDataFromObject(o.values));const H=overrideFormData(T,formDataFromObject(getExpressionVars(n)));let R=filterValues(H,n);htmx.config.getCacheBusterParam&&"get"===e&&R.set("org.htmx.cache-buster",getRawAttribute(f,"id")||"true"),null!=t&&""!==t||(t=getDocument().location.href);const O=getValuesForElement(n,"hx-request"),I=getInternalData(n).boosted;let D=htmx.config.methodsThatUseUrlParams.indexOf(e)>=0;const _={boosted:I,useUrlParams:D,formData:R,parameters:formDataProxy(R),unfilteredFormData:H,unfilteredParameters:formDataProxy(H),headers:S,target:f,verb:e,errors:C,withCredentials:o.credentials||O.credentials||htmx.config.withCredentials,timeout:o.timeout||O.timeout||htmx.config.timeout,path:t,triggeringEvent:r};if(!triggerEvent(n,"htmx:configRequest",_))return maybeCall(s),y(),l;if(t=_.path,e=_.verb,S=_.headers,R=formDataFromObject(_.parameters),C=_.errors,D=_.useUrlParams,C&&C.length>0)return triggerEvent(n,"htmx:validation:halted",_),maybeCall(s),y(),l;const N=t.split("#"),L=N[0],q=N[1];let P=t;if(D&&(P=L,!R.keys().next().done&&(P.indexOf("?")<0?P+="?":P+="&",P+=urlEncode(R),q&&(P+="#"+q))),!verifyPath(n,P,_))return triggerErrorEvent(n,"htmx:invalidPath",_),maybeCall(i),l;if(x.open(e.toUpperCase(),P,!0),x.overrideMimeType("text/html"),x.withCredentials=_.withCredentials,x.timeout=_.timeout,O.noHeaders);else for(const e in S)if(S.hasOwnProperty(e)){const t=S[e];safelySetHeaderValue(x,e,t)}const F={xhr:x,target:f,requestConfig:_,etc:o,boosted:I,select:u,pathInfo:{requestPath:t,finalRequestPath:P,responsePath:null,anchor:q}};if(x.onload=function(){try{const e=hierarchyForElt(n);if(F.pathInfo.responsePath=getPathFromResponse(x),c(n,F),!0!==F.keepIndicators&&removeRequestIndicators(k,M),triggerEvent(n,"htmx:afterRequest",F),triggerEvent(n,"htmx:afterOnLoad",F),!bodyContains(n)){let t=null;for(;e.length>0&&null==t;){const n=e.shift();bodyContains(n)&&(t=n)}t&&(triggerEvent(t,"htmx:afterRequest",F),triggerEvent(t,"htmx:afterOnLoad",F))}maybeCall(s),y()}catch(e){throw triggerErrorEvent(n,"htmx:onLoadError",mergeObjects({error:e},F)),e}},x.onerror=function(){removeRequestIndicators(k,M),triggerErrorEvent(n,"htmx:afterRequest",F),triggerErrorEvent(n,"htmx:sendError",F),maybeCall(i),y()},x.onabort=function(){removeRequestIndicators(k,M),triggerErrorEvent(n,"htmx:afterRequest",F),triggerErrorEvent(n,"htmx:sendAbort",F),maybeCall(i),y()},x.ontimeout=function(){removeRequestIndicators(k,M),triggerErrorEvent(n,"htmx:afterRequest",F),triggerErrorEvent(n,"htmx:timeout",F),maybeCall(i),y()},!triggerEvent(n,"htmx:beforeRequest",F))return maybeCall(s),y(),l;var k=addRequestIndicatorClasses(n),M=disableElements(n);forEach(["loadstart","loadend","progress","abort"],(function(e){forEach([x,x.upload],(function(t){t.addEventListener(e,(function(t){triggerEvent(n,"htmx:xhr:"+e,{lengthComputable:t.lengthComputable,loaded:t.loaded,total:t.total})}))}))})),triggerEvent(n,"htmx:beforeSend",F);const V=D?null:encodeParamsForBody(x,n,R);return x.send(V),l}function determineHistoryUpdates(e,t){const n=t.xhr;let r=null,o=null;if(hasHeader(n,/HX-Push:/i)?(r=n.getResponseHeader("HX-Push"),o="push"):hasHeader(n,/HX-Push-Url:/i)?(r=n.getResponseHeader("HX-Push-Url"),o="push"):hasHeader(n,/HX-Replace-Url:/i)&&(r=n.getResponseHeader("HX-Replace-Url"),o="replace"),r)return"false"===r?{}:{type:o,path:r};const a=t.pathInfo.finalRequestPath,s=t.pathInfo.responsePath,i=getClosestAttributeValue(e,"hx-push-url"),l=getClosestAttributeValue(e,"hx-replace-url"),c=getInternalData(e).boosted;let u=null,f=null;return i?(u="push",f=i):l?(u="replace",f=l):c&&(u="push",f=s||a),f?"false"===f?{}:("true"===f&&(f=s||a),t.pathInfo.anchor&&-1===f.indexOf("#")&&(f=f+"#"+t.pathInfo.anchor),{type:u,path:f}):{}}function codeMatches(e,t){return new RegExp(e.code).test(t.toString(10))}function resolveResponseHandling(e){for(var t=0;t0?getWindow().setTimeout(u,E.swapDelay):u()}f&&triggerErrorEvent(e,"htmx:responseError",mergeObjects({error:"Response Status Error Code "+n.status+" from "+t.pathInfo.requestPath},t))}}const extensions={};function extensionBase(){return{init:function(e){return null},getSelectors:function(){return null},onEvent:function(e,t){return!0},transformResponse:function(e,t,n){return e},isInlineSwap:function(e){return!1},handleSwap:function(e,t,n,r){return!1},encodeParameters:function(e,t,n){return null}}}function defineExtension(e,t){t.init&&t.init(internalAPI),extensions[e]=mergeObjects(extensionBase(),t)}function removeExtension(e){delete extensions[e]}function getExtensions(e,t,n){if(null==t&&(t=[]),null==e)return t;null==n&&(n=[]);const r=getAttributeValue(e,"hx-ext");return r&&forEach(r.split(","),(function(e){if("ignore:"!=(e=e.replace(/ /g,"")).slice(0,7)){if(n.indexOf(e)<0){const n=extensions[e];n&&t.indexOf(n)<0&&t.push(n)}}else n.push(e.slice(7))})),getExtensions(asElement(parentElt(e)),t,n)}var isReady=!1;function ready(e){isReady||"complete"===getDocument().readyState?e():getDocument().addEventListener("DOMContentLoaded",e)}function insertIndicatorStyles(){if(!1!==htmx.config.includeIndicatorStyles){const e=htmx.config.inlineStyleNonce?` nonce="${htmx.config.inlineStyleNonce}"`:"";getDocument().head.insertAdjacentHTML("beforeend"," ."+htmx.config.indicatorClass+"{opacity:0} ."+htmx.config.requestClass+" ."+htmx.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;} ."+htmx.config.requestClass+"."+htmx.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;} ")}}function getMetaConfig(){const e=getDocument().querySelector('meta[name="htmx-config"]');return e?parseJSON(e.content):null}function mergeMetaConfig(){const e=getMetaConfig();e&&(htmx.config=mergeObjects(htmx.config,e))}return getDocument().addEventListener("DOMContentLoaded",(function(){isReady=!0})),ready((function(){mergeMetaConfig(),insertIndicatorStyles();let e=getDocument().body;processNode(e);const t=getDocument().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",(function(e){const t=getInternalData(e.target);t&&t.xhr&&t.xhr.abort()}));const n=window.onpopstate?window.onpopstate.bind(window):null;window.onpopstate=function(e){e.state&&e.state.htmx?(restoreHistory(),forEach(t,(function(e){triggerEvent(e,"htmx:restored",{document:getDocument(),triggerEvent})}))):n&&n(e)},getWindow().setTimeout((function(){triggerEvent(e,"htmx:load",{}),e=null}),0)})),htmx}();const __WEBPACK_DEFAULT_EXPORT__=htmx}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var __webpack_exports__={},htmx=__webpack_require__(335);let tool={indexOf:function(e){return Array.prototype.indexOf.call(e.parentNode.children,e)},escapeHTML:function(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}};const src_tool=tool;htmx.A.defineExtension("bny-tab",{onEvent:function(e,t){return"htmx:beforeProcessNode"===e?function(e){const t=e.target;return!e.target.classList.contains("bny-tab")||(htmx.A.findAll(".bny-tab-item",t).forEach((e=>{htmx.A.on(e,"click",(function(){const e=src_tool.indexOf(this),t=this.parentNode.parentNode,n=htmx.A.find(t,`.bny-tab-body>div:nth-child(${e+1})`);htmx.A.findAll(t,".bny-tab-title .this").forEach((function(e){e.classList.remove("this")})),htmx.A.findAll(t,".bny-tab-body .this").forEach((function(e){e.classList.remove("this")})),htmx.A.addClass(this,"this"),htmx.A.addClass(n,"this")}))})),!1)}(t):"htmx:afterProcessNode"===e?(function(e){const t=e.target;if(t.classList.contains("bny-tab-body")){const e=htmx.A.findAll(t.parentNode,".bny-tab-title .bny-tab-item").length,n=htmx.A.findAll(t,"div").length;if(e-n>0)for(let r=0;rdiv:nth-child(${n+1})`);htmx.A.swap(r,e.detail.serverResponse,{swapStyle:"innerHTML"})}}(t),!1):void 0}}),htmx.A.defineExtension("bny-card",{onEvent:function(e,t){if("htmx:beforeSwap"===e){if(t.detail.isError)t.detail.elt.innerHTML='
加载失败...
';else try{const e=JSON.parse(t.detail.serverResponse);if(1===e.code){const n=e.data,r=n&&n.body?`\n

${n.body.title||""}

\n
${n.body.subtitle||""}
\n

${n.body.text||""}

\n `:"";t.detail.elt.innerHTML=`\n
\n ${n&&n.top_img?``:""}\n ${n&&n.header?`
${n.header}
`:""}\n
${r}
\n ${n&&n.footer?``:""}\n ${n&&n.bottom_img?``:""}\n
`}else t.detail.elt.innerHTML=`
${data.msg}
`}catch(e){console.error(e)}return!1}}}),htmx.A.defineExtension("bny-code",{onEvent:function(e,t){if("htmx:beforeSwap"===e){const e=t.target.getAttribute("hx-swap")||"innerHTML",n=`
${src_tool.escapeHTML(t.detail.serverResponse)}
`;return htmx.A.swap(t.target,n,{swapStyle:e}),!1}}}),htmx.A.defineExtension("bny-marquee",{onEvent:function(e,t){if("htmx:beforeProcessNode"===e&&t.target.classList.contains("bny-marquee")){const e=t.target.getAttribute("speed")||50;let o=htmx.A.find(t.target,".bny-marquee-content");var n=o.parentNode.offsetWidth,r=(o.offsetWidth+n)/Number(e);return o.style.animationDuration=r+"s",!1}}}),htmx.A.defineExtension("bny-alert",{onEvent:function(e,t){if("htmx:beforeProcessNode"===e){const e=t.target;let n=document.createElement("span");n.setAttribute("class","alert-del"),n.textContent="X",e.append(n),htmx.A.on(n,"click",(function(){this.parentNode.style.opacity=0,setTimeout((()=>{this.parentNode.remove()}),235)}))}}}),function(){function e(t){let n="";return t.forEach((t=>{const r=t.icon?``:"",o=t.children?`${e(t.children)}`:"",a=t.url?t.url:"javascript:;",s=t.title?`${t.title}`:"";n+=`
  • ${r}${s}${o}
  • `})),n}htmx.A.defineExtension("bny-menu",{onEvent:function(t,n){if("htmx:beforeSwap"===t){const t=n.target.getAttribute("hx-swap")||"innerHTML",r=null!==n.target.getAttribute("vertical")?"vertical":"";if(n.detail.isError)htmx.A.swap(n.detail.elt,"网络错误...",{swapStyle:t});else try{const o=JSON.parse(n.detail.serverResponse);if(1===o.code){const a=o.data;htmx.A.swap(n.detail.elt,`${e(a)}`,{swapStyle:t})}else htmx.A.swap(n.detail.elt,"加载失败...",{swapStyle:t})}catch(e){console.error(e)}return!1}}})}(),window.htmx=htmx.A})(); \ No newline at end of file +(()=>{"use strict";var __webpack_modules__={335:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var htmx=function(){const htmx={onLoad:null,process:null,on:null,off:null,trigger:null,ajax:null,find:null,findAll:null,closest:null,values:function(e,t){return getInputValues(e,t||"post").values},remove:null,addClass:null,removeClass:null,toggleClass:null,takeClass:null,swap:null,defineExtension:null,removeExtension:null,logAll:null,logNone:null,logger:null,config:{historyEnabled:!0,historyCacheSize:10,refreshOnHistoryMiss:!1,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:!0,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:!0,allowScriptTags:!0,inlineScriptNonce:"",inlineStyleNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:!1,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",scrollBehavior:"instant",defaultFocusScroll:!1,getCacheBusterParam:!1,globalViewTransitions:!1,methodsThatUseUrlParams:["get","delete"],selfRequestsOnly:!0,ignoreTitle:!1,scrollIntoViewOnBoost:!0,triggerSpecsCache:null,disableInheritance:!1,responseHandling:[{code:"204",swap:!1},{code:"[23]..",swap:!0},{code:"[45]..",swap:!1,error:!0}],allowNestedOobSwaps:!0},parseInterval:null,_:null,version:"2.0.2"};htmx.onLoad=onLoadHelper,htmx.process=processNode,htmx.on=addEventListenerImpl,htmx.off=removeEventListenerImpl,htmx.trigger=triggerEvent,htmx.ajax=ajaxHelper,htmx.find=find,htmx.findAll=findAll,htmx.closest=closest,htmx.remove=removeElement,htmx.addClass=addClassToElement,htmx.removeClass=removeClassFromElement,htmx.toggleClass=toggleClassOnElement,htmx.takeClass=takeClassForElement,htmx.swap=swap,htmx.defineExtension=defineExtension,htmx.removeExtension=removeExtension,htmx.logAll=logAll,htmx.logNone=logNone,htmx.parseInterval=parseInterval,htmx._=internalEval;const internalAPI={addTriggerHandler,bodyContains,canAccessLocalStorage,findThisElement,filterValues,swap,hasAttribute,getAttributeValue,getClosestAttributeValue,getClosestMatch,getExpressionVars,getHeaders,getInputValues,getInternalData,getSwapSpecification,getTriggerSpecs,getTarget,makeFragment,mergeObjects,makeSettleInfo,oobSwap,querySelectorExt,settleImmediately,shouldCancel,triggerEvent,triggerErrorEvent,withExtensions},VERBS=["get","post","put","delete","patch"],VERB_SELECTOR=VERBS.map((function(e){return"[hx-"+e+"], [data-hx-"+e+"]"})).join(", "),HEAD_TAG_REGEX=makeTagRegEx("head");function makeTagRegEx(e,t=!1){return new RegExp(`<${e}(\\s[^>]*>|>)([\\s\\S]*?)<\\/${e}>`,t?"gim":"im")}function parseInterval(e){if(null==e)return;let t=NaN;return t="ms"==e.slice(-2)?parseFloat(e.slice(0,-2)):"s"==e.slice(-1)?1e3*parseFloat(e.slice(0,-1)):"m"==e.slice(-1)?1e3*parseFloat(e.slice(0,-1))*60:parseFloat(e),isNaN(t)?void 0:t}function getRawAttribute(e,t){return e instanceof Element&&e.getAttribute(t)}function hasAttribute(e,t){return!!e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function getAttributeValue(e,t){return getRawAttribute(e,t)||getRawAttribute(e,"data-"+t)}function parentElt(e){const t=e.parentElement;return!t&&e.parentNode instanceof ShadowRoot?e.parentNode:t}function getDocument(){return document}function getRootNode(e,t){return e.getRootNode?e.getRootNode({composed:t}):getDocument()}function getClosestMatch(e,t){for(;e&&!t(e);)e=parentElt(e);return e||null}function getAttributeValueWithDisinheritance(e,t,n){const r=getAttributeValue(t,n),o=getAttributeValue(t,"hx-disinherit");var a=getAttributeValue(t,"hx-inherit");if(e!==t){if(htmx.config.disableInheritance)return a&&("*"===a||a.split(" ").indexOf(n)>=0)?r:null;if(o&&("*"===o||o.split(" ").indexOf(n)>=0))return"unset"}return r}function getClosestAttributeValue(e,t){let n=null;if(getClosestMatch(e,(function(r){return!!(n=getAttributeValueWithDisinheritance(e,asElement(r),t))})),"unset"!==n)return n}function matches(e,t){const n=e instanceof Element&&(e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector);return!!n&&n.call(e,t)}function getStartTag(e){const t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i.exec(e);return t?t[1].toLowerCase():""}function parseHTML(e){return(new DOMParser).parseFromString(e,"text/html")}function takeChildrenFor(e,t){for(;t.childNodes.length>0;)e.append(t.childNodes[0])}function duplicateScript(e){const t=getDocument().createElement("script");return forEach(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),t.textContent=e.textContent,t.async=!1,htmx.config.inlineScriptNonce&&(t.nonce=htmx.config.inlineScriptNonce),t}function isJavaScriptScriptNode(e){return e.matches("script")&&("text/javascript"===e.type||"module"===e.type||""===e.type)}function normalizeScriptTags(e){Array.from(e.querySelectorAll("script")).forEach((e=>{if(isJavaScriptScriptNode(e)){const t=duplicateScript(e),n=e.parentNode;try{n.insertBefore(t,e)}catch(e){logError(e)}finally{e.remove()}}}))}function makeFragment(e){const t=e.replace(HEAD_TAG_REGEX,""),n=getStartTag(t);let r;if("html"===n){r=new DocumentFragment;const t=parseHTML(e);takeChildrenFor(r,t.body),r.title=t.title}else if("body"===n){r=new DocumentFragment;const e=parseHTML(t);takeChildrenFor(r,e.body),r.title=e.title}else{const e=parseHTML('");r=e.querySelector("template").content,r.title=e.title;var o=r.querySelector("title");o&&o.parentNode===r&&(o.remove(),r.title=o.innerText)}return r&&(htmx.config.allowScriptTags?normalizeScriptTags(r):r.querySelectorAll("script").forEach((e=>e.remove()))),r}function maybeCall(e){e&&e()}function isType(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function isFunction(e){return"function"==typeof e}function isRawObject(e){return isType(e,"Object")}function getInternalData(e){const t="htmx-internal-data";let n=e[t];return n||(n=e[t]={}),n}function toArray(e){const t=[];if(e)for(let n=0;n=0}function bodyContains(e){const t=e.getRootNode&&e.getRootNode();return t&&t instanceof window.ShadowRoot?getDocument().body.contains(t.host):getDocument().body.contains(e)}function splitOnWhitespace(e){return e.trim().split(/\s+/)}function mergeObjects(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function parseJSON(e){try{return JSON.parse(e)}catch(e){return logError(e),null}}function canAccessLocalStorage(){const e="htmx:localStorageTest";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}function normalizePath(e){try{const t=new URL(e);return t&&(e=t.pathname+t.search),/^\/$/.test(e)||(e=e.replace(/\/+$/,"")),e}catch(t){return e}}function internalEval(str){return maybeEval(getDocument().body,(function(){return eval(str)}))}function onLoadHelper(e){return htmx.on("htmx:load",(function(t){e(t.detail.elt)}))}function logAll(){htmx.logger=function(e,t,n){console&&console.log(t,e,n)}}function logNone(){htmx.logger=null}function find(e,t){return"string"!=typeof e?e.querySelector(t):find(getDocument(),e)}function findAll(e,t){return"string"!=typeof e?e.querySelectorAll(t):findAll(getDocument(),e)}function getWindow(){return window}function removeElement(e,t){e=resolveTarget(e),t?getWindow().setTimeout((function(){removeElement(e),e=null}),t):parentElt(e).removeChild(e)}function asElement(e){return e instanceof Element?e:null}function asHtmlElement(e){return e instanceof HTMLElement?e:null}function asString(e){return"string"==typeof e?e:null}function asParentNode(e){return e instanceof Element||e instanceof Document||e instanceof DocumentFragment?e:null}function addClassToElement(e,t,n){(e=asElement(resolveTarget(e)))&&(n?getWindow().setTimeout((function(){addClassToElement(e,t),e=null}),n):e.classList&&e.classList.add(t))}function removeClassFromElement(e,t,n){let r=asElement(resolveTarget(e));r&&(n?getWindow().setTimeout((function(){removeClassFromElement(r,t),r=null}),n):r.classList&&(r.classList.remove(t),0===r.classList.length&&r.removeAttribute("class")))}function toggleClassOnElement(e,t){(e=resolveTarget(e)).classList.toggle(t)}function takeClassForElement(e,t){forEach((e=resolveTarget(e)).parentElement.children,(function(e){removeClassFromElement(e,t)})),addClassToElement(asElement(e),t)}function closest(e,t){if((e=asElement(resolveTarget(e)))&&e.closest)return e.closest(t);do{if(null==e||matches(e,t))return e}while(e=e&&asElement(parentElt(e)));return null}function startsWith(e,t){return e.substring(0,t.length)===t}function endsWith(e,t){return e.substring(e.length-t.length)===t}function normalizeSelector(e){const t=e.trim();return startsWith(t,"<")&&endsWith(t,"/>")?t.substring(1,t.length-2):t}function querySelectorAllExt(e,t,n){return e=resolveTarget(e),0===t.indexOf("closest ")?[closest(asElement(e),normalizeSelector(t.substr(8)))]:0===t.indexOf("find ")?[find(asParentNode(e),normalizeSelector(t.substr(5)))]:"next"===t?[asElement(e).nextElementSibling]:0===t.indexOf("next ")?[scanForwardQuery(e,normalizeSelector(t.substr(5)),!!n)]:"previous"===t?[asElement(e).previousElementSibling]:0===t.indexOf("previous ")?[scanBackwardsQuery(e,normalizeSelector(t.substr(9)),!!n)]:"document"===t?[document]:"window"===t?[window]:"body"===t?[document.body]:"root"===t?[getRootNode(e,!!n)]:0===t.indexOf("global ")?querySelectorAllExt(e,t.slice(7),!0):toArray(asParentNode(getRootNode(e,!!n)).querySelectorAll(normalizeSelector(t)))}var scanForwardQuery=function(e,t,n){const r=asParentNode(getRootNode(e,n)).querySelectorAll(t);for(let t=0;t=0;t--){const n=r[t];if(n.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING)return n}};function querySelectorExt(e,t){return"string"!=typeof e?querySelectorAllExt(e,t)[0]:querySelectorAllExt(getDocument().body,e)[0]}function resolveTarget(e,t){return"string"==typeof e?find(asParentNode(t)||document,e):e}function processEventArgs(e,t,n){return isFunction(t)?{target:getDocument().body,event:asString(e),listener:t}:{target:resolveTarget(e),event:asString(t),listener:n}}function addEventListenerImpl(e,t,n){return ready((function(){const r=processEventArgs(e,t,n);r.target.addEventListener(r.event,r.listener)})),isFunction(t)?t:n}function removeEventListenerImpl(e,t,n){return ready((function(){const r=processEventArgs(e,t,n);r.target.removeEventListener(r.event,r.listener)})),isFunction(t)?t:n}const DUMMY_ELT=getDocument().createElement("output");function findAttributeTargets(e,t){const n=getClosestAttributeValue(e,t);if(n){if("this"===n)return[findThisElement(e,t)];{const r=querySelectorAllExt(e,n);return 0===r.length?(logError('The selector "'+n+'" on '+t+" returned no matches!"),[DUMMY_ELT]):r}}}function findThisElement(e,t){return asElement(getClosestMatch(e,(function(e){return null!=getAttributeValue(asElement(e),t)})))}function getTarget(e){const t=getClosestAttributeValue(e,"hx-target");return t?"this"===t?findThisElement(e,"hx-target"):querySelectorExt(e,t):getInternalData(e).boosted?getDocument().body:e}function shouldSettleAttribute(e){const t=htmx.config.attributesToSettle;for(let n=0;n0?(o=e.substr(0,e.indexOf(":")),r=e.substr(e.indexOf(":")+1,e.length)):o=e);const a=getDocument().querySelectorAll(r);return a?(forEach(a,(function(e){let r;const a=t.cloneNode(!0);r=getDocument().createDocumentFragment(),r.appendChild(a),isInlineSwap(o,e)||(r=asParentNode(a));const s={shouldSwap:!0,target:e,fragment:r};triggerEvent(e,"htmx:oobBeforeSwap",s)&&(e=s.target,s.shouldSwap&&swapWithStyle(o,e,e,r,n),forEach(n.elts,(function(e){triggerEvent(e,"htmx:oobAfterSwap",s)})))})),t.parentNode.removeChild(t)):(t.parentNode.removeChild(t),triggerErrorEvent(getDocument().body,"htmx:oobErrorNoTarget",{content:t})),e}function handlePreservedElements(e){forEach(findAll(e,"[hx-preserve], [data-hx-preserve]"),(function(e){const t=getAttributeValue(e,"id"),n=getDocument().getElementById(t);null!=n&&e.parentNode.replaceChild(n,e)}))}function handleAttributes(e,t,n){forEach(t.querySelectorAll("[id]"),(function(t){const r=getRawAttribute(t,"id");if(r&&r.length>0){const o=r.replace("'","\\'"),a=t.tagName.replace(":","\\:"),s=asParentNode(e),i=s&&s.querySelector(a+"[id='"+o+"']");if(i&&i!==s){const e=t.cloneNode();cloneAttributes(t,i),n.tasks.push((function(){cloneAttributes(t,e)}))}}}))}function makeAjaxLoadTask(e){return function(){removeClassFromElement(e,htmx.config.addedClass),processNode(asElement(e)),processFocus(asParentNode(e)),triggerEvent(e,"htmx:load")}}function processFocus(e){const t="[autofocus]",n=asHtmlElement(matches(e,t)?e:e.querySelector(t));null!=n&&n.focus()}function insertNodesBefore(e,t,n,r){for(handleAttributes(e,n,r);n.childNodes.length>0;){const o=n.firstChild;addClassToElement(asElement(o),htmx.config.addedClass),e.insertBefore(o,t),o.nodeType!==Node.TEXT_NODE&&o.nodeType!==Node.COMMENT_NODE&&r.tasks.push(makeAjaxLoadTask(o))}}function stringHash(e,t){let n=0;for(;n0}function swap(e,t,n,r){r||(r={}),e=resolveTarget(e);const o=document.activeElement;let a={};try{a={elt:o,start:o?o.selectionStart:null,end:o?o.selectionEnd:null}}catch(e){}const s=makeSettleInfo(e);if("textContent"===n.swapStyle)e.textContent=t;else{let o=makeFragment(t);if(s.title=o.title,r.selectOOB){const e=r.selectOOB.split(",");for(let t=0;t0?getWindow().setTimeout(i,n.settleDelay):i()}function handleTriggerHeader(e,t,n){const r=e.getResponseHeader(t);if(0===r.indexOf("{")){const e=parseJSON(r);for(const t in e)if(e.hasOwnProperty(t)){let r=e[t];isRawObject(r)?n=void 0!==r.target?r.target:n:r={value:r},triggerEvent(n,t,r)}}else{const e=r.split(",");for(let t=0;t0;){const s=t[0];if("]"===s){if(r--,0===r){null===a&&(o+="true"),t.shift(),o+=")})";try{const t=maybeEval(e,(function(){return Function(o)()}),(function(){return!0}));return t.source=o,t}catch(e){return triggerErrorEvent(getDocument().body,"htmx:syntax:error",{error:e,source:o}),null}}}else"["===s&&r++;isPossibleRelativeReference(s,a,n)?o+="(("+n+"."+s+") ? ("+n+"."+s+") : (window."+s+"))":o+=s,a=t.shift()}}}function consumeUntil(e,t){let n="";for(;e.length>0&&!t.test(e[0]);)n+=e.shift();return n}function consumeCSSSelector(e){let t;return e.length>0&&COMBINED_SELECTOR_START.test(e[0])?(e.shift(),t=consumeUntil(e,COMBINED_SELECTOR_END).trim(),e.shift()):t=consumeUntil(e,WHITESPACE_OR_COMMA),t}const INPUT_SELECTOR="input, textarea, select";function parseAndCacheTrigger(e,t,n){const r=[],o=tokenizeString(t);do{consumeUntil(o,NOT_WHITESPACE);const t=o.length,n=consumeUntil(o,/[,\[\s]/);if(""!==n)if("every"===n){const t={trigger:"every"};consumeUntil(o,NOT_WHITESPACE),t.pollInterval=parseInterval(consumeUntil(o,/[,\[\s]/)),consumeUntil(o,NOT_WHITESPACE),(a=maybeGenerateConditional(e,o,"event"))&&(t.eventFilter=a),r.push(t)}else{const t={trigger:n};var a;for((a=maybeGenerateConditional(e,o,"event"))&&(t.eventFilter=a);o.length>0&&","!==o[0];){consumeUntil(o,NOT_WHITESPACE);const n=o.shift();if("changed"===n)t.changed=!0;else if("once"===n)t.once=!0;else if("consume"===n)t.consume=!0;else if("delay"===n&&":"===o[0])o.shift(),t.delay=parseInterval(consumeUntil(o,WHITESPACE_OR_COMMA));else if("from"===n&&":"===o[0]){if(o.shift(),COMBINED_SELECTOR_START.test(o[0]))var s=consumeCSSSelector(o);else if("closest"===(s=consumeUntil(o,WHITESPACE_OR_COMMA))||"find"===s||"next"===s||"previous"===s){o.shift();const e=consumeCSSSelector(o);e.length>0&&(s+=" "+e)}t.from=s}else"target"===n&&":"===o[0]?(o.shift(),t.target=consumeCSSSelector(o)):"throttle"===n&&":"===o[0]?(o.shift(),t.throttle=parseInterval(consumeUntil(o,WHITESPACE_OR_COMMA))):"queue"===n&&":"===o[0]?(o.shift(),t.queue=consumeUntil(o,WHITESPACE_OR_COMMA)):"root"===n&&":"===o[0]?(o.shift(),t[n]=consumeCSSSelector(o)):"threshold"===n&&":"===o[0]?(o.shift(),t[n]=consumeUntil(o,WHITESPACE_OR_COMMA)):triggerErrorEvent(e,"htmx:syntax:error",{token:o.shift()})}r.push(t)}o.length===t&&triggerErrorEvent(e,"htmx:syntax:error",{token:o.shift()}),consumeUntil(o,NOT_WHITESPACE)}while(","===o[0]&&o.shift());return n&&(n[t]=r),r}function getTriggerSpecs(e){const t=getAttributeValue(e,"hx-trigger");let n=[];if(t){const r=htmx.config.triggerSpecsCache;n=r&&r[t]||parseAndCacheTrigger(e,t,r)}return n.length>0?n:matches(e,"form")?[{trigger:"submit"}]:matches(e,'input[type="button"], input[type="submit"]')?[{trigger:"click"}]:matches(e,INPUT_SELECTOR)?[{trigger:"change"}]:[{trigger:"click"}]}function cancelPolling(e){getInternalData(e).cancelled=!0}function processPolling(e,t,n){const r=getInternalData(e);r.timeout=getWindow().setTimeout((function(){bodyContains(e)&&!0!==r.cancelled&&(maybeFilterEvent(n,e,makeEvent("hx:poll:trigger",{triggerSpec:n,target:e}))||t(e),processPolling(e,t,n))}),n.pollInterval)}function isLocalLink(e){return location.hostname===e.hostname&&getRawAttribute(e,"href")&&0!==getRawAttribute(e,"href").indexOf("#")}function eltIsDisabled(e){return closest(e,htmx.config.disableSelector)}function boostElement(e,t,n){if(e instanceof HTMLAnchorElement&&isLocalLink(e)&&(""===e.target||"_self"===e.target)||"FORM"===e.tagName&&"dialog"!==String(getRawAttribute(e,"method")).toLowerCase()){let r,o;if(t.boosted=!0,"A"===e.tagName)r="get",o=getRawAttribute(e,"href");else{const t=getRawAttribute(e,"method");r=t?t.toLowerCase():"get",o=getRawAttribute(e,"action")}n.forEach((function(n){addEventListener(e,(function(e,t){const n=asElement(e);eltIsDisabled(n)?cleanUpElement(n):issueAjaxRequest(r,o,n,t)}),t,n,!0)}))}}function shouldCancel(e,t){const n=asElement(t);if(!n)return!1;if("submit"===e.type||"click"===e.type){if("FORM"===n.tagName)return!0;if(matches(n,'input[type="submit"], button')&&null!==closest(n,"form"))return!0;if(n instanceof HTMLAnchorElement&&n.href&&("#"===n.getAttribute("href")||0!==n.getAttribute("href").indexOf("#")))return!0}return!1}function ignoreBoostedAnchorCtrlClick(e,t){return getInternalData(e).boosted&&e instanceof HTMLAnchorElement&&"click"===t.type&&(t.ctrlKey||t.metaKey)}function maybeFilterEvent(e,t,n){const r=e.eventFilter;if(r)try{return!0!==r.call(t,n)}catch(e){const t=r.source;return triggerErrorEvent(getDocument().body,"htmx:eventFilter:error",{error:e,source:t}),!0}return!1}function addEventListener(e,t,n,r,o){const a=getInternalData(e);let s;s=r.from?querySelectorAllExt(e,r.from):[e],r.changed&&s.forEach((function(e){getInternalData(e).lastValue=e.value})),forEach(s,(function(s){const i=function(n){if(!bodyContains(e))return void s.removeEventListener(r.trigger,i);if(ignoreBoostedAnchorCtrlClick(e,n))return;if((o||shouldCancel(n,e))&&n.preventDefault(),maybeFilterEvent(r,e,n))return;const l=getInternalData(n);if(l.triggerSpec=r,null==l.handledFor&&(l.handledFor=[]),l.handledFor.indexOf(e)<0){if(l.handledFor.push(e),r.consume&&n.stopPropagation(),r.target&&n.target&&!matches(asElement(n.target),r.target))return;if(r.once){if(a.triggeredOnce)return;a.triggeredOnce=!0}if(r.changed){const e=getInternalData(s),t=s.value;if(e.lastValue===t)return;e.lastValue=t}if(a.delayed&&clearTimeout(a.delayed),a.throttle)return;r.throttle>0?a.throttle||(triggerEvent(e,"htmx:trigger"),t(e,n),a.throttle=getWindow().setTimeout((function(){a.throttle=null}),r.throttle)):r.delay>0?a.delayed=getWindow().setTimeout((function(){triggerEvent(e,"htmx:trigger"),t(e,n)}),r.delay):(triggerEvent(e,"htmx:trigger"),t(e,n))}};null==n.listenerInfos&&(n.listenerInfos=[]),n.listenerInfos.push({trigger:r.trigger,listener:i,on:s}),s.addEventListener(r.trigger,i)}))}let windowIsScrolling=!1,scrollHandler=null;function initScrollHandler(){scrollHandler||(scrollHandler=function(){windowIsScrolling=!0},window.addEventListener("scroll",scrollHandler),setInterval((function(){windowIsScrolling&&(windowIsScrolling=!1,forEach(getDocument().querySelectorAll("[hx-trigger*='revealed'],[data-hx-trigger*='revealed']"),(function(e){maybeReveal(e)})))}),200))}function maybeReveal(e){!hasAttribute(e,"data-hx-revealed")&&isScrolledIntoView(e)&&(e.setAttribute("data-hx-revealed","true"),getInternalData(e).initHash?triggerEvent(e,"revealed"):e.addEventListener("htmx:afterProcessNode",(function(){triggerEvent(e,"revealed")}),{once:!0}))}function loadImmediately(e,t,n,r){const o=function(){n.loaded||(n.loaded=!0,t(e))};r>0?getWindow().setTimeout(o,r):o()}function processVerbs(e,t,n){let r=!1;return forEach(VERBS,(function(o){if(hasAttribute(e,"hx-"+o)){const a=getAttributeValue(e,"hx-"+o);r=!0,t.path=a,t.verb=o,n.forEach((function(n){addTriggerHandler(e,n,t,(function(e,t){const n=asElement(e);closest(n,htmx.config.disableSelector)?cleanUpElement(n):issueAjaxRequest(o,a,n,t)}))}))}})),r}function addTriggerHandler(e,t,n,r){if("revealed"===t.trigger)initScrollHandler(),addEventListener(e,r,n,t),maybeReveal(asElement(e));else if("intersect"===t.trigger){const o={};t.root&&(o.root=querySelectorExt(e,t.root)),t.threshold&&(o.threshold=parseFloat(t.threshold)),new IntersectionObserver((function(t){for(let n=0;n0?(n.polling=!0,processPolling(asElement(e),r,t)):addEventListener(e,r,n,t)}function shouldProcessHxOn(e){const t=asElement(e);if(!t)return!1;const n=t.attributes;for(let e=0;e", "+e)).join(""))}return[]}function maybeSetLastButtonClicked(e){const t=closest(asElement(e.target),"button, input[type='submit']"),n=getRelatedFormData(e);n&&(n.lastButtonClicked=t)}function maybeUnsetLastButtonClicked(e){const t=getRelatedFormData(e);t&&(t.lastButtonClicked=null)}function getRelatedFormData(e){const t=closest(asElement(e.target),"button, input[type='submit']");if(!t)return;const n=resolveTarget("#"+getRawAttribute(t,"form"),t.getRootNode())||closest(t,"form");return n?getInternalData(n):void 0}function initButtonTracking(e){e.addEventListener("click",maybeSetLastButtonClicked),e.addEventListener("focusin",maybeSetLastButtonClicked),e.addEventListener("focusout",maybeUnsetLastButtonClicked)}function addHxOnEventHandler(e,t,n){const r=getInternalData(e);let o;Array.isArray(r.onHandlers)||(r.onHandlers=[]);const a=function(t){maybeEval(e,(function(){eltIsDisabled(e)||(o||(o=new Function("event",n)),o.call(e,t))}))};e.addEventListener(t,a),r.onHandlers.push({event:t,listener:a})}function processHxOnWildcard(e){deInitOnHandlers(e);for(let t=0;thtmx.config.historyCacheSize;)a.shift();for(;a.length>0;)try{localStorage.setItem("htmx-history-cache",JSON.stringify(a));break}catch(e){triggerErrorEvent(getDocument().body,"htmx:historyCacheError",{cause:e,cache:a}),a.shift()}}function getCachedHistory(e){if(!canAccessLocalStorage())return null;e=normalizePath(e);const t=parseJSON(localStorage.getItem("htmx-history-cache"))||[];for(let n=0;n=200&&this.status<400){triggerEvent(getDocument().body,"htmx:historyCacheMissLoad",n);const t=makeFragment(this.response),r=t.querySelector("[hx-history-elt],[data-hx-history-elt]")||t,o=getHistoryElement(),a=makeSettleInfo(o);handleTitle(t.title),swapInnerHTML(o,r,a),settleImmediately(a.tasks),currentPathForHistory=e,triggerEvent(getDocument().body,"htmx:historyRestore",{path:e,cacheMiss:!0,serverResponse:this.response})}else triggerErrorEvent(getDocument().body,"htmx:historyCacheMissLoadError",n)},t.send()}function restoreHistory(e){saveCurrentPageToHistory();const t=getCachedHistory(e=e||location.pathname+location.search);if(t){const n=makeFragment(t.content),r=getHistoryElement(),o=makeSettleInfo(r);handleTitle(n.title),swapInnerHTML(r,n,o),settleImmediately(o.tasks),getWindow().setTimeout((function(){window.scrollTo(0,t.scroll)}),0),currentPathForHistory=e,triggerEvent(getDocument().body,"htmx:historyRestore",{path:e,item:t})}else htmx.config.refreshOnHistoryMiss?window.location.reload(!0):loadHistoryFromServer(e)}function addRequestIndicatorClasses(e){let t=findAttributeTargets(e,"hx-indicator");return null==t&&(t=[e]),forEach(t,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)+1,e.classList.add.call(e.classList,htmx.config.requestClass)})),t}function disableElements(e){let t=findAttributeTargets(e,"hx-disabled-elt");return null==t&&(t=[]),forEach(t,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)+1,e.setAttribute("disabled",""),e.setAttribute("data-disabled-by-htmx","")})),t}function removeRequestIndicators(e,t){forEach(e,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)-1,0===t.requestCount&&e.classList.remove.call(e.classList,htmx.config.requestClass)})),forEach(t,(function(e){const t=getInternalData(e);t.requestCount=(t.requestCount||0)-1,0===t.requestCount&&(e.removeAttribute("disabled"),e.removeAttribute("data-disabled-by-htmx"))}))}function haveSeenNode(e,t){for(let n=0;nt.indexOf(e)<0)):r.filter((e=>e!==t)),n.delete(e),forEach(r,(t=>n.append(e,t)))}}function processInputValue(e,t,n,r,o){if(null!=r&&!haveSeenNode(e,r)){if(e.push(r),shouldInclude(r)){const e=getRawAttribute(r,"name");let a=r.value;r instanceof HTMLSelectElement&&r.multiple&&(a=toArray(r.querySelectorAll("option:checked")).map((function(e){return e.value}))),r instanceof HTMLInputElement&&r.files&&(a=toArray(r.files)),addValueToFormData(e,a,t),o&&validateElement(r,n)}r instanceof HTMLFormElement&&(forEach(r.elements,(function(r){e.indexOf(r)>=0?removeValueFromFormData(r.name,r.value,t):e.push(r),o&&validateElement(r,n)})),new FormData(r).forEach((function(e,n){e instanceof File&&""===e.name||addValueToFormData(n,e,t)})))}}function validateElement(e,t){const n=e;n.willValidate&&(triggerEvent(n,"htmx:validation:validate"),n.checkValidity()||(t.push({elt:n,message:n.validationMessage,validity:n.validity}),triggerEvent(n,"htmx:validation:failed",{message:n.validationMessage,validity:n.validity})))}function overrideFormData(e,t){for(const n of t.keys())e.delete(n);return t.forEach((function(t,n){e.append(n,t)})),e}function getInputValues(e,t){const n=[],r=new FormData,o=new FormData,a=[],s=getInternalData(e);s.lastButtonClicked&&!bodyContains(s.lastButtonClicked)&&(s.lastButtonClicked=null);let i=e instanceof HTMLFormElement&&!0!==e.noValidate||"true"===getAttributeValue(e,"hx-validate");if(s.lastButtonClicked&&(i=i&&!0!==s.lastButtonClicked.formNoValidate),"get"!==t&&processInputValue(n,o,a,closest(e,"form"),i),processInputValue(n,r,a,e,i),s.lastButtonClicked||"BUTTON"===e.tagName||"INPUT"===e.tagName&&"submit"===getRawAttribute(e,"type")){const t=s.lastButtonClicked||e;addValueToFormData(getRawAttribute(t,"name"),t.value,o)}return forEach(findAttributeTargets(e,"hx-include"),(function(e){processInputValue(n,r,a,asElement(e),i),matches(e,"form")||forEach(asParentNode(e).querySelectorAll(INPUT_SELECTOR),(function(e){processInputValue(n,r,a,e,i)}))})),overrideFormData(r,o),{errors:a,formData:r,values:formDataProxy(r)}}function appendParam(e,t,n){""!==e&&(e+="&"),"[object Object]"===String(n)&&(n=JSON.stringify(n));const r=encodeURIComponent(n);return e+(encodeURIComponent(t)+"=")+r}function urlEncode(e){e=formDataFromObject(e);let t="";return e.forEach((function(e,n){t=appendParam(t,n,e)})),t}function getHeaders(e,t,n){const r={"HX-Request":"true","HX-Trigger":getRawAttribute(e,"id"),"HX-Trigger-Name":getRawAttribute(e,"name"),"HX-Target":getAttributeValue(t,"id"),"HX-Current-URL":getDocument().location.href};return getValuesForElement(e,"hx-headers",!1,r),void 0!==n&&(r["HX-Prompt"]=n),getInternalData(e).boosted&&(r["HX-Boosted"]="true"),r}function filterValues(e,t){const n=getClosestAttributeValue(t,"hx-params");if(n){if("none"===n)return new FormData;if("*"===n)return e;if(0===n.indexOf("not "))return forEach(n.substr(4).split(","),(function(t){t=t.trim(),e.delete(t)})),e;{const t=new FormData;return forEach(n.split(","),(function(n){n=n.trim(),e.has(n)&&e.getAll(n).forEach((function(e){t.append(n,e)}))})),t}}return e}function isAnchorLink(e){return!!getRawAttribute(e,"href")&&getRawAttribute(e,"href").indexOf("#")>=0}function getSwapSpecification(e,t){const n=t||getClosestAttributeValue(e,"hx-swap"),r={swapStyle:getInternalData(e).boosted?"innerHTML":htmx.config.defaultSwapStyle,swapDelay:htmx.config.defaultSwapDelay,settleDelay:htmx.config.defaultSettleDelay};if(htmx.config.scrollIntoViewOnBoost&&getInternalData(e).boosted&&!isAnchorLink(e)&&(r.show="top"),n){const e=splitOnWhitespace(n);if(e.length>0)for(let t=0;t0?a.join(":"):null;r.scroll=e,r.scrollTarget=o}else if(0===n.indexOf("show:")){var a;const e=(a=n.substr(5).split(":")).pop();o=a.length>0?a.join(":"):null,r.show=e,r.showTarget=o}else if(0===n.indexOf("focus-scroll:")){const e=n.substr(13);r.focusScroll="true"==e}else 0==t?r.swapStyle=n:logError("Unknown modifier in hx-swap: "+n)}}return r}function usesFormData(e){return"multipart/form-data"===getClosestAttributeValue(e,"hx-encoding")||matches(e,"form")&&"multipart/form-data"===getRawAttribute(e,"enctype")}function encodeParamsForBody(e,t,n){let r=null;return withExtensions(t,(function(o){null==r&&(r=o.encodeParameters(e,n,t))})),null!=r?r:usesFormData(t)?overrideFormData(new FormData,formDataFromObject(n)):urlEncode(n)}function makeSettleInfo(e){return{tasks:[],elts:[e]}}function updateScrollState(e,t){const n=e[0],r=e[e.length-1];if(t.scroll){var o=null;t.scrollTarget&&(o=asElement(querySelectorExt(n,t.scrollTarget))),"top"===t.scroll&&(n||o)&&((o=o||n).scrollTop=0),"bottom"===t.scroll&&(r||o)&&((o=o||r).scrollTop=o.scrollHeight)}if(t.show){if(o=null,t.showTarget){let e=t.showTarget;"window"===t.showTarget&&(e="body"),o=asElement(querySelectorExt(n,e))}"top"===t.show&&(n||o)&&(o=o||n).scrollIntoView({block:"start",behavior:htmx.config.scrollBehavior}),"bottom"===t.show&&(r||o)&&(o=o||r).scrollIntoView({block:"end",behavior:htmx.config.scrollBehavior})}}function getValuesForElement(e,t,n,r){if(null==r&&(r={}),null==e)return r;const o=getAttributeValue(e,t);if(o){let t,a=o.trim(),s=n;if("unset"===a)return null;0===a.indexOf("javascript:")?(a=a.substr(11),s=!0):0===a.indexOf("js:")&&(a=a.substr(3),s=!0),0!==a.indexOf("{")&&(a="{"+a+"}"),t=s?maybeEval(e,(function(){return Function("return ("+a+")")()}),{}):parseJSON(a);for(const e in t)t.hasOwnProperty(e)&&null==r[e]&&(r[e]=t[e])}return getValuesForElement(asElement(parentElt(e)),t,n,r)}function maybeEval(e,t,n){return htmx.config.allowEval?t():(triggerErrorEvent(e,"htmx:evalDisallowedError"),n)}function getHXVarsForElement(e,t){return getValuesForElement(e,"hx-vars",!0,t)}function getHXValsForElement(e,t){return getValuesForElement(e,"hx-vals",!1,t)}function getExpressionVars(e){return mergeObjects(getHXVarsForElement(e),getHXValsForElement(e))}function safelySetHeaderValue(e,t,n){if(null!==n)try{e.setRequestHeader(t,n)}catch(r){e.setRequestHeader(t,encodeURIComponent(n)),e.setRequestHeader(t+"-URI-AutoEncoded","true")}}function getPathFromResponse(e){if(e.responseURL&&"undefined"!=typeof URL)try{const t=new URL(e.responseURL);return t.pathname+t.search}catch(t){triggerErrorEvent(getDocument().body,"htmx:badResponseUrl",{url:e.responseURL})}}function hasHeader(e,t){return t.test(e.getAllResponseHeaders())}function ajaxHelper(e,t,n){return e=e.toLowerCase(),n?n instanceof Element||"string"==typeof n?issueAjaxRequest(e,t,null,null,{targetOverride:resolveTarget(n),returnPromise:!0}):issueAjaxRequest(e,t,resolveTarget(n.source),n.event,{handler:n.handler,headers:n.headers,values:n.values,targetOverride:resolveTarget(n.target),swapOverride:n.swap,select:n.select,returnPromise:!0}):issueAjaxRequest(e,t,null,null,{returnPromise:!0})}function hierarchyForElt(e){const t=[];for(;e;)t.push(e),e=e.parentElement;return t}function verifyPath(e,t,n){let r,o;return"function"==typeof URL?(o=new URL(t,document.location.href),r=document.location.origin===o.origin):(o=t,r=startsWith(t,document.location.origin)),!(htmx.config.selfRequestsOnly&&!r)&&triggerEvent(e,"htmx:validateUrl",mergeObjects({url:o,sameHost:r},n))}function formDataFromObject(e){if(e instanceof FormData)return e;const t=new FormData;for(const n in e)e.hasOwnProperty(n)&&("function"==typeof e[n].forEach?e[n].forEach((function(e){t.append(n,e)})):"object"!=typeof e[n]||e[n]instanceof Blob?t.append(n,e[n]):t.append(n,JSON.stringify(e[n])));return t}function formDataArrayProxy(e,t,n){return new Proxy(n,{get:function(n,r){return"number"==typeof r?n[r]:"length"===r?n.length:"push"===r?function(r){n.push(r),e.append(t,r)}:"function"==typeof n[r]?function(){n[r].apply(n,arguments),e.delete(t),n.forEach((function(n){e.append(t,n)}))}:n[r]&&1===n[r].length?n[r][0]:n[r]},set:function(n,r,o){return n[r]=o,e.delete(t),n.forEach((function(n){e.append(t,n)})),!0}})}function formDataProxy(e){return new Proxy(e,{get:function(t,n){if("symbol"==typeof n)return Reflect.get(t,n);if("toJSON"===n)return()=>Object.fromEntries(e);if(n in t)return"function"==typeof t[n]?function(){return e[n].apply(e,arguments)}:t[n];const r=e.getAll(n);return 0===r.length?void 0:1===r.length?r[0]:formDataArrayProxy(t,n,r)},set:function(e,t,n){return"string"==typeof t&&(e.delete(t),"function"==typeof n.forEach?n.forEach((function(n){e.append(t,n)})):"object"!=typeof n||n instanceof Blob?e.append(t,n):e.append(t,JSON.stringify(n)),!0)},deleteProperty:function(e,t){return"string"==typeof t&&e.delete(t),!0},ownKeys:function(e){return Reflect.ownKeys(Object.fromEntries(e))},getOwnPropertyDescriptor:function(e,t){return Reflect.getOwnPropertyDescriptor(Object.fromEntries(e),t)}})}function issueAjaxRequest(e,t,n,r,o,a){let s=null,i=null;if((o=null!=o?o:{}).returnPromise&&"undefined"!=typeof Promise)var l=new Promise((function(e,t){s=e,i=t}));null==n&&(n=getDocument().body);const c=o.handler||handleAjaxResponse,u=o.select||null;if(!bodyContains(n))return maybeCall(s),l;const f=o.targetOverride||asElement(getTarget(n));if(null==f||f==DUMMY_ELT)return triggerErrorEvent(n,"htmx:targetError",{target:getAttributeValue(n,"hx-target")}),maybeCall(i),l;let d=getInternalData(n);const g=d.lastButtonClicked;if(g){const n=getRawAttribute(g,"formaction");null!=n&&(t=n);const r=getRawAttribute(g,"formmethod");null!=r&&"dialog"!==r.toLowerCase()&&(e=r)}const h=getClosestAttributeValue(n,"hx-confirm");if(void 0===a&&!1===triggerEvent(n,"htmx:confirm",{target:f,elt:n,path:t,verb:e,triggeringEvent:r,etc:o,issueRequest:function(a){return issueAjaxRequest(e,t,n,r,o,!!a)},question:h}))return maybeCall(s),l;let m=n,p=getClosestAttributeValue(n,"hx-sync"),E=null,b=!1;if(p){const e=p.split(":"),t=e[0].trim();if(m="this"===t?findThisElement(n,"hx-sync"):asElement(querySelectorExt(n,t)),p=(e[1]||"drop").trim(),d=getInternalData(m),"drop"===p&&d.xhr&&!0!==d.abortable)return maybeCall(s),l;if("abort"===p){if(d.xhr)return maybeCall(s),l;b=!0}else"replace"===p?triggerEvent(m,"htmx:abort"):0===p.indexOf("queue")&&(E=(p.split(" ")[1]||"last").trim())}if(d.xhr){if(!d.abortable){if(null==E){if(r){const e=getInternalData(r);e&&e.triggerSpec&&e.triggerSpec.queue&&(E=e.triggerSpec.queue)}null==E&&(E="last")}return null==d.queuedRequests&&(d.queuedRequests=[]),"first"===E&&0===d.queuedRequests.length||"all"===E?d.queuedRequests.push((function(){issueAjaxRequest(e,t,n,r,o)})):"last"===E&&(d.queuedRequests=[],d.queuedRequests.push((function(){issueAjaxRequest(e,t,n,r,o)}))),maybeCall(s),l}triggerEvent(m,"htmx:abort")}const x=new XMLHttpRequest;d.xhr=x,d.abortable=b;const y=function(){d.xhr=null,d.abortable=!1,null!=d.queuedRequests&&d.queuedRequests.length>0&&d.queuedRequests.shift()()},v=getClosestAttributeValue(n,"hx-prompt");if(v){var w=prompt(v);if(null===w||!triggerEvent(n,"htmx:prompt",{prompt:w,target:f}))return maybeCall(s),y(),l}if(h&&!a&&!confirm(h))return maybeCall(s),y(),l;let S=getHeaders(n,f,w);"get"===e||usesFormData(n)||(S["Content-Type"]="application/x-www-form-urlencoded"),o.headers&&(S=mergeObjects(S,o.headers));const A=getInputValues(n,e);let C=A.errors;const T=A.formData;o.values&&overrideFormData(T,formDataFromObject(o.values));const H=overrideFormData(T,formDataFromObject(getExpressionVars(n)));let R=filterValues(H,n);htmx.config.getCacheBusterParam&&"get"===e&&R.set("org.htmx.cache-buster",getRawAttribute(f,"id")||"true"),null!=t&&""!==t||(t=getDocument().location.href);const O=getValuesForElement(n,"hx-request"),I=getInternalData(n).boosted;let D=htmx.config.methodsThatUseUrlParams.indexOf(e)>=0;const _={boosted:I,useUrlParams:D,formData:R,parameters:formDataProxy(R),unfilteredFormData:H,unfilteredParameters:formDataProxy(H),headers:S,target:f,verb:e,errors:C,withCredentials:o.credentials||O.credentials||htmx.config.withCredentials,timeout:o.timeout||O.timeout||htmx.config.timeout,path:t,triggeringEvent:r};if(!triggerEvent(n,"htmx:configRequest",_))return maybeCall(s),y(),l;if(t=_.path,e=_.verb,S=_.headers,R=formDataFromObject(_.parameters),C=_.errors,D=_.useUrlParams,C&&C.length>0)return triggerEvent(n,"htmx:validation:halted",_),maybeCall(s),y(),l;const N=t.split("#"),L=N[0],q=N[1];let P=t;if(D&&(P=L,!R.keys().next().done&&(P.indexOf("?")<0?P+="?":P+="&",P+=urlEncode(R),q&&(P+="#"+q))),!verifyPath(n,P,_))return triggerErrorEvent(n,"htmx:invalidPath",_),maybeCall(i),l;if(x.open(e.toUpperCase(),P,!0),x.overrideMimeType("text/html"),x.withCredentials=_.withCredentials,x.timeout=_.timeout,O.noHeaders);else for(const e in S)if(S.hasOwnProperty(e)){const t=S[e];safelySetHeaderValue(x,e,t)}const F={xhr:x,target:f,requestConfig:_,etc:o,boosted:I,select:u,pathInfo:{requestPath:t,finalRequestPath:P,responsePath:null,anchor:q}};if(x.onload=function(){try{const e=hierarchyForElt(n);if(F.pathInfo.responsePath=getPathFromResponse(x),c(n,F),!0!==F.keepIndicators&&removeRequestIndicators(k,M),triggerEvent(n,"htmx:afterRequest",F),triggerEvent(n,"htmx:afterOnLoad",F),!bodyContains(n)){let t=null;for(;e.length>0&&null==t;){const n=e.shift();bodyContains(n)&&(t=n)}t&&(triggerEvent(t,"htmx:afterRequest",F),triggerEvent(t,"htmx:afterOnLoad",F))}maybeCall(s),y()}catch(e){throw triggerErrorEvent(n,"htmx:onLoadError",mergeObjects({error:e},F)),e}},x.onerror=function(){removeRequestIndicators(k,M),triggerErrorEvent(n,"htmx:afterRequest",F),triggerErrorEvent(n,"htmx:sendError",F),maybeCall(i),y()},x.onabort=function(){removeRequestIndicators(k,M),triggerErrorEvent(n,"htmx:afterRequest",F),triggerErrorEvent(n,"htmx:sendAbort",F),maybeCall(i),y()},x.ontimeout=function(){removeRequestIndicators(k,M),triggerErrorEvent(n,"htmx:afterRequest",F),triggerErrorEvent(n,"htmx:timeout",F),maybeCall(i),y()},!triggerEvent(n,"htmx:beforeRequest",F))return maybeCall(s),y(),l;var k=addRequestIndicatorClasses(n),M=disableElements(n);forEach(["loadstart","loadend","progress","abort"],(function(e){forEach([x,x.upload],(function(t){t.addEventListener(e,(function(t){triggerEvent(n,"htmx:xhr:"+e,{lengthComputable:t.lengthComputable,loaded:t.loaded,total:t.total})}))}))})),triggerEvent(n,"htmx:beforeSend",F);const V=D?null:encodeParamsForBody(x,n,R);return x.send(V),l}function determineHistoryUpdates(e,t){const n=t.xhr;let r=null,o=null;if(hasHeader(n,/HX-Push:/i)?(r=n.getResponseHeader("HX-Push"),o="push"):hasHeader(n,/HX-Push-Url:/i)?(r=n.getResponseHeader("HX-Push-Url"),o="push"):hasHeader(n,/HX-Replace-Url:/i)&&(r=n.getResponseHeader("HX-Replace-Url"),o="replace"),r)return"false"===r?{}:{type:o,path:r};const a=t.pathInfo.finalRequestPath,s=t.pathInfo.responsePath,i=getClosestAttributeValue(e,"hx-push-url"),l=getClosestAttributeValue(e,"hx-replace-url"),c=getInternalData(e).boosted;let u=null,f=null;return i?(u="push",f=i):l?(u="replace",f=l):c&&(u="push",f=s||a),f?"false"===f?{}:("true"===f&&(f=s||a),t.pathInfo.anchor&&-1===f.indexOf("#")&&(f=f+"#"+t.pathInfo.anchor),{type:u,path:f}):{}}function codeMatches(e,t){return new RegExp(e.code).test(t.toString(10))}function resolveResponseHandling(e){for(var t=0;t0?getWindow().setTimeout(u,E.swapDelay):u()}f&&triggerErrorEvent(e,"htmx:responseError",mergeObjects({error:"Response Status Error Code "+n.status+" from "+t.pathInfo.requestPath},t))}}const extensions={};function extensionBase(){return{init:function(e){return null},getSelectors:function(){return null},onEvent:function(e,t){return!0},transformResponse:function(e,t,n){return e},isInlineSwap:function(e){return!1},handleSwap:function(e,t,n,r){return!1},encodeParameters:function(e,t,n){return null}}}function defineExtension(e,t){t.init&&t.init(internalAPI),extensions[e]=mergeObjects(extensionBase(),t)}function removeExtension(e){delete extensions[e]}function getExtensions(e,t,n){if(null==t&&(t=[]),null==e)return t;null==n&&(n=[]);const r=getAttributeValue(e,"hx-ext");return r&&forEach(r.split(","),(function(e){if("ignore:"!=(e=e.replace(/ /g,"")).slice(0,7)){if(n.indexOf(e)<0){const n=extensions[e];n&&t.indexOf(n)<0&&t.push(n)}}else n.push(e.slice(7))})),getExtensions(asElement(parentElt(e)),t,n)}var isReady=!1;function ready(e){isReady||"complete"===getDocument().readyState?e():getDocument().addEventListener("DOMContentLoaded",e)}function insertIndicatorStyles(){if(!1!==htmx.config.includeIndicatorStyles){const e=htmx.config.inlineStyleNonce?` nonce="${htmx.config.inlineStyleNonce}"`:"";getDocument().head.insertAdjacentHTML("beforeend"," ."+htmx.config.indicatorClass+"{opacity:0} ."+htmx.config.requestClass+" ."+htmx.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;} ."+htmx.config.requestClass+"."+htmx.config.indicatorClass+"{opacity:1; transition: opacity 200ms ease-in;} ")}}function getMetaConfig(){const e=getDocument().querySelector('meta[name="htmx-config"]');return e?parseJSON(e.content):null}function mergeMetaConfig(){const e=getMetaConfig();e&&(htmx.config=mergeObjects(htmx.config,e))}return getDocument().addEventListener("DOMContentLoaded",(function(){isReady=!0})),ready((function(){mergeMetaConfig(),insertIndicatorStyles();let e=getDocument().body;processNode(e);const t=getDocument().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",(function(e){const t=getInternalData(e.target);t&&t.xhr&&t.xhr.abort()}));const n=window.onpopstate?window.onpopstate.bind(window):null;window.onpopstate=function(e){e.state&&e.state.htmx?(restoreHistory(),forEach(t,(function(e){triggerEvent(e,"htmx:restored",{document:getDocument(),triggerEvent})}))):n&&n(e)},getWindow().setTimeout((function(){triggerEvent(e,"htmx:load",{}),e=null}),0)})),htmx}();const __WEBPACK_DEFAULT_EXPORT__=htmx}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var __webpack_exports__={},htmx=__webpack_require__(335);let tool={indexOf:function(e){return Array.prototype.indexOf.call(e.parentNode.children,e)},escapeHTML:function(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}};const src_tool=tool;htmx.A.defineExtension("bny-tab",{onEvent:function(e,t){return"htmx:beforeProcessNode"===e?function(e){const t=e.target;return null===t||!e.target.classList.contains("bny-tab")||(htmx.A.findAll(".bny-tab-item",t).forEach((e=>{htmx.A.on(e,"click",(function(){const e=src_tool.indexOf(this),t=this.parentNode.parentNode,n=htmx.A.find(t,`.bny-tab-body>div:nth-child(${e+1})`);htmx.A.findAll(t,".bny-tab-title .this").forEach((async function(e){e.classList.remove("this")})),htmx.A.findAll(t,".bny-tab-body .this").forEach((async function(e){e.classList.remove("this")})),htmx.A.addClass(this,"this"),htmx.A.addClass(n,"this"),htmx.A.process(n)}))})),!1)}(t):"htmx:afterProcessNode"===e?(function(e){const t=e.target;if(null!==t&&t.classList.contains("bny-tab-body")){const e=htmx.A.findAll(t.parentNode,".bny-tab-title .bny-tab-item").length,n=htmx.A.findAll(t,"div").length;if(e-n>0)for(let r=0;rdiv:nth-child(${n+1})`);200===e.detail.xhr.status?htmx.A.swap(r,e.detail.serverResponse,{swapStyle:"innerHTML"}):htmx.A.swap(r,"网络错误...",{swapStyle:"innerHTML"})}}(t),!1):void 0}}),htmx.A.defineExtension("bny-card",{onEvent:function(e,t){if("htmx:beforeSwap"===e){if(200===t.detail.xhr.status){const e=JSON.parse(t.detail.serverResponse);if(1===e.code){const n=e.data,r=n&&n.body?`\n

    ${n.body.title||""}

    \n
    ${n.body.subtitle||""}
    \n

    ${n.body.text||""}

    \n `:"";t.detail.elt.innerHTML=`\n
    \n ${n&&n.top_img?``:""}\n ${n&&n.header?`
    ${n.header}
    `:""}\n
    ${r}
    \n ${n&&n.footer?``:""}\n ${n&&n.bottom_img?``:""}\n
    `}else t.detail.elt.innerHTML=`
    ${data.msg}
    `}else t.detail.elt.innerHTML='
    网络错误
    ';return!1}}}),htmx.A.defineExtension("bny-code",{onEvent:function(e,t){if(null!==t.target&&"htmx:beforeSwap"===e){const e=t.target.getAttribute("hx-swap")||"innerHTML";if(200===t.detail.xhr.status){const n=`
    ${src_tool.escapeHTML(t.detail.serverResponse)}
    `;htmx.A.swap(t.target,n,{swapStyle:e})}else htmx.A.swap(t.target,"网络错误...",{swapStyle:e});return!1}}}),htmx.A.defineExtension("bny-marquee",{onEvent:function(e,t){if("htmx:beforeProcessNode"===e&&t.target.classList.contains("bny-marquee")){const e=t.target.getAttribute("speed")||50;let o=htmx.A.find(t.target,".bny-marquee-content");var n=o.parentNode.offsetWidth,r=(o.offsetWidth+n)/Number(e);return o.style.animationDuration=r+"s",!1}}}),htmx.A.defineExtension("bny-alert",{onEvent:function(e,t){if("htmx:beforeProcessNode"===e){const e=t.target;let n=document.createElement("span");n.setAttribute("class","alert-del"),n.textContent="X",e.append(n),htmx.A.on(n,"click",(function(){this.parentNode.style.opacity=0,setTimeout((()=>{this.parentNode.remove()}),235)}))}}}),function(){function e(t){let n="";return t.forEach((t=>{const r=t.icon?``:"",o=t.children?`${e(t.children)}`:"",a=t.url?t.url:"javascript:;",s=t.title?`${t.title}`:"";n+=`
  • ${r}${s}${o}
  • `})),n}function t(t){const n=t.target.getAttribute("hx-swap")||"innerHTML",r=null!==t.target.getAttribute("vertical")?"vertical":"";if(200===t.detail.xhr.status){const o=JSON.parse(t.detail.serverResponse);if(1===o.code){const a=o.data;htmx.A.swap(t.detail.elt,`${e(a)}`,{swapStyle:n})}else htmx.A.swap(t.detail.elt,`加载失败${o.msg}...`,{swapStyle:n})}else htmx.A.swap(t.detail.elt,"网络错误...",{swapStyle:n})}htmx.A.defineExtension("bny-menu",{onEvent:function(e,n){null!==n.target&&"htmx:beforeSwap"===e&&t(n)}})}(),window.htmx=htmx.A})(); \ No newline at end of file diff --git a/doc/alert.html b/doc/alert.html deleted file mode 100644 index 014c570..0000000 --- a/doc/alert.html +++ /dev/null @@ -1,34 +0,0 @@ -
    -

    静态:

    -
    - 警示信息alert-primary -
    -
    - 警示信息alert-secondary -
    -
    - 警示信息alert-success -
    -
    - 警示信息alert-warning -
    -
    - 警示信息alert-danger -
    -

    动态:

    -
    - 警示信息alert-primary -
    -
    - 警示信息alert-secondary -
    -
    - 警示信息alert-success -
    -
    - 警示信息alert-warning -
    -
    - 警示信息alert-danger -
    -
    \ No newline at end of file diff --git a/doc/alert.md b/doc/alert.md new file mode 100644 index 0000000..4d132cd --- /dev/null +++ b/doc/alert.md @@ -0,0 +1,75 @@ +静态: + +
    + 警示信息alert-primary +
    +
    + 警示信息alert-secondary +
    +
    + 警示信息alert-success +
    +
    + 警示信息alert-warning +
    +
    + 警示信息alert-danger +
    + +代码: + +```html +
    + 警示信息alert-primary +
    +
    + 警示信息alert-secondary +
    +
    + 警示信息alert-success +
    +
    + 警示信息alert-warning +
    +
    + 警示信息alert-danger +
    +``` + +动态: + +
    + 警示信息alert-primary +
    +
    + 警示信息alert-secondary +
    +
    + 警示信息alert-success +
    +
    + 警示信息alert-warning +
    +
    + 警示信息alert-danger +
    + +代码: + +```html +
    + 警示信息alert-primary +
    +
    + 警示信息alert-secondary +
    +
    + 警示信息alert-success +
    +
    + 警示信息alert-warning +
    +
    + 警示信息alert-danger +
    +``` \ No newline at end of file diff --git a/doc/btn.html b/doc/btn.html deleted file mode 100644 index 6ed66fb..0000000 --- a/doc/btn.html +++ /dev/null @@ -1,48 +0,0 @@ -
    - - - - - - - -
    - - - - - - - -
    - a标签按钮 - a标签按钮 - a标签按钮 - a禁用按钮 -
    - - - - - - -
    -
    - - - -
    -
    - - - -
    -
    \ No newline at end of file diff --git a/doc/btn.md b/doc/btn.md new file mode 100644 index 0000000..19a897d --- /dev/null +++ b/doc/btn.md @@ -0,0 +1,117 @@ + + + + + + + +
    + +代码: + +```html + + + + + + + +``` + + + + + + + + +
    + +代码: + +```html + + + + + + + +``` + +a标签按钮 +a标签按钮 +a标签按钮 +a禁用按钮 +
    + +代码: + +```html +a标签按钮 +a标签按钮 +a标签按钮 +a禁用按钮 +``` + + + + + + + +
    + +代码: + +```html + + + + + + +``` + +
    + + + +
    +
    + + + +
    + +代码: + +```html +
    + + + +
    +
    + + + +
    +``` \ No newline at end of file diff --git a/doc/card.html b/doc/card.html deleted file mode 100644 index f77c9e3..0000000 --- a/doc/card.html +++ /dev/null @@ -1,60 +0,0 @@ -
    -
    - Card example image -
    -

    欢迎光临兔子卡片!

    -
    奈斯小标题。
    -

    注意,本例中的卡片宽度已设置为20rem,否则它将尝试填充卡片所在的当前容器/行。

    - -
    -
    -
    -
    -
    -

    欢迎光临兔子卡片!

    -
    奈斯小标题。
    -

    注意,本例中的卡片宽度已设置为20rem,否则它将尝试填充卡片所在的当前容器/行。

    - -
    - Card example image -
    -
    -
    -
    -

    欢迎光临兔子卡片!

    -
    奈斯小标题。
    -

    注意,本例中的卡片宽度已设置为20rem,否则它将尝试填充卡片所在的当前容器/行。

    - 第一link - 第二link -
    -
    -
    -
    -
    - 头部 -
    -
    -

    欢迎光临兔子卡片!

    -
    奈斯小标题。
    -

    注意,本例中的卡片宽度已设置为20rem,否则它将尝试填充卡片所在的当前容器/行。

    - -
    - -
    -
    - -

    htmx ext

    -
    - 加载中 -
    -
    -
    - 加载中 -
    -
    -
    - 加载中 -
    -
    \ No newline at end of file diff --git a/doc/card.md b/doc/card.md new file mode 100644 index 0000000..2121e03 --- /dev/null +++ b/doc/card.md @@ -0,0 +1,214 @@ +### 静态 +#### 卡片一: + +
    + Card example image +
    +

    欢迎光临兔子卡片!

    +
    奈斯小标题。
    +

    注意,本例中的卡片宽度已设置为20rem,否则它将尝试填充卡片所在的当前容器/行。

    + +
    +
    +
    + +代码: + +```html +
    + Card example image +
    +

    欢迎光临兔子卡片!

    +
    奈斯小标题。
    +

    注意,本例中的卡片宽度已设置为20rem,否则它将尝试填充卡片所在的当前容器/行。

    + +
    +
    +``` + +#### 卡片二: + +
    +
    +

    欢迎光临兔子卡片!

    +
    奈斯小标题。
    +

    注意,本例中的卡片宽度已设置为20rem,否则它将尝试填充卡片所在的当前容器/行。

    + +
    + Card example image +
    +
    + +代码: + +```html +
    +
    +

    欢迎光临兔子卡片!

    +
    奈斯小标题。
    +

    注意,本例中的卡片宽度已设置为20rem,否则它将尝试填充卡片所在的当前容器/行。

    + +
    + Card example image +
    +``` + +#### 卡片三: + +
    +
    +

    欢迎光临兔子卡片!

    +
    奈斯小标题。
    +

    注意,本例中的卡片宽度已设置为20rem,否则它将尝试填充卡片所在的当前容器/行。

    + 第一link + 第二link +
    +
    +
    + +代码: + +```html +
    +
    +

    欢迎光临兔子卡片!

    +
    奈斯小标题。
    +

    注意,本例中的卡片宽度已设置为20rem,否则它将尝试填充卡片所在的当前容器/行。

    + 第一link + 第二link +
    +
    +``` + +#### 卡片四: + +
    +
    + 头部 +
    +
    +

    欢迎光临兔子卡片!

    +
    奈斯小标题。
    +

    注意,本例中的卡片宽度已设置为20rem,否则它将尝试填充卡片所在的当前容器/行。

    + +
    + +
    +
    + +代码: + +```html +
    +
    + 头部 +
    +
    +

    欢迎光临兔子卡片!

    +
    奈斯小标题。
    +

    注意,本例中的卡片宽度已设置为20rem,否则它将尝试填充卡片所在的当前容器/行。

    + +
    + +
    +``` + +### 动态 +#### 卡片五: + +
    + 加载中 +
    +
    + +html代码: + +```html +
    + 加载中 +
    +``` + +json代码: + +```json +{ + "code": 1, + "data": { + "body": { + "title": "我的远程标题", + "subtitle":"远程小白兔", + "text":"我的远程内容,注意格式要求哦~" + } + }, + "msg": "请求成功" +} +``` + +#### 卡片六: + +
    + 加载中 +
    +
    + +html代码: + +```html +
    + 加载中 +
    +``` + +json代码: + +```json +{ + "code": 1, + "data": { + "header": "远程头部内容", + "body": { + "title": "我的远程标题", + "subtitle": "远程小白兔", + "text": "我的远程内容,注意格式要求哦~" + }, + "footer": "远程底部内容" + }, + "msg": "请求成功" +} +``` + +#### 卡片七: + +
    + 加载中 +
    + +html代码: + +```html +
    + 加载中 +
    +``` + +json代码: + +```json +{ + "code": 1, + "data": { + "top_img": "https://unsplash.it/550/250", + "body": { + "title": "我的远程标题", + "subtitle": "远程小白兔", + "text": "我的远程内容,注意格式要求哦~" + } + }, + "msg": "请求成功" +} +``` \ No newline at end of file diff --git a/doc/class.html b/doc/class.md similarity index 100% rename from doc/class.html rename to doc/class.md diff --git a/doc/code.html b/doc/code.html deleted file mode 100644 index dd8b515..0000000 --- a/doc/code.html +++ /dev/null @@ -1,8 +0,0 @@ -
    -

    静态:

    -
    function add(x, y) {
    -    return x + y;
    -}
    -

    动态:

    -
    -
    \ No newline at end of file diff --git a/doc/code.md b/doc/code.md new file mode 100644 index 0000000..0acaba7 --- /dev/null +++ b/doc/code.md @@ -0,0 +1,31 @@ +### 静态 + +
    function add(x, y) {
    +return x + y;
    +}
    + +代码: + +```html +
    function add(x, y) {
    +return x + y;
    +}
    +``` + +### 动态 + +
    + +html代码: + +```html +
    +``` + +文件代码: + +```php + -

    字体

    -
    -
    - 默认 -
    -
    - 蓝色 -
    -
    - 绿色 -
    -
    - 黄色 -
    -
    - 红色 -
    -
    - 灰色 -
    -
    - 白色 -
    -
    -

    背景色

    -
    -
    - 蓝色 -
    -
    - 绿色 -
    -
    - 黄色 -
    -
    - 红色 -
    -
    - 灰色 -
    -
    - 白色 -
    -
    - 黑色 -
    -
    - \ No newline at end of file diff --git a/doc/color.md b/doc/color.md new file mode 100644 index 0000000..087c09d --- /dev/null +++ b/doc/color.md @@ -0,0 +1,106 @@ +#### 颜色 + +
    +
    + 默认 +
    +
    + 蓝色 +
    +
    + 绿色 +
    +
    + 黄色 +
    +
    + 红色 +
    +
    + 灰色 +
    +
    + 白色 +
    +
    + +代码: +```html +
    +
    + 默认 +
    +
    + 蓝色 +
    +
    + 绿色 +
    +
    + 黄色 +
    +
    + 红色 +
    +
    + 灰色 +
    +
    + 白色 +
    +
    +``` + +#### 背景色 + +
    +
    + 蓝色 +
    +
    + 绿色 +
    +
    + 黄色 +
    +
    + 红色 +
    +
    + 灰色 +
    +
    + 白色 +
    +
    + 黑色 +
    +
    + +代码: + +```html +
    +
    + 蓝色 +
    +
    + 绿色 +
    +
    + 黄色 +
    +
    + 红色 +
    +
    + 灰色 +
    +
    + 白色 +
    +
    + 黑色 +
    +
    +``` \ No newline at end of file diff --git a/doc/flexbox.html b/doc/flexbox.md similarity index 52% rename from doc/flexbox.html rename to doc/flexbox.md index b263e29..1da032d 100644 --- a/doc/flexbox.html +++ b/doc/flexbox.md @@ -70,4 +70,80 @@ luctus erat posuere. Curabitur ac turpis aliquam, malesuada elit suscipit, blandit dolor. - \ No newline at end of file + + +代码: + +```html +
    + 弹性网格是一种网格系统,每行最多支持12列。因为它使用了flexbox(而不仅仅是%widths),我们也从flexbox的有趣部分中获益,比如以比普通方式更复杂的方式对齐。 +
    +
    +
    col-4 col
    +
    col-4 col
    +
    col-4 col
    +
    +
    +
    col-3 col
    +
    col-9 col
    +
    +
    +
    sm-6 md-8 lg-10 col
    +
    sm-6 md-4 lg-2 col
    +
    +
    +
    sm-5 col
    +
    col-fill col
    +
    col-fill col
    +
    +
    +
    Aligned
    +
    Left (default)
    +
    +
    +
    Aligned
    +
    Right (flex-right)
    +
    +
    +
    Aligned
    +
    Center (flex-center)
    +
    +
    +
    Aligned
    +
    to edges (flex-edges)
    +
    +
    +
    Aligned
    +
    to be evenly spaced (flex-spaces)
    +
    +
    +
    Aligned top
    +
    + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras lorem lectus, lobortis a nibh non, luctus + luctus erat posuere. Curabitur ac turpis aliquam, malesuada elit suscipit, blandit dolor. +
    +
    +
    +
    Aligned middle
    +
    + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras lorem lectus, lobortis a nibh non, luctus + luctus erat posuere. Curabitur ac turpis aliquam, malesuada elit suscipit, blandit dolor. +
    +
    +
    +
    Aligned bottom
    +
    + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras lorem lectus, lobortis a nibh non, luctus + luctus erat posuere. Curabitur ac turpis aliquam, malesuada elit suscipit, blandit dolor. +
    +
    +
    +
    Align bottom
    +
    Align middle
    +
    Align top
    +
    + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras lorem lectus, lobortis a nibh non, luctus + luctus erat posuere. Curabitur ac turpis aliquam, malesuada elit suscipit, blandit dolor. +
    +
    +``` \ No newline at end of file diff --git a/doc/form.html b/doc/form.md similarity index 54% rename from doc/form.html rename to doc/form.md index 8a55207..c4ec569 100644 --- a/doc/form.html +++ b/doc/form.md @@ -7,7 +7,6 @@

    -
    @@ -38,7 +37,6 @@
    -
    -
    -
    - - \ No newline at end of file + + +代码: + +```html +
    + + + +
    + +
    +
    + + +
    +
    + + +
    +
    +
    + + +
    +
    + + +
    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + + + +
    +
    + + + +
    +
    +``` \ No newline at end of file diff --git a/doc/list.html b/doc/list.md similarity index 52% rename from doc/list.html rename to doc/list.md index e6388ec..527177b 100644 --- a/doc/list.html +++ b/doc/list.md @@ -27,9 +27,7 @@

    Ordered Lists

  • But don't forget this
  • -

    Unordered Lists

    -
    • Let's try this
    • Let's try this again @@ -54,13 +52,76 @@

      Unordered Lists

    • And now we're are the top!
    -

    Inline List

    -
    • Item 1
    • Item 2
    • Item 3
    • Item 4
    - \ No newline at end of file + + +代码: + +```html +

    Ordered Lists

    +
      +
    1. Do this
    2. +
    3. Then this
    4. +
    5. Finally this
    6. +
    7. Then we'll go one deeper +
        +
      1. Dillon
      2. +
      3. Francis +
          +
        1. What if we went...
        2. +
        3. One more deeper? +
            +
          1. DJ
          2. +
          3. Hanzel +
              +
            1. Five levels should be enough
            2. +
            3. Right?
            4. +
            +
          4. +
          +
        4. +
        +
      4. +
      +
    8. +
    9. But don't forget this
    10. +
    +

    Unordered Lists

    +
      +
    • Let's try this
    • +
    • Let's try this again +
        +
      • And now we are nested
      • +
      • Pretty cool? +
          +
        • The list items are just text
        • +
        • From this font +
            +
          • We'll keep going
          • +
          • Until we hit +
              +
            • LEVEL 5
            • +
            +
          • +
          +
        • +
        +
      • +
      +
    • +
    • And now we're are the top!
    • +
    +

    Inline List

    +
      +
    • Item 1
    • +
    • Item 2
    • +
    • Item 3
    • +
    • Item 4
    • +
    +``` \ No newline at end of file diff --git a/doc/marquee.html b/doc/marquee.html deleted file mode 100644 index 2264e33..0000000 --- a/doc/marquee.html +++ /dev/null @@ -1,22 +0,0 @@ -
    -

    走马灯:

    -
    -
    - 这里是您想要滚动的文本内容,可以是新闻、公告等。 -
    -
    -
    -
    -
    - 我这个速度更快,属性speed默认50,我这个100。 -
    -
    -
    -
    -
    -
    - logo -
    -
    -
    -
    \ No newline at end of file diff --git a/doc/marquee.md b/doc/marquee.md new file mode 100644 index 0000000..53e342b --- /dev/null +++ b/doc/marquee.md @@ -0,0 +1,54 @@ +

    走马灯:

    +
    +
    + 这里是您想要滚动的文本内容,可以是新闻、公告等。 +
    +
    + +代码: + +```html +
    +
    + 这里是您想要滚动的文本内容,可以是新闻、公告等。 +
    +
    +``` + +
    +
    +
    + 我这个速度更快,属性speed默认50,我这个100。 +
    +
    + +代码: + +```html +
    +
    + 我这个速度更快,属性speed默认50,我这个100。 +
    +
    +``` + +
    +
    +
    +
    + logo +
    +
    +
    + +代码: + +```html +
    +
    +
    + logo +
    +
    +
    +``` \ No newline at end of file diff --git a/doc/menu.html b/doc/menu.html deleted file mode 100644 index 6ce0cdc..0000000 --- a/doc/menu.html +++ /dev/null @@ -1,121 +0,0 @@ -
    -

    静态:

    -

    横向

    - -
  • - - - 首页 - -
  • -
  • - - - 资源 - - -
  • - - - 设置 - -
  • -
  • - - - 设置 - - -
  • - - - 设置3 - -
  • -
  • - - - 设置3 - -
  • -
    -
  • -
    -
  • -
  • - - - 首页 - -
  • -
  • - - - 首页 - -
  • -
    -
    -

    纵向

    - -
  • - - - 首页 - -
  • -
  • - - - 资源 - - -
  • - - - 设置 - -
  • -
  • - - - 设置 - - -
  • - - - 设置3 - -
  • -
  • - - - 设置3 - -
  • -
    -
  • -
    -
  • -
  • - - - 首页 - -
  • -
  • - - - 首页 - -
  • -
    -
    -

    动态:

    -
    -
    -
    -
    - -
    \ No newline at end of file diff --git a/doc/menu.md b/doc/menu.md new file mode 100644 index 0000000..2162028 --- /dev/null +++ b/doc/menu.md @@ -0,0 +1,280 @@ +

    静态:

    +

    横向

    + +
  • + + + 首页 + +
  • +
  • + + + 资源 + + +
  • + + + 设置 + +
  • +
  • + + + 设置 + + +
  • + + + 设置3 + +
  • +
  • + + + 设置3 + +
  • +
    +
  • +
    +
  • +
  • + + + 首页 + +
  • +
  • + + + 首页 + +
  • +
    + +代码: + +```html + +
  • + + + 首页 + +
  • +
  • + + + 资源 + + +
  • + + + 设置 + +
  • +
  • + + + 设置 + + +
  • + + + 设置3 + +
  • +
  • + + + 设置3 + +
  • +
    +
  • +
    +
  • +
  • + + + 首页 + +
  • +
  • + + + 首页 + +
  • +
    +``` + +
    +

    纵向

    + +
  • + + + 首页 + +
  • +
  • + + + 资源 + + +
  • + + + 设置 + +
  • +
  • + + + 设置 + + +
  • + + + 设置3 + +
  • +
  • + + + 设置3 + +
  • +
    +
  • +
    +
  • +
  • + + + 首页 + +
  • +
  • + + + 首页 + +
  • +
    + +代码: + +```html + +
  • + + + 首页 + +
  • +
  • + + + 资源 + + +
  • + + + 设置 + +
  • +
  • + + + 设置 + + +
  • + + + 设置3 + +
  • +
  • + + + 设置3 + +
  • +
    +
  • +
    +
  • +
  • + + + 首页 + +
  • +
  • + + + 首页 + +
  • +
    +``` + +
    +

    动态:

    +
    + +html代码: + +```html +
    +``` + +json代码: + +```json +{ + "code": 1, + "data": [ + { + "url": "#", + "icon": "icon icon-shouye", + "title": "首页" + }, + { + "url": "javascript:;", + "icon": "icon icon-shezhi", + "title": "设置", + "children": [ + { + "url": "#", + "icon": "icon icon-ziyuan", + "title": "资源" + } + ] + } + ], + "msg": "请求成功" +} +``` + +
    +
    +
    + +html代码: + +```html +
    +
    +``` \ No newline at end of file diff --git a/doc/subsidiary.html b/doc/subsidiary.md similarity index 100% rename from doc/subsidiary.html rename to doc/subsidiary.md diff --git a/doc/tab.html b/doc/tab.md similarity index 100% rename from doc/tab.html rename to doc/tab.md diff --git a/doc/tips.html b/doc/tips.md similarity index 100% rename from doc/tips.html rename to doc/tips.md diff --git a/doc/typography.html b/doc/typography.md similarity index 100% rename from doc/typography.html rename to doc/typography.md diff --git a/index.html b/index.html index ddf9ea9..4ddfc00 100644 --- a/index.html +++ b/index.html @@ -5,10 +5,14 @@ bunny-ui + + + + @@ -29,23 +33,39 @@
    -
    颜色
    -
    按钮
    -
    表单
    -
    卡片
    -
    选项卡
    -
    代码
    -
    提示
    -
    走马灯
    -
    警示
    -
    弹性盒子
    -
    排版
    -
    列表
    -
    菜单
    -
    辅助
    -
    公共类
    +
    颜色
    +
    按钮
    +
    表单
    +
    卡片
    +
    选项卡
    +
    代码
    +
    提示
    +
    走马灯
    +
    警示
    +
    弹性盒子
    +
    排版
    +
    列表
    +
    菜单
    +
    辅助
    +
    公共类
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    -
    + \ No newline at end of file diff --git a/marked.min.js b/marked.min.js new file mode 100644 index 0000000..e3fd93c --- /dev/null +++ b/marked.min.js @@ -0,0 +1,6 @@ +/** + * marked v15.0.4 - a markdown parser + * Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed) + * https://github.com/markedjs/marked + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).marked={})}(this,(function(e){"use strict";function t(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function n(t){e.defaults=t}e.defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};const s={exec:()=>null};function r(e,t=""){let n="string"==typeof e?e:e.source;const s={replace:(e,t)=>{let r="string"==typeof t?t:t.source;return r=r.replace(i.caret,"$1"),n=n.replace(e,r),s},getRegex:()=>new RegExp(n,t)};return s}const i={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},l=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,o=/(?:[*+-]|\d{1,9}[.)])/,a=r(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,o).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),c=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,h=/(?!\s*\])(?:\\.|[^\[\]\\])+/,p=r(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",h).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),u=r(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,o).getRegex(),g="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",k=/|$))/,f=r("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",k).replace("tag",g).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),d=r(c).replace("hr",l).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",g).getRegex(),x={blockquote:r(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",d).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:p,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:l,html:f,lheading:a,list:u,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:d,table:s,text:/^[^\n]+/},b=r("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",l).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",g).getRegex(),w={...x,table:b,paragraph:r(c).replace("hr",l).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",b).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",g).getRegex()},m={...x,html:r("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",k).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:s,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:r(c).replace("hr",l).replace("heading"," *#{1,6} *[^\n]").replace("lheading",a).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},y=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,$=/^( {2,}|\\)\n(?!\s*$)/,R=/[\p{P}\p{S}]/u,S=/[\s\p{P}\p{S}]/u,T=/[^\s\p{P}\p{S}]/u,z=r(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,S).getRegex(),A=r(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,"u").replace(/punct/g,R).getRegex(),_=r("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)","gu").replace(/notPunctSpace/g,T).replace(/punctSpace/g,S).replace(/punct/g,R).getRegex(),P=r("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,T).replace(/punctSpace/g,S).replace(/punct/g,R).getRegex(),I=r(/\\(punct)/,"gu").replace(/punct/g,R).getRegex(),L=r(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),B=r(k).replace("(?:--\x3e|$)","--\x3e").getRegex(),C=r("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",B).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),E=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,q=r(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",E).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Z=r(/^!?\[(label)\]\[(ref)\]/).replace("label",E).replace("ref",h).getRegex(),v=r(/^!?\[(ref)\](?:\[\])?/).replace("ref",h).getRegex(),D={_backpedal:s,anyPunctuation:I,autolink:L,blockSkip:/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,br:$,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:s,emStrongLDelim:A,emStrongRDelimAst:_,emStrongRDelimUnd:P,escape:y,link:q,nolink:v,punctuation:z,reflink:Z,reflinkSearch:r("reflink|nolink(?!\\()","g").replace("reflink",Z).replace("nolink",v).getRegex(),tag:C,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},H=e=>G[e];function X(e,t){if(t){if(i.escapeTest.test(e))return e.replace(i.escapeReplace,H)}else if(i.escapeTestNoEncode.test(e))return e.replace(i.escapeReplaceNoEncode,H);return e}function F(e){try{e=encodeURI(e).replace(i.percentDecode,"%")}catch{return null}return e}function U(e,t){const n=e.replace(i.findPipe,((e,t,n)=>{let s=!1,r=t;for(;--r>=0&&"\\"===n[r];)s=!s;return s?"|":" |"})).split(i.splitPipe);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:J(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t,n){const s=e.match(n.other.indentCodeCompensation);if(null===s)return t;const r=s[1];return t.split("\n").map((e=>{const t=e.match(n.other.beginningSpace);if(null===t)return e;const[s]=t;return s.length>=r.length?e.slice(r.length):e})).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){const t=J(e,"#");this.options.pedantic?e=t.trim():t&&!this.rules.other.endingSpaceChar.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:J(t[0],"\n")}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=J(t[0],"\n").split("\n"),n="",s="";const r=[];for(;e.length>0;){let t=!1;const i=[];let l;for(l=0;l1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const i=this.rules.other.listItemRegex(n);let l=!1;for(;e;){let n=!1,s="",o="";if(!(t=i.exec(e)))break;if(this.rules.block.hr.test(e))break;s=t[0],e=e.substring(s.length);let a=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],h=!a.trim(),p=0;if(this.options.pedantic?(p=2,o=a.trimStart()):h?p=t[1].length+1:(p=t[2].search(this.rules.other.nonSpaceChar),p=p>4?1:p,o=a.slice(p),p+=t[1].length),h&&this.rules.other.blankLine.test(c)&&(s+=c+"\n",e=e.substring(c.length+1),n=!0),!n){const t=this.rules.other.nextBulletRegex(p),n=this.rules.other.hrRegex(p),r=this.rules.other.fencesBeginRegex(p),i=this.rules.other.headingBeginRegex(p),l=this.rules.other.htmlBeginRegex(p);for(;e;){const u=e.split("\n",1)[0];let g;if(c=u,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),g=c):g=c.replace(this.rules.other.tabCharGlobal," "),r.test(c))break;if(i.test(c))break;if(l.test(c))break;if(t.test(c))break;if(n.test(c))break;if(g.search(this.rules.other.nonSpaceChar)>=p||!c.trim())o+="\n"+g.slice(p);else{if(h)break;if(a.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4)break;if(r.test(a))break;if(i.test(a))break;if(n.test(a))break;o+="\n"+c}h||c.trim()||(h=!0),s+=u+"\n",e=e.substring(u.length+1),a=g.slice(p)}}r.loose||(l?r.loose=!0:this.rules.other.doubleBlankLine.test(s)&&(l=!0));let u,g=null;this.options.gfm&&(g=this.rules.other.listIsTask.exec(o),g&&(u="[ ] "!==g[0],o=o.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:s,task:!!g,checked:u,loose:!1,text:o,tokens:[]}),r.raw+=s}const o=r.items.at(-1);if(!o)return;o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd(),r.raw=r.raw.trimEnd();for(let e=0;e"space"===e.type)),n=t.length>0&&t.some((e=>this.rules.other.anyLine.test(e.raw)));r.loose=n}if(r.loose)for(let e=0;e({text:e,tokens:this.lexer.inline(e),header:!1,align:i.align[t]}))));return i}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;const t=J(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let s=0;s-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){const e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),K(t,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:s?s.replace(this.rules.inline.anyPunctuation,"$1"):s},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return K(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s)return;if(s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...s[0]].length-1;let r,i,l=n,o=0;const a="*"===s[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(a.lastIndex=0,t=t.slice(-1*e.length+n);null!=(s=a.exec(t));){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(i=[...r].length,s[3]||s[4]){l+=i;continue}if((s[5]||s[6])&&n%3&&!((n+i)%3)){o+=i;continue}if(l-=i,l>0)continue;i=Math.min(i,i+l+o);const t=[...s[0]][0].length,a=e.slice(0,n+s.index+t+i);if(Math.min(n,i)%2){const e=a.slice(1,-1);return{type:"em",raw:a,text:e,tokens:this.lexer.inlineTokens(e)}}const c=a.slice(2,-2);return{type:"strong",raw:a,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," ");const n=this.rules.other.nonSpaceChar.test(e),s=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&s&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=t[0],n="mailto:"+e;else{let s;do{s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(s!==t[0]);e=t[0],n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}}class W{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||e.defaults,this.options.tokenizer=this.options.tokenizer||new V,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:i,block:j.normal,inline:N.normal};this.options.pedantic?(n.block=j.pedantic,n.inline=N.pedantic):this.options.gfm&&(n.block=j.gfm,this.options.breaks?n.inline=N.breaks:n.inline=N.gfm),this.tokenizer.rules=n}static get rules(){return{block:j,inline:N}}static lex(e,t){return new W(t).lex(e)}static lexInline(e,t){return new W(t).inlineTokens(e)}lex(e){e=e.replace(i.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e!!(s=n.call({lexer:this},e,t))&&(e=e.substring(s.raw.length),t.push(s),!0))))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);const n=t.at(-1);1===s.raw.length&&void 0!==n?n.raw+="\n":t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);const n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+="\n"+s.raw,n.text+="\n"+s.text,this.inlineQueue.at(-1).src=n.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);const n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+="\n"+s.raw,n.text+="\n"+s.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let r=e;if(this.options.extensions?.startBlock){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startBlock.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(this.state.top&&(s=this.tokenizer.paragraph(r))){const i=t.at(-1);n&&"paragraph"===i?.type?(i.raw+="\n"+s.raw,i.text+="\n"+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(s),n=r.length!==e.length,e=e.substring(s.raw.length)}else if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);const n=t.at(-1);"text"===n?.type?(n.raw+="\n"+s.raw,n.text+="\n"+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(s)}else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,s=null;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(s=this.tokenizer.rules.inline.reflinkSearch.exec(n));)e.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(s=this.tokenizer.rules.inline.blockSkip.exec(n));)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(s=this.tokenizer.rules.inline.anyPunctuation.exec(n));)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let r=!1,i="";for(;e;){let s;if(r||(i=""),r=!1,this.options.extensions?.inline?.some((n=>!!(s=n.call({lexer:this},e,t))&&(e=e.substring(s.raw.length),t.push(s),!0))))continue;if(s=this.tokenizer.escape(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.tag(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.link(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(s.raw.length);const n=t.at(-1);"text"===s.type&&"text"===n?.type?(n.raw+=s.raw,n.text+=s.text):t.push(s);continue}if(s=this.tokenizer.emStrong(e,n,i)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.codespan(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.br(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.del(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.autolink(e)){e=e.substring(s.raw.length),t.push(s);continue}if(!this.state.inLink&&(s=this.tokenizer.url(e))){e=e.substring(s.raw.length),t.push(s);continue}let l=e;if(this.options.extensions?.startInline){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startInline.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(l=e.substring(0,t+1))}if(s=this.tokenizer.inlineText(l)){e=e.substring(s.raw.length),"_"!==s.raw.slice(-1)&&(i=s.raw.slice(-1)),r=!0;const n=t.at(-1);"text"===n?.type?(n.raw+=s.raw,n.text+=s.text):t.push(s)}else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}}class Y{options;parser;constructor(t){this.options=t||e.defaults}space(e){return""}code({text:e,lang:t,escaped:n}){const s=(t||"").match(i.notSpaceStart)?.[0],r=e.replace(i.endingNewline,"")+"\n";return s?'
    '+(n?r:X(r,!0))+"
    \n":"
    "+(n?r:X(r,!0))+"
    \n"}blockquote({tokens:e}){return`
    \n${this.parser.parse(e)}
    \n`}html({text:e}){return e}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)}\n`}hr(e){return"
    \n"}list(e){const t=e.ordered,n=e.start;let s="";for(let t=0;t\n"+s+"\n"}listitem(e){let t="";if(e.task){const n=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===e.tokens[0]?.type?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+X(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`
  • ${t}
  • \n`}checkbox({checked:e}){return"'}paragraph({tokens:e}){return`

    ${this.parser.parseInline(e)}

    \n`}table(e){let t="",n="";for(let t=0;t${s}`),"\n\n"+t+"\n"+s+"
    \n"}tablerow({text:e}){return`\n${e}\n`}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`\n`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${X(e,!0)}`}br(e){return"
    "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:n}){const s=this.parser.parseInline(n),r=F(e);if(null===r)return s;let i='
    ",i}image({href:e,title:t,text:n}){const s=F(e);if(null===s)return X(n);let r=`${n}{const r=e[s].flat(1/0);n=n.concat(this.walkTokens(r,t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let s=e.renderer.apply(this,t);return!1===s&&(s=n.apply(this,t)),s}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new Y(this.defaults);for(const n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;const s=n,r=e.renderer[s],i=t[s];t[s]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new V(this.defaults);for(const n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;const s=n,r=e.tokenizer[s],i=t[s];t[s]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new ne;for(const n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;const s=n,r=e.hooks[s],i=t[s];ne.passThroughHooks.has(n)?t[s]=e=>{if(this.defaults.async)return Promise.resolve(r.call(t,e)).then((e=>i.call(t,e)));const n=r.call(t,e);return i.call(t,n)}:t[s]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,s=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(s.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return W.lex(e,t??this.defaults)}parser(e,t){return te.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{const s={...n},r={...this.defaults,...s},i=this.onError(!!r.silent,!!r.async);if(!0===this.defaults.async&&!1===s.async)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(null==t)return i(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=e);const l=r.hooks?r.hooks.provideLexer():e?W.lex:W.lexInline,o=r.hooks?r.hooks.provideParser():e?te.parse:te.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(t):t).then((e=>l(e,r))).then((e=>r.hooks?r.hooks.processAllTokens(e):e)).then((e=>r.walkTokens?Promise.all(this.walkTokens(e,r.walkTokens)).then((()=>e)):e)).then((e=>o(e,r))).then((e=>r.hooks?r.hooks.postprocess(e):e)).catch(i);try{r.hooks&&(t=r.hooks.preprocess(t));let e=l(t,r);r.hooks&&(e=r.hooks.processAllTokens(e)),r.walkTokens&&this.walkTokens(e,r.walkTokens);let n=o(e,r);return r.hooks&&(n=r.hooks.postprocess(n)),n}catch(e){return i(e)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="

    An error occurred:

    "+X(n.message+"",!0)+"
    ";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}}const re=new se;function ie(e,t){return re.parse(e,t)}ie.options=ie.setOptions=function(e){return re.setOptions(e),ie.defaults=re.defaults,n(ie.defaults),ie},ie.getDefaults=t,ie.defaults=e.defaults,ie.use=function(...e){return re.use(...e),ie.defaults=re.defaults,n(ie.defaults),ie},ie.walkTokens=function(e,t){return re.walkTokens(e,t)},ie.parseInline=re.parseInline,ie.Parser=te,ie.parser=te.parse,ie.Renderer=Y,ie.TextRenderer=ee,ie.Lexer=W,ie.lexer=W.lex,ie.Tokenizer=V,ie.Hooks=ne,ie.parse=ie;const le=ie.options,oe=ie.setOptions,ae=ie.use,ce=ie.walkTokens,he=ie.parseInline,pe=ie,ue=te.parse,ge=W.lex;e.Hooks=ne,e.Lexer=W,e.Marked=se,e.Parser=te,e.Renderer=Y,e.TextRenderer=ee,e.Tokenizer=V,e.getDefaults=t,e.lexer=ge,e.marked=ie,e.options=le,e.parse=pe,e.parseInline=he,e.parser=ue,e.setOptions=oe,e.use=ae,e.walkTokens=ce})); \ No newline at end of file diff --git a/src/bny-card.js b/src/bny-card.js index 90efc4c..b4f168a 100644 --- a/src/bny-card.js +++ b/src/bny-card.js @@ -5,18 +5,16 @@ import htmx from "./htmx" htmx.defineExtension("bny-card", { onEvent: function (name, evt) { if (name === "htmx:beforeSwap") { - const isError = evt.detail.isError - if (!isError) { - try { - const res = JSON.parse(evt.detail.serverResponse) - if (res.code === 1) { - const data = res.data; - const bodyContent = data && data.body ? ` + if (evt.detail.xhr.status === 200) { + const res = JSON.parse(evt.detail.serverResponse) + if (res.code === 1) { + const data = res.data; + const bodyContent = data && data.body ? `

    ${data.body.title || ''}

    ${data.body.subtitle || ''}

    ${data.body.text || ''}

    ` : ''; - evt.detail.elt.innerHTML = ` + evt.detail.elt.innerHTML = `
    ${data && data.top_img ? `` : ''} ${data && data.header ? `
    ${data.header}
    ` : ''} @@ -24,16 +22,12 @@ import htmx from "./htmx" ${data && data.footer ? `` : ''} ${data && data.bottom_img ? `` : ''}
    `; - } else { - evt.detail.elt.innerHTML = `
    ${data.msg}
    ` - } - } catch (error) { - console.error(error) + } else { + evt.detail.elt.innerHTML = `
    ${data.msg}
    ` } } else { - evt.detail.elt.innerHTML = `
    加载失败...
    ` + evt.detail.elt.innerHTML = `
    网络错误
    `; } - // console.log(evt.detail) return false } } diff --git a/src/bny-code.js b/src/bny-code.js index 4538e34..6984f9a 100644 --- a/src/bny-code.js +++ b/src/bny-code.js @@ -5,10 +5,14 @@ import tool from "./tool.js"; (function () { htmx.defineExtension("bny-code", { onEvent: function (name, evt) { - if (name === "htmx:beforeSwap") { + if (evt.target !== null && name === "htmx:beforeSwap") { const swap = evt.target.getAttribute("hx-swap") || "innerHTML" - const body = `
    ${tool.escapeHTML(evt.detail.serverResponse)}
    ` - htmx.swap(evt.target, body, { swapStyle: swap }) + if (evt.detail.xhr.status === 200) { + const body = `
    ${tool.escapeHTML(evt.detail.serverResponse)}
    ` + htmx.swap(evt.target, body, { swapStyle: swap }) + } else { + htmx.swap(evt.target, `网络错误...`, { swapStyle: swap }) + } return false } } diff --git a/src/bny-menu.js b/src/bny-menu.js index 8b36ff3..ae1d218 100644 --- a/src/bny-menu.js +++ b/src/bny-menu.js @@ -16,28 +16,26 @@ import htmx from "./htmx.js"; return str } + function beforeSwap(evt) { + const swap = evt.target.getAttribute("hx-swap") || "innerHTML" + const vertical = evt.target.getAttribute("vertical") !== null ? "vertical" : "" + if (evt.detail.xhr.status === 200) { + const res = JSON.parse(evt.detail.serverResponse) + if (res.code === 1) { + const data = res.data; + htmx.swap(evt.detail.elt, `${list(data)}`, { swapStyle: swap }) + } else { + htmx.swap(evt.detail.elt, `加载失败${res.msg}...`, { swapStyle: swap }) + } + } else { + htmx.swap(evt.detail.elt, `网络错误...`, { swapStyle: swap }) + } + } + htmx.defineExtension("bny-menu", { onEvent: function (name, evt) { - if (name === "htmx:beforeSwap") { - const swap = evt.target.getAttribute("hx-swap") || "innerHTML" - const vertical = evt.target.getAttribute("vertical") !== null ? "vertical" : "" - const isError = evt.detail.isError - if (!isError) { - try { - const res = JSON.parse(evt.detail.serverResponse) - if (res.code === 1) { - const data = res.data; - htmx.swap(evt.detail.elt, `${list(data)}`, { swapStyle: swap }) - } else { - htmx.swap(evt.detail.elt, `加载失败${res.msg}...`, { swapStyle: swap }) - } - } catch (error) { - console.error(error) - } - } else { - htmx.swap(evt.detail.elt, `网络错误...`, { swapStyle: swap }) - } - return false + if (evt.target !== null && name === "htmx:beforeSwap") { + beforeSwap(evt) } } }) diff --git a/src/bny-tab.js b/src/bny-tab.js index c55756b..ceb409d 100644 --- a/src/bny-tab.js +++ b/src/bny-tab.js @@ -6,21 +6,22 @@ import tool from "./tool" function beforeProcessNode(evt) { const elem = evt.target - if (evt.target.classList.contains("bny-tab")) { + if (elem !== null && evt.target.classList.contains("bny-tab")) { let items = htmx.findAll(".bny-tab-item", elem) items.forEach((item) => { htmx.on(item, "click", function () { const index = tool.indexOf(this) const parent = this.parentNode.parentNode const body = htmx.find(parent, `.bny-tab-body>div:nth-child(${index + 1})`) - htmx.findAll(parent, ".bny-tab-title .this").forEach(function (v) { + htmx.findAll(parent, ".bny-tab-title .this").forEach(async function (v) { v.classList.remove("this") }) - htmx.findAll(parent, ".bny-tab-body .this").forEach(function (vv) { + htmx.findAll(parent, ".bny-tab-body .this").forEach(async function (vv) { vv.classList.remove("this") }) htmx.addClass(this, "this") htmx.addClass(body, "this") + htmx.process(body) }) }); return false @@ -30,7 +31,7 @@ import tool from "./tool" function afterProcessNode(evt) { const elem = evt.target - if (elem.classList.contains("bny-tab-body")) { + if (elem !== null && elem.classList.contains("bny-tab-body")) { const num = htmx.findAll(elem.parentNode, ".bny-tab-title .bny-tab-item").length const then_num = htmx.findAll(elem, "div").length if ((num - then_num) > 0) { @@ -49,10 +50,15 @@ import tool from "./tool" function beforeSwap(evt) { const elem = evt.target - if (elem.classList.contains("bny-tab-item")) { + if (elem !== null && elem.classList.contains("bny-tab-item")) { const index = tool.indexOf(elem) const body = htmx.find(elem.parentNode.parentNode, `.bny-tab-body>div:nth-child(${index + 1})`) - htmx.swap(body, evt.detail.serverResponse, { swapStyle: "innerHTML" }) + if (evt.detail.xhr.status === 200) { + htmx.swap(body, evt.detail.serverResponse, { swapStyle: "innerHTML" }) + // body.innerHTML = evt.detail.serverResponse + } else { + htmx.swap(body, "网络错误...", { swapStyle: "innerHTML" }) + } } }