1var e=`despiece.offcutInventory.v1`,t=[`horizontal`,`vertical`,`none`];function n(e){return typeof e==`string`&&t.includes(e)}function r(e){if(!e||typeof e!=`object`)return!1;let t=e;return!(typeof t.id!=`string`||!t.id||typeof t.width!=`number`||!Number.isFinite(t.width)||t.width<=0||typeof t.height!=`number`||!Number.isFinite(t.height)||t.height<=0||typeof t.thickness!=`number`||!Number.isFinite(t.thickness)||t.thickness<=0||typeof t.material!=`string`||!n(t.grain)||typeof t.sourceProject!=`string`||typeof t.createdAt!=`number`||!Number.isFinite(t.createdAt)||typeof t.qty!=`number`||!Number.isFinite(t.qty)||t.qty<1)}function i(){if(typeof localStorage>`u`)return[];try{let t=localStorage.getItem(e);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(r):[]}catch(e){return console.warn(`[offcut-inventory] load failed`,e),[]}}function a(t){if(!(typeof localStorage>`u`))try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.warn(`[offcut-inventory] save failed`,e)}}function o(){return`inv_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function s(e,t,n){let r=n?.now??Date.now(),i=(n?.sourceProject??`nest`).trim()||`nest`,a=e.map(e=>({...e}));for(let e of t){let t=Math.max(e.width,e.height),n=Math.min(e.width,e.height),s=(e.material??``).trim(),c=e.grain??`none`,l=e.thickness,u=Math.max(1,Math.floor(e.quantity||1)),d=a.find(e=>e.width===t&&e.height===n&&e.thickness===l&&e.material===s&&e.grain===c);if(d){d.qty+=u;continue}a.push({id:o(),width:t,height:n,thickness:l,material:s,grain:c,sourceProject:(e.sourceProject??i).trim()||i,createdAt:e.createdAt??r,qty:u})}return a}function c(e,t){return e.filter(e=>e.id!==t)}function l(e){return e.map(e=>({id:`stock_${e.id}`,label:`Retazo ${e.width}Ã${e.height} · ${e.thickness}mm`,width:e.width,height:e.height,thickness:e.thickness,grain:e.grain,quantity:Math.max(1,Math.floor(e.qty)),material:e.material,kind:`offcut`,sourceProject:e.sourceProject,createdAt:e.createdAt}))}function u(e,t){let n=[...e];for(let e of t){let t=n.findIndex(t=>t.id===e.id);t>=0?n[t]=e:n.push(e)}return n}function d(e){let t=e(i());return a(t),t}export{u as a,a as c,i,s as n,d as o,l as r,c as s,e as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.