@paroicms/content-loading-plugin 0.12.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paroicms/content-loading-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "Content loading plugin for ParoiCMS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"paroicms",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"dev:public": "(cd public-front && vite)",
|
|
20
20
|
"build": "npm run build:backend && npm run build:public",
|
|
21
21
|
"build:backend": "(cd backend && tsc)",
|
|
22
|
+
"build:backend:watch": "(cd backend && tsc --watch --preserveWatchOutput)",
|
|
22
23
|
"build:public": "(cd public-front && tsc && vite build && npm run minify:public)",
|
|
23
24
|
"minify:public": "terser public-front/dist/public-front-plugin.mjs --output public-front/dist/public-front-plugin.mjs",
|
|
24
25
|
"build:public:watch": "(cd public-front && tsc && vite build --watch)",
|
|
@@ -33,19 +34,19 @@
|
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@paroicms/public-anywhere-lib": "0.19.0",
|
|
36
|
-
"@paroicms/public-server-lib": "0.
|
|
37
|
-
"@paroicms/tiny-modal": "0.
|
|
38
|
-
"@solid-primitives/i18n": "~2.
|
|
39
|
-
"@solidjs/router": "~0.
|
|
37
|
+
"@paroicms/public-server-lib": "0.27.0",
|
|
38
|
+
"@paroicms/tiny-modal": "0.4.0",
|
|
39
|
+
"@solid-primitives/i18n": "~2.2.0",
|
|
40
|
+
"@solidjs/router": "~0.15.3",
|
|
40
41
|
"@types/node": "~22.13.10",
|
|
41
42
|
"rimraf": "~6.0.1",
|
|
42
|
-
"sass": "~1.
|
|
43
|
+
"sass": "~1.85.1",
|
|
43
44
|
"solid-devtools": "~0.33.0",
|
|
44
|
-
"solid-js": "1.9.
|
|
45
|
+
"solid-js": "1.9.5",
|
|
45
46
|
"typescript": "~5.8.2",
|
|
46
|
-
"vite": "~6.
|
|
47
|
-
"vite-plugin-solid": "~2.11.
|
|
48
|
-
"terser": "~5.
|
|
47
|
+
"vite": "~6.2.2",
|
|
48
|
+
"vite-plugin-solid": "~2.11.6",
|
|
49
|
+
"terser": "~5.39.0"
|
|
49
50
|
},
|
|
50
51
|
"type": "module",
|
|
51
52
|
"main": "backend/dist/plugin.js",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@
|
|
1
|
+
@import"https://cdn.jsdelivr.net/npm/@paroicms/tiny-modal@0.4.0/dist/tiny-modal.css";.PaSearchApp-form{display:flex;justify-content:center;margin-bottom:20px}.PaSearchOpenerButton{cursor:pointer}.PaSearchOpenerButton-svg{fill:var(--paInteractiveColor, #000)}.PaSearchOpener{box-sizing:border-box;display:flex;gap:20px;justify-content:center;flex-direction:column;align-items:center;max-width:500px;padding:30px 5px;width:85vw}.PaSearchOpener-input{border:1px solid transparent;font-size:1.2rem;padding:10px;width:100%}.PaSearchOpener-button{cursor:pointer;padding:20px 25px}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{delegateEvents as te,template as S,insert as E,setAttribute as K,isServer as k,getRequestEvent as Y,createComponent as $,memo as me,effect as F,className as pe,render as ge}from"https://esm.sh/solid-js@1.9.4/web";import{createMemo as C,getOwner as we,runWithOwner as ve,useContext as ye,createContext as be,createSignal as A,createRenderEffect as He,on as B,startTransition as Ve,resetErrorBoundaries as Ge,batch as Ke,untrack as $e,createComponent as ze,children as Re,mergeProps as Je,Show as T,createRoot as Qe,onCleanup as Se,sharedConfig as J,createEffect as ne}from"https://esm.sh/solid-js@1.9.4";function Z(e){return e.varName?` for '${e.varName}'`:""}function Xe(e){return!isNaN(e)&&!isNaN(parseFloat(e))}function Ye(e,t={}){if(e==null||e===""&&!t.allowEmpty)throw new Error(`Missing string value${Z(t)}`);return typeof e=="string"?e:e.toString()}function H(e,t={}){return e==null||e===""&&!t.allowEmpty?void 0:Ye(e,t)}function Ze(e,t={}){if(typeof e=="number")return e;if(e==null)throw new Error(`Missing number value${Z(t)}`);if(typeof e=="string"&&Xe(e))return Number(e);throw new Error(`Cannot convert to number the value of type '${typeof e}'${Z(t)}`)}function V(e,t={}){return e==null?void 0:Ze(e,t)}function et(e){let t=e;const r=t.indexOf("?");r!==-1&&(t=t.substring(0,r));const o=t.indexOf("#");o!==-1&&(t=t.substring(0,o));const n=t.lastIndexOf("/");return n===-1?void 0:t.slice(0,n)}const Le="/api/plugin/content-loading",Ee=et(import.meta.url);async function tt(e){const t=`${Le}${e}`,r=await fetch(t);if(r.status!==200)throw new Error(`api error ${r.status}`);return await r.text()}var Ce=e=>e!=null&&(e=Object.getPrototypeOf(e),e===Array.prototype||e===Object.prototype);function Ae(e,t,r){for(const[o,n]of Object.entries(t)){const a=`${r}.${o}`;e[a]=n,Ce(n)&&Ae(e,n,a)}}function nt(e){const t={...e};for(const[r,o]of Object.entries(e))Ce(o)&&Ae(t,o,r);return t}var rt=(e,t)=>{if(t)for(const[r,o]of Object.entries(t))e=e.replace(new RegExp(`{{\\s*${r}\\s*}}`,"g"),o);return e},ot=e=>e;function at(e,t=ot){return(r,...o)=>{r[0]==="."&&(r=r.slice(1));const n=e()?.[r];switch(typeof n){case"function":return n(...o);case"string":return t(n,o[0]);default:return n}}}const st={nothingGet:"No results found for",search:"Search"},it={loadMore:"Load more"},ct={searchApp:st,infiniteLoading:it},lt={nothingGet:"Aucun résultat trouvé pour",search:"Rechercher"},ut={loadMore:"Charger la suite"},dt={searchApp:lt,infiniteLoading:ut},le={en:ct,fr:dt};function z(e){const t=C((()=>{const o=e in le?e:"en";return nt(le[o])}));return{t:at(t,rt)}}var ft=S("<button class=InfiniteLoading-btn type=button>"),ht=S("<div class=InfiniteLoading-actionArea>"),mt=S("<img class=InfiniteLoading-spinner width=50 height=50 alt=…>");function pt(e,{language:t}){const r=V(e.dataset.start),o=V(e.dataset.total),n=V(e.dataset.limit),a=H(e.dataset.parentId),s=H(e.dataset.template),i=H(e.dataset.labeledById);if(!(r===void 0||o===void 0||a===void 0||n===void 0||s===void 0)){if(!t)throw new Error("Missing language");gt({language:t,limit:n,parentId:a,root:e,start:r,total:o,templateName:s,labeledById:i})}}function gt({language:e,limit:t,root:r,start:o,total:n,parentId:a,templateName:s,labeledById:i}){const{t:l}=z(e);let c=o;if(c>=n)return;const d=(()=>{var v=ft();return v.$$click=g,E(v,(()=>l("infiniteLoading.loadMore"))),v})(),m=(()=>{var v=ht();return E(v,d),v})(),h=(()=>{var v=mt();return K(v,"src",`${Ee}/spinner.svg`),v})();r.appendChild(m);async function g(){r.appendChild(h);const v=await wt({limit:t,newStart:c,parentId:a,templateName:s,labeledById:i});for(const u of v)r.insertBefore(u,m);c+=t,c>=n&&m.remove(),h.remove()}}async function wt({limit:e,newStart:t,parentId:r,templateName:o,labeledById:n}){const a=n?`?labeled=${encodeURIComponent(n)}`:"",s=`/partials?templateName=${encodeURIComponent(o)}&children-of=${encodeURIComponent(r)}&start=${encodeURIComponent(t)}&limit=${encodeURIComponent(e)}${a}`,i=await tt(s),l=document.createElement("div");return l.innerHTML=i,[...l.children]}te(["click"]);function Pe(){let e=new Set;function t(n){return e.add(n),()=>e.delete(n)}let r=!1;function o(n,a){if(r)return!(r=!1);const s={to:n,options:a,defaultPrevented:!1,preventDefault:()=>s.defaultPrevented=!0};for(const i of e)i.listener({...s,from:i.location,retry:l=>{l&&(r=!0),i.navigate(n,{...a,resolve:!1})}});return!s.defaultPrevented}return{subscribe:t,confirm:o}}let ee;function re(){(!window.history.state||window.history.state._depth==null)&&window.history.replaceState({...window.history.state,_depth:window.history.length-1},""),ee=window.history.state._depth}k||re();function vt(e){return{...e,_depth:window.history.state&&window.history.state._depth}}function yt(e,t){let r=!1;return()=>{const o=ee;re();const n=o==null?null:ee-o;if(r){r=!1;return}n&&t(n)?(r=!0,window.history.go(-n)):e()}}const bt=/^(?:[a-z0-9]+:)?\/\//i,$t=/^\/+|(\/)\/+$/g,_e="http://sr";function N(e,t=!1){const r=e.replace($t,"$1");return r?t||/^[?#]/.test(r)?r:"/"+r:""}function G(e,t,r){if(bt.test(t))return;const o=N(e),n=r&&N(r);let a="";return!n||t.startsWith("/")?a=o:n.toLowerCase().indexOf(o.toLowerCase())!==0?a=o+n:a=n,(a||"/")+N(t,!a)}function Rt(e,t){if(e==null)throw new Error(t);return e}function St(e,t){return N(e).replace(/\/*(\*.*)?$/g,"")+N(t)}function xe(e){const t={};return e.searchParams.forEach(((r,o)=>{o in t?Array.isArray(t[o])?t[o].push(r):t[o]=[t[o],r]:t[o]=r})),t}function Lt(e,t,r){const[o,n]=e.split("/*",2),a=o.split("/").filter(Boolean),s=a.length;return i=>{const l=i.split("/").filter(Boolean),c=l.length-s;if(c<0||c>0&&n===void 0&&!t)return null;const d={path:s?"":"/",params:{}},m=h=>r===void 0?void 0:r[h];for(let h=0;h<s;h++){const g=a[h],v=g[0]===":",u=v?l[h]:l[h].toLowerCase(),f=v?g.slice(1):g.toLowerCase();if(v&&Q(u,m(f)))d.params[f]=u;else if(v||!Q(u,f))return null;d.path+=`/${u}`}if(n){const h=c?l.slice(-c).join("/"):"";if(Q(h,m(n)))d.params[n]=h;else return null}return d}}function Q(e,t){const r=o=>o===e;return t===void 0?!0:typeof t=="string"?r(t):typeof t=="function"?t(e):Array.isArray(t)?t.some(r):t instanceof RegExp?t.test(e):!1}function Et(e){const[t,r]=e.pattern.split("/*",2),o=t.split("/").filter(Boolean);return o.reduce(((n,a)=>n+(a.startsWith(":")?2:3)),o.length-(r===void 0?0:1))}function Ue(e){const t=new Map,r=we();return new Proxy({},{get(o,n){return t.has(n)||ve(r,(()=>t.set(n,C((()=>e()[n]))))),t.get(n)()},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},ownKeys(){return Reflect.ownKeys(e())}})}function Ie(e){let t=/(\/?\:[^\/]+)\?/.exec(e);if(!t)return[e];let r=e.slice(0,t.index),o=e.slice(t.index+t[0].length);const n=[r,r+=t[1]];for(;t=/^(\/\:[^\/]+)\?/.exec(o);)n.push(r+=t[1]),o=o.slice(t[0].length);return Ie(o).reduce(((a,s)=>[...a,...n.map((i=>i+s))]),[])}const Ct=100,Oe=be(),Fe=be(),oe=()=>Rt(ye(Oe),"<A> and 'use' router primitives can be only used inside a Route."),Me=()=>oe().navigatorFactory(),At=()=>oe().location,Pt=()=>oe().params;function _t(e,t=""){const{component:r,preload:o,load:n,children:a,info:s}=e,i=!a||Array.isArray(a)&&!a.length,l={key:e,component:r,preload:o||n,info:s};return ke(e.path).reduce(((c,d)=>{for(const m of Ie(d)){const h=St(t,m);let g=i?h:h.split("/*",1)[0];g=g.split("/").map((v=>v.startsWith(":")||v.startsWith("*")?v:encodeURIComponent(v))).join("/"),c.push({...l,originalPath:d,pattern:g,matcher:Lt(g,!i,e.matchFilters)})}return c}),[])}function xt(e,t=0){return{routes:e,score:Et(e[e.length-1])*1e4-t,matcher(r){const o=[];for(let n=e.length-1;n>=0;n--){const a=e[n],s=a.matcher(r);if(!s)return null;o.unshift({...s,route:a})}return o}}}function ke(e){return Array.isArray(e)?e:[e]}function Te(e,t="",r=[],o=[]){const n=ke(e);for(let a=0,s=n.length;a<s;a++){const i=n[a];if(i&&typeof i=="object"){i.hasOwnProperty("path")||(i.path="");const l=_t(i,t);for(const c of l){r.push(c);const d=Array.isArray(i.children)&&i.children.length===0;if(i.children&&!d)Te(i.children,c.pattern,r,o);else{const m=xt([...r],o.length);o.push(m)}r.pop()}}}return r.length?o:o.sort(((a,s)=>s.score-a.score))}function q(e,t){for(let r=0,o=e.length;r<o;r++){const n=e[r].matcher(t);if(n)return n}return[]}function Ut(e,t,r){const o=new URL(_e),n=C((d=>{const m=e();try{return new URL(m,o)}catch{return console.error(`Invalid path ${m}`),d}}),o,{equals:(d,m)=>d.href===m.href}),a=C((()=>n().pathname)),s=C((()=>n().search),!0),i=C((()=>n().hash)),l=()=>"",c=B(s,(()=>xe(n())));return{get pathname(){return a()},get search(){return s()},get hash(){return i()},get state(){return t()},get key(){return l()},query:r?r(c):Ue(c)}}let x;function It(){return x}function Ot(e,t,r,o={}){const{signal:[n,a],utils:s={}}=e,i=s.parsePath||(w=>w),l=s.renderPath||(w=>w),c=s.beforeLeave||Pe(),d=G("",o.base||"");if(d===void 0)throw new Error(`${d} is not a valid base path`);d&&!n().value&&a({value:d,replace:!0,scroll:!1});const[m,h]=A(!1);let g;const v=(w,y)=>{y.value===u()&&y.state===b()||(g===void 0&&h(!0),x=w,g=y,Ve((()=>{g===y&&(f(g.value),p(g.state),Ge(),k||_[1]([]))})).finally((()=>{g===y&&Ke((()=>{x=void 0,w==="navigate"&&je(g),h(!1),g=void 0}))})))},[u,f]=A(n().value),[b,p]=A(n().state),P=Ut(u,b,s.queryWrapper),R=[],_=A(k?We():[]),M=C((()=>typeof o.transformUrl=="function"?q(t(),o.transformUrl(P.pathname)):q(t(),P.pathname))),ae=()=>{const w=M(),y={};for(let L=0;L<w.length;L++)Object.assign(y,w[L].params);return y},Ne=s.paramsWrapper?s.paramsWrapper(ae,t):Ue(ae),se={pattern:d,path:()=>d,outlet:()=>null,resolvePath(w){return G(d,w)}};return He(B(n,(w=>v("native",w)),{defer:!0})),{base:se,location:P,params:Ne,isRouting:m,renderPath:l,parsePath:i,navigatorFactory:Be,matches:M,beforeLeave:c,preloadRoute:De,singleFlight:o.singleFlight===void 0?!0:o.singleFlight,submissions:_};function qe(w,y,L){$e((()=>{if(typeof y=="number"){y&&(s.go?s.go(y):console.warn("Router integration does not support relative routing"));return}const j=!y||y[0]==="?",{replace:D,resolve:U,scroll:W,state:I}={replace:!1,resolve:!j,scroll:!0,...L},O=U?w.resolvePath(y):G(j&&P.pathname||"",y);if(O===void 0)throw new Error(`Path '${y}' is not a routable path`);if(R.length>=Ct)throw new Error("Too many redirects");const ie=u();if(O!==ie||I!==b())if(k){const ce=Y();ce&&(ce.response={status:302,headers:new Headers({Location:O})}),a({value:O,replace:D,scroll:W,state:I})}else c.confirm(O,L)&&(R.push({value:ie,replace:D,scroll:W,state:b()}),v("navigate",{value:O,state:I}))}))}function Be(w){return w=w||ye(Fe)||se,(y,L)=>qe(w,y,L)}function je(w){const y=R[0];y&&(a({...w,replace:y.replace,scroll:y.scroll}),R.length=0)}function De(w,y){const L=q(t(),w.pathname),j=x;x="preload";for(let D in L){const{route:U,params:W}=L[D];U.component&&U.component.preload&&U.component.preload();const{preload:I}=U;y&&I&&ve(r(),(()=>I({params:W,location:{pathname:w.pathname,search:w.search,hash:w.hash,query:xe(w),state:null,key:""},intent:"preload"})))}x=j}function We(){const w=Y();return w&&w.router&&w.router.submission?[w.router.submission]:[]}}function Ft(e,t,r,o){const{base:n,location:a,params:s}=e,{pattern:i,component:l,preload:c}=o().route,d=C((()=>o().path));l&&l.preload&&l.preload();const m=c?c({params:s,location:a,intent:x||"initial"}):void 0;return{parent:t,pattern:i,path:d,outlet:()=>l?ze(l,{params:s,location:a,data:m,get children(){return r()}}):r(),resolvePath(g){return G(n.path(),g,d())}}}const Mt=e=>t=>{const{base:r}=t,o=Re((()=>t.children)),n=C((()=>Te(o(),t.base||"")));let a;const s=Ot(e,n,(()=>a),{base:r,singleFlight:t.singleFlight,transformUrl:t.transformUrl});return e.create&&e.create(s),$(Oe.Provider,{value:s,get children(){return $(kt,{routerState:s,get root(){return t.root},get preload(){return t.rootPreload||t.rootLoad},get children(){return[me((()=>(a=we())&&null)),$(Tt,{routerState:s,get branches(){return n()}})]}})}})};function kt(e){const t=e.routerState.location,r=e.routerState.params,o=C((()=>e.preload&&$e((()=>{e.preload({params:r,location:t,intent:It()||"initial"})}))));return $(T,{get when(){return e.root},keyed:!0,get fallback(){return e.children},children:n=>$(n,{params:r,location:t,get data(){return o()},get children(){return e.children}})})}function Tt(e){if(k){const n=Y();if(n&&n.router&&n.router.dataOnly){Nt(n,e.routerState,e.branches);return}n&&((n.router||(n.router={})).matches||(n.router.matches=e.routerState.matches().map((({route:a,path:s,params:i})=>({path:a.originalPath,pattern:a.pattern,match:s,params:i,info:a.info})))))}const t=[];let r;const o=C(B(e.routerState.matches,((n,a,s)=>{let i=a&&n.length===a.length;const l=[];for(let c=0,d=n.length;c<d;c++){const m=a&&a[c],h=n[c];s&&m&&h.route.key===m.route.key?l[c]=s[c]:(i=!1,t[c]&&t[c](),Qe((g=>{t[c]=g,l[c]=Ft(e.routerState,l[c-1]||e.routerState.base,ue((()=>o()[c+1])),(()=>e.routerState.matches()[c]))})))}return t.splice(n.length).forEach((c=>c())),s&&i?s:(r=l[0],l)})));return ue((()=>o()&&r))()}const ue=e=>()=>$(T,{get when(){return e()},keyed:!0,children:t=>$(Fe.Provider,{value:t,get children(){return t.outlet()}})}),X=e=>{const t=Re((()=>e.children));return Je(e,{get children(){return t()}})};function Nt(e,t,r){const o=new URL(e.request.url),n=q(r,new URL(e.router.previousUrl||e.request.url).pathname),a=q(r,o.pathname);for(let s=0;s<a.length;s++){(!n[s]||a[s].route!==n[s].route)&&(e.router.dataOnly=!0);const{route:i,params:l}=a[s];i.preload&&i.preload({params:l,location:t.location,intent:"preload"})}}function qt([e,t],r,o){return[e,o?n=>t(o(n)):t]}function Bt(e){let t=!1;const r=n=>typeof n=="string"?{value:n}:n,o=qt(A(r(e.get()),{equals:(n,a)=>n.value===a.value&&n.state===a.state}),void 0,(n=>(!t&&e.set(n),J.registry&&!J.done&&(J.done=!0),n)));return e.init&&Se(e.init(((n=e.get())=>{t=!0,o[1](r(n)),t=!1}))),Mt({signal:o,create:e.create,utils:e.utils})}function jt(e,t,r){return e.addEventListener(t,r),()=>e.removeEventListener(t,r)}function Dt(e,t){const r=e&&document.getElementById(e);r?r.scrollIntoView():t&&window.scrollTo(0,0)}const Wt=new Map;function Ht(e=!0,t=!1,r="/_server",o){return n=>{const a=n.base.path(),s=n.navigatorFactory(n.base);let i,l;function c(u){return u.namespaceURI==="http://www.w3.org/2000/svg"}function d(u){if(u.defaultPrevented||u.button!==0||u.metaKey||u.altKey||u.ctrlKey||u.shiftKey)return;const f=u.composedPath().find((M=>M instanceof Node&&M.nodeName.toUpperCase()==="A"));if(!f||t&&!f.hasAttribute("link"))return;const b=c(f),p=b?f.href.baseVal:f.href;if((b?f.target.baseVal:f.target)||!p&&!f.hasAttribute("state"))return;const R=(f.getAttribute("rel")||"").split(/\s+/);if(f.hasAttribute("download")||R&&R.includes("external"))return;const _=b?new URL(p,document.baseURI):new URL(p);if(!(_.origin!==window.location.origin||a&&_.pathname&&!_.pathname.toLowerCase().startsWith(a.toLowerCase())))return[f,_]}function m(u){const f=d(u);if(!f)return;const[b,p]=f,P=n.parsePath(p.pathname+p.search+p.hash),R=b.getAttribute("state");u.preventDefault(),s(P,{resolve:!1,replace:b.hasAttribute("replace"),scroll:!b.hasAttribute("noscroll"),state:R?JSON.parse(R):void 0})}function h(u){const f=d(u);if(!f)return;const[b,p]=f;n.preloadRoute(p,b.getAttribute("preload")!=="false")}function g(u){clearTimeout(i);const f=d(u);if(!f)return l=null;const[b,p]=f;l!==b&&(i=setTimeout((()=>{n.preloadRoute(p,b.getAttribute("preload")!=="false"),l=b}),20))}function v(u){if(u.defaultPrevented)return;let f=u.submitter&&u.submitter.hasAttribute("formaction")?u.submitter.getAttribute("formaction"):u.target.getAttribute("action");if(!f)return;if(!f.startsWith("https://action/")){const p=new URL(f,_e);if(f=n.parsePath(p.pathname+p.search),!f.startsWith(r))return}if(u.target.method.toUpperCase()!=="POST")throw new Error("Only POST forms are supported for Actions");const b=Wt.get(f);if(b){u.preventDefault();const p=new FormData(u.target,u.submitter);b.call({r:n,f:u.target},u.target.enctype==="multipart/form-data"?p:new URLSearchParams(p))}}te(["click","submit"]),document.addEventListener("click",m),e&&(document.addEventListener("mousemove",g,{passive:!0}),document.addEventListener("focusin",h,{passive:!0}),document.addEventListener("touchstart",h,{passive:!0})),document.addEventListener("submit",v),Se((()=>{document.removeEventListener("click",m),e&&(document.removeEventListener("mousemove",g),document.removeEventListener("focusin",h),document.removeEventListener("touchstart",h)),document.removeEventListener("submit",v)}))}}function Vt(e){const t=e.replace(/^.*?#/,"");if(!t.startsWith("/")){const[,r="/"]=window.location.hash.split("#",2);return`${r}#${t}`}return t}function Gt(e){const t=()=>window.location.hash.slice(1),r=Pe();return Bt({get:t,set({value:o,replace:n,scroll:a,state:s}){n?window.history.replaceState(vt(s),"","#"+o):window.history.pushState(s,"","#"+o);const i=o.indexOf("#"),l=i>=0?o.slice(i+1):"";Dt(l,a),re()},init:o=>jt(window,"hashchange",yt(o,(n=>!r.confirm(n&&n<0?n:t())))),create:Ht(e.preload,e.explicitLinks,e.actionBase),utils:{go:o=>window.history.go(o),renderPath:o=>`#${o}`,parsePath:Vt,beforeLeave:r}})(e)}function Kt(e){const t=Me(),r=At(),{href:o,state:n}=e,a=typeof o=="function"?o({navigate:t,location:r}):o;return t(a,{replace:!0,state:n}),null}const zt={};async function de({language:e,text:t,limit:r,start:o,templateName:n}){const a=`${Le}/search?language=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}&limit=${encodeURIComponent(r)}&start=${encodeURIComponent(o)}&tpl=${encodeURIComponent(n)}`,s=await fetch(a,{method:"GET"});if(s.status!==200){const l=await s.text();throw new Error(`API error (${s.status}): ${l}`)}return await s.json()}const Jt="_SearchForm_1a5n6_1",Qt={SearchForm:Jt};var Xt=S("<form><input type=search><button type=submit>");const Yt=e=>{const t=Me(),[r,o]=A(e.value??""),{t:n}=z(e.language);ne(B((()=>e.value),(()=>o(e.value??""))));const a=async s=>{s.preventDefault(),t(`/q/${encodeURIComponent(r())}`)};return(()=>{var s=Xt(),i=s.firstChild,l=i.nextSibling;return s.addEventListener("submit",a),i.addEventListener("change",(c=>o(c.currentTarget.value))),E(l,(()=>n("searchApp.search"))),F((c=>{var d=Qt.SearchForm,m=n("searchApp.search");return d!==c.e&&pe(s,c.e=d),m!==c.t&&K(i,"placeholder",c.t=m),c}),{e:void 0,t:void 0}),F((()=>i.value=r())),s})()};var Zt=S("<div class=SearchPageResponse>"),fe=S("<div>"),en=S("<img class=SearchPageResponse-spinner width=80 height=80 alt=…>"),tn=S("<button type=button>"),nn=S("<div class=SearchPageResponse-noResultMessage> <span>");function he({language:e,limit:t,templateName:r}){const{t:o}=z(e),{searchString:n}=Pt(),[a,s]=A(""),[i,l]=A(0),[c,d]=A(0),[m,h]=A(!1);ne(B((()=>n),g));async function g(){if(n){h(!0);try{s(""),d(0);const u=await de({language:e,text:decodeURIComponent(n),limit:t,start:c(),templateName:r});if(l(u.total),d(c()+t),!u.html)return;s(u.html)}finally{h(!1)}}}async function v(){if(!n)return;const u=i();if(u===void 0||c()>=u)return;const f=await de({language:e,text:decodeURIComponent(n),limit:t,start:c(),templateName:r});f.html&&(s(`${a()}${f.html}`),d(c()+t))}return(()=>{var u=fe();return E(u,$(Yt,{language:e,get value(){return n?decodeURIComponent(n):void 0}}),null),E(u,$(T,{when:n,get children(){var f=Zt();return E(f,(()=>{var b=me((()=>!!m()));return()=>b()?(()=>{var p=en();return K(p,"src",`${Ee}/spinner.svg`),p})():$(T,{get when(){return a()},get fallback(){return(()=>{var p=nn(),P=p.firstChild,R=P.nextSibling;return E(p,(()=>o("searchApp.nothingGet")),P),E(R,n),p})()},get children(){return[(()=>{var p=fe();return F((()=>p.innerHTML=a())),p})(),$(T,{get when(){return c()<i()},get children(){var p=tn();return p.$$click=v,E(p,(()=>o("infiniteLoading.loadMore"))),p}})]}})})()),f}}),null),F((()=>pe(u,zt.SiteApp))),u})()}te(["click"]);function rn(e,{language:t}){if(!t)throw new Error("Missing language");const r=V(e.dataset.limit),o=H(e.dataset.template);r===void 0||o===void 0||ge((()=>$(Gt,{explicitLinks:!0,get children(){return[$(X,{path:"/",component:()=>$(Kt,{href:"/q"})}),$(X,{path:"/q",component:()=>$(he,{language:t,templateName:o,limit:r})}),$(X,{path:"/q/:searchString",component:()=>$(he,{language:t,templateName:o,limit:r})})]}})),e)}function on({openButton:e,dialogContent:t}){const r=e?typeof e=="string"?document.querySelector(e):e:void 0,o=typeof t=="string"?document.querySelector(t):t;if(!o)return;o instanceof HTMLTemplateElement||o.classList.remove("HiddenForTinyModal");const n=document.createElement("dialog");n.classList.add("TinyModal");const a=document.createElement("button");a.classList.add("TinyModal-closeBtn"),n.appendChild(a);const s=document.createElement("div");s.classList.add("TinyModal-wrapper"),s.appendChild(o instanceof HTMLTemplateElement?o.content.cloneNode(!0):o),n.appendChild(s),document.body.appendChild(n);const i=new Map;function l(h,g){i.has(h)||i.set(h,[]),i.get(h)?.push(g)}function c(h){i.has(h)&&i.get(h)?.forEach((g=>g()))}function d(){n.showModal(),document.body.style.overflow="hidden",c("open")}function m(){n.close()}return r?.addEventListener("click",d),a.addEventListener("click",m),n.addEventListener("close",(()=>{document.body.style.overflow="",c("close")})),{open:d,close:m,on:l}}var an=S("<input class=SearchForm-input type=search required>"),sn=S("<div class=SearchOpener><form class=SearchForm><button class=SearchForm-btn type=submit>");function cn({searchURL:e,language:t}){const[r,o]=A(""),{t:n}=z(t),a=(()=>{var i=an();return i.addEventListener("change",(l=>o(l.currentTarget.value))),F((()=>K(i,"placeholder",n("searchApp.search")))),F((()=>i.value=r())),i})(),s=i=>{i.preventDefault(),window.location.href=`${e}#/q/${encodeURIComponent(r())}`};return ne((()=>{a.focus()})),(()=>{var i=sn(),l=i.firstChild,c=l.firstChild;return l.addEventListener("submit",s),E(l,a,c),E(c,(()=>n("searchApp.search"))),i})()}var ln=S('<button type=button class=SearchOpenerBtn><svg class=SearchOpenerBtn-svg width=20 height=20 version=1.1 id=Capa_1 xmlns=http://www.w3.org/2000/svg viewBox="0 0 490.4 490.4"><title>Search Icon</title><g id=SVGRepo_bgCarrier stroke-width=0></g><g id=SVGRepo_tracerCarrier stroke-linecap=round stroke-linejoin=round></g><g id=SVGRepo_iconCarrier><g><path d="M484.1,454.796l-110.5-110.6c29.8-36.3,47.6-82.8,47.6-133.4c0-116.3-94.3-210.6-210.6-210.6S0,94.496,0,210.796 s94.3,210.6,210.6,210.6c50.8,0,97.4-18,133.8-48l110.5,110.5c12.9,11.8,25,4.2,29.2,0C492.5,475.596,492.5,463.096,484.1,454.796z M41.1,210.796c0-93.6,75.9-169.5,169.5-169.5s169.6,75.9,169.6,169.5s-75.9,169.5-169.5,169.5S41.1,304.396,41.1,210.796z"></path> ');function un({searchIconColor:e,language:t,searchURL:r}){const o=(()=>{var a=ln(),s=a.firstChild;return e!=null?s.style.setProperty("fill",e):s.style.removeProperty("fill"),a})(),n=$(cn,{searchURL:r,language:t});return on({openButton:o,dialogContent:n}),o}function dn(e,{language:t}){const r=e.dataset.searchUrl,o=e.dataset.iconColor;if(!t)throw new Error("Missing language");if(!r)throw new Error("Missing search url");ge((()=>$(un,{language:t,searchURL:r,searchIconColor:o})),e)}document.addEventListener("DOMContentLoaded",(()=>{const e=document.documentElement.lang,t={searchOpener:dn,searchForm:rn,infiniteLoading:pt},r=document.querySelectorAll("[data-effect]");for(const o of r){const n=o.dataset.effect;if(!n)continue;const a=t[n];a&&a(o,{language:e})}}));
|
|
1
|
+
import{delegateEvents as re,template as E,insert as L,setAttribute as z,isServer as T,getRequestEvent as Y,createComponent as S,memo as Z,effect as K,render as pe}from"https://esm.sh/solid-js@1.9.5/web";import{createMemo as R,getOwner as me,runWithOwner as ge,useContext as we,createContext as ye,createSignal as A,createRenderEffect as We,on as N,startTransition as Ve,resetErrorBoundaries as He,batch as Ke,untrack as ve,createComponent as ze,children as be,mergeProps as Ge,Show as k,createRoot as Je,onCleanup as Se,sharedConfig as J,createEffect as $e}from"https://esm.sh/solid-js@1.9.5";function ee(e){return e.varName?` for '${e.varName}'`:""}function Qe(e){return!isNaN(e)&&!isNaN(parseFloat(e))}function Xe(e,t={}){if(e==null||e===""&&!t.allowEmpty)throw new Error(`Missing string value${ee(t)}`);return typeof e=="string"?e:e.toString()}function W(e,t={}){return e==null||e===""&&!t.allowEmpty?void 0:Xe(e,t)}function Ye(e,t={}){if(typeof e=="number")return e;if(e==null)throw new Error(`Missing number value${ee(t)}`);if(typeof e=="string"&&Qe(e))return Number(e);throw new Error(`Cannot convert to number the value of type '${typeof e}'${ee(t)}`)}function V(e,t={}){return e==null?void 0:Ye(e,t)}function Ze(e){let t=e;const r=t.indexOf("?");r!==-1&&(t=t.substring(0,r));const o=t.indexOf("#");o!==-1&&(t=t.substring(0,o));const n=t.lastIndexOf("/");return n===-1?void 0:t.slice(0,n)}const Pe="/api/plugin/content-loading",Le=Ze(import.meta.url);async function et(e){const t=`${Pe}${e}`,r=await fetch(t);if(r.status!==200)throw new Error(`api error ${r.status}`);return await r.text()}function te(e){const t=document.createElement("div");return t.innerHTML=e,[...t.children]}const Ee=e=>e!=null&&(e=Object.getPrototypeOf(e),e===Array.prototype||e===Object.prototype);function Re(e,t,r){for(const[o,n]of Object.entries(t)){const a=`${r}.${o}`;e[a]=n,Ee(n)&&Re(e,n,a)}}function tt(e){const t={...e};for(const[r,o]of Object.entries(e))Ee(o)&&Re(t,o,r);return t}const nt=(e,t)=>{if(t)for(const[r,o]of Object.entries(t))e=e.replace(new RegExp(`{{\\s*${r}\\s*}}`,"g"),o);return e},rt=e=>e;function ot(e,t=rt){return(r,...o)=>{r[0]==="."&&(r=r.slice(1));const n=e()?.[r];switch(typeof n){case"function":return n(...o);case"string":return t(n,o[0]);default:return n}}}const at={nothingMessage:"No results found for",search:"Search"},st={loadMore:"Load more"},it={searchApp:at,infiniteLoading:st},ct={nothingMessage:"Aucun résultat trouvé pour",search:"Rechercher"},lt={loadMore:"Charger la suite"},ut={searchApp:ct,infiniteLoading:lt},ue={en:it,fr:ut};function G(e){const t=R((()=>{const o=e in ue?e:"en";return tt(ue[o])}));return{t:ot(t,nt)}}var dt=E('<button class="PaInfiniteLoading-loadButton PaButton"type=button>'),ft=E("<div class=PaInfiniteLoading-loadMore>"),ht=E('<img class="PaInfiniteLoading-loading PaLoading"width=50 height=50 alt=…>');function pt(e,{language:t}){const r=V(e.dataset.start),o=V(e.dataset.total),n=V(e.dataset.limit),a=W(e.dataset.parentId),s=W(e.dataset.template),i=W(e.dataset.labeledById);if(!(r===void 0||o===void 0||a===void 0||n===void 0||s===void 0)){if(!t)throw new Error("Missing language");mt({language:t,limit:n,parentId:a,root:e,start:r,total:o,templateName:s,labeledById:i})}}function mt({language:e,limit:t,root:r,start:o,total:n,parentId:a,templateName:s,labeledById:i}){const{t:c}=G(e);let l=o;if(l>=n)return;const f=(()=>{var m=dt();return m.$$click=p,L(m,(()=>c("infiniteLoading.loadMore"))),m})(),w=(()=>{var m=ft();return L(m,f),m})(),h=(()=>{var m=ht();return z(m,"src",`${Le}/spinner.svg`),m})();r.appendChild(w);async function p(){r.appendChild(h);const m=await gt({limit:t,newStart:l,parentId:a,templateName:s,labeledById:i});for(const u of m)r.insertBefore(u,w);l+=t,l>=n&&w.remove(),h.remove()}}async function gt({limit:e,newStart:t,parentId:r,templateName:o,labeledById:n}){const a=n?`?labeled=${encodeURIComponent(n)}`:"",s=`/partials?templateName=${encodeURIComponent(o)}&children-of=${encodeURIComponent(r)}&start=${encodeURIComponent(t)}&limit=${encodeURIComponent(e)}${a}`,i=await et(s);return te(i)}re(["click"]);function Ae(){let e=new Set;function t(n){return e.add(n),()=>e.delete(n)}let r=!1;function o(n,a){if(r)return!(r=!1);const s={to:n,options:a,defaultPrevented:!1,preventDefault:()=>s.defaultPrevented=!0};for(const i of e)i.listener({...s,from:i.location,retry:c=>{c&&(r=!0),i.navigate(n,{...a,resolve:!1})}});return!s.defaultPrevented}return{subscribe:t,confirm:o}}let ne;function oe(){(!window.history.state||window.history.state._depth==null)&&window.history.replaceState({...window.history.state,_depth:window.history.length-1},""),ne=window.history.state._depth}T||oe();function wt(e){return{...e,_depth:window.history.state&&window.history.state._depth}}function yt(e,t){let r=!1;return()=>{const o=ne;oe();const n=o==null?null:ne-o;if(r){r=!1;return}n&&t(n)?(r=!0,window.history.go(-n)):e()}}const vt=/^(?:[a-z0-9]+:)?\/\//i,bt=/^\/+|(\/)\/+$/g,Ce="http://sr";function F(e,t=!1){const r=e.replace(bt,"$1");return r?t||/^[?#]/.test(r)?r:"/"+r:""}function H(e,t,r){if(vt.test(t))return;const o=F(e),n=r&&F(r);let a="";return!n||t.startsWith("/")?a=o:n.toLowerCase().indexOf(o.toLowerCase())!==0?a=o+n:a=n,(a||"/")+F(t,!a)}function St(e,t){if(e==null)throw new Error(t);return e}function $t(e,t){return F(e).replace(/\/*(\*.*)?$/g,"")+F(t)}function _e(e){const t={};return e.searchParams.forEach(((r,o)=>{o in t?Array.isArray(t[o])?t[o].push(r):t[o]=[t[o],r]:t[o]=r})),t}function Pt(e,t,r){const[o,n]=e.split("/*",2),a=o.split("/").filter(Boolean),s=a.length;return i=>{const c=i.split("/").filter(Boolean),l=c.length-s;if(l<0||l>0&&n===void 0&&!t)return null;const f={path:s?"":"/",params:{}},w=h=>r===void 0?void 0:r[h];for(let h=0;h<s;h++){const p=a[h],m=p[0]===":",u=m?c[h]:c[h].toLowerCase(),d=m?p.slice(1):p.toLowerCase();if(m&&Q(u,w(d)))f.params[d]=u;else if(m||!Q(u,d))return null;f.path+=`/${u}`}if(n){const h=l?c.slice(-l).join("/"):"";if(Q(h,w(n)))f.params[n]=h;else return null}return f}}function Q(e,t){const r=o=>o===e;return t===void 0?!0:typeof t=="string"?r(t):typeof t=="function"?t(e):Array.isArray(t)?t.some(r):t instanceof RegExp?t.test(e):!1}function Lt(e){const[t,r]=e.pattern.split("/*",2),o=t.split("/").filter(Boolean);return o.reduce(((n,a)=>n+(a.startsWith(":")?2:3)),o.length-(r===void 0?0:1))}function xe(e){const t=new Map,r=me();return new Proxy({},{get(o,n){return t.has(n)||ge(r,(()=>t.set(n,R((()=>e()[n]))))),t.get(n)()},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},ownKeys(){return Reflect.ownKeys(e())}})}function Ie(e){let t=/(\/?\:[^\/]+)\?/.exec(e);if(!t)return[e];let r=e.slice(0,t.index),o=e.slice(t.index+t[0].length);const n=[r,r+=t[1]];for(;t=/^(\/\:[^\/]+)\?/.exec(o);)n.push(r+=t[1]),o=o.slice(t[0].length);return Ie(o).reduce(((a,s)=>[...a,...n.map((i=>i+s))]),[])}const Et=100,Oe=ye(),Ue=ye(),ae=()=>St(we(Oe),"<A> and 'use' router primitives can be only used inside a Route."),Me=()=>ae().navigatorFactory(),Rt=()=>ae().location,At=()=>ae().params;function Ct(e,t=""){const{component:r,preload:o,load:n,children:a,info:s}=e,i=!a||Array.isArray(a)&&!a.length,c={key:e,component:r,preload:o||n,info:s};return ke(e.path).reduce(((l,f)=>{for(const w of Ie(f)){const h=$t(t,w);let p=i?h:h.split("/*",1)[0];p=p.split("/").map((m=>m.startsWith(":")||m.startsWith("*")?m:encodeURIComponent(m))).join("/"),l.push({...c,originalPath:f,pattern:p,matcher:Pt(p,!i,e.matchFilters)})}return l}),[])}function _t(e,t=0){return{routes:e,score:Lt(e[e.length-1])*1e4-t,matcher(r){const o=[];for(let n=e.length-1;n>=0;n--){const a=e[n],s=a.matcher(r);if(!s)return null;o.unshift({...s,route:a})}return o}}}function ke(e){return Array.isArray(e)?e:[e]}function Be(e,t="",r=[],o=[]){const n=ke(e);for(let a=0,s=n.length;a<s;a++){const i=n[a];if(i&&typeof i=="object"){i.hasOwnProperty("path")||(i.path="");const c=Ct(i,t);for(const l of c){r.push(l);const f=Array.isArray(i.children)&&i.children.length===0;if(i.children&&!f)Be(i.children,l.pattern,r,o);else{const w=_t([...r],o.length);o.push(w)}r.pop()}}}return r.length?o:o.sort(((a,s)=>s.score-a.score))}function q(e,t){for(let r=0,o=e.length;r<o;r++){const n=e[r].matcher(t);if(n)return n}return[]}function xt(e,t,r){const o=new URL(Ce),n=R((f=>{const w=e();try{return new URL(w,o)}catch{return console.error(`Invalid path ${w}`),f}}),o,{equals:(f,w)=>f.href===w.href}),a=R((()=>n().pathname)),s=R((()=>n().search),!0),i=R((()=>n().hash)),c=()=>"",l=N(s,(()=>_e(n())));return{get pathname(){return a()},get search(){return s()},get hash(){return i()},get state(){return t()},get key(){return c()},query:r?r(l):xe(l)}}let x;function It(){return x}function Ot(e,t,r,o={}){const{signal:[n,a],utils:s={}}=e,i=s.parsePath||(g=>g),c=s.renderPath||(g=>g),l=s.beforeLeave||Ae(),f=H("",o.base||"");if(f===void 0)throw new Error(`${f} is not a valid base path`);f&&!n().value&&a({value:f,replace:!0,scroll:!1});const[w,h]=A(!1);let p;const m=(g,v)=>{v.value===u()&&v.state===y()||(p===void 0&&h(!0),x=g,p=v,Ve((()=>{p===v&&(d(p.value),b(p.state),He(),T||_[1]((P=>P.filter((I=>I.pending)))))})).finally((()=>{p===v&&Ke((()=>{x=void 0,g==="navigate"&&Ne(p),h(!1),p=void 0}))})))},[u,d]=A(n().value),[y,b]=A(n().state),$=xt(u,y,s.queryWrapper),C=[],_=A(T?De():[]),B=R((()=>typeof o.transformUrl=="function"?q(t(),o.transformUrl($.pathname)):q(t(),$.pathname))),se=()=>{const g=B(),v={};for(let P=0;P<g.length;P++)Object.assign(v,g[P].params);return v},Te=s.paramsWrapper?s.paramsWrapper(se,t):xe(se),ie={pattern:f,path:()=>f,outlet:()=>null,resolvePath(g){return H(f,g)}};return We(N(n,(g=>m("native",g)),{defer:!0})),{base:ie,location:$,params:Te,isRouting:w,renderPath:c,parsePath:i,navigatorFactory:qe,matches:B,beforeLeave:l,preloadRoute:je,singleFlight:o.singleFlight===void 0?!0:o.singleFlight,submissions:_};function Fe(g,v,P){ve((()=>{if(typeof v=="number"){v&&(s.go?s.go(v):console.warn("Router integration does not support relative routing"));return}const I=!v||v[0]==="?",{replace:j,resolve:O,scroll:D,state:U}={replace:!1,resolve:!I,scroll:!0,...P},M=O?g.resolvePath(v):H(I&&$.pathname||"",v);if(M===void 0)throw new Error(`Path '${v}' is not a routable path`);if(C.length>=Et)throw new Error("Too many redirects");const ce=u();if(M!==ce||U!==y())if(T){const le=Y();le&&(le.response={status:302,headers:new Headers({Location:M})}),a({value:M,replace:j,scroll:D,state:U})}else l.confirm(M,P)&&(C.push({value:ce,replace:j,scroll:D,state:y()}),m("navigate",{value:M,state:U}))}))}function qe(g){return g=g||we(Ue)||ie,(v,P)=>Fe(g,v,P)}function Ne(g){const v=C[0];v&&(a({...g,replace:v.replace,scroll:v.scroll}),C.length=0)}function je(g,v){const P=q(t(),g.pathname),I=x;x="preload";for(let j in P){const{route:O,params:D}=P[j];O.component&&O.component.preload&&O.component.preload();const{preload:U}=O;v&&U&&ge(r(),(()=>U({params:D,location:{pathname:g.pathname,search:g.search,hash:g.hash,query:_e(g),state:null,key:""},intent:"preload"})))}x=I}function De(){const g=Y();return g&&g.router&&g.router.submission?[g.router.submission]:[]}}function Ut(e,t,r,o){const{base:n,location:a,params:s}=e,{pattern:i,component:c,preload:l}=o().route,f=R((()=>o().path));c&&c.preload&&c.preload();const w=l?l({params:s,location:a,intent:x||"initial"}):void 0;return{parent:t,pattern:i,path:f,outlet:()=>c?ze(c,{params:s,location:a,data:w,get children(){return r()}}):r(),resolvePath(p){return H(n.path(),p,f())}}}const Mt=e=>t=>{const{base:r}=t,o=be((()=>t.children)),n=R((()=>Be(o(),t.base||"")));let a;const s=Ot(e,n,(()=>a),{base:r,singleFlight:t.singleFlight,transformUrl:t.transformUrl});return e.create&&e.create(s),S(Oe.Provider,{value:s,get children(){return S(kt,{routerState:s,get root(){return t.root},get preload(){return t.rootPreload||t.rootLoad},get children(){return[Z((()=>(a=me())&&null)),S(Bt,{routerState:s,get branches(){return n()}})]}})}})};function kt(e){const t=e.routerState.location,r=e.routerState.params,o=R((()=>e.preload&&ve((()=>{e.preload({params:r,location:t,intent:It()||"initial"})}))));return S(k,{get when(){return e.root},keyed:!0,get fallback(){return e.children},children:n=>S(n,{params:r,location:t,get data(){return o()},get children(){return e.children}})})}function Bt(e){if(T){const n=Y();if(n&&n.router&&n.router.dataOnly){Tt(n,e.routerState,e.branches);return}n&&((n.router||(n.router={})).matches||(n.router.matches=e.routerState.matches().map((({route:a,path:s,params:i})=>({path:a.originalPath,pattern:a.pattern,match:s,params:i,info:a.info})))))}const t=[];let r;const o=R(N(e.routerState.matches,((n,a,s)=>{let i=a&&n.length===a.length;const c=[];for(let l=0,f=n.length;l<f;l++){const w=a&&a[l],h=n[l];s&&w&&h.route.key===w.route.key?c[l]=s[l]:(i=!1,t[l]&&t[l](),Je((p=>{t[l]=p,c[l]=Ut(e.routerState,c[l-1]||e.routerState.base,de((()=>o()[l+1])),(()=>e.routerState.matches()[l]))})))}return t.splice(n.length).forEach((l=>l())),s&&i?s:(r=c[0],c)})));return de((()=>o()&&r))()}const de=e=>()=>S(k,{get when(){return e()},keyed:!0,children:t=>S(Ue.Provider,{value:t,get children(){return t.outlet()}})}),X=e=>{const t=be((()=>e.children));return Ge(e,{get children(){return t()}})};function Tt(e,t,r){const o=new URL(e.request.url),n=q(r,new URL(e.router.previousUrl||e.request.url).pathname),a=q(r,o.pathname);for(let s=0;s<a.length;s++){(!n[s]||a[s].route!==n[s].route)&&(e.router.dataOnly=!0);const{route:i,params:c}=a[s];i.preload&&i.preload({params:c,location:t.location,intent:"preload"})}}function Ft([e,t],r,o){return[e,o?n=>t(o(n)):t]}function qt(e){let t=!1;const r=n=>typeof n=="string"?{value:n}:n,o=Ft(A(r(e.get()),{equals:(n,a)=>n.value===a.value&&n.state===a.state}),void 0,(n=>(!t&&e.set(n),J.registry&&!J.done&&(J.done=!0),n)));return e.init&&Se(e.init(((n=e.get())=>{t=!0,o[1](r(n)),t=!1}))),Mt({signal:o,create:e.create,utils:e.utils})}function Nt(e,t,r){return e.addEventListener(t,r),()=>e.removeEventListener(t,r)}function jt(e,t){const r=e&&document.getElementById(e);r?r.scrollIntoView():t&&window.scrollTo(0,0)}const Dt=new Map;function Wt(e=!0,t=!1,r="/_server",o){return n=>{const a=n.base.path(),s=n.navigatorFactory(n.base);let i,c;function l(u){return u.namespaceURI==="http://www.w3.org/2000/svg"}function f(u){if(u.defaultPrevented||u.button!==0||u.metaKey||u.altKey||u.ctrlKey||u.shiftKey)return;const d=u.composedPath().find((B=>B instanceof Node&&B.nodeName.toUpperCase()==="A"));if(!d||t&&!d.hasAttribute("link"))return;const y=l(d),b=y?d.href.baseVal:d.href;if((y?d.target.baseVal:d.target)||!b&&!d.hasAttribute("state"))return;const C=(d.getAttribute("rel")||"").split(/\s+/);if(d.hasAttribute("download")||C&&C.includes("external"))return;const _=y?new URL(b,document.baseURI):new URL(b);if(!(_.origin!==window.location.origin||a&&_.pathname&&!_.pathname.toLowerCase().startsWith(a.toLowerCase())))return[d,_]}function w(u){const d=f(u);if(!d)return;const[y,b]=d,$=n.parsePath(b.pathname+b.search+b.hash),C=y.getAttribute("state");u.preventDefault(),s($,{resolve:!1,replace:y.hasAttribute("replace"),scroll:!y.hasAttribute("noscroll"),state:C?JSON.parse(C):void 0})}function h(u){const d=f(u);if(!d)return;const[y,b]=d;n.preloadRoute(b,y.getAttribute("preload")!=="false")}function p(u){clearTimeout(i);const d=f(u);if(!d)return c=null;const[y,b]=d;c!==y&&(i=setTimeout((()=>{n.preloadRoute(b,y.getAttribute("preload")!=="false"),c=y}),20))}function m(u){if(u.defaultPrevented)return;let d=u.submitter&&u.submitter.hasAttribute("formaction")?u.submitter.getAttribute("formaction"):u.target.getAttribute("action");if(!d)return;if(!d.startsWith("https://action/")){const b=new URL(d,Ce);if(d=n.parsePath(b.pathname+b.search),!d.startsWith(r))return}if(u.target.method.toUpperCase()!=="POST")throw new Error("Only POST forms are supported for Actions");const y=Dt.get(d);if(y){u.preventDefault();const b=new FormData(u.target,u.submitter);y.call({r:n,f:u.target},u.target.enctype==="multipart/form-data"?b:new URLSearchParams(b))}}re(["click","submit"]),document.addEventListener("click",w),e&&(document.addEventListener("mousemove",p,{passive:!0}),document.addEventListener("focusin",h,{passive:!0}),document.addEventListener("touchstart",h,{passive:!0})),document.addEventListener("submit",m),Se((()=>{document.removeEventListener("click",w),e&&(document.removeEventListener("mousemove",p),document.removeEventListener("focusin",h),document.removeEventListener("touchstart",h)),document.removeEventListener("submit",m)}))}}function Vt(e){const t=e.replace(/^.*?#/,"");if(!t.startsWith("/")){const[,r="/"]=window.location.hash.split("#",2);return`${r}#${t}`}return t}function Ht(e){const t=()=>window.location.hash.slice(1),r=Ae();return qt({get:t,set({value:o,replace:n,scroll:a,state:s}){n?window.history.replaceState(wt(s),"","#"+o):window.history.pushState(s,"","#"+o);const i=o.indexOf("#"),c=i>=0?o.slice(i+1):"";jt(c,a),oe()},init:o=>Nt(window,"hashchange",yt(o,(n=>!r.confirm(n&&n<0?n:t())))),create:Wt(e.preload,e.explicitLinks,e.actionBase),utils:{go:o=>window.history.go(o),renderPath:o=>`#${o}`,parsePath:Vt,beforeLeave:r}})(e)}function Kt(e){const t=Me(),r=Rt(),{href:o,state:n}=e,a=typeof o=="function"?o({navigate:t,location:r}):o;return t(a,{replace:!0,state:n}),null}async function fe({language:e,text:t,limit:r,start:o,templateName:n}){const a=`${Pe}/search?language=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}&limit=${encodeURIComponent(r)}&start=${encodeURIComponent(o)}&tpl=${encodeURIComponent(n)}`,s=await fetch(a,{method:"GET"});if(s.status!==200){const c=await s.text();throw new Error(`API error (${s.status}): ${c}`)}return await s.json()}var zt=E('<form class=PaSearchApp-form><input class="PaSearchApp-input PaInput"type=search><button class="PaSearchApp-searchButton PaButton"type=submit>');function Gt(e){const t=Me(),[r,o]=A(e.value??""),{t:n}=G(e.language);$e(N((()=>e.value),(()=>o(e.value??""))));const a=async s=>{s.preventDefault(),t(`/q/${encodeURIComponent(r())}`)};return(()=>{var s=zt(),i=s.firstChild,c=i.nextSibling;return s.addEventListener("submit",a),i.addEventListener("change",(l=>o(l.currentTarget.value))),L(c,(()=>n("searchApp.search"))),K((()=>z(i,"placeholder",n("searchApp.search")))),K((()=>i.value=r())),s})()}var Jt=E("<div class=PaSearchApp-loadMore>"),Qt=E("<div class=PaSearchApp-results>"),Xt=E("<div class=PaSearchApp>"),Yt=E("<div class=PaSearchApp-nothing> <span class=PaSearchApp-quote>"),Zt=E('<img class="PaSearchApp-loading PaLoading"width=80 height=80 alt=…>'),en=E('<button class="PaSearchApp-loadButton PaButton"type=button>');function he({language:e,limit:t,templateName:r}){const{t:o}=G(e),n=At(),[a,s]=A([]),[i,c]=A(-1),[l,f]=A(0),[w,h]=A(!1);$e(N((()=>n.searchString),p));async function p(){if(n.searchString){h(!0);try{s([]),f(0),c(-1);const u=await fe({language:e,text:decodeURIComponent(n.searchString),limit:t,start:l(),templateName:r});if(c(u.total),f(l()+t),!u.html)return;s(te(u.html))}finally{h(!1)}}}async function m(){if(!n.searchString)return;const u=i();if(!(u===-1||l()>=u)){h(!0);try{const d=await fe({language:e,text:decodeURIComponent(n.searchString),limit:t,start:l(),templateName:r});if(!d.html)return;s([...a(),...te(d.html)]),f(l()+t)}finally{h(!1)}}}return(()=>{var u=Xt();return L(u,S(Gt,{language:e,get value(){return Z((()=>!!n.searchString))()?decodeURIComponent(n.searchString):void 0}}),null),L(u,S(k,{get when(){return n.searchString},get children(){var d=Qt();return L(d,S(k,{get when(){return i()!==-1},get children(){return S(k,{get when(){return a().length>0},get fallback(){return(()=>{var y=Yt(),b=y.firstChild,$=b.nextSibling;return L(y,(()=>o("searchApp.nothingMessage")),b),L($,(()=>n.searchString)),y})()},get children(){return a()}})}}),null),L(d,S(k,{get when(){return i()===-1||w()||l()<i()},get children(){var y=Jt();return L(y,(()=>{var b=Z((()=>!!w()));return()=>b()?(()=>{var $=Zt();return z($,"src",`${Le}/spinner.svg`),$})():(()=>{var $=en();return $.$$click=m,L($,(()=>o("infiniteLoading.loadMore"))),$})()})()),y}}),null),d}}),null),u})()}re(["click"]);function tn(e,{language:t}){if(!t)throw new Error("Missing language");const r=V(e.dataset.limit),o=W(e.dataset.template);r===void 0||o===void 0||pe((()=>S(Ht,{explicitLinks:!0,get children(){return[S(X,{path:"/",component:()=>S(Kt,{href:"/q"})}),S(X,{path:"/q",component:()=>S(he,{language:t,templateName:o,limit:r})}),S(X,{path:"/q/:searchString",component:()=>S(he,{language:t,templateName:o,limit:r})})]}})),e)}function nn({openButton:e,dialogContent:t,modalClass:r}){const o=e?typeof e=="string"?document.querySelector(e):e:void 0,n=typeof t=="string"?document.querySelector(t):t;if(!n)return;n instanceof HTMLTemplateElement||n.classList.remove("TinyModalHidden");const a=document.createElement("dialog");a.classList.add("TinyModal"),a.classList.add(r);const s=document.createElement("button");s.classList.add("TinyModal-closeButton"),a.appendChild(s);const i=document.createElement("div");i.classList.add("TinyModal-body"),i.appendChild(n instanceof HTMLTemplateElement?n.content.cloneNode(!0):n),a.appendChild(i),document.body.appendChild(a);const c=new Map;function l(p,m){c.has(p)||c.set(p,[]),c.get(p)?.push(m)}function f(p){c.has(p)&&c.get(p)?.forEach((m=>m()))}function w(){a.showModal(),document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden",f("open")}function h(){a.close()}return o?.addEventListener("click",w),s.addEventListener("click",h),a.addEventListener("close",(()=>{document.body.style.removeProperty("overflow"),document.documentElement.style.removeProperty("overflow"),f("close")})),{open:w,close:h,on:l}}var rn=E('<input class="PaSearchOpener-input PaInput"type=search required>'),on=E('<form class=PaSearchOpener><button class="PaSearchOpener-button PaButton"type=submit>');function an({searchURL:e,language:t}){const[r,o]=A(""),{t:n}=G(t),a=(()=>{var i=rn();return i.addEventListener("change",(c=>o(c.currentTarget.value))),K((()=>z(i,"placeholder",n("searchApp.search")))),K((()=>i.value=r())),i})(),s=i=>{i.preventDefault(),window.location.href=`${e}#/q/${encodeURIComponent(r())}`};return(()=>{var i=on(),c=i.firstChild;return i.addEventListener("submit",s),L(i,a,c),L(c,(()=>n("searchApp.search"))),i})()}var sn=E('<button class="PaSearchOpenerButton PaIconButton"type=button><svg class=PaSearchOpenerButton-svg width=20 height=20 version=1.1 xmlns=http://www.w3.org/2000/svg viewBox="0 0 490.4 490.4"><title>Mignifier</title><g id=SVGRepo_bgCarrier stroke-width=0></g><g id=SVGRepo_tracerCarrier stroke-linecap=round stroke-linejoin=round></g><g id=SVGRepo_iconCarrier><g><path d="M484.1,454.796l-110.5-110.6c29.8-36.3,47.6-82.8,47.6-133.4c0-116.3-94.3-210.6-210.6-210.6S0,94.496,0,210.796 s94.3,210.6,210.6,210.6c50.8,0,97.4-18,133.8-48l110.5,110.5c12.9,11.8,25,4.2,29.2,0C492.5,475.596,492.5,463.096,484.1,454.796z M41.1,210.796c0-93.6,75.9-169.5,169.5-169.5s169.6,75.9,169.6,169.5s-75.9,169.5-169.5,169.5S41.1,304.396,41.1,210.796z"></path> ');function cn({searchIconColor:e,language:t,searchURL:r}){const o=(()=>{var s=sn(),i=s.firstChild;return e!=null?i.style.setProperty("fill",e):i.style.removeProperty("fill"),s})(),n=S(an,{searchURL:r,language:t});return nn({openButton:o,dialogContent:n,modalClass:"_paSearchOpener"}).on("open",(()=>{n.querySelector("input")?.focus()})),o}function ln(e,{language:t}){const r=e.dataset.searchUrl,o=e.dataset.iconColor;if(!t)throw new Error("Missing language");if(!r)throw new Error("Missing search url");pe((()=>S(cn,{language:t,searchURL:r,searchIconColor:o})),e)}document.addEventListener("DOMContentLoaded",(()=>{const e=document.documentElement.lang,t={paSearchOpener:ln,paSearchApp:tn,paInfiniteLoading:pt},r=document.querySelectorAll("[data-effect]");for(const o of r){const n=o.dataset.effect;if(!n)continue;const a=t[n];a&&a(o,{language:e})}}));
|