WordPress/wp-includes/js/dist/shortcode.min.js

2 lines
2.9 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
!function(){"use strict";var t={d:function(e,n){for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},e={};function n(t){return new RegExp("\\[(\\[?)("+t+")(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*(?:\\[(?!\\/\\2\\])[^\\[]*)*)(\\[\\/\\2\\]))?)(\\]?)","g")}t.d(e,{default:function(){return i}});const r=function(t,e){var n,r,s=0;function o(){var o,i,c=n,a=arguments.length;t:for(;c;){if(c.args.length===arguments.length){for(i=0;i<a;i++)if(c.args[i]!==arguments[i]){c=c.next;continue t}return c!==n&&(c===r&&(r=c.prev),c.prev.next=c.next,c.next&&(c.next.prev=c.prev),c.next=n,c.prev=null,n.prev=c,n=c),c.val}c=c.next}for(o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return c={args:o,val:t.apply(null,o)},n?(n.prev=c,c.next=n):r=c,s===e.maxSize?(r=r.prev).next=null:s++,n=c,c.val}return e=e||{},o.clear=function(){n=null,r=null,s=0},o}((t=>{const e={},n=[],r=/([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*'([^']*)'(?:\s|$)|([\w-]+)\s*=\s*([^\s'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|'([^']*)'(?:\s|$)|(\S+)(?:\s|$)/g;let s;for(t=t.replace(/[\u00a0\u200b]/g," ");s=r.exec(t);)s[1]?e[s[1].toLowerCase()]=s[2]:s[3]?e[s[3].toLowerCase()]=s[4]:s[5]?e[s[5].toLowerCase()]=s[6]:s[7]?n.push(s[7]):s[8]?n.push(s[8]):s[9]&&n.push(s[9]);return{named:e,numeric:n}}));function s(t){let e;return e=t[4]?"self-closing":t[6]?"closed":"single",new o({tag:t[2],attrs:t[3],type:e,content:t[5]})}const o=Object.assign((function(t){const{tag:e,attrs:n,type:s,content:o}=t||{};if(Object.assign(this,{tag:e,type:s,content:o}),this.attrs={named:{},numeric:[]},!n)return;const i=["named","numeric"];"string"==typeof n?this.attrs=r(n):n.length===i.length&&i.every(((t,e)=>t===n[e]))?this.attrs=n:Object.entries(n).forEach((([t,e])=>{this.set(t,e)}))}),{next:function t(e,r,o=0){const i=n(e);i.lastIndex=o;const c=i.exec(r);if(!c)return;if("["===c[1]&&"]"===c[7])return t(e,r,i.lastIndex);const a={index:c.index,content:c[0],shortcode:s(c)};return c[1]&&(a.content=a.content.slice(1),a.index++),c[7]&&(a.content=a.content.slice(0,-1)),a},replace:function(t,e,r){return e.replace(n(t),(function(t,e,n,o,i,c,a,u){if("["===e&&"]"===u)return t;const l=r(s(arguments));return l||""===l?e+l+u:t}))},string:function(t){return new o(t).string()},regexp:n,attrs:r,fromMatch:s});Object.assign(o.prototype,{get(t){return this.attrs["number"==typeof t?"numeric":"named"][t]},set(t,e){return this.attrs["number"==typeof t?"numeric":"named"][t]=e,this},string(){let t="["+this.tag;return this.attrs.numeric.forEach((e=>{/\s/.test(e)?t+=' "'+e+'"':t+=" "+e})),Object.entries(this.attrs.named).forEach((([e,n])=>{t+=" "+e+'="'+n+'"'})),"single"===this.type?t+"]":"self-closing"===this.type?t+" /]":(t+="]",this.content&&(t+=this.content),t+"[/"+this.tag+"]")}});var i=o;(window.wp=window.wp||{}).shortcode=e.default}();