import
UserScript
文字カウンター
code:script.src.js
import '../../per-terra/文字カウンター/script.js';
リアルタイム文字カウンター
code:script.src.js
import '../../per-terra/リアルタイム文字カウンター/script.js';
hr.iconをショートカットキーで挿入できるようにするUserScript
code:script.src.js
import '../../per-terra/hr.iconをショートカットキーで挿入できるようにするUserScript/script.js';
モバイル環境でタイムスタンプを打てるようにするUserScript
code:script.src.js
import '../../per-terra/モバイル環境でタイムスタンプを打てるようにするUserScript/script.js';
https://scrapbox-bundler.vercel.app?url=https://scrapbox.io/api/code/per-terra/import/script.src.js&bundle&minify&reload
code:script.js
cosense.PopupMenu.addButton({title:t=>{let o=t.split(/\s+/).filter(Boolean).length,s=t.length;return${o}w ${s}c},onClick:()=>null});(()=>{let t=document.createElement("div");t.setAttribute("class","counters");let o=t.appendChild(document.createElement("span"));o.setAttribute("class","item");let s=document.getElementsByClassName("status-bar")0;cosense.Layout==="page"&&s.appendChild(t),cosense.on("layout:changed",()=>{cosense.Layout==="page"?s.prepend(t):s.removeChild(t)});let c=()=>{if(!window.cosense.Page.lines)return;let a=cosense.Page.lines.map(i=>i.text.split(/\s+/).filter(Boolean).length).reduce((i,e)=>i+e);o.innerText=${a} words, ${cosense.Page.metadata.charsCount} chars, ${cosense.Page.metadata.linesCount} lines};c(),cosense.on("lines:changed",c)})();document.addEventListener("keydown",t=>{t.ctrlKey&&t.key==="l"&&document.execCommand("insertText",null,"/icons/hr.icon")});(()=>{let t=()=>"ontouchstart"in window,o=e=>{let n=document.getElementById("text-input");n.focus(),n.value=e;let l=new InputEvent("input",{bubbles:!0});n.dispatchEvent(l)},s=e=>e.toString().padStart(2,"0"),c=()=>YYYY${window.COSENSE_DATE_DELIMITER||"-"}MM${window.COSENSE_DATE_DELIMITER||"-"}DD,a=e=>${e.getFullYear()}${window.COSENSE_DATE_DELIMITER||"-"}${s(e.getMonth()+1)}${window.COSENSE_DATE_DELIMITER||"-"}${s(e.getDate())},i=e=>${s(e.getHours())}:${s(e.getMinutes())}:${s(e.getSeconds())};if(t()){let e="timestamp";cosense.PageMenu.addMenu({title:e,icon:"far fa-clock"}),cosense.PageMenu(e).addItem({title:()=>#${c()} HH:mm:ss_,onClick:()=>o((n=>#${a(n)} ${i(n)} )(new Date))}),cosense.PageMenu(e).addItem({title:()=>#${c()} HH:mm:ss,onClick:()=>o((n=>#${a(n)} ${i(n)})(new Date))}),cosense.PageMenu(e).addItem({title:()=>#${c()},onClick:()=>o((n=>#${a(n)})(new Date))}),cosense.PageMenu(e).addItem({title:()=>[${c()}],onClick:()=>o((n=>[${a(n)}])(new Date))})}})();
/takker/scrapbox-history-slider
code:script.src.ts
import { setup as setupSlider } from "https://raw.githubusercontent.com/takker99/scrapbox-history-slider/0.2.2/App.tsx";
(async () => {
const { toggle } = await setupSlider();
scrapbox.PageMenu.addItem({
title: "履歴スライダー",
image: "https://1.bp.blogspot.com/-UZtkSEX0wh4/U5l5_dNcEsI/AAAAAAAAhWs/UzJGVzyiX8Y/s800/kaichu_dokei.png",
onClick: toggle,
});
})();
https://scrapbox-bundler.vercel.app?url=https://scrapbox.io/api/code/per-terra/import/script.src.ts&bundle&minify&reload
code:script.js
var Et,v,xe,Or,J,pe,ge,ye,we,Bt,Ut,$t,Er,xt={},ve=[],Tr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|inech|zoo|^ord|itera/i,Tt=Array.isArray;function B(t,e){for(var r in e)tr=er;return t}function zt(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Fr(t,e,r){var o,n,a,i={};for(a in e)a=="key"?o=ea:a=="ref"?n=ea:ia=ea;if(arguments.length>2&&(i.children=arguments.length>3?Et.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(a in t.defaultProps)ia===void 0&&(ia=t.defaultPropsa);return Mt(t,i,o,n,null)}function Mt(t,e,r,o,n){var a={type:t,props:e,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++xe,__i:-1,__u:0};return n==null&&v.vnode!=null&&v.vnode(a),a}function z(t){return t.children}function Rt(t,e){this.props=t,this.context=e}function st(t,e){if(e==null)return t.__?st(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__ke)!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?st(t):null}function be(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__ke)!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return be(t)}}function ce(t){(!t.__d&&(t.__d=!0)&&J.push(t)&&!Ot.__r++||pe!=v.debounceRendering)&&((pe=v.debounceRendering)||ge)(Ot)}function Ot(){for(var t,e,r,o,n,a,i,m=1;J.length;)J.length>m&&J.sort(ye),t=J.shift(),m=J.length,t.__d&&(r=void 0,n=(o=(e=t).__v).__e,a=[],i=[],e.__P&&((r=B({},o)).__v=o.__v+1,v.vnode&&v.vnode(r),Gt(e.__P,r,o,e.__n,e.__P.namespaceURI,32&o.__u?n:null,a,n??st(o),!!(32&o.__u),i),r.__v=o.__v,r.__.__kr.__i=r,De(a,r,i),r.__e!=n&&be(r)));Ot.__r=0}function _e(t,e,r,o,n,a,i,m,p,f,c){var u,h,d,x,I,_,y,w=o&&o.__k||ve,C=e.length;for(p=Ir(r,e,w,p,C),u=0;u<C;u++)(d=r.__ku)!=null&&(h=d.__i==-1?xt:wd.__i||xt,d.__i=u,_=Gt(t,d,h,n,a,i,m,p,f,c),x=d.__e,d.ref&&h.ref!=d.ref&&(h.ref&&Qt(h.ref,null,d),c.push(d.ref,d.__c||x,d)),I==null&&x!=null&&(I=x),(y=!!(4&d.__u))||h.__k===d.__k?p=ke(d,p,t,y):typeof d.type=="function"&&_!==void 0?p=_:x&&(p=x.nextSibling),d.__u&=-7);return r.__e=I,p}function Ir(t,e,r,o,n){var a,i,m,p,f,c=r.length,u=c,h=0;for(t.__k=new Array(n),a=0;a<n;a++)(i=ea)!=null&&typeof i!="boolean"&&typeof i!="function"?(p=a+h,(i=t.__ka=typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?Mt(null,i,null,null,null):Tt(i)?Mt(z,{children:i},null,null,null):i.constructor==null&&i.__b>0?Mt(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i).__=t,i.__b=t.__b+1,m=null,(f=i.__i=Sr(i,r,p,u))!=-1&&(u--,(m=rf)&&(m.__u|=2)),m==null||m.__v==null?(f==-1&&(n>c?h--:n<c&&h++),typeof i.type!="function"&&(i.__u|=4)):f!=p&&(f==p-1?h--:f==p+1?h++:(f>p?h--:h++,i.__u|=4))):t.__ka=null;if(u)for(a=0;a<c;a++)(m=ra)!=null&&!(2&m.__u)&&(m.__e==o&&(o=st(m)),Re(m,m));return o}function ke(t,e,r,o){var n,a;if(typeof t.type=="function"){for(n=t.__k,a=0;n&&a<n.length;a++)na&&(na.__=t,e=ke(na,e,r,o));return e}t.__e!=e&&(o&&(e&&t.type&&!e.parentNode&&(e=st(t)),r.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function Sr(t,e,r,o){var n,a,i,m=t.key,p=t.type,f=er,c=f!=null&&(2&f.__u)==0;if(f===null&&t.key==null||c&&m==f.key&&p==f.type)return r;if(o>(c?1:0)){for(n=r-1,a=r+1;n>=0||a<e.length;)if((f=ei=n>=0?n--:a++)!=null&&!(2&f.__u)&&m==f.key&&p==f.type)return i}return-1}function de(t,e,r){e0=="-"?t.setProperty(e,r??""):te=r==null?"":typeof r!="number"||Tr.test(e)?r:r+"px"}function Dt(t,e,r,o,n){var a,i;t:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof o=="string"&&(t.style.cssText=o=""),o)for(e in o)r&&e in r||de(t.style,e,"");if(r)for(e in r)o&&re==oe||de(t.style,e,re)}else if(e0=="o"&&e1=="n")a=e!=(e=e.replace(we,"$1")),i=e.toLowerCase(),e=i in t||e=="onFocusOut"||e=="onFocusIn"?i.slice(2):e.slice(2),t.l||(t.l={}),t.le+a=r,r?o?r.u=o.u:(r.u=Bt,t.addEventListener(e,a?$t:Ut,a)):t.removeEventListener(e,a?$t:Ut,a);else{if(n=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{te=r??"";break t}catch{}typeof r=="function"||(r==null||r===!1&&e4!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function he(t){return function(e){if(this.l){var r=this.le.type+t;if(e.t==null)e.t=Bt++;else if(e.t<r.u)return;return r(v.event?v.event(e):e)}}}function Gt(t,e,r,o,n,a,i,m,p,f){var c,u,h,d,x,I,_,y,w,C,q,_t,dt,le,kt,ht,At,A=e.type;if(e.constructor!=null)return null;128&r.__u&&(p=!!(32&r.__u),a=m=e.__e=r.__e),(c=v.__b)&&c(e);t:if(typeof A=="function")try{if(y=e.props,w="prototype"in A&&A.prototype.render,C=(c=A.contextType)&&oc.__c,q=c?C?C.props.value:c.__:o,r.__c?_=(u=e.__c=r.__c).__=u.__E:(w?e.__c=u=new A(y,q):(e.__c=u=new Rt(y,q),u.constructor=A,u.render=Pr),C&&C.sub(u),u.props=y,u.state||(u.state={}),u.context=q,u.__n=o,h=u.__d=!0,u.__h=[],u._sb=[]),w&&u.__s==null&&(u.__s=u.state),w&&A.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=B({},u.__s)),B(u.__s,A.getDerivedStateFromProps(y,u.__s))),d=u.props,x=u.state,u.__v=e,h)w&&A.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),w&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(w&&A.getDerivedStateFromProps==null&&y!==d&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(y,q),!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(y,u.__s,q)===!1||e.__v==r.__v){for(e.__v!=r.__v&&(u.props=y,u.state=u.__s,u.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(at){at&&(at.__=e)}),_t=0;_t<u._sb.length;_t++)u.__h.push(u._sb_t);u._sb=[],u.__h.length&&i.push(u);break t}u.componentWillUpdate!=null&&u.componentWillUpdate(y,u.__s,q),w&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(d,x,I)})}if(u.context=q,u.props=y,u.__P=t,u.__e=!1,dt=v.__r,le=0,w){for(u.state=u.__s,u.__d=!1,dt&&dt(e),c=u.render(u.props,u.state,u.context),kt=0;kt<u._sb.length;kt++)u.__h.push(u._sbkt);u._sb=[]}else do u.__d=!1,dt&&dt(e),c=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++le<25);u.state=u.__s,u.getChildContext!=null&&(o=B(B({},o),u.getChildContext())),w&&!h&&u.getSnapshotBeforeUpdate!=null&&(I=u.getSnapshotBeforeUpdate(d,x)),ht=c,c!=null&&c.type===z&&c.key==null&&(ht=Me(c.props.children)),m=_e(t,Tt(ht)?ht:ht,e,r,o,n,a,i,m,p,f),u.base=e.__e,e.__u&=-161,u.__h.length&&i.push(u),_&&(u.__E=u.__=null)}catch(at){if(e.__v=null,p||a!=null)if(at.then){for(e.__u|=p?160:128;m&&m.nodeType==8&&m.nextSibling;)m=m.nextSibling;aa.indexOf(m)=null,e.__e=m}else{for(At=a.length;At--;)zt(aAt);jt(e)}else e.__e=r.__e,e.__k=r.__k,at.then||jt(e);v.__e(at,e,r)}else a==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):m=e.__e=Nr(r.__e,e,r,o,n,a,i,p,f);return(c=v.diffed)&&c(e),128&e.__u?void 0:m}function jt(t){t&&t.__c&&(t.__c.__e=!0),t&&t.__k&&t.__k.forEach(jt)}function De(t,e,r){for(var o=0;o<r.length;o++)Qt(ro,r++o,r++o);v.__c&&v.__c(e,t),t.some(function(n){try{t=n.__h,n.__h=[],t.some(function(a){a.call(n)})}catch(a){v.__e(a,n.__v)}})}function Me(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:Tt(t)?t.map(Me):B({},t)}function Nr(t,e,r,o,n,a,i,m,p){var f,c,u,h,d,x,I,_=r.props,y=e.props,w=e.type;if(w=="svg"?n="http://www.w3.org/2000/svg":w=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),a!=null){for(f=0;f<a.length;f++)if((d=a[f])&&"setAttribute"in d==!!w&&(w?d.localName==w:d.nodeType==3)){t=d,af=null;break}}if(t==null){if(w==null)return document.createTextNode(y);t=document.createElementNS(n,w,y.is&&y),m&&(v.__m&&v.__m(e,a),m=!1),a=null}if(w==null)_===y||m&&t.data==y||(t.data=y);else{if(a=a&&Et.call(t.childNodes),_=r.props||xt,!m&&a!=null)for(_={},f=0;f<t.attributes.length;f++)_[(d=t.attributesf).name]=d.value;for(f in _)if(d=_f,f!="children"){if(f=="dangerouslySetInnerHTML")u=d;else if(!(f in y)){if(f=="value"&&"defaultValue"in y||f=="checked"&&"defaultChecked"in y)continue;Dt(t,f,null,d,n)}}for(f in y)d=yf,f=="children"?h=d:f=="dangerouslySetInnerHTML"?c=d:f=="value"?x=d:f=="checked"?I=d:m&&typeof d!="function"||_f===d||Dt(t,f,d,_f,n);if(c)m||u&&(c.__html==u.__html||c.__html==t.innerHTML)||(t.innerHTML=c.__html),e.__k=[];else if(u&&(t.innerHTML=""),_e(e.type=="template"?t.content:t,Tt(h)?h:h,e,r,o,w=="foreignObject"?"http://www.w3.org/1999/xhtml":n,a,i,a?a[0]:r.__k&&st(r,0),m,p),a!=null)for(f=a.length;f--;)zt(a[f]);m||(f="value",w=="progress"&&x==null?t.removeAttribute("value"):x!=null&&(x!==t[f]||w=="progress"&&!x||w=="option"&&x!=_[f])&&Dt(t,f,x,_[f],n),f="checked",I!=null&&I!=t[f]&&Dt(t,f,I,_[f],n))}return t}function Qt(t,e,r){try{if(typeof t=="function"){var o=typeof t.__u=="function";o&&t.__u(),o&&e==null||(t.__u=t(e))}else t.current=e}catch(n){v.__e(n,r)}}function Re(t,e,r){var o,n;if(v.unmount&&v.unmount(t),(o=t.ref)&&(o.current&&o.current!=t.__e||Qt(o,null,e)),(o=t.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){v.__e(a,e)}o.base=o.__P=null}if(o=t.__k)for(n=0;n<o.length;n++)on&&Re(on,e,r||typeof t.type!="function");r||zt(t.__e),t.__c=t.__=t.__e=void 0}function Pr(t,e,r){return this.constructor(t,r)}function Oe(t,e,r){var o,n,a,i;e==document&&(e=document.documentElement),v.__&&v.__(t,e),n=(o=typeof r=="function")?null:r&&r.__k||e.__k,a=[],i=[],Gt(e,t=(!o&&r||e).__k=Fr(z,null,t),n||xt,xt,e.namespaceURI,!o&&r?r:n?null:e.firstChild?Et.call(e.childNodes):null,a,!o&&r?r:n?n.__e:e.firstChild,o,i),De(a,t,i)}Et=ve.slice,v={__e:function(t,e,r,o){for(var n,a,i;e=e.__;)if((n=e.__c)&&!n.__)try{if((a=n.constructor)&&a.getDerivedStateFromError!=null&&(n.setState(a.getDerivedStateFromError(t)),i=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(t,o||{}),i=n.__d),i)return n.__E=n}catch(m){t=m}throw t}},xe=0,Or=function(t){return t!=null&&t.constructor==null},Rt.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=B({},this.state),typeof t=="function"&&(t=t(B({},r),this.props)),t&&B(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),ce(this))},Rt.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ce(this))},Rt.prototype.render=z,J=[],ge=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ye=function(t,e){return t.__v.__b-e.__v.__b},Ot.__r=0,we=/(PointerCapture)$|Capture$/i,Bt=0,Ut=he(!1),$t=he(!0),Er=0;var gt,D,Xt,Ee,It=0,He=[],O=v,Te=O.__b,Fe=O.__r,Ie=O.diffed,Se=O.__c,Ne=O.unmount,Pe=O.__;function Zt(t,e){O.__h&&O.__h(D,t,It||e),It=0;var r=D.__H||(D.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__t}function K(t){return It=1,Yr(We,t)}function Yr(t,e,r){var o=Zt(gt++,2);if(o.t=t,!o.__c&&(o.__=[r?r(e):We(void 0,e),function(m){var p=o.__N?o.__N0:o.__0,f=o.t(p,m);p!==f&&(o.__N=[f,o.__1],o.__c.setState({}))}],o.__c=D,!D.__f)){var n=function(m,p,f){if(!o.__c.__H)return!0;var c=o.__c.__H.__.filter(function(h){return!!h.__c});if(c.every(function(h){return!h.__N}))return!a||a.call(this,m,p,f);var u=o.__c.props!==m;return c.forEach(function(h){if(h.__N){var d=h.__0;h.__=h.__N,h.__N=void 0,d!==h.__0&&(u=!0)}}),a&&a.call(this,m,p,f)||u};D.__f=!0;var a=D.shouldComponentUpdate,i=D.componentWillUpdate;D.componentWillUpdate=function(m,p,f){if(this.__e){var c=a;a=void 0,n(m,p,f),a=c}i&&i.call(this,m,p,f)},D.shouldComponentUpdate=n}return o.__N||o.__}function yt(t,e){var r=Zt(gt++,3);!O.__s&&Ce(r.__H,e)&&(r.__=t,r.u=e,D.__H.__h.push(r))}function Hr(t,e){var r=Zt(gt++,7);return Ce(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function X(t,e){return It=8,Hr(function(){return t},e)}function Cr(){for(var t;t=He.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Ft),t.__H.__h.forEach(Vt),t.__H.__h=[]}catch(e){t.__H.__h=[],O.__e(e,t.__v)}}O.__b=function(t){D=null,Te&&Te(t)},O.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Pe&&Pe(t,e)},O.__r=function(t){Fe&&Fe(t),gt=0;var e=(D=t.__c).__H;e&&(Xt===D?(e.__h=[],D.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(Ft),e.__h.forEach(Vt),e.__h=[],gt=0)),Xt=D},O.diffed=function(t){Ie&&Ie(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(He.push(e)!==1&&Ee===O.requestAnimationFrame||((Ee=O.requestAnimationFrame)||Wr)(Cr)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Xt=D=null},O.__c=function(t,e){e.some(function(r){try{r.__h.forEach(Ft),r.__h=r.__h.filter(function(o){return!o.__||Vt(o)})}catch(o){e.some(function(n){n.__h&&(n.__h=[])}),e=[],O.__e(o,r.__v)}}),Se&&Se(t,e)},O.unmount=function(t){Ne&&Ne(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(o){try{Ft(o)}catch(n){e=n}}),r.__H=void 0,e&&O.__e(e,r.__v))};var Ye=typeof requestAnimationFrame=="function";function Wr(t){var e,r=function(){clearTimeout(o),Ye&&cancelAnimationFrame(e),setTimeout(t)},o=setTimeout(r,35);Ye&&(e=requestAnimationFrame(r))}function Ft(t){var e=D,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),D=e}function Vt(t){var e=D;t.__c=t.__(),D=e}function Ce(t,e){return!t||t.length!==e.length||e.some(function(r,o){return r!==to})}function We(t,e){return typeof e=="function"?e(t):e}var Lr=Math.pow(10,8)*24*60*60*1e3,Ia=-Lr,tt=6048e5;var V=6e4,et=36e5,St=1e3;var Nt=3600;var Jt=Nt*24,qr=Jt*7,Le=Jt*365.2425,qe=Le/12,Ar=qe*3,Kt=Symbol.for("constructDateFrom");function l(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&Kt in t?tKt(e):t instanceof Date?new t.constructor(e):new Date(e)}function s(t,e){return l(e||t,t)}function U(t,e,r){let o=s(t,r?.in);return isNaN(e)?l(r?.in||t,NaN):(e&&o.setDate(o.getDate()+e),o)}var Ur={};function W(){return Ur}function E(t,e){let r=W(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,n=s(t,e?.in),a=n.getDay(),i=(a<o?7:0)+a-o;return n.setDate(n.getDate()-i),n.setHours(0,0,0,0),n}function P(t,e){return E(t,{...e,weekStartsOn:1})}function rt(t,e){let r=s(t,e?.in),o=r.getFullYear(),n=l(r,0);n.setFullYear(o+1,0,4),n.setHours(0,0,0,0);let a=P(n),i=l(r,0);i.setFullYear(o,0,4),i.setHours(0,0,0,0);let m=P(i);return r.getTime()>=a.getTime()?o+1:r.getTime()>=m.getTime()?o:o-1}function ot(t){let e=s(t),r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),+t-+r}function wt(t,e){let r=rt(t,e),o=l(e?.in||t,0);return o.setFullYear(r,0,4),o.setHours(0,0,0,0),P(o)}function je(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="object Date"}function Z(t){return!(!je(t)&&typeof t!="number"||isNaN(+s(t)))}function Ht(t){return(e={})=>{let r=e.width?String(e.width):t.defaultWidth;return t.formatsr||t.formatst.defaultWidth}}function ut(t){return(e,r)=>{let o=r?.context?String(r.context):"standalone",n;if(o==="formatting"&&t.formattingValues){let i=t.defaultFormattingWidth||t.defaultWidth,m=r?.width?String(r.width):i;n=t.formattingValuesm||t.formattingValuesi}else{let i=t.defaultWidth,m=r?.width?String(r.width):t.defaultWidth;n=t.valuesm||t.valuesi}let a=t.argumentCallback?t.argumentCallback(e):e;return na}}var ro={narrow:"B","A",abbreviated:"BC","AD",wide:"Before Christ","Anno Domini"},oo={narrow:"1","2","3","4",abbreviated:"Q1","Q2","Q3","Q4",wide:"1st quarter","2nd quarter","3rd quarter","4th quarter"},no={narrow:"J","F","M","A","M","J","J","A","S","O","N","D",abbreviated:"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",wide:"January","February","March","April","May","June","July","August","September","October","November","December"},ao={narrow:"S","M","T","W","T","F","S",short:"Su","Mo","Tu","We","Th","Fr","Sa",abbreviated:"Sun","Mon","Tue","Wed","Thu","Fri","Sat",wide:"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"},so={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},io={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},uo=(t,e)=>{let r=Number(t),o=r%100;if(o>20||o<10)switch(o%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},mo={ordinalNumber:uo,era:ut({values:ro,defaultWidth:"wide"}),quarter:ut({values:oo,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ut({values:no,defaultWidth:"wide"}),day:ut({values:ao,defaultWidth:"wide"}),dayPeriod:ut({values:so,defaultWidth:"wide",formattingValues:io,defaultFormattingWidth:"wide"})};function mt(t){return(e,r={})=>{let o=r.width,n=o&&t.matchPatternso||t.matchPatternst.defaultMatchWidth,a=e.match(n);if(!a)return null;let i=a0,m=o&&t.parsePatternso||t.parsePatternst.defaultParseWidth,p=Array.isArray(m)?lo(m,u=>u.test(i)):fo(m,u=>u.test(i)),f;f=t.valueCallback?t.valueCallback(p):p,f=r.valueCallback?r.valueCallback(f):f;let c=e.slice(i.length);return{value:f,rest:c}}}function fo(t,e){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(tr))return r}function lo(t,e){for(let r=0;r<t.length;r++)if(e(tr))return r}function Qe(t){return(e,r={})=>{let o=e.match(t.matchPattern);if(!o)return null;let n=o0,a=e.match(t.parsePattern);if(!a)return null;let i=t.valueCallback?t.valueCallback(a0):a0;i=r.valueCallback?r.valueCallback(i):i;let m=e.slice(n.length);return{value:i,rest:m}}}var po=/^(\d+)(th|st|nd|rd)?/i,co=/\d+/i,ho={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},xo={any:/^b/i,/^(a|c)/i},go={narrow:/^1234/i,abbreviated:/^q1234/i,wide:/^1234(th|st|nd|rd)? quarter/i},yo={any:/1/i,/2/i,/3/i,/4/i},wo={narrow:/^jfmasond/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},vo={narrow:/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i,any:/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i},bo={narrow:/^smtwf/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},_o={narrow:/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i,any:/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i},ko={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^(ap\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Do={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Mo={ordinalNumber:Qe({matchPattern:po,parsePattern:co,valueCallback:t=>parseInt(t,10)}),era:mt({matchPatterns:ho,defaultMatchWidth:"wide",parsePatterns:xo,defaultParseWidth:"any"}),quarter:mt({matchPatterns:go,defaultMatchWidth:"wide",parsePatterns:yo,defaultParseWidth:"any",valueCallback:t=>t+1}),month:mt({matchPatterns:wo,defaultMatchWidth:"wide",parsePatterns:vo,defaultParseWidth:"any"}),day:mt({matchPatterns:bo,defaultMatchWidth:"wide",parsePatterns:_o,defaultParseWidth:"any"}),dayPeriod:mt({matchPatterns:ko,defaultMatchWidth:"any",parsePatterns:Do,defaultParseWidth:"any"})};var Ro={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Oo={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Eo={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},tl={date:Ht({formats:Ro,defaultWidth:"full"}),time:Ht({formats:Oo,defaultWidth:"full"}),dateTime:Ht({formats:Eo,defaultWidth:"full"})};function re(t,e){let r=s(t,e?.in),o=+P(r)-+wt(r);return Math.round(o/tt)+1}function bt(t,e){let r=s(t,e?.in),o=r.getFullYear(),n=W(),a=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=l(e?.in||t,0);i.setFullYear(o+1,0,a),i.setHours(0,0,0,0);let m=E(i,e),p=l(e?.in||t,0);p.setFullYear(o,0,a),p.setHours(0,0,0,0);let f=E(p,e);return+r>=+m?o+1:+r>=+f?o:o-1}var To={};function Fo(){return To}function oe(t,e){let r=Fo(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,n=bt(t,e),a=l(e?.in||t,0);return a.setFullYear(n,0,o),a.setHours(0,0,0,0),E(a,e)}function ne(t,e){let r=s(t,e?.in),o=+E(r,e)-+oe(r,e);return Math.round(o/tt)+1}function L(t,e){let r=t<0?"-":"",o=Math.abs(t).toString().padStart(e,"0");return r+o}var ae={y(t,e){let r=t.getFullYear(),o=r>0?r:1-r;return L(e==="yy"?o%100:o,e.length)},M(t,e){let r=t.getMonth();return e==="M"?String(r+1):L(r+1,2)},d(t,e){return L(t.getDate(),e.length)},a(t,e){let r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r0;case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(t,e){return L(t.getHours()%12||12,e.length)},H(t,e){return L(t.getHours(),e.length)},m(t,e){return L(t.getMinutes(),e.length)},s(t,e){return L(t.getSeconds(),e.length)},S(t,e){let r=e.length,o=t.getMilliseconds(),n=Math.trunc(o*Math.pow(10,r-3));return L(n,e.length)}};function Ve(t,e){let r=s(t,e?.in).getDay();return r===0?7:r}function Ke(t,e,r){let o=s(t,r?.in),n=ne(o,r)-e;return o.setDate(o.getDate()-n*7),s(o,r?.in)}function tr(t,e,r){let o=s(t,r?.in),n=re(o,r)-e;return o.setDate(o.getDate()-n*7),o}function lt(t,e,r){let o=W(),n=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0,a=s(t,r?.in),i=a.getDay(),m=(e%7+7)%7,p=7-n,f=e<0||e>6?e-(i+p)%7:(m+p)%7-(i+p)%7;return U(a,f,r)}function er(t,e,r){let o=s(t,r?.in),n=Ve(o,r),a=e-n;return U(o,a,r)}var Ao=class{subPriority=0;validate(t,e){return!0}},Uo=class extends Ao{constructor(t,e,r,o,n){super(),this.value=t,this.validateValue=e,this.setValue=r,this.priority=o,n&&(this.subPriority=n)}validate(t,e){return this.validateValue(t,this.value,e)}set(t,e,r){return this.setValue(t,e,this.value,r)}};var g=class{run(t,e,r,o){let n=this.parse(t,e,r,o);return n?{setter:new Uo(n.value,this.validate,this.set,this.priority,this.subPriority),rest:n.rest}:null}validate(t,e,r){return!0}},$o=class extends g{priority=140;parse(t,e,r){switch(e){case"G":case"GG":case"GGG":return r.era(t,{width:"abbreviated"})||r.era(t,{width:"narrow"});case"GGGGG":return r.era(t,{width:"narrow"});case"GGGG":default:return r.era(t,{width:"wide"})||r.era(t,{width:"abbreviated"})||r.era(t,{width:"narrow"})}}set(t,e,r){return e.era=r,t.setFullYear(r,0,1),t.setHours(0,0,0,0),t}incompatibleTokens="R","u","t","T"},M={month:/^(10-2|0?\d)/,date:/^(30-1|0-2?\d)/,dayOfYear:/^(360-6|30-5\d|0-2?\d?\d)/,week:/^(50-3|0-4?\d)/,hour23h:/^(20-3|0-1?\d)/,hour24h:/^(20-4|0-1?\d)/,hour11h:/^(10-1|0?\d)/,hour12h:/^(10-2|0?\d)/,minute:/^0-5?\d/,second:/^0-5?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},$={basicOptionalMinutes:/^(+-)(\d{2})(\d{2})?|Z/,basic:/^(+-)(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^(+-)(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^(+-)(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^(+-)(\d{2}):(\d{2})(:(\d{2}))?|Z/};function R(t,e){return t&&{value:e(t.value),rest:t.rest}}function b(t,e){let r=e.match(t);return r?{value:parseInt(r0,10),rest:e.slice(r0.length)}:null}function j(t,e){let r=e.match(t);if(!r)return null;if(r0==="Z")return{value:0,rest:e.slice(1)};let o=r1==="+"?1:-1,n=r2?parseInt(r2,10):0,a=r3?parseInt(r3,10):0,i=r5?parseInt(r5,10):0;return{value:o*(n*et+a*V+i*St),rest:e.slice(r0.length)}}function rr(t){return b(M.anyDigitsSigned,t)}function k(t,e){switch(t){case 1:return b(M.singleDigit,e);case 2:return b(M.twoDigits,e);case 3:return b(M.threeDigits,e);case 4:return b(M.fourDigits,e);default:return b(new RegExp("^\\d{1,"+t+"}"),e)}}function Ct(t,e){switch(t){case 1:return b(M.singleDigitSigned,e);case 2:return b(M.twoDigitsSigned,e);case 3:return b(M.threeDigitsSigned,e);case 4:return b(M.fourDigitsSigned,e);default:return b(new RegExp("^-?\\d{1,"+t+"}"),e)}}function se(t){switch(t){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function or(t,e){let r=e>0,o=r?e:1-e,n;if(o<=50)n=t||100;else{let a=o+50,i=Math.trunc(a/100)*100,m=t>=a%100;n=t+i-(m?100:0)}return r?n:1-n}function nr(t){return t%400===0||t%4===0&&t%100!==0}var jo=class extends g{priority=130;incompatibleTokens="Y","R","u","w","I","i","e","c","t","T";parse(t,e,r){let o=n=>({year:n,isTwoDigitYear:e==="yy"});switch(e){case"y":return R(k(4,t),o);case"yo":return R(r.ordinalNumber(t,{unit:"year"}),o);default:return R(k(e.length,t),o)}}validate(t,e){return e.isTwoDigitYear||e.year>0}set(t,e,r){let o=t.getFullYear();if(r.isTwoDigitYear){let a=or(r.year,o);return t.setFullYear(a,0,1),t.setHours(0,0,0,0),t}let n=!("era"in e)||e.era===1?r.year:1-r.year;return t.setFullYear(n,0,1),t.setHours(0,0,0,0),t}},Bo=class extends g{priority=130;parse(t,e,r){let o=n=>({year:n,isTwoDigitYear:e==="YY"});switch(e){case"Y":return R(k(4,t),o);case"Yo":return R(r.ordinalNumber(t,{unit:"year"}),o);default:return R(k(e.length,t),o)}}validate(t,e){return e.isTwoDigitYear||e.year>0}set(t,e,r,o){let n=bt(t,o);if(r.isTwoDigitYear){let i=or(r.year,n);return t.setFullYear(i,0,o.firstWeekContainsDate),t.setHours(0,0,0,0),E(t,o)}let a=!("era"in e)||e.era===1?r.year:1-r.year;return t.setFullYear(a,0,o.firstWeekContainsDate),t.setHours(0,0,0,0),E(t,o)}incompatibleTokens="y","R","u","Q","q","M","L","I","d","D","i","t","T"},zo=class extends g{priority=130;parse(t,e){return Ct(e==="R"?4:e.length,t)}set(t,e,r){let o=l(t,0);return o.setFullYear(r,0,4),o.setHours(0,0,0,0),P(o)}incompatibleTokens="G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"},Go=class extends g{priority=130;parse(t,e){return Ct(e==="u"?4:e.length,t)}set(t,e,r){return t.setFullYear(r,0,1),t.setHours(0,0,0,0),t}incompatibleTokens="G","y","Y","R","w","I","i","e","c","t","T"},Qo=class extends g{priority=120;parse(t,e,r){switch(e){case"Q":case"QQ":return k(e.length,t);case"Qo":return r.ordinalNumber(t,{unit:"quarter"});case"QQQ":return r.quarter(t,{width:"abbreviated",context:"formatting"})||r.quarter(t,{width:"narrow",context:"formatting"});case"QQQQQ":return r.quarter(t,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(t,{width:"wide",context:"formatting"})||r.quarter(t,{width:"abbreviated",context:"formatting"})||r.quarter(t,{width:"narrow",context:"formatting"})}}validate(t,e){return e>=1&&e<=4}set(t,e,r){return t.setMonth((r-1)*3,1),t.setHours(0,0,0,0),t}incompatibleTokens="Y","R","q","M","L","w","I","d","D","i","e","c","t","T"},Xo=class extends g{priority=120;parse(t,e,r){switch(e){case"q":case"qq":return k(e.length,t);case"qo":return r.ordinalNumber(t,{unit:"quarter"});case"qqq":return r.quarter(t,{width:"abbreviated",context:"standalone"})||r.quarter(t,{width:"narrow",context:"standalone"});case"qqqqq":return r.quarter(t,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(t,{width:"wide",context:"standalone"})||r.quarter(t,{width:"abbreviated",context:"standalone"})||r.quarter(t,{width:"narrow",context:"standalone"})}}validate(t,e){return e>=1&&e<=4}set(t,e,r){return t.setMonth((r-1)*3,1),t.setHours(0,0,0,0),t}incompatibleTokens="Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"},Vo=class extends g{incompatibleTokens="Y","R","q","Q","L","w","I","D","i","e","c","t","T";priority=110;parse(t,e,r){let o=n=>n-1;switch(e){case"M":return R(b(M.month,t),o);case"MM":return R(k(2,t),o);case"Mo":return R(r.ordinalNumber(t,{unit:"month"}),o);case"MMM":return r.month(t,{width:"abbreviated",context:"formatting"})||r.month(t,{width:"narrow",context:"formatting"});case"MMMMM":return r.month(t,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(t,{width:"wide",context:"formatting"})||r.month(t,{width:"abbreviated",context:"formatting"})||r.month(t,{width:"narrow",context:"formatting"})}}validate(t,e){return e>=0&&e<=11}set(t,e,r){return t.setMonth(r,1),t.setHours(0,0,0,0),t}},Zo=class extends g{priority=110;parse(t,e,r){let o=n=>n-1;switch(e){case"L":return R(b(M.month,t),o);case"LL":return R(k(2,t),o);case"Lo":return R(r.ordinalNumber(t,{unit:"month"}),o);case"LLL":return r.month(t,{width:"abbreviated",context:"standalone"})||r.month(t,{width:"narrow",context:"standalone"});case"LLLLL":return r.month(t,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(t,{width:"wide",context:"standalone"})||r.month(t,{width:"abbreviated",context:"standalone"})||r.month(t,{width:"narrow",context:"standalone"})}}validate(t,e){return e>=0&&e<=11}set(t,e,r){return t.setMonth(r,1),t.setHours(0,0,0,0),t}incompatibleTokens="Y","R","q","Q","M","w","I","D","i","e","c","t","T"},Jo=class extends g{priority=100;parse(t,e,r){switch(e){case"w":return b(M.week,t);case"wo":return r.ordinalNumber(t,{unit:"week"});default:return k(e.length,t)}}validate(t,e){return e>=1&&e<=53}set(t,e,r,o){return E(Ke(t,r,o),o)}incompatibleTokens="y","R","u","q","Q","M","L","I","d","D","i","t","T"},Ko=class extends g{priority=100;parse(t,e,r){switch(e){case"I":return b(M.week,t);case"Io":return r.ordinalNumber(t,{unit:"week"});default:return k(e.length,t)}}validate(t,e){return e>=1&&e<=53}set(t,e,r){return P(tr(t,r))}incompatibleTokens="y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"},tn=31,28,31,30,31,30,31,31,30,31,30,31,en=31,29,31,30,31,30,31,31,30,31,30,31,rn=class extends g{priority=90;subPriority=1;parse(t,e,r){switch(e){case"d":return b(M.date,t);case"do":return r.ordinalNumber(t,{unit:"date"});default:return k(e.length,t)}}validate(t,e){let r=t.getFullYear(),o=nr(r),n=t.getMonth();return o?e>=1&&e<=enn:e>=1&&e<=tnn}set(t,e,r){return t.setDate(r),t.setHours(0,0,0,0),t}incompatibleTokens="Y","R","q","Q","w","I","D","i","e","c","t","T"},on=class extends g{priority=90;subpriority=1;parse(t,e,r){switch(e){case"D":case"DD":return b(M.dayOfYear,t);case"Do":return r.ordinalNumber(t,{unit:"date"});default:return k(e.length,t)}}validate(t,e){let r=t.getFullYear();return nr(r)?e>=1&&e<=366:e>=1&&e<=365}set(t,e,r){return t.setMonth(0,r),t.setHours(0,0,0,0),t}incompatibleTokens="Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"},nn=class extends g{priority=90;parse(t,e,r){switch(e){case"E":case"EE":case"EEE":return r.day(t,{width:"abbreviated",context:"formatting"})||r.day(t,{width:"short",context:"formatting"})||r.day(t,{width:"narrow",context:"formatting"});case"EEEEE":return r.day(t,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(t,{width:"short",context:"formatting"})||r.day(t,{width:"narrow",context:"formatting"});case"EEEE":default:return r.day(t,{width:"wide",context:"formatting"})||r.day(t,{width:"abbreviated",context:"formatting"})||r.day(t,{width:"short",context:"formatting"})||r.day(t,{width:"narrow",context:"formatting"})}}validate(t,e){return e>=0&&e<=6}set(t,e,r,o){return t=lt(t,r,o),t.setHours(0,0,0,0),t}incompatibleTokens="D","i","e","c","t","T"},an=class extends g{priority=90;parse(t,e,r,o){let n=a=>{let i=Math.floor((a-1)/7)*7;return(a+o.weekStartsOn+6)%7+i};switch(e){case"e":case"ee":return R(k(e.length,t),n);case"eo":return R(r.ordinalNumber(t,{unit:"day"}),n);case"eee":return r.day(t,{width:"abbreviated",context:"formatting"})||r.day(t,{width:"short",context:"formatting"})||r.day(t,{width:"narrow",context:"formatting"});case"eeeee":return r.day(t,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(t,{width:"short",context:"formatting"})||r.day(t,{width:"narrow",context:"formatting"});case"eeee":default:return r.day(t,{width:"wide",context:"formatting"})||r.day(t,{width:"abbreviated",context:"formatting"})||r.day(t,{width:"short",context:"formatting"})||r.day(t,{width:"narrow",context:"formatting"})}}validate(t,e){return e>=0&&e<=6}set(t,e,r,o){return t=lt(t,r,o),t.setHours(0,0,0,0),t}incompatibleTokens="y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"},sn=class extends g{priority=90;parse(t,e,r,o){let n=a=>{let i=Math.floor((a-1)/7)*7;return(a+o.weekStartsOn+6)%7+i};switch(e){case"c":case"cc":return R(k(e.length,t),n);case"co":return R(r.ordinalNumber(t,{unit:"day"}),n);case"ccc":return r.day(t,{width:"abbreviated",context:"standalone"})||r.day(t,{width:"short",context:"standalone"})||r.day(t,{width:"narrow",context:"standalone"});case"ccccc":return r.day(t,{width:"narrow",context:"standalone"});case"cccccc":return r.day(t,{width:"short",context:"standalone"})||r.day(t,{width:"narrow",context:"standalone"});case"cccc":default:return r.day(t,{width:"wide",context:"standalone"})||r.day(t,{width:"abbreviated",context:"standalone"})||r.day(t,{width:"short",context:"standalone"})||r.day(t,{width:"narrow",context:"standalone"})}}validate(t,e){return e>=0&&e<=6}set(t,e,r,o){return t=lt(t,r,o),t.setHours(0,0,0,0),t}incompatibleTokens="y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"},un=class extends g{priority=90;parse(t,e,r){let o=n=>n===0?7:n;switch(e){case"i":case"ii":return k(e.length,t);case"io":return r.ordinalNumber(t,{unit:"day"});case"iii":return R(r.day(t,{width:"abbreviated",context:"formatting"})||r.day(t,{width:"short",context:"formatting"})||r.day(t,{width:"narrow",context:"formatting"}),o);case"iiiii":return R(r.day(t,{width:"narrow",context:"formatting"}),o);case"iiiiii":return R(r.day(t,{width:"short",context:"formatting"})||r.day(t,{width:"narrow",context:"formatting"}),o);case"iiii":default:return R(r.day(t,{width:"wide",context:"formatting"})||r.day(t,{width:"abbreviated",context:"formatting"})||r.day(t,{width:"short",context:"formatting"})||r.day(t,{width:"narrow",context:"formatting"}),o)}}validate(t,e){return e>=1&&e<=7}set(t,e,r){return t=er(t,r),t.setHours(0,0,0,0),t}incompatibleTokens="y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"},mn=class extends g{priority=80;parse(t,e,r){switch(e){case"a":case"aa":case"aaa":return r.dayPeriod(t,{width:"abbreviated",context:"formatting"})||r.dayPeriod(t,{width:"narrow",context:"formatting"});case"aaaaa":return r.dayPeriod(t,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(t,{width:"wide",context:"formatting"})||r.dayPeriod(t,{width:"abbreviated",context:"formatting"})||r.dayPeriod(t,{width:"narrow",context:"formatting"})}}set(t,e,r){return t.setHours(se(r),0,0,0),t}incompatibleTokens="b","B","H","k","t","T"},fn=class extends g{priority=80;parse(t,e,r){switch(e){case"b":case"bb":case"bbb":return r.dayPeriod(t,{width:"abbreviated",context:"formatting"})||r.dayPeriod(t,{width:"narrow",context:"formatting"});case"bbbbb":return r.dayPeriod(t,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(t,{width:"wide",context:"formatting"})||r.dayPeriod(t,{width:"abbreviated",context:"formatting"})||r.dayPeriod(t,{width:"narrow",context:"formatting"})}}set(t,e,r){return t.setHours(se(r),0,0,0),t}incompatibleTokens="a","B","H","k","t","T"},ln=class extends g{priority=80;parse(t,e,r){switch(e){case"B":case"BB":case"BBB":return r.dayPeriod(t,{width:"abbreviated",context:"formatting"})||r.dayPeriod(t,{width:"narrow",context:"formatting"});case"BBBBB":return r.dayPeriod(t,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(t,{width:"wide",context:"formatting"})||r.dayPeriod(t,{width:"abbreviated",context:"formatting"})||r.dayPeriod(t,{width:"narrow",context:"formatting"})}}set(t,e,r){return t.setHours(se(r),0,0,0),t}incompatibleTokens="a","b","t","T"},pn=class extends g{priority=70;parse(t,e,r){switch(e){case"h":return b(M.hour12h,t);case"ho":return r.ordinalNumber(t,{unit:"hour"});default:return k(e.length,t)}}validate(t,e){return e>=1&&e<=12}set(t,e,r){let o=t.getHours()>=12;return o&&r<12?t.setHours(r+12,0,0,0):!o&&r===12?t.setHours(0,0,0,0):t.setHours(r,0,0,0),t}incompatibleTokens="H","K","k","t","T"},cn=class extends g{priority=70;parse(t,e,r){switch(e){case"H":return b(M.hour23h,t);case"Ho":return r.ordinalNumber(t,{unit:"hour"});default:return k(e.length,t)}}validate(t,e){return e>=0&&e<=23}set(t,e,r){return t.setHours(r,0,0,0),t}incompatibleTokens="a","b","h","K","k","t","T"},dn=class extends g{priority=70;parse(t,e,r){switch(e){case"K":return b(M.hour11h,t);case"Ko":return r.ordinalNumber(t,{unit:"hour"});default:return k(e.length,t)}}validate(t,e){return e>=0&&e<=11}set(t,e,r){return t.getHours()>=12&&r<12?t.setHours(r+12,0,0,0):t.setHours(r,0,0,0),t}incompatibleTokens="h","H","k","t","T"},hn=class extends g{priority=70;parse(t,e,r){switch(e){case"k":return b(M.hour24h,t);case"ko":return r.ordinalNumber(t,{unit:"hour"});default:return k(e.length,t)}}validate(t,e){return e>=1&&e<=24}set(t,e,r){let o=r<=24?r%24:r;return t.setHours(o,0,0,0),t}incompatibleTokens="a","b","h","H","K","t","T"},xn=class extends g{priority=60;parse(t,e,r){switch(e){case"m":return b(M.minute,t);case"mo":return r.ordinalNumber(t,{unit:"minute"});default:return k(e.length,t)}}validate(t,e){return e>=0&&e<=59}set(t,e,r){return t.setMinutes(r,0,0),t}incompatibleTokens="t","T"},gn=class extends g{priority=50;parse(t,e,r){switch(e){case"s":return b(M.second,t);case"so":return r.ordinalNumber(t,{unit:"second"});default:return k(e.length,t)}}validate(t,e){return e>=0&&e<=59}set(t,e,r){return t.setSeconds(r,0),t}incompatibleTokens="t","T"},yn=class extends g{priority=30;parse(t,e){let r=o=>Math.trunc(o*Math.pow(10,-e.length+3));return R(k(e.length,t),r)}set(t,e,r){return t.setMilliseconds(r),t}incompatibleTokens="t","T"},wn=class extends g{priority=10;parse(t,e){switch(e){case"X":return j($.basicOptionalMinutes,t);case"XX":return j($.basic,t);case"XXXX":return j($.basicOptionalSeconds,t);case"XXXXX":return j($.extendedOptionalSeconds,t);case"XXX":default:return j($.extended,t)}}set(t,e,r){return e.timestampIsSet?t:l(t,t.getTime()-ot(t)-r)}incompatibleTokens="t","T","x"},vn=class extends g{priority=10;parse(t,e){switch(e){case"x":return j($.basicOptionalMinutes,t);case"xx":return j($.basic,t);case"xxxx":return j($.basicOptionalSeconds,t);case"xxxxx":return j($.extendedOptionalSeconds,t);case"xxx":default:return j($.extended,t)}}set(t,e,r){return e.timestampIsSet?t:l(t,t.getTime()-ot(t)-r)}incompatibleTokens="t","T","X"},bn=class extends g{priority=40;parse(t){return rr(t)}set(t,e,r){returnl(t,r*1e3),{timestampIsSet:!0}}incompatibleTokens="*"},_n=class extends g{priority=20;parse(t){return rr(t)}set(t,e,r){returnl(t,r),{timestampIsSet:!0}}incompatibleTokens="*"},Fh={G:new $o,y:new jo,Y:new Bo,R:new zo,u:new Go,Q:new Qo,q:new Xo,M:new Vo,L:new Zo,w:new Jo,I:new Ko,d:new rn,D:new on,E:new nn,e:new an,c:new sn,i:new un,a:new mn,b:new fn,B:new ln,h:new pn,H:new cn,K:new dn,k:new hn,m:new xn,s:new gn,S:new yn,X:new wn,x:new vn,t:new bn,T:new _n};var Dn=/(\w)\1*|''|'(''|^')+('|$)|./g,Mn=/^'(^*?)'?$/,Rn=/''/g,On=/a-zA-Z/;function Wt(t,e){let r=s(t);if(!Z(r))throw new RangeError("Invalid time value");let o=e.match(Dn);return o?o.map(n=>{if(n==="''")return"'";let a=n0;if(a==="'")return En(n);let i=aea;if(i)return i(r,n);if(a.match(On))throw new RangeError("Format string contains an unescaped latin alphabet character "+a+"");return n}).join(""):""}function En(t){let e=t.match(Mn);return e?e1.replace(Rn,"'"):t}var sr=(t,e,r=0,o=[])=>{letn,a=K("uninitialized"),i,m=K({ok:!0,value:e}),p=X(t,o);return yt(()=>{(async()=>{let f=setTimeout(()=>a("pending"),r);try{let c=await p();if(c===void 0)return;m({ok:!0,value:c})}catch(c){m({ok:!1,value:c})}finally{clearTimeout(f),a("resolved")}})()},p,r,...o),i.ok?{result:i.value,state:n}:{result:i.value,state:"rejected"}};var ir=t=>{let e=t.flatMap(({changes:n,created:a,userId:i})=>n.flatMap(m=>{let p=Pn(m,i,a);return p?p:[]})),r=...new Set(e.map(({created:n})=>n)).sort();return{history:e.reduce((n,a)=>{if(a.type==="insert"){let m=new Map;m.set(a.created,{text:a.text,type:a.type,userId:a.userId});let p={id:a.id,snapshots:m};if(a.parentId==="_end")return...n,p;let f=n.findIndex(({id:c})=>c===a.parentId);return f<0?(console.warn("scrapbox-snapshot@0.1.0 The parent line the snapshot would insert before is not found. change: ",a),...n,p):...n.slice(0,f),p,...n.slice(f)}let i=n.findIndex(({id:m})=>m===a.id);return i<0?(console.warn("scrapbox-snapshot@0.1.0 The line data to be append the change is not found. change: ",a),n):(ni.snapshots.set(a.created,{text:a.type==="update"?a.text:void 0,type:a.type,userId:a.userId}),n)},[]),range:r}},Pn=(t,e,r)=>{if("_insert"in t)return{type:"insert",id:t.lines.id,parentId:t._insert,text:t.lines.text,userId:e,created:r};if("_update"in t)return{type:"update",id:t._update,text:t.lines.text,userId:e,created:r};if("_delete"in t)return{type:"delete",id:t._delete,userId:e,created:r}};var Y=t=>{let{fetch:e=(n,a)=>globalThis.fetch(n,a),baseURL:r="https://scrapbox.io/",...o}=t;return{fetch:e,baseURL:r,...o}};var ur=" must not return ",Yn="transformer",Hn="recoverer",Cn="defaultValue",D1=Yn+ur,mr="called with ",M1=Cn+" must not be ",R1=Hn+ur,Wn="Ok",fr="Err",O1=mr+fr,E1=mr+Wn,T1="Carrying E in "+fr+" instead of throwing it directly. See .cause",ie="an instance of Error of the current realm.",F1="The thrown value is not "+ie,I1="The contained E should be "+ie,S1="This .cause is not "+ie;var pr=" must not return ",qn="transformer",An="recoverer",Un="defaultValue",$n=qn+pr,jn="called with ",Bn=Un+" must not be ",zn=An+pr,Lt="null",_T=$n+Lt,kT=jn+Lt,DT=Bn+Lt,MT=zn+Lt;var cr=" must not return ",Gn="transformer",Qn="recoverer",Xn="defaultValue",Vn=Gn+cr,Zn="called with ",Jn=Xn+" must not be ",Kn=Qn+cr,qt="undefined",OT=Vn+qt,ET=Zn+qt,TT=Jn+qt,FT=Kn+qt;var dr=" must not return ",ta="transformer",ea="recoverer",ra="defaultValue",WT=ta+dr,hr="called with ",LT=ra+" must not be ",qT=ea+dr;var oa="Ok",xr="Err",AT=hr+xr,UT=hr+oa,$T="Carrying E in "+xr+" instead of throwing it directly. See .cause",ue="an instance of Error of the current realm.",jT="The thrown value is not "+ue,BT="The contained E should be "+ue,zT="This .cause is not "+ue;var gr=" must not return ",na="transformer",aa="recoverer",sa="defaultValue",XT=na+gr,yr="called with ",VT=sa+" must not be ",ZT=aa+gr;var ia="Ok",wr="Err",JT=yr+wr,KT=yr+ia,tF="Carrying E in "+wr+" instead of throwing it directly. See .cause",me="an instance of Error of the current realm.",eF="The thrown value is not "+me,rF="The contained E should be "+me,oF="This .cause is not "+me;var vr=" must not return ",ua="transformer",ma="recoverer",fa="defaultValue",fF=ua+vr,br="called with ",lF=fa+" must not be ",pF=ma+vr,la="Ok",_r="Err",cF=br+_r,dF=br+la,hF="Carrying E in "+_r+" instead of throwing it directly. See .cause",fe="an instance of Error of the current realm.",xF="The thrown value is not "+fe,gF="The contained E should be "+fe,yF="This .cause is not "+fe;var H=t=>connect.sid=${t};var ha=(t,e,r)=>{let{sid:o,baseURL:n,head:a}=Y(r??{});return new Request(${n}api/commits/${t}/${e}?head=${a??""},o?{headers:{Cookie:H(o)}}:void 0)},kr=(t,e,r)=>Y(r??{}).fetch(ha(t,e,r));var Mr=async(t,e)=>{let r=await kr(t,e);if(!r.ok)throw new Error(Failed to fetch commits for ${t}/${e}: ${r.statusText},{cause:r});return ir((await r.json()).commits)};var ya=0,FP=Array.isArray;function N(t,e,r,o,n,a){e||(e={});var i,m,p=e;if("ref"in p)for(m in p={},e)m=="ref"?i=em:pm=em;var f={type:t,props:p,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ya,__i:-1,__u:0,__source:n,__self:a};if(typeof t=="function"&&(i=t.defaultProps))for(m in i)pm===void 0&&(pm=im);return v.vnode&&v.vnode(f),f}var Rr=()=>{let t=document.createElement("div");t.dataset.userscriptName="takker99/scrapbox-history-slider";let e=t.attachShadow({mode:"open"});return document.body.append(t),new Promise(r=>Oe(N(wa,{getController:o=>r(o)}),e))},wa=({getController:t})=>{lete,r=K(!0),o=X(()=>r(!1),[]),n=X(()=>r(!0),[]),a=X(()=>r(x=>!x),[]);yt(()=>t({open:o,close:n,toggle:a}),t);let i=X(x=>{x.target instanceof HTMLElement&&x.target.id==="background"&&n()},[]),{state:m,result:p}=sr(async()=>{if(e||scrapbox.Layout!=="page")return;let x=await Mr(scrapbox.Project.name,scrapbox.Page.id);return{range:x.range,getSnapshot:I=>x.history.flatMap(({snapshots:_})=>{let y=_.get(I);if(y)return y.text===void 0?[]:y.text;let w=Math.max(......_.keys().filter(q=>q<I));if(w===I)return[];let C=_.get(w)?.text;return C===void 0?[]:C})}},{range:[],getSnapshot:()=>[]},1e3,e),f,c=K(0),u,h=K(0);yt(()=>{if(m!=="resolved")return;let x=Math.max(0,p.range.length-1);c(x),h(x)},p);let d=X(x=>h(parseInt(x.currentTarget.value)),[]);return N(z,{children:[N("style",{children:'.modal{position:fixed;inset:0;z-index:1050;background-color:#000c;display:flex;flex-direction:column;align-items:center;row-gap:10px;padding:10px}.closed{display:none}.modal>*{color:var(--page-text-color, #4a4a4a);background-color:var(--page-bg, #fefefe);border:2px solid var(--body-bg, #dcdde0);border-radius:4px;padding:5px;width:calc(var(--item-width, 100%) - 10px)}@media (min-width: 768px){.modal{padding:30px}}.controller{display:flex;flex-direction:row-reverse;gap:.2em}input{width:100%}time{white-space:nowrap}.viewer{overflow-y:scroll}pre{width:100%;font-family:var(--history-slider-pre-font, Menlo,Monaco,Consolas,"Courier New",monospace);word-break:break-all;word-wrap:break-word;white-space:pre-wrap}'}),N("div",{id:"background",className:modal${e?" closed":""},onClick:i,children:[N("div",{className:"controller",children:[N("button",{type:"button",className:"close-button",onClick:n,children:"x"}),m==="resolved"&&p.range.length===0&&N("span",{className:"not-found",children:"no history found."}),m!=="rejected"&&p.range.length>0&&N(z,{children:[N("input",{type:"range",max:f,min:"0",step:"1",value:u,title:Wt(new Date(p.rangeu*1e3),"yyyy-MM-dd HH:mm:ss"),onInput:d}),N("time",{dateTime:Wt(new Date(p.rangeu*1e3),"yyyy-MM-dd HH:mm:ss"),children:Wt(new Date(p.rangeu*1e3),"yyyy-MM-dd HH:mm:ss")})]})]}),m!=="rejected"?N("div",{className:"viewer",children:N("pre",{children:p.getSnapshot(p.rangeu).join(`
)})}):N("div",{className:"error viewer",children:Error: ${JSON.stringify(p)}`})]})]})};(async()=>{let{toggle:t}=await Rr();scrapbox.PageMenu.addItem({title:"履歴スライダー",image:"https://1.bp.blogspot.com/-UZtkSEX0wh4/U5l5_dNcEsI/AAAAAAAAhWs/UzJGVzyiX8Y/s800/kaichu_dokei.png",onClick:t})})();
UserCSS
カーソル行を強調するUserCSS
code:style.src.css
@import "../../per-terra/カーソル行を強調するUserCSS/style.css";
カーソル行ではコードブロックのファイル名をunclickableにするUserCSS
code:style.src.css
@import "../../per-terra/カーソル行ではコードブロックのファイル名をunclickableにするUserCSS/style.css";
iOS上のPWA版Cosenseでstatus barがホームインジケーターに隠れないようにするUserCSS
code:style.src.css
@import "../../per-terra/iOS上のPWA版Cosenseでstatus barがホームインジケーターに隠れないようにするUserCSS/style.css";
status barのpage titleをfixedするUserCSS
code:style.src.css
@import "../../per-terra/status barのpage titleをfixedするUserCSS/style.css";
/per-terra-memex/指定したプロジェクトの更新を非表示にするUserCSS
これは公開できないのでバンドルしない
code:style.css
@import "../../per-terra-memex/指定したプロジェクトの更新を非表示にするUserCSS/style.css";
https://scrapbox-bundler.vercel.app?url=https://scrapbox.io/api/code/per-terra/import/style.src.css&bundle&minify&reload
code:style.css
htmldata-project-theme=default-dark,htmldata-project-theme=paper-dark-dark{--cursor-line-bg: rgb(255 255 255 / 4%);--cursor-line-shadow: rgb(255 255 255 / 40%)}.cursor-line{background-color:var(--cursor-line-bg, rgb(0 0 0 / 2%));box-shadow:inset 0 -5px 5px -5px var(--cursor-line-shadow, rgb(0 0 0 / 30%))}.cursor-line .code-block-start a{pointer-events:none}:root{--safe-area-inset-bottom: 18px}@media (display-mode: standalone) and (orientation: portrait){htmldata-os*=ios{.status-bar{height:calc(20px + var(--safe-area-inset-bottom));>div{padding-bottom:var(--safe-area-inset-bottom)!important}}}}.status-bar>div.page-title{position:fixed;bottom:0;left:0}